Skip to content

Commit 73221a9

Browse files
jaschrep-msftgapra-msftkasobol-msft
authored
Feature/oauth copyfromurl (#22086)
* Set up STG78 branch (#21634) * Generated off latest version of blob swagger (#21644) * swagger generation and public API overloads * blob clients obey new generation * minor changes to bearer token logic * TEST WORKING * extra testing * ported oauthcopy source to blobs * options API changes and docstrings * fixed constructor issues * fix missed source auth misses * script tags on pom * removes arg checks in option model constructors rerecorded tests * pom fix * fix misnamed page blob tests * Test fixes adds missing recording. extra playback logic for oauth tokens that should fix a CI-specific issue. * fixed pom script comment * downgrade some depenency verions * rerecord sas tests * snippets and checkstyle * rerecorded tests fixed recording infra for file share tests * test fixes * rerecorded versioning tests * HttpAuthorization added to core-experimental azure-storage-blob and azure-storage-file-share now depend on core-experimental for new class and updated their APIs to use the new class. * refactored options type names * Reenabled quick query parquet support (#21785) * reidentified samples for options class name change * Implemented Immutable Storage with Versioning (#21718) * File listing v2 (#21720) * swagger generation and hookup regenerated files swagger for listing hooked up generated and handwritten models expanded client API to support new models * testing and fixes expanded test parameters for file listing. swagger transform added. * rerecorded file listing test * more testing also fixed a method name casing * docstrings and samples * checkstyle * reverted primative boolean extended info arg REST api accepts true or an absence of value. Alligning with .NET for now on Boolean vs boolean. * checkpoint * pr feedback * misused variable fix * fixed test * send nothing, not false: include-extended-info other minor fixes rerecorded tests * import cleanup * swagger regeneration and test fixes * API comments extendedInfo boolean => Boolean renamed options class * reidentified samples for options class name change Co-authored-by: jschrepp-MSFT <41338290+jschrepp-MSFT@users.noreply.github.com> * Fix test. * remove HttpAuthorization in prep for merge added in separate PR. removing to be ready for that offical addition. * fix build from merge * fix pom versioning CI issues * snippet line length * fix merge error with immutable versioning * PR feedback * Minor cleanup * generator cleanup and regeneration * Keep files-shares tests dependent on latest blob * test refactor/rerecord * deleted old tests that were copied instead of moved * min service version reformat * import cleanup * post-merge. * getOauthToken refactor * reformatting Co-authored-by: Gauri Prasad <51212198+gapra-msft@users.noreply.github.com> Co-authored-by: jschrepp-MSFT <41338290+jschrepp-MSFT@users.noreply.github.com> Co-authored-by: gapra <gapra@microsoft.com> Co-authored-by: Kamil Sobol <kasobol@microsoft.com> Co-authored-by: Kamil Sobol <61715331+kasobol-msft@users.noreply.github.com>
1 parent 395370a commit 73221a9

File tree

201 files changed

+11477
-15187
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

201 files changed

+11477
-15187
lines changed

sdk/storage/azure-storage-blob/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@
5858
<artifactId>azure-core</artifactId>
5959
<version>1.17.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
6060
</dependency>
61+
<dependency>
62+
<groupId>com.azure</groupId>
63+
<artifactId>azure-core-experimental</artifactId>
64+
<version>1.0.0-beta.15</version> <!-- {x-version-update;com.azure:azure-core-experimental;current} -->
65+
</dependency>
6166
<dependency>
6267
<groupId>com.azure</groupId>
6368
<artifactId>azure-core-http-netty</artifactId>
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
package com.azure.storage.blob.options;
5+
6+
import com.azure.core.annotation.Fluent;
7+
import com.azure.core.experimental.http.HttpAuthorization;
8+
import com.azure.core.util.CoreUtils;
9+
import com.azure.storage.blob.models.AppendBlobRequestConditions;
10+
import com.azure.storage.blob.models.BlobRange;
11+
import com.azure.storage.blob.models.BlobRequestConditions;
12+
13+
/**
14+
* Extended options that may be passed when appending a block from a source URL.
15+
*/
16+
@Fluent
17+
public class AppendBlobAppendBlockFromUrlOptions {
18+
private final String sourceUrl;
19+
private BlobRange sourceRange;
20+
private byte[] sourceContentMd5;
21+
private AppendBlobRequestConditions destinationRequestConditions;
22+
private BlobRequestConditions sourceRequestConditions;
23+
private HttpAuthorization sourceAuthorization;
24+
25+
/**
26+
* @param sourceUrl The source URL to copy from. URLs outside of Azure may only be copied to block blobs.
27+
*/
28+
public AppendBlobAppendBlockFromUrlOptions(String sourceUrl) {
29+
this.sourceUrl = sourceUrl;
30+
}
31+
32+
/**
33+
* @return Source URL to copy from.
34+
*/
35+
public String getSourceUrl() {
36+
return sourceUrl;
37+
}
38+
39+
/**
40+
* @return Range of bytes to read from the source.
41+
*/
42+
public BlobRange getSourceRange() {
43+
return sourceRange;
44+
}
45+
46+
/**
47+
* @param sourceRange Range of bytes to read from the source.
48+
* @return The updated options.
49+
*/
50+
public AppendBlobAppendBlockFromUrlOptions setSourceRange(BlobRange sourceRange) {
51+
this.sourceRange = sourceRange;
52+
return this;
53+
}
54+
55+
/**
56+
* @return MD5 of the source content to be appended.
57+
*/
58+
public byte[] getSourceContentMd5() {
59+
return CoreUtils.clone(sourceContentMd5);
60+
}
61+
62+
/**
63+
* @param sourceContentMd5 MD5 of the source content to be appended.
64+
* @return The updated options.
65+
*/
66+
public AppendBlobAppendBlockFromUrlOptions setSourceContentMd5(byte[] sourceContentMd5) {
67+
this.sourceContentMd5 = CoreUtils.clone(sourceContentMd5);
68+
return this;
69+
}
70+
71+
/**
72+
* @return {@link AppendBlobRequestConditions} for writing to destination.
73+
*/
74+
public AppendBlobRequestConditions getDestinationRequestConditions() {
75+
return destinationRequestConditions;
76+
}
77+
78+
/**
79+
* @param destinationRequestConditions {@link AppendBlobRequestConditions} for writing to destination.
80+
* @return The updated options.
81+
*/
82+
public AppendBlobAppendBlockFromUrlOptions setDestinationRequestConditions(AppendBlobRequestConditions destinationRequestConditions) {
83+
this.destinationRequestConditions = destinationRequestConditions;
84+
return this;
85+
}
86+
87+
/**
88+
* @return {@link BlobRequestConditions} for accessing source.
89+
*/
90+
public BlobRequestConditions getSourceRequestConditions() {
91+
return sourceRequestConditions;
92+
}
93+
94+
/**
95+
* @param sourceRequestConditions {@link BlobRequestConditions} for accessing source.
96+
* @return The updated options.
97+
*/
98+
public AppendBlobAppendBlockFromUrlOptions setSourceRequestConditions(BlobRequestConditions sourceRequestConditions) {
99+
this.sourceRequestConditions = sourceRequestConditions;
100+
return this;
101+
}
102+
103+
/**
104+
* @return auth header for accessing source.
105+
*/
106+
public HttpAuthorization getSourceAuthorization() {
107+
return sourceAuthorization;
108+
}
109+
110+
/**
111+
* Sets "Authorization" header for accessing source URL. Currently only "Bearer" authentication is accepted by
112+
* Storage.
113+
*
114+
* @param sourceAuthorization auth header for accessing source.
115+
* @return The updated options.
116+
*/
117+
public AppendBlobAppendBlockFromUrlOptions setSourceAuthorization(HttpAuthorization sourceAuthorization) {
118+
this.sourceAuthorization = sourceAuthorization;
119+
return this;
120+
}
121+
}

sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/options/BlobCopyFromUrlOptions.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package com.azure.storage.blob.options;
55

66
import com.azure.core.annotation.Fluent;
7+
import com.azure.core.experimental.http.HttpAuthorization;
78
import com.azure.core.http.RequestConditions;
89
import com.azure.storage.blob.models.AccessTier;
910
import com.azure.storage.blob.models.BlobImmutabilityPolicy;
@@ -23,6 +24,7 @@ public class BlobCopyFromUrlOptions {
2324
private AccessTier tier;
2425
private RequestConditions sourceRequestConditions;
2526
private BlobRequestConditions destinationRequestConditions;
27+
private HttpAuthorization sourceAuthorization;
2628
private BlobImmutabilityPolicy immutabilityPolicy;
2729
private Boolean legalHold;
2830

@@ -122,6 +124,25 @@ public BlobCopyFromUrlOptions setDestinationRequestConditions(BlobRequestConditi
122124
return this;
123125
}
124126

127+
/**
128+
* @return auth header for access to source.
129+
*/
130+
public HttpAuthorization getSourceAuthorization() {
131+
return sourceAuthorization;
132+
}
133+
134+
/**
135+
* Sets "Authorization" header for accessing source URL. Currently only "Bearer" authentication is accepted by
136+
* Storage.
137+
*
138+
* @param sourceAuthorization auth header for access to source.
139+
* @return The updated options.
140+
*/
141+
public BlobCopyFromUrlOptions setSourceAuthorization(HttpAuthorization sourceAuthorization) {
142+
this.sourceAuthorization = sourceAuthorization;
143+
return this;
144+
}
145+
125146
/**
126147
* @return {@link BlobImmutabilityPolicy}
127148
*/

sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/options/BlobUploadFromUrlOptions.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package com.azure.storage.blob.options;
55

66
import com.azure.core.util.CoreUtils;
7+
import com.azure.core.experimental.http.HttpAuthorization;
78
import com.azure.storage.blob.models.AccessTier;
89
import com.azure.storage.blob.models.BlobHttpHeaders;
910
import com.azure.storage.blob.models.BlobRequestConditions;
@@ -23,6 +24,7 @@ public class BlobUploadFromUrlOptions {
2324
private BlobRequestConditions destinationRequestConditions;
2425
private BlobRequestConditions sourceRequestConditions;
2526
private Boolean copySourceBlobProperties;
27+
private HttpAuthorization sourceAuthorization;
2628

2729
/**
2830
* @param sourceUrl The source URL to upload from.
@@ -159,4 +161,23 @@ public BlobUploadFromUrlOptions setCopySourceBlobProperties(Boolean copySourceBl
159161
this.copySourceBlobProperties = copySourceBlobProperties;
160162
return this;
161163
}
164+
165+
/**
166+
* @return auth header for access to source.
167+
*/
168+
public HttpAuthorization getSourceAuthorization() {
169+
return sourceAuthorization;
170+
}
171+
172+
/**
173+
* Sets "Authorization" header for accessing source URL. Currently only "Bearer" authentication is accepted by
174+
* Storage.
175+
*
176+
* @param sourceAuthorization auth header for access to source.
177+
* @return The updated options.
178+
*/
179+
public BlobUploadFromUrlOptions setSourceAuthorization(HttpAuthorization sourceAuthorization) {
180+
this.sourceAuthorization = sourceAuthorization;
181+
return this;
182+
}
162183
}
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
package com.azure.storage.blob.options;
5+
6+
import com.azure.core.annotation.Fluent;
7+
import com.azure.core.experimental.http.HttpAuthorization;
8+
import com.azure.core.util.CoreUtils;
9+
import com.azure.storage.blob.models.BlobRange;
10+
import com.azure.storage.blob.models.BlobRequestConditions;
11+
12+
/**
13+
* Extended options that may be passed when staging a block from a source URL.
14+
*/
15+
@Fluent
16+
public class BlockBlobStageBlockFromUrlOptions {
17+
private final String base64BlockId;
18+
private final String sourceUrl;
19+
private BlobRange sourceRange;
20+
private byte[] sourceContentMd5;
21+
private String leaseId;
22+
private BlobRequestConditions sourceRequestConditions;
23+
private HttpAuthorization sourceAuthorization;
24+
25+
/**
26+
* @param base64BlockId The block ID to assign the new block.
27+
* @param sourceUrl The source URL to copy from. URLs outside of Azure may only be copied to block blobs.
28+
*/
29+
public BlockBlobStageBlockFromUrlOptions(String base64BlockId, String sourceUrl) {
30+
this.base64BlockId = base64BlockId;
31+
this.sourceUrl = sourceUrl;
32+
}
33+
34+
/**
35+
* @return The block ID to assign the new block.
36+
*/
37+
public String getBase64BlockId() {
38+
return base64BlockId;
39+
}
40+
41+
/**
42+
* @return The source URL to upload from.
43+
*/
44+
public String getSourceUrl() {
45+
return sourceUrl;
46+
}
47+
48+
/**
49+
* @return Range of bytes to read from the source.
50+
*/
51+
public BlobRange getSourceRange() {
52+
return sourceRange;
53+
}
54+
55+
/**
56+
* @param sourceRange Range of bytes to read from the source.
57+
* @return The updated options.
58+
*/
59+
public BlockBlobStageBlockFromUrlOptions setSourceRange(BlobRange sourceRange) {
60+
this.sourceRange = sourceRange;
61+
return this;
62+
}
63+
64+
/**
65+
* @return MD5 of the source content.
66+
*/
67+
public byte[] getSourceContentMd5() {
68+
return CoreUtils.clone(sourceContentMd5);
69+
}
70+
71+
/**
72+
* @param sourceContentMd5 MD5 of the source content.
73+
* @return The updated options.
74+
*/
75+
public BlockBlobStageBlockFromUrlOptions setSourceContentMd5(byte[] sourceContentMd5) {
76+
this.sourceContentMd5 = CoreUtils.clone(sourceContentMd5);
77+
return this;
78+
}
79+
80+
/**
81+
* @return Lease ID for accessing source content.
82+
*/
83+
public String getLeaseId() {
84+
return leaseId;
85+
}
86+
87+
/**
88+
* @param leaseId Lease ID for accessing source content.
89+
* @return The updated options.
90+
*/
91+
public BlockBlobStageBlockFromUrlOptions setLeaseId(String leaseId) {
92+
this.leaseId = leaseId;
93+
return this;
94+
}
95+
96+
/**
97+
* @return {@link BlobRequestConditions} for accessing source content.
98+
*/
99+
public BlobRequestConditions getSourceRequestConditions() {
100+
return sourceRequestConditions;
101+
}
102+
103+
/**
104+
* @param sourceRequestConditions {@link BlobRequestConditions} for accessing source content.
105+
* @return The updated options.
106+
*/
107+
public BlockBlobStageBlockFromUrlOptions setSourceRequestConditions(BlobRequestConditions sourceRequestConditions) {
108+
this.sourceRequestConditions = sourceRequestConditions;
109+
return this;
110+
}
111+
112+
/**
113+
* @return auth header to access source.
114+
*/
115+
public HttpAuthorization getSourceAuthorization() {
116+
return sourceAuthorization;
117+
}
118+
119+
/**
120+
* Sets "Authorization" header for accessing source URL. Currently only "Bearer" authentication is accepted by
121+
* Storage.
122+
*
123+
* @param sourceAuthorization auth header to access source.
124+
* @return The updated options.
125+
*/
126+
public BlockBlobStageBlockFromUrlOptions setSourceAuthorization(HttpAuthorization sourceAuthorization) {
127+
this.sourceAuthorization = sourceAuthorization;
128+
return this;
129+
}
130+
}

0 commit comments

Comments
 (0)