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
partition
stringclasses
1 value
cloudfoundry/cli
api/cloudcontroller/cloud_controller_connection.go
NewConnection
func NewConnection(config Config) *CloudControllerConnection { tr := &http.Transport{ TLSClientConfig: &tls.Config{ InsecureSkipVerify: config.SkipSSLValidation, }, Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ KeepAlive: 30 * time.Second, Timeout: config.DialTimeout, }).DialContext...
go
func NewConnection(config Config) *CloudControllerConnection { tr := &http.Transport{ TLSClientConfig: &tls.Config{ InsecureSkipVerify: config.SkipSSLValidation, }, Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ KeepAlive: 30 * time.Second, Timeout: config.DialTimeout, }).DialContext...
[ "func", "NewConnection", "(", "config", "Config", ")", "*", "CloudControllerConnection", "{", "tr", ":=", "&", "http", ".", "Transport", "{", "TLSClientConfig", ":", "&", "tls", ".", "Config", "{", "InsecureSkipVerify", ":", "config", ".", "SkipSSLValidation", ...
// NewConnection returns a new CloudControllerConnection with provided // configuration.
[ "NewConnection", "returns", "a", "new", "CloudControllerConnection", "with", "provided", "configuration", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/cloud_controller_connection.go#L31-L46
train
cloudfoundry/cli
api/cloudcontroller/cloud_controller_connection.go
handleWarnings
func (*CloudControllerConnection) handleWarnings(response *http.Response) ([]string, error) { rawWarnings := response.Header.Get("X-Cf-Warnings") if len(rawWarnings) == 0 { return nil, nil } var warnings []string for _, rawWarning := range strings.Split(rawWarnings, ",") { warning, err := url.QueryUnescape(ra...
go
func (*CloudControllerConnection) handleWarnings(response *http.Response) ([]string, error) { rawWarnings := response.Header.Get("X-Cf-Warnings") if len(rawWarnings) == 0 { return nil, nil } var warnings []string for _, rawWarning := range strings.Split(rawWarnings, ",") { warning, err := url.QueryUnescape(ra...
[ "func", "(", "*", "CloudControllerConnection", ")", "handleWarnings", "(", "response", "*", "http", ".", "Response", ")", "(", "[", "]", "string", ",", "error", ")", "{", "rawWarnings", ":=", "response", ".", "Header", ".", "Get", "(", "\"", "\"", ")", ...
// handleWarnings looks for the "X-Cf-Warnings" header in the cloud controller // response and URI decodes them. The value can contain multiple warnings that // are comma separated.
[ "handleWarnings", "looks", "for", "the", "X", "-", "Cf", "-", "Warnings", "header", "in", "the", "cloud", "controller", "response", "and", "URI", "decodes", "them", ".", "The", "value", "can", "contain", "multiple", "warnings", "that", "are", "comma", "separ...
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/cloud_controller_connection.go#L90-L106
train
cloudfoundry/cli
cf/actors/push.go
ProcessPath
func (actor PushActorImpl) ProcessPath(dirOrZipFile string, f func(string) error) error { if !actor.zipper.IsZipFile(dirOrZipFile) { if filepath.IsAbs(dirOrZipFile) { appDir, err := filepath.EvalSymlinks(dirOrZipFile) if err != nil { return err } err = f(appDir) if err != nil { return err }...
go
func (actor PushActorImpl) ProcessPath(dirOrZipFile string, f func(string) error) error { if !actor.zipper.IsZipFile(dirOrZipFile) { if filepath.IsAbs(dirOrZipFile) { appDir, err := filepath.EvalSymlinks(dirOrZipFile) if err != nil { return err } err = f(appDir) if err != nil { return err }...
[ "func", "(", "actor", "PushActorImpl", ")", "ProcessPath", "(", "dirOrZipFile", "string", ",", "f", "func", "(", "string", ")", "error", ")", "error", "{", "if", "!", "actor", ".", "zipper", ".", "IsZipFile", "(", "dirOrZipFile", ")", "{", "if", "filepat...
// ProcessPath takes in a director of app files or a zip file which contains // the app files. If given a zip file, it will extract the zip to a temporary // location, call the provided callback with that location, and then clean up // the location after the callback has been executed. // // This was done so that the c...
[ "ProcessPath", "takes", "in", "a", "director", "of", "app", "files", "or", "a", "zip", "file", "which", "contains", "the", "app", "files", ".", "If", "given", "a", "zip", "file", "it", "will", "extract", "the", "zip", "to", "a", "temporary", "location", ...
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/cf/actors/push.go#L55-L106
train
cloudfoundry/cli
actor/sharedaction/is_logged_in.go
IsLoggedIn
func (actor Actor) IsLoggedIn() bool { return actor.Config.AccessToken() != "" || actor.Config.RefreshToken() != "" }
go
func (actor Actor) IsLoggedIn() bool { return actor.Config.AccessToken() != "" || actor.Config.RefreshToken() != "" }
[ "func", "(", "actor", "Actor", ")", "IsLoggedIn", "(", ")", "bool", "{", "return", "actor", ".", "Config", ".", "AccessToken", "(", ")", "!=", "\"", "\"", "||", "actor", ".", "Config", ".", "RefreshToken", "(", ")", "!=", "\"", "\"", "\n", "}" ]
// IsLoggedIn checks whether a user has authenticated with CF
[ "IsLoggedIn", "checks", "whether", "a", "user", "has", "authenticated", "with", "CF" ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/sharedaction/is_logged_in.go#L4-L6
train
cloudfoundry/cli
api/plugin/request.go
newGETRequest
func (client *Client) newGETRequest(url string) (*http.Request, error) { request, err := http.NewRequest( http.MethodGet, url, nil, ) if err != nil { return nil, err } request.Header = http.Header{} request.Header.Set("Accept", "application/json") request.Header.Set("Content-Type", "application/json") ...
go
func (client *Client) newGETRequest(url string) (*http.Request, error) { request, err := http.NewRequest( http.MethodGet, url, nil, ) if err != nil { return nil, err } request.Header = http.Header{} request.Header.Set("Accept", "application/json") request.Header.Set("Content-Type", "application/json") ...
[ "func", "(", "client", "*", "Client", ")", "newGETRequest", "(", "url", "string", ")", "(", "*", "http", ".", "Request", ",", "error", ")", "{", "request", ",", "err", ":=", "http", ".", "NewRequest", "(", "http", ".", "MethodGet", ",", "url", ",", ...
// newGETRequest returns a constructed HTTP.Request with some defaults. // Defaults are applied when Request options are not filled in.
[ "newGETRequest", "returns", "a", "constructed", "HTTP", ".", "Request", "with", "some", "defaults", ".", "Defaults", "are", "applied", "when", "Request", "options", "are", "not", "filled", "in", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/plugin/request.go#L7-L23
train
cloudfoundry/cli
api/cloudcontroller/minimum_version_check.go
MinimumAPIVersionCheck
func MinimumAPIVersionCheck(current string, minimum string) error { if minimum == "" { return nil } currentSemver, err := semver.Make(current) if err != nil { return err } minimumSemver, err := semver.Make(minimum) if err != nil { return err } if currentSemver.Compare(minimumSemver) == -1 { return c...
go
func MinimumAPIVersionCheck(current string, minimum string) error { if minimum == "" { return nil } currentSemver, err := semver.Make(current) if err != nil { return err } minimumSemver, err := semver.Make(minimum) if err != nil { return err } if currentSemver.Compare(minimumSemver) == -1 { return c...
[ "func", "MinimumAPIVersionCheck", "(", "current", "string", ",", "minimum", "string", ")", "error", "{", "if", "minimum", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "currentSemver", ",", "err", ":=", "semver", ".", "Make", "(", "current", ...
// MinimumAPIVersionCheck compares `current` to `minimum`. If `current` is // older than `minimum` then an error is returned; otherwise, nil is returned.
[ "MinimumAPIVersionCheck", "compares", "current", "to", "minimum", ".", "If", "current", "is", "older", "than", "minimum", "then", "an", "error", "is", "returned", ";", "otherwise", "nil", "is", "returned", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/minimum_version_check.go#L10-L33
train
cloudfoundry/cli
util/ui/request_logger_file_writer.go
RequestLoggerFileWriter
func (ui *UI) RequestLoggerFileWriter(filePaths []string) *RequestLoggerFileWriter { return newRequestLoggerFileWriter(ui, ui.fileLock, filePaths) }
go
func (ui *UI) RequestLoggerFileWriter(filePaths []string) *RequestLoggerFileWriter { return newRequestLoggerFileWriter(ui, ui.fileLock, filePaths) }
[ "func", "(", "ui", "*", "UI", ")", "RequestLoggerFileWriter", "(", "filePaths", "[", "]", "string", ")", "*", "RequestLoggerFileWriter", "{", "return", "newRequestLoggerFileWriter", "(", "ui", ",", "ui", ".", "fileLock", ",", "filePaths", ")", "\n", "}" ]
// RequestLoggerFileWriter returns a RequestLoggerFileWriter that cannot // overwrite another RequestLoggerFileWriter.
[ "RequestLoggerFileWriter", "returns", "a", "RequestLoggerFileWriter", "that", "cannot", "overwrite", "another", "RequestLoggerFileWriter", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/util/ui/request_logger_file_writer.go#L142-L144
train
cloudfoundry/cli
api/cloudcontroller/ccv2/stack.go
UnmarshalJSON
func (stack *Stack) UnmarshalJSON(data []byte) error { var ccStack struct { Metadata internal.Metadata `json:"metadata"` Entity struct { Name string `json:"name"` Description string `json:"description"` } `json:"entity"` } err := cloudcontroller.DecodeJSON(data, &ccStack) if err != nil { retu...
go
func (stack *Stack) UnmarshalJSON(data []byte) error { var ccStack struct { Metadata internal.Metadata `json:"metadata"` Entity struct { Name string `json:"name"` Description string `json:"description"` } `json:"entity"` } err := cloudcontroller.DecodeJSON(data, &ccStack) if err != nil { retu...
[ "func", "(", "stack", "*", "Stack", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "ccStack", "struct", "{", "Metadata", "internal", ".", "Metadata", "`json:\"metadata\"`", "\n", "Entity", "struct", "{", "Name", "string", "`...
// UnmarshalJSON helps unmarshal a Cloud Controller Stack response.
[ "UnmarshalJSON", "helps", "unmarshal", "a", "Cloud", "Controller", "Stack", "response", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/stack.go#L22-L39
train
cloudfoundry/cli
api/cloudcontroller/ccv2/stack.go
GetStack
func (client *Client) GetStack(guid string) (Stack, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetStackRequest, URIParams: Params{"stack_guid": guid}, }) if err != nil { return Stack{}, nil, err } var stack Stack response := cloudcontroller.Response{ ...
go
func (client *Client) GetStack(guid string) (Stack, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetStackRequest, URIParams: Params{"stack_guid": guid}, }) if err != nil { return Stack{}, nil, err } var stack Stack response := cloudcontroller.Response{ ...
[ "func", "(", "client", "*", "Client", ")", "GetStack", "(", "guid", "string", ")", "(", "Stack", ",", "Warnings", ",", "error", ")", "{", "request", ",", "err", ":=", "client", ".", "newHTTPRequest", "(", "requestOptions", "{", "RequestName", ":", "inter...
// GetStack returns the requested stack.
[ "GetStack", "returns", "the", "requested", "stack", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/stack.go#L42-L58
train
cloudfoundry/cli
api/cloudcontroller/ccv2/stack.go
GetStacks
func (client *Client) GetStacks(filters ...Filter) ([]Stack, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetStacksRequest, Query: ConvertFilterParameters(filters), }) if err != nil { return nil, nil, err } var fullStacksList []Stack warnings, err := ...
go
func (client *Client) GetStacks(filters ...Filter) ([]Stack, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetStacksRequest, Query: ConvertFilterParameters(filters), }) if err != nil { return nil, nil, err } var fullStacksList []Stack warnings, err := ...
[ "func", "(", "client", "*", "Client", ")", "GetStacks", "(", "filters", "...", "Filter", ")", "(", "[", "]", "Stack", ",", "Warnings", ",", "error", ")", "{", "request", ",", "err", ":=", "client", ".", "newHTTPRequest", "(", "requestOptions", "{", "Re...
// GetStacks returns a list of Stacks based off of the provided filters.
[ "GetStacks", "returns", "a", "list", "of", "Stacks", "based", "off", "of", "the", "provided", "filters", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/stack.go#L61-L84
train
cloudfoundry/cli
api/cloudcontroller/wrapper/uaa_authentication.go
refreshToken
func (t *UAAAuthentication) refreshToken() error { var expiresIn time.Duration tokenStr := strings.TrimPrefix(t.cache.AccessToken(), "bearer ") token, err := jws.ParseJWT([]byte(tokenStr)) if err != nil { // if the JWT could not be parsed, force a refresh expiresIn = 0 } else { expiration, _ := token.Claims...
go
func (t *UAAAuthentication) refreshToken() error { var expiresIn time.Duration tokenStr := strings.TrimPrefix(t.cache.AccessToken(), "bearer ") token, err := jws.ParseJWT([]byte(tokenStr)) if err != nil { // if the JWT could not be parsed, force a refresh expiresIn = 0 } else { expiration, _ := token.Claims...
[ "func", "(", "t", "*", "UAAAuthentication", ")", "refreshToken", "(", ")", "error", "{", "var", "expiresIn", "time", ".", "Duration", "\n\n", "tokenStr", ":=", "strings", ".", "TrimPrefix", "(", "t", ".", "cache", ".", "AccessToken", "(", ")", ",", "\"",...
// refreshToken refreshes the JWT access token if it is expired or about to expire. // If the access token is not yet expired, no action is performed.
[ "refreshToken", "refreshes", "the", "JWT", "access", "token", "if", "it", "is", "expired", "or", "about", "to", "expire", ".", "If", "the", "access", "token", "is", "not", "yet", "expired", "no", "action", "is", "performed", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/wrapper/uaa_authentication.go#L83-L105
train
cloudfoundry/cli
actor/v2action/service_access.go
EnableServiceForOrg
func (actor Actor) EnableServiceForOrg(serviceName, orgName, brokerName string) (Warnings, error) { servicePlans, allWarnings, err := actor.GetServicePlansForService(serviceName, brokerName) if err != nil { return allWarnings, err } org, orgWarnings, err := actor.GetOrganizationByName(orgName) allWarnings = app...
go
func (actor Actor) EnableServiceForOrg(serviceName, orgName, brokerName string) (Warnings, error) { servicePlans, allWarnings, err := actor.GetServicePlansForService(serviceName, brokerName) if err != nil { return allWarnings, err } org, orgWarnings, err := actor.GetOrganizationByName(orgName) allWarnings = app...
[ "func", "(", "actor", "Actor", ")", "EnableServiceForOrg", "(", "serviceName", ",", "orgName", ",", "brokerName", "string", ")", "(", "Warnings", ",", "error", ")", "{", "servicePlans", ",", "allWarnings", ",", "err", ":=", "actor", ".", "GetServicePlansForSer...
// EnableServiceForOrg enables access for the given service in a specific org.
[ "EnableServiceForOrg", "enables", "access", "for", "the", "given", "service", "in", "a", "specific", "org", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/service_access.go#L63-L89
train
cloudfoundry/cli
actor/v2action/service_access.go
EnablePlanForOrg
func (actor Actor) EnablePlanForOrg(serviceName, servicePlanName, orgName, brokerName string) (Warnings, error) { servicePlans, allWarnings, err := actor.GetServicePlansForService(serviceName, brokerName) if err != nil { return allWarnings, err } org, orgWarnings, err := actor.GetOrganizationByName(orgName) all...
go
func (actor Actor) EnablePlanForOrg(serviceName, servicePlanName, orgName, brokerName string) (Warnings, error) { servicePlans, allWarnings, err := actor.GetServicePlansForService(serviceName, brokerName) if err != nil { return allWarnings, err } org, orgWarnings, err := actor.GetOrganizationByName(orgName) all...
[ "func", "(", "actor", "Actor", ")", "EnablePlanForOrg", "(", "serviceName", ",", "servicePlanName", ",", "orgName", ",", "brokerName", "string", ")", "(", "Warnings", ",", "error", ")", "{", "servicePlans", ",", "allWarnings", ",", "err", ":=", "actor", ".",...
// EnablePlanForOrg enables access to a specific plan of the given service in a specific org.
[ "EnablePlanForOrg", "enables", "access", "to", "a", "specific", "plan", "of", "the", "given", "service", "in", "a", "specific", "org", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/service_access.go#L92-L119
train
cloudfoundry/cli
actor/v2action/service_access.go
DisableServiceForAllOrgs
func (actor Actor) DisableServiceForAllOrgs(serviceName, brokerName string) (Warnings, error) { servicePlans, allWarnings, err := actor.GetServicePlansForService(serviceName, brokerName) if err != nil { return allWarnings, err } for _, plan := range servicePlans { warnings, err := actor.removeOrgLevelServicePl...
go
func (actor Actor) DisableServiceForAllOrgs(serviceName, brokerName string) (Warnings, error) { servicePlans, allWarnings, err := actor.GetServicePlansForService(serviceName, brokerName) if err != nil { return allWarnings, err } for _, plan := range servicePlans { warnings, err := actor.removeOrgLevelServicePl...
[ "func", "(", "actor", "Actor", ")", "DisableServiceForAllOrgs", "(", "serviceName", ",", "brokerName", "string", ")", "(", "Warnings", ",", "error", ")", "{", "servicePlans", ",", "allWarnings", ",", "err", ":=", "actor", ".", "GetServicePlansForService", "(", ...
// DisableServiceForAllOrgs disables access for the given service in all orgs.
[ "DisableServiceForAllOrgs", "disables", "access", "for", "the", "given", "service", "in", "all", "orgs", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/service_access.go#L122-L144
train
cloudfoundry/cli
actor/v2action/service_access.go
DisablePlanForAllOrgs
func (actor Actor) DisablePlanForAllOrgs(serviceName, servicePlanName, brokerName string) (Warnings, error) { servicePlans, allWarnings, err := actor.GetServicePlansForService(serviceName, brokerName) if err != nil { return allWarnings, err } planFound := false for _, plan := range servicePlans { if plan.Name...
go
func (actor Actor) DisablePlanForAllOrgs(serviceName, servicePlanName, brokerName string) (Warnings, error) { servicePlans, allWarnings, err := actor.GetServicePlansForService(serviceName, brokerName) if err != nil { return allWarnings, err } planFound := false for _, plan := range servicePlans { if plan.Name...
[ "func", "(", "actor", "Actor", ")", "DisablePlanForAllOrgs", "(", "serviceName", ",", "servicePlanName", ",", "brokerName", "string", ")", "(", "Warnings", ",", "error", ")", "{", "servicePlans", ",", "allWarnings", ",", "err", ":=", "actor", ".", "GetServiceP...
// DisablePlanForAllOrgs disables access to a specific plan of the given service, from the given broker in all orgs.
[ "DisablePlanForAllOrgs", "disables", "access", "to", "a", "specific", "plan", "of", "the", "given", "service", "from", "the", "given", "broker", "in", "all", "orgs", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/service_access.go#L147-L176
train
cloudfoundry/cli
actor/v2action/service_access.go
DisableServiceForOrg
func (actor Actor) DisableServiceForOrg(serviceName, orgName, brokerName string) (Warnings, error) { servicePlans, allWarnings, err := actor.GetServicePlansForService(serviceName, brokerName) if err != nil { return allWarnings, err } org, orgWarnings, err := actor.GetOrganizationByName(orgName) allWarnings = ap...
go
func (actor Actor) DisableServiceForOrg(serviceName, orgName, brokerName string) (Warnings, error) { servicePlans, allWarnings, err := actor.GetServicePlansForService(serviceName, brokerName) if err != nil { return allWarnings, err } org, orgWarnings, err := actor.GetOrganizationByName(orgName) allWarnings = ap...
[ "func", "(", "actor", "Actor", ")", "DisableServiceForOrg", "(", "serviceName", ",", "orgName", ",", "brokerName", "string", ")", "(", "Warnings", ",", "error", ")", "{", "servicePlans", ",", "allWarnings", ",", "err", ":=", "actor", ".", "GetServicePlansForSe...
// DisableServiceForOrg disables access for the given service in a specific org.
[ "DisableServiceForOrg", "disables", "access", "for", "the", "given", "service", "in", "a", "specific", "org", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/service_access.go#L179-L199
train
cloudfoundry/cli
actor/v2action/service_access.go
DisablePlanForOrg
func (actor Actor) DisablePlanForOrg(serviceName, servicePlanName, orgName, brokerName string) (Warnings, error) { servicePlans, allWarnings, err := actor.GetServicePlansForService(serviceName, brokerName) if err != nil { return allWarnings, err } org, orgWarnings, err := actor.GetOrganizationByName(orgName) al...
go
func (actor Actor) DisablePlanForOrg(serviceName, servicePlanName, orgName, brokerName string) (Warnings, error) { servicePlans, allWarnings, err := actor.GetServicePlansForService(serviceName, brokerName) if err != nil { return allWarnings, err } org, orgWarnings, err := actor.GetOrganizationByName(orgName) al...
[ "func", "(", "actor", "Actor", ")", "DisablePlanForOrg", "(", "serviceName", ",", "servicePlanName", ",", "orgName", ",", "brokerName", "string", ")", "(", "Warnings", ",", "error", ")", "{", "servicePlans", ",", "allWarnings", ",", "err", ":=", "actor", "."...
// DisablePlanForOrg disables access to a specific plan of the given service from the given broker in a specific org.
[ "DisablePlanForOrg", "disables", "access", "to", "a", "specific", "plan", "of", "the", "given", "service", "from", "the", "given", "broker", "in", "a", "specific", "org", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/service_access.go#L202-L231
train
cloudfoundry/cli
integration/helpers/service_instance.go
ManagedServiceInstanceGUID
func ManagedServiceInstanceGUID(managedServiceInstanceName string) string { session := CF("curl", fmt.Sprintf("/v2/service_instances?q=name:%s", managedServiceInstanceName)) Eventually(session).Should(Exit(0)) rawJSON := strings.TrimSpace(string(session.Out.Contents())) var serviceInstanceGUID ServiceInstanceGUID...
go
func ManagedServiceInstanceGUID(managedServiceInstanceName string) string { session := CF("curl", fmt.Sprintf("/v2/service_instances?q=name:%s", managedServiceInstanceName)) Eventually(session).Should(Exit(0)) rawJSON := strings.TrimSpace(string(session.Out.Contents())) var serviceInstanceGUID ServiceInstanceGUID...
[ "func", "ManagedServiceInstanceGUID", "(", "managedServiceInstanceName", "string", ")", "string", "{", "session", ":=", "CF", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "managedServiceInstanceName", ")", ")", "\n", "Eventually", "(", "s...
// ManagedServiceInstanceGUID returns the GUID for a managed service instance.
[ "ManagedServiceInstanceGUID", "returns", "the", "GUID", "for", "a", "managed", "service", "instance", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/integration/helpers/service_instance.go#L21-L33
train
cloudfoundry/cli
api/uaa/wrapper/uaa_authentication.go
Make
func (t *UAAAuthentication) Make(request *http.Request, passedResponse *uaa.Response) error { if t.client == nil { return t.connection.Make(request, passedResponse) } var err error var rawRequestBody []byte if request.Body != nil { rawRequestBody, err = ioutil.ReadAll(request.Body) defer request.Body.Close...
go
func (t *UAAAuthentication) Make(request *http.Request, passedResponse *uaa.Response) error { if t.client == nil { return t.connection.Make(request, passedResponse) } var err error var rawRequestBody []byte if request.Body != nil { rawRequestBody, err = ioutil.ReadAll(request.Body) defer request.Body.Close...
[ "func", "(", "t", "*", "UAAAuthentication", ")", "Make", "(", "request", "*", "http", ".", "Request", ",", "passedResponse", "*", "uaa", ".", "Response", ")", "error", "{", "if", "t", ".", "client", "==", "nil", "{", "return", "t", ".", "connection", ...
// Make adds authentication headers to the passed in request and then calls the // wrapped connection's Make
[ "Make", "adds", "authentication", "headers", "to", "the", "passed", "in", "request", "and", "then", "calls", "the", "wrapped", "connection", "s", "Make" ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/uaa/wrapper/uaa_authentication.go#L48-L90
train
cloudfoundry/cli
api/uaa/wrapper/uaa_authentication.go
skipAuthenticationHeader
func skipAuthenticationHeader(request *http.Request, body []byte) bool { stringBody := string(body) return strings.Contains(request.URL.String(), "/oauth/token") && request.Method == http.MethodPost && (strings.Contains(stringBody, "grant_type=refresh_token") || strings.Contains(stringBody, "grant_type=passwo...
go
func skipAuthenticationHeader(request *http.Request, body []byte) bool { stringBody := string(body) return strings.Contains(request.URL.String(), "/oauth/token") && request.Method == http.MethodPost && (strings.Contains(stringBody, "grant_type=refresh_token") || strings.Contains(stringBody, "grant_type=passwo...
[ "func", "skipAuthenticationHeader", "(", "request", "*", "http", ".", "Request", ",", "body", "[", "]", "byte", ")", "bool", "{", "stringBody", ":=", "string", "(", "body", ")", "\n\n", "return", "strings", ".", "Contains", "(", "request", ".", "URL", "....
// The authentication header is not added to token refresh requests or login // requests.
[ "The", "authentication", "header", "is", "not", "added", "to", "token", "refresh", "requests", "or", "login", "requests", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/uaa/wrapper/uaa_authentication.go#L105-L113
train
cloudfoundry/cli
api/plugin/plugin_connection.go
NewConnection
func NewConnection(skipSSLValidation bool, dialTimeout time.Duration) *PluginConnection { tr := &http.Transport{ TLSClientConfig: &tls.Config{ InsecureSkipVerify: skipSSLValidation, }, Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ KeepAlive: 30 * time.Second, Timeout: dialTimeout, }...
go
func NewConnection(skipSSLValidation bool, dialTimeout time.Duration) *PluginConnection { tr := &http.Transport{ TLSClientConfig: &tls.Config{ InsecureSkipVerify: skipSSLValidation, }, Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ KeepAlive: 30 * time.Second, Timeout: dialTimeout, }...
[ "func", "NewConnection", "(", "skipSSLValidation", "bool", ",", "dialTimeout", "time", ".", "Duration", ")", "*", "PluginConnection", "{", "tr", ":=", "&", "http", ".", "Transport", "{", "TLSClientConfig", ":", "&", "tls", ".", "Config", "{", "InsecureSkipVeri...
// NewConnection returns a new PluginConnection
[ "NewConnection", "returns", "a", "new", "PluginConnection" ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/plugin/plugin_connection.go#L25-L40
train
cloudfoundry/cli
actor/v2action/service.go
GetService
func (actor Actor) GetService(serviceGUID string) (Service, Warnings, error) { service, warnings, err := actor.CloudControllerClient.GetService(serviceGUID) return Service(service), Warnings(warnings), err }
go
func (actor Actor) GetService(serviceGUID string) (Service, Warnings, error) { service, warnings, err := actor.CloudControllerClient.GetService(serviceGUID) return Service(service), Warnings(warnings), err }
[ "func", "(", "actor", "Actor", ")", "GetService", "(", "serviceGUID", "string", ")", "(", "Service", ",", "Warnings", ",", "error", ")", "{", "service", ",", "warnings", ",", "err", ":=", "actor", ".", "CloudControllerClient", ".", "GetService", "(", "serv...
// GetService fetches a service by GUID.
[ "GetService", "fetches", "a", "service", "by", "GUID", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/service.go#L19-L22
train
cloudfoundry/cli
actor/v2action/service.go
GetServicesWithPlans
func (actor Actor) GetServicesWithPlans(filters ...Filter) (ServicesWithPlans, Warnings, error) { ccv2Filters := []ccv2.Filter{} for _, f := range filters { ccv2Filters = append(ccv2Filters, ccv2.Filter(f)) } var allWarnings Warnings services, warnings, err := actor.CloudControllerClient.GetServices(ccv2Filter...
go
func (actor Actor) GetServicesWithPlans(filters ...Filter) (ServicesWithPlans, Warnings, error) { ccv2Filters := []ccv2.Filter{} for _, f := range filters { ccv2Filters = append(ccv2Filters, ccv2.Filter(f)) } var allWarnings Warnings services, warnings, err := actor.CloudControllerClient.GetServices(ccv2Filter...
[ "func", "(", "actor", "Actor", ")", "GetServicesWithPlans", "(", "filters", "...", "Filter", ")", "(", "ServicesWithPlans", ",", "Warnings", ",", "error", ")", "{", "ccv2Filters", ":=", "[", "]", "ccv2", ".", "Filter", "{", "}", "\n", "for", "_", ",", ...
// GetServicesWithPlans returns a map of Services to ServicePlans for a particular broker. // A particular service with associated plans from a broker can be fetched by additionally providing // a service label filter.
[ "GetServicesWithPlans", "returns", "a", "map", "of", "Services", "to", "ServicePlans", "for", "a", "particular", "broker", ".", "A", "particular", "service", "with", "associated", "plans", "from", "a", "broker", "can", "be", "fetched", "by", "additionally", "pro...
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/service.go#L93-L128
train
cloudfoundry/cli
actor/v2action/service.go
ServiceExistsWithName
func (actor Actor) ServiceExistsWithName(serviceName string) (bool, Warnings, error) { services, warnings, err := actor.CloudControllerClient.GetServices(ccv2.Filter{ Type: constant.LabelFilter, Operator: constant.EqualOperator, Values: []string{serviceName}, }) if err != nil { return false, Warnings(w...
go
func (actor Actor) ServiceExistsWithName(serviceName string) (bool, Warnings, error) { services, warnings, err := actor.CloudControllerClient.GetServices(ccv2.Filter{ Type: constant.LabelFilter, Operator: constant.EqualOperator, Values: []string{serviceName}, }) if err != nil { return false, Warnings(w...
[ "func", "(", "actor", "Actor", ")", "ServiceExistsWithName", "(", "serviceName", "string", ")", "(", "bool", ",", "Warnings", ",", "error", ")", "{", "services", ",", "warnings", ",", "err", ":=", "actor", ".", "CloudControllerClient", ".", "GetServices", "(...
// ServiceExistsWithName returns true if there is an Organization with the // provided name, otherwise false.
[ "ServiceExistsWithName", "returns", "true", "if", "there", "is", "an", "Organization", "with", "the", "provided", "name", "otherwise", "false", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/service.go#L132-L147
train
cloudfoundry/cli
api/cloudcontroller/ccv3/organization.go
GetIsolationSegmentOrganizations
func (client *Client) GetIsolationSegmentOrganizations(isolationSegmentGUID string) ([]Organization, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetIsolationSegmentOrganizationsRequest, URIParams: map[string]string{"isolation_segment_guid": isolationSegmentGUID}...
go
func (client *Client) GetIsolationSegmentOrganizations(isolationSegmentGUID string) ([]Organization, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetIsolationSegmentOrganizationsRequest, URIParams: map[string]string{"isolation_segment_guid": isolationSegmentGUID}...
[ "func", "(", "client", "*", "Client", ")", "GetIsolationSegmentOrganizations", "(", "isolationSegmentGUID", "string", ")", "(", "[", "]", "Organization", ",", "Warnings", ",", "error", ")", "{", "request", ",", "err", ":=", "client", ".", "newHTTPRequest", "("...
// GetIsolationSegmentOrganizations lists organizations // entitled to an isolation segment.
[ "GetIsolationSegmentOrganizations", "lists", "organizations", "entitled", "to", "an", "isolation", "segment", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv3/organization.go#L25-L48
train
cloudfoundry/cli
api/cloudcontroller/ccv3/organization.go
GetOrganizations
func (client *Client) GetOrganizations(query ...Query) ([]Organization, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetOrganizationsRequest, Query: query, }) if err != nil { return nil, nil, err } var fullOrgsList []Organization warnings, err := clie...
go
func (client *Client) GetOrganizations(query ...Query) ([]Organization, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetOrganizationsRequest, Query: query, }) if err != nil { return nil, nil, err } var fullOrgsList []Organization warnings, err := clie...
[ "func", "(", "client", "*", "Client", ")", "GetOrganizations", "(", "query", "...", "Query", ")", "(", "[", "]", "Organization", ",", "Warnings", ",", "error", ")", "{", "request", ",", "err", ":=", "client", ".", "newHTTPRequest", "(", "requestOptions", ...
// GetOrganizations lists organizations with optional filters.
[ "GetOrganizations", "lists", "organizations", "with", "optional", "filters", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv3/organization.go#L51-L74
train
cloudfoundry/cli
api/cloudcontroller/ccv3/droplet.go
GetApplicationDropletCurrent
func (client *Client) GetApplicationDropletCurrent(appGUID string) (Droplet, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetApplicationDropletCurrentRequest, URIParams: map[string]string{"app_guid": appGUID}, }) if err != nil { return Droplet{}, nil, err } ...
go
func (client *Client) GetApplicationDropletCurrent(appGUID string) (Droplet, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetApplicationDropletCurrentRequest, URIParams: map[string]string{"app_guid": appGUID}, }) if err != nil { return Droplet{}, nil, err } ...
[ "func", "(", "client", "*", "Client", ")", "GetApplicationDropletCurrent", "(", "appGUID", "string", ")", "(", "Droplet", ",", "Warnings", ",", "error", ")", "{", "request", ",", "err", ":=", "client", ".", "newHTTPRequest", "(", "requestOptions", "{", "Requ...
// GetApplicationDropletCurrent returns the current droplet for a given // application.
[ "GetApplicationDropletCurrent", "returns", "the", "current", "droplet", "for", "a", "given", "application", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv3/droplet.go#L38-L53
train
cloudfoundry/cli
api/cloudcontroller/ccv3/droplet.go
GetDroplet
func (client *Client) GetDroplet(dropletGUID string) (Droplet, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetDropletRequest, URIParams: map[string]string{"droplet_guid": dropletGUID}, }) if err != nil { return Droplet{}, nil, err } var responseDroplet Dr...
go
func (client *Client) GetDroplet(dropletGUID string) (Droplet, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetDropletRequest, URIParams: map[string]string{"droplet_guid": dropletGUID}, }) if err != nil { return Droplet{}, nil, err } var responseDroplet Dr...
[ "func", "(", "client", "*", "Client", ")", "GetDroplet", "(", "dropletGUID", "string", ")", "(", "Droplet", ",", "Warnings", ",", "error", ")", "{", "request", ",", "err", ":=", "client", ".", "newHTTPRequest", "(", "requestOptions", "{", "RequestName", ":...
// GetDroplet returns a droplet with the given GUID.
[ "GetDroplet", "returns", "a", "droplet", "with", "the", "given", "GUID", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv3/droplet.go#L56-L72
train
cloudfoundry/cli
api/cloudcontroller/ccv3/droplet.go
GetDroplets
func (client *Client) GetDroplets(query ...Query) ([]Droplet, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetDropletsRequest, Query: query, }) if err != nil { return nil, nil, err } var responseDroplets []Droplet warnings, err := client.paginate(requ...
go
func (client *Client) GetDroplets(query ...Query) ([]Droplet, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetDropletsRequest, Query: query, }) if err != nil { return nil, nil, err } var responseDroplets []Droplet warnings, err := client.paginate(requ...
[ "func", "(", "client", "*", "Client", ")", "GetDroplets", "(", "query", "...", "Query", ")", "(", "[", "]", "Droplet", ",", "Warnings", ",", "error", ")", "{", "request", ",", "err", ":=", "client", ".", "newHTTPRequest", "(", "requestOptions", "{", "R...
// GetDroplets lists droplets with optional filters.
[ "GetDroplets", "lists", "droplets", "with", "optional", "filters", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv3/droplet.go#L75-L98
train
cloudfoundry/cli
types/null_int.go
IsValidValue
func (n *NullInt) IsValidValue(val string) error { _, err := strconv.Atoi(val) return err }
go
func (n *NullInt) IsValidValue(val string) error { _, err := strconv.Atoi(val) return err }
[ "func", "(", "n", "*", "NullInt", ")", "IsValidValue", "(", "val", "string", ")", "error", "{", "_", ",", "err", ":=", "strconv", ".", "Atoi", "(", "val", ")", "\n", "return", "err", "\n", "}" ]
// IsValidValue returns an error if the input value is not an integer.
[ "IsValidValue", "returns", "an", "error", "if", "the", "input", "value", "is", "not", "an", "integer", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/types/null_int.go#L34-L37
train
cloudfoundry/cli
api/cloudcontroller/ccv3/service_instance.go
GetServiceInstances
func (client *Client) GetServiceInstances(query ...Query) ([]ServiceInstance, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetServiceInstancesRequest, Query: query, }) if err != nil { return nil, nil, err } var fullServiceInstanceList []ServiceInstance...
go
func (client *Client) GetServiceInstances(query ...Query) ([]ServiceInstance, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetServiceInstancesRequest, Query: query, }) if err != nil { return nil, nil, err } var fullServiceInstanceList []ServiceInstance...
[ "func", "(", "client", "*", "Client", ")", "GetServiceInstances", "(", "query", "...", "Query", ")", "(", "[", "]", "ServiceInstance", ",", "Warnings", ",", "error", ")", "{", "request", ",", "err", ":=", "client", ".", "newHTTPRequest", "(", "requestOptio...
// GetServiceInstances lists service instances with optional filters.
[ "GetServiceInstances", "lists", "service", "instances", "with", "optional", "filters", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv3/service_instance.go#L17-L40
train
cloudfoundry/cli
api/cloudcontroller/ccv2/route_mapping.go
UnmarshalJSON
func (routeMapping *RouteMapping) UnmarshalJSON(data []byte) error { var ccRouteMapping struct { Metadata internal.Metadata `json:"metadata"` Entity struct { AppGUID string `json:"app_guid"` RouteGUID string `json:"route_guid"` } `json:"entity"` } err := cloudcontroller.DecodeJSON(data, &ccRouteMapp...
go
func (routeMapping *RouteMapping) UnmarshalJSON(data []byte) error { var ccRouteMapping struct { Metadata internal.Metadata `json:"metadata"` Entity struct { AppGUID string `json:"app_guid"` RouteGUID string `json:"route_guid"` } `json:"entity"` } err := cloudcontroller.DecodeJSON(data, &ccRouteMapp...
[ "func", "(", "routeMapping", "*", "RouteMapping", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "ccRouteMapping", "struct", "{", "Metadata", "internal", ".", "Metadata", "`json:\"metadata\"`", "\n", "Entity", "struct", "{", "Ap...
// UnmarshalJSON helps unmarshal a Cloud Controller Route Mapping
[ "UnmarshalJSON", "helps", "unmarshal", "a", "Cloud", "Controller", "Route", "Mapping" ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/route_mapping.go#L22-L40
train
cloudfoundry/cli
api/cloudcontroller/ccv2/route_mapping.go
GetRouteMapping
func (client *Client) GetRouteMapping(guid string) (RouteMapping, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetRouteMappingRequest, URIParams: Params{"route_mapping_guid": guid}, }) if err != nil { return RouteMapping{}, nil, err } var routeMapping Rout...
go
func (client *Client) GetRouteMapping(guid string) (RouteMapping, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetRouteMappingRequest, URIParams: Params{"route_mapping_guid": guid}, }) if err != nil { return RouteMapping{}, nil, err } var routeMapping Rout...
[ "func", "(", "client", "*", "Client", ")", "GetRouteMapping", "(", "guid", "string", ")", "(", "RouteMapping", ",", "Warnings", ",", "error", ")", "{", "request", ",", "err", ":=", "client", ".", "newHTTPRequest", "(", "requestOptions", "{", "RequestName", ...
// GetRouteMapping returns a route mapping with the provided guid.
[ "GetRouteMapping", "returns", "a", "route", "mapping", "with", "the", "provided", "guid", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/route_mapping.go#L43-L59
train
cloudfoundry/cli
api/cloudcontroller/ccv2/route_mapping.go
GetRouteMappings
func (client *Client) GetRouteMappings(filters ...Filter) ([]RouteMapping, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetRouteMappingsRequest, Query: ConvertFilterParameters(filters), }) if err != nil { return nil, nil, err } var fullRouteMappingsLis...
go
func (client *Client) GetRouteMappings(filters ...Filter) ([]RouteMapping, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetRouteMappingsRequest, Query: ConvertFilterParameters(filters), }) if err != nil { return nil, nil, err } var fullRouteMappingsLis...
[ "func", "(", "client", "*", "Client", ")", "GetRouteMappings", "(", "filters", "...", "Filter", ")", "(", "[", "]", "RouteMapping", ",", "Warnings", ",", "error", ")", "{", "request", ",", "err", ":=", "client", ".", "newHTTPRequest", "(", "requestOptions"...
// GetRouteMappings returns a list of RouteMappings based off of the provided queries.
[ "GetRouteMappings", "returns", "a", "list", "of", "RouteMappings", "based", "off", "of", "the", "provided", "queries", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/route_mapping.go#L62-L85
train
cloudfoundry/cli
api/uaa/refresh_token.go
AuthorizationToken
func (refreshTokenResponse RefreshedTokens) AuthorizationToken() string { return fmt.Sprintf("%s %s", refreshTokenResponse.Type, refreshTokenResponse.AccessToken) }
go
func (refreshTokenResponse RefreshedTokens) AuthorizationToken() string { return fmt.Sprintf("%s %s", refreshTokenResponse.Type, refreshTokenResponse.AccessToken) }
[ "func", "(", "refreshTokenResponse", "RefreshedTokens", ")", "AuthorizationToken", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "refreshTokenResponse", ".", "Type", ",", "refreshTokenResponse", ".", "AccessToken", ")", "\n", "}...
// AuthorizationToken returns formatted authorization header.
[ "AuthorizationToken", "returns", "formatted", "authorization", "header", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/uaa/refresh_token.go#L21-L23
train
cloudfoundry/cli
api/uaa/refresh_token.go
RefreshAccessToken
func (client *Client) RefreshAccessToken(refreshToken string) (RefreshedTokens, error) { var values url.Values switch client.config.UAAGrantType() { case string(constant.GrantTypeClientCredentials): values = client.clientCredentialRefreshBody() case "", string(constant.GrantTypePassword): // CLI used to write em...
go
func (client *Client) RefreshAccessToken(refreshToken string) (RefreshedTokens, error) { var values url.Values switch client.config.UAAGrantType() { case string(constant.GrantTypeClientCredentials): values = client.clientCredentialRefreshBody() case "", string(constant.GrantTypePassword): // CLI used to write em...
[ "func", "(", "client", "*", "Client", ")", "RefreshAccessToken", "(", "refreshToken", "string", ")", "(", "RefreshedTokens", ",", "error", ")", "{", "var", "values", "url", ".", "Values", "\n\n", "switch", "client", ".", "config", ".", "UAAGrantType", "(", ...
// RefreshAccessToken refreshes the current access token.
[ "RefreshAccessToken", "refreshes", "the", "current", "access", "token", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/uaa/refresh_token.go#L26-L62
train
cloudfoundry/cli
util/ui/table.go
DisplayKeyValueTable
func (ui *UI) DisplayKeyValueTable(prefix string, table [][]string, padding int) { rows := len(table) if rows == 0 { return } var displayTable [][]string for _, row := range table { if len(row) > 0 { displayTable = append(displayTable, row) } } columns := len(displayTable[0]) if columns < 2 || !ui.Is...
go
func (ui *UI) DisplayKeyValueTable(prefix string, table [][]string, padding int) { rows := len(table) if rows == 0 { return } var displayTable [][]string for _, row := range table { if len(row) > 0 { displayTable = append(displayTable, row) } } columns := len(displayTable[0]) if columns < 2 || !ui.Is...
[ "func", "(", "ui", "*", "UI", ")", "DisplayKeyValueTable", "(", "prefix", "string", ",", "table", "[", "]", "[", "]", "string", ",", "padding", "int", ")", "{", "rows", ":=", "len", "(", "table", ")", "\n", "if", "rows", "==", "0", "{", "return", ...
// DisplayKeyValueTable outputs a matrix of strings as a table to UI.Out. // Prefix will be prepended to each row and padding adds the specified number // of spaces between columns. The final columns may wrap to multiple lines but // will still be confined to the last column. Wrapping will occur on word // boundaries.
[ "DisplayKeyValueTable", "outputs", "a", "matrix", "of", "strings", "as", "a", "table", "to", "UI", ".", "Out", ".", "Prefix", "will", "be", "prepended", "to", "each", "row", "and", "padding", "adds", "the", "specified", "number", "of", "spaces", "between", ...
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/util/ui/table.go#L20-L40
train
cloudfoundry/cli
util/ui/table.go
DisplayNonWrappingTable
func (ui *UI) DisplayNonWrappingTable(prefix string, table [][]string, padding int) { ui.terminalLock.Lock() defer ui.terminalLock.Unlock() if len(table) == 0 { return } var columnPadding []int rows := len(table) columns := len(table[0]) for col := 0; col < columns; col++ { var max int for row := 0; ro...
go
func (ui *UI) DisplayNonWrappingTable(prefix string, table [][]string, padding int) { ui.terminalLock.Lock() defer ui.terminalLock.Unlock() if len(table) == 0 { return } var columnPadding []int rows := len(table) columns := len(table[0]) for col := 0; col < columns; col++ { var max int for row := 0; ro...
[ "func", "(", "ui", "*", "UI", ")", "DisplayNonWrappingTable", "(", "prefix", "string", ",", "table", "[", "]", "[", "]", "string", ",", "padding", "int", ")", "{", "ui", ".", "terminalLock", ".", "Lock", "(", ")", "\n", "defer", "ui", ".", "terminalL...
// DisplayNonWrappingTable outputs a matrix of strings as a table to UI.Out. // Prefix will be prepended to each row and padding adds the specified number // of spaces between columns.
[ "DisplayNonWrappingTable", "outputs", "a", "matrix", "of", "strings", "as", "a", "table", "to", "UI", ".", "Out", ".", "Prefix", "will", "be", "prepended", "to", "each", "row", "and", "padding", "adds", "the", "specified", "number", "of", "spaces", "between"...
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/util/ui/table.go#L45-L79
train
cloudfoundry/cli
util/ui/table.go
DisplayTableWithHeader
func (ui *UI) DisplayTableWithHeader(prefix string, table [][]string, padding int) { if len(table) == 0 { return } for i, str := range table[0] { table[0][i] = ui.modifyColor(str, color.New(color.Bold)) } ui.DisplayNonWrappingTable(prefix, table, padding) }
go
func (ui *UI) DisplayTableWithHeader(prefix string, table [][]string, padding int) { if len(table) == 0 { return } for i, str := range table[0] { table[0][i] = ui.modifyColor(str, color.New(color.Bold)) } ui.DisplayNonWrappingTable(prefix, table, padding) }
[ "func", "(", "ui", "*", "UI", ")", "DisplayTableWithHeader", "(", "prefix", "string", ",", "table", "[", "]", "[", "]", "string", ",", "padding", "int", ")", "{", "if", "len", "(", "table", ")", "==", "0", "{", "return", "\n", "}", "\n", "for", "...
// DisplayTableWithHeader outputs a simple non-wrapping table with bolded // headers.
[ "DisplayTableWithHeader", "outputs", "a", "simple", "non", "-", "wrapping", "table", "with", "bolded", "headers", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/util/ui/table.go#L83-L92
train
cloudfoundry/cli
api/cloudcontroller/ccv2/application_instance.go
GetApplicationApplicationInstances
func (client *Client) GetApplicationApplicationInstances(guid string) (map[int]ApplicationInstance, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetAppInstancesRequest, URIParams: Params{"app_guid": guid}, }) if err != nil { return nil, nil, err } var inst...
go
func (client *Client) GetApplicationApplicationInstances(guid string) (map[int]ApplicationInstance, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetAppInstancesRequest, URIParams: Params{"app_guid": guid}, }) if err != nil { return nil, nil, err } var inst...
[ "func", "(", "client", "*", "Client", ")", "GetApplicationApplicationInstances", "(", "guid", "string", ")", "(", "map", "[", "int", "]", "ApplicationInstance", ",", "Warnings", ",", "error", ")", "{", "request", ",", "err", ":=", "client", ".", "newHTTPRequ...
// GetApplicationApplicationInstances returns a list of ApplicationInstance for // a given application. Depending on the state of an application, it might skip // some application instances.
[ "GetApplicationApplicationInstances", "returns", "a", "list", "of", "ApplicationInstance", "for", "a", "given", "application", ".", "Depending", "on", "the", "state", "of", "an", "application", "it", "might", "skip", "some", "application", "instances", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/application_instance.go#L50-L80
train
cloudfoundry/cli
api/cloudcontroller/ccv2/service_plan_visibility.go
UnmarshalJSON
func (servicePlanVisibility *ServicePlanVisibility) UnmarshalJSON(data []byte) error { var ccServicePlanVisibility struct { Metadata internal.Metadata Entity struct { ServicePlanGUID string `json:"service_plan_guid"` OrganizationGUID string `json:"organization_guid"` } `json:"entity"` } err := cloudco...
go
func (servicePlanVisibility *ServicePlanVisibility) UnmarshalJSON(data []byte) error { var ccServicePlanVisibility struct { Metadata internal.Metadata Entity struct { ServicePlanGUID string `json:"service_plan_guid"` OrganizationGUID string `json:"organization_guid"` } `json:"entity"` } err := cloudco...
[ "func", "(", "servicePlanVisibility", "*", "ServicePlanVisibility", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "ccServicePlanVisibility", "struct", "{", "Metadata", "internal", ".", "Metadata", "\n", "Entity", "struct", "{", "...
// UnmarshalJSON helps unmarshal a Cloud Controller Service Plan Visibilities // response.
[ "UnmarshalJSON", "helps", "unmarshal", "a", "Cloud", "Controller", "Service", "Plan", "Visibilities", "response", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/service_plan_visibility.go#L24-L41
train
cloudfoundry/cli
api/cloudcontroller/ccv2/service_plan_visibility.go
GetServicePlanVisibilities
func (client *Client) GetServicePlanVisibilities(filters ...Filter) ([]ServicePlanVisibility, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetServicePlanVisibilitiesRequest, Query: ConvertFilterParameters(filters), }) if err != nil { return nil, nil, err...
go
func (client *Client) GetServicePlanVisibilities(filters ...Filter) ([]ServicePlanVisibility, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetServicePlanVisibilitiesRequest, Query: ConvertFilterParameters(filters), }) if err != nil { return nil, nil, err...
[ "func", "(", "client", "*", "Client", ")", "GetServicePlanVisibilities", "(", "filters", "...", "Filter", ")", "(", "[", "]", "ServicePlanVisibility", ",", "Warnings", ",", "error", ")", "{", "request", ",", "err", ":=", "client", ".", "newHTTPRequest", "(",...
// GetServicePlanVisibilities returns back a list of Service Plan Visibilities // given the provided filters.
[ "GetServicePlanVisibilities", "returns", "back", "a", "list", "of", "Service", "Plan", "Visibilities", "given", "the", "provided", "filters", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/service_plan_visibility.go#L93-L117
train
cloudfoundry/cli
api/uaa/wrapper/request_logger.go
Make
func (logger *RequestLogger) Make(request *http.Request, passedResponse *uaa.Response) error { err := logger.displayRequest(request) if err != nil { logger.output.HandleInternalError(err) } err = logger.connection.Make(request, passedResponse) if passedResponse.HTTPResponse != nil { displayErr := logger.disp...
go
func (logger *RequestLogger) Make(request *http.Request, passedResponse *uaa.Response) error { err := logger.displayRequest(request) if err != nil { logger.output.HandleInternalError(err) } err = logger.connection.Make(request, passedResponse) if passedResponse.HTTPResponse != nil { displayErr := logger.disp...
[ "func", "(", "logger", "*", "RequestLogger", ")", "Make", "(", "request", "*", "http", ".", "Request", ",", "passedResponse", "*", "uaa", ".", "Response", ")", "error", "{", "err", ":=", "logger", ".", "displayRequest", "(", "request", ")", "\n", "if", ...
// Make records the request and the response to UI
[ "Make", "records", "the", "request", "and", "the", "response", "to", "UI" ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/uaa/wrapper/request_logger.go#L44-L60
train
cloudfoundry/cli
api/cloudcontroller/ccv2/space_quota.go
UnmarshalJSON
func (spaceQuota *SpaceQuota) UnmarshalJSON(data []byte) error { var ccSpaceQuota struct { Metadata internal.Metadata `json:"metadata"` Entity struct { Name string `json:"name"` } `json:"entity"` } err := cloudcontroller.DecodeJSON(data, &ccSpaceQuota) if err != nil { return err } spaceQuota.GUID = ...
go
func (spaceQuota *SpaceQuota) UnmarshalJSON(data []byte) error { var ccSpaceQuota struct { Metadata internal.Metadata `json:"metadata"` Entity struct { Name string `json:"name"` } `json:"entity"` } err := cloudcontroller.DecodeJSON(data, &ccSpaceQuota) if err != nil { return err } spaceQuota.GUID = ...
[ "func", "(", "spaceQuota", "*", "SpaceQuota", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "ccSpaceQuota", "struct", "{", "Metadata", "internal", ".", "Metadata", "`json:\"metadata\"`", "\n", "Entity", "struct", "{", "Name", ...
// UnmarshalJSON helps unmarshal a Cloud Controller Space Quota response.
[ "UnmarshalJSON", "helps", "unmarshal", "a", "Cloud", "Controller", "Space", "Quota", "response", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/space_quota.go#L21-L36
train
cloudfoundry/cli
api/cloudcontroller/ccv2/space_quota.go
GetSpaceQuotaDefinition
func (client *Client) GetSpaceQuotaDefinition(guid string) (SpaceQuota, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetSpaceQuotaDefinitionRequest, URIParams: Params{"space_quota_guid": guid}, }) if err != nil { return SpaceQuota{}, nil, err } var spaceQu...
go
func (client *Client) GetSpaceQuotaDefinition(guid string) (SpaceQuota, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetSpaceQuotaDefinitionRequest, URIParams: Params{"space_quota_guid": guid}, }) if err != nil { return SpaceQuota{}, nil, err } var spaceQu...
[ "func", "(", "client", "*", "Client", ")", "GetSpaceQuotaDefinition", "(", "guid", "string", ")", "(", "SpaceQuota", ",", "Warnings", ",", "error", ")", "{", "request", ",", "err", ":=", "client", ".", "newHTTPRequest", "(", "requestOptions", "{", "RequestNa...
// GetSpaceQuotaDefinition returns a Space Quota.
[ "GetSpaceQuotaDefinition", "returns", "a", "Space", "Quota", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/space_quota.go#L39-L55
train
cloudfoundry/cli
api/cloudcontroller/ccv2/space_quota.go
GetSpaceQuotas
func (client *Client) GetSpaceQuotas(orgGUID string) ([]SpaceQuota, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetOrganizationSpaceQuotasRequest, URIParams: Params{"organization_guid": orgGUID}, }) if err != nil { return nil, nil, err } var spaceQuotas ...
go
func (client *Client) GetSpaceQuotas(orgGUID string) ([]SpaceQuota, Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.GetOrganizationSpaceQuotasRequest, URIParams: Params{"organization_guid": orgGUID}, }) if err != nil { return nil, nil, err } var spaceQuotas ...
[ "func", "(", "client", "*", "Client", ")", "GetSpaceQuotas", "(", "orgGUID", "string", ")", "(", "[", "]", "SpaceQuota", ",", "Warnings", ",", "error", ")", "{", "request", ",", "err", ":=", "client", ".", "newHTTPRequest", "(", "requestOptions", "{", "R...
// GetSpaceQuotas returns all the space quotas for the org
[ "GetSpaceQuotas", "returns", "all", "the", "space", "quotas", "for", "the", "org" ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/space_quota.go#L58-L82
train
cloudfoundry/cli
api/cloudcontroller/ccv2/space_quota.go
SetSpaceQuota
func (client *Client) SetSpaceQuota(spaceGUID string, quotaGUID string) (Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.PutSpaceQuotaRequest, URIParams: Params{"space_quota_guid": quotaGUID, "space_guid": spaceGUID}, }) if err != nil { return nil, err } res...
go
func (client *Client) SetSpaceQuota(spaceGUID string, quotaGUID string) (Warnings, error) { request, err := client.newHTTPRequest(requestOptions{ RequestName: internal.PutSpaceQuotaRequest, URIParams: Params{"space_quota_guid": quotaGUID, "space_guid": spaceGUID}, }) if err != nil { return nil, err } res...
[ "func", "(", "client", "*", "Client", ")", "SetSpaceQuota", "(", "spaceGUID", "string", ",", "quotaGUID", "string", ")", "(", "Warnings", ",", "error", ")", "{", "request", ",", "err", ":=", "client", ".", "newHTTPRequest", "(", "requestOptions", "{", "Req...
// SetSpaceQuota should set the quota for the space and returns the warnings
[ "SetSpaceQuota", "should", "set", "the", "quota", "for", "the", "space", "and", "returns", "the", "warnings" ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/api/cloudcontroller/ccv2/space_quota.go#L85-L99
train
cloudfoundry/cli
actor/v2action/organization.go
GetOrganization
func (actor Actor) GetOrganization(guid string) (Organization, Warnings, error) { org, warnings, err := actor.CloudControllerClient.GetOrganization(guid) if _, ok := err.(ccerror.ResourceNotFoundError); ok { return Organization{}, Warnings(warnings), actionerror.OrganizationNotFoundError{GUID: guid} } return Or...
go
func (actor Actor) GetOrganization(guid string) (Organization, Warnings, error) { org, warnings, err := actor.CloudControllerClient.GetOrganization(guid) if _, ok := err.(ccerror.ResourceNotFoundError); ok { return Organization{}, Warnings(warnings), actionerror.OrganizationNotFoundError{GUID: guid} } return Or...
[ "func", "(", "actor", "Actor", ")", "GetOrganization", "(", "guid", "string", ")", "(", "Organization", ",", "Warnings", ",", "error", ")", "{", "org", ",", "warnings", ",", "err", ":=", "actor", ".", "CloudControllerClient", ".", "GetOrganization", "(", "...
// GetOrganization returns an Organization based on the provided guid.
[ "GetOrganization", "returns", "an", "Organization", "based", "on", "the", "provided", "guid", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/organization.go#L15-L23
train
cloudfoundry/cli
actor/v2action/organization.go
GetOrganizationByName
func (actor Actor) GetOrganizationByName(orgName string) (Organization, Warnings, error) { orgs, warnings, err := actor.CloudControllerClient.GetOrganizations(ccv2.Filter{ Type: constant.NameFilter, Operator: constant.EqualOperator, Values: []string{orgName}, }) if err != nil { return Organization{}, W...
go
func (actor Actor) GetOrganizationByName(orgName string) (Organization, Warnings, error) { orgs, warnings, err := actor.CloudControllerClient.GetOrganizations(ccv2.Filter{ Type: constant.NameFilter, Operator: constant.EqualOperator, Values: []string{orgName}, }) if err != nil { return Organization{}, W...
[ "func", "(", "actor", "Actor", ")", "GetOrganizationByName", "(", "orgName", "string", ")", "(", "Organization", ",", "Warnings", ",", "error", ")", "{", "orgs", ",", "warnings", ",", "err", ":=", "actor", ".", "CloudControllerClient", ".", "GetOrganizations",...
// GetOrganizationByName returns an Organization based off of the name given.
[ "GetOrganizationByName", "returns", "an", "Organization", "based", "off", "of", "the", "name", "given", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/organization.go#L26-L49
train
cloudfoundry/cli
actor/v2action/organization.go
GrantOrgManagerByUsername
func (actor Actor) GrantOrgManagerByUsername(guid string, username string) (Warnings, error) { var warnings ccv2.Warnings var err error if actor.Config.UAAGrantType() != string(uaaconst.GrantTypeClientCredentials) { warnings, err = actor.CloudControllerClient.UpdateOrganizationManagerByUsername(guid, username) }...
go
func (actor Actor) GrantOrgManagerByUsername(guid string, username string) (Warnings, error) { var warnings ccv2.Warnings var err error if actor.Config.UAAGrantType() != string(uaaconst.GrantTypeClientCredentials) { warnings, err = actor.CloudControllerClient.UpdateOrganizationManagerByUsername(guid, username) }...
[ "func", "(", "actor", "Actor", ")", "GrantOrgManagerByUsername", "(", "guid", "string", ",", "username", "string", ")", "(", "Warnings", ",", "error", ")", "{", "var", "warnings", "ccv2", ".", "Warnings", "\n", "var", "err", "error", "\n\n", "if", "actor",...
// GrantOrgManagerByUsername gives the Org Manager role to the provided user.
[ "GrantOrgManagerByUsername", "gives", "the", "Org", "Manager", "role", "to", "the", "provided", "user", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/organization.go#L52-L63
train
cloudfoundry/cli
actor/v2action/organization.go
CreateOrganization
func (actor Actor) CreateOrganization(orgName string, quotaName string) (Organization, Warnings, error) { var quotaGUID string var allWarnings Warnings if quotaName != "" { quota, warnings, err := actor.GetOrganizationQuotaByName(quotaName) allWarnings = append(allWarnings, warnings...) if err != nil { re...
go
func (actor Actor) CreateOrganization(orgName string, quotaName string) (Organization, Warnings, error) { var quotaGUID string var allWarnings Warnings if quotaName != "" { quota, warnings, err := actor.GetOrganizationQuotaByName(quotaName) allWarnings = append(allWarnings, warnings...) if err != nil { re...
[ "func", "(", "actor", "Actor", ")", "CreateOrganization", "(", "orgName", "string", ",", "quotaName", "string", ")", "(", "Organization", ",", "Warnings", ",", "error", ")", "{", "var", "quotaGUID", "string", "\n", "var", "allWarnings", "Warnings", "\n\n", "...
// CreateOrganization creates an Organization based on the provided orgName.
[ "CreateOrganization", "creates", "an", "Organization", "based", "on", "the", "provided", "orgName", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/organization.go#L66-L91
train
cloudfoundry/cli
actor/v2action/organization.go
DeleteOrganization
func (actor Actor) DeleteOrganization(orgName string) (Warnings, error) { var allWarnings Warnings org, warnings, err := actor.GetOrganizationByName(orgName) allWarnings = append(allWarnings, warnings...) if err != nil { return allWarnings, err } job, deleteWarnings, err := actor.CloudControllerClient.DeleteO...
go
func (actor Actor) DeleteOrganization(orgName string) (Warnings, error) { var allWarnings Warnings org, warnings, err := actor.GetOrganizationByName(orgName) allWarnings = append(allWarnings, warnings...) if err != nil { return allWarnings, err } job, deleteWarnings, err := actor.CloudControllerClient.DeleteO...
[ "func", "(", "actor", "Actor", ")", "DeleteOrganization", "(", "orgName", "string", ")", "(", "Warnings", ",", "error", ")", "{", "var", "allWarnings", "Warnings", "\n\n", "org", ",", "warnings", ",", "err", ":=", "actor", ".", "GetOrganizationByName", "(", ...
// DeleteOrganization deletes the Organization associated with the provided // GUID. Once the deletion request is sent, it polls the deletion job until // it's finished.
[ "DeleteOrganization", "deletes", "the", "Organization", "associated", "with", "the", "provided", "GUID", ".", "Once", "the", "deletion", "request", "is", "sent", "it", "polls", "the", "deletion", "job", "until", "it", "s", "finished", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/organization.go#L96-L117
train
cloudfoundry/cli
actor/v2action/organization.go
GetOrganizations
func (actor Actor) GetOrganizations() ([]Organization, Warnings, error) { var returnedOrgs []Organization orgs, warnings, err := actor.CloudControllerClient.GetOrganizations() for _, org := range orgs { returnedOrgs = append(returnedOrgs, Organization(org)) } return returnedOrgs, Warnings(warnings), err }
go
func (actor Actor) GetOrganizations() ([]Organization, Warnings, error) { var returnedOrgs []Organization orgs, warnings, err := actor.CloudControllerClient.GetOrganizations() for _, org := range orgs { returnedOrgs = append(returnedOrgs, Organization(org)) } return returnedOrgs, Warnings(warnings), err }
[ "func", "(", "actor", "Actor", ")", "GetOrganizations", "(", ")", "(", "[", "]", "Organization", ",", "Warnings", ",", "error", ")", "{", "var", "returnedOrgs", "[", "]", "Organization", "\n", "orgs", ",", "warnings", ",", "err", ":=", "actor", ".", "C...
// GetOrganizations returns all the available organizations.
[ "GetOrganizations", "returns", "all", "the", "available", "organizations", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/organization.go#L120-L127
train
cloudfoundry/cli
actor/v2action/organization.go
OrganizationExistsWithName
func (actor Actor) OrganizationExistsWithName(orgName string) (bool, Warnings, error) { orgs, warnings, err := actor.CloudControllerClient.GetOrganizations(ccv2.Filter{ Type: constant.NameFilter, Operator: constant.EqualOperator, Values: []string{orgName}, }) if err != nil { return false, Warnings(warn...
go
func (actor Actor) OrganizationExistsWithName(orgName string) (bool, Warnings, error) { orgs, warnings, err := actor.CloudControllerClient.GetOrganizations(ccv2.Filter{ Type: constant.NameFilter, Operator: constant.EqualOperator, Values: []string{orgName}, }) if err != nil { return false, Warnings(warn...
[ "func", "(", "actor", "Actor", ")", "OrganizationExistsWithName", "(", "orgName", "string", ")", "(", "bool", ",", "Warnings", ",", "error", ")", "{", "orgs", ",", "warnings", ",", "err", ":=", "actor", ".", "CloudControllerClient", ".", "GetOrganizations", ...
// OrganizationExistsWithName returns true if there is an Organization with the // provided name, otherwise false.
[ "OrganizationExistsWithName", "returns", "true", "if", "there", "is", "an", "Organization", "with", "the", "provided", "name", "otherwise", "false", "." ]
5010c000047f246b870475e2c299556078cdad30
https://github.com/cloudfoundry/cli/blob/5010c000047f246b870475e2c299556078cdad30/actor/v2action/organization.go#L131-L146
train
google/seesaw
ncc/client/ncc_client.go
call
func (nc *nccClient) call(name string, in interface{}, out interface{}) error { nc.lock.RLock() client := nc.client nc.lock.RUnlock() if client == nil { return fmt.Errorf("Not connected") } ch := make(chan error, 1) go func() { ch <- client.Call(name, in, out) }() select { case err := <-ch: return err ...
go
func (nc *nccClient) call(name string, in interface{}, out interface{}) error { nc.lock.RLock() client := nc.client nc.lock.RUnlock() if client == nil { return fmt.Errorf("Not connected") } ch := make(chan error, 1) go func() { ch <- client.Call(name, in, out) }() select { case err := <-ch: return err ...
[ "func", "(", "nc", "*", "nccClient", ")", "call", "(", "name", "string", ",", "in", "interface", "{", "}", ",", "out", "interface", "{", "}", ")", "error", "{", "nc", ".", "lock", ".", "RLock", "(", ")", "\n", "client", ":=", "nc", ".", "client",...
// call performs an RPC call to the Seesaw v2 nccClient.
[ "call", "performs", "an", "RPC", "call", "to", "the", "Seesaw", "v2", "nccClient", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/client/ncc_client.go#L159-L176
train
google/seesaw
healthcheck/core.go
String
func (s State) String() string { if name, ok := stateNames[s]; ok { return name } return "<unknown>" }
go
func (s State) String() string { if name, ok := stateNames[s]; ok { return name } return "<unknown>" }
[ "func", "(", "s", "State", ")", "String", "(", ")", "string", "{", "if", "name", ",", "ok", ":=", "stateNames", "[", "s", "]", ";", "ok", "{", "return", "name", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
// String returns the string representation for the given healthcheck state.
[ "String", "returns", "the", "string", "representation", "for", "the", "given", "healthcheck", "state", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L67-L72
train
google/seesaw
healthcheck/core.go
String
func (t Target) String() string { var via string if t.Mode == seesaw.HCModeDSR { via = fmt.Sprintf(" (via %s mark %d)", t.Host, t.Mark) } return fmt.Sprintf("%s %s%s", t.addr(), t.Mode, via) }
go
func (t Target) String() string { var via string if t.Mode == seesaw.HCModeDSR { via = fmt.Sprintf(" (via %s mark %d)", t.Host, t.Mark) } return fmt.Sprintf("%s %s%s", t.addr(), t.Mode, via) }
[ "func", "(", "t", "Target", ")", "String", "(", ")", "string", "{", "var", "via", "string", "\n", "if", "t", ".", "Mode", "==", "seesaw", ".", "HCModeDSR", "{", "via", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "t", ".", "Host", ",", "t"...
// String returns the string representation of a healthcheck target.
[ "String", "returns", "the", "string", "representation", "of", "a", "healthcheck", "target", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L91-L97
train
google/seesaw
healthcheck/core.go
addr
func (t *Target) addr() string { if t.IP.To4() != nil { return fmt.Sprintf("%v:%d", t.IP, t.Port) } return fmt.Sprintf("[%v]:%d", t.IP, t.Port) }
go
func (t *Target) addr() string { if t.IP.To4() != nil { return fmt.Sprintf("%v:%d", t.IP, t.Port) } return fmt.Sprintf("[%v]:%d", t.IP, t.Port) }
[ "func", "(", "t", "*", "Target", ")", "addr", "(", ")", "string", "{", "if", "t", ".", "IP", ".", "To4", "(", ")", "!=", "nil", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "t", ".", "IP", ",", "t", ".", "Port", ")", "\n", ...
// addr returns the address string for the healthcheck target.
[ "addr", "returns", "the", "address", "string", "for", "the", "healthcheck", "target", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L100-L105
train
google/seesaw
healthcheck/core.go
network
func (t *Target) network() string { version := 4 if t.IP.To4() == nil { version = 6 } var network string switch t.Proto { case seesaw.IPProtoICMP: network = "ip4:icmp" case seesaw.IPProtoICMPv6: network = "ip6:ipv6-icmp" case seesaw.IPProtoTCP: network = fmt.Sprintf("tcp%d", version) case seesaw.IPPro...
go
func (t *Target) network() string { version := 4 if t.IP.To4() == nil { version = 6 } var network string switch t.Proto { case seesaw.IPProtoICMP: network = "ip4:icmp" case seesaw.IPProtoICMPv6: network = "ip6:ipv6-icmp" case seesaw.IPProtoTCP: network = fmt.Sprintf("tcp%d", version) case seesaw.IPPro...
[ "func", "(", "t", "*", "Target", ")", "network", "(", ")", "string", "{", "version", ":=", "4", "\n", "if", "t", ".", "IP", ".", "To4", "(", ")", "==", "nil", "{", "version", "=", "6", "\n", "}", "\n\n", "var", "network", "string", "\n", "switc...
// network returns the network name for the healthcheck target.
[ "network", "returns", "the", "network", "name", "for", "the", "healthcheck", "target", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L108-L129
train
google/seesaw
healthcheck/core.go
String
func (r *Result) String() string { if r.Err != nil { return r.Err.Error() } return r.Message }
go
func (r *Result) String() string { if r.Err != nil { return r.Err.Error() } return r.Message }
[ "func", "(", "r", "*", "Result", ")", "String", "(", ")", "string", "{", "if", "r", ".", "Err", "!=", "nil", "{", "return", "r", ".", "Err", ".", "Error", "(", ")", "\n", "}", "\n", "return", "r", ".", "Message", "\n", "}" ]
// String returns the string representation of a healthcheck result.
[ "String", "returns", "the", "string", "representation", "of", "a", "healthcheck", "result", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L140-L145
train
google/seesaw
healthcheck/core.go
complete
func complete(start time.Time, msg string, success bool, err error) *Result { // TODO(jsing): Make this clock skew safe. duration := time.Since(start) return &Result{msg, success, duration, err} }
go
func complete(start time.Time, msg string, success bool, err error) *Result { // TODO(jsing): Make this clock skew safe. duration := time.Since(start) return &Result{msg, success, duration, err} }
[ "func", "complete", "(", "start", "time", ".", "Time", ",", "msg", "string", ",", "success", "bool", ",", "err", "error", ")", "*", "Result", "{", "// TODO(jsing): Make this clock skew safe.", "duration", ":=", "time", ".", "Since", "(", "start", ")", "\n", ...
// complete returns a Result for a completed healthcheck.
[ "complete", "returns", "a", "Result", "for", "a", "completed", "healthcheck", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L148-L152
train
google/seesaw
healthcheck/core.go
String
func (n *Notification) String() string { return fmt.Sprintf("ID 0x%x %v", n.Id, n.State) }
go
func (n *Notification) String() string { return fmt.Sprintf("ID 0x%x %v", n.Id, n.State) }
[ "func", "(", "n", "*", "Notification", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "n", ".", "Id", ",", "n", ".", "State", ")", "\n", "}" ]
// String returns the string representation for the given notification.
[ "String", "returns", "the", "string", "representation", "for", "the", "given", "notification", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L161-L163
train
google/seesaw
healthcheck/core.go
NewConfig
func NewConfig(id Id, checker Checker) *Config { return &Config{ Id: id, Interval: 5 * time.Second, Timeout: 30 * time.Second, Retries: 0, Checker: checker, } }
go
func NewConfig(id Id, checker Checker) *Config { return &Config{ Id: id, Interval: 5 * time.Second, Timeout: 30 * time.Second, Retries: 0, Checker: checker, } }
[ "func", "NewConfig", "(", "id", "Id", ",", "checker", "Checker", ")", "*", "Config", "{", "return", "&", "Config", "{", "Id", ":", "id", ",", "Interval", ":", "5", "*", "time", ".", "Second", ",", "Timeout", ":", "30", "*", "time", ".", "Second", ...
// NewConfig returns an initialised Config.
[ "NewConfig", "returns", "an", "initialised", "Config", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L186-L194
train
google/seesaw
healthcheck/core.go
NewCheck
func NewCheck(notify chan<- *Notification) *Check { return &Check{ state: StateUnknown, notify: notify, update: make(chan Config, 1), quit: make(chan bool, 1), } }
go
func NewCheck(notify chan<- *Notification) *Check { return &Check{ state: StateUnknown, notify: notify, update: make(chan Config, 1), quit: make(chan bool, 1), } }
[ "func", "NewCheck", "(", "notify", "chan", "<-", "*", "Notification", ")", "*", "Check", "{", "return", "&", "Check", "{", "state", ":", "StateUnknown", ",", "notify", ":", "notify", ",", "update", ":", "make", "(", "chan", "Config", ",", "1", ")", "...
// NewCheck returns an initialised Check.
[ "NewCheck", "returns", "an", "initialised", "Check", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L225-L232
train
google/seesaw
healthcheck/core.go
Status
func (hc *Check) Status() Status { hc.lock.RLock() defer hc.lock.RUnlock() status := Status{ LastCheck: hc.start, Failures: hc.failures, Successes: hc.successes, State: hc.state, } if hc.result != nil { status.Duration = hc.result.Duration status.Message = hc.result.String() } return status }
go
func (hc *Check) Status() Status { hc.lock.RLock() defer hc.lock.RUnlock() status := Status{ LastCheck: hc.start, Failures: hc.failures, Successes: hc.successes, State: hc.state, } if hc.result != nil { status.Duration = hc.result.Duration status.Message = hc.result.String() } return status }
[ "func", "(", "hc", "*", "Check", ")", "Status", "(", ")", "Status", "{", "hc", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "hc", ".", "lock", ".", "RUnlock", "(", ")", "\n", "status", ":=", "Status", "{", "LastCheck", ":", "hc", ".", "s...
// Status returns the current status for this healthcheck instance.
[ "Status", "returns", "the", "current", "status", "for", "this", "healthcheck", "instance", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L235-L249
train
google/seesaw
healthcheck/core.go
Run
func (hc *Check) Run(start <-chan time.Time) { // Wait for initial configuration. select { case config := <-hc.update: hc.Config = config case <-hc.quit: return } // Wait for a tick to avoid a thundering herd at startup and to // stagger healthchecks that have the same interval. if start != nil { <-star...
go
func (hc *Check) Run(start <-chan time.Time) { // Wait for initial configuration. select { case config := <-hc.update: hc.Config = config case <-hc.quit: return } // Wait for a tick to avoid a thundering herd at startup and to // stagger healthchecks that have the same interval. if start != nil { <-star...
[ "func", "(", "hc", "*", "Check", ")", "Run", "(", "start", "<-", "chan", "time", ".", "Time", ")", "{", "// Wait for initial configuration.", "select", "{", "case", "config", ":=", "<-", "hc", ".", "update", ":", "hc", ".", "Config", "=", "config", "\n...
// Run invokes a healthcheck. It waits for the initial configuration to be // provided via the configuration channel, after which the configured // healthchecker is invoked at the given interval. If a new configuration // is provided the healthchecker is updated and checks are scheduled at the // new interval. Notifica...
[ "Run", "invokes", "a", "healthcheck", ".", "It", "waits", "for", "the", "initial", "configuration", "to", "be", "provided", "via", "the", "configuration", "channel", "after", "which", "the", "configured", "healthchecker", "is", "invoked", "at", "the", "given", ...
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L258-L298
train
google/seesaw
healthcheck/core.go
healthcheck
func (hc *Check) healthcheck() { if hc.Checker == nil { return } start := time.Now() result := hc.execute() status := "SUCCESS" if !result.Success { status = "FAILURE" } log.Infof("%d: (%s) %s: %v", hc.Id, hc, status, result) hc.lock.Lock() hc.start = start hc.result = result var state State if res...
go
func (hc *Check) healthcheck() { if hc.Checker == nil { return } start := time.Now() result := hc.execute() status := "SUCCESS" if !result.Success { status = "FAILURE" } log.Infof("%d: (%s) %s: %v", hc.Id, hc, status, result) hc.lock.Lock() hc.start = start hc.result = result var state State if res...
[ "func", "(", "hc", "*", "Check", ")", "healthcheck", "(", ")", "{", "if", "hc", ".", "Checker", "==", "nil", "{", "return", "\n", "}", "\n", "start", ":=", "time", ".", "Now", "(", ")", "\n", "result", ":=", "hc", ".", "execute", "(", ")", "\n\...
// healthcheck executes the given checker.
[ "healthcheck", "executes", "the", "given", "checker", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L301-L342
train
google/seesaw
healthcheck/core.go
Notify
func (hc *Check) Notify() { hc.notify <- &Notification{ Id: hc.Id, Status: hc.Status(), } }
go
func (hc *Check) Notify() { hc.notify <- &Notification{ Id: hc.Id, Status: hc.Status(), } }
[ "func", "(", "hc", "*", "Check", ")", "Notify", "(", ")", "{", "hc", ".", "notify", "<-", "&", "Notification", "{", "Id", ":", "hc", ".", "Id", ",", "Status", ":", "hc", ".", "Status", "(", ")", ",", "}", "\n", "}" ]
// Notify generates a healthcheck notification for this checker.
[ "Notify", "generates", "a", "healthcheck", "notification", "for", "this", "checker", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L345-L350
train
google/seesaw
healthcheck/core.go
execute
func (hc *Check) execute() *Result { ch := make(chan *Result, 1) checker := hc.Checker go func() { // TODO(jsing): Determine a way to ensure that this go routine // does not linger. ch <- checker.Check(hc.Timeout) }() select { case result := <-ch: return result case <-time.After(hc.Timeout): return &Re...
go
func (hc *Check) execute() *Result { ch := make(chan *Result, 1) checker := hc.Checker go func() { // TODO(jsing): Determine a way to ensure that this go routine // does not linger. ch <- checker.Check(hc.Timeout) }() select { case result := <-ch: return result case <-time.After(hc.Timeout): return &Re...
[ "func", "(", "hc", "*", "Check", ")", "execute", "(", ")", "*", "Result", "{", "ch", ":=", "make", "(", "chan", "*", "Result", ",", "1", ")", "\n", "checker", ":=", "hc", ".", "Checker", "\n", "go", "func", "(", ")", "{", "// TODO(jsing): Determine...
// execute invokes the given healthcheck checker with the configured timeout.
[ "execute", "invokes", "the", "given", "healthcheck", "checker", "with", "the", "configured", "timeout", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L353-L367
train
google/seesaw
healthcheck/core.go
Blocking
func (hc *Check) Blocking(block bool) { len := 0 if !block { len = 1 } hc.blocking = block hc.update = make(chan Config, len) }
go
func (hc *Check) Blocking(block bool) { len := 0 if !block { len = 1 } hc.blocking = block hc.update = make(chan Config, len) }
[ "func", "(", "hc", "*", "Check", ")", "Blocking", "(", "block", "bool", ")", "{", "len", ":=", "0", "\n", "if", "!", "block", "{", "len", "=", "1", "\n", "}", "\n", "hc", ".", "blocking", "=", "block", "\n", "hc", ".", "update", "=", "make", ...
// Blocking enables or disables blocking updates for a healthcheck.
[ "Blocking", "enables", "or", "disables", "blocking", "updates", "for", "a", "healthcheck", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L378-L385
train
google/seesaw
healthcheck/core.go
Update
func (hc *Check) Update(config *Config) { if hc.blocking { hc.update <- *config return } select { case hc.update <- *config: default: log.Warningf("Unable to update %d (%s), last update still queued", hc.Id, hc) } }
go
func (hc *Check) Update(config *Config) { if hc.blocking { hc.update <- *config return } select { case hc.update <- *config: default: log.Warningf("Unable to update %d (%s), last update still queued", hc.Id, hc) } }
[ "func", "(", "hc", "*", "Check", ")", "Update", "(", "config", "*", "Config", ")", "{", "if", "hc", ".", "blocking", "{", "hc", ".", "update", "<-", "*", "config", "\n", "return", "\n", "}", "\n", "select", "{", "case", "hc", ".", "update", "<-",...
// Update queues a healthcheck configuration update for processing.
[ "Update", "queues", "a", "healthcheck", "configuration", "update", "for", "processing", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L388-L398
train
google/seesaw
healthcheck/core.go
NewServer
func NewServer(cfg *ServerConfig) *Server { if cfg == nil { defaultCfg := DefaultServerConfig() cfg = &defaultCfg } return &Server{ config: cfg, healthchecks: make(map[Id]*Check), notify: make(chan *Notification, cfg.ChannelSize), configs: make(chan map[Id]*Config), batch: make([]*No...
go
func NewServer(cfg *ServerConfig) *Server { if cfg == nil { defaultCfg := DefaultServerConfig() cfg = &defaultCfg } return &Server{ config: cfg, healthchecks: make(map[Id]*Check), notify: make(chan *Notification, cfg.ChannelSize), configs: make(chan map[Id]*Config), batch: make([]*No...
[ "func", "NewServer", "(", "cfg", "*", "ServerConfig", ")", "*", "Server", "{", "if", "cfg", "==", "nil", "{", "defaultCfg", ":=", "DefaultServerConfig", "(", ")", "\n", "cfg", "=", "&", "defaultCfg", "\n", "}", "\n", "return", "&", "Server", "{", "conf...
// NewServer returns an initialised healthcheck server.
[ "NewServer", "returns", "an", "initialised", "healthcheck", "server", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L439-L454
train
google/seesaw
healthcheck/core.go
Run
func (s *Server) Run() { go s.updater() go s.notifier() go s.manager() <-s.quit }
go
func (s *Server) Run() { go s.updater() go s.notifier() go s.manager() <-s.quit }
[ "func", "(", "s", "*", "Server", ")", "Run", "(", ")", "{", "go", "s", ".", "updater", "(", ")", "\n", "go", "s", ".", "notifier", "(", ")", "\n", "go", "s", ".", "manager", "(", ")", "\n\n", "<-", "s", ".", "quit", "\n", "}" ]
// Run runs a healthcheck server.
[ "Run", "runs", "a", "healthcheck", "server", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L465-L471
train
google/seesaw
healthcheck/core.go
getHealthchecks
func (s *Server) getHealthchecks() (*Checks, error) { engineConn, err := net.DialTimeout("unix", s.config.EngineSocket, engineTimeout) if err != nil { return nil, fmt.Errorf("Dial failed: %v", err) } engineConn.SetDeadline(time.Now().Add(engineTimeout)) engine := rpc.NewClient(engineConn) defer engine.Close() ...
go
func (s *Server) getHealthchecks() (*Checks, error) { engineConn, err := net.DialTimeout("unix", s.config.EngineSocket, engineTimeout) if err != nil { return nil, fmt.Errorf("Dial failed: %v", err) } engineConn.SetDeadline(time.Now().Add(engineTimeout)) engine := rpc.NewClient(engineConn) defer engine.Close() ...
[ "func", "(", "s", "*", "Server", ")", "getHealthchecks", "(", ")", "(", "*", "Checks", ",", "error", ")", "{", "engineConn", ",", "err", ":=", "net", ".", "DialTimeout", "(", "\"", "\"", ",", "s", ".", "config", ".", "EngineSocket", ",", "engineTimeo...
// getHealthchecks attempts to get the current healthcheck configurations from // the Seesaw Engine.
[ "getHealthchecks", "attempts", "to", "get", "the", "current", "healthcheck", "configurations", "from", "the", "Seesaw", "Engine", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L475-L491
train
google/seesaw
healthcheck/core.go
updater
func (s *Server) updater() { for { log.Info("Getting healthchecks from engine...") checks, err := s.getHealthchecks() if err != nil { log.Error(err) time.Sleep(5 * time.Second) } else { log.Infof("Engine returned %d healthchecks", len(checks.Configs)) s.configs <- checks.Configs time.Sleep(15 * ...
go
func (s *Server) updater() { for { log.Info("Getting healthchecks from engine...") checks, err := s.getHealthchecks() if err != nil { log.Error(err) time.Sleep(5 * time.Second) } else { log.Infof("Engine returned %d healthchecks", len(checks.Configs)) s.configs <- checks.Configs time.Sleep(15 * ...
[ "func", "(", "s", "*", "Server", ")", "updater", "(", ")", "{", "for", "{", "log", ".", "Info", "(", "\"", "\"", ")", "\n", "checks", ",", "err", ":=", "s", ".", "getHealthchecks", "(", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "E...
// updater attempts to fetch healthcheck configurations at regular intervals. // When configurations are successfully retrieved they are provided to the // manager via the configs channel.
[ "updater", "attempts", "to", "fetch", "healthcheck", "configurations", "at", "regular", "intervals", ".", "When", "configurations", "are", "successfully", "retrieved", "they", "are", "provided", "to", "the", "manager", "via", "the", "configs", "channel", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L496-L509
train
google/seesaw
healthcheck/core.go
manager
func (s *Server) manager() { checkTicker := time.NewTicker(50 * time.Millisecond) notifyTicker := time.NewTicker(s.config.NotifyInterval) for { select { case configs := <-s.configs: // Remove healthchecks that have been deleted. for id, hc := range s.healthchecks { if configs[id] == nil { hc.Stop...
go
func (s *Server) manager() { checkTicker := time.NewTicker(50 * time.Millisecond) notifyTicker := time.NewTicker(s.config.NotifyInterval) for { select { case configs := <-s.configs: // Remove healthchecks that have been deleted. for id, hc := range s.healthchecks { if configs[id] == nil { hc.Stop...
[ "func", "(", "s", "*", "Server", ")", "manager", "(", ")", "{", "checkTicker", ":=", "time", ".", "NewTicker", "(", "50", "*", "time", ".", "Millisecond", ")", "\n", "notifyTicker", ":=", "time", ".", "NewTicker", "(", "s", ".", "config", ".", "Notif...
// manager is responsible for controlling the healthchecks that are currently // running. When healthcheck configurations become available, the manager will // stop and remove deleted healthchecks, spawn new healthchecks and provide // the current configurations to each of the running healthchecks.
[ "manager", "is", "responsible", "for", "controlling", "the", "healthchecks", "that", "are", "currently", "running", ".", "When", "healthcheck", "configurations", "become", "available", "the", "manager", "will", "stop", "and", "remove", "deleted", "healthchecks", "sp...
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L515-L550
train
google/seesaw
healthcheck/core.go
notifier
func (s *Server) notifier() { var timer <-chan time.Time for { var err error select { case notification := <-s.notify: s.batch = append(s.batch, notification) // Collect until BatchDelay passes, or BatchSize are queued. switch len(s.batch) { case 1: timer = time.After(s.config.BatchDelay) cas...
go
func (s *Server) notifier() { var timer <-chan time.Time for { var err error select { case notification := <-s.notify: s.batch = append(s.batch, notification) // Collect until BatchDelay passes, or BatchSize are queued. switch len(s.batch) { case 1: timer = time.After(s.config.BatchDelay) cas...
[ "func", "(", "s", "*", "Server", ")", "notifier", "(", ")", "{", "var", "timer", "<-", "chan", "time", ".", "Time", "\n", "for", "{", "var", "err", "error", "\n", "select", "{", "case", "notification", ":=", "<-", "s", ".", "notify", ":", "s", "....
// notifier batches healthcheck notifications and sends them to the Seesaw // Engine.
[ "notifier", "batches", "healthcheck", "notifications", "and", "sends", "them", "to", "the", "Seesaw", "Engine", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L554-L578
train
google/seesaw
healthcheck/core.go
send
func (s *Server) send() error { failures := 0 for { err := s.sendBatch(s.batch) if err == nil { break } failures++ log.Errorf("Send failed %d times: %v", failures, err) if failures >= s.config.MaxFailures { return fmt.Errorf("send: %d errors, giving up", failures) } time.Sleep(s.config.RetryDe...
go
func (s *Server) send() error { failures := 0 for { err := s.sendBatch(s.batch) if err == nil { break } failures++ log.Errorf("Send failed %d times: %v", failures, err) if failures >= s.config.MaxFailures { return fmt.Errorf("send: %d errors, giving up", failures) } time.Sleep(s.config.RetryDe...
[ "func", "(", "s", "*", "Server", ")", "send", "(", ")", "error", "{", "failures", ":=", "0", "\n", "for", "{", "err", ":=", "s", ".", "sendBatch", "(", "s", ".", "batch", ")", "\n", "if", "err", "==", "nil", "{", "break", "\n", "}", "\n\n", "...
// send sends a batch of notifications to the Seesaw Engine, retrying on any // error and giving up after MaxFailures.
[ "send", "sends", "a", "batch", "of", "notifications", "to", "the", "Seesaw", "Engine", "retrying", "on", "any", "error", "and", "giving", "up", "after", "MaxFailures", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L582-L601
train
google/seesaw
healthcheck/core.go
sendBatch
func (s *Server) sendBatch(batch []*Notification) error { engineConn, err := net.DialTimeout("unix", s.config.EngineSocket, engineTimeout) if err != nil { return err } engineConn.SetDeadline(time.Now().Add(engineTimeout)) engine := rpc.NewClient(engineConn) defer engine.Close() var reply int ctx := ipc.NewTr...
go
func (s *Server) sendBatch(batch []*Notification) error { engineConn, err := net.DialTimeout("unix", s.config.EngineSocket, engineTimeout) if err != nil { return err } engineConn.SetDeadline(time.Now().Add(engineTimeout)) engine := rpc.NewClient(engineConn) defer engine.Close() var reply int ctx := ipc.NewTr...
[ "func", "(", "s", "*", "Server", ")", "sendBatch", "(", "batch", "[", "]", "*", "Notification", ")", "error", "{", "engineConn", ",", "err", ":=", "net", ".", "DialTimeout", "(", "\"", "\"", ",", "s", ".", "config", ".", "EngineSocket", ",", "engineT...
// sendBatch sends a batch of notifications to the Seesaw Engine.
[ "sendBatch", "sends", "a", "batch", "of", "notifications", "to", "the", "Seesaw", "Engine", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/core.go#L604-L616
train
google/seesaw
ecu/stats.go
newECUStats
func newECUStats(ecu *ECU) *ecuStats { return &ecuStats{ ecu: ecu, stats: &stats{ lastUpdate: time.Unix(0, 0), lastSuccess: time.Unix(0, 0), }, } }
go
func newECUStats(ecu *ECU) *ecuStats { return &ecuStats{ ecu: ecu, stats: &stats{ lastUpdate: time.Unix(0, 0), lastSuccess: time.Unix(0, 0), }, } }
[ "func", "newECUStats", "(", "ecu", "*", "ECU", ")", "*", "ecuStats", "{", "return", "&", "ecuStats", "{", "ecu", ":", "ecu", ",", "stats", ":", "&", "stats", "{", "lastUpdate", ":", "time", ".", "Unix", "(", "0", ",", "0", ")", ",", "lastSuccess", ...
// newECUStats returns an initialised ecuStats struct.
[ "newECUStats", "returns", "an", "initialised", "ecuStats", "struct", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ecu/stats.go#L63-L71
train
google/seesaw
ecu/stats.go
notify
func (e *ecuStats) notify(p publisher) { e.publishers = append(e.publishers, p) }
go
func (e *ecuStats) notify(p publisher) { e.publishers = append(e.publishers, p) }
[ "func", "(", "e", "*", "ecuStats", ")", "notify", "(", "p", "publisher", ")", "{", "e", ".", "publishers", "=", "append", "(", "e", ".", "publishers", ",", "p", ")", "\n", "}" ]
// notify registers a publisher for update notifications.
[ "notify", "registers", "a", "publisher", "for", "update", "notifications", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ecu/stats.go#L74-L76
train
google/seesaw
ecu/stats.go
run
func (e *ecuStats) run() { ticker := time.NewTicker(e.ecu.cfg.UpdateInterval) for { e.stats.lock.Lock() e.stats.lastUpdate = time.Now() e.stats.lock.Unlock() log.Info("Updating ECU statistics from Seesaw Engine...") if err := e.update(); err != nil { log.Warning(err) } else { e.stats.lock.Lock() ...
go
func (e *ecuStats) run() { ticker := time.NewTicker(e.ecu.cfg.UpdateInterval) for { e.stats.lock.Lock() e.stats.lastUpdate = time.Now() e.stats.lock.Unlock() log.Info("Updating ECU statistics from Seesaw Engine...") if err := e.update(); err != nil { log.Warning(err) } else { e.stats.lock.Lock() ...
[ "func", "(", "e", "*", "ecuStats", ")", "run", "(", ")", "{", "ticker", ":=", "time", ".", "NewTicker", "(", "e", ".", "ecu", ".", "cfg", ".", "UpdateInterval", ")", "\n", "for", "{", "e", ".", "stats", ".", "lock", ".", "Lock", "(", ")", "\n",...
// run attempts to update the cached statistics from the Seesaw Engine at // regular intervals.
[ "run", "attempts", "to", "update", "the", "cached", "statistics", "from", "the", "Seesaw", "Engine", "at", "regular", "intervals", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ecu/stats.go#L80-L100
train
google/seesaw
ecu/stats.go
update
func (e *ecuStats) update() error { // TODO(jsing): Make this untrusted. ctx := ipc.NewTrustedContext(seesaw.SCECU) seesawConn, err := conn.NewSeesawIPC(ctx) if err != nil { return fmt.Errorf("Failed to connect to engine: %v", err) } if err := seesawConn.Dial(e.ecu.cfg.EngineSocket); err != nil { return fmt.E...
go
func (e *ecuStats) update() error { // TODO(jsing): Make this untrusted. ctx := ipc.NewTrustedContext(seesaw.SCECU) seesawConn, err := conn.NewSeesawIPC(ctx) if err != nil { return fmt.Errorf("Failed to connect to engine: %v", err) } if err := seesawConn.Dial(e.ecu.cfg.EngineSocket); err != nil { return fmt.E...
[ "func", "(", "e", "*", "ecuStats", ")", "update", "(", ")", "error", "{", "// TODO(jsing): Make this untrusted.", "ctx", ":=", "ipc", ".", "NewTrustedContext", "(", "seesaw", ".", "SCECU", ")", "\n", "seesawConn", ",", "err", ":=", "conn", ".", "NewSeesawIPC...
// update attempts to update the cached statistics from the Seesaw Engine.
[ "update", "attempts", "to", "update", "the", "cached", "statistics", "from", "the", "Seesaw", "Engine", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ecu/stats.go#L103-L164
train
google/seesaw
engine/healthcheck.go
newHealthcheckManager
func newHealthcheckManager(e *Engine) *healthcheckManager { return &healthcheckManager{ engine: e, marks: make(map[seesaw.IP]uint32), markAlloc: newMarkAllocator(dsrMarkBase, dsrMarkSize), ncc: ncclient.NewNCC(e.config.NCCSocket), next: healthcheck.Id((uint64(os.Getpid()...
go
func newHealthcheckManager(e *Engine) *healthcheckManager { return &healthcheckManager{ engine: e, marks: make(map[seesaw.IP]uint32), markAlloc: newMarkAllocator(dsrMarkBase, dsrMarkSize), ncc: ncclient.NewNCC(e.config.NCCSocket), next: healthcheck.Id((uint64(os.Getpid()...
[ "func", "newHealthcheckManager", "(", "e", "*", "Engine", ")", "*", "healthcheckManager", "{", "return", "&", "healthcheckManager", "{", "engine", ":", "e", ",", "marks", ":", "make", "(", "map", "[", "seesaw", ".", "IP", "]", "uint32", ")", ",", "markAl...
// newHealthcheckManager creates a new healthcheckManager.
[ "newHealthcheckManager", "creates", "a", "new", "healthcheckManager", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L68-L80
train
google/seesaw
engine/healthcheck.go
configs
func (h *healthcheckManager) configs() map[healthcheck.Id]*healthcheck.Config { h.lock.RLock() defer h.lock.RUnlock() if !h.enabled { return nil } return h.cfgs }
go
func (h *healthcheckManager) configs() map[healthcheck.Id]*healthcheck.Config { h.lock.RLock() defer h.lock.RUnlock() if !h.enabled { return nil } return h.cfgs }
[ "func", "(", "h", "*", "healthcheckManager", ")", "configs", "(", ")", "map", "[", "healthcheck", ".", "Id", "]", "*", "healthcheck", ".", "Config", "{", "h", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "h", ".", "lock", ".", "RUnlock", "("...
// configs returns the healthcheck Configs for a Seesaw Engine. The returned // map should only be read, not mutated. If the healthcheckManager is disabled, // then nil is returned.
[ "configs", "returns", "the", "healthcheck", "Configs", "for", "a", "Seesaw", "Engine", ".", "The", "returned", "map", "should", "only", "be", "read", "not", "mutated", ".", "If", "the", "healthcheckManager", "is", "disabled", "then", "nil", "is", "returned", ...
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L85-L92
train
google/seesaw
engine/healthcheck.go
update
func (h *healthcheckManager) update(vserverName string, checks map[checkKey]*check) { if checks == nil { delete(h.vserverChecks, vserverName) } else { h.vserverChecks[vserverName] = checks } h.buildMaps() }
go
func (h *healthcheckManager) update(vserverName string, checks map[checkKey]*check) { if checks == nil { delete(h.vserverChecks, vserverName) } else { h.vserverChecks[vserverName] = checks } h.buildMaps() }
[ "func", "(", "h", "*", "healthcheckManager", ")", "update", "(", "vserverName", "string", ",", "checks", "map", "[", "checkKey", "]", "*", "check", ")", "{", "if", "checks", "==", "nil", "{", "delete", "(", "h", ".", "vserverChecks", ",", "vserverName", ...
// update updates the healthchecks for a vserver.
[ "update", "updates", "the", "healthchecks", "for", "a", "vserver", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L95-L102
train
google/seesaw
engine/healthcheck.go
enable
func (h *healthcheckManager) enable() { h.lock.Lock() defer h.lock.Unlock() h.enabled = true }
go
func (h *healthcheckManager) enable() { h.lock.Lock() defer h.lock.Unlock() h.enabled = true }
[ "func", "(", "h", "*", "healthcheckManager", ")", "enable", "(", ")", "{", "h", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "h", ".", "lock", ".", "Unlock", "(", ")", "\n", "h", ".", "enabled", "=", "true", "\n", "}" ]
// enable enables the healthcheck manager for the Seesaw Engine.
[ "enable", "enables", "the", "healthcheck", "manager", "for", "the", "Seesaw", "Engine", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L105-L109
train
google/seesaw
engine/healthcheck.go
disable
func (h *healthcheckManager) disable() { h.lock.Lock() defer h.lock.Unlock() h.enabled = false }
go
func (h *healthcheckManager) disable() { h.lock.Lock() defer h.lock.Unlock() h.enabled = false }
[ "func", "(", "h", "*", "healthcheckManager", ")", "disable", "(", ")", "{", "h", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "h", ".", "lock", ".", "Unlock", "(", ")", "\n", "h", ".", "enabled", "=", "false", "\n", "}" ]
// disable disables the healthcheck manager for the Seesaw Engine.
[ "disable", "disables", "the", "healthcheck", "manager", "for", "the", "Seesaw", "Engine", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L112-L116
train
google/seesaw
engine/healthcheck.go
buildMaps
func (h *healthcheckManager) buildMaps() { allChecks := make(map[checkKey]*check) for _, vchecks := range h.vserverChecks { for k, c := range vchecks { if allChecks[k] == nil { allChecks[k] = c } else { log.Warningf("Duplicate key: %v", k) } } } h.lock.RLock() ids := h.ids cfgs := h.cfgs ch...
go
func (h *healthcheckManager) buildMaps() { allChecks := make(map[checkKey]*check) for _, vchecks := range h.vserverChecks { for k, c := range vchecks { if allChecks[k] == nil { allChecks[k] = c } else { log.Warningf("Duplicate key: %v", k) } } } h.lock.RLock() ids := h.ids cfgs := h.cfgs ch...
[ "func", "(", "h", "*", "healthcheckManager", ")", "buildMaps", "(", ")", "{", "allChecks", ":=", "make", "(", "map", "[", "checkKey", "]", "*", "check", ")", "\n", "for", "_", ",", "vchecks", ":=", "range", "h", ".", "vserverChecks", "{", "for", "k",...
// buildMaps builds the cfgs, checks, and ids maps based on the vserverChecks.
[ "buildMaps", "builds", "the", "cfgs", "checks", "and", "ids", "maps", "based", "on", "the", "vserverChecks", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L125-L177
train
google/seesaw
engine/healthcheck.go
healthState
func (h *healthcheckManager) healthState(n *healthcheck.Notification) error { log.V(1).Infof("Received healthcheck notification: %v", n) h.lock.RLock() enabled := h.enabled h.lock.RUnlock() if !enabled { log.Warningf("Healthcheck manager is disabled; ignoring healthcheck notification %v", n) return nil } ...
go
func (h *healthcheckManager) healthState(n *healthcheck.Notification) error { log.V(1).Infof("Received healthcheck notification: %v", n) h.lock.RLock() enabled := h.enabled h.lock.RUnlock() if !enabled { log.Warningf("Healthcheck manager is disabled; ignoring healthcheck notification %v", n) return nil } ...
[ "func", "(", "h", "*", "healthcheckManager", ")", "healthState", "(", "n", "*", "healthcheck", ".", "Notification", ")", "error", "{", "log", ".", "V", "(", "1", ")", ".", "Infof", "(", "\"", "\"", ",", "n", ")", "\n\n", "h", ".", "lock", ".", "R...
// healthState handles Notifications from the healthcheck component.
[ "healthState", "handles", "Notifications", "from", "the", "healthcheck", "component", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L180-L195
train
google/seesaw
engine/healthcheck.go
queueHealthState
func (h *healthcheckManager) queueHealthState(n *healthcheck.Notification) error { h.lock.RLock() cfg := h.cfgs[n.Id] check := h.checks[n.Id] h.lock.RUnlock() if cfg == nil || check == nil { log.Warningf("Unknown healthcheck ID %v", n.Id) return nil } note := &checkNotification{ key: check.key, ...
go
func (h *healthcheckManager) queueHealthState(n *healthcheck.Notification) error { h.lock.RLock() cfg := h.cfgs[n.Id] check := h.checks[n.Id] h.lock.RUnlock() if cfg == nil || check == nil { log.Warningf("Unknown healthcheck ID %v", n.Id) return nil } note := &checkNotification{ key: check.key, ...
[ "func", "(", "h", "*", "healthcheckManager", ")", "queueHealthState", "(", "n", "*", "healthcheck", ".", "Notification", ")", "error", "{", "h", ".", "lock", ".", "RLock", "(", ")", "\n", "cfg", ":=", "h", ".", "cfgs", "[", "n", ".", "Id", "]", "\n...
// queueHealthState queues a health state Notification for processing by a // vserver.
[ "queueHealthState", "queues", "a", "health", "state", "Notification", "for", "processing", "by", "a", "vserver", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L199-L218
train
google/seesaw
engine/healthcheck.go
run
func (h *healthcheckManager) run() { for { select { case <-h.quit: h.unmarkAllBackends() h.stopped <- true case vc := <-h.vcc: h.update(vc.vserverName, vc.checks) } } }
go
func (h *healthcheckManager) run() { for { select { case <-h.quit: h.unmarkAllBackends() h.stopped <- true case vc := <-h.vcc: h.update(vc.vserverName, vc.checks) } } }
[ "func", "(", "h", "*", "healthcheckManager", ")", "run", "(", ")", "{", "for", "{", "select", "{", "case", "<-", "h", ".", "quit", ":", "h", ".", "unmarkAllBackends", "(", ")", "\n", "h", ".", "stopped", "<-", "true", "\n", "case", "vc", ":=", "<...
// run runs the healthcheck manager and processes incoming vserver checks.
[ "run", "runs", "the", "healthcheck", "manager", "and", "processes", "incoming", "vserver", "checks", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L345-L355
train
google/seesaw
engine/healthcheck.go
expire
func (h *healthcheckManager) expire() { h.lock.RLock() ids := h.ids h.lock.RUnlock() status := healthcheck.Status{State: healthcheck.StateUnknown} for _, id := range ids { h.queueHealthState(&healthcheck.Notification{id, status}) } }
go
func (h *healthcheckManager) expire() { h.lock.RLock() ids := h.ids h.lock.RUnlock() status := healthcheck.Status{State: healthcheck.StateUnknown} for _, id := range ids { h.queueHealthState(&healthcheck.Notification{id, status}) } }
[ "func", "(", "h", "*", "healthcheckManager", ")", "expire", "(", ")", "{", "h", ".", "lock", ".", "RLock", "(", ")", "\n", "ids", ":=", "h", ".", "ids", "\n", "h", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "status", ":=", "healthcheck", ".",...
// expire invalidates the state of all configured healthchecks.
[ "expire", "invalidates", "the", "state", "of", "all", "configured", "healthchecks", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L358-L367
train
google/seesaw
engine/healthcheck.go
markBackend
func (h *healthcheckManager) markBackend(backend seesaw.IP) uint32 { mark, ok := h.marks[backend] if ok { return mark } mark, err := h.markAlloc.get() if err != nil { log.Fatalf("Failed to get mark: %v", err) } h.marks[backend] = mark ip := net.IPv6zero if backend.AF() == seesaw.IPv4 { ip = net.IPv4zer...
go
func (h *healthcheckManager) markBackend(backend seesaw.IP) uint32 { mark, ok := h.marks[backend] if ok { return mark } mark, err := h.markAlloc.get() if err != nil { log.Fatalf("Failed to get mark: %v", err) } h.marks[backend] = mark ip := net.IPv6zero if backend.AF() == seesaw.IPv4 { ip = net.IPv4zer...
[ "func", "(", "h", "*", "healthcheckManager", ")", "markBackend", "(", "backend", "seesaw", ".", "IP", ")", "uint32", "{", "mark", ",", "ok", ":=", "h", ".", "marks", "[", "backend", "]", "\n", "if", "ok", "{", "return", "mark", "\n", "}", "\n\n", "...
// markBackend returns a mark for the specified backend and sets up the IPVS // service entry if it does not exist.
[ "markBackend", "returns", "a", "mark", "for", "the", "specified", "backend", "and", "sets", "up", "the", "IPVS", "service", "entry", "if", "it", "does", "not", "exist", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L371-L415
train
google/seesaw
engine/healthcheck.go
pruneMarks
func (h *healthcheckManager) pruneMarks() { h.lock.RLock() checks := h.checks h.lock.RUnlock() backends := make(map[seesaw.IP]bool) for _, check := range checks { if check.key.healthcheckMode != seesaw.HCModeDSR { continue } backends[check.key.backendIP] = true } for ip := range h.marks { if _, ok :...
go
func (h *healthcheckManager) pruneMarks() { h.lock.RLock() checks := h.checks h.lock.RUnlock() backends := make(map[seesaw.IP]bool) for _, check := range checks { if check.key.healthcheckMode != seesaw.HCModeDSR { continue } backends[check.key.backendIP] = true } for ip := range h.marks { if _, ok :...
[ "func", "(", "h", "*", "healthcheckManager", ")", "pruneMarks", "(", ")", "{", "h", ".", "lock", ".", "RLock", "(", ")", "\n", "checks", ":=", "h", ".", "checks", "\n", "h", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "backends", ":=", "make", ...
// pruneMarks unmarks backends that no longer have DSR healthchecks configured.
[ "pruneMarks", "unmarks", "backends", "that", "no", "longer", "have", "DSR", "healthchecks", "configured", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/healthcheck.go#L461-L479
train
google/seesaw
engine/config/notifier.go
NewNotifier
func NewNotifier(ec *EngineConfig) (*Notifier, error) { outgoing := make(chan Notification, 1) n := &Notifier{ C: outgoing, outgoing: outgoing, reload: make(chan bool, 1), shutdown: make(chan bool, 1), engineCfg: ec, source: SourcePeer, } note, err := n.bootstrap() if err != nil { re...
go
func NewNotifier(ec *EngineConfig) (*Notifier, error) { outgoing := make(chan Notification, 1) n := &Notifier{ C: outgoing, outgoing: outgoing, reload: make(chan bool, 1), shutdown: make(chan bool, 1), engineCfg: ec, source: SourcePeer, } note, err := n.bootstrap() if err != nil { re...
[ "func", "NewNotifier", "(", "ec", "*", "EngineConfig", ")", "(", "*", "Notifier", ",", "error", ")", "{", "outgoing", ":=", "make", "(", "chan", "Notification", ",", "1", ")", "\n", "n", ":=", "&", "Notifier", "{", "C", ":", "outgoing", ",", "outgoin...
// NewNotifier creates a new Notifier.
[ "NewNotifier", "creates", "a", "new", "Notifier", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/config/notifier.go#L57-L88
train
google/seesaw
engine/config/notifier.go
Source
func (n *Notifier) Source() Source { n.lock.RLock() defer n.lock.RUnlock() return n.source }
go
func (n *Notifier) Source() Source { n.lock.RLock() defer n.lock.RUnlock() return n.source }
[ "func", "(", "n", "*", "Notifier", ")", "Source", "(", ")", "Source", "{", "n", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "n", ".", "lock", ".", "RUnlock", "(", ")", "\n", "return", "n", ".", "source", "\n", "}" ]
// Source returns the current configuration source.
[ "Source", "returns", "the", "current", "configuration", "source", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/config/notifier.go#L91-L95
train
google/seesaw
engine/config/notifier.go
SetSource
func (n *Notifier) SetSource(source Source) { n.lock.Lock() n.source = source n.lock.Unlock() if err := n.Reload(); err != nil { log.Warningf("Reload failed after setting source: %v", err) } }
go
func (n *Notifier) SetSource(source Source) { n.lock.Lock() n.source = source n.lock.Unlock() if err := n.Reload(); err != nil { log.Warningf("Reload failed after setting source: %v", err) } }
[ "func", "(", "n", "*", "Notifier", ")", "SetSource", "(", "source", "Source", ")", "{", "n", ".", "lock", ".", "Lock", "(", ")", "\n", "n", ".", "source", "=", "source", "\n", "n", ".", "lock", ".", "Unlock", "(", ")", "\n", "if", "err", ":=", ...
// SetSource sets the configuration Source for a Notifier.
[ "SetSource", "sets", "the", "configuration", "Source", "for", "a", "Notifier", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/config/notifier.go#L98-L105
train
google/seesaw
engine/config/notifier.go
Reload
func (n *Notifier) Reload() error { select { case n.reload <- true: default: return errors.New("reload request already queued") } return nil }
go
func (n *Notifier) Reload() error { select { case n.reload <- true: default: return errors.New("reload request already queued") } return nil }
[ "func", "(", "n", "*", "Notifier", ")", "Reload", "(", ")", "error", "{", "select", "{", "case", "n", ".", "reload", "<-", "true", ":", "default", ":", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", ...
// Reload requests an immediate reload from the configuration source.
[ "Reload", "requests", "an", "immediate", "reload", "from", "the", "configuration", "source", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/config/notifier.go#L108-L115
train
google/seesaw
engine/config/notifier.go
configCheck
func (n *Notifier) configCheck() { log.Infof("Checking for config changes...") s := n.Source() last := n.last note, err := n.pullConfig(s) if err != nil && s == SourcePeer { log.Errorf("Failed to pull configuration from peer: %v", err) n.peerFailures++ if n.peerFailures < n.engineCfg.MaxPeerConfigSyncErrors...
go
func (n *Notifier) configCheck() { log.Infof("Checking for config changes...") s := n.Source() last := n.last note, err := n.pullConfig(s) if err != nil && s == SourcePeer { log.Errorf("Failed to pull configuration from peer: %v", err) n.peerFailures++ if n.peerFailures < n.engineCfg.MaxPeerConfigSyncErrors...
[ "func", "(", "n", "*", "Notifier", ")", "configCheck", "(", ")", "{", "log", ".", "Infof", "(", "\"", "\"", ")", "\n\n", "s", ":=", "n", ".", "Source", "(", ")", "\n", "last", ":=", "n", ".", "last", "\n", "note", ",", "err", ":=", "n", ".", ...
// configCheck checks for configuration changes.
[ "configCheck", "checks", "for", "configuration", "changes", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/config/notifier.go#L138-L194
train