示例#1
0
// WireUpDomain prepares common resources to send request to Concerto API
func WireUpDomain(c *cli.Context) (ds *api.DomainService, f format.Formatter) {

	f = format.GetFormatter()

	config, err := utils.GetConcertoConfig()
	if err != nil {
		f.PrintFatal("Couldn't wire up config", err)
	}
	hcs, err := utils.NewHTTPConcertoService(config)
	if err != nil {
		f.PrintFatal("Couldn't wire up concerto service", err)
	}
	ds, err = api.NewDomainService(hcs)
	if err != nil {
		f.PrintFatal("Couldn't wire up domain service", err)
	}

	return ds, f
}
示例#2
0
// WireUpEvent prepares common resources to send request to Concerto API
func WireUpEvent(c *cli.Context) (ns *api.EventService, f format.Formatter) {

	f = format.GetFormatter()

	config, err := utils.GetConcertoConfig()
	if err != nil {
		f.PrintFatal("Couldn't wire up config", err)
	}
	hcs, err := utils.NewHTTPConcertoService(config)
	if err != nil {
		f.PrintFatal("Couldn't wire up concerto service", err)
	}
	ns, err = api.NewEventService(hcs)
	if err != nil {
		f.PrintFatal("Couldn't wire up event service", err)
	}

	return ns, f
}
示例#3
0
// WireUpCluster prepares common resources to send request to Concerto API
func WireUpCluster(c *cli.Context) (cs *api.ClusterService, f format.Formatter) {

	f = format.GetFormatter()

	config, err := utils.GetConcertoConfig()
	if err != nil {
		f.PrintFatal("Couldn't wire up config", err)
	}
	hcs, err := utils.NewHTTPConcertoService(config)
	if err != nil {
		f.PrintFatal("Couldn't wire up concerto service", err)
	}
	cs, err = api.NewClusterService(hcs)
	if err != nil {
		f.PrintFatal("Couldn't wire up cluster service", err)
	}

	return cs, f
}