@@ -20,10 +20,10 @@ import (
2020 "golang.org/x/net/context"
2121)
2222
23- func newFuncEndpointRequest (method , subpath string , query url.Values , body io.Reader ) (* http.Request , error ) {
23+ func newFuncEndpointRequest (region , method , subpath string , query url.Values , body io.Reader ) (* http.Request , error ) {
2424 endpoint := os .Getenv ("HYPER_FUNC_ENDPOINT" )
2525 if endpoint == "" {
26- endpoint = "us-west-1 .hyperfunc.io"
26+ endpoint = region + " .hyperfunc.io"
2727 }
2828 apiURL , err := url .Parse (endpoint )
2929 if err != nil {
@@ -182,7 +182,7 @@ func (cli *Client) FuncInspectWithCallId(ctx context.Context, id string) (*types
182182 return & fn , err
183183}
184184
185- func (cli * Client ) FuncCall (ctx context.Context , name string , stdin io.Reader , sync bool ) (io.ReadCloser , error ) {
185+ func (cli * Client ) FuncCall (ctx context.Context , region , name string , stdin io.Reader , sync bool ) (io.ReadCloser , error ) {
186186 fn , _ , err := cli .FuncInspectWithRaw (ctx , name )
187187 if err != nil {
188188 return nil , err
@@ -191,7 +191,7 @@ func (cli *Client) FuncCall(ctx context.Context, name string, stdin io.Reader, s
191191 if sync {
192192 subpath += "/sync"
193193 }
194- req , err := newFuncEndpointRequest ("POST" , path .Join ("call" , name , fn .UUID , subpath ), nil , stdin )
194+ req , err := newFuncEndpointRequest (region , "POST" , path .Join ("call" , name , fn .UUID , subpath ), nil , stdin )
195195 if err != nil {
196196 return nil , err
197197 }
@@ -202,7 +202,7 @@ func (cli *Client) FuncCall(ctx context.Context, name string, stdin io.Reader, s
202202 return resp .Body , nil
203203}
204204
205- func (cli * Client ) FuncGet (ctx context.Context , callId string , wait bool ) (io.ReadCloser , error ) {
205+ func (cli * Client ) FuncGet (ctx context.Context , region , callId string , wait bool ) (io.ReadCloser , error ) {
206206 fn , err := cli .FuncInspectWithCallId (ctx , callId )
207207 if err != nil {
208208 return nil , err
@@ -211,7 +211,7 @@ func (cli *Client) FuncGet(ctx context.Context, callId string, wait bool) (io.Re
211211 if wait {
212212 subpath += "/wait"
213213 }
214- req , err := newFuncEndpointRequest ("GET" , path .Join ("output" , fn .Name , fn .UUID , subpath ), nil , nil )
214+ req , err := newFuncEndpointRequest (region , "GET" , path .Join ("output" , fn .Name , fn .UUID , subpath ), nil , nil )
215215 if err != nil {
216216 return nil , err
217217 }
@@ -222,7 +222,7 @@ func (cli *Client) FuncGet(ctx context.Context, callId string, wait bool) (io.Re
222222 return resp .Body , nil
223223}
224224
225- func (cli * Client ) FuncLogs (ctx context.Context , name , callId string , follow bool , tail string ) (io.ReadCloser , error ) {
225+ func (cli * Client ) FuncLogs (ctx context.Context , region , name , callId string , follow bool , tail string ) (io.ReadCloser , error ) {
226226 fn , _ , err := cli .FuncInspectWithRaw (ctx , name )
227227 if err != nil {
228228 return nil , err
@@ -237,7 +237,7 @@ func (cli *Client) FuncLogs(ctx context.Context, name, callId string, follow boo
237237 if tail != "" {
238238 query .Add ("tail" , tail )
239239 }
240- req , err := newFuncEndpointRequest ("GET" , path .Join ("logs" , name , fn .UUID , "" ), query , nil )
240+ req , err := newFuncEndpointRequest (region , "GET" , path .Join ("logs" , name , fn .UUID , "" ), query , nil )
241241 if err != nil {
242242 return nil , err
243243 }
@@ -255,15 +255,15 @@ func (cli *Client) FuncLogs(ctx context.Context, name, callId string, follow boo
255255 return resp .Body , nil
256256}
257257
258- func (cli * Client ) FuncStatus (ctx context.Context , name string ) (* types.FuncStatusResponse , error ) {
258+ func (cli * Client ) FuncStatus (ctx context.Context , region , name string ) (* types.FuncStatusResponse , error ) {
259259 fn , _ , err := cli .FuncInspectWithRaw (ctx , name )
260260 if err != nil {
261261 return nil , err
262262 }
263263
264264 query := url.Values {}
265265 query .Set ("list" , strconv .FormatBool (false ))
266- req , err := newFuncEndpointRequest ("GET" , path .Join ("status" , name , fn .UUID ), query , nil )
266+ req , err := newFuncEndpointRequest (region , "GET" , path .Join ("status" , name , fn .UUID ), query , nil )
267267 if err != nil {
268268 return nil , err
269269 }
0 commit comments