()
| 29 | ) |
| 30 | |
| 31 | func main() { |
| 32 | // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-bucketname, my-objectname and |
| 33 | // my-testfile are dummy values, please replace them with original values. |
| 34 | |
| 35 | // Requests are always secure (HTTPS) by default. Set secure=false to enable insecure (HTTP) access. |
| 36 | // This boolean value is the last argument for New(). |
| 37 | |
| 38 | // New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically |
| 39 | // determined based on the Endpoint value. |
| 40 | s3Client, err := minio.New("s3.amazonaws.com", &minio.Options{ |
| 41 | Creds: credentials.NewStaticV4("YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", ""), |
| 42 | Secure: true, |
| 43 | }) |
| 44 | if err != nil { |
| 45 | log.Fatalln(err) |
| 46 | } |
| 47 | s := minio.LegalHoldEnabled |
| 48 | opts := minio.PutObjectLegalHoldOptions{ |
| 49 | Status: &s, |
| 50 | } |
| 51 | err = s3Client.PutObjectLegalHold(context.Background(), "my-bucket", "my-object", opts) |
| 52 | if err != nil { |
| 53 | log.Fatalln(err) |
| 54 | } |
| 55 | log.Println("Set object legal-hold on my-object successfully.") |
| 56 | } |
nothing calls this directly
no test coverage detected