Skip to content
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

How to get object using idempotent key? #276

Open
Kingg22 opened this issue Nov 14, 2024 · 4 comments
Open

How to get object using idempotent key? #276

Kingg22 opened this issue Nov 14, 2024 · 4 comments

Comments

@Kingg22
Copy link

Kingg22 commented Nov 14, 2024

using var client = new ObjectStorageClient(Provider, new());
var getObjectRequest = new GetObjectRequest()
{
    BucketName = BucketName,
    NamespaceName = Namespace,
    ObjectName = objectName,
};

try
{
    var response = await client.GetObject(getObjectRequest);
}

Hi, I'm making a request like this, but I'd like to get an object with an ETag or a custom key with a more idempotent id to make sure I delete it correctly and don't lose other objects. Can this be done at the moment or could it be implemented?

@github-anurag
Copy link
Member

@Kingg22
You can use the IfMatch property of the GetObjectRequest to pass in the ETag as desired.

Please refer to the official API documentation for more information.

@Kingg22
Copy link
Author

Kingg22 commented Nov 15, 2024

@Kingg22
You can use the IfMatch property of the GetObjectRequest to pass in the ETag as desired.

Please refer to the official API documentation for more information.

Yes, I saw that attribute, but my question is if you could use it to search without using the name. Just the ID.

@github-anurag
Copy link
Member

@Kingg22
The name property is a required param for the GetObjectRequest request

For your usecase perhaps you can try using ListObjects and pass in the ETag in the fields parameter

@Kingg22
Copy link
Author

Kingg22 commented Nov 15, 2024

@Kingg22 The name property is a required param for the GetObjectRequest request

For your usecase perhaps you can try using ListObjects and pass in the ETag in the fields parameter

Thanks for that, anyway I wanted to leave the suggestion (although it is not directly the SDK but the API) to search for objects with other keys and not strictly the object name. That's all from me, thanks for the speed in responding to me. Have a good day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants