mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 17:35:43 +03:00
Merge pull request #10806 from hashicorp/munda/idempotent-job-dispatch
Enforce idempotency of dispatched jobs using token on dispatch request
This commit is contained in:
6
vendor/github.com/hashicorp/nomad/api/api.go
generated
vendored
6
vendor/github.com/hashicorp/nomad/api/api.go
generated
vendored
@@ -93,6 +93,9 @@ type WriteOptions struct {
|
||||
// ctx is an optional context pass through to the underlying HTTP
|
||||
// request layer. Use Context() and WithContext() to manage this.
|
||||
ctx context.Context
|
||||
|
||||
// IdempotencyToken can be used to ensure the write is idempotent.
|
||||
IdempotencyToken string
|
||||
}
|
||||
|
||||
// QueryMeta is used to return meta data about a query
|
||||
@@ -593,6 +596,9 @@ func (r *request) setWriteOptions(q *WriteOptions) {
|
||||
if q.AuthToken != "" {
|
||||
r.token = q.AuthToken
|
||||
}
|
||||
if q.IdempotencyToken != "" {
|
||||
r.params.Set("idempotency_token", q.IdempotencyToken)
|
||||
}
|
||||
r.ctx = q.Context()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user