id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
24,300
couchbase/go-couchbase
views.go
ViewURL
func (b *Bucket) ViewURL(ddoc, name string, params map[string]interface{}) (string, error) { u, err := b.randomBaseURL() if err != nil { return "", err } values := url.Values{} for k, v := range params { switch t := v.(type) { case DocID: values[k] = []string{string(t)} case string: values[k] = []s...
go
func (b *Bucket) ViewURL(ddoc, name string, params map[string]interface{}) (string, error) { u, err := b.randomBaseURL() if err != nil { return "", err } values := url.Values{} for k, v := range params { switch t := v.(type) { case DocID: values[k] = []string{string(t)} case string: values[k] = []s...
[ "func", "(", "b", "*", "Bucket", ")", "ViewURL", "(", "ddoc", ",", "name", "string", ",", "params", "map", "[", "string", "]", "interface", "{", "}", ")", "(", "string", ",", "error", ")", "{", "u", ",", "err", ":=", "b", ".", "randomBaseURL", "(...
// ViewURL constructs a URL for a view with the given ddoc, view name, // and parameters.
[ "ViewURL", "constructs", "a", "URL", "for", "a", "view", "with", "the", "given", "ddoc", "view", "name", "and", "parameters", "." ]
6aeabeae85e5645306382779e3ee55a330ec558c
https://github.com/couchbase/go-couchbase/blob/6aeabeae85e5645306382779e3ee55a330ec558c/views.go#L114-L150
24,301
couchbase/go-couchbase
views.go
ViewCustom
func (b *Bucket) ViewCustom(ddoc, name string, params map[string]interface{}, vres interface{}) (err error) { if SlowServerCallWarningThreshold > 0 { defer slowLog(time.Now(), "call to ViewCustom(%q, %q)", ddoc, name) } if ViewCallback != nil { defer func(t time.Time) { ViewCallback(ddoc, name, t, err) }(time....
go
func (b *Bucket) ViewCustom(ddoc, name string, params map[string]interface{}, vres interface{}) (err error) { if SlowServerCallWarningThreshold > 0 { defer slowLog(time.Now(), "call to ViewCustom(%q, %q)", ddoc, name) } if ViewCallback != nil { defer func(t time.Time) { ViewCallback(ddoc, name, t, err) }(time....
[ "func", "(", "b", "*", "Bucket", ")", "ViewCustom", "(", "ddoc", ",", "name", "string", ",", "params", "map", "[", "string", "]", "interface", "{", "}", ",", "vres", "interface", "{", "}", ")", "(", "err", "error", ")", "{", "if", "SlowServerCallWarn...
// ViewCustom performs a view request that can map row values to a // custom type. // // See the source to View for an example usage.
[ "ViewCustom", "performs", "a", "view", "request", "that", "can", "map", "row", "values", "to", "a", "custom", "type", ".", "See", "the", "source", "to", "View", "for", "an", "example", "usage", "." ]
6aeabeae85e5645306382779e3ee55a330ec558c
https://github.com/couchbase/go-couchbase/blob/6aeabeae85e5645306382779e3ee55a330ec558c/views.go#L159-L201
24,302
gogs/go-gogs-client
repo.go
ListMyRepos
func (c *Client) ListMyRepos() ([]*Repository, error) { repos := make([]*Repository, 0, 10) return repos, c.getParsedResponse("GET", "/user/repos", nil, nil, &repos) }
go
func (c *Client) ListMyRepos() ([]*Repository, error) { repos := make([]*Repository, 0, 10) return repos, c.getParsedResponse("GET", "/user/repos", nil, nil, &repos) }
[ "func", "(", "c", "*", "Client", ")", "ListMyRepos", "(", ")", "(", "[", "]", "*", "Repository", ",", "error", ")", "{", "repos", ":=", "make", "(", "[", "]", "*", "Repository", ",", "0", ",", "10", ")", "\n", "return", "repos", ",", "c", ".", ...
// ListMyRepos lists all repositories for the authenticated user that has access to.
[ "ListMyRepos", "lists", "all", "repositories", "for", "the", "authenticated", "user", "that", "has", "access", "to", "." ]
1cd0db3113de87dbac702b9f1a08d9bd0e7142bb
https://github.com/gogs/go-gogs-client/blob/1cd0db3113de87dbac702b9f1a08d9bd0e7142bb/repo.go#L49-L52
24,303
gogs/go-gogs-client
repo.go
CreateRepo
func (c *Client) CreateRepo(opt CreateRepoOption) (*Repository, error) { body, err := json.Marshal(&opt) if err != nil { return nil, err } repo := new(Repository) return repo, c.getParsedResponse("POST", "/user/repos", jsonHeader, bytes.NewReader(body), repo) }
go
func (c *Client) CreateRepo(opt CreateRepoOption) (*Repository, error) { body, err := json.Marshal(&opt) if err != nil { return nil, err } repo := new(Repository) return repo, c.getParsedResponse("POST", "/user/repos", jsonHeader, bytes.NewReader(body), repo) }
[ "func", "(", "c", "*", "Client", ")", "CreateRepo", "(", "opt", "CreateRepoOption", ")", "(", "*", "Repository", ",", "error", ")", "{", "body", ",", "err", ":=", "json", ".", "Marshal", "(", "&", "opt", ")", "\n", "if", "err", "!=", "nil", "{", ...
// CreateRepo creates a repository for authenticated user.
[ "CreateRepo", "creates", "a", "repository", "for", "authenticated", "user", "." ]
1cd0db3113de87dbac702b9f1a08d9bd0e7142bb
https://github.com/gogs/go-gogs-client/blob/1cd0db3113de87dbac702b9f1a08d9bd0e7142bb/repo.go#L75-L82
24,304
gogs/go-gogs-client
repo.go
CreateOrgRepo
func (c *Client) CreateOrgRepo(org string, opt CreateRepoOption) (*Repository, error) { body, err := json.Marshal(&opt) if err != nil { return nil, err } repo := new(Repository) return repo, c.getParsedResponse("POST", fmt.Sprintf("/org/%s/repos", org), jsonHeader, bytes.NewReader(body), repo) }
go
func (c *Client) CreateOrgRepo(org string, opt CreateRepoOption) (*Repository, error) { body, err := json.Marshal(&opt) if err != nil { return nil, err } repo := new(Repository) return repo, c.getParsedResponse("POST", fmt.Sprintf("/org/%s/repos", org), jsonHeader, bytes.NewReader(body), repo) }
[ "func", "(", "c", "*", "Client", ")", "CreateOrgRepo", "(", "org", "string", ",", "opt", "CreateRepoOption", ")", "(", "*", "Repository", ",", "error", ")", "{", "body", ",", "err", ":=", "json", ".", "Marshal", "(", "&", "opt", ")", "\n", "if", "e...
// CreateOrgRepo creates an organization repository for authenticated user.
[ "CreateOrgRepo", "creates", "an", "organization", "repository", "for", "authenticated", "user", "." ]
1cd0db3113de87dbac702b9f1a08d9bd0e7142bb
https://github.com/gogs/go-gogs-client/blob/1cd0db3113de87dbac702b9f1a08d9bd0e7142bb/repo.go#L85-L92
24,305
gogs/go-gogs-client
repo.go
GetRepo
func (c *Client) GetRepo(owner, reponame string) (*Repository, error) { repo := new(Repository) return repo, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s", owner, reponame), nil, nil, repo) }
go
func (c *Client) GetRepo(owner, reponame string) (*Repository, error) { repo := new(Repository) return repo, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s", owner, reponame), nil, nil, repo) }
[ "func", "(", "c", "*", "Client", ")", "GetRepo", "(", "owner", ",", "reponame", "string", ")", "(", "*", "Repository", ",", "error", ")", "{", "repo", ":=", "new", "(", "Repository", ")", "\n", "return", "repo", ",", "c", ".", "getParsedResponse", "(...
// GetRepo returns information of a repository of given owner.
[ "GetRepo", "returns", "information", "of", "a", "repository", "of", "given", "owner", "." ]
1cd0db3113de87dbac702b9f1a08d9bd0e7142bb
https://github.com/gogs/go-gogs-client/blob/1cd0db3113de87dbac702b9f1a08d9bd0e7142bb/repo.go#L95-L98
24,306
gogs/go-gogs-client
repo.go
DeleteRepo
func (c *Client) DeleteRepo(owner, repo string) error { _, err := c.getResponse("DELETE", fmt.Sprintf("/repos/%s/%s", owner, repo), nil, nil) return err }
go
func (c *Client) DeleteRepo(owner, repo string) error { _, err := c.getResponse("DELETE", fmt.Sprintf("/repos/%s/%s", owner, repo), nil, nil) return err }
[ "func", "(", "c", "*", "Client", ")", "DeleteRepo", "(", "owner", ",", "repo", "string", ")", "error", "{", "_", ",", "err", ":=", "c", ".", "getResponse", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "owner", ",", "repo", ...
// DeleteRepo deletes a repository of user or organization.
[ "DeleteRepo", "deletes", "a", "repository", "of", "user", "or", "organization", "." ]
1cd0db3113de87dbac702b9f1a08d9bd0e7142bb
https://github.com/gogs/go-gogs-client/blob/1cd0db3113de87dbac702b9f1a08d9bd0e7142bb/repo.go#L101-L104
24,307
gogs/go-gogs-client
repo.go
EditIssueTracker
func (c *Client) EditIssueTracker(owner, repo string, opt EditIssueTrackerOption) error { body, err := json.Marshal(&opt) if err != nil { return err } _, err = c.getResponse("PATCH", fmt.Sprintf("/repos/%s/%s/issue-tracker", owner, repo), jsonHeader, bytes.NewReader(body)) return err }
go
func (c *Client) EditIssueTracker(owner, repo string, opt EditIssueTrackerOption) error { body, err := json.Marshal(&opt) if err != nil { return err } _, err = c.getResponse("PATCH", fmt.Sprintf("/repos/%s/%s/issue-tracker", owner, repo), jsonHeader, bytes.NewReader(body)) return err }
[ "func", "(", "c", "*", "Client", ")", "EditIssueTracker", "(", "owner", ",", "repo", "string", ",", "opt", "EditIssueTrackerOption", ")", "error", "{", "body", ",", "err", ":=", "json", ".", "Marshal", "(", "&", "opt", ")", "\n", "if", "err", "!=", "...
// EditIssueTracker updates issue tracker options of the repository.
[ "EditIssueTracker", "updates", "issue", "tracker", "options", "of", "the", "repository", "." ]
1cd0db3113de87dbac702b9f1a08d9bd0e7142bb
https://github.com/gogs/go-gogs-client/blob/1cd0db3113de87dbac702b9f1a08d9bd0e7142bb/repo.go#L140-L147
24,308
gogs/go-gogs-client
issue_comment.go
ListIssueComments
func (c *Client) ListIssueComments(owner, repo string, index int64) ([]*Comment, error) { comments := make([]*Comment, 0, 10) return comments, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/%d/comments", owner, repo, index), nil, nil, &comments) }
go
func (c *Client) ListIssueComments(owner, repo string, index int64) ([]*Comment, error) { comments := make([]*Comment, 0, 10) return comments, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/%d/comments", owner, repo, index), nil, nil, &comments) }
[ "func", "(", "c", "*", "Client", ")", "ListIssueComments", "(", "owner", ",", "repo", "string", ",", "index", "int64", ")", "(", "[", "]", "*", "Comment", ",", "error", ")", "{", "comments", ":=", "make", "(", "[", "]", "*", "Comment", ",", "0", ...
// ListIssueComments list comments on an issue.
[ "ListIssueComments", "list", "comments", "on", "an", "issue", "." ]
1cd0db3113de87dbac702b9f1a08d9bd0e7142bb
https://github.com/gogs/go-gogs-client/blob/1cd0db3113de87dbac702b9f1a08d9bd0e7142bb/issue_comment.go#L25-L28
24,309
gogs/go-gogs-client
issue_comment.go
ListRepoIssueComments
func (c *Client) ListRepoIssueComments(owner, repo string) ([]*Comment, error) { comments := make([]*Comment, 0, 10) return comments, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/comments", owner, repo), nil, nil, &comments) }
go
func (c *Client) ListRepoIssueComments(owner, repo string) ([]*Comment, error) { comments := make([]*Comment, 0, 10) return comments, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/comments", owner, repo), nil, nil, &comments) }
[ "func", "(", "c", "*", "Client", ")", "ListRepoIssueComments", "(", "owner", ",", "repo", "string", ")", "(", "[", "]", "*", "Comment", ",", "error", ")", "{", "comments", ":=", "make", "(", "[", "]", "*", "Comment", ",", "0", ",", "10", ")", "\n...
// ListRepoIssueComments list comments for a given repo.
[ "ListRepoIssueComments", "list", "comments", "for", "a", "given", "repo", "." ]
1cd0db3113de87dbac702b9f1a08d9bd0e7142bb
https://github.com/gogs/go-gogs-client/blob/1cd0db3113de87dbac702b9f1a08d9bd0e7142bb/issue_comment.go#L31-L34
24,310
gogs/go-gogs-client
issue_comment.go
CreateIssueComment
func (c *Client) CreateIssueComment(owner, repo string, index int64, opt CreateIssueCommentOption) (*Comment, error) { body, err := json.Marshal(&opt) if err != nil { return nil, err } comment := new(Comment) return comment, c.getParsedResponse("POST", fmt.Sprintf("/repos/%s/%s/issues/%d/comments", owner, repo, ...
go
func (c *Client) CreateIssueComment(owner, repo string, index int64, opt CreateIssueCommentOption) (*Comment, error) { body, err := json.Marshal(&opt) if err != nil { return nil, err } comment := new(Comment) return comment, c.getParsedResponse("POST", fmt.Sprintf("/repos/%s/%s/issues/%d/comments", owner, repo, ...
[ "func", "(", "c", "*", "Client", ")", "CreateIssueComment", "(", "owner", ",", "repo", "string", ",", "index", "int64", ",", "opt", "CreateIssueCommentOption", ")", "(", "*", "Comment", ",", "error", ")", "{", "body", ",", "err", ":=", "json", ".", "Ma...
// CreateIssueComment create comment on an issue.
[ "CreateIssueComment", "create", "comment", "on", "an", "issue", "." ]
1cd0db3113de87dbac702b9f1a08d9bd0e7142bb
https://github.com/gogs/go-gogs-client/blob/1cd0db3113de87dbac702b9f1a08d9bd0e7142bb/issue_comment.go#L42-L49
24,311
gogs/go-gogs-client
issue_comment.go
DeleteIssueComment
func (c *Client) DeleteIssueComment(owner, repo string, index, commentID int64) error { _, err := c.getResponse("DELETE", fmt.Sprintf("/repos/%s/%s/issues/%d/comments/%d", owner, repo, index, commentID), nil, nil) return err }
go
func (c *Client) DeleteIssueComment(owner, repo string, index, commentID int64) error { _, err := c.getResponse("DELETE", fmt.Sprintf("/repos/%s/%s/issues/%d/comments/%d", owner, repo, index, commentID), nil, nil) return err }
[ "func", "(", "c", "*", "Client", ")", "DeleteIssueComment", "(", "owner", ",", "repo", "string", ",", "index", ",", "commentID", "int64", ")", "error", "{", "_", ",", "err", ":=", "c", ".", "getResponse", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", ...
// DeleteIssueComment deletes an issue comment.
[ "DeleteIssueComment", "deletes", "an", "issue", "comment", "." ]
1cd0db3113de87dbac702b9f1a08d9bd0e7142bb
https://github.com/gogs/go-gogs-client/blob/1cd0db3113de87dbac702b9f1a08d9bd0e7142bb/issue_comment.go#L67-L70
24,312
gogs/go-gogs-client
repo_hook.go
ParseCreateHook
func ParseCreateHook(raw []byte) (*CreatePayload, error) { hook := new(CreatePayload) if err := json.Unmarshal(raw, hook); err != nil { return nil, err } // it is possible the JSON was parsed, however, // was not from Gogs (maybe was from Bitbucket) // So we'll check to be sure certain key fields // were popu...
go
func ParseCreateHook(raw []byte) (*CreatePayload, error) { hook := new(CreatePayload) if err := json.Unmarshal(raw, hook); err != nil { return nil, err } // it is possible the JSON was parsed, however, // was not from Gogs (maybe was from Bitbucket) // So we'll check to be sure certain key fields // were popu...
[ "func", "ParseCreateHook", "(", "raw", "[", "]", "byte", ")", "(", "*", "CreatePayload", ",", "error", ")", "{", "hook", ":=", "new", "(", "CreatePayload", ")", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "raw", ",", "hook", ")", ";", "...
// ParseCreateHook parses create event hook content.
[ "ParseCreateHook", "parses", "create", "event", "hook", "content", "." ]
1cd0db3113de87dbac702b9f1a08d9bd0e7142bb
https://github.com/gogs/go-gogs-client/blob/1cd0db3113de87dbac702b9f1a08d9bd0e7142bb/repo_hook.go#L127-L144
24,313
gogs/go-gogs-client
repo_hook.go
ParsePushHook
func ParsePushHook(raw []byte) (*PushPayload, error) { hook := new(PushPayload) if err := json.Unmarshal(raw, hook); err != nil { return nil, err } switch { case hook.Repo == nil: return nil, ErrInvalidReceiveHook case len(hook.Ref) == 0: return nil, ErrInvalidReceiveHook } return hook, nil }
go
func ParsePushHook(raw []byte) (*PushPayload, error) { hook := new(PushPayload) if err := json.Unmarshal(raw, hook); err != nil { return nil, err } switch { case hook.Repo == nil: return nil, ErrInvalidReceiveHook case len(hook.Ref) == 0: return nil, ErrInvalidReceiveHook } return hook, nil }
[ "func", "ParsePushHook", "(", "raw", "[", "]", "byte", ")", "(", "*", "PushPayload", ",", "error", ")", "{", "hook", ":=", "new", "(", "PushPayload", ")", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "raw", ",", "hook", ")", ";", "err", ...
// ParsePushHook parses push event hook content.
[ "ParsePushHook", "parses", "push", "event", "hook", "content", "." ]
1cd0db3113de87dbac702b9f1a08d9bd0e7142bb
https://github.com/gogs/go-gogs-client/blob/1cd0db3113de87dbac702b9f1a08d9bd0e7142bb/repo_hook.go#L212-L225
24,314
gogs/go-gogs-client
gogs.go
NewClient
func NewClient(url, token string) *Client { return &Client{ url: strings.TrimSuffix(url, "/"), accessToken: token, client: &http.Client{}, } }
go
func NewClient(url, token string) *Client { return &Client{ url: strings.TrimSuffix(url, "/"), accessToken: token, client: &http.Client{}, } }
[ "func", "NewClient", "(", "url", ",", "token", "string", ")", "*", "Client", "{", "return", "&", "Client", "{", "url", ":", "strings", ".", "TrimSuffix", "(", "url", ",", "\"", "\"", ")", ",", "accessToken", ":", "token", ",", "client", ":", "&", "...
// NewClient initializes and returns an API client.
[ "NewClient", "initializes", "and", "returns", "an", "API", "client", "." ]
1cd0db3113de87dbac702b9f1a08d9bd0e7142bb
https://github.com/gogs/go-gogs-client/blob/1cd0db3113de87dbac702b9f1a08d9bd0e7142bb/gogs.go#L28-L34
24,315
iron-io/functions
api/models/app.go
UpdateConfig
func (a *App) UpdateConfig(patch Config) { if patch != nil { if a.Config == nil { a.Config = make(Config) } for k, v := range patch { if v == "" { delete(a.Config, k) } else { a.Config[k] = v } } } }
go
func (a *App) UpdateConfig(patch Config) { if patch != nil { if a.Config == nil { a.Config = make(Config) } for k, v := range patch { if v == "" { delete(a.Config, k) } else { a.Config[k] = v } } } }
[ "func", "(", "a", "*", "App", ")", "UpdateConfig", "(", "patch", "Config", ")", "{", "if", "patch", "!=", "nil", "{", "if", "a", ".", "Config", "==", "nil", "{", "a", ".", "Config", "=", "make", "(", "Config", ")", "\n", "}", "\n", "for", "k", ...
// UpdateConfig adds entries from patch to a.Config, and removes entries with empty values.
[ "UpdateConfig", "adds", "entries", "from", "patch", "to", "a", ".", "Config", "and", "removes", "entries", "with", "empty", "values", "." ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/models/app.go#L74-L87
24,316
iron-io/functions
api/server/singleflight.go
do
func (g *singleflight) do(key models.RouteFilter, fn func() (interface{}, error)) (interface{}, error) { g.mu.Lock() if g.m == nil { g.m = make(map[models.RouteFilter]*call) } if c, ok := g.m[key]; ok { g.mu.Unlock() c.wg.Wait() return c.val, c.err } c := new(call) c.wg.Add(1) g.m[key] = c g.mu.Unlock(...
go
func (g *singleflight) do(key models.RouteFilter, fn func() (interface{}, error)) (interface{}, error) { g.mu.Lock() if g.m == nil { g.m = make(map[models.RouteFilter]*call) } if c, ok := g.m[key]; ok { g.mu.Unlock() c.wg.Wait() return c.val, c.err } c := new(call) c.wg.Add(1) g.m[key] = c g.mu.Unlock(...
[ "func", "(", "g", "*", "singleflight", ")", "do", "(", "key", "models", ".", "RouteFilter", ",", "fn", "func", "(", ")", "(", "interface", "{", "}", ",", "error", ")", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "g", ".", "mu", "."...
// do executes and returns the results of the given function, making // sure that only one execution is in-flight for a given key at a // time. If a duplicate comes in, the duplicate caller waits for the // original to complete and receives the same results.
[ "do", "executes", "and", "returns", "the", "results", "of", "the", "given", "function", "making", "sure", "that", "only", "one", "execution", "is", "in", "-", "flight", "for", "a", "given", "key", "at", "a", "time", ".", "If", "a", "duplicate", "comes", ...
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/server/singleflight.go#L27-L50
24,317
iron-io/functions
lb/roundtripper.go
NewRoundTripper
func NewRoundTripper(ctx context.Context, nodes []string) *FallbackRoundTripper { frt := &FallbackRoundTripper{ nodes: nodes, fallback: make(map[string]string), } go frt.checkHealth(ctx) return frt }
go
func NewRoundTripper(ctx context.Context, nodes []string) *FallbackRoundTripper { frt := &FallbackRoundTripper{ nodes: nodes, fallback: make(map[string]string), } go frt.checkHealth(ctx) return frt }
[ "func", "NewRoundTripper", "(", "ctx", "context", ".", "Context", ",", "nodes", "[", "]", "string", ")", "*", "FallbackRoundTripper", "{", "frt", ":=", "&", "FallbackRoundTripper", "{", "nodes", ":", "nodes", ",", "fallback", ":", "make", "(", "map", "[", ...
// NewRoundTripper creates a new FallbackRoundTripper and triggers the internal // host TCP health checks.
[ "NewRoundTripper", "creates", "a", "new", "FallbackRoundTripper", "and", "triggers", "the", "internal", "host", "TCP", "health", "checks", "." ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/lb/roundtripper.go#L36-L43
24,318
iron-io/functions
api/models/new_task.go
Validate
func (m *NewTask) Validate(formats strfmt.Registry) error { var res []error if err := m.validateImage(formats); err != nil { // prop res = append(res, err) } if err := m.validatePriority(formats); err != nil { // prop res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(r...
go
func (m *NewTask) Validate(formats strfmt.Registry) error { var res []error if err := m.validateImage(formats); err != nil { // prop res = append(res, err) } if err := m.validatePriority(formats); err != nil { // prop res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(r...
[ "func", "(", "m", "*", "NewTask", ")", "Validate", "(", "formats", "strfmt", ".", "Registry", ")", "error", "{", "var", "res", "[", "]", "error", "\n\n", "if", "err", ":=", "m", ".", "validateImage", "(", "formats", ")", ";", "err", "!=", "nil", "{...
// Validate validates this new task
[ "Validate", "validates", "this", "new", "task" ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/models/new_task.go#L65-L82
24,319
iron-io/functions
fn/commands/images/build.go
Build
func (b *Buildcmd) Build(c *cli.Context) error { verbwriter := common.Verbwriter(b.Verbose) path, err := os.Getwd() if err != nil { return err } fn, err := common.FindFuncfile(path) if err != nil { return err } fmt.Fprintln(verbwriter, "building", fn) ff, err := common.Buildfunc(verbwriter, fn) if err !...
go
func (b *Buildcmd) Build(c *cli.Context) error { verbwriter := common.Verbwriter(b.Verbose) path, err := os.Getwd() if err != nil { return err } fn, err := common.FindFuncfile(path) if err != nil { return err } fmt.Fprintln(verbwriter, "building", fn) ff, err := common.Buildfunc(verbwriter, fn) if err !...
[ "func", "(", "b", "*", "Buildcmd", ")", "Build", "(", "c", "*", "cli", ".", "Context", ")", "error", "{", "verbwriter", ":=", "common", ".", "Verbwriter", "(", "b", ".", "Verbose", ")", "\n\n", "path", ",", "err", ":=", "os", ".", "Getwd", "(", "...
// build will take the found valid function and build it
[ "build", "will", "take", "the", "found", "valid", "function", "and", "build", "it" ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/fn/commands/images/build.go#L37-L57
24,320
iron-io/functions
api/mqs/new.go
New
func New(mqURL string) (models.MessageQueue, error) { // Play with URL schemes here: https://play.golang.org/p/xWAf9SpCBW u, err := url.Parse(mqURL) if err != nil { logrus.WithError(err).WithFields(logrus.Fields{"url": mqURL}).Fatal("bad MQ URL") } logrus.WithFields(logrus.Fields{"mq": u.Scheme}).Debug("selectin...
go
func New(mqURL string) (models.MessageQueue, error) { // Play with URL schemes here: https://play.golang.org/p/xWAf9SpCBW u, err := url.Parse(mqURL) if err != nil { logrus.WithError(err).WithFields(logrus.Fields{"url": mqURL}).Fatal("bad MQ URL") } logrus.WithFields(logrus.Fields{"mq": u.Scheme}).Debug("selectin...
[ "func", "New", "(", "mqURL", "string", ")", "(", "models", ".", "MessageQueue", ",", "error", ")", "{", "// Play with URL schemes here: https://play.golang.org/p/xWAf9SpCBW", "u", ",", "err", ":=", "url", ".", "Parse", "(", "mqURL", ")", "\n", "if", "err", "!=...
// New will parse the URL and return the correct MQ implementation.
[ "New", "will", "parse", "the", "URL", "and", "return", "the", "correct", "MQ", "implementation", "." ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/mqs/new.go#L13-L33
24,321
iron-io/functions
api/runner/worker.go
StartWorkers
func StartWorkers(ctx context.Context, rnr *Runner, tasks <-chan task.Request) { var wg sync.WaitGroup defer wg.Wait() var hcmgr htfnmgr for { select { case <-ctx.Done(): return case task := <-tasks: p := hcmgr.getPipe(ctx, rnr, task.Config) if p == nil { wg.Add(1) go runTaskReq(rnr, &wg, ta...
go
func StartWorkers(ctx context.Context, rnr *Runner, tasks <-chan task.Request) { var wg sync.WaitGroup defer wg.Wait() var hcmgr htfnmgr for { select { case <-ctx.Done(): return case task := <-tasks: p := hcmgr.getPipe(ctx, rnr, task.Config) if p == nil { wg.Add(1) go runTaskReq(rnr, &wg, ta...
[ "func", "StartWorkers", "(", "ctx", "context", ".", "Context", ",", "rnr", "*", "Runner", ",", "tasks", "<-", "chan", "task", ".", "Request", ")", "{", "var", "wg", "sync", ".", "WaitGroup", "\n", "defer", "wg", ".", "Wait", "(", ")", "\n", "var", ...
// StartWorkers operates the common concurrency stream, ie, it will process all // IronFunctions tasks, either sync or async. In the process, it also dispatches // the workload to either regular or hot functions.
[ "StartWorkers", "operates", "the", "common", "concurrency", "stream", "ie", "it", "will", "process", "all", "IronFunctions", "tasks", "either", "sync", "or", "async", ".", "In", "the", "process", "it", "also", "dispatches", "the", "workload", "to", "either", "...
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/runner/worker.go#L77-L103
24,322
iron-io/functions
api/server/runner_listeners.go
AddRunnerListener
func (s *Server) AddRunnerListener(listener RunnerListener) { s.runnerListeners = append(s.runnerListeners, listener) }
go
func (s *Server) AddRunnerListener(listener RunnerListener) { s.runnerListeners = append(s.runnerListeners, listener) }
[ "func", "(", "s", "*", "Server", ")", "AddRunnerListener", "(", "listener", "RunnerListener", ")", "{", "s", ".", "runnerListeners", "=", "append", "(", "s", ".", "runnerListeners", ",", "listener", ")", "\n", "}" ]
// AddRunListeners adds a listener that will be fired before and after a function run.
[ "AddRunListeners", "adds", "a", "listener", "that", "will", "be", "fired", "before", "and", "after", "a", "function", "run", "." ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/server/runner_listeners.go#L16-L18
24,323
iron-io/functions
api/runner/async_runner.go
RunAsyncRunner
func RunAsyncRunner(ctx context.Context, tasksrv string, tasks chan task.Request, rnr *Runner) { u := tasksrvURL(tasksrv) startAsyncRunners(ctx, u, tasks, rnr) <-ctx.Done() }
go
func RunAsyncRunner(ctx context.Context, tasksrv string, tasks chan task.Request, rnr *Runner) { u := tasksrvURL(tasksrv) startAsyncRunners(ctx, u, tasks, rnr) <-ctx.Done() }
[ "func", "RunAsyncRunner", "(", "ctx", "context", ".", "Context", ",", "tasksrv", "string", ",", "tasks", "chan", "task", ".", "Request", ",", "rnr", "*", "Runner", ")", "{", "u", ":=", "tasksrvURL", "(", "tasksrv", ")", "\n\n", "startAsyncRunners", "(", ...
// RunAsyncRunner pulls tasks off a queue and processes them
[ "RunAsyncRunner", "pulls", "tasks", "off", "a", "queue", "and", "processes", "them" ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/runner/async_runner.go#L92-L97
24,324
iron-io/functions
api/server/server.go
NewFromEnv
func NewFromEnv(ctx context.Context) *Server { ds, err := datastore.New(viper.GetString(EnvDBURL)) if err != nil { logrus.WithError(err).Fatalln("Error initializing datastore.") } mq, err := mqs.New(viper.GetString(EnvMQURL)) if err != nil { logrus.WithError(err).Fatal("Error initializing message queue.") } ...
go
func NewFromEnv(ctx context.Context) *Server { ds, err := datastore.New(viper.GetString(EnvDBURL)) if err != nil { logrus.WithError(err).Fatalln("Error initializing datastore.") } mq, err := mqs.New(viper.GetString(EnvMQURL)) if err != nil { logrus.WithError(err).Fatal("Error initializing message queue.") } ...
[ "func", "NewFromEnv", "(", "ctx", "context", ".", "Context", ")", "*", "Server", "{", "ds", ",", "err", ":=", "datastore", ".", "New", "(", "viper", ".", "GetString", "(", "EnvDBURL", ")", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "W...
// NewFromEnv creates a new IronFunctions server based on env vars.
[ "NewFromEnv", "creates", "a", "new", "IronFunctions", "server", "based", "on", "env", "vars", "." ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/server/server.go#L59-L73
24,325
iron-io/functions
api/server/server.go
New
func New(ctx context.Context, ds models.Datastore, mq models.MessageQueue, apiURL string, opts ...ServerOption) *Server { metricLogger := runner.NewMetricLogger() funcLogger := runner.NewFuncLogger() rnr, err := runner.New(ctx, funcLogger, metricLogger) if err != nil { logrus.WithError(err).Fatalln("Failed to cr...
go
func New(ctx context.Context, ds models.Datastore, mq models.MessageQueue, apiURL string, opts ...ServerOption) *Server { metricLogger := runner.NewMetricLogger() funcLogger := runner.NewFuncLogger() rnr, err := runner.New(ctx, funcLogger, metricLogger) if err != nil { logrus.WithError(err).Fatalln("Failed to cr...
[ "func", "New", "(", "ctx", "context", ".", "Context", ",", "ds", "models", ".", "Datastore", ",", "mq", "models", ".", "MessageQueue", ",", "apiURL", "string", ",", "opts", "...", "ServerOption", ")", "*", "Server", "{", "metricLogger", ":=", "runner", "...
// New creates a new IronFunctions server with the passed in datastore, message queue and API URL
[ "New", "creates", "a", "new", "IronFunctions", "server", "with", "the", "passed", "in", "datastore", "message", "queue", "and", "API", "URL" ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/server/server.go#L76-L106
24,326
iron-io/functions
api/models/id_status.go
Validate
func (m *IDStatus) Validate(formats strfmt.Registry) error { var res []error if err := m.validateStatus(formats); err != nil { // prop res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
go
func (m *IDStatus) Validate(formats strfmt.Registry) error { var res []error if err := m.validateStatus(formats); err != nil { // prop res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
[ "func", "(", "m", "*", "IDStatus", ")", "Validate", "(", "formats", "strfmt", ".", "Registry", ")", "error", "{", "var", "res", "[", "]", "error", "\n\n", "if", "err", ":=", "m", ".", "validateStatus", "(", "formats", ")", ";", "err", "!=", "nil", ...
// Validate validates this Id status
[ "Validate", "validates", "this", "Id", "status" ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/models/id_status.go#L70-L82
24,327
iron-io/functions
api/mqs/memory.go
pickEarliestNonblocking
func pickEarliestNonblocking(channels ...chan *models.Task) *models.Task { if len(channels) == 0 { return nil } select { case job := <-channels[0]: return job default: return pickEarliestNonblocking(channels[1:]...) } }
go
func pickEarliestNonblocking(channels ...chan *models.Task) *models.Task { if len(channels) == 0 { return nil } select { case job := <-channels[0]: return job default: return pickEarliestNonblocking(channels[1:]...) } }
[ "func", "pickEarliestNonblocking", "(", "channels", "...", "chan", "*", "models", ".", "Task", ")", "*", "models", ".", "Task", "{", "if", "len", "(", "channels", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "select", "{", "case", "job", ...
// This is recursive, so be careful how many channels you pass in.
[ "This", "is", "recursive", "so", "be", "careful", "how", "many", "channels", "you", "pass", "in", "." ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/mqs/memory.go#L157-L168
24,328
iron-io/functions
fn/commands/images/bump.go
bump
func (b *bumpcmd) bump(c *cli.Context) error { verbwriter := common.Verbwriter(b.verbose) path, err := os.Getwd() if err != nil { return err } fn, err := common.FindFuncfile(path) if err != nil { return err } fmt.Fprintln(verbwriter, "bumping version for", fn) funcfile, err := common.ParseFuncfile(fn) ...
go
func (b *bumpcmd) bump(c *cli.Context) error { verbwriter := common.Verbwriter(b.verbose) path, err := os.Getwd() if err != nil { return err } fn, err := common.FindFuncfile(path) if err != nil { return err } fmt.Fprintln(verbwriter, "bumping version for", fn) funcfile, err := common.ParseFuncfile(fn) ...
[ "func", "(", "b", "*", "bumpcmd", ")", "bump", "(", "c", "*", "cli", ".", "Context", ")", "error", "{", "verbwriter", ":=", "common", ".", "Verbwriter", "(", "b", ".", "verbose", ")", "\n\n", "path", ",", "err", ":=", "os", ".", "Getwd", "(", ")"...
// bump will take the found valid function and bump its version
[ "bump", "will", "take", "the", "found", "valid", "function", "and", "bump", "its", "version" ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/fn/commands/images/bump.go#L40-L70
24,329
iron-io/functions
api/models/reason.go
Validate
func (m Reason) Validate(formats strfmt.Registry) error { var res []error // value enum if err := m.validateReasonEnum("", "body", m); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
go
func (m Reason) Validate(formats strfmt.Registry) error { var res []error // value enum if err := m.validateReasonEnum("", "body", m); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
[ "func", "(", "m", "Reason", ")", "Validate", "(", "formats", "strfmt", ".", "Registry", ")", "error", "{", "var", "res", "[", "]", "error", "\n\n", "// value enum", "if", "err", ":=", "m", ".", "validateReasonEnum", "(", "\"", "\"", ",", "\"", "\"", ...
// Validate validates this reason
[ "Validate", "validates", "this", "reason" ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/models/reason.go#L45-L57
24,330
iron-io/functions
api/models/route.go
SetDefaults
func (r *Route) SetDefaults() { if r.Memory == 0 { r.Memory = 128 } if r.Type == TypeNone { r.Type = TypeSync } if r.Format == "" { r.Format = FormatDefault } if r.MaxConcurrency == 0 { r.MaxConcurrency = 1 } if r.Headers == nil { r.Headers = http.Header{} } if r.Config == nil { r.Config = m...
go
func (r *Route) SetDefaults() { if r.Memory == 0 { r.Memory = 128 } if r.Type == TypeNone { r.Type = TypeSync } if r.Format == "" { r.Format = FormatDefault } if r.MaxConcurrency == 0 { r.MaxConcurrency = 1 } if r.Headers == nil { r.Headers = http.Header{} } if r.Config == nil { r.Config = m...
[ "func", "(", "r", "*", "Route", ")", "SetDefaults", "(", ")", "{", "if", "r", ".", "Memory", "==", "0", "{", "r", ".", "Memory", "=", "128", "\n", "}", "\n\n", "if", "r", ".", "Type", "==", "TypeNone", "{", "r", ".", "Type", "=", "TypeSync", ...
// SetDefaults sets zeroed field to defaults.
[ "SetDefaults", "sets", "zeroed", "field", "to", "defaults", "." ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/models/route.go#L65-L97
24,331
iron-io/functions
api/models/route.go
Validate
func (r *Route) Validate(skipZero bool) error { var res []error if !skipZero { if r.AppName == "" { res = append(res, ErrRoutesValidationMissingAppName) } if r.Image == "" { res = append(res, ErrRoutesValidationMissingImage) } if r.Path == "" { res = append(res, ErrRoutesValidationMissingPath) ...
go
func (r *Route) Validate(skipZero bool) error { var res []error if !skipZero { if r.AppName == "" { res = append(res, ErrRoutesValidationMissingAppName) } if r.Image == "" { res = append(res, ErrRoutesValidationMissingImage) } if r.Path == "" { res = append(res, ErrRoutesValidationMissingPath) ...
[ "func", "(", "r", "*", "Route", ")", "Validate", "(", "skipZero", "bool", ")", "error", "{", "var", "res", "[", "]", "error", "\n\n", "if", "!", "skipZero", "{", "if", "r", ".", "AppName", "==", "\"", "\"", "{", "res", "=", "append", "(", "res", ...
// Validate validates field values, skipping zeroed fields if skipZero is true.
[ "Validate", "validates", "field", "values", "skipping", "zeroed", "fields", "if", "skipZero", "is", "true", "." ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/models/route.go#L100-L161
24,332
iron-io/functions
api/models/route.go
Update
func (r *Route) Update(new *Route) { if new.Image != "" { r.Image = new.Image } if new.Memory != 0 { r.Memory = new.Memory } if new.Type != "" { r.Type = new.Type } if new.Timeout != 0 { r.Timeout = new.Timeout } if new.IdleTimeout != 0 { r.IdleTimeout = new.IdleTimeout } if new.Format != "" { r....
go
func (r *Route) Update(new *Route) { if new.Image != "" { r.Image = new.Image } if new.Memory != 0 { r.Memory = new.Memory } if new.Type != "" { r.Type = new.Type } if new.Timeout != 0 { r.Timeout = new.Timeout } if new.IdleTimeout != 0 { r.IdleTimeout = new.IdleTimeout } if new.Format != "" { r....
[ "func", "(", "r", "*", "Route", ")", "Update", "(", "new", "*", "Route", ")", "{", "if", "new", ".", "Image", "!=", "\"", "\"", "{", "r", ".", "Image", "=", "new", ".", "Image", "\n", "}", "\n", "if", "new", ".", "Memory", "!=", "0", "{", "...
// Update updates fields in r with non-zero field values from new. // 0-length slice Header values, and empty-string Config values trigger removal of map entry.
[ "Update", "updates", "fields", "in", "r", "with", "non", "-", "zero", "field", "values", "from", "new", ".", "0", "-", "length", "slice", "Header", "values", "and", "empty", "-", "string", "Config", "values", "trigger", "removal", "of", "map", "entry", "...
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/models/route.go#L173-L225
24,333
iron-io/functions
api/runner/protocol/factory.go
IsStreamable
func IsStreamable(p string) (bool, error) { proto, err := New(Protocol(p), nil, nil) if err != nil { return false, err } return proto.IsStreamable(), nil }
go
func IsStreamable(p string) (bool, error) { proto, err := New(Protocol(p), nil, nil) if err != nil { return false, err } return proto.IsStreamable(), nil }
[ "func", "IsStreamable", "(", "p", "string", ")", "(", "bool", ",", "error", ")", "{", "proto", ",", "err", ":=", "New", "(", "Protocol", "(", "p", ")", ",", "nil", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "e...
// IsStreamable says whether the given protocol can be used for streaming into // hot functions.
[ "IsStreamable", "says", "whether", "the", "given", "protocol", "can", "be", "used", "for", "streaming", "into", "hot", "functions", "." ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/runner/protocol/factory.go#L47-L53
24,334
iron-io/functions
api/server/special_handler.go
UseSpecialHandlers
func (s *Server) UseSpecialHandlers(ctx context.Context, req *http.Request, resp http.ResponseWriter) (context.Context, error) { if len(s.specialHandlers) == 0 { return ctx, ErrNoSpecialHandlerFound } c := &SpecialHandlerContext{ request: req, response: resp, ctx: ctx, } for _, l := range s.specialH...
go
func (s *Server) UseSpecialHandlers(ctx context.Context, req *http.Request, resp http.ResponseWriter) (context.Context, error) { if len(s.specialHandlers) == 0 { return ctx, ErrNoSpecialHandlerFound } c := &SpecialHandlerContext{ request: req, response: resp, ctx: ctx, } for _, l := range s.specialH...
[ "func", "(", "s", "*", "Server", ")", "UseSpecialHandlers", "(", "ctx", "context", ".", "Context", ",", "req", "*", "http", ".", "Request", ",", "resp", "http", ".", "ResponseWriter", ")", "(", "context", ".", "Context", ",", "error", ")", "{", "if", ...
// UseSpecialHandlers execute all special handlers
[ "UseSpecialHandlers", "execute", "all", "special", "handlers" ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/server/special_handler.go#L57-L74
24,335
iron-io/functions
api/server/internal/routecache/lru.go
New
func New(maxentries int) *Cache { return &Cache{ MaxEntries: maxentries, ll: list.New(), cache: make(map[string]*list.Element), } }
go
func New(maxentries int) *Cache { return &Cache{ MaxEntries: maxentries, ll: list.New(), cache: make(map[string]*list.Element), } }
[ "func", "New", "(", "maxentries", "int", ")", "*", "Cache", "{", "return", "&", "Cache", "{", "MaxEntries", ":", "maxentries", ",", "ll", ":", "list", ".", "New", "(", ")", ",", "cache", ":", "make", "(", "map", "[", "string", "]", "*", "list", "...
// New returns a route cache.
[ "New", "returns", "a", "route", "cache", "." ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/server/internal/routecache/lru.go#L24-L30
24,336
iron-io/functions
api/server/internal/routecache/lru.go
Refresh
func (c *Cache) Refresh(route *models.Route) { if c.cache == nil { return } if ee, ok := c.cache[route.AppName+route.Path]; ok { c.ll.MoveToFront(ee) ee.Value = route return } ele := c.ll.PushFront(route) c.cache[route.AppName+route.Path] = ele if c.MaxEntries != 0 && c.ll.Len() > c.MaxEntries { c.re...
go
func (c *Cache) Refresh(route *models.Route) { if c.cache == nil { return } if ee, ok := c.cache[route.AppName+route.Path]; ok { c.ll.MoveToFront(ee) ee.Value = route return } ele := c.ll.PushFront(route) c.cache[route.AppName+route.Path] = ele if c.MaxEntries != 0 && c.ll.Len() > c.MaxEntries { c.re...
[ "func", "(", "c", "*", "Cache", ")", "Refresh", "(", "route", "*", "models", ".", "Route", ")", "{", "if", "c", ".", "cache", "==", "nil", "{", "return", "\n", "}", "\n\n", "if", "ee", ",", "ok", ":=", "c", ".", "cache", "[", "route", ".", "A...
// Refresh updates internal linkedlist either adding a new route to the front, // or moving it to the front when used. It will discard seldom used routes.
[ "Refresh", "updates", "internal", "linkedlist", "either", "adding", "a", "new", "route", "to", "the", "front", "or", "moving", "it", "to", "the", "front", "when", "used", ".", "It", "will", "discard", "seldom", "used", "routes", "." ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/server/internal/routecache/lru.go#L34-L50
24,337
iron-io/functions
api/server/internal/routecache/lru.go
Get
func (c *Cache) Get(appname, path string) (route *models.Route, ok bool) { if c.cache == nil { return } if ele, hit := c.cache[appname+path]; hit { c.ll.MoveToFront(ele) return ele.Value.(*models.Route), true } return }
go
func (c *Cache) Get(appname, path string) (route *models.Route, ok bool) { if c.cache == nil { return } if ele, hit := c.cache[appname+path]; hit { c.ll.MoveToFront(ele) return ele.Value.(*models.Route), true } return }
[ "func", "(", "c", "*", "Cache", ")", "Get", "(", "appname", ",", "path", "string", ")", "(", "route", "*", "models", ".", "Route", ",", "ok", "bool", ")", "{", "if", "c", ".", "cache", "==", "nil", "{", "return", "\n", "}", "\n", "if", "ele", ...
// Get looks up a path's route from the cache.
[ "Get", "looks", "up", "a", "path", "s", "route", "from", "the", "cache", "." ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/server/internal/routecache/lru.go#L53-L62
24,338
iron-io/functions
api/server/internal/routecache/lru.go
Delete
func (c *Cache) Delete(appname, path string) { if ele, hit := c.cache[appname+path]; hit { c.removeElement(ele) } }
go
func (c *Cache) Delete(appname, path string) { if ele, hit := c.cache[appname+path]; hit { c.removeElement(ele) } }
[ "func", "(", "c", "*", "Cache", ")", "Delete", "(", "appname", ",", "path", "string", ")", "{", "if", "ele", ",", "hit", ":=", "c", ".", "cache", "[", "appname", "+", "path", "]", ";", "hit", "{", "c", ".", "removeElement", "(", "ele", ")", "\n...
// Delete removes the element for the given appname and path from the cache.
[ "Delete", "removes", "the", "element", "for", "the", "given", "appname", "and", "path", "from", "the", "cache", "." ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/server/internal/routecache/lru.go#L65-L69
24,339
iron-io/functions
api/server/app_listeners.go
AddAppListener
func (s *Server) AddAppListener(listener AppListener) { s.appListeners = append(s.appListeners, listener) }
go
func (s *Server) AddAppListener(listener AppListener) { s.appListeners = append(s.appListeners, listener) }
[ "func", "(", "s", "*", "Server", ")", "AddAppListener", "(", "listener", "AppListener", ")", "{", "s", ".", "appListeners", "=", "append", "(", "s", ".", "appListeners", ",", "listener", ")", "\n", "}" ]
// AddAppCreateListener adds a listener that will be notified on App created.
[ "AddAppCreateListener", "adds", "a", "listener", "that", "will", "be", "notified", "on", "App", "created", "." ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/server/app_listeners.go#L25-L27
24,340
iron-io/functions
api/server/tree.go
findCaseInsensitivePath
func (n *node) findCaseInsensitivePath(path string, fixTrailingSlash bool) (ciPath []byte, found bool) { return n.findCaseInsensitivePathRec( path, strings.ToLower(path), make([]byte, 0, len(path)+1), // preallocate enough memory for new path [4]byte{}, // empty rune buffer fixTrailingSlas...
go
func (n *node) findCaseInsensitivePath(path string, fixTrailingSlash bool) (ciPath []byte, found bool) { return n.findCaseInsensitivePathRec( path, strings.ToLower(path), make([]byte, 0, len(path)+1), // preallocate enough memory for new path [4]byte{}, // empty rune buffer fixTrailingSlas...
[ "func", "(", "n", "*", "node", ")", "findCaseInsensitivePath", "(", "path", "string", ",", "fixTrailingSlash", "bool", ")", "(", "ciPath", "[", "]", "byte", ",", "found", "bool", ")", "{", "return", "n", ".", "findCaseInsensitivePathRec", "(", "path", ",",...
// Makes a case-insensitive lookup of the given path and tries to find a handler. // It can optionally also fix trailing slashes. // It returns the case-corrected path and a bool indicating whether the lookup // was successful.
[ "Makes", "a", "case", "-", "insensitive", "lookup", "of", "the", "given", "path", "and", "tries", "to", "find", "a", "handler", ".", "It", "can", "optionally", "also", "fix", "trailing", "slashes", ".", "It", "returns", "the", "case", "-", "corrected", "...
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/server/tree.go#L458-L466
24,341
iron-io/functions
api/mqs/bolt.go
delayTask
func (mq *BoltDbMQ) delayTask(job *models.Task) (*models.Task, error) { readyAt := time.Now().Add(time.Duration(job.Delay) * time.Second) err := mq.db.Update(func(tx *bolt.Tx) error { b := tx.Bucket(delayQueueName) id, _ := b.NextSequence() buf, err := json.Marshal(job) if err != nil { return err } ke...
go
func (mq *BoltDbMQ) delayTask(job *models.Task) (*models.Task, error) { readyAt := time.Now().Add(time.Duration(job.Delay) * time.Second) err := mq.db.Update(func(tx *bolt.Tx) error { b := tx.Bucket(delayQueueName) id, _ := b.NextSequence() buf, err := json.Marshal(job) if err != nil { return err } ke...
[ "func", "(", "mq", "*", "BoltDbMQ", ")", "delayTask", "(", "job", "*", "models", ".", "Task", ")", "(", "*", "models", ".", "Task", ",", "error", ")", "{", "readyAt", ":=", "time", ".", "Now", "(", ")", ".", "Add", "(", "time", ".", "Duration", ...
// We insert a "reservation" at readyAt, and store the json blob at the msg // key. The timer loop plucks this out and puts it in the jobs bucket when the // time elapses. The value stored at the reservation key is the priority.
[ "We", "insert", "a", "reservation", "at", "readyAt", "and", "store", "the", "json", "blob", "at", "the", "msg", "key", ".", "The", "timer", "loop", "plucks", "this", "out", "and", "puts", "it", "in", "the", "jobs", "bucket", "when", "the", "time", "ela...
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/mqs/bolt.go#L183-L205
24,342
iron-io/functions
fn/langs/base.go
GetLangHelper
func GetLangHelper(lang string) LangHelper { switch lang { case "go": return &GoLangHelper{} case "node": return &NodeLangHelper{} case "ruby": return &RubyLangHelper{} case "python": return &PythonHelper{} case "rust": return &RustLangHelper{} case "dotnet": return &DotNetLangHelper{} case "java": ...
go
func GetLangHelper(lang string) LangHelper { switch lang { case "go": return &GoLangHelper{} case "node": return &NodeLangHelper{} case "ruby": return &RubyLangHelper{} case "python": return &PythonHelper{} case "rust": return &RustLangHelper{} case "dotnet": return &DotNetLangHelper{} case "java": ...
[ "func", "GetLangHelper", "(", "lang", "string", ")", "LangHelper", "{", "switch", "lang", "{", "case", "\"", "\"", ":", "return", "&", "GoLangHelper", "{", "}", "\n", "case", "\"", "\"", ":", "return", "&", "NodeLangHelper", "{", "}", "\n", "case", "\"...
// GetLangHelper returns a LangHelper for the passed in language
[ "GetLangHelper", "returns", "a", "LangHelper", "for", "the", "passed", "in", "language" ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/fn/langs/base.go#L4-L24
24,343
iron-io/functions
api/runner/runner.go
queueHandler
func (r *Runner) queueHandler(ctx context.Context) { consumeQueue: for { select { case task := <-r.taskQueue: r.handleTask(task) case <-ctx.Done(): break consumeQueue } } // consume remainders for len(r.taskQueue) > 0 { r.handleTask(<-r.taskQueue) } }
go
func (r *Runner) queueHandler(ctx context.Context) { consumeQueue: for { select { case task := <-r.taskQueue: r.handleTask(task) case <-ctx.Done(): break consumeQueue } } // consume remainders for len(r.taskQueue) > 0 { r.handleTask(<-r.taskQueue) } }
[ "func", "(", "r", "*", "Runner", ")", "queueHandler", "(", "ctx", "context", ".", "Context", ")", "{", "consumeQueue", ":", "for", "{", "select", "{", "case", "task", ":=", "<-", "r", ".", "taskQueue", ":", "r", ".", "handleTask", "(", "task", ")", ...
// This routine checks for available memory; // If there's memory then send signal to the task to proceed. // If there's not available memory to run the task it waits // If the task waits for more than X seconds it timeouts
[ "This", "routine", "checks", "for", "available", "memory", ";", "If", "there", "s", "memory", "then", "send", "signal", "to", "the", "task", "to", "proceed", ".", "If", "there", "s", "not", "available", "memory", "to", "run", "the", "task", "it", "waits"...
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/runner/runner.go#L72-L87
24,344
iron-io/functions
api/runner/task.go
DockerAuth
func (t *containerTask) DockerAuth() (docker.AuthConfiguration, error) { reg, _, _ := drivers.ParseImage(t.Image()) authconfig := docker.AuthConfiguration{} if customAuth := registries.Find(reg); customAuth != nil { authconfig = docker.AuthConfiguration{ Password: customAuth.Password, ServerAddress: cu...
go
func (t *containerTask) DockerAuth() (docker.AuthConfiguration, error) { reg, _, _ := drivers.ParseImage(t.Image()) authconfig := docker.AuthConfiguration{} if customAuth := registries.Find(reg); customAuth != nil { authconfig = docker.AuthConfiguration{ Password: customAuth.Password, ServerAddress: cu...
[ "func", "(", "t", "*", "containerTask", ")", "DockerAuth", "(", ")", "(", "docker", ".", "AuthConfiguration", ",", "error", ")", "{", "reg", ",", "_", ",", "_", ":=", "drivers", ".", "ParseImage", "(", "t", ".", "Image", "(", ")", ")", "\n", "authc...
// Implementing the docker.AuthConfiguration interface. Pulling in // the docker repo password from environment variables
[ "Implementing", "the", "docker", ".", "AuthConfiguration", "interface", ".", "Pulling", "in", "the", "docker", "repo", "password", "from", "environment", "variables" ]
d59d7d1c40b2ff26b1afee31bde64df444e96525
https://github.com/iron-io/functions/blob/d59d7d1c40b2ff26b1afee31bde64df444e96525/api/runner/task.go#L91-L104
24,345
elastic/go-ucfg
flag/file.go
NewFlagFiles
func NewFlagFiles( cfg *ucfg.Config, extensions map[string]FileLoader, opts ...ucfg.Option, ) *FlagValue { return newFlagValue(cfg, opts, func(path string) (*ucfg.Config, error, error) { ext := filepath.Ext(path) loader := extensions[ext] if loader == nil { loader = extensions[""] } if loader == nil { ...
go
func NewFlagFiles( cfg *ucfg.Config, extensions map[string]FileLoader, opts ...ucfg.Option, ) *FlagValue { return newFlagValue(cfg, opts, func(path string) (*ucfg.Config, error, error) { ext := filepath.Ext(path) loader := extensions[ext] if loader == nil { loader = extensions[""] } if loader == nil { ...
[ "func", "NewFlagFiles", "(", "cfg", "*", "ucfg", ".", "Config", ",", "extensions", "map", "[", "string", "]", "FileLoader", ",", "opts", "...", "ucfg", ".", "Option", ",", ")", "*", "FlagValue", "{", "return", "newFlagValue", "(", "cfg", ",", "opts", "...
// NewFlagFiles create a new flag, that will load external configurations file // when being used. Configurations loaded from multiple files will be merged // into one common Config object. If cfg is not nil, then the loaded // configurations will be merged into cfg. // The extensions parameter define custom file load...
[ "NewFlagFiles", "create", "a", "new", "flag", "that", "will", "load", "external", "configurations", "file", "when", "being", "used", ".", "Configurations", "loaded", "from", "multiple", "files", "will", "be", "merged", "into", "one", "common", "Config", "object"...
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/flag/file.go#L38-L56
24,346
elastic/go-ucfg
unpack.go
valueIsUnpacker
func valueIsUnpacker(v reflect.Value) (reflect.Value, bool) { for { if implementsUnpacker(v.Type()) { return v, true } if !v.CanAddr() { break } v = v.Addr() } return reflect.Value{}, false }
go
func valueIsUnpacker(v reflect.Value) (reflect.Value, bool) { for { if implementsUnpacker(v.Type()) { return v, true } if !v.CanAddr() { break } v = v.Addr() } return reflect.Value{}, false }
[ "func", "valueIsUnpacker", "(", "v", "reflect", ".", "Value", ")", "(", "reflect", ".", "Value", ",", "bool", ")", "{", "for", "{", "if", "implementsUnpacker", "(", "v", ".", "Type", "(", ")", ")", "{", "return", "v", ",", "true", "\n", "}", "\n\n"...
// valueIsUnpacker checks if v implements the Unpacker interface. // If there exists a pointer to v, the pointer to v is also tested.
[ "valueIsUnpacker", "checks", "if", "v", "implements", "the", "Unpacker", "interface", ".", "If", "there", "exists", "a", "pointer", "to", "v", "the", "pointer", "to", "v", "is", "also", "tested", "." ]
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/unpack.go#L92-L105
24,347
elastic/go-ucfg
validator.go
RegisterValidator
func RegisterValidator(name string, cb ValidatorCallback) error { if _, exists := validators[name]; exists { return ErrDuplicateValidator } validators[name] = cb return nil }
go
func RegisterValidator(name string, cb ValidatorCallback) error { if _, exists := validators[name]; exists { return ErrDuplicateValidator } validators[name] = cb return nil }
[ "func", "RegisterValidator", "(", "name", "string", ",", "cb", "ValidatorCallback", ")", "error", "{", "if", "_", ",", "exists", ":=", "validators", "[", "name", "]", ";", "exists", "{", "return", "ErrDuplicateValidator", "\n", "}", "\n\n", "validators", "["...
// RegisterValidator adds a new validator option to the "validate" struct tag. // The callback will be executed when unpacking into a struct field.
[ "RegisterValidator", "adds", "a", "new", "validator", "option", "to", "the", "validate", "struct", "tag", ".", "The", "callback", "will", "be", "executed", "when", "unpacking", "into", "a", "struct", "field", "." ]
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/validator.go#L70-L77
24,348
elastic/go-ucfg
validator.go
validateRequired
func validateRequired(v interface{}, name string) error { if v == nil { return ErrRequired } return validateNonEmpty(v, name) }
go
func validateRequired(v interface{}, name string) error { if v == nil { return ErrRequired } return validateNonEmpty(v, name) }
[ "func", "validateRequired", "(", "v", "interface", "{", "}", ",", "name", "string", ")", "error", "{", "if", "v", "==", "nil", "{", "return", "ErrRequired", "\n", "}", "\n", "return", "validateNonEmpty", "(", "v", ",", "name", ")", "\n", "}" ]
// validateRequired implements the `required` validation tag. // If a field is required, it must be present in the config. // If field is a string, regex or slice its length must be > 0.
[ "validateRequired", "implements", "the", "required", "validation", "tag", ".", "If", "a", "field", "is", "required", "it", "must", "be", "present", "in", "the", "config", ".", "If", "field", "is", "a", "string", "regex", "or", "slice", "its", "length", "mu...
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/validator.go#L304-L309
24,349
elastic/go-ucfg
yaml/yaml.go
NewConfig
func NewConfig(in []byte, opts ...ucfg.Option) (*ucfg.Config, error) { var m interface{} if err := yaml.Unmarshal(in, &m); err != nil { return nil, err } return ucfg.NewFrom(m, opts...) }
go
func NewConfig(in []byte, opts ...ucfg.Option) (*ucfg.Config, error) { var m interface{} if err := yaml.Unmarshal(in, &m); err != nil { return nil, err } return ucfg.NewFrom(m, opts...) }
[ "func", "NewConfig", "(", "in", "[", "]", "byte", ",", "opts", "...", "ucfg", ".", "Option", ")", "(", "*", "ucfg", ".", "Config", ",", "error", ")", "{", "var", "m", "interface", "{", "}", "\n", "if", "err", ":=", "yaml", ".", "Unmarshal", "(", ...
// NewConfig creates a new configuration object from the YAML string passed via in.
[ "NewConfig", "creates", "a", "new", "configuration", "object", "from", "the", "YAML", "string", "passed", "via", "in", "." ]
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/yaml/yaml.go#L29-L36
24,350
elastic/go-ucfg
yaml/yaml.go
NewConfigWithFile
func NewConfigWithFile(name string, opts ...ucfg.Option) (*ucfg.Config, error) { input, err := ioutil.ReadFile(name) if err != nil { return nil, err } opts = append([]ucfg.Option{ ucfg.MetaData(ucfg.Meta{Source: name}), }, opts...) return NewConfig(input, opts...) }
go
func NewConfigWithFile(name string, opts ...ucfg.Option) (*ucfg.Config, error) { input, err := ioutil.ReadFile(name) if err != nil { return nil, err } opts = append([]ucfg.Option{ ucfg.MetaData(ucfg.Meta{Source: name}), }, opts...) return NewConfig(input, opts...) }
[ "func", "NewConfigWithFile", "(", "name", "string", ",", "opts", "...", "ucfg", ".", "Option", ")", "(", "*", "ucfg", ".", "Config", ",", "error", ")", "{", "input", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "name", ")", "\n", "if", "err", ...
// NewConfigWithFile loads a new configuration object from an external JSON file.
[ "NewConfigWithFile", "loads", "a", "new", "configuration", "object", "from", "an", "external", "JSON", "file", "." ]
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/yaml/yaml.go#L39-L49
24,351
elastic/go-ucfg
ucfg.go
GetFields
func (c *Config) GetFields() []string { var names []string for k := range c.fields.dict() { names = append(names, k) } return names }
go
func (c *Config) GetFields() []string { var names []string for k := range c.fields.dict() { names = append(names, k) } return names }
[ "func", "(", "c", "*", "Config", ")", "GetFields", "(", ")", "[", "]", "string", "{", "var", "names", "[", "]", "string", "\n", "for", "k", ":=", "range", "c", ".", "fields", ".", "dict", "(", ")", "{", "names", "=", "append", "(", "names", ","...
// GetFields returns a list of all top-level named keys in c.
[ "GetFields", "returns", "a", "list", "of", "all", "top", "-", "level", "named", "keys", "in", "c", "." ]
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/ucfg.go#L121-L127
24,352
elastic/go-ucfg
ucfg.go
Has
func (c *Config) Has(name string, idx int, options ...Option) (bool, error) { opts := makeOptions(options) p := parsePathIdx(name, opts.pathSep, idx) return p.Has(c, opts) }
go
func (c *Config) Has(name string, idx int, options ...Option) (bool, error) { opts := makeOptions(options) p := parsePathIdx(name, opts.pathSep, idx) return p.Has(c, opts) }
[ "func", "(", "c", "*", "Config", ")", "Has", "(", "name", "string", ",", "idx", "int", ",", "options", "...", "Option", ")", "(", "bool", ",", "error", ")", "{", "opts", ":=", "makeOptions", "(", "options", ")", "\n", "p", ":=", "parsePathIdx", "("...
// Has checks if a field by the given path+idx configuration exists. // Has returns an error if the path can not be resolved because a primitive // value is found in the middle of the traversal.
[ "Has", "checks", "if", "a", "field", "by", "the", "given", "path", "+", "idx", "configuration", "exists", ".", "Has", "returns", "an", "error", "if", "the", "path", "can", "not", "be", "resolved", "because", "a", "primitive", "value", "is", "found", "in"...
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/ucfg.go#L132-L136
24,353
elastic/go-ucfg
ucfg.go
HasField
func (c *Config) HasField(name string) bool { _, ok := c.fields.get(name) return ok }
go
func (c *Config) HasField(name string) bool { _, ok := c.fields.get(name) return ok }
[ "func", "(", "c", "*", "Config", ")", "HasField", "(", "name", "string", ")", "bool", "{", "_", ",", "ok", ":=", "c", ".", "fields", ".", "get", "(", "name", ")", "\n", "return", "ok", "\n", "}" ]
// HasField checks if c has a top-level named key name.
[ "HasField", "checks", "if", "c", "has", "a", "top", "-", "level", "named", "key", "name", "." ]
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/ucfg.go#L139-L142
24,354
elastic/go-ucfg
ucfg.go
Path
func (c *Config) Path(sep string) string { return c.ctx.path(sep) }
go
func (c *Config) Path(sep string) string { return c.ctx.path(sep) }
[ "func", "(", "c", "*", "Config", ")", "Path", "(", "sep", "string", ")", "string", "{", "return", "c", ".", "ctx", ".", "path", "(", "sep", ")", "\n", "}" ]
// Path gets the absolute path of c separated by sep. If c is a root-Config an // empty string will be returned.
[ "Path", "gets", "the", "absolute", "path", "of", "c", "separated", "by", "sep", ".", "If", "c", "is", "a", "root", "-", "Config", "an", "empty", "string", "will", "be", "returned", "." ]
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/ucfg.go#L175-L177
24,355
elastic/go-ucfg
ucfg.go
PathOf
func (c *Config) PathOf(field, sep string) string { return c.ctx.pathOf(field, sep) }
go
func (c *Config) PathOf(field, sep string) string { return c.ctx.pathOf(field, sep) }
[ "func", "(", "c", "*", "Config", ")", "PathOf", "(", "field", ",", "sep", "string", ")", "string", "{", "return", "c", ".", "ctx", ".", "pathOf", "(", "field", ",", "sep", ")", "\n", "}" ]
// PathOf gets the absolute path of a potential setting field in c with name // separated by sep.
[ "PathOf", "gets", "the", "absolute", "path", "of", "a", "potential", "setting", "field", "in", "c", "with", "name", "separated", "by", "sep", "." ]
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/ucfg.go#L181-L183
24,356
elastic/go-ucfg
ucfg.go
Parent
func (c *Config) Parent() *Config { ctx := c.ctx for { if ctx.parent == nil { return nil } switch p := ctx.parent.(type) { case cfgSub: return p.c default: return nil } } }
go
func (c *Config) Parent() *Config { ctx := c.ctx for { if ctx.parent == nil { return nil } switch p := ctx.parent.(type) { case cfgSub: return p.c default: return nil } } }
[ "func", "(", "c", "*", "Config", ")", "Parent", "(", ")", "*", "Config", "{", "ctx", ":=", "c", ".", "ctx", "\n", "for", "{", "if", "ctx", ".", "parent", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "switch", "p", ":=", "ctx", ".", "...
// Parent returns the parent configuration or nil if c is already a root // Configuration.
[ "Parent", "returns", "the", "parent", "configuration", "or", "nil", "if", "c", "is", "already", "a", "root", "Configuration", "." ]
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/ucfg.go#L187-L201
24,357
elastic/go-ucfg
ucfg.go
FlattenedKeys
func (c *Config) FlattenedKeys(opts ...Option) []string { var keys []string normalizedOptions := makeOptions(opts) if normalizedOptions.pathSep == "" { normalizedOptions.pathSep = "." } if c.IsDict() { for _, v := range c.fields.dict() { subcfg, err := v.toConfig(normalizedOptions) if err != nil { ...
go
func (c *Config) FlattenedKeys(opts ...Option) []string { var keys []string normalizedOptions := makeOptions(opts) if normalizedOptions.pathSep == "" { normalizedOptions.pathSep = "." } if c.IsDict() { for _, v := range c.fields.dict() { subcfg, err := v.toConfig(normalizedOptions) if err != nil { ...
[ "func", "(", "c", "*", "Config", ")", "FlattenedKeys", "(", "opts", "...", "Option", ")", "[", "]", "string", "{", "var", "keys", "[", "]", "string", "\n", "normalizedOptions", ":=", "makeOptions", "(", "opts", ")", "\n\n", "if", "normalizedOptions", "."...
// FlattenedKeys return a sorted flattened views of the set keys in the configuration
[ "FlattenedKeys", "return", "a", "sorted", "flattened", "views", "of", "the", "set", "keys", "in", "the", "configuration" ]
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/ucfg.go#L204-L242
24,358
elastic/go-ucfg
opts.go
Env
func Env(e *Config) Option { return func(o *options) { o.env = append(o.env, e) } }
go
func Env(e *Config) Option { return func(o *options) { o.env = append(o.env, e) } }
[ "func", "Env", "(", "e", "*", "Config", ")", "Option", "{", "return", "func", "(", "o", "*", "options", ")", "{", "o", ".", "env", "=", "append", "(", "o", ".", "env", ",", "e", ")", "\n", "}", "\n", "}" ]
// Env option adds another configuration for variable expansion to be used, if // the path to look up does not exist in the actual configuration. Env can be used // multiple times in order to add more lookup environments.
[ "Env", "option", "adds", "another", "configuration", "for", "variable", "expansion", "to", "be", "used", "if", "the", "path", "to", "look", "up", "does", "not", "exist", "in", "the", "actual", "configuration", ".", "Env", "can", "be", "used", "multiple", "...
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/opts.go#L98-L102
24,359
elastic/go-ucfg
opts.go
Resolve
func Resolve(fn func(name string) (string, error)) Option { return func(o *options) { o.resolvers = append(o.resolvers, fn) } }
go
func Resolve(fn func(name string) (string, error)) Option { return func(o *options) { o.resolvers = append(o.resolvers, fn) } }
[ "func", "Resolve", "(", "fn", "func", "(", "name", "string", ")", "(", "string", ",", "error", ")", ")", "Option", "{", "return", "func", "(", "o", "*", "options", ")", "{", "o", ".", "resolvers", "=", "append", "(", "o", ".", "resolvers", ",", "...
// Resolve option adds a callback used by variable name expansion. The callback // will be called if a variable can not be resolved from within the actual configuration // or any of its environments.
[ "Resolve", "option", "adds", "a", "callback", "used", "by", "variable", "name", "expansion", ".", "The", "callback", "will", "be", "called", "if", "a", "variable", "can", "not", "be", "resolved", "from", "within", "the", "actual", "configuration", "or", "any...
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/opts.go#L107-L111
24,360
elastic/go-ucfg
diff/keys.go
String
func (d Diff) String() string { var lines []string for k, values := range d { for _, v := range values { lines = append(lines, fmt.Sprintf("%s | key: %s", k, v)) } } return strings.Join(lines, "\n") }
go
func (d Diff) String() string { var lines []string for k, values := range d { for _, v := range values { lines = append(lines, fmt.Sprintf("%s | key: %s", k, v)) } } return strings.Join(lines, "\n") }
[ "func", "(", "d", "Diff", ")", "String", "(", ")", "string", "{", "var", "lines", "[", "]", "string", "\n\n", "for", "k", ",", "values", ":=", "range", "d", "{", "for", "_", ",", "v", ":=", "range", "values", "{", "lines", "=", "append", "(", "...
// String return a human friendly format of the diff
[ "String", "return", "a", "human", "friendly", "format", "of", "the", "diff" ]
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/diff/keys.go#L53-L63
24,361
elastic/go-ucfg
diff/keys.go
HasChanged
func (d *Diff) HasChanged() bool { if d.HasKeyAdded() || d.HasKeyRemoved() { return true } return false }
go
func (d *Diff) HasChanged() bool { if d.HasKeyAdded() || d.HasKeyRemoved() { return true } return false }
[ "func", "(", "d", "*", "Diff", ")", "HasChanged", "(", ")", "bool", "{", "if", "d", ".", "HasKeyAdded", "(", ")", "||", "d", ".", "HasKeyRemoved", "(", ")", "{", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
// HasChanged returns true if we have remove of added new elements in the graph
[ "HasChanged", "returns", "true", "if", "we", "have", "remove", "of", "added", "new", "elements", "in", "the", "graph" ]
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/diff/keys.go#L66-L71
24,362
elastic/go-ucfg
diff/keys.go
CompareConfigs
func CompareConfigs(old, new *ucfg.Config, opts ...ucfg.Option) Diff { oldKeys := old.FlattenedKeys(opts...) newKeys := new.FlattenedKeys(opts...) difference := make(map[string]Type) // Map for candidates check for _, k := range oldKeys { difference[k] = Remove } for _, nk := range newKeys { if _, ok := d...
go
func CompareConfigs(old, new *ucfg.Config, opts ...ucfg.Option) Diff { oldKeys := old.FlattenedKeys(opts...) newKeys := new.FlattenedKeys(opts...) difference := make(map[string]Type) // Map for candidates check for _, k := range oldKeys { difference[k] = Remove } for _, nk := range newKeys { if _, ok := d...
[ "func", "CompareConfigs", "(", "old", ",", "new", "*", "ucfg", ".", "Config", ",", "opts", "...", "ucfg", ".", "Option", ")", "Diff", "{", "oldKeys", ":=", "old", ".", "FlattenedKeys", "(", "opts", "...", ")", "\n", "newKeys", ":=", "new", ".", "Flat...
// CompareConfigs takes two configuration and return the difference between the defined keys
[ "CompareConfigs", "takes", "two", "configuration", "and", "return", "the", "difference", "between", "the", "defined", "keys" ]
c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab
https://github.com/elastic/go-ucfg/blob/c5859d30d9ff1bf630e2dfbe1498ad3d1b7607ab/diff/keys.go#L96-L122
24,363
cloudfoundry/bytefmt
bytes.go
ToMegabytes
func ToMegabytes(s string) (uint64, error) { bytes, err := ToBytes(s) if err != nil { return 0, err } return bytes / MEGABYTE, nil }
go
func ToMegabytes(s string) (uint64, error) { bytes, err := ToBytes(s) if err != nil { return 0, err } return bytes / MEGABYTE, nil }
[ "func", "ToMegabytes", "(", "s", "string", ")", "(", "uint64", ",", "error", ")", "{", "bytes", ",", "err", ":=", "ToBytes", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "return", "bytes", "/",...
// ToMegabytes parses a string formatted by ByteSize as megabytes.
[ "ToMegabytes", "parses", "a", "string", "formatted", "by", "ByteSize", "as", "megabytes", "." ]
2aa6f33b730c79971cfc3c742f279195b0abc627
https://github.com/cloudfoundry/bytefmt/blob/2aa6f33b730c79971cfc3c742f279195b0abc627/bytes.go#L61-L68
24,364
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/rules.go
NewRules
func NewRules() *Rules { rules := &Rules{} rules.Rule = NewRule() rules.Rule.Name = "default" rules.Init() return rules }
go
func NewRules() *Rules { rules := &Rules{} rules.Rule = NewRule() rules.Rule.Name = "default" rules.Init() return rules }
[ "func", "NewRules", "(", ")", "*", "Rules", "{", "rules", ":=", "&", "Rules", "{", "}", "\n", "rules", ".", "Rule", "=", "NewRule", "(", ")", "\n", "rules", ".", "Rule", ".", "Name", "=", "\"", "\"", "\n", "rules", ".", "Init", "(", ")", "\n\n"...
// NewRules creates a new Rules
[ "NewRules", "creates", "a", "new", "Rules" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/rules.go#L25-L32
24,365
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/rules.go
Freeze
func (rules *Rules) Freeze(format string) error { rules.Errors = []*RuleErrors{} req, err := client.NewJSONRequest( Config, "PUT", fmt.Sprintf( "/papi/v1/properties/%s/versions/%d/rules", rules.PropertyID, rules.PropertyVersion, ), rules, ) if err != nil { return err } req.Header.Set("Conte...
go
func (rules *Rules) Freeze(format string) error { rules.Errors = []*RuleErrors{} req, err := client.NewJSONRequest( Config, "PUT", fmt.Sprintf( "/papi/v1/properties/%s/versions/%d/rules", rules.PropertyID, rules.PropertyVersion, ), rules, ) if err != nil { return err } req.Header.Set("Conte...
[ "func", "(", "rules", "*", "Rules", ")", "Freeze", "(", "format", "string", ")", "error", "{", "rules", ".", "Errors", "=", "[", "]", "*", "RuleErrors", "{", "}", "\n\n", "req", ",", "err", ":=", "client", ".", "NewJSONRequest", "(", "Config", ",", ...
// Freeze pins a properties rule set to a specific rule set version
[ "Freeze", "pins", "a", "properties", "rule", "set", "to", "a", "specific", "rule", "set", "version" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/rules.go#L152-L189
24,366
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/rules.go
MergeBehavior
func (rule *Rule) MergeBehavior(behavior *Behavior) { for _, existingBehavior := range rule.Behaviors { if existingBehavior.Name == behavior.Name { existingBehavior.MergeOptions(behavior.Options) return } } rule.Behaviors = append(rule.Behaviors, behavior) }
go
func (rule *Rule) MergeBehavior(behavior *Behavior) { for _, existingBehavior := range rule.Behaviors { if existingBehavior.Name == behavior.Name { existingBehavior.MergeOptions(behavior.Options) return } } rule.Behaviors = append(rule.Behaviors, behavior) }
[ "func", "(", "rule", "*", "Rule", ")", "MergeBehavior", "(", "behavior", "*", "Behavior", ")", "{", "for", "_", ",", "existingBehavior", ":=", "range", "rule", ".", "Behaviors", "{", "if", "existingBehavior", ".", "Name", "==", "behavior", ".", "Name", "...
// MergeBehavior merges a behavior into a rule // // If the behavior already exists, it's options are merged with the existing // options.
[ "MergeBehavior", "merges", "a", "behavior", "into", "a", "rule", "If", "the", "behavior", "already", "exists", "it", "s", "options", "are", "merged", "with", "the", "existing", "options", "." ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/rules.go#L225-L234
24,367
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/rules.go
AddBehavior
func (rule *Rule) AddBehavior(behavior *Behavior) { for key, existingBehavior := range rule.Behaviors { if existingBehavior.Name == behavior.Name { rule.Behaviors[key] = behavior return } } rule.Behaviors = append(rule.Behaviors, behavior) }
go
func (rule *Rule) AddBehavior(behavior *Behavior) { for key, existingBehavior := range rule.Behaviors { if existingBehavior.Name == behavior.Name { rule.Behaviors[key] = behavior return } } rule.Behaviors = append(rule.Behaviors, behavior) }
[ "func", "(", "rule", "*", "Rule", ")", "AddBehavior", "(", "behavior", "*", "Behavior", ")", "{", "for", "key", ",", "existingBehavior", ":=", "range", "rule", ".", "Behaviors", "{", "if", "existingBehavior", ".", "Name", "==", "behavior", ".", "Name", "...
// AddBehavior adds a behavior to the rule // // If the behavior already exists it is replaced with the given behavior
[ "AddBehavior", "adds", "a", "behavior", "to", "the", "rule", "If", "the", "behavior", "already", "exists", "it", "is", "replaced", "with", "the", "given", "behavior" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/rules.go#L239-L248
24,368
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/rules.go
MergeCriteria
func (rule *Rule) MergeCriteria(criteria *Criteria) { for _, existingCriteria := range rule.Criteria { if existingCriteria.Name == criteria.Name { existingCriteria.MergeOptions(criteria.Options) return } } rule.Criteria = append(rule.Criteria, criteria) }
go
func (rule *Rule) MergeCriteria(criteria *Criteria) { for _, existingCriteria := range rule.Criteria { if existingCriteria.Name == criteria.Name { existingCriteria.MergeOptions(criteria.Options) return } } rule.Criteria = append(rule.Criteria, criteria) }
[ "func", "(", "rule", "*", "Rule", ")", "MergeCriteria", "(", "criteria", "*", "Criteria", ")", "{", "for", "_", ",", "existingCriteria", ":=", "range", "rule", ".", "Criteria", "{", "if", "existingCriteria", ".", "Name", "==", "criteria", ".", "Name", "{...
// MergeCriteria merges a criteria into a rule // // If the criteria already exists, it's options are merged with the existing // options.
[ "MergeCriteria", "merges", "a", "criteria", "into", "a", "rule", "If", "the", "criteria", "already", "exists", "it", "s", "options", "are", "merged", "with", "the", "existing", "options", "." ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/rules.go#L254-L263
24,369
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/rules.go
AddCriteria
func (rule *Rule) AddCriteria(criteria *Criteria) { for key, existingCriteria := range rule.Criteria { if existingCriteria.Name == criteria.Name { rule.Criteria[key] = criteria return } } rule.Criteria = append(rule.Criteria, criteria) }
go
func (rule *Rule) AddCriteria(criteria *Criteria) { for key, existingCriteria := range rule.Criteria { if existingCriteria.Name == criteria.Name { rule.Criteria[key] = criteria return } } rule.Criteria = append(rule.Criteria, criteria) }
[ "func", "(", "rule", "*", "Rule", ")", "AddCriteria", "(", "criteria", "*", "Criteria", ")", "{", "for", "key", ",", "existingCriteria", ":=", "range", "rule", ".", "Criteria", "{", "if", "existingCriteria", ".", "Name", "==", "criteria", ".", "Name", "{...
// AddCriteria add a criteria to a rule // // If the criteria already exists, it is replaced with the given criteria.
[ "AddCriteria", "add", "a", "criteria", "to", "a", "rule", "If", "the", "criteria", "already", "exists", "it", "is", "replaced", "with", "the", "given", "criteria", "." ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/rules.go#L268-L277
24,370
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/rules.go
MergeChildRule
func (rule *Rule) MergeChildRule(childRule *Rule) { for key, existingChildRule := range rule.Children { if existingChildRule.Name == childRule.Name { for _, behavior := range childRule.Behaviors { rule.Children[key].MergeBehavior(behavior) } for _, criteria := range childRule.Criteria { rule.Childr...
go
func (rule *Rule) MergeChildRule(childRule *Rule) { for key, existingChildRule := range rule.Children { if existingChildRule.Name == childRule.Name { for _, behavior := range childRule.Behaviors { rule.Children[key].MergeBehavior(behavior) } for _, criteria := range childRule.Criteria { rule.Childr...
[ "func", "(", "rule", "*", "Rule", ")", "MergeChildRule", "(", "childRule", "*", "Rule", ")", "{", "for", "key", ",", "existingChildRule", ":=", "range", "rule", ".", "Children", "{", "if", "existingChildRule", ".", "Name", "==", "childRule", ".", "Name", ...
// MergeChildRule adds a child rule to this rule // // If the rule already exists, criteria, behaviors, and child rules are added to // the existing rule.
[ "MergeChildRule", "adds", "a", "child", "rule", "to", "this", "rule", "If", "the", "rule", "already", "exists", "criteria", "behaviors", "and", "child", "rules", "are", "added", "to", "the", "existing", "rule", "." ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/rules.go#L283-L303
24,371
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/rules.go
AddChildRule
func (rule *Rule) AddChildRule(childRule *Rule) { for key, existingChildRule := range rule.Children { if existingChildRule.Name == childRule.Name { rule.Children[key] = childRule return } } rule.Children = append(rule.Children, childRule) }
go
func (rule *Rule) AddChildRule(childRule *Rule) { for key, existingChildRule := range rule.Children { if existingChildRule.Name == childRule.Name { rule.Children[key] = childRule return } } rule.Children = append(rule.Children, childRule) }
[ "func", "(", "rule", "*", "Rule", ")", "AddChildRule", "(", "childRule", "*", "Rule", ")", "{", "for", "key", ",", "existingChildRule", ":=", "range", "rule", ".", "Children", "{", "if", "existingChildRule", ".", "Name", "==", "childRule", ".", "Name", "...
// AddChildRule adds a rule as a child of this rule // // If the rule already exists, it is replaced by the given rule.
[ "AddChildRule", "adds", "a", "rule", "as", "a", "child", "of", "this", "rule", "If", "the", "rule", "already", "exists", "it", "is", "replaced", "by", "the", "given", "rule", "." ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/rules.go#L308-L318
24,372
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/rules.go
AddVariable
func (rule *Rule) AddVariable(variable *Variable) { for key, existingVariable := range rule.Variables { if existingVariable.Name == variable.Name { rule.Variables[key] = variable return } } rule.Variables = append(rule.Variables, variable) }
go
func (rule *Rule) AddVariable(variable *Variable) { for key, existingVariable := range rule.Variables { if existingVariable.Name == variable.Name { rule.Variables[key] = variable return } } rule.Variables = append(rule.Variables, variable) }
[ "func", "(", "rule", "*", "Rule", ")", "AddVariable", "(", "variable", "*", "Variable", ")", "{", "for", "key", ",", "existingVariable", ":=", "range", "rule", ".", "Variables", "{", "if", "existingVariable", ".", "Name", "==", "variable", ".", "Name", "...
// AddVariable adds a variable as a child of this rule // // If the rule already exists, it is replaced by the given rule.
[ "AddVariable", "adds", "a", "variable", "as", "a", "child", "of", "this", "rule", "If", "the", "rule", "already", "exists", "it", "is", "replaced", "by", "the", "given", "rule", "." ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/rules.go#L323-L333
24,373
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/rules.go
FindBehavior
func (rules *Rules) FindBehavior(path string) (*Behavior, error) { if len(path) <= 1 { return nil, ErrorMap[ErrInvalidPath] } rule, err := rules.FindParentRule(path) if err != nil { return nil, err } sep := "/" segments := strings.Split(path, sep) behaviorName := strings.ToLower(segments[len(segments)-1])...
go
func (rules *Rules) FindBehavior(path string) (*Behavior, error) { if len(path) <= 1 { return nil, ErrorMap[ErrInvalidPath] } rule, err := rules.FindParentRule(path) if err != nil { return nil, err } sep := "/" segments := strings.Split(path, sep) behaviorName := strings.ToLower(segments[len(segments)-1])...
[ "func", "(", "rules", "*", "Rules", ")", "FindBehavior", "(", "path", "string", ")", "(", "*", "Behavior", ",", "error", ")", "{", "if", "len", "(", "path", ")", "<=", "1", "{", "return", "nil", ",", "ErrorMap", "[", "ErrInvalidPath", "]", "\n", "}...
// FindBehavior locates a specific behavior by path
[ "FindBehavior", "locates", "a", "specific", "behavior", "by", "path" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/rules.go#L336-L356
24,374
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/rules.go
FindCriteria
func (rules *Rules) FindCriteria(path string) (*Criteria, error) { if len(path) <= 1 { return nil, ErrorMap[ErrInvalidPath] } rule, err := rules.FindParentRule(path) if err != nil { return nil, err } sep := "/" segments := strings.Split(path, sep) criteriaName := strings.ToLower(segments[len(segments)-1])...
go
func (rules *Rules) FindCriteria(path string) (*Criteria, error) { if len(path) <= 1 { return nil, ErrorMap[ErrInvalidPath] } rule, err := rules.FindParentRule(path) if err != nil { return nil, err } sep := "/" segments := strings.Split(path, sep) criteriaName := strings.ToLower(segments[len(segments)-1])...
[ "func", "(", "rules", "*", "Rules", ")", "FindCriteria", "(", "path", "string", ")", "(", "*", "Criteria", ",", "error", ")", "{", "if", "len", "(", "path", ")", "<=", "1", "{", "return", "nil", ",", "ErrorMap", "[", "ErrInvalidPath", "]", "\n", "}...
// FindCriteria locates a specific Critieria by path
[ "FindCriteria", "locates", "a", "specific", "Critieria", "by", "path" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/rules.go#L359-L379
24,375
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/rules.go
FindVariable
func (rules *Rules) FindVariable(path string) (*Variable, error) { if len(path) <= 1 { return nil, ErrorMap[ErrInvalidPath] } rule, err := rules.FindParentRule(path) if err != nil { return nil, err } sep := "/" segments := strings.Split(path, sep) variableName := strings.ToLower(segments[len(segments)-1])...
go
func (rules *Rules) FindVariable(path string) (*Variable, error) { if len(path) <= 1 { return nil, ErrorMap[ErrInvalidPath] } rule, err := rules.FindParentRule(path) if err != nil { return nil, err } sep := "/" segments := strings.Split(path, sep) variableName := strings.ToLower(segments[len(segments)-1])...
[ "func", "(", "rules", "*", "Rules", ")", "FindVariable", "(", "path", "string", ")", "(", "*", "Variable", ",", "error", ")", "{", "if", "len", "(", "path", ")", "<=", "1", "{", "return", "nil", ",", "ErrorMap", "[", "ErrInvalidPath", "]", "\n", "}...
// FindVariable locates a specific Variable by path
[ "FindVariable", "locates", "a", "specific", "Variable", "by", "path" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/rules.go#L382-L402
24,376
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/rules.go
FindRule
func (rules *Rules) FindRule(path string) (*Rule, error) { if path == "" { return rules.Rule, nil } sep := "/" segments := strings.Split(path, sep) currentRule := rules.Rule for _, segment := range segments { found := false for _, rule := range currentRule.Children { if strings.ToLower(rule.Name) == se...
go
func (rules *Rules) FindRule(path string) (*Rule, error) { if path == "" { return rules.Rule, nil } sep := "/" segments := strings.Split(path, sep) currentRule := rules.Rule for _, segment := range segments { found := false for _, rule := range currentRule.Children { if strings.ToLower(rule.Name) == se...
[ "func", "(", "rules", "*", "Rules", ")", "FindRule", "(", "path", "string", ")", "(", "*", "Rule", ",", "error", ")", "{", "if", "path", "==", "\"", "\"", "{", "return", "rules", ".", "Rule", ",", "nil", "\n", "}", "\n\n", "sep", ":=", "\"", "\...
// FindRule locates a specific rule by path
[ "FindRule", "locates", "a", "specific", "rule", "by", "path" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/rules.go#L405-L428
24,377
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/rules.go
FindParentRule
func (rules *Rules) FindParentRule(path string) (*Rule, error) { sep := "/" segments := strings.Split(strings.ToLower(strings.TrimPrefix(path, sep)), sep) parentPath := strings.Join(segments[0:len(segments)-1], sep) return rules.FindRule(parentPath) }
go
func (rules *Rules) FindParentRule(path string) (*Rule, error) { sep := "/" segments := strings.Split(strings.ToLower(strings.TrimPrefix(path, sep)), sep) parentPath := strings.Join(segments[0:len(segments)-1], sep) return rules.FindRule(parentPath) }
[ "func", "(", "rules", "*", "Rules", ")", "FindParentRule", "(", "path", "string", ")", "(", "*", "Rule", ",", "error", ")", "{", "sep", ":=", "\"", "\"", "\n", "segments", ":=", "strings", ".", "Split", "(", "strings", ".", "ToLower", "(", "strings",...
// Find the parent rule for a given rule, criteria, or behavior path
[ "Find", "the", "parent", "rule", "for", "a", "given", "rule", "criteria", "or", "behavior", "path" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/rules.go#L431-L437
24,378
akamai/AkamaiOPEN-edgegrid-golang
edgegrid/signer.go
AddRequestHeader
func AddRequestHeader(config Config, req *http.Request) *http.Request { if config.Debug { log.SetLevel(log.DebugLevel) } timestamp := makeEdgeTimeStamp() nonce := createNonce() if req.Header.Get("Content-Type") == "" { req.Header.Set("Content-Type", "application/json") } _, AkamaiCliEnvOK := os.LookupEnv("...
go
func AddRequestHeader(config Config, req *http.Request) *http.Request { if config.Debug { log.SetLevel(log.DebugLevel) } timestamp := makeEdgeTimeStamp() nonce := createNonce() if req.Header.Get("Content-Type") == "" { req.Header.Set("Content-Type", "application/json") } _, AkamaiCliEnvOK := os.LookupEnv("...
[ "func", "AddRequestHeader", "(", "config", "Config", ",", "req", "*", "http", ".", "Request", ")", "*", "http", ".", "Request", "{", "if", "config", ".", "Debug", "{", "log", ".", "SetLevel", "(", "log", ".", "DebugLevel", ")", "\n", "}", "\n", "time...
// AddRequestHeader sets the Authorization header to use Akamai Open API
[ "AddRequestHeader", "sets", "the", "Authorization", "header", "to", "use", "Akamai", "Open", "API" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/edgegrid/signer.go#L25-L58
24,379
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/cpcodes.go
ID
func (cpcode *CpCode) ID() int { id, err := strconv.Atoi(strings.TrimPrefix(cpcode.CpcodeID, "cpc_")) if err != nil { return 0 } return id }
go
func (cpcode *CpCode) ID() int { id, err := strconv.Atoi(strings.TrimPrefix(cpcode.CpcodeID, "cpc_")) if err != nil { return 0 } return id }
[ "func", "(", "cpcode", "*", "CpCode", ")", "ID", "(", ")", "int", "{", "id", ",", "err", ":=", "strconv", ".", "Atoi", "(", "strings", ".", "TrimPrefix", "(", "cpcode", ".", "CpcodeID", ",", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", ...
// ID retrieves a CP Codes integer ID // // PAPI Behaviors require the integer ID, rather than the prefixed string returned
[ "ID", "retrieves", "a", "CP", "Codes", "integer", "ID", "PAPI", "Behaviors", "require", "the", "integer", "ID", "rather", "than", "the", "prefixed", "string", "returned" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/cpcodes.go#L217-L224
24,380
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/contracts.go
FindContract
func (contracts *Contracts) FindContract(id string) (*Contract, error) { var contract *Contract var contractFound bool for _, contract = range contracts.Contracts.Items { if contract.ContractID == id { contractFound = true break } } if !contractFound { return nil, fmt.Errorf("Unable to find contract: ...
go
func (contracts *Contracts) FindContract(id string) (*Contract, error) { var contract *Contract var contractFound bool for _, contract = range contracts.Contracts.Items { if contract.ContractID == id { contractFound = true break } } if !contractFound { return nil, fmt.Errorf("Unable to find contract: ...
[ "func", "(", "contracts", "*", "Contracts", ")", "FindContract", "(", "id", "string", ")", "(", "*", "Contract", ",", "error", ")", "{", "var", "contract", "*", "Contract", "\n", "var", "contractFound", "bool", "\n", "for", "_", ",", "contract", "=", "...
// FindContract finds a specific contract by ID
[ "FindContract", "finds", "a", "specific", "contract", "by", "ID" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/contracts.go#L79-L94
24,381
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/contracts.go
NewContract
func NewContract(parent *Contracts) *Contract { contract := &Contract{ parent: parent, } contract.Init() return contract }
go
func NewContract(parent *Contracts) *Contract { contract := &Contract{ parent: parent, } contract.Init() return contract }
[ "func", "NewContract", "(", "parent", "*", "Contracts", ")", "*", "Contract", "{", "contract", ":=", "&", "Contract", "{", "parent", ":", "parent", ",", "}", "\n", "contract", ".", "Init", "(", ")", "\n", "return", "contract", "\n", "}" ]
// NewContract creates a new Contract
[ "NewContract", "creates", "a", "new", "Contract" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/contracts.go#L105-L111
24,382
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/contracts.go
GetContract
func (contract *Contract) GetContract() error { contracts, err := GetContracts() if err != nil { return err } for _, c := range contracts.Contracts.Items { if c.ContractID == contract.ContractID { contract.parent = c.parent contract.ContractTypeName = c.ContractTypeName contract.Complete <- true re...
go
func (contract *Contract) GetContract() error { contracts, err := GetContracts() if err != nil { return err } for _, c := range contracts.Contracts.Items { if c.ContractID == contract.ContractID { contract.parent = c.parent contract.ContractTypeName = c.ContractTypeName contract.Complete <- true re...
[ "func", "(", "contract", "*", "Contract", ")", "GetContract", "(", ")", "error", "{", "contracts", ",", "err", ":=", "GetContracts", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "for", "_", ",", "c", ":=", "ran...
// GetContract populates a Contract
[ "GetContract", "populates", "a", "Contract" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/contracts.go#L114-L130
24,383
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/contracts.go
GetProducts
func (contract *Contract) GetProducts() (*Products, error) { req, err := client.NewRequest( Config, "GET", fmt.Sprintf( "/papi/v1/products?contractId=%s", contract.ContractID, ), nil, ) if err != nil { return nil, err } res, err := client.Do(Config, req) if err != nil { return nil, err } i...
go
func (contract *Contract) GetProducts() (*Products, error) { req, err := client.NewRequest( Config, "GET", fmt.Sprintf( "/papi/v1/products?contractId=%s", contract.ContractID, ), nil, ) if err != nil { return nil, err } res, err := client.Do(Config, req) if err != nil { return nil, err } i...
[ "func", "(", "contract", "*", "Contract", ")", "GetProducts", "(", ")", "(", "*", "Products", ",", "error", ")", "{", "req", ",", "err", ":=", "client", ".", "NewRequest", "(", "Config", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"",...
// GetProducts gets products associated with a contract
[ "GetProducts", "gets", "products", "associated", "with", "a", "contract" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/contracts.go#L133-L162
24,384
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/activations.go
NewActivation
func NewActivation(parent *Activations) *Activation { activation := &Activation{parent: parent} activation.Init() return activation }
go
func NewActivation(parent *Activations) *Activation { activation := &Activation{parent: parent} activation.Init() return activation }
[ "func", "NewActivation", "(", "parent", "*", "Activations", ")", "*", "Activation", "{", "activation", ":=", "&", "Activation", "{", "parent", ":", "parent", "}", "\n", "activation", ".", "Init", "(", ")", "\n\n", "return", "activation", "\n", "}" ]
// NewActivation creates a new Activation
[ "NewActivation", "creates", "a", "new", "Activation" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/activations.go#L138-L143
24,385
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/hostnames.go
NewHostname
func (hostnames *Hostnames) NewHostname() *Hostname { hostname := NewHostname(hostnames) hostnames.Hostnames.Items = append(hostnames.Hostnames.Items, hostname) return hostname }
go
func (hostnames *Hostnames) NewHostname() *Hostname { hostname := NewHostname(hostnames) hostnames.Hostnames.Items = append(hostnames.Hostnames.Items, hostname) return hostname }
[ "func", "(", "hostnames", "*", "Hostnames", ")", "NewHostname", "(", ")", "*", "Hostname", "{", "hostname", ":=", "NewHostname", "(", "hostnames", ")", "\n", "hostnames", ".", "Hostnames", ".", "Items", "=", "append", "(", "hostnames", ".", "Hostnames", "....
// NewHostname creates a new Hostname within a given Hostnames
[ "NewHostname", "creates", "a", "new", "Hostname", "within", "a", "given", "Hostnames" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/hostnames.go#L104-L108
24,386
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/hostnames.go
Save
func (hostnames *Hostnames) Save() error { req, err := client.NewJSONRequest( Config, "PUT", fmt.Sprintf( "/papi/v1/properties/%s/versions/%d/hostnames?contractId=%s&groupId=%s", hostnames.PropertyID, hostnames.PropertyVersion, hostnames.ContractID, hostnames.GroupID, ), hostnames.Hostnames.It...
go
func (hostnames *Hostnames) Save() error { req, err := client.NewJSONRequest( Config, "PUT", fmt.Sprintf( "/papi/v1/properties/%s/versions/%d/hostnames?contractId=%s&groupId=%s", hostnames.PropertyID, hostnames.PropertyVersion, hostnames.ContractID, hostnames.GroupID, ), hostnames.Hostnames.It...
[ "func", "(", "hostnames", "*", "Hostnames", ")", "Save", "(", ")", "error", "{", "req", ",", "err", ":=", "client", ".", "NewJSONRequest", "(", "Config", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "hostnames", ".", "PropertyID...
// Save updates a properties hostnames
[ "Save", "updates", "a", "properties", "hostnames" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/hostnames.go#L111-L142
24,387
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/hostnames.go
NewHostname
func NewHostname(parent *Hostnames) *Hostname { hostname := &Hostname{parent: parent, CnameType: CnameTypeEdgeHostname} hostname.Init() return hostname }
go
func NewHostname(parent *Hostnames) *Hostname { hostname := &Hostname{parent: parent, CnameType: CnameTypeEdgeHostname} hostname.Init() return hostname }
[ "func", "NewHostname", "(", "parent", "*", "Hostnames", ")", "*", "Hostname", "{", "hostname", ":=", "&", "Hostname", "{", "parent", ":", "parent", ",", "CnameType", ":", "CnameTypeEdgeHostname", "}", "\n", "hostname", ".", "Init", "(", ")", "\n\n", "retur...
// NewHostname creates a new Hostname
[ "NewHostname", "creates", "a", "new", "Hostname" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/hostnames.go#L155-L160
24,388
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/versions.go
AddVersion
func (versions *Versions) AddVersion(version *Version) { if version.PropertyVersion != 0 { for key, v := range versions.Versions.Items { if v.PropertyVersion == version.PropertyVersion { versions.Versions.Items[key] = version return } } } versions.Versions.Items = append(versions.Versions.Items, v...
go
func (versions *Versions) AddVersion(version *Version) { if version.PropertyVersion != 0 { for key, v := range versions.Versions.Items { if v.PropertyVersion == version.PropertyVersion { versions.Versions.Items[key] = version return } } } versions.Versions.Items = append(versions.Versions.Items, v...
[ "func", "(", "versions", "*", "Versions", ")", "AddVersion", "(", "version", "*", "Version", ")", "{", "if", "version", ".", "PropertyVersion", "!=", "0", "{", "for", "key", ",", "v", ":=", "range", "versions", ".", "Versions", ".", "Items", "{", "if",...
// AddVersion adds or replaces a version within the collection
[ "AddVersion", "adds", "or", "replaces", "a", "version", "within", "the", "collection" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/versions.go#L47-L58
24,389
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/versions.go
NewVersion
func (versions *Versions) NewVersion(createFromVersion *Version, useEtagStrict bool) *Version { if createFromVersion == nil { var err error createFromVersion, err = versions.GetLatestVersion("") if err != nil { return nil } } version := NewVersion(versions) version.CreateFromVersion = createFromVersion....
go
func (versions *Versions) NewVersion(createFromVersion *Version, useEtagStrict bool) *Version { if createFromVersion == nil { var err error createFromVersion, err = versions.GetLatestVersion("") if err != nil { return nil } } version := NewVersion(versions) version.CreateFromVersion = createFromVersion....
[ "func", "(", "versions", "*", "Versions", ")", "NewVersion", "(", "createFromVersion", "*", "Version", ",", "useEtagStrict", "bool", ")", "*", "Version", "{", "if", "createFromVersion", "==", "nil", "{", "var", "err", "error", "\n", "createFromVersion", ",", ...
// NewVersion creates a new version associated with the Versions collection
[ "NewVersion", "creates", "a", "new", "version", "associated", "with", "the", "Versions", "collection" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/versions.go#L137-L156
24,390
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/versions.go
NewVersion
func NewVersion(parent *Versions) *Version { version := &Version{parent: parent} version.Init() return version }
go
func NewVersion(parent *Versions) *Version { version := &Version{parent: parent} version.Init() return version }
[ "func", "NewVersion", "(", "parent", "*", "Versions", ")", "*", "Version", "{", "version", ":=", "&", "Version", "{", "parent", ":", "parent", "}", "\n", "version", ".", "Init", "(", ")", "\n\n", "return", "version", "\n", "}" ]
// NewVersion creates a new Version
[ "NewVersion", "creates", "a", "new", "Version" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/versions.go#L176-L181
24,391
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/versions.go
HasBeenActivated
func (version *Version) HasBeenActivated(activatedOn NetworkValue) (bool, error) { properties := NewProperties() property := NewProperty(properties) property.PropertyID = version.parent.PropertyID property.Group = NewGroup(NewGroups()) property.Group.GroupID = version.parent.GroupID property.Contract = NewContr...
go
func (version *Version) HasBeenActivated(activatedOn NetworkValue) (bool, error) { properties := NewProperties() property := NewProperty(properties) property.PropertyID = version.parent.PropertyID property.Group = NewGroup(NewGroups()) property.Group.GroupID = version.parent.GroupID property.Contract = NewContr...
[ "func", "(", "version", "*", "Version", ")", "HasBeenActivated", "(", "activatedOn", "NetworkValue", ")", "(", "bool", ",", "error", ")", "{", "properties", ":=", "NewProperties", "(", ")", "\n", "property", ":=", "NewProperty", "(", "properties", ")", "\n",...
// HasBeenActivated determines if a given version has been activated, optionally on a specific network
[ "HasBeenActivated", "determines", "if", "a", "given", "version", "has", "been", "activated", "optionally", "on", "a", "specific", "network" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/versions.go#L235-L258
24,392
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/edgehostnames.go
NewEdgeHostname
func (edgeHostnames *EdgeHostnames) NewEdgeHostname() *EdgeHostname { edgeHostname := NewEdgeHostname(edgeHostnames) edgeHostnames.EdgeHostnames.Items = append(edgeHostnames.EdgeHostnames.Items, edgeHostname) return edgeHostname }
go
func (edgeHostnames *EdgeHostnames) NewEdgeHostname() *EdgeHostname { edgeHostname := NewEdgeHostname(edgeHostnames) edgeHostnames.EdgeHostnames.Items = append(edgeHostnames.EdgeHostnames.Items, edgeHostname) return edgeHostname }
[ "func", "(", "edgeHostnames", "*", "EdgeHostnames", ")", "NewEdgeHostname", "(", ")", "*", "EdgeHostname", "{", "edgeHostname", ":=", "NewEdgeHostname", "(", "edgeHostnames", ")", "\n", "edgeHostnames", ".", "EdgeHostnames", ".", "Items", "=", "append", "(", "ed...
// NewEdgeHostname creates a new EdgeHostname within a given EdgeHostnames
[ "NewEdgeHostname", "creates", "a", "new", "EdgeHostname", "within", "a", "given", "EdgeHostnames" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/edgehostnames.go#L51-L55
24,393
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/edgehostnames.go
NewEdgeHostname
func NewEdgeHostname(edgeHostnames *EdgeHostnames) *EdgeHostname { edgeHostname := &EdgeHostname{parent: edgeHostnames} edgeHostname.Init() return edgeHostname }
go
func NewEdgeHostname(edgeHostnames *EdgeHostnames) *EdgeHostname { edgeHostname := &EdgeHostname{parent: edgeHostnames} edgeHostname.Init() return edgeHostname }
[ "func", "NewEdgeHostname", "(", "edgeHostnames", "*", "EdgeHostnames", ")", "*", "EdgeHostname", "{", "edgeHostname", ":=", "&", "EdgeHostname", "{", "parent", ":", "edgeHostnames", "}", "\n", "edgeHostname", ".", "Init", "(", ")", "\n", "return", "edgeHostname"...
// NewEdgeHostname creates a new EdgeHostname
[ "NewEdgeHostname", "creates", "a", "new", "EdgeHostname" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/edgehostnames.go#L161-L165
24,394
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/properties.go
AddProperty
func (properties *Properties) AddProperty(newProperty *Property) { if newProperty.PropertyID != "" { for key, property := range properties.Properties.Items { if property.PropertyID == newProperty.PropertyID { properties.Properties.Items[key] = newProperty return } } } newProperty.parent = properti...
go
func (properties *Properties) AddProperty(newProperty *Property) { if newProperty.PropertyID != "" { for key, property := range properties.Properties.Items { if property.PropertyID == newProperty.PropertyID { properties.Properties.Items[key] = newProperty return } } } newProperty.parent = properti...
[ "func", "(", "properties", "*", "Properties", ")", "AddProperty", "(", "newProperty", "*", "Property", ")", "{", "if", "newProperty", ".", "PropertyID", "!=", "\"", "\"", "{", "for", "key", ",", "property", ":=", "range", "properties", ".", "Properties", "...
// AddProperty adds a property to the collection, if the property already exists // in the collection it will be replaced.
[ "AddProperty", "adds", "a", "property", "to", "the", "collection", "if", "the", "property", "already", "exists", "in", "the", "collection", "it", "will", "be", "replaced", "." ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/properties.go#L83-L96
24,395
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/properties.go
FindProperty
func (properties *Properties) FindProperty(id string) (*Property, error) { var property *Property var propertyFound bool for _, property = range properties.Properties.Items { if property.PropertyID == id { propertyFound = true break } } if !propertyFound { return nil, fmt.Errorf("Unable to find proper...
go
func (properties *Properties) FindProperty(id string) (*Property, error) { var property *Property var propertyFound bool for _, property = range properties.Properties.Items { if property.PropertyID == id { propertyFound = true break } } if !propertyFound { return nil, fmt.Errorf("Unable to find proper...
[ "func", "(", "properties", "*", "Properties", ")", "FindProperty", "(", "id", "string", ")", "(", "*", "Property", ",", "error", ")", "{", "var", "property", "*", "Property", "\n", "var", "propertyFound", "bool", "\n", "for", "_", ",", "property", "=", ...
// FindProperty finds a property by ID within the collection
[ "FindProperty", "finds", "a", "property", "by", "ID", "within", "the", "collection" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/properties.go#L99-L114
24,396
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/properties.go
NewProperty
func (properties *Properties) NewProperty(contract *Contract, group *Group) *Property { property := NewProperty(properties) properties.AddProperty(property) property.Contract = contract property.Group = group go property.Contract.GetContract() go property.Group.GetGroup() go (func(property *Property) { group...
go
func (properties *Properties) NewProperty(contract *Contract, group *Group) *Property { property := NewProperty(properties) properties.AddProperty(property) property.Contract = contract property.Group = group go property.Contract.GetContract() go property.Group.GetGroup() go (func(property *Property) { group...
[ "func", "(", "properties", "*", "Properties", ")", "NewProperty", "(", "contract", "*", "Contract", ",", "group", "*", "Group", ")", "*", "Property", "{", "property", ":=", "NewProperty", "(", "properties", ")", "\n\n", "properties", ".", "AddProperty", "(",...
// NewProperty creates a new property associated with the collection
[ "NewProperty", "creates", "a", "new", "property", "associated", "with", "the", "collection" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/properties.go#L117-L133
24,397
akamai/AkamaiOPEN-edgegrid-golang
papi-v1/properties.go
NewProperty
func NewProperty(parent *Properties) *Property { property := &Property{parent: parent, Group: &Group{}, Contract: &Contract{}} property.Init() return property }
go
func NewProperty(parent *Properties) *Property { property := &Property{parent: parent, Group: &Group{}, Contract: &Contract{}} property.Init() return property }
[ "func", "NewProperty", "(", "parent", "*", "Properties", ")", "*", "Property", "{", "property", ":=", "&", "Property", "{", "parent", ":", "parent", ",", "Group", ":", "&", "Group", "{", "}", ",", "Contract", ":", "&", "Contract", "{", "}", "}", "\n"...
// NewProperty creates a new Property
[ "NewProperty", "creates", "a", "new", "Property" ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/papi-v1/properties.go#L156-L160
24,398
akamai/AkamaiOPEN-edgegrid-golang
client-v1/errors.go
NewAPIError
func NewAPIError(response *http.Response) APIError { // TODO: handle this error body, _ := ioutil.ReadAll(response.Body) return NewAPIErrorFromBody(response, body) }
go
func NewAPIError(response *http.Response) APIError { // TODO: handle this error body, _ := ioutil.ReadAll(response.Body) return NewAPIErrorFromBody(response, body) }
[ "func", "NewAPIError", "(", "response", "*", "http", ".", "Response", ")", "APIError", "{", "// TODO: handle this error", "body", ",", "_", ":=", "ioutil", ".", "ReadAll", "(", "response", ".", "Body", ")", "\n\n", "return", "NewAPIErrorFromBody", "(", "respon...
// NewAPIError creates a new API error based on a Response, // or http.Response-like.
[ "NewAPIError", "creates", "a", "new", "API", "error", "based", "on", "a", "Response", "or", "http", ".", "Response", "-", "like", "." ]
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/client-v1/errors.go#L55-L60
24,399
akamai/AkamaiOPEN-edgegrid-golang
client-v1/errors.go
NewAPIErrorFromBody
func NewAPIErrorFromBody(response *http.Response, body []byte) APIError { error := APIError{} if err := jsonhooks.Unmarshal(body, &error); err == nil { error.Status = response.StatusCode error.Title = response.Status } error.Response = response error.RawBody = string(body) return error }
go
func NewAPIErrorFromBody(response *http.Response, body []byte) APIError { error := APIError{} if err := jsonhooks.Unmarshal(body, &error); err == nil { error.Status = response.StatusCode error.Title = response.Status } error.Response = response error.RawBody = string(body) return error }
[ "func", "NewAPIErrorFromBody", "(", "response", "*", "http", ".", "Response", ",", "body", "[", "]", "byte", ")", "APIError", "{", "error", ":=", "APIError", "{", "}", "\n", "if", "err", ":=", "jsonhooks", ".", "Unmarshal", "(", "body", ",", "&", "erro...
// NewAPIErrorFromBody creates a new API error, allowing you to pass in a body // // This function is intended to be used after the body has already been read for // other purposes.
[ "NewAPIErrorFromBody", "creates", "a", "new", "API", "error", "allowing", "you", "to", "pass", "in", "a", "body", "This", "function", "is", "intended", "to", "be", "used", "after", "the", "body", "has", "already", "been", "read", "for", "other", "purposes", ...
009960c8b2c7c57a0c5c488a3c8c778c16f3f586
https://github.com/akamai/AkamaiOPEN-edgegrid-golang/blob/009960c8b2c7c57a0c5c488a3c8c778c16f3f586/client-v1/errors.go#L66-L77