MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / GetFunction

Method GetFunction

pkg/controller/registry/registry.go:72–97  ·  view source on GitHub ↗
(input *api.GetFunctionInput)

Source from the content-addressed store, hash-verified

70}
71
72func (c *RegistryClient) GetFunction(input *api.GetFunctionInput) (*api.GetFunctionOutput, error) {
73 req := c.client.Get().
74 Resource("functions/" + *input.FunctionName)
75 req.SetHeader("Host", req.URL().Host)
76 req.SetHeader(api.HeaderXRequestID, input.RequestID)
77
78 if input.SimpleAuth {
79 req.SetHeader(api.HeaderXAuthToken, "cfc-auth-2018")
80 req.SetHeader(api.BceFaasUIDKey, "root")
81 }
82 if c.authTransfer && input.Authorization != "" {
83 req.SetHeader(api.HeaderAuthorization, input.Authorization)
84 } else {
85 req.SetHeader(api.HeaderXAccountID, input.AccountID)
86 req.SetHeader(api.HeaderAuthorization, c.signer.GetSignature(req))
87 }
88
89 var out api.GetFunctionOutput
90 result := req.Do()
91 err := result.Into(&out)
92 if err != nil && result.GetStatusCode() == http.StatusNotFound {
93 finalErr := innerErr.NewResourceNotFoundException("get function from data storer failed", err)
94 return &out, finalErr
95 }
96 return &out, err
97}
98
99func (c *RegistryClient) GetAlias(input *api.GetAliasInput) (*api.GetAliasOutput, error) {
100 // TODO: not a common api

Callers

nothing calls this directly

Calls 8

ResourceMethod · 0.80
URLMethod · 0.80
IntoMethod · 0.80
GetStatusCodeMethod · 0.80
GetMethod · 0.65
GetSignatureMethod · 0.65
DoMethod · 0.65
SetHeaderMethod · 0.45

Tested by

no test coverage detected