diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index a62cda94707e..291b041846a6 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -183,6 +183,7 @@ com.azure:azure-storage-blob-batch;12.26.0;12.27.0-beta.1 com.azure:azure-storage-blob-changefeed;12.0.0-beta.29;12.0.0-beta.30 com.azure:azure-storage-blob-cryptography;12.29.0;12.30.0-beta.1 com.azure:azure-storage-blob-nio;12.0.0-beta.30;12.0.0-beta.31 +com.azure:azure-storage-blob-v2;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-storage-common;12.29.0;12.30.0-beta.1 com.azure:azure-storage-file-share;12.26.0;12.27.0-beta.1 com.azure:azure-storage-file-datalake;12.23.0;12.24.0-beta.1 diff --git a/sdk/storage/azure-storage-blob-stress-v2/.helmignore b/sdk/storage/azure-storage-blob-stress-v2/.helmignore new file mode 100644 index 000000000000..2f7896d1d136 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/.helmignore @@ -0,0 +1 @@ +target/ diff --git a/sdk/storage/azure-storage-blob-stress-v2/Chart.yaml b/sdk/storage/azure-storage-blob-stress-v2/Chart.yaml new file mode 100644 index 000000000000..8b1496577535 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/Chart.yaml @@ -0,0 +1,14 @@ +apiVersion: v2 +name: java-storage-blob-v2 +description: Stress tests for Java Blob Storage +version: 0.1.1 +appVersion: v0.1 +annotations: + stressTest: 'true' # enable auto-discovery of this test via `find-all-stress-packages.ps1` + namespace: 'java' + # CI override to deploy to storage test environment + environment: 'storage' +dependencies: +- name: stress-test-addons + version: ~0.3.0 + repository: "@stress-test-charts" diff --git a/sdk/storage/azure-storage-blob-stress-v2/Dockerfile b/sdk/storage/azure-storage-blob-stress-v2/Dockerfile new file mode 100644 index 000000000000..ecc03058326f --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/Dockerfile @@ -0,0 +1,45 @@ +ARG REGISTRY="azsdkengsys.azurecr.io" +FROM ${REGISTRY}/java/jdk-mariner-mvn:jdk11-latest AS builder + +RUN yum -y update + +# Add necessary files to the image +RUN mkdir /stress +WORKDIR /stress +ADD ./common /stress/common +ADD ./eng /stress/eng +ADD ./sdk/clientcore /stress/sdk/clientcore +ADD ./sdk/core /stress/sdk/core +ADD ./sdk/parents /stress/sdk/parents +ADD ./sdk/storage /stress/sdk/storage +ADD ./sdk/tools /stress/sdk/tools + +# Build storage and stress tests +ARG SKIP_CHECKS="-Dcheckstyle.skip -Dgpg.skip -Dmaven.javadoc.skip -Drevapi.skip -Dspotbugs.skip -Djacoco.skip -DskipTests -Dcodesnippet.skip -Dspotless.skip -Denforcer.skip" +RUN --mount=type=cache,target=/root/.m2 \ + mvn -f /stress/eng/code-quality-reports/pom.xml clean install && \ + mvn -f /stress/sdk/parents/azure-perf-test-parent/pom.xml clean install ${SKIP_CHECKS} && \ + mvn -f /stress/common/perf-test-core/pom.xml clean install ${SKIP_CHECKS} && \ + mvn -f /stress/sdk/tools/pom.xml clean install ${SKIP_CHECKS} && \ + mvn -f /stress/sdk/clientcore/http-okhttp3/pom.xml clean install ${SKIP_CHECKS} && \ + mvn -f /stress/sdk/core/azure-core-v2/pom.xml clean install ${SKIP_CHECKS} && \ + mvn -f /stress/sdk/storage/azure-storage-blob/pom.xml clean install ${SKIP_CHECKS} && \ + mvn -f /stress/sdk/storage/azure-storage-stress/pom.xml clean install ${SKIP_CHECKS} && \ + mvn -f /stress/sdk/parents/azure-client-sdk-parent-v2/pom.xml clean install ${SKIP_CHECKS} && \ + mvn -f /stress/sdk/storage/azure-storage-blob-v2/pom.xml clean install ${SKIP_CHECKS} && \ + mvn -f /stress/sdk/storage/azure-storage-stress-v2/pom.xml clean install ${SKIP_CHECKS} && \ + mvn -f /stress/sdk/storage/azure-storage-blob-stress-v2/pom.xml clean install ${SKIP_CHECKS} + +FROM mcr.microsoft.com/openjdk/jdk:21-mariner + +RUN yum -y update + +# Required for `ps` command to find and stop the fault injector process +RUN yum install -y procps + +# Copy target files from builder image +WORKDIR /app +COPY --from=builder /stress/sdk/storage/azure-storage-blob-stress-v2/target . + +# This is never executed (since job yaml overrides it) +ENTRYPOINT ["bash"] diff --git a/sdk/storage/azure-storage-blob-stress-v2/README.md b/sdk/storage/azure-storage-blob-stress-v2/README.md new file mode 100644 index 000000000000..a65558b9aabe --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/README.md @@ -0,0 +1,229 @@ +# Azure Blob Storage V2 Stress Tests + +Represents stress tests for Azure Storage Blob V2 client library. + +## Running tests in stress infra + +Check out [Azure SDK Stress Test Wiki][azure_sdk_stress_test] for general information about stress tests. + +### Prerequisites + +- [Java Development Kit (JDK)][jdk_link], version 8 or later. +- [Maven][maven] +- [Docker][docker] +- [Kubectl][kubectl] +- [Helm][helm] +- [Azure CLI][azure_cli] +- [Powershell 7.0+][powershell] + +### Deploy Stress Test + +cd into `azure-sdk-for-java` root folder and run command to deploy the package to cluster: + +```shell +.\eng\common\scripts\stress-testing\deploy-stress-tests.ps1 -SearchDirectory .\sdk\storage +``` + +### Check Status + +Only the most frequently used commands are listed below. See [Deploying A Stress Test][deploy_stress_test] for more details. + +List deployed packages: + +```shell +helm list -n +``` + +the namespace usually matches your username. + +Get stress test pods and status: + +```shell +kubectl get pods -n +``` + +Get stress test pod logs: + +```shell +kubectl logs -n +# Note that we may define multiple containers (for example, `fault-injector` and `main`) +kubectl logs -n -c +``` + +If stress test pod is in `Error` status, check logs from init container: + +```shell +kubectl logs -n -c init-azure-deployer +``` + +If above command output is empty, there may have been startup failures: + +```shell +kubectl describe pod -n +``` + +Stop and remove deployed package: + +```shell +helm uninstall -n +``` + +### Fault injection + +## Running tests locally + +You can also run stress tests locally with or without fault-injection. +To run test locally: +1. Build `azure-storage-blob-stress-v2` jar file. For example, you can do it with: + ```powershell + cd .\sdk\storage + mvn clean install -pl .\azure-storage-stress-v2\,.\azure-storage-blob-stress-v2 + ``` + As a result, you should have fat jar in `azure-storage-blob-stress-v2\target\azure-storage-blob-stress-v2-1.0.0-beta.1-jar-with-dependencies.jar` +2. Configure environment: + - Set `STORAGE_CONNECTION_STRING`environment variable (connection string to storage account). You may also provide it with `--cs` command line option + - Configure Application Insights: + - Set `APPLICATIONINSIGHTS_CONNECTION_STRING` (connection string to application insights). You may also provide it in any other + way mentioned in the [Enable Application Insights steps][enable_application_insights] + - Set `APPLICATIONINSIGHTS_ROLE_NAME` to `storage-{ random string }` (for example, `storage-foobar`). +3. Run the test, for example, with: + ```powershell + java -javaagent:path\to\applicationinsights-agent.jar ` + -jar .\azure-storage-blob-stress-v2\target\azure-storage-blob-stress-v2-1.0.0-beta.1-jar-with-dependencies.jar ` + downloadtofile --duration 10 --size 1024 --parallel 2 --warmup 0 + ``` + +### Running locally with fault-injection + +If you want to run test with fault-injection locally, you'd need to run fault-injector first: + +1. Install [HTTP fault-injector][http-fault-injector] tool: + ```powershell + dotnet tool install azure.sdk.tools.httpfaultinjector --global --prerelease --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json + ``` + It uses .NET 6, so you might need to install it first. + + You might also need to trust development certificates: + ```powershell + dotnet dev-certs https --trust + ``` +2. Run fault-injector: + ```powershell + http-fault-injector + ``` +3. Then you can run stress test with `--faults` option: + ```powershell + java -javaagent:path\to\applicationinsights-agent.jar ` + -jar .\azure-storage-blob-stress-v2\target\azure-storage-blob-stress-v2-1.0.0-beta.1-jar-with-dependencies.jar ` + downloadtofile --duration 10 --size 1024 --parallel 2 --warmup 0 --faults + ``` + +### Checking test results + +To get a super-quick idea about test results, look for a log record that looks like this: + +```log +14:49:05.219 [main] INFO c.a.s.blob.stress.DownloadToFile - {"az.sdk.message":"test finished","scenarioName":"com.azure.v2.storage.blob.stress.DownloadToFile", + "succeeded":468,"failed":0} +``` + +After the stress test is deployed on the cluster, we can monitor the progress on the Application Insights resource inside the stress test resource group. +There are several dashboards within the stress test resource group that we can use to monitor the AKS pod and stress test status. + +#### Stress Test Dashboard + +General-purpose stress test dashboard is available at https://aka.ms/azsdk/stress/dashboard. It shows: +- Pod status events +- CPU and memory utilization of the stress test pods +- Container logs and events + +Stress test dashboard does not know about local stress test runs. + +#### Application Insights + +Application Insights agent brings rich monitoring experience including: +- resource utilization metrics (CPU, memory, GC, threads, etc.) +- live metrics, performance overview, etc +- distributed tracing and dependency calls (HTTP, Azure SDK calls) +- exceptions and logs +- profiling in production + +Application Insights is useful to: +- monitor and compare throughput and latency across runs +- investigate issues and find bottlenecks + +Application Insights is available for local runs (as long as you provide `-javaagent` option and make sure connection string is configured). + +##### Stress test workbook + +Storage stress test workbook is available [here][storage-workbook] and allows to pick a specific run and see it's summary: +1. Key test parameters +2. Throughput and latency charts +3. Failed operations including their status and fault injected (if any) +4. CPU and memory usage +5. Errors/warnings and exceptions in logs + +The workbook relies on tests to emit: +- certain logs in a specific format produced by [TelemetryHelper][telemetry-helper] class +- certain spans produced in [BlobScenarioBase][blob-scenario-base] class. +- report cloud role name that follows `storage-{runId}` pattern. + Make sure to set `APPLICATIONINSIGHTS_ROLE_NAME` environment variable accordingly to make sure run appears on the dashboard. + +_Note: some failures are expected and there is no clear 'success' criteria for the stress test_ + +Here are a few things that clearly indicate an issue: +- Content mismatch - they can be detected in following ways: + - workbook shows that some operations has failed with `content mismatch` status + - you see error logs like `{"az.sdk.message":"mismatched crc"...}`. Such logs have some additional context to investigate (content length, first 1024 bytes of it). +- Throughput is noticeably lower than for previous runs with the similar parameters. This would normally correlate with latency being higher than usual. +- CPU/memory consumption is noticeably higher than for previous runs with the similar parameters + +### Logging + +We use [logback.xml][logback_xml] to configure the logging. By default, the stress test run on cluster will output +`INFO` level log which you may adjust based on your needs. + +The [storage workbook](#stress-test-workbook) needs `com.azure.v2.storage.blob.stress` and `com.azure.v2.storage.stress` to stay at the `INFO` level. + +You may also control the verbosity of logs that go to Application Insights - see [Application Insights logging configuration][application-insights-logging] for more details. + +See also [Logging in Azure SDK][logging-azure-sdk] for more details. + +## Key concepts + +### Project Structure + +See [Layout][stress_test_layout] section for details. + +Below is the current structure of project: +``` +. +├── src/ # Test code +├── templates/ # A directory of helm templates that will generate Kubernetes manifest files. +├── Chart.yaml # A YAML file containing information about the helm chart and its dependencies +├── scenarios-matrix.yaml # A YAML file containing configuration and custom values for stress test(s) +├── Dockerfile # A Dockerfile for building the stress test image +├── stress-test-resources.bicep # An Azure Bicep for deploying stress test azure resources +├── pom.xml +└── README.md +``` + + +[azure_sdk_stress_test]: https://aka.ms/azsdk/stress +[jdk_link]: https://learn.microsoft.com/java/azure/jdk/?view=azure-java-stable +[maven]: https://maven.apache.org/ +[docker]: https://docs.docker.com/get-docker/ +[kubectl]: https://kubernetes.io/docs/tasks/tools/#kubectl +[helm]: https://helm.sh/docs/intro/install/ +[azure_cli]: https://learn.microsoft.com/cli/azure/install-azure-cli +[powershell]: https://learn.microsoft.com/powershell/scripting/install/installing-powershell?view=powershell-7 +[enable_application_insights]: https://learn.microsoft.com/azure/azure-monitor/app/opentelemetry-enable?tabs=java#enable-azure-monitor-application-insights#enable-azure-monitor-application-insights +[logback_xml]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/servicebus/azure-messaging-servicebus-stress/src/main/resources/logback.xml +[deploy_stress_test]: https://github.com/Azure/azure-sdk-tools/blob/main/tools/stress-cluster/chaos/README.md#deploying-a-stress-test +[stress_test_layout]: https://github.com/Azure/azure-sdk-tools/blob/main/tools/stress-cluster/chaos/README.md#layout +[http-fault-injector]: https://github.com/Azure/azure-sdk-tools/tree/main/tools/http-fault-injector +[telemtery-helper]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/TelemetryHelper.java +[blob-scenario-base]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/BlobScenarioBase.java +[storage-workbook]: https://ms.portal.azure.com/#blade/AppInsightsExtension/UsageNotebookBlade/ComponentId/%2Fsubscriptions%2Ffaa080af-c1d8-40ad-9cce-e1a450ca5b57%2FresourceGroups%2Frg-stress-cluster-pg%2Fproviders%2FMicrosoft.Insights%2Fcomponents%2Fstress-pg-ai-s7b6dif73rup6/ConfigurationId/%2Fsubscriptions%2Ffaa080af-c1d8-40ad-9cce-e1a450ca5b57%2Fresourcegroups%2Frg-stress-cluster-pg%2Fproviders%2Fmicrosoft.insights%2Fworkbooks%2Fa6fc3414-4c15-4651-8517-6f74cbe0d0fe/Type/workbook/WorkbookTemplateName/Storage%20stress%20tests +[application-insights-logging]: https://learn.microsoft.com/azure/azure-monitor/app/java-standalone-config#autocollected-logging +[logging-azure-sdk]: https://github.com/Azure/azure-sdk-for-java/wiki/Logging-in-Azure-SDK diff --git a/sdk/storage/azure-storage-blob-stress-v2/pom.xml b/sdk/storage/azure-storage-blob-stress-v2/pom.xml new file mode 100644 index 000000000000..694458b08fa2 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/pom.xml @@ -0,0 +1,142 @@ + + + 4.0.0 + + com.azure.v2 + azure-storage-blob-stress-v2 + jar + 1.0.0-beta.1 + + + UTF-8 + UTF-8 + + + 1.8 + 1.8 + + + - + + + + + ch.qos.logback + logback-classic + 1.3.14 + + + com.azure + azure-core + 1.55.0 + + + com.azure + azure-core-http-netty + 1.15.8 + + + com.azure + azure-storage-blob + 12.30.0-beta.1 + + + com.azure + azure-storage-stress + 1.0.0-beta.1 + + + + + com.azure + azure-core-v2 + 1.0.0-beta.1 + + + io.clientcore + http-okhttp3 + 1.0.0-beta.1 + + + com.azure + azure-storage-blob-v2 + 1.0.0-beta.1 + + + com.azure.v2 + azure-storage-stress-v2 + 1.0.0-beta.1 + + + + + com.azure + azure-monitor-opentelemetry-autoconfigure + 1.0.0-beta.2 + + + io.opentelemetry.instrumentation + opentelemetry-runtime-telemetry-java8 + 2.12.0-alpha + + + io.opentelemetry.instrumentation + opentelemetry-logback-appender-1.0 + 2.12.0-alpha + + + + com.azure + azure-core-tracing-opentelemetry + 1.0.0-beta.53 + + + com.azure + azure-identity + 1.13.1 + compile + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + + package + + shade + + + ${project.artifactId}-${project.version}-jar-with-dependencies + + + + com.azure.v2.storage.blob.stress.App + + + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + + + + + + diff --git a/sdk/storage/azure-storage-blob-stress-v2/scenarios-matrix.yaml b/sdk/storage/azure-storage-blob-stress-v2/scenarios-matrix.yaml new file mode 100644 index 000000000000..225076422203 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/scenarios-matrix.yaml @@ -0,0 +1,19 @@ +matrix: + scenarios: + # this test downloads 1KB (1024 bytes), small content, no chunking + downloadcontentsmall: + testScenario: downloadcontentv2 + sync: true + sizeBytes: 1024 + downloadFaults: false + durationMin: 25 + imageBuildDir: "../../.." + + # this test downloads 50MB (1024 * 1024 * 50), large content requiring multiple requests + downloadcontentlarge: + testScenario: downloadcontentv2 + sync: true + sizeBytes: "52428800" + downloadFaults: false + durationMin: 60 + imageBuildDir: "../../.." diff --git a/sdk/storage/azure-storage-blob-stress-v2/scripts/fault-injector.sh b/sdk/storage/azure-storage-blob-stress-v2/scripts/fault-injector.sh new file mode 100644 index 000000000000..ed834fc131d6 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/scripts/fault-injector.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -ex; +dotnet dev-certs https --export-path /mnt/outputs/dev-cert.pfx; +/root/.dotnet/tools/http-fault-injector; diff --git a/sdk/storage/azure-storage-blob-stress-v2/scripts/stress-run.sh b/sdk/storage/azure-storage-blob-stress-v2/scripts/stress-run.sh new file mode 100644 index 000000000000..20a7669c46e9 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/scripts/stress-run.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -ex; +set -exa; +keytool -import -alias test -file /mnt/outputs/dev-cert.pfx -keystore ${JAVA_HOME}/lib/security/cacerts -noprompt -keypass changeit -storepass changeit; diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/App.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/App.java new file mode 100644 index 000000000000..0a65741fb002 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/App.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.perf.test.core.PerfStressProgram; +import com.azure.v2.storage.stress.TelemetryHelper; + +public class App { + public static void main(String[] args) { + TelemetryHelper.init(); + PerfStressProgram.run(new Class[]{ + DownloadContentV2.class + }, args); + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/AppendBlobOutputStream.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/AppendBlobOutputStream.java new file mode 100644 index 000000000000..3bd14eb108c3 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/AppendBlobOutputStream.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlobClient; +import com.azure.storage.blob.specialized.AppendBlobClient; +import com.azure.storage.blob.specialized.BlobOutputStream; +import com.azure.storage.stress.CrcInputStream; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.v2.storage.blob.stress.utils.OriginalContent; +import reactor.core.publisher.Mono; + +import java.io.IOException; + +import static com.azure.core.util.FluxUtil.monoError; + +public class AppendBlobOutputStream extends BlobScenarioBase { + private static final ClientLogger LOGGER = new ClientLogger(BlockBlobOutputStream.class); + private final OriginalContent originalContent = new OriginalContent(); + private final BlobClient syncClient; + private final BlobAsyncClient asyncNoFaultClient; + // this blob is used to perform normal upload in the setup phase + private final BlobAsyncClient tempSetupBlobClient; + + public AppendBlobOutputStream(StorageStressOptions options) { + super(options); + String blobName = generateBlobName(); + String tempBlobName = generateBlobName(); + + this.asyncNoFaultClient = getAsyncContainerClientNoFault().getBlobAsyncClient(blobName); + this.syncClient = getSyncContainerClient().getBlobClient(blobName); + this.tempSetupBlobClient = getAsyncContainerClientNoFault().getBlobAsyncClient(tempBlobName); + } + + @Override + protected void runInternal(Context span) throws IOException { + AppendBlobClient appendBlobClient = syncClient.getAppendBlobClient(); + + try (CrcInputStream inputStream = new CrcInputStream(originalContent.getBlobContentHead(), options.getSize()); + BlobOutputStream outputStream = appendBlobClient.getBlobOutputStream(true)) { + byte[] buffer = new byte[4096]; // Define a buffer + int bytesRead; + + // Read from the inputStream and write to the blobOutputStream + while ((bytesRead = inputStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesRead); + } + + // Ensure to close the blobOutputStream to flush any remaining data and finalize the blob. + outputStream.close(); + originalContent.checkMatch(inputStream.getContentInfo(), span).block(); + } + } + + @Override + protected Mono runInternalAsync(Context span) { + return monoError(LOGGER, new RuntimeException("getBlobOutputStream() does not exist on the async client")); + } + + @Override + public Mono setupAsync() { + return super.setupAsync() + .then(asyncNoFaultClient.getAppendBlobAsyncClient().create()) + .then(originalContent.setupBlob(tempSetupBlobClient, options.getSize())); + } + + @Override + public Mono cleanupAsync() { + return asyncNoFaultClient.delete() + .then(super.cleanupAsync()); + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/AppendBlock.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/AppendBlock.java new file mode 100644 index 000000000000..6cbefdb56fc9 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/AppendBlock.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.util.Context; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlobClient; +import com.azure.storage.blob.specialized.AppendBlobAsyncClient; +import com.azure.storage.blob.specialized.AppendBlobClient; +import com.azure.storage.stress.CrcInputStream; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.v2.storage.blob.stress.utils.OriginalContent; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.nio.ByteBuffer; + +public class AppendBlock extends BlobScenarioBase { + private final OriginalContent originalContent = new OriginalContent(); + private final BlobClient syncClient; + private final BlobAsyncClient asyncClient; + private final BlobAsyncClient asyncNoFaultClient; + // this blob is used to perform normal upload in the setup phase + private final BlobAsyncClient tempSetupBlobClient; + + public AppendBlock(StorageStressOptions options) { + super(options); + String blobName = generateBlobName(); + String tempBlobName = generateBlobName(); + + this.asyncNoFaultClient = getAsyncContainerClientNoFault().getBlobAsyncClient(blobName); + this.syncClient = getSyncContainerClient().getBlobClient(blobName); + this.asyncClient = getAsyncContainerClient().getBlobAsyncClient(blobName); + this.tempSetupBlobClient = getAsyncContainerClientNoFault().getBlobAsyncClient(tempBlobName); + } + + @Override + protected void runInternal(Context span) { + try (CrcInputStream inputStream = new CrcInputStream(originalContent.getBlobContentHead(), options.getSize())) { + AppendBlobClient appendBlobClient = syncClient.getAppendBlobClient(); + appendBlobClient.appendBlockWithResponse(inputStream, options.getSize(), null, null, null, span); + originalContent.checkMatch(inputStream.getContentInfo(), span).block(); + } + } + + @Override + protected Mono runInternalAsync(Context span) { + AppendBlobAsyncClient appendBlobAsyncClient = asyncClient.getAppendBlobAsyncClient(); + Flux byteBufferFlux = new CrcInputStream(originalContent.getBlobContentHead(), options.getSize()) + .convertStreamToByteBuffer(); + return appendBlobAsyncClient.appendBlock(byteBufferFlux, options.getSize()) + .then(originalContent.checkMatch(byteBufferFlux, span)); + } + + @Override + public Mono setupAsync() { + return super.setupAsync().then(asyncNoFaultClient.getAppendBlobAsyncClient().create()) + .then(originalContent.setupBlob(tempSetupBlobClient, options.getSize())); + } + + @Override + public Mono cleanupAsync() { + return asyncNoFaultClient.getAppendBlobAsyncClient().delete() + .then(tempSetupBlobClient.delete()) + .then(super.cleanupAsync()); + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/BlobScenarioBase.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/BlobScenarioBase.java new file mode 100644 index 000000000000..753039e07428 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/BlobScenarioBase.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.util.Context; +import com.azure.identity.DefaultAzureCredential; +import com.azure.identity.DefaultAzureCredentialBuilder; +import com.azure.perf.test.core.PerfStressTest; +import com.azure.storage.blob.BlobContainerAsyncClient; +import com.azure.storage.blob.BlobContainerClient; +import com.azure.storage.blob.BlobServiceAsyncClient; +import com.azure.storage.blob.BlobServiceClient; +import com.azure.storage.blob.BlobServiceClientBuilder; +import com.azure.storage.stress.FaultInjectingHttpPolicy; +import com.azure.storage.stress.FaultInjectionProbabilities; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.storage.stress.TelemetryHelper; +import reactor.core.publisher.Mono; + +import java.time.Instant; +import java.util.UUID; + +public abstract class BlobScenarioBase extends PerfStressTest { + private static final String CONTAINER_NAME = "stress-" + UUID.randomUUID(); + protected final TelemetryHelper telemetryHelper = new TelemetryHelper(this.getClass()); + private final BlobContainerClient syncContainerClient; + private final BlobContainerAsyncClient asyncContainerClient; + private final BlobContainerAsyncClient asyncNoFaultContainerClient; + private final BlobContainerClient syncNoFaultContainerClient; + private Instant startTime; + + public BlobScenarioBase(TOptions options) { + super(options); + + DefaultAzureCredential defaultAzureCredential = new DefaultAzureCredentialBuilder().build(); + String endpoint = options.getEndpointString(); + + BlobServiceClientBuilder clientBuilder = new BlobServiceClientBuilder() + .credential(defaultAzureCredential) + .endpoint(endpoint) + .httpLogOptions(getLogOptions()); + + BlobServiceAsyncClient asyncNoFaultClient = clientBuilder.buildAsyncClient(); + BlobServiceClient syncNoFaultClient = clientBuilder.buildClient(); + + if (options.isFaultInjectionEnabledForDownloads()) { + clientBuilder.addPolicy(new FaultInjectingHttpPolicy(true, getFaultProbabilities(), false)); + } else if (options.isFaultInjectionEnabledForUploads()) { + clientBuilder.addPolicy(new FaultInjectingHttpPolicy(true, getFaultProbabilities(), true)); + } + + BlobServiceClient syncClient = clientBuilder.buildClient(); + BlobServiceAsyncClient asyncClient = clientBuilder.buildAsyncClient(); + asyncNoFaultContainerClient = asyncNoFaultClient.getBlobContainerAsyncClient(CONTAINER_NAME); + syncNoFaultContainerClient = syncNoFaultClient.getBlobContainerClient(CONTAINER_NAME); + syncContainerClient = syncClient.getBlobContainerClient(CONTAINER_NAME); + asyncContainerClient = asyncClient.getBlobContainerAsyncClient(CONTAINER_NAME); + } + + @Override + public Mono globalSetupAsync() { + startTime = Instant.now(); + telemetryHelper.recordStart(options); + return super.globalSetupAsync() + .then(asyncNoFaultContainerClient.createIfNotExists()) + .then(); + } + + @Override + public Mono globalCleanupAsync() { + telemetryHelper.recordEnd(startTime); + return asyncNoFaultContainerClient.deleteIfExists() + .then(super.globalCleanupAsync()); + } + + @SuppressWarnings("try") + @Override + public void run() { + telemetryHelper.instrumentRun(ctx -> runInternal(ctx)); + } + + @SuppressWarnings("try") + @Override + public Mono runAsync() { + return telemetryHelper.instrumentRunAsync(ctx -> runInternalAsync(ctx)) + .onErrorResume(e -> Mono.empty()); + } + + protected abstract void runInternal(Context context) throws Exception; + protected abstract Mono runInternalAsync(Context context); + + protected BlobContainerClient getSyncContainerClient() { + return syncContainerClient; + } + + protected BlobContainerAsyncClient getAsyncContainerClient() { + return asyncContainerClient; + } + + protected BlobContainerAsyncClient getAsyncContainerClientNoFault() { + return asyncNoFaultContainerClient; + } + + protected BlobContainerClient getSyncContainerClientNoFault() { + return syncNoFaultContainerClient; + } + + + protected String generateBlobName() { + return "blob-" + UUID.randomUUID(); + } + + protected static HttpLogOptions getLogOptions() { + return new HttpLogOptions() + .setLogLevel(HttpLogDetailLevel.HEADERS) + .addAllowedHeaderName("x-ms-faultinjector-response-option") + .addAllowedHeaderName("Content-Range") + .addAllowedHeaderName("Accept-Ranges") + .addAllowedHeaderName("x-ms-blob-content-md5") + .addAllowedHeaderName("x-ms-error-code") + .addAllowedHeaderName("x-ms-range"); + } + + protected static FaultInjectionProbabilities getFaultProbabilities() { + return new FaultInjectionProbabilities() + .setNoResponseIndefinite(0.003D) + .setNoResponseClose(0.004D) + .setNoResponseAbort(0.003D) + .setPartialResponseIndefinite(0.06) + .setPartialResponseClose(0.06) + .setPartialResponseAbort(0.06) + .setPartialResponseFinishNormal(0.06) + .setNoRequestIndefinite(0.003D) + .setNoRequestClose(0.004D) + .setNoRequestAbort(0.003D) + .setPartialRequestIndefinite(0.06) + .setPartialRequestClose(0.06) + .setPartialRequestAbort(0.06); + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/BlobScenarioBaseV2.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/BlobScenarioBaseV2.java new file mode 100644 index 000000000000..a6e432e5808b --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/BlobScenarioBaseV2.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.exception.HttpResponseException; +import com.azure.perf.test.core.PerfStressTest; +import com.azure.v2.storage.blob.AzureBlobStorageBuilder; +import com.azure.v2.storage.blob.ContainerClient; +import com.azure.v2.storage.stress.FaultInjectingHttpPolicy; +import com.azure.v2.storage.stress.FaultInjectionProbabilities; +import com.azure.v2.storage.stress.StorageStressOptions; +import com.azure.v2.storage.stress.TelemetryHelper; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.pipeline.HttpInstrumentationOptions; +import io.clientcore.core.utils.Context; +import reactor.core.publisher.Mono; + +import java.time.Instant; +import java.util.UUID; + +public abstract class BlobScenarioBaseV2 extends PerfStressTest { + protected static final String CONTAINER_NAME = "stress-" + UUID.randomUUID(); + protected final TelemetryHelper telemetryHelper = new TelemetryHelper(this.getClass()); + + private final ContainerClient syncContainerClientNoFault; + private final AzureBlobStorageBuilder storageBuilder; + private final AzureBlobStorageBuilder storageBuilderNoFault; + + private Instant startTime; + + public BlobScenarioBaseV2(TOptions options) { + super(options); + + String endpoint = options.getEndpointString(); + + storageBuilderNoFault = new AzureBlobStorageBuilder() + .httpInstrumentationOptions(getInstrumentationOptions()) + .url(endpoint); + syncContainerClientNoFault = storageBuilderNoFault.buildContainerClient(); + + storageBuilder = new AzureBlobStorageBuilder() + .httpInstrumentationOptions(getInstrumentationOptions()) + .url(endpoint); + + if (options.isFaultInjectionEnabledForDownloads()) { + storageBuilder.addHttpPipelinePolicy(new FaultInjectingHttpPolicy(true, getFaultProbabilities(), false)); + } else if (options.isFaultInjectionEnabledForUploads()) { + storageBuilder.addHttpPipelinePolicy(new FaultInjectingHttpPolicy(true, getFaultProbabilities(), true)); + } + } + + @Override + public Mono globalSetupAsync() { + startTime = Instant.now(); + telemetryHelper.recordStart(options); + + return super.globalSetupAsync().then(Mono.fromRunnable(() -> { + try { + syncContainerClientNoFault.create(CONTAINER_NAME, null, null, null, null, null); + } catch (HttpResponseException e) { + // If container already exists, ignore. Otherwise, throw. + if (e.getResponse().getStatusCode() != 409) { + throw e; + } + } + })); + } + + @Override + public Mono globalCleanupAsync() { + telemetryHelper.recordEnd(startTime); + + try { + syncContainerClientNoFault.delete(CONTAINER_NAME, null, null, null, null, null); + } catch (HttpResponseException e) { + // If container does not exist, ignore. Otherwise, throw. + if (e.getResponse().getStatusCode() != 404) { + throw e; + } + } + + return super.globalCleanupAsync(); + } + + @SuppressWarnings("try") + @Override + public void run() { + telemetryHelper.instrumentRun(context -> runInternal(Context.of(context.getValues()))); + } + + @SuppressWarnings("try") + @Override + public Mono runAsync() { + // No-op + return Mono.empty(); + } + + protected abstract void runInternal(Context context) throws Exception; + + protected AzureBlobStorageBuilder getBuilder() { + return storageBuilder; + } + + protected AzureBlobStorageBuilder getBuilderNoFault() { + return storageBuilderNoFault; + } + + protected String generateBlobName() { + return "blob-" + UUID.randomUUID(); + } + + protected static HttpInstrumentationOptions getInstrumentationOptions() { + return new HttpInstrumentationOptions() + .setHttpLogLevel(HttpInstrumentationOptions.HttpLogLevel.HEADERS) + .addAllowedHeaderName(HttpHeaderName.fromString("x-ms-faultinjector-response-option")) + .addAllowedHeaderName(HttpHeaderName.CONTENT_RANGE) + .addAllowedHeaderName(HttpHeaderName.ACCEPT_RANGES) + .addAllowedHeaderName(HttpHeaderName.fromString("x-ms-blob-content-md5")) + .addAllowedHeaderName(HttpHeaderName.fromString("x-ms-error-code")) + .addAllowedHeaderName(HttpHeaderName.fromString("x-ms-range")); + } + + protected static FaultInjectionProbabilities getFaultProbabilities() { + return new FaultInjectionProbabilities() + .setNoResponseIndefinite(0.003D) + .setNoResponseClose(0.004D) + .setNoResponseAbort(0.003D) + .setPartialResponseIndefinite(0.06) + .setPartialResponseClose(0.06) + .setPartialResponseAbort(0.06) + .setPartialResponseFinishNormal(0.06) + .setNoRequestIndefinite(0.003D) + .setNoRequestClose(0.004D) + .setNoRequestAbort(0.003D) + .setPartialRequestIndefinite(0.06) + .setPartialRequestClose(0.06) + .setPartialRequestAbort(0.06); + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/BlockBlobOutputStream.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/BlockBlobOutputStream.java new file mode 100644 index 000000000000..1707f53ca791 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/BlockBlobOutputStream.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlobClient; +import com.azure.storage.blob.models.ParallelTransferOptions; +import com.azure.storage.blob.options.BlockBlobOutputStreamOptions; +import com.azure.storage.blob.specialized.BlobOutputStream; +import com.azure.storage.blob.specialized.BlockBlobClient; +import com.azure.storage.stress.CrcInputStream; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.v2.storage.blob.stress.utils.OriginalContent; +import reactor.core.publisher.Mono; + +import java.io.IOException; + +import static com.azure.core.util.FluxUtil.monoError; + +public class BlockBlobOutputStream extends BlobScenarioBase { + private static final ClientLogger LOGGER = new ClientLogger(BlockBlobOutputStream.class); + private final OriginalContent originalContent = new OriginalContent(); + private final BlobClient syncClient; + private final BlobAsyncClient asyncNoFaultClient; + private final ParallelTransferOptions parallelTransferOptions; + + public BlockBlobOutputStream(StorageStressOptions options) { + super(options); + String blobName = generateBlobName(); + this.asyncNoFaultClient = getAsyncContainerClientNoFault().getBlobAsyncClient(blobName); + this.syncClient = getSyncContainerClient().getBlobClient(blobName); + this.parallelTransferOptions = new ParallelTransferOptions().setMaxConcurrency(options.getMaxConcurrency()); + } + + @Override + protected void runInternal(Context span) throws IOException { + BlockBlobClient blockBlobClient = syncClient.getBlockBlobClient(); + BlockBlobOutputStreamOptions blockBlobOutputStreamOptions = new BlockBlobOutputStreamOptions() + .setParallelTransferOptions(parallelTransferOptions); + + try (CrcInputStream inputStream = new CrcInputStream(originalContent.getBlobContentHead(), options.getSize()); + BlobOutputStream outputStream = blockBlobClient.getBlobOutputStream(blockBlobOutputStreamOptions, span)) { + byte[] buffer = new byte[4096]; // Define a buffer + int bytesRead; + + // Read from the inputStream and write to the blobOutputStream + while ((bytesRead = inputStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesRead); + } + + // Ensure to close the blobOutputStream to flush any remaining data and finalize the blob. + outputStream.close(); + originalContent.checkMatch(inputStream.getContentInfo(), span).block(); + } + } + + @Override + protected Mono runInternalAsync(Context span) { + return monoError(LOGGER, new RuntimeException("getBlobOutputStream() does not exist on the async client")); + } + + + @Override + public Mono setupAsync() { + return super.setupAsync().then(originalContent.setupBlob(asyncNoFaultClient, options.getSize())); + } + + @Override + public Mono cleanupAsync() { + return asyncNoFaultClient.delete() + .then(super.cleanupAsync()); + } + +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/BlockBlobUpload.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/BlockBlobUpload.java new file mode 100644 index 000000000000..b292ab775c82 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/BlockBlobUpload.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.util.Context; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlobClient; +import com.azure.storage.blob.specialized.BlockBlobAsyncClient; +import com.azure.storage.blob.specialized.BlockBlobClient; +import com.azure.storage.stress.CrcInputStream; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.v2.storage.blob.stress.utils.OriginalContent; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.nio.ByteBuffer; + +public class BlockBlobUpload extends BlobScenarioBase { + private final OriginalContent originalContent = new OriginalContent(); + private final BlobClient syncClient; + private final BlobAsyncClient asyncClient; + private final BlobAsyncClient asyncNoFaultClient; + + public BlockBlobUpload(StorageStressOptions options) { + super(options); + String blobName = generateBlobName(); + this.asyncNoFaultClient = getAsyncContainerClientNoFault().getBlobAsyncClient(blobName); + this.syncClient = getSyncContainerClient().getBlobClient(blobName); + this.asyncClient = getAsyncContainerClient().getBlobAsyncClient(blobName); + } + + @Override + protected void runInternal(Context span) { + BlockBlobClient blockBlobClient = syncClient.getBlockBlobClient(); + try (CrcInputStream inputStream = new CrcInputStream(originalContent.getBlobContentHead(), options.getSize())) { + blockBlobClient.upload(inputStream, options.getSize(), true); + originalContent.checkMatch(inputStream.getContentInfo(), span).block(); + } + } + + @Override + protected Mono runInternalAsync(Context span) { + Flux byteBufferFlux = new CrcInputStream(originalContent.getBlobContentHead(), options.getSize()) + .convertStreamToByteBuffer(); + BlockBlobAsyncClient blockBlobAsyncClient = asyncClient.getBlockBlobAsyncClient(); + return blockBlobAsyncClient.upload(byteBufferFlux, options.getSize(), true) + .then(originalContent.checkMatch(byteBufferFlux, span)); + } + + @Override + public Mono setupAsync() { + return super.setupAsync().then(originalContent.setupBlob(asyncNoFaultClient, options.getSize())); + } + + @Override + public Mono cleanupAsync() { + return asyncNoFaultClient.delete() + .then(super.cleanupAsync()); + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/CommitBlockList.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/CommitBlockList.java new file mode 100644 index 000000000000..c858e064cb63 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/CommitBlockList.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlobClient; +import com.azure.storage.blob.options.BlockBlobCommitBlockListOptions; +import com.azure.storage.blob.specialized.BlockBlobAsyncClient; +import com.azure.storage.blob.specialized.BlockBlobClient; +import com.azure.storage.stress.CrcInputStream; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.v2.storage.blob.stress.utils.OriginalContent; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import java.util.Collections; + +public class CommitBlockList extends BlobScenarioBase { + private final OriginalContent originalContent = new OriginalContent(); + private final BlobClient syncClient; + private final BlobAsyncClient asyncClient; + private final BlobClient syncNoFaultClient; + private final BlobAsyncClient asyncNoFaultClient; + + public CommitBlockList(StorageStressOptions options) { + super(options); + String blobName = generateBlobName(); + this.syncNoFaultClient = getSyncContainerClientNoFault().getBlobClient(blobName); + this.asyncNoFaultClient = getAsyncContainerClientNoFault().getBlobAsyncClient(blobName); + this.syncClient = getSyncContainerClient().getBlobClient(blobName); + this.asyncClient = getAsyncContainerClient().getBlobAsyncClient(blobName); + } + + @Override + protected void runInternal(Context span) throws Exception { + BlockBlobClient blockBlobClient = syncClient.getBlockBlobClient(); + BlockBlobClient blockBlobClientNoFault = syncNoFaultClient.getBlockBlobClient(); + String blockId = Base64.getEncoder().encodeToString(CoreUtils.randomUuid().toString() + .getBytes(StandardCharsets.UTF_8)); + try (CrcInputStream inputStream = new CrcInputStream(originalContent.getBlobContentHead(), options.getSize())) { + // First perform non-faulted stage block to send data to the service + blockBlobClientNoFault.stageBlockWithResponse(blockId, inputStream, options.getSize(), null, null, null, + span); + // Then perform faulted commit block list to commit the block + blockBlobClient.commitBlockListWithResponse( + new BlockBlobCommitBlockListOptions(Collections.singletonList(blockId)), null, span); + // Confirm the CRC matches for the uploaded input stream + originalContent.checkMatch(inputStream.getContentInfo(), span).block(); + } + } + + @Override + protected Mono runInternalAsync(Context span) { + BlockBlobAsyncClient blockBlobAsyncClient = asyncClient.getBlockBlobAsyncClient(); + BlockBlobAsyncClient blockBlobAsyncClientNoFault = asyncNoFaultClient.getBlockBlobAsyncClient(); + String blockId = Base64.getEncoder().encodeToString(CoreUtils.randomUuid().toString() + .getBytes(StandardCharsets.UTF_8)); + Flux byteBufferFlux = new CrcInputStream(originalContent.getBlobContentHead(), options.getSize()) + .convertStreamToByteBuffer(); + // First perform non-faulted stage block to send data to the service + return blockBlobAsyncClientNoFault.stageBlockWithResponse(blockId, byteBufferFlux, options.getSize(), null, null) + // Then perform faulted commit block list to commit the block + .then(blockBlobAsyncClient.commitBlockListWithResponse( + new BlockBlobCommitBlockListOptions(Collections.singletonList(blockId)))) + // Confirm the CRC matches for the uploaded byte buffer flux + .then(originalContent.checkMatch(byteBufferFlux, span)); + } + + @Override + public Mono setupAsync() { + return super.setupAsync().then(originalContent.setupBlob(asyncNoFaultClient, options.getSize())); + } + + @Override + public Mono cleanupAsync() { + return asyncNoFaultClient.delete() + .then(super.cleanupAsync()); + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/DownloadContent.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/DownloadContent.java new file mode 100644 index 000000000000..9e6a0114cb1d --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/DownloadContent.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlobClient; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.v2.storage.blob.stress.utils.OriginalContent; +import reactor.core.publisher.Mono; + +public class DownloadContent extends BlobScenarioBase { + private final OriginalContent originalContent = new OriginalContent(); + private final BlobClient syncClient; + private final BlobAsyncClient asyncClient; + private final BlobAsyncClient asyncNoFaultClient; + + public DownloadContent(StorageStressOptions options) { + super(options); + String blobName = generateBlobName(); + this.asyncNoFaultClient = getAsyncContainerClientNoFault().getBlobAsyncClient(blobName); + this.syncClient = getSyncContainerClient().getBlobClient(blobName); + this.asyncClient = getAsyncContainerClient().getBlobAsyncClient(blobName); + } + + @Override + protected void runInternal(Context span) { + originalContent.checkMatch(syncClient.downloadContent(), span).block(); + } + + @Override + protected Mono runInternalAsync(Context span) { + // TODO return downloadContent once it stops buffering + + return asyncClient.downloadStreamWithResponse(null, null, null, false) + .flatMap(response -> { + long contentLength = Long.valueOf(response.getHeaders().getValue(HttpHeaderName.CONTENT_LENGTH)); + return BinaryData.fromFlux(response.getValue(), contentLength, false); + }) + .flatMap(bd -> originalContent.checkMatch(bd, span)); + } + + @Override + public Mono setupAsync() { + // setup is called for each instance of scenario. Number of instances equals options.getParallel() + // so we're setting up options.getParallel() blobs to scale beyond service limits for 1 blob. + return super.setupAsync() + .then(originalContent.setupBlob(asyncNoFaultClient, options.getSize())); + } + + @Override + public Mono cleanupAsync() { + return asyncNoFaultClient.deleteIfExists() + .then(super.cleanupAsync()); + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/DownloadContentV2.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/DownloadContentV2.java new file mode 100644 index 000000000000..338748c64207 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/DownloadContentV2.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.v2.storage.blob.BlobClient; +import com.azure.v2.storage.blob.BlockBlobClient; +import com.azure.v2.storage.blob.stress.utils.OriginalContentV2; +import com.azure.v2.storage.stress.StorageStressOptions; +import io.clientcore.core.models.binarydata.BinaryData; +import io.clientcore.core.utils.Context; +import reactor.core.publisher.Mono; + +public class DownloadContentV2 extends BlobScenarioBaseV2 { + private final OriginalContentV2 originalContent = new OriginalContentV2(); + private final BlobClient blobClient; + private final BlobClient blobClientNoFault; + private final BlockBlobClient blockBlobClient; + private final String blobName; + + public DownloadContentV2(StorageStressOptions options) { + super(options); + + this.blobName = generateBlobName(); + this.blobClient = getBuilder().buildBlobClient(); + this.blobClientNoFault = getBuilderNoFault().buildBlobClient(); + this.blockBlobClient = getBuilder().buildBlockBlobClient(); + } + + @Override + protected void runInternal(Context span) { + originalContent.checkMatch(BinaryData.fromStream( + blobClient.download(CONTAINER_NAME, blobName, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null)), span); + } + + @Override + public Mono setupAsync() { + // Setup is called for each instance of scenario. + return super.setupAsync() + .then(Mono.fromRunnable( + () -> originalContent.setupBlob(CONTAINER_NAME, blobName, blockBlobClient, options.getSize()))); + } + + @Override + public Mono cleanupAsync() { + blobClientNoFault.delete(CONTAINER_NAME, blobName, null, null, null, null, null, null, null, null, null, null, + null, null); + + return super.cleanupAsync(); + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/DownloadStream.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/DownloadStream.java new file mode 100644 index 000000000000..adec0c8cb16b --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/DownloadStream.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.util.Context; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlobClient; +import com.azure.storage.stress.CrcOutputStream; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.v2.storage.blob.stress.utils.OriginalContent; +import reactor.core.publisher.Mono; + +import java.io.IOException; + +public class DownloadStream extends BlobScenarioBase { + private final OriginalContent originalContent = new OriginalContent(); + private final BlobClient syncClient; + private final BlobAsyncClient asyncClient; + private final BlobAsyncClient asyncNoFaultClient; + + public DownloadStream(StorageStressOptions options) { + super(options); + String blobName = generateBlobName(); + this.asyncNoFaultClient = getAsyncContainerClientNoFault().getBlobAsyncClient(blobName); + this.syncClient = getSyncContainerClient().getBlobClient(blobName); + this.asyncClient = getAsyncContainerClient().getBlobAsyncClient(blobName); + } + + @Override + protected void runInternal(Context span) throws IOException { + try (CrcOutputStream outputStream = new CrcOutputStream()) { + syncClient.downloadStreamWithResponse(outputStream, null, null, null, false, null, span); + outputStream.close(); + originalContent.checkMatch(outputStream.getContentInfo(), span).block(); + } + } + + @Override + protected Mono runInternalAsync(Context span) { + return asyncClient.downloadStreamWithResponse(null, null, null, false) + .flatMap(response -> originalContent.checkMatch(response.getValue(), span)); + } + + @Override + public Mono setupAsync() { + // setup is called for each instance of scenario. Number of instances equals options.getParallel() + // so we're setting up options.getParallel() blobs to scale beyond service limits for 1 blob. + return super.setupAsync() + .then(originalContent.setupBlob(asyncNoFaultClient, options.getSize())); + } + + @Override + public Mono cleanupAsync() { + return asyncNoFaultClient.deleteIfExists() + .then(super.cleanupAsync()); + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/DownloadToFile.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/DownloadToFile.java new file mode 100644 index 000000000000..b904185c1296 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/DownloadToFile.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlobClient; +import com.azure.storage.blob.options.BlobDownloadToFileOptions; +import com.azure.storage.common.ParallelTransferOptions; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.v2.storage.blob.stress.utils.OriginalContent; +import reactor.core.publisher.Mono; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.time.Duration; +import java.util.UUID; + +public class DownloadToFile extends BlobScenarioBase { + private static final ClientLogger LOGGER = new ClientLogger(DownloadToFile.class); + private final Path directoryPath; + private final OriginalContent originalContent = new OriginalContent(); + private final BlobClient syncClient; + private final BlobAsyncClient asyncClient; + private final BlobAsyncClient asyncNoFaultClient; + private final ParallelTransferOptions parallelTransferOptions; + + public DownloadToFile(StorageStressOptions options) { + super(options); + this.directoryPath = getTempPath("test"); + String blobName = generateBlobName(); + this.asyncNoFaultClient = getAsyncContainerClientNoFault().getBlobAsyncClient(blobName); + this.syncClient = getSyncContainerClient().getBlobClient(blobName); + this.asyncClient = getAsyncContainerClient().getBlobAsyncClient(blobName); + this.parallelTransferOptions = new ParallelTransferOptions().setMaxConcurrency(options.getMaxConcurrency()); + } + + @Override + protected void runInternal(Context span) { + Path downloadPath = directoryPath.resolve(UUID.randomUUID() + ".txt"); + BlobDownloadToFileOptions blobOptions = new BlobDownloadToFileOptions(downloadPath.toString()) + .setParallelTransferOptions(parallelTransferOptions); + + try { + syncClient.downloadToFileWithResponse(blobOptions, Duration.ofSeconds(options.getDuration()), span); + originalContent.checkMatch(BinaryData.fromFile(downloadPath), span).block(); + } finally { + deleteFile(downloadPath); + } + } + + @Override + protected Mono runInternalAsync(Context span) { + return Mono.using( + () -> directoryPath.resolve(UUID.randomUUID() + ".txt"), + path -> asyncClient.downloadToFileWithResponse( + new BlobDownloadToFileOptions(path.toString()).setParallelTransferOptions(parallelTransferOptions)) + .flatMap(ignored -> originalContent.checkMatch(BinaryData.fromFile(path), span)), + DownloadToFile::deleteFile); + } + + private static void deleteFile(Path path) { + try { + path.toFile().delete(); + } catch (Throwable e) { + LOGGER.atError() + .addKeyValue("path", path) + .log("failed to delete file", e); + } + } + + @Override + public Mono setupAsync() { + // setup is called for each instance of scenario. Number of instances equals options.getParallel() + // so we're setting up options.getParallel() blobs to scale beyond service limits for 1 blob. + return super.setupAsync() + .then(originalContent.setupBlob(asyncNoFaultClient, options.getSize())); + } + + @Override + public Mono cleanupAsync() { + return asyncNoFaultClient.deleteIfExists() + .then(super.cleanupAsync()); + } + + private Path getTempPath(String prefix) { + try { + return Files.createTempDirectory(prefix); + } catch (IOException e) { + throw LOGGER.logExceptionAsError(new UncheckedIOException(e)); + } + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/OpenInputStream.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/OpenInputStream.java new file mode 100644 index 000000000000..cb385f620f96 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/OpenInputStream.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlobClient; +import com.azure.storage.stress.CrcInputStream; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.v2.storage.blob.stress.utils.OriginalContent; +import reactor.core.publisher.Mono; + +import java.io.IOException; +import java.io.InputStream; + +import static com.azure.core.util.FluxUtil.monoError; + +public class OpenInputStream extends BlobScenarioBase { + private static final ClientLogger LOGGER = new ClientLogger(OpenInputStream.class); + private final OriginalContent originalContent = new OriginalContent(); + private final BlobClient syncClient; + private final BlobAsyncClient asyncNoFaultClient; + + + public OpenInputStream(StorageStressOptions options) { + super(options); + String blobName = generateBlobName(); + this.syncClient = getSyncContainerClient().getBlobClient(blobName); + this.asyncNoFaultClient = getAsyncContainerClientNoFault().getBlobAsyncClient(blobName); + } + + @Override + protected void runInternal(Context span) throws IOException { + try (InputStream stream = syncClient.openInputStream()) { + try (CrcInputStream crcStream = new CrcInputStream(stream)) { + byte[] buffer = new byte[8192]; + while (crcStream.read(buffer) != -1) { + // do nothing + } + originalContent.checkMatch(crcStream.getContentInfo(), span).block(); + } + } + } + + @Override + protected Mono runInternalAsync(Context context) { + return monoError(LOGGER, new RuntimeException("openInputStream() does not exist on the async client")); + } + + @Override + public Mono setupAsync() { + // setup is called for each instance of scenario. Number of instances equals options.getParallel() + // so we're setting up options.getParallel() blobs to scale beyond service limits for 1 blob. + return super.setupAsync() + .then(originalContent.setupBlob(asyncNoFaultClient, options.getSize())); + } + + @Override + public Mono cleanupAsync() { + return asyncNoFaultClient.deleteIfExists() + .then(super.cleanupAsync()); + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/OpenSeekableByteChannelRead.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/OpenSeekableByteChannelRead.java new file mode 100644 index 000000000000..9047e72e672f --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/OpenSeekableByteChannelRead.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlobClient; +import com.azure.storage.blob.models.BlobSeekableByteChannelReadResult; +import com.azure.storage.blob.options.BlobSeekableByteChannelReadOptions; +import com.azure.storage.stress.CrcInputStream; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.v2.storage.blob.stress.utils.OriginalContent; +import reactor.core.publisher.Mono; + +import java.io.IOException; +import java.nio.channels.Channels; + +import static com.azure.core.util.FluxUtil.monoError; + +public class OpenSeekableByteChannelRead extends BlobScenarioBase { + private static final ClientLogger LOGGER = new ClientLogger(OpenSeekableByteChannelRead.class); + private final OriginalContent originalContent = new OriginalContent(); + private final BlobClient syncClient; + private final BlobAsyncClient asyncNoFaultClient; + + public OpenSeekableByteChannelRead(StorageStressOptions options) { + super(options); + String blobName = generateBlobName(); + this.asyncNoFaultClient = getAsyncContainerClientNoFault().getBlobAsyncClient(blobName); + this.syncClient = getSyncContainerClient().getBlobClient(blobName); + } + + @Override + protected void runInternal(Context span) throws IOException { + BlobSeekableByteChannelReadResult result = syncClient.openSeekableByteChannelRead( + new BlobSeekableByteChannelReadOptions(), span); + try (CrcInputStream crcStream = new CrcInputStream(Channels.newInputStream(result.getChannel()))) { + byte[] buffer = new byte[8192]; + while (crcStream.read(buffer) != -1) { + // do nothing + } + originalContent.checkMatch(crcStream.getContentInfo(), span).block(); + } + } + + @Override + protected Mono runInternalAsync(Context span) { + return monoError(LOGGER, new RuntimeException("openSeekableByteChannelRead() does not exist on the async client")); + } + + @Override + public Mono setupAsync() { + // setup is called for each instance of scenario. Number of instances equals options.getParallel() + // so we're setting up options.getParallel() blobs to scale beyond service limits for 1 blob. + return super.setupAsync() + .then(originalContent.setupBlob(asyncNoFaultClient, options.getSize())); + } + + @Override + public Mono cleanupAsync() { + return asyncNoFaultClient.deleteIfExists() + .then(super.cleanupAsync()); + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/OpenSeekableByteChannelWrite.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/OpenSeekableByteChannelWrite.java new file mode 100644 index 000000000000..f47d7d2114e7 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/OpenSeekableByteChannelWrite.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlobClient; +import com.azure.storage.blob.options.BlockBlobSeekableByteChannelWriteOptions; +import com.azure.storage.blob.specialized.BlockBlobClient; +import com.azure.storage.common.implementation.StorageSeekableByteChannel; +import com.azure.storage.stress.CrcInputStream; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.v2.storage.blob.stress.utils.OriginalContent; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.io.IOException; +import java.nio.ByteBuffer; + +import static com.azure.core.util.FluxUtil.monoError; +import static com.azure.storage.blob.options.BlockBlobSeekableByteChannelWriteOptions.WriteMode.OVERWRITE; + +public class OpenSeekableByteChannelWrite extends BlobScenarioBase { + private static final ClientLogger LOGGER = new ClientLogger(OpenSeekableByteChannelWrite.class); + private final OriginalContent originalContent = new OriginalContent(); + private final BlobClient syncClient; + private final BlobAsyncClient asyncNoFaultClient; + + public OpenSeekableByteChannelWrite(StorageStressOptions options) { + super(options); + String blobName = generateBlobName(); + this.syncClient = getSyncContainerClient().getBlobClient(blobName); + this.asyncNoFaultClient = getAsyncContainerClientNoFault().getBlobAsyncClient(blobName); + } + + @Override + protected void runInternal(Context span) throws IOException { + BlockBlobClient blockBlobClient = syncClient.getBlockBlobClient(); + Flux byteBufferFlux = new CrcInputStream(originalContent.getBlobContentHead(), options.getSize()) + .convertStreamToByteBuffer(); + + try (StorageSeekableByteChannel channel = (StorageSeekableByteChannel) blockBlobClient.openSeekableByteChannelWrite( + new BlockBlobSeekableByteChannelWriteOptions(OVERWRITE))) { + // Perform buffered write upload to the blob + Mono writeOperation = byteBufferFlux + .doOnNext(buffer -> { + try { + // This will write each chunk as it comes + channel.write(buffer); + } catch (IOException e) { + throw LOGGER.logExceptionAsError(new RuntimeException(e)); + } + }).then(); + // Trigger the operation and wait for completion + writeOperation.block(); + channel.getWriteBehavior().commit(options.getSize()); + } + // Check if the blob content matches the original content + originalContent.checkMatch(byteBufferFlux, span).block(); + } + + @Override + protected Mono runInternalAsync(Context span) { + return monoError(LOGGER, new RuntimeException("OpenSeekableByteChannelWrite() does not exist on the async client")); + } + + @Override + public Mono setupAsync() { + return super.setupAsync().then(originalContent.setupBlob(asyncNoFaultClient, options.getSize())); + } + + @Override + public Mono cleanupAsync() { + return asyncNoFaultClient.deleteIfExists().then(super.cleanupAsync()); + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/PageBlobOutputStream.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/PageBlobOutputStream.java new file mode 100644 index 000000000000..6851f1fd0287 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/PageBlobOutputStream.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlobClient; +import com.azure.storage.blob.models.PageRange; +import com.azure.storage.blob.specialized.BlobOutputStream; +import com.azure.storage.blob.specialized.PageBlobAsyncClient; +import com.azure.storage.blob.specialized.PageBlobClient; +import com.azure.storage.stress.CrcInputStream; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.v2.storage.blob.stress.utils.OriginalContent; +import reactor.core.publisher.Mono; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import static com.azure.core.util.FluxUtil.monoError; + +public class PageBlobOutputStream extends PageBlobScenarioBase { + private static final ClientLogger LOGGER = new ClientLogger(BlockBlobOutputStream.class); + private final OriginalContent originalContent = new OriginalContent(); + private final BlobClient syncClient; + private final BlobAsyncClient asyncNoFaultClient; + // this blob is used to perform normal upload in the setup phase + private final PageBlobAsyncClient tempSetupPageBlobClient; + + public PageBlobOutputStream(StorageStressOptions options) { + super(options); + String blobName = generateBlobName(); + String tempBlobName = generateBlobName(); + + this.syncClient = getSyncContainerClient().getBlobClient(blobName); + this.asyncNoFaultClient = getAsyncContainerClientNoFault().getBlobAsyncClient(blobName); + BlobAsyncClient tempSetupBlobClient = getAsyncContainerClientNoFault().getBlobAsyncClient(tempBlobName); + this.tempSetupPageBlobClient = tempSetupBlobClient.getPageBlobAsyncClient(); + } + + @Override + protected void runInternal(Context span) throws IOException { + PageBlobClient pageBlobClient = syncClient.getPageBlobClient(); + + try (CrcInputStream inputStream = new CrcInputStream(originalContent.getBlobContentHead(), options.getSize()); + BlobOutputStream outputStream = pageBlobClient.getBlobOutputStream(new PageRange().setStart(0) + .setEnd(options.getSize() - 1))) { + ByteArrayOutputStream bufferStream = new ByteArrayOutputStream(); + byte[] buffer = new byte[512]; // Use 512-byte blocks for Page Blob + int bytesRead; + + // Read from the inputStream and write to the blobOutputStream in 512-byte chunks + while ((bytesRead = inputStream.read(buffer)) != -1) { + if (bytesRead < buffer.length) { + // If bytesRead is less than 512, store in a temporary buffer + bufferStream.write(buffer, 0, bytesRead); + // Check if the bufferStream has reached or exceeded 512 bytes + if (bufferStream.size() >= buffer.length) { + byte[] toWrite = bufferStream.toByteArray(); + int length = toWrite.length - (toWrite.length % buffer.length); + outputStream.write(toWrite, 0, length); + bufferStream.reset(); + // Keep the remainder in the bufferStream + bufferStream.write(toWrite, length, (toWrite.length % buffer.length)); + } + } else { + // If bytesRead is exactly 512, write directly + outputStream.write(buffer, 0, bytesRead); + } + } + + // Ensure to close the blobOutputStream to flush any remaining data and finalize the blob. + outputStream.close(); + originalContent.checkMatch(inputStream.getContentInfo(), span).block(); + } + } + + @Override + protected Mono runInternalAsync(Context span) { + return monoError(LOGGER, new RuntimeException("getBlobOutputStream() does not exist on the async client")); + } + + + @Override + public Mono setupAsync() { + return super.setupAsync() + .then(asyncNoFaultClient.getPageBlobAsyncClient().create(options.getSize())) + .then(tempSetupPageBlobClient.create(options.getSize())) + .then(originalContent.setupPageBlob(tempSetupPageBlobClient, options.getSize())); + } + + @Override + public Mono cleanupAsync() { + return asyncNoFaultClient.getPageBlobAsyncClient().delete() + .then(tempSetupPageBlobClient.delete()) + .then(super.cleanupAsync()); + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/PageBlobScenarioBase.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/PageBlobScenarioBase.java new file mode 100644 index 000000000000..ebd1ec8cb4d4 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/PageBlobScenarioBase.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.util.Context; +import com.azure.identity.DefaultAzureCredential; +import com.azure.identity.DefaultAzureCredentialBuilder; +import com.azure.perf.test.core.PerfStressTest; +import com.azure.storage.blob.BlobContainerAsyncClient; +import com.azure.storage.blob.BlobContainerClient; +import com.azure.storage.blob.BlobServiceAsyncClient; +import com.azure.storage.blob.BlobServiceClient; +import com.azure.storage.blob.BlobServiceClientBuilder; +import com.azure.storage.stress.FaultInjectingHttpPolicy; +import com.azure.storage.stress.FaultInjectionProbabilities; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.storage.stress.TelemetryHelper; +import reactor.core.publisher.Mono; + +import java.time.Instant; +import java.util.UUID; + +public abstract class PageBlobScenarioBase extends PerfStressTest { + private static final String CONTAINER_NAME = "stress-" + UUID.randomUUID(); + protected final TelemetryHelper telemetryHelper = new TelemetryHelper(this.getClass()); + private final BlobServiceClient noFaultServiceClient; + private final BlobContainerClient syncContainerClient; + private final BlobContainerAsyncClient asyncContainerClient; + private final BlobContainerAsyncClient asyncNoFaultContainerClient; + private Instant startTime; + + public PageBlobScenarioBase(TOptions options) { + super(options); + + DefaultAzureCredential defaultAzureCredential = new DefaultAzureCredentialBuilder().build(); + String endpoint = options.getPageBlobEndpointString(); + + BlobServiceClientBuilder clientBuilder = new BlobServiceClientBuilder() + .credential(defaultAzureCredential) + .endpoint(endpoint) + .httpLogOptions(getLogOptions()); + + BlobServiceAsyncClient asyncNoFaultClient = clientBuilder.buildAsyncClient(); + noFaultServiceClient = clientBuilder.buildClient(); + + if (options.isFaultInjectionEnabledForDownloads()) { + clientBuilder.addPolicy(new FaultInjectingHttpPolicy(true, getFaultProbabilities(), false)); + } else if (options.isFaultInjectionEnabledForUploads()) { + clientBuilder.addPolicy(new FaultInjectingHttpPolicy(true, getFaultProbabilities(), true)); + } + + BlobServiceClient syncClient = clientBuilder.buildClient(); + BlobServiceAsyncClient asyncClient = clientBuilder.buildAsyncClient(); + asyncNoFaultContainerClient = asyncNoFaultClient.getBlobContainerAsyncClient(CONTAINER_NAME); + syncContainerClient = syncClient.getBlobContainerClient(CONTAINER_NAME); + asyncContainerClient = asyncClient.getBlobContainerAsyncClient(CONTAINER_NAME); + } + + @Override + public Mono globalSetupAsync() { + startTime = Instant.now(); + telemetryHelper.recordStart(options); + return super.globalSetupAsync() + .then(asyncNoFaultContainerClient.createIfNotExists()) + .then(); + } + + @Override + public Mono globalCleanupAsync() { + telemetryHelper.recordEnd(startTime); + return asyncNoFaultContainerClient.deleteIfExists() + .then(super.globalCleanupAsync()); + } + + @SuppressWarnings("try") + @Override + public void run() { + telemetryHelper.instrumentRun(ctx -> runInternal(ctx)); + } + + @SuppressWarnings("try") + @Override + public Mono runAsync() { + return telemetryHelper.instrumentRunAsync(ctx -> runInternalAsync(ctx)) + .onErrorResume(e -> Mono.empty()); + } + + protected abstract void runInternal(Context context) throws Exception; + protected abstract Mono runInternalAsync(Context context); + + protected BlobContainerClient getSyncContainerClient() { + return syncContainerClient; + } + + protected BlobContainerAsyncClient getAsyncContainerClient() { + return asyncContainerClient; + } + + protected BlobContainerAsyncClient getAsyncContainerClientNoFault() { + return asyncNoFaultContainerClient; + } + + protected BlobContainerClient getSyncContainerClientNoFault() { + return noFaultServiceClient.getBlobContainerClient(CONTAINER_NAME); + } + + protected String generateBlobName() { + return "blob-" + UUID.randomUUID(); + } + + private static HttpLogOptions getLogOptions() { + return new HttpLogOptions() + .setLogLevel(HttpLogDetailLevel.HEADERS) + .addAllowedHeaderName("x-ms-faultinjector-response-option") + .addAllowedHeaderName("Content-Range") + .addAllowedHeaderName("Accept-Ranges") + .addAllowedHeaderName("x-ms-blob-content-md5") + .addAllowedHeaderName("x-ms-error-code") + .addAllowedHeaderName("x-ms-range"); + } + + private static FaultInjectionProbabilities getFaultProbabilities() { + return new FaultInjectionProbabilities() + .setNoResponseIndefinite(0.003D) + .setNoResponseClose(0.004D) + .setNoResponseAbort(0.003D) + .setPartialResponseIndefinite(0.06) + .setPartialResponseClose(0.06) + .setPartialResponseAbort(0.06) + .setPartialResponseFinishNormal(0.06) + .setNoRequestIndefinite(0.003D) + .setNoRequestClose(0.004D) + .setNoRequestAbort(0.003D) + .setPartialRequestIndefinite(0.06) + .setPartialRequestClose(0.06) + .setPartialRequestAbort(0.06); + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/StageBlock.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/StageBlock.java new file mode 100644 index 000000000000..5a28e766c615 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/StageBlock.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlobClient; +import com.azure.storage.blob.options.BlockBlobCommitBlockListOptions; +import com.azure.storage.blob.specialized.BlockBlobAsyncClient; +import com.azure.storage.blob.specialized.BlockBlobClient; +import com.azure.storage.stress.CrcInputStream; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.v2.storage.blob.stress.utils.OriginalContent; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import java.util.Collections; + +public class StageBlock extends BlobScenarioBase { + private final OriginalContent originalContent = new OriginalContent(); + private final BlobClient syncClient; + private final BlobAsyncClient asyncClient; + private final BlobClient syncNoFaultClient; + private final BlobAsyncClient asyncNoFaultClient; + + public StageBlock(StorageStressOptions options) { + super(options); + String blobName = generateBlobName(); + this.syncNoFaultClient = getSyncContainerClientNoFault().getBlobClient(blobName); + this.asyncNoFaultClient = getAsyncContainerClientNoFault().getBlobAsyncClient(blobName); + this.syncClient = getSyncContainerClient().getBlobClient(blobName); + this.asyncClient = getAsyncContainerClient().getBlobAsyncClient(blobName); + } + + @Override + protected void runInternal(Context span) { + BlockBlobClient blockBlobClient = syncClient.getBlockBlobClient(); + BlockBlobClient blockBlobClientNoFault = syncNoFaultClient.getBlockBlobClient(); + String blockId = Base64.getEncoder().encodeToString(CoreUtils.randomUuid().toString() + .getBytes(StandardCharsets.UTF_8)); + try (CrcInputStream inputStream = new CrcInputStream(originalContent.getBlobContentHead(), options.getSize())) { + // First perform faulted stage block to send data to the service + blockBlobClient.stageBlockWithResponse(blockId, inputStream, options.getSize(), null, null, null, span); + // Then perform non-faulted commit block list to commit the block + blockBlobClientNoFault.commitBlockListWithResponse( + new BlockBlobCommitBlockListOptions(Collections.singletonList(blockId)), null, span); + // Confirm the CRC matches for the uploaded input stream + originalContent.checkMatch(inputStream.getContentInfo(), span).block(); + } + } + + @Override + protected Mono runInternalAsync(Context span) { + BlockBlobAsyncClient blockBlobAsyncClient = asyncClient.getBlockBlobAsyncClient(); + BlockBlobAsyncClient blockBlobAsyncClientNoFault = asyncNoFaultClient.getBlockBlobAsyncClient(); + String blockId = Base64.getEncoder().encodeToString(CoreUtils.randomUuid().toString() + .getBytes(StandardCharsets.UTF_8)); + Flux byteBufferFlux = new CrcInputStream(originalContent.getBlobContentHead(), options.getSize()) + .convertStreamToByteBuffer(); + // First perform faulted stage block to send data to the service + return blockBlobAsyncClient.stageBlockWithResponse(blockId, byteBufferFlux, options.getSize(), null, null) + // Then perform non-faulted commit block list to commit the block + .then(blockBlobAsyncClientNoFault.commitBlockListWithResponse( + new BlockBlobCommitBlockListOptions(Collections.singletonList(blockId)))) + // Confirm the CRC matches for the uploaded byte buffer flux + .then(originalContent.checkMatch(byteBufferFlux, span)); + } + + @Override + public Mono setupAsync() { + return super.setupAsync().then(originalContent.setupBlob(asyncNoFaultClient, options.getSize())); + } + + @Override + public Mono cleanupAsync() { + return asyncNoFaultClient.delete() + .then(super.cleanupAsync()); + } + +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/Upload.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/Upload.java new file mode 100644 index 000000000000..bcdefb7bedf3 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/Upload.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.util.Context; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlobClient; +import com.azure.storage.blob.models.ParallelTransferOptions; +import com.azure.storage.blob.options.BlobParallelUploadOptions; +import com.azure.storage.stress.CrcInputStream; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.v2.storage.blob.stress.utils.OriginalContent; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.nio.ByteBuffer; + +public class Upload extends BlobScenarioBase { + private final OriginalContent originalContent = new OriginalContent(); + private final BlobClient syncClient; + private final BlobAsyncClient asyncClient; + private final BlobAsyncClient asyncNoFaultClient; + private final ParallelTransferOptions parallelTransferOptions; + + public Upload(StorageStressOptions options) { + super(options); + String blobName = generateBlobName(); + this.asyncNoFaultClient = getAsyncContainerClientNoFault().getBlobAsyncClient(blobName); + this.syncClient = getSyncContainerClient().getBlobClient(blobName); + this.asyncClient = getAsyncContainerClient().getBlobAsyncClient(blobName); + parallelTransferOptions = new ParallelTransferOptions() + .setMaxConcurrency(options.getMaxConcurrency()) + .setMaxSingleUploadSizeLong(4 * 1024 * 1024L); + } + + @Override + protected void runInternal(Context span) { + try (CrcInputStream inputStream = new CrcInputStream(originalContent.getBlobContentHead(), options.getSize())) { + syncClient.uploadWithResponse(new BlobParallelUploadOptions(inputStream) + .setParallelTransferOptions(parallelTransferOptions), null, span); + originalContent.checkMatch(inputStream.getContentInfo(), span).block(); + } + } + + @Override + protected Mono runInternalAsync(Context span) { + Flux byteBufferFlux = new CrcInputStream(originalContent.getBlobContentHead(), options.getSize()) + .convertStreamToByteBuffer(); + + // Using the same Flux that was used to upload the blob to check the content. + return asyncClient.uploadWithResponse(new BlobParallelUploadOptions(byteBufferFlux) + .setParallelTransferOptions(parallelTransferOptions)) + .then(originalContent.checkMatch(byteBufferFlux, span)); + } + + @Override + public Mono setupAsync() { + return super.setupAsync().then(originalContent.setupBlob(asyncNoFaultClient, options.getSize())); + } + + @Override + public Mono cleanupAsync() { + return asyncNoFaultClient.delete() + .then(super.cleanupAsync()); + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/UploadFromFile.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/UploadFromFile.java new file mode 100644 index 000000000000..e767c44475a9 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/UploadFromFile.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlobClient; +import com.azure.storage.blob.models.ParallelTransferOptions; +import com.azure.storage.blob.options.BlobDownloadToFileOptions; +import com.azure.storage.blob.options.BlobUploadFromFileOptions; +import com.azure.storage.stress.CrcInputStream; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.v2.storage.blob.stress.utils.OriginalContent; +import reactor.core.publisher.Mono; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.util.UUID; + +public class UploadFromFile extends BlobScenarioBase { + private static final ClientLogger LOGGER = new ClientLogger(UploadFromFile.class); + private final OriginalContent originalContent = new OriginalContent(); + private final BlobClient syncClient; + private final BlobAsyncClient asyncClient; + private final BlobClient syncNoFaultClient; + private final BlobAsyncClient asyncNoFaultClient; + private final ParallelTransferOptions parallelTransferOptions; + + public UploadFromFile(StorageStressOptions options) { + super(options); + String blobName = generateBlobName(); + this.asyncNoFaultClient = getAsyncContainerClientNoFault().getBlobAsyncClient(blobName); + this.syncNoFaultClient = getSyncContainerClientNoFault().getBlobClient(blobName); + this.syncClient = getSyncContainerClient().getBlobClient(blobName); + this.asyncClient = getAsyncContainerClient().getBlobAsyncClient(blobName); + this.parallelTransferOptions = new ParallelTransferOptions() + .setMaxConcurrency(options.getMaxConcurrency()) + .setMaxSingleUploadSizeLong(4 * 1024 * 1024L); + } + + @Override + protected void runInternal(Context span) { + // first upload file using faulted client + Path downloadPath = getTempPath("test"); + try (CrcInputStream inputStream = new CrcInputStream(originalContent.getBlobContentHead(), options.getSize())) { + Path uploadFilePath = generateFile(inputStream); + downloadPath = downloadPath.resolve(CoreUtils.randomUuid() + ".txt"); + syncClient.uploadFromFileWithResponse(new BlobUploadFromFileOptions(uploadFilePath.toString()) + .setParallelTransferOptions(parallelTransferOptions), null, span); + // then download file using no fault client to verify the content + syncNoFaultClient.downloadToFileWithResponse( + new BlobDownloadToFileOptions(downloadPath.toString()), null, span); + originalContent.checkMatch(BinaryData.fromFile(downloadPath), span).block(); + } finally { + deleteFile(downloadPath); + } + } + + @Override + protected Mono runInternalAsync(Context span) { + Path downloadPath = getTempPath("test"); + return Mono.using( + () -> new CrcInputStream(originalContent.getBlobContentHead(), options.getSize()), + inputStream -> { + Path uploadFilePath = generateFile(inputStream); + return Mono.using( + () -> downloadPath.resolve(UUID.randomUUID() + ".txt"), + path -> asyncClient.uploadFromFileWithResponse(new BlobUploadFromFileOptions(uploadFilePath.toString()) + .setParallelTransferOptions(parallelTransferOptions)) + .flatMap(ignored -> asyncNoFaultClient.downloadToFileWithResponse( + new BlobDownloadToFileOptions(path.toString())) + ) + .flatMap(ignored -> originalContent.checkMatch(BinaryData.fromFile(path), span)), + UploadFromFile::deleteFile); + }, + CrcInputStream::close); + } + + @Override + public Mono setupAsync() { + return super.setupAsync().then(originalContent.setupBlob(asyncNoFaultClient, options.getSize())); + } + + @Override + public Mono cleanupAsync() { + return asyncNoFaultClient.deleteIfExists() + .then(super.cleanupAsync()); + } + + + private Path getTempPath(String prefix) { + try { + return Files.createTempDirectory(prefix); + } catch (IOException e) { + throw LOGGER.logExceptionAsError(new UncheckedIOException(e)); + } + } + + private static void deleteFile(Path path) { + try { + path.toFile().delete(); + } catch (Throwable e) { + LOGGER.atError() + .addKeyValue("path", path) + .log("failed to delete file", e); + } + } + + private static Path generateFile(InputStream inputStream) { + try { + File file = Files.createTempFile(CoreUtils.randomUuid().toString(), ".txt").toFile(); + file.deleteOnExit(); + Files.copy(inputStream, file.toPath(), StandardCopyOption.REPLACE_EXISTING); + return file.toPath(); + } catch (IOException e) { + throw LOGGER.logExceptionAsError(new UncheckedIOException(e)); + } + } + +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/UploadPages.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/UploadPages.java new file mode 100644 index 000000000000..afd017e2cc10 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/UploadPages.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; + +import com.azure.core.util.Context; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlobClient; +import com.azure.storage.blob.models.PageRange; +import com.azure.storage.blob.specialized.PageBlobAsyncClient; +import com.azure.storage.blob.specialized.PageBlobClient; +import com.azure.storage.common.Utility; +import com.azure.storage.stress.CrcInputStream; +import com.azure.storage.stress.StorageStressOptions; +import com.azure.v2.storage.blob.stress.utils.OriginalContent; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.nio.ByteBuffer; + +public class UploadPages extends PageBlobScenarioBase { + private final OriginalContent originalContent = new OriginalContent(); + private final BlobClient syncClient; + private final BlobAsyncClient asyncClient; + private final BlobAsyncClient asyncNoFaultClient; + private final PageBlobAsyncClient tempSetupPageBlobClient; + + public UploadPages(StorageStressOptions options) { + super(options); + String blobName = generateBlobName(); + String tempBlobName = generateBlobName(); + + this.asyncNoFaultClient = getAsyncContainerClientNoFault().getBlobAsyncClient(blobName); + this.syncClient = getSyncContainerClient().getBlobClient(blobName); + this.asyncClient = getAsyncContainerClient().getBlobAsyncClient(blobName); + // this blob is used to perform normal upload in the setup phase + BlobAsyncClient tempSetupBlobClient = getAsyncContainerClientNoFault().getBlobAsyncClient(tempBlobName); + this.tempSetupPageBlobClient = tempSetupBlobClient.getPageBlobAsyncClient(); + } + + @Override + protected void runInternal(Context span) { + try (CrcInputStream inputStream = new CrcInputStream(originalContent.getBlobContentHead(), options.getSize())) { + PageBlobClient pageBlobClient = syncClient.getPageBlobClient(); + pageBlobClient.uploadPagesWithResponse(new PageRange().setStart(0).setEnd(options.getSize() - 1), + inputStream, null, null, null, span); + originalContent.checkMatch(inputStream.getContentInfo(), span).block(); + } + } + + @Override + protected Mono runInternalAsync(Context span) { + PageBlobAsyncClient pageBlobAsyncClient = asyncClient.getPageBlobAsyncClient(); + Flux byteBufferFlux = Utility.convertStreamToByteBuffer( + new CrcInputStream(originalContent.getBlobContentHead(), options.getSize()), options.getSize(), + PageBlobClient.PAGE_BYTES); + return pageBlobAsyncClient.uploadPagesWithResponse(new PageRange().setStart(0).setEnd(options.getSize() - 1), + byteBufferFlux, null, null) + .then(originalContent.checkMatch(byteBufferFlux, span)); + } + + @Override + public Mono setupAsync() { + return super.setupAsync() + .then(asyncNoFaultClient.getPageBlobAsyncClient().create(options.getSize())) + .then(tempSetupPageBlobClient.create(options.getSize())) + .then(originalContent.setupPageBlob(tempSetupPageBlobClient, options.getSize())); + } + + @Override + public Mono cleanupAsync() { + return asyncNoFaultClient.getPageBlobAsyncClient().delete() + .then(tempSetupPageBlobClient.delete()) + .then(super.cleanupAsync()); + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/package-info.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/package-info.java new file mode 100644 index 000000000000..34384cbb3638 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/package-info.java @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress; diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/utils/OriginalContent.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/utils/OriginalContent.java new file mode 100644 index 000000000000..1aa57ca9ba33 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/utils/OriginalContent.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress.utils; + +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.tracing.Tracer; +import com.azure.core.util.tracing.TracerProvider; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.models.PageRange; +import com.azure.storage.blob.models.ParallelTransferOptions; +import com.azure.storage.blob.specialized.PageBlobAsyncClient; +import com.azure.storage.stress.ContentInfo; +import com.azure.storage.stress.ContentMismatchException; +import com.azure.storage.stress.CrcInputStream; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.nio.ByteBuffer; +import java.util.Base64; + +import static com.azure.core.util.FluxUtil.monoError; +import static com.azure.core.util.FluxUtil.toFluxByteBuffer; + +public class OriginalContent { + private final static ClientLogger LOGGER = new ClientLogger(OriginalContent.class); + private final static Tracer TRACER = TracerProvider.getDefaultProvider().createTracer("unused", null, null, null); + private static final String BLOB_CONTENT_HEAD_STRING = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, " + + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. " + + "Pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat vivamus. Massa sapien faucibus et molestie ac feugiat sed lectus. " + + "Sed pulvinar proin gravida hendrerit."; + + private static final BinaryData BLOB_CONTENT_HEAD = BinaryData.fromString(BLOB_CONTENT_HEAD_STRING); + private long dataChecksum = -1; + private long blobSize = 0; + + public OriginalContent() { + } + + public Mono setupBlob(BlobAsyncClient blobClient, long blobSize) { + if (dataChecksum != -1) { + throw LOGGER.logExceptionAsError(new IllegalStateException("setupBlob can't be called again")); + } + + this.blobSize = blobSize; + return Mono.using( + () -> new CrcInputStream(BLOB_CONTENT_HEAD, blobSize), + data -> blobClient + .upload(toFluxByteBuffer(data, 8192), + new ParallelTransferOptions() + .setMaxSingleUploadSizeLong(4 * 1024 * 1024L) + .setMaxConcurrency(1)) + .then(data.getContentInfo()), + CrcInputStream::close) + .map(info -> dataChecksum = info.getCrc()) + .then(); + } + + public Mono setupPageBlob(PageBlobAsyncClient blobClient, long blobSize) { + if (dataChecksum != -1) { + throw LOGGER.logExceptionAsError(new IllegalStateException("setupBlob can't be called again")); + } + + this.blobSize = blobSize; + return Mono.using( + () -> new CrcInputStream(BLOB_CONTENT_HEAD, blobSize), + data -> blobClient + .uploadPages(new PageRange().setStart(0).setEnd(blobSize - 1), toFluxByteBuffer(data, 8192)) + .then(data.getContentInfo()), + CrcInputStream::close) + .map(info -> dataChecksum = info.getCrc()) + .then(); + } + + public Mono checkMatch(BinaryData data, Context span) { + return checkMatch(data.toFluxByteBuffer(), span); + } + + public Mono checkMatch(Flux data, Context span) { + return checkMatch(ContentInfo.fromFluxByteBuffer(data), span); + } + + public Mono checkMatch(Mono contentInfo, Context span) { + if (dataChecksum == -1) { + return monoError(LOGGER, new IllegalStateException("setupBlob must complete first")); + } + return contentInfo + .flatMap(info -> { + if (info.getCrc() != dataChecksum) { + logMismatch(info.getCrc(), info.getLength(), info.getHead(), span); + return Mono.error(new ContentMismatchException()); + } + + return Mono.empty(); + }); + } + + @SuppressWarnings("try") + private void logMismatch(long actualCrc, long actualLength, ByteBuffer actualContentHead, Context span) { + try(AutoCloseable scope = TRACER.makeSpanCurrent(span)) { + // future: if mismatch, compare against original file + LOGGER.atError() + .addKeyValue("expectedCrc", dataChecksum) + .addKeyValue("actualCrc", actualCrc) + .addKeyValue("expectedLength", blobSize) + .addKeyValue("actualLength", actualLength) + .addKeyValue("actualContentHead", Base64.getEncoder().encode(actualContentHead)) + .log("mismatched crc"); + } catch (Throwable e) { + throw LOGGER.logExceptionAsError(new RuntimeException(e)); + } + } + + public BinaryData getBlobContentHead() { + return BLOB_CONTENT_HEAD; + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/utils/OriginalContentV2.java b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/utils/OriginalContentV2.java new file mode 100644 index 000000000000..d961b1daeec3 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/java/com/azure/v2/storage/blob/stress/utils/OriginalContentV2.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.blob.stress.utils; + +import com.azure.v2.core.util.tracing.Tracer; +import com.azure.v2.core.util.tracing.TracerProvider; +import com.azure.v2.storage.blob.BlockBlobClient; +import com.azure.v2.storage.stress.ContentInfo; +import com.azure.v2.storage.stress.ContentMismatchException; +import com.azure.v2.storage.stress.CrcInputStream; +import io.clientcore.core.instrumentation.logging.ClientLogger; +import io.clientcore.core.models.binarydata.BinaryData; +import io.clientcore.core.utils.Context; + +import java.nio.ByteBuffer; +import java.util.Base64; + +public class OriginalContentV2 { + private final static ClientLogger LOGGER = new ClientLogger(OriginalContent.class); + private final static Tracer TRACER = TracerProvider.getDefaultProvider().createTracer("unused", null, null, null); + private static final String BLOB_CONTENT_HEAD_STRING = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, " + + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. " + + "Pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat vivamus. Massa sapien faucibus et molestie ac feugiat sed lectus. " + + "Sed pulvinar proin gravida hendrerit."; + + private static final BinaryData BLOB_CONTENT_HEAD = BinaryData.fromString(BLOB_CONTENT_HEAD_STRING); + private long dataChecksum = -1; + private long blobSize = 0; + + public OriginalContentV2() { + } + + public void setupBlob(String containerName, String blobName, BlockBlobClient blockBlobClient, long blobSize) { + if (dataChecksum != -1) { + throw LOGGER.logThrowableAsError(new IllegalStateException("setupBlob can't be called again")); + } + + this.blobSize = blobSize; + + CrcInputStream crcInputStream = new CrcInputStream(BLOB_CONTENT_HEAD, blobSize); + + blockBlobClient.upload(containerName, blobName, blobSize, BinaryData.fromStream(crcInputStream), null, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null); + + ContentInfo contentInfo = crcInputStream.getContentInfo().block(); + + crcInputStream.close(); + + dataChecksum = contentInfo.getCrc(); + } + + /*public Mono setupPageBlob(PageBlobAsyncClient blobClient, long blobSize) { + if (dataChecksum != -1) { + throw LOGGER.logThrowableAsError(new IllegalStateException("setupBlob can't be called again")); + } + + this.blobSize = blobSize; + return Mono.using( + () -> new CrcInputStream(BLOB_CONTENT_HEAD, blobSize), + data -> blobClient + .uploadPages(new PageRange().setStart(0).setEnd(blobSize - 1), toFluxByteBuffer(data, 8192)) + .then(data.getContentInfo()), + CrcInputStream::close) + .map(info -> dataChecksum = info.getCrc()) + .then(); + }*/ + + public void checkMatch(BinaryData data, Context span) { + checkMatch(ContentInfo.fromBinaryData(data), span); + } + + public void checkMatch(ContentInfo contentInfo, Context span) { + if (dataChecksum == -1) { + throw LOGGER.logThrowableAsError(new IllegalStateException("setupBlob must complete first")); + } + + if (contentInfo.getCrc() != dataChecksum) { + logMismatch(contentInfo.getCrc(), contentInfo.getLength(), contentInfo.getHead(), span); + + throw LOGGER.logThrowableAsError(new ContentMismatchException()); + } + } + + @SuppressWarnings("try") + private void logMismatch(long actualCrc, long actualLength, ByteBuffer actualContentHead, Context span) { + try(AutoCloseable scope = TRACER.makeSpanCurrent(span)) { + // future: if there is a mismatch, compare against the original file + LOGGER.atError() + .addKeyValue("expectedCrc", dataChecksum) + .addKeyValue("actualCrc", actualCrc) + .addKeyValue("expectedLength", blobSize) + .addKeyValue("actualLength", actualLength) + .addKeyValue("actualContentHead", Base64.getEncoder().encode(actualContentHead)) + .log("mismatched crc"); + } catch (Throwable e) { + throw LOGGER.logThrowableAsError(new RuntimeException(e)); + } + } + + public BinaryData getBlobContentHead() { + return BLOB_CONTENT_HEAD; + } +} diff --git a/sdk/storage/azure-storage-blob-stress-v2/src/main/resources/logback.xml b/sdk/storage/azure-storage-blob-stress-v2/src/main/resources/logback.xml new file mode 100644 index 000000000000..6a474dec63af --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/src/main/resources/logback.xml @@ -0,0 +1,27 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + # this is the category used by HTTP logging policy, add more/adjust as needed + + + + + + + + diff --git a/sdk/storage/azure-storage-blob-stress-v2/stress-test-resources.bicep b/sdk/storage/azure-storage-blob-stress-v2/stress-test-resources.bicep new file mode 100644 index 000000000000..724fa54d16af --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/stress-test-resources.bicep @@ -0,0 +1,36 @@ +param baseName string +param location string = resourceGroup().location +param urlSuffix string = environment().suffixes.storage + +var primaryAccountName = baseName +//var pageBlobStorageAccountName = '${baseName}pageblob' + +resource primaryAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = { + name: primaryAccountName + location: location + sku: { + name: 'Premium_LRS' + } + kind: 'BlockBlobStorage' + properties: {} +} + +var sasToken = primaryAccount.listAccountSas('2023-05-01', { + signedServices: 'b' + signedResourceTypes: 'sco' + signedPermission: 'rwdlacup' + signedExpiry: '2025-12-31T23:59:59Z' +}).accountSasToken + +/*resource pageBlobStorageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = { + name: pageBlobStorageAccountName + location: location + sku: { + name: 'Premium_LRS' + } + kind: 'StorageV2' + properties: {} +}*/ + +output STORAGE_ENDPOINT_STRING string = '"https://${primaryAccountName}.blob.${urlSuffix}/?${sasToken}"' +//output PAGE_BLOB_STORAGE_ENDPOINT_STRING string = '"https://${pageBlobStorageAccountName}.blob.core.windows.net/${sasToken}"' diff --git a/sdk/storage/azure-storage-blob-stress-v2/templates/stress-test-job.yaml b/sdk/storage/azure-storage-blob-stress-v2/templates/stress-test-job.yaml new file mode 100644 index 000000000000..13ea8a6903f6 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/templates/stress-test-job.yaml @@ -0,0 +1,70 @@ +{{- include "stress-test-addons.deploy-job-template.from-pod" (list . "stress.deploy-example") -}} + {{- define "stress.deploy-example" -}} +metadata: + labels: + chaos: "{{ default false .Stress.chaos }}" + testInstance: "{{.Stress.Scenario}}-{{ .Stress.BaseName }}-{{ .Release.Revision }}" +spec: + nodeSelector: + sku: default + shareProcessNamespace: true + containers: + - name: fault-injector + image: azsdkengsys.azurecr.io/stress/httpfaultinjector + imagePullPolicy: Always + command: ['sh', '-c'] + args: + - | + set -ex; + dotnet dev-certs https --export-path /mnt/outputs/dev-cert.pfx; + /root/.dotnet/tools/http-fault-injector; + resources: + limits: + memory: 1Gi + cpu: "0.5" + {{- include "stress-test-addons.container-env" . | nindent 6 }} + - name: main + image: {{ .Stress.imageTag }} + command: ['sh', '-c'] + args: + - | + set -xa; + set -o pipefail; + keytool -import -alias test -file /mnt/outputs/dev-cert.pfx -keystore ${JAVA_HOME}/lib/security/cacerts -noprompt -keypass changeit -storepass changeit; + mkdir -p "$DEBUG_SHARE"; + . /mnt/outputs/.env; + export AZURE_HTTP_CLIENT_IMPLEMENTATION=com.azure.core.http.netty.NettyAsyncHttpClientProvider; + echo "setting http client implementation to $AZURE_HTTP_CLIENT_IMPLEMENTATION"; + java \ + -Dotel.service.name={{ .Release.Name }}-{{ .Stress.BaseName }} \ + -Dotel.traces.sampler=traceidratio \ + -Dotel.traces.sampler.arg=0.001 \ + -XX:InitialRAMPercentage=50 \ + -XX:MaxRAMPercentage=50 \ + -XX:+HeapDumpOnOutOfMemoryError \ + -XX:HeapDumpPath="${DEBUG_SHARE}" \ + -Dreactor.schedulers.defaultBoundedElasticSize={{ 25 }} \ + -jar /app/azure-storage-blob-stress-v2-1.0.0-beta.1-jar-with-dependencies.jar \ + {{ .Stress.testScenario }} \ + --parallel {{ default 3 .Stress.parallelRuns }} \ + --maxConcurrency {{ default 10 .Stress.maxConcurrency }} \ + --duration {{ mul 60 .Stress.durationMin }} \ + --size {{ .Stress.sizeBytes }} \ + {{ ternary "--sync" "" .Stress.sync }} \ + {{ ternary "--downloadFaults" "" (default false .Stress.downloadFaults) }} \ + {{ ternary "--uploadFaults" "" (default false .Stress.uploadFaults) }} \ + --warmup 0 \ + 2>&1 | tee -a "${DEBUG_SHARE}/{{ .Stress.testScenario }}-`date +%s`.log"; + code=$?; + echo "before the kill command"; + kill `pidof http-fault-injector`; + echo "HTTP Fault Injector killed"; + exit $code; + imagePullPolicy: Always + resources: + limits: + memory: {{ default "1Gi" .Stress.memory }} + cpu: "0.7" + {{- include "stress-test-addons.container-env" . | nindent 6 }} + +{{- end -}} diff --git a/sdk/storage/azure-storage-blob-stress-v2/workbook/test-workbook.json b/sdk/storage/azure-storage-blob-stress-v2/workbook/test-workbook.json new file mode 100644 index 000000000000..57cb75161333 --- /dev/null +++ b/sdk/storage/azure-storage-blob-stress-v2/workbook/test-workbook.json @@ -0,0 +1,286 @@ +{ + "version": "Notebook/1.0", + "items": [ + { + "type": 1, + "content": { + "json": "## Storage for Java stress testing\n\nEnter the test runId - it matches Storage resource name and is a suffix in AppInsights role name." + }, + "name": "text - 2" + }, + { + "type": 9, + "content": { + "version": "KqlParameterItem/1.0", + "parameters": [ + { + "id": "ab5bb927-f8a4-4491-8621-d300820d2ff3", + "version": "KqlParameterItem/1.0", + "name": "timeRange", + "label": "Time Range", + "type": 4, + "typeSettings": { + "selectableValues": [ + { + "durationMs": 900000 + }, + { + "durationMs": 1800000 + }, + { + "durationMs": 3600000 + }, + { + "durationMs": 14400000 + }, + { + "durationMs": 43200000 + }, + { + "durationMs": 86400000 + }, + { + "durationMs": 172800000 + }, + { + "durationMs": 259200000 + }, + { + "durationMs": 604800000 + } + ], + "allowCustom": true + }, + "value": { + "durationMs": 172800000 + } + }, + { + "id": "1b563bbe-70e0-48e6-ae33-d71d97ab8332", + "version": "KqlParameterItem/1.0", + "name": "runId", + "type": 2, + "isRequired": true, + "query": "dependencies \r\n| where timestamp >= {timeRange:start} and timestamp <= {timeRange:end}\r\n| where cloud_RoleName startswith \"java-storage\" and name == \"before run\"\r\n| extend runId = tostring(split(cloud_RoleName, \"-\")[-1])\r\n| summarize start=min(timestamp) by runId, cloud_RoleInstance \r\n| order by start desc\r\n| project runId, pod=cloud_RoleInstance", + "typeSettings": { + "additionalResourceOptions": [], + "showDefault": false + }, + "queryType": 0, + "resourceType": "microsoft.insights/components", + "value": null + } + ], + "style": "pills", + "queryType": 0, + "resourceType": "microsoft.insights/components" + }, + "customWidth": "30", + "name": "parameters - 2", + "styleSettings": { + "maxWidth": "30" + } + }, + { + "type": 3, + "content": { + "version": "KqlItem/1.0", + "query": "let runs = customMetrics \r\n| where timestamp >= {timeRange:start} and timestamp <= {timeRange:end}\r\n| where cloud_RoleName startswith \"java-storage\" \r\n| extend runId = tostring(split(cloud_RoleName, \"-\")[-1])\r\n| summarize start=min(timestamp), end=max(timestamp) by runId\r\n| project start, duration= end-start, runId;\r\nlet runSpans = dependencies\r\n| where timestamp >= {timeRange:start} and timestamp <= {timeRange:end}\r\n| where cloud_RoleName startswith \"java-storage\" and name == \"before run\"\r\n| extend runId = tostring(split(cloud_RoleName, \"-\")[-1])\r\n| extend packageVersion=coalesce(customDimensions[\"storagePackageVersion\"], \"null\")\r\n| extend scenarioName=tostring(split(coalesce(customDimensions[\"scenarioName\"], \"null\"), \".\")[-1])\r\n| extend sync=coalesce(customDimensions[\"sync\"], \"null\")\r\n| extend concurrency=coalesce(customDimensions[\"concurrency\"], \"null\")\r\n| extend payloadSize=coalesce(customDimensions[\"payloadSize\"], \"null\")\r\n| extend pod=tostring(customDimensions[\"hostname\"]);\r\nruns \r\n| join kind = innerunique runSpans on runId\r\n| project runId, start, duration, scenarioName, concurrency, payloadSize, sync, pod, packageVersion\r\n", + "size": 0, + "title": "Runs in {timeRange:label}", + "noDataMessageStyle": 5, + "queryType": 0, + "resourceType": "microsoft.insights/components", + "gridSettings": { + "sortBy": [ + { + "itemKey": "start", + "sortOrder": 2 + } + ] + }, + "sortBy": [ + { + "itemKey": "start", + "sortOrder": 2 + } + ] + }, + "customWidth": "70", + "name": "query - 8", + "styleSettings": { + "maxWidth": "100" + } + }, + { + "type": 3, + "content": { + "version": "KqlItem/1.0", + "query": "let runId = \"{runId}\";\r\nlet runDuration = customMetrics\r\n| where timestamp >= {timeRange:start} and timestamp <= {timeRange:end}\r\n| where cloud_RoleName endswith runId\r\n| where name == \"test.run.duration\"\r\n| extend errorType = tostring(customDimensions[\"error.type\"]);\r\nlet testSpans = dependencies\r\n| where timestamp >= {timeRange:start} and timestamp <= {timeRange:end}\r\n| where cloud_RoleName endswith runId;\r\nlet errors = runDuration\r\n| summarize error_by_type=toint(sum(valueCount)) by errorType\r\n| summarize test_errors=make_bag(bag_pack(errorType, error_by_type))\r\n| evaluate narrow();\r\nlet runCounter = runDuration\r\n| summarize successful_runs=sumif(valueCount, errorType == \"\"), failed_runs=sumif(valueCount, errorType != \"\")\r\n| evaluate narrow();\r\nlet actualDuration = testSpans \r\n| where name == \"after run\"\r\n| summarize actual_test_duration_in_sec = max(toreal(customDimensions[\"durationMs\"])/1000) by cloud_RoleInstance\r\n| evaluate narrow();\r\nlet avgThroughput = runDuration\r\n| summarize throughputPerMin=sum(valueCount) by bin(timestamp, 1m) // in case AppInsights ingestion drops something\r\n| summarize avg_throughtput_per_sec=round(avg(throughputPerMin/60), 2)\r\n| evaluate narrow();\r\nlet parameters = testSpans \r\n| where name == \"before run\" \r\n| project parameters=bag_remove_keys(customDimensions, dynamic(['duration', 'sample.in', 'name', 'jreVendor']))\r\n| evaluate narrow();\r\nparameters \r\n| union runCounter, actualDuration, errors, avgThroughput\r\n| project Property = Column, Value\r\n", + "size": 0, + "title": "Test summary", + "queryType": 0, + "resourceType": "microsoft.insights/components", + "gridSettings": { + "sortBy": [ + { + "itemKey": "Property", + "sortOrder": 1 + } + ] + }, + "sortBy": [ + { + "itemKey": "Property", + "sortOrder": 1 + } + ] + }, + "name": "query - 11" + }, + { + "type": 3, + "content": { + "version": "KqlItem/1.0", + "query": "customMetrics\r\n| where timestamp >= {timeRange:start} and timestamp <= {timeRange:end}\r\n| where name == \"test.run.duration\" and cloud_RoleName startswith \"java-storage\" and cloud_RoleName endswith \"{runId}\"\r\n| where customDimensions[\"error.type\"] == \"\"\r\n| summarize successful_runs=sum(valueCount) by bin(timestamp, 1m)\r\n| render timechart", + "size": 0, + "aggregation": 3, + "title": "Download rate (per minute)", + "noDataMessageStyle": 5, + "queryType": 0, + "resourceType": "microsoft.insights/components" + }, + "customWidth": "30", + "name": "query - 3", + "styleSettings": { + "maxWidth": "30", + "showBorder": true + } + }, + { + "type": 3, + "content": { + "version": "KqlItem/1.0", + "query": "customMetrics\r\n| where timestamp >= {timeRange:start} and timestamp <= {timeRange:end}\r\n| where name == \"test.run.duration\"\r\n| where cloud_RoleName startswith \"java-storage\" and cloud_RoleName endswith \"{runId}\"\r\n| where customDimensions[\"error.type\"] == \"\"\r\n| summarize avg_duration = avg(valueSum/valueCount) * 1000 by bin(timestamp, 1m)\r\n| render timechart", + "size": 0, + "aggregation": 3, + "title": "Duration (ms), average per minute, successful only", + "noDataMessageStyle": 5, + "queryType": 0, + "resourceType": "microsoft.insights/components" + }, + "customWidth": "30", + "name": "query - 5", + "styleSettings": { + "maxWidth": "30" + } + }, + { + "type": 3, + "content": { + "version": "KqlItem/1.0", + "query": "customMetrics\r\n| where timestamp >= {timeRange:start} and timestamp <= {timeRange:end}\r\n| where cloud_RoleName startswith \"java-storage\" and cloud_RoleName endswith \"{runId}\"\r\n| where name == \"test.run.duration\"\r\n| extend status = tostring(customDimensions[\"error.type\"])\r\n| where status != \"\"\r\n| summarize test_errors = sum(valueCount) by status, bin(timestamp, 1m)\r\n| render timechart", + "size": 0, + "aggregation": 3, + "title": "Error rate (per minute)", + "queryType": 0, + "resourceType": "microsoft.insights/components" + }, + "customWidth": "30", + "name": "query - 10", + "styleSettings": { + "maxWidth": "30" + } + }, + { + "type": 3, + "content": { + "version": "KqlItem/1.0", + "query": "customMetrics\r\n| where timestamp >= {timeRange:start} and timestamp <= {timeRange:end}\r\n| where cloud_RoleName startswith \"java-storage\" and cloud_RoleName endswith \"{runId}\"\r\n| where name == \"process.runtime.jvm.memory.usage\" and customDimensions[\"type\"]==\"heap\"\r\n| summarize heap_memory_used=sum(valueSum/valueCount) by bin(timestamp, 1m)\r\n| render timechart", + "size": 0, + "aggregation": 2, + "title": "Heap memory used (MB)", + "queryType": 0, + "resourceType": "microsoft.insights/components" + }, + "customWidth": "30", + "name": "query - 8", + "styleSettings": { + "maxWidth": "30" + } + }, + { + "type": 3, + "content": { + "version": "KqlItem/1.0", + "query": "customMetrics\r\n| where timestamp >= {timeRange:start} and timestamp <= {timeRange:end}\r\n| where cloud_RoleName startswith \"java-storage\" and cloud_RoleName endswith \"{runId}\"\r\n| where name == \"process.runtime.jvm.cpu.utilization\"\r\n| summarize cpu_time_percent=avg(value) * 100 by bin(timestamp, 1m)\r\n| render timechart\r\n", + "size": 0, + "aggregation": 3, + "title": "CPU %", + "queryType": 0, + "resourceType": "microsoft.insights/components" + }, + "customWidth": "30", + "name": "query - 9", + "styleSettings": { + "maxWidth": "30" + } + }, + { + "type": 3, + "content": { + "version": "KqlItem/1.0", + "query": "customMetrics\r\n| where timestamp >= {timeRange:start} and timestamp <= {timeRange:end}\r\n| where cloud_RoleName startswith \"java-storage\" and cloud_RoleName endswith \"{runId}\"\r\n| where name == \"process.runtime.jvm.threads.count\"\r\n| summarize max_thread_count=max(valueMax) by bin(timestamp, 1m)\r\n| render timechart\r\n", + "size": 0, + "aggregation": 3, + "title": "Thread count", + "queryType": 0, + "resourceType": "microsoft.insights/components" + }, + "customWidth": "15", + "name": "query - 8", + "styleSettings": { + "maxWidth": "15" + } + }, + { + "type": 3, + "content": { + "version": "KqlItem/1.0", + "query": "customMetrics\r\n| where timestamp >= {timeRange:start} and timestamp <= {timeRange:end}\r\n| where cloud_RoleName startswith \"java-storage\" and cloud_RoleName endswith \"{runId}\"\r\n| where name == \"process.runtime.jvm.gc.duration\" \r\n| extend gc_type=tostring(customDimensions[\"gc\"])\r\n| summarize gc_percentage=sum(valueSum) / 60 * 100 by gc_type, bin(timestamp, 1m)\r\n| render timechart\r\n", + "size": 0, + "aggregation": 3, + "title": "% of time spent in GC", + "queryType": 0, + "resourceType": "microsoft.insights/components" + }, + "customWidth": "15", + "name": "query - 9", + "styleSettings": { + "maxWidth": "15" + } + }, + { + "type": 3, + "content": { + "version": "KqlItem/1.0", + "query": "let runId = \"{runId}\";\r\nlet role_name=strcat(\"java-storage\", runId);\r\nlet downloads=dependencies \r\n| where timestamp >= {timeRange:start} and timestamp <= {timeRange:end}\r\n| where cloud_RoleName == role_name and (name == \"run\" or name == \"runAsync\")\r\n| project timestamp, duration, name, traceId=operation_Id, status=tostring(customDimensions[\"error.type\"]), success;\r\nlet faultInjections=traces \r\n| where timestamp >= {timeRange:start} and timestamp <= {timeRange:end}\r\n| where cloud_RoleName == role_name\r\n| where message startswith \"{\\\"az.sdk.message\"\r\n| project timestamp, logger=customDimensions[\"LoggerName\"], level=customDimensions[\"LoggingLevel\"], thread=customDimensions[\"ThreadName\"], azSdkContext=parse_json(message)\r\n| where azSdkContext[\"az.sdk.message\"] == \"HTTP request\"\r\n| extend fault = coalesce(azSdkContext[\"x-ms-faultinjector-response-option\"], \"none\")\r\n| extend traceId=tostring(split(azSdkContext[\"traceparent\"], \"-\")[1])\r\n| project fault, traceId;\r\ndownloads \r\n| join kind=leftouter faultInjections on traceId\r\n| where success == False\r\n| summarize faults = make_list(fault) by timestamp, status, duration, traceId\r\n", + "size": 0, + "title": "Examples of failed operations (survived after sampling)", + "noDataMessage": "so empty", + "queryType": 0, + "resourceType": "microsoft.insights/components", + "sortBy": [] + }, + "customWidth": "100", + "name": "query - 9", + "styleSettings": { + "maxWidth": "100" + } + } + ], + "fallbackResourceIds": [ + "/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourceGroups/rg-stress-cluster-pg/providers/Microsoft.Insights/components/stress-pg-ai-s7b6dif73rup6" + ], + "$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json" +} diff --git a/sdk/storage/azure-storage-blob-v2/CHANGELOG.md b/sdk/storage/azure-storage-blob-v2/CHANGELOG.md new file mode 100644 index 000000000000..13dd08af78ab --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes diff --git a/sdk/storage/azure-storage-blob-v2/README.md b/sdk/storage/azure-storage-blob-v2/README.md new file mode 100644 index 000000000000..b116284e07a8 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/README.md @@ -0,0 +1,15 @@ +# Azure Storage Blob client library for Java + +## Getting started + +## Key concepts + +## Examples + +## Troubleshooting + +## Next steps + +## Next steps Samples + +## Contributing diff --git a/sdk/storage/azure-storage-blob-v2/pom.xml b/sdk/storage/azure-storage-blob-v2/pom.xml new file mode 100644 index 000000000000..74b8420b9338 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/pom.xml @@ -0,0 +1,60 @@ + + 4.0.0 + + + com.azure + azure-client-sdk-parent-v2 + 1.0.0-beta.1 + ../../parents/azure-client-sdk-parent-v2 + + + com.azure + azure-storage-blob-v2 + 1.0.0-beta.1 + + Microsoft Azure SDK V2 for Storage Blob + This package contains Microsoft Azure SDK V2 for Storage Blob. + + + + azure-java-build-docs + ${site.url}/site/${project.artifactId} + + + + + https://github.com/Azure/azure-sdk-for-java + + + + + io.clientcore + core + 1.0.0-beta.5 + + + com.azure + azure-core-v2 + 1.0.0-beta.1 + + + org.junit.jupiter + junit-jupiter-api + 5.9.3 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.9.3 + test + + + org.junit.jupiter + junit-jupiter-params + 5.9.3 + test + + + diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/AppendBlobClient.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/AppendBlobClient.java new file mode 100644 index 000000000000..239be86b58ea --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/AppendBlobClient.java @@ -0,0 +1,446 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob; + +import com.azure.v2.storage.blob.implementation.AppendBlobsImpl; +import com.azure.v2.storage.blob.models.BlobHttpHeaders; +import com.azure.v2.storage.blob.models.BlobImmutabilityPolicyMode; +import com.azure.v2.storage.blob.models.CpkInfo; +import com.azure.v2.storage.blob.models.EncryptionScope; +import com.azure.v2.storage.blob.models.StorageErrorException; +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.ServiceClient; +import io.clientcore.core.http.models.RequestOptions; +import io.clientcore.core.http.models.Response; +import io.clientcore.core.models.binarydata.BinaryData; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * Initializes a new instance of the synchronous AzureBlobStorage type. + */ +@ServiceClient(builder = AzureBlobStorageBuilder.class) +public final class AppendBlobClient { + @Metadata(generated = true) + private final AppendBlobsImpl serviceClient; + + /** + * Initializes an instance of AppendBlobClient class. + * + * @param serviceClient the service client implementation. + */ + @Metadata(generated = true) + AppendBlobClient(AppendBlobsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The Create Append Blob operation creates a new append blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response createWithResponse(String containerName, String blob, long contentLength, Integer timeout, + Map metadata, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, + RequestOptions requestOptions) { + return this.serviceClient.createWithResponse(containerName, blob, contentLength, timeout, metadata, leaseId, + ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobTagsString, + immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, blobHttpHeaders, cpkInfo, encryptionScopeParam, + requestOptions); + } + + /** + * The Create Append Blob operation creates a new append blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void create(String containerName, String blob, long contentLength, Integer timeout, + Map metadata, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + this.serviceClient.create(containerName, blob, contentLength, timeout, metadata, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, + immutabilityPolicyMode, legalHold, blobHttpHeaders, cpkInfo, encryptionScopeParam); + } + + /** + * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block + * operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is + * supported only on version 2015-02-21 version or later. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param body Initial data. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param maxSize Optional conditional header. The max length in bytes permitted for the append blob. If the Append + * Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value + * specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - + * Precondition Failed). + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param structuredBodyType Required if the request body is a structured message. Specifies the message schema + * version and properties. + * @param structuredContentLength Required if the request body is a structured message. Specifies the length of the + * blob/file content inside the message body. Will always be smaller than Content-Length. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response appendBlockWithResponse(String containerName, String blob, long contentLength, + BinaryData body, Integer timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, + String leaseId, Long maxSize, Long appendPosition, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + String structuredBodyType, Long structuredContentLength, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, + RequestOptions requestOptions) { + return this.serviceClient.appendBlockWithResponse(containerName, blob, contentLength, body, timeout, + transactionalContentMD5, transactionalContentCrc64, leaseId, maxSize, appendPosition, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, structuredBodyType, structuredContentLength, + cpkInfo, encryptionScopeParam, requestOptions); + } + + /** + * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block + * operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is + * supported only on version 2015-02-21 version or later. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param body Initial data. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param maxSize Optional conditional header. The max length in bytes permitted for the append blob. If the Append + * Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value + * specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - + * Precondition Failed). + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param structuredBodyType Required if the request body is a structured message. Specifies the message schema + * version and properties. + * @param structuredContentLength Required if the request body is a structured message. Specifies the length of the + * blob/file content inside the message body. Will always be smaller than Content-Length. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void appendBlock(String containerName, String blob, long contentLength, BinaryData body, Integer timeout, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, String leaseId, Long maxSize, + Long appendPosition, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, String structuredBodyType, Long structuredContentLength, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + this.serviceClient.appendBlock(containerName, blob, contentLength, body, timeout, transactionalContentMD5, + transactionalContentCrc64, leaseId, maxSize, appendPosition, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, requestId, structuredBodyType, structuredContentLength, cpkInfo, encryptionScopeParam); + } + + /** + * The Append Block operation commits a new block of data to the end of an existing append blob where the contents + * are read from a source url. The Append Block operation is permitted only if the blob was created with + * x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. + * + * @param containerName The container name. + * @param blob The blob name. + * @param sourceUrl Specify a URL to the copy source. + * @param contentLength The length of the request. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param maxSize Optional conditional header. The max length in bytes permitted for the append blob. If the Append + * Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value + * specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - + * Precondition Failed). + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response appendBlockFromUrlWithResponse(String containerName, String blob, String sourceUrl, + long contentLength, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, + byte[] transactionalContentMD5, String leaseId, Long maxSize, Long appendPosition, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + return this.serviceClient.appendBlockFromUrlWithResponse(containerName, blob, sourceUrl, contentLength, + sourceRange, sourceContentMD5, sourceContentcrc64, timeout, transactionalContentMD5, leaseId, maxSize, + appendPosition, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSince, + sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestId, copySourceAuthorization, cpkInfo, + encryptionScopeParam, requestOptions); + } + + /** + * The Append Block operation commits a new block of data to the end of an existing append blob where the contents + * are read from a source url. The Append Block operation is permitted only if the blob was created with + * x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. + * + * @param containerName The container name. + * @param blob The blob name. + * @param sourceUrl Specify a URL to the copy source. + * @param contentLength The length of the request. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param maxSize Optional conditional header. The max length in bytes permitted for the append blob. If the Append + * Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value + * specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - + * Precondition Failed). + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void appendBlockFromUrl(String containerName, String blob, String sourceUrl, long contentLength, + String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, + byte[] transactionalContentMD5, String leaseId, Long maxSize, Long appendPosition, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + this.serviceClient.appendBlockFromUrl(containerName, blob, sourceUrl, contentLength, sourceRange, + sourceContentMD5, sourceContentcrc64, timeout, transactionalContentMD5, leaseId, maxSize, appendPosition, + ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSince, + sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestId, copySourceAuthorization, cpkInfo, + encryptionScopeParam); + } + + /** + * The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 + * version or later. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response sealWithResponse(String containerName, String blob, Integer timeout, String requestId, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, Long appendPosition, RequestOptions requestOptions) { + return this.serviceClient.sealWithResponse(containerName, blob, timeout, requestId, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, appendPosition, requestOptions); + } + + /** + * The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 + * version or later. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void seal(String containerName, String blob, Integer timeout, String requestId, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + Long appendPosition) { + this.serviceClient.seal(containerName, blob, timeout, requestId, leaseId, ifModifiedSince, ifUnmodifiedSince, + ifMatch, ifNoneMatch, appendPosition); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/AzureBlobStorageBuilder.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/AzureBlobStorageBuilder.java new file mode 100644 index 000000000000..99754af63990 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/AzureBlobStorageBuilder.java @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob; + +import com.azure.v2.storage.blob.implementation.AzureBlobStorageImpl; +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.ServiceClientBuilder; +import io.clientcore.core.http.client.HttpClient; +import io.clientcore.core.http.models.ProxyOptions; +import io.clientcore.core.http.pipeline.HttpInstrumentationOptions; +import io.clientcore.core.http.pipeline.HttpInstrumentationPolicy; +import io.clientcore.core.http.pipeline.HttpPipeline; +import io.clientcore.core.http.pipeline.HttpPipelineBuilder; +import io.clientcore.core.http.pipeline.HttpPipelinePolicy; +import io.clientcore.core.http.pipeline.HttpRedirectOptions; +import io.clientcore.core.http.pipeline.HttpRedirectPolicy; +import io.clientcore.core.http.pipeline.HttpRetryOptions; +import io.clientcore.core.http.pipeline.HttpRetryPolicy; +import io.clientcore.core.traits.ConfigurationTrait; +import io.clientcore.core.traits.HttpTrait; +import io.clientcore.core.traits.ProxyTrait; +import io.clientcore.core.utils.configuration.Configuration; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * A builder for creating a new instance of the AzureBlobStorage type. + */ +@ServiceClientBuilder( + serviceClients = { + StorageServiceClient.class, + ContainerClient.class, + BlobClient.class, + PageBlobClient.class, + AppendBlobClient.class, + BlockBlobClient.class }) +public final class AzureBlobStorageBuilder implements HttpTrait, + ProxyTrait, ConfigurationTrait { + @Metadata(generated = true) + private static final String SDK_NAME = "name"; + + @Metadata(generated = true) + private static final String SDK_VERSION = "version"; + + @Metadata(generated = true) + private final List pipelinePolicies; + + /** + * Create an instance of the AzureBlobStorageBuilder. + */ + @Metadata(generated = true) + public AzureBlobStorageBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP pipeline to send requests through. + */ + @Metadata(generated = true) + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Metadata(generated = true) + @Override + public AzureBlobStorageBuilder httpPipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Metadata(generated = true) + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Metadata(generated = true) + @Override + public AzureBlobStorageBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Metadata(generated = true) + private HttpRetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Metadata(generated = true) + @Override + public AzureBlobStorageBuilder httpRetryOptions(HttpRetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Metadata(generated = true) + @Override + public AzureBlobStorageBuilder addHttpPipelinePolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The redirect options to configure redirect policy + */ + @Metadata(generated = true) + private HttpRedirectOptions redirectOptions; + + /** + * {@inheritDoc}. + */ + @Metadata(generated = true) + @Override + public AzureBlobStorageBuilder httpRedirectOptions(HttpRedirectOptions redirectOptions) { + this.redirectOptions = redirectOptions; + return this; + } + + /* + * The instrumentation configuration for HTTP requests and responses. + */ + @Metadata(generated = true) + private HttpInstrumentationOptions httpInstrumentationOptions; + + /** + * {@inheritDoc}. + */ + @Metadata(generated = true) + @Override + public AzureBlobStorageBuilder httpInstrumentationOptions(HttpInstrumentationOptions httpInstrumentationOptions) { + this.httpInstrumentationOptions = httpInstrumentationOptions; + return this; + } + + /* + * The proxy options used during construction of the service client. + */ + @Metadata(generated = true) + private ProxyOptions proxyOptions; + + /** + * {@inheritDoc}. + */ + @Metadata(generated = true) + @Override + public AzureBlobStorageBuilder proxyOptions(ProxyOptions proxyOptions) { + this.proxyOptions = proxyOptions; + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Metadata(generated = true) + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Metadata(generated = true) + @Override + public AzureBlobStorageBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The URL of the service account, container, or blob that is the target of the desired operation. + */ + @Metadata(generated = true) + private String url; + + /** + * Sets The URL of the service account, container, or blob that is the target of the desired operation. + * + * @param url the url value. + * @return the AzureBlobStorageBuilder. + */ + @Metadata(generated = true) + public AzureBlobStorageBuilder url(String url) { + this.url = url; + return this; + } + + /* + * Specifies the version of the operation to use for this request. + */ + @Metadata(generated = true) + private String version; + + /** + * Sets Specifies the version of the operation to use for this request. + * + * @param version the version value. + * @return the AzureBlobStorageBuilder. + */ + @Metadata(generated = true) + public AzureBlobStorageBuilder version(String version) { + this.version = version; + return this; + } + + /** + * Builds an instance of AzureBlobStorageImpl with the provided parameters. + * + * @return an instance of AzureBlobStorageImpl. + */ + @Metadata(generated = true) + private AzureBlobStorageImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localVersion = (version != null) ? version : "2025-01-05"; + AzureBlobStorageImpl client = new AzureBlobStorageImpl(localPipeline, this.url, localVersion); + return client; + } + + @Metadata(generated = true) + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(url, "'url' cannot be null."); + } + + @Metadata(generated = true) + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpInstrumentationOptions localHttpInstrumentationOptions = this.httpInstrumentationOptions == null + ? new HttpInstrumentationOptions() + : this.httpInstrumentationOptions; + HttpPipelineBuilder httpPipelineBuilder = new HttpPipelineBuilder(); + List policies = new ArrayList<>(); + policies.add(redirectOptions == null ? new HttpRedirectPolicy() : new HttpRedirectPolicy(redirectOptions)); + policies.add(retryOptions == null ? new HttpRetryPolicy() : new HttpRetryPolicy(retryOptions)); + this.pipelinePolicies.stream().forEach(p -> policies.add(p)); + policies.add(new HttpInstrumentationPolicy(localHttpInstrumentationOptions)); + policies.forEach(httpPipelineBuilder::addPolicy); + return httpPipelineBuilder.build(); + } + + /** + * Builds an instance of ServiceClient class. + * + * @return an instance of ServiceClient. + */ + @Metadata(generated = true) + public StorageServiceClient buildServiceClient() { + return new StorageServiceClient(buildInnerClient().getServices()); + } + + /** + * Builds an instance of ContainerClient class. + * + * @return an instance of ContainerClient. + */ + @Metadata(generated = true) + public ContainerClient buildContainerClient() { + return new ContainerClient(buildInnerClient().getContainers()); + } + + /** + * Builds an instance of BlobClient class. + * + * @return an instance of BlobClient. + */ + @Metadata(generated = true) + public BlobClient buildBlobClient() { + return new BlobClient(buildInnerClient().getBlobs()); + } + + /** + * Builds an instance of PageBlobClient class. + * + * @return an instance of PageBlobClient. + */ + @Metadata(generated = true) + public PageBlobClient buildPageBlobClient() { + return new PageBlobClient(buildInnerClient().getPageBlobs()); + } + + /** + * Builds an instance of AppendBlobClient class. + * + * @return an instance of AppendBlobClient. + */ + @Metadata(generated = true) + public AppendBlobClient buildAppendBlobClient() { + return new AppendBlobClient(buildInnerClient().getAppendBlobs()); + } + + /** + * Builds an instance of BlockBlobClient class. + * + * @return an instance of BlockBlobClient. + */ + @Metadata(generated = true) + public BlockBlobClient buildBlockBlobClient() { + return new BlockBlobClient(buildInnerClient().getBlockBlobs()); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/BlobClient.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/BlobClient.java new file mode 100644 index 000000000000..c4f608ac631f --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/BlobClient.java @@ -0,0 +1,1775 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob; + +import com.azure.v2.storage.blob.implementation.BlobsImpl; +import com.azure.v2.storage.blob.models.AccessTier; +import com.azure.v2.storage.blob.models.BlobCopySourceTagsMode; +import com.azure.v2.storage.blob.models.BlobDeleteType; +import com.azure.v2.storage.blob.models.BlobExpiryOptions; +import com.azure.v2.storage.blob.models.BlobHttpHeaders; +import com.azure.v2.storage.blob.models.BlobImmutabilityPolicyMode; +import com.azure.v2.storage.blob.models.BlobTags; +import com.azure.v2.storage.blob.models.CpkInfo; +import com.azure.v2.storage.blob.models.DeleteSnapshotsOptionType; +import com.azure.v2.storage.blob.models.EncryptionScope; +import com.azure.v2.storage.blob.models.QueryRequest; +import com.azure.v2.storage.blob.models.RehydratePriority; +import com.azure.v2.storage.blob.models.StorageErrorException; +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.ServiceClient; +import io.clientcore.core.http.models.RequestOptions; +import io.clientcore.core.http.models.Response; +import java.io.InputStream; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * Initializes a new instance of the synchronous AzureBlobStorage type. + */ +@ServiceClient(builder = AzureBlobStorageBuilder.class) +public final class BlobClient { + @Metadata(generated = true) + private final BlobsImpl serviceClient; + + /** + * Initializes an instance of BlobClient class. + * + * @param serviceClient the service client implementation. + */ + @Metadata(generated = true) + BlobClient(BlobsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can + * also call Download to read a snapshot or version. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param rangeGetContentMD5 When set to true and specified together with the Range, the service returns the MD5 + * hash for the range, as long as the range is less than or equal to 4 MB in size. + * @param rangeGetContentCRC64 When set to true and specified together with the Range, the service returns the CRC64 + * hash for the range, as long as the range is less than or equal to 4 MB in size. + * @param structuredBodyType Specifies the response content should be returned as a structured message and specifies + * the message schema version and properties. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response downloadWithResponse(String containerName, String blob, String snapshot, + String versionId, Integer timeout, String range, String leaseId, Boolean rangeGetContentMD5, + Boolean rangeGetContentCRC64, String structuredBodyType, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + CpkInfo cpkInfo, RequestOptions requestOptions) { + return this.serviceClient.downloadWithResponse(containerName, blob, snapshot, versionId, timeout, range, + leaseId, rangeGetContentMD5, rangeGetContentCRC64, structuredBodyType, ifModifiedSince, ifUnmodifiedSince, + ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, requestOptions); + } + + /** + * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can + * also call Download to read a snapshot or version. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param rangeGetContentMD5 When set to true and specified together with the Range, the service returns the MD5 + * hash for the range, as long as the range is less than or equal to 4 MB in size. + * @param rangeGetContentCRC64 When set to true and specified together with the Range, the service returns the CRC64 + * hash for the range, as long as the range is less than or equal to 4 MB in size. + * @param structuredBodyType Specifies the response content should be returned as a structured message and specifies + * the message schema version and properties. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public InputStream download(String containerName, String blob, String snapshot, String versionId, Integer timeout, + String range, String leaseId, Boolean rangeGetContentMD5, Boolean rangeGetContentCRC64, + String structuredBodyType, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo) { + return this.serviceClient.download(containerName, blob, snapshot, versionId, timeout, range, leaseId, + rangeGetContentMD5, rangeGetContentCRC64, structuredBodyType, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, requestId, cpkInfo); + } + + /** + * The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties + * for the blob. It does not return the content of the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response getPropertiesWithResponse(String containerName, String blob, String snapshot, + String versionId, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + CpkInfo cpkInfo, RequestOptions requestOptions) { + return this.serviceClient.getPropertiesWithResponse(containerName, blob, snapshot, versionId, timeout, leaseId, + ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, requestOptions); + } + + /** + * The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties + * for the blob. It does not return the content of the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void getProperties(String containerName, String blob, String snapshot, String versionId, Integer timeout, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo) { + this.serviceClient.getProperties(containerName, blob, snapshot, versionId, timeout, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo); + } + + /** + * If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed + * from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, + * it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or + * snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] + * (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently + * removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until + * it is permanently removed. Use the List Blobs API and specify the "include=deleted" query parameter to discover + * which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a + * soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP + * status code of 404 (ResourceNotFound). If the storage account's automatic snapshot feature is enabled, then, when + * a blob is deleted, an automatic snapshot is created. The blob becomes inaccessible immediately. All other + * operations on the blob causes the service to return an HTTP status code of 404 (ResourceNotFound). You can access + * automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob + * API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC + * permissions. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param deleteSnapshots Required if the blob has associated snapshots. Specify one of the following two options: + * include: Delete the base blob and all of its snapshots. only: Delete only the blob's snapshots and not the blob + * itself. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobDeleteType Optional. Only possible value is 'permanent', which specifies to permanently delete a blob + * if blob soft delete is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response deleteWithResponse(String containerName, String blob, String snapshot, String versionId, + Integer timeout, String leaseId, DeleteSnapshotsOptionType deleteSnapshots, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + BlobDeleteType blobDeleteType, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponse(containerName, blob, snapshot, versionId, timeout, leaseId, + deleteSnapshots, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, + blobDeleteType, requestOptions); + } + + /** + * If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed + * from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, + * it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or + * snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] + * (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently + * removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until + * it is permanently removed. Use the List Blobs API and specify the "include=deleted" query parameter to discover + * which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a + * soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP + * status code of 404 (ResourceNotFound). If the storage account's automatic snapshot feature is enabled, then, when + * a blob is deleted, an automatic snapshot is created. The blob becomes inaccessible immediately. All other + * operations on the blob causes the service to return an HTTP status code of 404 (ResourceNotFound). You can access + * automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob + * API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC + * permissions. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param deleteSnapshots Required if the blob has associated snapshots. Specify one of the following two options: + * include: Delete the base blob and all of its snapshots. only: Delete only the blob's snapshots and not the blob + * itself. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobDeleteType Optional. Only possible value is 'permanent', which specifies to permanently delete a blob + * if blob soft delete is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void delete(String containerName, String blob, String snapshot, String versionId, Integer timeout, + String leaseId, DeleteSnapshotsOptionType deleteSnapshots, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + BlobDeleteType blobDeleteType) { + this.serviceClient.delete(containerName, blob, snapshot, versionId, timeout, leaseId, deleteSnapshots, + ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobDeleteType); + } + + /** + * Undelete a blob that was previously soft deleted. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response undeleteWithResponse(String containerName, String blob, Integer timeout, String requestId, + RequestOptions requestOptions) { + return this.serviceClient.undeleteWithResponse(containerName, blob, timeout, requestId, requestOptions); + } + + /** + * Undelete a blob that was previously soft deleted. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void undelete(String containerName, String blob, Integer timeout, String requestId) { + this.serviceClient.undelete(containerName, blob, timeout, requestId); + } + + /** + * Sets the time a blob will expire and be deleted. + * + * @param containerName The container name. + * @param blob The blob name. + * @param expiryOptions Required. Indicates mode of the expiry time. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param expiresOn The time to set the blob to expiry. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response setExpiryWithResponse(String containerName, String blob, BlobExpiryOptions expiryOptions, + Integer timeout, String requestId, String expiresOn, RequestOptions requestOptions) { + return this.serviceClient.setExpiryWithResponse(containerName, blob, expiryOptions, timeout, requestId, + expiresOn, requestOptions); + } + + /** + * Sets the time a blob will expire and be deleted. + * + * @param containerName The container name. + * @param blob The blob name. + * @param expiryOptions Required. Indicates mode of the expiry time. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param expiresOn The time to set the blob to expiry. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void setExpiry(String containerName, String blob, BlobExpiryOptions expiryOptions, Integer timeout, + String requestId, String expiresOn) { + this.serviceClient.setExpiry(containerName, blob, expiryOptions, timeout, requestId, expiresOn); + } + + /** + * The Set HTTP Headers operation sets system properties on the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobHttpHeaders Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response setHttpHeadersWithResponse(String containerName, String blob, Integer timeout, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, BlobHttpHeaders blobHttpHeaders, RequestOptions requestOptions) { + return this.serviceClient.setHttpHeadersWithResponse(containerName, blob, timeout, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobHttpHeaders, requestOptions); + } + + /** + * The Set HTTP Headers operation sets system properties on the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobHttpHeaders Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void setHttpHeaders(String containerName, String blob, Integer timeout, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, BlobHttpHeaders blobHttpHeaders) { + this.serviceClient.setHttpHeaders(containerName, blob, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, + ifMatch, ifNoneMatch, ifTags, requestId, blobHttpHeaders); + } + + /** + * The Set Immutability Policy operation sets the immutability policy on the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response setImmutabilityPolicyWithResponse(String containerName, String blob, Integer timeout, + String requestId, OffsetDateTime ifUnmodifiedSince, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, String snapshot, String versionId, + RequestOptions requestOptions) { + return this.serviceClient.setImmutabilityPolicyWithResponse(containerName, blob, timeout, requestId, + ifUnmodifiedSince, immutabilityPolicyExpiry, immutabilityPolicyMode, snapshot, versionId, requestOptions); + } + + /** + * The Set Immutability Policy operation sets the immutability policy on the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void setImmutabilityPolicy(String containerName, String blob, Integer timeout, String requestId, + OffsetDateTime ifUnmodifiedSince, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, String snapshot, String versionId) { + this.serviceClient.setImmutabilityPolicy(containerName, blob, timeout, requestId, ifUnmodifiedSince, + immutabilityPolicyExpiry, immutabilityPolicyMode, snapshot, versionId); + } + + /** + * The Delete Immutability Policy operation deletes the immutability policy on the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response deleteImmutabilityPolicyWithResponse(String containerName, String blob, Integer timeout, + String requestId, String snapshot, String versionId, RequestOptions requestOptions) { + return this.serviceClient.deleteImmutabilityPolicyWithResponse(containerName, blob, timeout, requestId, + snapshot, versionId, requestOptions); + } + + /** + * The Delete Immutability Policy operation deletes the immutability policy on the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void deleteImmutabilityPolicy(String containerName, String blob, Integer timeout, String requestId, + String snapshot, String versionId) { + this.serviceClient.deleteImmutabilityPolicy(containerName, blob, timeout, requestId, snapshot, versionId); + } + + /** + * The Set Legal Hold operation sets a legal hold on the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response setLegalHoldWithResponse(String containerName, String blob, boolean legalHold, + Integer timeout, String requestId, String snapshot, String versionId, RequestOptions requestOptions) { + return this.serviceClient.setLegalHoldWithResponse(containerName, blob, legalHold, timeout, requestId, snapshot, + versionId, requestOptions); + } + + /** + * The Set Legal Hold operation sets a legal hold on the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void setLegalHold(String containerName, String blob, boolean legalHold, Integer timeout, String requestId, + String snapshot, String versionId) { + this.serviceClient.setLegalHold(containerName, blob, legalHold, timeout, requestId, snapshot, versionId); + } + + /** + * The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value + * pairs. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response setMetadataWithResponse(String containerName, String blob, Integer timeout, + Map metadata, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + return this.serviceClient.setMetadataWithResponse(containerName, blob, timeout, metadata, leaseId, + ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam, + requestOptions); + } + + /** + * The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value + * pairs. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void setMetadata(String containerName, String blob, Integer timeout, Map metadata, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + this.serviceClient.setMetadata(containerName, blob, timeout, metadata, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never + * expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or + * change. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response acquireLeaseWithResponse(String containerName, String blob, Integer timeout, Integer duration, + String proposedLeaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, RequestOptions requestOptions) { + return this.serviceClient.acquireLeaseWithResponse(containerName, blob, timeout, duration, proposedLeaseId, + ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, requestOptions); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never + * expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or + * change. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void acquireLease(String containerName, String blob, Integer timeout, Integer duration, + String proposedLeaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId) { + this.serviceClient.acquireLease(containerName, blob, timeout, duration, proposedLeaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param leaseId Specifies the current lease ID on the resource. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response releaseLeaseWithResponse(String containerName, String blob, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, RequestOptions requestOptions) { + return this.serviceClient.releaseLeaseWithResponse(containerName, blob, leaseId, timeout, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, requestOptions); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param leaseId Specifies the current lease ID on the resource. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void releaseLease(String containerName, String blob, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId) { + this.serviceClient.releaseLease(containerName, blob, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, + ifMatch, ifNoneMatch, ifTags, requestId); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param leaseId Specifies the current lease ID on the resource. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response renewLeaseWithResponse(String containerName, String blob, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, RequestOptions requestOptions) { + return this.serviceClient.renewLeaseWithResponse(containerName, blob, leaseId, timeout, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, requestOptions); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param leaseId Specifies the current lease ID on the resource. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void renewLease(String containerName, String blob, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId) { + this.serviceClient.renewLease(containerName, blob, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, + ifMatch, ifNoneMatch, ifTags, requestId); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param leaseId Specifies the current lease ID on the resource. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response changeLeaseWithResponse(String containerName, String blob, String leaseId, + String proposedLeaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, RequestOptions requestOptions) { + return this.serviceClient.changeLeaseWithResponse(containerName, blob, leaseId, proposedLeaseId, timeout, + ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, requestOptions); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param leaseId Specifies the current lease ID on the resource. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void changeLease(String containerName, String blob, String leaseId, String proposedLeaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId) { + this.serviceClient.changeLease(containerName, blob, leaseId, proposedLeaseId, timeout, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param breakPeriod For a break operation, proposed duration the lease should continue before it is broken, in + * seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. + * If longer, the time remaining on the lease is used. A new lease will not be available before the break period has + * expired, but the lease may be held for longer than the break period. If this header does not appear with a break + * operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks + * immediately. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response breakLeaseWithResponse(String containerName, String blob, Integer timeout, + Integer breakPeriod, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, RequestOptions requestOptions) { + return this.serviceClient.breakLeaseWithResponse(containerName, blob, timeout, breakPeriod, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, requestOptions); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param breakPeriod For a break operation, proposed duration the lease should continue before it is broken, in + * seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. + * If longer, the time remaining on the lease is used. A new lease will not be available before the break period has + * expired, but the lease may be held for longer than the break period. If this header does not appear with a break + * operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks + * immediately. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void breakLease(String containerName, String blob, Integer timeout, Integer breakPeriod, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId) { + this.serviceClient.breakLease(containerName, blob, timeout, breakPeriod, ifModifiedSince, ifUnmodifiedSince, + ifMatch, ifNoneMatch, ifTags, requestId); + } + + /** + * The Create Snapshot operation creates a read-only snapshot of a blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response createSnapshotWithResponse(String containerName, String blob, Integer timeout, + Map metadata, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String leaseId, String requestId, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + return this.serviceClient.createSnapshotWithResponse(containerName, blob, timeout, metadata, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, leaseId, requestId, cpkInfo, encryptionScopeParam, + requestOptions); + } + + /** + * The Create Snapshot operation creates a read-only snapshot of a blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void createSnapshot(String containerName, String blob, Integer timeout, Map metadata, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String leaseId, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + this.serviceClient.createSnapshot(containerName, blob, timeout, metadata, ifModifiedSince, ifUnmodifiedSince, + ifMatch, ifNoneMatch, ifTags, leaseId, requestId, cpkInfo, encryptionScopeParam); + } + + /** + * The Start Copy From URL operation copies a blob or an internet resource to a new blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param sealBlob Overrides the sealed state of the destination blob. Service version 2019-12-12 and newer. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response startCopyFromURLWithResponse(String containerName, String blob, String copySource, + Integer timeout, Map metadata, AccessTier tier, RehydratePriority rehydratePriority, + OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, + String sourceIfNoneMatch, String sourceIfTags, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String leaseId, String requestId, String blobTagsString, + Boolean sealBlob, OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, + Boolean legalHold, RequestOptions requestOptions) { + return this.serviceClient.startCopyFromURLWithResponse(containerName, blob, copySource, timeout, metadata, tier, + rehydratePriority, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, + sourceIfTags, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, leaseId, requestId, + blobTagsString, sealBlob, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, requestOptions); + } + + /** + * The Start Copy From URL operation copies a blob or an internet resource to a new blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param sealBlob Overrides the sealed state of the destination blob. Service version 2019-12-12 and newer. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void startCopyFromURL(String containerName, String blob, String copySource, Integer timeout, + Map metadata, AccessTier tier, RehydratePriority rehydratePriority, + OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, + String sourceIfNoneMatch, String sourceIfTags, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String leaseId, String requestId, String blobTagsString, + Boolean sealBlob, OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, + Boolean legalHold) { + this.serviceClient.startCopyFromURL(containerName, blob, copySource, timeout, metadata, tier, rehydratePriority, + sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, + ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, leaseId, requestId, blobTagsString, + sealBlob, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold); + } + + /** + * The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response + * until the copy is complete. + * + * @param containerName The container name. + * @param blob The blob name. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the + * tags specified by x-ms-tags. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response copyFromURLWithResponse(String containerName, String blob, String copySource, Integer timeout, + Map metadata, AccessTier tier, OffsetDateTime sourceIfModifiedSince, + OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, String sourceIfNoneMatch, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String leaseId, String requestId, byte[] sourceContentMD5, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + String copySourceAuthorization, BlobCopySourceTagsMode copySourceTags, EncryptionScope encryptionScopeParam, + RequestOptions requestOptions) { + return this.serviceClient.copyFromURLWithResponse(containerName, blob, copySource, timeout, metadata, tier, + sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, leaseId, requestId, sourceContentMD5, blobTagsString, + immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, copySourceAuthorization, copySourceTags, + encryptionScopeParam, requestOptions); + } + + /** + * The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response + * until the copy is complete. + * + * @param containerName The container name. + * @param blob The blob name. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the + * tags specified by x-ms-tags. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void copyFromURL(String containerName, String blob, String copySource, Integer timeout, + Map metadata, AccessTier tier, OffsetDateTime sourceIfModifiedSince, + OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, String sourceIfNoneMatch, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String leaseId, String requestId, byte[] sourceContentMD5, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + String copySourceAuthorization, BlobCopySourceTagsMode copySourceTags, EncryptionScope encryptionScopeParam) { + this.serviceClient.copyFromURL(containerName, blob, copySource, timeout, metadata, tier, sourceIfModifiedSince, + sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, leaseId, requestId, sourceContentMD5, blobTagsString, immutabilityPolicyExpiry, + immutabilityPolicyMode, legalHold, copySourceAuthorization, copySourceTags, encryptionScopeParam); + } + + /** + * The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with + * zero length and full metadata. + * + * @param containerName The container name. + * @param blob The blob name. + * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response abortCopyFromURLWithResponse(String containerName, String blob, String copyId, + Integer timeout, String leaseId, String requestId, RequestOptions requestOptions) { + return this.serviceClient.abortCopyFromURLWithResponse(containerName, blob, copyId, timeout, leaseId, requestId, + requestOptions); + } + + /** + * The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with + * zero length and full metadata. + * + * @param containerName The container name. + * @param blob The blob name. + * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void abortCopyFromURL(String containerName, String blob, String copyId, Integer timeout, String leaseId, + String requestId) { + this.serviceClient.abortCopyFromURL(containerName, blob, copyId, timeout, leaseId, requestId); + } + + /** + * The Set Tier operation sets the tier on a blob. The operation is allowed on a page blob in a premium storage + * account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's + * tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines + * Hot/Cool/Archive storage type. This operation does not update the blob's ETag. + * + * @param containerName The container name. + * @param blob The blob name. + * @param tier Indicates the tier to be set on the blob. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response setTierWithResponse(String containerName, String blob, AccessTier tier, String snapshot, + String versionId, Integer timeout, RehydratePriority rehydratePriority, String requestId, String leaseId, + String ifTags, RequestOptions requestOptions) { + return this.serviceClient.setTierWithResponse(containerName, blob, tier, snapshot, versionId, timeout, + rehydratePriority, requestId, leaseId, ifTags, requestOptions); + } + + /** + * The Set Tier operation sets the tier on a blob. The operation is allowed on a page blob in a premium storage + * account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's + * tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines + * Hot/Cool/Archive storage type. This operation does not update the blob's ETag. + * + * @param containerName The container name. + * @param blob The blob name. + * @param tier Indicates the tier to be set on the blob. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void setTier(String containerName, String blob, AccessTier tier, String snapshot, String versionId, + Integer timeout, RehydratePriority rehydratePriority, String requestId, String leaseId, String ifTags) { + this.serviceClient.setTier(containerName, blob, tier, snapshot, versionId, timeout, rehydratePriority, + requestId, leaseId, ifTags); + } + + /** + * Returns the sku name and account kind. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response getAccountInfoWithResponse(String containerName, String blob, Integer timeout, + String requestId, RequestOptions requestOptions) { + return this.serviceClient.getAccountInfoWithResponse(containerName, blob, timeout, requestId, requestOptions); + } + + /** + * Returns the sku name and account kind. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void getAccountInfo(String containerName, String blob, Integer timeout, String requestId) { + this.serviceClient.getAccountInfo(containerName, blob, timeout, requestId); + } + + /** + * The Query operation enables users to select/project on blob data by providing simple query expressions. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param queryRequest the query request. + * @param cpkInfo Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response queryWithResponse(String containerName, String blob, String snapshot, Integer timeout, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, QueryRequest queryRequest, CpkInfo cpkInfo, + RequestOptions requestOptions) { + return this.serviceClient.queryWithResponse(containerName, blob, snapshot, timeout, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, queryRequest, cpkInfo, requestOptions); + } + + /** + * The Query operation enables users to select/project on blob data by providing simple query expressions. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param queryRequest the query request. + * @param cpkInfo Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public InputStream query(String containerName, String blob, String snapshot, Integer timeout, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, QueryRequest queryRequest, CpkInfo cpkInfo) { + return this.serviceClient.query(containerName, blob, snapshot, timeout, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, queryRequest, cpkInfo); + } + + /** + * The Get Tags operation enables users to get the tags associated with a blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return blob tags. + */ + @Metadata(generated = true) + public Response getTagsWithResponse(String containerName, String blob, Integer timeout, String requestId, + String snapshot, String versionId, String ifTags, String leaseId, RequestOptions requestOptions) { + return this.serviceClient.getTagsWithResponse(containerName, blob, timeout, requestId, snapshot, versionId, + ifTags, leaseId, requestOptions); + } + + /** + * The Get Tags operation enables users to get the tags associated with a blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return blob tags. + */ + @Metadata(generated = true) + public BlobTags getTags(String containerName, String blob, Integer timeout, String requestId, String snapshot, + String versionId, String ifTags, String leaseId) { + return this.serviceClient.getTags(containerName, blob, timeout, requestId, snapshot, versionId, ifTags, + leaseId); + } + + /** + * The Set Tags operation enables users to set tags on a blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tags Blob tags. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response setTagsWithResponse(String containerName, String blob, Integer timeout, String versionId, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, String requestId, String ifTags, + String leaseId, BlobTags tags, RequestOptions requestOptions) { + return this.serviceClient.setTagsWithResponse(containerName, blob, timeout, versionId, transactionalContentMD5, + transactionalContentCrc64, requestId, ifTags, leaseId, tags, requestOptions); + } + + /** + * The Set Tags operation enables users to set tags on a blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tags Blob tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void setTags(String containerName, String blob, Integer timeout, String versionId, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, String requestId, String ifTags, + String leaseId, BlobTags tags) { + this.serviceClient.setTags(containerName, blob, timeout, versionId, transactionalContentMD5, + transactionalContentCrc64, requestId, ifTags, leaseId, tags); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/BlockBlobClient.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/BlockBlobClient.java new file mode 100644 index 000000000000..8051ca20974a --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/BlockBlobClient.java @@ -0,0 +1,666 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob; + +import com.azure.v2.storage.blob.implementation.BlockBlobsImpl; +import com.azure.v2.storage.blob.models.AccessTier; +import com.azure.v2.storage.blob.models.BlobCopySourceTagsMode; +import com.azure.v2.storage.blob.models.BlobHttpHeaders; +import com.azure.v2.storage.blob.models.BlobImmutabilityPolicyMode; +import com.azure.v2.storage.blob.models.BlockList; +import com.azure.v2.storage.blob.models.BlockListType; +import com.azure.v2.storage.blob.models.BlockLookupList; +import com.azure.v2.storage.blob.models.CpkInfo; +import com.azure.v2.storage.blob.models.EncryptionScope; +import com.azure.v2.storage.blob.models.StorageErrorException; +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.ServiceClient; +import io.clientcore.core.http.models.RequestOptions; +import io.clientcore.core.http.models.Response; +import io.clientcore.core.models.binarydata.BinaryData; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * Initializes a new instance of the synchronous AzureBlobStorage type. + */ +@ServiceClient(builder = AzureBlobStorageBuilder.class) +public final class BlockBlobClient { + @Metadata(generated = true) + private final BlockBlobsImpl serviceClient; + + /** + * Initializes an instance of BlockBlobClient class. + * + * @param serviceClient the service client implementation. + */ + @Metadata(generated = true) + BlockBlobClient(BlockBlobsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The Upload Block Blob operation updates the content of an existing block blob. Updating an existing block blob + * overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the + * existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a + * block blob, use the Put Block List operation. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param body Initial data. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param structuredBodyType Required if the request body is a structured message. Specifies the message schema + * version and properties. + * @param structuredContentLength Required if the request body is a structured message. Specifies the length of the + * blob/file content inside the message body. Will always be smaller than Content-Length. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response uploadWithResponse(String containerName, String blob, long contentLength, BinaryData body, + Integer timeout, byte[] transactionalContentMD5, Map metadata, String leaseId, AccessTier tier, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, byte[] transactionalContentCrc64, + String structuredBodyType, Long structuredContentLength, BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + return this.serviceClient.uploadWithResponse(containerName, blob, contentLength, body, timeout, + transactionalContentMD5, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, + transactionalContentCrc64, structuredBodyType, structuredContentLength, blobHttpHeaders, cpkInfo, + encryptionScopeParam, requestOptions); + } + + /** + * The Upload Block Blob operation updates the content of an existing block blob. Updating an existing block blob + * overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the + * existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a + * block blob, use the Put Block List operation. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param body Initial data. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param structuredBodyType Required if the request body is a structured message. Specifies the message schema + * version and properties. + * @param structuredContentLength Required if the request body is a structured message. Specifies the length of the + * blob/file content inside the message body. Will always be smaller than Content-Length. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void upload(String containerName, String blob, long contentLength, BinaryData body, Integer timeout, + byte[] transactionalContentMD5, Map metadata, String leaseId, AccessTier tier, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, byte[] transactionalContentCrc64, + String structuredBodyType, Long structuredContentLength, BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam) { + this.serviceClient.upload(containerName, blob, contentLength, body, timeout, transactionalContentMD5, metadata, + leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobTagsString, + immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, transactionalContentCrc64, structuredBodyType, + structuredContentLength, blobHttpHeaders, cpkInfo, encryptionScopeParam); + } + + /** + * The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given + * URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob + * from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial + * updates to a block blob's contents using a source URL, use the Put Block from URL API in conjunction with Put + * Block List. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param copySourceBlobProperties Optional, default is true. Indicates if properties from the source blob should be + * copied. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the + * tags specified by x-ms-tags. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response putBlobFromUrlWithResponse(String containerName, String blob, long contentLength, + String copySource, Integer timeout, byte[] transactionalContentMD5, Map metadata, + String leaseId, AccessTier tier, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, OffsetDateTime sourceIfModifiedSince, + OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, String sourceIfNoneMatch, String sourceIfTags, + String requestId, byte[] sourceContentMD5, String blobTagsString, Boolean copySourceBlobProperties, + String copySourceAuthorization, BlobCopySourceTagsMode copySourceTags, BlobHttpHeaders blobHttpHeaders, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + return this.serviceClient.putBlobFromUrlWithResponse(containerName, blob, contentLength, copySource, timeout, + transactionalContentMD5, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, + requestId, sourceContentMD5, blobTagsString, copySourceBlobProperties, copySourceAuthorization, + copySourceTags, blobHttpHeaders, cpkInfo, encryptionScopeParam, requestOptions); + } + + /** + * The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given + * URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob + * from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial + * updates to a block blob's contents using a source URL, use the Put Block from URL API in conjunction with Put + * Block List. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param copySourceBlobProperties Optional, default is true. Indicates if properties from the source blob should be + * copied. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the + * tags specified by x-ms-tags. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void putBlobFromUrl(String containerName, String blob, long contentLength, String copySource, + Integer timeout, byte[] transactionalContentMD5, Map metadata, String leaseId, AccessTier tier, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String sourceIfTags, String requestId, byte[] sourceContentMD5, + String blobTagsString, Boolean copySourceBlobProperties, String copySourceAuthorization, + BlobCopySourceTagsMode copySourceTags, BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam) { + this.serviceClient.putBlobFromUrl(containerName, blob, contentLength, copySource, timeout, + transactionalContentMD5, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, + requestId, sourceContentMD5, blobTagsString, copySourceBlobProperties, copySourceAuthorization, + copySourceTags, blobHttpHeaders, cpkInfo, encryptionScopeParam); + } + + /** + * The Stage Block operation creates a new block to be committed as part of a blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less + * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter + * must be the same size for each block. + * @param contentLength The length of the request. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param structuredBodyType Required if the request body is a structured message. Specifies the message schema + * version and properties. + * @param structuredContentLength Required if the request body is a structured message. Specifies the length of the + * blob/file content inside the message body. Will always be smaller than Content-Length. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response stageBlockWithResponse(String containerName, String blob, String blockId, long contentLength, + BinaryData body, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, + String leaseId, String requestId, String structuredBodyType, Long structuredContentLength, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + return this.serviceClient.stageBlockWithResponse(containerName, blob, blockId, contentLength, body, + transactionalContentMD5, transactionalContentCrc64, timeout, leaseId, requestId, structuredBodyType, + structuredContentLength, cpkInfo, encryptionScopeParam, requestOptions); + } + + /** + * The Stage Block operation creates a new block to be committed as part of a blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less + * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter + * must be the same size for each block. + * @param contentLength The length of the request. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param structuredBodyType Required if the request body is a structured message. Specifies the message schema + * version and properties. + * @param structuredContentLength Required if the request body is a structured message. Specifies the length of the + * blob/file content inside the message body. Will always be smaller than Content-Length. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void stageBlock(String containerName, String blob, String blockId, long contentLength, BinaryData body, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, String leaseId, + String requestId, String structuredBodyType, Long structuredContentLength, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam) { + this.serviceClient.stageBlock(containerName, blob, blockId, contentLength, body, transactionalContentMD5, + transactionalContentCrc64, timeout, leaseId, requestId, structuredBodyType, structuredContentLength, + cpkInfo, encryptionScopeParam); + } + + /** + * The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from + * a URL. + * + * @param containerName The container name. + * @param blob The blob name. + * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less + * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter + * must be the same size for each block. + * @param contentLength The length of the request. + * @param sourceUrl Specify a URL to the copy source. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response stageBlockFromURLWithResponse(String containerName, String blob, String blockId, + long contentLength, String sourceUrl, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, + Integer timeout, String leaseId, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + return this.serviceClient.stageBlockFromURLWithResponse(containerName, blob, blockId, contentLength, sourceUrl, + sourceRange, sourceContentMD5, sourceContentcrc64, timeout, leaseId, sourceIfModifiedSince, + sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestId, copySourceAuthorization, cpkInfo, + encryptionScopeParam, requestOptions); + } + + /** + * The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from + * a URL. + * + * @param containerName The container name. + * @param blob The blob name. + * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less + * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter + * must be the same size for each block. + * @param contentLength The length of the request. + * @param sourceUrl Specify a URL to the copy source. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void stageBlockFromURL(String containerName, String blob, String blockId, long contentLength, + String sourceUrl, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, + String leaseId, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + this.serviceClient.stageBlockFromURL(containerName, blob, blockId, contentLength, sourceUrl, sourceRange, + sourceContentMD5, sourceContentcrc64, timeout, leaseId, sourceIfModifiedSince, sourceIfUnmodifiedSince, + sourceIfMatch, sourceIfNoneMatch, requestId, copySourceAuthorization, cpkInfo, encryptionScopeParam); + } + + /** + * The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order + * to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block + * operation. You can call Put Block List to update a blob by uploading only those blocks that have changed, then + * committing the new and existing blocks together. You can do this by specifying whether to commit a block from the + * committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the + * block, whichever list it may belong to. + * + * @param containerName The container name. + * @param blob The blob name. + * @param blocks Blob Blocks. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response commitBlockListWithResponse(String containerName, String blob, BlockLookupList blocks, + Integer timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Map metadata, + String leaseId, AccessTier tier, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, + RequestOptions requestOptions) { + return this.serviceClient.commitBlockListWithResponse(containerName, blob, blocks, timeout, + transactionalContentMD5, transactionalContentCrc64, metadata, leaseId, tier, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, + immutabilityPolicyMode, legalHold, blobHttpHeaders, cpkInfo, encryptionScopeParam, requestOptions); + } + + /** + * The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order + * to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block + * operation. You can call Put Block List to update a blob by uploading only those blocks that have changed, then + * committing the new and existing blocks together. You can do this by specifying whether to commit a block from the + * committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the + * block, whichever list it may belong to. + * + * @param containerName The container name. + * @param blob The blob name. + * @param blocks Blob Blocks. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void commitBlockList(String containerName, String blob, BlockLookupList blocks, Integer timeout, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Map metadata, String leaseId, + AccessTier tier, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + this.serviceClient.commitBlockList(containerName, blob, blocks, timeout, transactionalContentMD5, + transactionalContentCrc64, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, + blobHttpHeaders, cpkInfo, encryptionScopeParam); + } + + /** + * The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param listType Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both + * lists together. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response getBlockListWithResponse(String containerName, String blob, BlockListType listType, + String snapshot, Integer timeout, String leaseId, String ifTags, String requestId, + RequestOptions requestOptions) { + return this.serviceClient.getBlockListWithResponse(containerName, blob, listType, snapshot, timeout, leaseId, + ifTags, requestId, requestOptions); + } + + /** + * The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param listType Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both + * lists together. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public BlockList getBlockList(String containerName, String blob, BlockListType listType, String snapshot, + Integer timeout, String leaseId, String ifTags, String requestId) { + return this.serviceClient.getBlockList(containerName, blob, listType, snapshot, timeout, leaseId, ifTags, + requestId); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/ContainerClient.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/ContainerClient.java new file mode 100644 index 000000000000..061a3f7ff18d --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/ContainerClient.java @@ -0,0 +1,1065 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob; + +import com.azure.v2.storage.blob.implementation.ContainersImpl; +import com.azure.v2.storage.blob.implementation.models.BlobSignedIdentifierWrapper; +import com.azure.v2.storage.blob.models.BlobContainerEncryptionScope; +import com.azure.v2.storage.blob.models.BlobSignedIdentifier; +import com.azure.v2.storage.blob.models.FilterBlobSegment; +import com.azure.v2.storage.blob.models.FilterBlobsIncludeItem; +import com.azure.v2.storage.blob.models.ListBlobsFlatSegmentResponse; +import com.azure.v2.storage.blob.models.ListBlobsHierarchySegmentResponse; +import com.azure.v2.storage.blob.models.ListBlobsIncludeItem; +import com.azure.v2.storage.blob.models.PublicAccessType; +import com.azure.v2.storage.blob.models.StorageErrorException; +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.ServiceClient; +import io.clientcore.core.http.models.RequestOptions; +import io.clientcore.core.http.models.Response; +import io.clientcore.core.models.binarydata.BinaryData; +import java.io.InputStream; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** + * Initializes a new instance of the synchronous AzureBlobStorage type. + */ +@ServiceClient(builder = AzureBlobStorageBuilder.class) +public final class ContainerClient { + @Metadata(generated = true) + private final ContainersImpl serviceClient; + + /** + * Initializes an instance of ContainerClient class. + * + * @param serviceClient the service client implementation. + */ + @Metadata(generated = true) + ContainerClient(ContainersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * creates a new container under the specified account. If the container with the same name already exists, the + * operation fails. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param access Specifies whether data in the container may be accessed publicly and the level of access. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobContainerEncryptionScope Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response createWithResponse(String containerName, Integer timeout, Map metadata, + PublicAccessType access, String requestId, BlobContainerEncryptionScope blobContainerEncryptionScope, + RequestOptions requestOptions) { + return this.serviceClient.createWithResponse(containerName, timeout, metadata, access, requestId, + blobContainerEncryptionScope, requestOptions); + } + + /** + * creates a new container under the specified account. If the container with the same name already exists, the + * operation fails. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param access Specifies whether data in the container may be accessed publicly and the level of access. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobContainerEncryptionScope Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void create(String containerName, Integer timeout, Map metadata, PublicAccessType access, + String requestId, BlobContainerEncryptionScope blobContainerEncryptionScope) { + this.serviceClient.create(containerName, timeout, metadata, access, requestId, blobContainerEncryptionScope); + } + + /** + * returns all user-defined metadata and system properties for the specified container. The data returned does not + * include the container's list of blobs. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response getPropertiesWithResponse(String containerName, Integer timeout, String leaseId, + String requestId, RequestOptions requestOptions) { + return this.serviceClient.getPropertiesWithResponse(containerName, timeout, leaseId, requestId, requestOptions); + } + + /** + * returns all user-defined metadata and system properties for the specified container. The data returned does not + * include the container's list of blobs. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void getProperties(String containerName, Integer timeout, String leaseId, String requestId) { + this.serviceClient.getProperties(containerName, timeout, leaseId, requestId); + } + + /** + * operation marks the specified container for deletion. The container and any blobs contained within it are later + * deleted during garbage collection. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response deleteWithResponse(String containerName, Integer timeout, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponse(containerName, timeout, leaseId, ifModifiedSince, + ifUnmodifiedSince, requestId, requestOptions); + } + + /** + * operation marks the specified container for deletion. The container and any blobs contained within it are later + * deleted during garbage collection. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void delete(String containerName, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String requestId) { + this.serviceClient.delete(containerName, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, requestId); + } + + /** + * operation sets one or more user-defined name-value pairs for the specified container. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response setMetadataWithResponse(String containerName, Integer timeout, String leaseId, + Map metadata, OffsetDateTime ifModifiedSince, String requestId, RequestOptions requestOptions) { + return this.serviceClient.setMetadataWithResponse(containerName, timeout, leaseId, metadata, ifModifiedSince, + requestId, requestOptions); + } + + /** + * operation sets one or more user-defined name-value pairs for the specified container. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void setMetadata(String containerName, Integer timeout, String leaseId, Map metadata, + OffsetDateTime ifModifiedSince, String requestId) { + this.serviceClient.setMetadata(containerName, timeout, leaseId, metadata, ifModifiedSince, requestId); + } + + /** + * gets the permissions for the specified container. The permissions indicate whether container data may be accessed + * publicly. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the permissions for the specified container. + */ + @Metadata(generated = true) + public Response getAccessPolicyWithResponse(String containerName, Integer timeout, + String leaseId, String requestId, RequestOptions requestOptions) { + return this.serviceClient.getAccessPolicyWithResponse(containerName, timeout, leaseId, requestId, + requestOptions); + } + + /** + * gets the permissions for the specified container. The permissions indicate whether container data may be accessed + * publicly. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the permissions for the specified container. + */ + @Metadata(generated = true) + public BlobSignedIdentifierWrapper getAccessPolicy(String containerName, Integer timeout, String leaseId, + String requestId) { + return this.serviceClient.getAccessPolicy(containerName, timeout, leaseId, requestId); + } + + /** + * sets the permissions for the specified container. The permissions indicate whether blobs in a container may be + * accessed publicly. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param access Specifies whether data in the container may be accessed publicly and the level of access. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param containerAcl the acls for the container. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response setAccessPolicyWithResponse(String containerName, Integer timeout, String leaseId, + PublicAccessType access, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + List containerAcl, RequestOptions requestOptions) { + return this.serviceClient.setAccessPolicyWithResponse(containerName, timeout, leaseId, access, ifModifiedSince, + ifUnmodifiedSince, requestId, containerAcl, requestOptions); + } + + /** + * sets the permissions for the specified container. The permissions indicate whether blobs in a container may be + * accessed publicly. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param access Specifies whether data in the container may be accessed publicly and the level of access. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param containerAcl the acls for the container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void setAccessPolicy(String containerName, Integer timeout, String leaseId, PublicAccessType access, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + List containerAcl) { + this.serviceClient.setAccessPolicy(containerName, timeout, leaseId, access, ifModifiedSince, ifUnmodifiedSince, + requestId, containerAcl); + } + + /** + * Restores a previously-deleted container. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param deletedContainerName Optional. Version 2019-12-12 and later. Specifies the name of the deleted container + * to restore. + * @param deletedContainerVersion Optional. Version 2019-12-12 and later. Specifies the version of the deleted + * container to restore. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response restoreWithResponse(String containerName, Integer timeout, String requestId, + String deletedContainerName, String deletedContainerVersion, RequestOptions requestOptions) { + return this.serviceClient.restoreWithResponse(containerName, timeout, requestId, deletedContainerName, + deletedContainerVersion, requestOptions); + } + + /** + * Restores a previously-deleted container. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param deletedContainerName Optional. Version 2019-12-12 and later. Specifies the name of the deleted container + * to restore. + * @param deletedContainerVersion Optional. Version 2019-12-12 and later. Specifies the version of the deleted + * container to restore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void restore(String containerName, Integer timeout, String requestId, String deletedContainerName, + String deletedContainerVersion) { + this.serviceClient.restore(containerName, timeout, requestId, deletedContainerName, deletedContainerVersion); + } + + /** + * Renames an existing container. + * + * @param containerName The container name. + * @param sourceContainerName Required. Specifies the name of the container to rename. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param sourceLeaseId A lease ID for the source path. If specified, the source path must have an active lease and + * the lease ID must match. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response renameWithResponse(String containerName, String sourceContainerName, Integer timeout, + String requestId, String sourceLeaseId, RequestOptions requestOptions) { + return this.serviceClient.renameWithResponse(containerName, sourceContainerName, timeout, requestId, + sourceLeaseId, requestOptions); + } + + /** + * Renames an existing container. + * + * @param containerName The container name. + * @param sourceContainerName Required. Specifies the name of the container to rename. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param sourceLeaseId A lease ID for the source path. If specified, the source path must have an active lease and + * the lease ID must match. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void rename(String containerName, String sourceContainerName, Integer timeout, String requestId, + String sourceLeaseId) { + this.serviceClient.rename(containerName, sourceContainerName, timeout, requestId, sourceLeaseId); + } + + /** + * The Batch operation allows multiple API calls to be embedded into a single HTTP request. + * + * @param containerName The container name. + * @param contentLength The length of the request. + * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. + * Example header value: multipart/mixed; boundary=batch_<GUID>. + * @param body Initial data. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response submitBatchWithResponse(String containerName, long contentLength, + String multipartContentType, BinaryData body, Integer timeout, String requestId, + RequestOptions requestOptions) { + return this.serviceClient.submitBatchWithResponse(containerName, contentLength, multipartContentType, body, + timeout, requestId, requestOptions); + } + + /** + * The Batch operation allows multiple API calls to be embedded into a single HTTP request. + * + * @param containerName The container name. + * @param contentLength The length of the request. + * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. + * Example header value: multipart/mixed; boundary=batch_<GUID>. + * @param body Initial data. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public InputStream submitBatch(String containerName, long contentLength, String multipartContentType, + BinaryData body, Integer timeout, String requestId) { + return this.serviceClient.submitBatch(containerName, contentLength, multipartContentType, body, timeout, + requestId); + } + + /** + * The Filter Blobs operation enables callers to list blobs in a container whose tags match a given search + * expression. Filter blobs searches within the given container. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param where Filters the results to return only to return only blobs whose tags match the specified expression. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a Filter Blobs API call. + */ + @Metadata(generated = true) + public Response filterBlobsWithResponse(String containerName, Integer timeout, String requestId, + String where, String marker, Integer maxresults, List include, + RequestOptions requestOptions) { + return this.serviceClient.filterBlobsWithResponse(containerName, timeout, requestId, where, marker, maxresults, + include, requestOptions); + } + + /** + * The Filter Blobs operation enables callers to list blobs in a container whose tags match a given search + * expression. Filter blobs searches within the given container. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param where Filters the results to return only to return only blobs whose tags match the specified expression. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a Filter Blobs API call. + */ + @Metadata(generated = true) + public FilterBlobSegment filterBlobs(String containerName, Integer timeout, String requestId, String where, + String marker, Integer maxresults, List include) { + return this.serviceClient.filterBlobs(containerName, timeout, requestId, where, marker, maxresults, include); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never + * expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or + * change. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response acquireLeaseWithResponse(String containerName, Integer timeout, Integer duration, + String proposedLeaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + RequestOptions requestOptions) { + return this.serviceClient.acquireLeaseWithResponse(containerName, timeout, duration, proposedLeaseId, + ifModifiedSince, ifUnmodifiedSince, requestId, requestOptions); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never + * expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or + * change. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void acquireLease(String containerName, Integer timeout, Integer duration, String proposedLeaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { + this.serviceClient.acquireLease(containerName, timeout, duration, proposedLeaseId, ifModifiedSince, + ifUnmodifiedSince, requestId); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param leaseId Specifies the current lease ID on the resource. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response releaseLeaseWithResponse(String containerName, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + RequestOptions requestOptions) { + return this.serviceClient.releaseLeaseWithResponse(containerName, leaseId, timeout, ifModifiedSince, + ifUnmodifiedSince, requestId, requestOptions); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param leaseId Specifies the current lease ID on the resource. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void releaseLease(String containerName, String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String requestId) { + this.serviceClient.releaseLease(containerName, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, requestId); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param leaseId Specifies the current lease ID on the resource. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response renewLeaseWithResponse(String containerName, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + RequestOptions requestOptions) { + return this.serviceClient.renewLeaseWithResponse(containerName, leaseId, timeout, ifModifiedSince, + ifUnmodifiedSince, requestId, requestOptions); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param leaseId Specifies the current lease ID on the resource. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void renewLease(String containerName, String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String requestId) { + this.serviceClient.renewLease(containerName, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, requestId); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param breakPeriod For a break operation, proposed duration the lease should continue before it is broken, in + * seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. + * If longer, the time remaining on the lease is used. A new lease will not be available before the break period has + * expired, but the lease may be held for longer than the break period. If this header does not appear with a break + * operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks + * immediately. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response breakLeaseWithResponse(String containerName, Integer timeout, Integer breakPeriod, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + RequestOptions requestOptions) { + return this.serviceClient.breakLeaseWithResponse(containerName, timeout, breakPeriod, ifModifiedSince, + ifUnmodifiedSince, requestId, requestOptions); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param breakPeriod For a break operation, proposed duration the lease should continue before it is broken, in + * seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. + * If longer, the time remaining on the lease is used. A new lease will not be available before the break period has + * expired, but the lease may be held for longer than the break period. If this header does not appear with a break + * operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks + * immediately. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void breakLease(String containerName, Integer timeout, Integer breakPeriod, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String requestId) { + this.serviceClient.breakLease(containerName, timeout, breakPeriod, ifModifiedSince, ifUnmodifiedSince, + requestId); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param leaseId Specifies the current lease ID on the resource. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response changeLeaseWithResponse(String containerName, String leaseId, String proposedLeaseId, + Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + RequestOptions requestOptions) { + return this.serviceClient.changeLeaseWithResponse(containerName, leaseId, proposedLeaseId, timeout, + ifModifiedSince, ifUnmodifiedSince, requestId, requestOptions); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param leaseId Specifies the current lease ID on the resource. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void changeLease(String containerName, String leaseId, String proposedLeaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { + this.serviceClient.changeLease(containerName, leaseId, proposedLeaseId, timeout, ifModifiedSince, + ifUnmodifiedSince, requestId); + } + + /** + * [Update] The List Blobs operation returns a list of the blobs under the specified container. + * + * @param containerName The container name. + * @param prefix Filters the results to return only containers whose name begins with the specified prefix. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of blobs. + */ + @Metadata(generated = true) + public Response listBlobFlatSegmentWithResponse(String containerName, String prefix, + String marker, Integer maxresults, List include, Integer timeout, String requestId, + RequestOptions requestOptions) { + return this.serviceClient.listBlobFlatSegmentWithResponse(containerName, prefix, marker, maxresults, include, + timeout, requestId, requestOptions); + } + + /** + * [Update] The List Blobs operation returns a list of the blobs under the specified container. + * + * @param containerName The container name. + * @param prefix Filters the results to return only containers whose name begins with the specified prefix. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of blobs. + */ + @Metadata(generated = true) + public ListBlobsFlatSegmentResponse listBlobFlatSegment(String containerName, String prefix, String marker, + Integer maxresults, List include, Integer timeout, String requestId) { + return this.serviceClient.listBlobFlatSegment(containerName, prefix, marker, maxresults, include, timeout, + requestId); + } + + /** + * [Update] The List Blobs operation returns a list of the blobs under the specified container. + * + * @param containerName The container name. + * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the + * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the + * appearance of the delimiter character. The delimiter may be a single character or a string. + * @param prefix Filters the results to return only containers whose name begins with the specified prefix. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of blobs. + */ + @Metadata(generated = true) + public Response listBlobHierarchySegmentWithResponse(String containerName, + String delimiter, String prefix, String marker, Integer maxresults, List include, + Integer timeout, String requestId, RequestOptions requestOptions) { + return this.serviceClient.listBlobHierarchySegmentWithResponse(containerName, delimiter, prefix, marker, + maxresults, include, timeout, requestId, requestOptions); + } + + /** + * [Update] The List Blobs operation returns a list of the blobs under the specified container. + * + * @param containerName The container name. + * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the + * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the + * appearance of the delimiter character. The delimiter may be a single character or a string. + * @param prefix Filters the results to return only containers whose name begins with the specified prefix. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of blobs. + */ + @Metadata(generated = true) + public ListBlobsHierarchySegmentResponse listBlobHierarchySegment(String containerName, String delimiter, + String prefix, String marker, Integer maxresults, List include, Integer timeout, + String requestId) { + return this.serviceClient.listBlobHierarchySegment(containerName, delimiter, prefix, marker, maxresults, + include, timeout, requestId); + } + + /** + * Returns the sku name and account kind. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response getAccountInfoWithResponse(String containerName, Integer timeout, String requestId, + RequestOptions requestOptions) { + return this.serviceClient.getAccountInfoWithResponse(containerName, timeout, requestId, requestOptions); + } + + /** + * Returns the sku name and account kind. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void getAccountInfo(String containerName, Integer timeout, String requestId) { + this.serviceClient.getAccountInfo(containerName, timeout, requestId); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/PageBlobClient.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/PageBlobClient.java new file mode 100644 index 000000000000..dfec65aa0401 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/PageBlobClient.java @@ -0,0 +1,903 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob; + +import com.azure.v2.storage.blob.implementation.PageBlobsImpl; +import com.azure.v2.storage.blob.models.BlobHttpHeaders; +import com.azure.v2.storage.blob.models.BlobImmutabilityPolicyMode; +import com.azure.v2.storage.blob.models.CpkInfo; +import com.azure.v2.storage.blob.models.EncryptionScope; +import com.azure.v2.storage.blob.models.PageList; +import com.azure.v2.storage.blob.models.PremiumPageBlobAccessTier; +import com.azure.v2.storage.blob.models.SequenceNumberActionType; +import com.azure.v2.storage.blob.models.StorageErrorException; +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.ServiceClient; +import io.clientcore.core.http.models.RequestOptions; +import io.clientcore.core.http.models.Response; +import io.clientcore.core.models.binarydata.BinaryData; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * Initializes a new instance of the synchronous AzureBlobStorage type. + */ +@ServiceClient(builder = AzureBlobStorageBuilder.class) +public final class PageBlobClient { + @Metadata(generated = true) + private final PageBlobsImpl serviceClient; + + /** + * Initializes an instance of PageBlobClient class. + * + * @param serviceClient the service client implementation. + */ + @Metadata(generated = true) + PageBlobClient(PageBlobsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The Create operation creates a new page blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size + * must be aligned to a 512-byte boundary. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param tier Optional. Indicates the tier to be set on the page blob. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param blobSequenceNumber Set for page blobs only. The sequence number is a user-controlled value that you can + * use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response createWithResponse(String containerName, String blob, long contentLength, + long blobContentLength, Integer timeout, PremiumPageBlobAccessTier tier, Map metadata, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, Long blobSequenceNumber, String requestId, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, + RequestOptions requestOptions) { + return this.serviceClient.createWithResponse(containerName, blob, contentLength, blobContentLength, timeout, + tier, metadata, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, + blobSequenceNumber, requestId, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, + blobHttpHeaders, cpkInfo, encryptionScopeParam, requestOptions); + } + + /** + * The Create operation creates a new page blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size + * must be aligned to a 512-byte boundary. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param tier Optional. Indicates the tier to be set on the page blob. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param blobSequenceNumber Set for page blobs only. The sequence number is a user-controlled value that you can + * use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void create(String containerName, String blob, long contentLength, long blobContentLength, Integer timeout, + PremiumPageBlobAccessTier tier, Map metadata, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, Long blobSequenceNumber, + String requestId, String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, BlobHttpHeaders blobHttpHeaders, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + this.serviceClient.create(containerName, blob, contentLength, blobContentLength, timeout, tier, metadata, + leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, blobSequenceNumber, requestId, + blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, blobHttpHeaders, cpkInfo, + encryptionScopeParam); + } + + /** + * The Upload Pages operation writes a range of pages to a page blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param structuredBodyType Required if the request body is a structured message. Specifies the message schema + * version and properties. + * @param structuredContentLength Required if the request body is a structured message. Specifies the length of the + * blob/file content inside the message body. Will always be smaller than Content-Length. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response uploadPagesWithResponse(String containerName, String blob, long contentLength, + BinaryData body, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, + String range, String leaseId, Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, + Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, String structuredBodyType, Long structuredContentLength, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + return this.serviceClient.uploadPagesWithResponse(containerName, blob, contentLength, body, + transactionalContentMD5, transactionalContentCrc64, timeout, range, leaseId, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, structuredBodyType, structuredContentLength, + cpkInfo, encryptionScopeParam, requestOptions); + } + + /** + * The Upload Pages operation writes a range of pages to a page blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param structuredBodyType Required if the request body is a structured message. Specifies the message schema + * version and properties. + * @param structuredContentLength Required if the request body is a structured message. Specifies the length of the + * blob/file content inside the message body. Will always be smaller than Content-Length. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void uploadPages(String containerName, String blob, long contentLength, BinaryData body, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, String range, String leaseId, + Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, Long ifSequenceNumberEqualTo, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, String structuredBodyType, Long structuredContentLength, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam) { + this.serviceClient.uploadPages(containerName, blob, contentLength, body, transactionalContentMD5, + transactionalContentCrc64, timeout, range, leaseId, ifSequenceNumberLessThanOrEqualTo, + ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, requestId, structuredBodyType, structuredContentLength, cpkInfo, encryptionScopeParam); + } + + /** + * The Clear Pages operation clears a set of pages from a page blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response clearPagesWithResponse(String containerName, String blob, long contentLength, Integer timeout, + String range, String leaseId, Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, + Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, + RequestOptions requestOptions) { + return this.serviceClient.clearPagesWithResponse(containerName, blob, contentLength, timeout, range, leaseId, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam, requestOptions); + } + + /** + * The Clear Pages operation clears a set of pages from a page blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void clearPages(String containerName, String blob, long contentLength, Integer timeout, String range, + String leaseId, Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, + Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + this.serviceClient.clearPages(containerName, blob, contentLength, timeout, range, leaseId, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam); + } + + /** + * The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. + * + * @param containerName The container name. + * @param blob The blob name. + * @param sourceUrl Specify a URL to the copy source. + * @param sourceRange Bytes of source data in the specified range. The length of this range should match the + * ContentLength header and x-ms-range/Range destination range header. + * @param contentLength The length of the request. + * @param range The range of bytes to which the source range would be written. The range should be 512 aligned and + * range-end is required. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response uploadPagesFromURLWithResponse(String containerName, String blob, String sourceUrl, + String sourceRange, long contentLength, String range, byte[] sourceContentMD5, byte[] sourceContentcrc64, + Integer timeout, String leaseId, Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, + Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + return this.serviceClient.uploadPagesFromURLWithResponse(containerName, blob, sourceUrl, sourceRange, + contentLength, range, sourceContentMD5, sourceContentcrc64, timeout, leaseId, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, + sourceIfMatch, sourceIfNoneMatch, requestId, copySourceAuthorization, cpkInfo, encryptionScopeParam, + requestOptions); + } + + /** + * The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. + * + * @param containerName The container name. + * @param blob The blob name. + * @param sourceUrl Specify a URL to the copy source. + * @param sourceRange Bytes of source data in the specified range. The length of this range should match the + * ContentLength header and x-ms-range/Range destination range header. + * @param contentLength The length of the request. + * @param range The range of bytes to which the source range would be written. The range should be 512 aligned and + * range-end is required. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void uploadPagesFromURL(String containerName, String blob, String sourceUrl, String sourceRange, + long contentLength, String range, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, + String leaseId, Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, + Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + this.serviceClient.uploadPagesFromURL(containerName, blob, sourceUrl, sourceRange, contentLength, range, + sourceContentMD5, sourceContentcrc64, timeout, leaseId, ifSequenceNumberLessThanOrEqualTo, + ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestId, + copySourceAuthorization, cpkInfo, encryptionScopeParam); + } + + /** + * The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a + * page blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException 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 of pages. + */ + @Metadata(generated = true) + public Response getPageRangesWithResponse(String containerName, String blob, String snapshot, + Integer timeout, String range, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, String marker, Integer maxresults, + RequestOptions requestOptions) { + return this.serviceClient.getPageRangesWithResponse(containerName, blob, snapshot, timeout, range, leaseId, + ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, marker, maxresults, + requestOptions); + } + + /** + * The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a + * page blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException 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 of pages. + */ + @Metadata(generated = true) + public PageList getPageRanges(String containerName, String blob, String snapshot, Integer timeout, String range, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, String marker, Integer maxresults) { + return this.serviceClient.getPageRanges(containerName, blob, snapshot, timeout, range, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, marker, maxresults); + } + + /** + * [Update] The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were + * changed between target blob and previous snapshot or version. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param prevsnapshot Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that + * specifies that the response will contain only pages that were changed between target blob and previous snapshot. + * Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot + * specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only + * for blobs created on or after January 1, 2016. + * @param prevSnapshotUrl Optional. This header is only supported in service versions 2019-04-19 and after and + * specifies the URL of a previous snapshot of the target blob. The response will only contain pages that were + * changed between the target blob and its previous snapshot. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException 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 of pages. + */ + @Metadata(generated = true) + public Response getPageRangesDiffWithResponse(String containerName, String blob, String snapshot, + Integer timeout, String prevsnapshot, String prevSnapshotUrl, String range, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, String marker, Integer maxresults, RequestOptions requestOptions) { + return this.serviceClient.getPageRangesDiffWithResponse(containerName, blob, snapshot, timeout, prevsnapshot, + prevSnapshotUrl, range, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, + requestId, marker, maxresults, requestOptions); + } + + /** + * [Update] The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were + * changed between target blob and previous snapshot or version. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param prevsnapshot Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that + * specifies that the response will contain only pages that were changed between target blob and previous snapshot. + * Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot + * specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only + * for blobs created on or after January 1, 2016. + * @param prevSnapshotUrl Optional. This header is only supported in service versions 2019-04-19 and after and + * specifies the URL of a previous snapshot of the target blob. The response will only contain pages that were + * changed between the target blob and its previous snapshot. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException 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 of pages. + */ + @Metadata(generated = true) + public PageList getPageRangesDiff(String containerName, String blob, String snapshot, Integer timeout, + String prevsnapshot, String prevSnapshotUrl, String range, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + String marker, Integer maxresults) { + return this.serviceClient.getPageRangesDiff(containerName, blob, snapshot, timeout, prevsnapshot, + prevSnapshotUrl, range, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, + requestId, marker, maxresults); + } + + /** + * Resize the Blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size + * must be aligned to a 512-byte boundary. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response resizeWithResponse(String containerName, String blob, long blobContentLength, Integer timeout, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, + RequestOptions requestOptions) { + return this.serviceClient.resizeWithResponse(containerName, blob, blobContentLength, timeout, leaseId, + ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam, + requestOptions); + } + + /** + * Resize the Blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size + * must be aligned to a 512-byte boundary. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void resize(String containerName, String blob, long blobContentLength, Integer timeout, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + this.serviceClient.resize(containerName, blob, blobContentLength, timeout, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam); + } + + /** + * Update the sequence number of the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param sequenceNumberAction Required if the x-ms-blob-sequence-number header is set for the request. This + * property applies to page blobs only. This property indicates how the service should modify the blob's sequence + * number. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param blobSequenceNumber Set for page blobs only. The sequence number is a user-controlled value that you can + * use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response updateSequenceNumberWithResponse(String containerName, String blob, + SequenceNumberActionType sequenceNumberAction, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, Long blobSequenceNumber, + String requestId, RequestOptions requestOptions) { + return this.serviceClient.updateSequenceNumberWithResponse(containerName, blob, sequenceNumberAction, timeout, + leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, blobSequenceNumber, requestId, + requestOptions); + } + + /** + * Update the sequence number of the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param sequenceNumberAction Required if the x-ms-blob-sequence-number header is set for the request. This + * property applies to page blobs only. This property indicates how the service should modify the blob's sequence + * number. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param blobSequenceNumber Set for page blobs only. The sequence number is a user-controlled value that you can + * use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void updateSequenceNumber(String containerName, String blob, SequenceNumberActionType sequenceNumberAction, + Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, Long blobSequenceNumber, String requestId) { + this.serviceClient.updateSequenceNumber(containerName, blob, sequenceNumberAction, timeout, leaseId, + ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, blobSequenceNumber, requestId); + } + + /** + * The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. The snapshot + * is copied such that only the differential changes between the previously copied snapshot are transferred to the + * destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as + * usual. This API is supported since REST version 2016-05-31. + * + * @param containerName The container name. + * @param blob The blob name. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response copyIncrementalWithResponse(String containerName, String blob, String copySource, + Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, RequestOptions requestOptions) { + return this.serviceClient.copyIncrementalWithResponse(containerName, blob, copySource, timeout, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, requestOptions); + } + + /** + * The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. The snapshot + * is copied such that only the differential changes between the previously copied snapshot are transferred to the + * destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as + * usual. This API is supported since REST version 2016-05-31. + * + * @param containerName The container name. + * @param blob The blob name. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void copyIncremental(String containerName, String blob, String copySource, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId) { + this.serviceClient.copyIncremental(containerName, blob, copySource, timeout, ifModifiedSince, ifUnmodifiedSince, + ifMatch, ifNoneMatch, ifTags, requestId); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/StorageServiceClient.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/StorageServiceClient.java new file mode 100644 index 000000000000..06548c51c8e1 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/StorageServiceClient.java @@ -0,0 +1,432 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob; + +import com.azure.v2.storage.blob.implementation.ServicesImpl; +import com.azure.v2.storage.blob.models.BlobContainerItem; +import com.azure.v2.storage.blob.models.BlobServiceProperties; +import com.azure.v2.storage.blob.models.BlobServiceStatistics; +import com.azure.v2.storage.blob.models.FilterBlobSegment; +import com.azure.v2.storage.blob.models.FilterBlobsIncludeItem; +import com.azure.v2.storage.blob.models.KeyInfo; +import com.azure.v2.storage.blob.models.ListBlobContainersIncludeType; +import com.azure.v2.storage.blob.models.StorageErrorException; +import com.azure.v2.storage.blob.models.UserDelegationKey; +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.ReturnType; +import io.clientcore.core.annotations.ServiceClient; +import io.clientcore.core.annotations.ServiceMethod; +import io.clientcore.core.http.models.PagedIterable; +import io.clientcore.core.http.models.RequestOptions; +import io.clientcore.core.http.models.Response; +import io.clientcore.core.models.binarydata.BinaryData; +import java.io.InputStream; +import java.util.List; + +/** + * Initializes a new instance of the synchronous AzureBlobStorage type. + */ +@ServiceClient(builder = AzureBlobStorageBuilder.class) +public final class StorageServiceClient { + @Metadata(generated = true) + private final ServicesImpl serviceClient; + + /** + * Initializes an instance of ServiceClient class. + * + * @param serviceClient the service client implementation. + */ + @Metadata(generated = true) + StorageServiceClient(ServicesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and + * CORS (Cross-Origin Resource Sharing) rules. + * + * @param blobServiceProperties The StorageService properties. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response setPropertiesWithResponse(BlobServiceProperties blobServiceProperties, Integer timeout, + String requestId, RequestOptions requestOptions) { + return this.serviceClient.setPropertiesWithResponse(blobServiceProperties, timeout, requestId, requestOptions); + } + + /** + * Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and + * CORS (Cross-Origin Resource Sharing) rules. + * + * @param blobServiceProperties The StorageService properties. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void setProperties(BlobServiceProperties blobServiceProperties, Integer timeout, String requestId) { + this.serviceClient.setProperties(blobServiceProperties, timeout, requestId); + } + + /** + * gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS + * (Cross-Origin Resource Sharing) rules. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a storage account's Blob service, including properties for Storage Analytics and CORS + * (Cross-Origin Resource Sharing) rules. + */ + @Metadata(generated = true) + public Response getPropertiesWithResponse(Integer timeout, String requestId, + RequestOptions requestOptions) { + return this.serviceClient.getPropertiesWithResponse(timeout, requestId, requestOptions); + } + + /** + * gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS + * (Cross-Origin Resource Sharing) rules. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a storage account's Blob service, including properties for Storage Analytics and CORS + * (Cross-Origin Resource Sharing) rules. + */ + @Metadata(generated = true) + public BlobServiceProperties getProperties(Integer timeout, String requestId) { + return this.serviceClient.getProperties(timeout, requestId); + } + + /** + * Retrieves statistics related to replication for the Blob service. It is only available on the secondary location + * endpoint when read-access geo-redundant replication is enabled for the storage account. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return stats for the storage service. + */ + @Metadata(generated = true) + public Response getStatisticsWithResponse(Integer timeout, String requestId, + RequestOptions requestOptions) { + return this.serviceClient.getStatisticsWithResponse(timeout, requestId, requestOptions); + } + + /** + * Retrieves statistics related to replication for the Blob service. It is only available on the secondary location + * endpoint when read-access geo-redundant replication is enabled for the storage account. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return stats for the storage service. + */ + @Metadata(generated = true) + public BlobServiceStatistics getStatistics(Integer timeout, String requestId) { + return this.serviceClient.getStatistics(timeout, requestId); + } + + /** + * The List Containers Segment operation returns a list of the containers under the specified account. + * + * @param prefix Filters the results to return only containers whose name begins with the specified prefix. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param listBlobContainersIncludeType Include this parameter to specify that the container's metadata be returned + * as part of the response body. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of containers. + */ + @Metadata(generated = true) + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBlobContainersSegment(String prefix, String marker, Integer maxresults, + List listBlobContainersIncludeType, Integer timeout, String requestId) { + return this.serviceClient.listBlobContainersSegment(prefix, marker, maxresults, listBlobContainersIncludeType, + timeout, requestId); + } + + /** + * The List Containers Segment operation returns a list of the containers under the specified account. + * + * @param prefix Filters the results to return only containers whose name begins with the specified prefix. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param listBlobContainersIncludeType Include this parameter to specify that the container's metadata be returned + * as part of the response body. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of containers. + */ + @Metadata(generated = true) + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBlobContainersSegment(String prefix, String marker, Integer maxresults, + List listBlobContainersIncludeType, Integer timeout, String requestId, + RequestOptions requestOptions) { + return this.serviceClient.listBlobContainersSegment(prefix, marker, maxresults, listBlobContainersIncludeType, + timeout, requestId, requestOptions); + } + + /** + * Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token + * authentication. + * + * @param keyInfo Key information. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a user delegation key. + */ + @Metadata(generated = true) + public Response getUserDelegationKeyWithResponse(KeyInfo keyInfo, Integer timeout, + String requestId, RequestOptions requestOptions) { + return this.serviceClient.getUserDelegationKeyWithResponse(keyInfo, timeout, requestId, requestOptions); + } + + /** + * Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token + * authentication. + * + * @param keyInfo Key information. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a user delegation key. + */ + @Metadata(generated = true) + public UserDelegationKey getUserDelegationKey(KeyInfo keyInfo, Integer timeout, String requestId) { + return this.serviceClient.getUserDelegationKey(keyInfo, timeout, requestId); + } + + /** + * Returns the sku name and account kind. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response getAccountInfoWithResponse(Integer timeout, String requestId, RequestOptions requestOptions) { + return this.serviceClient.getAccountInfoWithResponse(timeout, requestId, requestOptions); + } + + /** + * Returns the sku name and account kind. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Metadata(generated = true) + public void getAccountInfo(Integer timeout, String requestId) { + this.serviceClient.getAccountInfo(timeout, requestId); + } + + /** + * The Batch operation allows multiple API calls to be embedded into a single HTTP request. + * + * @param contentLength The length of the request. + * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. + * Example header value: multipart/mixed; boundary=batch_<GUID>. + * @param body Initial data. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public Response submitBatchWithResponse(long contentLength, String multipartContentType, + BinaryData body, Integer timeout, String requestId, RequestOptions requestOptions) { + return this.serviceClient.submitBatchWithResponse(contentLength, multipartContentType, body, timeout, requestId, + requestOptions); + } + + /** + * The Batch operation allows multiple API calls to be embedded into a single HTTP request. + * + * @param contentLength The length of the request. + * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. + * Example header value: multipart/mixed; boundary=batch_<GUID>. + * @param body Initial data. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Metadata(generated = true) + public InputStream submitBatch(long contentLength, String multipartContentType, BinaryData body, Integer timeout, + String requestId) { + return this.serviceClient.submitBatch(contentLength, multipartContentType, body, timeout, requestId); + } + + /** + * The Filter Blobs operation enables callers to list blobs across all containers whose tags match a given search + * expression. Filter blobs searches across all containers within a storage account but can be scoped within the + * expression to a single container. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param where Filters the results to return only to return only blobs whose tags match the specified expression. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a Filter Blobs API call. + */ + @Metadata(generated = true) + public Response filterBlobsWithResponse(Integer timeout, String requestId, String where, + String marker, Integer maxresults, List include, RequestOptions requestOptions) { + return this.serviceClient.filterBlobsWithResponse(timeout, requestId, where, marker, maxresults, include, + requestOptions); + } + + /** + * The Filter Blobs operation enables callers to list blobs across all containers whose tags match a given search + * expression. Filter blobs searches across all containers within a storage account but can be scoped within the + * expression to a single container. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param where Filters the results to return only to return only blobs whose tags match the specified expression. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws StorageErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a Filter Blobs API call. + */ + @Metadata(generated = true) + public FilterBlobSegment filterBlobs(Integer timeout, String requestId, String where, String marker, + Integer maxresults, List include) { + return this.serviceClient.filterBlobs(timeout, requestId, where, marker, maxresults, include); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/AppendBlobsImpl.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/AppendBlobsImpl.java new file mode 100644 index 000000000000..51f96bc2020d --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/AppendBlobsImpl.java @@ -0,0 +1,763 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.implementation; + +import com.azure.v2.storage.blob.models.BlobHttpHeaders; +import com.azure.v2.storage.blob.models.BlobImmutabilityPolicyMode; +import com.azure.v2.storage.blob.models.CpkInfo; +import com.azure.v2.storage.blob.models.EncryptionAlgorithmType; +import com.azure.v2.storage.blob.models.EncryptionScope; +import com.azure.v2.storage.blob.models.StorageError; +import io.clientcore.core.annotations.ServiceInterface; +import io.clientcore.core.http.RestProxy; +import io.clientcore.core.http.annotations.BodyParam; +import io.clientcore.core.http.annotations.HeaderParam; +import io.clientcore.core.http.annotations.HostParam; +import io.clientcore.core.http.annotations.HttpRequestInformation; +import io.clientcore.core.http.annotations.PathParam; +import io.clientcore.core.http.annotations.QueryParam; +import io.clientcore.core.http.annotations.UnexpectedResponseExceptionDetail; +import io.clientcore.core.http.exceptions.HttpResponseException; +import io.clientcore.core.http.models.HttpMethod; +import io.clientcore.core.http.models.RequestOptions; +import io.clientcore.core.http.models.Response; +import io.clientcore.core.http.pipeline.HttpPipeline; +import io.clientcore.core.models.binarydata.BinaryData; +import io.clientcore.core.serialization.ObjectSerializer; +import io.clientcore.core.utils.Base64Util; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.lang.reflect.InvocationTargetException; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * An instance of this class provides access to all the operations defined in AppendBlobs. + */ +public final class AppendBlobsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final AppendBlobsService service; + + /** + * The service client containing this operation class. + */ + private final AzureBlobStorageImpl client; + + /** + * Initializes an instance of AppendBlobsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AppendBlobsImpl(AzureBlobStorageImpl client) { + this.service = RestProxy.create(AppendBlobsService.class, client.getHttpPipeline()); + this.client = client; + } + + /** + * The interface defining all the services for AzureBlobStorageAppendBlobs to be used by the proxy service to + * perform REST calls. + */ + @ServiceInterface(name = "AzureBlobStorageAppe", host = "{url}") + public interface AppendBlobsService { + static AppendBlobsService getNewInstance(HttpPipeline pipeline, ObjectSerializer serializer) { + try { + Class clazz = Class.forName("com.azure.v2.storage.blob.implementation.AppendBlobsServiceImpl"); + return (AppendBlobsService) clazz + .getMethod("getNewInstance", HttpPipeline.class, ObjectSerializer.class) + .invoke(null, pipeline, serializer); + } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException + | InvocationTargetException e) { + throw new RuntimeException(e); + } + + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response create(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @HeaderParam("x-ms-blob-type") String blobType, + @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void create(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @HeaderParam("x-ms-blob-type") String blobType, + @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + create(url, containerName, blob, blobType, null, contentLength, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, version, null, null, null, null, null, + accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response appendBlock(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-blob-condition-maxsize") Long maxSize, + @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-structured-body") String structuredBodyType, + @HeaderParam("x-ms-structured-content-length") Long structuredContentLength, + @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void appendBlock(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-version") String version, + @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept) { + appendBlock(url, containerName, blob, comp, null, contentLength, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, version, null, null, null, body, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response appendBlockFromUrl(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-copy-source") String sourceUrl, + @HeaderParam("x-ms-source-range") String sourceRange, + @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, + @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, @QueryParam("timeout") Integer timeout, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-condition-maxsize") Long maxSize, + @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void appendBlockFromUrl(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-copy-source") String sourceUrl, @HeaderParam("Content-Length") long contentLength, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + appendBlockFromUrl(url, containerName, blob, comp, sourceUrl, null, null, null, null, contentLength, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, version, + null, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response seal(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void seal(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + seal(url, containerName, blob, comp, null, version, null, null, null, null, null, null, null, accept, null); + } + } + + /** + * The Create Append Blob operation creates a new append blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response createWithResponse(String containerName, String blob, long contentLength, Integer timeout, + Map metadata, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, + RequestOptions requestOptions) { + final String blobType = "AppendBlob"; + final String accept = "application/xml"; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String contentMd5Converted = Base64Util.encodeToString(contentMd5); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + return service.create(this.client.getUrl(), containerName, blob, blobType, timeout, contentLength, contentType, + contentEncoding, contentLanguage, contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, + blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, + requestOptions); + } + + /** + * The Create Append Blob operation creates a new append blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void create(String containerName, String blob, long contentLength, Integer timeout, + Map metadata, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + createWithResponse(containerName, blob, contentLength, timeout, metadata, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, + immutabilityPolicyMode, legalHold, blobHttpHeaders, cpkInfo, encryptionScopeParam, RequestOptions.none()); + } + + /** + * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block + * operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is + * supported only on version 2015-02-21 version or later. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param body Initial data. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param maxSize Optional conditional header. The max length in bytes permitted for the append blob. If the Append + * Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value + * specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - + * Precondition Failed). + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param structuredBodyType Required if the request body is a structured message. Specifies the message schema + * version and properties. + * @param structuredContentLength Required if the request body is a structured message. Specifies the length of the + * blob/file content inside the message body. Will always be smaller than Content-Length. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response appendBlockWithResponse(String containerName, String blob, long contentLength, + BinaryData body, Integer timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, + String leaseId, Long maxSize, Long appendPosition, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + String structuredBodyType, Long structuredContentLength, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, + RequestOptions requestOptions) { + final String comp = "appendblock"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.appendBlock(this.client.getUrl(), containerName, blob, comp, timeout, contentLength, + transactionalContentMD5Converted, transactionalContentCrc64Converted, leaseId, maxSize, appendPosition, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, + structuredBodyType, structuredContentLength, body, accept, requestOptions); + } + + /** + * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block + * operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is + * supported only on version 2015-02-21 version or later. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param body Initial data. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param maxSize Optional conditional header. The max length in bytes permitted for the append blob. If the Append + * Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value + * specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - + * Precondition Failed). + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param structuredBodyType Required if the request body is a structured message. Specifies the message schema + * version and properties. + * @param structuredContentLength Required if the request body is a structured message. Specifies the length of the + * blob/file content inside the message body. Will always be smaller than Content-Length. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void appendBlock(String containerName, String blob, long contentLength, BinaryData body, Integer timeout, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, String leaseId, Long maxSize, + Long appendPosition, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, String structuredBodyType, Long structuredContentLength, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + appendBlockWithResponse(containerName, blob, contentLength, body, timeout, transactionalContentMD5, + transactionalContentCrc64, leaseId, maxSize, appendPosition, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, requestId, structuredBodyType, structuredContentLength, cpkInfo, encryptionScopeParam, + RequestOptions.none()); + } + + /** + * The Append Block operation commits a new block of data to the end of an existing append blob where the contents + * are read from a source url. The Append Block operation is permitted only if the blob was created with + * x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. + * + * @param containerName The container name. + * @param blob The blob name. + * @param sourceUrl Specify a URL to the copy source. + * @param contentLength The length of the request. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param maxSize Optional conditional header. The max length in bytes permitted for the append blob. If the Append + * Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value + * specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - + * Precondition Failed). + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response appendBlockFromUrlWithResponse(String containerName, String blob, String sourceUrl, + long contentLength, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, + byte[] transactionalContentMD5, String leaseId, Long maxSize, Long appendPosition, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + final String comp = "appendblock"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + return service.appendBlockFromUrl(this.client.getUrl(), containerName, blob, comp, sourceUrl, sourceRange, + sourceContentMD5Converted, sourceContentcrc64Converted, timeout, contentLength, + transactionalContentMD5Converted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, + sourceIfNoneMatch, this.client.getVersion(), requestId, copySourceAuthorization, accept, requestOptions); + } + + /** + * The Append Block operation commits a new block of data to the end of an existing append blob where the contents + * are read from a source url. The Append Block operation is permitted only if the blob was created with + * x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. + * + * @param containerName The container name. + * @param blob The blob name. + * @param sourceUrl Specify a URL to the copy source. + * @param contentLength The length of the request. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param maxSize Optional conditional header. The max length in bytes permitted for the append blob. If the Append + * Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value + * specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - + * Precondition Failed). + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void appendBlockFromUrl(String containerName, String blob, String sourceUrl, long contentLength, + String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, + byte[] transactionalContentMD5, String leaseId, Long maxSize, Long appendPosition, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + appendBlockFromUrlWithResponse(containerName, blob, sourceUrl, contentLength, sourceRange, sourceContentMD5, + sourceContentcrc64, timeout, transactionalContentMD5, leaseId, maxSize, appendPosition, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, + sourceIfMatch, sourceIfNoneMatch, requestId, copySourceAuthorization, cpkInfo, encryptionScopeParam, + RequestOptions.none()); + } + + /** + * The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 + * version or later. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response sealWithResponse(String containerName, String blob, Integer timeout, String requestId, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, Long appendPosition, RequestOptions requestOptions) { + final String comp = "seal"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.seal(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), + requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, + appendPosition, accept, requestOptions); + } + + /** + * The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 + * version or later. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void seal(String containerName, String blob, Integer timeout, String requestId, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + Long appendPosition) { + sealWithResponse(containerName, blob, timeout, requestId, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, appendPosition, RequestOptions.none()); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/AzureBlobStorageImpl.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/AzureBlobStorageImpl.java new file mode 100644 index 000000000000..a06758a247d5 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/AzureBlobStorageImpl.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.implementation; + +import io.clientcore.core.http.pipeline.HttpPipeline; + +/** + * Initializes a new instance of the AzureBlobStorage type. + */ +public final class AzureBlobStorageImpl { + /** + * The URL of the service account, container, or blob that is the target of the desired operation. + */ + private final String url; + + /** + * Gets The URL of the service account, container, or blob that is the target of the desired operation. + * + * @return the url value. + */ + public String getUrl() { + return this.url; + } + + /** + * Specifies the version of the operation to use for this request. + */ + private final String version; + + /** + * Gets Specifies the version of the operation to use for this request. + * + * @return the version value. + */ + public String getVersion() { + return this.version; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The ServicesImpl object to access its operations. + */ + private final ServicesImpl services; + + /** + * Gets the ServicesImpl object to access its operations. + * + * @return the ServicesImpl object. + */ + public ServicesImpl getServices() { + return this.services; + } + + /** + * The ContainersImpl object to access its operations. + */ + private final ContainersImpl containers; + + /** + * Gets the ContainersImpl object to access its operations. + * + * @return the ContainersImpl object. + */ + public ContainersImpl getContainers() { + return this.containers; + } + + /** + * The BlobsImpl object to access its operations. + */ + private final BlobsImpl blobs; + + /** + * Gets the BlobsImpl object to access its operations. + * + * @return the BlobsImpl object. + */ + public BlobsImpl getBlobs() { + return this.blobs; + } + + /** + * The PageBlobsImpl object to access its operations. + */ + private final PageBlobsImpl pageBlobs; + + /** + * Gets the PageBlobsImpl object to access its operations. + * + * @return the PageBlobsImpl object. + */ + public PageBlobsImpl getPageBlobs() { + return this.pageBlobs; + } + + /** + * The AppendBlobsImpl object to access its operations. + */ + private final AppendBlobsImpl appendBlobs; + + /** + * Gets the AppendBlobsImpl object to access its operations. + * + * @return the AppendBlobsImpl object. + */ + public AppendBlobsImpl getAppendBlobs() { + return this.appendBlobs; + } + + /** + * The BlockBlobsImpl object to access its operations. + */ + private final BlockBlobsImpl blockBlobs; + + /** + * Gets the BlockBlobsImpl object to access its operations. + * + * @return the BlockBlobsImpl object. + */ + public BlockBlobsImpl getBlockBlobs() { + return this.blockBlobs; + } + + /** + * Initializes an instance of AzureBlobStorage client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param url The URL of the service account, container, or blob that is the target of the desired operation. + * @param version Specifies the version of the operation to use for this request. + */ + public AzureBlobStorageImpl(HttpPipeline httpPipeline, String url, String version) { + this.httpPipeline = httpPipeline; + this.url = url; + this.version = version; + this.services = new ServicesImpl(this); + this.containers = new ContainersImpl(this); + this.blobs = new BlobsImpl(this); + this.pageBlobs = new PageBlobsImpl(this); + this.appendBlobs = new AppendBlobsImpl(this); + this.blockBlobs = new BlockBlobsImpl(this); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/BlobsImpl.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/BlobsImpl.java new file mode 100644 index 000000000000..83adb2f6b488 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/BlobsImpl.java @@ -0,0 +1,2728 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.implementation; + +import com.azure.v2.storage.blob.models.AccessTier; +import com.azure.v2.storage.blob.models.BlobCopySourceTagsMode; +import com.azure.v2.storage.blob.models.BlobDeleteType; +import com.azure.v2.storage.blob.models.BlobExpiryOptions; +import com.azure.v2.storage.blob.models.BlobHttpHeaders; +import com.azure.v2.storage.blob.models.BlobImmutabilityPolicyMode; +import com.azure.v2.storage.blob.models.BlobTags; +import com.azure.v2.storage.blob.models.CpkInfo; +import com.azure.v2.storage.blob.models.DeleteSnapshotsOptionType; +import com.azure.v2.storage.blob.models.EncryptionAlgorithmType; +import com.azure.v2.storage.blob.models.EncryptionScope; +import com.azure.v2.storage.blob.models.QueryRequest; +import com.azure.v2.storage.blob.models.RehydratePriority; +import com.azure.v2.storage.blob.models.StorageError; +import io.clientcore.core.annotations.ServiceInterface; +import io.clientcore.core.http.RestProxy; +import io.clientcore.core.http.annotations.BodyParam; +import io.clientcore.core.http.annotations.HeaderParam; +import io.clientcore.core.http.annotations.HostParam; +import io.clientcore.core.http.annotations.HttpRequestInformation; +import io.clientcore.core.http.annotations.PathParam; +import io.clientcore.core.http.annotations.QueryParam; +import io.clientcore.core.http.annotations.UnexpectedResponseExceptionDetail; +import io.clientcore.core.http.exceptions.HttpResponseException; +import io.clientcore.core.http.models.HttpMethod; +import io.clientcore.core.http.models.RequestOptions; +import io.clientcore.core.http.models.Response; +import io.clientcore.core.http.pipeline.HttpPipeline; +import io.clientcore.core.serialization.ObjectSerializer; +import io.clientcore.core.utils.Base64Util; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * An instance of this class provides access to all the operations defined in Blobs. + */ +public final class BlobsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BlobsService service; + + /** + * The service client containing this operation class. + */ + private final AzureBlobStorageImpl client; + + /** + * Initializes an instance of BlobsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BlobsImpl(AzureBlobStorageImpl client) { + this.service = RestProxy.create(BlobsService.class, client.getHttpPipeline()); + this.client = client; + } + + /** + * The interface defining all the services for AzureBlobStorageBlobs to be used by the proxy service to perform REST + * calls. + */ + @ServiceInterface(name = "AzureBlobStorageBlob", host = "{url}") + public interface BlobsService { + static BlobsService getNewInstance(HttpPipeline pipeline, ObjectSerializer serializer) { + try { + Class clazz = Class.forName("com.azure.v2.storage.blob.implementation.BlobsServiceImpl"); + return (BlobsService) clazz.getMethod("getNewInstance", HttpPipeline.class, ObjectSerializer.class) + .invoke(null, pipeline, serializer); + } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException + | InvocationTargetException e) { + throw new RuntimeException(e); + } + + } + + @HttpRequestInformation( + method = HttpMethod.GET, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200, 206 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response download(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("snapshot") String snapshot, + @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-range-get-content-md5") Boolean rangeGetContentMD5, + @HeaderParam("x-ms-range-get-content-crc64") Boolean rangeGetContentCRC64, + @HeaderParam("x-ms-structured-body") String structuredBodyType, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.GET, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200, 206 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default InputStream download(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + return download(url, containerName, blob, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, version, null, accept, null).getValue(); + } + + @HttpRequestInformation( + method = HttpMethod.HEAD, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response getProperties(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("snapshot") String snapshot, + @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.HEAD, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void getProperties(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + getProperties(url, containerName, blob, null, null, null, null, null, null, null, null, null, null, null, + null, version, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.DELETE, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response delete(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("snapshot") String snapshot, + @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-delete-snapshots") DeleteSnapshotsOptionType deleteSnapshots, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @QueryParam("deletetype") BlobDeleteType blobDeleteType, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.DELETE, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void delete(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + delete(url, containerName, blob, null, null, null, null, null, null, null, null, null, null, version, null, + null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response undelete(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void undelete(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + undelete(url, containerName, blob, comp, null, version, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response setExpiry(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-expiry-option") BlobExpiryOptions expiryOptions, + @HeaderParam("x-ms-expiry-time") String expiresOn, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void setExpiry(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-expiry-option") BlobExpiryOptions expiryOptions, @HeaderParam("Accept") String accept) { + setExpiry(url, containerName, blob, comp, null, version, null, expiryOptions, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response setHttpHeaders(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void setHttpHeaders(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + setHttpHeaders(url, containerName, blob, comp, null, null, null, null, null, null, null, null, null, null, + null, null, null, version, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response setImmutabilityPolicy(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void setImmutabilityPolicy(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + setImmutabilityPolicy(url, containerName, blob, comp, null, version, null, null, null, null, null, null, + accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.DELETE, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response deleteImmutabilityPolicy(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.DELETE, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void deleteImmutabilityPolicy(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + deleteImmutabilityPolicy(url, containerName, blob, comp, null, version, null, null, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response setLegalHold(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-legal-hold") boolean legalHold, @QueryParam("snapshot") String snapshot, + @QueryParam("versionid") String versionId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void setLegalHold(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-legal-hold") boolean legalHold, + @HeaderParam("Accept") String accept) { + setLegalHold(url, containerName, blob, comp, null, version, null, legalHold, null, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response setMetadata(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void setMetadata(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + setMetadata(url, containerName, blob, comp, null, null, null, null, null, null, null, null, null, null, + null, null, version, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response acquireLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-lease-action") String action, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-duration") Integer duration, + @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void acquireLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-lease-action") String action, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + acquireLease(url, containerName, blob, comp, action, null, null, null, null, null, null, null, null, + version, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response releaseLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-lease-action") String action, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void releaseLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-lease-action") String action, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + releaseLease(url, containerName, blob, comp, action, null, leaseId, null, null, null, null, null, version, + null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response renewLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-lease-action") String action, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void renewLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-lease-action") String action, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + renewLease(url, containerName, blob, comp, action, null, leaseId, null, null, null, null, null, version, + null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response changeLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-lease-action") String action, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void changeLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-lease-action") String action, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + changeLease(url, containerName, blob, comp, action, null, leaseId, proposedLeaseId, null, null, null, null, + null, version, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response breakLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-lease-action") String action, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-break-period") Integer breakPeriod, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void breakLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-lease-action") String action, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + breakLease(url, containerName, blob, comp, action, null, null, null, null, null, null, null, version, null, + accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response createSnapshot(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-meta-") Map metadata, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void createSnapshot(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + createSnapshot(url, containerName, blob, comp, null, null, null, null, null, null, null, null, null, null, + null, null, version, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response startCopyFromURL(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("x-ms-rehydrate-priority") RehydratePriority rehydratePriority, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("x-ms-source-if-tags") String sourceIfTags, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-copy-source") String copySource, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-seal-blob") Boolean sealBlob, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void startCopyFromURL(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @HeaderParam("x-ms-copy-source") String copySource, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + startCopyFromURL(url, containerName, blob, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, copySource, null, version, null, null, null, null, null, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response copyFromURL(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @HeaderParam("x-ms-requires-sync") String xMsRequiresSync, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, + @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-copy-source") String copySource, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, + @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, + @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-copy-source-tag-option") BlobCopySourceTagsMode copySourceTags, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void copyFromURL(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @HeaderParam("x-ms-requires-sync") String xMsRequiresSync, + @HeaderParam("x-ms-copy-source") String copySource, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + copyFromURL(url, containerName, blob, xMsRequiresSync, null, null, null, null, null, null, null, null, null, + null, null, null, copySource, null, version, null, null, null, null, null, null, null, null, null, + accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 204 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response abortCopyFromURL(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-copy-action") String copyActionAbortConstant, @QueryParam("copyid") String copyId, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 204 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void abortCopyFromURL(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-copy-action") String copyActionAbortConstant, @QueryParam("copyid") String copyId, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + abortCopyFromURL(url, containerName, blob, comp, copyActionAbortConstant, copyId, null, null, version, null, + accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200, 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response setTier(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, + @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("x-ms-rehydrate-priority") RehydratePriority rehydratePriority, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200, 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void setTier(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-access-tier") AccessTier tier, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + setTier(url, containerName, blob, comp, null, null, null, tier, null, version, null, null, null, accept, + null); + } + + @HttpRequestInformation( + method = HttpMethod.GET, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response getAccountInfo(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.GET, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void getAccountInfo(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + getAccountInfo(url, containerName, blob, restype, comp, null, version, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.POST, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200, 206 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response query(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/xml") QueryRequest queryRequest, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.POST, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200, 206 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default InputStream query(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + return query(url, containerName, blob, comp, null, null, null, null, null, null, null, null, null, null, + null, version, null, null, accept, null).getValue(); + } + + @HttpRequestInformation( + method = HttpMethod.GET, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response getTags(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.GET, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default BlobTags getTags(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + return getTags(url, containerName, blob, comp, null, version, null, null, null, null, null, accept, null) + .getValue(); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 204 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response setTags(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @QueryParam("timeout") Integer timeout, + @QueryParam("versionid") String versionId, @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-lease-id") String leaseId, @BodyParam("application/xml") BlobTags tags, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 204 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void setTags(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + setTags(url, containerName, blob, comp, version, null, null, null, null, null, null, null, null, accept, + null); + } + } + + /** + * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can + * also call Download to read a snapshot or version. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param rangeGetContentMD5 When set to true and specified together with the Range, the service returns the MD5 + * hash for the range, as long as the range is less than or equal to 4 MB in size. + * @param rangeGetContentCRC64 When set to true and specified together with the Range, the service returns the CRC64 + * hash for the range, as long as the range is less than or equal to 4 MB in size. + * @param structuredBodyType Specifies the response content should be returned as a structured message and specifies + * the message schema version and properties. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response downloadWithResponse(String containerName, String blob, String snapshot, + String versionId, Integer timeout, String range, String leaseId, Boolean rangeGetContentMD5, + Boolean rangeGetContentCRC64, String structuredBodyType, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + CpkInfo cpkInfo, RequestOptions requestOptions) { + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.download(this.client.getUrl(), containerName, blob, snapshot, versionId, timeout, range, leaseId, + rangeGetContentMD5, rangeGetContentCRC64, structuredBodyType, encryptionKey, encryptionKeySha256, + encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can + * also call Download to read a snapshot or version. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param rangeGetContentMD5 When set to true and specified together with the Range, the service returns the MD5 + * hash for the range, as long as the range is less than or equal to 4 MB in size. + * @param rangeGetContentCRC64 When set to true and specified together with the Range, the service returns the CRC64 + * hash for the range, as long as the range is less than or equal to 4 MB in size. + * @param structuredBodyType Specifies the response content should be returned as a structured message and specifies + * the message schema version and properties. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public InputStream download(String containerName, String blob, String snapshot, String versionId, Integer timeout, + String range, String leaseId, Boolean rangeGetContentMD5, Boolean rangeGetContentCRC64, + String structuredBodyType, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo) { + return downloadWithResponse(containerName, blob, snapshot, versionId, timeout, range, leaseId, + rangeGetContentMD5, rangeGetContentCRC64, structuredBodyType, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, requestId, cpkInfo, RequestOptions.none()).getValue(); + } + + /** + * The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties + * for the blob. It does not return the content of the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response getPropertiesWithResponse(String containerName, String blob, String snapshot, + String versionId, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + CpkInfo cpkInfo, RequestOptions requestOptions) { + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.getProperties(this.client.getUrl(), containerName, blob, snapshot, versionId, timeout, leaseId, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, + requestOptions); + } + + /** + * The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties + * for the blob. It does not return the content of the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void getProperties(String containerName, String blob, String snapshot, String versionId, Integer timeout, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo) { + getPropertiesWithResponse(containerName, blob, snapshot, versionId, timeout, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, RequestOptions.none()); + } + + /** + * If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed + * from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, + * it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or + * snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] + * (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently + * removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until + * it is permanently removed. Use the List Blobs API and specify the "include=deleted" query parameter to discover + * which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a + * soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP + * status code of 404 (ResourceNotFound). If the storage account's automatic snapshot feature is enabled, then, when + * a blob is deleted, an automatic snapshot is created. The blob becomes inaccessible immediately. All other + * operations on the blob causes the service to return an HTTP status code of 404 (ResourceNotFound). You can access + * automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob + * API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC + * permissions. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param deleteSnapshots Required if the blob has associated snapshots. Specify one of the following two options: + * include: Delete the base blob and all of its snapshots. only: Delete only the blob's snapshots and not the blob + * itself. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobDeleteType Optional. Only possible value is 'permanent', which specifies to permanently delete a blob + * if blob soft delete is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response deleteWithResponse(String containerName, String blob, String snapshot, String versionId, + Integer timeout, String leaseId, DeleteSnapshotsOptionType deleteSnapshots, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + BlobDeleteType blobDeleteType, RequestOptions requestOptions) { + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.delete(this.client.getUrl(), containerName, blob, snapshot, versionId, timeout, leaseId, + deleteSnapshots, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, blobDeleteType, accept, requestOptions); + } + + /** + * If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed + * from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, + * it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or + * snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] + * (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently + * removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until + * it is permanently removed. Use the List Blobs API and specify the "include=deleted" query parameter to discover + * which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a + * soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP + * status code of 404 (ResourceNotFound). If the storage account's automatic snapshot feature is enabled, then, when + * a blob is deleted, an automatic snapshot is created. The blob becomes inaccessible immediately. All other + * operations on the blob causes the service to return an HTTP status code of 404 (ResourceNotFound). You can access + * automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob + * API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC + * permissions. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param deleteSnapshots Required if the blob has associated snapshots. Specify one of the following two options: + * include: Delete the base blob and all of its snapshots. only: Delete only the blob's snapshots and not the blob + * itself. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobDeleteType Optional. Only possible value is 'permanent', which specifies to permanently delete a blob + * if blob soft delete is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void delete(String containerName, String blob, String snapshot, String versionId, Integer timeout, + String leaseId, DeleteSnapshotsOptionType deleteSnapshots, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + BlobDeleteType blobDeleteType) { + deleteWithResponse(containerName, blob, snapshot, versionId, timeout, leaseId, deleteSnapshots, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobDeleteType, RequestOptions.none()); + } + + /** + * Undelete a blob that was previously soft deleted. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response undeleteWithResponse(String containerName, String blob, Integer timeout, String requestId, + RequestOptions requestOptions) { + final String comp = "undelete"; + final String accept = "application/xml"; + return service.undelete(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), + requestId, accept, requestOptions); + } + + /** + * Undelete a blob that was previously soft deleted. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void undelete(String containerName, String blob, Integer timeout, String requestId) { + undeleteWithResponse(containerName, blob, timeout, requestId, RequestOptions.none()); + } + + /** + * Sets the time a blob will expire and be deleted. + * + * @param containerName The container name. + * @param blob The blob name. + * @param expiryOptions Required. Indicates mode of the expiry time. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param expiresOn The time to set the blob to expiry. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response setExpiryWithResponse(String containerName, String blob, BlobExpiryOptions expiryOptions, + Integer timeout, String requestId, String expiresOn, RequestOptions requestOptions) { + final String comp = "expiry"; + final String accept = "application/xml"; + return service.setExpiry(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), + requestId, expiryOptions, expiresOn, accept, requestOptions); + } + + /** + * Sets the time a blob will expire and be deleted. + * + * @param containerName The container name. + * @param blob The blob name. + * @param expiryOptions Required. Indicates mode of the expiry time. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param expiresOn The time to set the blob to expiry. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void setExpiry(String containerName, String blob, BlobExpiryOptions expiryOptions, Integer timeout, + String requestId, String expiresOn) { + setExpiryWithResponse(containerName, blob, expiryOptions, timeout, requestId, expiresOn, RequestOptions.none()); + } + + /** + * The Set HTTP Headers operation sets system properties on the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobHttpHeaders Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response setHttpHeadersWithResponse(String containerName, String blob, Integer timeout, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, BlobHttpHeaders blobHttpHeaders, RequestOptions requestOptions) { + final String comp = "properties"; + final String accept = "application/xml"; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; + String contentMd5Converted = Base64Util.encodeToString(contentMd5); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.setHttpHeaders(this.client.getUrl(), containerName, blob, comp, timeout, cacheControl, + contentType, contentMd5Converted, contentEncoding, contentLanguage, leaseId, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, contentDisposition, this.client.getVersion(), + requestId, accept, requestOptions); + } + + /** + * The Set HTTP Headers operation sets system properties on the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobHttpHeaders Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void setHttpHeaders(String containerName, String blob, Integer timeout, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, BlobHttpHeaders blobHttpHeaders) { + setHttpHeadersWithResponse(containerName, blob, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, requestId, blobHttpHeaders, RequestOptions.none()); + } + + /** + * The Set Immutability Policy operation sets the immutability policy on the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response setImmutabilityPolicyWithResponse(String containerName, String blob, Integer timeout, + String requestId, OffsetDateTime ifUnmodifiedSince, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, String snapshot, String versionId, + RequestOptions requestOptions) { + final String comp = "immutabilityPolicies"; + final String accept = "application/xml"; + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + return service.setImmutabilityPolicy(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, ifUnmodifiedSinceConverted, immutabilityPolicyExpiryConverted, + immutabilityPolicyMode, snapshot, versionId, accept, requestOptions); + } + + /** + * The Set Immutability Policy operation sets the immutability policy on the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void setImmutabilityPolicy(String containerName, String blob, Integer timeout, String requestId, + OffsetDateTime ifUnmodifiedSince, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, String snapshot, String versionId) { + setImmutabilityPolicyWithResponse(containerName, blob, timeout, requestId, ifUnmodifiedSince, + immutabilityPolicyExpiry, immutabilityPolicyMode, snapshot, versionId, RequestOptions.none()); + } + + /** + * The Delete Immutability Policy operation deletes the immutability policy on the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response deleteImmutabilityPolicyWithResponse(String containerName, String blob, Integer timeout, + String requestId, String snapshot, String versionId, RequestOptions requestOptions) { + final String comp = "immutabilityPolicies"; + final String accept = "application/xml"; + return service.deleteImmutabilityPolicy(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, snapshot, versionId, accept, requestOptions); + } + + /** + * The Delete Immutability Policy operation deletes the immutability policy on the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void deleteImmutabilityPolicy(String containerName, String blob, Integer timeout, String requestId, + String snapshot, String versionId) { + deleteImmutabilityPolicyWithResponse(containerName, blob, timeout, requestId, snapshot, versionId, + RequestOptions.none()); + } + + /** + * The Set Legal Hold operation sets a legal hold on the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response setLegalHoldWithResponse(String containerName, String blob, boolean legalHold, + Integer timeout, String requestId, String snapshot, String versionId, RequestOptions requestOptions) { + final String comp = "legalhold"; + final String accept = "application/xml"; + return service.setLegalHold(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), + requestId, legalHold, snapshot, versionId, accept, requestOptions); + } + + /** + * The Set Legal Hold operation sets a legal hold on the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void setLegalHold(String containerName, String blob, boolean legalHold, Integer timeout, String requestId, + String snapshot, String versionId) { + setLegalHoldWithResponse(containerName, blob, legalHold, timeout, requestId, snapshot, versionId, + RequestOptions.none()); + } + + /** + * The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value + * pairs. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response setMetadataWithResponse(String containerName, String blob, Integer timeout, + Map metadata, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + final String comp = "metadata"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.setMetadata(this.client.getUrl(), containerName, blob, comp, timeout, metadata, leaseId, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, + requestOptions); + } + + /** + * The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value + * pairs. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void setMetadata(String containerName, String blob, Integer timeout, Map metadata, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + setMetadataWithResponse(containerName, blob, timeout, metadata, leaseId, ifModifiedSince, ifUnmodifiedSince, + ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam, RequestOptions.none()); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never + * expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or + * change. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response acquireLeaseWithResponse(String containerName, String blob, Integer timeout, Integer duration, + String proposedLeaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, RequestOptions requestOptions) { + final String comp = "lease"; + final String action = "acquire"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.acquireLease(this.client.getUrl(), containerName, blob, comp, action, timeout, duration, + proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never + * expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or + * change. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void acquireLease(String containerName, String blob, Integer timeout, Integer duration, + String proposedLeaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId) { + acquireLeaseWithResponse(containerName, blob, timeout, duration, proposedLeaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, RequestOptions.none()); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param leaseId Specifies the current lease ID on the resource. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response releaseLeaseWithResponse(String containerName, String blob, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, RequestOptions requestOptions) { + final String comp = "lease"; + final String action = "release"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.releaseLease(this.client.getUrl(), containerName, blob, comp, action, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param leaseId Specifies the current lease ID on the resource. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void releaseLease(String containerName, String blob, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId) { + releaseLeaseWithResponse(containerName, blob, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, requestId, RequestOptions.none()); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param leaseId Specifies the current lease ID on the resource. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response renewLeaseWithResponse(String containerName, String blob, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, RequestOptions requestOptions) { + final String comp = "lease"; + final String action = "renew"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.renewLease(this.client.getUrl(), containerName, blob, comp, action, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param leaseId Specifies the current lease ID on the resource. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void renewLease(String containerName, String blob, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId) { + renewLeaseWithResponse(containerName, blob, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, requestId, RequestOptions.none()); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param leaseId Specifies the current lease ID on the resource. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response changeLeaseWithResponse(String containerName, String blob, String leaseId, + String proposedLeaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, RequestOptions requestOptions) { + final String comp = "lease"; + final String action = "change"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.changeLease(this.client.getUrl(), containerName, blob, comp, action, timeout, leaseId, + proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param leaseId Specifies the current lease ID on the resource. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void changeLease(String containerName, String blob, String leaseId, String proposedLeaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId) { + changeLeaseWithResponse(containerName, blob, leaseId, proposedLeaseId, timeout, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, RequestOptions.none()); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param breakPeriod For a break operation, proposed duration the lease should continue before it is broken, in + * seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. + * If longer, the time remaining on the lease is used. A new lease will not be available before the break period has + * expired, but the lease may be held for longer than the break period. If this header does not appear with a break + * operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks + * immediately. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response breakLeaseWithResponse(String containerName, String blob, Integer timeout, + Integer breakPeriod, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, RequestOptions requestOptions) { + final String comp = "lease"; + final String action = "break"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.breakLease(this.client.getUrl(), containerName, blob, comp, action, timeout, breakPeriod, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param breakPeriod For a break operation, proposed duration the lease should continue before it is broken, in + * seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. + * If longer, the time remaining on the lease is used. A new lease will not be available before the break period has + * expired, but the lease may be held for longer than the break period. If this header does not appear with a break + * operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks + * immediately. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void breakLease(String containerName, String blob, Integer timeout, Integer breakPeriod, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId) { + breakLeaseWithResponse(containerName, blob, timeout, breakPeriod, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, requestId, RequestOptions.none()); + } + + /** + * The Create Snapshot operation creates a read-only snapshot of a blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response createSnapshotWithResponse(String containerName, String blob, Integer timeout, + Map metadata, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String leaseId, String requestId, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + final String comp = "snapshot"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.createSnapshot(this.client.getUrl(), containerName, blob, comp, timeout, metadata, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, leaseId, this.client.getVersion(), requestId, + accept, requestOptions); + } + + /** + * The Create Snapshot operation creates a read-only snapshot of a blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void createSnapshot(String containerName, String blob, Integer timeout, Map metadata, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String leaseId, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + createSnapshotWithResponse(containerName, blob, timeout, metadata, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, leaseId, requestId, cpkInfo, encryptionScopeParam, RequestOptions.none()); + } + + /** + * The Start Copy From URL operation copies a blob or an internet resource to a new blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param sealBlob Overrides the sealed state of the destination blob. Service version 2019-12-12 and newer. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response startCopyFromURLWithResponse(String containerName, String blob, String copySource, + Integer timeout, Map metadata, AccessTier tier, RehydratePriority rehydratePriority, + OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, + String sourceIfNoneMatch, String sourceIfTags, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String leaseId, String requestId, String blobTagsString, + Boolean sealBlob, OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, + Boolean legalHold, RequestOptions requestOptions) { + final String accept = "application/xml"; + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + return service.startCopyFromURL(this.client.getUrl(), containerName, blob, timeout, metadata, tier, + rehydratePriority, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, + sourceIfNoneMatch, sourceIfTags, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, + ifTags, copySource, leaseId, this.client.getVersion(), requestId, blobTagsString, sealBlob, + immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, requestOptions); + } + + /** + * The Start Copy From URL operation copies a blob or an internet resource to a new blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param sealBlob Overrides the sealed state of the destination blob. Service version 2019-12-12 and newer. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void startCopyFromURL(String containerName, String blob, String copySource, Integer timeout, + Map metadata, AccessTier tier, RehydratePriority rehydratePriority, + OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, + String sourceIfNoneMatch, String sourceIfTags, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String leaseId, String requestId, String blobTagsString, + Boolean sealBlob, OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, + Boolean legalHold) { + startCopyFromURLWithResponse(containerName, blob, copySource, timeout, metadata, tier, rehydratePriority, + sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, + ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, leaseId, requestId, blobTagsString, + sealBlob, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, RequestOptions.none()); + } + + /** + * The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response + * until the copy is complete. + * + * @param containerName The container name. + * @param blob The blob name. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the + * tags specified by x-ms-tags. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response copyFromURLWithResponse(String containerName, String blob, String copySource, Integer timeout, + Map metadata, AccessTier tier, OffsetDateTime sourceIfModifiedSince, + OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, String sourceIfNoneMatch, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String leaseId, String requestId, byte[] sourceContentMD5, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + String copySourceAuthorization, BlobCopySourceTagsMode copySourceTags, EncryptionScope encryptionScopeParam, + RequestOptions requestOptions) { + final String xMsRequiresSync = "true"; + final String accept = "application/xml"; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + return service.copyFromURL(this.client.getUrl(), containerName, blob, xMsRequiresSync, timeout, metadata, tier, + sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, copySource, leaseId, + this.client.getVersion(), requestId, sourceContentMD5Converted, blobTagsString, + immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, copySourceAuthorization, + encryptionScope, copySourceTags, accept, requestOptions); + } + + /** + * The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response + * until the copy is complete. + * + * @param containerName The container name. + * @param blob The blob name. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the + * tags specified by x-ms-tags. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void copyFromURL(String containerName, String blob, String copySource, Integer timeout, + Map metadata, AccessTier tier, OffsetDateTime sourceIfModifiedSince, + OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, String sourceIfNoneMatch, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String leaseId, String requestId, byte[] sourceContentMD5, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + String copySourceAuthorization, BlobCopySourceTagsMode copySourceTags, EncryptionScope encryptionScopeParam) { + copyFromURLWithResponse(containerName, blob, copySource, timeout, metadata, tier, sourceIfModifiedSince, + sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, leaseId, requestId, sourceContentMD5, blobTagsString, immutabilityPolicyExpiry, + immutabilityPolicyMode, legalHold, copySourceAuthorization, copySourceTags, encryptionScopeParam, + RequestOptions.none()); + } + + /** + * The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with + * zero length and full metadata. + * + * @param containerName The container name. + * @param blob The blob name. + * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response abortCopyFromURLWithResponse(String containerName, String blob, String copyId, + Integer timeout, String leaseId, String requestId, RequestOptions requestOptions) { + final String comp = "copy"; + final String copyActionAbortConstant = "abort"; + final String accept = "application/xml"; + return service.abortCopyFromURL(this.client.getUrl(), containerName, blob, comp, copyActionAbortConstant, + copyId, timeout, leaseId, this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with + * zero length and full metadata. + * + * @param containerName The container name. + * @param blob The blob name. + * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void abortCopyFromURL(String containerName, String blob, String copyId, Integer timeout, String leaseId, + String requestId) { + abortCopyFromURLWithResponse(containerName, blob, copyId, timeout, leaseId, requestId, RequestOptions.none()); + } + + /** + * The Set Tier operation sets the tier on a blob. The operation is allowed on a page blob in a premium storage + * account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's + * tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines + * Hot/Cool/Archive storage type. This operation does not update the blob's ETag. + * + * @param containerName The container name. + * @param blob The blob name. + * @param tier Indicates the tier to be set on the blob. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response setTierWithResponse(String containerName, String blob, AccessTier tier, String snapshot, + String versionId, Integer timeout, RehydratePriority rehydratePriority, String requestId, String leaseId, + String ifTags, RequestOptions requestOptions) { + final String comp = "tier"; + final String accept = "application/xml"; + return service.setTier(this.client.getUrl(), containerName, blob, comp, snapshot, versionId, timeout, tier, + rehydratePriority, this.client.getVersion(), requestId, leaseId, ifTags, accept, requestOptions); + } + + /** + * The Set Tier operation sets the tier on a blob. The operation is allowed on a page blob in a premium storage + * account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's + * tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines + * Hot/Cool/Archive storage type. This operation does not update the blob's ETag. + * + * @param containerName The container name. + * @param blob The blob name. + * @param tier Indicates the tier to be set on the blob. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void setTier(String containerName, String blob, AccessTier tier, String snapshot, String versionId, + Integer timeout, RehydratePriority rehydratePriority, String requestId, String leaseId, String ifTags) { + setTierWithResponse(containerName, blob, tier, snapshot, versionId, timeout, rehydratePriority, requestId, + leaseId, ifTags, RequestOptions.none()); + } + + /** + * Returns the sku name and account kind. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response getAccountInfoWithResponse(String containerName, String blob, Integer timeout, + String requestId, RequestOptions requestOptions) { + final String restype = "account"; + final String comp = "properties"; + final String accept = "application/xml"; + return service.getAccountInfo(this.client.getUrl(), containerName, blob, restype, comp, timeout, + this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * Returns the sku name and account kind. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void getAccountInfo(String containerName, String blob, Integer timeout, String requestId) { + getAccountInfoWithResponse(containerName, blob, timeout, requestId, RequestOptions.none()); + } + + /** + * The Query operation enables users to select/project on blob data by providing simple query expressions. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param queryRequest the query request. + * @param cpkInfo Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response queryWithResponse(String containerName, String blob, String snapshot, Integer timeout, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, QueryRequest queryRequest, CpkInfo cpkInfo, + RequestOptions requestOptions) { + final String comp = "query"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.query(this.client.getUrl(), containerName, blob, comp, snapshot, timeout, leaseId, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, this.client.getVersion(), requestId, queryRequest, accept, requestOptions); + } + + /** + * The Query operation enables users to select/project on blob data by providing simple query expressions. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param queryRequest the query request. + * @param cpkInfo Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public InputStream query(String containerName, String blob, String snapshot, Integer timeout, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, QueryRequest queryRequest, CpkInfo cpkInfo) { + return queryWithResponse(containerName, blob, snapshot, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, + ifMatch, ifNoneMatch, ifTags, requestId, queryRequest, cpkInfo, RequestOptions.none()).getValue(); + } + + /** + * The Get Tags operation enables users to get the tags associated with a blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return blob tags. + */ + public Response getTagsWithResponse(String containerName, String blob, Integer timeout, String requestId, + String snapshot, String versionId, String ifTags, String leaseId, RequestOptions requestOptions) { + final String comp = "tags"; + final String accept = "application/xml"; + return service.getTags(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), + requestId, snapshot, versionId, ifTags, leaseId, accept, requestOptions); + } + + /** + * The Get Tags operation enables users to get the tags associated with a blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return blob tags. + */ + public BlobTags getTags(String containerName, String blob, Integer timeout, String requestId, String snapshot, + String versionId, String ifTags, String leaseId) { + return getTagsWithResponse(containerName, blob, timeout, requestId, snapshot, versionId, ifTags, leaseId, + RequestOptions.none()).getValue(); + } + + /** + * The Set Tags operation enables users to set tags on a blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tags Blob tags. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response setTagsWithResponse(String containerName, String blob, Integer timeout, String versionId, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, String requestId, String ifTags, + String leaseId, BlobTags tags, RequestOptions requestOptions) { + final String comp = "tags"; + final String accept = "application/xml"; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + return service.setTags(this.client.getUrl(), containerName, blob, comp, this.client.getVersion(), timeout, + versionId, transactionalContentMD5Converted, transactionalContentCrc64Converted, requestId, ifTags, leaseId, + tags, accept, requestOptions); + } + + /** + * The Set Tags operation enables users to set tags on a blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tags Blob tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void setTags(String containerName, String blob, Integer timeout, String versionId, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, String requestId, String ifTags, + String leaseId, BlobTags tags) { + setTagsWithResponse(containerName, blob, timeout, versionId, transactionalContentMD5, transactionalContentCrc64, + requestId, ifTags, leaseId, tags, RequestOptions.none()); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/BlockBlobsImpl.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/BlockBlobsImpl.java new file mode 100644 index 000000000000..092cd907a0fc --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/BlockBlobsImpl.java @@ -0,0 +1,1184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.implementation; + +import com.azure.v2.storage.blob.models.AccessTier; +import com.azure.v2.storage.blob.models.BlobCopySourceTagsMode; +import com.azure.v2.storage.blob.models.BlobHttpHeaders; +import com.azure.v2.storage.blob.models.BlobImmutabilityPolicyMode; +import com.azure.v2.storage.blob.models.BlockList; +import com.azure.v2.storage.blob.models.BlockListType; +import com.azure.v2.storage.blob.models.BlockLookupList; +import com.azure.v2.storage.blob.models.CpkInfo; +import com.azure.v2.storage.blob.models.EncryptionAlgorithmType; +import com.azure.v2.storage.blob.models.EncryptionScope; +import com.azure.v2.storage.blob.models.StorageError; +import io.clientcore.core.annotations.ServiceInterface; +import io.clientcore.core.http.RestProxy; +import io.clientcore.core.http.annotations.BodyParam; +import io.clientcore.core.http.annotations.HeaderParam; +import io.clientcore.core.http.annotations.HostParam; +import io.clientcore.core.http.annotations.HttpRequestInformation; +import io.clientcore.core.http.annotations.PathParam; +import io.clientcore.core.http.annotations.QueryParam; +import io.clientcore.core.http.annotations.UnexpectedResponseExceptionDetail; +import io.clientcore.core.http.exceptions.HttpResponseException; +import io.clientcore.core.http.models.HttpMethod; +import io.clientcore.core.http.models.RequestOptions; +import io.clientcore.core.http.models.Response; +import io.clientcore.core.http.pipeline.HttpPipeline; +import io.clientcore.core.models.binarydata.BinaryData; +import io.clientcore.core.serialization.ObjectSerializer; +import io.clientcore.core.utils.Base64Util; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.lang.reflect.InvocationTargetException; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * An instance of this class provides access to all the operations defined in BlockBlobs. + */ +public final class BlockBlobsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BlockBlobsService service; + + /** + * The service client containing this operation class. + */ + private final AzureBlobStorageImpl client; + + /** + * Initializes an instance of BlockBlobsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BlockBlobsImpl(AzureBlobStorageImpl client) { + this.service = RestProxy.create(BlockBlobsService.class, client.getHttpPipeline()); + this.client = client; + } + + /** + * The interface defining all the services for AzureBlobStorageBlockBlobs to be used by the proxy service to perform + * REST calls. + */ + @ServiceInterface(name = "AzureBlobStorageBloc", host = "{url}") + public interface BlockBlobsService { + static BlockBlobsService getNewInstance(HttpPipeline pipeline, ObjectSerializer serializer) { + try { + Class clazz = Class.forName("com.azure.v2.storage.blob.implementation.BlockBlobsServiceImpl"); + return (BlockBlobsService) clazz.getMethod("getNewInstance", HttpPipeline.class, ObjectSerializer.class) + .invoke(null, pipeline, serializer); + } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException + | InvocationTargetException e) { + throw new RuntimeException(e); + } + + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response upload(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @HeaderParam("x-ms-blob-type") String blobType, + @QueryParam("timeout") Integer timeout, @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, + @HeaderParam("x-ms-structured-body") String structuredBodyType, + @HeaderParam("x-ms-structured-content-length") Long structuredContentLength, + @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void upload(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @HeaderParam("x-ms-blob-type") String blobType, + @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-version") String version, + @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept) { + upload(url, containerName, blob, blobType, null, null, contentLength, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, version, null, null, null, null, + null, null, null, null, body, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response putBlobFromUrl(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @HeaderParam("x-ms-blob-type") String blobType, + @QueryParam("timeout") Integer timeout, @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("x-ms-source-if-tags") String sourceIfTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, + @HeaderParam("x-ms-tags") String blobTagsString, @HeaderParam("x-ms-copy-source") String copySource, + @HeaderParam("x-ms-copy-source-blob-properties") Boolean copySourceBlobProperties, + @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, + @HeaderParam("x-ms-copy-source-tag-option") BlobCopySourceTagsMode copySourceTags, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void putBlobFromUrl(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @HeaderParam("x-ms-blob-type") String blobType, + @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-copy-source") String copySource, @HeaderParam("Accept") String accept) { + putBlobFromUrl(url, containerName, blob, blobType, null, null, contentLength, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null, version, null, null, null, copySource, null, null, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response stageBlock(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("blockid") String blockId, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-structured-body") String structuredBodyType, + @HeaderParam("x-ms-structured-content-length") Long structuredContentLength, + @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void stageBlock(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("blockid") String blockId, + @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-version") String version, + @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept) { + stageBlock(url, containerName, blob, comp, blockId, contentLength, null, null, null, null, null, null, null, + null, version, null, null, null, body, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response stageBlockFromURL(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("blockid") String blockId, + @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-copy-source") String sourceUrl, + @HeaderParam("x-ms-source-range") String sourceRange, + @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, + @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void stageBlockFromURL(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("blockid") String blockId, + @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-copy-source") String sourceUrl, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + stageBlockFromURL(url, containerName, blob, comp, blockId, contentLength, sourceUrl, null, null, null, null, + null, null, null, null, null, null, null, null, null, version, null, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response commitBlockList(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, @BodyParam("application/xml") BlockLookupList blocks, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void commitBlockList(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @BodyParam("application/xml") BlockLookupList blocks, + @HeaderParam("Accept") String accept) { + commitBlockList(url, containerName, blob, comp, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, version, null, null, null, null, null, + blocks, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.GET, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response getBlockList(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, + @QueryParam("blocklisttype") BlockListType listType, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.GET, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default BlockList getBlockList(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @QueryParam("blocklisttype") BlockListType listType, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + return getBlockList(url, containerName, blob, comp, null, listType, null, null, null, version, null, accept, + null).getValue(); + } + } + + /** + * The Upload Block Blob operation updates the content of an existing block blob. Updating an existing block blob + * overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the + * existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a + * block blob, use the Put Block List operation. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param body Initial data. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param structuredBodyType Required if the request body is a structured message. Specifies the message schema + * version and properties. + * @param structuredContentLength Required if the request body is a structured message. Specifies the length of the + * blob/file content inside the message body. Will always be smaller than Content-Length. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response uploadWithResponse(String containerName, String blob, long contentLength, BinaryData body, + Integer timeout, byte[] transactionalContentMD5, Map metadata, String leaseId, AccessTier tier, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, byte[] transactionalContentCrc64, + String structuredBodyType, Long structuredContentLength, BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + final String blobType = "BlockBlob"; + final String accept = "application/xml"; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String contentMd5Converted = Base64Util.encodeToString(contentMd5); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + return service.upload(this.client.getUrl(), containerName, blob, blobType, timeout, + transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, + contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, + blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, + transactionalContentCrc64Converted, structuredBodyType, structuredContentLength, body, accept, + requestOptions); + } + + /** + * The Upload Block Blob operation updates the content of an existing block blob. Updating an existing block blob + * overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the + * existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a + * block blob, use the Put Block List operation. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param body Initial data. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param structuredBodyType Required if the request body is a structured message. Specifies the message schema + * version and properties. + * @param structuredContentLength Required if the request body is a structured message. Specifies the length of the + * blob/file content inside the message body. Will always be smaller than Content-Length. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void upload(String containerName, String blob, long contentLength, BinaryData body, Integer timeout, + byte[] transactionalContentMD5, Map metadata, String leaseId, AccessTier tier, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, byte[] transactionalContentCrc64, + String structuredBodyType, Long structuredContentLength, BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam) { + uploadWithResponse(containerName, blob, contentLength, body, timeout, transactionalContentMD5, metadata, + leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobTagsString, + immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, transactionalContentCrc64, structuredBodyType, + structuredContentLength, blobHttpHeaders, cpkInfo, encryptionScopeParam, RequestOptions.none()); + } + + /** + * The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given + * URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob + * from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial + * updates to a block blob's contents using a source URL, use the Put Block from URL API in conjunction with Put + * Block List. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param copySourceBlobProperties Optional, default is true. Indicates if properties from the source blob should be + * copied. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the + * tags specified by x-ms-tags. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response putBlobFromUrlWithResponse(String containerName, String blob, long contentLength, + String copySource, Integer timeout, byte[] transactionalContentMD5, Map metadata, + String leaseId, AccessTier tier, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, OffsetDateTime sourceIfModifiedSince, + OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, String sourceIfNoneMatch, String sourceIfTags, + String requestId, byte[] sourceContentMD5, String blobTagsString, Boolean copySourceBlobProperties, + String copySourceAuthorization, BlobCopySourceTagsMode copySourceTags, BlobHttpHeaders blobHttpHeaders, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + final String blobType = "BlockBlob"; + final String accept = "application/xml"; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String contentMd5Converted = Base64Util.encodeToString(contentMd5); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + return service.putBlobFromUrl(this.client.getUrl(), containerName, blob, blobType, timeout, + transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, + contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSinceConverted, + sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, this.client.getVersion(), + requestId, sourceContentMD5Converted, blobTagsString, copySource, copySourceBlobProperties, + copySourceAuthorization, copySourceTags, accept, requestOptions); + } + + /** + * The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given + * URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob + * from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial + * updates to a block blob's contents using a source URL, use the Put Block from URL API in conjunction with Put + * Block List. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param copySourceBlobProperties Optional, default is true. Indicates if properties from the source blob should be + * copied. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the + * tags specified by x-ms-tags. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void putBlobFromUrl(String containerName, String blob, long contentLength, String copySource, + Integer timeout, byte[] transactionalContentMD5, Map metadata, String leaseId, AccessTier tier, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String sourceIfTags, String requestId, byte[] sourceContentMD5, + String blobTagsString, Boolean copySourceBlobProperties, String copySourceAuthorization, + BlobCopySourceTagsMode copySourceTags, BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam) { + putBlobFromUrlWithResponse(containerName, blob, contentLength, copySource, timeout, transactionalContentMD5, + metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, + sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, requestId, + sourceContentMD5, blobTagsString, copySourceBlobProperties, copySourceAuthorization, copySourceTags, + blobHttpHeaders, cpkInfo, encryptionScopeParam, RequestOptions.none()); + } + + /** + * The Stage Block operation creates a new block to be committed as part of a blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less + * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter + * must be the same size for each block. + * @param contentLength The length of the request. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param structuredBodyType Required if the request body is a structured message. Specifies the message schema + * version and properties. + * @param structuredContentLength Required if the request body is a structured message. Specifies the length of the + * blob/file content inside the message body. Will always be smaller than Content-Length. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response stageBlockWithResponse(String containerName, String blob, String blockId, long contentLength, + BinaryData body, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, + String leaseId, String requestId, String structuredBodyType, Long structuredContentLength, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + final String comp = "block"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + return service.stageBlock(this.client.getUrl(), containerName, blob, comp, blockId, contentLength, + transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, leaseId, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, this.client.getVersion(), requestId, + structuredBodyType, structuredContentLength, body, accept, requestOptions); + } + + /** + * The Stage Block operation creates a new block to be committed as part of a blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less + * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter + * must be the same size for each block. + * @param contentLength The length of the request. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param structuredBodyType Required if the request body is a structured message. Specifies the message schema + * version and properties. + * @param structuredContentLength Required if the request body is a structured message. Specifies the length of the + * blob/file content inside the message body. Will always be smaller than Content-Length. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void stageBlock(String containerName, String blob, String blockId, long contentLength, BinaryData body, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, String leaseId, + String requestId, String structuredBodyType, Long structuredContentLength, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam) { + stageBlockWithResponse(containerName, blob, blockId, contentLength, body, transactionalContentMD5, + transactionalContentCrc64, timeout, leaseId, requestId, structuredBodyType, structuredContentLength, + cpkInfo, encryptionScopeParam, RequestOptions.none()); + } + + /** + * The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from + * a URL. + * + * @param containerName The container name. + * @param blob The blob name. + * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less + * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter + * must be the same size for each block. + * @param contentLength The length of the request. + * @param sourceUrl Specify a URL to the copy source. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response stageBlockFromURLWithResponse(String containerName, String blob, String blockId, + long contentLength, String sourceUrl, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, + Integer timeout, String leaseId, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + final String comp = "block"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + return service.stageBlockFromURL(this.client.getUrl(), containerName, blob, comp, blockId, contentLength, + sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, leaseId, sourceIfModifiedSinceConverted, + sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, this.client.getVersion(), requestId, + copySourceAuthorization, accept, requestOptions); + } + + /** + * The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from + * a URL. + * + * @param containerName The container name. + * @param blob The blob name. + * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less + * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter + * must be the same size for each block. + * @param contentLength The length of the request. + * @param sourceUrl Specify a URL to the copy source. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void stageBlockFromURL(String containerName, String blob, String blockId, long contentLength, + String sourceUrl, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, + String leaseId, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + stageBlockFromURLWithResponse(containerName, blob, blockId, contentLength, sourceUrl, sourceRange, + sourceContentMD5, sourceContentcrc64, timeout, leaseId, sourceIfModifiedSince, sourceIfUnmodifiedSince, + sourceIfMatch, sourceIfNoneMatch, requestId, copySourceAuthorization, cpkInfo, encryptionScopeParam, + RequestOptions.none()); + } + + /** + * The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order + * to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block + * operation. You can call Put Block List to update a blob by uploading only those blocks that have changed, then + * committing the new and existing blocks together. You can do this by specifying whether to commit a block from the + * committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the + * block, whichever list it may belong to. + * + * @param containerName The container name. + * @param blob The blob name. + * @param blocks Blob Blocks. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response commitBlockListWithResponse(String containerName, String blob, BlockLookupList blocks, + Integer timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Map metadata, + String leaseId, AccessTier tier, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, + RequestOptions requestOptions) { + final String comp = "blocklist"; + final String accept = "application/xml"; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String contentMd5Converted = Base64Util.encodeToString(contentMd5); + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + return service.commitBlockList(this.client.getUrl(), containerName, blob, comp, timeout, cacheControl, + contentType, contentEncoding, contentLanguage, contentMd5Converted, transactionalContentMD5Converted, + transactionalContentCrc64Converted, metadata, leaseId, contentDisposition, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, + blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, blocks, accept, + requestOptions); + } + + /** + * The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order + * to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block + * operation. You can call Put Block List to update a blob by uploading only those blocks that have changed, then + * committing the new and existing blocks together. You can do this by specifying whether to commit a block from the + * committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the + * block, whichever list it may belong to. + * + * @param containerName The container name. + * @param blob The blob name. + * @param blocks Blob Blocks. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void commitBlockList(String containerName, String blob, BlockLookupList blocks, Integer timeout, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Map metadata, String leaseId, + AccessTier tier, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + commitBlockListWithResponse(containerName, blob, blocks, timeout, transactionalContentMD5, + transactionalContentCrc64, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, + blobHttpHeaders, cpkInfo, encryptionScopeParam, RequestOptions.none()); + } + + /** + * The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param listType Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both + * lists together. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response getBlockListWithResponse(String containerName, String blob, BlockListType listType, + String snapshot, Integer timeout, String leaseId, String ifTags, String requestId, + RequestOptions requestOptions) { + final String comp = "blocklist"; + final String accept = "application/xml"; + return service.getBlockList(this.client.getUrl(), containerName, blob, comp, snapshot, listType, timeout, + leaseId, ifTags, this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param listType Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both + * lists together. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public BlockList getBlockList(String containerName, String blob, BlockListType listType, String snapshot, + Integer timeout, String leaseId, String ifTags, String requestId) { + return getBlockListWithResponse(containerName, blob, listType, snapshot, timeout, leaseId, ifTags, requestId, + RequestOptions.none()).getValue(); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/ContainersImpl.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/ContainersImpl.java new file mode 100644 index 000000000000..9c85188924d5 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/ContainersImpl.java @@ -0,0 +1,1552 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.implementation; + +import com.azure.v2.storage.blob.implementation.models.BlobSignedIdentifierWrapper; +import com.azure.v2.storage.blob.models.BlobContainerEncryptionScope; +import com.azure.v2.storage.blob.models.BlobSignedIdentifier; +import com.azure.v2.storage.blob.models.FilterBlobSegment; +import com.azure.v2.storage.blob.models.FilterBlobsIncludeItem; +import com.azure.v2.storage.blob.models.ListBlobsFlatSegmentResponse; +import com.azure.v2.storage.blob.models.ListBlobsHierarchySegmentResponse; +import com.azure.v2.storage.blob.models.ListBlobsIncludeItem; +import com.azure.v2.storage.blob.models.PublicAccessType; +import com.azure.v2.storage.blob.models.StorageError; +import io.clientcore.core.annotations.ServiceInterface; +import io.clientcore.core.http.RestProxy; +import io.clientcore.core.http.annotations.BodyParam; +import io.clientcore.core.http.annotations.HeaderParam; +import io.clientcore.core.http.annotations.HostParam; +import io.clientcore.core.http.annotations.HttpRequestInformation; +import io.clientcore.core.http.annotations.PathParam; +import io.clientcore.core.http.annotations.QueryParam; +import io.clientcore.core.http.annotations.UnexpectedResponseExceptionDetail; +import io.clientcore.core.http.exceptions.HttpResponseException; +import io.clientcore.core.http.models.HttpMethod; +import io.clientcore.core.http.models.RequestOptions; +import io.clientcore.core.http.models.Response; +import io.clientcore.core.http.pipeline.HttpPipeline; +import io.clientcore.core.models.binarydata.BinaryData; +import io.clientcore.core.serialization.ObjectSerializer; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * An instance of this class provides access to all the operations defined in Containers. + */ +public final class ContainersImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ContainersService service; + + /** + * The service client containing this operation class. + */ + private final AzureBlobStorageImpl client; + + /** + * Initializes an instance of ContainersImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ContainersImpl(AzureBlobStorageImpl client) { + this.service = RestProxy.create(ContainersService.class, client.getHttpPipeline()); + this.client = client; + } + + /** + * The interface defining all the services for AzureBlobStorageContainers to be used by the proxy service to perform + * REST calls. + */ + @ServiceInterface(name = "AzureBlobStorageCont", host = "{url}") + public interface ContainersService { + static ContainersService getNewInstance(HttpPipeline pipeline, ObjectSerializer serializer) { + try { + Class clazz = Class.forName("com.azure.v2.storage.blob.implementation.ContainersServiceImpl"); + return (ContainersService) clazz.getMethod("getNewInstance", HttpPipeline.class, ObjectSerializer.class) + .invoke(null, pipeline, serializer); + } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException + | InvocationTargetException e) { + throw new RuntimeException(e); + } + + } + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response create(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-meta-") Map metadata, + @HeaderParam("x-ms-blob-public-access") PublicAccessType access, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-default-encryption-scope") String defaultEncryptionScope, + @HeaderParam("x-ms-deny-encryption-scope-override") Boolean encryptionScopeOverridePrevented, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void create(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + create(url, containerName, restype, null, null, null, version, null, null, null, accept, null); + } + + @HttpRequestInformation(method = HttpMethod.GET, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response getProperties(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.GET, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void getProperties(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + getProperties(url, containerName, restype, null, null, version, null, accept, null); + } + + @HttpRequestInformation(method = HttpMethod.DELETE, path = "/{containerName}", expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response delete(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.DELETE, path = "/{containerName}", expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void delete(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + delete(url, containerName, restype, null, null, null, null, version, null, accept, null); + } + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response setMetadata(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-meta-") Map metadata, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void setMetadata(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + setMetadata(url, containerName, restype, comp, null, null, null, null, version, null, accept, null); + } + + @HttpRequestInformation(method = HttpMethod.GET, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response getAccessPolicy(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.GET, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default BlobSignedIdentifierWrapper getAccessPolicy(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + return getAccessPolicy(url, containerName, restype, comp, null, null, version, null, accept, null) + .getValue(); + } + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response setAccessPolicy(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-public-access") PublicAccessType access, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/xml") BlobSignedIdentifierWrapper containerAcl, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void setAccessPolicy(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + setAccessPolicy(url, containerName, restype, comp, null, null, null, null, null, version, null, null, + accept, null); + } + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response restore(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-deleted-container-name") String deletedContainerName, + @HeaderParam("x-ms-deleted-container-version") String deletedContainerVersion, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void restore(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + restore(url, containerName, restype, comp, null, version, null, null, null, accept, null); + } + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response rename(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-source-container-name") String sourceContainerName, + @HeaderParam("x-ms-source-lease-id") String sourceLeaseId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void rename(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-source-container-name") String sourceContainerName, + @HeaderParam("Accept") String accept) { + rename(url, containerName, restype, comp, null, version, null, sourceContainerName, null, accept, null); + } + + @HttpRequestInformation(method = HttpMethod.POST, path = "/{containerName}", expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response submitBatch(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Content-Type") String multipartContentType, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/xml") BinaryData body, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.POST, path = "/{containerName}", expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default InputStream submitBatch(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-Type") String multipartContentType, + @HeaderParam("x-ms-version") String version, @BodyParam("application/xml") BinaryData body, + @HeaderParam("Accept") String accept) { + return submitBatch(url, containerName, restype, comp, contentLength, multipartContentType, null, version, + null, body, accept, null).getValue(); + } + + @HttpRequestInformation(method = HttpMethod.GET, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response filterBlobs(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @QueryParam("where") String where, @QueryParam("marker") String marker, + @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.GET, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default FilterBlobSegment filterBlobs(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + return filterBlobs(url, containerName, restype, comp, null, version, null, null, null, null, null, accept, + null).getValue(); + } + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response acquireLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("comp") String comp, @QueryParam("restype") String restype, + @HeaderParam("x-ms-lease-action") String action, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-duration") Integer duration, + @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void acquireLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("comp") String comp, @QueryParam("restype") String restype, + @HeaderParam("x-ms-lease-action") String action, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + acquireLease(url, containerName, comp, restype, action, null, null, null, null, null, version, null, accept, + null); + } + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response releaseLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("comp") String comp, @QueryParam("restype") String restype, + @HeaderParam("x-ms-lease-action") String action, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void releaseLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("comp") String comp, @QueryParam("restype") String restype, + @HeaderParam("x-ms-lease-action") String action, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + releaseLease(url, containerName, comp, restype, action, null, leaseId, null, null, version, null, accept, + null); + } + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response renewLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("comp") String comp, @QueryParam("restype") String restype, + @HeaderParam("x-ms-lease-action") String action, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void renewLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("comp") String comp, @QueryParam("restype") String restype, + @HeaderParam("x-ms-lease-action") String action, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + renewLease(url, containerName, comp, restype, action, null, leaseId, null, null, version, null, accept, + null); + } + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response breakLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("comp") String comp, @QueryParam("restype") String restype, + @HeaderParam("x-ms-lease-action") String action, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-break-period") Integer breakPeriod, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void breakLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("comp") String comp, @QueryParam("restype") String restype, + @HeaderParam("x-ms-lease-action") String action, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + breakLease(url, containerName, comp, restype, action, null, null, null, null, version, null, accept, null); + } + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response changeLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("comp") String comp, @QueryParam("restype") String restype, + @HeaderParam("x-ms-lease-action") String action, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void changeLease(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("comp") String comp, @QueryParam("restype") String restype, + @HeaderParam("x-ms-lease-action") String action, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + changeLease(url, containerName, comp, restype, action, null, leaseId, proposedLeaseId, null, null, version, + null, accept, null); + } + + @HttpRequestInformation(method = HttpMethod.GET, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response listBlobFlatSegment(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker, + @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.GET, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default ListBlobsFlatSegmentResponse listBlobFlatSegment(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + return listBlobFlatSegment(url, containerName, restype, comp, null, null, null, null, null, version, null, + accept, null).getValue(); + } + + @HttpRequestInformation(method = HttpMethod.GET, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response listBlobHierarchySegment(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("prefix") String prefix, + @QueryParam("delimiter") String delimiter, @QueryParam("marker") String marker, + @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.GET, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default ListBlobsHierarchySegmentResponse listBlobHierarchySegment(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("delimiter") String delimiter, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + return listBlobHierarchySegment(url, containerName, restype, comp, null, delimiter, null, null, null, null, + version, null, accept, null).getValue(); + } + + @HttpRequestInformation(method = HttpMethod.GET, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response getAccountInfo(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.GET, path = "/{containerName}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void getAccountInfo(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + getAccountInfo(url, containerName, restype, comp, null, version, null, accept, null); + } + } + + /** + * creates a new container under the specified account. If the container with the same name already exists, the + * operation fails. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param access Specifies whether data in the container may be accessed publicly and the level of access. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobContainerEncryptionScope Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response createWithResponse(String containerName, Integer timeout, Map metadata, + PublicAccessType access, String requestId, BlobContainerEncryptionScope blobContainerEncryptionScope, + RequestOptions requestOptions) { + final String restype = "container"; + final String accept = "application/xml"; + String defaultEncryptionScopeInternal = null; + if (blobContainerEncryptionScope != null) { + defaultEncryptionScopeInternal = blobContainerEncryptionScope.getDefaultEncryptionScope(); + } + String defaultEncryptionScope = defaultEncryptionScopeInternal; + Boolean encryptionScopeOverridePreventedInternal = null; + if (blobContainerEncryptionScope != null) { + encryptionScopeOverridePreventedInternal + = blobContainerEncryptionScope.isEncryptionScopeOverridePrevented(); + } + Boolean encryptionScopeOverridePrevented = encryptionScopeOverridePreventedInternal; + return service.create(this.client.getUrl(), containerName, restype, timeout, metadata, access, + this.client.getVersion(), requestId, defaultEncryptionScope, encryptionScopeOverridePrevented, accept, + requestOptions); + } + + /** + * creates a new container under the specified account. If the container with the same name already exists, the + * operation fails. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param access Specifies whether data in the container may be accessed publicly and the level of access. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobContainerEncryptionScope Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void create(String containerName, Integer timeout, Map metadata, PublicAccessType access, + String requestId, BlobContainerEncryptionScope blobContainerEncryptionScope) { + createWithResponse(containerName, timeout, metadata, access, requestId, blobContainerEncryptionScope, + RequestOptions.none()); + } + + /** + * returns all user-defined metadata and system properties for the specified container. The data returned does not + * include the container's list of blobs. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response getPropertiesWithResponse(String containerName, Integer timeout, String leaseId, + String requestId, RequestOptions requestOptions) { + final String restype = "container"; + final String accept = "application/xml"; + return service.getProperties(this.client.getUrl(), containerName, restype, timeout, leaseId, + this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * returns all user-defined metadata and system properties for the specified container. The data returned does not + * include the container's list of blobs. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void getProperties(String containerName, Integer timeout, String leaseId, String requestId) { + getPropertiesWithResponse(containerName, timeout, leaseId, requestId, RequestOptions.none()); + } + + /** + * operation marks the specified container for deletion. The container and any blobs contained within it are later + * deleted during garbage collection. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response deleteWithResponse(String containerName, Integer timeout, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + RequestOptions requestOptions) { + final String restype = "container"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.delete(this.client.getUrl(), containerName, restype, timeout, leaseId, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * operation marks the specified container for deletion. The container and any blobs contained within it are later + * deleted during garbage collection. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void delete(String containerName, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String requestId) { + deleteWithResponse(containerName, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, requestId, + RequestOptions.none()); + } + + /** + * operation sets one or more user-defined name-value pairs for the specified container. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response setMetadataWithResponse(String containerName, Integer timeout, String leaseId, + Map metadata, OffsetDateTime ifModifiedSince, String requestId, RequestOptions requestOptions) { + final String restype = "container"; + final String comp = "metadata"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + return service.setMetadata(this.client.getUrl(), containerName, restype, comp, timeout, leaseId, metadata, + ifModifiedSinceConverted, this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * operation sets one or more user-defined name-value pairs for the specified container. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void setMetadata(String containerName, Integer timeout, String leaseId, Map metadata, + OffsetDateTime ifModifiedSince, String requestId) { + setMetadataWithResponse(containerName, timeout, leaseId, metadata, ifModifiedSince, requestId, + RequestOptions.none()); + } + + /** + * gets the permissions for the specified container. The permissions indicate whether container data may be accessed + * publicly. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the permissions for the specified container. + */ + public Response getAccessPolicyWithResponse(String containerName, Integer timeout, + String leaseId, String requestId, RequestOptions requestOptions) { + final String restype = "container"; + final String comp = "acl"; + final String accept = "application/xml"; + return service.getAccessPolicy(this.client.getUrl(), containerName, restype, comp, timeout, leaseId, + this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * gets the permissions for the specified container. The permissions indicate whether container data may be accessed + * publicly. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the permissions for the specified container. + */ + public BlobSignedIdentifierWrapper getAccessPolicy(String containerName, Integer timeout, String leaseId, + String requestId) { + return getAccessPolicyWithResponse(containerName, timeout, leaseId, requestId, RequestOptions.none()) + .getValue(); + } + + /** + * sets the permissions for the specified container. The permissions indicate whether blobs in a container may be + * accessed publicly. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param access Specifies whether data in the container may be accessed publicly and the level of access. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param containerAcl the acls for the container. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response setAccessPolicyWithResponse(String containerName, Integer timeout, String leaseId, + PublicAccessType access, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + List containerAcl, RequestOptions requestOptions) { + final String restype = "container"; + final String comp = "acl"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + BlobSignedIdentifierWrapper containerAclConverted = new BlobSignedIdentifierWrapper(containerAcl); + return service.setAccessPolicy(this.client.getUrl(), containerName, restype, comp, timeout, leaseId, access, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, + containerAclConverted, accept, requestOptions); + } + + /** + * sets the permissions for the specified container. The permissions indicate whether blobs in a container may be + * accessed publicly. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param access Specifies whether data in the container may be accessed publicly and the level of access. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param containerAcl the acls for the container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void setAccessPolicy(String containerName, Integer timeout, String leaseId, PublicAccessType access, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + List containerAcl) { + setAccessPolicyWithResponse(containerName, timeout, leaseId, access, ifModifiedSince, ifUnmodifiedSince, + requestId, containerAcl, RequestOptions.none()); + } + + /** + * Restores a previously-deleted container. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param deletedContainerName Optional. Version 2019-12-12 and later. Specifies the name of the deleted container + * to restore. + * @param deletedContainerVersion Optional. Version 2019-12-12 and later. Specifies the version of the deleted + * container to restore. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response restoreWithResponse(String containerName, Integer timeout, String requestId, + String deletedContainerName, String deletedContainerVersion, RequestOptions requestOptions) { + final String restype = "container"; + final String comp = "undelete"; + final String accept = "application/xml"; + return service.restore(this.client.getUrl(), containerName, restype, comp, timeout, this.client.getVersion(), + requestId, deletedContainerName, deletedContainerVersion, accept, requestOptions); + } + + /** + * Restores a previously-deleted container. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param deletedContainerName Optional. Version 2019-12-12 and later. Specifies the name of the deleted container + * to restore. + * @param deletedContainerVersion Optional. Version 2019-12-12 and later. Specifies the version of the deleted + * container to restore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void restore(String containerName, Integer timeout, String requestId, String deletedContainerName, + String deletedContainerVersion) { + restoreWithResponse(containerName, timeout, requestId, deletedContainerName, deletedContainerVersion, + RequestOptions.none()); + } + + /** + * Renames an existing container. + * + * @param containerName The container name. + * @param sourceContainerName Required. Specifies the name of the container to rename. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param sourceLeaseId A lease ID for the source path. If specified, the source path must have an active lease and + * the lease ID must match. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response renameWithResponse(String containerName, String sourceContainerName, Integer timeout, + String requestId, String sourceLeaseId, RequestOptions requestOptions) { + final String restype = "container"; + final String comp = "rename"; + final String accept = "application/xml"; + return service.rename(this.client.getUrl(), containerName, restype, comp, timeout, this.client.getVersion(), + requestId, sourceContainerName, sourceLeaseId, accept, requestOptions); + } + + /** + * Renames an existing container. + * + * @param containerName The container name. + * @param sourceContainerName Required. Specifies the name of the container to rename. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param sourceLeaseId A lease ID for the source path. If specified, the source path must have an active lease and + * the lease ID must match. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void rename(String containerName, String sourceContainerName, Integer timeout, String requestId, + String sourceLeaseId) { + renameWithResponse(containerName, sourceContainerName, timeout, requestId, sourceLeaseId, + RequestOptions.none()); + } + + /** + * The Batch operation allows multiple API calls to be embedded into a single HTTP request. + * + * @param containerName The container name. + * @param contentLength The length of the request. + * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. + * Example header value: multipart/mixed; boundary=batch_<GUID>. + * @param body Initial data. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response submitBatchWithResponse(String containerName, long contentLength, + String multipartContentType, BinaryData body, Integer timeout, String requestId, + RequestOptions requestOptions) { + final String restype = "container"; + final String comp = "batch"; + final String accept = "application/xml"; + return service.submitBatch(this.client.getUrl(), containerName, restype, comp, contentLength, + multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, requestOptions); + } + + /** + * The Batch operation allows multiple API calls to be embedded into a single HTTP request. + * + * @param containerName The container name. + * @param contentLength The length of the request. + * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. + * Example header value: multipart/mixed; boundary=batch_<GUID>. + * @param body Initial data. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public InputStream submitBatch(String containerName, long contentLength, String multipartContentType, + BinaryData body, Integer timeout, String requestId) { + return submitBatchWithResponse(containerName, contentLength, multipartContentType, body, timeout, requestId, + RequestOptions.none()).getValue(); + } + + /** + * The Filter Blobs operation enables callers to list blobs in a container whose tags match a given search + * expression. Filter blobs searches within the given container. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param where Filters the results to return only to return only blobs whose tags match the specified expression. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a Filter Blobs API call. + */ + public Response filterBlobsWithResponse(String containerName, Integer timeout, String requestId, + String where, String marker, Integer maxresults, List include, + RequestOptions requestOptions) { + final String restype = "container"; + final String comp = "blobs"; + final String accept = "application/xml"; + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.filterBlobs(this.client.getUrl(), containerName, restype, comp, timeout, + this.client.getVersion(), requestId, where, marker, maxresults, includeConverted, accept, requestOptions); + } + + /** + * The Filter Blobs operation enables callers to list blobs in a container whose tags match a given search + * expression. Filter blobs searches within the given container. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param where Filters the results to return only to return only blobs whose tags match the specified expression. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a Filter Blobs API call. + */ + public FilterBlobSegment filterBlobs(String containerName, Integer timeout, String requestId, String where, + String marker, Integer maxresults, List include) { + return filterBlobsWithResponse(containerName, timeout, requestId, where, marker, maxresults, include, + RequestOptions.none()).getValue(); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never + * expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or + * change. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response acquireLeaseWithResponse(String containerName, Integer timeout, Integer duration, + String proposedLeaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + RequestOptions requestOptions) { + final String comp = "lease"; + final String restype = "container"; + final String action = "acquire"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.acquireLease(this.client.getUrl(), containerName, comp, restype, action, timeout, duration, + proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, + accept, requestOptions); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never + * expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or + * change. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void acquireLease(String containerName, Integer timeout, Integer duration, String proposedLeaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { + acquireLeaseWithResponse(containerName, timeout, duration, proposedLeaseId, ifModifiedSince, ifUnmodifiedSince, + requestId, RequestOptions.none()); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param leaseId Specifies the current lease ID on the resource. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response releaseLeaseWithResponse(String containerName, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + RequestOptions requestOptions) { + final String comp = "lease"; + final String restype = "container"; + final String action = "release"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.releaseLease(this.client.getUrl(), containerName, comp, restype, action, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, + requestOptions); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param leaseId Specifies the current lease ID on the resource. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void releaseLease(String containerName, String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String requestId) { + releaseLeaseWithResponse(containerName, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, requestId, + RequestOptions.none()); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param leaseId Specifies the current lease ID on the resource. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response renewLeaseWithResponse(String containerName, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + RequestOptions requestOptions) { + final String comp = "lease"; + final String restype = "container"; + final String action = "renew"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.renewLease(this.client.getUrl(), containerName, comp, restype, action, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, + requestOptions); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param leaseId Specifies the current lease ID on the resource. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void renewLease(String containerName, String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String requestId) { + renewLeaseWithResponse(containerName, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, requestId, + RequestOptions.none()); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param breakPeriod For a break operation, proposed duration the lease should continue before it is broken, in + * seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. + * If longer, the time remaining on the lease is used. A new lease will not be available before the break period has + * expired, but the lease may be held for longer than the break period. If this header does not appear with a break + * operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks + * immediately. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response breakLeaseWithResponse(String containerName, Integer timeout, Integer breakPeriod, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + RequestOptions requestOptions) { + final String comp = "lease"; + final String restype = "container"; + final String action = "break"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.breakLease(this.client.getUrl(), containerName, comp, restype, action, timeout, breakPeriod, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, + requestOptions); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param breakPeriod For a break operation, proposed duration the lease should continue before it is broken, in + * seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. + * If longer, the time remaining on the lease is used. A new lease will not be available before the break period has + * expired, but the lease may be held for longer than the break period. If this header does not appear with a break + * operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks + * immediately. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void breakLease(String containerName, Integer timeout, Integer breakPeriod, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String requestId) { + breakLeaseWithResponse(containerName, timeout, breakPeriod, ifModifiedSince, ifUnmodifiedSince, requestId, + RequestOptions.none()); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param leaseId Specifies the current lease ID on the resource. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response changeLeaseWithResponse(String containerName, String leaseId, String proposedLeaseId, + Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + RequestOptions requestOptions) { + final String comp = "lease"; + final String restype = "container"; + final String action = "change"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.changeLease(this.client.getUrl(), containerName, comp, restype, action, timeout, leaseId, + proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, + accept, requestOptions); + } + + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 + * seconds, or can be infinite. + * + * @param containerName The container name. + * @param leaseId Specifies the current lease ID on the resource. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void changeLease(String containerName, String leaseId, String proposedLeaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { + changeLeaseWithResponse(containerName, leaseId, proposedLeaseId, timeout, ifModifiedSince, ifUnmodifiedSince, + requestId, RequestOptions.none()); + } + + /** + * [Update] The List Blobs operation returns a list of the blobs under the specified container. + * + * @param containerName The container name. + * @param prefix Filters the results to return only containers whose name begins with the specified prefix. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of blobs. + */ + public Response listBlobFlatSegmentWithResponse(String containerName, String prefix, + String marker, Integer maxresults, List include, Integer timeout, String requestId, + RequestOptions requestOptions) { + final String restype = "container"; + final String comp = "list"; + final String accept = "application/xml"; + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.listBlobFlatSegment(this.client.getUrl(), containerName, restype, comp, prefix, marker, + maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * [Update] The List Blobs operation returns a list of the blobs under the specified container. + * + * @param containerName The container name. + * @param prefix Filters the results to return only containers whose name begins with the specified prefix. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of blobs. + */ + public ListBlobsFlatSegmentResponse listBlobFlatSegment(String containerName, String prefix, String marker, + Integer maxresults, List include, Integer timeout, String requestId) { + return listBlobFlatSegmentWithResponse(containerName, prefix, marker, maxresults, include, timeout, requestId, + RequestOptions.none()).getValue(); + } + + /** + * [Update] The List Blobs operation returns a list of the blobs under the specified container. + * + * @param containerName The container name. + * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the + * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the + * appearance of the delimiter character. The delimiter may be a single character or a string. + * @param prefix Filters the results to return only containers whose name begins with the specified prefix. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of blobs. + */ + public Response listBlobHierarchySegmentWithResponse(String containerName, + String delimiter, String prefix, String marker, Integer maxresults, List include, + Integer timeout, String requestId, RequestOptions requestOptions) { + final String restype = "container"; + final String comp = "list"; + final String accept = "application/xml"; + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.listBlobHierarchySegment(this.client.getUrl(), containerName, restype, comp, prefix, delimiter, + marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * [Update] The List Blobs operation returns a list of the blobs under the specified container. + * + * @param containerName The container name. + * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the + * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the + * appearance of the delimiter character. The delimiter may be a single character or a string. + * @param prefix Filters the results to return only containers whose name begins with the specified prefix. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of blobs. + */ + public ListBlobsHierarchySegmentResponse listBlobHierarchySegment(String containerName, String delimiter, + String prefix, String marker, Integer maxresults, List include, Integer timeout, + String requestId) { + return listBlobHierarchySegmentWithResponse(containerName, delimiter, prefix, marker, maxresults, include, + timeout, requestId, RequestOptions.none()).getValue(); + } + + /** + * Returns the sku name and account kind. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response getAccountInfoWithResponse(String containerName, Integer timeout, String requestId, + RequestOptions requestOptions) { + final String restype = "account"; + final String comp = "properties"; + final String accept = "application/xml"; + return service.getAccountInfo(this.client.getUrl(), containerName, restype, comp, timeout, + this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * Returns the sku name and account kind. + * + * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void getAccountInfo(String containerName, Integer timeout, String requestId) { + getAccountInfoWithResponse(containerName, timeout, requestId, RequestOptions.none()); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/PageBlobsImpl.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/PageBlobsImpl.java new file mode 100644 index 000000000000..88f24cf88d5d --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/PageBlobsImpl.java @@ -0,0 +1,1458 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.implementation; + +import com.azure.v2.storage.blob.models.BlobHttpHeaders; +import com.azure.v2.storage.blob.models.BlobImmutabilityPolicyMode; +import com.azure.v2.storage.blob.models.CpkInfo; +import com.azure.v2.storage.blob.models.EncryptionAlgorithmType; +import com.azure.v2.storage.blob.models.EncryptionScope; +import com.azure.v2.storage.blob.models.PageList; +import com.azure.v2.storage.blob.models.PremiumPageBlobAccessTier; +import com.azure.v2.storage.blob.models.SequenceNumberActionType; +import com.azure.v2.storage.blob.models.StorageError; +import io.clientcore.core.annotations.ServiceInterface; +import io.clientcore.core.http.RestProxy; +import io.clientcore.core.http.annotations.BodyParam; +import io.clientcore.core.http.annotations.HeaderParam; +import io.clientcore.core.http.annotations.HostParam; +import io.clientcore.core.http.annotations.HttpRequestInformation; +import io.clientcore.core.http.annotations.PathParam; +import io.clientcore.core.http.annotations.QueryParam; +import io.clientcore.core.http.annotations.UnexpectedResponseExceptionDetail; +import io.clientcore.core.http.exceptions.HttpResponseException; +import io.clientcore.core.http.models.HttpMethod; +import io.clientcore.core.http.models.RequestOptions; +import io.clientcore.core.http.models.Response; +import io.clientcore.core.http.pipeline.HttpPipeline; +import io.clientcore.core.models.binarydata.BinaryData; +import io.clientcore.core.serialization.ObjectSerializer; +import io.clientcore.core.utils.Base64Util; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.lang.reflect.InvocationTargetException; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * An instance of this class provides access to all the operations defined in PageBlobs. + */ +public final class PageBlobsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PageBlobsService service; + + /** + * The service client containing this operation class. + */ + private final AzureBlobStorageImpl client; + + /** + * Initializes an instance of PageBlobsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PageBlobsImpl(AzureBlobStorageImpl client) { + this.service = RestProxy.create(PageBlobsService.class, client.getHttpPipeline()); + this.client = client; + } + + /** + * The interface defining all the services for AzureBlobStoragePageBlobs to be used by the proxy service to perform + * REST calls. + */ + @ServiceInterface(name = "AzureBlobStoragePage", host = "{url}") + public interface PageBlobsService { + static PageBlobsService getNewInstance(HttpPipeline pipeline, ObjectSerializer serializer) { + try { + Class clazz = Class.forName("com.azure.v2.storage.blob.implementation.PageBlobsServiceImpl"); + return (PageBlobsService) clazz.getMethod("getNewInstance", HttpPipeline.class, ObjectSerializer.class) + .invoke(null, pipeline, serializer); + } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException + | InvocationTargetException e) { + throw new RuntimeException(e); + } + + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response create(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @HeaderParam("x-ms-blob-type") String blobType, + @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, + @HeaderParam("x-ms-access-tier") PremiumPageBlobAccessTier tier, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-blob-content-length") long blobContentLength, + @HeaderParam("x-ms-blob-sequence-number") Long blobSequenceNumber, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void create(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @HeaderParam("x-ms-blob-type") String blobType, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("x-ms-blob-content-length") long blobContentLength, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + create(url, containerName, blob, blobType, null, contentLength, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, blobContentLength, null, version, + null, null, null, null, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response uploadPages(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-page-write") String pageWrite, @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, + @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, + @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-structured-body") String structuredBodyType, + @HeaderParam("x-ms-structured-content-length") Long structuredContentLength, + @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void uploadPages(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-page-write") String pageWrite, @HeaderParam("Content-Length") long contentLength, + @HeaderParam("x-ms-version") String version, @BodyParam("application/octet-stream") BinaryData body, + @HeaderParam("Accept") String accept) { + uploadPages(url, containerName, blob, comp, pageWrite, contentLength, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, version, null, null, null, body, + accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response clearPages(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-page-write") String pageWrite, @HeaderParam("Content-Length") long contentLength, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, + @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, + @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void clearPages(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-page-write") String pageWrite, @HeaderParam("Content-Length") long contentLength, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + clearPages(url, containerName, blob, comp, pageWrite, contentLength, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, version, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response uploadPagesFromURL(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-page-write") String pageWrite, + @HeaderParam("x-ms-copy-source") String sourceUrl, @HeaderParam("x-ms-source-range") String sourceRange, + @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, + @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, + @HeaderParam("Content-Length") long contentLength, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, + @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, + @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 201 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void uploadPagesFromURL(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-page-write") String pageWrite, @HeaderParam("x-ms-copy-source") String sourceUrl, + @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("Content-Length") long contentLength, + @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + uploadPagesFromURL(url, containerName, blob, comp, pageWrite, sourceUrl, sourceRange, null, null, + contentLength, null, range, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, version, null, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.GET, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response getPageRanges(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("marker") String marker, + @QueryParam("maxresults") Integer maxresults, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.GET, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default PageList getPageRanges(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + return getPageRanges(url, containerName, blob, comp, null, null, null, null, null, null, null, null, null, + version, null, null, null, accept, null).getValue(); + } + + @HttpRequestInformation( + method = HttpMethod.GET, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response getPageRangesDiff(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, + @QueryParam("timeout") Integer timeout, @QueryParam("prevsnapshot") String prevsnapshot, + @HeaderParam("x-ms-previous-snapshot-url") String prevSnapshotUrl, @HeaderParam("x-ms-range") String range, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("marker") String marker, + @QueryParam("maxresults") Integer maxresults, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.GET, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default PageList getPageRangesDiff(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + return getPageRangesDiff(url, containerName, blob, comp, null, null, null, null, null, null, null, null, + null, null, null, version, null, null, null, accept, null).getValue(); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response resize(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-blob-content-length") long blobContentLength, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void resize(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-blob-content-length") long blobContentLength, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + resize(url, containerName, blob, comp, null, null, null, null, null, null, null, null, null, null, null, + blobContentLength, version, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response updateSequenceNumber(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-sequence-number-action") SequenceNumberActionType sequenceNumberAction, + @HeaderParam("x-ms-blob-sequence-number") Long blobSequenceNumber, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void updateSequenceNumber(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, + @HeaderParam("x-ms-sequence-number-action") SequenceNumberActionType sequenceNumberAction, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + updateSequenceNumber(url, containerName, blob, comp, null, null, null, null, null, null, null, + sequenceNumberAction, null, version, null, accept, null); + } + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response copyIncremental(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-copy-source") String copySource, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation( + method = HttpMethod.PUT, + path = "/{containerName}/{blob}", + expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void copyIncremental(@HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, + @HeaderParam("x-ms-copy-source") String copySource, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + copyIncremental(url, containerName, blob, comp, null, null, null, null, null, null, copySource, version, + null, accept, null); + } + } + + /** + * The Create operation creates a new page blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size + * must be aligned to a 512-byte boundary. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param tier Optional. Indicates the tier to be set on the page blob. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param blobSequenceNumber Set for page blobs only. The sequence number is a user-controlled value that you can + * use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response createWithResponse(String containerName, String blob, long contentLength, + long blobContentLength, Integer timeout, PremiumPageBlobAccessTier tier, Map metadata, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, Long blobSequenceNumber, String requestId, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, + RequestOptions requestOptions) { + final String blobType = "PageBlob"; + final String accept = "application/xml"; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String contentMd5Converted = Base64Util.encodeToString(contentMd5); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + return service.create(this.client.getUrl(), containerName, blob, blobType, timeout, contentLength, tier, + contentType, contentEncoding, contentLanguage, contentMd5Converted, cacheControl, metadata, leaseId, + contentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, blobContentLength, + blobSequenceNumber, this.client.getVersion(), requestId, blobTagsString, immutabilityPolicyExpiryConverted, + immutabilityPolicyMode, legalHold, accept, requestOptions); + } + + /** + * The Create operation creates a new page blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size + * must be aligned to a 512-byte boundary. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param tier Optional. Indicates the tier to be set on the page blob. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param blobSequenceNumber Set for page blobs only. The sequence number is a user-controlled value that you can + * use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void create(String containerName, String blob, long contentLength, long blobContentLength, Integer timeout, + PremiumPageBlobAccessTier tier, Map metadata, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, Long blobSequenceNumber, + String requestId, String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, BlobHttpHeaders blobHttpHeaders, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + createWithResponse(containerName, blob, contentLength, blobContentLength, timeout, tier, metadata, leaseId, + ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, blobSequenceNumber, requestId, + blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, blobHttpHeaders, cpkInfo, + encryptionScopeParam, RequestOptions.none()); + } + + /** + * The Upload Pages operation writes a range of pages to a page blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param structuredBodyType Required if the request body is a structured message. Specifies the message schema + * version and properties. + * @param structuredContentLength Required if the request body is a structured message. Specifies the length of the + * blob/file content inside the message body. Will always be smaller than Content-Length. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response uploadPagesWithResponse(String containerName, String blob, long contentLength, + BinaryData body, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, + String range, String leaseId, Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, + Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, String structuredBodyType, Long structuredContentLength, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + final String comp = "page"; + final String pageWrite = "update"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.uploadPages(this.client.getUrl(), containerName, blob, comp, pageWrite, contentLength, + transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, range, leaseId, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifSequenceNumberLessThanOrEqualTo, + ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, structuredBodyType, + structuredContentLength, body, accept, requestOptions); + } + + /** + * The Upload Pages operation writes a range of pages to a page blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param structuredBodyType Required if the request body is a structured message. Specifies the message schema + * version and properties. + * @param structuredContentLength Required if the request body is a structured message. Specifies the length of the + * blob/file content inside the message body. Will always be smaller than Content-Length. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void uploadPages(String containerName, String blob, long contentLength, BinaryData body, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, String range, String leaseId, + Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, Long ifSequenceNumberEqualTo, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, String structuredBodyType, Long structuredContentLength, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam) { + uploadPagesWithResponse(containerName, blob, contentLength, body, transactionalContentMD5, + transactionalContentCrc64, timeout, range, leaseId, ifSequenceNumberLessThanOrEqualTo, + ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, requestId, structuredBodyType, structuredContentLength, cpkInfo, encryptionScopeParam, + RequestOptions.none()); + } + + /** + * The Clear Pages operation clears a set of pages from a page blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response clearPagesWithResponse(String containerName, String blob, long contentLength, Integer timeout, + String range, String leaseId, Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, + Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, + RequestOptions requestOptions) { + final String comp = "page"; + final String pageWrite = "clear"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.clearPages(this.client.getUrl(), containerName, blob, comp, pageWrite, contentLength, timeout, + range, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * The Clear Pages operation clears a set of pages from a page blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param contentLength The length of the request. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void clearPages(String containerName, String blob, long contentLength, Integer timeout, String range, + String leaseId, Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, + Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + clearPagesWithResponse(containerName, blob, contentLength, timeout, range, leaseId, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam, + RequestOptions.none()); + } + + /** + * The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. + * + * @param containerName The container name. + * @param blob The blob name. + * @param sourceUrl Specify a URL to the copy source. + * @param sourceRange Bytes of source data in the specified range. The length of this range should match the + * ContentLength header and x-ms-range/Range destination range header. + * @param contentLength The length of the request. + * @param range The range of bytes to which the source range would be written. The range should be 512 aligned and + * range-end is required. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response uploadPagesFromURLWithResponse(String containerName, String blob, String sourceUrl, + String sourceRange, long contentLength, String range, byte[] sourceContentMD5, byte[] sourceContentcrc64, + Integer timeout, String leaseId, Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, + Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, RequestOptions requestOptions) { + final String comp = "page"; + final String pageWrite = "update"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + return service.uploadPagesFromURL(this.client.getUrl(), containerName, blob, comp, pageWrite, sourceUrl, + sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, contentLength, timeout, range, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, leaseId, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, + this.client.getVersion(), requestId, copySourceAuthorization, accept, requestOptions); + } + + /** + * The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. + * + * @param containerName The container name. + * @param blob The blob name. + * @param sourceUrl Specify a URL to the copy source. + * @param sourceRange Bytes of source data in the specified range. The length of this range should match the + * ContentLength header and x-ms-range/Range destination range header. + * @param contentLength The length of the request. + * @param range The range of bytes to which the source range would be written. The range should be 512 aligned and + * range-end is required. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void uploadPagesFromURL(String containerName, String blob, String sourceUrl, String sourceRange, + long contentLength, String range, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, + String leaseId, Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, + Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + uploadPagesFromURLWithResponse(containerName, blob, sourceUrl, sourceRange, contentLength, range, + sourceContentMD5, sourceContentcrc64, timeout, leaseId, ifSequenceNumberLessThanOrEqualTo, + ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestId, + copySourceAuthorization, cpkInfo, encryptionScopeParam, RequestOptions.none()); + } + + /** + * The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a + * page blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of pages. + */ + public Response getPageRangesWithResponse(String containerName, String blob, String snapshot, + Integer timeout, String range, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, String marker, Integer maxresults, + RequestOptions requestOptions) { + final String comp = "pagelist"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.getPageRanges(this.client.getUrl(), containerName, blob, comp, snapshot, timeout, range, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, marker, maxresults, accept, requestOptions); + } + + /** + * The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a + * page blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of pages. + */ + public PageList getPageRanges(String containerName, String blob, String snapshot, Integer timeout, String range, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, String marker, Integer maxresults) { + return getPageRangesWithResponse(containerName, blob, snapshot, timeout, range, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, marker, maxresults, RequestOptions.none()) + .getValue(); + } + + /** + * [Update] The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were + * changed between target blob and previous snapshot or version. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param prevsnapshot Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that + * specifies that the response will contain only pages that were changed between target blob and previous snapshot. + * Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot + * specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only + * for blobs created on or after January 1, 2016. + * @param prevSnapshotUrl Optional. This header is only supported in service versions 2019-04-19 and after and + * specifies the URL of a previous snapshot of the target blob. The response will only contain pages that were + * changed between the target blob and its previous snapshot. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of pages. + */ + public Response getPageRangesDiffWithResponse(String containerName, String blob, String snapshot, + Integer timeout, String prevsnapshot, String prevSnapshotUrl, String range, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, String marker, Integer maxresults, RequestOptions requestOptions) { + final String comp = "pagelist"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.getPageRangesDiff(this.client.getUrl(), containerName, blob, comp, snapshot, timeout, + prevsnapshot, prevSnapshotUrl, range, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, marker, maxresults, accept, + requestOptions); + } + + /** + * [Update] The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were + * changed between target blob and previous snapshot or version. + * + * @param containerName The container name. + * @param blob The blob name. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param prevsnapshot Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that + * specifies that the response will contain only pages that were changed between target blob and previous snapshot. + * Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot + * specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only + * for blobs created on or after January 1, 2016. + * @param prevSnapshotUrl Optional. This header is only supported in service versions 2019-04-19 and after and + * specifies the URL of a previous snapshot of the target blob. The response will only contain pages that were + * changed between the target blob and its previous snapshot. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of pages. + */ + public PageList getPageRangesDiff(String containerName, String blob, String snapshot, Integer timeout, + String prevsnapshot, String prevSnapshotUrl, String range, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + String marker, Integer maxresults) { + return getPageRangesDiffWithResponse(containerName, blob, snapshot, timeout, prevsnapshot, prevSnapshotUrl, + range, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, marker, + maxresults, RequestOptions.none()).getValue(); + } + + /** + * Resize the Blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size + * must be aligned to a 512-byte boundary. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response resizeWithResponse(String containerName, String blob, long blobContentLength, Integer timeout, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, + RequestOptions requestOptions) { + final String comp = "properties"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.resize(this.client.getUrl(), containerName, blob, comp, timeout, leaseId, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, blobContentLength, this.client.getVersion(), + requestId, accept, requestOptions); + } + + /** + * Resize the Blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size + * must be aligned to a 512-byte boundary. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void resize(String containerName, String blob, long blobContentLength, Integer timeout, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + resizeWithResponse(containerName, blob, blobContentLength, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, + ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam, RequestOptions.none()); + } + + /** + * Update the sequence number of the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param sequenceNumberAction Required if the x-ms-blob-sequence-number header is set for the request. This + * property applies to page blobs only. This property indicates how the service should modify the blob's sequence + * number. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param blobSequenceNumber Set for page blobs only. The sequence number is a user-controlled value that you can + * use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response updateSequenceNumberWithResponse(String containerName, String blob, + SequenceNumberActionType sequenceNumberAction, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, Long blobSequenceNumber, + String requestId, RequestOptions requestOptions) { + final String comp = "properties"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.updateSequenceNumber(this.client.getUrl(), containerName, blob, comp, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, sequenceNumberAction, + blobSequenceNumber, this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * Update the sequence number of the blob. + * + * @param containerName The container name. + * @param blob The blob name. + * @param sequenceNumberAction Required if the x-ms-blob-sequence-number header is set for the request. This + * property applies to page blobs only. This property indicates how the service should modify the blob's sequence + * number. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param blobSequenceNumber Set for page blobs only. The sequence number is a user-controlled value that you can + * use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void updateSequenceNumber(String containerName, String blob, SequenceNumberActionType sequenceNumberAction, + Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, Long blobSequenceNumber, String requestId) { + updateSequenceNumberWithResponse(containerName, blob, sequenceNumberAction, timeout, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, blobSequenceNumber, requestId, RequestOptions.none()); + } + + /** + * The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. The snapshot + * is copied such that only the differential changes between the previously copied snapshot are transferred to the + * destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as + * usual. This API is supported since REST version 2016-05-31. + * + * @param containerName The container name. + * @param blob The blob name. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response copyIncrementalWithResponse(String containerName, String blob, String copySource, + Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, RequestOptions requestOptions) { + final String comp = "incrementalcopy"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.copyIncremental(this.client.getUrl(), containerName, blob, comp, timeout, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, copySource, + this.client.getVersion(), requestId, accept, requestOptions); + } + + /** + * The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. The snapshot + * is copied such that only the differential changes between the previously copied snapshot are transferred to the + * destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as + * usual. This API is supported since REST version 2016-05-31. + * + * @param containerName The container name. + * @param blob The blob name. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void copyIncremental(String containerName, String blob, String copySource, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId) { + copyIncrementalWithResponse(containerName, blob, copySource, timeout, ifModifiedSince, ifUnmodifiedSince, + ifMatch, ifNoneMatch, ifTags, requestId, RequestOptions.none()); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/ServicesImpl.java new file mode 100644 index 000000000000..fbe519597b76 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/ServicesImpl.java @@ -0,0 +1,767 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.implementation; + +import com.azure.v2.storage.blob.models.BlobContainerItem; +import com.azure.v2.storage.blob.models.BlobContainersSegment; +import com.azure.v2.storage.blob.models.BlobServiceProperties; +import com.azure.v2.storage.blob.models.BlobServiceStatistics; +import com.azure.v2.storage.blob.models.FilterBlobSegment; +import com.azure.v2.storage.blob.models.FilterBlobsIncludeItem; +import com.azure.v2.storage.blob.models.KeyInfo; +import com.azure.v2.storage.blob.models.ListBlobContainersIncludeType; +import com.azure.v2.storage.blob.models.StorageError; +import com.azure.v2.storage.blob.models.UserDelegationKey; +import io.clientcore.core.annotations.ServiceInterface; +import io.clientcore.core.http.RestProxy; +import io.clientcore.core.http.annotations.BodyParam; +import io.clientcore.core.http.annotations.HeaderParam; +import io.clientcore.core.http.annotations.HostParam; +import io.clientcore.core.http.annotations.HttpRequestInformation; +import io.clientcore.core.http.annotations.PathParam; +import io.clientcore.core.http.annotations.QueryParam; +import io.clientcore.core.http.annotations.UnexpectedResponseExceptionDetail; +import io.clientcore.core.http.exceptions.HttpResponseException; +import io.clientcore.core.http.models.HttpMethod; +import io.clientcore.core.http.models.PagedIterable; +import io.clientcore.core.http.models.PagedResponse; +import io.clientcore.core.http.models.RequestOptions; +import io.clientcore.core.http.models.Response; +import io.clientcore.core.http.pipeline.HttpPipeline; +import io.clientcore.core.models.binarydata.BinaryData; +import io.clientcore.core.serialization.ObjectSerializer; +import io.clientcore.core.utils.Context; +import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * An instance of this class provides access to all the operations defined in Services. + */ +public final class ServicesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ServicesService service; + + /** + * The service client containing this operation class. + */ + private final AzureBlobStorageImpl client; + + /** + * Initializes an instance of ServicesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServicesImpl(AzureBlobStorageImpl client) { + this.service = RestProxy.create(ServicesService.class, client.getHttpPipeline()); + this.client = client; + } + + /** + * The interface defining all the services for AzureBlobStorageServices to be used by the proxy service to perform + * REST calls. + */ + @ServiceInterface(name = "AzureBlobStorageServ", host = "{url}") + public interface ServicesService { + static ServicesService getNewInstance(HttpPipeline pipeline, ObjectSerializer serializer) { + try { + Class clazz = Class.forName("com.azure.v2.storage.blob.implementation.ServicesServiceImpl"); + return (ServicesService) clazz.getMethod("getNewInstance", HttpPipeline.class, ObjectSerializer.class) + .invoke(null, pipeline, serializer); + } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException + | InvocationTargetException e) { + throw new RuntimeException(e); + } + + } + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/", expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response setProperties(@HostParam("url") String url, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/xml") BlobServiceProperties blobServiceProperties, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.PUT, path = "/", expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void setProperties(@HostParam("url") String url, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, + @BodyParam("application/xml") BlobServiceProperties blobServiceProperties, + @HeaderParam("Accept") String accept) { + setProperties(url, restype, comp, null, version, null, blobServiceProperties, accept, null); + } + + @HttpRequestInformation(method = HttpMethod.GET, path = "/", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response getProperties(@HostParam("url") String url, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.GET, path = "/", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default BlobServiceProperties getProperties(@HostParam("url") String url, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + return getProperties(url, restype, comp, null, version, null, accept, null).getValue(); + } + + @HttpRequestInformation(method = HttpMethod.GET, path = "/", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response getStatistics(@HostParam("url") String url, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.GET, path = "/", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default BlobServiceStatistics getStatistics(@HostParam("url") String url, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + return getStatistics(url, restype, comp, null, version, null, accept, null).getValue(); + } + + @HttpRequestInformation(method = HttpMethod.GET, path = "/", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response listBlobContainersSegment(@HostParam("url") String url, + @QueryParam("comp") String comp, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker, + @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String listBlobContainersIncludeType, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.GET, path = "/", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default BlobContainersSegment listBlobContainersSegment(@HostParam("url") String url, + @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + return listBlobContainersSegment(url, comp, null, null, null, null, null, version, null, accept, null) + .getValue(); + } + + @HttpRequestInformation(method = HttpMethod.POST, path = "/", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response getUserDelegationKey(@HostParam("url") String url, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @BodyParam("application/xml") KeyInfo keyInfo, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.POST, path = "/", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default UserDelegationKey getUserDelegationKey(@HostParam("url") String url, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @BodyParam("application/xml") KeyInfo keyInfo, + @HeaderParam("Accept") String accept) { + return getUserDelegationKey(url, restype, comp, null, version, null, keyInfo, accept, null).getValue(); + } + + @HttpRequestInformation(method = HttpMethod.GET, path = "/", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response getAccountInfo(@HostParam("url") String url, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.GET, path = "/", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default void getAccountInfo(@HostParam("url") String url, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept) { + getAccountInfo(url, restype, comp, null, version, null, accept, null); + } + + @HttpRequestInformation(method = HttpMethod.POST, path = "/", expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response submitBatch(@HostParam("url") String url, @QueryParam("comp") String comp, + @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-Type") String multipartContentType, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @BodyParam("application/xml") BinaryData body, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.POST, path = "/", expectedStatusCodes = { 202 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default InputStream submitBatch(@HostParam("url") String url, @QueryParam("comp") String comp, + @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-Type") String multipartContentType, + @HeaderParam("x-ms-version") String version, @BodyParam("application/xml") BinaryData body, + @HeaderParam("Accept") String accept) { + return submitBatch(url, comp, contentLength, multipartContentType, null, version, null, body, accept, null) + .getValue(); + } + + @HttpRequestInformation(method = HttpMethod.GET, path = "/", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response filterBlobs(@HostParam("url") String url, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("where") String where, + @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, + @QueryParam("include") String include, @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.GET, path = "/", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default FilterBlobSegment filterBlobs(@HostParam("url") String url, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + return filterBlobs(url, comp, null, version, null, null, null, null, null, accept, null).getValue(); + } + + @HttpRequestInformation(method = HttpMethod.GET, path = "{nextLink}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + Response listBlobContainersSegmentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("url") String url, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions); + + @HttpRequestInformation(method = HttpMethod.GET, path = "{nextLink}", expectedStatusCodes = { 200 }) + @UnexpectedResponseExceptionDetail(exceptionBodyClass = StorageError.class) + default BlobContainersSegment listBlobContainersSegmentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("url") String url, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept) { + return listBlobContainersSegmentNext(nextLink, url, version, null, accept, null).getValue(); + } + } + + /** + * Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and + * CORS (Cross-Origin Resource Sharing) rules. + * + * @param blobServiceProperties The StorageService properties. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response setPropertiesWithResponse(BlobServiceProperties blobServiceProperties, Integer timeout, + String requestId, RequestOptions requestOptions) { + final String restype = "service"; + final String comp = "properties"; + final String accept = "application/xml"; + return service.setProperties(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, + blobServiceProperties, accept, requestOptions); + } + + /** + * Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and + * CORS (Cross-Origin Resource Sharing) rules. + * + * @param blobServiceProperties The StorageService properties. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void setProperties(BlobServiceProperties blobServiceProperties, Integer timeout, String requestId) { + setPropertiesWithResponse(blobServiceProperties, timeout, requestId, RequestOptions.none()); + } + + /** + * gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS + * (Cross-Origin Resource Sharing) rules. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a storage account's Blob service, including properties for Storage Analytics and CORS + * (Cross-Origin Resource Sharing) rules. + */ + public Response getPropertiesWithResponse(Integer timeout, String requestId, + RequestOptions requestOptions) { + final String restype = "service"; + final String comp = "properties"; + final String accept = "application/xml"; + return service.getProperties(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, + accept, requestOptions); + } + + /** + * gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS + * (Cross-Origin Resource Sharing) rules. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a storage account's Blob service, including properties for Storage Analytics and CORS + * (Cross-Origin Resource Sharing) rules. + */ + public BlobServiceProperties getProperties(Integer timeout, String requestId) { + return getPropertiesWithResponse(timeout, requestId, RequestOptions.none()).getValue(); + } + + /** + * Retrieves statistics related to replication for the Blob service. It is only available on the secondary location + * endpoint when read-access geo-redundant replication is enabled for the storage account. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return stats for the storage service. + */ + public Response getStatisticsWithResponse(Integer timeout, String requestId, + RequestOptions requestOptions) { + final String restype = "service"; + final String comp = "stats"; + final String accept = "application/xml"; + return service.getStatistics(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, + accept, requestOptions); + } + + /** + * Retrieves statistics related to replication for the Blob service. It is only available on the secondary location + * endpoint when read-access geo-redundant replication is enabled for the storage account. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return stats for the storage service. + */ + public BlobServiceStatistics getStatistics(Integer timeout, String requestId) { + return getStatisticsWithResponse(timeout, requestId, RequestOptions.none()).getValue(); + } + + /** + * The List Containers Segment operation returns a list of the containers under the specified account. + * + * @param prefix Filters the results to return only containers whose name begins with the specified prefix. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param listBlobContainersIncludeType Include this parameter to specify that the container's metadata be returned + * as part of the response body. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of containers. + */ + public PagedResponse listBlobContainersSegmentSinglePage(String prefix, String marker, + Integer maxresults, List listBlobContainersIncludeType, Integer timeout, + String requestId) { + final String comp = "list"; + final String accept = "application/xml"; + String listBlobContainersIncludeTypeConverted = (listBlobContainersIncludeType == null) + ? null + : listBlobContainersIncludeType.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + Response res = service.listBlobContainersSegment(this.client.getUrl(), comp, prefix, + marker, maxresults, listBlobContainersIncludeTypeConverted, timeout, this.client.getVersion(), requestId, + accept, RequestOptions.none()); + return new PagedResponse<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getBody(), + res.getValue().getBlobContainerItems(), null, res.getValue().getNextMarker(), null, null, null); + } + + /** + * The List Containers Segment operation returns a list of the containers under the specified account. + * + * @param prefix Filters the results to return only containers whose name begins with the specified prefix. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param listBlobContainersIncludeType Include this parameter to specify that the container's metadata be returned + * as part of the response body. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of containers. + */ + public PagedResponse listBlobContainersSegmentSinglePage(String prefix, String marker, + Integer maxresults, List listBlobContainersIncludeType, Integer timeout, + String requestId, RequestOptions requestOptions) { + final String comp = "list"; + final String accept = "application/xml"; + String listBlobContainersIncludeTypeConverted = (listBlobContainersIncludeType == null) + ? null + : listBlobContainersIncludeType.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + Response res = service.listBlobContainersSegment(this.client.getUrl(), comp, prefix, + marker, maxresults, listBlobContainersIncludeTypeConverted, timeout, this.client.getVersion(), requestId, + accept, requestOptions); + return new PagedResponse<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getBody(), + res.getValue().getBlobContainerItems(), null, res.getValue().getNextMarker(), null, null, null); + } + + /** + * The List Containers Segment operation returns a list of the containers under the specified account. + * + * @param prefix Filters the results to return only containers whose name begins with the specified prefix. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param listBlobContainersIncludeType Include this parameter to specify that the container's metadata be returned + * as part of the response body. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of containers. + */ + public PagedIterable listBlobContainersSegment(String prefix, String marker, Integer maxresults, + List listBlobContainersIncludeType, Integer timeout, String requestId) { + return new PagedIterable<>( + (pagingOptions) -> listBlobContainersSegmentSinglePage(prefix, marker, maxresults, + listBlobContainersIncludeType, timeout, requestId), + (pagingOptions, nextLink) -> listBlobContainersSegmentNextSinglePage(nextLink, requestId)); + } + + /** + * The List Containers Segment operation returns a list of the containers under the specified account. + * + * @param prefix Filters the results to return only containers whose name begins with the specified prefix. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param listBlobContainersIncludeType Include this parameter to specify that the container's metadata be returned + * as part of the response body. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of containers. + */ + public PagedIterable listBlobContainersSegment(String prefix, String marker, Integer maxresults, + List listBlobContainersIncludeType, Integer timeout, String requestId, + RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.none()); + return new PagedIterable<>( + (pagingOptions) -> listBlobContainersSegmentSinglePage(prefix, marker, maxresults, + listBlobContainersIncludeType, timeout, requestId, requestOptions), + (pagingOptions, nextLink) -> listBlobContainersSegmentNextSinglePage(nextLink, requestId, + requestOptionsForNextPage)); + } + + /** + * Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token + * authentication. + * + * @param keyInfo Key information. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a user delegation key. + */ + public Response getUserDelegationKeyWithResponse(KeyInfo keyInfo, Integer timeout, + String requestId, RequestOptions requestOptions) { + final String restype = "service"; + final String comp = "userdelegationkey"; + final String accept = "application/xml"; + return service.getUserDelegationKey(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + requestId, keyInfo, accept, requestOptions); + } + + /** + * Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token + * authentication. + * + * @param keyInfo Key information. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a user delegation key. + */ + public UserDelegationKey getUserDelegationKey(KeyInfo keyInfo, Integer timeout, String requestId) { + return getUserDelegationKeyWithResponse(keyInfo, timeout, requestId, RequestOptions.none()).getValue(); + } + + /** + * Returns the sku name and account kind. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response getAccountInfoWithResponse(Integer timeout, String requestId, RequestOptions requestOptions) { + final String restype = "account"; + final String comp = "properties"; + final String accept = "application/xml"; + return service.getAccountInfo(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, + accept, requestOptions); + } + + /** + * Returns the sku name and account kind. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + public void getAccountInfo(Integer timeout, String requestId) { + getAccountInfoWithResponse(timeout, requestId, RequestOptions.none()); + } + + /** + * The Batch operation allows multiple API calls to be embedded into a single HTTP request. + * + * @param contentLength The length of the request. + * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. + * Example header value: multipart/mixed; boundary=batch_<GUID>. + * @param body Initial data. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public Response submitBatchWithResponse(long contentLength, String multipartContentType, + BinaryData body, Integer timeout, String requestId, RequestOptions requestOptions) { + final String comp = "batch"; + final String accept = "application/xml"; + return service.submitBatch(this.client.getUrl(), comp, contentLength, multipartContentType, timeout, + this.client.getVersion(), requestId, body, accept, requestOptions); + } + + /** + * The Batch operation allows multiple API calls to be embedded into a single HTTP request. + * + * @param contentLength The length of the request. + * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. + * Example header value: multipart/mixed; boundary=batch_<GUID>. + * @param body Initial data. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + public InputStream submitBatch(long contentLength, String multipartContentType, BinaryData body, Integer timeout, + String requestId) { + return submitBatchWithResponse(contentLength, multipartContentType, body, timeout, requestId, + RequestOptions.none()).getValue(); + } + + /** + * The Filter Blobs operation enables callers to list blobs across all containers whose tags match a given search + * expression. Filter blobs searches across all containers within a storage account but can be scoped within the + * expression to a single container. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param where Filters the results to return only to return only blobs whose tags match the specified expression. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a Filter Blobs API call. + */ + public Response filterBlobsWithResponse(Integer timeout, String requestId, String where, + String marker, Integer maxresults, List include, RequestOptions requestOptions) { + final String comp = "blobs"; + final String accept = "application/xml"; + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.filterBlobs(this.client.getUrl(), comp, timeout, this.client.getVersion(), requestId, where, + marker, maxresults, includeConverted, accept, requestOptions); + } + + /** + * The Filter Blobs operation enables callers to list blobs across all containers whose tags match a given search + * expression. Filter blobs searches across all containers within a storage account but can be scoped within the + * expression to a single container. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param where Filters the results to return only to return only blobs whose tags match the specified expression. + * @param marker A string value that identifies the portion of the list of containers to be returned with the next + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a Filter Blobs API call. + */ + public FilterBlobSegment filterBlobs(Integer timeout, String requestId, String where, String marker, + Integer maxresults, List include) { + return filterBlobsWithResponse(timeout, requestId, where, marker, maxresults, include, RequestOptions.none()) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of containers. + */ + public PagedResponse listBlobContainersSegmentNextSinglePage(String nextLink, String requestId) { + final String accept = "application/xml"; + Response res = service.listBlobContainersSegmentNext(nextLink, this.client.getUrl(), + this.client.getVersion(), requestId, accept, RequestOptions.none()); + return new PagedResponse<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getBody(), + res.getValue().getBlobContainerItems(), null, res.getValue().getNextMarker(), null, null, null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the service returns an error. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of containers. + */ + public PagedResponse listBlobContainersSegmentNextSinglePage(String nextLink, String requestId, + RequestOptions requestOptions) { + final String accept = "application/xml"; + Response res = service.listBlobContainersSegmentNext(nextLink, this.client.getUrl(), + this.client.getVersion(), requestId, accept, requestOptions); + return new PagedResponse<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getBody(), + res.getValue().getBlobContainerItems(), null, res.getValue().getNextMarker(), null, null, null); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/models/BlobSignedIdentifierWrapper.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/models/BlobSignedIdentifierWrapper.java new file mode 100644 index 000000000000..d90fb8419c9e --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/models/BlobSignedIdentifierWrapper.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.implementation.models; + +import com.azure.v2.storage.blob.models.BlobSignedIdentifier; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import java.util.ArrayList; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * A wrapper around List<BlobSignedIdentifier> which provides top-level metadata for serialization. + */ +public final class BlobSignedIdentifierWrapper implements XmlSerializable { + private final List signedIdentifiers; + + /** + * Creates an instance of BlobSignedIdentifierWrapper. + * + * @param signedIdentifiers the list. + */ + public BlobSignedIdentifierWrapper(List signedIdentifiers) { + this.signedIdentifiers = signedIdentifiers; + } + + /** + * Get the List<BlobSignedIdentifier> contained in this wrapper. + * + * @return the List<BlobSignedIdentifier>. + */ + public List items() { + return signedIdentifiers; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "SignedIdentifiers" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + if (signedIdentifiers != null) { + for (BlobSignedIdentifier element : signedIdentifiers) { + xmlWriter.writeXml(element, "SignedIdentifier"); + } + } + return xmlWriter.writeEndElement(); + } + + public static BlobSignedIdentifierWrapper fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + public static BlobSignedIdentifierWrapper fromXml(XmlReader xmlReader, String rootElementName) + throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "SignedIdentifiers" : rootElementName; + return xmlReader.readObject(rootElementName, reader -> { + List items = null; + + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("SignedIdentifier".equals(elementName.getLocalPart())) { + if (items == null) { + items = new ArrayList<>(); + } + + items.add(BlobSignedIdentifier.fromXml(reader)); + } else { + reader.nextElement(); + } + } + return new BlobSignedIdentifierWrapper(items); + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/package-info.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/package-info.java new file mode 100644 index 000000000000..e73f1f7a9444 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for AzureBlobStorage. + * null. + */ +package com.azure.v2.storage.blob.implementation; diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AccessTier.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AccessTier.java new file mode 100644 index 000000000000..f51f0f0bbe69 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AccessTier.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.v2.storage.blob.models; + +import io.clientcore.core.utils.ExpandableEnum; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +/** + * Defines values for AccessTier. + */ +public final class AccessTier implements ExpandableEnum { + private static final Map VALUES = new ConcurrentHashMap<>(); + + private static final Function NEW_INSTANCE = AccessTier::new; + + /** + * Static value P4 for AccessTier. + */ + public static final AccessTier P4 = fromValue("P4"); + + /** + * Static value P6 for AccessTier. + */ + public static final AccessTier P6 = fromValue("P6"); + + /** + * Static value P10 for AccessTier. + */ + public static final AccessTier P10 = fromValue("P10"); + + /** + * Static value P15 for AccessTier. + */ + public static final AccessTier P15 = fromValue("P15"); + + /** + * Static value P20 for AccessTier. + */ + public static final AccessTier P20 = fromValue("P20"); + + /** + * Static value P30 for AccessTier. + */ + public static final AccessTier P30 = fromValue("P30"); + + /** + * Static value P40 for AccessTier. + */ + public static final AccessTier P40 = fromValue("P40"); + + /** + * Static value P50 for AccessTier. + */ + public static final AccessTier P50 = fromValue("P50"); + + /** + * Static value P60 for AccessTier. + */ + public static final AccessTier P60 = fromValue("P60"); + + /** + * Static value P70 for AccessTier. + */ + public static final AccessTier P70 = fromValue("P70"); + + /** + * Static value P80 for AccessTier. + */ + public static final AccessTier P80 = fromValue("P80"); + + /** + * Static value Hot for AccessTier. + */ + public static final AccessTier HOT = fromValue("Hot"); + + /** + * Static value Cool for AccessTier. + */ + public static final AccessTier COOL = fromValue("Cool"); + + /** + * Static value Archive for AccessTier. + */ + public static final AccessTier ARCHIVE = fromValue("Archive"); + + /** + * Static value Premium for AccessTier. + */ + public static final AccessTier PREMIUM = fromValue("Premium"); + + /** + * Static value Cold for AccessTier. + */ + public static final AccessTier COLD = fromValue("Cold"); + + private final String value; + + private AccessTier(String value) { + this.value = value; + } + + /** + * Creates or finds a AccessTier. + * + * @param value a value to look for. + * @return the corresponding AccessTier. + * @throws IllegalArgumentException if value is null. + */ + public static AccessTier fromValue(String value) { + if (value == null) { + throw new IllegalArgumentException("'value' cannot be null."); + } + return VALUES.computeIfAbsent(value, NEW_INSTANCE); + } + + /** + * Gets known AccessTier values. + * + * @return Known AccessTier values. + */ + public static Collection values() { + return new ArrayList<>(VALUES.values()); + } + + /** + * Gets the value of the AccessTier instance. + * + * @return the value of the AccessTier instance. + */ + @Override + public String getValue() { + return this.value; + } + + @Override + public String toString() { + return Objects.toString(this.value); + } + + @Override + public boolean equals(Object obj) { + return this == obj; + } + + @Override + public int hashCode() { + return Objects.hashCode(this.value); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AccountKind.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AccountKind.java new file mode 100644 index 000000000000..ab64c1c30837 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AccountKind.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.v2.storage.blob.models; + +/** + * Defines values for AccountKind. + */ +public enum AccountKind { + /** + * Enum value Storage. + */ + STORAGE("Storage"), + + /** + * Enum value BlobStorage. + */ + BLOB_STORAGE("BlobStorage"), + + /** + * Enum value StorageV2. + */ + STORAGE_V2("StorageV2"), + + /** + * Enum value FileStorage. + */ + FILE_STORAGE("FileStorage"), + + /** + * Enum value BlockBlobStorage. + */ + BLOCK_BLOB_STORAGE("BlockBlobStorage"); + + /** + * The actual serialized value for a AccountKind instance. + */ + private final String value; + + AccountKind(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AccountKind instance. + * + * @param value the serialized value to parse. + * @return the parsed AccountKind object, or null if unable to parse. + */ + public static AccountKind fromString(String value) { + if (value == null) { + return null; + } + AccountKind[] items = AccountKind.values(); + for (AccountKind item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AppendBlobsAppendBlockFromUrlHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AppendBlobsAppendBlockFromUrlHeaders.java new file mode 100644 index 000000000000..ff7169a8488f --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AppendBlobsAppendBlockFromUrlHeaders.java @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Base64; + +/** + * The AppendBlobsAppendBlockFromUrlHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class AppendBlobsAppendBlockFromUrlHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-content-crc64 property. + */ + private byte[] xMsContentCrc64; + + /* + * The x-ms-blob-committed-block-count property. + */ + private Integer xMsBlobCommittedBlockCount; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-encryption-key-sha256 property. + */ + private String xMsEncryptionKeySha256; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-request-server-encrypted property. + */ + private Boolean xMsRequestServerEncrypted; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-MD5 property. + */ + private byte[] contentMD5; + + /* + * The x-ms-blob-append-offset property. + */ + private String xMsBlobAppendOffset; + + /* + * The x-ms-encryption-scope property. + */ + private String xMsEncryptionScope; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_CONTENT_CRC64 = HttpHeaderName.fromString("x-ms-content-crc64"); + + private static final HttpHeaderName X_MS_BLOB_COMMITTED_BLOCK_COUNT + = HttpHeaderName.fromString("x-ms-blob-committed-block-count"); + + private static final HttpHeaderName X_MS_ENCRYPTION_KEY_SHA256 + = HttpHeaderName.fromString("x-ms-encryption-key-sha256"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_REQUEST_SERVER_ENCRYPTED + = HttpHeaderName.fromString("x-ms-request-server-encrypted"); + + private static final HttpHeaderName X_MS_BLOB_APPEND_OFFSET = HttpHeaderName.fromString("x-ms-blob-append-offset"); + + private static final HttpHeaderName X_MS_ENCRYPTION_SCOPE = HttpHeaderName.fromString("x-ms-encryption-scope"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of AppendBlobsAppendBlockFromUrlHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public AppendBlobsAppendBlockFromUrlHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String xMsContentCrc64 = rawHeaders.getValue(X_MS_CONTENT_CRC64); + if (xMsContentCrc64 != null) { + this.xMsContentCrc64 = Base64.getDecoder().decode(xMsContentCrc64); + } + String xMsBlobCommittedBlockCount = rawHeaders.getValue(X_MS_BLOB_COMMITTED_BLOCK_COUNT); + if (xMsBlobCommittedBlockCount != null) { + this.xMsBlobCommittedBlockCount = Integer.parseInt(xMsBlobCommittedBlockCount); + } + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsEncryptionKeySha256 = rawHeaders.getValue(X_MS_ENCRYPTION_KEY_SHA256); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + String xMsRequestServerEncrypted = rawHeaders.getValue(X_MS_REQUEST_SERVER_ENCRYPTED); + if (xMsRequestServerEncrypted != null) { + this.xMsRequestServerEncrypted = Boolean.parseBoolean(xMsRequestServerEncrypted); + } + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + String contentMD5 = rawHeaders.getValue(HttpHeaderName.CONTENT_MD5); + if (contentMD5 != null) { + this.contentMD5 = Base64.getDecoder().decode(contentMD5); + } + this.xMsBlobAppendOffset = rawHeaders.getValue(X_MS_BLOB_APPEND_OFFSET); + this.xMsEncryptionScope = rawHeaders.getValue(X_MS_ENCRYPTION_SCOPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the AppendBlobsAppendBlockFromUrlHeaders object itself. + */ + public AppendBlobsAppendBlockFromUrlHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the AppendBlobsAppendBlockFromUrlHeaders object itself. + */ + public AppendBlobsAppendBlockFromUrlHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return this.xMsContentCrc64; + } + + /** + * Set the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the AppendBlobsAppendBlockFromUrlHeaders object itself. + */ + public AppendBlobsAppendBlockFromUrlHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = xMsContentCrc64; + return this; + } + + /** + * Get the xMsBlobCommittedBlockCount property: The x-ms-blob-committed-block-count property. + * + * @return the xMsBlobCommittedBlockCount value. + */ + public Integer getXMsBlobCommittedBlockCount() { + return this.xMsBlobCommittedBlockCount; + } + + /** + * Set the xMsBlobCommittedBlockCount property: The x-ms-blob-committed-block-count property. + * + * @param xMsBlobCommittedBlockCount the xMsBlobCommittedBlockCount value to set. + * @return the AppendBlobsAppendBlockFromUrlHeaders object itself. + */ + public AppendBlobsAppendBlockFromUrlHeaders setXMsBlobCommittedBlockCount(Integer xMsBlobCommittedBlockCount) { + this.xMsBlobCommittedBlockCount = xMsBlobCommittedBlockCount; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the AppendBlobsAppendBlockFromUrlHeaders object itself. + */ + public AppendBlobsAppendBlockFromUrlHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String getXMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the AppendBlobsAppendBlockFromUrlHeaders object itself. + */ + public AppendBlobsAppendBlockFromUrlHeaders setXMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the AppendBlobsAppendBlockFromUrlHeaders object itself. + */ + public AppendBlobsAppendBlockFromUrlHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @return the xMsRequestServerEncrypted value. + */ + public Boolean isXMsRequestServerEncrypted() { + return this.xMsRequestServerEncrypted; + } + + /** + * Set the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @param xMsRequestServerEncrypted the xMsRequestServerEncrypted value to set. + * @return the AppendBlobsAppendBlockFromUrlHeaders object itself. + */ + public AppendBlobsAppendBlockFromUrlHeaders setXMsRequestServerEncrypted(Boolean xMsRequestServerEncrypted) { + this.xMsRequestServerEncrypted = xMsRequestServerEncrypted; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the AppendBlobsAppendBlockFromUrlHeaders object itself. + */ + public AppendBlobsAppendBlockFromUrlHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentMD5 property: The Content-MD5 property. + * + * @return the contentMD5 value. + */ + public byte[] getContentMD5() { + return this.contentMD5; + } + + /** + * Set the contentMD5 property: The Content-MD5 property. + * + * @param contentMD5 the contentMD5 value to set. + * @return the AppendBlobsAppendBlockFromUrlHeaders object itself. + */ + public AppendBlobsAppendBlockFromUrlHeaders setContentMD5(byte[] contentMD5) { + this.contentMD5 = contentMD5; + return this; + } + + /** + * Get the xMsBlobAppendOffset property: The x-ms-blob-append-offset property. + * + * @return the xMsBlobAppendOffset value. + */ + public String getXMsBlobAppendOffset() { + return this.xMsBlobAppendOffset; + } + + /** + * Set the xMsBlobAppendOffset property: The x-ms-blob-append-offset property. + * + * @param xMsBlobAppendOffset the xMsBlobAppendOffset value to set. + * @return the AppendBlobsAppendBlockFromUrlHeaders object itself. + */ + public AppendBlobsAppendBlockFromUrlHeaders setXMsBlobAppendOffset(String xMsBlobAppendOffset) { + this.xMsBlobAppendOffset = xMsBlobAppendOffset; + return this; + } + + /** + * Get the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @return the xMsEncryptionScope value. + */ + public String getXMsEncryptionScope() { + return this.xMsEncryptionScope; + } + + /** + * Set the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @param xMsEncryptionScope the xMsEncryptionScope value to set. + * @return the AppendBlobsAppendBlockFromUrlHeaders object itself. + */ + public AppendBlobsAppendBlockFromUrlHeaders setXMsEncryptionScope(String xMsEncryptionScope) { + this.xMsEncryptionScope = xMsEncryptionScope; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AppendBlobsAppendBlockHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AppendBlobsAppendBlockHeaders.java new file mode 100644 index 000000000000..e932114037cb --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AppendBlobsAppendBlockHeaders.java @@ -0,0 +1,447 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Base64; + +/** + * The AppendBlobsAppendBlockHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class AppendBlobsAppendBlockHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-content-crc64 property. + */ + private byte[] xMsContentCrc64; + + /* + * The x-ms-blob-committed-block-count property. + */ + private Integer xMsBlobCommittedBlockCount; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-encryption-key-sha256 property. + */ + private String xMsEncryptionKeySha256; + + /* + * The x-ms-structured-body property. + */ + private String xMsStructuredBody; + + /* + * The x-ms-request-server-encrypted property. + */ + private Boolean xMsRequestServerEncrypted; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-MD5 property. + */ + private byte[] contentMD5; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The x-ms-blob-append-offset property. + */ + private String xMsBlobAppendOffset; + + /* + * The x-ms-encryption-scope property. + */ + private String xMsEncryptionScope; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_CONTENT_CRC64 = HttpHeaderName.fromString("x-ms-content-crc64"); + + private static final HttpHeaderName X_MS_BLOB_COMMITTED_BLOCK_COUNT + = HttpHeaderName.fromString("x-ms-blob-committed-block-count"); + + private static final HttpHeaderName X_MS_ENCRYPTION_KEY_SHA256 + = HttpHeaderName.fromString("x-ms-encryption-key-sha256"); + + private static final HttpHeaderName X_MS_STRUCTURED_BODY = HttpHeaderName.fromString("x-ms-structured-body"); + + private static final HttpHeaderName X_MS_REQUEST_SERVER_ENCRYPTED + = HttpHeaderName.fromString("x-ms-request-server-encrypted"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + private static final HttpHeaderName X_MS_BLOB_APPEND_OFFSET = HttpHeaderName.fromString("x-ms-blob-append-offset"); + + private static final HttpHeaderName X_MS_ENCRYPTION_SCOPE = HttpHeaderName.fromString("x-ms-encryption-scope"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of AppendBlobsAppendBlockHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public AppendBlobsAppendBlockHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + String xMsContentCrc64 = rawHeaders.getValue(X_MS_CONTENT_CRC64); + if (xMsContentCrc64 != null) { + this.xMsContentCrc64 = Base64.getDecoder().decode(xMsContentCrc64); + } + String xMsBlobCommittedBlockCount = rawHeaders.getValue(X_MS_BLOB_COMMITTED_BLOCK_COUNT); + if (xMsBlobCommittedBlockCount != null) { + this.xMsBlobCommittedBlockCount = Integer.parseInt(xMsBlobCommittedBlockCount); + } + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsEncryptionKeySha256 = rawHeaders.getValue(X_MS_ENCRYPTION_KEY_SHA256); + this.xMsStructuredBody = rawHeaders.getValue(X_MS_STRUCTURED_BODY); + String xMsRequestServerEncrypted = rawHeaders.getValue(X_MS_REQUEST_SERVER_ENCRYPTED); + if (xMsRequestServerEncrypted != null) { + this.xMsRequestServerEncrypted = Boolean.parseBoolean(xMsRequestServerEncrypted); + } + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + String contentMD5 = rawHeaders.getValue(HttpHeaderName.CONTENT_MD5); + if (contentMD5 != null) { + this.contentMD5 = Base64.getDecoder().decode(contentMD5); + } + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + this.xMsBlobAppendOffset = rawHeaders.getValue(X_MS_BLOB_APPEND_OFFSET); + this.xMsEncryptionScope = rawHeaders.getValue(X_MS_ENCRYPTION_SCOPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the AppendBlobsAppendBlockHeaders object itself. + */ + public AppendBlobsAppendBlockHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return this.xMsContentCrc64; + } + + /** + * Set the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the AppendBlobsAppendBlockHeaders object itself. + */ + public AppendBlobsAppendBlockHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = xMsContentCrc64; + return this; + } + + /** + * Get the xMsBlobCommittedBlockCount property: The x-ms-blob-committed-block-count property. + * + * @return the xMsBlobCommittedBlockCount value. + */ + public Integer getXMsBlobCommittedBlockCount() { + return this.xMsBlobCommittedBlockCount; + } + + /** + * Set the xMsBlobCommittedBlockCount property: The x-ms-blob-committed-block-count property. + * + * @param xMsBlobCommittedBlockCount the xMsBlobCommittedBlockCount value to set. + * @return the AppendBlobsAppendBlockHeaders object itself. + */ + public AppendBlobsAppendBlockHeaders setXMsBlobCommittedBlockCount(Integer xMsBlobCommittedBlockCount) { + this.xMsBlobCommittedBlockCount = xMsBlobCommittedBlockCount; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the AppendBlobsAppendBlockHeaders object itself. + */ + public AppendBlobsAppendBlockHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String getXMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the AppendBlobsAppendBlockHeaders object itself. + */ + public AppendBlobsAppendBlockHeaders setXMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsStructuredBody property: The x-ms-structured-body property. + * + * @return the xMsStructuredBody value. + */ + public String getXMsStructuredBody() { + return this.xMsStructuredBody; + } + + /** + * Set the xMsStructuredBody property: The x-ms-structured-body property. + * + * @param xMsStructuredBody the xMsStructuredBody value to set. + * @return the AppendBlobsAppendBlockHeaders object itself. + */ + public AppendBlobsAppendBlockHeaders setXMsStructuredBody(String xMsStructuredBody) { + this.xMsStructuredBody = xMsStructuredBody; + return this; + } + + /** + * Get the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @return the xMsRequestServerEncrypted value. + */ + public Boolean isXMsRequestServerEncrypted() { + return this.xMsRequestServerEncrypted; + } + + /** + * Set the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @param xMsRequestServerEncrypted the xMsRequestServerEncrypted value to set. + * @return the AppendBlobsAppendBlockHeaders object itself. + */ + public AppendBlobsAppendBlockHeaders setXMsRequestServerEncrypted(Boolean xMsRequestServerEncrypted) { + this.xMsRequestServerEncrypted = xMsRequestServerEncrypted; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the AppendBlobsAppendBlockHeaders object itself. + */ + public AppendBlobsAppendBlockHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentMD5 property: The Content-MD5 property. + * + * @return the contentMD5 value. + */ + public byte[] getContentMD5() { + return this.contentMD5; + } + + /** + * Set the contentMD5 property: The Content-MD5 property. + * + * @param contentMD5 the contentMD5 value to set. + * @return the AppendBlobsAppendBlockHeaders object itself. + */ + public AppendBlobsAppendBlockHeaders setContentMD5(byte[] contentMD5) { + this.contentMD5 = contentMD5; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the AppendBlobsAppendBlockHeaders object itself. + */ + public AppendBlobsAppendBlockHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the AppendBlobsAppendBlockHeaders object itself. + */ + public AppendBlobsAppendBlockHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the AppendBlobsAppendBlockHeaders object itself. + */ + public AppendBlobsAppendBlockHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the xMsBlobAppendOffset property: The x-ms-blob-append-offset property. + * + * @return the xMsBlobAppendOffset value. + */ + public String getXMsBlobAppendOffset() { + return this.xMsBlobAppendOffset; + } + + /** + * Set the xMsBlobAppendOffset property: The x-ms-blob-append-offset property. + * + * @param xMsBlobAppendOffset the xMsBlobAppendOffset value to set. + * @return the AppendBlobsAppendBlockHeaders object itself. + */ + public AppendBlobsAppendBlockHeaders setXMsBlobAppendOffset(String xMsBlobAppendOffset) { + this.xMsBlobAppendOffset = xMsBlobAppendOffset; + return this; + } + + /** + * Get the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @return the xMsEncryptionScope value. + */ + public String getXMsEncryptionScope() { + return this.xMsEncryptionScope; + } + + /** + * Set the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @param xMsEncryptionScope the xMsEncryptionScope value to set. + * @return the AppendBlobsAppendBlockHeaders object itself. + */ + public AppendBlobsAppendBlockHeaders setXMsEncryptionScope(String xMsEncryptionScope) { + this.xMsEncryptionScope = xMsEncryptionScope; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AppendBlobsCreateHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AppendBlobsCreateHeaders.java new file mode 100644 index 000000000000..1a2e6bcfbcf5 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AppendBlobsCreateHeaders.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Base64; + +/** + * The AppendBlobsCreateHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class AppendBlobsCreateHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-version-id property. + */ + private String xMsVersionId; + + /* + * The x-ms-encryption-key-sha256 property. + */ + private String xMsEncryptionKeySha256; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-request-server-encrypted property. + */ + private Boolean xMsRequestServerEncrypted; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-MD5 property. + */ + private byte[] contentMD5; + + /* + * The x-ms-encryption-scope property. + */ + private String xMsEncryptionScope; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_VERSION_ID = HttpHeaderName.fromString("x-ms-version-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_KEY_SHA256 + = HttpHeaderName.fromString("x-ms-encryption-key-sha256"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_REQUEST_SERVER_ENCRYPTED + = HttpHeaderName.fromString("x-ms-request-server-encrypted"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_SCOPE = HttpHeaderName.fromString("x-ms-encryption-scope"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of AppendBlobsCreateHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public AppendBlobsCreateHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsVersionId = rawHeaders.getValue(X_MS_VERSION_ID); + this.xMsEncryptionKeySha256 = rawHeaders.getValue(X_MS_ENCRYPTION_KEY_SHA256); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + String xMsRequestServerEncrypted = rawHeaders.getValue(X_MS_REQUEST_SERVER_ENCRYPTED); + if (xMsRequestServerEncrypted != null) { + this.xMsRequestServerEncrypted = Boolean.parseBoolean(xMsRequestServerEncrypted); + } + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + String contentMD5 = rawHeaders.getValue(HttpHeaderName.CONTENT_MD5); + if (contentMD5 != null) { + this.contentMD5 = Base64.getDecoder().decode(contentMD5); + } + this.xMsEncryptionScope = rawHeaders.getValue(X_MS_ENCRYPTION_SCOPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the AppendBlobsCreateHeaders object itself. + */ + public AppendBlobsCreateHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the AppendBlobsCreateHeaders object itself. + */ + public AppendBlobsCreateHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the AppendBlobsCreateHeaders object itself. + */ + public AppendBlobsCreateHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsVersionId property: The x-ms-version-id property. + * + * @return the xMsVersionId value. + */ + public String getXMsVersionId() { + return this.xMsVersionId; + } + + /** + * Set the xMsVersionId property: The x-ms-version-id property. + * + * @param xMsVersionId the xMsVersionId value to set. + * @return the AppendBlobsCreateHeaders object itself. + */ + public AppendBlobsCreateHeaders setXMsVersionId(String xMsVersionId) { + this.xMsVersionId = xMsVersionId; + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String getXMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the AppendBlobsCreateHeaders object itself. + */ + public AppendBlobsCreateHeaders setXMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the AppendBlobsCreateHeaders object itself. + */ + public AppendBlobsCreateHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @return the xMsRequestServerEncrypted value. + */ + public Boolean isXMsRequestServerEncrypted() { + return this.xMsRequestServerEncrypted; + } + + /** + * Set the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @param xMsRequestServerEncrypted the xMsRequestServerEncrypted value to set. + * @return the AppendBlobsCreateHeaders object itself. + */ + public AppendBlobsCreateHeaders setXMsRequestServerEncrypted(Boolean xMsRequestServerEncrypted) { + this.xMsRequestServerEncrypted = xMsRequestServerEncrypted; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the AppendBlobsCreateHeaders object itself. + */ + public AppendBlobsCreateHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the AppendBlobsCreateHeaders object itself. + */ + public AppendBlobsCreateHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentMD5 property: The Content-MD5 property. + * + * @return the contentMD5 value. + */ + public byte[] getContentMD5() { + return this.contentMD5; + } + + /** + * Set the contentMD5 property: The Content-MD5 property. + * + * @param contentMD5 the contentMD5 value to set. + * @return the AppendBlobsCreateHeaders object itself. + */ + public AppendBlobsCreateHeaders setContentMD5(byte[] contentMD5) { + this.contentMD5 = contentMD5; + return this; + } + + /** + * Get the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @return the xMsEncryptionScope value. + */ + public String getXMsEncryptionScope() { + return this.xMsEncryptionScope; + } + + /** + * Set the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @param xMsEncryptionScope the xMsEncryptionScope value to set. + * @return the AppendBlobsCreateHeaders object itself. + */ + public AppendBlobsCreateHeaders setXMsEncryptionScope(String xMsEncryptionScope) { + this.xMsEncryptionScope = xMsEncryptionScope; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AppendBlobsSealHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AppendBlobsSealHeaders.java new file mode 100644 index 000000000000..d670d1b92268 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/AppendBlobsSealHeaders.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The AppendBlobsSealHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class AppendBlobsSealHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-blob-sealed property. + */ + private Boolean xMsBlobSealed; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_BLOB_SEALED = HttpHeaderName.fromString("x-ms-blob-sealed"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of AppendBlobsSealHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public AppendBlobsSealHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String xMsBlobSealed = rawHeaders.getValue(X_MS_BLOB_SEALED); + if (xMsBlobSealed != null) { + this.xMsBlobSealed = Boolean.parseBoolean(xMsBlobSealed); + } + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the AppendBlobsSealHeaders object itself. + */ + public AppendBlobsSealHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the AppendBlobsSealHeaders object itself. + */ + public AppendBlobsSealHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsBlobSealed property: The x-ms-blob-sealed property. + * + * @return the xMsBlobSealed value. + */ + public Boolean isXMsBlobSealed() { + return this.xMsBlobSealed; + } + + /** + * Set the xMsBlobSealed property: The x-ms-blob-sealed property. + * + * @param xMsBlobSealed the xMsBlobSealed value to set. + * @return the AppendBlobsSealHeaders object itself. + */ + public AppendBlobsSealHeaders setXMsBlobSealed(Boolean xMsBlobSealed) { + this.xMsBlobSealed = xMsBlobSealed; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the AppendBlobsSealHeaders object itself. + */ + public AppendBlobsSealHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the AppendBlobsSealHeaders object itself. + */ + public AppendBlobsSealHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the AppendBlobsSealHeaders object itself. + */ + public AppendBlobsSealHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the AppendBlobsSealHeaders object itself. + */ + public AppendBlobsSealHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ArchiveStatus.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ArchiveStatus.java new file mode 100644 index 000000000000..5ae8219570c9 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ArchiveStatus.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.v2.storage.blob.models; + +import io.clientcore.core.utils.ExpandableEnum; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +/** + * Defines values for ArchiveStatus. + */ +public final class ArchiveStatus implements ExpandableEnum { + private static final Map VALUES = new ConcurrentHashMap<>(); + + private static final Function NEW_INSTANCE = ArchiveStatus::new; + + /** + * Static value rehydrate-pending-to-hot for ArchiveStatus. + */ + public static final ArchiveStatus REHYDRATE_PENDING_TO_HOT = fromValue("rehydrate-pending-to-hot"); + + /** + * Static value rehydrate-pending-to-cool for ArchiveStatus. + */ + public static final ArchiveStatus REHYDRATE_PENDING_TO_COOL = fromValue("rehydrate-pending-to-cool"); + + /** + * Static value rehydrate-pending-to-cold for ArchiveStatus. + */ + public static final ArchiveStatus REHYDRATE_PENDING_TO_COLD = fromValue("rehydrate-pending-to-cold"); + + private final String value; + + private ArchiveStatus(String value) { + this.value = value; + } + + /** + * Creates or finds a ArchiveStatus. + * + * @param value a value to look for. + * @return the corresponding ArchiveStatus. + * @throws IllegalArgumentException if value is null. + */ + public static ArchiveStatus fromValue(String value) { + if (value == null) { + throw new IllegalArgumentException("'value' cannot be null."); + } + return VALUES.computeIfAbsent(value, NEW_INSTANCE); + } + + /** + * Gets known ArchiveStatus values. + * + * @return Known ArchiveStatus values. + */ + public static Collection values() { + return new ArrayList<>(VALUES.values()); + } + + /** + * Gets the value of the ArchiveStatus instance. + * + * @return the value of the ArchiveStatus instance. + */ + @Override + public String getValue() { + return this.value; + } + + @Override + public String toString() { + return Objects.toString(this.value); + } + + @Override + public boolean equals(Object obj) { + return this == obj; + } + + @Override + public int hashCode() { + return Objects.hashCode(this.value); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ArrowConfiguration.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ArrowConfiguration.java new file mode 100644 index 000000000000..ad210c99bfb4 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ArrowConfiguration.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import java.util.ArrayList; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * Groups the settings used for formatting the response if the response should be Arrow formatted. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ArrowConfiguration implements XmlSerializable { + /* + * The Schema property. + */ + private List schema; + + /** + * Creates an instance of ArrowConfiguration class. + */ + public ArrowConfiguration() { + } + + /** + * Get the schema property: The Schema property. + * + * @return the schema value. + */ + public List getSchema() { + if (this.schema == null) { + this.schema = new ArrayList<>(); + } + return this.schema; + } + + /** + * Set the schema property: The Schema property. + * + * @param schema the schema value to set. + * @return the ArrowConfiguration object itself. + */ + public ArrowConfiguration setSchema(List schema) { + this.schema = schema; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "ArrowConfiguration" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + if (this.schema != null) { + xmlWriter.writeStartElement("Schema"); + for (ArrowField element : this.schema) { + xmlWriter.writeXml(element, "Field"); + } + xmlWriter.writeEndElement(); + } + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of ArrowConfiguration from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of ArrowConfiguration if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the ArrowConfiguration. + */ + public static ArrowConfiguration fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of ArrowConfiguration from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of ArrowConfiguration if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the ArrowConfiguration. + */ + public static ArrowConfiguration fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "ArrowConfiguration" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + ArrowConfiguration deserializedArrowConfiguration = new ArrowConfiguration(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Schema".equals(elementName.getLocalPart())) { + while (reader.nextElement() != XmlToken.END_ELEMENT) { + elementName = reader.getElementName(); + if ("Field".equals(elementName.getLocalPart())) { + if (deserializedArrowConfiguration.schema == null) { + deserializedArrowConfiguration.schema = new ArrayList<>(); + } + deserializedArrowConfiguration.schema.add(ArrowField.fromXml(reader, "Field")); + } else { + reader.skipElement(); + } + } + } else { + reader.skipElement(); + } + } + + return deserializedArrowConfiguration; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ArrowField.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ArrowField.java new file mode 100644 index 000000000000..f2af4ed54a46 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ArrowField.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * Groups settings regarding specific field of an arrow schema. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ArrowField implements XmlSerializable { + /* + * The Type property. + */ + private String type; + + /* + * The Name property. + */ + private String name; + + /* + * The Precision property. + */ + private Integer precision; + + /* + * The Scale property. + */ + private Integer scale; + + /** + * Creates an instance of ArrowField class. + */ + public ArrowField() { + } + + /** + * Get the type property: The Type property. + * + * @return the type value. + */ + public String getType() { + return this.type; + } + + /** + * Set the type property: The Type property. + * + * @param type the type value to set. + * @return the ArrowField object itself. + */ + public ArrowField setType(String type) { + this.type = type; + return this; + } + + /** + * Get the name property: The Name property. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * Set the name property: The Name property. + * + * @param name the name value to set. + * @return the ArrowField object itself. + */ + public ArrowField setName(String name) { + this.name = name; + return this; + } + + /** + * Get the precision property: The Precision property. + * + * @return the precision value. + */ + public Integer getPrecision() { + return this.precision; + } + + /** + * Set the precision property: The Precision property. + * + * @param precision the precision value to set. + * @return the ArrowField object itself. + */ + public ArrowField setPrecision(Integer precision) { + this.precision = precision; + return this; + } + + /** + * Get the scale property: The Scale property. + * + * @return the scale value. + */ + public Integer getScale() { + return this.scale; + } + + /** + * Set the scale property: The Scale property. + * + * @param scale the scale value to set. + * @return the ArrowField object itself. + */ + public ArrowField setScale(Integer scale) { + this.scale = scale; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "Field" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("Type", this.type); + xmlWriter.writeStringElement("Name", this.name); + xmlWriter.writeNumberElement("Precision", this.precision); + xmlWriter.writeNumberElement("Scale", this.scale); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of ArrowField from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of ArrowField if the XmlReader was pointing to an instance of it, or null if it was pointing + * to XML null. + * @throws XMLStreamException If an error occurs while reading the ArrowField. + */ + public static ArrowField fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of ArrowField from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of ArrowField if the XmlReader was pointing to an instance of it, or null if it was pointing + * to XML null. + * @throws XMLStreamException If an error occurs while reading the ArrowField. + */ + public static ArrowField fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "Field" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + ArrowField deserializedArrowField = new ArrowField(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Type".equals(elementName.getLocalPart())) { + deserializedArrowField.type = reader.getStringElement(); + } else if ("Name".equals(elementName.getLocalPart())) { + deserializedArrowField.name = reader.getStringElement(); + } else if ("Precision".equals(elementName.getLocalPart())) { + deserializedArrowField.precision = reader.getNullableElement(Integer::parseInt); + } else if ("Scale".equals(elementName.getLocalPart())) { + deserializedArrowField.scale = reader.getNullableElement(Integer::parseInt); + } else { + reader.skipElement(); + } + } + + return deserializedArrowField; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobAccessPolicy.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobAccessPolicy.java new file mode 100644 index 000000000000..f2366d28df1d --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobAccessPolicy.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * An Access policy. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobAccessPolicy implements XmlSerializable { + /* + * the date-time the policy is active + */ + private OffsetDateTime startsOn; + + /* + * the date-time the policy expires + */ + private OffsetDateTime expiresOn; + + /* + * the permissions for the acl policy + */ + private String permissions; + + /** + * Creates an instance of BlobAccessPolicy class. + */ + public BlobAccessPolicy() { + } + + /** + * Get the startsOn property: the date-time the policy is active. + * + * @return the startsOn value. + */ + public OffsetDateTime getStartsOn() { + return this.startsOn; + } + + /** + * Set the startsOn property: the date-time the policy is active. + * + * @param startsOn the startsOn value to set. + * @return the BlobAccessPolicy object itself. + */ + public BlobAccessPolicy setStartsOn(OffsetDateTime startsOn) { + this.startsOn = startsOn; + return this; + } + + /** + * Get the expiresOn property: the date-time the policy expires. + * + * @return the expiresOn value. + */ + public OffsetDateTime getExpiresOn() { + return this.expiresOn; + } + + /** + * Set the expiresOn property: the date-time the policy expires. + * + * @param expiresOn the expiresOn value to set. + * @return the BlobAccessPolicy object itself. + */ + public BlobAccessPolicy setExpiresOn(OffsetDateTime expiresOn) { + this.expiresOn = expiresOn; + return this; + } + + /** + * Get the permissions property: the permissions for the acl policy. + * + * @return the permissions value. + */ + public String getPermissions() { + return this.permissions; + } + + /** + * Set the permissions property: the permissions for the acl policy. + * + * @param permissions the permissions value to set. + * @return the BlobAccessPolicy object itself. + */ + public BlobAccessPolicy setPermissions(String permissions) { + this.permissions = permissions; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "BlobAccessPolicy" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("Start", + this.startsOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startsOn)); + xmlWriter.writeStringElement("Expiry", + this.expiresOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expiresOn)); + xmlWriter.writeStringElement("Permission", this.permissions); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobAccessPolicy from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobAccessPolicy if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobAccessPolicy. + */ + public static BlobAccessPolicy fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobAccessPolicy from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobAccessPolicy if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobAccessPolicy. + */ + public static BlobAccessPolicy fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "BlobAccessPolicy" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobAccessPolicy deserializedBlobAccessPolicy = new BlobAccessPolicy(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Start".equals(elementName.getLocalPart())) { + deserializedBlobAccessPolicy.startsOn + = reader.getNullableElement(dateString -> OffsetDateTime.parse(dateString)); + } else if ("Expiry".equals(elementName.getLocalPart())) { + deserializedBlobAccessPolicy.expiresOn + = reader.getNullableElement(dateString -> OffsetDateTime.parse(dateString)); + } else if ("Permission".equals(elementName.getLocalPart())) { + deserializedBlobAccessPolicy.permissions = reader.getStringElement(); + } else { + reader.skipElement(); + } + } + + return deserializedBlobAccessPolicy; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobAnalyticsLogging.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobAnalyticsLogging.java new file mode 100644 index 000000000000..c0946a3859ea --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobAnalyticsLogging.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * Azure Analytics Logging settings. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobAnalyticsLogging implements XmlSerializable { + /* + * The version of Storage Analytics to configure. + */ + private String version; + + /* + * Indicates whether all delete requests should be logged. + */ + private boolean delete; + + /* + * Indicates whether all read requests should be logged. + */ + private boolean read; + + /* + * Indicates whether all write requests should be logged. + */ + private boolean write; + + /* + * the retention policy which determines how long the associated data should persist + */ + private BlobRetentionPolicy retentionPolicy; + + /** + * Creates an instance of BlobAnalyticsLogging class. + */ + public BlobAnalyticsLogging() { + } + + /** + * Get the version property: The version of Storage Analytics to configure. + * + * @return the version value. + */ + public String getVersion() { + return this.version; + } + + /** + * Set the version property: The version of Storage Analytics to configure. + * + * @param version the version value to set. + * @return the BlobAnalyticsLogging object itself. + */ + public BlobAnalyticsLogging setVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the delete property: Indicates whether all delete requests should be logged. + * + * @return the delete value. + */ + public boolean isDelete() { + return this.delete; + } + + /** + * Set the delete property: Indicates whether all delete requests should be logged. + * + * @param delete the delete value to set. + * @return the BlobAnalyticsLogging object itself. + */ + public BlobAnalyticsLogging setDelete(boolean delete) { + this.delete = delete; + return this; + } + + /** + * Get the read property: Indicates whether all read requests should be logged. + * + * @return the read value. + */ + public boolean isRead() { + return this.read; + } + + /** + * Set the read property: Indicates whether all read requests should be logged. + * + * @param read the read value to set. + * @return the BlobAnalyticsLogging object itself. + */ + public BlobAnalyticsLogging setRead(boolean read) { + this.read = read; + return this; + } + + /** + * Get the write property: Indicates whether all write requests should be logged. + * + * @return the write value. + */ + public boolean isWrite() { + return this.write; + } + + /** + * Set the write property: Indicates whether all write requests should be logged. + * + * @param write the write value to set. + * @return the BlobAnalyticsLogging object itself. + */ + public BlobAnalyticsLogging setWrite(boolean write) { + this.write = write; + return this; + } + + /** + * Get the retentionPolicy property: the retention policy which determines how long the associated data should + * persist. + * + * @return the retentionPolicy value. + */ + public BlobRetentionPolicy getRetentionPolicy() { + return this.retentionPolicy; + } + + /** + * Set the retentionPolicy property: the retention policy which determines how long the associated data should + * persist. + * + * @param retentionPolicy the retentionPolicy value to set. + * @return the BlobAnalyticsLogging object itself. + */ + public BlobAnalyticsLogging setRetentionPolicy(BlobRetentionPolicy retentionPolicy) { + this.retentionPolicy = retentionPolicy; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName + = rootElementName == null || rootElementName.isEmpty() ? "BlobAnalyticsLogging" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("Version", this.version); + xmlWriter.writeBooleanElement("Delete", this.delete); + xmlWriter.writeBooleanElement("Read", this.read); + xmlWriter.writeBooleanElement("Write", this.write); + xmlWriter.writeXml(this.retentionPolicy, "RetentionPolicy"); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobAnalyticsLogging from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobAnalyticsLogging if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobAnalyticsLogging. + */ + public static BlobAnalyticsLogging fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobAnalyticsLogging from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobAnalyticsLogging if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobAnalyticsLogging. + */ + public static BlobAnalyticsLogging fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "BlobAnalyticsLogging" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobAnalyticsLogging deserializedBlobAnalyticsLogging = new BlobAnalyticsLogging(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Version".equals(elementName.getLocalPart())) { + deserializedBlobAnalyticsLogging.version = reader.getStringElement(); + } else if ("Delete".equals(elementName.getLocalPart())) { + deserializedBlobAnalyticsLogging.delete = reader.getBooleanElement(); + } else if ("Read".equals(elementName.getLocalPart())) { + deserializedBlobAnalyticsLogging.read = reader.getBooleanElement(); + } else if ("Write".equals(elementName.getLocalPart())) { + deserializedBlobAnalyticsLogging.write = reader.getBooleanElement(); + } else if ("RetentionPolicy".equals(elementName.getLocalPart())) { + deserializedBlobAnalyticsLogging.retentionPolicy + = BlobRetentionPolicy.fromXml(reader, "RetentionPolicy"); + } else { + reader.skipElement(); + } + } + + return deserializedBlobAnalyticsLogging; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobContainerEncryptionScope.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobContainerEncryptionScope.java new file mode 100644 index 000000000000..70bd8183a69b --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobContainerEncryptionScope.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; + +/** + * Parameter group. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobContainerEncryptionScope { + /* + * Optional. Version 2019-07-07 and later. Specifies the default encryption scope to set on the container and use + * for all future writes. + */ + private String defaultEncryptionScope; + + /* + * Optional. Version 2019-07-07 and newer. If true, prevents any request from specifying a different encryption + * scope than the scope set on the container. + */ + private Boolean encryptionScopeOverridePrevented; + + /** + * Creates an instance of BlobContainerEncryptionScope class. + */ + public BlobContainerEncryptionScope() { + } + + /** + * Get the defaultEncryptionScope property: Optional. Version 2019-07-07 and later. Specifies the default encryption + * scope to set on the container and use for all future writes. + * + * @return the defaultEncryptionScope value. + */ + public String getDefaultEncryptionScope() { + return this.defaultEncryptionScope; + } + + /** + * Set the defaultEncryptionScope property: Optional. Version 2019-07-07 and later. Specifies the default encryption + * scope to set on the container and use for all future writes. + * + * @param defaultEncryptionScope the defaultEncryptionScope value to set. + * @return the BlobContainerEncryptionScope object itself. + */ + public BlobContainerEncryptionScope setDefaultEncryptionScope(String defaultEncryptionScope) { + this.defaultEncryptionScope = defaultEncryptionScope; + return this; + } + + /** + * Get the encryptionScopeOverridePrevented property: Optional. Version 2019-07-07 and newer. If true, prevents any + * request from specifying a different encryption scope than the scope set on the container. + * + * @return the encryptionScopeOverridePrevented value. + */ + public Boolean isEncryptionScopeOverridePrevented() { + return this.encryptionScopeOverridePrevented; + } + + /** + * Set the encryptionScopeOverridePrevented property: Optional. Version 2019-07-07 and newer. If true, prevents any + * request from specifying a different encryption scope than the scope set on the container. + * + * @param encryptionScopeOverridePrevented the encryptionScopeOverridePrevented value to set. + * @return the BlobContainerEncryptionScope object itself. + */ + public BlobContainerEncryptionScope setEncryptionScopeOverridePrevented(Boolean encryptionScopeOverridePrevented) { + this.encryptionScopeOverridePrevented = encryptionScopeOverridePrevented; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobContainerItem.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobContainerItem.java new file mode 100644 index 000000000000..b3013ca30375 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobContainerItem.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import java.util.LinkedHashMap; +import java.util.Map; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * An Azure Storage container. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobContainerItem implements XmlSerializable { + /* + * The Name property. + */ + private String name; + + /* + * The Deleted property. + */ + private Boolean deleted; + + /* + * The Version property. + */ + private String version; + + /* + * Properties of a container + */ + private BlobContainerItemProperties properties; + + /* + * Dictionary of + */ + private Map metadata; + + /** + * Creates an instance of BlobContainerItem class. + */ + public BlobContainerItem() { + } + + /** + * Get the name property: The Name property. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * Set the name property: The Name property. + * + * @param name the name value to set. + * @return the BlobContainerItem object itself. + */ + public BlobContainerItem setName(String name) { + this.name = name; + return this; + } + + /** + * Get the deleted property: The Deleted property. + * + * @return the deleted value. + */ + public Boolean isDeleted() { + return this.deleted; + } + + /** + * Set the deleted property: The Deleted property. + * + * @param deleted the deleted value to set. + * @return the BlobContainerItem object itself. + */ + public BlobContainerItem setDeleted(Boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + * Get the version property: The Version property. + * + * @return the version value. + */ + public String getVersion() { + return this.version; + } + + /** + * Set the version property: The Version property. + * + * @param version the version value to set. + * @return the BlobContainerItem object itself. + */ + public BlobContainerItem setVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the properties property: Properties of a container. + * + * @return the properties value. + */ + public BlobContainerItemProperties getProperties() { + return this.properties; + } + + /** + * Set the properties property: Properties of a container. + * + * @param properties the properties value to set. + * @return the BlobContainerItem object itself. + */ + public BlobContainerItem setProperties(BlobContainerItemProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the metadata property: Dictionary of <string>. + * + * @return the metadata value. + */ + public Map getMetadata() { + return this.metadata; + } + + /** + * Set the metadata property: Dictionary of <string>. + * + * @param metadata the metadata value to set. + * @return the BlobContainerItem object itself. + */ + public BlobContainerItem setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "Container" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("Name", this.name); + xmlWriter.writeBooleanElement("Deleted", this.deleted); + xmlWriter.writeStringElement("Version", this.version); + xmlWriter.writeXml(this.properties, "Properties"); + if (this.metadata != null) { + xmlWriter.writeStartElement("Metadata"); + for (Map.Entry entry : this.metadata.entrySet()) { + xmlWriter.writeStringElement(entry.getKey(), entry.getValue()); + } + xmlWriter.writeEndElement(); + } + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobContainerItem from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobContainerItem if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobContainerItem. + */ + public static BlobContainerItem fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobContainerItem from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobContainerItem if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobContainerItem. + */ + public static BlobContainerItem fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "Container" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobContainerItem deserializedBlobContainerItem = new BlobContainerItem(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Name".equals(elementName.getLocalPart())) { + deserializedBlobContainerItem.name = reader.getStringElement(); + } else if ("Deleted".equals(elementName.getLocalPart())) { + deserializedBlobContainerItem.deleted = reader.getNullableElement(Boolean::parseBoolean); + } else if ("Version".equals(elementName.getLocalPart())) { + deserializedBlobContainerItem.version = reader.getStringElement(); + } else if ("Properties".equals(elementName.getLocalPart())) { + deserializedBlobContainerItem.properties + = BlobContainerItemProperties.fromXml(reader, "Properties"); + } else if ("Metadata".equals(elementName.getLocalPart())) { + while (reader.nextElement() != XmlToken.END_ELEMENT) { + if (deserializedBlobContainerItem.metadata == null) { + deserializedBlobContainerItem.metadata = new LinkedHashMap<>(); + } + deserializedBlobContainerItem.metadata.put(reader.getElementName().getLocalPart(), + reader.getStringElement()); + } + } else { + reader.skipElement(); + } + } + + return deserializedBlobContainerItem; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobContainerItemProperties.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobContainerItemProperties.java new file mode 100644 index 000000000000..79ac998b5e5e --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobContainerItemProperties.java @@ -0,0 +1,476 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Objects; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * Properties of a container. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobContainerItemProperties implements XmlSerializable { + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The Etag property. + */ + private String eTag; + + /* + * The LeaseStatus property. + */ + private LeaseStatusType leaseStatus; + + /* + * The LeaseState property. + */ + private LeaseStateType leaseState; + + /* + * The LeaseDuration property. + */ + private LeaseDurationType leaseDuration; + + /* + * The PublicAccess property. + */ + private PublicAccessType publicAccess; + + /* + * The HasImmutabilityPolicy property. + */ + private Boolean hasImmutabilityPolicy; + + /* + * The HasLegalHold property. + */ + private Boolean hasLegalHold; + + /* + * The DefaultEncryptionScope property. + */ + private String defaultEncryptionScope; + + /* + * The DenyEncryptionScopeOverride property. + */ + private Boolean encryptionScopeOverridePrevented; + + /* + * The DeletedTime property. + */ + private DateTimeRfc1123 deletedTime; + + /* + * The RemainingRetentionDays property. + */ + private Integer remainingRetentionDays; + + /* + * Indicates if version level worm is enabled on this container. + */ + private Boolean isImmutableStorageWithVersioningEnabled; + + /** + * Creates an instance of BlobContainerItemProperties class. + */ + public BlobContainerItemProperties() { + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlobContainerItemProperties object itself. + */ + public BlobContainerItemProperties setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the eTag property: The Etag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The Etag property. + * + * @param eTag the eTag value to set. + * @return the BlobContainerItemProperties object itself. + */ + public BlobContainerItemProperties setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the leaseStatus property: The LeaseStatus property. + * + * @return the leaseStatus value. + */ + public LeaseStatusType getLeaseStatus() { + return this.leaseStatus; + } + + /** + * Set the leaseStatus property: The LeaseStatus property. + * + * @param leaseStatus the leaseStatus value to set. + * @return the BlobContainerItemProperties object itself. + */ + public BlobContainerItemProperties setLeaseStatus(LeaseStatusType leaseStatus) { + this.leaseStatus = leaseStatus; + return this; + } + + /** + * Get the leaseState property: The LeaseState property. + * + * @return the leaseState value. + */ + public LeaseStateType getLeaseState() { + return this.leaseState; + } + + /** + * Set the leaseState property: The LeaseState property. + * + * @param leaseState the leaseState value to set. + * @return the BlobContainerItemProperties object itself. + */ + public BlobContainerItemProperties setLeaseState(LeaseStateType leaseState) { + this.leaseState = leaseState; + return this; + } + + /** + * Get the leaseDuration property: The LeaseDuration property. + * + * @return the leaseDuration value. + */ + public LeaseDurationType getLeaseDuration() { + return this.leaseDuration; + } + + /** + * Set the leaseDuration property: The LeaseDuration property. + * + * @param leaseDuration the leaseDuration value to set. + * @return the BlobContainerItemProperties object itself. + */ + public BlobContainerItemProperties setLeaseDuration(LeaseDurationType leaseDuration) { + this.leaseDuration = leaseDuration; + return this; + } + + /** + * Get the publicAccess property: The PublicAccess property. + * + * @return the publicAccess value. + */ + public PublicAccessType getPublicAccess() { + return this.publicAccess; + } + + /** + * Set the publicAccess property: The PublicAccess property. + * + * @param publicAccess the publicAccess value to set. + * @return the BlobContainerItemProperties object itself. + */ + public BlobContainerItemProperties setPublicAccess(PublicAccessType publicAccess) { + this.publicAccess = publicAccess; + return this; + } + + /** + * Get the hasImmutabilityPolicy property: The HasImmutabilityPolicy property. + * + * @return the hasImmutabilityPolicy value. + */ + public Boolean isHasImmutabilityPolicy() { + return this.hasImmutabilityPolicy; + } + + /** + * Set the hasImmutabilityPolicy property: The HasImmutabilityPolicy property. + * + * @param hasImmutabilityPolicy the hasImmutabilityPolicy value to set. + * @return the BlobContainerItemProperties object itself. + */ + public BlobContainerItemProperties setHasImmutabilityPolicy(Boolean hasImmutabilityPolicy) { + this.hasImmutabilityPolicy = hasImmutabilityPolicy; + return this; + } + + /** + * Get the hasLegalHold property: The HasLegalHold property. + * + * @return the hasLegalHold value. + */ + public Boolean isHasLegalHold() { + return this.hasLegalHold; + } + + /** + * Set the hasLegalHold property: The HasLegalHold property. + * + * @param hasLegalHold the hasLegalHold value to set. + * @return the BlobContainerItemProperties object itself. + */ + public BlobContainerItemProperties setHasLegalHold(Boolean hasLegalHold) { + this.hasLegalHold = hasLegalHold; + return this; + } + + /** + * Get the defaultEncryptionScope property: The DefaultEncryptionScope property. + * + * @return the defaultEncryptionScope value. + */ + public String getDefaultEncryptionScope() { + return this.defaultEncryptionScope; + } + + /** + * Set the defaultEncryptionScope property: The DefaultEncryptionScope property. + * + * @param defaultEncryptionScope the defaultEncryptionScope value to set. + * @return the BlobContainerItemProperties object itself. + */ + public BlobContainerItemProperties setDefaultEncryptionScope(String defaultEncryptionScope) { + this.defaultEncryptionScope = defaultEncryptionScope; + return this; + } + + /** + * Get the encryptionScopeOverridePrevented property: The DenyEncryptionScopeOverride property. + * + * @return the encryptionScopeOverridePrevented value. + */ + public Boolean isEncryptionScopeOverridePrevented() { + return this.encryptionScopeOverridePrevented; + } + + /** + * Set the encryptionScopeOverridePrevented property: The DenyEncryptionScopeOverride property. + * + * @param encryptionScopeOverridePrevented the encryptionScopeOverridePrevented value to set. + * @return the BlobContainerItemProperties object itself. + */ + public BlobContainerItemProperties setEncryptionScopeOverridePrevented(Boolean encryptionScopeOverridePrevented) { + this.encryptionScopeOverridePrevented = encryptionScopeOverridePrevented; + return this; + } + + /** + * Get the deletedTime property: The DeletedTime property. + * + * @return the deletedTime value. + */ + public OffsetDateTime getDeletedTime() { + if (this.deletedTime == null) { + return null; + } + return this.deletedTime.getDateTime(); + } + + /** + * Set the deletedTime property: The DeletedTime property. + * + * @param deletedTime the deletedTime value to set. + * @return the BlobContainerItemProperties object itself. + */ + public BlobContainerItemProperties setDeletedTime(OffsetDateTime deletedTime) { + if (deletedTime == null) { + this.deletedTime = null; + } else { + this.deletedTime = new DateTimeRfc1123(deletedTime); + } + return this; + } + + /** + * Get the remainingRetentionDays property: The RemainingRetentionDays property. + * + * @return the remainingRetentionDays value. + */ + public Integer getRemainingRetentionDays() { + return this.remainingRetentionDays; + } + + /** + * Set the remainingRetentionDays property: The RemainingRetentionDays property. + * + * @param remainingRetentionDays the remainingRetentionDays value to set. + * @return the BlobContainerItemProperties object itself. + */ + public BlobContainerItemProperties setRemainingRetentionDays(Integer remainingRetentionDays) { + this.remainingRetentionDays = remainingRetentionDays; + return this; + } + + /** + * Get the isImmutableStorageWithVersioningEnabled property: Indicates if version level worm is enabled on this + * container. + * + * @return the isImmutableStorageWithVersioningEnabled value. + */ + public Boolean isImmutableStorageWithVersioningEnabled() { + return this.isImmutableStorageWithVersioningEnabled; + } + + /** + * Set the isImmutableStorageWithVersioningEnabled property: Indicates if version level worm is enabled on this + * container. + * + * @param isImmutableStorageWithVersioningEnabled the isImmutableStorageWithVersioningEnabled value to set. + * @return the BlobContainerItemProperties object itself. + */ + public BlobContainerItemProperties + setIsImmutableStorageWithVersioningEnabled(Boolean isImmutableStorageWithVersioningEnabled) { + this.isImmutableStorageWithVersioningEnabled = isImmutableStorageWithVersioningEnabled; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName + = rootElementName == null || rootElementName.isEmpty() ? "BlobContainerItemProperties" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("Last-Modified", Objects.toString(this.lastModified, null)); + xmlWriter.writeStringElement("Etag", this.eTag); + xmlWriter.writeStringElement("LeaseStatus", this.leaseStatus == null ? null : this.leaseStatus.toString()); + xmlWriter.writeStringElement("LeaseState", this.leaseState == null ? null : this.leaseState.toString()); + xmlWriter.writeStringElement("LeaseDuration", + this.leaseDuration == null ? null : this.leaseDuration.toString()); + xmlWriter.writeStringElement("PublicAccess", this.publicAccess == null ? null : this.publicAccess.getValue()); + xmlWriter.writeBooleanElement("HasImmutabilityPolicy", this.hasImmutabilityPolicy); + xmlWriter.writeBooleanElement("HasLegalHold", this.hasLegalHold); + xmlWriter.writeStringElement("DefaultEncryptionScope", this.defaultEncryptionScope); + xmlWriter.writeBooleanElement("DenyEncryptionScopeOverride", this.encryptionScopeOverridePrevented); + xmlWriter.writeStringElement("DeletedTime", Objects.toString(this.deletedTime, null)); + xmlWriter.writeNumberElement("RemainingRetentionDays", this.remainingRetentionDays); + xmlWriter.writeBooleanElement("ImmutableStorageWithVersioningEnabled", + this.isImmutableStorageWithVersioningEnabled); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobContainerItemProperties from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobContainerItemProperties if the XmlReader was pointing to an instance of it, or null if + * it was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobContainerItemProperties. + */ + public static BlobContainerItemProperties fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobContainerItemProperties from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobContainerItemProperties if the XmlReader was pointing to an instance of it, or null if + * it was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobContainerItemProperties. + */ + public static BlobContainerItemProperties fromXml(XmlReader xmlReader, String rootElementName) + throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "BlobContainerItemProperties" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobContainerItemProperties deserializedBlobContainerItemProperties = new BlobContainerItemProperties(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Last-Modified".equals(elementName.getLocalPart())) { + deserializedBlobContainerItemProperties.lastModified + = reader.getNullableElement(DateTimeRfc1123::new); + } else if ("Etag".equals(elementName.getLocalPart())) { + deserializedBlobContainerItemProperties.eTag = reader.getStringElement(); + } else if ("LeaseStatus".equals(elementName.getLocalPart())) { + deserializedBlobContainerItemProperties.leaseStatus + = LeaseStatusType.fromString(reader.getStringElement()); + } else if ("LeaseState".equals(elementName.getLocalPart())) { + deserializedBlobContainerItemProperties.leaseState + = LeaseStateType.fromString(reader.getStringElement()); + } else if ("LeaseDuration".equals(elementName.getLocalPart())) { + deserializedBlobContainerItemProperties.leaseDuration + = LeaseDurationType.fromString(reader.getStringElement()); + } else if ("PublicAccess".equals(elementName.getLocalPart())) { + deserializedBlobContainerItemProperties.publicAccess + = PublicAccessType.fromValue(reader.getStringElement()); + } else if ("HasImmutabilityPolicy".equals(elementName.getLocalPart())) { + deserializedBlobContainerItemProperties.hasImmutabilityPolicy + = reader.getNullableElement(Boolean::parseBoolean); + } else if ("HasLegalHold".equals(elementName.getLocalPart())) { + deserializedBlobContainerItemProperties.hasLegalHold + = reader.getNullableElement(Boolean::parseBoolean); + } else if ("DefaultEncryptionScope".equals(elementName.getLocalPart())) { + deserializedBlobContainerItemProperties.defaultEncryptionScope = reader.getStringElement(); + } else if ("DenyEncryptionScopeOverride".equals(elementName.getLocalPart())) { + deserializedBlobContainerItemProperties.encryptionScopeOverridePrevented + = reader.getNullableElement(Boolean::parseBoolean); + } else if ("DeletedTime".equals(elementName.getLocalPart())) { + deserializedBlobContainerItemProperties.deletedTime + = reader.getNullableElement(DateTimeRfc1123::new); + } else if ("RemainingRetentionDays".equals(elementName.getLocalPart())) { + deserializedBlobContainerItemProperties.remainingRetentionDays + = reader.getNullableElement(Integer::parseInt); + } else if ("ImmutableStorageWithVersioningEnabled".equals(elementName.getLocalPart())) { + deserializedBlobContainerItemProperties.isImmutableStorageWithVersioningEnabled + = reader.getNullableElement(Boolean::parseBoolean); + } else { + reader.skipElement(); + } + } + + return deserializedBlobContainerItemProperties; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobContainersSegment.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobContainersSegment.java new file mode 100644 index 000000000000..a36859fc509b --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobContainersSegment.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import java.util.ArrayList; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * An enumeration of containers. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobContainersSegment implements XmlSerializable { + /* + * The ServiceEndpoint property. + */ + private String serviceEndpoint; + + /* + * The Prefix property. + */ + private String prefix; + + /* + * The Marker property. + */ + private String marker; + + /* + * The MaxResults property. + */ + private Integer maxResults; + + /* + * The NextMarker property. + */ + private String nextMarker; + + /* + * The BlobContainerItems property. + */ + private List blobContainerItems; + + /** + * Creates an instance of BlobContainersSegment class. + */ + public BlobContainersSegment() { + } + + /** + * Get the serviceEndpoint property: The ServiceEndpoint property. + * + * @return the serviceEndpoint value. + */ + public String getServiceEndpoint() { + return this.serviceEndpoint; + } + + /** + * Set the serviceEndpoint property: The ServiceEndpoint property. + * + * @param serviceEndpoint the serviceEndpoint value to set. + * @return the BlobContainersSegment object itself. + */ + public BlobContainersSegment setServiceEndpoint(String serviceEndpoint) { + this.serviceEndpoint = serviceEndpoint; + return this; + } + + /** + * Get the prefix property: The Prefix property. + * + * @return the prefix value. + */ + public String getPrefix() { + return this.prefix; + } + + /** + * Set the prefix property: The Prefix property. + * + * @param prefix the prefix value to set. + * @return the BlobContainersSegment object itself. + */ + public BlobContainersSegment setPrefix(String prefix) { + this.prefix = prefix; + return this; + } + + /** + * Get the marker property: The Marker property. + * + * @return the marker value. + */ + public String getMarker() { + return this.marker; + } + + /** + * Set the marker property: The Marker property. + * + * @param marker the marker value to set. + * @return the BlobContainersSegment object itself. + */ + public BlobContainersSegment setMarker(String marker) { + this.marker = marker; + return this; + } + + /** + * Get the maxResults property: The MaxResults property. + * + * @return the maxResults value. + */ + public Integer getMaxResults() { + return this.maxResults; + } + + /** + * Set the maxResults property: The MaxResults property. + * + * @param maxResults the maxResults value to set. + * @return the BlobContainersSegment object itself. + */ + public BlobContainersSegment setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the nextMarker property: The NextMarker property. + * + * @return the nextMarker value. + */ + public String getNextMarker() { + return this.nextMarker; + } + + /** + * Set the nextMarker property: The NextMarker property. + * + * @param nextMarker the nextMarker value to set. + * @return the BlobContainersSegment object itself. + */ + public BlobContainersSegment setNextMarker(String nextMarker) { + this.nextMarker = nextMarker; + return this; + } + + /** + * Get the blobContainerItems property: The BlobContainerItems property. + * + * @return the blobContainerItems value. + */ + public List getBlobContainerItems() { + if (this.blobContainerItems == null) { + this.blobContainerItems = new ArrayList<>(); + } + return this.blobContainerItems; + } + + /** + * Set the blobContainerItems property: The BlobContainerItems property. + * + * @param blobContainerItems the blobContainerItems value to set. + * @return the BlobContainersSegment object itself. + */ + public BlobContainersSegment setBlobContainerItems(List blobContainerItems) { + this.blobContainerItems = blobContainerItems; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "EnumerationResults" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringAttribute("ServiceEndpoint", this.serviceEndpoint); + xmlWriter.writeStringElement("Prefix", this.prefix); + xmlWriter.writeStringElement("Marker", this.marker); + xmlWriter.writeNumberElement("MaxResults", this.maxResults); + xmlWriter.writeStringElement("NextMarker", this.nextMarker); + if (this.blobContainerItems != null) { + xmlWriter.writeStartElement("Containers"); + for (BlobContainerItem element : this.blobContainerItems) { + xmlWriter.writeXml(element, "Container"); + } + xmlWriter.writeEndElement(); + } + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobContainersSegment from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobContainersSegment if the XmlReader was pointing to an instance of it, or null if it + * was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobContainersSegment. + */ + public static BlobContainersSegment fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobContainersSegment from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobContainersSegment if the XmlReader was pointing to an instance of it, or null if it + * was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobContainersSegment. + */ + public static BlobContainersSegment fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "EnumerationResults" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobContainersSegment deserializedBlobContainersSegment = new BlobContainersSegment(); + deserializedBlobContainersSegment.serviceEndpoint = reader.getStringAttribute(null, "ServiceEndpoint"); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Prefix".equals(elementName.getLocalPart())) { + deserializedBlobContainersSegment.prefix = reader.getStringElement(); + } else if ("Marker".equals(elementName.getLocalPart())) { + deserializedBlobContainersSegment.marker = reader.getStringElement(); + } else if ("MaxResults".equals(elementName.getLocalPart())) { + deserializedBlobContainersSegment.maxResults = reader.getNullableElement(Integer::parseInt); + } else if ("NextMarker".equals(elementName.getLocalPart())) { + deserializedBlobContainersSegment.nextMarker = reader.getStringElement(); + } else if ("Containers".equals(elementName.getLocalPart())) { + while (reader.nextElement() != XmlToken.END_ELEMENT) { + elementName = reader.getElementName(); + if ("Container".equals(elementName.getLocalPart())) { + if (deserializedBlobContainersSegment.blobContainerItems == null) { + deserializedBlobContainersSegment.blobContainerItems = new ArrayList<>(); + } + deserializedBlobContainersSegment.blobContainerItems + .add(BlobContainerItem.fromXml(reader, "Container")); + } else { + reader.skipElement(); + } + } + } else { + reader.skipElement(); + } + } + + return deserializedBlobContainersSegment; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobCopySourceTagsMode.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobCopySourceTagsMode.java new file mode 100644 index 000000000000..5eecd5be65a7 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobCopySourceTagsMode.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.utils.ExpandableEnum; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +/** + * Defines values for BlobCopySourceTagsMode. + */ +public final class BlobCopySourceTagsMode implements ExpandableEnum { + private static final Map VALUES = new ConcurrentHashMap<>(); + + private static final Function NEW_INSTANCE = BlobCopySourceTagsMode::new; + + /** + * Static value REPLACE for BlobCopySourceTagsMode. + */ + public static final BlobCopySourceTagsMode REPLACE = fromValue("REPLACE"); + + /** + * Static value COPY for BlobCopySourceTagsMode. + */ + public static final BlobCopySourceTagsMode COPY = fromValue("COPY"); + + private final String value; + + private BlobCopySourceTagsMode(String value) { + this.value = value; + } + + /** + * Creates or finds a BlobCopySourceTagsMode. + * + * @param value a value to look for. + * @return the corresponding BlobCopySourceTagsMode. + * @throws IllegalArgumentException if value is null. + */ + public static BlobCopySourceTagsMode fromValue(String value) { + if (value == null) { + throw new IllegalArgumentException("'value' cannot be null."); + } + return VALUES.computeIfAbsent(value, NEW_INSTANCE); + } + + /** + * Gets known BlobCopySourceTagsMode values. + * + * @return Known BlobCopySourceTagsMode values. + */ + public static Collection values() { + return new ArrayList<>(VALUES.values()); + } + + /** + * Gets the value of the BlobCopySourceTagsMode instance. + * + * @return the value of the BlobCopySourceTagsMode instance. + */ + @Override + public String getValue() { + return this.value; + } + + @Override + public String toString() { + return Objects.toString(this.value); + } + + @Override + public boolean equals(Object obj) { + return this == obj; + } + + @Override + public int hashCode() { + return Objects.hashCode(this.value); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobCorsRule.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobCorsRule.java new file mode 100644 index 000000000000..ac82ffeaa20e --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobCorsRule.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * CORS is an HTTP feature that enables a web application running under one domain to access resources in another + * domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from + * calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs + * in another domain. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobCorsRule implements XmlSerializable { + /* + * The origin domains that are permitted to make a request against the storage service via CORS. The origin domain + * is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with + * the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all + * origin domains to make requests via CORS. + */ + private String allowedOrigins; + + /* + * The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated) + */ + private String allowedMethods; + + /* + * the request headers that the origin domain may specify on the CORS request. + */ + private String allowedHeaders; + + /* + * The response headers that may be sent in the response to the CORS request and exposed by the browser to the + * request issuer + */ + private String exposedHeaders; + + /* + * The maximum amount time that a browser should cache the preflight OPTIONS request. + */ + private int maxAgeInSeconds; + + /** + * Creates an instance of BlobCorsRule class. + */ + public BlobCorsRule() { + } + + /** + * Get the allowedOrigins property: The origin domains that are permitted to make a request against the storage + * service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be + * an exact case-sensitive match with the origin that the user age sends to the service. You can also use the + * wildcard character '*' to allow all origin domains to make requests via CORS. + * + * @return the allowedOrigins value. + */ + public String getAllowedOrigins() { + return this.allowedOrigins; + } + + /** + * Set the allowedOrigins property: The origin domains that are permitted to make a request against the storage + * service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be + * an exact case-sensitive match with the origin that the user age sends to the service. You can also use the + * wildcard character '*' to allow all origin domains to make requests via CORS. + * + * @param allowedOrigins the allowedOrigins value to set. + * @return the BlobCorsRule object itself. + */ + public BlobCorsRule setAllowedOrigins(String allowedOrigins) { + this.allowedOrigins = allowedOrigins; + return this; + } + + /** + * Get the allowedMethods property: The methods (HTTP request verbs) that the origin domain may use for a CORS + * request. (comma separated). + * + * @return the allowedMethods value. + */ + public String getAllowedMethods() { + return this.allowedMethods; + } + + /** + * Set the allowedMethods property: The methods (HTTP request verbs) that the origin domain may use for a CORS + * request. (comma separated). + * + * @param allowedMethods the allowedMethods value to set. + * @return the BlobCorsRule object itself. + */ + public BlobCorsRule setAllowedMethods(String allowedMethods) { + this.allowedMethods = allowedMethods; + return this; + } + + /** + * Get the allowedHeaders property: the request headers that the origin domain may specify on the CORS request. + * + * @return the allowedHeaders value. + */ + public String getAllowedHeaders() { + return this.allowedHeaders; + } + + /** + * Set the allowedHeaders property: the request headers that the origin domain may specify on the CORS request. + * + * @param allowedHeaders the allowedHeaders value to set. + * @return the BlobCorsRule object itself. + */ + public BlobCorsRule setAllowedHeaders(String allowedHeaders) { + this.allowedHeaders = allowedHeaders; + return this; + } + + /** + * Get the exposedHeaders property: The response headers that may be sent in the response to the CORS request and + * exposed by the browser to the request issuer. + * + * @return the exposedHeaders value. + */ + public String getExposedHeaders() { + return this.exposedHeaders; + } + + /** + * Set the exposedHeaders property: The response headers that may be sent in the response to the CORS request and + * exposed by the browser to the request issuer. + * + * @param exposedHeaders the exposedHeaders value to set. + * @return the BlobCorsRule object itself. + */ + public BlobCorsRule setExposedHeaders(String exposedHeaders) { + this.exposedHeaders = exposedHeaders; + return this; + } + + /** + * Get the maxAgeInSeconds property: The maximum amount time that a browser should cache the preflight OPTIONS + * request. + * + * @return the maxAgeInSeconds value. + */ + public int getMaxAgeInSeconds() { + return this.maxAgeInSeconds; + } + + /** + * Set the maxAgeInSeconds property: The maximum amount time that a browser should cache the preflight OPTIONS + * request. + * + * @param maxAgeInSeconds the maxAgeInSeconds value to set. + * @return the BlobCorsRule object itself. + */ + public BlobCorsRule setMaxAgeInSeconds(int maxAgeInSeconds) { + this.maxAgeInSeconds = maxAgeInSeconds; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "CorsRule" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("AllowedOrigins", this.allowedOrigins); + xmlWriter.writeStringElement("AllowedMethods", this.allowedMethods); + xmlWriter.writeStringElement("AllowedHeaders", this.allowedHeaders); + xmlWriter.writeStringElement("ExposedHeaders", this.exposedHeaders); + xmlWriter.writeIntElement("MaxAgeInSeconds", this.maxAgeInSeconds); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobCorsRule from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobCorsRule if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobCorsRule. + */ + public static BlobCorsRule fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobCorsRule from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobCorsRule if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobCorsRule. + */ + public static BlobCorsRule fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "CorsRule" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobCorsRule deserializedBlobCorsRule = new BlobCorsRule(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("AllowedOrigins".equals(elementName.getLocalPart())) { + deserializedBlobCorsRule.allowedOrigins = reader.getStringElement(); + } else if ("AllowedMethods".equals(elementName.getLocalPart())) { + deserializedBlobCorsRule.allowedMethods = reader.getStringElement(); + } else if ("AllowedHeaders".equals(elementName.getLocalPart())) { + deserializedBlobCorsRule.allowedHeaders = reader.getStringElement(); + } else if ("ExposedHeaders".equals(elementName.getLocalPart())) { + deserializedBlobCorsRule.exposedHeaders = reader.getStringElement(); + } else if ("MaxAgeInSeconds".equals(elementName.getLocalPart())) { + deserializedBlobCorsRule.maxAgeInSeconds = reader.getIntElement(); + } else { + reader.skipElement(); + } + } + + return deserializedBlobCorsRule; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobDeleteType.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobDeleteType.java new file mode 100644 index 000000000000..a2d413b70535 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobDeleteType.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.utils.ExpandableEnum; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +/** + * Defines values for BlobDeleteType. + */ +public final class BlobDeleteType implements ExpandableEnum { + private static final Map VALUES = new ConcurrentHashMap<>(); + + private static final Function NEW_INSTANCE = BlobDeleteType::new; + + /** + * Static value Permanent for BlobDeleteType. + */ + public static final BlobDeleteType PERMANENT = fromValue("Permanent"); + + private final String value; + + private BlobDeleteType(String value) { + this.value = value; + } + + /** + * Creates or finds a BlobDeleteType. + * + * @param value a value to look for. + * @return the corresponding BlobDeleteType. + * @throws IllegalArgumentException if value is null. + */ + public static BlobDeleteType fromValue(String value) { + if (value == null) { + throw new IllegalArgumentException("'value' cannot be null."); + } + return VALUES.computeIfAbsent(value, NEW_INSTANCE); + } + + /** + * Gets known BlobDeleteType values. + * + * @return Known BlobDeleteType values. + */ + public static Collection values() { + return new ArrayList<>(VALUES.values()); + } + + /** + * Gets the value of the BlobDeleteType instance. + * + * @return the value of the BlobDeleteType instance. + */ + @Override + public String getValue() { + return this.value; + } + + @Override + public String toString() { + return Objects.toString(this.value); + } + + @Override + public boolean equals(Object obj) { + return this == obj; + } + + @Override + public int hashCode() { + return Objects.hashCode(this.value); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobErrorCode.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobErrorCode.java new file mode 100644 index 000000000000..85a8c7494638 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobErrorCode.java @@ -0,0 +1,678 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.utils.ExpandableEnum; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +/** + * Error codes returned by the service. + */ +public final class BlobErrorCode implements ExpandableEnum { + private static final Map VALUES = new ConcurrentHashMap<>(); + + private static final Function NEW_INSTANCE = BlobErrorCode::new; + + /** + * Static value AccountAlreadyExists for BlobErrorCode. + */ + public static final BlobErrorCode ACCOUNT_ALREADY_EXISTS = fromValue("AccountAlreadyExists"); + + /** + * Static value AccountBeingCreated for BlobErrorCode. + */ + public static final BlobErrorCode ACCOUNT_BEING_CREATED = fromValue("AccountBeingCreated"); + + /** + * Static value AccountIsDisabled for BlobErrorCode. + */ + public static final BlobErrorCode ACCOUNT_IS_DISABLED = fromValue("AccountIsDisabled"); + + /** + * Static value AuthenticationFailed for BlobErrorCode. + */ + public static final BlobErrorCode AUTHENTICATION_FAILED = fromValue("AuthenticationFailed"); + + /** + * Static value AuthorizationFailure for BlobErrorCode. + */ + public static final BlobErrorCode AUTHORIZATION_FAILURE = fromValue("AuthorizationFailure"); + + /** + * Static value ConditionHeadersNotSupported for BlobErrorCode. + */ + public static final BlobErrorCode CONDITION_HEADERS_NOT_SUPPORTED = fromValue("ConditionHeadersNotSupported"); + + /** + * Static value ConditionNotMet for BlobErrorCode. + */ + public static final BlobErrorCode CONDITION_NOT_MET = fromValue("ConditionNotMet"); + + /** + * Static value EmptyMetadataKey for BlobErrorCode. + */ + public static final BlobErrorCode EMPTY_METADATA_KEY = fromValue("EmptyMetadataKey"); + + /** + * Static value InsufficientAccountPermissions for BlobErrorCode. + */ + public static final BlobErrorCode INSUFFICIENT_ACCOUNT_PERMISSIONS = fromValue("InsufficientAccountPermissions"); + + /** + * Static value InternalError for BlobErrorCode. + */ + public static final BlobErrorCode INTERNAL_ERROR = fromValue("InternalError"); + + /** + * Static value InvalidAuthenticationInfo for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_AUTHENTICATION_INFO = fromValue("InvalidAuthenticationInfo"); + + /** + * Static value InvalidHeaderValue for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_HEADER_VALUE = fromValue("InvalidHeaderValue"); + + /** + * Static value InvalidHttpVerb for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_HTTP_VERB = fromValue("InvalidHttpVerb"); + + /** + * Static value InvalidInput for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_INPUT = fromValue("InvalidInput"); + + /** + * Static value InvalidMd5 for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_MD5 = fromValue("InvalidMd5"); + + /** + * Static value InvalidMetadata for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_METADATA = fromValue("InvalidMetadata"); + + /** + * Static value InvalidQueryParameterValue for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_QUERY_PARAMETER_VALUE = fromValue("InvalidQueryParameterValue"); + + /** + * Static value InvalidRange for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_RANGE = fromValue("InvalidRange"); + + /** + * Static value InvalidResourceName for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_RESOURCE_NAME = fromValue("InvalidResourceName"); + + /** + * Static value InvalidUri for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_URI = fromValue("InvalidUri"); + + /** + * Static value InvalidXmlDocument for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_XML_DOCUMENT = fromValue("InvalidXmlDocument"); + + /** + * Static value InvalidXmlNodeValue for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_XML_NODE_VALUE = fromValue("InvalidXmlNodeValue"); + + /** + * Static value Md5Mismatch for BlobErrorCode. + */ + public static final BlobErrorCode MD5MISMATCH = fromValue("Md5Mismatch"); + + /** + * Static value MetadataTooLarge for BlobErrorCode. + */ + public static final BlobErrorCode METADATA_TOO_LARGE = fromValue("MetadataTooLarge"); + + /** + * Static value MissingContentLengthHeader for BlobErrorCode. + */ + public static final BlobErrorCode MISSING_CONTENT_LENGTH_HEADER = fromValue("MissingContentLengthHeader"); + + /** + * Static value MissingRequiredQueryParameter for BlobErrorCode. + */ + public static final BlobErrorCode MISSING_REQUIRED_QUERY_PARAMETER = fromValue("MissingRequiredQueryParameter"); + + /** + * Static value MissingRequiredHeader for BlobErrorCode. + */ + public static final BlobErrorCode MISSING_REQUIRED_HEADER = fromValue("MissingRequiredHeader"); + + /** + * Static value MissingRequiredXmlNode for BlobErrorCode. + */ + public static final BlobErrorCode MISSING_REQUIRED_XML_NODE = fromValue("MissingRequiredXmlNode"); + + /** + * Static value MultipleConditionHeadersNotSupported for BlobErrorCode. + */ + public static final BlobErrorCode MULTIPLE_CONDITION_HEADERS_NOT_SUPPORTED + = fromValue("MultipleConditionHeadersNotSupported"); + + /** + * Static value OperationTimedOut for BlobErrorCode. + */ + public static final BlobErrorCode OPERATION_TIMED_OUT = fromValue("OperationTimedOut"); + + /** + * Static value OutOfRangeInput for BlobErrorCode. + */ + public static final BlobErrorCode OUT_OF_RANGE_INPUT = fromValue("OutOfRangeInput"); + + /** + * Static value OutOfRangeQueryParameterValue for BlobErrorCode. + */ + public static final BlobErrorCode OUT_OF_RANGE_QUERY_PARAMETER_VALUE = fromValue("OutOfRangeQueryParameterValue"); + + /** + * Static value RequestBodyTooLarge for BlobErrorCode. + */ + public static final BlobErrorCode REQUEST_BODY_TOO_LARGE = fromValue("RequestBodyTooLarge"); + + /** + * Static value ResourceTypeMismatch for BlobErrorCode. + */ + public static final BlobErrorCode RESOURCE_TYPE_MISMATCH = fromValue("ResourceTypeMismatch"); + + /** + * Static value RequestUrlFailedToParse for BlobErrorCode. + */ + public static final BlobErrorCode REQUEST_URL_FAILED_TO_PARSE = fromValue("RequestUrlFailedToParse"); + + /** + * Static value ResourceAlreadyExists for BlobErrorCode. + */ + public static final BlobErrorCode RESOURCE_ALREADY_EXISTS = fromValue("ResourceAlreadyExists"); + + /** + * Static value ResourceNotFound for BlobErrorCode. + */ + public static final BlobErrorCode RESOURCE_NOT_FOUND = fromValue("ResourceNotFound"); + + /** + * Static value ServerBusy for BlobErrorCode. + */ + public static final BlobErrorCode SERVER_BUSY = fromValue("ServerBusy"); + + /** + * Static value UnsupportedHeader for BlobErrorCode. + */ + public static final BlobErrorCode UNSUPPORTED_HEADER = fromValue("UnsupportedHeader"); + + /** + * Static value UnsupportedXmlNode for BlobErrorCode. + */ + public static final BlobErrorCode UNSUPPORTED_XML_NODE = fromValue("UnsupportedXmlNode"); + + /** + * Static value UnsupportedQueryParameter for BlobErrorCode. + */ + public static final BlobErrorCode UNSUPPORTED_QUERY_PARAMETER = fromValue("UnsupportedQueryParameter"); + + /** + * Static value UnsupportedHttpVerb for BlobErrorCode. + */ + public static final BlobErrorCode UNSUPPORTED_HTTP_VERB = fromValue("UnsupportedHttpVerb"); + + /** + * Static value AppendPositionConditionNotMet for BlobErrorCode. + */ + public static final BlobErrorCode APPEND_POSITION_CONDITION_NOT_MET = fromValue("AppendPositionConditionNotMet"); + + /** + * Static value BlobAlreadyExists for BlobErrorCode. + */ + public static final BlobErrorCode BLOB_ALREADY_EXISTS = fromValue("BlobAlreadyExists"); + + /** + * Static value BlobImmutableDueToPolicy for BlobErrorCode. + */ + public static final BlobErrorCode BLOB_IMMUTABLE_DUE_TO_POLICY = fromValue("BlobImmutableDueToPolicy"); + + /** + * Static value BlobNotFound for BlobErrorCode. + */ + public static final BlobErrorCode BLOB_NOT_FOUND = fromValue("BlobNotFound"); + + /** + * Static value BlobOverwritten for BlobErrorCode. + */ + public static final BlobErrorCode BLOB_OVERWRITTEN = fromValue("BlobOverwritten"); + + /** + * Static value BlobTierInadequateForContentLength for BlobErrorCode. + */ + public static final BlobErrorCode BLOB_TIER_INADEQUATE_FOR_CONTENT_LENGTH + = fromValue("BlobTierInadequateForContentLength"); + + /** + * Static value BlobUsesCustomerSpecifiedEncryption for BlobErrorCode. + */ + public static final BlobErrorCode BLOB_USES_CUSTOMER_SPECIFIED_ENCRYPTION + = fromValue("BlobUsesCustomerSpecifiedEncryption"); + + /** + * Static value BlockCountExceedsLimit for BlobErrorCode. + */ + public static final BlobErrorCode BLOCK_COUNT_EXCEEDS_LIMIT = fromValue("BlockCountExceedsLimit"); + + /** + * Static value BlockListTooLong for BlobErrorCode. + */ + public static final BlobErrorCode BLOCK_LIST_TOO_LONG = fromValue("BlockListTooLong"); + + /** + * Static value CannotChangeToLowerTier for BlobErrorCode. + */ + public static final BlobErrorCode CANNOT_CHANGE_TO_LOWER_TIER = fromValue("CannotChangeToLowerTier"); + + /** + * Static value CannotVerifyCopySource for BlobErrorCode. + */ + public static final BlobErrorCode CANNOT_VERIFY_COPY_SOURCE = fromValue("CannotVerifyCopySource"); + + /** + * Static value ContainerAlreadyExists for BlobErrorCode. + */ + public static final BlobErrorCode CONTAINER_ALREADY_EXISTS = fromValue("ContainerAlreadyExists"); + + /** + * Static value ContainerBeingDeleted for BlobErrorCode. + */ + public static final BlobErrorCode CONTAINER_BEING_DELETED = fromValue("ContainerBeingDeleted"); + + /** + * Static value ContainerDisabled for BlobErrorCode. + */ + public static final BlobErrorCode CONTAINER_DISABLED = fromValue("ContainerDisabled"); + + /** + * Static value ContainerNotFound for BlobErrorCode. + */ + public static final BlobErrorCode CONTAINER_NOT_FOUND = fromValue("ContainerNotFound"); + + /** + * Static value ContentLengthLargerThanTierLimit for BlobErrorCode. + */ + public static final BlobErrorCode CONTENT_LENGTH_LARGER_THAN_TIER_LIMIT + = fromValue("ContentLengthLargerThanTierLimit"); + + /** + * Static value CopyAcrossAccountsNotSupported for BlobErrorCode. + */ + public static final BlobErrorCode COPY_ACROSS_ACCOUNTS_NOT_SUPPORTED = fromValue("CopyAcrossAccountsNotSupported"); + + /** + * Static value CopyIdMismatch for BlobErrorCode. + */ + public static final BlobErrorCode COPY_ID_MISMATCH = fromValue("CopyIdMismatch"); + + /** + * Static value FeatureVersionMismatch for BlobErrorCode. + */ + public static final BlobErrorCode FEATURE_VERSION_MISMATCH = fromValue("FeatureVersionMismatch"); + + /** + * Static value IncrementalCopyBlobMismatch for BlobErrorCode. + */ + public static final BlobErrorCode INCREMENTAL_COPY_BLOB_MISMATCH = fromValue("IncrementalCopyBlobMismatch"); + + /** + * Static value IncrementalCopyOfEarlierVersionSnapshotNotAllowed for BlobErrorCode. + */ + public static final BlobErrorCode INCREMENTAL_COPY_OF_EARLIER_VERSION_SNAPSHOT_NOT_ALLOWED + = fromValue("IncrementalCopyOfEarlierVersionSnapshotNotAllowed"); + + /** + * Static value IncrementalCopySourceMustBeSnapshot for BlobErrorCode. + */ + public static final BlobErrorCode INCREMENTAL_COPY_SOURCE_MUST_BE_SNAPSHOT + = fromValue("IncrementalCopySourceMustBeSnapshot"); + + /** + * Static value InfiniteLeaseDurationRequired for BlobErrorCode. + */ + public static final BlobErrorCode INFINITE_LEASE_DURATION_REQUIRED = fromValue("InfiniteLeaseDurationRequired"); + + /** + * Static value InvalidBlobOrBlock for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_BLOB_OR_BLOCK = fromValue("InvalidBlobOrBlock"); + + /** + * Static value InvalidBlobTier for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_BLOB_TIER = fromValue("InvalidBlobTier"); + + /** + * Static value InvalidBlobType for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_BLOB_TYPE = fromValue("InvalidBlobType"); + + /** + * Static value InvalidBlockId for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_BLOCK_ID = fromValue("InvalidBlockId"); + + /** + * Static value InvalidBlockList for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_BLOCK_LIST = fromValue("InvalidBlockList"); + + /** + * Static value InvalidOperation for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_OPERATION = fromValue("InvalidOperation"); + + /** + * Static value InvalidPageRange for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_PAGE_RANGE = fromValue("InvalidPageRange"); + + /** + * Static value InvalidSourceBlobType for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_SOURCE_BLOB_TYPE = fromValue("InvalidSourceBlobType"); + + /** + * Static value InvalidSourceBlobUrl for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_SOURCE_BLOB_URL = fromValue("InvalidSourceBlobUrl"); + + /** + * Static value InvalidVersionForPageBlobOperation for BlobErrorCode. + */ + public static final BlobErrorCode INVALID_VERSION_FOR_PAGE_BLOB_OPERATION + = fromValue("InvalidVersionForPageBlobOperation"); + + /** + * Static value LeaseAlreadyPresent for BlobErrorCode. + */ + public static final BlobErrorCode LEASE_ALREADY_PRESENT = fromValue("LeaseAlreadyPresent"); + + /** + * Static value LeaseAlreadyBroken for BlobErrorCode. + */ + public static final BlobErrorCode LEASE_ALREADY_BROKEN = fromValue("LeaseAlreadyBroken"); + + /** + * Static value LeaseIdMismatchWithBlobOperation for BlobErrorCode. + */ + public static final BlobErrorCode LEASE_ID_MISMATCH_WITH_BLOB_OPERATION + = fromValue("LeaseIdMismatchWithBlobOperation"); + + /** + * Static value LeaseIdMismatchWithContainerOperation for BlobErrorCode. + */ + public static final BlobErrorCode LEASE_ID_MISMATCH_WITH_CONTAINER_OPERATION + = fromValue("LeaseIdMismatchWithContainerOperation"); + + /** + * Static value LeaseIdMismatchWithLeaseOperation for BlobErrorCode. + */ + public static final BlobErrorCode LEASE_ID_MISMATCH_WITH_LEASE_OPERATION + = fromValue("LeaseIdMismatchWithLeaseOperation"); + + /** + * Static value LeaseIdMissing for BlobErrorCode. + */ + public static final BlobErrorCode LEASE_ID_MISSING = fromValue("LeaseIdMissing"); + + /** + * Static value LeaseIsBreakingAndCannotBeAcquired for BlobErrorCode. + */ + public static final BlobErrorCode LEASE_IS_BREAKING_AND_CANNOT_BE_ACQUIRED + = fromValue("LeaseIsBreakingAndCannotBeAcquired"); + + /** + * Static value LeaseIsBreakingAndCannotBeChanged for BlobErrorCode. + */ + public static final BlobErrorCode LEASE_IS_BREAKING_AND_CANNOT_BE_CHANGED + = fromValue("LeaseIsBreakingAndCannotBeChanged"); + + /** + * Static value LeaseIsBrokenAndCannotBeRenewed for BlobErrorCode. + */ + public static final BlobErrorCode LEASE_IS_BROKEN_AND_CANNOT_BE_RENEWED + = fromValue("LeaseIsBrokenAndCannotBeRenewed"); + + /** + * Static value LeaseLost for BlobErrorCode. + */ + public static final BlobErrorCode LEASE_LOST = fromValue("LeaseLost"); + + /** + * Static value LeaseNotPresentWithBlobOperation for BlobErrorCode. + */ + public static final BlobErrorCode LEASE_NOT_PRESENT_WITH_BLOB_OPERATION + = fromValue("LeaseNotPresentWithBlobOperation"); + + /** + * Static value LeaseNotPresentWithContainerOperation for BlobErrorCode. + */ + public static final BlobErrorCode LEASE_NOT_PRESENT_WITH_CONTAINER_OPERATION + = fromValue("LeaseNotPresentWithContainerOperation"); + + /** + * Static value LeaseNotPresentWithLeaseOperation for BlobErrorCode. + */ + public static final BlobErrorCode LEASE_NOT_PRESENT_WITH_LEASE_OPERATION + = fromValue("LeaseNotPresentWithLeaseOperation"); + + /** + * Static value MaxBlobSizeConditionNotMet for BlobErrorCode. + */ + public static final BlobErrorCode MAX_BLOB_SIZE_CONDITION_NOT_MET = fromValue("MaxBlobSizeConditionNotMet"); + + /** + * Static value NoAuthenticationInformation for BlobErrorCode. + */ + public static final BlobErrorCode NO_AUTHENTICATION_INFORMATION = fromValue("NoAuthenticationInformation"); + + /** + * Static value NoPendingCopyOperation for BlobErrorCode. + */ + public static final BlobErrorCode NO_PENDING_COPY_OPERATION = fromValue("NoPendingCopyOperation"); + + /** + * Static value OperationNotAllowedOnIncrementalCopyBlob for BlobErrorCode. + */ + public static final BlobErrorCode OPERATION_NOT_ALLOWED_ON_INCREMENTAL_COPY_BLOB + = fromValue("OperationNotAllowedOnIncrementalCopyBlob"); + + /** + * Static value PendingCopyOperation for BlobErrorCode. + */ + public static final BlobErrorCode PENDING_COPY_OPERATION = fromValue("PendingCopyOperation"); + + /** + * Static value PreviousSnapshotCannotBeNewer for BlobErrorCode. + */ + public static final BlobErrorCode PREVIOUS_SNAPSHOT_CANNOT_BE_NEWER = fromValue("PreviousSnapshotCannotBeNewer"); + + /** + * Static value PreviousSnapshotNotFound for BlobErrorCode. + */ + public static final BlobErrorCode PREVIOUS_SNAPSHOT_NOT_FOUND = fromValue("PreviousSnapshotNotFound"); + + /** + * Static value PreviousSnapshotOperationNotSupported for BlobErrorCode. + */ + public static final BlobErrorCode PREVIOUS_SNAPSHOT_OPERATION_NOT_SUPPORTED + = fromValue("PreviousSnapshotOperationNotSupported"); + + /** + * Static value SequenceNumberConditionNotMet for BlobErrorCode. + */ + public static final BlobErrorCode SEQUENCE_NUMBER_CONDITION_NOT_MET = fromValue("SequenceNumberConditionNotMet"); + + /** + * Static value SequenceNumberIncrementTooLarge for BlobErrorCode. + */ + public static final BlobErrorCode SEQUENCE_NUMBER_INCREMENT_TOO_LARGE + = fromValue("SequenceNumberIncrementTooLarge"); + + /** + * Static value SnapshotCountExceeded for BlobErrorCode. + */ + public static final BlobErrorCode SNAPSHOT_COUNT_EXCEEDED = fromValue("SnapshotCountExceeded"); + + /** + * Static value SnapshotOperationRateExceeded for BlobErrorCode. + */ + public static final BlobErrorCode SNAPSHOT_OPERATION_RATE_EXCEEDED = fromValue("SnapshotOperationRateExceeded"); + + /** + * Static value SnapshotsPresent for BlobErrorCode. + */ + public static final BlobErrorCode SNAPSHOTS_PRESENT = fromValue("SnapshotsPresent"); + + /** + * Static value SourceConditionNotMet for BlobErrorCode. + */ + public static final BlobErrorCode SOURCE_CONDITION_NOT_MET = fromValue("SourceConditionNotMet"); + + /** + * Static value SystemInUse for BlobErrorCode. + */ + public static final BlobErrorCode SYSTEM_IN_USE = fromValue("SystemInUse"); + + /** + * Static value TargetConditionNotMet for BlobErrorCode. + */ + public static final BlobErrorCode TARGET_CONDITION_NOT_MET = fromValue("TargetConditionNotMet"); + + /** + * Static value UnauthorizedBlobOverwrite for BlobErrorCode. + */ + public static final BlobErrorCode UNAUTHORIZED_BLOB_OVERWRITE = fromValue("UnauthorizedBlobOverwrite"); + + /** + * Static value BlobBeingRehydrated for BlobErrorCode. + */ + public static final BlobErrorCode BLOB_BEING_REHYDRATED = fromValue("BlobBeingRehydrated"); + + /** + * Static value BlobArchived for BlobErrorCode. + */ + public static final BlobErrorCode BLOB_ARCHIVED = fromValue("BlobArchived"); + + /** + * Static value BlobNotArchived for BlobErrorCode. + */ + public static final BlobErrorCode BLOB_NOT_ARCHIVED = fromValue("BlobNotArchived"); + + /** + * Static value AuthorizationSourceIPMismatch for BlobErrorCode. + */ + public static final BlobErrorCode AUTHORIZATION_SOURCE_IPMISMATCH = fromValue("AuthorizationSourceIPMismatch"); + + /** + * Static value AuthorizationProtocolMismatch for BlobErrorCode. + */ + public static final BlobErrorCode AUTHORIZATION_PROTOCOL_MISMATCH = fromValue("AuthorizationProtocolMismatch"); + + /** + * Static value AuthorizationPermissionMismatch for BlobErrorCode. + */ + public static final BlobErrorCode AUTHORIZATION_PERMISSION_MISMATCH = fromValue("AuthorizationPermissionMismatch"); + + /** + * Static value AuthorizationServiceMismatch for BlobErrorCode. + */ + public static final BlobErrorCode AUTHORIZATION_SERVICE_MISMATCH = fromValue("AuthorizationServiceMismatch"); + + /** + * Static value AuthorizationResourceTypeMismatch for BlobErrorCode. + */ + public static final BlobErrorCode AUTHORIZATION_RESOURCE_TYPE_MISMATCH + = fromValue("AuthorizationResourceTypeMismatch"); + + /** + * Static value BlobAccessTierNotSupportedForAccountType for BlobErrorCode. + */ + public static final BlobErrorCode BLOB_ACCESS_TIER_NOT_SUPPORTED_FOR_ACCOUNT_TYPE + = fromValue("BlobAccessTierNotSupportedForAccountType"); + + /** + * Static value SnaphotOperationRateExceeded for BlobErrorCode. + */ + public static final BlobErrorCode SNAPHOT_OPERATION_RATE_EXCEEDED = fromValue("SnaphotOperationRateExceeded"); + + /** + * Static value IncrementalCopyOfEralierVersionSnapshotNotAllowed for BlobErrorCode. + */ + public static final BlobErrorCode INCREMENTAL_COPY_OF_ERALIER_VERSION_SNAPSHOT_NOT_ALLOWED + = fromValue("IncrementalCopyOfEralierVersionSnapshotNotAllowed"); + + private final String value; + + private BlobErrorCode(String value) { + this.value = value; + } + + /** + * Creates or finds a BlobErrorCode. + * + * @param value a value to look for. + * @return the corresponding BlobErrorCode. + * @throws IllegalArgumentException if value is null. + */ + public static BlobErrorCode fromValue(String value) { + if (value == null) { + throw new IllegalArgumentException("'value' cannot be null."); + } + return VALUES.computeIfAbsent(value, NEW_INSTANCE); + } + + /** + * Gets known BlobErrorCode values. + * + * @return Known BlobErrorCode values. + */ + public static Collection values() { + return new ArrayList<>(VALUES.values()); + } + + /** + * Gets the value of the BlobErrorCode instance. + * + * @return the value of the BlobErrorCode instance. + */ + @Override + public String getValue() { + return this.value; + } + + @Override + public String toString() { + return Objects.toString(this.value); + } + + @Override + public boolean equals(Object obj) { + return this == obj; + } + + @Override + public int hashCode() { + return Objects.hashCode(this.value); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobExpiryOptions.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobExpiryOptions.java new file mode 100644 index 000000000000..4b45b9ad5203 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobExpiryOptions.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.v2.storage.blob.models; + +import io.clientcore.core.utils.ExpandableEnum; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +/** + * Defines values for BlobExpiryOptions. + */ +public final class BlobExpiryOptions implements ExpandableEnum { + private static final Map VALUES = new ConcurrentHashMap<>(); + + private static final Function NEW_INSTANCE = BlobExpiryOptions::new; + + /** + * Static value NeverExpire for BlobExpiryOptions. + */ + public static final BlobExpiryOptions NEVER_EXPIRE = fromValue("NeverExpire"); + + /** + * Static value RelativeToCreation for BlobExpiryOptions. + */ + public static final BlobExpiryOptions RELATIVE_TO_CREATION = fromValue("RelativeToCreation"); + + /** + * Static value RelativeToNow for BlobExpiryOptions. + */ + public static final BlobExpiryOptions RELATIVE_TO_NOW = fromValue("RelativeToNow"); + + /** + * Static value Absolute for BlobExpiryOptions. + */ + public static final BlobExpiryOptions ABSOLUTE = fromValue("Absolute"); + + private final String value; + + private BlobExpiryOptions(String value) { + this.value = value; + } + + /** + * Creates or finds a BlobExpiryOptions. + * + * @param value a value to look for. + * @return the corresponding BlobExpiryOptions. + * @throws IllegalArgumentException if value is null. + */ + public static BlobExpiryOptions fromValue(String value) { + if (value == null) { + throw new IllegalArgumentException("'value' cannot be null."); + } + return VALUES.computeIfAbsent(value, NEW_INSTANCE); + } + + /** + * Gets known BlobExpiryOptions values. + * + * @return Known BlobExpiryOptions values. + */ + public static Collection values() { + return new ArrayList<>(VALUES.values()); + } + + /** + * Gets the value of the BlobExpiryOptions instance. + * + * @return the value of the BlobExpiryOptions instance. + */ + @Override + public String getValue() { + return this.value; + } + + @Override + public String toString() { + return Objects.toString(this.value); + } + + @Override + public boolean equals(Object obj) { + return this == obj; + } + + @Override + public int hashCode() { + return Objects.hashCode(this.value); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobFlatListSegment.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobFlatListSegment.java new file mode 100644 index 000000000000..27ddb51f7856 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobFlatListSegment.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import java.util.ArrayList; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * The BlobFlatListSegment model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobFlatListSegment implements XmlSerializable { + /* + * The BlobItems property. + */ + private List blobItems = new ArrayList<>(); + + /** + * Creates an instance of BlobFlatListSegment class. + */ + public BlobFlatListSegment() { + } + + /** + * Get the blobItems property: The BlobItems property. + * + * @return the blobItems value. + */ + public List getBlobItems() { + return this.blobItems; + } + + /** + * Set the blobItems property: The BlobItems property. + * + * @param blobItems the blobItems value to set. + * @return the BlobFlatListSegment object itself. + */ + public BlobFlatListSegment setBlobItems(List blobItems) { + this.blobItems = blobItems; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "Blobs" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + if (this.blobItems != null) { + for (BlobItemInternal element : this.blobItems) { + xmlWriter.writeXml(element, "Blob"); + } + } + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobFlatListSegment from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobFlatListSegment if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobFlatListSegment. + */ + public static BlobFlatListSegment fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobFlatListSegment from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobFlatListSegment if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobFlatListSegment. + */ + public static BlobFlatListSegment fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "Blobs" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobFlatListSegment deserializedBlobFlatListSegment = new BlobFlatListSegment(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Blob".equals(elementName.getLocalPart())) { + deserializedBlobFlatListSegment.blobItems.add(BlobItemInternal.fromXml(reader, "Blob")); + } else { + reader.skipElement(); + } + } + + return deserializedBlobFlatListSegment; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobHierarchyListSegment.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobHierarchyListSegment.java new file mode 100644 index 000000000000..47538b79e2b9 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobHierarchyListSegment.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import java.util.ArrayList; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * The BlobHierarchyListSegment model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobHierarchyListSegment implements XmlSerializable { + /* + * The BlobPrefixes property. + */ + private List blobPrefixes = new ArrayList<>(); + + /* + * The BlobItems property. + */ + private List blobItems = new ArrayList<>(); + + /** + * Creates an instance of BlobHierarchyListSegment class. + */ + public BlobHierarchyListSegment() { + } + + /** + * Get the blobPrefixes property: The BlobPrefixes property. + * + * @return the blobPrefixes value. + */ + public List getBlobPrefixes() { + return this.blobPrefixes; + } + + /** + * Set the blobPrefixes property: The BlobPrefixes property. + * + * @param blobPrefixes the blobPrefixes value to set. + * @return the BlobHierarchyListSegment object itself. + */ + public BlobHierarchyListSegment setBlobPrefixes(List blobPrefixes) { + this.blobPrefixes = blobPrefixes; + return this; + } + + /** + * Get the blobItems property: The BlobItems property. + * + * @return the blobItems value. + */ + public List getBlobItems() { + return this.blobItems; + } + + /** + * Set the blobItems property: The BlobItems property. + * + * @param blobItems the blobItems value to set. + * @return the BlobHierarchyListSegment object itself. + */ + public BlobHierarchyListSegment setBlobItems(List blobItems) { + this.blobItems = blobItems; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "Blobs" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + if (this.blobPrefixes != null) { + for (BlobPrefixInternal element : this.blobPrefixes) { + xmlWriter.writeXml(element, "BlobPrefix"); + } + } + if (this.blobItems != null) { + for (BlobItemInternal element : this.blobItems) { + xmlWriter.writeXml(element, "Blob"); + } + } + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobHierarchyListSegment from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobHierarchyListSegment if the XmlReader was pointing to an instance of it, or null if it + * was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobHierarchyListSegment. + */ + public static BlobHierarchyListSegment fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobHierarchyListSegment from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobHierarchyListSegment if the XmlReader was pointing to an instance of it, or null if it + * was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobHierarchyListSegment. + */ + public static BlobHierarchyListSegment fromXml(XmlReader xmlReader, String rootElementName) + throws XMLStreamException { + String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "Blobs" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobHierarchyListSegment deserializedBlobHierarchyListSegment = new BlobHierarchyListSegment(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("BlobPrefix".equals(elementName.getLocalPart())) { + deserializedBlobHierarchyListSegment.blobPrefixes + .add(BlobPrefixInternal.fromXml(reader, "BlobPrefix")); + } else if ("Blob".equals(elementName.getLocalPart())) { + deserializedBlobHierarchyListSegment.blobItems.add(BlobItemInternal.fromXml(reader, "Blob")); + } else { + reader.skipElement(); + } + } + + return deserializedBlobHierarchyListSegment; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobHttpHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobHttpHeaders.java new file mode 100644 index 000000000000..7aca03e9c0de --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobHttpHeaders.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; + +/** + * Parameter group. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobHttpHeaders { + /* + * Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a + * read request. + */ + private String cacheControl; + + /* + * Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a + * read request. + */ + private String contentType; + + /* + * Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual + * blocks were validated when each was uploaded. The value does not need to be base64 encoded as the SDK will + * perform the encoding. + */ + private byte[] contentMd5; + + /* + * Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with + * a read request. + */ + private String contentEncoding; + + /* + * Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with + * a read request. + */ + private String contentLanguage; + + /* + * Optional. Sets the blob's Content-Disposition header. + */ + private String contentDisposition; + + /** + * Creates an instance of BlobHttpHeaders class. + */ + public BlobHttpHeaders() { + } + + /** + * Get the cacheControl property: Optional. Sets the blob's cache control. If specified, this property is stored + * with the blob and returned with a read request. + * + * @return the cacheControl value. + */ + public String getCacheControl() { + return this.cacheControl; + } + + /** + * Set the cacheControl property: Optional. Sets the blob's cache control. If specified, this property is stored + * with the blob and returned with a read request. + * + * @param cacheControl the cacheControl value to set. + * @return the BlobHttpHeaders object itself. + */ + public BlobHttpHeaders setCacheControl(String cacheControl) { + this.cacheControl = cacheControl; + return this; + } + + /** + * Get the contentType property: Optional. Sets the blob's content type. If specified, this property is stored with + * the blob and returned with a read request. + * + * @return the contentType value. + */ + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: Optional. Sets the blob's content type. If specified, this property is stored with + * the blob and returned with a read request. + * + * @param contentType the contentType value to set. + * @return the BlobHttpHeaders object itself. + */ + public BlobHttpHeaders setContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the contentMd5 property: Optional. An MD5 hash of the blob content. Note that this hash is not validated, as + * the hashes for the individual blocks were validated when each was uploaded. The value does not need to be base64 + * encoded as the SDK will perform the encoding. + * + * @return the contentMd5 value. + */ + public byte[] getContentMd5() { + return this.contentMd5; + } + + /** + * Set the contentMd5 property: Optional. An MD5 hash of the blob content. Note that this hash is not validated, as + * the hashes for the individual blocks were validated when each was uploaded. The value does not need to be base64 + * encoded as the SDK will perform the encoding. + * + * @param contentMd5 the contentMd5 value to set. + * @return the BlobHttpHeaders object itself. + */ + public BlobHttpHeaders setContentMd5(byte[] contentMd5) { + this.contentMd5 = contentMd5; + return this; + } + + /** + * Get the contentEncoding property: Optional. Sets the blob's content encoding. If specified, this property is + * stored with the blob and returned with a read request. + * + * @return the contentEncoding value. + */ + public String getContentEncoding() { + return this.contentEncoding; + } + + /** + * Set the contentEncoding property: Optional. Sets the blob's content encoding. If specified, this property is + * stored with the blob and returned with a read request. + * + * @param contentEncoding the contentEncoding value to set. + * @return the BlobHttpHeaders object itself. + */ + public BlobHttpHeaders setContentEncoding(String contentEncoding) { + this.contentEncoding = contentEncoding; + return this; + } + + /** + * Get the contentLanguage property: Optional. Set the blob's content language. If specified, this property is + * stored with the blob and returned with a read request. + * + * @return the contentLanguage value. + */ + public String getContentLanguage() { + return this.contentLanguage; + } + + /** + * Set the contentLanguage property: Optional. Set the blob's content language. If specified, this property is + * stored with the blob and returned with a read request. + * + * @param contentLanguage the contentLanguage value to set. + * @return the BlobHttpHeaders object itself. + */ + public BlobHttpHeaders setContentLanguage(String contentLanguage) { + this.contentLanguage = contentLanguage; + return this; + } + + /** + * Get the contentDisposition property: Optional. Sets the blob's Content-Disposition header. + * + * @return the contentDisposition value. + */ + public String getContentDisposition() { + return this.contentDisposition; + } + + /** + * Set the contentDisposition property: Optional. Sets the blob's Content-Disposition header. + * + * @param contentDisposition the contentDisposition value to set. + * @return the BlobHttpHeaders object itself. + */ + public BlobHttpHeaders setContentDisposition(String contentDisposition) { + this.contentDisposition = contentDisposition; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobImmutabilityPolicyMode.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobImmutabilityPolicyMode.java new file mode 100644 index 000000000000..3bcbd6e38ce6 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobImmutabilityPolicyMode.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +/** + * Defines values for BlobImmutabilityPolicyMode. + */ +public enum BlobImmutabilityPolicyMode { + /** + * Enum value Mutable. + */ + MUTABLE("Mutable"), + + /** + * Enum value Unlocked. + */ + UNLOCKED("Unlocked"), + + /** + * Enum value Locked. + */ + LOCKED("Locked"); + + /** + * The actual serialized value for a BlobImmutabilityPolicyMode instance. + */ + private final String value; + + BlobImmutabilityPolicyMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a BlobImmutabilityPolicyMode instance. + * + * @param value the serialized value to parse. + * @return the parsed BlobImmutabilityPolicyMode object, or null if unable to parse. + */ + public static BlobImmutabilityPolicyMode fromString(String value) { + if (value == null) { + return null; + } + BlobImmutabilityPolicyMode[] items = BlobImmutabilityPolicyMode.values(); + for (BlobImmutabilityPolicyMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobItemInternal.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobItemInternal.java new file mode 100644 index 000000000000..7688ef3f366f --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobItemInternal.java @@ -0,0 +1,410 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import java.util.LinkedHashMap; +import java.util.Map; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * An Azure Storage blob. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobItemInternal implements XmlSerializable { + /* + * The Name property. + */ + private BlobName name; + + /* + * The Deleted property. + */ + private boolean deleted; + + /* + * The Snapshot property. + */ + private String snapshot; + + /* + * The VersionId property. + */ + private String versionId; + + /* + * The IsCurrentVersion property. + */ + private Boolean isCurrentVersion; + + /* + * Properties of a blob + */ + private BlobItemPropertiesInternal properties; + + /* + * Dictionary of + */ + private Map metadata; + + /* + * Blob tags + */ + private BlobTags blobTags; + + /* + * Dictionary of + */ + private Map objectReplicationMetadata; + + /* + * The HasVersionsOnly property. + */ + private Boolean hasVersionsOnly; + + /* + * The IsPrefix property. + */ + private Boolean isPrefix; + + /** + * Creates an instance of BlobItemInternal class. + */ + public BlobItemInternal() { + } + + /** + * Get the name property: The Name property. + * + * @return the name value. + */ + public BlobName getName() { + return this.name; + } + + /** + * Set the name property: The Name property. + * + * @param name the name value to set. + * @return the BlobItemInternal object itself. + */ + public BlobItemInternal setName(BlobName name) { + this.name = name; + return this; + } + + /** + * Get the deleted property: The Deleted property. + * + * @return the deleted value. + */ + public boolean isDeleted() { + return this.deleted; + } + + /** + * Set the deleted property: The Deleted property. + * + * @param deleted the deleted value to set. + * @return the BlobItemInternal object itself. + */ + public BlobItemInternal setDeleted(boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + * Get the snapshot property: The Snapshot property. + * + * @return the snapshot value. + */ + public String getSnapshot() { + return this.snapshot; + } + + /** + * Set the snapshot property: The Snapshot property. + * + * @param snapshot the snapshot value to set. + * @return the BlobItemInternal object itself. + */ + public BlobItemInternal setSnapshot(String snapshot) { + this.snapshot = snapshot; + return this; + } + + /** + * Get the versionId property: The VersionId property. + * + * @return the versionId value. + */ + public String getVersionId() { + return this.versionId; + } + + /** + * Set the versionId property: The VersionId property. + * + * @param versionId the versionId value to set. + * @return the BlobItemInternal object itself. + */ + public BlobItemInternal setVersionId(String versionId) { + this.versionId = versionId; + return this; + } + + /** + * Get the isCurrentVersion property: The IsCurrentVersion property. + * + * @return the isCurrentVersion value. + */ + public Boolean isCurrentVersion() { + return this.isCurrentVersion; + } + + /** + * Set the isCurrentVersion property: The IsCurrentVersion property. + * + * @param isCurrentVersion the isCurrentVersion value to set. + * @return the BlobItemInternal object itself. + */ + public BlobItemInternal setIsCurrentVersion(Boolean isCurrentVersion) { + this.isCurrentVersion = isCurrentVersion; + return this; + } + + /** + * Get the properties property: Properties of a blob. + * + * @return the properties value. + */ + public BlobItemPropertiesInternal getProperties() { + return this.properties; + } + + /** + * Set the properties property: Properties of a blob. + * + * @param properties the properties value to set. + * @return the BlobItemInternal object itself. + */ + public BlobItemInternal setProperties(BlobItemPropertiesInternal properties) { + this.properties = properties; + return this; + } + + /** + * Get the metadata property: Dictionary of <string>. + * + * @return the metadata value. + */ + public Map getMetadata() { + return this.metadata; + } + + /** + * Set the metadata property: Dictionary of <string>. + * + * @param metadata the metadata value to set. + * @return the BlobItemInternal object itself. + */ + public BlobItemInternal setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the blobTags property: Blob tags. + * + * @return the blobTags value. + */ + public BlobTags getBlobTags() { + return this.blobTags; + } + + /** + * Set the blobTags property: Blob tags. + * + * @param blobTags the blobTags value to set. + * @return the BlobItemInternal object itself. + */ + public BlobItemInternal setBlobTags(BlobTags blobTags) { + this.blobTags = blobTags; + return this; + } + + /** + * Get the objectReplicationMetadata property: Dictionary of <string>. + * + * @return the objectReplicationMetadata value. + */ + public Map getObjectReplicationMetadata() { + return this.objectReplicationMetadata; + } + + /** + * Set the objectReplicationMetadata property: Dictionary of <string>. + * + * @param objectReplicationMetadata the objectReplicationMetadata value to set. + * @return the BlobItemInternal object itself. + */ + public BlobItemInternal setObjectReplicationMetadata(Map objectReplicationMetadata) { + this.objectReplicationMetadata = objectReplicationMetadata; + return this; + } + + /** + * Get the hasVersionsOnly property: The HasVersionsOnly property. + * + * @return the hasVersionsOnly value. + */ + public Boolean isHasVersionsOnly() { + return this.hasVersionsOnly; + } + + /** + * Set the hasVersionsOnly property: The HasVersionsOnly property. + * + * @param hasVersionsOnly the hasVersionsOnly value to set. + * @return the BlobItemInternal object itself. + */ + public BlobItemInternal setHasVersionsOnly(Boolean hasVersionsOnly) { + this.hasVersionsOnly = hasVersionsOnly; + return this; + } + + /** + * Get the isPrefix property: The IsPrefix property. + * + * @return the isPrefix value. + */ + public Boolean isPrefix() { + return this.isPrefix; + } + + /** + * Set the isPrefix property: The IsPrefix property. + * + * @param isPrefix the isPrefix value to set. + * @return the BlobItemInternal object itself. + */ + public BlobItemInternal setIsPrefix(Boolean isPrefix) { + this.isPrefix = isPrefix; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "Blob" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeXml(this.name, "Name"); + xmlWriter.writeBooleanElement("Deleted", this.deleted); + xmlWriter.writeStringElement("Snapshot", this.snapshot); + xmlWriter.writeStringElement("VersionId", this.versionId); + xmlWriter.writeBooleanElement("IsCurrentVersion", this.isCurrentVersion); + xmlWriter.writeXml(this.properties, "Properties"); + if (this.metadata != null) { + xmlWriter.writeStartElement("Metadata"); + for (Map.Entry entry : this.metadata.entrySet()) { + xmlWriter.writeStringElement(entry.getKey(), entry.getValue()); + } + xmlWriter.writeEndElement(); + } + xmlWriter.writeXml(this.blobTags, "Tags"); + if (this.objectReplicationMetadata != null) { + xmlWriter.writeStartElement("OrMetadata"); + for (Map.Entry entry : this.objectReplicationMetadata.entrySet()) { + xmlWriter.writeStringElement(entry.getKey(), entry.getValue()); + } + xmlWriter.writeEndElement(); + } + xmlWriter.writeBooleanElement("HasVersionsOnly", this.hasVersionsOnly); + xmlWriter.writeBooleanElement("IsPrefix", this.isPrefix); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobItemInternal from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobItemInternal if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobItemInternal. + */ + public static BlobItemInternal fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobItemInternal from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobItemInternal if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobItemInternal. + */ + public static BlobItemInternal fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "Blob" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobItemInternal deserializedBlobItemInternal = new BlobItemInternal(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Name".equals(elementName.getLocalPart())) { + deserializedBlobItemInternal.name = BlobName.fromXml(reader, "Name"); + } else if ("Deleted".equals(elementName.getLocalPart())) { + deserializedBlobItemInternal.deleted = reader.getBooleanElement(); + } else if ("Snapshot".equals(elementName.getLocalPart())) { + deserializedBlobItemInternal.snapshot = reader.getStringElement(); + } else if ("VersionId".equals(elementName.getLocalPart())) { + deserializedBlobItemInternal.versionId = reader.getStringElement(); + } else if ("IsCurrentVersion".equals(elementName.getLocalPart())) { + deserializedBlobItemInternal.isCurrentVersion = reader.getNullableElement(Boolean::parseBoolean); + } else if ("Properties".equals(elementName.getLocalPart())) { + deserializedBlobItemInternal.properties = BlobItemPropertiesInternal.fromXml(reader, "Properties"); + } else if ("Metadata".equals(elementName.getLocalPart())) { + while (reader.nextElement() != XmlToken.END_ELEMENT) { + if (deserializedBlobItemInternal.metadata == null) { + deserializedBlobItemInternal.metadata = new LinkedHashMap<>(); + } + deserializedBlobItemInternal.metadata.put(reader.getElementName().getLocalPart(), + reader.getStringElement()); + } + } else if ("Tags".equals(elementName.getLocalPart())) { + deserializedBlobItemInternal.blobTags = BlobTags.fromXml(reader, "Tags"); + } else if ("OrMetadata".equals(elementName.getLocalPart())) { + while (reader.nextElement() != XmlToken.END_ELEMENT) { + if (deserializedBlobItemInternal.objectReplicationMetadata == null) { + deserializedBlobItemInternal.objectReplicationMetadata = new LinkedHashMap<>(); + } + deserializedBlobItemInternal.objectReplicationMetadata + .put(reader.getElementName().getLocalPart(), reader.getStringElement()); + } + } else if ("HasVersionsOnly".equals(elementName.getLocalPart())) { + deserializedBlobItemInternal.hasVersionsOnly = reader.getNullableElement(Boolean::parseBoolean); + } else if ("IsPrefix".equals(elementName.getLocalPart())) { + deserializedBlobItemInternal.isPrefix = reader.getNullableElement(Boolean::parseBoolean); + } else { + reader.skipElement(); + } + } + + return deserializedBlobItemInternal; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobItemPropertiesInternal.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobItemPropertiesInternal.java new file mode 100644 index 000000000000..e2509e785727 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobItemPropertiesInternal.java @@ -0,0 +1,1284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Objects; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * Properties of a blob. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobItemPropertiesInternal implements XmlSerializable { + /* + * The Creation-Time property. + */ + private DateTimeRfc1123 creationTime; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The Etag property. + */ + private String eTag; + + /* + * Size in bytes + */ + private Long contentLength; + + /* + * The Content-Type property. + */ + private String contentType; + + /* + * The Content-Encoding property. + */ + private String contentEncoding; + + /* + * The Content-Language property. + */ + private String contentLanguage; + + /* + * The Content-MD5 property. + */ + private byte[] contentMd5; + + /* + * The Content-Disposition property. + */ + private String contentDisposition; + + /* + * The Cache-Control property. + */ + private String cacheControl; + + /* + * The x-ms-blob-sequence-number property. + */ + private Long blobSequenceNumber; + + /* + * The BlobType property. + */ + private BlobType blobType; + + /* + * The LeaseStatus property. + */ + private LeaseStatusType leaseStatus; + + /* + * The LeaseState property. + */ + private LeaseStateType leaseState; + + /* + * The LeaseDuration property. + */ + private LeaseDurationType leaseDuration; + + /* + * The CopyId property. + */ + private String copyId; + + /* + * The CopyStatus property. + */ + private CopyStatusType copyStatus; + + /* + * The CopySource property. + */ + private String copySource; + + /* + * The CopyProgress property. + */ + private String copyProgress; + + /* + * The CopyCompletionTime property. + */ + private DateTimeRfc1123 copyCompletionTime; + + /* + * The CopyStatusDescription property. + */ + private String copyStatusDescription; + + /* + * The ServerEncrypted property. + */ + private Boolean serverEncrypted; + + /* + * The IncrementalCopy property. + */ + private Boolean incrementalCopy; + + /* + * The DestinationSnapshot property. + */ + private String destinationSnapshot; + + /* + * The DeletedTime property. + */ + private DateTimeRfc1123 deletedTime; + + /* + * The RemainingRetentionDays property. + */ + private Integer remainingRetentionDays; + + /* + * The AccessTier property. + */ + private AccessTier accessTier; + + /* + * The AccessTierInferred property. + */ + private Boolean accessTierInferred; + + /* + * The ArchiveStatus property. + */ + private ArchiveStatus archiveStatus; + + /* + * The CustomerProvidedKeySha256 property. + */ + private String customerProvidedKeySha256; + + /* + * The name of the encryption scope under which the blob is encrypted. + */ + private String encryptionScope; + + /* + * The AccessTierChangeTime property. + */ + private DateTimeRfc1123 accessTierChangeTime; + + /* + * The TagCount property. + */ + private Integer tagCount; + + /* + * The Expiry-Time property. + */ + private DateTimeRfc1123 expiresOn; + + /* + * The Sealed property. + */ + private Boolean isSealed; + + /* + * If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid values + * are High and Standard. + */ + private RehydratePriority rehydratePriority; + + /* + * The LastAccessTime property. + */ + private DateTimeRfc1123 lastAccessedOn; + + /* + * The ImmutabilityPolicyUntilDate property. + */ + private DateTimeRfc1123 immutabilityPolicyExpiresOn; + + /* + * The ImmutabilityPolicyMode property. + */ + private BlobImmutabilityPolicyMode immutabilityPolicyMode; + + /* + * The LegalHold property. + */ + private Boolean legalHold; + + /** + * Creates an instance of BlobItemPropertiesInternal class. + */ + public BlobItemPropertiesInternal() { + } + + /** + * Get the creationTime property: The Creation-Time property. + * + * @return the creationTime value. + */ + public OffsetDateTime getCreationTime() { + if (this.creationTime == null) { + return null; + } + return this.creationTime.getDateTime(); + } + + /** + * Set the creationTime property: The Creation-Time property. + * + * @param creationTime the creationTime value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setCreationTime(OffsetDateTime creationTime) { + if (creationTime == null) { + this.creationTime = null; + } else { + this.creationTime = new DateTimeRfc1123(creationTime); + } + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the eTag property: The Etag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The Etag property. + * + * @param eTag the eTag value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the contentLength property: Size in bytes. + * + * @return the contentLength value. + */ + public Long getContentLength() { + return this.contentLength; + } + + /** + * Set the contentLength property: Size in bytes. + * + * @param contentLength the contentLength value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setContentLength(Long contentLength) { + this.contentLength = contentLength; + return this; + } + + /** + * Get the contentType property: The Content-Type property. + * + * @return the contentType value. + */ + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The Content-Type property. + * + * @param contentType the contentType value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the contentEncoding property: The Content-Encoding property. + * + * @return the contentEncoding value. + */ + public String getContentEncoding() { + return this.contentEncoding; + } + + /** + * Set the contentEncoding property: The Content-Encoding property. + * + * @param contentEncoding the contentEncoding value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setContentEncoding(String contentEncoding) { + this.contentEncoding = contentEncoding; + return this; + } + + /** + * Get the contentLanguage property: The Content-Language property. + * + * @return the contentLanguage value. + */ + public String getContentLanguage() { + return this.contentLanguage; + } + + /** + * Set the contentLanguage property: The Content-Language property. + * + * @param contentLanguage the contentLanguage value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setContentLanguage(String contentLanguage) { + this.contentLanguage = contentLanguage; + return this; + } + + /** + * Get the contentMd5 property: The Content-MD5 property. + * + * @return the contentMd5 value. + */ + public byte[] getContentMd5() { + return this.contentMd5; + } + + /** + * Set the contentMd5 property: The Content-MD5 property. + * + * @param contentMd5 the contentMd5 value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setContentMd5(byte[] contentMd5) { + this.contentMd5 = contentMd5; + return this; + } + + /** + * Get the contentDisposition property: The Content-Disposition property. + * + * @return the contentDisposition value. + */ + public String getContentDisposition() { + return this.contentDisposition; + } + + /** + * Set the contentDisposition property: The Content-Disposition property. + * + * @param contentDisposition the contentDisposition value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setContentDisposition(String contentDisposition) { + this.contentDisposition = contentDisposition; + return this; + } + + /** + * Get the cacheControl property: The Cache-Control property. + * + * @return the cacheControl value. + */ + public String getCacheControl() { + return this.cacheControl; + } + + /** + * Set the cacheControl property: The Cache-Control property. + * + * @param cacheControl the cacheControl value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setCacheControl(String cacheControl) { + this.cacheControl = cacheControl; + return this; + } + + /** + * Get the blobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @return the blobSequenceNumber value. + */ + public Long getBlobSequenceNumber() { + return this.blobSequenceNumber; + } + + /** + * Set the blobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @param blobSequenceNumber the blobSequenceNumber value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setBlobSequenceNumber(Long blobSequenceNumber) { + this.blobSequenceNumber = blobSequenceNumber; + return this; + } + + /** + * Get the blobType property: The BlobType property. + * + * @return the blobType value. + */ + public BlobType getBlobType() { + return this.blobType; + } + + /** + * Set the blobType property: The BlobType property. + * + * @param blobType the blobType value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setBlobType(BlobType blobType) { + this.blobType = blobType; + return this; + } + + /** + * Get the leaseStatus property: The LeaseStatus property. + * + * @return the leaseStatus value. + */ + public LeaseStatusType getLeaseStatus() { + return this.leaseStatus; + } + + /** + * Set the leaseStatus property: The LeaseStatus property. + * + * @param leaseStatus the leaseStatus value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setLeaseStatus(LeaseStatusType leaseStatus) { + this.leaseStatus = leaseStatus; + return this; + } + + /** + * Get the leaseState property: The LeaseState property. + * + * @return the leaseState value. + */ + public LeaseStateType getLeaseState() { + return this.leaseState; + } + + /** + * Set the leaseState property: The LeaseState property. + * + * @param leaseState the leaseState value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setLeaseState(LeaseStateType leaseState) { + this.leaseState = leaseState; + return this; + } + + /** + * Get the leaseDuration property: The LeaseDuration property. + * + * @return the leaseDuration value. + */ + public LeaseDurationType getLeaseDuration() { + return this.leaseDuration; + } + + /** + * Set the leaseDuration property: The LeaseDuration property. + * + * @param leaseDuration the leaseDuration value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setLeaseDuration(LeaseDurationType leaseDuration) { + this.leaseDuration = leaseDuration; + return this; + } + + /** + * Get the copyId property: The CopyId property. + * + * @return the copyId value. + */ + public String getCopyId() { + return this.copyId; + } + + /** + * Set the copyId property: The CopyId property. + * + * @param copyId the copyId value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setCopyId(String copyId) { + this.copyId = copyId; + return this; + } + + /** + * Get the copyStatus property: The CopyStatus property. + * + * @return the copyStatus value. + */ + public CopyStatusType getCopyStatus() { + return this.copyStatus; + } + + /** + * Set the copyStatus property: The CopyStatus property. + * + * @param copyStatus the copyStatus value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setCopyStatus(CopyStatusType copyStatus) { + this.copyStatus = copyStatus; + return this; + } + + /** + * Get the copySource property: The CopySource property. + * + * @return the copySource value. + */ + public String getCopySource() { + return this.copySource; + } + + /** + * Set the copySource property: The CopySource property. + * + * @param copySource the copySource value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setCopySource(String copySource) { + this.copySource = copySource; + return this; + } + + /** + * Get the copyProgress property: The CopyProgress property. + * + * @return the copyProgress value. + */ + public String getCopyProgress() { + return this.copyProgress; + } + + /** + * Set the copyProgress property: The CopyProgress property. + * + * @param copyProgress the copyProgress value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setCopyProgress(String copyProgress) { + this.copyProgress = copyProgress; + return this; + } + + /** + * Get the copyCompletionTime property: The CopyCompletionTime property. + * + * @return the copyCompletionTime value. + */ + public OffsetDateTime getCopyCompletionTime() { + if (this.copyCompletionTime == null) { + return null; + } + return this.copyCompletionTime.getDateTime(); + } + + /** + * Set the copyCompletionTime property: The CopyCompletionTime property. + * + * @param copyCompletionTime the copyCompletionTime value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setCopyCompletionTime(OffsetDateTime copyCompletionTime) { + if (copyCompletionTime == null) { + this.copyCompletionTime = null; + } else { + this.copyCompletionTime = new DateTimeRfc1123(copyCompletionTime); + } + return this; + } + + /** + * Get the copyStatusDescription property: The CopyStatusDescription property. + * + * @return the copyStatusDescription value. + */ + public String getCopyStatusDescription() { + return this.copyStatusDescription; + } + + /** + * Set the copyStatusDescription property: The CopyStatusDescription property. + * + * @param copyStatusDescription the copyStatusDescription value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setCopyStatusDescription(String copyStatusDescription) { + this.copyStatusDescription = copyStatusDescription; + return this; + } + + /** + * Get the serverEncrypted property: The ServerEncrypted property. + * + * @return the serverEncrypted value. + */ + public Boolean isServerEncrypted() { + return this.serverEncrypted; + } + + /** + * Set the serverEncrypted property: The ServerEncrypted property. + * + * @param serverEncrypted the serverEncrypted value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setServerEncrypted(Boolean serverEncrypted) { + this.serverEncrypted = serverEncrypted; + return this; + } + + /** + * Get the incrementalCopy property: The IncrementalCopy property. + * + * @return the incrementalCopy value. + */ + public Boolean isIncrementalCopy() { + return this.incrementalCopy; + } + + /** + * Set the incrementalCopy property: The IncrementalCopy property. + * + * @param incrementalCopy the incrementalCopy value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setIncrementalCopy(Boolean incrementalCopy) { + this.incrementalCopy = incrementalCopy; + return this; + } + + /** + * Get the destinationSnapshot property: The DestinationSnapshot property. + * + * @return the destinationSnapshot value. + */ + public String getDestinationSnapshot() { + return this.destinationSnapshot; + } + + /** + * Set the destinationSnapshot property: The DestinationSnapshot property. + * + * @param destinationSnapshot the destinationSnapshot value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setDestinationSnapshot(String destinationSnapshot) { + this.destinationSnapshot = destinationSnapshot; + return this; + } + + /** + * Get the deletedTime property: The DeletedTime property. + * + * @return the deletedTime value. + */ + public OffsetDateTime getDeletedTime() { + if (this.deletedTime == null) { + return null; + } + return this.deletedTime.getDateTime(); + } + + /** + * Set the deletedTime property: The DeletedTime property. + * + * @param deletedTime the deletedTime value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setDeletedTime(OffsetDateTime deletedTime) { + if (deletedTime == null) { + this.deletedTime = null; + } else { + this.deletedTime = new DateTimeRfc1123(deletedTime); + } + return this; + } + + /** + * Get the remainingRetentionDays property: The RemainingRetentionDays property. + * + * @return the remainingRetentionDays value. + */ + public Integer getRemainingRetentionDays() { + return this.remainingRetentionDays; + } + + /** + * Set the remainingRetentionDays property: The RemainingRetentionDays property. + * + * @param remainingRetentionDays the remainingRetentionDays value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setRemainingRetentionDays(Integer remainingRetentionDays) { + this.remainingRetentionDays = remainingRetentionDays; + return this; + } + + /** + * Get the accessTier property: The AccessTier property. + * + * @return the accessTier value. + */ + public AccessTier getAccessTier() { + return this.accessTier; + } + + /** + * Set the accessTier property: The AccessTier property. + * + * @param accessTier the accessTier value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setAccessTier(AccessTier accessTier) { + this.accessTier = accessTier; + return this; + } + + /** + * Get the accessTierInferred property: The AccessTierInferred property. + * + * @return the accessTierInferred value. + */ + public Boolean isAccessTierInferred() { + return this.accessTierInferred; + } + + /** + * Set the accessTierInferred property: The AccessTierInferred property. + * + * @param accessTierInferred the accessTierInferred value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setAccessTierInferred(Boolean accessTierInferred) { + this.accessTierInferred = accessTierInferred; + return this; + } + + /** + * Get the archiveStatus property: The ArchiveStatus property. + * + * @return the archiveStatus value. + */ + public ArchiveStatus getArchiveStatus() { + return this.archiveStatus; + } + + /** + * Set the archiveStatus property: The ArchiveStatus property. + * + * @param archiveStatus the archiveStatus value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setArchiveStatus(ArchiveStatus archiveStatus) { + this.archiveStatus = archiveStatus; + return this; + } + + /** + * Get the customerProvidedKeySha256 property: The CustomerProvidedKeySha256 property. + * + * @return the customerProvidedKeySha256 value. + */ + public String getCustomerProvidedKeySha256() { + return this.customerProvidedKeySha256; + } + + /** + * Set the customerProvidedKeySha256 property: The CustomerProvidedKeySha256 property. + * + * @param customerProvidedKeySha256 the customerProvidedKeySha256 value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setCustomerProvidedKeySha256(String customerProvidedKeySha256) { + this.customerProvidedKeySha256 = customerProvidedKeySha256; + return this; + } + + /** + * Get the encryptionScope property: The name of the encryption scope under which the blob is encrypted. + * + * @return the encryptionScope value. + */ + public String getEncryptionScope() { + return this.encryptionScope; + } + + /** + * Set the encryptionScope property: The name of the encryption scope under which the blob is encrypted. + * + * @param encryptionScope the encryptionScope value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setEncryptionScope(String encryptionScope) { + this.encryptionScope = encryptionScope; + return this; + } + + /** + * Get the accessTierChangeTime property: The AccessTierChangeTime property. + * + * @return the accessTierChangeTime value. + */ + public OffsetDateTime getAccessTierChangeTime() { + if (this.accessTierChangeTime == null) { + return null; + } + return this.accessTierChangeTime.getDateTime(); + } + + /** + * Set the accessTierChangeTime property: The AccessTierChangeTime property. + * + * @param accessTierChangeTime the accessTierChangeTime value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setAccessTierChangeTime(OffsetDateTime accessTierChangeTime) { + if (accessTierChangeTime == null) { + this.accessTierChangeTime = null; + } else { + this.accessTierChangeTime = new DateTimeRfc1123(accessTierChangeTime); + } + return this; + } + + /** + * Get the tagCount property: The TagCount property. + * + * @return the tagCount value. + */ + public Integer getTagCount() { + return this.tagCount; + } + + /** + * Set the tagCount property: The TagCount property. + * + * @param tagCount the tagCount value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setTagCount(Integer tagCount) { + this.tagCount = tagCount; + return this; + } + + /** + * Get the expiresOn property: The Expiry-Time property. + * + * @return the expiresOn value. + */ + public OffsetDateTime getExpiresOn() { + if (this.expiresOn == null) { + return null; + } + return this.expiresOn.getDateTime(); + } + + /** + * Set the expiresOn property: The Expiry-Time property. + * + * @param expiresOn the expiresOn value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setExpiresOn(OffsetDateTime expiresOn) { + if (expiresOn == null) { + this.expiresOn = null; + } else { + this.expiresOn = new DateTimeRfc1123(expiresOn); + } + return this; + } + + /** + * Get the isSealed property: The Sealed property. + * + * @return the isSealed value. + */ + public Boolean isSealed() { + return this.isSealed; + } + + /** + * Set the isSealed property: The Sealed property. + * + * @param isSealed the isSealed value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setIsSealed(Boolean isSealed) { + this.isSealed = isSealed; + return this; + } + + /** + * Get the rehydratePriority property: If an object is in rehydrate pending state then this header is returned with + * priority of rehydrate. Valid values are High and Standard. + * + * @return the rehydratePriority value. + */ + public RehydratePriority getRehydratePriority() { + return this.rehydratePriority; + } + + /** + * Set the rehydratePriority property: If an object is in rehydrate pending state then this header is returned with + * priority of rehydrate. Valid values are High and Standard. + * + * @param rehydratePriority the rehydratePriority value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setRehydratePriority(RehydratePriority rehydratePriority) { + this.rehydratePriority = rehydratePriority; + return this; + } + + /** + * Get the lastAccessedOn property: The LastAccessTime property. + * + * @return the lastAccessedOn value. + */ + public OffsetDateTime getLastAccessedOn() { + if (this.lastAccessedOn == null) { + return null; + } + return this.lastAccessedOn.getDateTime(); + } + + /** + * Set the lastAccessedOn property: The LastAccessTime property. + * + * @param lastAccessedOn the lastAccessedOn value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setLastAccessedOn(OffsetDateTime lastAccessedOn) { + if (lastAccessedOn == null) { + this.lastAccessedOn = null; + } else { + this.lastAccessedOn = new DateTimeRfc1123(lastAccessedOn); + } + return this; + } + + /** + * Get the immutabilityPolicyExpiresOn property: The ImmutabilityPolicyUntilDate property. + * + * @return the immutabilityPolicyExpiresOn value. + */ + public OffsetDateTime getImmutabilityPolicyExpiresOn() { + if (this.immutabilityPolicyExpiresOn == null) { + return null; + } + return this.immutabilityPolicyExpiresOn.getDateTime(); + } + + /** + * Set the immutabilityPolicyExpiresOn property: The ImmutabilityPolicyUntilDate property. + * + * @param immutabilityPolicyExpiresOn the immutabilityPolicyExpiresOn value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setImmutabilityPolicyExpiresOn(OffsetDateTime immutabilityPolicyExpiresOn) { + if (immutabilityPolicyExpiresOn == null) { + this.immutabilityPolicyExpiresOn = null; + } else { + this.immutabilityPolicyExpiresOn = new DateTimeRfc1123(immutabilityPolicyExpiresOn); + } + return this; + } + + /** + * Get the immutabilityPolicyMode property: The ImmutabilityPolicyMode property. + * + * @return the immutabilityPolicyMode value. + */ + public BlobImmutabilityPolicyMode getImmutabilityPolicyMode() { + return this.immutabilityPolicyMode; + } + + /** + * Set the immutabilityPolicyMode property: The ImmutabilityPolicyMode property. + * + * @param immutabilityPolicyMode the immutabilityPolicyMode value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setImmutabilityPolicyMode(BlobImmutabilityPolicyMode immutabilityPolicyMode) { + this.immutabilityPolicyMode = immutabilityPolicyMode; + return this; + } + + /** + * Get the legalHold property: The LegalHold property. + * + * @return the legalHold value. + */ + public Boolean isLegalHold() { + return this.legalHold; + } + + /** + * Set the legalHold property: The LegalHold property. + * + * @param legalHold the legalHold value to set. + * @return the BlobItemPropertiesInternal object itself. + */ + public BlobItemPropertiesInternal setLegalHold(Boolean legalHold) { + this.legalHold = legalHold; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "Properties" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("Creation-Time", Objects.toString(this.creationTime, null)); + xmlWriter.writeStringElement("Last-Modified", Objects.toString(this.lastModified, null)); + xmlWriter.writeStringElement("Etag", this.eTag); + xmlWriter.writeNumberElement("Content-Length", this.contentLength); + xmlWriter.writeStringElement("Content-Type", this.contentType); + xmlWriter.writeStringElement("Content-Encoding", this.contentEncoding); + xmlWriter.writeStringElement("Content-Language", this.contentLanguage); + xmlWriter.writeBinaryElement("Content-MD5", this.contentMd5); + xmlWriter.writeStringElement("Content-Disposition", this.contentDisposition); + xmlWriter.writeStringElement("Cache-Control", this.cacheControl); + xmlWriter.writeNumberElement("x-ms-blob-sequence-number", this.blobSequenceNumber); + xmlWriter.writeStringElement("BlobType", this.blobType == null ? null : this.blobType.toString()); + xmlWriter.writeStringElement("LeaseStatus", this.leaseStatus == null ? null : this.leaseStatus.toString()); + xmlWriter.writeStringElement("LeaseState", this.leaseState == null ? null : this.leaseState.toString()); + xmlWriter.writeStringElement("LeaseDuration", + this.leaseDuration == null ? null : this.leaseDuration.toString()); + xmlWriter.writeStringElement("CopyId", this.copyId); + xmlWriter.writeStringElement("CopyStatus", this.copyStatus == null ? null : this.copyStatus.toString()); + xmlWriter.writeStringElement("CopySource", this.copySource); + xmlWriter.writeStringElement("CopyProgress", this.copyProgress); + xmlWriter.writeStringElement("CopyCompletionTime", Objects.toString(this.copyCompletionTime, null)); + xmlWriter.writeStringElement("CopyStatusDescription", this.copyStatusDescription); + xmlWriter.writeBooleanElement("ServerEncrypted", this.serverEncrypted); + xmlWriter.writeBooleanElement("IncrementalCopy", this.incrementalCopy); + xmlWriter.writeStringElement("DestinationSnapshot", this.destinationSnapshot); + xmlWriter.writeStringElement("DeletedTime", Objects.toString(this.deletedTime, null)); + xmlWriter.writeNumberElement("RemainingRetentionDays", this.remainingRetentionDays); + xmlWriter.writeStringElement("AccessTier", this.accessTier == null ? null : this.accessTier.getValue()); + xmlWriter.writeBooleanElement("AccessTierInferred", this.accessTierInferred); + xmlWriter.writeStringElement("ArchiveStatus", + this.archiveStatus == null ? null : this.archiveStatus.getValue()); + xmlWriter.writeStringElement("CustomerProvidedKeySha256", this.customerProvidedKeySha256); + xmlWriter.writeStringElement("EncryptionScope", this.encryptionScope); + xmlWriter.writeStringElement("AccessTierChangeTime", Objects.toString(this.accessTierChangeTime, null)); + xmlWriter.writeNumberElement("TagCount", this.tagCount); + xmlWriter.writeStringElement("Expiry-Time", Objects.toString(this.expiresOn, null)); + xmlWriter.writeBooleanElement("Sealed", this.isSealed); + xmlWriter.writeStringElement("RehydratePriority", + this.rehydratePriority == null ? null : this.rehydratePriority.getValue()); + xmlWriter.writeStringElement("LastAccessTime", Objects.toString(this.lastAccessedOn, null)); + xmlWriter.writeStringElement("ImmutabilityPolicyUntilDate", + Objects.toString(this.immutabilityPolicyExpiresOn, null)); + xmlWriter.writeStringElement("ImmutabilityPolicyMode", + this.immutabilityPolicyMode == null ? null : this.immutabilityPolicyMode.toString()); + xmlWriter.writeBooleanElement("LegalHold", this.legalHold); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobItemPropertiesInternal from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobItemPropertiesInternal if the XmlReader was pointing to an instance of it, or null if + * it was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobItemPropertiesInternal. + */ + public static BlobItemPropertiesInternal fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobItemPropertiesInternal from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobItemPropertiesInternal if the XmlReader was pointing to an instance of it, or null if + * it was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobItemPropertiesInternal. + */ + public static BlobItemPropertiesInternal fromXml(XmlReader xmlReader, String rootElementName) + throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "Properties" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobItemPropertiesInternal deserializedBlobItemPropertiesInternal = new BlobItemPropertiesInternal(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Creation-Time".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.creationTime + = reader.getNullableElement(DateTimeRfc1123::new); + } else if ("Last-Modified".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.lastModified + = reader.getNullableElement(DateTimeRfc1123::new); + } else if ("Etag".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.eTag = reader.getStringElement(); + } else if ("Content-Length".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.contentLength = reader.getNullableElement(Long::parseLong); + } else if ("Content-Type".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.contentType = reader.getStringElement(); + } else if ("Content-Encoding".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.contentEncoding = reader.getStringElement(); + } else if ("Content-Language".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.contentLanguage = reader.getStringElement(); + } else if ("Content-MD5".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.contentMd5 = reader.getBinaryElement(); + } else if ("Content-Disposition".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.contentDisposition = reader.getStringElement(); + } else if ("Cache-Control".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.cacheControl = reader.getStringElement(); + } else if ("x-ms-blob-sequence-number".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.blobSequenceNumber + = reader.getNullableElement(Long::parseLong); + } else if ("BlobType".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.blobType = BlobType.fromString(reader.getStringElement()); + } else if ("LeaseStatus".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.leaseStatus + = LeaseStatusType.fromString(reader.getStringElement()); + } else if ("LeaseState".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.leaseState + = LeaseStateType.fromString(reader.getStringElement()); + } else if ("LeaseDuration".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.leaseDuration + = LeaseDurationType.fromString(reader.getStringElement()); + } else if ("CopyId".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.copyId = reader.getStringElement(); + } else if ("CopyStatus".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.copyStatus + = CopyStatusType.fromString(reader.getStringElement()); + } else if ("CopySource".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.copySource = reader.getStringElement(); + } else if ("CopyProgress".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.copyProgress = reader.getStringElement(); + } else if ("CopyCompletionTime".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.copyCompletionTime + = reader.getNullableElement(DateTimeRfc1123::new); + } else if ("CopyStatusDescription".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.copyStatusDescription = reader.getStringElement(); + } else if ("ServerEncrypted".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.serverEncrypted + = reader.getNullableElement(Boolean::parseBoolean); + } else if ("IncrementalCopy".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.incrementalCopy + = reader.getNullableElement(Boolean::parseBoolean); + } else if ("DestinationSnapshot".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.destinationSnapshot = reader.getStringElement(); + } else if ("DeletedTime".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.deletedTime + = reader.getNullableElement(DateTimeRfc1123::new); + } else if ("RemainingRetentionDays".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.remainingRetentionDays + = reader.getNullableElement(Integer::parseInt); + } else if ("AccessTier".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.accessTier = AccessTier.fromValue(reader.getStringElement()); + } else if ("AccessTierInferred".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.accessTierInferred + = reader.getNullableElement(Boolean::parseBoolean); + } else if ("ArchiveStatus".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.archiveStatus + = ArchiveStatus.fromValue(reader.getStringElement()); + } else if ("CustomerProvidedKeySha256".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.customerProvidedKeySha256 = reader.getStringElement(); + } else if ("EncryptionScope".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.encryptionScope = reader.getStringElement(); + } else if ("AccessTierChangeTime".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.accessTierChangeTime + = reader.getNullableElement(DateTimeRfc1123::new); + } else if ("TagCount".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.tagCount = reader.getNullableElement(Integer::parseInt); + } else if ("Expiry-Time".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.expiresOn = reader.getNullableElement(DateTimeRfc1123::new); + } else if ("Sealed".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.isSealed = reader.getNullableElement(Boolean::parseBoolean); + } else if ("RehydratePriority".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.rehydratePriority + = RehydratePriority.fromValue(reader.getStringElement()); + } else if ("LastAccessTime".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.lastAccessedOn + = reader.getNullableElement(DateTimeRfc1123::new); + } else if ("ImmutabilityPolicyUntilDate".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.immutabilityPolicyExpiresOn + = reader.getNullableElement(DateTimeRfc1123::new); + } else if ("ImmutabilityPolicyMode".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.immutabilityPolicyMode + = BlobImmutabilityPolicyMode.fromString(reader.getStringElement()); + } else if ("LegalHold".equals(elementName.getLocalPart())) { + deserializedBlobItemPropertiesInternal.legalHold = reader.getNullableElement(Boolean::parseBoolean); + } else { + reader.skipElement(); + } + } + + return deserializedBlobItemPropertiesInternal; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobMetrics.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobMetrics.java new file mode 100644 index 000000000000..87f011f23edd --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobMetrics.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * a summary of request statistics grouped by API in hour or minute aggregates for blobs. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobMetrics implements XmlSerializable { + /* + * The version of Storage Analytics to configure. + */ + private String version; + + /* + * Indicates whether metrics are enabled for the Blob service. + */ + private boolean enabled; + + /* + * Indicates whether metrics should generate summary statistics for called API operations. + */ + private Boolean includeApis; + + /* + * the retention policy which determines how long the associated data should persist + */ + private BlobRetentionPolicy retentionPolicy; + + /** + * Creates an instance of BlobMetrics class. + */ + public BlobMetrics() { + } + + /** + * Get the version property: The version of Storage Analytics to configure. + * + * @return the version value. + */ + public String getVersion() { + return this.version; + } + + /** + * Set the version property: The version of Storage Analytics to configure. + * + * @param version the version value to set. + * @return the BlobMetrics object itself. + */ + public BlobMetrics setVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the enabled property: Indicates whether metrics are enabled for the Blob service. + * + * @return the enabled value. + */ + public boolean isEnabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates whether metrics are enabled for the Blob service. + * + * @param enabled the enabled value to set. + * @return the BlobMetrics object itself. + */ + public BlobMetrics setEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the includeApis property: Indicates whether metrics should generate summary statistics for called API + * operations. + * + * @return the includeApis value. + */ + public Boolean isIncludeApis() { + return this.includeApis; + } + + /** + * Set the includeApis property: Indicates whether metrics should generate summary statistics for called API + * operations. + * + * @param includeApis the includeApis value to set. + * @return the BlobMetrics object itself. + */ + public BlobMetrics setIncludeApis(Boolean includeApis) { + this.includeApis = includeApis; + return this; + } + + /** + * Get the retentionPolicy property: the retention policy which determines how long the associated data should + * persist. + * + * @return the retentionPolicy value. + */ + public BlobRetentionPolicy getRetentionPolicy() { + return this.retentionPolicy; + } + + /** + * Set the retentionPolicy property: the retention policy which determines how long the associated data should + * persist. + * + * @param retentionPolicy the retentionPolicy value to set. + * @return the BlobMetrics object itself. + */ + public BlobMetrics setRetentionPolicy(BlobRetentionPolicy retentionPolicy) { + this.retentionPolicy = retentionPolicy; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "BlobMetrics" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("Version", this.version); + xmlWriter.writeBooleanElement("Enabled", this.enabled); + xmlWriter.writeBooleanElement("IncludeAPIs", this.includeApis); + xmlWriter.writeXml(this.retentionPolicy, "RetentionPolicy"); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobMetrics from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobMetrics if the XmlReader was pointing to an instance of it, or null if it was pointing + * to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobMetrics. + */ + public static BlobMetrics fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobMetrics from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobMetrics if the XmlReader was pointing to an instance of it, or null if it was pointing + * to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobMetrics. + */ + public static BlobMetrics fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "BlobMetrics" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobMetrics deserializedBlobMetrics = new BlobMetrics(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Version".equals(elementName.getLocalPart())) { + deserializedBlobMetrics.version = reader.getStringElement(); + } else if ("Enabled".equals(elementName.getLocalPart())) { + deserializedBlobMetrics.enabled = reader.getBooleanElement(); + } else if ("IncludeAPIs".equals(elementName.getLocalPart())) { + deserializedBlobMetrics.includeApis = reader.getNullableElement(Boolean::parseBoolean); + } else if ("RetentionPolicy".equals(elementName.getLocalPart())) { + deserializedBlobMetrics.retentionPolicy = BlobRetentionPolicy.fromXml(reader, "RetentionPolicy"); + } else { + reader.skipElement(); + } + } + + return deserializedBlobMetrics; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobName.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobName.java new file mode 100644 index 000000000000..163aa90204c4 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobName.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.stream.XMLStreamException; + +/** + * The BlobName model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobName implements XmlSerializable { + /* + * Indicates if the blob name is encoded. + */ + private Boolean encoded; + + /* + * The name of the blob. + */ + private String content; + + /** + * Creates an instance of BlobName class. + */ + public BlobName() { + } + + /** + * Get the encoded property: Indicates if the blob name is encoded. + * + * @return the encoded value. + */ + public Boolean isEncoded() { + return this.encoded; + } + + /** + * Set the encoded property: Indicates if the blob name is encoded. + * + * @param encoded the encoded value to set. + * @return the BlobName object itself. + */ + public BlobName setEncoded(Boolean encoded) { + this.encoded = encoded; + return this; + } + + /** + * Get the content property: The name of the blob. + * + * @return the content value. + */ + public String getContent() { + return this.content; + } + + /** + * Set the content property: The name of the blob. + * + * @param content the content value to set. + * @return the BlobName object itself. + */ + public BlobName setContent(String content) { + this.content = content; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "BlobName" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeBooleanAttribute("Encoded", this.encoded); + xmlWriter.writeString(this.content); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobName from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobName if the XmlReader was pointing to an instance of it, or null if it was pointing to + * XML null. + * @throws XMLStreamException If an error occurs while reading the BlobName. + */ + public static BlobName fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobName from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobName if the XmlReader was pointing to an instance of it, or null if it was pointing to + * XML null. + * @throws XMLStreamException If an error occurs while reading the BlobName. + */ + public static BlobName fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "BlobName" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobName deserializedBlobName = new BlobName(); + deserializedBlobName.encoded = reader.getNullableAttribute(null, "Encoded", Boolean::parseBoolean); + deserializedBlobName.content = reader.getStringElement(); + + return deserializedBlobName; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobPrefixInternal.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobPrefixInternal.java new file mode 100644 index 000000000000..ef62231d38dd --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobPrefixInternal.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * The BlobPrefixInternal model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobPrefixInternal implements XmlSerializable { + /* + * The Name property. + */ + private BlobName name; + + /** + * Creates an instance of BlobPrefixInternal class. + */ + public BlobPrefixInternal() { + } + + /** + * Get the name property: The Name property. + * + * @return the name value. + */ + public BlobName getName() { + return this.name; + } + + /** + * Set the name property: The Name property. + * + * @param name the name value to set. + * @return the BlobPrefixInternal object itself. + */ + public BlobPrefixInternal setName(BlobName name) { + this.name = name; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "BlobPrefix" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeXml(this.name, "Name"); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobPrefixInternal from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobPrefixInternal if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobPrefixInternal. + */ + public static BlobPrefixInternal fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobPrefixInternal from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobPrefixInternal if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobPrefixInternal. + */ + public static BlobPrefixInternal fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "BlobPrefix" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobPrefixInternal deserializedBlobPrefixInternal = new BlobPrefixInternal(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Name".equals(elementName.getLocalPart())) { + deserializedBlobPrefixInternal.name = BlobName.fromXml(reader, "Name"); + } else { + reader.skipElement(); + } + } + + return deserializedBlobPrefixInternal; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobRetentionPolicy.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobRetentionPolicy.java new file mode 100644 index 000000000000..6bd3d40baf8e --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobRetentionPolicy.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * the retention policy which determines how long the associated data should persist. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobRetentionPolicy implements XmlSerializable { + /* + * Indicates whether a retention policy is enabled for the storage service + */ + private boolean enabled; + + /* + * Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than + * this value will be deleted + */ + private Integer days; + + /** + * Creates an instance of BlobRetentionPolicy class. + */ + public BlobRetentionPolicy() { + } + + /** + * Get the enabled property: Indicates whether a retention policy is enabled for the storage service. + * + * @return the enabled value. + */ + public boolean isEnabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates whether a retention policy is enabled for the storage service. + * + * @param enabled the enabled value to set. + * @return the BlobRetentionPolicy object itself. + */ + public BlobRetentionPolicy setEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the days property: Indicates the number of days that metrics or logging or soft-deleted data should be + * retained. All data older than this value will be deleted. + * + * @return the days value. + */ + public Integer getDays() { + return this.days; + } + + /** + * Set the days property: Indicates the number of days that metrics or logging or soft-deleted data should be + * retained. All data older than this value will be deleted. + * + * @param days the days value to set. + * @return the BlobRetentionPolicy object itself. + */ + public BlobRetentionPolicy setDays(Integer days) { + this.days = days; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName + = rootElementName == null || rootElementName.isEmpty() ? "BlobRetentionPolicy" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeBooleanElement("Enabled", this.enabled); + xmlWriter.writeNumberElement("Days", this.days); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobRetentionPolicy from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobRetentionPolicy if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobRetentionPolicy. + */ + public static BlobRetentionPolicy fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobRetentionPolicy from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobRetentionPolicy if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobRetentionPolicy. + */ + public static BlobRetentionPolicy fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "BlobRetentionPolicy" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobRetentionPolicy deserializedBlobRetentionPolicy = new BlobRetentionPolicy(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Enabled".equals(elementName.getLocalPart())) { + deserializedBlobRetentionPolicy.enabled = reader.getBooleanElement(); + } else if ("Days".equals(elementName.getLocalPart())) { + deserializedBlobRetentionPolicy.days = reader.getNullableElement(Integer::parseInt); + } else { + reader.skipElement(); + } + } + + return deserializedBlobRetentionPolicy; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobServiceProperties.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobServiceProperties.java new file mode 100644 index 000000000000..f0f195f505b1 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobServiceProperties.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import java.util.ArrayList; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * Storage Service Properties. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobServiceProperties implements XmlSerializable { + /* + * Azure Analytics Logging settings. + */ + private BlobAnalyticsLogging logging; + + /* + * a summary of request statistics grouped by API in hour or minute aggregates for blobs + */ + private BlobMetrics hourMetrics; + + /* + * a summary of request statistics grouped by API in hour or minute aggregates for blobs + */ + private BlobMetrics minuteMetrics; + + /* + * The set of CORS rules. + */ + private List cors; + + /* + * The default version to use for requests to the Blob service if an incoming request's version is not specified. + * Possible values include version 2008-10-27 and all more recent versions + */ + private String defaultServiceVersion; + + /* + * the retention policy which determines how long the associated data should persist + */ + private BlobRetentionPolicy deleteRetentionPolicy; + + /* + * The properties that enable an account to host a static website + */ + private StaticWebsite staticWebsite; + + /** + * Creates an instance of BlobServiceProperties class. + */ + public BlobServiceProperties() { + } + + /** + * Get the logging property: Azure Analytics Logging settings. + * + * @return the logging value. + */ + public BlobAnalyticsLogging getLogging() { + return this.logging; + } + + /** + * Set the logging property: Azure Analytics Logging settings. + * + * @param logging the logging value to set. + * @return the BlobServiceProperties object itself. + */ + public BlobServiceProperties setLogging(BlobAnalyticsLogging logging) { + this.logging = logging; + return this; + } + + /** + * Get the hourMetrics property: a summary of request statistics grouped by API in hour or minute aggregates for + * blobs. + * + * @return the hourMetrics value. + */ + public BlobMetrics getHourMetrics() { + return this.hourMetrics; + } + + /** + * Set the hourMetrics property: a summary of request statistics grouped by API in hour or minute aggregates for + * blobs. + * + * @param hourMetrics the hourMetrics value to set. + * @return the BlobServiceProperties object itself. + */ + public BlobServiceProperties setHourMetrics(BlobMetrics hourMetrics) { + this.hourMetrics = hourMetrics; + return this; + } + + /** + * Get the minuteMetrics property: a summary of request statistics grouped by API in hour or minute aggregates for + * blobs. + * + * @return the minuteMetrics value. + */ + public BlobMetrics getMinuteMetrics() { + return this.minuteMetrics; + } + + /** + * Set the minuteMetrics property: a summary of request statistics grouped by API in hour or minute aggregates for + * blobs. + * + * @param minuteMetrics the minuteMetrics value to set. + * @return the BlobServiceProperties object itself. + */ + public BlobServiceProperties setMinuteMetrics(BlobMetrics minuteMetrics) { + this.minuteMetrics = minuteMetrics; + return this; + } + + /** + * Get the cors property: The set of CORS rules. + * + * @return the cors value. + */ + public List getCors() { + if (this.cors == null) { + this.cors = new ArrayList<>(); + } + return this.cors; + } + + /** + * Set the cors property: The set of CORS rules. + * + * @param cors the cors value to set. + * @return the BlobServiceProperties object itself. + */ + public BlobServiceProperties setCors(List cors) { + this.cors = cors; + return this; + } + + /** + * Get the defaultServiceVersion property: The default version to use for requests to the Blob service if an + * incoming request's version is not specified. Possible values include version 2008-10-27 and all more recent + * versions. + * + * @return the defaultServiceVersion value. + */ + public String getDefaultServiceVersion() { + return this.defaultServiceVersion; + } + + /** + * Set the defaultServiceVersion property: The default version to use for requests to the Blob service if an + * incoming request's version is not specified. Possible values include version 2008-10-27 and all more recent + * versions. + * + * @param defaultServiceVersion the defaultServiceVersion value to set. + * @return the BlobServiceProperties object itself. + */ + public BlobServiceProperties setDefaultServiceVersion(String defaultServiceVersion) { + this.defaultServiceVersion = defaultServiceVersion; + return this; + } + + /** + * Get the deleteRetentionPolicy property: the retention policy which determines how long the associated data should + * persist. + * + * @return the deleteRetentionPolicy value. + */ + public BlobRetentionPolicy getDeleteRetentionPolicy() { + return this.deleteRetentionPolicy; + } + + /** + * Set the deleteRetentionPolicy property: the retention policy which determines how long the associated data should + * persist. + * + * @param deleteRetentionPolicy the deleteRetentionPolicy value to set. + * @return the BlobServiceProperties object itself. + */ + public BlobServiceProperties setDeleteRetentionPolicy(BlobRetentionPolicy deleteRetentionPolicy) { + this.deleteRetentionPolicy = deleteRetentionPolicy; + return this; + } + + /** + * Get the staticWebsite property: The properties that enable an account to host a static website. + * + * @return the staticWebsite value. + */ + public StaticWebsite getStaticWebsite() { + return this.staticWebsite; + } + + /** + * Set the staticWebsite property: The properties that enable an account to host a static website. + * + * @param staticWebsite the staticWebsite value to set. + * @return the BlobServiceProperties object itself. + */ + public BlobServiceProperties setStaticWebsite(StaticWebsite staticWebsite) { + this.staticWebsite = staticWebsite; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName + = rootElementName == null || rootElementName.isEmpty() ? "StorageServiceProperties" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeXml(this.logging, "Logging"); + xmlWriter.writeXml(this.hourMetrics, "HourMetrics"); + xmlWriter.writeXml(this.minuteMetrics, "MinuteMetrics"); + if (this.cors != null) { + xmlWriter.writeStartElement("Cors"); + for (BlobCorsRule element : this.cors) { + xmlWriter.writeXml(element, "CorsRule"); + } + xmlWriter.writeEndElement(); + } + xmlWriter.writeStringElement("DefaultServiceVersion", this.defaultServiceVersion); + xmlWriter.writeXml(this.deleteRetentionPolicy, "DeleteRetentionPolicy"); + xmlWriter.writeXml(this.staticWebsite, "StaticWebsite"); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobServiceProperties from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobServiceProperties if the XmlReader was pointing to an instance of it, or null if it + * was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobServiceProperties. + */ + public static BlobServiceProperties fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobServiceProperties from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobServiceProperties if the XmlReader was pointing to an instance of it, or null if it + * was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobServiceProperties. + */ + public static BlobServiceProperties fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "StorageServiceProperties" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobServiceProperties deserializedBlobServiceProperties = new BlobServiceProperties(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Logging".equals(elementName.getLocalPart())) { + deserializedBlobServiceProperties.logging = BlobAnalyticsLogging.fromXml(reader, "Logging"); + } else if ("HourMetrics".equals(elementName.getLocalPart())) { + deserializedBlobServiceProperties.hourMetrics = BlobMetrics.fromXml(reader, "HourMetrics"); + } else if ("MinuteMetrics".equals(elementName.getLocalPart())) { + deserializedBlobServiceProperties.minuteMetrics = BlobMetrics.fromXml(reader, "MinuteMetrics"); + } else if ("Cors".equals(elementName.getLocalPart())) { + while (reader.nextElement() != XmlToken.END_ELEMENT) { + elementName = reader.getElementName(); + if ("CorsRule".equals(elementName.getLocalPart())) { + if (deserializedBlobServiceProperties.cors == null) { + deserializedBlobServiceProperties.cors = new ArrayList<>(); + } + deserializedBlobServiceProperties.cors.add(BlobCorsRule.fromXml(reader, "CorsRule")); + } else { + reader.skipElement(); + } + } + } else if ("DefaultServiceVersion".equals(elementName.getLocalPart())) { + deserializedBlobServiceProperties.defaultServiceVersion = reader.getStringElement(); + } else if ("DeleteRetentionPolicy".equals(elementName.getLocalPart())) { + deserializedBlobServiceProperties.deleteRetentionPolicy + = BlobRetentionPolicy.fromXml(reader, "DeleteRetentionPolicy"); + } else if ("StaticWebsite".equals(elementName.getLocalPart())) { + deserializedBlobServiceProperties.staticWebsite = StaticWebsite.fromXml(reader, "StaticWebsite"); + } else { + reader.skipElement(); + } + } + + return deserializedBlobServiceProperties; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobServiceStatistics.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobServiceStatistics.java new file mode 100644 index 000000000000..18dce5c2d818 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobServiceStatistics.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * Stats for the storage service. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobServiceStatistics implements XmlSerializable { + /* + * Geo-Replication information for the Secondary Storage Service + */ + private GeoReplication geoReplication; + + /** + * Creates an instance of BlobServiceStatistics class. + */ + public BlobServiceStatistics() { + } + + /** + * Get the geoReplication property: Geo-Replication information for the Secondary Storage Service. + * + * @return the geoReplication value. + */ + public GeoReplication getGeoReplication() { + return this.geoReplication; + } + + /** + * Set the geoReplication property: Geo-Replication information for the Secondary Storage Service. + * + * @param geoReplication the geoReplication value to set. + * @return the BlobServiceStatistics object itself. + */ + public BlobServiceStatistics setGeoReplication(GeoReplication geoReplication) { + this.geoReplication = geoReplication; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName + = rootElementName == null || rootElementName.isEmpty() ? "StorageServiceStats" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeXml(this.geoReplication, "GeoReplication"); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobServiceStatistics from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobServiceStatistics if the XmlReader was pointing to an instance of it, or null if it + * was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobServiceStatistics. + */ + public static BlobServiceStatistics fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobServiceStatistics from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobServiceStatistics if the XmlReader was pointing to an instance of it, or null if it + * was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobServiceStatistics. + */ + public static BlobServiceStatistics fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "StorageServiceStats" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobServiceStatistics deserializedBlobServiceStatistics = new BlobServiceStatistics(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("GeoReplication".equals(elementName.getLocalPart())) { + deserializedBlobServiceStatistics.geoReplication = GeoReplication.fromXml(reader, "GeoReplication"); + } else { + reader.skipElement(); + } + } + + return deserializedBlobServiceStatistics; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobSignedIdentifier.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobSignedIdentifier.java new file mode 100644 index 000000000000..202188a6554d --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobSignedIdentifier.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * signed identifier. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobSignedIdentifier implements XmlSerializable { + /* + * a unique id + */ + private String id; + + /* + * An Access policy + */ + private BlobAccessPolicy accessPolicy; + + /** + * Creates an instance of BlobSignedIdentifier class. + */ + public BlobSignedIdentifier() { + } + + /** + * Get the id property: a unique id. + * + * @return the id value. + */ + public String getId() { + return this.id; + } + + /** + * Set the id property: a unique id. + * + * @param id the id value to set. + * @return the BlobSignedIdentifier object itself. + */ + public BlobSignedIdentifier setId(String id) { + this.id = id; + return this; + } + + /** + * Get the accessPolicy property: An Access policy. + * + * @return the accessPolicy value. + */ + public BlobAccessPolicy getAccessPolicy() { + return this.accessPolicy; + } + + /** + * Set the accessPolicy property: An Access policy. + * + * @param accessPolicy the accessPolicy value to set. + * @return the BlobSignedIdentifier object itself. + */ + public BlobSignedIdentifier setAccessPolicy(BlobAccessPolicy accessPolicy) { + this.accessPolicy = accessPolicy; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "SignedIdentifier" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("Id", this.id); + xmlWriter.writeXml(this.accessPolicy, "AccessPolicy"); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobSignedIdentifier from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobSignedIdentifier if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobSignedIdentifier. + */ + public static BlobSignedIdentifier fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobSignedIdentifier from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobSignedIdentifier if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlobSignedIdentifier. + */ + public static BlobSignedIdentifier fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "SignedIdentifier" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobSignedIdentifier deserializedBlobSignedIdentifier = new BlobSignedIdentifier(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Id".equals(elementName.getLocalPart())) { + deserializedBlobSignedIdentifier.id = reader.getStringElement(); + } else if ("AccessPolicy".equals(elementName.getLocalPart())) { + deserializedBlobSignedIdentifier.accessPolicy = BlobAccessPolicy.fromXml(reader, "AccessPolicy"); + } else { + reader.skipElement(); + } + } + + return deserializedBlobSignedIdentifier; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobTag.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobTag.java new file mode 100644 index 000000000000..2ca7755e1599 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobTag.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * The BlobTag model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobTag implements XmlSerializable { + /* + * The Key property. + */ + private String key; + + /* + * The Value property. + */ + private String value; + + /** + * Creates an instance of BlobTag class. + */ + public BlobTag() { + } + + /** + * Get the key property: The Key property. + * + * @return the key value. + */ + public String getKey() { + return this.key; + } + + /** + * Set the key property: The Key property. + * + * @param key the key value to set. + * @return the BlobTag object itself. + */ + public BlobTag setKey(String key) { + this.key = key; + return this; + } + + /** + * Get the value property: The Value property. + * + * @return the value value. + */ + public String getValue() { + return this.value; + } + + /** + * Set the value property: The Value property. + * + * @param value the value value to set. + * @return the BlobTag object itself. + */ + public BlobTag setValue(String value) { + this.value = value; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "Tag" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("Key", this.key); + xmlWriter.writeStringElement("Value", this.value); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobTag from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobTag if the XmlReader was pointing to an instance of it, or null if it was pointing to + * XML null. + * @throws XMLStreamException If an error occurs while reading the BlobTag. + */ + public static BlobTag fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobTag from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobTag if the XmlReader was pointing to an instance of it, or null if it was pointing to + * XML null. + * @throws XMLStreamException If an error occurs while reading the BlobTag. + */ + public static BlobTag fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "Tag" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobTag deserializedBlobTag = new BlobTag(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Key".equals(elementName.getLocalPart())) { + deserializedBlobTag.key = reader.getStringElement(); + } else if ("Value".equals(elementName.getLocalPart())) { + deserializedBlobTag.value = reader.getStringElement(); + } else { + reader.skipElement(); + } + } + + return deserializedBlobTag; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobTags.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobTags.java new file mode 100644 index 000000000000..a658ac325b54 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobTags.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.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import java.util.ArrayList; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * Blob tags. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobTags implements XmlSerializable { + /* + * The BlobTagSet property. + */ + private List blobTagSet; + + /** + * Creates an instance of BlobTags class. + */ + public BlobTags() { + } + + /** + * Get the blobTagSet property: The BlobTagSet property. + * + * @return the blobTagSet value. + */ + public List getBlobTagSet() { + if (this.blobTagSet == null) { + this.blobTagSet = new ArrayList<>(); + } + return this.blobTagSet; + } + + /** + * Set the blobTagSet property: The BlobTagSet property. + * + * @param blobTagSet the blobTagSet value to set. + * @return the BlobTags object itself. + */ + public BlobTags setBlobTagSet(List blobTagSet) { + this.blobTagSet = blobTagSet; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "Tags" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + if (this.blobTagSet != null) { + xmlWriter.writeStartElement("TagSet"); + for (BlobTag element : this.blobTagSet) { + xmlWriter.writeXml(element, "Tag"); + } + xmlWriter.writeEndElement(); + } + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlobTags from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlobTags if the XmlReader was pointing to an instance of it, or null if it was pointing to + * XML null. + * @throws XMLStreamException If an error occurs while reading the BlobTags. + */ + public static BlobTags fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlobTags from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlobTags if the XmlReader was pointing to an instance of it, or null if it was pointing to + * XML null. + * @throws XMLStreamException If an error occurs while reading the BlobTags. + */ + public static BlobTags fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "Tags" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlobTags deserializedBlobTags = new BlobTags(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("TagSet".equals(elementName.getLocalPart())) { + while (reader.nextElement() != XmlToken.END_ELEMENT) { + elementName = reader.getElementName(); + if ("Tag".equals(elementName.getLocalPart())) { + if (deserializedBlobTags.blobTagSet == null) { + deserializedBlobTags.blobTagSet = new ArrayList<>(); + } + deserializedBlobTags.blobTagSet.add(BlobTag.fromXml(reader, "Tag")); + } else { + reader.skipElement(); + } + } + } else { + reader.skipElement(); + } + } + + return deserializedBlobTags; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobType.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobType.java new file mode 100644 index 000000000000..5888ff4bb3ea --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobType.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +/** + * Defines values for BlobType. + */ +public enum BlobType { + /** + * Enum value BlockBlob. + */ + BLOCK_BLOB("BlockBlob"), + + /** + * Enum value PageBlob. + */ + PAGE_BLOB("PageBlob"), + + /** + * Enum value AppendBlob. + */ + APPEND_BLOB("AppendBlob"); + + /** + * The actual serialized value for a BlobType instance. + */ + private final String value; + + BlobType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a BlobType instance. + * + * @param value the serialized value to parse. + * @return the parsed BlobType object, or null if unable to parse. + */ + public static BlobType fromString(String value) { + if (value == null) { + return null; + } + BlobType[] items = BlobType.values(); + for (BlobType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsAbortCopyFromURLHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsAbortCopyFromURLHeaders.java new file mode 100644 index 000000000000..ac926ce8fe0e --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsAbortCopyFromURLHeaders.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsAbortCopyFromURLHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsAbortCopyFromURLHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsAbortCopyFromURLHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsAbortCopyFromURLHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsAbortCopyFromURLHeaders object itself. + */ + public BlobsAbortCopyFromURLHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsAbortCopyFromURLHeaders object itself. + */ + public BlobsAbortCopyFromURLHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsAbortCopyFromURLHeaders object itself. + */ + public BlobsAbortCopyFromURLHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsAbortCopyFromURLHeaders object itself. + */ + public BlobsAbortCopyFromURLHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsAcquireLeaseHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsAcquireLeaseHeaders.java new file mode 100644 index 000000000000..67789398df0c --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsAcquireLeaseHeaders.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsAcquireLeaseHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsAcquireLeaseHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-lease-id property. + */ + private String xMsLeaseId; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_LEASE_ID = HttpHeaderName.fromString("x-ms-lease-id"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsAcquireLeaseHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsAcquireLeaseHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + this.xMsLeaseId = rawHeaders.getValue(X_MS_LEASE_ID); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsAcquireLeaseHeaders object itself. + */ + public BlobsAcquireLeaseHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlobsAcquireLeaseHeaders object itself. + */ + public BlobsAcquireLeaseHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsLeaseId property: The x-ms-lease-id property. + * + * @return the xMsLeaseId value. + */ + public String getXMsLeaseId() { + return this.xMsLeaseId; + } + + /** + * Set the xMsLeaseId property: The x-ms-lease-id property. + * + * @param xMsLeaseId the xMsLeaseId value to set. + * @return the BlobsAcquireLeaseHeaders object itself. + */ + public BlobsAcquireLeaseHeaders setXMsLeaseId(String xMsLeaseId) { + this.xMsLeaseId = xMsLeaseId; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlobsAcquireLeaseHeaders object itself. + */ + public BlobsAcquireLeaseHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsAcquireLeaseHeaders object itself. + */ + public BlobsAcquireLeaseHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsAcquireLeaseHeaders object itself. + */ + public BlobsAcquireLeaseHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsAcquireLeaseHeaders object itself. + */ + public BlobsAcquireLeaseHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsBreakLeaseHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsBreakLeaseHeaders.java new file mode 100644 index 000000000000..fc7e1fae13a1 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsBreakLeaseHeaders.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsBreakLeaseHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsBreakLeaseHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-lease-time property. + */ + private Integer xMsLeaseTime; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_LEASE_TIME = HttpHeaderName.fromString("x-ms-lease-time"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsBreakLeaseHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsBreakLeaseHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String xMsLeaseTime = rawHeaders.getValue(X_MS_LEASE_TIME); + if (xMsLeaseTime != null) { + this.xMsLeaseTime = Integer.parseInt(xMsLeaseTime); + } + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsBreakLeaseHeaders object itself. + */ + public BlobsBreakLeaseHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlobsBreakLeaseHeaders object itself. + */ + public BlobsBreakLeaseHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsLeaseTime property: The x-ms-lease-time property. + * + * @return the xMsLeaseTime value. + */ + public Integer getXMsLeaseTime() { + return this.xMsLeaseTime; + } + + /** + * Set the xMsLeaseTime property: The x-ms-lease-time property. + * + * @param xMsLeaseTime the xMsLeaseTime value to set. + * @return the BlobsBreakLeaseHeaders object itself. + */ + public BlobsBreakLeaseHeaders setXMsLeaseTime(Integer xMsLeaseTime) { + this.xMsLeaseTime = xMsLeaseTime; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlobsBreakLeaseHeaders object itself. + */ + public BlobsBreakLeaseHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsBreakLeaseHeaders object itself. + */ + public BlobsBreakLeaseHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsBreakLeaseHeaders object itself. + */ + public BlobsBreakLeaseHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsBreakLeaseHeaders object itself. + */ + public BlobsBreakLeaseHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsChangeLeaseHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsChangeLeaseHeaders.java new file mode 100644 index 000000000000..b5af5112a093 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsChangeLeaseHeaders.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsChangeLeaseHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsChangeLeaseHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-lease-id property. + */ + private String xMsLeaseId; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_LEASE_ID = HttpHeaderName.fromString("x-ms-lease-id"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsChangeLeaseHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsChangeLeaseHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + this.xMsLeaseId = rawHeaders.getValue(X_MS_LEASE_ID); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsChangeLeaseHeaders object itself. + */ + public BlobsChangeLeaseHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlobsChangeLeaseHeaders object itself. + */ + public BlobsChangeLeaseHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsLeaseId property: The x-ms-lease-id property. + * + * @return the xMsLeaseId value. + */ + public String getXMsLeaseId() { + return this.xMsLeaseId; + } + + /** + * Set the xMsLeaseId property: The x-ms-lease-id property. + * + * @param xMsLeaseId the xMsLeaseId value to set. + * @return the BlobsChangeLeaseHeaders object itself. + */ + public BlobsChangeLeaseHeaders setXMsLeaseId(String xMsLeaseId) { + this.xMsLeaseId = xMsLeaseId; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlobsChangeLeaseHeaders object itself. + */ + public BlobsChangeLeaseHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsChangeLeaseHeaders object itself. + */ + public BlobsChangeLeaseHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsChangeLeaseHeaders object itself. + */ + public BlobsChangeLeaseHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsChangeLeaseHeaders object itself. + */ + public BlobsChangeLeaseHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsCopyFromURLHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsCopyFromURLHeaders.java new file mode 100644 index 000000000000..df8a2124f7e5 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsCopyFromURLHeaders.java @@ -0,0 +1,382 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Base64; + +/** + * The BlobsCopyFromURLHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsCopyFromURLHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-copy-id property. + */ + private String xMsCopyId; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-content-crc64 property. + */ + private byte[] xMsContentCrc64; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-version-id property. + */ + private String xMsVersionId; + + /* + * The x-ms-copy-status property. + */ + private String xMsCopyStatus = "success"; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-MD5 property. + */ + private byte[] contentMD5; + + /* + * The x-ms-encryption-scope property. + */ + private String xMsEncryptionScope; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_COPY_ID = HttpHeaderName.fromString("x-ms-copy-id"); + + private static final HttpHeaderName X_MS_CONTENT_CRC64 = HttpHeaderName.fromString("x-ms-content-crc64"); + + private static final HttpHeaderName X_MS_VERSION_ID = HttpHeaderName.fromString("x-ms-version-id"); + + private static final HttpHeaderName X_MS_COPY_STATUS = HttpHeaderName.fromString("x-ms-copy-status"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_SCOPE = HttpHeaderName.fromString("x-ms-encryption-scope"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsCopyFromURLHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsCopyFromURLHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsCopyId = rawHeaders.getValue(X_MS_COPY_ID); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String xMsContentCrc64 = rawHeaders.getValue(X_MS_CONTENT_CRC64); + if (xMsContentCrc64 != null) { + this.xMsContentCrc64 = Base64.getDecoder().decode(xMsContentCrc64); + } + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsVersionId = rawHeaders.getValue(X_MS_VERSION_ID); + this.xMsCopyStatus = rawHeaders.getValue(X_MS_COPY_STATUS); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + String contentMD5 = rawHeaders.getValue(HttpHeaderName.CONTENT_MD5); + if (contentMD5 != null) { + this.contentMD5 = Base64.getDecoder().decode(contentMD5); + } + this.xMsEncryptionScope = rawHeaders.getValue(X_MS_ENCRYPTION_SCOPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsCopyFromURLHeaders object itself. + */ + public BlobsCopyFromURLHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsCopyId property: The x-ms-copy-id property. + * + * @return the xMsCopyId value. + */ + public String getXMsCopyId() { + return this.xMsCopyId; + } + + /** + * Set the xMsCopyId property: The x-ms-copy-id property. + * + * @param xMsCopyId the xMsCopyId value to set. + * @return the BlobsCopyFromURLHeaders object itself. + */ + public BlobsCopyFromURLHeaders setXMsCopyId(String xMsCopyId) { + this.xMsCopyId = xMsCopyId; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlobsCopyFromURLHeaders object itself. + */ + public BlobsCopyFromURLHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return this.xMsContentCrc64; + } + + /** + * Set the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the BlobsCopyFromURLHeaders object itself. + */ + public BlobsCopyFromURLHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = xMsContentCrc64; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlobsCopyFromURLHeaders object itself. + */ + public BlobsCopyFromURLHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsVersionId property: The x-ms-version-id property. + * + * @return the xMsVersionId value. + */ + public String getXMsVersionId() { + return this.xMsVersionId; + } + + /** + * Set the xMsVersionId property: The x-ms-version-id property. + * + * @param xMsVersionId the xMsVersionId value to set. + * @return the BlobsCopyFromURLHeaders object itself. + */ + public BlobsCopyFromURLHeaders setXMsVersionId(String xMsVersionId) { + this.xMsVersionId = xMsVersionId; + return this; + } + + /** + * Get the xMsCopyStatus property: The x-ms-copy-status property. + * + * @return the xMsCopyStatus value. + */ + public String getXMsCopyStatus() { + return this.xMsCopyStatus; + } + + /** + * Set the xMsCopyStatus property: The x-ms-copy-status property. + * + * @param xMsCopyStatus the xMsCopyStatus value to set. + * @return the BlobsCopyFromURLHeaders object itself. + */ + public BlobsCopyFromURLHeaders setXMsCopyStatus(String xMsCopyStatus) { + this.xMsCopyStatus = xMsCopyStatus; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsCopyFromURLHeaders object itself. + */ + public BlobsCopyFromURLHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsCopyFromURLHeaders object itself. + */ + public BlobsCopyFromURLHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsCopyFromURLHeaders object itself. + */ + public BlobsCopyFromURLHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentMD5 property: The Content-MD5 property. + * + * @return the contentMD5 value. + */ + public byte[] getContentMD5() { + return this.contentMD5; + } + + /** + * Set the contentMD5 property: The Content-MD5 property. + * + * @param contentMD5 the contentMD5 value to set. + * @return the BlobsCopyFromURLHeaders object itself. + */ + public BlobsCopyFromURLHeaders setContentMD5(byte[] contentMD5) { + this.contentMD5 = contentMD5; + return this; + } + + /** + * Get the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @return the xMsEncryptionScope value. + */ + public String getXMsEncryptionScope() { + return this.xMsEncryptionScope; + } + + /** + * Set the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @param xMsEncryptionScope the xMsEncryptionScope value to set. + * @return the BlobsCopyFromURLHeaders object itself. + */ + public BlobsCopyFromURLHeaders setXMsEncryptionScope(String xMsEncryptionScope) { + this.xMsEncryptionScope = xMsEncryptionScope; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsCreateSnapshotHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsCreateSnapshotHeaders.java new file mode 100644 index 000000000000..d5b441c6538b --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsCreateSnapshotHeaders.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsCreateSnapshotHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsCreateSnapshotHeaders { + /* + * The x-ms-snapshot property. + */ + private String xMsSnapshot; + + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-version-id property. + */ + private String xMsVersionId; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-request-server-encrypted property. + */ + private Boolean xMsRequestServerEncrypted; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_SNAPSHOT = HttpHeaderName.fromString("x-ms-snapshot"); + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_VERSION_ID = HttpHeaderName.fromString("x-ms-version-id"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_REQUEST_SERVER_ENCRYPTED + = HttpHeaderName.fromString("x-ms-request-server-encrypted"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsCreateSnapshotHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsCreateSnapshotHeaders(HttpHeaders rawHeaders) { + this.xMsSnapshot = rawHeaders.getValue(X_MS_SNAPSHOT); + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsVersionId = rawHeaders.getValue(X_MS_VERSION_ID); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + String xMsRequestServerEncrypted = rawHeaders.getValue(X_MS_REQUEST_SERVER_ENCRYPTED); + if (xMsRequestServerEncrypted != null) { + this.xMsRequestServerEncrypted = Boolean.parseBoolean(xMsRequestServerEncrypted); + } + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsSnapshot property: The x-ms-snapshot property. + * + * @return the xMsSnapshot value. + */ + public String getXMsSnapshot() { + return this.xMsSnapshot; + } + + /** + * Set the xMsSnapshot property: The x-ms-snapshot property. + * + * @param xMsSnapshot the xMsSnapshot value to set. + * @return the BlobsCreateSnapshotHeaders object itself. + */ + public BlobsCreateSnapshotHeaders setXMsSnapshot(String xMsSnapshot) { + this.xMsSnapshot = xMsSnapshot; + return this; + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsCreateSnapshotHeaders object itself. + */ + public BlobsCreateSnapshotHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlobsCreateSnapshotHeaders object itself. + */ + public BlobsCreateSnapshotHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlobsCreateSnapshotHeaders object itself. + */ + public BlobsCreateSnapshotHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsVersionId property: The x-ms-version-id property. + * + * @return the xMsVersionId value. + */ + public String getXMsVersionId() { + return this.xMsVersionId; + } + + /** + * Set the xMsVersionId property: The x-ms-version-id property. + * + * @param xMsVersionId the xMsVersionId value to set. + * @return the BlobsCreateSnapshotHeaders object itself. + */ + public BlobsCreateSnapshotHeaders setXMsVersionId(String xMsVersionId) { + this.xMsVersionId = xMsVersionId; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsCreateSnapshotHeaders object itself. + */ + public BlobsCreateSnapshotHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @return the xMsRequestServerEncrypted value. + */ + public Boolean isXMsRequestServerEncrypted() { + return this.xMsRequestServerEncrypted; + } + + /** + * Set the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @param xMsRequestServerEncrypted the xMsRequestServerEncrypted value to set. + * @return the BlobsCreateSnapshotHeaders object itself. + */ + public BlobsCreateSnapshotHeaders setXMsRequestServerEncrypted(Boolean xMsRequestServerEncrypted) { + this.xMsRequestServerEncrypted = xMsRequestServerEncrypted; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsCreateSnapshotHeaders object itself. + */ + public BlobsCreateSnapshotHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsCreateSnapshotHeaders object itself. + */ + public BlobsCreateSnapshotHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsDeleteHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsDeleteHeaders.java new file mode 100644 index 000000000000..f1e9bec034ee --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsDeleteHeaders.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsDeleteHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsDeleteHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsDeleteHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsDeleteHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsDeleteHeaders object itself. + */ + public BlobsDeleteHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsDeleteHeaders object itself. + */ + public BlobsDeleteHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsDeleteHeaders object itself. + */ + public BlobsDeleteHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsDeleteHeaders object itself. + */ + public BlobsDeleteHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsDeleteImmutabilityPolicyHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsDeleteImmutabilityPolicyHeaders.java new file mode 100644 index 000000000000..2a145ead2391 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsDeleteImmutabilityPolicyHeaders.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsDeleteImmutabilityPolicyHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsDeleteImmutabilityPolicyHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsDeleteImmutabilityPolicyHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsDeleteImmutabilityPolicyHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsDeleteImmutabilityPolicyHeaders object itself. + */ + public BlobsDeleteImmutabilityPolicyHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsDeleteImmutabilityPolicyHeaders object itself. + */ + public BlobsDeleteImmutabilityPolicyHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsDeleteImmutabilityPolicyHeaders object itself. + */ + public BlobsDeleteImmutabilityPolicyHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsDeleteImmutabilityPolicyHeaders object itself. + */ + public BlobsDeleteImmutabilityPolicyHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsDownloadHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsDownloadHeaders.java new file mode 100644 index 000000000000..ce9f856b5441 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsDownloadHeaders.java @@ -0,0 +1,1422 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Base64; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The BlobsDownloadHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsDownloadHeaders { + /* + * The x-ms-is-current-version property. + */ + private Boolean xMsIsCurrentVersion; + + /* + * The x-ms-lease-status property. + */ + private LeaseStatusType xMsLeaseStatus; + + /* + * The x-ms-tag-count property. + */ + private Long xMsTagCount; + + /* + * The Content-Range property. + */ + private String contentRange; + + /* + * The x-ms-lease-state property. + */ + private LeaseStateType xMsLeaseState; + + /* + * The x-ms-blob-sealed property. + */ + private Boolean xMsBlobSealed; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-version-id property. + */ + private String xMsVersionId; + + /* + * The x-ms-encryption-key-sha256 property. + */ + private String xMsEncryptionKeySha256; + + /* + * The x-ms-structured-body property. + */ + private String xMsStructuredBody; + + /* + * The x-ms-blob-type property. + */ + private BlobType xMsBlobType; + + /* + * The x-ms-immutability-policy-mode property. + */ + private String xMsImmutabilityPolicyMode; + + /* + * The x-ms-structured-content-length property. + */ + private Long xMsStructuredContentLength; + + /* + * The Content-Encoding property. + */ + private String contentEncoding; + + /* + * The x-ms-copy-status-description property. + */ + private String xMsCopyStatusDescription; + + /* + * The x-ms-creation-time property. + */ + private DateTimeRfc1123 xMsCreationTime; + + /* + * The x-ms-lease-duration property. + */ + private LeaseDurationType xMsLeaseDuration; + + /* + * The Content-Length property. + */ + private Long contentLength; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The Content-Type property. + */ + private String contentType; + + /* + * The x-ms-last-access-time property. + */ + private DateTimeRfc1123 xMsLastAccessTime; + + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-copy-id property. + */ + private String xMsCopyId; + + /* + * The x-ms-copy-source property. + */ + private String xMsCopySource; + + /* + * The x-ms-immutability-policy-until-date property. + */ + private DateTimeRfc1123 xMsImmutabilityPolicyUntilDate; + + /* + * The x-ms-content-crc64 property. + */ + private byte[] xMsContentCrc64; + + /* + * The x-ms-blob-sequence-number property. + */ + private Long xMsBlobSequenceNumber; + + /* + * The x-ms-copy-progress property. + */ + private String xMsCopyProgress; + + /* + * The x-ms-blob-committed-block-count property. + */ + private Integer xMsBlobCommittedBlockCount; + + /* + * The x-ms-blob-content-md5 property. + */ + private byte[] xMsBlobContentMd5; + + /* + * The x-ms-meta- property. + */ + private Map xMsMeta; + + /* + * The x-ms-legal-hold property. + */ + private Boolean xMsLegalHold; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-MD5 property. + */ + private byte[] contentMD5; + + /* + * The x-ms-copy-completion-time property. + */ + private DateTimeRfc1123 xMsCopyCompletionTime; + + /* + * The Accept-Ranges property. + */ + private String acceptRanges; + + /* + * The x-ms-server-encrypted property. + */ + private Boolean xMsServerEncrypted; + + /* + * The x-ms-or-policy-id property. + */ + private String xMsOrPolicyId; + + /* + * The Cache-Control property. + */ + private String cacheControl; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Content-Disposition property. + */ + private String contentDisposition; + + /* + * The x-ms-copy-status property. + */ + private CopyStatusType xMsCopyStatus; + + /* + * The Content-Language property. + */ + private String contentLanguage; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The x-ms-or- property. + */ + private Map xMsOr; + + /* + * The x-ms-encryption-scope property. + */ + private String xMsEncryptionScope; + + private static final HttpHeaderName X_MS_IS_CURRENT_VERSION = HttpHeaderName.fromString("x-ms-is-current-version"); + + private static final HttpHeaderName X_MS_LEASE_STATUS = HttpHeaderName.fromString("x-ms-lease-status"); + + private static final HttpHeaderName X_MS_TAG_COUNT = HttpHeaderName.fromString("x-ms-tag-count"); + + private static final HttpHeaderName X_MS_LEASE_STATE = HttpHeaderName.fromString("x-ms-lease-state"); + + private static final HttpHeaderName X_MS_BLOB_SEALED = HttpHeaderName.fromString("x-ms-blob-sealed"); + + private static final HttpHeaderName X_MS_VERSION_ID = HttpHeaderName.fromString("x-ms-version-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_KEY_SHA256 + = HttpHeaderName.fromString("x-ms-encryption-key-sha256"); + + private static final HttpHeaderName X_MS_STRUCTURED_BODY = HttpHeaderName.fromString("x-ms-structured-body"); + + private static final HttpHeaderName X_MS_BLOB_TYPE = HttpHeaderName.fromString("x-ms-blob-type"); + + private static final HttpHeaderName X_MS_IMMUTABILITY_POLICY_MODE + = HttpHeaderName.fromString("x-ms-immutability-policy-mode"); + + private static final HttpHeaderName X_MS_STRUCTURED_CONTENT_LENGTH + = HttpHeaderName.fromString("x-ms-structured-content-length"); + + private static final HttpHeaderName X_MS_COPY_STATUS_DESCRIPTION + = HttpHeaderName.fromString("x-ms-copy-status-description"); + + private static final HttpHeaderName X_MS_CREATION_TIME = HttpHeaderName.fromString("x-ms-creation-time"); + + private static final HttpHeaderName X_MS_LEASE_DURATION = HttpHeaderName.fromString("x-ms-lease-duration"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_LAST_ACCESS_TIME = HttpHeaderName.fromString("x-ms-last-access-time"); + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_COPY_ID = HttpHeaderName.fromString("x-ms-copy-id"); + + private static final HttpHeaderName X_MS_COPY_SOURCE = HttpHeaderName.fromString("x-ms-copy-source"); + + private static final HttpHeaderName X_MS_IMMUTABILITY_POLICY_UNTIL_DATE + = HttpHeaderName.fromString("x-ms-immutability-policy-until-date"); + + private static final HttpHeaderName X_MS_CONTENT_CRC64 = HttpHeaderName.fromString("x-ms-content-crc64"); + + private static final HttpHeaderName X_MS_BLOB_SEQUENCE_NUMBER + = HttpHeaderName.fromString("x-ms-blob-sequence-number"); + + private static final HttpHeaderName X_MS_COPY_PROGRESS = HttpHeaderName.fromString("x-ms-copy-progress"); + + private static final HttpHeaderName X_MS_BLOB_COMMITTED_BLOCK_COUNT + = HttpHeaderName.fromString("x-ms-blob-committed-block-count"); + + private static final HttpHeaderName X_MS_BLOB_CONTENT_MD5 = HttpHeaderName.fromString("x-ms-blob-content-md5"); + + private static final HttpHeaderName X_MS_LEGAL_HOLD = HttpHeaderName.fromString("x-ms-legal-hold"); + + private static final HttpHeaderName X_MS_COPY_COMPLETION_TIME + = HttpHeaderName.fromString("x-ms-copy-completion-time"); + + private static final HttpHeaderName X_MS_SERVER_ENCRYPTED = HttpHeaderName.fromString("x-ms-server-encrypted"); + + private static final HttpHeaderName X_MS_OR_POLICY_ID = HttpHeaderName.fromString("x-ms-or-policy-id"); + + private static final HttpHeaderName X_MS_COPY_STATUS = HttpHeaderName.fromString("x-ms-copy-status"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_SCOPE = HttpHeaderName.fromString("x-ms-encryption-scope"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsDownloadHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsDownloadHeaders(HttpHeaders rawHeaders) { + String xMsIsCurrentVersion = rawHeaders.getValue(X_MS_IS_CURRENT_VERSION); + if (xMsIsCurrentVersion != null) { + this.xMsIsCurrentVersion = Boolean.parseBoolean(xMsIsCurrentVersion); + } + String xMsLeaseStatus = rawHeaders.getValue(X_MS_LEASE_STATUS); + if (xMsLeaseStatus != null) { + this.xMsLeaseStatus = LeaseStatusType.fromString(xMsLeaseStatus); + } + String xMsTagCount = rawHeaders.getValue(X_MS_TAG_COUNT); + if (xMsTagCount != null) { + this.xMsTagCount = Long.parseLong(xMsTagCount); + } + this.contentRange = rawHeaders.getValue(HttpHeaderName.CONTENT_RANGE); + String xMsLeaseState = rawHeaders.getValue(X_MS_LEASE_STATE); + if (xMsLeaseState != null) { + this.xMsLeaseState = LeaseStateType.fromString(xMsLeaseState); + } + String xMsBlobSealed = rawHeaders.getValue(X_MS_BLOB_SEALED); + if (xMsBlobSealed != null) { + this.xMsBlobSealed = Boolean.parseBoolean(xMsBlobSealed); + } + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsVersionId = rawHeaders.getValue(X_MS_VERSION_ID); + this.xMsEncryptionKeySha256 = rawHeaders.getValue(X_MS_ENCRYPTION_KEY_SHA256); + this.xMsStructuredBody = rawHeaders.getValue(X_MS_STRUCTURED_BODY); + String xMsBlobType = rawHeaders.getValue(X_MS_BLOB_TYPE); + if (xMsBlobType != null) { + this.xMsBlobType = BlobType.fromString(xMsBlobType); + } + this.xMsImmutabilityPolicyMode = rawHeaders.getValue(X_MS_IMMUTABILITY_POLICY_MODE); + String xMsStructuredContentLength = rawHeaders.getValue(X_MS_STRUCTURED_CONTENT_LENGTH); + if (xMsStructuredContentLength != null) { + this.xMsStructuredContentLength = Long.parseLong(xMsStructuredContentLength); + } + this.contentEncoding = rawHeaders.getValue(HttpHeaderName.CONTENT_ENCODING); + this.xMsCopyStatusDescription = rawHeaders.getValue(X_MS_COPY_STATUS_DESCRIPTION); + String xMsCreationTime = rawHeaders.getValue(X_MS_CREATION_TIME); + if (xMsCreationTime != null) { + this.xMsCreationTime = new DateTimeRfc1123(xMsCreationTime); + } + String xMsLeaseDuration = rawHeaders.getValue(X_MS_LEASE_DURATION); + if (xMsLeaseDuration != null) { + this.xMsLeaseDuration = LeaseDurationType.fromString(xMsLeaseDuration); + } + String contentLength = rawHeaders.getValue(HttpHeaderName.CONTENT_LENGTH); + if (contentLength != null) { + this.contentLength = Long.parseLong(contentLength); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.contentType = rawHeaders.getValue(HttpHeaderName.CONTENT_TYPE); + String xMsLastAccessTime = rawHeaders.getValue(X_MS_LAST_ACCESS_TIME); + if (xMsLastAccessTime != null) { + this.xMsLastAccessTime = new DateTimeRfc1123(xMsLastAccessTime); + } + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsCopyId = rawHeaders.getValue(X_MS_COPY_ID); + this.xMsCopySource = rawHeaders.getValue(X_MS_COPY_SOURCE); + String xMsImmutabilityPolicyUntilDate = rawHeaders.getValue(X_MS_IMMUTABILITY_POLICY_UNTIL_DATE); + if (xMsImmutabilityPolicyUntilDate != null) { + this.xMsImmutabilityPolicyUntilDate = new DateTimeRfc1123(xMsImmutabilityPolicyUntilDate); + } + String xMsContentCrc64 = rawHeaders.getValue(X_MS_CONTENT_CRC64); + if (xMsContentCrc64 != null) { + this.xMsContentCrc64 = Base64.getDecoder().decode(xMsContentCrc64); + } + String xMsBlobSequenceNumber = rawHeaders.getValue(X_MS_BLOB_SEQUENCE_NUMBER); + if (xMsBlobSequenceNumber != null) { + this.xMsBlobSequenceNumber = Long.parseLong(xMsBlobSequenceNumber); + } + this.xMsCopyProgress = rawHeaders.getValue(X_MS_COPY_PROGRESS); + String xMsBlobCommittedBlockCount = rawHeaders.getValue(X_MS_BLOB_COMMITTED_BLOCK_COUNT); + if (xMsBlobCommittedBlockCount != null) { + this.xMsBlobCommittedBlockCount = Integer.parseInt(xMsBlobCommittedBlockCount); + } + String xMsBlobContentMd5 = rawHeaders.getValue(X_MS_BLOB_CONTENT_MD5); + if (xMsBlobContentMd5 != null) { + this.xMsBlobContentMd5 = Base64.getDecoder().decode(xMsBlobContentMd5); + } + String xMsLegalHold = rawHeaders.getValue(X_MS_LEGAL_HOLD); + if (xMsLegalHold != null) { + this.xMsLegalHold = Boolean.parseBoolean(xMsLegalHold); + } + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + String contentMD5 = rawHeaders.getValue(HttpHeaderName.CONTENT_MD5); + if (contentMD5 != null) { + this.contentMD5 = Base64.getDecoder().decode(contentMD5); + } + String xMsCopyCompletionTime = rawHeaders.getValue(X_MS_COPY_COMPLETION_TIME); + if (xMsCopyCompletionTime != null) { + this.xMsCopyCompletionTime = new DateTimeRfc1123(xMsCopyCompletionTime); + } + this.acceptRanges = rawHeaders.getValue(HttpHeaderName.ACCEPT_RANGES); + String xMsServerEncrypted = rawHeaders.getValue(X_MS_SERVER_ENCRYPTED); + if (xMsServerEncrypted != null) { + this.xMsServerEncrypted = Boolean.parseBoolean(xMsServerEncrypted); + } + this.xMsOrPolicyId = rawHeaders.getValue(X_MS_OR_POLICY_ID); + this.cacheControl = rawHeaders.getValue(HttpHeaderName.CACHE_CONTROL); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + this.contentDisposition = rawHeaders.getValue(HttpHeaderName.CONTENT_DISPOSITION); + String xMsCopyStatus = rawHeaders.getValue(X_MS_COPY_STATUS); + if (xMsCopyStatus != null) { + this.xMsCopyStatus = CopyStatusType.fromString(xMsCopyStatus); + } + this.contentLanguage = rawHeaders.getValue(HttpHeaderName.CONTENT_LANGUAGE); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + this.xMsEncryptionScope = rawHeaders.getValue(X_MS_ENCRYPTION_SCOPE); + Map xMsMetaHeaderCollection = new LinkedHashMap<>(); + Map xMsOrHeaderCollection = new LinkedHashMap<>(); + + rawHeaders.stream().forEach(header -> { + String headerName = header.getName().getValue(); + if (headerName.startsWith("x-ms-meta-")) { + xMsMetaHeaderCollection.put(headerName.substring(10), header.getValue()); + return; + } + if (headerName.startsWith("x-ms-or-")) { + xMsOrHeaderCollection.put(headerName.substring(8), header.getValue()); + } + }); + this.xMsMeta = xMsMetaHeaderCollection; + this.xMsOr = xMsOrHeaderCollection; + } + + /** + * Get the xMsIsCurrentVersion property: The x-ms-is-current-version property. + * + * @return the xMsIsCurrentVersion value. + */ + public Boolean isXMsIsCurrentVersion() { + return this.xMsIsCurrentVersion; + } + + /** + * Set the xMsIsCurrentVersion property: The x-ms-is-current-version property. + * + * @param xMsIsCurrentVersion the xMsIsCurrentVersion value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsIsCurrentVersion(Boolean xMsIsCurrentVersion) { + this.xMsIsCurrentVersion = xMsIsCurrentVersion; + return this; + } + + /** + * Get the xMsLeaseStatus property: The x-ms-lease-status property. + * + * @return the xMsLeaseStatus value. + */ + public LeaseStatusType getXMsLeaseStatus() { + return this.xMsLeaseStatus; + } + + /** + * Set the xMsLeaseStatus property: The x-ms-lease-status property. + * + * @param xMsLeaseStatus the xMsLeaseStatus value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsLeaseStatus(LeaseStatusType xMsLeaseStatus) { + this.xMsLeaseStatus = xMsLeaseStatus; + return this; + } + + /** + * Get the xMsTagCount property: The x-ms-tag-count property. + * + * @return the xMsTagCount value. + */ + public Long getXMsTagCount() { + return this.xMsTagCount; + } + + /** + * Set the xMsTagCount property: The x-ms-tag-count property. + * + * @param xMsTagCount the xMsTagCount value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsTagCount(Long xMsTagCount) { + this.xMsTagCount = xMsTagCount; + return this; + } + + /** + * Get the contentRange property: The Content-Range property. + * + * @return the contentRange value. + */ + public String getContentRange() { + return this.contentRange; + } + + /** + * Set the contentRange property: The Content-Range property. + * + * @param contentRange the contentRange value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setContentRange(String contentRange) { + this.contentRange = contentRange; + return this; + } + + /** + * Get the xMsLeaseState property: The x-ms-lease-state property. + * + * @return the xMsLeaseState value. + */ + public LeaseStateType getXMsLeaseState() { + return this.xMsLeaseState; + } + + /** + * Set the xMsLeaseState property: The x-ms-lease-state property. + * + * @param xMsLeaseState the xMsLeaseState value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsLeaseState(LeaseStateType xMsLeaseState) { + this.xMsLeaseState = xMsLeaseState; + return this; + } + + /** + * Get the xMsBlobSealed property: The x-ms-blob-sealed property. + * + * @return the xMsBlobSealed value. + */ + public Boolean isXMsBlobSealed() { + return this.xMsBlobSealed; + } + + /** + * Set the xMsBlobSealed property: The x-ms-blob-sealed property. + * + * @param xMsBlobSealed the xMsBlobSealed value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsBlobSealed(Boolean xMsBlobSealed) { + this.xMsBlobSealed = xMsBlobSealed; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsVersionId property: The x-ms-version-id property. + * + * @return the xMsVersionId value. + */ + public String getXMsVersionId() { + return this.xMsVersionId; + } + + /** + * Set the xMsVersionId property: The x-ms-version-id property. + * + * @param xMsVersionId the xMsVersionId value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsVersionId(String xMsVersionId) { + this.xMsVersionId = xMsVersionId; + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String getXMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsStructuredBody property: The x-ms-structured-body property. + * + * @return the xMsStructuredBody value. + */ + public String getXMsStructuredBody() { + return this.xMsStructuredBody; + } + + /** + * Set the xMsStructuredBody property: The x-ms-structured-body property. + * + * @param xMsStructuredBody the xMsStructuredBody value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsStructuredBody(String xMsStructuredBody) { + this.xMsStructuredBody = xMsStructuredBody; + return this; + } + + /** + * Get the xMsBlobType property: The x-ms-blob-type property. + * + * @return the xMsBlobType value. + */ + public BlobType getXMsBlobType() { + return this.xMsBlobType; + } + + /** + * Set the xMsBlobType property: The x-ms-blob-type property. + * + * @param xMsBlobType the xMsBlobType value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsBlobType(BlobType xMsBlobType) { + this.xMsBlobType = xMsBlobType; + return this; + } + + /** + * Get the xMsImmutabilityPolicyMode property: The x-ms-immutability-policy-mode property. + * + * @return the xMsImmutabilityPolicyMode value. + */ + public String getXMsImmutabilityPolicyMode() { + return this.xMsImmutabilityPolicyMode; + } + + /** + * Set the xMsImmutabilityPolicyMode property: The x-ms-immutability-policy-mode property. + * + * @param xMsImmutabilityPolicyMode the xMsImmutabilityPolicyMode value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsImmutabilityPolicyMode(String xMsImmutabilityPolicyMode) { + this.xMsImmutabilityPolicyMode = xMsImmutabilityPolicyMode; + return this; + } + + /** + * Get the xMsStructuredContentLength property: The x-ms-structured-content-length property. + * + * @return the xMsStructuredContentLength value. + */ + public Long getXMsStructuredContentLength() { + return this.xMsStructuredContentLength; + } + + /** + * Set the xMsStructuredContentLength property: The x-ms-structured-content-length property. + * + * @param xMsStructuredContentLength the xMsStructuredContentLength value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsStructuredContentLength(Long xMsStructuredContentLength) { + this.xMsStructuredContentLength = xMsStructuredContentLength; + return this; + } + + /** + * Get the contentEncoding property: The Content-Encoding property. + * + * @return the contentEncoding value. + */ + public String getContentEncoding() { + return this.contentEncoding; + } + + /** + * Set the contentEncoding property: The Content-Encoding property. + * + * @param contentEncoding the contentEncoding value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setContentEncoding(String contentEncoding) { + this.contentEncoding = contentEncoding; + return this; + } + + /** + * Get the xMsCopyStatusDescription property: The x-ms-copy-status-description property. + * + * @return the xMsCopyStatusDescription value. + */ + public String getXMsCopyStatusDescription() { + return this.xMsCopyStatusDescription; + } + + /** + * Set the xMsCopyStatusDescription property: The x-ms-copy-status-description property. + * + * @param xMsCopyStatusDescription the xMsCopyStatusDescription value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsCopyStatusDescription(String xMsCopyStatusDescription) { + this.xMsCopyStatusDescription = xMsCopyStatusDescription; + return this; + } + + /** + * Get the xMsCreationTime property: The x-ms-creation-time property. + * + * @return the xMsCreationTime value. + */ + public OffsetDateTime getXMsCreationTime() { + if (this.xMsCreationTime == null) { + return null; + } + return this.xMsCreationTime.getDateTime(); + } + + /** + * Set the xMsCreationTime property: The x-ms-creation-time property. + * + * @param xMsCreationTime the xMsCreationTime value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsCreationTime(OffsetDateTime xMsCreationTime) { + if (xMsCreationTime == null) { + this.xMsCreationTime = null; + } else { + this.xMsCreationTime = new DateTimeRfc1123(xMsCreationTime); + } + return this; + } + + /** + * Get the xMsLeaseDuration property: The x-ms-lease-duration property. + * + * @return the xMsLeaseDuration value. + */ + public LeaseDurationType getXMsLeaseDuration() { + return this.xMsLeaseDuration; + } + + /** + * Set the xMsLeaseDuration property: The x-ms-lease-duration property. + * + * @param xMsLeaseDuration the xMsLeaseDuration value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsLeaseDuration(LeaseDurationType xMsLeaseDuration) { + this.xMsLeaseDuration = xMsLeaseDuration; + return this; + } + + /** + * Get the contentLength property: The Content-Length property. + * + * @return the contentLength value. + */ + public Long getContentLength() { + return this.contentLength; + } + + /** + * Set the contentLength property: The Content-Length property. + * + * @param contentLength the contentLength value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setContentLength(Long contentLength) { + this.contentLength = contentLength; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the contentType property: The Content-Type property. + * + * @return the contentType value. + */ + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The Content-Type property. + * + * @param contentType the contentType value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the xMsLastAccessTime property: The x-ms-last-access-time property. + * + * @return the xMsLastAccessTime value. + */ + public OffsetDateTime getXMsLastAccessTime() { + if (this.xMsLastAccessTime == null) { + return null; + } + return this.xMsLastAccessTime.getDateTime(); + } + + /** + * Set the xMsLastAccessTime property: The x-ms-last-access-time property. + * + * @param xMsLastAccessTime the xMsLastAccessTime value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsLastAccessTime(OffsetDateTime xMsLastAccessTime) { + if (xMsLastAccessTime == null) { + this.xMsLastAccessTime = null; + } else { + this.xMsLastAccessTime = new DateTimeRfc1123(xMsLastAccessTime); + } + return this; + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsCopyId property: The x-ms-copy-id property. + * + * @return the xMsCopyId value. + */ + public String getXMsCopyId() { + return this.xMsCopyId; + } + + /** + * Set the xMsCopyId property: The x-ms-copy-id property. + * + * @param xMsCopyId the xMsCopyId value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsCopyId(String xMsCopyId) { + this.xMsCopyId = xMsCopyId; + return this; + } + + /** + * Get the xMsCopySource property: The x-ms-copy-source property. + * + * @return the xMsCopySource value. + */ + public String getXMsCopySource() { + return this.xMsCopySource; + } + + /** + * Set the xMsCopySource property: The x-ms-copy-source property. + * + * @param xMsCopySource the xMsCopySource value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsCopySource(String xMsCopySource) { + this.xMsCopySource = xMsCopySource; + return this; + } + + /** + * Get the xMsImmutabilityPolicyUntilDate property: The x-ms-immutability-policy-until-date property. + * + * @return the xMsImmutabilityPolicyUntilDate value. + */ + public OffsetDateTime getXMsImmutabilityPolicyUntilDate() { + if (this.xMsImmutabilityPolicyUntilDate == null) { + return null; + } + return this.xMsImmutabilityPolicyUntilDate.getDateTime(); + } + + /** + * Set the xMsImmutabilityPolicyUntilDate property: The x-ms-immutability-policy-until-date property. + * + * @param xMsImmutabilityPolicyUntilDate the xMsImmutabilityPolicyUntilDate value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsImmutabilityPolicyUntilDate(OffsetDateTime xMsImmutabilityPolicyUntilDate) { + if (xMsImmutabilityPolicyUntilDate == null) { + this.xMsImmutabilityPolicyUntilDate = null; + } else { + this.xMsImmutabilityPolicyUntilDate = new DateTimeRfc1123(xMsImmutabilityPolicyUntilDate); + } + return this; + } + + /** + * Get the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return this.xMsContentCrc64; + } + + /** + * Set the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = xMsContentCrc64; + return this; + } + + /** + * Get the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @return the xMsBlobSequenceNumber value. + */ + public Long getXMsBlobSequenceNumber() { + return this.xMsBlobSequenceNumber; + } + + /** + * Set the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @param xMsBlobSequenceNumber the xMsBlobSequenceNumber value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsBlobSequenceNumber(Long xMsBlobSequenceNumber) { + this.xMsBlobSequenceNumber = xMsBlobSequenceNumber; + return this; + } + + /** + * Get the xMsCopyProgress property: The x-ms-copy-progress property. + * + * @return the xMsCopyProgress value. + */ + public String getXMsCopyProgress() { + return this.xMsCopyProgress; + } + + /** + * Set the xMsCopyProgress property: The x-ms-copy-progress property. + * + * @param xMsCopyProgress the xMsCopyProgress value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsCopyProgress(String xMsCopyProgress) { + this.xMsCopyProgress = xMsCopyProgress; + return this; + } + + /** + * Get the xMsBlobCommittedBlockCount property: The x-ms-blob-committed-block-count property. + * + * @return the xMsBlobCommittedBlockCount value. + */ + public Integer getXMsBlobCommittedBlockCount() { + return this.xMsBlobCommittedBlockCount; + } + + /** + * Set the xMsBlobCommittedBlockCount property: The x-ms-blob-committed-block-count property. + * + * @param xMsBlobCommittedBlockCount the xMsBlobCommittedBlockCount value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsBlobCommittedBlockCount(Integer xMsBlobCommittedBlockCount) { + this.xMsBlobCommittedBlockCount = xMsBlobCommittedBlockCount; + return this; + } + + /** + * Get the xMsBlobContentMd5 property: The x-ms-blob-content-md5 property. + * + * @return the xMsBlobContentMd5 value. + */ + public byte[] getXMsBlobContentMd5() { + return this.xMsBlobContentMd5; + } + + /** + * Set the xMsBlobContentMd5 property: The x-ms-blob-content-md5 property. + * + * @param xMsBlobContentMd5 the xMsBlobContentMd5 value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsBlobContentMd5(byte[] xMsBlobContentMd5) { + this.xMsBlobContentMd5 = xMsBlobContentMd5; + return this; + } + + /** + * Get the xMsMeta property: The x-ms-meta- property. + * + * @return the xMsMeta value. + */ + public Map getXMsMeta() { + return this.xMsMeta; + } + + /** + * Set the xMsMeta property: The x-ms-meta- property. + * + * @param xMsMeta the xMsMeta value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsMeta(Map xMsMeta) { + this.xMsMeta = xMsMeta; + return this; + } + + /** + * Get the xMsLegalHold property: The x-ms-legal-hold property. + * + * @return the xMsLegalHold value. + */ + public Boolean isXMsLegalHold() { + return this.xMsLegalHold; + } + + /** + * Set the xMsLegalHold property: The x-ms-legal-hold property. + * + * @param xMsLegalHold the xMsLegalHold value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsLegalHold(Boolean xMsLegalHold) { + this.xMsLegalHold = xMsLegalHold; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentMD5 property: The Content-MD5 property. + * + * @return the contentMD5 value. + */ + public byte[] getContentMD5() { + return this.contentMD5; + } + + /** + * Set the contentMD5 property: The Content-MD5 property. + * + * @param contentMD5 the contentMD5 value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setContentMD5(byte[] contentMD5) { + this.contentMD5 = contentMD5; + return this; + } + + /** + * Get the xMsCopyCompletionTime property: The x-ms-copy-completion-time property. + * + * @return the xMsCopyCompletionTime value. + */ + public OffsetDateTime getXMsCopyCompletionTime() { + if (this.xMsCopyCompletionTime == null) { + return null; + } + return this.xMsCopyCompletionTime.getDateTime(); + } + + /** + * Set the xMsCopyCompletionTime property: The x-ms-copy-completion-time property. + * + * @param xMsCopyCompletionTime the xMsCopyCompletionTime value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsCopyCompletionTime(OffsetDateTime xMsCopyCompletionTime) { + if (xMsCopyCompletionTime == null) { + this.xMsCopyCompletionTime = null; + } else { + this.xMsCopyCompletionTime = new DateTimeRfc1123(xMsCopyCompletionTime); + } + return this; + } + + /** + * Get the acceptRanges property: The Accept-Ranges property. + * + * @return the acceptRanges value. + */ + public String getAcceptRanges() { + return this.acceptRanges; + } + + /** + * Set the acceptRanges property: The Accept-Ranges property. + * + * @param acceptRanges the acceptRanges value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setAcceptRanges(String acceptRanges) { + this.acceptRanges = acceptRanges; + return this; + } + + /** + * Get the xMsServerEncrypted property: The x-ms-server-encrypted property. + * + * @return the xMsServerEncrypted value. + */ + public Boolean isXMsServerEncrypted() { + return this.xMsServerEncrypted; + } + + /** + * Set the xMsServerEncrypted property: The x-ms-server-encrypted property. + * + * @param xMsServerEncrypted the xMsServerEncrypted value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsServerEncrypted(Boolean xMsServerEncrypted) { + this.xMsServerEncrypted = xMsServerEncrypted; + return this; + } + + /** + * Get the xMsOrPolicyId property: The x-ms-or-policy-id property. + * + * @return the xMsOrPolicyId value. + */ + public String getXMsOrPolicyId() { + return this.xMsOrPolicyId; + } + + /** + * Set the xMsOrPolicyId property: The x-ms-or-policy-id property. + * + * @param xMsOrPolicyId the xMsOrPolicyId value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsOrPolicyId(String xMsOrPolicyId) { + this.xMsOrPolicyId = xMsOrPolicyId; + return this; + } + + /** + * Get the cacheControl property: The Cache-Control property. + * + * @return the cacheControl value. + */ + public String getCacheControl() { + return this.cacheControl; + } + + /** + * Set the cacheControl property: The Cache-Control property. + * + * @param cacheControl the cacheControl value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setCacheControl(String cacheControl) { + this.cacheControl = cacheControl; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the contentDisposition property: The Content-Disposition property. + * + * @return the contentDisposition value. + */ + public String getContentDisposition() { + return this.contentDisposition; + } + + /** + * Set the contentDisposition property: The Content-Disposition property. + * + * @param contentDisposition the contentDisposition value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setContentDisposition(String contentDisposition) { + this.contentDisposition = contentDisposition; + return this; + } + + /** + * Get the xMsCopyStatus property: The x-ms-copy-status property. + * + * @return the xMsCopyStatus value. + */ + public CopyStatusType getXMsCopyStatus() { + return this.xMsCopyStatus; + } + + /** + * Set the xMsCopyStatus property: The x-ms-copy-status property. + * + * @param xMsCopyStatus the xMsCopyStatus value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsCopyStatus(CopyStatusType xMsCopyStatus) { + this.xMsCopyStatus = xMsCopyStatus; + return this; + } + + /** + * Get the contentLanguage property: The Content-Language property. + * + * @return the contentLanguage value. + */ + public String getContentLanguage() { + return this.contentLanguage; + } + + /** + * Set the contentLanguage property: The Content-Language property. + * + * @param contentLanguage the contentLanguage value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setContentLanguage(String contentLanguage) { + this.contentLanguage = contentLanguage; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the xMsOr property: The x-ms-or- property. + * + * @return the xMsOr value. + */ + public Map getXMsOr() { + return this.xMsOr; + } + + /** + * Set the xMsOr property: The x-ms-or- property. + * + * @param xMsOr the xMsOr value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsOr(Map xMsOr) { + this.xMsOr = xMsOr; + return this; + } + + /** + * Get the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @return the xMsEncryptionScope value. + */ + public String getXMsEncryptionScope() { + return this.xMsEncryptionScope; + } + + /** + * Set the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @param xMsEncryptionScope the xMsEncryptionScope value to set. + * @return the BlobsDownloadHeaders object itself. + */ + public BlobsDownloadHeaders setXMsEncryptionScope(String xMsEncryptionScope) { + this.xMsEncryptionScope = xMsEncryptionScope; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsGetAccountInfoHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsGetAccountInfoHeaders.java new file mode 100644 index 000000000000..c568884fc9ec --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsGetAccountInfoHeaders.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsGetAccountInfoHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsGetAccountInfoHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-account-kind property. + */ + private AccountKind xMsAccountKind; + + /* + * The x-ms-is-hns-enabled property. + */ + private Boolean xMsIsHnsEnabled; + + /* + * The x-ms-sku-name property. + */ + private SkuName xMsSkuName; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_ACCOUNT_KIND = HttpHeaderName.fromString("x-ms-account-kind"); + + private static final HttpHeaderName X_MS_IS_HNS_ENABLED = HttpHeaderName.fromString("x-ms-is-hns-enabled"); + + private static final HttpHeaderName X_MS_SKU_NAME = HttpHeaderName.fromString("x-ms-sku-name"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsGetAccountInfoHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsGetAccountInfoHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + String xMsAccountKind = rawHeaders.getValue(X_MS_ACCOUNT_KIND); + if (xMsAccountKind != null) { + this.xMsAccountKind = AccountKind.fromString(xMsAccountKind); + } + String xMsIsHnsEnabled = rawHeaders.getValue(X_MS_IS_HNS_ENABLED); + if (xMsIsHnsEnabled != null) { + this.xMsIsHnsEnabled = Boolean.parseBoolean(xMsIsHnsEnabled); + } + String xMsSkuName = rawHeaders.getValue(X_MS_SKU_NAME); + if (xMsSkuName != null) { + this.xMsSkuName = SkuName.fromString(xMsSkuName); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsGetAccountInfoHeaders object itself. + */ + public BlobsGetAccountInfoHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsAccountKind property: The x-ms-account-kind property. + * + * @return the xMsAccountKind value. + */ + public AccountKind getXMsAccountKind() { + return this.xMsAccountKind; + } + + /** + * Set the xMsAccountKind property: The x-ms-account-kind property. + * + * @param xMsAccountKind the xMsAccountKind value to set. + * @return the BlobsGetAccountInfoHeaders object itself. + */ + public BlobsGetAccountInfoHeaders setXMsAccountKind(AccountKind xMsAccountKind) { + this.xMsAccountKind = xMsAccountKind; + return this; + } + + /** + * Get the xMsIsHnsEnabled property: The x-ms-is-hns-enabled property. + * + * @return the xMsIsHnsEnabled value. + */ + public Boolean isXMsIsHnsEnabled() { + return this.xMsIsHnsEnabled; + } + + /** + * Set the xMsIsHnsEnabled property: The x-ms-is-hns-enabled property. + * + * @param xMsIsHnsEnabled the xMsIsHnsEnabled value to set. + * @return the BlobsGetAccountInfoHeaders object itself. + */ + public BlobsGetAccountInfoHeaders setXMsIsHnsEnabled(Boolean xMsIsHnsEnabled) { + this.xMsIsHnsEnabled = xMsIsHnsEnabled; + return this; + } + + /** + * Get the xMsSkuName property: The x-ms-sku-name property. + * + * @return the xMsSkuName value. + */ + public SkuName getXMsSkuName() { + return this.xMsSkuName; + } + + /** + * Set the xMsSkuName property: The x-ms-sku-name property. + * + * @param xMsSkuName the xMsSkuName value to set. + * @return the BlobsGetAccountInfoHeaders object itself. + */ + public BlobsGetAccountInfoHeaders setXMsSkuName(SkuName xMsSkuName) { + this.xMsSkuName = xMsSkuName; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsGetAccountInfoHeaders object itself. + */ + public BlobsGetAccountInfoHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsGetAccountInfoHeaders object itself. + */ + public BlobsGetAccountInfoHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsGetAccountInfoHeaders object itself. + */ + public BlobsGetAccountInfoHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsGetPropertiesHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsGetPropertiesHeaders.java new file mode 100644 index 000000000000..8a60c9a7d636 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsGetPropertiesHeaders.java @@ -0,0 +1,1531 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Base64; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The BlobsGetPropertiesHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsGetPropertiesHeaders { + /* + * The x-ms-is-current-version property. + */ + private Boolean xMsIsCurrentVersion; + + /* + * The x-ms-lease-status property. + */ + private LeaseStatusType xMsLeaseStatus; + + /* + * The x-ms-copy-destination-snapshot property. + */ + private String xMsCopyDestinationSnapshot; + + /* + * The x-ms-lease-state property. + */ + private LeaseStateType xMsLeaseState; + + /* + * The x-ms-blob-sealed property. + */ + private Boolean xMsBlobSealed; + + /* + * The x-ms-version-id property. + */ + private String xMsVersionId; + + /* + * The x-ms-encryption-key-sha256 property. + */ + private String xMsEncryptionKeySha256; + + /* + * The x-ms-access-tier-change-time property. + */ + private DateTimeRfc1123 xMsAccessTierChangeTime; + + /* + * The x-ms-blob-type property. + */ + private BlobType xMsBlobType; + + /* + * The Content-Encoding property. + */ + private String contentEncoding; + + /* + * The x-ms-creation-time property. + */ + private DateTimeRfc1123 xMsCreationTime; + + /* + * The x-ms-incremental-copy property. + */ + private Boolean xMsIncrementalCopy; + + /* + * The x-ms-lease-duration property. + */ + private LeaseDurationType xMsLeaseDuration; + + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-copy-id property. + */ + private String xMsCopyId; + + /* + * The x-ms-immutability-policy-until-date property. + */ + private DateTimeRfc1123 xMsImmutabilityPolicyUntilDate; + + /* + * The x-ms-blob-sequence-number property. + */ + private Long xMsBlobSequenceNumber; + + /* + * The x-ms-blob-committed-block-count property. + */ + private Integer xMsBlobCommittedBlockCount; + + /* + * The x-ms-legal-hold property. + */ + private Boolean xMsLegalHold; + + /* + * The Content-MD5 property. + */ + private byte[] contentMD5; + + /* + * The x-ms-or-policy-id property. + */ + private String xMsOrPolicyId; + + /* + * The Cache-Control property. + */ + private String cacheControl; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Content-Disposition property. + */ + private String contentDisposition; + + /* + * The Content-Language property. + */ + private String contentLanguage; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The x-ms-or- property. + */ + private Map xMsOr; + + /* + * The x-ms-encryption-scope property. + */ + private String xMsEncryptionScope; + + /* + * The x-ms-tag-count property. + */ + private Long xMsTagCount; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-access-tier-inferred property. + */ + private Boolean xMsAccessTierInferred; + + /* + * The x-ms-immutability-policy-mode property. + */ + private BlobImmutabilityPolicyMode xMsImmutabilityPolicyMode; + + /* + * The x-ms-access-tier property. + */ + private String xMsAccessTier; + + /* + * The x-ms-copy-status-description property. + */ + private String xMsCopyStatusDescription; + + /* + * The Content-Length property. + */ + private Long contentLength; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The Content-Type property. + */ + private String contentType; + + /* + * The x-ms-last-access-time property. + */ + private DateTimeRfc1123 xMsLastAccessTime; + + /* + * The x-ms-copy-source property. + */ + private String xMsCopySource; + + /* + * The x-ms-copy-progress property. + */ + private String xMsCopyProgress; + + /* + * The x-ms-meta- property. + */ + private Map xMsMeta; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The x-ms-expiry-time property. + */ + private DateTimeRfc1123 xMsExpiryTime; + + /* + * The x-ms-copy-completion-time property. + */ + private DateTimeRfc1123 xMsCopyCompletionTime; + + /* + * The Accept-Ranges property. + */ + private String acceptRanges; + + /* + * The x-ms-server-encrypted property. + */ + private Boolean xMsServerEncrypted; + + /* + * The x-ms-rehydrate-priority property. + */ + private String xMsRehydratePriority; + + /* + * The x-ms-copy-status property. + */ + private CopyStatusType xMsCopyStatus; + + /* + * The x-ms-archive-status property. + */ + private String xMsArchiveStatus; + + private static final HttpHeaderName X_MS_IS_CURRENT_VERSION = HttpHeaderName.fromString("x-ms-is-current-version"); + + private static final HttpHeaderName X_MS_LEASE_STATUS = HttpHeaderName.fromString("x-ms-lease-status"); + + private static final HttpHeaderName X_MS_COPY_DESTINATION_SNAPSHOT + = HttpHeaderName.fromString("x-ms-copy-destination-snapshot"); + + private static final HttpHeaderName X_MS_LEASE_STATE = HttpHeaderName.fromString("x-ms-lease-state"); + + private static final HttpHeaderName X_MS_BLOB_SEALED = HttpHeaderName.fromString("x-ms-blob-sealed"); + + private static final HttpHeaderName X_MS_VERSION_ID = HttpHeaderName.fromString("x-ms-version-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_KEY_SHA256 + = HttpHeaderName.fromString("x-ms-encryption-key-sha256"); + + private static final HttpHeaderName X_MS_ACCESS_TIER_CHANGE_TIME + = HttpHeaderName.fromString("x-ms-access-tier-change-time"); + + private static final HttpHeaderName X_MS_BLOB_TYPE = HttpHeaderName.fromString("x-ms-blob-type"); + + private static final HttpHeaderName X_MS_CREATION_TIME = HttpHeaderName.fromString("x-ms-creation-time"); + + private static final HttpHeaderName X_MS_INCREMENTAL_COPY = HttpHeaderName.fromString("x-ms-incremental-copy"); + + private static final HttpHeaderName X_MS_LEASE_DURATION = HttpHeaderName.fromString("x-ms-lease-duration"); + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_COPY_ID = HttpHeaderName.fromString("x-ms-copy-id"); + + private static final HttpHeaderName X_MS_IMMUTABILITY_POLICY_UNTIL_DATE + = HttpHeaderName.fromString("x-ms-immutability-policy-until-date"); + + private static final HttpHeaderName X_MS_BLOB_SEQUENCE_NUMBER + = HttpHeaderName.fromString("x-ms-blob-sequence-number"); + + private static final HttpHeaderName X_MS_BLOB_COMMITTED_BLOCK_COUNT + = HttpHeaderName.fromString("x-ms-blob-committed-block-count"); + + private static final HttpHeaderName X_MS_LEGAL_HOLD = HttpHeaderName.fromString("x-ms-legal-hold"); + + private static final HttpHeaderName X_MS_OR_POLICY_ID = HttpHeaderName.fromString("x-ms-or-policy-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_SCOPE = HttpHeaderName.fromString("x-ms-encryption-scope"); + + private static final HttpHeaderName X_MS_TAG_COUNT = HttpHeaderName.fromString("x-ms-tag-count"); + + private static final HttpHeaderName X_MS_ACCESS_TIER_INFERRED + = HttpHeaderName.fromString("x-ms-access-tier-inferred"); + + private static final HttpHeaderName X_MS_IMMUTABILITY_POLICY_MODE + = HttpHeaderName.fromString("x-ms-immutability-policy-mode"); + + private static final HttpHeaderName X_MS_ACCESS_TIER = HttpHeaderName.fromString("x-ms-access-tier"); + + private static final HttpHeaderName X_MS_COPY_STATUS_DESCRIPTION + = HttpHeaderName.fromString("x-ms-copy-status-description"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_LAST_ACCESS_TIME = HttpHeaderName.fromString("x-ms-last-access-time"); + + private static final HttpHeaderName X_MS_COPY_SOURCE = HttpHeaderName.fromString("x-ms-copy-source"); + + private static final HttpHeaderName X_MS_COPY_PROGRESS = HttpHeaderName.fromString("x-ms-copy-progress"); + + private static final HttpHeaderName X_MS_EXPIRY_TIME = HttpHeaderName.fromString("x-ms-expiry-time"); + + private static final HttpHeaderName X_MS_COPY_COMPLETION_TIME + = HttpHeaderName.fromString("x-ms-copy-completion-time"); + + private static final HttpHeaderName X_MS_SERVER_ENCRYPTED = HttpHeaderName.fromString("x-ms-server-encrypted"); + + private static final HttpHeaderName X_MS_REHYDRATE_PRIORITY = HttpHeaderName.fromString("x-ms-rehydrate-priority"); + + private static final HttpHeaderName X_MS_COPY_STATUS = HttpHeaderName.fromString("x-ms-copy-status"); + + private static final HttpHeaderName X_MS_ARCHIVE_STATUS = HttpHeaderName.fromString("x-ms-archive-status"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsGetPropertiesHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsGetPropertiesHeaders(HttpHeaders rawHeaders) { + String xMsIsCurrentVersion = rawHeaders.getValue(X_MS_IS_CURRENT_VERSION); + if (xMsIsCurrentVersion != null) { + this.xMsIsCurrentVersion = Boolean.parseBoolean(xMsIsCurrentVersion); + } + String xMsLeaseStatus = rawHeaders.getValue(X_MS_LEASE_STATUS); + if (xMsLeaseStatus != null) { + this.xMsLeaseStatus = LeaseStatusType.fromString(xMsLeaseStatus); + } + this.xMsCopyDestinationSnapshot = rawHeaders.getValue(X_MS_COPY_DESTINATION_SNAPSHOT); + String xMsLeaseState = rawHeaders.getValue(X_MS_LEASE_STATE); + if (xMsLeaseState != null) { + this.xMsLeaseState = LeaseStateType.fromString(xMsLeaseState); + } + String xMsBlobSealed = rawHeaders.getValue(X_MS_BLOB_SEALED); + if (xMsBlobSealed != null) { + this.xMsBlobSealed = Boolean.parseBoolean(xMsBlobSealed); + } + this.xMsVersionId = rawHeaders.getValue(X_MS_VERSION_ID); + this.xMsEncryptionKeySha256 = rawHeaders.getValue(X_MS_ENCRYPTION_KEY_SHA256); + String xMsAccessTierChangeTime = rawHeaders.getValue(X_MS_ACCESS_TIER_CHANGE_TIME); + if (xMsAccessTierChangeTime != null) { + this.xMsAccessTierChangeTime = new DateTimeRfc1123(xMsAccessTierChangeTime); + } + String xMsBlobType = rawHeaders.getValue(X_MS_BLOB_TYPE); + if (xMsBlobType != null) { + this.xMsBlobType = BlobType.fromString(xMsBlobType); + } + this.contentEncoding = rawHeaders.getValue(HttpHeaderName.CONTENT_ENCODING); + String xMsCreationTime = rawHeaders.getValue(X_MS_CREATION_TIME); + if (xMsCreationTime != null) { + this.xMsCreationTime = new DateTimeRfc1123(xMsCreationTime); + } + String xMsIncrementalCopy = rawHeaders.getValue(X_MS_INCREMENTAL_COPY); + if (xMsIncrementalCopy != null) { + this.xMsIncrementalCopy = Boolean.parseBoolean(xMsIncrementalCopy); + } + String xMsLeaseDuration = rawHeaders.getValue(X_MS_LEASE_DURATION); + if (xMsLeaseDuration != null) { + this.xMsLeaseDuration = LeaseDurationType.fromString(xMsLeaseDuration); + } + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsCopyId = rawHeaders.getValue(X_MS_COPY_ID); + String xMsImmutabilityPolicyUntilDate = rawHeaders.getValue(X_MS_IMMUTABILITY_POLICY_UNTIL_DATE); + if (xMsImmutabilityPolicyUntilDate != null) { + this.xMsImmutabilityPolicyUntilDate = new DateTimeRfc1123(xMsImmutabilityPolicyUntilDate); + } + String xMsBlobSequenceNumber = rawHeaders.getValue(X_MS_BLOB_SEQUENCE_NUMBER); + if (xMsBlobSequenceNumber != null) { + this.xMsBlobSequenceNumber = Long.parseLong(xMsBlobSequenceNumber); + } + String xMsBlobCommittedBlockCount = rawHeaders.getValue(X_MS_BLOB_COMMITTED_BLOCK_COUNT); + if (xMsBlobCommittedBlockCount != null) { + this.xMsBlobCommittedBlockCount = Integer.parseInt(xMsBlobCommittedBlockCount); + } + String xMsLegalHold = rawHeaders.getValue(X_MS_LEGAL_HOLD); + if (xMsLegalHold != null) { + this.xMsLegalHold = Boolean.parseBoolean(xMsLegalHold); + } + String contentMD5 = rawHeaders.getValue(HttpHeaderName.CONTENT_MD5); + if (contentMD5 != null) { + this.contentMD5 = Base64.getDecoder().decode(contentMD5); + } + this.xMsOrPolicyId = rawHeaders.getValue(X_MS_OR_POLICY_ID); + this.cacheControl = rawHeaders.getValue(HttpHeaderName.CACHE_CONTROL); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + this.contentDisposition = rawHeaders.getValue(HttpHeaderName.CONTENT_DISPOSITION); + this.contentLanguage = rawHeaders.getValue(HttpHeaderName.CONTENT_LANGUAGE); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + this.xMsEncryptionScope = rawHeaders.getValue(X_MS_ENCRYPTION_SCOPE); + String xMsTagCount = rawHeaders.getValue(X_MS_TAG_COUNT); + if (xMsTagCount != null) { + this.xMsTagCount = Long.parseLong(xMsTagCount); + } + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + String xMsAccessTierInferred = rawHeaders.getValue(X_MS_ACCESS_TIER_INFERRED); + if (xMsAccessTierInferred != null) { + this.xMsAccessTierInferred = Boolean.parseBoolean(xMsAccessTierInferred); + } + String xMsImmutabilityPolicyMode = rawHeaders.getValue(X_MS_IMMUTABILITY_POLICY_MODE); + if (xMsImmutabilityPolicyMode != null) { + this.xMsImmutabilityPolicyMode = BlobImmutabilityPolicyMode.fromString(xMsImmutabilityPolicyMode); + } + this.xMsAccessTier = rawHeaders.getValue(X_MS_ACCESS_TIER); + this.xMsCopyStatusDescription = rawHeaders.getValue(X_MS_COPY_STATUS_DESCRIPTION); + String contentLength = rawHeaders.getValue(HttpHeaderName.CONTENT_LENGTH); + if (contentLength != null) { + this.contentLength = Long.parseLong(contentLength); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.contentType = rawHeaders.getValue(HttpHeaderName.CONTENT_TYPE); + String xMsLastAccessTime = rawHeaders.getValue(X_MS_LAST_ACCESS_TIME); + if (xMsLastAccessTime != null) { + this.xMsLastAccessTime = new DateTimeRfc1123(xMsLastAccessTime); + } + this.xMsCopySource = rawHeaders.getValue(X_MS_COPY_SOURCE); + this.xMsCopyProgress = rawHeaders.getValue(X_MS_COPY_PROGRESS); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + String xMsExpiryTime = rawHeaders.getValue(X_MS_EXPIRY_TIME); + if (xMsExpiryTime != null) { + this.xMsExpiryTime = new DateTimeRfc1123(xMsExpiryTime); + } + String xMsCopyCompletionTime = rawHeaders.getValue(X_MS_COPY_COMPLETION_TIME); + if (xMsCopyCompletionTime != null) { + this.xMsCopyCompletionTime = new DateTimeRfc1123(xMsCopyCompletionTime); + } + this.acceptRanges = rawHeaders.getValue(HttpHeaderName.ACCEPT_RANGES); + String xMsServerEncrypted = rawHeaders.getValue(X_MS_SERVER_ENCRYPTED); + if (xMsServerEncrypted != null) { + this.xMsServerEncrypted = Boolean.parseBoolean(xMsServerEncrypted); + } + this.xMsRehydratePriority = rawHeaders.getValue(X_MS_REHYDRATE_PRIORITY); + String xMsCopyStatus = rawHeaders.getValue(X_MS_COPY_STATUS); + if (xMsCopyStatus != null) { + this.xMsCopyStatus = CopyStatusType.fromString(xMsCopyStatus); + } + this.xMsArchiveStatus = rawHeaders.getValue(X_MS_ARCHIVE_STATUS); + Map xMsOrHeaderCollection = new LinkedHashMap<>(); + Map xMsMetaHeaderCollection = new LinkedHashMap<>(); + + rawHeaders.stream().forEach(header -> { + String headerName = header.getName().getValue(); + if (headerName.startsWith("x-ms-or-")) { + xMsOrHeaderCollection.put(headerName.substring(8), header.getValue()); + return; + } + if (headerName.startsWith("x-ms-meta-")) { + xMsMetaHeaderCollection.put(headerName.substring(10), header.getValue()); + } + }); + this.xMsOr = xMsOrHeaderCollection; + this.xMsMeta = xMsMetaHeaderCollection; + } + + /** + * Get the xMsIsCurrentVersion property: The x-ms-is-current-version property. + * + * @return the xMsIsCurrentVersion value. + */ + public Boolean isXMsIsCurrentVersion() { + return this.xMsIsCurrentVersion; + } + + /** + * Set the xMsIsCurrentVersion property: The x-ms-is-current-version property. + * + * @param xMsIsCurrentVersion the xMsIsCurrentVersion value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsIsCurrentVersion(Boolean xMsIsCurrentVersion) { + this.xMsIsCurrentVersion = xMsIsCurrentVersion; + return this; + } + + /** + * Get the xMsLeaseStatus property: The x-ms-lease-status property. + * + * @return the xMsLeaseStatus value. + */ + public LeaseStatusType getXMsLeaseStatus() { + return this.xMsLeaseStatus; + } + + /** + * Set the xMsLeaseStatus property: The x-ms-lease-status property. + * + * @param xMsLeaseStatus the xMsLeaseStatus value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsLeaseStatus(LeaseStatusType xMsLeaseStatus) { + this.xMsLeaseStatus = xMsLeaseStatus; + return this; + } + + /** + * Get the xMsCopyDestinationSnapshot property: The x-ms-copy-destination-snapshot property. + * + * @return the xMsCopyDestinationSnapshot value. + */ + public String getXMsCopyDestinationSnapshot() { + return this.xMsCopyDestinationSnapshot; + } + + /** + * Set the xMsCopyDestinationSnapshot property: The x-ms-copy-destination-snapshot property. + * + * @param xMsCopyDestinationSnapshot the xMsCopyDestinationSnapshot value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsCopyDestinationSnapshot(String xMsCopyDestinationSnapshot) { + this.xMsCopyDestinationSnapshot = xMsCopyDestinationSnapshot; + return this; + } + + /** + * Get the xMsLeaseState property: The x-ms-lease-state property. + * + * @return the xMsLeaseState value. + */ + public LeaseStateType getXMsLeaseState() { + return this.xMsLeaseState; + } + + /** + * Set the xMsLeaseState property: The x-ms-lease-state property. + * + * @param xMsLeaseState the xMsLeaseState value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsLeaseState(LeaseStateType xMsLeaseState) { + this.xMsLeaseState = xMsLeaseState; + return this; + } + + /** + * Get the xMsBlobSealed property: The x-ms-blob-sealed property. + * + * @return the xMsBlobSealed value. + */ + public Boolean isXMsBlobSealed() { + return this.xMsBlobSealed; + } + + /** + * Set the xMsBlobSealed property: The x-ms-blob-sealed property. + * + * @param xMsBlobSealed the xMsBlobSealed value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsBlobSealed(Boolean xMsBlobSealed) { + this.xMsBlobSealed = xMsBlobSealed; + return this; + } + + /** + * Get the xMsVersionId property: The x-ms-version-id property. + * + * @return the xMsVersionId value. + */ + public String getXMsVersionId() { + return this.xMsVersionId; + } + + /** + * Set the xMsVersionId property: The x-ms-version-id property. + * + * @param xMsVersionId the xMsVersionId value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsVersionId(String xMsVersionId) { + this.xMsVersionId = xMsVersionId; + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String getXMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsAccessTierChangeTime property: The x-ms-access-tier-change-time property. + * + * @return the xMsAccessTierChangeTime value. + */ + public OffsetDateTime getXMsAccessTierChangeTime() { + if (this.xMsAccessTierChangeTime == null) { + return null; + } + return this.xMsAccessTierChangeTime.getDateTime(); + } + + /** + * Set the xMsAccessTierChangeTime property: The x-ms-access-tier-change-time property. + * + * @param xMsAccessTierChangeTime the xMsAccessTierChangeTime value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsAccessTierChangeTime(OffsetDateTime xMsAccessTierChangeTime) { + if (xMsAccessTierChangeTime == null) { + this.xMsAccessTierChangeTime = null; + } else { + this.xMsAccessTierChangeTime = new DateTimeRfc1123(xMsAccessTierChangeTime); + } + return this; + } + + /** + * Get the xMsBlobType property: The x-ms-blob-type property. + * + * @return the xMsBlobType value. + */ + public BlobType getXMsBlobType() { + return this.xMsBlobType; + } + + /** + * Set the xMsBlobType property: The x-ms-blob-type property. + * + * @param xMsBlobType the xMsBlobType value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsBlobType(BlobType xMsBlobType) { + this.xMsBlobType = xMsBlobType; + return this; + } + + /** + * Get the contentEncoding property: The Content-Encoding property. + * + * @return the contentEncoding value. + */ + public String getContentEncoding() { + return this.contentEncoding; + } + + /** + * Set the contentEncoding property: The Content-Encoding property. + * + * @param contentEncoding the contentEncoding value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setContentEncoding(String contentEncoding) { + this.contentEncoding = contentEncoding; + return this; + } + + /** + * Get the xMsCreationTime property: The x-ms-creation-time property. + * + * @return the xMsCreationTime value. + */ + public OffsetDateTime getXMsCreationTime() { + if (this.xMsCreationTime == null) { + return null; + } + return this.xMsCreationTime.getDateTime(); + } + + /** + * Set the xMsCreationTime property: The x-ms-creation-time property. + * + * @param xMsCreationTime the xMsCreationTime value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsCreationTime(OffsetDateTime xMsCreationTime) { + if (xMsCreationTime == null) { + this.xMsCreationTime = null; + } else { + this.xMsCreationTime = new DateTimeRfc1123(xMsCreationTime); + } + return this; + } + + /** + * Get the xMsIncrementalCopy property: The x-ms-incremental-copy property. + * + * @return the xMsIncrementalCopy value. + */ + public Boolean isXMsIncrementalCopy() { + return this.xMsIncrementalCopy; + } + + /** + * Set the xMsIncrementalCopy property: The x-ms-incremental-copy property. + * + * @param xMsIncrementalCopy the xMsIncrementalCopy value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsIncrementalCopy(Boolean xMsIncrementalCopy) { + this.xMsIncrementalCopy = xMsIncrementalCopy; + return this; + } + + /** + * Get the xMsLeaseDuration property: The x-ms-lease-duration property. + * + * @return the xMsLeaseDuration value. + */ + public LeaseDurationType getXMsLeaseDuration() { + return this.xMsLeaseDuration; + } + + /** + * Set the xMsLeaseDuration property: The x-ms-lease-duration property. + * + * @param xMsLeaseDuration the xMsLeaseDuration value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsLeaseDuration(LeaseDurationType xMsLeaseDuration) { + this.xMsLeaseDuration = xMsLeaseDuration; + return this; + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsCopyId property: The x-ms-copy-id property. + * + * @return the xMsCopyId value. + */ + public String getXMsCopyId() { + return this.xMsCopyId; + } + + /** + * Set the xMsCopyId property: The x-ms-copy-id property. + * + * @param xMsCopyId the xMsCopyId value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsCopyId(String xMsCopyId) { + this.xMsCopyId = xMsCopyId; + return this; + } + + /** + * Get the xMsImmutabilityPolicyUntilDate property: The x-ms-immutability-policy-until-date property. + * + * @return the xMsImmutabilityPolicyUntilDate value. + */ + public OffsetDateTime getXMsImmutabilityPolicyUntilDate() { + if (this.xMsImmutabilityPolicyUntilDate == null) { + return null; + } + return this.xMsImmutabilityPolicyUntilDate.getDateTime(); + } + + /** + * Set the xMsImmutabilityPolicyUntilDate property: The x-ms-immutability-policy-until-date property. + * + * @param xMsImmutabilityPolicyUntilDate the xMsImmutabilityPolicyUntilDate value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsImmutabilityPolicyUntilDate(OffsetDateTime xMsImmutabilityPolicyUntilDate) { + if (xMsImmutabilityPolicyUntilDate == null) { + this.xMsImmutabilityPolicyUntilDate = null; + } else { + this.xMsImmutabilityPolicyUntilDate = new DateTimeRfc1123(xMsImmutabilityPolicyUntilDate); + } + return this; + } + + /** + * Get the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @return the xMsBlobSequenceNumber value. + */ + public Long getXMsBlobSequenceNumber() { + return this.xMsBlobSequenceNumber; + } + + /** + * Set the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @param xMsBlobSequenceNumber the xMsBlobSequenceNumber value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsBlobSequenceNumber(Long xMsBlobSequenceNumber) { + this.xMsBlobSequenceNumber = xMsBlobSequenceNumber; + return this; + } + + /** + * Get the xMsBlobCommittedBlockCount property: The x-ms-blob-committed-block-count property. + * + * @return the xMsBlobCommittedBlockCount value. + */ + public Integer getXMsBlobCommittedBlockCount() { + return this.xMsBlobCommittedBlockCount; + } + + /** + * Set the xMsBlobCommittedBlockCount property: The x-ms-blob-committed-block-count property. + * + * @param xMsBlobCommittedBlockCount the xMsBlobCommittedBlockCount value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsBlobCommittedBlockCount(Integer xMsBlobCommittedBlockCount) { + this.xMsBlobCommittedBlockCount = xMsBlobCommittedBlockCount; + return this; + } + + /** + * Get the xMsLegalHold property: The x-ms-legal-hold property. + * + * @return the xMsLegalHold value. + */ + public Boolean isXMsLegalHold() { + return this.xMsLegalHold; + } + + /** + * Set the xMsLegalHold property: The x-ms-legal-hold property. + * + * @param xMsLegalHold the xMsLegalHold value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsLegalHold(Boolean xMsLegalHold) { + this.xMsLegalHold = xMsLegalHold; + return this; + } + + /** + * Get the contentMD5 property: The Content-MD5 property. + * + * @return the contentMD5 value. + */ + public byte[] getContentMD5() { + return this.contentMD5; + } + + /** + * Set the contentMD5 property: The Content-MD5 property. + * + * @param contentMD5 the contentMD5 value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setContentMD5(byte[] contentMD5) { + this.contentMD5 = contentMD5; + return this; + } + + /** + * Get the xMsOrPolicyId property: The x-ms-or-policy-id property. + * + * @return the xMsOrPolicyId value. + */ + public String getXMsOrPolicyId() { + return this.xMsOrPolicyId; + } + + /** + * Set the xMsOrPolicyId property: The x-ms-or-policy-id property. + * + * @param xMsOrPolicyId the xMsOrPolicyId value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsOrPolicyId(String xMsOrPolicyId) { + this.xMsOrPolicyId = xMsOrPolicyId; + return this; + } + + /** + * Get the cacheControl property: The Cache-Control property. + * + * @return the cacheControl value. + */ + public String getCacheControl() { + return this.cacheControl; + } + + /** + * Set the cacheControl property: The Cache-Control property. + * + * @param cacheControl the cacheControl value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setCacheControl(String cacheControl) { + this.cacheControl = cacheControl; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the contentDisposition property: The Content-Disposition property. + * + * @return the contentDisposition value. + */ + public String getContentDisposition() { + return this.contentDisposition; + } + + /** + * Set the contentDisposition property: The Content-Disposition property. + * + * @param contentDisposition the contentDisposition value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setContentDisposition(String contentDisposition) { + this.contentDisposition = contentDisposition; + return this; + } + + /** + * Get the contentLanguage property: The Content-Language property. + * + * @return the contentLanguage value. + */ + public String getContentLanguage() { + return this.contentLanguage; + } + + /** + * Set the contentLanguage property: The Content-Language property. + * + * @param contentLanguage the contentLanguage value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setContentLanguage(String contentLanguage) { + this.contentLanguage = contentLanguage; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the xMsOr property: The x-ms-or- property. + * + * @return the xMsOr value. + */ + public Map getXMsOr() { + return this.xMsOr; + } + + /** + * Set the xMsOr property: The x-ms-or- property. + * + * @param xMsOr the xMsOr value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsOr(Map xMsOr) { + this.xMsOr = xMsOr; + return this; + } + + /** + * Get the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @return the xMsEncryptionScope value. + */ + public String getXMsEncryptionScope() { + return this.xMsEncryptionScope; + } + + /** + * Set the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @param xMsEncryptionScope the xMsEncryptionScope value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsEncryptionScope(String xMsEncryptionScope) { + this.xMsEncryptionScope = xMsEncryptionScope; + return this; + } + + /** + * Get the xMsTagCount property: The x-ms-tag-count property. + * + * @return the xMsTagCount value. + */ + public Long getXMsTagCount() { + return this.xMsTagCount; + } + + /** + * Set the xMsTagCount property: The x-ms-tag-count property. + * + * @param xMsTagCount the xMsTagCount value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsTagCount(Long xMsTagCount) { + this.xMsTagCount = xMsTagCount; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsAccessTierInferred property: The x-ms-access-tier-inferred property. + * + * @return the xMsAccessTierInferred value. + */ + public Boolean isXMsAccessTierInferred() { + return this.xMsAccessTierInferred; + } + + /** + * Set the xMsAccessTierInferred property: The x-ms-access-tier-inferred property. + * + * @param xMsAccessTierInferred the xMsAccessTierInferred value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsAccessTierInferred(Boolean xMsAccessTierInferred) { + this.xMsAccessTierInferred = xMsAccessTierInferred; + return this; + } + + /** + * Get the xMsImmutabilityPolicyMode property: The x-ms-immutability-policy-mode property. + * + * @return the xMsImmutabilityPolicyMode value. + */ + public BlobImmutabilityPolicyMode getXMsImmutabilityPolicyMode() { + return this.xMsImmutabilityPolicyMode; + } + + /** + * Set the xMsImmutabilityPolicyMode property: The x-ms-immutability-policy-mode property. + * + * @param xMsImmutabilityPolicyMode the xMsImmutabilityPolicyMode value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders + setXMsImmutabilityPolicyMode(BlobImmutabilityPolicyMode xMsImmutabilityPolicyMode) { + this.xMsImmutabilityPolicyMode = xMsImmutabilityPolicyMode; + return this; + } + + /** + * Get the xMsAccessTier property: The x-ms-access-tier property. + * + * @return the xMsAccessTier value. + */ + public String getXMsAccessTier() { + return this.xMsAccessTier; + } + + /** + * Set the xMsAccessTier property: The x-ms-access-tier property. + * + * @param xMsAccessTier the xMsAccessTier value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsAccessTier(String xMsAccessTier) { + this.xMsAccessTier = xMsAccessTier; + return this; + } + + /** + * Get the xMsCopyStatusDescription property: The x-ms-copy-status-description property. + * + * @return the xMsCopyStatusDescription value. + */ + public String getXMsCopyStatusDescription() { + return this.xMsCopyStatusDescription; + } + + /** + * Set the xMsCopyStatusDescription property: The x-ms-copy-status-description property. + * + * @param xMsCopyStatusDescription the xMsCopyStatusDescription value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsCopyStatusDescription(String xMsCopyStatusDescription) { + this.xMsCopyStatusDescription = xMsCopyStatusDescription; + return this; + } + + /** + * Get the contentLength property: The Content-Length property. + * + * @return the contentLength value. + */ + public Long getContentLength() { + return this.contentLength; + } + + /** + * Set the contentLength property: The Content-Length property. + * + * @param contentLength the contentLength value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setContentLength(Long contentLength) { + this.contentLength = contentLength; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the contentType property: The Content-Type property. + * + * @return the contentType value. + */ + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The Content-Type property. + * + * @param contentType the contentType value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the xMsLastAccessTime property: The x-ms-last-access-time property. + * + * @return the xMsLastAccessTime value. + */ + public OffsetDateTime getXMsLastAccessTime() { + if (this.xMsLastAccessTime == null) { + return null; + } + return this.xMsLastAccessTime.getDateTime(); + } + + /** + * Set the xMsLastAccessTime property: The x-ms-last-access-time property. + * + * @param xMsLastAccessTime the xMsLastAccessTime value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsLastAccessTime(OffsetDateTime xMsLastAccessTime) { + if (xMsLastAccessTime == null) { + this.xMsLastAccessTime = null; + } else { + this.xMsLastAccessTime = new DateTimeRfc1123(xMsLastAccessTime); + } + return this; + } + + /** + * Get the xMsCopySource property: The x-ms-copy-source property. + * + * @return the xMsCopySource value. + */ + public String getXMsCopySource() { + return this.xMsCopySource; + } + + /** + * Set the xMsCopySource property: The x-ms-copy-source property. + * + * @param xMsCopySource the xMsCopySource value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsCopySource(String xMsCopySource) { + this.xMsCopySource = xMsCopySource; + return this; + } + + /** + * Get the xMsCopyProgress property: The x-ms-copy-progress property. + * + * @return the xMsCopyProgress value. + */ + public String getXMsCopyProgress() { + return this.xMsCopyProgress; + } + + /** + * Set the xMsCopyProgress property: The x-ms-copy-progress property. + * + * @param xMsCopyProgress the xMsCopyProgress value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsCopyProgress(String xMsCopyProgress) { + this.xMsCopyProgress = xMsCopyProgress; + return this; + } + + /** + * Get the xMsMeta property: The x-ms-meta- property. + * + * @return the xMsMeta value. + */ + public Map getXMsMeta() { + return this.xMsMeta; + } + + /** + * Set the xMsMeta property: The x-ms-meta- property. + * + * @param xMsMeta the xMsMeta value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsMeta(Map xMsMeta) { + this.xMsMeta = xMsMeta; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the xMsExpiryTime property: The x-ms-expiry-time property. + * + * @return the xMsExpiryTime value. + */ + public OffsetDateTime getXMsExpiryTime() { + if (this.xMsExpiryTime == null) { + return null; + } + return this.xMsExpiryTime.getDateTime(); + } + + /** + * Set the xMsExpiryTime property: The x-ms-expiry-time property. + * + * @param xMsExpiryTime the xMsExpiryTime value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsExpiryTime(OffsetDateTime xMsExpiryTime) { + if (xMsExpiryTime == null) { + this.xMsExpiryTime = null; + } else { + this.xMsExpiryTime = new DateTimeRfc1123(xMsExpiryTime); + } + return this; + } + + /** + * Get the xMsCopyCompletionTime property: The x-ms-copy-completion-time property. + * + * @return the xMsCopyCompletionTime value. + */ + public OffsetDateTime getXMsCopyCompletionTime() { + if (this.xMsCopyCompletionTime == null) { + return null; + } + return this.xMsCopyCompletionTime.getDateTime(); + } + + /** + * Set the xMsCopyCompletionTime property: The x-ms-copy-completion-time property. + * + * @param xMsCopyCompletionTime the xMsCopyCompletionTime value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsCopyCompletionTime(OffsetDateTime xMsCopyCompletionTime) { + if (xMsCopyCompletionTime == null) { + this.xMsCopyCompletionTime = null; + } else { + this.xMsCopyCompletionTime = new DateTimeRfc1123(xMsCopyCompletionTime); + } + return this; + } + + /** + * Get the acceptRanges property: The Accept-Ranges property. + * + * @return the acceptRanges value. + */ + public String getAcceptRanges() { + return this.acceptRanges; + } + + /** + * Set the acceptRanges property: The Accept-Ranges property. + * + * @param acceptRanges the acceptRanges value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setAcceptRanges(String acceptRanges) { + this.acceptRanges = acceptRanges; + return this; + } + + /** + * Get the xMsServerEncrypted property: The x-ms-server-encrypted property. + * + * @return the xMsServerEncrypted value. + */ + public Boolean isXMsServerEncrypted() { + return this.xMsServerEncrypted; + } + + /** + * Set the xMsServerEncrypted property: The x-ms-server-encrypted property. + * + * @param xMsServerEncrypted the xMsServerEncrypted value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsServerEncrypted(Boolean xMsServerEncrypted) { + this.xMsServerEncrypted = xMsServerEncrypted; + return this; + } + + /** + * Get the xMsRehydratePriority property: The x-ms-rehydrate-priority property. + * + * @return the xMsRehydratePriority value. + */ + public String getXMsRehydratePriority() { + return this.xMsRehydratePriority; + } + + /** + * Set the xMsRehydratePriority property: The x-ms-rehydrate-priority property. + * + * @param xMsRehydratePriority the xMsRehydratePriority value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsRehydratePriority(String xMsRehydratePriority) { + this.xMsRehydratePriority = xMsRehydratePriority; + return this; + } + + /** + * Get the xMsCopyStatus property: The x-ms-copy-status property. + * + * @return the xMsCopyStatus value. + */ + public CopyStatusType getXMsCopyStatus() { + return this.xMsCopyStatus; + } + + /** + * Set the xMsCopyStatus property: The x-ms-copy-status property. + * + * @param xMsCopyStatus the xMsCopyStatus value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsCopyStatus(CopyStatusType xMsCopyStatus) { + this.xMsCopyStatus = xMsCopyStatus; + return this; + } + + /** + * Get the xMsArchiveStatus property: The x-ms-archive-status property. + * + * @return the xMsArchiveStatus value. + */ + public String getXMsArchiveStatus() { + return this.xMsArchiveStatus; + } + + /** + * Set the xMsArchiveStatus property: The x-ms-archive-status property. + * + * @param xMsArchiveStatus the xMsArchiveStatus value to set. + * @return the BlobsGetPropertiesHeaders object itself. + */ + public BlobsGetPropertiesHeaders setXMsArchiveStatus(String xMsArchiveStatus) { + this.xMsArchiveStatus = xMsArchiveStatus; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsGetTagsHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsGetTagsHeaders.java new file mode 100644 index 000000000000..b41128b3bdbe --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsGetTagsHeaders.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsGetTagsHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsGetTagsHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsGetTagsHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsGetTagsHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsGetTagsHeaders object itself. + */ + public BlobsGetTagsHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsGetTagsHeaders object itself. + */ + public BlobsGetTagsHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsGetTagsHeaders object itself. + */ + public BlobsGetTagsHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsGetTagsHeaders object itself. + */ + public BlobsGetTagsHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsQueryHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsQueryHeaders.java new file mode 100644 index 000000000000..6ff0dba3787a --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsQueryHeaders.java @@ -0,0 +1,1007 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Base64; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The BlobsQueryHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsQueryHeaders { + /* + * The x-ms-lease-status property. + */ + private LeaseStatusType xMsLeaseStatus; + + /* + * The Content-Range property. + */ + private String contentRange; + + /* + * The x-ms-lease-state property. + */ + private LeaseStateType xMsLeaseState; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-encryption-key-sha256 property. + */ + private String xMsEncryptionKeySha256; + + /* + * The x-ms-blob-type property. + */ + private BlobType xMsBlobType; + + /* + * The Content-Encoding property. + */ + private String contentEncoding; + + /* + * The x-ms-copy-status-description property. + */ + private String xMsCopyStatusDescription; + + /* + * The x-ms-lease-duration property. + */ + private LeaseDurationType xMsLeaseDuration; + + /* + * The Content-Length property. + */ + private Long contentLength; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The Content-Type property. + */ + private String contentType; + + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-copy-id property. + */ + private String xMsCopyId; + + /* + * The x-ms-copy-source property. + */ + private String xMsCopySource; + + /* + * The x-ms-content-crc64 property. + */ + private byte[] xMsContentCrc64; + + /* + * The x-ms-blob-sequence-number property. + */ + private Long xMsBlobSequenceNumber; + + /* + * The x-ms-copy-progress property. + */ + private String xMsCopyProgress; + + /* + * The x-ms-blob-committed-block-count property. + */ + private Integer xMsBlobCommittedBlockCount; + + /* + * The x-ms-blob-content-md5 property. + */ + private byte[] xMsBlobContentMd5; + + /* + * The x-ms-meta- property. + */ + private Map xMsMeta; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-MD5 property. + */ + private byte[] contentMD5; + + /* + * The x-ms-copy-completion-time property. + */ + private DateTimeRfc1123 xMsCopyCompletionTime; + + /* + * The Accept-Ranges property. + */ + private String acceptRanges; + + /* + * The x-ms-server-encrypted property. + */ + private Boolean xMsServerEncrypted; + + /* + * The Cache-Control property. + */ + private String cacheControl; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Content-Disposition property. + */ + private String contentDisposition; + + /* + * The x-ms-copy-status property. + */ + private CopyStatusType xMsCopyStatus; + + /* + * The Content-Language property. + */ + private String contentLanguage; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The x-ms-encryption-scope property. + */ + private String xMsEncryptionScope; + + private static final HttpHeaderName X_MS_LEASE_STATUS = HttpHeaderName.fromString("x-ms-lease-status"); + + private static final HttpHeaderName X_MS_LEASE_STATE = HttpHeaderName.fromString("x-ms-lease-state"); + + private static final HttpHeaderName X_MS_ENCRYPTION_KEY_SHA256 + = HttpHeaderName.fromString("x-ms-encryption-key-sha256"); + + private static final HttpHeaderName X_MS_BLOB_TYPE = HttpHeaderName.fromString("x-ms-blob-type"); + + private static final HttpHeaderName X_MS_COPY_STATUS_DESCRIPTION + = HttpHeaderName.fromString("x-ms-copy-status-description"); + + private static final HttpHeaderName X_MS_LEASE_DURATION = HttpHeaderName.fromString("x-ms-lease-duration"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_COPY_ID = HttpHeaderName.fromString("x-ms-copy-id"); + + private static final HttpHeaderName X_MS_COPY_SOURCE = HttpHeaderName.fromString("x-ms-copy-source"); + + private static final HttpHeaderName X_MS_CONTENT_CRC64 = HttpHeaderName.fromString("x-ms-content-crc64"); + + private static final HttpHeaderName X_MS_BLOB_SEQUENCE_NUMBER + = HttpHeaderName.fromString("x-ms-blob-sequence-number"); + + private static final HttpHeaderName X_MS_COPY_PROGRESS = HttpHeaderName.fromString("x-ms-copy-progress"); + + private static final HttpHeaderName X_MS_BLOB_COMMITTED_BLOCK_COUNT + = HttpHeaderName.fromString("x-ms-blob-committed-block-count"); + + private static final HttpHeaderName X_MS_BLOB_CONTENT_MD5 = HttpHeaderName.fromString("x-ms-blob-content-md5"); + + private static final HttpHeaderName X_MS_COPY_COMPLETION_TIME + = HttpHeaderName.fromString("x-ms-copy-completion-time"); + + private static final HttpHeaderName X_MS_SERVER_ENCRYPTED = HttpHeaderName.fromString("x-ms-server-encrypted"); + + private static final HttpHeaderName X_MS_COPY_STATUS = HttpHeaderName.fromString("x-ms-copy-status"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_SCOPE = HttpHeaderName.fromString("x-ms-encryption-scope"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsQueryHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsQueryHeaders(HttpHeaders rawHeaders) { + String xMsLeaseStatus = rawHeaders.getValue(X_MS_LEASE_STATUS); + if (xMsLeaseStatus != null) { + this.xMsLeaseStatus = LeaseStatusType.fromString(xMsLeaseStatus); + } + this.contentRange = rawHeaders.getValue(HttpHeaderName.CONTENT_RANGE); + String xMsLeaseState = rawHeaders.getValue(X_MS_LEASE_STATE); + if (xMsLeaseState != null) { + this.xMsLeaseState = LeaseStateType.fromString(xMsLeaseState); + } + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsEncryptionKeySha256 = rawHeaders.getValue(X_MS_ENCRYPTION_KEY_SHA256); + String xMsBlobType = rawHeaders.getValue(X_MS_BLOB_TYPE); + if (xMsBlobType != null) { + this.xMsBlobType = BlobType.fromString(xMsBlobType); + } + this.contentEncoding = rawHeaders.getValue(HttpHeaderName.CONTENT_ENCODING); + this.xMsCopyStatusDescription = rawHeaders.getValue(X_MS_COPY_STATUS_DESCRIPTION); + String xMsLeaseDuration = rawHeaders.getValue(X_MS_LEASE_DURATION); + if (xMsLeaseDuration != null) { + this.xMsLeaseDuration = LeaseDurationType.fromString(xMsLeaseDuration); + } + String contentLength = rawHeaders.getValue(HttpHeaderName.CONTENT_LENGTH); + if (contentLength != null) { + this.contentLength = Long.parseLong(contentLength); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.contentType = rawHeaders.getValue(HttpHeaderName.CONTENT_TYPE); + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsCopyId = rawHeaders.getValue(X_MS_COPY_ID); + this.xMsCopySource = rawHeaders.getValue(X_MS_COPY_SOURCE); + String xMsContentCrc64 = rawHeaders.getValue(X_MS_CONTENT_CRC64); + if (xMsContentCrc64 != null) { + this.xMsContentCrc64 = Base64.getDecoder().decode(xMsContentCrc64); + } + String xMsBlobSequenceNumber = rawHeaders.getValue(X_MS_BLOB_SEQUENCE_NUMBER); + if (xMsBlobSequenceNumber != null) { + this.xMsBlobSequenceNumber = Long.parseLong(xMsBlobSequenceNumber); + } + this.xMsCopyProgress = rawHeaders.getValue(X_MS_COPY_PROGRESS); + String xMsBlobCommittedBlockCount = rawHeaders.getValue(X_MS_BLOB_COMMITTED_BLOCK_COUNT); + if (xMsBlobCommittedBlockCount != null) { + this.xMsBlobCommittedBlockCount = Integer.parseInt(xMsBlobCommittedBlockCount); + } + String xMsBlobContentMd5 = rawHeaders.getValue(X_MS_BLOB_CONTENT_MD5); + if (xMsBlobContentMd5 != null) { + this.xMsBlobContentMd5 = Base64.getDecoder().decode(xMsBlobContentMd5); + } + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + String contentMD5 = rawHeaders.getValue(HttpHeaderName.CONTENT_MD5); + if (contentMD5 != null) { + this.contentMD5 = Base64.getDecoder().decode(contentMD5); + } + String xMsCopyCompletionTime = rawHeaders.getValue(X_MS_COPY_COMPLETION_TIME); + if (xMsCopyCompletionTime != null) { + this.xMsCopyCompletionTime = new DateTimeRfc1123(xMsCopyCompletionTime); + } + this.acceptRanges = rawHeaders.getValue(HttpHeaderName.ACCEPT_RANGES); + String xMsServerEncrypted = rawHeaders.getValue(X_MS_SERVER_ENCRYPTED); + if (xMsServerEncrypted != null) { + this.xMsServerEncrypted = Boolean.parseBoolean(xMsServerEncrypted); + } + this.cacheControl = rawHeaders.getValue(HttpHeaderName.CACHE_CONTROL); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + this.contentDisposition = rawHeaders.getValue(HttpHeaderName.CONTENT_DISPOSITION); + String xMsCopyStatus = rawHeaders.getValue(X_MS_COPY_STATUS); + if (xMsCopyStatus != null) { + this.xMsCopyStatus = CopyStatusType.fromString(xMsCopyStatus); + } + this.contentLanguage = rawHeaders.getValue(HttpHeaderName.CONTENT_LANGUAGE); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + this.xMsEncryptionScope = rawHeaders.getValue(X_MS_ENCRYPTION_SCOPE); + Map xMsMetaHeaderCollection = new LinkedHashMap<>(); + + rawHeaders.stream().forEach(header -> { + String headerName = header.getName().getValue(); + if (headerName.startsWith("x-ms-meta-")) { + xMsMetaHeaderCollection.put(headerName.substring(10), header.getValue()); + } + }); + this.xMsMeta = xMsMetaHeaderCollection; + } + + /** + * Get the xMsLeaseStatus property: The x-ms-lease-status property. + * + * @return the xMsLeaseStatus value. + */ + public LeaseStatusType getXMsLeaseStatus() { + return this.xMsLeaseStatus; + } + + /** + * Set the xMsLeaseStatus property: The x-ms-lease-status property. + * + * @param xMsLeaseStatus the xMsLeaseStatus value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsLeaseStatus(LeaseStatusType xMsLeaseStatus) { + this.xMsLeaseStatus = xMsLeaseStatus; + return this; + } + + /** + * Get the contentRange property: The Content-Range property. + * + * @return the contentRange value. + */ + public String getContentRange() { + return this.contentRange; + } + + /** + * Set the contentRange property: The Content-Range property. + * + * @param contentRange the contentRange value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setContentRange(String contentRange) { + this.contentRange = contentRange; + return this; + } + + /** + * Get the xMsLeaseState property: The x-ms-lease-state property. + * + * @return the xMsLeaseState value. + */ + public LeaseStateType getXMsLeaseState() { + return this.xMsLeaseState; + } + + /** + * Set the xMsLeaseState property: The x-ms-lease-state property. + * + * @param xMsLeaseState the xMsLeaseState value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsLeaseState(LeaseStateType xMsLeaseState) { + this.xMsLeaseState = xMsLeaseState; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String getXMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsBlobType property: The x-ms-blob-type property. + * + * @return the xMsBlobType value. + */ + public BlobType getXMsBlobType() { + return this.xMsBlobType; + } + + /** + * Set the xMsBlobType property: The x-ms-blob-type property. + * + * @param xMsBlobType the xMsBlobType value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsBlobType(BlobType xMsBlobType) { + this.xMsBlobType = xMsBlobType; + return this; + } + + /** + * Get the contentEncoding property: The Content-Encoding property. + * + * @return the contentEncoding value. + */ + public String getContentEncoding() { + return this.contentEncoding; + } + + /** + * Set the contentEncoding property: The Content-Encoding property. + * + * @param contentEncoding the contentEncoding value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setContentEncoding(String contentEncoding) { + this.contentEncoding = contentEncoding; + return this; + } + + /** + * Get the xMsCopyStatusDescription property: The x-ms-copy-status-description property. + * + * @return the xMsCopyStatusDescription value. + */ + public String getXMsCopyStatusDescription() { + return this.xMsCopyStatusDescription; + } + + /** + * Set the xMsCopyStatusDescription property: The x-ms-copy-status-description property. + * + * @param xMsCopyStatusDescription the xMsCopyStatusDescription value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsCopyStatusDescription(String xMsCopyStatusDescription) { + this.xMsCopyStatusDescription = xMsCopyStatusDescription; + return this; + } + + /** + * Get the xMsLeaseDuration property: The x-ms-lease-duration property. + * + * @return the xMsLeaseDuration value. + */ + public LeaseDurationType getXMsLeaseDuration() { + return this.xMsLeaseDuration; + } + + /** + * Set the xMsLeaseDuration property: The x-ms-lease-duration property. + * + * @param xMsLeaseDuration the xMsLeaseDuration value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsLeaseDuration(LeaseDurationType xMsLeaseDuration) { + this.xMsLeaseDuration = xMsLeaseDuration; + return this; + } + + /** + * Get the contentLength property: The Content-Length property. + * + * @return the contentLength value. + */ + public Long getContentLength() { + return this.contentLength; + } + + /** + * Set the contentLength property: The Content-Length property. + * + * @param contentLength the contentLength value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setContentLength(Long contentLength) { + this.contentLength = contentLength; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the contentType property: The Content-Type property. + * + * @return the contentType value. + */ + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The Content-Type property. + * + * @param contentType the contentType value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsCopyId property: The x-ms-copy-id property. + * + * @return the xMsCopyId value. + */ + public String getXMsCopyId() { + return this.xMsCopyId; + } + + /** + * Set the xMsCopyId property: The x-ms-copy-id property. + * + * @param xMsCopyId the xMsCopyId value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsCopyId(String xMsCopyId) { + this.xMsCopyId = xMsCopyId; + return this; + } + + /** + * Get the xMsCopySource property: The x-ms-copy-source property. + * + * @return the xMsCopySource value. + */ + public String getXMsCopySource() { + return this.xMsCopySource; + } + + /** + * Set the xMsCopySource property: The x-ms-copy-source property. + * + * @param xMsCopySource the xMsCopySource value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsCopySource(String xMsCopySource) { + this.xMsCopySource = xMsCopySource; + return this; + } + + /** + * Get the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return this.xMsContentCrc64; + } + + /** + * Set the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = xMsContentCrc64; + return this; + } + + /** + * Get the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @return the xMsBlobSequenceNumber value. + */ + public Long getXMsBlobSequenceNumber() { + return this.xMsBlobSequenceNumber; + } + + /** + * Set the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @param xMsBlobSequenceNumber the xMsBlobSequenceNumber value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsBlobSequenceNumber(Long xMsBlobSequenceNumber) { + this.xMsBlobSequenceNumber = xMsBlobSequenceNumber; + return this; + } + + /** + * Get the xMsCopyProgress property: The x-ms-copy-progress property. + * + * @return the xMsCopyProgress value. + */ + public String getXMsCopyProgress() { + return this.xMsCopyProgress; + } + + /** + * Set the xMsCopyProgress property: The x-ms-copy-progress property. + * + * @param xMsCopyProgress the xMsCopyProgress value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsCopyProgress(String xMsCopyProgress) { + this.xMsCopyProgress = xMsCopyProgress; + return this; + } + + /** + * Get the xMsBlobCommittedBlockCount property: The x-ms-blob-committed-block-count property. + * + * @return the xMsBlobCommittedBlockCount value. + */ + public Integer getXMsBlobCommittedBlockCount() { + return this.xMsBlobCommittedBlockCount; + } + + /** + * Set the xMsBlobCommittedBlockCount property: The x-ms-blob-committed-block-count property. + * + * @param xMsBlobCommittedBlockCount the xMsBlobCommittedBlockCount value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsBlobCommittedBlockCount(Integer xMsBlobCommittedBlockCount) { + this.xMsBlobCommittedBlockCount = xMsBlobCommittedBlockCount; + return this; + } + + /** + * Get the xMsBlobContentMd5 property: The x-ms-blob-content-md5 property. + * + * @return the xMsBlobContentMd5 value. + */ + public byte[] getXMsBlobContentMd5() { + return this.xMsBlobContentMd5; + } + + /** + * Set the xMsBlobContentMd5 property: The x-ms-blob-content-md5 property. + * + * @param xMsBlobContentMd5 the xMsBlobContentMd5 value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsBlobContentMd5(byte[] xMsBlobContentMd5) { + this.xMsBlobContentMd5 = xMsBlobContentMd5; + return this; + } + + /** + * Get the xMsMeta property: The x-ms-meta- property. + * + * @return the xMsMeta value. + */ + public Map getXMsMeta() { + return this.xMsMeta; + } + + /** + * Set the xMsMeta property: The x-ms-meta- property. + * + * @param xMsMeta the xMsMeta value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsMeta(Map xMsMeta) { + this.xMsMeta = xMsMeta; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentMD5 property: The Content-MD5 property. + * + * @return the contentMD5 value. + */ + public byte[] getContentMD5() { + return this.contentMD5; + } + + /** + * Set the contentMD5 property: The Content-MD5 property. + * + * @param contentMD5 the contentMD5 value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setContentMD5(byte[] contentMD5) { + this.contentMD5 = contentMD5; + return this; + } + + /** + * Get the xMsCopyCompletionTime property: The x-ms-copy-completion-time property. + * + * @return the xMsCopyCompletionTime value. + */ + public OffsetDateTime getXMsCopyCompletionTime() { + if (this.xMsCopyCompletionTime == null) { + return null; + } + return this.xMsCopyCompletionTime.getDateTime(); + } + + /** + * Set the xMsCopyCompletionTime property: The x-ms-copy-completion-time property. + * + * @param xMsCopyCompletionTime the xMsCopyCompletionTime value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsCopyCompletionTime(OffsetDateTime xMsCopyCompletionTime) { + if (xMsCopyCompletionTime == null) { + this.xMsCopyCompletionTime = null; + } else { + this.xMsCopyCompletionTime = new DateTimeRfc1123(xMsCopyCompletionTime); + } + return this; + } + + /** + * Get the acceptRanges property: The Accept-Ranges property. + * + * @return the acceptRanges value. + */ + public String getAcceptRanges() { + return this.acceptRanges; + } + + /** + * Set the acceptRanges property: The Accept-Ranges property. + * + * @param acceptRanges the acceptRanges value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setAcceptRanges(String acceptRanges) { + this.acceptRanges = acceptRanges; + return this; + } + + /** + * Get the xMsServerEncrypted property: The x-ms-server-encrypted property. + * + * @return the xMsServerEncrypted value. + */ + public Boolean isXMsServerEncrypted() { + return this.xMsServerEncrypted; + } + + /** + * Set the xMsServerEncrypted property: The x-ms-server-encrypted property. + * + * @param xMsServerEncrypted the xMsServerEncrypted value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsServerEncrypted(Boolean xMsServerEncrypted) { + this.xMsServerEncrypted = xMsServerEncrypted; + return this; + } + + /** + * Get the cacheControl property: The Cache-Control property. + * + * @return the cacheControl value. + */ + public String getCacheControl() { + return this.cacheControl; + } + + /** + * Set the cacheControl property: The Cache-Control property. + * + * @param cacheControl the cacheControl value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setCacheControl(String cacheControl) { + this.cacheControl = cacheControl; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the contentDisposition property: The Content-Disposition property. + * + * @return the contentDisposition value. + */ + public String getContentDisposition() { + return this.contentDisposition; + } + + /** + * Set the contentDisposition property: The Content-Disposition property. + * + * @param contentDisposition the contentDisposition value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setContentDisposition(String contentDisposition) { + this.contentDisposition = contentDisposition; + return this; + } + + /** + * Get the xMsCopyStatus property: The x-ms-copy-status property. + * + * @return the xMsCopyStatus value. + */ + public CopyStatusType getXMsCopyStatus() { + return this.xMsCopyStatus; + } + + /** + * Set the xMsCopyStatus property: The x-ms-copy-status property. + * + * @param xMsCopyStatus the xMsCopyStatus value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsCopyStatus(CopyStatusType xMsCopyStatus) { + this.xMsCopyStatus = xMsCopyStatus; + return this; + } + + /** + * Get the contentLanguage property: The Content-Language property. + * + * @return the contentLanguage value. + */ + public String getContentLanguage() { + return this.contentLanguage; + } + + /** + * Set the contentLanguage property: The Content-Language property. + * + * @param contentLanguage the contentLanguage value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setContentLanguage(String contentLanguage) { + this.contentLanguage = contentLanguage; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @return the xMsEncryptionScope value. + */ + public String getXMsEncryptionScope() { + return this.xMsEncryptionScope; + } + + /** + * Set the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @param xMsEncryptionScope the xMsEncryptionScope value to set. + * @return the BlobsQueryHeaders object itself. + */ + public BlobsQueryHeaders setXMsEncryptionScope(String xMsEncryptionScope) { + this.xMsEncryptionScope = xMsEncryptionScope; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsReleaseLeaseHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsReleaseLeaseHeaders.java new file mode 100644 index 000000000000..60a28e2d58f5 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsReleaseLeaseHeaders.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsReleaseLeaseHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsReleaseLeaseHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsReleaseLeaseHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsReleaseLeaseHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsReleaseLeaseHeaders object itself. + */ + public BlobsReleaseLeaseHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlobsReleaseLeaseHeaders object itself. + */ + public BlobsReleaseLeaseHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlobsReleaseLeaseHeaders object itself. + */ + public BlobsReleaseLeaseHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsReleaseLeaseHeaders object itself. + */ + public BlobsReleaseLeaseHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsReleaseLeaseHeaders object itself. + */ + public BlobsReleaseLeaseHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsReleaseLeaseHeaders object itself. + */ + public BlobsReleaseLeaseHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsRenewLeaseHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsRenewLeaseHeaders.java new file mode 100644 index 000000000000..82089f4f0ba5 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsRenewLeaseHeaders.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsRenewLeaseHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsRenewLeaseHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-lease-id property. + */ + private String xMsLeaseId; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_LEASE_ID = HttpHeaderName.fromString("x-ms-lease-id"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsRenewLeaseHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsRenewLeaseHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + this.xMsLeaseId = rawHeaders.getValue(X_MS_LEASE_ID); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsRenewLeaseHeaders object itself. + */ + public BlobsRenewLeaseHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlobsRenewLeaseHeaders object itself. + */ + public BlobsRenewLeaseHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsLeaseId property: The x-ms-lease-id property. + * + * @return the xMsLeaseId value. + */ + public String getXMsLeaseId() { + return this.xMsLeaseId; + } + + /** + * Set the xMsLeaseId property: The x-ms-lease-id property. + * + * @param xMsLeaseId the xMsLeaseId value to set. + * @return the BlobsRenewLeaseHeaders object itself. + */ + public BlobsRenewLeaseHeaders setXMsLeaseId(String xMsLeaseId) { + this.xMsLeaseId = xMsLeaseId; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlobsRenewLeaseHeaders object itself. + */ + public BlobsRenewLeaseHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsRenewLeaseHeaders object itself. + */ + public BlobsRenewLeaseHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsRenewLeaseHeaders object itself. + */ + public BlobsRenewLeaseHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsRenewLeaseHeaders object itself. + */ + public BlobsRenewLeaseHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetExpiryHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetExpiryHeaders.java new file mode 100644 index 000000000000..668f23d0f6f3 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetExpiryHeaders.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsSetExpiryHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsSetExpiryHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsSetExpiryHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsSetExpiryHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsSetExpiryHeaders object itself. + */ + public BlobsSetExpiryHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlobsSetExpiryHeaders object itself. + */ + public BlobsSetExpiryHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlobsSetExpiryHeaders object itself. + */ + public BlobsSetExpiryHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsSetExpiryHeaders object itself. + */ + public BlobsSetExpiryHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsSetExpiryHeaders object itself. + */ + public BlobsSetExpiryHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsSetExpiryHeaders object itself. + */ + public BlobsSetExpiryHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetHttpHeadersHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetHttpHeadersHeaders.java new file mode 100644 index 000000000000..bd56a9ec0f46 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetHttpHeadersHeaders.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsSetHttpHeadersHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsSetHttpHeadersHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-blob-sequence-number property. + */ + private Long xMsBlobSequenceNumber; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_BLOB_SEQUENCE_NUMBER + = HttpHeaderName.fromString("x-ms-blob-sequence-number"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsSetHttpHeadersHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsSetHttpHeadersHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String xMsBlobSequenceNumber = rawHeaders.getValue(X_MS_BLOB_SEQUENCE_NUMBER); + if (xMsBlobSequenceNumber != null) { + this.xMsBlobSequenceNumber = Long.parseLong(xMsBlobSequenceNumber); + } + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsSetHttpHeadersHeaders object itself. + */ + public BlobsSetHttpHeadersHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlobsSetHttpHeadersHeaders object itself. + */ + public BlobsSetHttpHeadersHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @return the xMsBlobSequenceNumber value. + */ + public Long getXMsBlobSequenceNumber() { + return this.xMsBlobSequenceNumber; + } + + /** + * Set the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @param xMsBlobSequenceNumber the xMsBlobSequenceNumber value to set. + * @return the BlobsSetHttpHeadersHeaders object itself. + */ + public BlobsSetHttpHeadersHeaders setXMsBlobSequenceNumber(Long xMsBlobSequenceNumber) { + this.xMsBlobSequenceNumber = xMsBlobSequenceNumber; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlobsSetHttpHeadersHeaders object itself. + */ + public BlobsSetHttpHeadersHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsSetHttpHeadersHeaders object itself. + */ + public BlobsSetHttpHeadersHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsSetHttpHeadersHeaders object itself. + */ + public BlobsSetHttpHeadersHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsSetHttpHeadersHeaders object itself. + */ + public BlobsSetHttpHeadersHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetImmutabilityPolicyHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetImmutabilityPolicyHeaders.java new file mode 100644 index 000000000000..d5f71f831808 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetImmutabilityPolicyHeaders.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsSetImmutabilityPolicyHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsSetImmutabilityPolicyHeaders { + /* + * The x-ms-immutability-policy-mode property. + */ + private BlobImmutabilityPolicyMode xMsImmutabilityPolicyMode; + + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-immutability-policy-until-date property. + */ + private DateTimeRfc1123 xMsImmutabilityPolicyUntilDate; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_IMMUTABILITY_POLICY_MODE + = HttpHeaderName.fromString("x-ms-immutability-policy-mode"); + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_IMMUTABILITY_POLICY_UNTIL_DATE + = HttpHeaderName.fromString("x-ms-immutability-policy-until-date"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsSetImmutabilityPolicyHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsSetImmutabilityPolicyHeaders(HttpHeaders rawHeaders) { + String xMsImmutabilityPolicyMode = rawHeaders.getValue(X_MS_IMMUTABILITY_POLICY_MODE); + if (xMsImmutabilityPolicyMode != null) { + this.xMsImmutabilityPolicyMode = BlobImmutabilityPolicyMode.fromString(xMsImmutabilityPolicyMode); + } + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + String xMsImmutabilityPolicyUntilDate = rawHeaders.getValue(X_MS_IMMUTABILITY_POLICY_UNTIL_DATE); + if (xMsImmutabilityPolicyUntilDate != null) { + this.xMsImmutabilityPolicyUntilDate = new DateTimeRfc1123(xMsImmutabilityPolicyUntilDate); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsImmutabilityPolicyMode property: The x-ms-immutability-policy-mode property. + * + * @return the xMsImmutabilityPolicyMode value. + */ + public BlobImmutabilityPolicyMode getXMsImmutabilityPolicyMode() { + return this.xMsImmutabilityPolicyMode; + } + + /** + * Set the xMsImmutabilityPolicyMode property: The x-ms-immutability-policy-mode property. + * + * @param xMsImmutabilityPolicyMode the xMsImmutabilityPolicyMode value to set. + * @return the BlobsSetImmutabilityPolicyHeaders object itself. + */ + public BlobsSetImmutabilityPolicyHeaders + setXMsImmutabilityPolicyMode(BlobImmutabilityPolicyMode xMsImmutabilityPolicyMode) { + this.xMsImmutabilityPolicyMode = xMsImmutabilityPolicyMode; + return this; + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsSetImmutabilityPolicyHeaders object itself. + */ + public BlobsSetImmutabilityPolicyHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsImmutabilityPolicyUntilDate property: The x-ms-immutability-policy-until-date property. + * + * @return the xMsImmutabilityPolicyUntilDate value. + */ + public OffsetDateTime getXMsImmutabilityPolicyUntilDate() { + if (this.xMsImmutabilityPolicyUntilDate == null) { + return null; + } + return this.xMsImmutabilityPolicyUntilDate.getDateTime(); + } + + /** + * Set the xMsImmutabilityPolicyUntilDate property: The x-ms-immutability-policy-until-date property. + * + * @param xMsImmutabilityPolicyUntilDate the xMsImmutabilityPolicyUntilDate value to set. + * @return the BlobsSetImmutabilityPolicyHeaders object itself. + */ + public BlobsSetImmutabilityPolicyHeaders + setXMsImmutabilityPolicyUntilDate(OffsetDateTime xMsImmutabilityPolicyUntilDate) { + if (xMsImmutabilityPolicyUntilDate == null) { + this.xMsImmutabilityPolicyUntilDate = null; + } else { + this.xMsImmutabilityPolicyUntilDate = new DateTimeRfc1123(xMsImmutabilityPolicyUntilDate); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsSetImmutabilityPolicyHeaders object itself. + */ + public BlobsSetImmutabilityPolicyHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsSetImmutabilityPolicyHeaders object itself. + */ + public BlobsSetImmutabilityPolicyHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsSetImmutabilityPolicyHeaders object itself. + */ + public BlobsSetImmutabilityPolicyHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetLegalHoldHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetLegalHoldHeaders.java new file mode 100644 index 000000000000..81a3c24e9a11 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetLegalHoldHeaders.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.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsSetLegalHoldHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsSetLegalHoldHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-legal-hold property. + */ + private Boolean xMsLegalHold; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_LEGAL_HOLD = HttpHeaderName.fromString("x-ms-legal-hold"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsSetLegalHoldHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsSetLegalHoldHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + String xMsLegalHold = rawHeaders.getValue(X_MS_LEGAL_HOLD); + if (xMsLegalHold != null) { + this.xMsLegalHold = Boolean.parseBoolean(xMsLegalHold); + } + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsSetLegalHoldHeaders object itself. + */ + public BlobsSetLegalHoldHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsSetLegalHoldHeaders object itself. + */ + public BlobsSetLegalHoldHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsLegalHold property: The x-ms-legal-hold property. + * + * @return the xMsLegalHold value. + */ + public Boolean isXMsLegalHold() { + return this.xMsLegalHold; + } + + /** + * Set the xMsLegalHold property: The x-ms-legal-hold property. + * + * @param xMsLegalHold the xMsLegalHold value to set. + * @return the BlobsSetLegalHoldHeaders object itself. + */ + public BlobsSetLegalHoldHeaders setXMsLegalHold(Boolean xMsLegalHold) { + this.xMsLegalHold = xMsLegalHold; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsSetLegalHoldHeaders object itself. + */ + public BlobsSetLegalHoldHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsSetLegalHoldHeaders object itself. + */ + public BlobsSetLegalHoldHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetMetadataHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetMetadataHeaders.java new file mode 100644 index 000000000000..8884abac6b7a --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetMetadataHeaders.java @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsSetMetadataHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsSetMetadataHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-version-id property. + */ + private String xMsVersionId; + + /* + * The x-ms-encryption-key-sha256 property. + */ + private String xMsEncryptionKeySha256; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-request-server-encrypted property. + */ + private Boolean xMsRequestServerEncrypted; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The x-ms-encryption-scope property. + */ + private String xMsEncryptionScope; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_VERSION_ID = HttpHeaderName.fromString("x-ms-version-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_KEY_SHA256 + = HttpHeaderName.fromString("x-ms-encryption-key-sha256"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_REQUEST_SERVER_ENCRYPTED + = HttpHeaderName.fromString("x-ms-request-server-encrypted"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_SCOPE = HttpHeaderName.fromString("x-ms-encryption-scope"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsSetMetadataHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsSetMetadataHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsVersionId = rawHeaders.getValue(X_MS_VERSION_ID); + this.xMsEncryptionKeySha256 = rawHeaders.getValue(X_MS_ENCRYPTION_KEY_SHA256); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + String xMsRequestServerEncrypted = rawHeaders.getValue(X_MS_REQUEST_SERVER_ENCRYPTED); + if (xMsRequestServerEncrypted != null) { + this.xMsRequestServerEncrypted = Boolean.parseBoolean(xMsRequestServerEncrypted); + } + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + this.xMsEncryptionScope = rawHeaders.getValue(X_MS_ENCRYPTION_SCOPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsSetMetadataHeaders object itself. + */ + public BlobsSetMetadataHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlobsSetMetadataHeaders object itself. + */ + public BlobsSetMetadataHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlobsSetMetadataHeaders object itself. + */ + public BlobsSetMetadataHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsVersionId property: The x-ms-version-id property. + * + * @return the xMsVersionId value. + */ + public String getXMsVersionId() { + return this.xMsVersionId; + } + + /** + * Set the xMsVersionId property: The x-ms-version-id property. + * + * @param xMsVersionId the xMsVersionId value to set. + * @return the BlobsSetMetadataHeaders object itself. + */ + public BlobsSetMetadataHeaders setXMsVersionId(String xMsVersionId) { + this.xMsVersionId = xMsVersionId; + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String getXMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the BlobsSetMetadataHeaders object itself. + */ + public BlobsSetMetadataHeaders setXMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsSetMetadataHeaders object itself. + */ + public BlobsSetMetadataHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @return the xMsRequestServerEncrypted value. + */ + public Boolean isXMsRequestServerEncrypted() { + return this.xMsRequestServerEncrypted; + } + + /** + * Set the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @param xMsRequestServerEncrypted the xMsRequestServerEncrypted value to set. + * @return the BlobsSetMetadataHeaders object itself. + */ + public BlobsSetMetadataHeaders setXMsRequestServerEncrypted(Boolean xMsRequestServerEncrypted) { + this.xMsRequestServerEncrypted = xMsRequestServerEncrypted; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsSetMetadataHeaders object itself. + */ + public BlobsSetMetadataHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsSetMetadataHeaders object itself. + */ + public BlobsSetMetadataHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @return the xMsEncryptionScope value. + */ + public String getXMsEncryptionScope() { + return this.xMsEncryptionScope; + } + + /** + * Set the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @param xMsEncryptionScope the xMsEncryptionScope value to set. + * @return the BlobsSetMetadataHeaders object itself. + */ + public BlobsSetMetadataHeaders setXMsEncryptionScope(String xMsEncryptionScope) { + this.xMsEncryptionScope = xMsEncryptionScope; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetTagsHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetTagsHeaders.java new file mode 100644 index 000000000000..460a6d783236 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetTagsHeaders.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsSetTagsHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsSetTagsHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsSetTagsHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsSetTagsHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsSetTagsHeaders object itself. + */ + public BlobsSetTagsHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsSetTagsHeaders object itself. + */ + public BlobsSetTagsHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsSetTagsHeaders object itself. + */ + public BlobsSetTagsHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsSetTagsHeaders object itself. + */ + public BlobsSetTagsHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetTierHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetTierHeaders.java new file mode 100644 index 000000000000..42c17a22f9be --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsSetTierHeaders.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; + +/** + * The BlobsSetTierHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsSetTierHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsSetTierHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsSetTierHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsSetTierHeaders object itself. + */ + public BlobsSetTierHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsSetTierHeaders object itself. + */ + public BlobsSetTierHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsSetTierHeaders object itself. + */ + public BlobsSetTierHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsStartCopyFromURLHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsStartCopyFromURLHeaders.java new file mode 100644 index 000000000000..c10c0c9a0a06 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsStartCopyFromURLHeaders.java @@ -0,0 +1,296 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsStartCopyFromURLHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsStartCopyFromURLHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-copy-id property. + */ + private String xMsCopyId; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-version-id property. + */ + private String xMsVersionId; + + /* + * The x-ms-copy-status property. + */ + private CopyStatusType xMsCopyStatus; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_COPY_ID = HttpHeaderName.fromString("x-ms-copy-id"); + + private static final HttpHeaderName X_MS_VERSION_ID = HttpHeaderName.fromString("x-ms-version-id"); + + private static final HttpHeaderName X_MS_COPY_STATUS = HttpHeaderName.fromString("x-ms-copy-status"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsStartCopyFromURLHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsStartCopyFromURLHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsCopyId = rawHeaders.getValue(X_MS_COPY_ID); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsVersionId = rawHeaders.getValue(X_MS_VERSION_ID); + String xMsCopyStatus = rawHeaders.getValue(X_MS_COPY_STATUS); + if (xMsCopyStatus != null) { + this.xMsCopyStatus = CopyStatusType.fromString(xMsCopyStatus); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsStartCopyFromURLHeaders object itself. + */ + public BlobsStartCopyFromURLHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsCopyId property: The x-ms-copy-id property. + * + * @return the xMsCopyId value. + */ + public String getXMsCopyId() { + return this.xMsCopyId; + } + + /** + * Set the xMsCopyId property: The x-ms-copy-id property. + * + * @param xMsCopyId the xMsCopyId value to set. + * @return the BlobsStartCopyFromURLHeaders object itself. + */ + public BlobsStartCopyFromURLHeaders setXMsCopyId(String xMsCopyId) { + this.xMsCopyId = xMsCopyId; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlobsStartCopyFromURLHeaders object itself. + */ + public BlobsStartCopyFromURLHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlobsStartCopyFromURLHeaders object itself. + */ + public BlobsStartCopyFromURLHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsVersionId property: The x-ms-version-id property. + * + * @return the xMsVersionId value. + */ + public String getXMsVersionId() { + return this.xMsVersionId; + } + + /** + * Set the xMsVersionId property: The x-ms-version-id property. + * + * @param xMsVersionId the xMsVersionId value to set. + * @return the BlobsStartCopyFromURLHeaders object itself. + */ + public BlobsStartCopyFromURLHeaders setXMsVersionId(String xMsVersionId) { + this.xMsVersionId = xMsVersionId; + return this; + } + + /** + * Get the xMsCopyStatus property: The x-ms-copy-status property. + * + * @return the xMsCopyStatus value. + */ + public CopyStatusType getXMsCopyStatus() { + return this.xMsCopyStatus; + } + + /** + * Set the xMsCopyStatus property: The x-ms-copy-status property. + * + * @param xMsCopyStatus the xMsCopyStatus value to set. + * @return the BlobsStartCopyFromURLHeaders object itself. + */ + public BlobsStartCopyFromURLHeaders setXMsCopyStatus(CopyStatusType xMsCopyStatus) { + this.xMsCopyStatus = xMsCopyStatus; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsStartCopyFromURLHeaders object itself. + */ + public BlobsStartCopyFromURLHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsStartCopyFromURLHeaders object itself. + */ + public BlobsStartCopyFromURLHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsStartCopyFromURLHeaders object itself. + */ + public BlobsStartCopyFromURLHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsUndeleteHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsUndeleteHeaders.java new file mode 100644 index 000000000000..ce5000252627 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlobsUndeleteHeaders.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlobsUndeleteHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlobsUndeleteHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlobsUndeleteHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlobsUndeleteHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlobsUndeleteHeaders object itself. + */ + public BlobsUndeleteHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlobsUndeleteHeaders object itself. + */ + public BlobsUndeleteHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlobsUndeleteHeaders object itself. + */ + public BlobsUndeleteHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlobsUndeleteHeaders object itself. + */ + public BlobsUndeleteHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/Block.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/Block.java new file mode 100644 index 000000000000..9561869a1160 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/Block.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * Represents a single block in a block blob. It describes the block's ID and size. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class Block implements XmlSerializable { + /* + * The base64 encoded block ID. + */ + private String name; + + /* + * The block size in bytes. + */ + private long sizeLong; + + /* + * The SizeInt property. + */ + private int sizeInt; + + /** + * Creates an instance of Block class. + */ + public Block() { + } + + /** + * Get the name property: The base64 encoded block ID. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * Set the name property: The base64 encoded block ID. + * + * @param name the name value to set. + * @return the Block object itself. + */ + public Block setName(String name) { + this.name = name; + return this; + } + + /** + * Get the sizeLong property: The block size in bytes. + * + * @return the sizeLong value. + */ + public long getSizeLong() { + return this.sizeLong; + } + + /** + * Set the sizeLong property: The block size in bytes. + * + * @param sizeLong the sizeLong value to set. + * @return the Block object itself. + */ + public Block setSizeLong(long sizeLong) { + this.sizeLong = sizeLong; + return this; + } + + /** + * Get the sizeInt property: The SizeInt property. + * + * @return the sizeInt value. + */ + public int getSizeInt() { + return this.sizeInt; + } + + /** + * Set the sizeInt property: The SizeInt property. + * + * @param sizeInt the sizeInt value to set. + * @return the Block object itself. + */ + public Block setSizeInt(int sizeInt) { + this.sizeInt = sizeInt; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "Block" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("Name", this.name); + xmlWriter.writeLongElement("Size", this.sizeLong); + xmlWriter.writeIntElement("SizeInt", this.sizeInt); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of Block from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of Block if the XmlReader was pointing to an instance of it, or null if it was pointing to + * XML null. + * @throws XMLStreamException If an error occurs while reading the Block. + */ + public static Block fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of Block from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of Block if the XmlReader was pointing to an instance of it, or null if it was pointing to + * XML null. + * @throws XMLStreamException If an error occurs while reading the Block. + */ + public static Block fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "Block" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + Block deserializedBlock = new Block(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Name".equals(elementName.getLocalPart())) { + deserializedBlock.name = reader.getStringElement(); + } else if ("Size".equals(elementName.getLocalPart())) { + deserializedBlock.sizeLong = reader.getLongElement(); + } else if ("SizeInt".equals(elementName.getLocalPart())) { + deserializedBlock.sizeInt = reader.getIntElement(); + } else { + reader.skipElement(); + } + } + + return deserializedBlock; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsCommitBlockListHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsCommitBlockListHeaders.java new file mode 100644 index 000000000000..c25621898425 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsCommitBlockListHeaders.java @@ -0,0 +1,387 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Base64; + +/** + * The BlockBlobsCommitBlockListHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlockBlobsCommitBlockListHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-content-crc64 property. + */ + private byte[] xMsContentCrc64; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-version-id property. + */ + private String xMsVersionId; + + /* + * The x-ms-encryption-key-sha256 property. + */ + private String xMsEncryptionKeySha256; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-request-server-encrypted property. + */ + private Boolean xMsRequestServerEncrypted; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-MD5 property. + */ + private byte[] contentMD5; + + /* + * The x-ms-encryption-scope property. + */ + private String xMsEncryptionScope; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_CONTENT_CRC64 = HttpHeaderName.fromString("x-ms-content-crc64"); + + private static final HttpHeaderName X_MS_VERSION_ID = HttpHeaderName.fromString("x-ms-version-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_KEY_SHA256 + = HttpHeaderName.fromString("x-ms-encryption-key-sha256"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_REQUEST_SERVER_ENCRYPTED + = HttpHeaderName.fromString("x-ms-request-server-encrypted"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_SCOPE = HttpHeaderName.fromString("x-ms-encryption-scope"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlockBlobsCommitBlockListHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlockBlobsCommitBlockListHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String xMsContentCrc64 = rawHeaders.getValue(X_MS_CONTENT_CRC64); + if (xMsContentCrc64 != null) { + this.xMsContentCrc64 = Base64.getDecoder().decode(xMsContentCrc64); + } + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsVersionId = rawHeaders.getValue(X_MS_VERSION_ID); + this.xMsEncryptionKeySha256 = rawHeaders.getValue(X_MS_ENCRYPTION_KEY_SHA256); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + String xMsRequestServerEncrypted = rawHeaders.getValue(X_MS_REQUEST_SERVER_ENCRYPTED); + if (xMsRequestServerEncrypted != null) { + this.xMsRequestServerEncrypted = Boolean.parseBoolean(xMsRequestServerEncrypted); + } + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + String contentMD5 = rawHeaders.getValue(HttpHeaderName.CONTENT_MD5); + if (contentMD5 != null) { + this.contentMD5 = Base64.getDecoder().decode(contentMD5); + } + this.xMsEncryptionScope = rawHeaders.getValue(X_MS_ENCRYPTION_SCOPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlockBlobsCommitBlockListHeaders object itself. + */ + public BlockBlobsCommitBlockListHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlockBlobsCommitBlockListHeaders object itself. + */ + public BlockBlobsCommitBlockListHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return this.xMsContentCrc64; + } + + /** + * Set the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the BlockBlobsCommitBlockListHeaders object itself. + */ + public BlockBlobsCommitBlockListHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = xMsContentCrc64; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlockBlobsCommitBlockListHeaders object itself. + */ + public BlockBlobsCommitBlockListHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsVersionId property: The x-ms-version-id property. + * + * @return the xMsVersionId value. + */ + public String getXMsVersionId() { + return this.xMsVersionId; + } + + /** + * Set the xMsVersionId property: The x-ms-version-id property. + * + * @param xMsVersionId the xMsVersionId value to set. + * @return the BlockBlobsCommitBlockListHeaders object itself. + */ + public BlockBlobsCommitBlockListHeaders setXMsVersionId(String xMsVersionId) { + this.xMsVersionId = xMsVersionId; + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String getXMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the BlockBlobsCommitBlockListHeaders object itself. + */ + public BlockBlobsCommitBlockListHeaders setXMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlockBlobsCommitBlockListHeaders object itself. + */ + public BlockBlobsCommitBlockListHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @return the xMsRequestServerEncrypted value. + */ + public Boolean isXMsRequestServerEncrypted() { + return this.xMsRequestServerEncrypted; + } + + /** + * Set the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @param xMsRequestServerEncrypted the xMsRequestServerEncrypted value to set. + * @return the BlockBlobsCommitBlockListHeaders object itself. + */ + public BlockBlobsCommitBlockListHeaders setXMsRequestServerEncrypted(Boolean xMsRequestServerEncrypted) { + this.xMsRequestServerEncrypted = xMsRequestServerEncrypted; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlockBlobsCommitBlockListHeaders object itself. + */ + public BlockBlobsCommitBlockListHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlockBlobsCommitBlockListHeaders object itself. + */ + public BlockBlobsCommitBlockListHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentMD5 property: The Content-MD5 property. + * + * @return the contentMD5 value. + */ + public byte[] getContentMD5() { + return this.contentMD5; + } + + /** + * Set the contentMD5 property: The Content-MD5 property. + * + * @param contentMD5 the contentMD5 value to set. + * @return the BlockBlobsCommitBlockListHeaders object itself. + */ + public BlockBlobsCommitBlockListHeaders setContentMD5(byte[] contentMD5) { + this.contentMD5 = contentMD5; + return this; + } + + /** + * Get the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @return the xMsEncryptionScope value. + */ + public String getXMsEncryptionScope() { + return this.xMsEncryptionScope; + } + + /** + * Set the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @param xMsEncryptionScope the xMsEncryptionScope value to set. + * @return the BlockBlobsCommitBlockListHeaders object itself. + */ + public BlockBlobsCommitBlockListHeaders setXMsEncryptionScope(String xMsEncryptionScope) { + this.xMsEncryptionScope = xMsEncryptionScope; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsGetBlockListHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsGetBlockListHeaders.java new file mode 100644 index 000000000000..30cac29ed24f --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsGetBlockListHeaders.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The BlockBlobsGetBlockListHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlockBlobsGetBlockListHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-blob-content-length property. + */ + private Long xMsBlobContentLength; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-Type property. + */ + private String contentType; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_BLOB_CONTENT_LENGTH + = HttpHeaderName.fromString("x-ms-blob-content-length"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlockBlobsGetBlockListHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlockBlobsGetBlockListHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + String xMsBlobContentLength = rawHeaders.getValue(X_MS_BLOB_CONTENT_LENGTH); + if (xMsBlobContentLength != null) { + this.xMsBlobContentLength = Long.parseLong(xMsBlobContentLength); + } + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + this.contentType = rawHeaders.getValue(HttpHeaderName.CONTENT_TYPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlockBlobsGetBlockListHeaders object itself. + */ + public BlockBlobsGetBlockListHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsBlobContentLength property: The x-ms-blob-content-length property. + * + * @return the xMsBlobContentLength value. + */ + public Long getXMsBlobContentLength() { + return this.xMsBlobContentLength; + } + + /** + * Set the xMsBlobContentLength property: The x-ms-blob-content-length property. + * + * @param xMsBlobContentLength the xMsBlobContentLength value to set. + * @return the BlockBlobsGetBlockListHeaders object itself. + */ + public BlockBlobsGetBlockListHeaders setXMsBlobContentLength(Long xMsBlobContentLength) { + this.xMsBlobContentLength = xMsBlobContentLength; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlockBlobsGetBlockListHeaders object itself. + */ + public BlockBlobsGetBlockListHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlockBlobsGetBlockListHeaders object itself. + */ + public BlockBlobsGetBlockListHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlockBlobsGetBlockListHeaders object itself. + */ + public BlockBlobsGetBlockListHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlockBlobsGetBlockListHeaders object itself. + */ + public BlockBlobsGetBlockListHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlockBlobsGetBlockListHeaders object itself. + */ + public BlockBlobsGetBlockListHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentType property: The Content-Type property. + * + * @return the contentType value. + */ + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The Content-Type property. + * + * @param contentType the contentType value to set. + * @return the BlockBlobsGetBlockListHeaders object itself. + */ + public BlockBlobsGetBlockListHeaders setContentType(String contentType) { + this.contentType = contentType; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsPutBlobFromUrlHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsPutBlobFromUrlHeaders.java new file mode 100644 index 000000000000..92a29ab099d9 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsPutBlobFromUrlHeaders.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Base64; + +/** + * The BlockBlobsPutBlobFromUrlHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlockBlobsPutBlobFromUrlHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-version-id property. + */ + private String xMsVersionId; + + /* + * The x-ms-encryption-key-sha256 property. + */ + private String xMsEncryptionKeySha256; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-request-server-encrypted property. + */ + private Boolean xMsRequestServerEncrypted; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-MD5 property. + */ + private byte[] contentMD5; + + /* + * The x-ms-encryption-scope property. + */ + private String xMsEncryptionScope; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_VERSION_ID = HttpHeaderName.fromString("x-ms-version-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_KEY_SHA256 + = HttpHeaderName.fromString("x-ms-encryption-key-sha256"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_REQUEST_SERVER_ENCRYPTED + = HttpHeaderName.fromString("x-ms-request-server-encrypted"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_SCOPE = HttpHeaderName.fromString("x-ms-encryption-scope"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlockBlobsPutBlobFromUrlHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlockBlobsPutBlobFromUrlHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsVersionId = rawHeaders.getValue(X_MS_VERSION_ID); + this.xMsEncryptionKeySha256 = rawHeaders.getValue(X_MS_ENCRYPTION_KEY_SHA256); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + String xMsRequestServerEncrypted = rawHeaders.getValue(X_MS_REQUEST_SERVER_ENCRYPTED); + if (xMsRequestServerEncrypted != null) { + this.xMsRequestServerEncrypted = Boolean.parseBoolean(xMsRequestServerEncrypted); + } + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + String contentMD5 = rawHeaders.getValue(HttpHeaderName.CONTENT_MD5); + if (contentMD5 != null) { + this.contentMD5 = Base64.getDecoder().decode(contentMD5); + } + this.xMsEncryptionScope = rawHeaders.getValue(X_MS_ENCRYPTION_SCOPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlockBlobsPutBlobFromUrlHeaders object itself. + */ + public BlockBlobsPutBlobFromUrlHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlockBlobsPutBlobFromUrlHeaders object itself. + */ + public BlockBlobsPutBlobFromUrlHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlockBlobsPutBlobFromUrlHeaders object itself. + */ + public BlockBlobsPutBlobFromUrlHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsVersionId property: The x-ms-version-id property. + * + * @return the xMsVersionId value. + */ + public String getXMsVersionId() { + return this.xMsVersionId; + } + + /** + * Set the xMsVersionId property: The x-ms-version-id property. + * + * @param xMsVersionId the xMsVersionId value to set. + * @return the BlockBlobsPutBlobFromUrlHeaders object itself. + */ + public BlockBlobsPutBlobFromUrlHeaders setXMsVersionId(String xMsVersionId) { + this.xMsVersionId = xMsVersionId; + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String getXMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the BlockBlobsPutBlobFromUrlHeaders object itself. + */ + public BlockBlobsPutBlobFromUrlHeaders setXMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlockBlobsPutBlobFromUrlHeaders object itself. + */ + public BlockBlobsPutBlobFromUrlHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @return the xMsRequestServerEncrypted value. + */ + public Boolean isXMsRequestServerEncrypted() { + return this.xMsRequestServerEncrypted; + } + + /** + * Set the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @param xMsRequestServerEncrypted the xMsRequestServerEncrypted value to set. + * @return the BlockBlobsPutBlobFromUrlHeaders object itself. + */ + public BlockBlobsPutBlobFromUrlHeaders setXMsRequestServerEncrypted(Boolean xMsRequestServerEncrypted) { + this.xMsRequestServerEncrypted = xMsRequestServerEncrypted; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlockBlobsPutBlobFromUrlHeaders object itself. + */ + public BlockBlobsPutBlobFromUrlHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlockBlobsPutBlobFromUrlHeaders object itself. + */ + public BlockBlobsPutBlobFromUrlHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentMD5 property: The Content-MD5 property. + * + * @return the contentMD5 value. + */ + public byte[] getContentMD5() { + return this.contentMD5; + } + + /** + * Set the contentMD5 property: The Content-MD5 property. + * + * @param contentMD5 the contentMD5 value to set. + * @return the BlockBlobsPutBlobFromUrlHeaders object itself. + */ + public BlockBlobsPutBlobFromUrlHeaders setContentMD5(byte[] contentMD5) { + this.contentMD5 = contentMD5; + return this; + } + + /** + * Get the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @return the xMsEncryptionScope value. + */ + public String getXMsEncryptionScope() { + return this.xMsEncryptionScope; + } + + /** + * Set the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @param xMsEncryptionScope the xMsEncryptionScope value to set. + * @return the BlockBlobsPutBlobFromUrlHeaders object itself. + */ + public BlockBlobsPutBlobFromUrlHeaders setXMsEncryptionScope(String xMsEncryptionScope) { + this.xMsEncryptionScope = xMsEncryptionScope; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsStageBlockFromURLHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsStageBlockFromURLHeaders.java new file mode 100644 index 000000000000..46038c944f5f --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsStageBlockFromURLHeaders.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Base64; + +/** + * The BlockBlobsStageBlockFromURLHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlockBlobsStageBlockFromURLHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-content-crc64 property. + */ + private byte[] xMsContentCrc64; + + /* + * The x-ms-encryption-key-sha256 property. + */ + private String xMsEncryptionKeySha256; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-request-server-encrypted property. + */ + private Boolean xMsRequestServerEncrypted; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-MD5 property. + */ + private byte[] contentMD5; + + /* + * The x-ms-encryption-scope property. + */ + private String xMsEncryptionScope; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_CONTENT_CRC64 = HttpHeaderName.fromString("x-ms-content-crc64"); + + private static final HttpHeaderName X_MS_ENCRYPTION_KEY_SHA256 + = HttpHeaderName.fromString("x-ms-encryption-key-sha256"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_REQUEST_SERVER_ENCRYPTED + = HttpHeaderName.fromString("x-ms-request-server-encrypted"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_SCOPE = HttpHeaderName.fromString("x-ms-encryption-scope"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlockBlobsStageBlockFromURLHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlockBlobsStageBlockFromURLHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + String xMsContentCrc64 = rawHeaders.getValue(X_MS_CONTENT_CRC64); + if (xMsContentCrc64 != null) { + this.xMsContentCrc64 = Base64.getDecoder().decode(xMsContentCrc64); + } + this.xMsEncryptionKeySha256 = rawHeaders.getValue(X_MS_ENCRYPTION_KEY_SHA256); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + String xMsRequestServerEncrypted = rawHeaders.getValue(X_MS_REQUEST_SERVER_ENCRYPTED); + if (xMsRequestServerEncrypted != null) { + this.xMsRequestServerEncrypted = Boolean.parseBoolean(xMsRequestServerEncrypted); + } + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + String contentMD5 = rawHeaders.getValue(HttpHeaderName.CONTENT_MD5); + if (contentMD5 != null) { + this.contentMD5 = Base64.getDecoder().decode(contentMD5); + } + this.xMsEncryptionScope = rawHeaders.getValue(X_MS_ENCRYPTION_SCOPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlockBlobsStageBlockFromURLHeaders object itself. + */ + public BlockBlobsStageBlockFromURLHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return this.xMsContentCrc64; + } + + /** + * Set the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the BlockBlobsStageBlockFromURLHeaders object itself. + */ + public BlockBlobsStageBlockFromURLHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = xMsContentCrc64; + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String getXMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the BlockBlobsStageBlockFromURLHeaders object itself. + */ + public BlockBlobsStageBlockFromURLHeaders setXMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlockBlobsStageBlockFromURLHeaders object itself. + */ + public BlockBlobsStageBlockFromURLHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @return the xMsRequestServerEncrypted value. + */ + public Boolean isXMsRequestServerEncrypted() { + return this.xMsRequestServerEncrypted; + } + + /** + * Set the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @param xMsRequestServerEncrypted the xMsRequestServerEncrypted value to set. + * @return the BlockBlobsStageBlockFromURLHeaders object itself. + */ + public BlockBlobsStageBlockFromURLHeaders setXMsRequestServerEncrypted(Boolean xMsRequestServerEncrypted) { + this.xMsRequestServerEncrypted = xMsRequestServerEncrypted; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlockBlobsStageBlockFromURLHeaders object itself. + */ + public BlockBlobsStageBlockFromURLHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlockBlobsStageBlockFromURLHeaders object itself. + */ + public BlockBlobsStageBlockFromURLHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentMD5 property: The Content-MD5 property. + * + * @return the contentMD5 value. + */ + public byte[] getContentMD5() { + return this.contentMD5; + } + + /** + * Set the contentMD5 property: The Content-MD5 property. + * + * @param contentMD5 the contentMD5 value to set. + * @return the BlockBlobsStageBlockFromURLHeaders object itself. + */ + public BlockBlobsStageBlockFromURLHeaders setContentMD5(byte[] contentMD5) { + this.contentMD5 = contentMD5; + return this; + } + + /** + * Get the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @return the xMsEncryptionScope value. + */ + public String getXMsEncryptionScope() { + return this.xMsEncryptionScope; + } + + /** + * Set the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @param xMsEncryptionScope the xMsEncryptionScope value to set. + * @return the BlockBlobsStageBlockFromURLHeaders object itself. + */ + public BlockBlobsStageBlockFromURLHeaders setXMsEncryptionScope(String xMsEncryptionScope) { + this.xMsEncryptionScope = xMsEncryptionScope; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsStageBlockHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsStageBlockHeaders.java new file mode 100644 index 000000000000..394184c165f7 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsStageBlockHeaders.java @@ -0,0 +1,325 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Base64; + +/** + * The BlockBlobsStageBlockHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlockBlobsStageBlockHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-content-crc64 property. + */ + private byte[] xMsContentCrc64; + + /* + * The x-ms-encryption-key-sha256 property. + */ + private String xMsEncryptionKeySha256; + + /* + * The x-ms-structured-body property. + */ + private String xMsStructuredBody; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-request-server-encrypted property. + */ + private Boolean xMsRequestServerEncrypted; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-MD5 property. + */ + private byte[] contentMD5; + + /* + * The x-ms-encryption-scope property. + */ + private String xMsEncryptionScope; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_CONTENT_CRC64 = HttpHeaderName.fromString("x-ms-content-crc64"); + + private static final HttpHeaderName X_MS_ENCRYPTION_KEY_SHA256 + = HttpHeaderName.fromString("x-ms-encryption-key-sha256"); + + private static final HttpHeaderName X_MS_STRUCTURED_BODY = HttpHeaderName.fromString("x-ms-structured-body"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_REQUEST_SERVER_ENCRYPTED + = HttpHeaderName.fromString("x-ms-request-server-encrypted"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_SCOPE = HttpHeaderName.fromString("x-ms-encryption-scope"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlockBlobsStageBlockHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlockBlobsStageBlockHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + String xMsContentCrc64 = rawHeaders.getValue(X_MS_CONTENT_CRC64); + if (xMsContentCrc64 != null) { + this.xMsContentCrc64 = Base64.getDecoder().decode(xMsContentCrc64); + } + this.xMsEncryptionKeySha256 = rawHeaders.getValue(X_MS_ENCRYPTION_KEY_SHA256); + this.xMsStructuredBody = rawHeaders.getValue(X_MS_STRUCTURED_BODY); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + String xMsRequestServerEncrypted = rawHeaders.getValue(X_MS_REQUEST_SERVER_ENCRYPTED); + if (xMsRequestServerEncrypted != null) { + this.xMsRequestServerEncrypted = Boolean.parseBoolean(xMsRequestServerEncrypted); + } + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + String contentMD5 = rawHeaders.getValue(HttpHeaderName.CONTENT_MD5); + if (contentMD5 != null) { + this.contentMD5 = Base64.getDecoder().decode(contentMD5); + } + this.xMsEncryptionScope = rawHeaders.getValue(X_MS_ENCRYPTION_SCOPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlockBlobsStageBlockHeaders object itself. + */ + public BlockBlobsStageBlockHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return this.xMsContentCrc64; + } + + /** + * Set the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the BlockBlobsStageBlockHeaders object itself. + */ + public BlockBlobsStageBlockHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = xMsContentCrc64; + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String getXMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the BlockBlobsStageBlockHeaders object itself. + */ + public BlockBlobsStageBlockHeaders setXMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsStructuredBody property: The x-ms-structured-body property. + * + * @return the xMsStructuredBody value. + */ + public String getXMsStructuredBody() { + return this.xMsStructuredBody; + } + + /** + * Set the xMsStructuredBody property: The x-ms-structured-body property. + * + * @param xMsStructuredBody the xMsStructuredBody value to set. + * @return the BlockBlobsStageBlockHeaders object itself. + */ + public BlockBlobsStageBlockHeaders setXMsStructuredBody(String xMsStructuredBody) { + this.xMsStructuredBody = xMsStructuredBody; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlockBlobsStageBlockHeaders object itself. + */ + public BlockBlobsStageBlockHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @return the xMsRequestServerEncrypted value. + */ + public Boolean isXMsRequestServerEncrypted() { + return this.xMsRequestServerEncrypted; + } + + /** + * Set the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @param xMsRequestServerEncrypted the xMsRequestServerEncrypted value to set. + * @return the BlockBlobsStageBlockHeaders object itself. + */ + public BlockBlobsStageBlockHeaders setXMsRequestServerEncrypted(Boolean xMsRequestServerEncrypted) { + this.xMsRequestServerEncrypted = xMsRequestServerEncrypted; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlockBlobsStageBlockHeaders object itself. + */ + public BlockBlobsStageBlockHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlockBlobsStageBlockHeaders object itself. + */ + public BlockBlobsStageBlockHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentMD5 property: The Content-MD5 property. + * + * @return the contentMD5 value. + */ + public byte[] getContentMD5() { + return this.contentMD5; + } + + /** + * Set the contentMD5 property: The Content-MD5 property. + * + * @param contentMD5 the contentMD5 value to set. + * @return the BlockBlobsStageBlockHeaders object itself. + */ + public BlockBlobsStageBlockHeaders setContentMD5(byte[] contentMD5) { + this.contentMD5 = contentMD5; + return this; + } + + /** + * Get the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @return the xMsEncryptionScope value. + */ + public String getXMsEncryptionScope() { + return this.xMsEncryptionScope; + } + + /** + * Set the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @param xMsEncryptionScope the xMsEncryptionScope value to set. + * @return the BlockBlobsStageBlockHeaders object itself. + */ + public BlockBlobsStageBlockHeaders setXMsEncryptionScope(String xMsEncryptionScope) { + this.xMsEncryptionScope = xMsEncryptionScope; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsUploadHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsUploadHeaders.java new file mode 100644 index 000000000000..1437c6295585 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockBlobsUploadHeaders.java @@ -0,0 +1,384 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Base64; + +/** + * The BlockBlobsUploadHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlockBlobsUploadHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-version-id property. + */ + private String xMsVersionId; + + /* + * The x-ms-encryption-key-sha256 property. + */ + private String xMsEncryptionKeySha256; + + /* + * The x-ms-structured-body property. + */ + private String xMsStructuredBody; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-request-server-encrypted property. + */ + private Boolean xMsRequestServerEncrypted; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-MD5 property. + */ + private byte[] contentMD5; + + /* + * The x-ms-encryption-scope property. + */ + private String xMsEncryptionScope; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_VERSION_ID = HttpHeaderName.fromString("x-ms-version-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_KEY_SHA256 + = HttpHeaderName.fromString("x-ms-encryption-key-sha256"); + + private static final HttpHeaderName X_MS_STRUCTURED_BODY = HttpHeaderName.fromString("x-ms-structured-body"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_REQUEST_SERVER_ENCRYPTED + = HttpHeaderName.fromString("x-ms-request-server-encrypted"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_SCOPE = HttpHeaderName.fromString("x-ms-encryption-scope"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of BlockBlobsUploadHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public BlockBlobsUploadHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsVersionId = rawHeaders.getValue(X_MS_VERSION_ID); + this.xMsEncryptionKeySha256 = rawHeaders.getValue(X_MS_ENCRYPTION_KEY_SHA256); + this.xMsStructuredBody = rawHeaders.getValue(X_MS_STRUCTURED_BODY); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + String xMsRequestServerEncrypted = rawHeaders.getValue(X_MS_REQUEST_SERVER_ENCRYPTED); + if (xMsRequestServerEncrypted != null) { + this.xMsRequestServerEncrypted = Boolean.parseBoolean(xMsRequestServerEncrypted); + } + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + String contentMD5 = rawHeaders.getValue(HttpHeaderName.CONTENT_MD5); + if (contentMD5 != null) { + this.contentMD5 = Base64.getDecoder().decode(contentMD5); + } + this.xMsEncryptionScope = rawHeaders.getValue(X_MS_ENCRYPTION_SCOPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the BlockBlobsUploadHeaders object itself. + */ + public BlockBlobsUploadHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the BlockBlobsUploadHeaders object itself. + */ + public BlockBlobsUploadHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the BlockBlobsUploadHeaders object itself. + */ + public BlockBlobsUploadHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsVersionId property: The x-ms-version-id property. + * + * @return the xMsVersionId value. + */ + public String getXMsVersionId() { + return this.xMsVersionId; + } + + /** + * Set the xMsVersionId property: The x-ms-version-id property. + * + * @param xMsVersionId the xMsVersionId value to set. + * @return the BlockBlobsUploadHeaders object itself. + */ + public BlockBlobsUploadHeaders setXMsVersionId(String xMsVersionId) { + this.xMsVersionId = xMsVersionId; + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String getXMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the BlockBlobsUploadHeaders object itself. + */ + public BlockBlobsUploadHeaders setXMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsStructuredBody property: The x-ms-structured-body property. + * + * @return the xMsStructuredBody value. + */ + public String getXMsStructuredBody() { + return this.xMsStructuredBody; + } + + /** + * Set the xMsStructuredBody property: The x-ms-structured-body property. + * + * @param xMsStructuredBody the xMsStructuredBody value to set. + * @return the BlockBlobsUploadHeaders object itself. + */ + public BlockBlobsUploadHeaders setXMsStructuredBody(String xMsStructuredBody) { + this.xMsStructuredBody = xMsStructuredBody; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the BlockBlobsUploadHeaders object itself. + */ + public BlockBlobsUploadHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @return the xMsRequestServerEncrypted value. + */ + public Boolean isXMsRequestServerEncrypted() { + return this.xMsRequestServerEncrypted; + } + + /** + * Set the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @param xMsRequestServerEncrypted the xMsRequestServerEncrypted value to set. + * @return the BlockBlobsUploadHeaders object itself. + */ + public BlockBlobsUploadHeaders setXMsRequestServerEncrypted(Boolean xMsRequestServerEncrypted) { + this.xMsRequestServerEncrypted = xMsRequestServerEncrypted; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the BlockBlobsUploadHeaders object itself. + */ + public BlockBlobsUploadHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the BlockBlobsUploadHeaders object itself. + */ + public BlockBlobsUploadHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentMD5 property: The Content-MD5 property. + * + * @return the contentMD5 value. + */ + public byte[] getContentMD5() { + return this.contentMD5; + } + + /** + * Set the contentMD5 property: The Content-MD5 property. + * + * @param contentMD5 the contentMD5 value to set. + * @return the BlockBlobsUploadHeaders object itself. + */ + public BlockBlobsUploadHeaders setContentMD5(byte[] contentMD5) { + this.contentMD5 = contentMD5; + return this; + } + + /** + * Get the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @return the xMsEncryptionScope value. + */ + public String getXMsEncryptionScope() { + return this.xMsEncryptionScope; + } + + /** + * Set the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @param xMsEncryptionScope the xMsEncryptionScope value to set. + * @return the BlockBlobsUploadHeaders object itself. + */ + public BlockBlobsUploadHeaders setXMsEncryptionScope(String xMsEncryptionScope) { + this.xMsEncryptionScope = xMsEncryptionScope; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockList.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockList.java new file mode 100644 index 000000000000..7eb0e602cc58 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockList.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import java.util.ArrayList; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * The BlockList model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlockList implements XmlSerializable { + /* + * The CommittedBlocks property. + */ + private List committedBlocks; + + /* + * The UncommittedBlocks property. + */ + private List uncommittedBlocks; + + /** + * Creates an instance of BlockList class. + */ + public BlockList() { + } + + /** + * Get the committedBlocks property: The CommittedBlocks property. + * + * @return the committedBlocks value. + */ + public List getCommittedBlocks() { + if (this.committedBlocks == null) { + this.committedBlocks = new ArrayList<>(); + } + return this.committedBlocks; + } + + /** + * Set the committedBlocks property: The CommittedBlocks property. + * + * @param committedBlocks the committedBlocks value to set. + * @return the BlockList object itself. + */ + public BlockList setCommittedBlocks(List committedBlocks) { + this.committedBlocks = committedBlocks; + return this; + } + + /** + * Get the uncommittedBlocks property: The UncommittedBlocks property. + * + * @return the uncommittedBlocks value. + */ + public List getUncommittedBlocks() { + if (this.uncommittedBlocks == null) { + this.uncommittedBlocks = new ArrayList<>(); + } + return this.uncommittedBlocks; + } + + /** + * Set the uncommittedBlocks property: The UncommittedBlocks property. + * + * @param uncommittedBlocks the uncommittedBlocks value to set. + * @return the BlockList object itself. + */ + public BlockList setUncommittedBlocks(List uncommittedBlocks) { + this.uncommittedBlocks = uncommittedBlocks; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "BlockList" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + if (this.committedBlocks != null) { + xmlWriter.writeStartElement("CommittedBlocks"); + for (Block element : this.committedBlocks) { + xmlWriter.writeXml(element, "Block"); + } + xmlWriter.writeEndElement(); + } + if (this.uncommittedBlocks != null) { + xmlWriter.writeStartElement("UncommittedBlocks"); + for (Block element : this.uncommittedBlocks) { + xmlWriter.writeXml(element, "Block"); + } + xmlWriter.writeEndElement(); + } + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlockList from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlockList if the XmlReader was pointing to an instance of it, or null if it was pointing + * to XML null. + * @throws XMLStreamException If an error occurs while reading the BlockList. + */ + public static BlockList fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlockList from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlockList if the XmlReader was pointing to an instance of it, or null if it was pointing + * to XML null. + * @throws XMLStreamException If an error occurs while reading the BlockList. + */ + public static BlockList fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "BlockList" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlockList deserializedBlockList = new BlockList(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("CommittedBlocks".equals(elementName.getLocalPart())) { + while (reader.nextElement() != XmlToken.END_ELEMENT) { + elementName = reader.getElementName(); + if ("Block".equals(elementName.getLocalPart())) { + if (deserializedBlockList.committedBlocks == null) { + deserializedBlockList.committedBlocks = new ArrayList<>(); + } + deserializedBlockList.committedBlocks.add(Block.fromXml(reader, "Block")); + } else { + reader.skipElement(); + } + } + } else if ("UncommittedBlocks".equals(elementName.getLocalPart())) { + while (reader.nextElement() != XmlToken.END_ELEMENT) { + elementName = reader.getElementName(); + if ("Block".equals(elementName.getLocalPart())) { + if (deserializedBlockList.uncommittedBlocks == null) { + deserializedBlockList.uncommittedBlocks = new ArrayList<>(); + } + deserializedBlockList.uncommittedBlocks.add(Block.fromXml(reader, "Block")); + } else { + reader.skipElement(); + } + } + } else { + reader.skipElement(); + } + } + + return deserializedBlockList; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockListType.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockListType.java new file mode 100644 index 000000000000..7e8fda0bfc67 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockListType.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +/** + * Defines values for BlockListType. + */ +public enum BlockListType { + /** + * Enum value committed. + */ + COMMITTED("committed"), + + /** + * Enum value uncommitted. + */ + UNCOMMITTED("uncommitted"), + + /** + * Enum value all. + */ + ALL("all"); + + /** + * The actual serialized value for a BlockListType instance. + */ + private final String value; + + BlockListType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a BlockListType instance. + * + * @param value the serialized value to parse. + * @return the parsed BlockListType object, or null if unable to parse. + */ + public static BlockListType fromString(String value) { + if (value == null) { + return null; + } + BlockListType[] items = BlockListType.values(); + for (BlockListType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockLookupList.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockLookupList.java new file mode 100644 index 000000000000..8d0eb895e91d --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/BlockLookupList.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import java.util.ArrayList; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * The BlockLookupList model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class BlockLookupList implements XmlSerializable { + /* + * The Committed property. + */ + private List committed = new ArrayList<>(); + + /* + * The Uncommitted property. + */ + private List uncommitted = new ArrayList<>(); + + /* + * The Latest property. + */ + private List latest = new ArrayList<>(); + + /** + * Creates an instance of BlockLookupList class. + */ + public BlockLookupList() { + } + + /** + * Get the committed property: The Committed property. + * + * @return the committed value. + */ + public List getCommitted() { + return this.committed; + } + + /** + * Set the committed property: The Committed property. + * + * @param committed the committed value to set. + * @return the BlockLookupList object itself. + */ + public BlockLookupList setCommitted(List committed) { + this.committed = committed; + return this; + } + + /** + * Get the uncommitted property: The Uncommitted property. + * + * @return the uncommitted value. + */ + public List getUncommitted() { + return this.uncommitted; + } + + /** + * Set the uncommitted property: The Uncommitted property. + * + * @param uncommitted the uncommitted value to set. + * @return the BlockLookupList object itself. + */ + public BlockLookupList setUncommitted(List uncommitted) { + this.uncommitted = uncommitted; + return this; + } + + /** + * Get the latest property: The Latest property. + * + * @return the latest value. + */ + public List getLatest() { + return this.latest; + } + + /** + * Set the latest property: The Latest property. + * + * @param latest the latest value to set. + * @return the BlockLookupList object itself. + */ + public BlockLookupList setLatest(List latest) { + this.latest = latest; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "BlockList" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + if (this.committed != null) { + for (String element : this.committed) { + xmlWriter.writeStringElement("Committed", element); + } + } + if (this.uncommitted != null) { + for (String element : this.uncommitted) { + xmlWriter.writeStringElement("Uncommitted", element); + } + } + if (this.latest != null) { + for (String element : this.latest) { + xmlWriter.writeStringElement("Latest", element); + } + } + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of BlockLookupList from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of BlockLookupList if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlockLookupList. + */ + public static BlockLookupList fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of BlockLookupList from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of BlockLookupList if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the BlockLookupList. + */ + public static BlockLookupList fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "BlockList" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + BlockLookupList deserializedBlockLookupList = new BlockLookupList(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Committed".equals(elementName.getLocalPart())) { + deserializedBlockLookupList.committed.add(reader.getStringElement()); + } else if ("Uncommitted".equals(elementName.getLocalPart())) { + deserializedBlockLookupList.uncommitted.add(reader.getStringElement()); + } else if ("Latest".equals(elementName.getLocalPart())) { + deserializedBlockLookupList.latest.add(reader.getStringElement()); + } else { + reader.skipElement(); + } + } + + return deserializedBlockLookupList; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ClearRange.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ClearRange.java new file mode 100644 index 000000000000..dba994238def --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ClearRange.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * The ClearRange model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ClearRange implements XmlSerializable { + /* + * The Start property. + */ + private long start; + + /* + * The End property. + */ + private long end; + + /** + * Creates an instance of ClearRange class. + */ + public ClearRange() { + } + + /** + * Get the start property: The Start property. + * + * @return the start value. + */ + public long getStart() { + return this.start; + } + + /** + * Set the start property: The Start property. + * + * @param start the start value to set. + * @return the ClearRange object itself. + */ + public ClearRange setStart(long start) { + this.start = start; + return this; + } + + /** + * Get the end property: The End property. + * + * @return the end value. + */ + public long getEnd() { + return this.end; + } + + /** + * Set the end property: The End property. + * + * @param end the end value to set. + * @return the ClearRange object itself. + */ + public ClearRange setEnd(long end) { + this.end = end; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "ClearRange" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeLongElement("Start", this.start); + xmlWriter.writeLongElement("End", this.end); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of ClearRange from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of ClearRange if the XmlReader was pointing to an instance of it, or null if it was pointing + * to XML null. + * @throws XMLStreamException If an error occurs while reading the ClearRange. + */ + public static ClearRange fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of ClearRange from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of ClearRange if the XmlReader was pointing to an instance of it, or null if it was pointing + * to XML null. + * @throws XMLStreamException If an error occurs while reading the ClearRange. + */ + public static ClearRange fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "ClearRange" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + ClearRange deserializedClearRange = new ClearRange(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Start".equals(elementName.getLocalPart())) { + deserializedClearRange.start = reader.getLongElement(); + } else if ("End".equals(elementName.getLocalPart())) { + deserializedClearRange.end = reader.getLongElement(); + } else { + reader.skipElement(); + } + } + + return deserializedClearRange; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersAcquireLeaseHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersAcquireLeaseHeaders.java new file mode 100644 index 000000000000..e4ed70561416 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersAcquireLeaseHeaders.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ContainersAcquireLeaseHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersAcquireLeaseHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-lease-id property. + */ + private String xMsLeaseId; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_LEASE_ID = HttpHeaderName.fromString("x-ms-lease-id"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersAcquireLeaseHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersAcquireLeaseHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + this.xMsLeaseId = rawHeaders.getValue(X_MS_LEASE_ID); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersAcquireLeaseHeaders object itself. + */ + public ContainersAcquireLeaseHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the ContainersAcquireLeaseHeaders object itself. + */ + public ContainersAcquireLeaseHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsLeaseId property: The x-ms-lease-id property. + * + * @return the xMsLeaseId value. + */ + public String getXMsLeaseId() { + return this.xMsLeaseId; + } + + /** + * Set the xMsLeaseId property: The x-ms-lease-id property. + * + * @param xMsLeaseId the xMsLeaseId value to set. + * @return the ContainersAcquireLeaseHeaders object itself. + */ + public ContainersAcquireLeaseHeaders setXMsLeaseId(String xMsLeaseId) { + this.xMsLeaseId = xMsLeaseId; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the ContainersAcquireLeaseHeaders object itself. + */ + public ContainersAcquireLeaseHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersAcquireLeaseHeaders object itself. + */ + public ContainersAcquireLeaseHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ContainersAcquireLeaseHeaders object itself. + */ + public ContainersAcquireLeaseHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ContainersAcquireLeaseHeaders object itself. + */ + public ContainersAcquireLeaseHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersBreakLeaseHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersBreakLeaseHeaders.java new file mode 100644 index 000000000000..3190fbe8eab1 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersBreakLeaseHeaders.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ContainersBreakLeaseHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersBreakLeaseHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-lease-time property. + */ + private Integer xMsLeaseTime; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_LEASE_TIME = HttpHeaderName.fromString("x-ms-lease-time"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersBreakLeaseHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersBreakLeaseHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String xMsLeaseTime = rawHeaders.getValue(X_MS_LEASE_TIME); + if (xMsLeaseTime != null) { + this.xMsLeaseTime = Integer.parseInt(xMsLeaseTime); + } + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersBreakLeaseHeaders object itself. + */ + public ContainersBreakLeaseHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the ContainersBreakLeaseHeaders object itself. + */ + public ContainersBreakLeaseHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsLeaseTime property: The x-ms-lease-time property. + * + * @return the xMsLeaseTime value. + */ + public Integer getXMsLeaseTime() { + return this.xMsLeaseTime; + } + + /** + * Set the xMsLeaseTime property: The x-ms-lease-time property. + * + * @param xMsLeaseTime the xMsLeaseTime value to set. + * @return the ContainersBreakLeaseHeaders object itself. + */ + public ContainersBreakLeaseHeaders setXMsLeaseTime(Integer xMsLeaseTime) { + this.xMsLeaseTime = xMsLeaseTime; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the ContainersBreakLeaseHeaders object itself. + */ + public ContainersBreakLeaseHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersBreakLeaseHeaders object itself. + */ + public ContainersBreakLeaseHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ContainersBreakLeaseHeaders object itself. + */ + public ContainersBreakLeaseHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ContainersBreakLeaseHeaders object itself. + */ + public ContainersBreakLeaseHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersChangeLeaseHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersChangeLeaseHeaders.java new file mode 100644 index 000000000000..d0a208db338d --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersChangeLeaseHeaders.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ContainersChangeLeaseHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersChangeLeaseHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-lease-id property. + */ + private String xMsLeaseId; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_LEASE_ID = HttpHeaderName.fromString("x-ms-lease-id"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersChangeLeaseHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersChangeLeaseHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + this.xMsLeaseId = rawHeaders.getValue(X_MS_LEASE_ID); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersChangeLeaseHeaders object itself. + */ + public ContainersChangeLeaseHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the ContainersChangeLeaseHeaders object itself. + */ + public ContainersChangeLeaseHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsLeaseId property: The x-ms-lease-id property. + * + * @return the xMsLeaseId value. + */ + public String getXMsLeaseId() { + return this.xMsLeaseId; + } + + /** + * Set the xMsLeaseId property: The x-ms-lease-id property. + * + * @param xMsLeaseId the xMsLeaseId value to set. + * @return the ContainersChangeLeaseHeaders object itself. + */ + public ContainersChangeLeaseHeaders setXMsLeaseId(String xMsLeaseId) { + this.xMsLeaseId = xMsLeaseId; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the ContainersChangeLeaseHeaders object itself. + */ + public ContainersChangeLeaseHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersChangeLeaseHeaders object itself. + */ + public ContainersChangeLeaseHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ContainersChangeLeaseHeaders object itself. + */ + public ContainersChangeLeaseHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ContainersChangeLeaseHeaders object itself. + */ + public ContainersChangeLeaseHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersCreateHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersCreateHeaders.java new file mode 100644 index 000000000000..0aba13a559f2 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersCreateHeaders.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ContainersCreateHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersCreateHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersCreateHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersCreateHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersCreateHeaders object itself. + */ + public ContainersCreateHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the ContainersCreateHeaders object itself. + */ + public ContainersCreateHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the ContainersCreateHeaders object itself. + */ + public ContainersCreateHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersCreateHeaders object itself. + */ + public ContainersCreateHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ContainersCreateHeaders object itself. + */ + public ContainersCreateHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ContainersCreateHeaders object itself. + */ + public ContainersCreateHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersDeleteHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersDeleteHeaders.java new file mode 100644 index 000000000000..f706ddd22b5f --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersDeleteHeaders.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ContainersDeleteHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersDeleteHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersDeleteHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersDeleteHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersDeleteHeaders object itself. + */ + public ContainersDeleteHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersDeleteHeaders object itself. + */ + public ContainersDeleteHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ContainersDeleteHeaders object itself. + */ + public ContainersDeleteHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ContainersDeleteHeaders object itself. + */ + public ContainersDeleteHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersFilterBlobsHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersFilterBlobsHeaders.java new file mode 100644 index 000000000000..0d976d829922 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersFilterBlobsHeaders.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ContainersFilterBlobsHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersFilterBlobsHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersFilterBlobsHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersFilterBlobsHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersFilterBlobsHeaders object itself. + */ + public ContainersFilterBlobsHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersFilterBlobsHeaders object itself. + */ + public ContainersFilterBlobsHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ContainersFilterBlobsHeaders object itself. + */ + public ContainersFilterBlobsHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ContainersFilterBlobsHeaders object itself. + */ + public ContainersFilterBlobsHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersGetAccessPolicyHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersGetAccessPolicyHeaders.java new file mode 100644 index 000000000000..4286f48288ff --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersGetAccessPolicyHeaders.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ContainersGetAccessPolicyHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersGetAccessPolicyHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-blob-public-access property. + */ + private PublicAccessType xMsBlobPublicAccess; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_BLOB_PUBLIC_ACCESS = HttpHeaderName.fromString("x-ms-blob-public-access"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersGetAccessPolicyHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersGetAccessPolicyHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + String xMsBlobPublicAccess = rawHeaders.getValue(X_MS_BLOB_PUBLIC_ACCESS); + if (xMsBlobPublicAccess != null) { + this.xMsBlobPublicAccess = PublicAccessType.fromValue(xMsBlobPublicAccess); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersGetAccessPolicyHeaders object itself. + */ + public ContainersGetAccessPolicyHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the ContainersGetAccessPolicyHeaders object itself. + */ + public ContainersGetAccessPolicyHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the ContainersGetAccessPolicyHeaders object itself. + */ + public ContainersGetAccessPolicyHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsBlobPublicAccess property: The x-ms-blob-public-access property. + * + * @return the xMsBlobPublicAccess value. + */ + public PublicAccessType getXMsBlobPublicAccess() { + return this.xMsBlobPublicAccess; + } + + /** + * Set the xMsBlobPublicAccess property: The x-ms-blob-public-access property. + * + * @param xMsBlobPublicAccess the xMsBlobPublicAccess value to set. + * @return the ContainersGetAccessPolicyHeaders object itself. + */ + public ContainersGetAccessPolicyHeaders setXMsBlobPublicAccess(PublicAccessType xMsBlobPublicAccess) { + this.xMsBlobPublicAccess = xMsBlobPublicAccess; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersGetAccessPolicyHeaders object itself. + */ + public ContainersGetAccessPolicyHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ContainersGetAccessPolicyHeaders object itself. + */ + public ContainersGetAccessPolicyHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ContainersGetAccessPolicyHeaders object itself. + */ + public ContainersGetAccessPolicyHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersGetAccountInfoHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersGetAccountInfoHeaders.java new file mode 100644 index 000000000000..f35e0a4757af --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersGetAccountInfoHeaders.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ContainersGetAccountInfoHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersGetAccountInfoHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-account-kind property. + */ + private AccountKind xMsAccountKind; + + /* + * The x-ms-is-hns-enabled property. + */ + private Boolean xMsIsHnsEnabled; + + /* + * The x-ms-sku-name property. + */ + private SkuName xMsSkuName; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_ACCOUNT_KIND = HttpHeaderName.fromString("x-ms-account-kind"); + + private static final HttpHeaderName X_MS_IS_HNS_ENABLED = HttpHeaderName.fromString("x-ms-is-hns-enabled"); + + private static final HttpHeaderName X_MS_SKU_NAME = HttpHeaderName.fromString("x-ms-sku-name"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersGetAccountInfoHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersGetAccountInfoHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + String xMsAccountKind = rawHeaders.getValue(X_MS_ACCOUNT_KIND); + if (xMsAccountKind != null) { + this.xMsAccountKind = AccountKind.fromString(xMsAccountKind); + } + String xMsIsHnsEnabled = rawHeaders.getValue(X_MS_IS_HNS_ENABLED); + if (xMsIsHnsEnabled != null) { + this.xMsIsHnsEnabled = Boolean.parseBoolean(xMsIsHnsEnabled); + } + String xMsSkuName = rawHeaders.getValue(X_MS_SKU_NAME); + if (xMsSkuName != null) { + this.xMsSkuName = SkuName.fromString(xMsSkuName); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersGetAccountInfoHeaders object itself. + */ + public ContainersGetAccountInfoHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsAccountKind property: The x-ms-account-kind property. + * + * @return the xMsAccountKind value. + */ + public AccountKind getXMsAccountKind() { + return this.xMsAccountKind; + } + + /** + * Set the xMsAccountKind property: The x-ms-account-kind property. + * + * @param xMsAccountKind the xMsAccountKind value to set. + * @return the ContainersGetAccountInfoHeaders object itself. + */ + public ContainersGetAccountInfoHeaders setXMsAccountKind(AccountKind xMsAccountKind) { + this.xMsAccountKind = xMsAccountKind; + return this; + } + + /** + * Get the xMsIsHnsEnabled property: The x-ms-is-hns-enabled property. + * + * @return the xMsIsHnsEnabled value. + */ + public Boolean isXMsIsHnsEnabled() { + return this.xMsIsHnsEnabled; + } + + /** + * Set the xMsIsHnsEnabled property: The x-ms-is-hns-enabled property. + * + * @param xMsIsHnsEnabled the xMsIsHnsEnabled value to set. + * @return the ContainersGetAccountInfoHeaders object itself. + */ + public ContainersGetAccountInfoHeaders setXMsIsHnsEnabled(Boolean xMsIsHnsEnabled) { + this.xMsIsHnsEnabled = xMsIsHnsEnabled; + return this; + } + + /** + * Get the xMsSkuName property: The x-ms-sku-name property. + * + * @return the xMsSkuName value. + */ + public SkuName getXMsSkuName() { + return this.xMsSkuName; + } + + /** + * Set the xMsSkuName property: The x-ms-sku-name property. + * + * @param xMsSkuName the xMsSkuName value to set. + * @return the ContainersGetAccountInfoHeaders object itself. + */ + public ContainersGetAccountInfoHeaders setXMsSkuName(SkuName xMsSkuName) { + this.xMsSkuName = xMsSkuName; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersGetAccountInfoHeaders object itself. + */ + public ContainersGetAccountInfoHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ContainersGetAccountInfoHeaders object itself. + */ + public ContainersGetAccountInfoHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ContainersGetAccountInfoHeaders object itself. + */ + public ContainersGetAccountInfoHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersGetPropertiesHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersGetPropertiesHeaders.java new file mode 100644 index 000000000000..05c6f2bbe88b --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersGetPropertiesHeaders.java @@ -0,0 +1,530 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The ContainersGetPropertiesHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersGetPropertiesHeaders { + /* + * The x-ms-lease-status property. + */ + private LeaseStatusType xMsLeaseStatus; + + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-immutable-storage-with-versioning-enabled property. + */ + private Boolean xMsImmutableStorageWithVersioningEnabled; + + /* + * The x-ms-lease-state property. + */ + private LeaseStateType xMsLeaseState; + + /* + * The x-ms-deny-encryption-scope-override property. + */ + private Boolean xMsDenyEncryptionScopeOverride; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-meta- property. + */ + private Map xMsMeta; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The x-ms-has-legal-hold property. + */ + private Boolean xMsHasLegalHold; + + /* + * The x-ms-default-encryption-scope property. + */ + private String xMsDefaultEncryptionScope; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-has-immutability-policy property. + */ + private Boolean xMsHasImmutabilityPolicy; + + /* + * The x-ms-lease-duration property. + */ + private LeaseDurationType xMsLeaseDuration; + + /* + * The x-ms-blob-public-access property. + */ + private PublicAccessType xMsBlobPublicAccess; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + private static final HttpHeaderName X_MS_LEASE_STATUS = HttpHeaderName.fromString("x-ms-lease-status"); + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_IMMUTABLE_STORAGE_WITH_VERSIONING_ENABLED + = HttpHeaderName.fromString("x-ms-immutable-storage-with-versioning-enabled"); + + private static final HttpHeaderName X_MS_LEASE_STATE = HttpHeaderName.fromString("x-ms-lease-state"); + + private static final HttpHeaderName X_MS_DENY_ENCRYPTION_SCOPE_OVERRIDE + = HttpHeaderName.fromString("x-ms-deny-encryption-scope-override"); + + private static final HttpHeaderName X_MS_HAS_LEGAL_HOLD = HttpHeaderName.fromString("x-ms-has-legal-hold"); + + private static final HttpHeaderName X_MS_DEFAULT_ENCRYPTION_SCOPE + = HttpHeaderName.fromString("x-ms-default-encryption-scope"); + + private static final HttpHeaderName X_MS_HAS_IMMUTABILITY_POLICY + = HttpHeaderName.fromString("x-ms-has-immutability-policy"); + + private static final HttpHeaderName X_MS_LEASE_DURATION = HttpHeaderName.fromString("x-ms-lease-duration"); + + private static final HttpHeaderName X_MS_BLOB_PUBLIC_ACCESS = HttpHeaderName.fromString("x-ms-blob-public-access"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersGetPropertiesHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersGetPropertiesHeaders(HttpHeaders rawHeaders) { + String xMsLeaseStatus = rawHeaders.getValue(X_MS_LEASE_STATUS); + if (xMsLeaseStatus != null) { + this.xMsLeaseStatus = LeaseStatusType.fromString(xMsLeaseStatus); + } + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + String xMsImmutableStorageWithVersioningEnabled + = rawHeaders.getValue(X_MS_IMMUTABLE_STORAGE_WITH_VERSIONING_ENABLED); + if (xMsImmutableStorageWithVersioningEnabled != null) { + this.xMsImmutableStorageWithVersioningEnabled + = Boolean.parseBoolean(xMsImmutableStorageWithVersioningEnabled); + } + String xMsLeaseState = rawHeaders.getValue(X_MS_LEASE_STATE); + if (xMsLeaseState != null) { + this.xMsLeaseState = LeaseStateType.fromString(xMsLeaseState); + } + String xMsDenyEncryptionScopeOverride = rawHeaders.getValue(X_MS_DENY_ENCRYPTION_SCOPE_OVERRIDE); + if (xMsDenyEncryptionScopeOverride != null) { + this.xMsDenyEncryptionScopeOverride = Boolean.parseBoolean(xMsDenyEncryptionScopeOverride); + } + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + String xMsHasLegalHold = rawHeaders.getValue(X_MS_HAS_LEGAL_HOLD); + if (xMsHasLegalHold != null) { + this.xMsHasLegalHold = Boolean.parseBoolean(xMsHasLegalHold); + } + this.xMsDefaultEncryptionScope = rawHeaders.getValue(X_MS_DEFAULT_ENCRYPTION_SCOPE); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String xMsHasImmutabilityPolicy = rawHeaders.getValue(X_MS_HAS_IMMUTABILITY_POLICY); + if (xMsHasImmutabilityPolicy != null) { + this.xMsHasImmutabilityPolicy = Boolean.parseBoolean(xMsHasImmutabilityPolicy); + } + String xMsLeaseDuration = rawHeaders.getValue(X_MS_LEASE_DURATION); + if (xMsLeaseDuration != null) { + this.xMsLeaseDuration = LeaseDurationType.fromString(xMsLeaseDuration); + } + String xMsBlobPublicAccess = rawHeaders.getValue(X_MS_BLOB_PUBLIC_ACCESS); + if (xMsBlobPublicAccess != null) { + this.xMsBlobPublicAccess = PublicAccessType.fromValue(xMsBlobPublicAccess); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + Map xMsMetaHeaderCollection = new LinkedHashMap<>(); + + rawHeaders.stream().forEach(header -> { + String headerName = header.getName().getValue(); + if (headerName.startsWith("x-ms-meta-")) { + xMsMetaHeaderCollection.put(headerName.substring(10), header.getValue()); + } + }); + this.xMsMeta = xMsMetaHeaderCollection; + } + + /** + * Get the xMsLeaseStatus property: The x-ms-lease-status property. + * + * @return the xMsLeaseStatus value. + */ + public LeaseStatusType getXMsLeaseStatus() { + return this.xMsLeaseStatus; + } + + /** + * Set the xMsLeaseStatus property: The x-ms-lease-status property. + * + * @param xMsLeaseStatus the xMsLeaseStatus value to set. + * @return the ContainersGetPropertiesHeaders object itself. + */ + public ContainersGetPropertiesHeaders setXMsLeaseStatus(LeaseStatusType xMsLeaseStatus) { + this.xMsLeaseStatus = xMsLeaseStatus; + return this; + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersGetPropertiesHeaders object itself. + */ + public ContainersGetPropertiesHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsImmutableStorageWithVersioningEnabled property: The x-ms-immutable-storage-with-versioning-enabled + * property. + * + * @return the xMsImmutableStorageWithVersioningEnabled value. + */ + public Boolean isXMsImmutableStorageWithVersioningEnabled() { + return this.xMsImmutableStorageWithVersioningEnabled; + } + + /** + * Set the xMsImmutableStorageWithVersioningEnabled property: The x-ms-immutable-storage-with-versioning-enabled + * property. + * + * @param xMsImmutableStorageWithVersioningEnabled the xMsImmutableStorageWithVersioningEnabled value to set. + * @return the ContainersGetPropertiesHeaders object itself. + */ + public ContainersGetPropertiesHeaders + setXMsImmutableStorageWithVersioningEnabled(Boolean xMsImmutableStorageWithVersioningEnabled) { + this.xMsImmutableStorageWithVersioningEnabled = xMsImmutableStorageWithVersioningEnabled; + return this; + } + + /** + * Get the xMsLeaseState property: The x-ms-lease-state property. + * + * @return the xMsLeaseState value. + */ + public LeaseStateType getXMsLeaseState() { + return this.xMsLeaseState; + } + + /** + * Set the xMsLeaseState property: The x-ms-lease-state property. + * + * @param xMsLeaseState the xMsLeaseState value to set. + * @return the ContainersGetPropertiesHeaders object itself. + */ + public ContainersGetPropertiesHeaders setXMsLeaseState(LeaseStateType xMsLeaseState) { + this.xMsLeaseState = xMsLeaseState; + return this; + } + + /** + * Get the xMsDenyEncryptionScopeOverride property: The x-ms-deny-encryption-scope-override property. + * + * @return the xMsDenyEncryptionScopeOverride value. + */ + public Boolean isXMsDenyEncryptionScopeOverride() { + return this.xMsDenyEncryptionScopeOverride; + } + + /** + * Set the xMsDenyEncryptionScopeOverride property: The x-ms-deny-encryption-scope-override property. + * + * @param xMsDenyEncryptionScopeOverride the xMsDenyEncryptionScopeOverride value to set. + * @return the ContainersGetPropertiesHeaders object itself. + */ + public ContainersGetPropertiesHeaders setXMsDenyEncryptionScopeOverride(Boolean xMsDenyEncryptionScopeOverride) { + this.xMsDenyEncryptionScopeOverride = xMsDenyEncryptionScopeOverride; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the ContainersGetPropertiesHeaders object itself. + */ + public ContainersGetPropertiesHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsMeta property: The x-ms-meta- property. + * + * @return the xMsMeta value. + */ + public Map getXMsMeta() { + return this.xMsMeta; + } + + /** + * Set the xMsMeta property: The x-ms-meta- property. + * + * @param xMsMeta the xMsMeta value to set. + * @return the ContainersGetPropertiesHeaders object itself. + */ + public ContainersGetPropertiesHeaders setXMsMeta(Map xMsMeta) { + this.xMsMeta = xMsMeta; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ContainersGetPropertiesHeaders object itself. + */ + public ContainersGetPropertiesHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the xMsHasLegalHold property: The x-ms-has-legal-hold property. + * + * @return the xMsHasLegalHold value. + */ + public Boolean isXMsHasLegalHold() { + return this.xMsHasLegalHold; + } + + /** + * Set the xMsHasLegalHold property: The x-ms-has-legal-hold property. + * + * @param xMsHasLegalHold the xMsHasLegalHold value to set. + * @return the ContainersGetPropertiesHeaders object itself. + */ + public ContainersGetPropertiesHeaders setXMsHasLegalHold(Boolean xMsHasLegalHold) { + this.xMsHasLegalHold = xMsHasLegalHold; + return this; + } + + /** + * Get the xMsDefaultEncryptionScope property: The x-ms-default-encryption-scope property. + * + * @return the xMsDefaultEncryptionScope value. + */ + public String getXMsDefaultEncryptionScope() { + return this.xMsDefaultEncryptionScope; + } + + /** + * Set the xMsDefaultEncryptionScope property: The x-ms-default-encryption-scope property. + * + * @param xMsDefaultEncryptionScope the xMsDefaultEncryptionScope value to set. + * @return the ContainersGetPropertiesHeaders object itself. + */ + public ContainersGetPropertiesHeaders setXMsDefaultEncryptionScope(String xMsDefaultEncryptionScope) { + this.xMsDefaultEncryptionScope = xMsDefaultEncryptionScope; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the ContainersGetPropertiesHeaders object itself. + */ + public ContainersGetPropertiesHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsHasImmutabilityPolicy property: The x-ms-has-immutability-policy property. + * + * @return the xMsHasImmutabilityPolicy value. + */ + public Boolean isXMsHasImmutabilityPolicy() { + return this.xMsHasImmutabilityPolicy; + } + + /** + * Set the xMsHasImmutabilityPolicy property: The x-ms-has-immutability-policy property. + * + * @param xMsHasImmutabilityPolicy the xMsHasImmutabilityPolicy value to set. + * @return the ContainersGetPropertiesHeaders object itself. + */ + public ContainersGetPropertiesHeaders setXMsHasImmutabilityPolicy(Boolean xMsHasImmutabilityPolicy) { + this.xMsHasImmutabilityPolicy = xMsHasImmutabilityPolicy; + return this; + } + + /** + * Get the xMsLeaseDuration property: The x-ms-lease-duration property. + * + * @return the xMsLeaseDuration value. + */ + public LeaseDurationType getXMsLeaseDuration() { + return this.xMsLeaseDuration; + } + + /** + * Set the xMsLeaseDuration property: The x-ms-lease-duration property. + * + * @param xMsLeaseDuration the xMsLeaseDuration value to set. + * @return the ContainersGetPropertiesHeaders object itself. + */ + public ContainersGetPropertiesHeaders setXMsLeaseDuration(LeaseDurationType xMsLeaseDuration) { + this.xMsLeaseDuration = xMsLeaseDuration; + return this; + } + + /** + * Get the xMsBlobPublicAccess property: The x-ms-blob-public-access property. + * + * @return the xMsBlobPublicAccess value. + */ + public PublicAccessType getXMsBlobPublicAccess() { + return this.xMsBlobPublicAccess; + } + + /** + * Set the xMsBlobPublicAccess property: The x-ms-blob-public-access property. + * + * @param xMsBlobPublicAccess the xMsBlobPublicAccess value to set. + * @return the ContainersGetPropertiesHeaders object itself. + */ + public ContainersGetPropertiesHeaders setXMsBlobPublicAccess(PublicAccessType xMsBlobPublicAccess) { + this.xMsBlobPublicAccess = xMsBlobPublicAccess; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersGetPropertiesHeaders object itself. + */ + public ContainersGetPropertiesHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ContainersGetPropertiesHeaders object itself. + */ + public ContainersGetPropertiesHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersListBlobFlatSegmentHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersListBlobFlatSegmentHeaders.java new file mode 100644 index 000000000000..efbabab1d1c7 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersListBlobFlatSegmentHeaders.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ContainersListBlobFlatSegmentHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersListBlobFlatSegmentHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-Type property. + */ + private String contentType; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersListBlobFlatSegmentHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersListBlobFlatSegmentHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + this.contentType = rawHeaders.getValue(HttpHeaderName.CONTENT_TYPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersListBlobFlatSegmentHeaders object itself. + */ + public ContainersListBlobFlatSegmentHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersListBlobFlatSegmentHeaders object itself. + */ + public ContainersListBlobFlatSegmentHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ContainersListBlobFlatSegmentHeaders object itself. + */ + public ContainersListBlobFlatSegmentHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ContainersListBlobFlatSegmentHeaders object itself. + */ + public ContainersListBlobFlatSegmentHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentType property: The Content-Type property. + * + * @return the contentType value. + */ + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The Content-Type property. + * + * @param contentType the contentType value to set. + * @return the ContainersListBlobFlatSegmentHeaders object itself. + */ + public ContainersListBlobFlatSegmentHeaders setContentType(String contentType) { + this.contentType = contentType; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersListBlobHierarchySegmentHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersListBlobHierarchySegmentHeaders.java new file mode 100644 index 000000000000..872bc7b6ba43 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersListBlobHierarchySegmentHeaders.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ContainersListBlobHierarchySegmentHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersListBlobHierarchySegmentHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-Type property. + */ + private String contentType; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersListBlobHierarchySegmentHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersListBlobHierarchySegmentHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + this.contentType = rawHeaders.getValue(HttpHeaderName.CONTENT_TYPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersListBlobHierarchySegmentHeaders object itself. + */ + public ContainersListBlobHierarchySegmentHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersListBlobHierarchySegmentHeaders object itself. + */ + public ContainersListBlobHierarchySegmentHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ContainersListBlobHierarchySegmentHeaders object itself. + */ + public ContainersListBlobHierarchySegmentHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ContainersListBlobHierarchySegmentHeaders object itself. + */ + public ContainersListBlobHierarchySegmentHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentType property: The Content-Type property. + * + * @return the contentType value. + */ + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The Content-Type property. + * + * @param contentType the contentType value to set. + * @return the ContainersListBlobHierarchySegmentHeaders object itself. + */ + public ContainersListBlobHierarchySegmentHeaders setContentType(String contentType) { + this.contentType = contentType; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersReleaseLeaseHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersReleaseLeaseHeaders.java new file mode 100644 index 000000000000..373ca378e1d4 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersReleaseLeaseHeaders.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ContainersReleaseLeaseHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersReleaseLeaseHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersReleaseLeaseHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersReleaseLeaseHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersReleaseLeaseHeaders object itself. + */ + public ContainersReleaseLeaseHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the ContainersReleaseLeaseHeaders object itself. + */ + public ContainersReleaseLeaseHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the ContainersReleaseLeaseHeaders object itself. + */ + public ContainersReleaseLeaseHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersReleaseLeaseHeaders object itself. + */ + public ContainersReleaseLeaseHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ContainersReleaseLeaseHeaders object itself. + */ + public ContainersReleaseLeaseHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ContainersReleaseLeaseHeaders object itself. + */ + public ContainersReleaseLeaseHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersRenameHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersRenameHeaders.java new file mode 100644 index 000000000000..524ba16b6d0b --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersRenameHeaders.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ContainersRenameHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersRenameHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersRenameHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersRenameHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersRenameHeaders object itself. + */ + public ContainersRenameHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersRenameHeaders object itself. + */ + public ContainersRenameHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ContainersRenameHeaders object itself. + */ + public ContainersRenameHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ContainersRenameHeaders object itself. + */ + public ContainersRenameHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersRenewLeaseHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersRenewLeaseHeaders.java new file mode 100644 index 000000000000..c3381121cfd4 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersRenewLeaseHeaders.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ContainersRenewLeaseHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersRenewLeaseHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-lease-id property. + */ + private String xMsLeaseId; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_LEASE_ID = HttpHeaderName.fromString("x-ms-lease-id"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersRenewLeaseHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersRenewLeaseHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + this.xMsLeaseId = rawHeaders.getValue(X_MS_LEASE_ID); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersRenewLeaseHeaders object itself. + */ + public ContainersRenewLeaseHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the ContainersRenewLeaseHeaders object itself. + */ + public ContainersRenewLeaseHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsLeaseId property: The x-ms-lease-id property. + * + * @return the xMsLeaseId value. + */ + public String getXMsLeaseId() { + return this.xMsLeaseId; + } + + /** + * Set the xMsLeaseId property: The x-ms-lease-id property. + * + * @param xMsLeaseId the xMsLeaseId value to set. + * @return the ContainersRenewLeaseHeaders object itself. + */ + public ContainersRenewLeaseHeaders setXMsLeaseId(String xMsLeaseId) { + this.xMsLeaseId = xMsLeaseId; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the ContainersRenewLeaseHeaders object itself. + */ + public ContainersRenewLeaseHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersRenewLeaseHeaders object itself. + */ + public ContainersRenewLeaseHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ContainersRenewLeaseHeaders object itself. + */ + public ContainersRenewLeaseHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ContainersRenewLeaseHeaders object itself. + */ + public ContainersRenewLeaseHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersRestoreHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersRestoreHeaders.java new file mode 100644 index 000000000000..d971228daf39 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersRestoreHeaders.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ContainersRestoreHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersRestoreHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersRestoreHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersRestoreHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersRestoreHeaders object itself. + */ + public ContainersRestoreHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersRestoreHeaders object itself. + */ + public ContainersRestoreHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ContainersRestoreHeaders object itself. + */ + public ContainersRestoreHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ContainersRestoreHeaders object itself. + */ + public ContainersRestoreHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersSetAccessPolicyHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersSetAccessPolicyHeaders.java new file mode 100644 index 000000000000..13b19c5dc9d4 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersSetAccessPolicyHeaders.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ContainersSetAccessPolicyHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersSetAccessPolicyHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersSetAccessPolicyHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersSetAccessPolicyHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersSetAccessPolicyHeaders object itself. + */ + public ContainersSetAccessPolicyHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the ContainersSetAccessPolicyHeaders object itself. + */ + public ContainersSetAccessPolicyHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the ContainersSetAccessPolicyHeaders object itself. + */ + public ContainersSetAccessPolicyHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersSetAccessPolicyHeaders object itself. + */ + public ContainersSetAccessPolicyHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ContainersSetAccessPolicyHeaders object itself. + */ + public ContainersSetAccessPolicyHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ContainersSetAccessPolicyHeaders object itself. + */ + public ContainersSetAccessPolicyHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersSetMetadataHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersSetMetadataHeaders.java new file mode 100644 index 000000000000..0c6026a2fe56 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersSetMetadataHeaders.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ContainersSetMetadataHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersSetMetadataHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersSetMetadataHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersSetMetadataHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersSetMetadataHeaders object itself. + */ + public ContainersSetMetadataHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the ContainersSetMetadataHeaders object itself. + */ + public ContainersSetMetadataHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the ContainersSetMetadataHeaders object itself. + */ + public ContainersSetMetadataHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersSetMetadataHeaders object itself. + */ + public ContainersSetMetadataHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ContainersSetMetadataHeaders object itself. + */ + public ContainersSetMetadataHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ContainersSetMetadataHeaders object itself. + */ + public ContainersSetMetadataHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersSubmitBatchHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersSubmitBatchHeaders.java new file mode 100644 index 000000000000..5a8b0e1df189 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ContainersSubmitBatchHeaders.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; + +/** + * The ContainersSubmitBatchHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ContainersSubmitBatchHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The Content-Type property. + */ + private String contentType; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ContainersSubmitBatchHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ContainersSubmitBatchHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.contentType = rawHeaders.getValue(HttpHeaderName.CONTENT_TYPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ContainersSubmitBatchHeaders object itself. + */ + public ContainersSubmitBatchHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ContainersSubmitBatchHeaders object itself. + */ + public ContainersSubmitBatchHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the contentType property: The Content-Type property. + * + * @return the contentType value. + */ + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The Content-Type property. + * + * @param contentType the contentType value to set. + * @return the ContainersSubmitBatchHeaders object itself. + */ + public ContainersSubmitBatchHeaders setContentType(String contentType) { + this.contentType = contentType; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/CopyStatusType.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/CopyStatusType.java new file mode 100644 index 000000000000..bf373d85dffa --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/CopyStatusType.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.v2.storage.blob.models; + +/** + * Defines values for CopyStatusType. + */ +public enum CopyStatusType { + /** + * Enum value pending. + */ + PENDING("pending"), + + /** + * Enum value success. + */ + SUCCESS("success"), + + /** + * Enum value aborted. + */ + ABORTED("aborted"), + + /** + * Enum value failed. + */ + FAILED("failed"); + + /** + * The actual serialized value for a CopyStatusType instance. + */ + private final String value; + + CopyStatusType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CopyStatusType instance. + * + * @param value the serialized value to parse. + * @return the parsed CopyStatusType object, or null if unable to parse. + */ + public static CopyStatusType fromString(String value) { + if (value == null) { + return null; + } + CopyStatusType[] items = CopyStatusType.values(); + for (CopyStatusType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/CpkInfo.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/CpkInfo.java new file mode 100644 index 000000000000..7bab8a840f75 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/CpkInfo.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; + +/** + * Parameter group. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class CpkInfo { + /* + * Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, + * encryption is performed with the root account encryption key. For more information, see Encryption at Rest for + * Azure Storage Services. + */ + private String encryptionKey; + + /* + * The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. + */ + private String encryptionKeySha256; + + /* + * The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be + * provided if the x-ms-encryption-key header is provided. + */ + private EncryptionAlgorithmType encryptionAlgorithm; + + /** + * Creates an instance of CpkInfo class. + */ + public CpkInfo() { + } + + /** + * Get the encryptionKey property: Optional. Specifies the encryption key to use to encrypt the data provided in the + * request. If not specified, encryption is performed with the root account encryption key. For more information, + * see Encryption at Rest for Azure Storage Services. + * + * @return the encryptionKey value. + */ + public String getEncryptionKey() { + return this.encryptionKey; + } + + /** + * Set the encryptionKey property: Optional. Specifies the encryption key to use to encrypt the data provided in the + * request. If not specified, encryption is performed with the root account encryption key. For more information, + * see Encryption at Rest for Azure Storage Services. + * + * @param encryptionKey the encryptionKey value to set. + * @return the CpkInfo object itself. + */ + public CpkInfo setEncryptionKey(String encryptionKey) { + this.encryptionKey = encryptionKey; + return this; + } + + /** + * Get the encryptionKeySha256 property: The SHA-256 hash of the provided encryption key. Must be provided if the + * x-ms-encryption-key header is provided. + * + * @return the encryptionKeySha256 value. + */ + public String getEncryptionKeySha256() { + return this.encryptionKeySha256; + } + + /** + * Set the encryptionKeySha256 property: The SHA-256 hash of the provided encryption key. Must be provided if the + * x-ms-encryption-key header is provided. + * + * @param encryptionKeySha256 the encryptionKeySha256 value to set. + * @return the CpkInfo object itself. + */ + public CpkInfo setEncryptionKeySha256(String encryptionKeySha256) { + this.encryptionKeySha256 = encryptionKeySha256; + return this; + } + + /** + * Get the encryptionAlgorithm property: The algorithm used to produce the encryption key hash. Currently, the only + * accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. + * + * @return the encryptionAlgorithm value. + */ + public EncryptionAlgorithmType getEncryptionAlgorithm() { + return this.encryptionAlgorithm; + } + + /** + * Set the encryptionAlgorithm property: The algorithm used to produce the encryption key hash. Currently, the only + * accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. + * + * @param encryptionAlgorithm the encryptionAlgorithm value to set. + * @return the CpkInfo object itself. + */ + public CpkInfo setEncryptionAlgorithm(EncryptionAlgorithmType encryptionAlgorithm) { + this.encryptionAlgorithm = encryptionAlgorithm; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/DeleteSnapshotsOptionType.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/DeleteSnapshotsOptionType.java new file mode 100644 index 000000000000..69e1358af4fa --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/DeleteSnapshotsOptionType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +/** + * Defines values for DeleteSnapshotsOptionType. + */ +public enum DeleteSnapshotsOptionType { + /** + * Enum value include. + */ + INCLUDE("include"), + + /** + * Enum value only. + */ + ONLY("only"); + + /** + * The actual serialized value for a DeleteSnapshotsOptionType instance. + */ + private final String value; + + DeleteSnapshotsOptionType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DeleteSnapshotsOptionType instance. + * + * @param value the serialized value to parse. + * @return the parsed DeleteSnapshotsOptionType object, or null if unable to parse. + */ + public static DeleteSnapshotsOptionType fromString(String value) { + if (value == null) { + return null; + } + DeleteSnapshotsOptionType[] items = DeleteSnapshotsOptionType.values(); + for (DeleteSnapshotsOptionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/DelimitedTextConfiguration.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/DelimitedTextConfiguration.java new file mode 100644 index 000000000000..33aae012a3b7 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/DelimitedTextConfiguration.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * Groups the settings used for interpreting the blob data if the blob is delimited text formatted. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class DelimitedTextConfiguration implements XmlSerializable { + /* + * The string used to separate columns. + */ + private String columnSeparator; + + /* + * The string used to quote a specific field. + */ + private String fieldQuote; + + /* + * The string used to separate records. + */ + private String recordSeparator; + + /* + * The string used as an escape character. + */ + private String escapeChar; + + /* + * Represents whether the data has headers. + */ + private Boolean headersPresent; + + /** + * Creates an instance of DelimitedTextConfiguration class. + */ + public DelimitedTextConfiguration() { + } + + /** + * Get the columnSeparator property: The string used to separate columns. + * + * @return the columnSeparator value. + */ + public String getColumnSeparator() { + return this.columnSeparator; + } + + /** + * Set the columnSeparator property: The string used to separate columns. + * + * @param columnSeparator the columnSeparator value to set. + * @return the DelimitedTextConfiguration object itself. + */ + public DelimitedTextConfiguration setColumnSeparator(String columnSeparator) { + this.columnSeparator = columnSeparator; + return this; + } + + /** + * Get the fieldQuote property: The string used to quote a specific field. + * + * @return the fieldQuote value. + */ + public String getFieldQuote() { + return this.fieldQuote; + } + + /** + * Set the fieldQuote property: The string used to quote a specific field. + * + * @param fieldQuote the fieldQuote value to set. + * @return the DelimitedTextConfiguration object itself. + */ + public DelimitedTextConfiguration setFieldQuote(String fieldQuote) { + this.fieldQuote = fieldQuote; + return this; + } + + /** + * Get the recordSeparator property: The string used to separate records. + * + * @return the recordSeparator value. + */ + public String getRecordSeparator() { + return this.recordSeparator; + } + + /** + * Set the recordSeparator property: The string used to separate records. + * + * @param recordSeparator the recordSeparator value to set. + * @return the DelimitedTextConfiguration object itself. + */ + public DelimitedTextConfiguration setRecordSeparator(String recordSeparator) { + this.recordSeparator = recordSeparator; + return this; + } + + /** + * Get the escapeChar property: The string used as an escape character. + * + * @return the escapeChar value. + */ + public String getEscapeChar() { + return this.escapeChar; + } + + /** + * Set the escapeChar property: The string used as an escape character. + * + * @param escapeChar the escapeChar value to set. + * @return the DelimitedTextConfiguration object itself. + */ + public DelimitedTextConfiguration setEscapeChar(String escapeChar) { + this.escapeChar = escapeChar; + return this; + } + + /** + * Get the headersPresent property: Represents whether the data has headers. + * + * @return the headersPresent value. + */ + public Boolean isHeadersPresent() { + return this.headersPresent; + } + + /** + * Set the headersPresent property: Represents whether the data has headers. + * + * @param headersPresent the headersPresent value to set. + * @return the DelimitedTextConfiguration object itself. + */ + public DelimitedTextConfiguration setHeadersPresent(Boolean headersPresent) { + this.headersPresent = headersPresent; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName + = rootElementName == null || rootElementName.isEmpty() ? "DelimitedTextConfiguration" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("ColumnSeparator", this.columnSeparator); + xmlWriter.writeStringElement("FieldQuote", this.fieldQuote); + xmlWriter.writeStringElement("RecordSeparator", this.recordSeparator); + xmlWriter.writeStringElement("EscapeChar", this.escapeChar); + xmlWriter.writeBooleanElement("HasHeaders", this.headersPresent); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of DelimitedTextConfiguration from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of DelimitedTextConfiguration if the XmlReader was pointing to an instance of it, or null if + * it was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the DelimitedTextConfiguration. + */ + public static DelimitedTextConfiguration fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of DelimitedTextConfiguration from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of DelimitedTextConfiguration if the XmlReader was pointing to an instance of it, or null if + * it was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the DelimitedTextConfiguration. + */ + public static DelimitedTextConfiguration fromXml(XmlReader xmlReader, String rootElementName) + throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "DelimitedTextConfiguration" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + DelimitedTextConfiguration deserializedDelimitedTextConfiguration = new DelimitedTextConfiguration(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("ColumnSeparator".equals(elementName.getLocalPart())) { + deserializedDelimitedTextConfiguration.columnSeparator = reader.getStringElement(); + } else if ("FieldQuote".equals(elementName.getLocalPart())) { + deserializedDelimitedTextConfiguration.fieldQuote = reader.getStringElement(); + } else if ("RecordSeparator".equals(elementName.getLocalPart())) { + deserializedDelimitedTextConfiguration.recordSeparator = reader.getStringElement(); + } else if ("EscapeChar".equals(elementName.getLocalPart())) { + deserializedDelimitedTextConfiguration.escapeChar = reader.getStringElement(); + } else if ("HasHeaders".equals(elementName.getLocalPart())) { + deserializedDelimitedTextConfiguration.headersPresent + = reader.getNullableElement(Boolean::parseBoolean); + } else { + reader.skipElement(); + } + } + + return deserializedDelimitedTextConfiguration; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/EncryptionAlgorithmType.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/EncryptionAlgorithmType.java new file mode 100644 index 000000000000..37422368f6c7 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/EncryptionAlgorithmType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +/** + * Defines values for EncryptionAlgorithmType. + */ +public enum EncryptionAlgorithmType { + /** + * Enum value AES256. + */ + AES256("AES256"); + + /** + * The actual serialized value for a EncryptionAlgorithmType instance. + */ + private final String value; + + EncryptionAlgorithmType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a EncryptionAlgorithmType instance. + * + * @param value the serialized value to parse. + * @return the parsed EncryptionAlgorithmType object, or null if unable to parse. + */ + public static EncryptionAlgorithmType fromString(String value) { + if (value == null) { + return null; + } + EncryptionAlgorithmType[] items = EncryptionAlgorithmType.values(); + for (EncryptionAlgorithmType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/EncryptionScope.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/EncryptionScope.java new file mode 100644 index 000000000000..310af8b6a119 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/EncryptionScope.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; + +/** + * Parameter group. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class EncryptionScope { + /* + * Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data + * provided in the request. If not specified, encryption is performed with the default account encryption scope. For + * more information, see Encryption at Rest for Azure Storage Services. + */ + private String encryptionScope; + + /** + * Creates an instance of EncryptionScope class. + */ + public EncryptionScope() { + } + + /** + * Get the encryptionScope property: Optional. Version 2019-07-07 and later. Specifies the name of the encryption + * scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the + * default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services. + * + * @return the encryptionScope value. + */ + public String getEncryptionScope() { + return this.encryptionScope; + } + + /** + * Set the encryptionScope property: Optional. Version 2019-07-07 and later. Specifies the name of the encryption + * scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the + * default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services. + * + * @param encryptionScope the encryptionScope value to set. + * @return the EncryptionScope object itself. + */ + public EncryptionScope setEncryptionScope(String encryptionScope) { + this.encryptionScope = encryptionScope; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/FilterBlobItem.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/FilterBlobItem.java new file mode 100644 index 000000000000..b279ad4682c8 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/FilterBlobItem.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * Blob info from a Filter Blobs API call. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class FilterBlobItem implements XmlSerializable { + /* + * The Name property. + */ + private String name; + + /* + * The ContainerName property. + */ + private String containerName; + + /* + * Blob tags + */ + private BlobTags tags; + + /* + * The VersionId property. + */ + private String versionId; + + /* + * The IsCurrentVersion property. + */ + private Boolean isCurrentVersion; + + /** + * Creates an instance of FilterBlobItem class. + */ + public FilterBlobItem() { + } + + /** + * Get the name property: The Name property. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * Set the name property: The Name property. + * + * @param name the name value to set. + * @return the FilterBlobItem object itself. + */ + public FilterBlobItem setName(String name) { + this.name = name; + return this; + } + + /** + * Get the containerName property: The ContainerName property. + * + * @return the containerName value. + */ + public String getContainerName() { + return this.containerName; + } + + /** + * Set the containerName property: The ContainerName property. + * + * @param containerName the containerName value to set. + * @return the FilterBlobItem object itself. + */ + public FilterBlobItem setContainerName(String containerName) { + this.containerName = containerName; + return this; + } + + /** + * Get the tags property: Blob tags. + * + * @return the tags value. + */ + public BlobTags getTags() { + return this.tags; + } + + /** + * Set the tags property: Blob tags. + * + * @param tags the tags value to set. + * @return the FilterBlobItem object itself. + */ + public FilterBlobItem setTags(BlobTags tags) { + this.tags = tags; + return this; + } + + /** + * Get the versionId property: The VersionId property. + * + * @return the versionId value. + */ + public String getVersionId() { + return this.versionId; + } + + /** + * Set the versionId property: The VersionId property. + * + * @param versionId the versionId value to set. + * @return the FilterBlobItem object itself. + */ + public FilterBlobItem setVersionId(String versionId) { + this.versionId = versionId; + return this; + } + + /** + * Get the isCurrentVersion property: The IsCurrentVersion property. + * + * @return the isCurrentVersion value. + */ + public Boolean isCurrentVersion() { + return this.isCurrentVersion; + } + + /** + * Set the isCurrentVersion property: The IsCurrentVersion property. + * + * @param isCurrentVersion the isCurrentVersion value to set. + * @return the FilterBlobItem object itself. + */ + public FilterBlobItem setIsCurrentVersion(Boolean isCurrentVersion) { + this.isCurrentVersion = isCurrentVersion; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "Blob" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("Name", this.name); + xmlWriter.writeStringElement("ContainerName", this.containerName); + xmlWriter.writeXml(this.tags, "Tags"); + xmlWriter.writeStringElement("VersionId", this.versionId); + xmlWriter.writeBooleanElement("IsCurrentVersion", this.isCurrentVersion); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of FilterBlobItem from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of FilterBlobItem if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the FilterBlobItem. + */ + public static FilterBlobItem fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of FilterBlobItem from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of FilterBlobItem if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the FilterBlobItem. + */ + public static FilterBlobItem fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "Blob" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + FilterBlobItem deserializedFilterBlobItem = new FilterBlobItem(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Name".equals(elementName.getLocalPart())) { + deserializedFilterBlobItem.name = reader.getStringElement(); + } else if ("ContainerName".equals(elementName.getLocalPart())) { + deserializedFilterBlobItem.containerName = reader.getStringElement(); + } else if ("Tags".equals(elementName.getLocalPart())) { + deserializedFilterBlobItem.tags = BlobTags.fromXml(reader, "Tags"); + } else if ("VersionId".equals(elementName.getLocalPart())) { + deserializedFilterBlobItem.versionId = reader.getStringElement(); + } else if ("IsCurrentVersion".equals(elementName.getLocalPart())) { + deserializedFilterBlobItem.isCurrentVersion = reader.getNullableElement(Boolean::parseBoolean); + } else { + reader.skipElement(); + } + } + + return deserializedFilterBlobItem; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/FilterBlobSegment.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/FilterBlobSegment.java new file mode 100644 index 000000000000..8f071cb3eb0c --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/FilterBlobSegment.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import java.util.ArrayList; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * The result of a Filter Blobs API call. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class FilterBlobSegment implements XmlSerializable { + /* + * The ServiceEndpoint property. + */ + private String serviceEndpoint; + + /* + * The Where property. + */ + private String where; + + /* + * The Blobs property. + */ + private List blobs; + + /* + * The NextMarker property. + */ + private String nextMarker; + + /** + * Creates an instance of FilterBlobSegment class. + */ + public FilterBlobSegment() { + } + + /** + * Get the serviceEndpoint property: The ServiceEndpoint property. + * + * @return the serviceEndpoint value. + */ + public String getServiceEndpoint() { + return this.serviceEndpoint; + } + + /** + * Set the serviceEndpoint property: The ServiceEndpoint property. + * + * @param serviceEndpoint the serviceEndpoint value to set. + * @return the FilterBlobSegment object itself. + */ + public FilterBlobSegment setServiceEndpoint(String serviceEndpoint) { + this.serviceEndpoint = serviceEndpoint; + return this; + } + + /** + * Get the where property: The Where property. + * + * @return the where value. + */ + public String getWhere() { + return this.where; + } + + /** + * Set the where property: The Where property. + * + * @param where the where value to set. + * @return the FilterBlobSegment object itself. + */ + public FilterBlobSegment setWhere(String where) { + this.where = where; + return this; + } + + /** + * Get the blobs property: The Blobs property. + * + * @return the blobs value. + */ + public List getBlobs() { + if (this.blobs == null) { + this.blobs = new ArrayList<>(); + } + return this.blobs; + } + + /** + * Set the blobs property: The Blobs property. + * + * @param blobs the blobs value to set. + * @return the FilterBlobSegment object itself. + */ + public FilterBlobSegment setBlobs(List blobs) { + this.blobs = blobs; + return this; + } + + /** + * Get the nextMarker property: The NextMarker property. + * + * @return the nextMarker value. + */ + public String getNextMarker() { + return this.nextMarker; + } + + /** + * Set the nextMarker property: The NextMarker property. + * + * @param nextMarker the nextMarker value to set. + * @return the FilterBlobSegment object itself. + */ + public FilterBlobSegment setNextMarker(String nextMarker) { + this.nextMarker = nextMarker; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "EnumerationResults" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringAttribute("ServiceEndpoint", this.serviceEndpoint); + xmlWriter.writeStringElement("Where", this.where); + if (this.blobs != null) { + xmlWriter.writeStartElement("Blobs"); + for (FilterBlobItem element : this.blobs) { + xmlWriter.writeXml(element, "Blob"); + } + xmlWriter.writeEndElement(); + } + xmlWriter.writeStringElement("NextMarker", this.nextMarker); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of FilterBlobSegment from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of FilterBlobSegment if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the FilterBlobSegment. + */ + public static FilterBlobSegment fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of FilterBlobSegment from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of FilterBlobSegment if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the FilterBlobSegment. + */ + public static FilterBlobSegment fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "EnumerationResults" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + FilterBlobSegment deserializedFilterBlobSegment = new FilterBlobSegment(); + deserializedFilterBlobSegment.serviceEndpoint = reader.getStringAttribute(null, "ServiceEndpoint"); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Where".equals(elementName.getLocalPart())) { + deserializedFilterBlobSegment.where = reader.getStringElement(); + } else if ("Blobs".equals(elementName.getLocalPart())) { + while (reader.nextElement() != XmlToken.END_ELEMENT) { + elementName = reader.getElementName(); + if ("Blob".equals(elementName.getLocalPart())) { + if (deserializedFilterBlobSegment.blobs == null) { + deserializedFilterBlobSegment.blobs = new ArrayList<>(); + } + deserializedFilterBlobSegment.blobs.add(FilterBlobItem.fromXml(reader, "Blob")); + } else { + reader.skipElement(); + } + } + } else if ("NextMarker".equals(elementName.getLocalPart())) { + deserializedFilterBlobSegment.nextMarker = reader.getStringElement(); + } else { + reader.skipElement(); + } + } + + return deserializedFilterBlobSegment; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/FilterBlobsIncludeItem.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/FilterBlobsIncludeItem.java new file mode 100644 index 000000000000..cc7893e5b3d5 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/FilterBlobsIncludeItem.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +/** + * Defines values for FilterBlobsIncludeItem. + */ +public enum FilterBlobsIncludeItem { + /** + * Enum value none. + */ + NONE("none"), + + /** + * Enum value versions. + */ + VERSIONS("versions"); + + /** + * The actual serialized value for a FilterBlobsIncludeItem instance. + */ + private final String value; + + FilterBlobsIncludeItem(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a FilterBlobsIncludeItem instance. + * + * @param value the serialized value to parse. + * @return the parsed FilterBlobsIncludeItem object, or null if unable to parse. + */ + public static FilterBlobsIncludeItem fromString(String value) { + if (value == null) { + return null; + } + FilterBlobsIncludeItem[] items = FilterBlobsIncludeItem.values(); + for (FilterBlobsIncludeItem item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/GeoReplication.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/GeoReplication.java new file mode 100644 index 000000000000..41a36bb6f4d0 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/GeoReplication.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Objects; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * Geo-Replication information for the Secondary Storage Service. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class GeoReplication implements XmlSerializable { + /* + * The status of the secondary location + */ + private GeoReplicationStatus status; + + /* + * A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for + * read operations at the secondary. Primary writes after this point in time may or may not be available for reads. + */ + private DateTimeRfc1123 lastSyncTime; + + /** + * Creates an instance of GeoReplication class. + */ + public GeoReplication() { + } + + /** + * Get the status property: The status of the secondary location. + * + * @return the status value. + */ + public GeoReplicationStatus getStatus() { + return this.status; + } + + /** + * Set the status property: The status of the secondary location. + * + * @param status the status value to set. + * @return the GeoReplication object itself. + */ + public GeoReplication setStatus(GeoReplicationStatus status) { + this.status = status; + return this; + } + + /** + * Get the lastSyncTime property: A GMT date/time value, to the second. All primary writes preceding this value are + * guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or + * may not be available for reads. + * + * @return the lastSyncTime value. + */ + public OffsetDateTime getLastSyncTime() { + if (this.lastSyncTime == null) { + return null; + } + return this.lastSyncTime.getDateTime(); + } + + /** + * Set the lastSyncTime property: A GMT date/time value, to the second. All primary writes preceding this value are + * guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or + * may not be available for reads. + * + * @param lastSyncTime the lastSyncTime value to set. + * @return the GeoReplication object itself. + */ + public GeoReplication setLastSyncTime(OffsetDateTime lastSyncTime) { + if (lastSyncTime == null) { + this.lastSyncTime = null; + } else { + this.lastSyncTime = new DateTimeRfc1123(lastSyncTime); + } + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "GeoReplication" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("Status", this.status == null ? null : this.status.getValue()); + xmlWriter.writeStringElement("LastSyncTime", Objects.toString(this.lastSyncTime, null)); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of GeoReplication from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of GeoReplication if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the GeoReplication. + */ + public static GeoReplication fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of GeoReplication from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of GeoReplication if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the GeoReplication. + */ + public static GeoReplication fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "GeoReplication" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + GeoReplication deserializedGeoReplication = new GeoReplication(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Status".equals(elementName.getLocalPart())) { + deserializedGeoReplication.status = GeoReplicationStatus.fromValue(reader.getStringElement()); + } else if ("LastSyncTime".equals(elementName.getLocalPart())) { + deserializedGeoReplication.lastSyncTime = reader.getNullableElement(DateTimeRfc1123::new); + } else { + reader.skipElement(); + } + } + + return deserializedGeoReplication; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/GeoReplicationStatus.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/GeoReplicationStatus.java new file mode 100644 index 000000000000..9a44dd4d868d --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/GeoReplicationStatus.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.v2.storage.blob.models; + +import io.clientcore.core.utils.ExpandableEnum; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +/** + * The status of the secondary location. + */ +public final class GeoReplicationStatus implements ExpandableEnum { + private static final Map VALUES = new ConcurrentHashMap<>(); + + private static final Function NEW_INSTANCE = GeoReplicationStatus::new; + + /** + * Static value live for GeoReplicationStatus. + */ + public static final GeoReplicationStatus LIVE = fromValue("live"); + + /** + * Static value bootstrap for GeoReplicationStatus. + */ + public static final GeoReplicationStatus BOOTSTRAP = fromValue("bootstrap"); + + /** + * Static value unavailable for GeoReplicationStatus. + */ + public static final GeoReplicationStatus UNAVAILABLE = fromValue("unavailable"); + + private final String value; + + private GeoReplicationStatus(String value) { + this.value = value; + } + + /** + * Creates or finds a GeoReplicationStatus. + * + * @param value a value to look for. + * @return the corresponding GeoReplicationStatus. + * @throws IllegalArgumentException if value is null. + */ + public static GeoReplicationStatus fromValue(String value) { + if (value == null) { + throw new IllegalArgumentException("'value' cannot be null."); + } + return VALUES.computeIfAbsent(value, NEW_INSTANCE); + } + + /** + * Gets known GeoReplicationStatus values. + * + * @return Known GeoReplicationStatus values. + */ + public static Collection values() { + return new ArrayList<>(VALUES.values()); + } + + /** + * Gets the value of the GeoReplicationStatus instance. + * + * @return the value of the GeoReplicationStatus instance. + */ + @Override + public String getValue() { + return this.value; + } + + @Override + public String toString() { + return Objects.toString(this.value); + } + + @Override + public boolean equals(Object obj) { + return this == obj; + } + + @Override + public int hashCode() { + return Objects.hashCode(this.value); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/JsonTextConfiguration.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/JsonTextConfiguration.java new file mode 100644 index 000000000000..6c398447e004 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/JsonTextConfiguration.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * json text configuration. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class JsonTextConfiguration implements XmlSerializable { + /* + * The string used to separate records. + */ + private String recordSeparator; + + /** + * Creates an instance of JsonTextConfiguration class. + */ + public JsonTextConfiguration() { + } + + /** + * Get the recordSeparator property: The string used to separate records. + * + * @return the recordSeparator value. + */ + public String getRecordSeparator() { + return this.recordSeparator; + } + + /** + * Set the recordSeparator property: The string used to separate records. + * + * @param recordSeparator the recordSeparator value to set. + * @return the JsonTextConfiguration object itself. + */ + public JsonTextConfiguration setRecordSeparator(String recordSeparator) { + this.recordSeparator = recordSeparator; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName + = rootElementName == null || rootElementName.isEmpty() ? "JsonTextConfiguration" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("RecordSeparator", this.recordSeparator); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of JsonTextConfiguration from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of JsonTextConfiguration if the XmlReader was pointing to an instance of it, or null if it + * was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the JsonTextConfiguration. + */ + public static JsonTextConfiguration fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of JsonTextConfiguration from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of JsonTextConfiguration if the XmlReader was pointing to an instance of it, or null if it + * was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the JsonTextConfiguration. + */ + public static JsonTextConfiguration fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "JsonTextConfiguration" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + JsonTextConfiguration deserializedJsonTextConfiguration = new JsonTextConfiguration(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("RecordSeparator".equals(elementName.getLocalPart())) { + deserializedJsonTextConfiguration.recordSeparator = reader.getStringElement(); + } else { + reader.skipElement(); + } + } + + return deserializedJsonTextConfiguration; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/KeyInfo.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/KeyInfo.java new file mode 100644 index 000000000000..5b566dbbea37 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/KeyInfo.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * Key information. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class KeyInfo implements XmlSerializable { + /* + * The date-time the key is active in ISO 8601 UTC time + */ + private String start; + + /* + * The date-time the key expires in ISO 8601 UTC time + */ + private String expiry; + + /** + * Creates an instance of KeyInfo class. + */ + public KeyInfo() { + } + + /** + * Get the start property: The date-time the key is active in ISO 8601 UTC time. + * + * @return the start value. + */ + public String getStart() { + return this.start; + } + + /** + * Set the start property: The date-time the key is active in ISO 8601 UTC time. + * + * @param start the start value to set. + * @return the KeyInfo object itself. + */ + public KeyInfo setStart(String start) { + this.start = start; + return this; + } + + /** + * Get the expiry property: The date-time the key expires in ISO 8601 UTC time. + * + * @return the expiry value. + */ + public String getExpiry() { + return this.expiry; + } + + /** + * Set the expiry property: The date-time the key expires in ISO 8601 UTC time. + * + * @param expiry the expiry value to set. + * @return the KeyInfo object itself. + */ + public KeyInfo setExpiry(String expiry) { + this.expiry = expiry; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "KeyInfo" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("Start", this.start); + xmlWriter.writeStringElement("Expiry", this.expiry); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of KeyInfo from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of KeyInfo if the XmlReader was pointing to an instance of it, or null if it was pointing to + * XML null. + * @throws XMLStreamException If an error occurs while reading the KeyInfo. + */ + public static KeyInfo fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of KeyInfo from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of KeyInfo if the XmlReader was pointing to an instance of it, or null if it was pointing to + * XML null. + * @throws XMLStreamException If an error occurs while reading the KeyInfo. + */ + public static KeyInfo fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "KeyInfo" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + KeyInfo deserializedKeyInfo = new KeyInfo(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Start".equals(elementName.getLocalPart())) { + deserializedKeyInfo.start = reader.getStringElement(); + } else if ("Expiry".equals(elementName.getLocalPart())) { + deserializedKeyInfo.expiry = reader.getStringElement(); + } else { + reader.skipElement(); + } + } + + return deserializedKeyInfo; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/LeaseDurationType.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/LeaseDurationType.java new file mode 100644 index 000000000000..f9a44fa7828c --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/LeaseDurationType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +/** + * Defines values for LeaseDurationType. + */ +public enum LeaseDurationType { + /** + * Enum value infinite. + */ + INFINITE("infinite"), + + /** + * Enum value fixed. + */ + FIXED("fixed"); + + /** + * The actual serialized value for a LeaseDurationType instance. + */ + private final String value; + + LeaseDurationType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a LeaseDurationType instance. + * + * @param value the serialized value to parse. + * @return the parsed LeaseDurationType object, or null if unable to parse. + */ + public static LeaseDurationType fromString(String value) { + if (value == null) { + return null; + } + LeaseDurationType[] items = LeaseDurationType.values(); + for (LeaseDurationType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/LeaseStateType.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/LeaseStateType.java new file mode 100644 index 000000000000..3b06b1616a68 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/LeaseStateType.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.v2.storage.blob.models; + +/** + * Defines values for LeaseStateType. + */ +public enum LeaseStateType { + /** + * Enum value available. + */ + AVAILABLE("available"), + + /** + * Enum value leased. + */ + LEASED("leased"), + + /** + * Enum value expired. + */ + EXPIRED("expired"), + + /** + * Enum value breaking. + */ + BREAKING("breaking"), + + /** + * Enum value broken. + */ + BROKEN("broken"); + + /** + * The actual serialized value for a LeaseStateType instance. + */ + private final String value; + + LeaseStateType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a LeaseStateType instance. + * + * @param value the serialized value to parse. + * @return the parsed LeaseStateType object, or null if unable to parse. + */ + public static LeaseStateType fromString(String value) { + if (value == null) { + return null; + } + LeaseStateType[] items = LeaseStateType.values(); + for (LeaseStateType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/LeaseStatusType.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/LeaseStatusType.java new file mode 100644 index 000000000000..ad6684aa8577 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/LeaseStatusType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +/** + * Defines values for LeaseStatusType. + */ +public enum LeaseStatusType { + /** + * Enum value locked. + */ + LOCKED("locked"), + + /** + * Enum value unlocked. + */ + UNLOCKED("unlocked"); + + /** + * The actual serialized value for a LeaseStatusType instance. + */ + private final String value; + + LeaseStatusType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a LeaseStatusType instance. + * + * @param value the serialized value to parse. + * @return the parsed LeaseStatusType object, or null if unable to parse. + */ + public static LeaseStatusType fromString(String value) { + if (value == null) { + return null; + } + LeaseStatusType[] items = LeaseStatusType.values(); + for (LeaseStatusType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ListBlobContainersIncludeType.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ListBlobContainersIncludeType.java new file mode 100644 index 000000000000..ae759587d38b --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ListBlobContainersIncludeType.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +/** + * Defines values for ListBlobContainersIncludeType. + */ +public enum ListBlobContainersIncludeType { + /** + * Enum value metadata. + */ + METADATA("metadata"), + + /** + * Enum value deleted. + */ + DELETED("deleted"), + + /** + * Enum value system. + */ + SYSTEM("system"); + + /** + * The actual serialized value for a ListBlobContainersIncludeType instance. + */ + private final String value; + + ListBlobContainersIncludeType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ListBlobContainersIncludeType instance. + * + * @param value the serialized value to parse. + * @return the parsed ListBlobContainersIncludeType object, or null if unable to parse. + */ + public static ListBlobContainersIncludeType fromString(String value) { + if (value == null) { + return null; + } + ListBlobContainersIncludeType[] items = ListBlobContainersIncludeType.values(); + for (ListBlobContainersIncludeType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ListBlobsFlatSegmentResponse.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ListBlobsFlatSegmentResponse.java new file mode 100644 index 000000000000..a78e88bf743b --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ListBlobsFlatSegmentResponse.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * An enumeration of blobs. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ListBlobsFlatSegmentResponse implements XmlSerializable { + /* + * The ServiceEndpoint property. + */ + private String serviceEndpoint; + + /* + * The ContainerName property. + */ + private String containerName; + + /* + * The Prefix property. + */ + private String prefix; + + /* + * The Marker property. + */ + private String marker; + + /* + * The MaxResults property. + */ + private int maxResults; + + /* + * The Segment property. + */ + private BlobFlatListSegment segment; + + /* + * The NextMarker property. + */ + private String nextMarker; + + /** + * Creates an instance of ListBlobsFlatSegmentResponse class. + */ + public ListBlobsFlatSegmentResponse() { + } + + /** + * Get the serviceEndpoint property: The ServiceEndpoint property. + * + * @return the serviceEndpoint value. + */ + public String getServiceEndpoint() { + return this.serviceEndpoint; + } + + /** + * Set the serviceEndpoint property: The ServiceEndpoint property. + * + * @param serviceEndpoint the serviceEndpoint value to set. + * @return the ListBlobsFlatSegmentResponse object itself. + */ + public ListBlobsFlatSegmentResponse setServiceEndpoint(String serviceEndpoint) { + this.serviceEndpoint = serviceEndpoint; + return this; + } + + /** + * Get the containerName property: The ContainerName property. + * + * @return the containerName value. + */ + public String getContainerName() { + return this.containerName; + } + + /** + * Set the containerName property: The ContainerName property. + * + * @param containerName the containerName value to set. + * @return the ListBlobsFlatSegmentResponse object itself. + */ + public ListBlobsFlatSegmentResponse setContainerName(String containerName) { + this.containerName = containerName; + return this; + } + + /** + * Get the prefix property: The Prefix property. + * + * @return the prefix value. + */ + public String getPrefix() { + return this.prefix; + } + + /** + * Set the prefix property: The Prefix property. + * + * @param prefix the prefix value to set. + * @return the ListBlobsFlatSegmentResponse object itself. + */ + public ListBlobsFlatSegmentResponse setPrefix(String prefix) { + this.prefix = prefix; + return this; + } + + /** + * Get the marker property: The Marker property. + * + * @return the marker value. + */ + public String getMarker() { + return this.marker; + } + + /** + * Set the marker property: The Marker property. + * + * @param marker the marker value to set. + * @return the ListBlobsFlatSegmentResponse object itself. + */ + public ListBlobsFlatSegmentResponse setMarker(String marker) { + this.marker = marker; + return this; + } + + /** + * Get the maxResults property: The MaxResults property. + * + * @return the maxResults value. + */ + public int getMaxResults() { + return this.maxResults; + } + + /** + * Set the maxResults property: The MaxResults property. + * + * @param maxResults the maxResults value to set. + * @return the ListBlobsFlatSegmentResponse object itself. + */ + public ListBlobsFlatSegmentResponse setMaxResults(int maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the segment property: The Segment property. + * + * @return the segment value. + */ + public BlobFlatListSegment getSegment() { + return this.segment; + } + + /** + * Set the segment property: The Segment property. + * + * @param segment the segment value to set. + * @return the ListBlobsFlatSegmentResponse object itself. + */ + public ListBlobsFlatSegmentResponse setSegment(BlobFlatListSegment segment) { + this.segment = segment; + return this; + } + + /** + * Get the nextMarker property: The NextMarker property. + * + * @return the nextMarker value. + */ + public String getNextMarker() { + return this.nextMarker; + } + + /** + * Set the nextMarker property: The NextMarker property. + * + * @param nextMarker the nextMarker value to set. + * @return the ListBlobsFlatSegmentResponse object itself. + */ + public ListBlobsFlatSegmentResponse setNextMarker(String nextMarker) { + this.nextMarker = nextMarker; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "EnumerationResults" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringAttribute("ServiceEndpoint", this.serviceEndpoint); + xmlWriter.writeStringAttribute("ContainerName", this.containerName); + xmlWriter.writeStringElement("Prefix", this.prefix); + xmlWriter.writeStringElement("Marker", this.marker); + xmlWriter.writeIntElement("MaxResults", this.maxResults); + xmlWriter.writeXml(this.segment, "Blobs"); + xmlWriter.writeStringElement("NextMarker", this.nextMarker); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of ListBlobsFlatSegmentResponse from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of ListBlobsFlatSegmentResponse if the XmlReader was pointing to an instance of it, or null + * if it was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the ListBlobsFlatSegmentResponse. + */ + public static ListBlobsFlatSegmentResponse fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of ListBlobsFlatSegmentResponse from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of ListBlobsFlatSegmentResponse if the XmlReader was pointing to an instance of it, or null + * if it was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the ListBlobsFlatSegmentResponse. + */ + public static ListBlobsFlatSegmentResponse fromXml(XmlReader xmlReader, String rootElementName) + throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "EnumerationResults" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + ListBlobsFlatSegmentResponse deserializedListBlobsFlatSegmentResponse = new ListBlobsFlatSegmentResponse(); + deserializedListBlobsFlatSegmentResponse.serviceEndpoint + = reader.getStringAttribute(null, "ServiceEndpoint"); + deserializedListBlobsFlatSegmentResponse.containerName = reader.getStringAttribute(null, "ContainerName"); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Prefix".equals(elementName.getLocalPart())) { + deserializedListBlobsFlatSegmentResponse.prefix = reader.getStringElement(); + } else if ("Marker".equals(elementName.getLocalPart())) { + deserializedListBlobsFlatSegmentResponse.marker = reader.getStringElement(); + } else if ("MaxResults".equals(elementName.getLocalPart())) { + deserializedListBlobsFlatSegmentResponse.maxResults = reader.getIntElement(); + } else if ("Blobs".equals(elementName.getLocalPart())) { + deserializedListBlobsFlatSegmentResponse.segment = BlobFlatListSegment.fromXml(reader, "Blobs"); + } else if ("NextMarker".equals(elementName.getLocalPart())) { + deserializedListBlobsFlatSegmentResponse.nextMarker = reader.getStringElement(); + } else { + reader.skipElement(); + } + } + + return deserializedListBlobsFlatSegmentResponse; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ListBlobsHierarchySegmentResponse.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ListBlobsHierarchySegmentResponse.java new file mode 100644 index 000000000000..60b541d95a6f --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ListBlobsHierarchySegmentResponse.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * An enumeration of blobs. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ListBlobsHierarchySegmentResponse implements XmlSerializable { + /* + * The ServiceEndpoint property. + */ + private String serviceEndpoint; + + /* + * The ContainerName property. + */ + private String containerName; + + /* + * The Prefix property. + */ + private String prefix; + + /* + * The Marker property. + */ + private String marker; + + /* + * The MaxResults property. + */ + private int maxResults; + + /* + * The Delimiter property. + */ + private String delimiter; + + /* + * The Segment property. + */ + private BlobHierarchyListSegment segment; + + /* + * The NextMarker property. + */ + private String nextMarker; + + /** + * Creates an instance of ListBlobsHierarchySegmentResponse class. + */ + public ListBlobsHierarchySegmentResponse() { + } + + /** + * Get the serviceEndpoint property: The ServiceEndpoint property. + * + * @return the serviceEndpoint value. + */ + public String getServiceEndpoint() { + return this.serviceEndpoint; + } + + /** + * Set the serviceEndpoint property: The ServiceEndpoint property. + * + * @param serviceEndpoint the serviceEndpoint value to set. + * @return the ListBlobsHierarchySegmentResponse object itself. + */ + public ListBlobsHierarchySegmentResponse setServiceEndpoint(String serviceEndpoint) { + this.serviceEndpoint = serviceEndpoint; + return this; + } + + /** + * Get the containerName property: The ContainerName property. + * + * @return the containerName value. + */ + public String getContainerName() { + return this.containerName; + } + + /** + * Set the containerName property: The ContainerName property. + * + * @param containerName the containerName value to set. + * @return the ListBlobsHierarchySegmentResponse object itself. + */ + public ListBlobsHierarchySegmentResponse setContainerName(String containerName) { + this.containerName = containerName; + return this; + } + + /** + * Get the prefix property: The Prefix property. + * + * @return the prefix value. + */ + public String getPrefix() { + return this.prefix; + } + + /** + * Set the prefix property: The Prefix property. + * + * @param prefix the prefix value to set. + * @return the ListBlobsHierarchySegmentResponse object itself. + */ + public ListBlobsHierarchySegmentResponse setPrefix(String prefix) { + this.prefix = prefix; + return this; + } + + /** + * Get the marker property: The Marker property. + * + * @return the marker value. + */ + public String getMarker() { + return this.marker; + } + + /** + * Set the marker property: The Marker property. + * + * @param marker the marker value to set. + * @return the ListBlobsHierarchySegmentResponse object itself. + */ + public ListBlobsHierarchySegmentResponse setMarker(String marker) { + this.marker = marker; + return this; + } + + /** + * Get the maxResults property: The MaxResults property. + * + * @return the maxResults value. + */ + public int getMaxResults() { + return this.maxResults; + } + + /** + * Set the maxResults property: The MaxResults property. + * + * @param maxResults the maxResults value to set. + * @return the ListBlobsHierarchySegmentResponse object itself. + */ + public ListBlobsHierarchySegmentResponse setMaxResults(int maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the delimiter property: The Delimiter property. + * + * @return the delimiter value. + */ + public String getDelimiter() { + return this.delimiter; + } + + /** + * Set the delimiter property: The Delimiter property. + * + * @param delimiter the delimiter value to set. + * @return the ListBlobsHierarchySegmentResponse object itself. + */ + public ListBlobsHierarchySegmentResponse setDelimiter(String delimiter) { + this.delimiter = delimiter; + return this; + } + + /** + * Get the segment property: The Segment property. + * + * @return the segment value. + */ + public BlobHierarchyListSegment getSegment() { + return this.segment; + } + + /** + * Set the segment property: The Segment property. + * + * @param segment the segment value to set. + * @return the ListBlobsHierarchySegmentResponse object itself. + */ + public ListBlobsHierarchySegmentResponse setSegment(BlobHierarchyListSegment segment) { + this.segment = segment; + return this; + } + + /** + * Get the nextMarker property: The NextMarker property. + * + * @return the nextMarker value. + */ + public String getNextMarker() { + return this.nextMarker; + } + + /** + * Set the nextMarker property: The NextMarker property. + * + * @param nextMarker the nextMarker value to set. + * @return the ListBlobsHierarchySegmentResponse object itself. + */ + public ListBlobsHierarchySegmentResponse setNextMarker(String nextMarker) { + this.nextMarker = nextMarker; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "EnumerationResults" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringAttribute("ServiceEndpoint", this.serviceEndpoint); + xmlWriter.writeStringAttribute("ContainerName", this.containerName); + xmlWriter.writeStringElement("Prefix", this.prefix); + xmlWriter.writeStringElement("Marker", this.marker); + xmlWriter.writeIntElement("MaxResults", this.maxResults); + xmlWriter.writeStringElement("Delimiter", this.delimiter); + xmlWriter.writeXml(this.segment, "Blobs"); + xmlWriter.writeStringElement("NextMarker", this.nextMarker); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of ListBlobsHierarchySegmentResponse from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of ListBlobsHierarchySegmentResponse if the XmlReader was pointing to an instance of it, or + * null if it was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the ListBlobsHierarchySegmentResponse. + */ + public static ListBlobsHierarchySegmentResponse fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of ListBlobsHierarchySegmentResponse from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of ListBlobsHierarchySegmentResponse if the XmlReader was pointing to an instance of it, or + * null if it was pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the ListBlobsHierarchySegmentResponse. + */ + public static ListBlobsHierarchySegmentResponse fromXml(XmlReader xmlReader, String rootElementName) + throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "EnumerationResults" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + ListBlobsHierarchySegmentResponse deserializedListBlobsHierarchySegmentResponse + = new ListBlobsHierarchySegmentResponse(); + deserializedListBlobsHierarchySegmentResponse.serviceEndpoint + = reader.getStringAttribute(null, "ServiceEndpoint"); + deserializedListBlobsHierarchySegmentResponse.containerName + = reader.getStringAttribute(null, "ContainerName"); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Prefix".equals(elementName.getLocalPart())) { + deserializedListBlobsHierarchySegmentResponse.prefix = reader.getStringElement(); + } else if ("Marker".equals(elementName.getLocalPart())) { + deserializedListBlobsHierarchySegmentResponse.marker = reader.getStringElement(); + } else if ("MaxResults".equals(elementName.getLocalPart())) { + deserializedListBlobsHierarchySegmentResponse.maxResults = reader.getIntElement(); + } else if ("Delimiter".equals(elementName.getLocalPart())) { + deserializedListBlobsHierarchySegmentResponse.delimiter = reader.getStringElement(); + } else if ("Blobs".equals(elementName.getLocalPart())) { + deserializedListBlobsHierarchySegmentResponse.segment + = BlobHierarchyListSegment.fromXml(reader, "Blobs"); + } else if ("NextMarker".equals(elementName.getLocalPart())) { + deserializedListBlobsHierarchySegmentResponse.nextMarker = reader.getStringElement(); + } else { + reader.skipElement(); + } + } + + return deserializedListBlobsHierarchySegmentResponse; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ListBlobsIncludeItem.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ListBlobsIncludeItem.java new file mode 100644 index 000000000000..5fdd8bc94a12 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ListBlobsIncludeItem.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.v2.storage.blob.models; + +/** + * Defines values for ListBlobsIncludeItem. + */ +public enum ListBlobsIncludeItem { + /** + * Enum value copy. + */ + COPY("copy"), + + /** + * Enum value deleted. + */ + DELETED("deleted"), + + /** + * Enum value metadata. + */ + METADATA("metadata"), + + /** + * Enum value snapshots. + */ + SNAPSHOTS("snapshots"), + + /** + * Enum value uncommittedblobs. + */ + UNCOMMITTEDBLOBS("uncommittedblobs"), + + /** + * Enum value versions. + */ + VERSIONS("versions"), + + /** + * Enum value tags. + */ + TAGS("tags"), + + /** + * Enum value immutabilitypolicy. + */ + IMMUTABILITY_POLICY("immutabilitypolicy"), + + /** + * Enum value legalhold. + */ + LEGAL_HOLD("legalhold"), + + /** + * Enum value deletedwithversions. + */ + DELETED_WITH_VERSIONS("deletedwithversions"); + + /** + * The actual serialized value for a ListBlobsIncludeItem instance. + */ + private final String value; + + ListBlobsIncludeItem(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ListBlobsIncludeItem instance. + * + * @param value the serialized value to parse. + * @return the parsed ListBlobsIncludeItem object, or null if unable to parse. + */ + public static ListBlobsIncludeItem fromString(String value) { + if (value == null) { + return null; + } + ListBlobsIncludeItem[] items = ListBlobsIncludeItem.values(); + for (ListBlobsIncludeItem item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsClearPagesHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsClearPagesHeaders.java new file mode 100644 index 000000000000..f25ab6effdeb --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsClearPagesHeaders.java @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Base64; + +/** + * The PageBlobsClearPagesHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class PageBlobsClearPagesHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-content-crc64 property. + */ + private byte[] xMsContentCrc64; + + /* + * The x-ms-blob-sequence-number property. + */ + private Long xMsBlobSequenceNumber; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-encryption-key-sha256 property. + */ + private String xMsEncryptionKeySha256; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-request-server-encrypted property. + */ + private Boolean xMsRequestServerEncrypted; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-MD5 property. + */ + private byte[] contentMD5; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_CONTENT_CRC64 = HttpHeaderName.fromString("x-ms-content-crc64"); + + private static final HttpHeaderName X_MS_BLOB_SEQUENCE_NUMBER + = HttpHeaderName.fromString("x-ms-blob-sequence-number"); + + private static final HttpHeaderName X_MS_ENCRYPTION_KEY_SHA256 + = HttpHeaderName.fromString("x-ms-encryption-key-sha256"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_REQUEST_SERVER_ENCRYPTED + = HttpHeaderName.fromString("x-ms-request-server-encrypted"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of PageBlobsClearPagesHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public PageBlobsClearPagesHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String xMsContentCrc64 = rawHeaders.getValue(X_MS_CONTENT_CRC64); + if (xMsContentCrc64 != null) { + this.xMsContentCrc64 = Base64.getDecoder().decode(xMsContentCrc64); + } + String xMsBlobSequenceNumber = rawHeaders.getValue(X_MS_BLOB_SEQUENCE_NUMBER); + if (xMsBlobSequenceNumber != null) { + this.xMsBlobSequenceNumber = Long.parseLong(xMsBlobSequenceNumber); + } + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsEncryptionKeySha256 = rawHeaders.getValue(X_MS_ENCRYPTION_KEY_SHA256); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + String xMsRequestServerEncrypted = rawHeaders.getValue(X_MS_REQUEST_SERVER_ENCRYPTED); + if (xMsRequestServerEncrypted != null) { + this.xMsRequestServerEncrypted = Boolean.parseBoolean(xMsRequestServerEncrypted); + } + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + String contentMD5 = rawHeaders.getValue(HttpHeaderName.CONTENT_MD5); + if (contentMD5 != null) { + this.contentMD5 = Base64.getDecoder().decode(contentMD5); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the PageBlobsClearPagesHeaders object itself. + */ + public PageBlobsClearPagesHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the PageBlobsClearPagesHeaders object itself. + */ + public PageBlobsClearPagesHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return this.xMsContentCrc64; + } + + /** + * Set the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the PageBlobsClearPagesHeaders object itself. + */ + public PageBlobsClearPagesHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = xMsContentCrc64; + return this; + } + + /** + * Get the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @return the xMsBlobSequenceNumber value. + */ + public Long getXMsBlobSequenceNumber() { + return this.xMsBlobSequenceNumber; + } + + /** + * Set the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @param xMsBlobSequenceNumber the xMsBlobSequenceNumber value to set. + * @return the PageBlobsClearPagesHeaders object itself. + */ + public PageBlobsClearPagesHeaders setXMsBlobSequenceNumber(Long xMsBlobSequenceNumber) { + this.xMsBlobSequenceNumber = xMsBlobSequenceNumber; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the PageBlobsClearPagesHeaders object itself. + */ + public PageBlobsClearPagesHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String getXMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the PageBlobsClearPagesHeaders object itself. + */ + public PageBlobsClearPagesHeaders setXMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the PageBlobsClearPagesHeaders object itself. + */ + public PageBlobsClearPagesHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @return the xMsRequestServerEncrypted value. + */ + public Boolean isXMsRequestServerEncrypted() { + return this.xMsRequestServerEncrypted; + } + + /** + * Set the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @param xMsRequestServerEncrypted the xMsRequestServerEncrypted value to set. + * @return the PageBlobsClearPagesHeaders object itself. + */ + public PageBlobsClearPagesHeaders setXMsRequestServerEncrypted(Boolean xMsRequestServerEncrypted) { + this.xMsRequestServerEncrypted = xMsRequestServerEncrypted; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the PageBlobsClearPagesHeaders object itself. + */ + public PageBlobsClearPagesHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the PageBlobsClearPagesHeaders object itself. + */ + public PageBlobsClearPagesHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentMD5 property: The Content-MD5 property. + * + * @return the contentMD5 value. + */ + public byte[] getContentMD5() { + return this.contentMD5; + } + + /** + * Set the contentMD5 property: The Content-MD5 property. + * + * @param contentMD5 the contentMD5 value to set. + * @return the PageBlobsClearPagesHeaders object itself. + */ + public PageBlobsClearPagesHeaders setContentMD5(byte[] contentMD5) { + this.contentMD5 = contentMD5; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsCopyIncrementalHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsCopyIncrementalHeaders.java new file mode 100644 index 000000000000..b3bfe2d1be85 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsCopyIncrementalHeaders.java @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The PageBlobsCopyIncrementalHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class PageBlobsCopyIncrementalHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-copy-id property. + */ + private String xMsCopyId; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-copy-status property. + */ + private CopyStatusType xMsCopyStatus; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_COPY_ID = HttpHeaderName.fromString("x-ms-copy-id"); + + private static final HttpHeaderName X_MS_COPY_STATUS = HttpHeaderName.fromString("x-ms-copy-status"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of PageBlobsCopyIncrementalHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public PageBlobsCopyIncrementalHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsCopyId = rawHeaders.getValue(X_MS_COPY_ID); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + String xMsCopyStatus = rawHeaders.getValue(X_MS_COPY_STATUS); + if (xMsCopyStatus != null) { + this.xMsCopyStatus = CopyStatusType.fromString(xMsCopyStatus); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the PageBlobsCopyIncrementalHeaders object itself. + */ + public PageBlobsCopyIncrementalHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsCopyId property: The x-ms-copy-id property. + * + * @return the xMsCopyId value. + */ + public String getXMsCopyId() { + return this.xMsCopyId; + } + + /** + * Set the xMsCopyId property: The x-ms-copy-id property. + * + * @param xMsCopyId the xMsCopyId value to set. + * @return the PageBlobsCopyIncrementalHeaders object itself. + */ + public PageBlobsCopyIncrementalHeaders setXMsCopyId(String xMsCopyId) { + this.xMsCopyId = xMsCopyId; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the PageBlobsCopyIncrementalHeaders object itself. + */ + public PageBlobsCopyIncrementalHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the PageBlobsCopyIncrementalHeaders object itself. + */ + public PageBlobsCopyIncrementalHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsCopyStatus property: The x-ms-copy-status property. + * + * @return the xMsCopyStatus value. + */ + public CopyStatusType getXMsCopyStatus() { + return this.xMsCopyStatus; + } + + /** + * Set the xMsCopyStatus property: The x-ms-copy-status property. + * + * @param xMsCopyStatus the xMsCopyStatus value to set. + * @return the PageBlobsCopyIncrementalHeaders object itself. + */ + public PageBlobsCopyIncrementalHeaders setXMsCopyStatus(CopyStatusType xMsCopyStatus) { + this.xMsCopyStatus = xMsCopyStatus; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the PageBlobsCopyIncrementalHeaders object itself. + */ + public PageBlobsCopyIncrementalHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the PageBlobsCopyIncrementalHeaders object itself. + */ + public PageBlobsCopyIncrementalHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the PageBlobsCopyIncrementalHeaders object itself. + */ + public PageBlobsCopyIncrementalHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsCreateHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsCreateHeaders.java new file mode 100644 index 000000000000..6549ad73e03b --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsCreateHeaders.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Base64; + +/** + * The PageBlobsCreateHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class PageBlobsCreateHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-version-id property. + */ + private String xMsVersionId; + + /* + * The x-ms-encryption-key-sha256 property. + */ + private String xMsEncryptionKeySha256; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-request-server-encrypted property. + */ + private Boolean xMsRequestServerEncrypted; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-MD5 property. + */ + private byte[] contentMD5; + + /* + * The x-ms-encryption-scope property. + */ + private String xMsEncryptionScope; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_VERSION_ID = HttpHeaderName.fromString("x-ms-version-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_KEY_SHA256 + = HttpHeaderName.fromString("x-ms-encryption-key-sha256"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_REQUEST_SERVER_ENCRYPTED + = HttpHeaderName.fromString("x-ms-request-server-encrypted"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_SCOPE = HttpHeaderName.fromString("x-ms-encryption-scope"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of PageBlobsCreateHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public PageBlobsCreateHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsVersionId = rawHeaders.getValue(X_MS_VERSION_ID); + this.xMsEncryptionKeySha256 = rawHeaders.getValue(X_MS_ENCRYPTION_KEY_SHA256); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + String xMsRequestServerEncrypted = rawHeaders.getValue(X_MS_REQUEST_SERVER_ENCRYPTED); + if (xMsRequestServerEncrypted != null) { + this.xMsRequestServerEncrypted = Boolean.parseBoolean(xMsRequestServerEncrypted); + } + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + String contentMD5 = rawHeaders.getValue(HttpHeaderName.CONTENT_MD5); + if (contentMD5 != null) { + this.contentMD5 = Base64.getDecoder().decode(contentMD5); + } + this.xMsEncryptionScope = rawHeaders.getValue(X_MS_ENCRYPTION_SCOPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the PageBlobsCreateHeaders object itself. + */ + public PageBlobsCreateHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the PageBlobsCreateHeaders object itself. + */ + public PageBlobsCreateHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the PageBlobsCreateHeaders object itself. + */ + public PageBlobsCreateHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsVersionId property: The x-ms-version-id property. + * + * @return the xMsVersionId value. + */ + public String getXMsVersionId() { + return this.xMsVersionId; + } + + /** + * Set the xMsVersionId property: The x-ms-version-id property. + * + * @param xMsVersionId the xMsVersionId value to set. + * @return the PageBlobsCreateHeaders object itself. + */ + public PageBlobsCreateHeaders setXMsVersionId(String xMsVersionId) { + this.xMsVersionId = xMsVersionId; + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String getXMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the PageBlobsCreateHeaders object itself. + */ + public PageBlobsCreateHeaders setXMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the PageBlobsCreateHeaders object itself. + */ + public PageBlobsCreateHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @return the xMsRequestServerEncrypted value. + */ + public Boolean isXMsRequestServerEncrypted() { + return this.xMsRequestServerEncrypted; + } + + /** + * Set the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @param xMsRequestServerEncrypted the xMsRequestServerEncrypted value to set. + * @return the PageBlobsCreateHeaders object itself. + */ + public PageBlobsCreateHeaders setXMsRequestServerEncrypted(Boolean xMsRequestServerEncrypted) { + this.xMsRequestServerEncrypted = xMsRequestServerEncrypted; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the PageBlobsCreateHeaders object itself. + */ + public PageBlobsCreateHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the PageBlobsCreateHeaders object itself. + */ + public PageBlobsCreateHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentMD5 property: The Content-MD5 property. + * + * @return the contentMD5 value. + */ + public byte[] getContentMD5() { + return this.contentMD5; + } + + /** + * Set the contentMD5 property: The Content-MD5 property. + * + * @param contentMD5 the contentMD5 value to set. + * @return the PageBlobsCreateHeaders object itself. + */ + public PageBlobsCreateHeaders setContentMD5(byte[] contentMD5) { + this.contentMD5 = contentMD5; + return this; + } + + /** + * Get the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @return the xMsEncryptionScope value. + */ + public String getXMsEncryptionScope() { + return this.xMsEncryptionScope; + } + + /** + * Set the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @param xMsEncryptionScope the xMsEncryptionScope value to set. + * @return the PageBlobsCreateHeaders object itself. + */ + public PageBlobsCreateHeaders setXMsEncryptionScope(String xMsEncryptionScope) { + this.xMsEncryptionScope = xMsEncryptionScope; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsGetPageRangesDiffHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsGetPageRangesDiffHeaders.java new file mode 100644 index 000000000000..84daa38499e1 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsGetPageRangesDiffHeaders.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The PageBlobsGetPageRangesDiffHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class PageBlobsGetPageRangesDiffHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-blob-content-length property. + */ + private Long xMsBlobContentLength; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_BLOB_CONTENT_LENGTH + = HttpHeaderName.fromString("x-ms-blob-content-length"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of PageBlobsGetPageRangesDiffHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public PageBlobsGetPageRangesDiffHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + String xMsBlobContentLength = rawHeaders.getValue(X_MS_BLOB_CONTENT_LENGTH); + if (xMsBlobContentLength != null) { + this.xMsBlobContentLength = Long.parseLong(xMsBlobContentLength); + } + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the PageBlobsGetPageRangesDiffHeaders object itself. + */ + public PageBlobsGetPageRangesDiffHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsBlobContentLength property: The x-ms-blob-content-length property. + * + * @return the xMsBlobContentLength value. + */ + public Long getXMsBlobContentLength() { + return this.xMsBlobContentLength; + } + + /** + * Set the xMsBlobContentLength property: The x-ms-blob-content-length property. + * + * @param xMsBlobContentLength the xMsBlobContentLength value to set. + * @return the PageBlobsGetPageRangesDiffHeaders object itself. + */ + public PageBlobsGetPageRangesDiffHeaders setXMsBlobContentLength(Long xMsBlobContentLength) { + this.xMsBlobContentLength = xMsBlobContentLength; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the PageBlobsGetPageRangesDiffHeaders object itself. + */ + public PageBlobsGetPageRangesDiffHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the PageBlobsGetPageRangesDiffHeaders object itself. + */ + public PageBlobsGetPageRangesDiffHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the PageBlobsGetPageRangesDiffHeaders object itself. + */ + public PageBlobsGetPageRangesDiffHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the PageBlobsGetPageRangesDiffHeaders object itself. + */ + public PageBlobsGetPageRangesDiffHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the PageBlobsGetPageRangesDiffHeaders object itself. + */ + public PageBlobsGetPageRangesDiffHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsGetPageRangesHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsGetPageRangesHeaders.java new file mode 100644 index 000000000000..b398b3a9120c --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsGetPageRangesHeaders.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The PageBlobsGetPageRangesHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class PageBlobsGetPageRangesHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-blob-content-length property. + */ + private Long xMsBlobContentLength; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_BLOB_CONTENT_LENGTH + = HttpHeaderName.fromString("x-ms-blob-content-length"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of PageBlobsGetPageRangesHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public PageBlobsGetPageRangesHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + String xMsBlobContentLength = rawHeaders.getValue(X_MS_BLOB_CONTENT_LENGTH); + if (xMsBlobContentLength != null) { + this.xMsBlobContentLength = Long.parseLong(xMsBlobContentLength); + } + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the PageBlobsGetPageRangesHeaders object itself. + */ + public PageBlobsGetPageRangesHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsBlobContentLength property: The x-ms-blob-content-length property. + * + * @return the xMsBlobContentLength value. + */ + public Long getXMsBlobContentLength() { + return this.xMsBlobContentLength; + } + + /** + * Set the xMsBlobContentLength property: The x-ms-blob-content-length property. + * + * @param xMsBlobContentLength the xMsBlobContentLength value to set. + * @return the PageBlobsGetPageRangesHeaders object itself. + */ + public PageBlobsGetPageRangesHeaders setXMsBlobContentLength(Long xMsBlobContentLength) { + this.xMsBlobContentLength = xMsBlobContentLength; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the PageBlobsGetPageRangesHeaders object itself. + */ + public PageBlobsGetPageRangesHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the PageBlobsGetPageRangesHeaders object itself. + */ + public PageBlobsGetPageRangesHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the PageBlobsGetPageRangesHeaders object itself. + */ + public PageBlobsGetPageRangesHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the PageBlobsGetPageRangesHeaders object itself. + */ + public PageBlobsGetPageRangesHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the PageBlobsGetPageRangesHeaders object itself. + */ + public PageBlobsGetPageRangesHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsResizeHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsResizeHeaders.java new file mode 100644 index 000000000000..63304d4af4d5 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsResizeHeaders.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The PageBlobsResizeHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class PageBlobsResizeHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-blob-sequence-number property. + */ + private Long xMsBlobSequenceNumber; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_BLOB_SEQUENCE_NUMBER + = HttpHeaderName.fromString("x-ms-blob-sequence-number"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of PageBlobsResizeHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public PageBlobsResizeHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String xMsBlobSequenceNumber = rawHeaders.getValue(X_MS_BLOB_SEQUENCE_NUMBER); + if (xMsBlobSequenceNumber != null) { + this.xMsBlobSequenceNumber = Long.parseLong(xMsBlobSequenceNumber); + } + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the PageBlobsResizeHeaders object itself. + */ + public PageBlobsResizeHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the PageBlobsResizeHeaders object itself. + */ + public PageBlobsResizeHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @return the xMsBlobSequenceNumber value. + */ + public Long getXMsBlobSequenceNumber() { + return this.xMsBlobSequenceNumber; + } + + /** + * Set the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @param xMsBlobSequenceNumber the xMsBlobSequenceNumber value to set. + * @return the PageBlobsResizeHeaders object itself. + */ + public PageBlobsResizeHeaders setXMsBlobSequenceNumber(Long xMsBlobSequenceNumber) { + this.xMsBlobSequenceNumber = xMsBlobSequenceNumber; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the PageBlobsResizeHeaders object itself. + */ + public PageBlobsResizeHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the PageBlobsResizeHeaders object itself. + */ + public PageBlobsResizeHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the PageBlobsResizeHeaders object itself. + */ + public PageBlobsResizeHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the PageBlobsResizeHeaders object itself. + */ + public PageBlobsResizeHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsUpdateSequenceNumberHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsUpdateSequenceNumberHeaders.java new file mode 100644 index 000000000000..1c1e5c95458d --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsUpdateSequenceNumberHeaders.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The PageBlobsUpdateSequenceNumberHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class PageBlobsUpdateSequenceNumberHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-blob-sequence-number property. + */ + private Long xMsBlobSequenceNumber; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_BLOB_SEQUENCE_NUMBER + = HttpHeaderName.fromString("x-ms-blob-sequence-number"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of PageBlobsUpdateSequenceNumberHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public PageBlobsUpdateSequenceNumberHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String xMsBlobSequenceNumber = rawHeaders.getValue(X_MS_BLOB_SEQUENCE_NUMBER); + if (xMsBlobSequenceNumber != null) { + this.xMsBlobSequenceNumber = Long.parseLong(xMsBlobSequenceNumber); + } + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the PageBlobsUpdateSequenceNumberHeaders object itself. + */ + public PageBlobsUpdateSequenceNumberHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the PageBlobsUpdateSequenceNumberHeaders object itself. + */ + public PageBlobsUpdateSequenceNumberHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @return the xMsBlobSequenceNumber value. + */ + public Long getXMsBlobSequenceNumber() { + return this.xMsBlobSequenceNumber; + } + + /** + * Set the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @param xMsBlobSequenceNumber the xMsBlobSequenceNumber value to set. + * @return the PageBlobsUpdateSequenceNumberHeaders object itself. + */ + public PageBlobsUpdateSequenceNumberHeaders setXMsBlobSequenceNumber(Long xMsBlobSequenceNumber) { + this.xMsBlobSequenceNumber = xMsBlobSequenceNumber; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the PageBlobsUpdateSequenceNumberHeaders object itself. + */ + public PageBlobsUpdateSequenceNumberHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the PageBlobsUpdateSequenceNumberHeaders object itself. + */ + public PageBlobsUpdateSequenceNumberHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the PageBlobsUpdateSequenceNumberHeaders object itself. + */ + public PageBlobsUpdateSequenceNumberHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the PageBlobsUpdateSequenceNumberHeaders object itself. + */ + public PageBlobsUpdateSequenceNumberHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsUploadPagesFromURLHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsUploadPagesFromURLHeaders.java new file mode 100644 index 000000000000..506ca96f52b4 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsUploadPagesFromURLHeaders.java @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Base64; + +/** + * The PageBlobsUploadPagesFromURLHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class PageBlobsUploadPagesFromURLHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-content-crc64 property. + */ + private byte[] xMsContentCrc64; + + /* + * The x-ms-blob-sequence-number property. + */ + private Long xMsBlobSequenceNumber; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-encryption-key-sha256 property. + */ + private String xMsEncryptionKeySha256; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-request-server-encrypted property. + */ + private Boolean xMsRequestServerEncrypted; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-MD5 property. + */ + private byte[] contentMD5; + + /* + * The x-ms-encryption-scope property. + */ + private String xMsEncryptionScope; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_CONTENT_CRC64 = HttpHeaderName.fromString("x-ms-content-crc64"); + + private static final HttpHeaderName X_MS_BLOB_SEQUENCE_NUMBER + = HttpHeaderName.fromString("x-ms-blob-sequence-number"); + + private static final HttpHeaderName X_MS_ENCRYPTION_KEY_SHA256 + = HttpHeaderName.fromString("x-ms-encryption-key-sha256"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_REQUEST_SERVER_ENCRYPTED + = HttpHeaderName.fromString("x-ms-request-server-encrypted"); + + private static final HttpHeaderName X_MS_ENCRYPTION_SCOPE = HttpHeaderName.fromString("x-ms-encryption-scope"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of PageBlobsUploadPagesFromURLHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public PageBlobsUploadPagesFromURLHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + String xMsContentCrc64 = rawHeaders.getValue(X_MS_CONTENT_CRC64); + if (xMsContentCrc64 != null) { + this.xMsContentCrc64 = Base64.getDecoder().decode(xMsContentCrc64); + } + String xMsBlobSequenceNumber = rawHeaders.getValue(X_MS_BLOB_SEQUENCE_NUMBER); + if (xMsBlobSequenceNumber != null) { + this.xMsBlobSequenceNumber = Long.parseLong(xMsBlobSequenceNumber); + } + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsEncryptionKeySha256 = rawHeaders.getValue(X_MS_ENCRYPTION_KEY_SHA256); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + String xMsRequestServerEncrypted = rawHeaders.getValue(X_MS_REQUEST_SERVER_ENCRYPTED); + if (xMsRequestServerEncrypted != null) { + this.xMsRequestServerEncrypted = Boolean.parseBoolean(xMsRequestServerEncrypted); + } + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + String contentMD5 = rawHeaders.getValue(HttpHeaderName.CONTENT_MD5); + if (contentMD5 != null) { + this.contentMD5 = Base64.getDecoder().decode(contentMD5); + } + this.xMsEncryptionScope = rawHeaders.getValue(X_MS_ENCRYPTION_SCOPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the PageBlobsUploadPagesFromURLHeaders object itself. + */ + public PageBlobsUploadPagesFromURLHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the PageBlobsUploadPagesFromURLHeaders object itself. + */ + public PageBlobsUploadPagesFromURLHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return this.xMsContentCrc64; + } + + /** + * Set the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the PageBlobsUploadPagesFromURLHeaders object itself. + */ + public PageBlobsUploadPagesFromURLHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = xMsContentCrc64; + return this; + } + + /** + * Get the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @return the xMsBlobSequenceNumber value. + */ + public Long getXMsBlobSequenceNumber() { + return this.xMsBlobSequenceNumber; + } + + /** + * Set the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @param xMsBlobSequenceNumber the xMsBlobSequenceNumber value to set. + * @return the PageBlobsUploadPagesFromURLHeaders object itself. + */ + public PageBlobsUploadPagesFromURLHeaders setXMsBlobSequenceNumber(Long xMsBlobSequenceNumber) { + this.xMsBlobSequenceNumber = xMsBlobSequenceNumber; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the PageBlobsUploadPagesFromURLHeaders object itself. + */ + public PageBlobsUploadPagesFromURLHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String getXMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the PageBlobsUploadPagesFromURLHeaders object itself. + */ + public PageBlobsUploadPagesFromURLHeaders setXMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the PageBlobsUploadPagesFromURLHeaders object itself. + */ + public PageBlobsUploadPagesFromURLHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @return the xMsRequestServerEncrypted value. + */ + public Boolean isXMsRequestServerEncrypted() { + return this.xMsRequestServerEncrypted; + } + + /** + * Set the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @param xMsRequestServerEncrypted the xMsRequestServerEncrypted value to set. + * @return the PageBlobsUploadPagesFromURLHeaders object itself. + */ + public PageBlobsUploadPagesFromURLHeaders setXMsRequestServerEncrypted(Boolean xMsRequestServerEncrypted) { + this.xMsRequestServerEncrypted = xMsRequestServerEncrypted; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the PageBlobsUploadPagesFromURLHeaders object itself. + */ + public PageBlobsUploadPagesFromURLHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentMD5 property: The Content-MD5 property. + * + * @return the contentMD5 value. + */ + public byte[] getContentMD5() { + return this.contentMD5; + } + + /** + * Set the contentMD5 property: The Content-MD5 property. + * + * @param contentMD5 the contentMD5 value to set. + * @return the PageBlobsUploadPagesFromURLHeaders object itself. + */ + public PageBlobsUploadPagesFromURLHeaders setContentMD5(byte[] contentMD5) { + this.contentMD5 = contentMD5; + return this; + } + + /** + * Get the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @return the xMsEncryptionScope value. + */ + public String getXMsEncryptionScope() { + return this.xMsEncryptionScope; + } + + /** + * Set the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @param xMsEncryptionScope the xMsEncryptionScope value to set. + * @return the PageBlobsUploadPagesFromURLHeaders object itself. + */ + public PageBlobsUploadPagesFromURLHeaders setXMsEncryptionScope(String xMsEncryptionScope) { + this.xMsEncryptionScope = xMsEncryptionScope; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsUploadPagesHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsUploadPagesHeaders.java new file mode 100644 index 000000000000..d810a4648c8c --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageBlobsUploadPagesHeaders.java @@ -0,0 +1,419 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; +import java.util.Base64; + +/** + * The PageBlobsUploadPagesHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class PageBlobsUploadPagesHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-content-crc64 property. + */ + private byte[] xMsContentCrc64; + + /* + * The x-ms-blob-sequence-number property. + */ + private Long xMsBlobSequenceNumber; + + /* + * The Last-Modified property. + */ + private DateTimeRfc1123 lastModified; + + /* + * The x-ms-encryption-key-sha256 property. + */ + private String xMsEncryptionKeySha256; + + /* + * The x-ms-structured-body property. + */ + private String xMsStructuredBody; + + /* + * The x-ms-request-server-encrypted property. + */ + private Boolean xMsRequestServerEncrypted; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + /* + * The Content-MD5 property. + */ + private byte[] contentMD5; + + /* + * The ETag property. + */ + private String eTag; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The x-ms-encryption-scope property. + */ + private String xMsEncryptionScope; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_CONTENT_CRC64 = HttpHeaderName.fromString("x-ms-content-crc64"); + + private static final HttpHeaderName X_MS_BLOB_SEQUENCE_NUMBER + = HttpHeaderName.fromString("x-ms-blob-sequence-number"); + + private static final HttpHeaderName X_MS_ENCRYPTION_KEY_SHA256 + = HttpHeaderName.fromString("x-ms-encryption-key-sha256"); + + private static final HttpHeaderName X_MS_STRUCTURED_BODY = HttpHeaderName.fromString("x-ms-structured-body"); + + private static final HttpHeaderName X_MS_REQUEST_SERVER_ENCRYPTED + = HttpHeaderName.fromString("x-ms-request-server-encrypted"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + private static final HttpHeaderName X_MS_ENCRYPTION_SCOPE = HttpHeaderName.fromString("x-ms-encryption-scope"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of PageBlobsUploadPagesHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public PageBlobsUploadPagesHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + String xMsContentCrc64 = rawHeaders.getValue(X_MS_CONTENT_CRC64); + if (xMsContentCrc64 != null) { + this.xMsContentCrc64 = Base64.getDecoder().decode(xMsContentCrc64); + } + String xMsBlobSequenceNumber = rawHeaders.getValue(X_MS_BLOB_SEQUENCE_NUMBER); + if (xMsBlobSequenceNumber != null) { + this.xMsBlobSequenceNumber = Long.parseLong(xMsBlobSequenceNumber); + } + String lastModified = rawHeaders.getValue(HttpHeaderName.LAST_MODIFIED); + if (lastModified != null) { + this.lastModified = new DateTimeRfc1123(lastModified); + } + this.xMsEncryptionKeySha256 = rawHeaders.getValue(X_MS_ENCRYPTION_KEY_SHA256); + this.xMsStructuredBody = rawHeaders.getValue(X_MS_STRUCTURED_BODY); + String xMsRequestServerEncrypted = rawHeaders.getValue(X_MS_REQUEST_SERVER_ENCRYPTED); + if (xMsRequestServerEncrypted != null) { + this.xMsRequestServerEncrypted = Boolean.parseBoolean(xMsRequestServerEncrypted); + } + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + String contentMD5 = rawHeaders.getValue(HttpHeaderName.CONTENT_MD5); + if (contentMD5 != null) { + this.contentMD5 = Base64.getDecoder().decode(contentMD5); + } + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + this.xMsEncryptionScope = rawHeaders.getValue(X_MS_ENCRYPTION_SCOPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the PageBlobsUploadPagesHeaders object itself. + */ + public PageBlobsUploadPagesHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return this.xMsContentCrc64; + } + + /** + * Set the xMsContentCrc64 property: The x-ms-content-crc64 property. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the PageBlobsUploadPagesHeaders object itself. + */ + public PageBlobsUploadPagesHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = xMsContentCrc64; + return this; + } + + /** + * Get the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @return the xMsBlobSequenceNumber value. + */ + public Long getXMsBlobSequenceNumber() { + return this.xMsBlobSequenceNumber; + } + + /** + * Set the xMsBlobSequenceNumber property: The x-ms-blob-sequence-number property. + * + * @param xMsBlobSequenceNumber the xMsBlobSequenceNumber value to set. + * @return the PageBlobsUploadPagesHeaders object itself. + */ + public PageBlobsUploadPagesHeaders setXMsBlobSequenceNumber(Long xMsBlobSequenceNumber) { + this.xMsBlobSequenceNumber = xMsBlobSequenceNumber; + return this; + } + + /** + * Get the lastModified property: The Last-Modified property. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The Last-Modified property. + * + * @param lastModified the lastModified value to set. + * @return the PageBlobsUploadPagesHeaders object itself. + */ + public PageBlobsUploadPagesHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String getXMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The x-ms-encryption-key-sha256 property. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the PageBlobsUploadPagesHeaders object itself. + */ + public PageBlobsUploadPagesHeaders setXMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsStructuredBody property: The x-ms-structured-body property. + * + * @return the xMsStructuredBody value. + */ + public String getXMsStructuredBody() { + return this.xMsStructuredBody; + } + + /** + * Set the xMsStructuredBody property: The x-ms-structured-body property. + * + * @param xMsStructuredBody the xMsStructuredBody value to set. + * @return the PageBlobsUploadPagesHeaders object itself. + */ + public PageBlobsUploadPagesHeaders setXMsStructuredBody(String xMsStructuredBody) { + this.xMsStructuredBody = xMsStructuredBody; + return this; + } + + /** + * Get the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @return the xMsRequestServerEncrypted value. + */ + public Boolean isXMsRequestServerEncrypted() { + return this.xMsRequestServerEncrypted; + } + + /** + * Set the xMsRequestServerEncrypted property: The x-ms-request-server-encrypted property. + * + * @param xMsRequestServerEncrypted the xMsRequestServerEncrypted value to set. + * @return the PageBlobsUploadPagesHeaders object itself. + */ + public PageBlobsUploadPagesHeaders setXMsRequestServerEncrypted(Boolean xMsRequestServerEncrypted) { + this.xMsRequestServerEncrypted = xMsRequestServerEncrypted; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the PageBlobsUploadPagesHeaders object itself. + */ + public PageBlobsUploadPagesHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } + + /** + * Get the contentMD5 property: The Content-MD5 property. + * + * @return the contentMD5 value. + */ + public byte[] getContentMD5() { + return this.contentMD5; + } + + /** + * Set the contentMD5 property: The Content-MD5 property. + * + * @param contentMD5 the contentMD5 value to set. + * @return the PageBlobsUploadPagesHeaders object itself. + */ + public PageBlobsUploadPagesHeaders setContentMD5(byte[] contentMD5) { + this.contentMD5 = contentMD5; + return this; + } + + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the PageBlobsUploadPagesHeaders object itself. + */ + public PageBlobsUploadPagesHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the PageBlobsUploadPagesHeaders object itself. + */ + public PageBlobsUploadPagesHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the PageBlobsUploadPagesHeaders object itself. + */ + public PageBlobsUploadPagesHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @return the xMsEncryptionScope value. + */ + public String getXMsEncryptionScope() { + return this.xMsEncryptionScope; + } + + /** + * Set the xMsEncryptionScope property: The x-ms-encryption-scope property. + * + * @param xMsEncryptionScope the xMsEncryptionScope value to set. + * @return the PageBlobsUploadPagesHeaders object itself. + */ + public PageBlobsUploadPagesHeaders setXMsEncryptionScope(String xMsEncryptionScope) { + this.xMsEncryptionScope = xMsEncryptionScope; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageList.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageList.java new file mode 100644 index 000000000000..2dc07d1cd558 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageList.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import java.util.ArrayList; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * the list of pages. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class PageList implements XmlSerializable { + /* + * The PageRange property. + */ + private List pageRange = new ArrayList<>(); + + /* + * The ClearRange property. + */ + private List clearRange = new ArrayList<>(); + + /* + * The NextMarker property. + */ + private String nextMarker; + + /** + * Creates an instance of PageList class. + */ + public PageList() { + } + + /** + * Get the pageRange property: The PageRange property. + * + * @return the pageRange value. + */ + public List getPageRange() { + return this.pageRange; + } + + /** + * Set the pageRange property: The PageRange property. + * + * @param pageRange the pageRange value to set. + * @return the PageList object itself. + */ + public PageList setPageRange(List pageRange) { + this.pageRange = pageRange; + return this; + } + + /** + * Get the clearRange property: The ClearRange property. + * + * @return the clearRange value. + */ + public List getClearRange() { + return this.clearRange; + } + + /** + * Set the clearRange property: The ClearRange property. + * + * @param clearRange the clearRange value to set. + * @return the PageList object itself. + */ + public PageList setClearRange(List clearRange) { + this.clearRange = clearRange; + return this; + } + + /** + * Get the nextMarker property: The NextMarker property. + * + * @return the nextMarker value. + */ + public String getNextMarker() { + return this.nextMarker; + } + + /** + * Set the nextMarker property: The NextMarker property. + * + * @param nextMarker the nextMarker value to set. + * @return the PageList object itself. + */ + public PageList setNextMarker(String nextMarker) { + this.nextMarker = nextMarker; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "PageList" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + if (this.pageRange != null) { + for (PageRange element : this.pageRange) { + xmlWriter.writeXml(element, "PageRange"); + } + } + if (this.clearRange != null) { + for (ClearRange element : this.clearRange) { + xmlWriter.writeXml(element, "ClearRange"); + } + } + xmlWriter.writeStringElement("NextMarker", this.nextMarker); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of PageList from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of PageList if the XmlReader was pointing to an instance of it, or null if it was pointing to + * XML null. + * @throws XMLStreamException If an error occurs while reading the PageList. + */ + public static PageList fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of PageList from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of PageList if the XmlReader was pointing to an instance of it, or null if it was pointing to + * XML null. + * @throws XMLStreamException If an error occurs while reading the PageList. + */ + public static PageList fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "PageList" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + PageList deserializedPageList = new PageList(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("PageRange".equals(elementName.getLocalPart())) { + deserializedPageList.pageRange.add(PageRange.fromXml(reader, "PageRange")); + } else if ("ClearRange".equals(elementName.getLocalPart())) { + deserializedPageList.clearRange.add(ClearRange.fromXml(reader, "ClearRange")); + } else if ("NextMarker".equals(elementName.getLocalPart())) { + deserializedPageList.nextMarker = reader.getStringElement(); + } else { + reader.skipElement(); + } + } + + return deserializedPageList; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageRange.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageRange.java new file mode 100644 index 000000000000..991d9fb4e81e --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PageRange.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * The PageRange model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class PageRange implements XmlSerializable { + /* + * The Start property. + */ + private long start; + + /* + * The End property. + */ + private long end; + + /** + * Creates an instance of PageRange class. + */ + public PageRange() { + } + + /** + * Get the start property: The Start property. + * + * @return the start value. + */ + public long getStart() { + return this.start; + } + + /** + * Set the start property: The Start property. + * + * @param start the start value to set. + * @return the PageRange object itself. + */ + public PageRange setStart(long start) { + this.start = start; + return this; + } + + /** + * Get the end property: The End property. + * + * @return the end value. + */ + public long getEnd() { + return this.end; + } + + /** + * Set the end property: The End property. + * + * @param end the end value to set. + * @return the PageRange object itself. + */ + public PageRange setEnd(long end) { + this.end = end; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "PageRange" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeLongElement("Start", this.start); + xmlWriter.writeLongElement("End", this.end); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of PageRange from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of PageRange if the XmlReader was pointing to an instance of it, or null if it was pointing + * to XML null. + * @throws XMLStreamException If an error occurs while reading the PageRange. + */ + public static PageRange fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of PageRange from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of PageRange if the XmlReader was pointing to an instance of it, or null if it was pointing + * to XML null. + * @throws XMLStreamException If an error occurs while reading the PageRange. + */ + public static PageRange fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "PageRange" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + PageRange deserializedPageRange = new PageRange(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Start".equals(elementName.getLocalPart())) { + deserializedPageRange.start = reader.getLongElement(); + } else if ("End".equals(elementName.getLocalPart())) { + deserializedPageRange.end = reader.getLongElement(); + } else { + reader.skipElement(); + } + } + + return deserializedPageRange; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PremiumPageBlobAccessTier.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PremiumPageBlobAccessTier.java new file mode 100644 index 000000000000..9d3d8be3eddd --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PremiumPageBlobAccessTier.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.v2.storage.blob.models; + +import io.clientcore.core.utils.ExpandableEnum; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +/** + * Defines values for PremiumPageBlobAccessTier. + */ +public final class PremiumPageBlobAccessTier implements ExpandableEnum { + private static final Map VALUES = new ConcurrentHashMap<>(); + + private static final Function NEW_INSTANCE = PremiumPageBlobAccessTier::new; + + /** + * Static value P4 for PremiumPageBlobAccessTier. + */ + public static final PremiumPageBlobAccessTier P4 = fromValue("P4"); + + /** + * Static value P6 for PremiumPageBlobAccessTier. + */ + public static final PremiumPageBlobAccessTier P6 = fromValue("P6"); + + /** + * Static value P10 for PremiumPageBlobAccessTier. + */ + public static final PremiumPageBlobAccessTier P10 = fromValue("P10"); + + /** + * Static value P15 for PremiumPageBlobAccessTier. + */ + public static final PremiumPageBlobAccessTier P15 = fromValue("P15"); + + /** + * Static value P20 for PremiumPageBlobAccessTier. + */ + public static final PremiumPageBlobAccessTier P20 = fromValue("P20"); + + /** + * Static value P30 for PremiumPageBlobAccessTier. + */ + public static final PremiumPageBlobAccessTier P30 = fromValue("P30"); + + /** + * Static value P40 for PremiumPageBlobAccessTier. + */ + public static final PremiumPageBlobAccessTier P40 = fromValue("P40"); + + /** + * Static value P50 for PremiumPageBlobAccessTier. + */ + public static final PremiumPageBlobAccessTier P50 = fromValue("P50"); + + /** + * Static value P60 for PremiumPageBlobAccessTier. + */ + public static final PremiumPageBlobAccessTier P60 = fromValue("P60"); + + /** + * Static value P70 for PremiumPageBlobAccessTier. + */ + public static final PremiumPageBlobAccessTier P70 = fromValue("P70"); + + /** + * Static value P80 for PremiumPageBlobAccessTier. + */ + public static final PremiumPageBlobAccessTier P80 = fromValue("P80"); + + private final String value; + + private PremiumPageBlobAccessTier(String value) { + this.value = value; + } + + /** + * Creates or finds a PremiumPageBlobAccessTier. + * + * @param value a value to look for. + * @return the corresponding PremiumPageBlobAccessTier. + * @throws IllegalArgumentException if value is null. + */ + public static PremiumPageBlobAccessTier fromValue(String value) { + if (value == null) { + throw new IllegalArgumentException("'value' cannot be null."); + } + return VALUES.computeIfAbsent(value, NEW_INSTANCE); + } + + /** + * Gets known PremiumPageBlobAccessTier values. + * + * @return Known PremiumPageBlobAccessTier values. + */ + public static Collection values() { + return new ArrayList<>(VALUES.values()); + } + + /** + * Gets the value of the PremiumPageBlobAccessTier instance. + * + * @return the value of the PremiumPageBlobAccessTier instance. + */ + @Override + public String getValue() { + return this.value; + } + + @Override + public String toString() { + return Objects.toString(this.value); + } + + @Override + public boolean equals(Object obj) { + return this == obj; + } + + @Override + public int hashCode() { + return Objects.hashCode(this.value); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PublicAccessType.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PublicAccessType.java new file mode 100644 index 000000000000..a814cd11495f --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/PublicAccessType.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.utils.ExpandableEnum; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +/** + * Defines values for PublicAccessType. + */ +public final class PublicAccessType implements ExpandableEnum { + private static final Map VALUES = new ConcurrentHashMap<>(); + + private static final Function NEW_INSTANCE = PublicAccessType::new; + + /** + * Static value container for PublicAccessType. + */ + public static final PublicAccessType CONTAINER = fromValue("container"); + + /** + * Static value blob for PublicAccessType. + */ + public static final PublicAccessType BLOB = fromValue("blob"); + + private final String value; + + private PublicAccessType(String value) { + this.value = value; + } + + /** + * Creates or finds a PublicAccessType. + * + * @param value a value to look for. + * @return the corresponding PublicAccessType. + * @throws IllegalArgumentException if value is null. + */ + public static PublicAccessType fromValue(String value) { + if (value == null) { + throw new IllegalArgumentException("'value' cannot be null."); + } + return VALUES.computeIfAbsent(value, NEW_INSTANCE); + } + + /** + * Gets known PublicAccessType values. + * + * @return Known PublicAccessType values. + */ + public static Collection values() { + return new ArrayList<>(VALUES.values()); + } + + /** + * Gets the value of the PublicAccessType instance. + * + * @return the value of the PublicAccessType instance. + */ + @Override + public String getValue() { + return this.value; + } + + @Override + public String toString() { + return Objects.toString(this.value); + } + + @Override + public boolean equals(Object obj) { + return this == obj; + } + + @Override + public int hashCode() { + return Objects.hashCode(this.value); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/QueryFormat.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/QueryFormat.java new file mode 100644 index 000000000000..65328eabb98d --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/QueryFormat.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * The QueryFormat model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class QueryFormat implements XmlSerializable { + /* + * The quick query format type. + */ + private QueryFormatType type; + + /* + * Groups the settings used for interpreting the blob data if the blob is delimited text formatted. + */ + private DelimitedTextConfiguration delimitedTextConfiguration; + + /* + * json text configuration + */ + private JsonTextConfiguration jsonTextConfiguration; + + /* + * Groups the settings used for formatting the response if the response should be Arrow formatted. + */ + private ArrowConfiguration arrowConfiguration; + + /* + * parquet configuration + */ + private Object parquetTextConfiguration; + + /** + * Creates an instance of QueryFormat class. + */ + public QueryFormat() { + } + + /** + * Get the type property: The quick query format type. + * + * @return the type value. + */ + public QueryFormatType getType() { + return this.type; + } + + /** + * Set the type property: The quick query format type. + * + * @param type the type value to set. + * @return the QueryFormat object itself. + */ + public QueryFormat setType(QueryFormatType type) { + this.type = type; + return this; + } + + /** + * Get the delimitedTextConfiguration property: Groups the settings used for interpreting the blob data if the blob + * is delimited text formatted. + * + * @return the delimitedTextConfiguration value. + */ + public DelimitedTextConfiguration getDelimitedTextConfiguration() { + return this.delimitedTextConfiguration; + } + + /** + * Set the delimitedTextConfiguration property: Groups the settings used for interpreting the blob data if the blob + * is delimited text formatted. + * + * @param delimitedTextConfiguration the delimitedTextConfiguration value to set. + * @return the QueryFormat object itself. + */ + public QueryFormat setDelimitedTextConfiguration(DelimitedTextConfiguration delimitedTextConfiguration) { + this.delimitedTextConfiguration = delimitedTextConfiguration; + return this; + } + + /** + * Get the jsonTextConfiguration property: json text configuration. + * + * @return the jsonTextConfiguration value. + */ + public JsonTextConfiguration getJsonTextConfiguration() { + return this.jsonTextConfiguration; + } + + /** + * Set the jsonTextConfiguration property: json text configuration. + * + * @param jsonTextConfiguration the jsonTextConfiguration value to set. + * @return the QueryFormat object itself. + */ + public QueryFormat setJsonTextConfiguration(JsonTextConfiguration jsonTextConfiguration) { + this.jsonTextConfiguration = jsonTextConfiguration; + return this; + } + + /** + * Get the arrowConfiguration property: Groups the settings used for formatting the response if the response should + * be Arrow formatted. + * + * @return the arrowConfiguration value. + */ + public ArrowConfiguration getArrowConfiguration() { + return this.arrowConfiguration; + } + + /** + * Set the arrowConfiguration property: Groups the settings used for formatting the response if the response should + * be Arrow formatted. + * + * @param arrowConfiguration the arrowConfiguration value to set. + * @return the QueryFormat object itself. + */ + public QueryFormat setArrowConfiguration(ArrowConfiguration arrowConfiguration) { + this.arrowConfiguration = arrowConfiguration; + return this; + } + + /** + * Get the parquetTextConfiguration property: parquet configuration. + * + * @return the parquetTextConfiguration value. + */ + public Object getParquetTextConfiguration() { + return this.parquetTextConfiguration; + } + + /** + * Set the parquetTextConfiguration property: parquet configuration. + * + * @param parquetTextConfiguration the parquetTextConfiguration value to set. + * @return the QueryFormat object itself. + */ + public QueryFormat setParquetTextConfiguration(Object parquetTextConfiguration) { + this.parquetTextConfiguration = parquetTextConfiguration; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "QueryFormat" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("Type", this.type == null ? null : this.type.toString()); + xmlWriter.writeXml(this.delimitedTextConfiguration, "DelimitedTextConfiguration"); + xmlWriter.writeXml(this.jsonTextConfiguration, "JsonTextConfiguration"); + xmlWriter.writeXml(this.arrowConfiguration, "ArrowConfiguration"); + xmlWriter.writeStartElement("ParquetTextConfiguration").writeEndElement(); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of QueryFormat from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of QueryFormat if the XmlReader was pointing to an instance of it, or null if it was pointing + * to XML null. + * @throws XMLStreamException If an error occurs while reading the QueryFormat. + */ + public static QueryFormat fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of QueryFormat from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of QueryFormat if the XmlReader was pointing to an instance of it, or null if it was pointing + * to XML null. + * @throws XMLStreamException If an error occurs while reading the QueryFormat. + */ + public static QueryFormat fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "QueryFormat" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + QueryFormat deserializedQueryFormat = new QueryFormat(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Type".equals(elementName.getLocalPart())) { + deserializedQueryFormat.type = QueryFormatType.fromString(reader.getStringElement()); + } else if ("DelimitedTextConfiguration".equals(elementName.getLocalPart())) { + deserializedQueryFormat.delimitedTextConfiguration + = DelimitedTextConfiguration.fromXml(reader, "DelimitedTextConfiguration"); + } else if ("JsonTextConfiguration".equals(elementName.getLocalPart())) { + deserializedQueryFormat.jsonTextConfiguration + = JsonTextConfiguration.fromXml(reader, "JsonTextConfiguration"); + } else if ("ArrowConfiguration".equals(elementName.getLocalPart())) { + deserializedQueryFormat.arrowConfiguration + = ArrowConfiguration.fromXml(reader, "ArrowConfiguration"); + } else if ("ParquetTextConfiguration".equals(elementName.getLocalPart())) { + deserializedQueryFormat.parquetTextConfiguration = new Object(); + xmlReader.skipElement(); + } else { + reader.skipElement(); + } + } + + return deserializedQueryFormat; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/QueryFormatType.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/QueryFormatType.java new file mode 100644 index 000000000000..2f223abde826 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/QueryFormatType.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.v2.storage.blob.models; + +/** + * The quick query format type. + */ +public enum QueryFormatType { + /** + * Enum value delimited. + */ + DELIMITED("delimited"), + + /** + * Enum value json. + */ + JSON("json"), + + /** + * Enum value arrow. + */ + ARROW("arrow"), + + /** + * Enum value parquet. + */ + PARQUET("parquet"); + + /** + * The actual serialized value for a QueryFormatType instance. + */ + private final String value; + + QueryFormatType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a QueryFormatType instance. + * + * @param value the serialized value to parse. + * @return the parsed QueryFormatType object, or null if unable to parse. + */ + public static QueryFormatType fromString(String value) { + if (value == null) { + return null; + } + QueryFormatType[] items = QueryFormatType.values(); + for (QueryFormatType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/QueryRequest.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/QueryRequest.java new file mode 100644 index 000000000000..56190cd82d86 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/QueryRequest.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.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * Groups the set of query request settings. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class QueryRequest implements XmlSerializable { + /* + * Required. The type of the provided query expression. + */ + private final String queryType = "SQL"; + + /* + * The query expression in SQL. The maximum size of the query expression is 256KiB. + */ + private String expression; + + /* + * The InputSerialization property. + */ + private QuerySerialization inputSerialization; + + /* + * The OutputSerialization property. + */ + private QuerySerialization outputSerialization; + + /** + * Creates an instance of QueryRequest class. + */ + public QueryRequest() { + } + + /** + * Get the queryType property: Required. The type of the provided query expression. + * + * @return the queryType value. + */ + public String getQueryType() { + return this.queryType; + } + + /** + * Get the expression property: The query expression in SQL. The maximum size of the query expression is 256KiB. + * + * @return the expression value. + */ + public String getExpression() { + return this.expression; + } + + /** + * Set the expression property: The query expression in SQL. The maximum size of the query expression is 256KiB. + * + * @param expression the expression value to set. + * @return the QueryRequest object itself. + */ + public QueryRequest setExpression(String expression) { + this.expression = expression; + return this; + } + + /** + * Get the inputSerialization property: The InputSerialization property. + * + * @return the inputSerialization value. + */ + public QuerySerialization getInputSerialization() { + return this.inputSerialization; + } + + /** + * Set the inputSerialization property: The InputSerialization property. + * + * @param inputSerialization the inputSerialization value to set. + * @return the QueryRequest object itself. + */ + public QueryRequest setInputSerialization(QuerySerialization inputSerialization) { + this.inputSerialization = inputSerialization; + return this; + } + + /** + * Get the outputSerialization property: The OutputSerialization property. + * + * @return the outputSerialization value. + */ + public QuerySerialization getOutputSerialization() { + return this.outputSerialization; + } + + /** + * Set the outputSerialization property: The OutputSerialization property. + * + * @param outputSerialization the outputSerialization value to set. + * @return the QueryRequest object itself. + */ + public QueryRequest setOutputSerialization(QuerySerialization outputSerialization) { + this.outputSerialization = outputSerialization; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "QueryRequest" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("QueryType", this.queryType); + xmlWriter.writeStringElement("Expression", this.expression); + xmlWriter.writeXml(this.inputSerialization, "InputSerialization"); + xmlWriter.writeXml(this.outputSerialization, "OutputSerialization"); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of QueryRequest from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of QueryRequest if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the QueryRequest. + */ + public static QueryRequest fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of QueryRequest from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of QueryRequest if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the QueryRequest. + */ + public static QueryRequest fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "QueryRequest" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + QueryRequest deserializedQueryRequest = new QueryRequest(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Expression".equals(elementName.getLocalPart())) { + deserializedQueryRequest.expression = reader.getStringElement(); + } else if ("InputSerialization".equals(elementName.getLocalPart())) { + deserializedQueryRequest.inputSerialization + = QuerySerialization.fromXml(reader, "InputSerialization"); + } else if ("OutputSerialization".equals(elementName.getLocalPart())) { + deserializedQueryRequest.outputSerialization + = QuerySerialization.fromXml(reader, "OutputSerialization"); + } else { + reader.skipElement(); + } + } + + return deserializedQueryRequest; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/QuerySerialization.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/QuerySerialization.java new file mode 100644 index 000000000000..040a1ecda0f5 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/QuerySerialization.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * The QuerySerialization model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class QuerySerialization implements XmlSerializable { + /* + * The Format property. + */ + private QueryFormat format; + + /** + * Creates an instance of QuerySerialization class. + */ + public QuerySerialization() { + } + + /** + * Get the format property: The Format property. + * + * @return the format value. + */ + public QueryFormat getFormat() { + return this.format; + } + + /** + * Set the format property: The Format property. + * + * @param format the format value to set. + * @return the QuerySerialization object itself. + */ + public QuerySerialization setFormat(QueryFormat format) { + this.format = format; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "QuerySerialization" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeXml(this.format, "Format"); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of QuerySerialization from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of QuerySerialization if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the QuerySerialization. + */ + public static QuerySerialization fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of QuerySerialization from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of QuerySerialization if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the QuerySerialization. + */ + public static QuerySerialization fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "QuerySerialization" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + QuerySerialization deserializedQuerySerialization = new QuerySerialization(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Format".equals(elementName.getLocalPart())) { + deserializedQuerySerialization.format = QueryFormat.fromXml(reader, "Format"); + } else { + reader.skipElement(); + } + } + + return deserializedQuerySerialization; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/RehydratePriority.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/RehydratePriority.java new file mode 100644 index 000000000000..013f73d60240 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/RehydratePriority.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.utils.ExpandableEnum; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +/** + * If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid values are + * High and Standard. + */ +public final class RehydratePriority implements ExpandableEnum { + private static final Map VALUES = new ConcurrentHashMap<>(); + + private static final Function NEW_INSTANCE = RehydratePriority::new; + + /** + * Static value High for RehydratePriority. + */ + public static final RehydratePriority HIGH = fromValue("High"); + + /** + * Static value Standard for RehydratePriority. + */ + public static final RehydratePriority STANDARD = fromValue("Standard"); + + private final String value; + + private RehydratePriority(String value) { + this.value = value; + } + + /** + * Creates or finds a RehydratePriority. + * + * @param value a value to look for. + * @return the corresponding RehydratePriority. + * @throws IllegalArgumentException if value is null. + */ + public static RehydratePriority fromValue(String value) { + if (value == null) { + throw new IllegalArgumentException("'value' cannot be null."); + } + return VALUES.computeIfAbsent(value, NEW_INSTANCE); + } + + /** + * Gets known RehydratePriority values. + * + * @return Known RehydratePriority values. + */ + public static Collection values() { + return new ArrayList<>(VALUES.values()); + } + + /** + * Gets the value of the RehydratePriority instance. + * + * @return the value of the RehydratePriority instance. + */ + @Override + public String getValue() { + return this.value; + } + + @Override + public String toString() { + return Objects.toString(this.value); + } + + @Override + public boolean equals(Object obj) { + return this == obj; + } + + @Override + public int hashCode() { + return Objects.hashCode(this.value); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/SequenceNumberActionType.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/SequenceNumberActionType.java new file mode 100644 index 000000000000..fa214119b30c --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/SequenceNumberActionType.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +/** + * Defines values for SequenceNumberActionType. + */ +public enum SequenceNumberActionType { + /** + * Enum value max. + */ + MAX("max"), + + /** + * Enum value update. + */ + UPDATE("update"), + + /** + * Enum value increment. + */ + INCREMENT("increment"); + + /** + * The actual serialized value for a SequenceNumberActionType instance. + */ + private final String value; + + SequenceNumberActionType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SequenceNumberActionType instance. + * + * @param value the serialized value to parse. + * @return the parsed SequenceNumberActionType object, or null if unable to parse. + */ + public static SequenceNumberActionType fromString(String value) { + if (value == null) { + return null; + } + SequenceNumberActionType[] items = SequenceNumberActionType.values(); + for (SequenceNumberActionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesFilterBlobsHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesFilterBlobsHeaders.java new file mode 100644 index 000000000000..dc4c6642d576 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesFilterBlobsHeaders.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ServicesFilterBlobsHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ServicesFilterBlobsHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ServicesFilterBlobsHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ServicesFilterBlobsHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ServicesFilterBlobsHeaders object itself. + */ + public ServicesFilterBlobsHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ServicesFilterBlobsHeaders object itself. + */ + public ServicesFilterBlobsHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ServicesFilterBlobsHeaders object itself. + */ + public ServicesFilterBlobsHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ServicesFilterBlobsHeaders object itself. + */ + public ServicesFilterBlobsHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesGetAccountInfoHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesGetAccountInfoHeaders.java new file mode 100644 index 000000000000..a9702f036e04 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesGetAccountInfoHeaders.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ServicesGetAccountInfoHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ServicesGetAccountInfoHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-account-kind property. + */ + private AccountKind xMsAccountKind; + + /* + * The x-ms-is-hns-enabled property. + */ + private Boolean xMsIsHnsEnabled; + + /* + * The x-ms-sku-name property. + */ + private SkuName xMsSkuName; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_ACCOUNT_KIND = HttpHeaderName.fromString("x-ms-account-kind"); + + private static final HttpHeaderName X_MS_IS_HNS_ENABLED = HttpHeaderName.fromString("x-ms-is-hns-enabled"); + + private static final HttpHeaderName X_MS_SKU_NAME = HttpHeaderName.fromString("x-ms-sku-name"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ServicesGetAccountInfoHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ServicesGetAccountInfoHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + String xMsAccountKind = rawHeaders.getValue(X_MS_ACCOUNT_KIND); + if (xMsAccountKind != null) { + this.xMsAccountKind = AccountKind.fromString(xMsAccountKind); + } + String xMsIsHnsEnabled = rawHeaders.getValue(X_MS_IS_HNS_ENABLED); + if (xMsIsHnsEnabled != null) { + this.xMsIsHnsEnabled = Boolean.parseBoolean(xMsIsHnsEnabled); + } + String xMsSkuName = rawHeaders.getValue(X_MS_SKU_NAME); + if (xMsSkuName != null) { + this.xMsSkuName = SkuName.fromString(xMsSkuName); + } + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ServicesGetAccountInfoHeaders object itself. + */ + public ServicesGetAccountInfoHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsAccountKind property: The x-ms-account-kind property. + * + * @return the xMsAccountKind value. + */ + public AccountKind getXMsAccountKind() { + return this.xMsAccountKind; + } + + /** + * Set the xMsAccountKind property: The x-ms-account-kind property. + * + * @param xMsAccountKind the xMsAccountKind value to set. + * @return the ServicesGetAccountInfoHeaders object itself. + */ + public ServicesGetAccountInfoHeaders setXMsAccountKind(AccountKind xMsAccountKind) { + this.xMsAccountKind = xMsAccountKind; + return this; + } + + /** + * Get the xMsIsHnsEnabled property: The x-ms-is-hns-enabled property. + * + * @return the xMsIsHnsEnabled value. + */ + public Boolean isXMsIsHnsEnabled() { + return this.xMsIsHnsEnabled; + } + + /** + * Set the xMsIsHnsEnabled property: The x-ms-is-hns-enabled property. + * + * @param xMsIsHnsEnabled the xMsIsHnsEnabled value to set. + * @return the ServicesGetAccountInfoHeaders object itself. + */ + public ServicesGetAccountInfoHeaders setXMsIsHnsEnabled(Boolean xMsIsHnsEnabled) { + this.xMsIsHnsEnabled = xMsIsHnsEnabled; + return this; + } + + /** + * Get the xMsSkuName property: The x-ms-sku-name property. + * + * @return the xMsSkuName value. + */ + public SkuName getXMsSkuName() { + return this.xMsSkuName; + } + + /** + * Set the xMsSkuName property: The x-ms-sku-name property. + * + * @param xMsSkuName the xMsSkuName value to set. + * @return the ServicesGetAccountInfoHeaders object itself. + */ + public ServicesGetAccountInfoHeaders setXMsSkuName(SkuName xMsSkuName) { + this.xMsSkuName = xMsSkuName; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ServicesGetAccountInfoHeaders object itself. + */ + public ServicesGetAccountInfoHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ServicesGetAccountInfoHeaders object itself. + */ + public ServicesGetAccountInfoHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ServicesGetAccountInfoHeaders object itself. + */ + public ServicesGetAccountInfoHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesGetPropertiesHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesGetPropertiesHeaders.java new file mode 100644 index 000000000000..f7072f065c35 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesGetPropertiesHeaders.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; + +/** + * The ServicesGetPropertiesHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ServicesGetPropertiesHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ServicesGetPropertiesHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ServicesGetPropertiesHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ServicesGetPropertiesHeaders object itself. + */ + public ServicesGetPropertiesHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ServicesGetPropertiesHeaders object itself. + */ + public ServicesGetPropertiesHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ServicesGetPropertiesHeaders object itself. + */ + public ServicesGetPropertiesHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesGetStatisticsHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesGetStatisticsHeaders.java new file mode 100644 index 000000000000..1e620bcce2b6 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesGetStatisticsHeaders.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ServicesGetStatisticsHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ServicesGetStatisticsHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ServicesGetStatisticsHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ServicesGetStatisticsHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ServicesGetStatisticsHeaders object itself. + */ + public ServicesGetStatisticsHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ServicesGetStatisticsHeaders object itself. + */ + public ServicesGetStatisticsHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ServicesGetStatisticsHeaders object itself. + */ + public ServicesGetStatisticsHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ServicesGetStatisticsHeaders object itself. + */ + public ServicesGetStatisticsHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesGetUserDelegationKeyHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesGetUserDelegationKeyHeaders.java new file mode 100644 index 000000000000..999ff3e3c379 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesGetUserDelegationKeyHeaders.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; +import io.clientcore.core.utils.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * The ServicesGetUserDelegationKeyHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ServicesGetUserDelegationKeyHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + /* + * The Date property. + */ + private DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ServicesGetUserDelegationKeyHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ServicesGetUserDelegationKeyHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + String date = rawHeaders.getValue(HttpHeaderName.DATE); + if (date != null) { + this.date = new DateTimeRfc1123(date); + } + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ServicesGetUserDelegationKeyHeaders object itself. + */ + public ServicesGetUserDelegationKeyHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ServicesGetUserDelegationKeyHeaders object itself. + */ + public ServicesGetUserDelegationKeyHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ServicesGetUserDelegationKeyHeaders object itself. + */ + public ServicesGetUserDelegationKeyHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the date property: The Date property. + * + * @return the date value. + */ + public OffsetDateTime getDate() { + if (this.date == null) { + return null; + } + return this.date.getDateTime(); + } + + /** + * Set the date property: The Date property. + * + * @param date the date value to set. + * @return the ServicesGetUserDelegationKeyHeaders object itself. + */ + public ServicesGetUserDelegationKeyHeaders setDate(OffsetDateTime date) { + if (date == null) { + this.date = null; + } else { + this.date = new DateTimeRfc1123(date); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesListBlobContainersSegmentHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesListBlobContainersSegmentHeaders.java new file mode 100644 index 000000000000..0401957a3080 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesListBlobContainersSegmentHeaders.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; + +/** + * The ServicesListBlobContainersSegmentHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ServicesListBlobContainersSegmentHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ServicesListBlobContainersSegmentHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ServicesListBlobContainersSegmentHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ServicesListBlobContainersSegmentHeaders object itself. + */ + public ServicesListBlobContainersSegmentHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ServicesListBlobContainersSegmentHeaders object itself. + */ + public ServicesListBlobContainersSegmentHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ServicesListBlobContainersSegmentHeaders object itself. + */ + public ServicesListBlobContainersSegmentHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesListBlobContainersSegmentNextHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesListBlobContainersSegmentNextHeaders.java new file mode 100644 index 000000000000..098aad4593be --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesListBlobContainersSegmentNextHeaders.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; + +/** + * The ServicesListBlobContainersSegmentNextHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ServicesListBlobContainersSegmentNextHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ServicesListBlobContainersSegmentNextHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ServicesListBlobContainersSegmentNextHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ServicesListBlobContainersSegmentNextHeaders object itself. + */ + public ServicesListBlobContainersSegmentNextHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ServicesListBlobContainersSegmentNextHeaders object itself. + */ + public ServicesListBlobContainersSegmentNextHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ServicesListBlobContainersSegmentNextHeaders object itself. + */ + public ServicesListBlobContainersSegmentNextHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesSetPropertiesHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesSetPropertiesHeaders.java new file mode 100644 index 000000000000..70405645f9bf --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesSetPropertiesHeaders.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; + +/** + * The ServicesSetPropertiesHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ServicesSetPropertiesHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The x-ms-client-request-id property. + */ + private String xMsClientRequestId; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ServicesSetPropertiesHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ServicesSetPropertiesHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.xMsClientRequestId = rawHeaders.getValue(X_MS_CLIENT_REQUEST_ID); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ServicesSetPropertiesHeaders object itself. + */ + public ServicesSetPropertiesHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ServicesSetPropertiesHeaders object itself. + */ + public ServicesSetPropertiesHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String getXMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the ServicesSetPropertiesHeaders object itself. + */ + public ServicesSetPropertiesHeaders setXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesSubmitBatchHeaders.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesSubmitBatchHeaders.java new file mode 100644 index 000000000000..962179a12113 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/ServicesSubmitBatchHeaders.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpHeaders; + +/** + * The ServicesSubmitBatchHeaders model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class ServicesSubmitBatchHeaders { + /* + * The x-ms-version property. + */ + private String xMsVersion; + + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The Content-Type property. + */ + private String contentType; + + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ServicesSubmitBatchHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ServicesSubmitBatchHeaders(HttpHeaders rawHeaders) { + this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + this.contentType = rawHeaders.getValue(HttpHeaderName.CONTENT_TYPE); + } + + /** + * Get the xMsVersion property: The x-ms-version property. + * + * @return the xMsVersion value. + */ + public String getXMsVersion() { + return this.xMsVersion; + } + + /** + * Set the xMsVersion property: The x-ms-version property. + * + * @param xMsVersion the xMsVersion value to set. + * @return the ServicesSubmitBatchHeaders object itself. + */ + public ServicesSubmitBatchHeaders setXMsVersion(String xMsVersion) { + this.xMsVersion = xMsVersion; + return this; + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String getXMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the ServicesSubmitBatchHeaders object itself. + */ + public ServicesSubmitBatchHeaders setXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the contentType property: The Content-Type property. + * + * @return the contentType value. + */ + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The Content-Type property. + * + * @param contentType the contentType value to set. + * @return the ServicesSubmitBatchHeaders object itself. + */ + public ServicesSubmitBatchHeaders setContentType(String contentType) { + this.contentType = contentType; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/SkuName.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/SkuName.java new file mode 100644 index 000000000000..1f236b296ed4 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/SkuName.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.v2.storage.blob.models; + +/** + * Defines values for SkuName. + */ +public enum SkuName { + /** + * Enum value Standard_LRS. + */ + STANDARD_LRS("Standard_LRS"), + + /** + * Enum value Standard_GRS. + */ + STANDARD_GRS("Standard_GRS"), + + /** + * Enum value Standard_RAGRS. + */ + STANDARD_RAGRS("Standard_RAGRS"), + + /** + * Enum value Standard_ZRS. + */ + STANDARD_ZRS("Standard_ZRS"), + + /** + * Enum value Premium_LRS. + */ + PREMIUM_LRS("Premium_LRS"); + + /** + * The actual serialized value for a SkuName instance. + */ + private final String value; + + SkuName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SkuName instance. + * + * @param value the serialized value to parse. + * @return the parsed SkuName object, or null if unable to parse. + */ + public static SkuName fromString(String value) { + if (value == null) { + return null; + } + SkuName[] items = SkuName.values(); + for (SkuName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/StaticWebsite.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/StaticWebsite.java new file mode 100644 index 000000000000..c282a2cc1261 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/StaticWebsite.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * The properties that enable an account to host a static website. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class StaticWebsite implements XmlSerializable { + /* + * Indicates whether this account is hosting a static website + */ + private boolean enabled; + + /* + * The default name of the index page under each directory + */ + private String indexDocument; + + /* + * The absolute path of the custom 404 page + */ + private String errorDocument404Path; + + /* + * Absolute path of the default index page + */ + private String defaultIndexDocumentPath; + + /** + * Creates an instance of StaticWebsite class. + */ + public StaticWebsite() { + } + + /** + * Get the enabled property: Indicates whether this account is hosting a static website. + * + * @return the enabled value. + */ + public boolean isEnabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates whether this account is hosting a static website. + * + * @param enabled the enabled value to set. + * @return the StaticWebsite object itself. + */ + public StaticWebsite setEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the indexDocument property: The default name of the index page under each directory. + * + * @return the indexDocument value. + */ + public String getIndexDocument() { + return this.indexDocument; + } + + /** + * Set the indexDocument property: The default name of the index page under each directory. + * + * @param indexDocument the indexDocument value to set. + * @return the StaticWebsite object itself. + */ + public StaticWebsite setIndexDocument(String indexDocument) { + this.indexDocument = indexDocument; + return this; + } + + /** + * Get the errorDocument404Path property: The absolute path of the custom 404 page. + * + * @return the errorDocument404Path value. + */ + public String getErrorDocument404Path() { + return this.errorDocument404Path; + } + + /** + * Set the errorDocument404Path property: The absolute path of the custom 404 page. + * + * @param errorDocument404Path the errorDocument404Path value to set. + * @return the StaticWebsite object itself. + */ + public StaticWebsite setErrorDocument404Path(String errorDocument404Path) { + this.errorDocument404Path = errorDocument404Path; + return this; + } + + /** + * Get the defaultIndexDocumentPath property: Absolute path of the default index page. + * + * @return the defaultIndexDocumentPath value. + */ + public String getDefaultIndexDocumentPath() { + return this.defaultIndexDocumentPath; + } + + /** + * Set the defaultIndexDocumentPath property: Absolute path of the default index page. + * + * @param defaultIndexDocumentPath the defaultIndexDocumentPath value to set. + * @return the StaticWebsite object itself. + */ + public StaticWebsite setDefaultIndexDocumentPath(String defaultIndexDocumentPath) { + this.defaultIndexDocumentPath = defaultIndexDocumentPath; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "StaticWebsite" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeBooleanElement("Enabled", this.enabled); + xmlWriter.writeStringElement("IndexDocument", this.indexDocument); + xmlWriter.writeStringElement("ErrorDocument404Path", this.errorDocument404Path); + xmlWriter.writeStringElement("DefaultIndexDocumentPath", this.defaultIndexDocumentPath); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of StaticWebsite from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of StaticWebsite if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the StaticWebsite. + */ + public static StaticWebsite fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of StaticWebsite from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of StaticWebsite if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the StaticWebsite. + */ + public static StaticWebsite fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "StaticWebsite" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + StaticWebsite deserializedStaticWebsite = new StaticWebsite(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Enabled".equals(elementName.getLocalPart())) { + deserializedStaticWebsite.enabled = reader.getBooleanElement(); + } else if ("IndexDocument".equals(elementName.getLocalPart())) { + deserializedStaticWebsite.indexDocument = reader.getStringElement(); + } else if ("ErrorDocument404Path".equals(elementName.getLocalPart())) { + deserializedStaticWebsite.errorDocument404Path = reader.getStringElement(); + } else if ("DefaultIndexDocumentPath".equals(elementName.getLocalPart())) { + deserializedStaticWebsite.defaultIndexDocumentPath = reader.getStringElement(); + } else { + reader.skipElement(); + } + } + + return deserializedStaticWebsite; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/StorageError.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/StorageError.java new file mode 100644 index 000000000000..79fb49590239 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/StorageError.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * The StorageError model. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class StorageError implements XmlSerializable { + /* + * The Message property. + */ + private String message; + + /** + * Creates an instance of StorageError class. + */ + public StorageError() { + } + + /** + * Get the message property: The Message property. + * + * @return the message value. + */ + public String getMessage() { + return this.message; + } + + /** + * Set the message property: The Message property. + * + * @param message the message value to set. + * @return the StorageError object itself. + */ + public StorageError setMessage(String message) { + this.message = message; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "StorageError" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("Message", this.message); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of StorageError from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of StorageError if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the StorageError. + */ + public static StorageError fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of StorageError from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of StorageError if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the StorageError. + */ + public static StorageError fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "StorageError" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + StorageError deserializedStorageError = new StorageError(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("Message".equals(elementName.getLocalPart())) { + deserializedStorageError.message = reader.getStringElement(); + } else { + reader.skipElement(); + } + } + + return deserializedStorageError; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/StorageErrorException.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/StorageErrorException.java new file mode 100644 index 000000000000..9d0ae0be1e28 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/StorageErrorException.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.http.exceptions.HttpResponseException; +import io.clientcore.core.http.models.Response; + +/** + * Exception thrown for an invalid response with StorageError information. + */ +public final class StorageErrorException extends HttpResponseException { + /** + * Initializes a new instance of the StorageErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + */ + public StorageErrorException(String message, Response response) { + super(message, response, null); + } + + /** + * Initializes a new instance of the StorageErrorException 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 StorageErrorException(String message, Response response, StorageError value) { + super(message, response, value); + } + + /** + * {@inheritDoc} + */ + @Override + public StorageError getValue() { + return (StorageError) super.getValue(); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/UserDelegationKey.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/UserDelegationKey.java new file mode 100644 index 000000000000..7f8a7c619a27 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/UserDelegationKey.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.v2.storage.blob.models; + +import io.clientcore.core.annotations.Metadata; +import io.clientcore.core.annotations.TypeConditions; +import io.clientcore.core.serialization.xml.XmlReader; +import io.clientcore.core.serialization.xml.XmlSerializable; +import io.clientcore.core.serialization.xml.XmlToken; +import io.clientcore.core.serialization.xml.XmlWriter; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * A user delegation key. + */ +@Metadata(conditions = { TypeConditions.FLUENT }) +public final class UserDelegationKey implements XmlSerializable { + /* + * The Azure Active Directory object ID in GUID format. + */ + private String signedObjectId; + + /* + * The Azure Active Directory tenant ID in GUID format + */ + private String signedTenantId; + + /* + * The date-time the key is active + */ + private OffsetDateTime signedStart; + + /* + * The date-time the key expires + */ + private OffsetDateTime signedExpiry; + + /* + * Abbreviation of the Azure Storage service that accepts the key + */ + private String signedService; + + /* + * The service version that created the key + */ + private String signedVersion; + + /* + * The key as a base64 string + */ + private String value; + + /** + * Creates an instance of UserDelegationKey class. + */ + public UserDelegationKey() { + } + + /** + * Get the signedObjectId property: The Azure Active Directory object ID in GUID format. + * + * @return the signedObjectId value. + */ + public String getSignedObjectId() { + return this.signedObjectId; + } + + /** + * Set the signedObjectId property: The Azure Active Directory object ID in GUID format. + * + * @param signedObjectId the signedObjectId value to set. + * @return the UserDelegationKey object itself. + */ + public UserDelegationKey setSignedObjectId(String signedObjectId) { + this.signedObjectId = signedObjectId; + return this; + } + + /** + * Get the signedTenantId property: The Azure Active Directory tenant ID in GUID format. + * + * @return the signedTenantId value. + */ + public String getSignedTenantId() { + return this.signedTenantId; + } + + /** + * Set the signedTenantId property: The Azure Active Directory tenant ID in GUID format. + * + * @param signedTenantId the signedTenantId value to set. + * @return the UserDelegationKey object itself. + */ + public UserDelegationKey setSignedTenantId(String signedTenantId) { + this.signedTenantId = signedTenantId; + return this; + } + + /** + * Get the signedStart property: The date-time the key is active. + * + * @return the signedStart value. + */ + public OffsetDateTime getSignedStart() { + return this.signedStart; + } + + /** + * Set the signedStart property: The date-time the key is active. + * + * @param signedStart the signedStart value to set. + * @return the UserDelegationKey object itself. + */ + public UserDelegationKey setSignedStart(OffsetDateTime signedStart) { + this.signedStart = signedStart; + return this; + } + + /** + * Get the signedExpiry property: The date-time the key expires. + * + * @return the signedExpiry value. + */ + public OffsetDateTime getSignedExpiry() { + return this.signedExpiry; + } + + /** + * Set the signedExpiry property: The date-time the key expires. + * + * @param signedExpiry the signedExpiry value to set. + * @return the UserDelegationKey object itself. + */ + public UserDelegationKey setSignedExpiry(OffsetDateTime signedExpiry) { + this.signedExpiry = signedExpiry; + return this; + } + + /** + * Get the signedService property: Abbreviation of the Azure Storage service that accepts the key. + * + * @return the signedService value. + */ + public String getSignedService() { + return this.signedService; + } + + /** + * Set the signedService property: Abbreviation of the Azure Storage service that accepts the key. + * + * @param signedService the signedService value to set. + * @return the UserDelegationKey object itself. + */ + public UserDelegationKey setSignedService(String signedService) { + this.signedService = signedService; + return this; + } + + /** + * Get the signedVersion property: The service version that created the key. + * + * @return the signedVersion value. + */ + public String getSignedVersion() { + return this.signedVersion; + } + + /** + * Set the signedVersion property: The service version that created the key. + * + * @param signedVersion the signedVersion value to set. + * @return the UserDelegationKey object itself. + */ + public UserDelegationKey setSignedVersion(String signedVersion) { + this.signedVersion = signedVersion; + return this; + } + + /** + * Get the value property: The key as a base64 string. + * + * @return the value value. + */ + public String getValue() { + return this.value; + } + + /** + * Set the value property: The key as a base64 string. + * + * @param value the value value to set. + * @return the UserDelegationKey object itself. + */ + public UserDelegationKey setValue(String value) { + this.value = value; + return this; + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "UserDelegationKey" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + xmlWriter.writeStringElement("SignedOid", this.signedObjectId); + xmlWriter.writeStringElement("SignedTid", this.signedTenantId); + xmlWriter.writeStringElement("SignedStart", + this.signedStart == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.signedStart)); + xmlWriter.writeStringElement("SignedExpiry", + this.signedExpiry == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.signedExpiry)); + xmlWriter.writeStringElement("SignedService", this.signedService); + xmlWriter.writeStringElement("SignedVersion", this.signedVersion); + xmlWriter.writeStringElement("Value", this.value); + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of UserDelegationKey from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of UserDelegationKey if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the UserDelegationKey. + */ + public static UserDelegationKey fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of UserDelegationKey from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of UserDelegationKey if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws XMLStreamException If an error occurs while reading the UserDelegationKey. + */ + public static UserDelegationKey fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "UserDelegationKey" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + UserDelegationKey deserializedUserDelegationKey = new UserDelegationKey(); + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + + if ("SignedOid".equals(elementName.getLocalPart())) { + deserializedUserDelegationKey.signedObjectId = reader.getStringElement(); + } else if ("SignedTid".equals(elementName.getLocalPart())) { + deserializedUserDelegationKey.signedTenantId = reader.getStringElement(); + } else if ("SignedStart".equals(elementName.getLocalPart())) { + deserializedUserDelegationKey.signedStart + = reader.getNullableElement(dateString -> OffsetDateTime.parse(dateString)); + } else if ("SignedExpiry".equals(elementName.getLocalPart())) { + deserializedUserDelegationKey.signedExpiry + = reader.getNullableElement(dateString -> OffsetDateTime.parse(dateString)); + } else if ("SignedService".equals(elementName.getLocalPart())) { + deserializedUserDelegationKey.signedService = reader.getStringElement(); + } else if ("SignedVersion".equals(elementName.getLocalPart())) { + deserializedUserDelegationKey.signedVersion = reader.getStringElement(); + } else if ("Value".equals(elementName.getLocalPart())) { + deserializedUserDelegationKey.value = reader.getStringElement(); + } else { + reader.skipElement(); + } + } + + return deserializedUserDelegationKey; + }); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/package-info.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/package-info.java new file mode 100644 index 000000000000..b26b0d5f392e --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for AzureBlobStorage. + * null. + */ +package com.azure.v2.storage.blob.models; diff --git a/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/package-info.java b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/package-info.java new file mode 100644 index 000000000000..3bd945a879dc --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/main/java/com/azure/v2/storage/blob/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for AzureBlobStorage. + * null. + */ +package com.azure.v2.storage.blob; diff --git a/sdk/storage/azure-storage-blob-v2/src/test/java/com/azure/v2/storage/blob/BlobClientTest.java b/sdk/storage/azure-storage-blob-v2/src/test/java/com/azure/v2/storage/blob/BlobClientTest.java new file mode 100644 index 000000000000..485b026b480a --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/test/java/com/azure/v2/storage/blob/BlobClientTest.java @@ -0,0 +1,35 @@ +package com.azure.v2.storage.blob; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + +public class BlobClientTest { + @Test + public void testDownload() throws IOException { + BlobClient blobClient = new AzureBlobStorageBuilder() + .url("sas-url") + .buildBlobClient(); + + InputStream sampleText = blobClient.download("test-container", "upload.txt", null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null); + + String text = new String(readAllBytes(sampleText)); + System.out.println(text); + } + + public static byte[] readAllBytes(InputStream inputStream) throws IOException { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + int nRead; + byte[] data = new byte[1024]; + + while ((nRead = inputStream.read(data, 0, data.length)) != -1) { + buffer.write(data, 0, nRead); + } + + return buffer.toByteArray(); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/test/java/com/azure/v2/storage/blob/BlockBlobClientTest.java b/sdk/storage/azure-storage-blob-v2/src/test/java/com/azure/v2/storage/blob/BlockBlobClientTest.java new file mode 100644 index 000000000000..9661b5aea6ba --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/test/java/com/azure/v2/storage/blob/BlockBlobClientTest.java @@ -0,0 +1,20 @@ +package com.azure.v2.storage.blob; + +import io.clientcore.core.models.binarydata.BinaryData; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public class BlockBlobClientTest { + @Test + @Disabled + public void testUpload() { + BlockBlobClient blockBlobClient = new AzureBlobStorageBuilder() + .url("sas-url") + .buildBlockBlobClient(); + + String content = "Hello World!"; + blockBlobClient.upload("test-container", "upload.txt", content.length(), BinaryData.fromString(content), null, + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/src/test/java/com/azure/v2/storage/blob/ContainerClientTest.java b/sdk/storage/azure-storage-blob-v2/src/test/java/com/azure/v2/storage/blob/ContainerClientTest.java new file mode 100644 index 000000000000..5fbe51d5cae7 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/src/test/java/com/azure/v2/storage/blob/ContainerClientTest.java @@ -0,0 +1,21 @@ +package com.azure.v2.storage.blob; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public class ContainerClientTest { + @Test + @Disabled + public void testContainerClient() { + ContainerClient containerClient = new AzureBlobStorageBuilder() + .url("sas-url") + .buildContainerClient(); + + containerClient.create("test-container", null, null, null, null, null); + + // This will not work yet as xml serialization is not supported in clientcore. + // Response testcontainer = containerClient.listBlobHierarchySegmentNoCustomHeadersWithResponse("testcontainer", null, null, null, null, null, null, null, null); + // System.out.println(testcontainer.getStatusCode()); + // System.out.println(testcontainer.getValue().getSegment().getBlobItems().get(0)); + } +} diff --git a/sdk/storage/azure-storage-blob-v2/swagger/autorest.md b/sdk/storage/azure-storage-blob-v2/swagger/autorest.md new file mode 100644 index 000000000000..138069712174 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/swagger/autorest.md @@ -0,0 +1,669 @@ +### Code generation settings + +``` yaml +use: '@autorest/java@4.1.39' +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/refs/heads/feature/storage/stg96base2/specification/storage/data-plane/Microsoft.BlobStorage/stable/2025-01-05/blob.json +java: true +output-folder: ../ +namespace: com.azure.v2.storage.blob +service-interface-as-public: true +license-header: MICROSOFT_MIT_SMALL +enable-sync-stack: true +context-client-method-parameter: true +optional-constant-as-enum: true +generic-response-type: true +use-input-stream-for-binary: true +no-custom-headers: true +stream-style-serialization: true +customization-class: src/main/java/StorageCustomization.java +generate-sync-async-clients: true +sync-methods: sync-only +flavor: azurev2 +disable-typed-headers-methods: true +``` + +### /{containerName}/{blob} +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}"] + transform: > + $.get.description = "The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or version."; + $.delete.description = "If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until it is permanently removed. Use the List Blobs API and specify the \"include=deleted\" query parameter to discover which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP status code of 404 (ResourceNotFound). If the storage account's automatic snapshot feature is enabled, then, when a blob is deleted, an automatic snapshot is created. The blob becomes inaccessible immediately. All other operations on the blob causes the service to return an HTTP status code of 404 (ResourceNotFound). You can access automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC permissions."; + $.get.responses["200"].headers["Content-MD5"]["x-ms-client-name"] = "contentMd5"; + $.get.responses["206"].headers["Content-MD5"]["x-ms-client-name"] = "contentMd5"; +``` + + +### /{containerName}/{blob}?comp=appendblock +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=appendblock"] + transform: > + $.put.consumes = ["application/octet-stream"]; +``` + +### /{containerName}/{blob}?comp=copy +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=copy"] + transform: > + $.put.responses["202"].headers["x-ms-version-id"] = { + "x-ms-client-name": "VersionId", + "type": "string", + "description": "UTC date/time value generated by the service that identifies the version of the blob. This header is returned for requests made against version 2018-11-09 and above." + }; + +``` + +### /{containerName}/{blob}?comp=copy&sync +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=copy&sync"] + transform: > + $.put.responses["202"].headers["x-ms-version-id"] = { + "x-ms-client-name": "VersionId", + "type": "string", + "description": "UTC date/time value generated by the service that identifies the version of the blob. This header is returned for requests made against version 2018-11-09 and above." + }; +``` + +### /{containerName}/{blob}?comp=pagelist +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=pagelist"] + transform: > + $.get.description = "The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a page blob"; +``` + +### /{containerName}/{blob}?comp=pagelist&diff +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=pagelist&diff"] + transform: > + $.get.description = "[Update] The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were changed between target blob and previous snapshot or version."; +``` + +### BlobItemInternal +``` yaml +directive: +- from: swagger-document + where: $.definitions.BlobItemInternal + transform: > + if (!$.required.includes("VersionId")) { + $.required.push("VersionId"); + $.properties.Metadata.type = "object"; + $.properties.Metadata.additionalProperties = { "type": "string" }; + delete $.properties.Metadata.$ref; + $.properties.VersionId = { "type": "string" }; + } + $.properties.IsPrefix = { "type": "boolean" }; +``` + +### BlobItemPropertiesInternal and ContainerItemProperties +``` yaml +directive: +- from: swagger-document + where: $.definitions + transform: > + if (!$.BlobContainerItemProperties) { + $.BlobContainerItemProperties = $.ContainerProperties; + delete $.ContainerProperties; + // + const etag = $.BlobContainerItemProperties.properties.Etag; + if (etag && !etag["x-ms-client-name"]) { + etag["x-ms-client-name"] = "eTag"; + $.BlobContainerItemProperties.properties.Etag = etag; + } + $.BlobContainerItemProperties.properties.DenyEncryptionScopeOverride["x-ms-client-name"] = "EncryptionScopeOverridePrevented"; + } + if (!$.BlobContainerItem) { + $.BlobContainerItem = $.ContainerItem; + const path = $.BlobContainerItem.properties.Properties.$ref.replace(/[#].*$/, "#/definitions/BlobContainerItemProperties"); + $.BlobContainerItem.properties.Properties.$ref = path; + delete $.ContainerItem; + } + if (!$.BlobItemPropertiesInternal) { + $.BlobItemPropertiesInternal = $.BlobPropertiesInternal; + delete $.BlobPropertiesInternal; + $.BlobItemPropertiesInternal.properties.CustomerProvidedKeySha256 = { "type": "string" } + $.BlobItemPropertiesInternal.properties["Content-MD5"]["x-ms-client-name"] = "contentMd5"; + const etag = $.BlobItemPropertiesInternal.properties.Etag; + if (etag && !etag["x-ms-client-name"]) { + etag["x-ms-client-name"] = "eTag"; + $.BlobItemPropertiesInternal.properties.Etag = etag; + } + } + if ($.BlobItemInternal) { + const path = $.BlobItemInternal.properties.Properties.$ref.replace(/[#].*$/, "#/definitions/BlobItemPropertiesInternal"); + $.BlobItemInternal.properties.Properties.$ref = path; + } +``` + +### BlobMetadata +Deleting out Encryption until https://github.com/Azure/azure-sdk-for-java/issues/5000 is determined. +``` yaml +directive: +- from: swagger-document + where: $.definitions.BlobMetadata + transform: > + delete $.properties +``` + +### ListBlobsFlatSegmentResponse +``` yaml +directive: +- from: swagger-document + where: $.definitions.ListBlobsFlatSegmentResponse + transform: > + if (!$.required.includes("Prefix")) { + $.required.push("Prefix"); + $.required.push("Marker"); + $.required.push("MaxResults"); + $.required.push("Delimiter"); + $.required.push("NextMarker"); + } +``` + +### ListBlobsHierarchySegmentResponse +``` yaml +directive: +- from: swagger-document + where: $.definitions.ListBlobsHierarchySegmentResponse + transform: > + if (!$.required.includes("Prefix")) { + $.required.push("Prefix"); + $.required.push("Marker"); + $.required.push("MaxResults"); + $.required.push("Delimiter"); + $.required.push("NextMarker"); + } +``` + +### KeyInfo +``` yaml +directive: +- from: swagger-document + where: $.parameters.KeyInfo + transform: > + if ($["x-ms-parameter-location"]) { + delete $["x-ms-parameter-location"]; + } +``` + +### Extra parameters +``` yaml +directive: +- from: swagger-document + where: $.parameters + transform: > + if (!$.CacheControl) { + $.CacheControl = { + "name": "Cache-Control", + "x-ms-client-name": "cacheControl", + "in": "header", + "required": false, + "type": "string", + "x-ms-parameter-location": "method", + "description": "Cache control for given resource" + }; + } +``` + +### Add EncryptionKeySha256 to PageBlobUploadPagesFromURLHeaders +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=page&update&fromUrl"].put.responses["201"].headers + transform: > + if (!$["x-ms-encryption-key-sha256"]) { + $["x-ms-encryption-key-sha256"] = { + "x-ms-client-name": "EncryptionKeySha256", + "type": "string", + "description": "The SHA-256 hash of the encryption key used to encrypt the pages. This header is only returned when the pages were encrypted with a customer-provided key." + }; + } +``` + +### Add IsServerEncrypted to AppendBlobAppendBlockFromUrlHeaders +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=appendblock&fromUrl"].put.responses["201"].headers + transform: > + if (!$["x-ms-request-server-encrypted"]) { + $["x-ms-request-server-encrypted"] = { + "x-ms-client-name": "IsServerEncrypted", + "type": "boolean", + "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." + }; + } +``` + +### Add EncryptionKeySha256 and IsServerEncrypted to PageBlobClearPagesHeaders +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=page&clear"].put.responses["201"].headers + transform: > + if (!$["x-ms-request-server-encrypted"]) { + $["x-ms-request-server-encrypted"] = { + "x-ms-client-name": "IsServerEncrypted", + "type": "boolean", + "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." + }; + } + if (!$["x-ms-encryption-key-sha256"]) { + $["x-ms-encryption-key-sha256"] = { + "x-ms-client-name": "EncryptionKeySha256", + "type": "string", + "description": "The SHA-256 hash of the encryption key used to encrypt the pages. This header is only returned when the pages were encrypted with a customer-provided key." + }; + } +``` + +### Batch returns a 202 +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/?comp=batch"].post.responses + transform: > + const response = $["200"]; + if (response) { + delete $["200"]; + $["202"] = response; + } +``` + +### Rename ListContainersIncludeType to ListBlobContainersIncludeType +``` yaml +directive: +- from: swagger-document + where: $.parameters.ListContainersInclude + transform: > + $["x-ms-client-name"] = "ListBlobContainersIncludeType"; + $["items"]["x-ms-enum"].name = "ListBlobContainersIncludeType"; +``` + +### /?comp=list +``` yaml +directive: +- from: swagger-document + where: $.definitions + transform: > + if (!$.BlobContainersSegment) { + $.BlobContainersSegment = $.ListContainersSegmentResponse; + delete $.ListContainersSegmentResponse; + $.BlobContainersSegment["x-az-public"] = false; + $.BlobContainersSegment.required.push("NextMarker"); + $.BlobContainersSegment.properties.BlobContainerItems = $.BlobContainersSegment.properties.ContainerItems; + delete $.BlobContainersSegment.properties.ContainerItems; + const path = $.BlobContainersSegment.properties.BlobContainerItems.items.$ref.replace(/[#].*$/, "#/definitions/BlobContainerItem"); + $.BlobContainersSegment.properties.BlobContainerItems.items.$ref = path; + } +- from: swagger-document + where: $["x-ms-paths"]["/?comp=list"] + transform: > + const def = $.get.responses["200"].schema; + if (def && def["$ref"] && !def["$ref"].endsWith("BlobContainersSegment")) { + const path = def["$ref"].replace(/[#].*$/, "#/definitions/BlobContainersSegment"); + $.get.responses["200"].schema = { "$ref": path }; + } + $.get.operationId = "Service_ListBlobContainersSegment"; +``` + +### GeoReplication +``` yaml +directive: +- from: swagger-document + where: $.definitions.GeoReplication.properties.Status + transform: > + $["x-ms-enum"].name = "GeoReplicationStatus"; +``` + +### BlobErrorCode +``` yaml +directive: +- from: swagger-document + where: $.definitions.ErrorCode + transform: > + $["x-ms-enum"].name = "BlobErrorCode"; +``` + +### Typo Fixed in ErrorCode Removed Enum Value +``` yaml +directive: +- from: swagger-document + where: $.definitions.ErrorCode + transform: > + $.enum.push("SnaphotOperationRateExceeded"); + $.enum.push("IncrementalCopyOfEralierVersionSnapshotNotAllowed"); +``` + +### BlobServiceProperties, BlobAnalyticsLogging, BlobMetrics, BlobCorsRule, and BlobRetentionPolicy +``` yaml +directive: +- rename-model: + from: Logging + to: BlobAnalyticsLogging +- rename-model: + from: Metrics + to: BlobMetrics +- rename-model: + from: CorsRule + to: BlobCorsRule +- rename-model: + from: RetentionPolicy + to: BlobRetentionPolicy +- rename-model: + from: StorageServiceProperties + to: BlobServiceProperties + +- from: swagger-document + where: $.definitions + transform: > + $.BlobMetrics.properties.IncludeAPIs["x-ms-client-name"] = "IncludeApis"; + delete $.BlobRetentionPolicy.properties.AllowPermanentDelete; + $.BlobServiceProperties.xml = {"name": "StorageServiceProperties"}; + $.BlobCorsRule.xml = {"name": "CorsRule"}; + +- from: swagger-document + where: $.parameters + transform: > + $.StorageServiceProperties.name = "BlobServiceProperties"; +``` + +### BlobServiceStatistics and BlobPrefixInternal +``` yaml +directive: +- rename-model: + from: StorageServiceStats + to: BlobServiceStatistics +- rename-model: + from: BlobPrefix + to: BlobPrefixInternal + +- from: swagger-document + where: $.definitions + transform: > + $.BlobServiceStatistics.xml = { "name": "StorageServiceStats" }; + $.BlobPrefixInternal.xml = { "name": "BlobPrefix" }; +``` + +### BlobAccessPolicy and BlobSignedIdentifier +``` yaml +directive: +- rename-model: + from: SignedIdentifier + to: BlobSignedIdentifier +- rename-model: + from: AccessPolicy + to: BlobAccessPolicy +- from: swagger-document + where: $.definitions + transform: > + $.BlobAccessPolicy.properties.Start["x-ms-client-name"] = "StartsOn"; + $.BlobAccessPolicy.properties.Expiry["x-ms-client-name"] = "ExpiresOn"; + $.BlobAccessPolicy.properties.Permission["x-ms-client-name"] = "Permissions"; +``` + +### Rename BlobHttpHeaders to BlobHttpHeader +``` yaml +directive: +- from: swagger-document + where: $.parameters + transform: > + $.BlobCacheControl["x-ms-parameter-grouping"].name = "blob-http-headers"; + $.BlobCacheControl["x-ms-client-name"] = "cacheControl"; + $.BlobContentDisposition["x-ms-parameter-grouping"].name = "blob-http-headers"; + $.BlobContentDisposition["x-ms-client-name"] = "contentDisposition"; + $.BlobContentEncoding["x-ms-parameter-grouping"].name = "blob-http-headers"; + $.BlobContentEncoding["x-ms-client-name"] = "contentEncoding"; + $.BlobContentLanguage["x-ms-parameter-grouping"].name = "blob-http-headers"; + $.BlobContentLanguage["x-ms-client-name"] = "contentLanguage"; + $.BlobContentMD5["x-ms-parameter-grouping"].name = "blob-http-headers"; + $.BlobContentMD5["x-ms-client-name"] = "contentMd5"; + $.BlobContentMD5.description = "Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks were validated when each was uploaded. The value does not need to be base64 encoded as the SDK will perform the encoding."; + $.BlobContentType["x-ms-parameter-grouping"].name = "blob-http-headers"; + $.BlobContentType["x-ms-client-name"] = "contentType"; +``` + +### Rename UserDelegationKey SignedOid and SignedTid +``` yaml +directive: +- from: swagger-document + where: $.definitions.UserDelegationKey + transform: > + $.properties.SignedOid["x-ms-client-name"] = "signedObjectId"; + $.properties.SignedTid["x-ms-client-name"] = "signedTenantId"; +``` + +### Remove AccessConditions parameter groupings +``` yaml +directive: +- from: swagger-document + where: $.parameters + transform: > + delete $.SourceIfMatch["x-ms-parameter-grouping"]; + delete $.SourceIfModifiedSince["x-ms-parameter-grouping"]; + delete $.SourceIfNoneMatch["x-ms-parameter-grouping"]; + delete $.SourceIfUnmodifiedSince["x-ms-parameter-grouping"]; + delete $.SourceIfTags["x-ms-parameter-grouping"]; +- from: swagger-document + where: $.parameters + transform: > + delete $.IfMatch["x-ms-parameter-grouping"]; + delete $.IfModifiedSince["x-ms-parameter-grouping"]; + delete $.IfNoneMatch["x-ms-parameter-grouping"]; + delete $.IfUnmodifiedSince["x-ms-parameter-grouping"]; + delete $.IfTags["x-ms-parameter-grouping"]; +- from: swagger-document + where: $.parameters + transform: > + delete $.BlobConditionAppendPos["x-ms-parameter-grouping"]; + delete $.BlobConditionMaxSize["x-ms-parameter-grouping"]; +- from: swagger-document + where: $.parameters + transform: > + delete $.IfSequenceNumberEqualTo["x-ms-parameter-grouping"]; + delete $.IfSequenceNumberLessThan["x-ms-parameter-grouping"]; + delete $.IfSequenceNumberLessThanOrEqualTo["x-ms-parameter-grouping"]; +- from: swagger-document + where: $.parameters + transform: > + delete $.LeaseIdOptional["x-ms-parameter-grouping"]; +``` + +### Rename container-cpk-scope-info to blob-container-encryption-scope +``` yaml +directive: +- from: swagger-document + where: $.parameters + transform: > + $.DenyEncryptionScopeOverride["x-ms-client-name"] = "EncryptionScopeOverridePrevented"; + $.DefaultEncryptionScope["x-ms-parameter-grouping"]["name"] = "blob-container-encryption-scope"; + $.DenyEncryptionScopeOverride["x-ms-parameter-grouping"]["name"] = "blob-container-encryption-scope"; +``` + +### Rename cpk-scope-info to encryption-scope +``` yaml +directive: +- from: swagger-document + where: $.parameters + transform: > + $.EncryptionScope["x-ms-parameter-grouping"]["name"] = "encryption-scope"; +``` + +### Block size int to long transition +``` yaml +directive: +- from: swagger-document + where: $.definitions.Block + transform: > + $.properties.Size["x-ms-client-name"] = "sizeLong"; + $.properties.Size["format"] = "int64"; + $.properties.SizeInt = { "type" : "integer" }; + $.required.push("SizeInt"); +``` + +### /{containerName}/{blob}?comp=query +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=query"] + transform: > + $.post.responses["200"].headers["Content-MD5"]["x-ms-client-name"] = "contentMd5"; + $.post.responses["206"].headers["Content-MD5"]["x-ms-client-name"] = "contentMd5"; + $.post.responses["200"].headers["x-ms-blob-content-md5"]["x-ms-client-name"] = "blobContentMd5"; + $.post.responses["206"].headers["x-ms-blob-content-md5"]["x-ms-client-name"] = "blobContentMd5"; + $.post.responses["200"].headers["x-ms-server-encrypted"]["x-ms-client-name"] = "serverEncrypted"; + $.post.responses["206"].headers["x-ms-server-encrypted"]["x-ms-client-name"] = "serverEncrypted"; +``` + +### Hide TagValue in FilterBlobItem +``` yaml +directive: +- from: swagger-document + where: $.definitions + transform: > + delete $.FilterBlobItem.properties.TagValue; +``` + +### Service_ListContainersSegment x-ms-pageable itemName +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/?comp=list"].get + transform: > + $["x-ms-pageable"].itemName = "BlobContainerItems"; +``` + + +### Delete Container_ListBlobFlatSegment x-ms-pageable as autorest can't recognize the itemName for this +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?restype=container&comp=list&flat"].get + transform: > + delete $["x-ms-pageable"]; +``` + +### Delete Container_ListBlobHierarchySegment x-ms-pageable as autorest can't recognize the itemName for this +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?restype=container&comp=list&hierarchy"].get + transform: > + delete $["x-ms-pageable"]; +``` + +### BlobDeleteType expandable string enum +``` yaml +directive: +- from: swagger-document + where: $.parameters.BlobDeleteType + transform: > + $["x-ms-enum"].modelAsString = true; +``` + +### Delete PageBlob_GetPageRanges x-ms-pageable as autorest can't recognize the itemName for this +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=pagelist"].get + transform: > + delete $["x-ms-pageable"]; +``` + +### Delete PageList_GetPageRangesDiff x-ms-pageable as autorest can't recognize the itemName for this +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=pagelist&diff"].get + transform: > + delete $["x-ms-pageable"]; +``` + +### BlobCopySourceTags expandable string enum and rename +``` yaml +directive: +- from: swagger-document + where: $.parameters.CopySourceTags + transform: > + $["x-ms-enum"].modelAsString = true; + $["x-ms-enum"].name = "BlobCopySourceTagsMode"; +``` + +### Fix putBlobFromUrl Apostrophe +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?BlockBlob&fromUrl"].put + transform: > + $.description = "The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial updates to a block blob's contents using a source URL, use the Put Block from URL API in conjunction with Put Block List."; +``` + +### Rename ListBlobsIncludeItem Enums to be underscore cased +```yaml +directive: + - from: swagger-document + where: $.parameters.ListBlobsInclude + transform: > + $.items["x-ms-enum"].values = [ + { + "value": "copy", + "name": "copy", + "description": "" + }, + { + "value": "deleted", + "name": "deleted", + "description": "" + }, + { + "value": "metadata", + "name": "metadata", + "description": "" + }, + { + "value": "snapshots", + "name": "snapshots", + "description": "" + }, + { + "value": "uncommittedblobs", + "name": "uncommittedblobs", + "description": "" + }, + { + "value": "versions", + "name": "versions", + "description": "" + }, + { + "value": "tags", + "name": "tags", + "description": "" + }, + { + "value": "immutabilitypolicy", + "name": "immutability_policy", + "description": "" + }, + { + "value": "legalhold", + "name": "legal_hold", + "description": "" + }, + { + "value": "deletedwithversions", + "name": "deleted_with_versions", + "description": "" + } + ]; +``` diff --git a/sdk/storage/azure-storage-blob-v2/swagger/pom.xml b/sdk/storage/azure-storage-blob-v2/swagger/pom.xml new file mode 100644 index 000000000000..56ba4d21e02f --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/swagger/pom.xml @@ -0,0 +1,17 @@ + + + + + com.azure + azure-code-customization-parent + 1.0.0-beta.1 + ../../../parents/azure-code-customization-parent + + + com.azure + azure-storage-blob-customization-v2 + 1.0.0-beta.1 + 4.0.0 + diff --git a/sdk/storage/azure-storage-blob-v2/swagger/src/main/java/StorageCustomization.java b/sdk/storage/azure-storage-blob-v2/swagger/src/main/java/StorageCustomization.java new file mode 100644 index 000000000000..7f64caa2a616 --- /dev/null +++ b/sdk/storage/azure-storage-blob-v2/swagger/src/main/java/StorageCustomization.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import com.azure.autorest.customization.ClassCustomization; +import com.azure.autorest.customization.Customization; +import com.azure.autorest.customization.JavadocCustomization; +import com.azure.autorest.customization.LibraryCustomization; +import com.azure.autorest.customization.PackageCustomization; +import com.github.javaparser.ParseProblemException; +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.CatchClause; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.stmt.TryStmt; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import com.github.javaparser.ast.type.Type; +import org.slf4j.Logger; + +import java.util.Arrays; +import java.util.List; + +/** + * Customization class for Blob Storage. + */ +public class StorageCustomization extends Customization { + @Override + public void customize(LibraryCustomization customization, Logger logger) { + + // Implementation models customizations + PackageCustomization implementationModels = customization.getPackage("com.azure.v2.storage.blob.models"); + + //QueryFormat + customizeQueryFormat(implementationModels.getClass("QueryFormat")); + } + + private static void customizeQueryFormat(ClassCustomization classCustomization) { + String fileContent = classCustomization.getEditor().getFileContent(classCustomization.getFileName()); + fileContent = fileContent.replace("xmlWriter.nullElement(\"ParquetTextConfiguration\", this.parquetTextConfiguration);", + "xmlWriter.writeStartElement(\"ParquetTextConfiguration\").writeEndElement();"); + fileContent = fileContent.replace("deserializedQueryFormat.parquetTextConfiguration = reader.null;", + "deserializedQueryFormat.parquetTextConfiguration = new Object();\nxmlReader.skipElement();"); + classCustomization.getEditor().replaceFile(classCustomization.getFileName(), fileContent); + } +} 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 5c4b16b3b9e9..5693b17ca5c6 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 @@ -4,6 +4,7 @@ package com.azure.storage.blob; import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.HttpPipeline; import com.azure.core.http.rest.Response; @@ -82,6 +83,7 @@ * Azure * Docs for more information. */ +@ServiceClient(builder = BlobClientBuilder.class, isAsync = true) public class BlobAsyncClient extends BlobAsyncClientBase { /** * The block size to use if none is specified in parallel operations. 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 7254a4568737..026fb0f15bc1 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 @@ -4,6 +4,7 @@ package com.azure.storage.blob.specialized; import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpResponse; @@ -22,6 +23,7 @@ import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollResponse; import com.azure.core.util.polling.PollerFlux; +import com.azure.storage.blob.BlobClientBuilder; import com.azure.storage.blob.BlobContainerAsyncClient; import com.azure.storage.blob.BlobContainerClientBuilder; import com.azure.storage.blob.BlobServiceAsyncClient; @@ -125,6 +127,7 @@ * This client offers the ability to download blobs. Note that uploading data is specific to each type of blob. Please * refer to the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link AppendBlobClient} for upload options. */ +@ServiceClient(builder = BlobClientBuilder.class, isAsync = true) public class BlobAsyncClientBase { private static final ClientLogger LOGGER = new ClientLogger(BlobAsyncClientBase.class); 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 e2211b71e785..051fa74765db 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 @@ -4,6 +4,7 @@ package com.azure.storage.blob.specialized; import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpResponse; @@ -20,6 +21,7 @@ import com.azure.core.util.polling.PollResponse; import com.azure.core.util.polling.PollingContext; import com.azure.core.util.polling.SyncPoller; +import com.azure.storage.blob.BlobClientBuilder; import com.azure.storage.blob.BlobContainerClient; import com.azure.storage.blob.BlobContainerClientBuilder; import com.azure.storage.blob.BlobServiceClient; @@ -132,6 +134,7 @@ * This client offers the ability to download blobs. Note that uploading data is specific to each type of blob. Please * refer to the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link AppendBlobClient} for upload options. */ +@ServiceClient(builder = BlobClientBuilder.class) public class BlobClientBase { private static final ClientLogger LOGGER = new ClientLogger(BlobClientBase.class); private static final Set DEFAULT_OPEN_OPTIONS_SET = Collections.unmodifiableSet( diff --git a/sdk/storage/azure-storage-stress-v2/pom.xml b/sdk/storage/azure-storage-stress-v2/pom.xml new file mode 100644 index 000000000000..c5e78540333b --- /dev/null +++ b/sdk/storage/azure-storage-stress-v2/pom.xml @@ -0,0 +1,70 @@ + + + 4.0.0 + + com.azure.v2 + azure-storage-stress-v2 + jar + 1.0.0-beta.1 + + + UTF-8 + UTF-8 + + + 1.8 + 1.8 + + + - + + + + + ch.qos.logback + logback-classic + 1.3.14 + + + com.azure + azure-core-v2 + 1.0.0-beta.1 + + + com.azure + perf-test-core + 1.0.0-beta.1 + + + + + com.azure + azure-monitor-opentelemetry-autoconfigure + 1.0.0-beta.2 + + + io.opentelemetry.instrumentation + opentelemetry-runtime-telemetry-java8 + 2.12.0-alpha + + + io.opentelemetry.instrumentation + opentelemetry-logback-appender-1.0 + 2.12.0-alpha + + + com.azure + azure-core-metrics-opentelemetry + 1.0.0-beta.26 + + + + com.azure + azure-core-tracing-opentelemetry + 1.0.0-beta.53 + + + + diff --git a/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/ContentInfo.java b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/ContentInfo.java new file mode 100644 index 000000000000..442b675e2736 --- /dev/null +++ b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/ContentInfo.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.stress; + +import io.clientcore.core.models.binarydata.BinaryData; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.nio.ByteBuffer; +import java.util.concurrent.atomic.AtomicLong; +import java.util.zip.CRC32; + +public class ContentInfo { + private final long length; + private final long crc; + private final ByteBuffer head; + + ContentInfo(long crc, long length, ByteBuffer head) { + this.crc = crc; + this.length = length; + this.head = head; + } + + // Helper method to update the CRC, length, and head + private static void processBuffer(ByteBuffer bb, CRC32 crc, AtomicLong length, ByteBuffer head) { + int remaining = bb.remaining(); + length.getAndAdd(remaining); + + if (head.hasRemaining()) { + int toRead = Math.min(head.remaining(), remaining); + byte[] temp = new byte[toRead]; + // Read bytes from bb into temp + bb.get(temp, 0, toRead); + head.put(temp); + } + + // Rewind the buffer to update CRC with all data + bb.rewind(); + byte[] crcTemp = new byte[bb.remaining()]; + bb.get(crcTemp); + crc.update(crcTemp, 0, crcTemp.length); + } + + public static Mono fromFluxByteBuffer(Flux data) { + AtomicLong length = new AtomicLong(0); + CRC32 crc = new CRC32(); + ByteBuffer head = ByteBuffer.allocate(1024); + + return data + .doOnNext(bb -> processBuffer(bb.duplicate(), crc, length, head)) + .then(Mono.fromCallable(() -> new ContentInfo(crc.getValue(), length.get(), (ByteBuffer) head.flip()))); + } + + public static ContentInfo fromBinaryData(BinaryData data) { + ByteBuffer bb = data.toByteBuffer(); + AtomicLong length = new AtomicLong(0); + CRC32 crc = new CRC32(); + ByteBuffer head = ByteBuffer.allocate(1024); + + processBuffer(bb, crc, length, head); + + return new ContentInfo(crc.getValue(), length.get(), (ByteBuffer) head.flip()); + } + + public long getLength() { + return length; + } + + public long getCrc() { + return crc; + } + + public ByteBuffer getHead() { + return head; + } +} diff --git a/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/ContentMismatchException.java b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/ContentMismatchException.java new file mode 100644 index 000000000000..4302e35f820c --- /dev/null +++ b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/ContentMismatchException.java @@ -0,0 +1,7 @@ +package com.azure.v2.storage.stress; + +public class ContentMismatchException extends RuntimeException { + public ContentMismatchException() { + super("crc mismatch"); + } +} diff --git a/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/CrcInputStream.java b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/CrcInputStream.java new file mode 100644 index 000000000000..2447be41fe89 --- /dev/null +++ b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/CrcInputStream.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.stress; + +import com.azure.core.exception.UnexpectedLengthException; +import com.azure.core.util.FluxUtil; +import io.clientcore.core.instrumentation.logging.ClientLogger; +import io.clientcore.core.models.binarydata.BinaryData; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.core.publisher.Sinks; + +import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; +import java.nio.ByteBuffer; +import java.util.zip.CRC32; + +public class CrcInputStream extends InputStream { + private final static com.azure.core.util.logging.ClientLogger OLD_LOGGER = + new com.azure.core.util.logging.ClientLogger(CrcInputStream.class); + private final static ClientLogger LOGGER = new ClientLogger(CrcInputStream.class); + private final Sinks.One sink = Sinks.one(); + private final InputStream inputStream; + private final CRC32 crc = new CRC32(); + private final ByteBuffer head = ByteBuffer.allocate(1024); + private final boolean markSupported; + private long markPosition = -1; + private long length = 0; + private long size; + + public CrcInputStream(BinaryData source, long size) { + this.inputStream = new RepeatingInputStream(source, size); + this.markSupported = true; + this.size = size; + } + + public CrcInputStream(InputStream source) { + this.inputStream = source; + this.markSupported = source.markSupported(); + } + + @Override + public synchronized int read() throws IOException { + int b = inputStream.read(); + if (b >= 0) { + crc.update(b); + if (head.hasRemaining()) { + head.put((byte) b); + } + length++; + } else { + sink.emitValue(new ContentInfo(crc.getValue(), length, head), Sinks.EmitFailureHandler.FAIL_FAST); + } + return b; + } + + @Override + public synchronized int read(byte buf[], int off, int len) throws IOException { + int read = inputStream.read(buf, off, len); + if (read >= 0) { + length += read; + crc.update(buf, off, read); + if (head.hasRemaining()) { + head.put(buf, off, Math.min(read, head.remaining())); + } + } else { + sink.emitValue(new ContentInfo(crc.getValue(), length, head), Sinks.EmitFailureHandler.FAIL_FAST); + } + return read; + } + + @Override + public synchronized void mark(int readLimit) { + if (markSupported) { + inputStream.mark(readLimit); + markPosition = length; + } + } + + @Override + public synchronized void reset() throws IOException { + if (markPosition != -1) { + inputStream.reset(); + length = markPosition; // Reset length to markPosition + crc.reset(); // Reset CRC32 to recalculate from the markPosition + head.clear(); // Clear the head buffer + } else { + throw new IOException("Mark/reset not supported or mark not set"); + } + } + + @Override + public boolean markSupported() { + return markSupported; + } + + public Mono getContentInfo() { + return sink.asMono(); + } + + @Override + public void close() { + try { + inputStream.close(); + } catch (IOException e) { + throw LOGGER.logThrowableAsError(new UncheckedIOException(e)); + } + } + + public Flux convertStreamToByteBuffer() { + int blockSize = 4 * 1024 * 1024; + inputStream.mark(Integer.MAX_VALUE); + + if (size == 0) { + try { + if (inputStream.read() != -1) { + long totalLength = 1 + inputStream.available(); + return FluxUtil.fluxError(OLD_LOGGER, new UnexpectedLengthException(String.format( + "Request body emitted %d bytes, more than the expected %d bytes.", totalLength, size), + totalLength, size)); + } + } catch (IOException e) { + return FluxUtil.fluxError(OLD_LOGGER, new UncheckedIOException(e)); + } + } + + return Flux.defer(() -> { + /* + * If the request needs to be retried, the flux will be resubscribed to. The stream and counter must be + * reset in order to correctly return the same data again. + */ + try { + inputStream.reset(); + } catch (IOException e) { + return FluxUtil.fluxError(OLD_LOGGER, new UncheckedIOException(e)); + } + + final long[] currentTotalLength = new long[1]; + return Flux.generate(() -> inputStream, (is, sink) -> { + long pos = currentTotalLength[0]; + + long count = (pos + blockSize) > size ? (size - pos) : blockSize; + byte[] cache = new byte[(int) count]; + + int numOfBytes = 0; + int offset = 0; + // Revise the casting if the max allowed network data transmission is over 2G. + int len = (int) count; + + while (numOfBytes != -1 && offset < count) { + try { + numOfBytes = inputStream.read(cache, offset, len); + if (numOfBytes != -1) { + offset += numOfBytes; + len -= numOfBytes; + currentTotalLength[0] += numOfBytes; + } + } catch (IOException e) { + sink.error(e); + return is; + } + } + + if (numOfBytes == -1 && currentTotalLength[0] < size) { + sink.error(LOGGER.logThrowableAsError(new UnexpectedLengthException(String.format( + "Request body emitted %d bytes, less than the expected %d bytes.", + currentTotalLength[0], size), currentTotalLength[0], size))); + return is; + } + + // Validate that stream isn't longer. + if (currentTotalLength[0] >= size) { + try { + if (inputStream.read() != -1) { + long totalLength = 1 + currentTotalLength[0] + inputStream.available(); + sink.error(LOGGER.logThrowableAsError(new UnexpectedLengthException( + String.format("Request body emitted %d bytes, more than the expected %d bytes.", + totalLength, size), totalLength, size))); + return is; + } else if (currentTotalLength[0] > size) { + sink.error(LOGGER.logThrowableAsError(new IllegalStateException( + String.format("Read more data than was requested. Size of data read: %d. Size of data" + + " requested: %d", currentTotalLength[0], size)))); + return is; + } + } catch (IOException e) { + sink.error(LOGGER.logThrowableAsError(new RuntimeException("I/O errors occurred", e))); + return is; + } + } + + sink.next(ByteBuffer.wrap(cache, 0, offset)); + if (currentTotalLength[0] == size) { + sink.complete(); + } + return is; + }); + }); + } +} diff --git a/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/CrcOutputStream.java b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/CrcOutputStream.java new file mode 100644 index 000000000000..e648f1510c6c --- /dev/null +++ b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/CrcOutputStream.java @@ -0,0 +1,42 @@ +package com.azure.v2.storage.stress; + +import reactor.core.publisher.Mono; +import reactor.core.publisher.Sinks; + +import java.io.IOException; +import java.io.OutputStream; +import java.nio.ByteBuffer; +import java.util.zip.CRC32; + +public class CrcOutputStream extends OutputStream { + private final Sinks.One sink = Sinks.one(); + private final CRC32 crc = new CRC32(); + private long length = 0; + private final ByteBuffer head = ByteBuffer.allocate(1024); + @Override + public synchronized void write(int b) { + crc.update(b); + if (head.hasRemaining()) { + head.put((byte)b); + } + length ++; + } + + public synchronized void write(byte buf[], int off, int len) { + crc.update(buf, off, len); + if (head.hasRemaining()) { + head.put(buf, off, Math.min(len, head.remaining())); + } + length += len; + } + + @Override + public void close() throws IOException { + sink.emitValue(new ContentInfo(crc.getValue(), length, head), Sinks.EmitFailureHandler.FAIL_FAST); + super.close(); + } + + public Mono getContentInfo() { + return sink.asMono(); + } +} diff --git a/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/FaultInjectingHttpPolicy.java b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/FaultInjectingHttpPolicy.java new file mode 100644 index 000000000000..efa99a648319 --- /dev/null +++ b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/FaultInjectingHttpPolicy.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.stress; + +import io.clientcore.core.http.models.HttpHeaderName; +import io.clientcore.core.http.models.HttpRequest; +import io.clientcore.core.http.models.Response; +import io.clientcore.core.http.pipeline.HttpPipelineNextPolicy; +import io.clientcore.core.http.pipeline.HttpPipelinePolicy; +import io.clientcore.core.implementation.http.HttpResponse; +import io.clientcore.core.instrumentation.logging.ClientLogger; +import io.clientcore.core.utils.UriBuilder; +import reactor.util.function.Tuple2; +import reactor.util.function.Tuples; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.List; + +public class FaultInjectingHttpPolicy implements HttpPipelinePolicy { + private static final ClientLogger LOGGER = new ClientLogger(FaultInjectingHttpPolicy.class); + private static final HttpHeaderName TRACEPARENT_HEADER = HttpHeaderName.fromString("traceparent"); + private static final HttpHeaderName UPSTREAM_URI_HEADER = HttpHeaderName.fromString("X-Upstream-Base-Uri"); + private static final HttpHeaderName HTTP_FAULT_INJECTOR_RESPONSE_HEADER = HttpHeaderName.fromString("x-ms-faultinjector-response-option"); + private static final HttpHeaderName SERVER_REQUEST_ID_HEADER = HttpHeaderName.fromString("x-ms-request-id"); + private static final HttpHeaderName X_MS_CLIENT_REQUEST_ID = HttpHeaderName.fromString("x-ms-client-request-id"); + + private final boolean https; + private final List> probabilities; + + public FaultInjectingHttpPolicy(boolean https, FaultInjectionProbabilities probabilities, boolean isUploadFaultsEnabled) { + this.https = https; + this.probabilities = new ArrayList<>(); + + if (isUploadFaultsEnabled) { + addRequestFaultedProbabilities(probabilities); + } else { + addResponseFaultedProbabilities(probabilities); + } + } + + // May remove later since this is for local debugging only. + private static void logResponse(String faultType, HttpRequest request, HttpResponse response) { + LOGGER.atInfo() + .addKeyValue(HTTP_FAULT_INJECTOR_RESPONSE_HEADER.getCaseInsensitiveName(), faultType) + .addKeyValue(X_MS_CLIENT_REQUEST_ID.getCaseInsensitiveName(), request.getHeaders().getValue(X_MS_CLIENT_REQUEST_ID)) + .addKeyValue(SERVER_REQUEST_ID_HEADER.getCaseInsensitiveName(), response == null ? null : response.getHeaders().getValue(SERVER_REQUEST_ID_HEADER)) + .addKeyValue(TRACEPARENT_HEADER.getCaseInsensitiveName(), request.getHeaders().getValue(TRACEPARENT_HEADER)) + .addKeyValue("responseCode", response == null ? null : response.getStatusCode()) + .log("HTTP response with fault injection"); + } + + private URI rewriteUrl(URI originalUrl) { + try { + return UriBuilder.parse(originalUrl) + .setScheme(https ? "https" : "http") + .setHost("localhost") + .setPort(https ? 7778 : 7777) + .toUri(); + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } + } + + private String faultInjectorHandling() { + double random = Math.random(); + double sum = 0d; + + for (Tuple2 tup : probabilities) { + if (random < sum + tup.getT1()) { + return tup.getT2(); + } + + sum += tup.getT1(); + } + + return "f"; + } + + @Override + public Response process(HttpRequest request, HttpPipelineNextPolicy next) { + URI originalUrl = request.getUri(); + + String faultType = injectFault(request); + try { + logResponse(faultType, request, null); + + return cleanup(next.process(), originalUrl); + } catch (Exception e) { + logResponse(faultType, request, null); + + throw e; + } + } + + private String injectFault(HttpRequest request) { + URI originalUrl = request.getUri(); + + request.getHeaders().set(UPSTREAM_URI_HEADER, originalUrl.toString()); + request.setUri(rewriteUrl(originalUrl)); + + String faultType = faultInjectorHandling(); + + request.getHeaders().set(HTTP_FAULT_INJECTOR_RESPONSE_HEADER, faultType); + + return faultType; + } + + private Response cleanup(Response response, URI originalUri) { + response.getRequest().setUri(originalUri); + response.getRequest().getHeaders().remove(UPSTREAM_URI_HEADER); + + return response; + } + + private void addRequestFaultedProbabilities(FaultInjectionProbabilities probabilities) { + // pq: Partial Request (full headers, 50% of body), then wait indefinitely + // pqc: Partial Request (full headers, 50% of body), then close (TCP FIN) + // pqa: Partial Request (full headers, 50% of body), then abort (TCP RST) + // nq: No Request, then wait indefinitely + // nqc: No Request, then close (TCP FIN) + // nqa: No Request, then abort (TCP RST) + this.probabilities.add(Tuples.of(probabilities.getPartialRequestIndefinite(), "pq")); + this.probabilities.add(Tuples.of(probabilities.getPartialRequestClose(), "pqc")); + this.probabilities.add(Tuples.of(probabilities.getPartialRequestAbort(), "pqa")); + this.probabilities.add(Tuples.of(probabilities.getNoRequestIndefinite(), "nq")); + this.probabilities.add(Tuples.of(probabilities.getNoRequestClose(), "nqc")); + this.probabilities.add(Tuples.of(probabilities.getNoRequestAbort(), "nqa")); + } + + private void addResponseFaultedProbabilities(FaultInjectionProbabilities probabilities) { + // f: Full response + // p: Partial Response (full headers, 50% of body), then wait indefinitely + // pc: Partial Response (full headers, 50% of body), then close (TCP FIN) + // pa: Partial Response (full headers, 50% of body), then abort (TCP RST) + // pn: Partial Response (full headers, 50% of body), then finish normally + // n: No response, then wait indefinitely + // nc: No response, then close (TCP FIN) + // na: No response, then abort (TCP RST) + this.probabilities.add(Tuples.of(probabilities.getPartialResponseIndefinite(), "p")); + this.probabilities.add(Tuples.of(probabilities.getPartialResponseClose(), "pc")); + this.probabilities.add(Tuples.of(probabilities.getPartialResponseAbort(), "pa")); + this.probabilities.add(Tuples.of(probabilities.getPartialResponseFinishNormal(), "pn")); + this.probabilities.add(Tuples.of(probabilities.getNoResponseIndefinite(), "n")); + this.probabilities.add(Tuples.of(probabilities.getNoResponseClose(), "nc")); + this.probabilities.add(Tuples.of(probabilities.getNoResponseAbort(), "na")); + } +} diff --git a/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/FaultInjectionProbabilities.java b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/FaultInjectionProbabilities.java new file mode 100644 index 000000000000..8d1f36e29c24 --- /dev/null +++ b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/FaultInjectionProbabilities.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.stress; + +public class FaultInjectionProbabilities { + // f: Full response + // p: Partial Response (full headers, 50% of body), then wait indefinitely + // pc: Partial Response (full headers, 50% of body), then close (TCP FIN) + // pa: Partial Response (full headers, 50% of body), then abort (TCP RST) + // pn: Partial Response (full headers, 50% of body), then finish normally + // n: No response, then wait indefinitely + // nc: No response, then close (TCP FIN) + // na: No response, then abort (TCP RST) + private double noResponseIndefinite; + private double noResponseClose; + private double noResponseAbort; + private double partialResponseIndefinite; + private double partialResponseClose; + private double partialResponseAbort; + private double partialResponseFinishNormal; + // pq: Partial Request (full headers, 50% of body), then wait indefinitely + // pqc: Partial Request (full headers, 50% of body), then close (TCP FIN) + // pqa: Partial Request (full headers, 50% of body), then abort (TCP RST) + // nq: No Request, then wait indefinitely + // nqc: No Request, then close (TCP FIN) + // nqa: No Request, then abort (TCP RST) + private double partialRequestIndefinite; + private double partialRequestClose; + private double partialRequestAbort; + private double noRequestIndefinite; + private double noRequestClose; + private double noRequestAbort; + + private double getExistingSum() { + return noResponseIndefinite + noResponseClose + noResponseAbort + partialResponseIndefinite + + partialResponseClose + partialResponseAbort + partialResponseFinishNormal; + } + private void validateProbabilityChange(double netChange) { + double newSum = getExistingSum() + netChange; + if (newSum > 1d) { + throw new IllegalStateException(String.format("Probability sum cannot exceed 1. Got %4f.", newSum)); + } + } + + public double getNoResponseIndefinite() { + return noResponseIndefinite; + } + + public FaultInjectionProbabilities setNoResponseIndefinite(double noResponseIndefinite) { + validateProbabilityChange(noResponseIndefinite - this.noResponseIndefinite); + this.noResponseIndefinite = noResponseIndefinite; + return this; + } + + public double getNoResponseClose() { + return noResponseClose; + } + + public FaultInjectionProbabilities setNoResponseClose(double noResponseClose) { + validateProbabilityChange(noResponseClose - this.noResponseClose); + this.noResponseClose = noResponseClose; + return this; + } + + public double getNoResponseAbort() { + return noResponseAbort; + } + + public FaultInjectionProbabilities setNoResponseAbort(double noResponseAbort) { + validateProbabilityChange(noResponseAbort - this.noResponseAbort); + this.noResponseAbort = noResponseAbort; + return this; + } + + public double getPartialResponseIndefinite() { + return partialResponseIndefinite; + } + + public FaultInjectionProbabilities setPartialResponseIndefinite(double partialResponseIndefinite) { + validateProbabilityChange(partialResponseIndefinite - this.partialResponseIndefinite); + this.partialResponseIndefinite = partialResponseIndefinite; + return this; + } + + public double getPartialResponseClose() { + return partialResponseClose; + } + + public FaultInjectionProbabilities setPartialResponseClose(double partialResponseClose) { + validateProbabilityChange(partialResponseClose - this.partialResponseClose); + this.partialResponseClose = partialResponseClose; + return this; + } + + public double getPartialResponseAbort() { + return partialResponseAbort; + } + + public FaultInjectionProbabilities setPartialResponseAbort(double partialResponseAbort) { + validateProbabilityChange(partialResponseAbort - this.partialResponseAbort); + this.partialResponseAbort = partialResponseAbort; + return this; + } + + public double getPartialResponseFinishNormal() { + return partialResponseFinishNormal; + } + + public FaultInjectionProbabilities setPartialResponseFinishNormal(double partialResponseFinishNormal) { + validateProbabilityChange(partialResponseFinishNormal - this.partialResponseFinishNormal); + this.partialResponseFinishNormal = partialResponseFinishNormal; + return this; + } + + public double getPartialRequestIndefinite() { + return partialRequestIndefinite; + } + + public FaultInjectionProbabilities setPartialRequestIndefinite(double partialRequestIndefinite) { + validateProbabilityChange(partialRequestIndefinite - this.partialRequestIndefinite); + this.partialRequestIndefinite = partialRequestIndefinite; + return this; + } + + public double getPartialRequestClose() { + return partialRequestClose; + } + + public FaultInjectionProbabilities setPartialRequestClose(double partialRequestClose) { + validateProbabilityChange(partialRequestClose - this.partialRequestClose); + this.partialRequestClose = partialRequestClose; + return this; + } + + public double getPartialRequestAbort() { + return partialRequestAbort; + } + + public FaultInjectionProbabilities setPartialRequestAbort(double partialRequestAbort) { + validateProbabilityChange(partialRequestAbort - this.partialRequestAbort); + this.partialRequestAbort = partialRequestAbort; + return this; + } + + public double getNoRequestIndefinite() { + return noRequestIndefinite; + } + + public FaultInjectionProbabilities setNoRequestIndefinite(double noRequestIndefinite) { + validateProbabilityChange(noRequestIndefinite - this.noRequestIndefinite); + this.noRequestIndefinite = noRequestIndefinite; + return this; + } + + public double getNoRequestClose() { + return noRequestClose; + } + + public FaultInjectionProbabilities setNoRequestClose(double noRequestClose) { + validateProbabilityChange(noRequestClose - this.noRequestClose); + this.noRequestClose = noRequestClose; + return this; + } + + public double getNoRequestAbort() { + return noRequestAbort; + } + + public FaultInjectionProbabilities setNoRequestAbort(double noRequestAbort) { + validateProbabilityChange(noRequestAbort - this.noRequestAbort); + this.noRequestAbort = noRequestAbort; + return this; + } +} diff --git a/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/RepeatingInputStream.java b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/RepeatingInputStream.java new file mode 100644 index 000000000000..8dc90578c2b9 --- /dev/null +++ b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/RepeatingInputStream.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.stress; + +import io.clientcore.core.models.binarydata.BinaryData; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Random; + +/** + * Represents a repeating input stream with mark support enabled. + */ +public class RepeatingInputStream extends InputStream { + private static final byte[] RANDOM_BYTES; + private final long size; + + private long mark = 0; + private long readLimit = Long.MAX_VALUE; + private long pos = 0; + private final byte[] source; + static { + int randomLength = Integer.parseInt(System.getProperty("azure.core.perf.test.data.buffer.size", "1048576")); // 1MB default; + + Random random = new Random(0); + RANDOM_BYTES = new byte[randomLength]; + random.nextBytes(RANDOM_BYTES); + } + + /** + * Creates an Instance of the repeating input stream. + * @param size the size of the stream. + */ + public RepeatingInputStream(long size) { + this.size = size; + this.source = RANDOM_BYTES; + } + + /** + * Creates an instance of the stream which repeats the given buffer. + * @param source the buffer to repeat. Must be relatively small and fit into memory. + * @param size the size of the stream. + */ + public RepeatingInputStream(BinaryData source, long size) { + this.size = size; + this.source = source.toBytes(); + } + + @Override + public synchronized int read() { + return (pos < size) ? getByte(pos) : -1; + } + + @Override + public synchronized int read(byte[] b) { + return read(b, 0, b.length); + } + + @Override + public synchronized int read(byte[] b, int off, int len) { + if (pos >= size || pos >= readLimit) { + return -1; + } + + int posSrc = (int) (pos % source.length); + int readCount = Math.min(len, source.length - posSrc); + + long remainingDest = this.size - this.pos; + if (remainingDest < readCount) { + readCount = (int) remainingDest; + } + System.arraycopy(source, posSrc, b, off, readCount); + pos += readCount; + + return readCount; + } + + @Override + public synchronized void mark(int readLimit) { + this.readLimit = readLimit; + this.mark = this.pos; + } + + /** + * Same as {@link #mark(int)} but takes long. + * @param readLimit read limit. + */ + public synchronized void mark(long readLimit) { + this.readLimit = readLimit; + this.mark = this.pos; + } + + @Override + public boolean markSupported() { + return true; + } + + @Override + public synchronized void reset() { + this.pos = this.mark; + } + + @Override + public int available() throws IOException { + long remaining = this.size - this.pos; + if (remaining > Integer.MAX_VALUE) { + return Integer.MAX_VALUE; + } else { + return (int) remaining; + } + } + + private int getByte(long pos) { + return source[(int) (pos % source.length)] & 0xFF; + } +} diff --git a/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/StorageStressOptions.java b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/StorageStressOptions.java new file mode 100644 index 000000000000..991cf99d7e13 --- /dev/null +++ b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/StorageStressOptions.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.stress; + +import com.azure.perf.test.core.PerfStressOptions; +import com.beust.jcommander.Parameter; +import io.clientcore.core.utils.configuration.Configuration; + +public class StorageStressOptions extends PerfStressOptions { + @Parameter(names = { "--downloadFaults" }, description = "Enable fault injection for downloads") + private boolean enableFaultInjectionDownloads = false; + @Parameter(names = { "--uploadFaults" }, description = "Enable fault injection for uploads") + private boolean enableFaultInjectionUploads = false; + @Parameter(names = { "--endpoint"}, description = "Storage endpoint string") + private String endpointString = Configuration.getGlobalConfiguration().get("STORAGE_ENDPOINT_STRING"); + @Parameter(names = { "--pbEndpoint"}, description = "Page Blob Storage endpoint string") + private String pageBlobEndpointString = Configuration.getGlobalConfiguration().get("PAGE_BLOB_STORAGE_ENDPOINT_STRING"); + @Parameter(names = { "--maxConcurrency" }, description = "Max concurrency of ParallelTransferOptions") + private int maxConcurrency = 1; + + public boolean isFaultInjectionEnabledForDownloads() { + return enableFaultInjectionDownloads; + } + + /** + * If fault injection is enabled, this flag will be used to determine if the request should be faulted. + * If fault injection is not enabled, this flag will be ignored. + * True: The request will be faulted. False: The response will be faulted. Default is false. + * @return whether the request is faulted. + */ + public boolean isFaultInjectionEnabledForUploads() { + return enableFaultInjectionUploads; + } + + public String getEndpointString() { + return endpointString; + } + + public String getPageBlobEndpointString() { + return pageBlobEndpointString; + } + + /** + * Get the max concurrency of ParallelTransferOptions. + * @return the max concurrency of ParallelTransferOptions. + */ + public int getMaxConcurrency() { + return maxConcurrency; + } +} diff --git a/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/TelemetryHelper.java b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/TelemetryHelper.java new file mode 100644 index 000000000000..54a39f6ef7a9 --- /dev/null +++ b/sdk/storage/azure-storage-stress-v2/src/main/java/com/azure/v2/storage/stress/TelemetryHelper.java @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.v2.storage.stress; + +import com.azure.monitor.opentelemetry.autoconfigure.AzureMonitorAutoConfigure; +import io.clientcore.core.instrumentation.logging.ClientLogger; +import io.netty.channel.unix.Errors; +import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.api.common.AttributeKey; +import io.opentelemetry.api.common.Attributes; +import io.opentelemetry.api.metrics.DoubleHistogram; +import io.opentelemetry.api.metrics.Meter; +import io.opentelemetry.api.trace.Span; +import io.opentelemetry.api.trace.SpanKind; +import io.opentelemetry.api.trace.StatusCode; +import io.opentelemetry.api.trace.Tracer; +import io.opentelemetry.context.Context; +import io.opentelemetry.context.Scope; +import io.opentelemetry.instrumentation.logback.appender.v1_0.OpenTelemetryAppender; +import io.opentelemetry.instrumentation.runtimemetrics.java8.Classes; +import io.opentelemetry.instrumentation.runtimemetrics.java8.Cpu; +import io.opentelemetry.instrumentation.runtimemetrics.java8.GarbageCollector; +import io.opentelemetry.instrumentation.runtimemetrics.java8.MemoryPools; +import io.opentelemetry.instrumentation.runtimemetrics.java8.Threads; +import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk; +import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder; +import io.opentelemetry.sdk.trace.data.LinkData; +import io.opentelemetry.sdk.trace.samplers.Sampler; +import io.opentelemetry.sdk.trace.samplers.SamplingResult; +import reactor.core.Exceptions; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Schedulers; + +import java.time.Instant; +import java.util.List; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Function; + +/** + * Telemetry helper is used to monitor test execution and record stats. + */ +public class TelemetryHelper { + private final Tracer tracer; + private final ClientLogger logger; + private static final AttributeKey SCENARIO_NAME_ATTRIBUTE = AttributeKey.stringKey("scenario_name"); + private static final AttributeKey ERROR_TYPE_ATTRIBUTE = AttributeKey.stringKey("error.type"); + private static final AttributeKey SAMPLE_IN_ATTRIBUTE = AttributeKey.booleanKey("sample.in"); + private static final OpenTelemetry OTEL; + private final String scenarioName; + private final Meter meter; + private final DoubleHistogram runDuration; + private final Attributes commonAttributes; + private final Attributes canceledAttributes; + private final String packageType; + + private final AtomicLong successfulRuns = new AtomicLong(); + private final AtomicLong failedRuns = new AtomicLong(); + + static { + // enables micrometer metrics from Reactor schedulers allowing to monitor thread pool usage and starvation + Schedulers.enableMetrics(); + OTEL = init(); + } + + /** + * Creates an instance of telemetry helper. + * @param scenarioClass the scenario class + */ + public TelemetryHelper(Class scenarioClass) { + this.scenarioName = scenarioClass.getName(); + this.tracer = OTEL.getTracer(scenarioName); + this.meter = OTEL.getMeter(scenarioName); + this.logger = new ClientLogger(scenarioName); + this.runDuration = meter.histogramBuilder("test.run.duration") + .setUnit("s") + .build(); + this.commonAttributes = Attributes.of(SCENARIO_NAME_ATTRIBUTE, scenarioName); + this.canceledAttributes = Attributes.of(SCENARIO_NAME_ATTRIBUTE, scenarioName, ERROR_TYPE_ATTRIBUTE, "cancelled"); + this.packageType = scenarioClass.getPackage().toString(); + } + + /** + * Initializes telemetry helper: sets up Azure Monitor exporter, enables JVM metrics collection. + */ + public static OpenTelemetry init() { + if (OTEL != null) { + return OTEL; + } + + System.setProperty("otel.java.global-autoconfigure.enabled", "true"); + + AutoConfiguredOpenTelemetrySdkBuilder sdkBuilder = AutoConfiguredOpenTelemetrySdk.builder(); + String applicationInsightsConnectionString = System.getenv("APPLICATIONINSIGHTS_CONNECTION_STRING"); + if (applicationInsightsConnectionString == null) { + System.setProperty("otel.traces.exporter", "none"); + System.setProperty("otel.metrics.exporter", "none"); + System.setProperty("otel.logs.exporter", "none"); + } else { + AzureMonitorAutoConfigure.customize(sdkBuilder, applicationInsightsConnectionString); + } + + OpenTelemetry otel = sdkBuilder + .addSamplerCustomizer((sampler, props) -> new Sampler() { + @Override + public SamplingResult shouldSample(Context parentContext, String traceId, String name, SpanKind spanKind, Attributes attributes, List parentLinks) { + if (Boolean.TRUE.equals(attributes.get(SAMPLE_IN_ATTRIBUTE))) { + return SamplingResult.recordAndSample(); + } + return sampler.shouldSample(parentContext, traceId, name, spanKind, attributes, parentLinks); + } + + @Override + public String getDescription() { + return sampler.getDescription(); + } + }) + .setResultAsGlobal() + .build() + .getOpenTelemetrySdk(); + Classes.registerObservers(otel); + Cpu.registerObservers(otel); + MemoryPools.registerObservers(otel); + Threads.registerObservers(otel); + GarbageCollector.registerObservers(otel); + OpenTelemetryAppender.install(otel); + return otel; + } + + /** + * Instruments a runnable: records runnable duration along with the status (success, error, cancellation), + * @param oneRun the runnable to instrument + */ + @SuppressWarnings("try") + public void instrumentRun(ThrowingFunction oneRun) { + Instant start = Instant.now(); + Span span = tracer.spanBuilder("run").startSpan(); + try (Scope s = span.makeCurrent()) { + com.azure.core.util.Context ctx = new com.azure.core.util.Context(com.azure.core.util.tracing.Tracer.PARENT_TRACE_CONTEXT_KEY, io.opentelemetry.context.Context.current()); + oneRun.run(ctx); + trackSuccess(start, span); + } catch (Throwable e) { + if (e.getMessage().contains("Timeout on blocking read") || e instanceof InterruptedException || e instanceof TimeoutException) { + trackCancellation(start, span); + } else { + trackFailure(start, e, span); + } + } + } + + /** + * Instruments a Mono: records mono duration along with the status (success, error, cancellation), + * @param runAsync the mono to instrument + * @return the instrumented mono + */ + @SuppressWarnings("try") + public Mono instrumentRunAsync(Function> runAsync) { + return Mono.defer(() -> { + Instant start = Instant.now(); + Span span = tracer.spanBuilder("runAsync").startSpan(); + try (Scope s = span.makeCurrent()) { + com.azure.core.util.Context ctx = new com.azure.core.util.Context(com.azure.core.util.tracing.Tracer.PARENT_TRACE_CONTEXT_KEY, io.opentelemetry.context.Context.current()); + return runAsync.apply(ctx).doOnError(e -> trackFailure(start, e, span)) + .doOnCancel(() -> trackCancellation(start, span)) + .doOnSuccess(v -> trackSuccess(start, span)) + .contextWrite(reactor.util.context.Context.of(com.azure.core.util.tracing.Tracer.PARENT_TRACE_CONTEXT_KEY, io.opentelemetry.context.Context.current())); + } + }); + } + + private void trackSuccess(Instant start, Span span) { + logger.atVerbose() + .addKeyValue("traceId", span.getSpanContext().getTraceId()) + .addKeyValue("status", "success") + .log("run ended"); + + runDuration.record(getDuration(start), commonAttributes); + successfulRuns.incrementAndGet(); + span.end(); + logger.atInfo().log("track success"); + } + + private void trackCancellation(Instant start, Span span) { + logger.atWarning() + .addKeyValue("error.type", "cancelled") + .log("run ended"); + + runDuration.record(getDuration(start), canceledAttributes); + span.setAttribute(ERROR_TYPE_ATTRIBUTE, "cancelled"); + span.setStatus(StatusCode.ERROR); + span.end(); + } + + private void trackFailure(Instant start, Throwable e, Span span) { + Throwable unwrapped = Exceptions.unwrap(e); + + // Check if the unwrapped exception is a RuntimeException + // Check if the message contains "NativeIoException" or TimeoutException and the unwrapped exception is not + // already a NativeIoException/TimeoutException + if (unwrapped instanceof RuntimeException) { + String message = unwrapped.getMessage(); + if (message.contains("NativeIoException")) { + unwrapped = new io.netty.channel.unix.Errors.NativeIoException("recvAddress", Errors.ERRNO_ECONNRESET_NEGATIVE); + } else if (message.contains("TimeoutException")) { + unwrapped = new TimeoutException(message); + } + } + + span.recordException(unwrapped); + span.setAttribute(ERROR_TYPE_ATTRIBUTE, unwrapped.getClass().getName()); + span.setStatus(StatusCode.ERROR, unwrapped.getMessage()); + + String errorType = unwrapped.getClass().getName(); + logger.atError() + .addKeyValue("error.type", errorType) + // due to sampling, most of the logs are available in console/file share' + // without trace context. + // The only way to correlate them is to explicitly log traceId/ + .addKeyValue("traceId", span.getSpanContext().getTraceId()) + .log("run ended", unwrapped); + + Attributes attributes = Attributes.of(SCENARIO_NAME_ATTRIBUTE, scenarioName, ERROR_TYPE_ATTRIBUTE, errorType); + runDuration.record(getDuration(start), attributes); + failedRuns.incrementAndGet(); + logger.atInfo().log("track failure"); + span.end(); + } + + /** + * Records an event representing the start of a test along with test options. + * @param options test parameters + */ + public void recordStart(StorageStressOptions options) { + Span before = startSampledInSpan("before run"); + before.setAttribute(AttributeKey.longKey("durationSec"), options.getDuration()); + before.setAttribute(AttributeKey.stringKey("scenarioName"), scenarioName); + before.setAttribute(AttributeKey.longKey("concurrency"), options.getParallel()); + before.setAttribute(AttributeKey.stringKey("storagePackageVersion"), this.packageType); + before.setAttribute(AttributeKey.booleanKey("sync"), options.isSync()); + before.setAttribute(AttributeKey.longKey("payloadSize"), options.getSize()); + before.setAttribute(AttributeKey.stringKey("hostname"), System.getenv().get("HOSTNAME")); + before.setAttribute(AttributeKey.booleanKey("faultInjectionForDownloads"), options.isFaultInjectionEnabledForDownloads()); + before.setAttribute(AttributeKey.booleanKey("faultInjectionForUploads"), options.isFaultInjectionEnabledForUploads()); + before.setAttribute(AttributeKey.stringKey("httpClientProvider"), options.getHttpClient().toString()); + before.setAttribute(AttributeKey.stringKey("jreVersion"), System.getProperty("java.version")); + before.setAttribute(AttributeKey.stringKey("jreVendor"), System.getProperty("java.vendor")); + before.end(); + + // be sure to remove logging afterwards + logger.atInfo() + .addKeyValue("duration", options.getDuration()) + .addKeyValue("payloadSize", options.getSize()) + .addKeyValue("concurrency", options.getParallel()) + .addKeyValue("faultInjectionForDownloads", options.isFaultInjectionEnabledForDownloads()) + .addKeyValue("faultInjectionForUploads", options.isFaultInjectionEnabledForUploads()) + .addKeyValue("storagePackageVersion", this.packageType) + .addKeyValue("sync", options.isSync()) + .addKeyValue("scenarioName", scenarioName) + .log("starting test"); + logger.atInfo().log("starting test"); + } + + /** + * Records an event representing the end of the test. + * @param startTime the start time of the test + */ + public void recordEnd(Instant startTime) { + Span after = startSampledInSpan("after run"); + after.setAttribute(AttributeKey.longKey("succeeded"), successfulRuns.get()); + after.setAttribute(AttributeKey.longKey("failed"), failedRuns.get()); + after.setAttribute(AttributeKey.longKey("durationMs"), Instant.now().toEpochMilli() - startTime.toEpochMilli()); + after.end(); + + // be sure to remove logging afterwards + logger.atInfo() + .addKeyValue("scenarioName", scenarioName) + .addKeyValue("succeeded", successfulRuns.get()) + .addKeyValue("failed", failedRuns.get()) + .log("test finished"); + } + + + private Span startSampledInSpan(String name) { + return tracer.spanBuilder(name) + // guarantee that we have before/after spans sampled in + // and record duration/result of the test + .setAttribute(SAMPLE_IN_ATTRIBUTE, true) + .startSpan(); + } + + private static double getDuration(Instant start) { + return Math.max(0d, Instant.now().toEpochMilli() - start.toEpochMilli()) / 1000d; + } + + @FunctionalInterface + public interface ThrowingFunction { + void run(com.azure.core.util.Context context) throws Exception; + } + +} diff --git a/sdk/storage/azure-storage-stress-v2/src/main/resources/logback.xml b/sdk/storage/azure-storage-stress-v2/src/main/resources/logback.xml new file mode 100644 index 000000000000..e01c5f8d6715 --- /dev/null +++ b/sdk/storage/azure-storage-stress-v2/src/main/resources/logback.xml @@ -0,0 +1,23 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + # this is the category used by HTTP logging policy, add more/adjust as needed + + + + diff --git a/sdk/storage/pom.xml b/sdk/storage/pom.xml index 60a3b0e7d3a3..f9e0bedc022b 100644 --- a/sdk/storage/pom.xml +++ b/sdk/storage/pom.xml @@ -9,20 +9,25 @@ pom 1.0.0 - azure-storage-common - azure-storage-blob - azure-storage-blob-batch - azure-storage-blob-changefeed - azure-storage-blob-cryptography - azure-storage-blob-nio - azure-storage-file-share - azure-storage-file-datalake - azure-storage-internal-avro - azure-storage-queue - azure-storage-perf + azure-storage-common + azure-storage-blob + azure-storage-blob-batch + azure-storage-blob-changefeed + azure-storage-blob-cryptography + azure-storage-blob-nio + azure-storage-file-share + azure-storage-file-datalake + azure-storage-internal-avro + azure-storage-queue + azure-storage-perf azure-storage-blob-stress azure-storage-stress azure-storage-file-datalake-stress azure-storage-file-share-stress + + + azure-storage-blob-v2 + azure-storage-blob-stress-v2 + azure-storage-stress-v2