Skip to content

Commit

Permalink
add edge flag to remote target (#306)
Browse files Browse the repository at this point in the history
this flag designates if target is receiving edge traffic
  • Loading branch information
poornas authored Sep 13, 2024
1 parent 7de8c4e commit 7ed9c8d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions remote-target-commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ type BucketTarget struct {
Online bool `json:"isOnline"`
Latency LatencyStat `json:"latency"`
DeploymentID string `json:"deploymentID,omitempty"`
Edge bool `json:"edge"` // target is recipient of edge traffic
}

// Clone returns shallow clone of BucketTarget without secret key in credentials
Expand Down Expand Up @@ -135,6 +136,7 @@ func (t *BucketTarget) Clone() BucketTarget {
Online: t.Online,
Latency: t.Latency,
DeploymentID: t.DeploymentID,
Edge: t.Edge,
}
}

Expand Down Expand Up @@ -270,6 +272,8 @@ const (
PathUpdateType
// ResetUpdateType sets ResetBeforeDate and ResetID on a bucket target
ResetUpdateType
// EdgeUpdateType sets bucket target as a recipent of edge traffic
EdgeUpdateType
)

// GetTargetUpdateOps returns a slice of update operations being
Expand Down Expand Up @@ -297,6 +301,9 @@ func GetTargetUpdateOps(values url.Values) []TargetUpdateType {
if values.Get("path") == "true" {
ops = append(ops, PathUpdateType)
}
if values.Get("edge") == "true" {
ops = append(ops, EdgeUpdateType)
}
return ops
}

Expand Down Expand Up @@ -331,6 +338,8 @@ func (adm *AdminClient) UpdateRemoteTarget(ctx context.Context, target *BucketTa
queryValues.Set("healthcheck", "true")
case PathUpdateType:
queryValues.Set("path", "true")
case EdgeUpdateType:
queryValues.Set("edge", "true")
}
}

Expand Down

0 comments on commit 7ed9c8d

Please sign in to comment.