Skip to content

samples: add samples for object contexts#3329

Merged
BenWhitehead merged 7 commits into
googleapis:mainfrom
nidhiii-27:feat-object-contexts
Oct 9, 2025
Merged

samples: add samples for object contexts#3329
BenWhitehead merged 7 commits into
googleapis:mainfrom
nidhiii-27:feat-object-contexts

Conversation

@nidhiii-27

Copy link
Copy Markdown
Contributor

Added samples :
storage_get_object_contexts
storage_list_object_contexts
storage_set_object_contexts

@product-auto-label product-auto-label Bot added size: m Pull request size is medium. api: storage Issues related to the googleapis/java-storage API. samples Issues that are directly related to samples. labels Oct 6, 2025
@nidhiii-27 nidhiii-27 marked this pull request as ready for review October 7, 2025 19:52
@snippet-bot

snippet-bot Bot commented Oct 7, 2025

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 3 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@BenWhitehead BenWhitehead left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small things to address and a few nits. Feel free to skip the nits if you so choose.

Comment thread samples/snippets/src/main/java/com/example/storage/object/GetObjectContexts.java Outdated
import java.util.Map;

public class GetObjectContexts {
public static void getObjectMetadata(String projectId, String bucketName, String blobName)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: method is named getObjectMetadata but the contents show how to get contexts.

* List any object that does not have a context with the specified key and value attached
* String filter = "NOT contexts.\"KEY\"=\"VALUE\"";
*/
String key = "your-context-key";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: making this a method parameter will probably make test authoring easier

Comment thread samples/snippets/src/main/java/com/example/storage/object/ListObjectContexts.java Outdated
Comment thread samples/snippets/src/main/java/com/example/storage/object/SetObjectContexts.java Outdated
Comment on lines +49 to +50
String key = "your-context-key";
String value = "your-context-value";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: providing these as method parameters will probably make test authoring easier

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the suggestion!

Comment thread samples/snippets/src/main/java/com/example/storage/object/GetObjectContexts.java Outdated
@BenWhitehead BenWhitehead merged commit 9dcce11 into googleapis:main Oct 9, 2025
22 checks passed
@nidhiii-27 nidhiii-27 deleted the feat-object-contexts branch October 13, 2025 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the googleapis/java-storage API. samples Issues that are directly related to samples. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants