| 37 | } |
| 38 | |
| 39 | func NewControllerClient(runOptions *ControllerClientOptions) (c *ControllerClient, err error) { |
| 40 | u, err := url.Parse(runOptions.Host) |
| 41 | if err != nil { |
| 42 | return nil, InvaildConfigError{Reason: fmt.Sprintf("invaild host %s", runOptions.Host)} |
| 43 | } |
| 44 | client := rest.NewFastClient(u.Host) |
| 45 | return &ControllerClient{ |
| 46 | client: client, |
| 47 | scheme: u.Scheme, |
| 48 | prefix: u.Path, |
| 49 | version: "v1", |
| 50 | host: u.Host, |
| 51 | }, nil |
| 52 | } |
| 53 | |
| 54 | func (c *ControllerClient) Invoke(ir *api.InvokeRequest) (response *api.InvokeResponse, err error) { |
| 55 | response = api.NewInvokeResponse() |