@@ -424,6 +424,68 @@ def create_bucket_fork(tigris, bucket_name):
424424</TabItem >
425425</Tabs >
426426
427+ ### Listing and Retrieving Objects from a Snapshot
428+
429+ Objects can be listed in a snapshot with the same ListObjectsV2 API call, with
430+ an additional header: ` X-Tigris-Snapshot-Version: SNAPSHOT_VERSION ` . Similarly,
431+ specific versions of an object in a particular snapshot can be retrieved with
432+ the same GetObject API call and header. The same approach also applies to
433+ HeadObject requests.
434+
435+ Below is an example of retrieving an object from a snapshot:
436+
437+ <Tabs groupId = " languages" >
438+ <TabItem value = " go" label = " Go" >
439+ Example using the Go SDK ` github.com/aws/aws-sdk-go-v2/service/s3 ` :
440+
441+ ``` go
442+ func getObjectFromSnapshot (ctx context .Context , client *s3 .Client , bucket string , object string , snapshotVersion string ) (*s3 .GetObjectOutput , error ) {
443+ return client.GetObject (ctx, &s3.GetObjectInput {Bucket: aws.String (bucket), Key: aws.String (object)}, func (options *s3.Options ) {
444+ options.APIOptions = append (options.APIOptions , http.AddHeaderValue (" X-Tigris-Snapshot-Version" , snapshotVersion))
445+ })
446+ }
447+ ```
448+
449+ </TabItem >
450+
451+ <TabItem value = " js" label = " JavaScript" >
452+ Example using the AWS SDK for JavaScript v3:
453+
454+ ``` js
455+ import { S3Client , GetObjectCommand } from " @aws-sdk/client-s3" ;
456+
457+ async function getObjectFromSnapshot (client , bucket , key , snapshotVersion ) {
458+ return client .send (
459+ new GetObjectCommand ({
460+ Bucket: bucket,
461+ Key: key,
462+ $httpOptions: {
463+ headers: { " X-Tigris-Snapshot-Version" : snapshotVersion },
464+ },
465+ }),
466+ );
467+ }
468+ ```
469+
470+ </TabItem >
471+ <TabItem value = " python" label = " Python" >
472+ Example using the Python SDK boto3:
473+
474+ ``` python
475+ def get_object_from_snapshot (s3_client , bucket_name , object_key , snapshot_version ):
476+ def add_header (request , ** kwargs ):
477+ request.headers[" X-Tigris-Snapshot-Version" ] = snapshot_version
478+ s3_client.meta.events.register(" before-sign.s3.GetObject" , add_header)
479+ try :
480+ response = s3_client.get_object(Bucket = bucket_name, Key = object_key)
481+ return response
482+ finally :
483+ s3_client.meta.events.unregister(" before-sign.s3.GetObject" , add_header)
484+ ```
485+
486+ </TabItem >
487+ </Tabs >
488+
427489### Using a Forked Bucket
428490
429491Forked buckets behave the same as regular buckets, and you can use the usual
@@ -432,6 +494,14 @@ tooling (AWS CLI or SDK) to work with them.
432494The only restriction is that the parent bucket cannot be deleted while forked
433495buckets depend on it.
434496
497+ ### Authorization
498+
499+ Snapshotting and forking operations on existing buckets are limited to users who
500+ are bucket owners, organization admins, or have ReadOnly (or Editor) access to
501+ the buckets. This includes all operations mentioned above, such as creating a
502+ snapshot, creating a fork from a specific parent bucket, or listing objects in a
503+ snapshot.
504+
435505## Limitations and Upcoming Functionality
436506
437507### Current Limitations
0 commit comments