You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead you could create a new type Instance, i think which I suggested somewhere else and maintain a list of this type whose items gets modified/deleted/added throught the update process.
What data would be held in type called Instance? Would it be a tuple of (instanceID, containerInstanceARN)?
Taking a named struct (see above) might have helped here as well.
I think you're on the right track - I'd want to take it further than the Instance type thought.
The behavior in this main function looks like it could be collected into a management type.. or even just a package with a "main" type fed into most of its functions:
package managed // import path: updater/managedtypeClusterInstancesstruct {
// ...
}
func (ci*ClusterInstances) Instances() []Instance {
// ...
}
// CollectCluster retrieves a set of cluster instances to manage in the named ECS cluster.funcCollectCluster(ecsiface.ECS, clusterNamestring) (*managed.ClusterInstances, error) {
// list instances and collect cluster instances that should be managed// ...
}
typeInstanceinterface {
Cluster() stringContainerInstanceARN() stringInstanceID() string// ...
}
funcDrain(ecsiface.ECS, instances []Instance) error {
for_, inst:=rangeinstances {
// build request
}
// send drain request
}
Me, carried away..
With such a package, main can look like (with some filling in where needed):
func_main() error {
// build clientsmci, err:=managed.CollectCluster(ecsclient, *flagCluster)
iferr!=nil {
// ...
}
// filter set of instances as necessary or just do all of them.. for example:err=managed.Drain(ecsclient, mci.Instances())
iferr!=// ...// more fictional types, just to get carried away.ssmcommander.Run(ssmclient, mci.Instances(),
&api.ClientCommand{
Command: "update check",
})
// ... and on ...
}
What data would be held in type called
Instance
? Would it be a tuple of(instanceID, containerInstanceARN)
?I think you're on the right track - I'd want to take it further than the
Instance
type thought.The behavior in this main function looks like it could be collected into a management type.. or even just a package with a "main" type fed into most of its functions:
Me, carried away..
With such a package, main can look like (with some filling in where needed):
Originally posted by @jahkeup in #35 (comment)
The text was updated successfully, but these errors were encountered: