-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Stg102/datalake tags #48057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/storage/stg102base
Are you sure you want to change the base?
Stg102/datalake tags #48057
Changes from all commits
0b89f95
8127a5e
e3989c5
4c765d4
2ef3d71
7c282bb
e8d6e59
661ace4
03afd46
a18b53f
95ddef5
aa462d4
ed23d3b
7b0c8b9
7a7b517
63e09fc
453a093
de14786
14c325c
b0b451a
54757b1
357bc84
f15d4ad
af7713f
95515ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,6 +19,8 @@ | |||||||
| import com.azure.core.util.logging.ClientLogger; | ||||||||
| import com.azure.storage.blob.BlobContainerAsyncClient; | ||||||||
| import com.azure.storage.blob.BlobUrlParts; | ||||||||
| import com.azure.storage.blob.options.BlobGetTagsOptions; | ||||||||
| import com.azure.storage.blob.options.BlobSetTagsOptions; | ||||||||
| import com.azure.storage.blob.specialized.BlockBlobAsyncClient; | ||||||||
| import com.azure.storage.blob.specialized.SpecializedBlobClientBuilder; | ||||||||
| import com.azure.storage.common.StorageSharedKeyCredential; | ||||||||
|
|
@@ -62,8 +64,10 @@ | |||||||
| import com.azure.storage.file.datalake.models.PathRemoveAccessControlEntry; | ||||||||
| import com.azure.storage.file.datalake.models.PathSystemProperties; | ||||||||
| import com.azure.storage.file.datalake.models.UserDelegationKey; | ||||||||
| import com.azure.storage.file.datalake.options.DataLakeGetTagsOptions; | ||||||||
| import com.azure.storage.file.datalake.options.DataLakePathCreateOptions; | ||||||||
| import com.azure.storage.file.datalake.options.DataLakePathDeleteOptions; | ||||||||
| import com.azure.storage.file.datalake.options.DataLakeSetTagsOptions; | ||||||||
| import com.azure.storage.file.datalake.options.PathGetPropertiesOptions; | ||||||||
| import com.azure.storage.file.datalake.options.PathGetSystemPropertiesOptions; | ||||||||
| import com.azure.storage.file.datalake.options.PathRemoveAccessControlRecursiveOptions; | ||||||||
|
|
@@ -1950,4 +1954,65 @@ public String generateSas(DataLakeServiceSasSignatureValues dataLakeServiceSasSi | |||||||
| PathResourceType.DIRECTORY.equals(this.pathResourceType)) | ||||||||
| .generateSas(SasImplUtils.extractSharedKeyCredential(getHttpPipeline()), stringToSignHandler, context); | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * Gets the tags associated with the underlying path. | ||||||||
| * | ||||||||
| * @return The path's tags. | ||||||||
| */ | ||||||||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||||||||
| public Mono<Map<String, String>> getTags() { | ||||||||
| return this.getTagsWithResponse(new DataLakeGetTagsOptions()).map(Response::getValue); | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * Gets the tags associated with the underlying path. | ||||||||
| * | ||||||||
| * @param options {@link DataLakeGetTagsOptions} | ||||||||
| * @return The path's tags. | ||||||||
| */ | ||||||||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||||||||
| public Mono<Response<Map<String, String>>> getTagsWithResponse(DataLakeGetTagsOptions options) { | ||||||||
| options = (options == null) ? new DataLakeGetTagsOptions() : options; | ||||||||
| DataLakeRequestConditions requestConditions = (options.getRequestConditions() == null) | ||||||||
| ? new DataLakeRequestConditions() | ||||||||
| : options.getRequestConditions(); | ||||||||
| BlobGetTagsOptions blobGetTagsOptions | ||||||||
| = new BlobGetTagsOptions().setRequestConditions(Transforms.toBlobRequestConditions(requestConditions)); | ||||||||
|
|
||||||||
| return this.blockBlobAsyncClient.getTagsWithResponse(blobGetTagsOptions) | ||||||||
| .onErrorMap(DataLakeImplUtils::transformBlobStorageException); | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * Sets user defined tags. The specified tags in this method will replace existing tags. If old values | ||||||||
| * must be preserved, they must be downloaded and included in the call to this method. | ||||||||
| * | ||||||||
| * @param tags Tags to associate with the path. | ||||||||
| * @return A reactive response signalling completion. | ||||||||
| */ | ||||||||
| @ServiceMethod(returns = ReturnType.SINGLE) | ||||||||
| public Mono<Void> setTags(Map<String, String> tags) { | ||||||||
| return this.setTagsWithResponse(new DataLakeSetTagsOptions(tags)).map(Response::getValue); | ||||||||
|
||||||||
| return this.setTagsWithResponse(new DataLakeSetTagsOptions(tags)).map(Response::getValue); | |
| return this.setTagsWithResponse(new DataLakeSetTagsOptions(tags)) | |
| .flatMap(FluxUtil::toMono); |
ibrandes marked this conversation as resolved.
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| package com.azure.storage.file.datalake.options; | ||
|
|
||
| import com.azure.core.annotation.Fluent; | ||
| import com.azure.storage.file.datalake.models.DataLakeRequestConditions; | ||
|
|
||
| /** | ||
| * Extended options that may be passed when getting tags for a path. | ||
| */ | ||
| @Fluent | ||
| public class DataLakeGetTagsOptions { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can make this final; from the wise words of the azure sdk api view bot, "Consider making all classes final by default - only make non-final if subclassing is supported." |
||
| private DataLakeRequestConditions requestConditions; | ||
|
|
||
| /** | ||
| * Creates a new instance of {@link DataLakeGetTagsOptions}. | ||
| */ | ||
| public DataLakeGetTagsOptions() { | ||
| } | ||
|
|
||
| /** | ||
| * Gets the {@link DataLakeRequestConditions}. | ||
| * | ||
| * @return {@link DataLakeRequestConditions} | ||
| */ | ||
| public DataLakeRequestConditions getRequestConditions() { | ||
| return requestConditions; | ||
| } | ||
|
|
||
| /** | ||
| * Sets the {@link DataLakeRequestConditions}. | ||
| * | ||
| * @param requestConditions {@link DataLakeRequestConditions} | ||
| * @return The updated options. | ||
| */ | ||
| public DataLakeGetTagsOptions setRequestConditions(DataLakeRequestConditions requestConditions) { | ||
| this.requestConditions = requestConditions; | ||
| return this; | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| package com.azure.storage.file.datalake.options; | ||
|
|
||
| import com.azure.core.annotation.Fluent; | ||
| import com.azure.storage.common.implementation.StorageImplUtils; | ||
| import com.azure.storage.file.datalake.models.DataLakeRequestConditions; | ||
|
|
||
| import java.util.Collections; | ||
| import java.util.Map; | ||
|
|
||
| /** | ||
| * Extended options that may be passed when setting tags for a path. | ||
| */ | ||
| @Fluent | ||
| public class DataLakeSetTagsOptions { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also can be final. |
||
| private final Map<String, String> tags; | ||
| private DataLakeRequestConditions requestConditions; | ||
|
|
||
| /** | ||
| * Creates a new instance of {@link DataLakeSetTagsOptions}. | ||
| * | ||
| * @param tags Tags to associate with the path. | ||
| * @throws NullPointerException If {@code tags} is null. | ||
| */ | ||
| public DataLakeSetTagsOptions(Map<String, String> tags) { | ||
| StorageImplUtils.assertNotNull("tags", tags); | ||
| this.tags = Collections.unmodifiableMap(tags); | ||
| } | ||
|
|
||
| /** | ||
| * Gets the tags to associate with the path. | ||
| * | ||
| * @return The tags to associate with the path. | ||
| */ | ||
| public Map<String, String> getTags() { | ||
| return tags; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the {@link DataLakeRequestConditions}. | ||
| * | ||
| * @return {@link DataLakeRequestConditions} | ||
| */ | ||
| public DataLakeRequestConditions getRequestConditions() { | ||
| return requestConditions; | ||
| } | ||
|
|
||
| /** | ||
| * Sets the {@link DataLakeRequestConditions}. | ||
| * | ||
| * @param requestConditions {@link DataLakeRequestConditions} | ||
| * @return The updated options. | ||
| */ | ||
| public DataLakeSetTagsOptions setRequestConditions(DataLakeRequestConditions requestConditions) { | ||
| this.requestConditions = requestConditions; | ||
| return this; | ||
| } | ||
|
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.