Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/tenant/bucket-operations/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func createExampleBuckets(ctx context.Context, client *client.TenantClient) erro
Enabled: &config.objectLock,
DefaultRetentionSetting: &models.BucketS3ObjectLockDefaultRetentionSettings{
Mode: "COMPLIANCE",
Years: 1,
Years: "1",
},
}
}
Expand Down
16 changes: 13 additions & 3 deletions models/buckets.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package models

import "time"
import (
"encoding/json"
"time"
)

type Bucket struct {
// if true, object versioning will be enabled for the bucket.
Expand Down Expand Up @@ -30,9 +33,16 @@ type BucketS3ObjectLockDefaultRetentionSettings struct {
// The retention mode used for new objects added to this bucket. Must be compliance, which means that an object version cannot be overwritten or deleted by any user.
Mode string `json:"mode"`
// The length of the default retention period for new objects added to this bucket, in days. If provided, must be paired with retentionMode. Does not affect existing bucket objects or objects with their own retain-until-date settings.
Days int32 `json:"days,omitempty"`
//
// Typed as json.Number because the StorageGRID API returns this value
// as a JSON string (e.g. "30") even though it accepts an integer on
// write. json.Number tolerates both encodings on read and marshals
// back as a bare numeric literal on write.
Days json.Number `json:"days,omitempty"`
// The length of the default retention period for new objects added to this bucket, in years. If provided, must be paired with retentionMode. Does not affect existing bucket objects or objects with their own retain-until-date settings.
Years int32 `json:"years,omitempty"`
//
// See Days for why this is typed as json.Number.
Years json.Number `json:"years,omitempty"`
}

type BucketComplianceSettings struct {
Expand Down