feat: add max age to replications create and update (#367)

This commit is contained in:
Dane Strandboge
2022-03-18 17:21:12 -05:00
committed by GitHub
parent c8c7c1c680
commit 88ba3464cd
6 changed files with 90 additions and 3 deletions

View File

@ -25,6 +25,7 @@ type CreateParams struct {
MaxQueueSize int64
DropNonRetryableData bool
NoDropNonRetryableData bool
MaxAge int64
}
func (c Client) Create(ctx context.Context, params *CreateParams) error {
@ -41,6 +42,7 @@ func (c Client) Create(ctx context.Context, params *CreateParams) error {
LocalBucketID: params.LocalBucketID,
RemoteBucketID: params.RemoteBucketID,
MaxQueueSizeBytes: params.MaxQueueSize,
MaxAgeSeconds: params.MaxAge,
}
// set optional params if specified
@ -118,6 +120,7 @@ type UpdateParams struct {
MaxQueueSize int64
DropNonRetryableData bool
NoDropNonRetryableData bool
MaxAge int64
}
func (c Client) Update(ctx context.Context, params *UpdateParams) error {
@ -153,6 +156,10 @@ func (c Client) Update(ctx context.Context, params *UpdateParams) error {
body.SetDropNonRetryableData(*dropNonRetryableDataBoolPtr)
}
if params.MaxAge != 0 {
body.SetMaxAgeSeconds(params.MaxAge)
}
// send patch request
res, err := c.PatchReplicationByID(ctx, params.ReplicationID).ReplicationUpdateRequest(body).Execute()
if err != nil {