Merge pull request #14686 from influxdata/feat/create-task-from-check
feat(check): pass ownerID to task on createpull/14694/head
commit
2710fac45f
4
check.go
4
check.go
|
@ -18,9 +18,9 @@ type Check interface {
|
|||
ClearPrivateData()
|
||||
SetTaskID(ID)
|
||||
GetTaskID() ID
|
||||
GenerateFlux() (string, error)
|
||||
GetOwnerID() ID
|
||||
SetOwnerID(id ID)
|
||||
SetOwnerID(ID)
|
||||
GenerateFlux() (string, error)
|
||||
json.Marshaler
|
||||
Updater
|
||||
Getter
|
||||
|
|
|
@ -301,6 +301,7 @@ func decodePostCheckRequest(ctx context.Context, r *http.Request) (influxdb.Chec
|
|||
Err: err,
|
||||
}
|
||||
}
|
||||
|
||||
return chk, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -508,6 +508,7 @@ func TestService_handlePostCheck(t *testing.T) {
|
|||
Base: check.Base{
|
||||
Name: "hello",
|
||||
OrgID: influxTesting.MustIDBase16("6f626f7274697320"),
|
||||
OwnerID: influxTesting.MustIDBase16("6f626f7274697321"),
|
||||
Description: "desc1",
|
||||
StatusMessageTemplate: "msg1",
|
||||
Status: influxdb.Active,
|
||||
|
|
|
@ -115,6 +115,11 @@ func (b Base) GetOrgID() influxdb.ID {
|
|||
return b.OrgID
|
||||
}
|
||||
|
||||
// GetOwnerID gets the ownerID associated with a Base.
|
||||
func (b Base) GetOwnerID() influxdb.ID {
|
||||
return b.OwnerID
|
||||
}
|
||||
|
||||
// GetTaskID retrieves the task ID for a check.
|
||||
func (b Base) GetTaskID() influxdb.ID {
|
||||
return b.TaskID
|
||||
|
@ -125,11 +130,6 @@ func (b Base) GetCRUDLog() influxdb.CRUDLog {
|
|||
return b.CRUDLog
|
||||
}
|
||||
|
||||
// GetOwnerID gets the authID for a check
|
||||
func (b Base) GetOwnerID() influxdb.ID {
|
||||
return b.OwnerID
|
||||
}
|
||||
|
||||
// GetName implements influxdb.Getter interface.
|
||||
func (b *Base) GetName() string {
|
||||
return b.Name
|
||||
|
@ -155,11 +155,6 @@ func (b *Base) SetOrgID(id influxdb.ID) {
|
|||
b.OrgID = id
|
||||
}
|
||||
|
||||
// SetOwnerID will set the org key.
|
||||
func (b *Base) SetOwnerID(id influxdb.ID) {
|
||||
b.OwnerID = id
|
||||
}
|
||||
|
||||
// ClearPrivateData remove any data that we don't want to be exposed publicly.
|
||||
func (b *Base) ClearPrivateData() {
|
||||
b.TaskID = 0
|
||||
|
@ -170,6 +165,11 @@ func (b *Base) SetTaskID(id influxdb.ID) {
|
|||
b.TaskID = id
|
||||
}
|
||||
|
||||
// SetOwnerID sets the taskID for a check.
|
||||
func (b *Base) SetOwnerID(id influxdb.ID) {
|
||||
b.OwnerID = id
|
||||
}
|
||||
|
||||
// SetName implements influxdb.Updator interface.
|
||||
func (b *Base) SetName(name string) {
|
||||
b.Name = name
|
||||
|
|
|
@ -309,6 +309,7 @@ func CreateCheck(
|
|||
Base: check.Base{
|
||||
Name: "name2",
|
||||
OrgID: MustIDBase16(orgTwoID),
|
||||
OwnerID: MustIDBase16(twoID),
|
||||
Description: "desc2",
|
||||
Status: influxdb.Active,
|
||||
StatusMessageTemplate: "msg2",
|
||||
|
|
Loading…
Reference in New Issue