// MakeStopLink creates a tokenized link for stopping func makeStopLink(region reapable.Region, id reapable.ID, tokenSecret, apiURL string) (string, error) { stop, err := token.Tokenize(tokenSecret, token.NewStopJob(region.String(), id.String())) if err != nil { log.Error("Error creating ScaleToZero link: ", err) return "", err } return makeURL(apiURL, "stop", stop), nil }
// MakeWhitelistLink creates a tokenized link for whitelisting func makeWhitelistLink(region reapable.Region, id reapable.ID, tokenSecret, apiURL string) (string, error) { whitelist, err := token.Tokenize(tokenSecret, token.NewWhitelistJob(region.String(), id.String())) if err != nil { log.Error("Error creating whitelist link: ", err) return "", err } return makeURL(apiURL, "whitelist", whitelist), nil }
// MakeTerminateLink creates a tokenized link for terminating func makeTerminateLink(region reapable.Region, id reapable.ID, tokenSecret, apiURL string) (string, error) { term, err := token.Tokenize(tokenSecret, token.NewTerminateJob(region.String(), id.String())) if err != nil { return "", err } return makeURL(apiURL, "terminate", term), nil }
// MakeIgnoreLink creates a tokenized link for ignoring for a duration func makeIgnoreLink(region reapable.Region, id reapable.ID, tokenSecret, apiURL string, duration time.Duration) (string, error) { delay, err := token.Tokenize(tokenSecret, token.NewDelayJob(region.String(), id.String(), duration)) if err != nil { return "", err } action := "delay_" + duration.String() return makeURL(apiURL, action, delay), nil }