MCPcopy
hub / github.com/minio/minio-go / main

Function main

examples/s3/putobjectannotation.go:32–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30)
31
32func main() {
33 // Note: my-bucketname, my-objectname and my-annotationname are dummy
34 // values, please replace them with original values.
35
36 s3Client, err := minio.New("play.min.io", &minio.Options{
37 Creds: credentials.NewStaticV4("Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG", ""),
38 Secure: true,
39 })
40 if err != nil {
41 log.Fatalln(err)
42 }
43
44 // The annotation payload is any byte stream (JSON/XML/YAML/plain), 1 byte to
45 // 1 MiB, supplied as an io.ReadSeeker so it can be streamed without buffering.
46 payload := strings.NewReader(`{"label":"cat","confidence":0.98}`)
47
48 etag, err := s3Client.PutObjectAnnotation(context.Background(), "my-bucketname", "my-objectname", "model.labels.json", payload, minio.PutObjectAnnotationOptions{
49 // VersionID: "target a specific object version",
50 // IfMatch: "only write if the object's ETag matches",
51 })
52 if err != nil {
53 log.Fatalln(err)
54 }
55
56 log.Printf("annotation written, etag: %s\n", etag)
57}

Callers

nothing calls this directly

Calls 2

NewStaticV4Function · 0.92
PutObjectAnnotationMethod · 0.80

Tested by

no test coverage detected