Renaming RealisClient to Client to avoid stuttering. Moving monitors under Client. Making configuration object private. Deleted legacy code to generate configuration object.

This commit is contained in:
Renan DelValle 2018-12-08 08:57:15 -08:00
parent c1be2fe62b
commit 76300782ba
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9
7 changed files with 253 additions and 256 deletions

View file

@ -125,7 +125,7 @@ func init() {
}
}
func CreateRealisClient(config *Config) (*realis.RealisClient, error) {
func CreateRealisClient(config *Config) (*realis.Client, error) {
var transportOption realis.ClientOption
// Configuring transport protocol. If not transport is provided, then using JSON as the
// default transport protocol.
@ -157,7 +157,7 @@ func CreateRealisClient(config *Config) (*realis.RealisClient, error) {
clientOptions = append(clientOptions, realis.Debug())
}
return realis.NewRealisClient(clientOptions...)
return realis.NewClient(clientOptions...)
}
func main() {
@ -165,7 +165,6 @@ func main() {
fmt.Println(clientCreationErr)
os.Exit(1)
} else {
monitor := &realis.Monitor{Client: r}
defer r.Close()
uris := job.URIs
labels := job.Labels
@ -209,7 +208,7 @@ func main() {
fmt.Println("Error creating Aurora job: ", jobCreationErr)
os.Exit(1)
} else {
if ok, monitorErr := monitor.Instances(auroraJob.JobKey(), auroraJob.GetInstanceCount(), 5, 50); !ok || monitorErr != nil {
if ok, monitorErr := r.InstancesMonitor(auroraJob.JobKey(), auroraJob.GetInstanceCount(), 5, 50); !ok || monitorErr != nil {
if jobErr := r.KillJob(auroraJob.JobKey()); jobErr !=
nil {
fmt.Println(jobErr)