| 1 |
package callrules |
| 2 |
|
| 3 |
import ( |
| 4 |
"context" |
| 5 |
|
| 6 |
"github.com/mesos/mesos-go/api/v1/lib" |
| 7 |
"github.com/mesos/mesos-go/api/v1/lib/scheduler" |
| 8 |
) |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
func WithFrameworkID(frameworkID func() string) Rule { |
| 14 |
return func(ctx context.Context, c *scheduler.Call, r mesos.Response, err error, ch Chain) (context.Context, *scheduler.Call, mesos.Response, error) { |
| 15 |
|
| 16 |
if c.GetType() != scheduler.Call_SUBSCRIBE { |
| 17 |
if fid := frameworkID(); fid != "" { |
| 18 |
c2 := *c |
| 19 |
c2.FrameworkID = &mesos.FrameworkID{Value: fid} |
| 20 |
c = &c2 |
| 21 |
} |
| 22 |
} |
| 23 |
return ch(ctx, c, r, err) |
| 24 |
} |
| 25 |
} |