id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
154,700
juju/juju
api/credentialvalidator/credentialvalidator.go
WatchCredential
func (c *Facade) WatchCredential(credentialID string) (watcher.NotifyWatcher, error) { if !names.IsValidCloudCredential(credentialID) { return nil, errors.NotValidf("cloud credential ID %q", credentialID) } in := names.NewCloudCredentialTag(credentialID).String() var result params.NotifyWatchResult err := c.faca...
go
func (c *Facade) WatchCredential(credentialID string) (watcher.NotifyWatcher, error) { if !names.IsValidCloudCredential(credentialID) { return nil, errors.NotValidf("cloud credential ID %q", credentialID) } in := names.NewCloudCredentialTag(credentialID).String() var result params.NotifyWatchResult err := c.faca...
[ "func", "(", "c", "*", "Facade", ")", "WatchCredential", "(", "credentialID", "string", ")", "(", "watcher", ".", "NotifyWatcher", ",", "error", ")", "{", "if", "!", "names", ".", "IsValidCloudCredential", "(", "credentialID", ")", "{", "return", "nil", ",...
// WatchCredential provides a notify watcher that is responsive to changes // to a given cloud credential.
[ "WatchCredential", "provides", "a", "notify", "watcher", "that", "is", "responsive", "to", "changes", "to", "a", "given", "cloud", "credential", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/credentialvalidator/credentialvalidator.go#L61-L77
154,701
juju/juju
api/credentialvalidator/credentialvalidator.go
InvalidateModelCredential
func (c *Facade) InvalidateModelCredential(reason string) error { in := params.InvalidateCredentialArg{reason} var result params.ErrorResult err := c.facade.FacadeCall("InvalidateModelCredential", in, &result) if err != nil { return errors.Trace(err) } if result.Error != nil { return errors.Trace(result.Erro...
go
func (c *Facade) InvalidateModelCredential(reason string) error { in := params.InvalidateCredentialArg{reason} var result params.ErrorResult err := c.facade.FacadeCall("InvalidateModelCredential", in, &result) if err != nil { return errors.Trace(err) } if result.Error != nil { return errors.Trace(result.Erro...
[ "func", "(", "c", "*", "Facade", ")", "InvalidateModelCredential", "(", "reason", "string", ")", "error", "{", "in", ":=", "params", ".", "InvalidateCredentialArg", "{", "reason", "}", "\n", "var", "result", "params", ".", "ErrorResult", "\n", "err", ":=", ...
// InvalidateModelCredential invalidates cloud credential for the model that made a connection.
[ "InvalidateModelCredential", "invalidates", "cloud", "credential", "for", "the", "model", "that", "made", "a", "connection", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/credentialvalidator/credentialvalidator.go#L80-L92
154,702
juju/juju
api/credentialvalidator/credentialvalidator.go
WatchModelCredential
func (c *Facade) WatchModelCredential() (watcher.NotifyWatcher, error) { if v := c.facade.BestAPIVersion(); v < 2 { return nil, errors.NotSupportedf("WatchModelCredential on CredentialValidator v%v", v) } var result params.NotifyWatchResult err := c.facade.FacadeCall("WatchModelCredential", nil, &result) if err ...
go
func (c *Facade) WatchModelCredential() (watcher.NotifyWatcher, error) { if v := c.facade.BestAPIVersion(); v < 2 { return nil, errors.NotSupportedf("WatchModelCredential on CredentialValidator v%v", v) } var result params.NotifyWatchResult err := c.facade.FacadeCall("WatchModelCredential", nil, &result) if err ...
[ "func", "(", "c", "*", "Facade", ")", "WatchModelCredential", "(", ")", "(", "watcher", ".", "NotifyWatcher", ",", "error", ")", "{", "if", "v", ":=", "c", ".", "facade", ".", "BestAPIVersion", "(", ")", ";", "v", "<", "2", "{", "return", "nil", ",...
// WatchModelCredential provides a notify watcher that is responsive to changes // to a given cloud credential.
[ "WatchModelCredential", "provides", "a", "notify", "watcher", "that", "is", "responsive", "to", "changes", "to", "a", "given", "cloud", "credential", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/credentialvalidator/credentialvalidator.go#L96-L111
154,703
juju/juju
worker/uniter/operation/runaction.go
Prepare
func (ra *runAction) Prepare(state State) (*State, error) { rnr, err := ra.runnerFactory.NewActionRunner(ra.actionId) if cause := errors.Cause(err); charmrunner.IsBadActionError(cause) { if err := ra.callbacks.FailAction(ra.actionId, err.Error()); err != nil { return nil, err } return nil, ErrSkipExecute } ...
go
func (ra *runAction) Prepare(state State) (*State, error) { rnr, err := ra.runnerFactory.NewActionRunner(ra.actionId) if cause := errors.Cause(err); charmrunner.IsBadActionError(cause) { if err := ra.callbacks.FailAction(ra.actionId, err.Error()); err != nil { return nil, err } return nil, ErrSkipExecute } ...
[ "func", "(", "ra", "*", "runAction", ")", "Prepare", "(", "state", "State", ")", "(", "*", "State", ",", "error", ")", "{", "rnr", ",", "err", ":=", "ra", ".", "runnerFactory", ".", "NewActionRunner", "(", "ra", ".", "actionId", ")", "\n", "if", "c...
// Prepare ensures that the action is valid and can be executed. If not, it // will return ErrSkipExecute. It preserves any hook recorded in the supplied // state. // Prepare is part of the Operation interface.
[ "Prepare", "ensures", "that", "the", "action", "is", "valid", "and", "can", "be", "executed", ".", "If", "not", "it", "will", "return", "ErrSkipExecute", ".", "It", "preserves", "any", "hook", "recorded", "in", "the", "supplied", "state", ".", "Prepare", "...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/operation/runaction.go#L36-L65
154,704
juju/juju
worker/uniter/operation/runaction.go
Execute
func (ra *runAction) Execute(state State) (*State, error) { message := fmt.Sprintf("running action %s", ra.name) if err := ra.callbacks.SetExecutingStatus(message); err != nil { return nil, err } err := ra.runner.RunAction(ra.name) if err != nil { // This indicates an actual error -- an action merely failing...
go
func (ra *runAction) Execute(state State) (*State, error) { message := fmt.Sprintf("running action %s", ra.name) if err := ra.callbacks.SetExecutingStatus(message); err != nil { return nil, err } err := ra.runner.RunAction(ra.name) if err != nil { // This indicates an actual error -- an action merely failing...
[ "func", "(", "ra", "*", "runAction", ")", "Execute", "(", "state", "State", ")", "(", "*", "State", ",", "error", ")", "{", "message", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "ra", ".", "name", ")", "\n\n", "if", "err", ":=", "ra", "...
// Execute runs the action, and preserves any hook recorded in the supplied state. // Execute is part of the Operation interface.
[ "Execute", "runs", "the", "action", "and", "preserves", "any", "hook", "recorded", "in", "the", "supplied", "state", ".", "Execute", "is", "part", "of", "the", "Operation", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/operation/runaction.go#L69-L88
154,705
juju/juju
cloudconfig/cloudinit/cloudinit_opensuse.go
addPackageProxyCmd
func (helper openSUSEHelper) addPackageProxyCmd(url string) string { return helper.paccmder.SetProxyCmds(proxy.Settings{ Http: url, })[0] }
go
func (helper openSUSEHelper) addPackageProxyCmd(url string) string { return helper.paccmder.SetProxyCmds(proxy.Settings{ Http: url, })[0] }
[ "func", "(", "helper", "openSUSEHelper", ")", "addPackageProxyCmd", "(", "url", "string", ")", "string", "{", "return", "helper", ".", "paccmder", ".", "SetProxyCmds", "(", "proxy", ".", "Settings", "{", "Http", ":", "url", ",", "}", ")", "[", "0", "]", ...
// addPackageProxyCmd is a helper method which returns the corresponding runcmd // to apply the package proxy settings for OpenSUSE
[ "addPackageProxyCmd", "is", "a", "helper", "method", "which", "returns", "the", "corresponding", "runcmd", "to", "apply", "the", "package", "proxy", "settings", "for", "OpenSUSE" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloudconfig/cloudinit/cloudinit_opensuse.go#L30-L34
154,706
juju/juju
provider/vsphere/environ_broker.go
finishMachineConfig
func (env *sessionEnviron) finishMachineConfig(args environs.StartInstanceParams, img *OvaFileMetadata) error { envTools, err := args.Tools.Match(tools.Filter{Arch: img.Arch}) if err != nil { return err } if err := args.InstanceConfig.SetTools(envTools); err != nil { return errors.Trace(err) } return FinishIn...
go
func (env *sessionEnviron) finishMachineConfig(args environs.StartInstanceParams, img *OvaFileMetadata) error { envTools, err := args.Tools.Match(tools.Filter{Arch: img.Arch}) if err != nil { return err } if err := args.InstanceConfig.SetTools(envTools); err != nil { return errors.Trace(err) } return FinishIn...
[ "func", "(", "env", "*", "sessionEnviron", ")", "finishMachineConfig", "(", "args", "environs", ".", "StartInstanceParams", ",", "img", "*", "OvaFileMetadata", ")", "error", "{", "envTools", ",", "err", ":=", "args", ".", "Tools", ".", "Match", "(", "tools",...
// finishMachineConfig updates args.MachineConfig in place. Setting up // the API, StateServing, and SSHkeys information.
[ "finishMachineConfig", "updates", "args", ".", "MachineConfig", "in", "place", ".", "Setting", "up", "the", "API", "StateServing", "and", "SSHkeys", "information", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/vsphere/environ_broker.go#L109-L118
154,707
juju/juju
resource/context/internal/resourcedir.go
NewDirectorySpec
func NewDirectorySpec(dataDir, name string, deps DirectorySpecDeps) *DirectorySpec { dirname := deps.Join(dataDir, name) spec := &DirectorySpec{ Name: name, Dirname: dirname, Deps: deps, } return spec }
go
func NewDirectorySpec(dataDir, name string, deps DirectorySpecDeps) *DirectorySpec { dirname := deps.Join(dataDir, name) spec := &DirectorySpec{ Name: name, Dirname: dirname, Deps: deps, } return spec }
[ "func", "NewDirectorySpec", "(", "dataDir", ",", "name", "string", ",", "deps", "DirectorySpecDeps", ")", "*", "DirectorySpec", "{", "dirname", ":=", "deps", ".", "Join", "(", "dataDir", ",", "name", ")", "\n\n", "spec", ":=", "&", "DirectorySpec", "{", "N...
// NewDirectorySpec returns a new directory spec for the given info.
[ "NewDirectorySpec", "returns", "a", "new", "directory", "spec", "for", "the", "given", "info", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/context/internal/resourcedir.go#L29-L39
154,708
juju/juju
resource/context/internal/resourcedir.go
Resolve
func (spec DirectorySpec) Resolve(path ...string) string { return spec.Deps.Join(append([]string{spec.Dirname}, path...)...) }
go
func (spec DirectorySpec) Resolve(path ...string) string { return spec.Deps.Join(append([]string{spec.Dirname}, path...)...) }
[ "func", "(", "spec", "DirectorySpec", ")", "Resolve", "(", "path", "...", "string", ")", "string", "{", "return", "spec", ".", "Deps", ".", "Join", "(", "append", "(", "[", "]", "string", "{", "spec", ".", "Dirname", "}", ",", "path", "...", ")", "...
// Resolve returns the fully resolved file path, relative to the directory.
[ "Resolve", "returns", "the", "fully", "resolved", "file", "path", "relative", "to", "the", "directory", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/context/internal/resourcedir.go#L42-L44
154,709
juju/juju
resource/context/internal/resourcedir.go
Initialize
func (spec DirectorySpec) Initialize() (*Directory, error) { if err := spec.Deps.MkdirAll(spec.Dirname); err != nil { return nil, errors.Annotate(err, "could not create resource dir") } return NewDirectory(&spec, spec.Deps), nil }
go
func (spec DirectorySpec) Initialize() (*Directory, error) { if err := spec.Deps.MkdirAll(spec.Dirname); err != nil { return nil, errors.Annotate(err, "could not create resource dir") } return NewDirectory(&spec, spec.Deps), nil }
[ "func", "(", "spec", "DirectorySpec", ")", "Initialize", "(", ")", "(", "*", "Directory", ",", "error", ")", "{", "if", "err", ":=", "spec", ".", "Deps", ".", "MkdirAll", "(", "spec", ".", "Dirname", ")", ";", "err", "!=", "nil", "{", "return", "ni...
// Initialize preps the spec'ed directory and returns it.
[ "Initialize", "preps", "the", "spec", "ed", "directory", "and", "returns", "it", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/context/internal/resourcedir.go#L56-L62
154,710
juju/juju
resource/context/internal/resourcedir.go
NewTempDirectorySpec
func NewTempDirectorySpec(name string, deps TempDirDeps) (*TempDirectorySpec, error) { tempDir, err := deps.NewTempDir() if err != nil { return nil, errors.Trace(err) } spec := &TempDirectorySpec{ DirectorySpec: NewDirectorySpec(tempDir, name, deps), CleanUp: func() error { return deps.RemoveDir(tempDir) ...
go
func NewTempDirectorySpec(name string, deps TempDirDeps) (*TempDirectorySpec, error) { tempDir, err := deps.NewTempDir() if err != nil { return nil, errors.Trace(err) } spec := &TempDirectorySpec{ DirectorySpec: NewDirectorySpec(tempDir, name, deps), CleanUp: func() error { return deps.RemoveDir(tempDir) ...
[ "func", "NewTempDirectorySpec", "(", "name", "string", ",", "deps", "TempDirDeps", ")", "(", "*", "TempDirectorySpec", ",", "error", ")", "{", "tempDir", ",", "err", ":=", "deps", ".", "NewTempDir", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return"...
// NewTempDirectorySpec creates a new temp directory spec // for the given resource.
[ "NewTempDirectorySpec", "creates", "a", "new", "temp", "directory", "spec", "for", "the", "given", "resource", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/context/internal/resourcedir.go#L90-L103
154,711
juju/juju
resource/context/internal/resourcedir.go
NewDirectory
func NewDirectory(spec *DirectorySpec, deps DirectoryDeps) *Directory { dir := &Directory{ DirectorySpec: spec, Deps: deps, } return dir }
go
func NewDirectory(spec *DirectorySpec, deps DirectoryDeps) *Directory { dir := &Directory{ DirectorySpec: spec, Deps: deps, } return dir }
[ "func", "NewDirectory", "(", "spec", "*", "DirectorySpec", ",", "deps", "DirectoryDeps", ")", "*", "Directory", "{", "dir", ":=", "&", "Directory", "{", "DirectorySpec", ":", "spec", ",", "Deps", ":", "deps", ",", "}", "\n", "return", "dir", "\n", "}" ]
// NewDirectory returns a new directory for the provided spec.
[ "NewDirectory", "returns", "a", "new", "directory", "for", "the", "provided", "spec", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/context/internal/resourcedir.go#L134-L140
154,712
juju/juju
resource/context/internal/resourcedir.go
Write
func (dir *Directory) Write(opened ContentSource) error { // TODO(ericsnow) Also write the info file... relPath := opened.Info().Path if err := dir.WriteContent(relPath, opened.Content()); err != nil { return errors.Trace(err) } return nil }
go
func (dir *Directory) Write(opened ContentSource) error { // TODO(ericsnow) Also write the info file... relPath := opened.Info().Path if err := dir.WriteContent(relPath, opened.Content()); err != nil { return errors.Trace(err) } return nil }
[ "func", "(", "dir", "*", "Directory", ")", "Write", "(", "opened", "ContentSource", ")", "error", "{", "// TODO(ericsnow) Also write the info file...", "relPath", ":=", "opened", ".", "Info", "(", ")", ".", "Path", "\n", "if", "err", ":=", "dir", ".", "Write...
// Write writes all relevant files from the given source // to the directory.
[ "Write", "writes", "all", "relevant", "files", "from", "the", "given", "source", "to", "the", "directory", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/context/internal/resourcedir.go#L144-L153
154,713
juju/juju
resource/context/internal/resourcedir.go
WriteContent
func (dir *Directory) WriteContent(relPath string, content Content) error { if len(relPath) == 0 { // TODO(ericsnow) Use rd.readInfo().Path, like openResource() does? return errors.NotImplementedf("") } filename := dir.Resolve(relPath) target, err := dir.Deps.CreateWriter(filename) if err != nil { return er...
go
func (dir *Directory) WriteContent(relPath string, content Content) error { if len(relPath) == 0 { // TODO(ericsnow) Use rd.readInfo().Path, like openResource() does? return errors.NotImplementedf("") } filename := dir.Resolve(relPath) target, err := dir.Deps.CreateWriter(filename) if err != nil { return er...
[ "func", "(", "dir", "*", "Directory", ")", "WriteContent", "(", "relPath", "string", ",", "content", "Content", ")", "error", "{", "if", "len", "(", "relPath", ")", "==", "0", "{", "// TODO(ericsnow) Use rd.readInfo().Path, like openResource() does?", "return", "e...
// WriteContent writes the resource file to the given path // within the directory.
[ "WriteContent", "writes", "the", "resource", "file", "to", "the", "given", "path", "within", "the", "directory", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/context/internal/resourcedir.go#L157-L175
154,714
juju/juju
worker/meterstatus/connected.go
NewConnectedStatusWorker
func NewConnectedStatusWorker(cfg ConnectedConfig) (worker.Worker, error) { handler, err := NewConnectedStatusHandler(cfg) if err != nil { return nil, errors.Trace(err) } return watcher.NewNotifyWorker(watcher.NotifyConfig{ Handler: handler, }) }
go
func NewConnectedStatusWorker(cfg ConnectedConfig) (worker.Worker, error) { handler, err := NewConnectedStatusHandler(cfg) if err != nil { return nil, errors.Trace(err) } return watcher.NewNotifyWorker(watcher.NotifyConfig{ Handler: handler, }) }
[ "func", "NewConnectedStatusWorker", "(", "cfg", "ConnectedConfig", ")", "(", "worker", ".", "Worker", ",", "error", ")", "{", "handler", ",", "err", ":=", "NewConnectedStatusHandler", "(", "cfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", "...
// NewConnectedStatusWorker creates a new worker that monitors the meter status of the // unit and runs the meter-status-changed hook appropriately.
[ "NewConnectedStatusWorker", "creates", "a", "new", "worker", "that", "monitors", "the", "meter", "status", "of", "the", "unit", "and", "runs", "the", "meter", "-", "status", "-", "changed", "hook", "appropriately", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/meterstatus/connected.go#L47-L55
154,715
juju/juju
worker/meterstatus/connected.go
NewConnectedStatusHandler
func NewConnectedStatusHandler(cfg ConnectedConfig) (watcher.NotifyHandler, error) { if err := cfg.Validate(); err != nil { return nil, errors.Trace(err) } w := &connectedStatusHandler{ config: cfg, } return w, nil }
go
func NewConnectedStatusHandler(cfg ConnectedConfig) (watcher.NotifyHandler, error) { if err := cfg.Validate(); err != nil { return nil, errors.Trace(err) } w := &connectedStatusHandler{ config: cfg, } return w, nil }
[ "func", "NewConnectedStatusHandler", "(", "cfg", "ConnectedConfig", ")", "(", "watcher", ".", "NotifyHandler", ",", "error", ")", "{", "if", "err", ":=", "cfg", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".",...
// NewConnectedStatusHandler creates a new meter status handler for handling meter status // changes as provided by the API.
[ "NewConnectedStatusHandler", "creates", "a", "new", "meter", "status", "handler", "for", "handling", "meter", "status", "changes", "as", "provided", "by", "the", "API", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/meterstatus/connected.go#L59-L68
154,716
juju/juju
worker/meterstatus/connected.go
SetUp
func (w *connectedStatusHandler) SetUp() (watcher.NotifyWatcher, error) { var err error w.code, w.info, _, err = w.config.StateFile.Read() if err != nil { return nil, errors.Trace(err) } return w.config.Status.WatchMeterStatus() }
go
func (w *connectedStatusHandler) SetUp() (watcher.NotifyWatcher, error) { var err error w.code, w.info, _, err = w.config.StateFile.Read() if err != nil { return nil, errors.Trace(err) } return w.config.Status.WatchMeterStatus() }
[ "func", "(", "w", "*", "connectedStatusHandler", ")", "SetUp", "(", ")", "(", "watcher", ".", "NotifyWatcher", ",", "error", ")", "{", "var", "err", "error", "\n", "w", ".", "code", ",", "w", ".", "info", ",", "_", ",", "err", "=", "w", ".", "con...
// SetUp is part of the worker.NotifyWatchHandler interface.
[ "SetUp", "is", "part", "of", "the", "worker", ".", "NotifyWatchHandler", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/meterstatus/connected.go#L71-L79
154,717
juju/juju
worker/meterstatus/connected.go
Handle
func (w *connectedStatusHandler) Handle(abort <-chan struct{}) error { logger.Debugf("got meter status change signal from watcher") currentCode, currentInfo, err := w.config.Status.MeterStatus() if err != nil { return errors.Trace(err) } if currentCode == w.code && currentInfo == w.info { logger.Tracef("meter ...
go
func (w *connectedStatusHandler) Handle(abort <-chan struct{}) error { logger.Debugf("got meter status change signal from watcher") currentCode, currentInfo, err := w.config.Status.MeterStatus() if err != nil { return errors.Trace(err) } if currentCode == w.code && currentInfo == w.info { logger.Tracef("meter ...
[ "func", "(", "w", "*", "connectedStatusHandler", ")", "Handle", "(", "abort", "<-", "chan", "struct", "{", "}", ")", "error", "{", "logger", ".", "Debugf", "(", "\"", "\"", ")", "\n", "currentCode", ",", "currentInfo", ",", "err", ":=", "w", ".", "co...
// Handle is part of the worker.NotifyWatchHandler interface.
[ "Handle", "is", "part", "of", "the", "worker", ".", "NotifyWatchHandler", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/meterstatus/connected.go#L87-L104
154,718
juju/juju
state/resources_persistence.go
ListResources
func (p ResourcePersistence) ListResources(applicationID string) (resource.ApplicationResources, error) { logger.Tracef("listing all resources for application %q", applicationID) docs, err := p.resources(applicationID) if err != nil { return resource.ApplicationResources{}, errors.Trace(err) } store := map[str...
go
func (p ResourcePersistence) ListResources(applicationID string) (resource.ApplicationResources, error) { logger.Tracef("listing all resources for application %q", applicationID) docs, err := p.resources(applicationID) if err != nil { return resource.ApplicationResources{}, errors.Trace(err) } store := map[str...
[ "func", "(", "p", "ResourcePersistence", ")", "ListResources", "(", "applicationID", "string", ")", "(", "resource", ".", "ApplicationResources", ",", "error", ")", "{", "logger", ".", "Tracef", "(", "\"", "\"", ",", "applicationID", ")", "\n\n", "docs", ","...
// ListResources returns the info for each non-pending resource of the // identified application.
[ "ListResources", "returns", "the", "info", "for", "each", "non", "-", "pending", "resource", "of", "the", "identified", "application", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_persistence.go#L58-L111
154,719
juju/juju
state/resources_persistence.go
ListPendingResources
func (p ResourcePersistence) ListPendingResources(applicationID string) ([]resource.Resource, error) { docs, err := p.resources(applicationID) if err != nil { return nil, errors.Trace(err) } var resources []resource.Resource for _, doc := range docs { if doc.PendingID == "" { continue } // doc.UnitID w...
go
func (p ResourcePersistence) ListPendingResources(applicationID string) ([]resource.Resource, error) { docs, err := p.resources(applicationID) if err != nil { return nil, errors.Trace(err) } var resources []resource.Resource for _, doc := range docs { if doc.PendingID == "" { continue } // doc.UnitID w...
[ "func", "(", "p", "ResourcePersistence", ")", "ListPendingResources", "(", "applicationID", "string", ")", "(", "[", "]", "resource", ".", "Resource", ",", "error", ")", "{", "docs", ",", "err", ":=", "p", ".", "resources", "(", "applicationID", ")", "\n",...
// ListPendingResources returns the extended, model-related info for // each pending resource of the identifies application.
[ "ListPendingResources", "returns", "the", "extended", "model", "-", "related", "info", "for", "each", "pending", "resource", "of", "the", "identifies", "application", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_persistence.go#L115-L135
154,720
juju/juju
state/resources_persistence.go
GetResource
func (p ResourcePersistence) GetResource(id string) (res resource.Resource, storagePath string, _ error) { doc, err := p.getOne(id) if err != nil { return res, "", errors.Trace(err) } stored, err := doc2resource(doc) if err != nil { return res, "", errors.Trace(err) } return stored.Resource, stored.storage...
go
func (p ResourcePersistence) GetResource(id string) (res resource.Resource, storagePath string, _ error) { doc, err := p.getOne(id) if err != nil { return res, "", errors.Trace(err) } stored, err := doc2resource(doc) if err != nil { return res, "", errors.Trace(err) } return stored.Resource, stored.storage...
[ "func", "(", "p", "ResourcePersistence", ")", "GetResource", "(", "id", "string", ")", "(", "res", "resource", ".", "Resource", ",", "storagePath", "string", ",", "_", "error", ")", "{", "doc", ",", "err", ":=", "p", ".", "getOne", "(", "id", ")", "\...
// GetResource returns the extended, model-related info for the non-pending // resource.
[ "GetResource", "returns", "the", "extended", "model", "-", "related", "info", "for", "the", "non", "-", "pending", "resource", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_persistence.go#L139-L151
154,721
juju/juju
state/resources_persistence.go
StageResource
func (p ResourcePersistence) StageResource(res resource.Resource, storagePath string) (*StagedResource, error) { if storagePath == "" { return nil, errors.Errorf("missing storage path") } if err := res.Validate(); err != nil { return nil, errors.Annotate(err, "bad resource") } stored := storedResource{ Res...
go
func (p ResourcePersistence) StageResource(res resource.Resource, storagePath string) (*StagedResource, error) { if storagePath == "" { return nil, errors.Errorf("missing storage path") } if err := res.Validate(); err != nil { return nil, errors.Annotate(err, "bad resource") } stored := storedResource{ Res...
[ "func", "(", "p", "ResourcePersistence", ")", "StageResource", "(", "res", "resource", ".", "Resource", ",", "storagePath", "string", ")", "(", "*", "StagedResource", ",", "error", ")", "{", "if", "storagePath", "==", "\"", "\"", "{", "return", "nil", ",",...
// StageResource adds the resource in a separate staging area // if the resource isn't already staged. If it is then // errors.AlreadyExists is returned. A wrapper around the staged // resource is returned which supports both finalizing and removing // the staged resource.
[ "StageResource", "adds", "the", "resource", "in", "a", "separate", "staging", "area", "if", "the", "resource", "isn", "t", "already", "staged", ".", "If", "it", "is", "then", "errors", ".", "AlreadyExists", "is", "returned", ".", "A", "wrapper", "around", ...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_persistence.go#L158-L180
154,722
juju/juju
state/resources_persistence.go
SetResource
func (p ResourcePersistence) SetResource(res resource.Resource) error { stored, err := p.getStored(res) if errors.IsNotFound(err) { stored = storedResource{Resource: res} } else if err != nil { return errors.Trace(err) } // TODO(ericsnow) Ensure that stored.Resource matches res? If we do // so then the follow...
go
func (p ResourcePersistence) SetResource(res resource.Resource) error { stored, err := p.getStored(res) if errors.IsNotFound(err) { stored = storedResource{Resource: res} } else if err != nil { return errors.Trace(err) } // TODO(ericsnow) Ensure that stored.Resource matches res? If we do // so then the follow...
[ "func", "(", "p", "ResourcePersistence", ")", "SetResource", "(", "res", "resource", ".", "Resource", ")", "error", "{", "stored", ",", "err", ":=", "p", ".", "getStored", "(", "res", ")", "\n", "if", "errors", ".", "IsNotFound", "(", "err", ")", "{", ...
// SetResource sets the info for the resource.
[ "SetResource", "sets", "the", "info", "for", "the", "resource", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_persistence.go#L183-L220
154,723
juju/juju
state/resources_persistence.go
SetCharmStoreResource
func (p ResourcePersistence) SetCharmStoreResource(id, applicationID string, res charmresource.Resource, lastPolled time.Time) error { if err := res.Validate(); err != nil { return errors.Annotate(err, "bad resource") } csRes := charmStoreResource{ Resource: res, id: id, applicationID: appli...
go
func (p ResourcePersistence) SetCharmStoreResource(id, applicationID string, res charmresource.Resource, lastPolled time.Time) error { if err := res.Validate(); err != nil { return errors.Annotate(err, "bad resource") } csRes := charmStoreResource{ Resource: res, id: id, applicationID: appli...
[ "func", "(", "p", "ResourcePersistence", ")", "SetCharmStoreResource", "(", "id", ",", "applicationID", "string", ",", "res", "charmresource", ".", "Resource", ",", "lastPolled", "time", ".", "Time", ")", "error", "{", "if", "err", ":=", "res", ".", "Validat...
// SetCharmStoreResource stores the resource info that was retrieved // from the charm store.
[ "SetCharmStoreResource", "stores", "the", "resource", "info", "that", "was", "retrieved", "from", "the", "charm", "store", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_persistence.go#L224-L256
154,724
juju/juju
state/resources_persistence.go
SetUnitResource
func (p ResourcePersistence) SetUnitResource(unitID string, res resource.Resource) error { if res.PendingID != "" { return errors.Errorf("pending resources not allowed") } return p.setUnitResource(unitID, res, nil) }
go
func (p ResourcePersistence) SetUnitResource(unitID string, res resource.Resource) error { if res.PendingID != "" { return errors.Errorf("pending resources not allowed") } return p.setUnitResource(unitID, res, nil) }
[ "func", "(", "p", "ResourcePersistence", ")", "SetUnitResource", "(", "unitID", "string", ",", "res", "resource", ".", "Resource", ")", "error", "{", "if", "res", ".", "PendingID", "!=", "\"", "\"", "{", "return", "errors", ".", "Errorf", "(", "\"", "\""...
// SetUnitResource stores the resource info for a particular unit. The // resource must already be set for the application.
[ "SetUnitResource", "stores", "the", "resource", "info", "for", "a", "particular", "unit", ".", "The", "resource", "must", "already", "be", "set", "for", "the", "application", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_persistence.go#L260-L265
154,725
juju/juju
state/resources_persistence.go
SetUnitResourceProgress
func (p ResourcePersistence) SetUnitResourceProgress(unitID string, res resource.Resource, progress int64) error { if res.PendingID == "" { return errors.Errorf("only pending resources may track progress") } return p.setUnitResource(unitID, res, &progress) }
go
func (p ResourcePersistence) SetUnitResourceProgress(unitID string, res resource.Resource, progress int64) error { if res.PendingID == "" { return errors.Errorf("only pending resources may track progress") } return p.setUnitResource(unitID, res, &progress) }
[ "func", "(", "p", "ResourcePersistence", ")", "SetUnitResourceProgress", "(", "unitID", "string", ",", "res", "resource", ".", "Resource", ",", "progress", "int64", ")", "error", "{", "if", "res", ".", "PendingID", "==", "\"", "\"", "{", "return", "errors", ...
// SetUnitResource stores the resource info for a particular unit. The // resource must already be set for the application. The provided progress // is stored in the DB.
[ "SetUnitResource", "stores", "the", "resource", "info", "for", "a", "particular", "unit", ".", "The", "resource", "must", "already", "be", "set", "for", "the", "application", ".", "The", "provided", "progress", "is", "stored", "in", "the", "DB", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_persistence.go#L270-L275
154,726
juju/juju
state/resources_persistence.go
NewRemoveUnitResourcesOps
func (p ResourcePersistence) NewRemoveUnitResourcesOps(unitID string) ([]txn.Op, error) { docs, err := p.unitResources(unitID) if err != nil { return nil, errors.Trace(err) } ops := newRemoveResourcesOps(docs) // We do not remove the resource from the blob store here. That is // an application-level matter. r...
go
func (p ResourcePersistence) NewRemoveUnitResourcesOps(unitID string) ([]txn.Op, error) { docs, err := p.unitResources(unitID) if err != nil { return nil, errors.Trace(err) } ops := newRemoveResourcesOps(docs) // We do not remove the resource from the blob store here. That is // an application-level matter. r...
[ "func", "(", "p", "ResourcePersistence", ")", "NewRemoveUnitResourcesOps", "(", "unitID", "string", ")", "(", "[", "]", "txn", ".", "Op", ",", "error", ")", "{", "docs", ",", "err", ":=", "p", ".", "unitResources", "(", "unitID", ")", "\n", "if", "err"...
// NewRemoveUnitResourcesOps returns mgo transaction operations // that remove resource information specific to the unit from state.
[ "NewRemoveUnitResourcesOps", "returns", "mgo", "transaction", "operations", "that", "remove", "resource", "information", "specific", "to", "the", "unit", "from", "state", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_persistence.go#L375-L385
154,727
juju/juju
state/resources_persistence.go
NewRemoveResourcesOps
func (p ResourcePersistence) NewRemoveResourcesOps(applicationID string) ([]txn.Op, error) { docs, err := p.resources(applicationID) if err != nil { return nil, errors.Trace(err) } return removeResourcesAndStorageCleanupOps(docs), nil }
go
func (p ResourcePersistence) NewRemoveResourcesOps(applicationID string) ([]txn.Op, error) { docs, err := p.resources(applicationID) if err != nil { return nil, errors.Trace(err) } return removeResourcesAndStorageCleanupOps(docs), nil }
[ "func", "(", "p", "ResourcePersistence", ")", "NewRemoveResourcesOps", "(", "applicationID", "string", ")", "(", "[", "]", "txn", ".", "Op", ",", "error", ")", "{", "docs", ",", "err", ":=", "p", ".", "resources", "(", "applicationID", ")", "\n", "if", ...
// NewRemoveResourcesOps returns mgo transaction operations that // remove all the applications's resources from state.
[ "NewRemoveResourcesOps", "returns", "mgo", "transaction", "operations", "that", "remove", "all", "the", "applications", "s", "resources", "from", "state", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_persistence.go#L389-L395
154,728
juju/juju
state/resources_persistence.go
NewRemovePendingAppResourcesOps
func (p ResourcePersistence) NewRemovePendingAppResourcesOps(applicationID string, pendingIDs map[string]string) ([]txn.Op, error) { docs, err := p.resources(applicationID) if err != nil { return nil, errors.Trace(err) } pending := make([]resourceDoc, 0, len(docs)) for _, doc := range docs { if doc.UnitID != "...
go
func (p ResourcePersistence) NewRemovePendingAppResourcesOps(applicationID string, pendingIDs map[string]string) ([]txn.Op, error) { docs, err := p.resources(applicationID) if err != nil { return nil, errors.Trace(err) } pending := make([]resourceDoc, 0, len(docs)) for _, doc := range docs { if doc.UnitID != "...
[ "func", "(", "p", "ResourcePersistence", ")", "NewRemovePendingAppResourcesOps", "(", "applicationID", "string", ",", "pendingIDs", "map", "[", "string", "]", "string", ")", "(", "[", "]", "txn", ".", "Op", ",", "error", ")", "{", "docs", ",", "err", ":=",...
// NewRemovePendingResourcesOps returns mgo transaction operations to // clean up pending resources for the application from state. We pass // in the pending IDs to avoid removing the wrong resources if there's // a race to deploy the same application.
[ "NewRemovePendingResourcesOps", "returns", "mgo", "transaction", "operations", "to", "clean", "up", "pending", "resources", "for", "the", "application", "from", "state", ".", "We", "pass", "in", "the", "pending", "IDs", "to", "avoid", "removing", "the", "wrong", ...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_persistence.go#L401-L419
154,729
juju/juju
api/metricsadder/client.go
NewClient
func NewClient(caller base.APICaller) *Client { return &Client{facade: base.NewFacadeCaller(caller, "MetricsAdder")} }
go
func NewClient(caller base.APICaller) *Client { return &Client{facade: base.NewFacadeCaller(caller, "MetricsAdder")} }
[ "func", "NewClient", "(", "caller", "base", ".", "APICaller", ")", "*", "Client", "{", "return", "&", "Client", "{", "facade", ":", "base", ".", "NewFacadeCaller", "(", "caller", ",", "\"", "\"", ")", "}", "\n", "}" ]
// NewClient creates a new client for accessing the metricsadder API.
[ "NewClient", "creates", "a", "new", "client", "for", "accessing", "the", "metricsadder", "API", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/metricsadder/client.go#L22-L24
154,730
juju/juju
api/metricsadder/client.go
AddMetricBatches
func (c *Client) AddMetricBatches(batches []params.MetricBatchParam) (map[string]error, error) { parameters := params.MetricBatchParams{ Batches: batches, } results := new(params.ErrorResults) err := c.facade.FacadeCall("AddMetricBatches", parameters, results) if err != nil { return nil, errors.Trace(err) } ...
go
func (c *Client) AddMetricBatches(batches []params.MetricBatchParam) (map[string]error, error) { parameters := params.MetricBatchParams{ Batches: batches, } results := new(params.ErrorResults) err := c.facade.FacadeCall("AddMetricBatches", parameters, results) if err != nil { return nil, errors.Trace(err) } ...
[ "func", "(", "c", "*", "Client", ")", "AddMetricBatches", "(", "batches", "[", "]", "params", ".", "MetricBatchParam", ")", "(", "map", "[", "string", "]", "error", ",", "error", ")", "{", "parameters", ":=", "params", ".", "MetricBatchParams", "{", "Bat...
// AddMetricBatches implements the MetricsAdderClient interface.
[ "AddMetricBatches", "implements", "the", "MetricsAdderClient", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/metricsadder/client.go#L34-L48
154,731
juju/juju
worker/txnpruner/txnpruner.go
New
func New(tp TransactionPruner, interval time.Duration, clock clock.Clock) worker.Worker { return jworker.NewSimpleWorker(func(stopCh <-chan struct{}) error { for { select { case <-clock.After(interval): err := tp.MaybePruneTransactions() if err != nil { return errors.Annotate(err, "pruning failed,...
go
func New(tp TransactionPruner, interval time.Duration, clock clock.Clock) worker.Worker { return jworker.NewSimpleWorker(func(stopCh <-chan struct{}) error { for { select { case <-clock.After(interval): err := tp.MaybePruneTransactions() if err != nil { return errors.Annotate(err, "pruning failed,...
[ "func", "New", "(", "tp", "TransactionPruner", ",", "interval", "time", ".", "Duration", ",", "clock", "clock", ".", "Clock", ")", "worker", ".", "Worker", "{", "return", "jworker", ".", "NewSimpleWorker", "(", "func", "(", "stopCh", "<-", "chan", "struct"...
// New returns a worker which periodically prunes the data for // completed transactions.
[ "New", "returns", "a", "worker", "which", "periodically", "prunes", "the", "data", "for", "completed", "transactions", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/txnpruner/txnpruner.go#L24-L38
154,732
juju/juju
cmd/juju/status/output_tabular.go
FormatTabular
func FormatTabular(writer io.Writer, forceColor bool, value interface{}) error { fs, valueConverted := value.(formattedStatus) if !valueConverted { return errors.Errorf("expected value of type %T, got %T", fs, value) } // To format things into columns. tw := output.TabWriter(writer) if forceColor { tw.SetCol...
go
func FormatTabular(writer io.Writer, forceColor bool, value interface{}) error { fs, valueConverted := value.(formattedStatus) if !valueConverted { return errors.Errorf("expected value of type %T, got %T", fs, value) } // To format things into columns. tw := output.TabWriter(writer) if forceColor { tw.SetCol...
[ "func", "FormatTabular", "(", "writer", "io", ".", "Writer", ",", "forceColor", "bool", ",", "value", "interface", "{", "}", ")", "error", "{", "fs", ",", "valueConverted", ":=", "value", ".", "(", "formattedStatus", ")", "\n", "if", "!", "valueConverted",...
// FormatTabular writes a tabular summary of machines, applications, and // units. Any subordinate items are indented by two spaces beneath // their superior.
[ "FormatTabular", "writes", "a", "tabular", "summary", "of", "machines", "applications", "and", "units", ".", "Any", "subordinate", "items", "are", "indented", "by", "two", "spaces", "beneath", "their", "superior", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/status/output_tabular.go#L38-L104
154,733
juju/juju
cmd/juju/status/output_tabular.go
printOffers
func printOffers(tw *ansiterm.TabWriter, offers map[string]offerStatus) error { if len(offers) == 0 { return nil } w := startSection(tw, false, "Offer", "Application", "Charm", "Rev", "Connected", "Endpoint", "Interface", "Role") for _, offerName := range naturalsort.Sort(stringKeysFromMap(offers)) { offer := o...
go
func printOffers(tw *ansiterm.TabWriter, offers map[string]offerStatus) error { if len(offers) == 0 { return nil } w := startSection(tw, false, "Offer", "Application", "Charm", "Rev", "Connected", "Endpoint", "Interface", "Role") for _, offerName := range naturalsort.Sort(stringKeysFromMap(offers)) { offer := o...
[ "func", "printOffers", "(", "tw", "*", "ansiterm", ".", "TabWriter", ",", "offers", "map", "[", "string", "]", "offerStatus", ")", "error", "{", "if", "len", "(", "offers", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "w", ":=", "startSecti...
// printOffers prints a tabular summary of the offers.
[ "printOffers", "prints", "a", "tabular", "summary", "of", "the", "offers", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/status/output_tabular.go#L313-L349
154,734
juju/juju
cmd/juju/status/output_tabular.go
FormatMachineTabular
func FormatMachineTabular(writer io.Writer, forceColor bool, value interface{}) error { fs, valueConverted := value.(formattedMachineStatus) if !valueConverted { return errors.Errorf("expected value of type %T, got %T", fs, value) } tw := output.TabWriter(writer) if forceColor { tw.SetColorCapable(forceColor) ...
go
func FormatMachineTabular(writer io.Writer, forceColor bool, value interface{}) error { fs, valueConverted := value.(formattedMachineStatus) if !valueConverted { return errors.Errorf("expected value of type %T, got %T", fs, value) } tw := output.TabWriter(writer) if forceColor { tw.SetColorCapable(forceColor) ...
[ "func", "FormatMachineTabular", "(", "writer", "io", ".", "Writer", ",", "forceColor", "bool", ",", "value", "interface", "{", "}", ")", "error", "{", "fs", ",", "valueConverted", ":=", "value", ".", "(", "formattedMachineStatus", ")", "\n", "if", "!", "va...
// FormatMachineTabular writes a tabular summary of machine
[ "FormatMachineTabular", "writes", "a", "tabular", "summary", "of", "machine" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/status/output_tabular.go#L421-L432
154,735
juju/juju
cmd/juju/status/output_tabular.go
agentDoing
func agentDoing(agentStatus statusInfoContents) string { if agentStatus.Current != status.Executing { return "" } // First see if we can determine a hook name. var hookNames []string for _, h := range hooks.UnitHooks() { hookNames = append(hookNames, string(h)) } for _, h := range hooks.RelationHooks() { h...
go
func agentDoing(agentStatus statusInfoContents) string { if agentStatus.Current != status.Executing { return "" } // First see if we can determine a hook name. var hookNames []string for _, h := range hooks.UnitHooks() { hookNames = append(hookNames, string(h)) } for _, h := range hooks.RelationHooks() { h...
[ "func", "agentDoing", "(", "agentStatus", "statusInfoContents", ")", "string", "{", "if", "agentStatus", ".", "Current", "!=", "status", ".", "Executing", "{", "return", "\"", "\"", "\n", "}", "\n", "// First see if we can determine a hook name.", "var", "hookNames"...
// agentDoing returns what hook or action, if any, // the agent is currently executing. // The hook name or action is extracted from the agent message.
[ "agentDoing", "returns", "what", "hook", "or", "action", "if", "any", "the", "agent", "is", "currently", "executing", ".", "The", "hook", "name", "or", "action", "is", "extracted", "from", "the", "agent", "message", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/status/output_tabular.go#L437-L461
154,736
juju/juju
provider/ec2/image.go
findInstanceSpec
func findInstanceSpec( controller bool, allImageMetadata []*imagemetadata.ImageMetadata, instanceTypes []instances.InstanceType, ic *instances.InstanceConstraint, ) (*instances.InstanceSpec, error) { logger.Debugf("received %d image(s)", len(allImageMetadata)) if !controller { ic.Constraints = withDefaultNonCon...
go
func findInstanceSpec( controller bool, allImageMetadata []*imagemetadata.ImageMetadata, instanceTypes []instances.InstanceType, ic *instances.InstanceConstraint, ) (*instances.InstanceSpec, error) { logger.Debugf("received %d image(s)", len(allImageMetadata)) if !controller { ic.Constraints = withDefaultNonCon...
[ "func", "findInstanceSpec", "(", "controller", "bool", ",", "allImageMetadata", "[", "]", "*", "imagemetadata", ".", "ImageMetadata", ",", "instanceTypes", "[", "]", "instances", ".", "InstanceType", ",", "ic", "*", "instances", ".", "InstanceConstraint", ",", "...
// findInstanceSpec returns an InstanceSpec satisfying the supplied instanceConstraint.
[ "findInstanceSpec", "returns", "an", "InstanceSpec", "satisfying", "the", "supplied", "instanceConstraint", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/ec2/image.go#L39-L53
154,737
juju/juju
resource/context/cmd/get.go
NewGetCmd
func NewGetCmd(c jujuc.ContextComponent) (*GetCmd, error) { return &GetCmd{ compContext: c, }, nil }
go
func NewGetCmd(c jujuc.ContextComponent) (*GetCmd, error) { return &GetCmd{ compContext: c, }, nil }
[ "func", "NewGetCmd", "(", "c", "jujuc", ".", "ContextComponent", ")", "(", "*", "GetCmd", ",", "error", ")", "{", "return", "&", "GetCmd", "{", "compContext", ":", "c", ",", "}", ",", "nil", "\n", "}" ]
// NewGetCmd creates a new GetCmd for the given hook context.
[ "NewGetCmd", "creates", "a", "new", "GetCmd", "for", "the", "given", "hook", "context", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/context/cmd/get.go#L20-L24
154,738
juju/juju
cmd/juju/user/whoami.go
NewWhoAmICommand
func NewWhoAmICommand() cmd.Command { cmd := &whoAmICommand{ store: jujuclient.NewFileClientStore(), } return modelcmd.WrapBase(cmd) }
go
func NewWhoAmICommand() cmd.Command { cmd := &whoAmICommand{ store: jujuclient.NewFileClientStore(), } return modelcmd.WrapBase(cmd) }
[ "func", "NewWhoAmICommand", "(", ")", "cmd", ".", "Command", "{", "cmd", ":=", "&", "whoAmICommand", "{", "store", ":", "jujuclient", ".", "NewFileClientStore", "(", ")", ",", "}", "\n", "return", "modelcmd", ".", "WrapBase", "(", "cmd", ")", "\n", "}" ]
// NewWhoAmICommand returns a command to print login details.
[ "NewWhoAmICommand", "returns", "a", "command", "to", "print", "login", "details", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/user/whoami.go#L37-L42
154,739
juju/juju
cmd/helpers.go
IsUserAbortedError
func IsUserAbortedError(err error) bool { _, ok := errors.Cause(err).(userAbortedError) return ok }
go
func IsUserAbortedError(err error) bool { _, ok := errors.Cause(err).(userAbortedError) return ok }
[ "func", "IsUserAbortedError", "(", "err", "error", ")", "bool", "{", "_", ",", "ok", ":=", "errors", ".", "Cause", "(", "err", ")", ".", "(", "userAbortedError", ")", "\n", "return", "ok", "\n", "}" ]
// IsUserAbortedError returns true if err is of type userAbortedError.
[ "IsUserAbortedError", "returns", "true", "if", "err", "is", "of", "type", "userAbortedError", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/helpers.go#L25-L28
154,740
juju/juju
cmd/helpers.go
UserConfirmYes
func UserConfirmYes(ctx *cmd.Context) error { scanner := bufio.NewScanner(ctx.Stdin) scanner.Scan() err := scanner.Err() if err != nil && err != io.EOF { return errors.Trace(err) } answer := strings.ToLower(scanner.Text()) if answer != "y" && answer != "yes" { return errors.Trace(userAbortedError("aborted"))...
go
func UserConfirmYes(ctx *cmd.Context) error { scanner := bufio.NewScanner(ctx.Stdin) scanner.Scan() err := scanner.Err() if err != nil && err != io.EOF { return errors.Trace(err) } answer := strings.ToLower(scanner.Text()) if answer != "y" && answer != "yes" { return errors.Trace(userAbortedError("aborted"))...
[ "func", "UserConfirmYes", "(", "ctx", "*", "cmd", ".", "Context", ")", "error", "{", "scanner", ":=", "bufio", ".", "NewScanner", "(", "ctx", ".", "Stdin", ")", "\n", "scanner", ".", "Scan", "(", ")", "\n", "err", ":=", "scanner", ".", "Err", "(", ...
// UserConfirmYes returns an error if we do not read a "y" or "yes" from user // input.
[ "UserConfirmYes", "returns", "an", "error", "if", "we", "do", "not", "read", "a", "y", "or", "yes", "from", "user", "input", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/helpers.go#L32-L44
154,741
juju/juju
resource/api/client/client.go
NewClient
func NewClient(caller FacadeCaller, doer Doer, closer io.Closer) *Client { return &Client{ FacadeCaller: caller, Closer: closer, doer: doer, } }
go
func NewClient(caller FacadeCaller, doer Doer, closer io.Closer) *Client { return &Client{ FacadeCaller: caller, Closer: closer, doer: doer, } }
[ "func", "NewClient", "(", "caller", "FacadeCaller", ",", "doer", "Doer", ",", "closer", "io", ".", "Closer", ")", "*", "Client", "{", "return", "&", "Client", "{", "FacadeCaller", ":", "caller", ",", "Closer", ":", "closer", ",", "doer", ":", "doer", "...
// NewClient returns a new Client for the given raw API caller.
[ "NewClient", "returns", "a", "new", "Client", "for", "the", "given", "raw", "API", "caller", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/api/client/client.go#L43-L49
154,742
juju/juju
resource/api/client/client.go
ListResources
func (c Client) ListResources(applications []string) ([]resource.ApplicationResources, error) { args, err := newListResourcesArgs(applications) if err != nil { return nil, errors.Trace(err) } var apiResults params.ResourcesResults if err := c.FacadeCall("ListResources", &args, &apiResults); err != nil { retur...
go
func (c Client) ListResources(applications []string) ([]resource.ApplicationResources, error) { args, err := newListResourcesArgs(applications) if err != nil { return nil, errors.Trace(err) } var apiResults params.ResourcesResults if err := c.FacadeCall("ListResources", &args, &apiResults); err != nil { retur...
[ "func", "(", "c", "Client", ")", "ListResources", "(", "applications", "[", "]", "string", ")", "(", "[", "]", "resource", ".", "ApplicationResources", ",", "error", ")", "{", "args", ",", "err", ":=", "newListResourcesArgs", "(", "applications", ")", "\n"...
// ListResources calls the ListResources API server method with // the given application names.
[ "ListResources", "calls", "the", "ListResources", "API", "server", "method", "with", "the", "given", "application", "names", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/api/client/client.go#L53-L86
154,743
juju/juju
resource/api/client/client.go
newListResourcesArgs
func newListResourcesArgs(applications []string) (params.ListResourcesArgs, error) { var args params.ListResourcesArgs var errs []error for _, application := range applications { if !names.IsValidApplication(application) { err := errors.Errorf("invalid application %q", application) errs = append(errs, err) ...
go
func newListResourcesArgs(applications []string) (params.ListResourcesArgs, error) { var args params.ListResourcesArgs var errs []error for _, application := range applications { if !names.IsValidApplication(application) { err := errors.Errorf("invalid application %q", application) errs = append(errs, err) ...
[ "func", "newListResourcesArgs", "(", "applications", "[", "]", "string", ")", "(", "params", ".", "ListResourcesArgs", ",", "error", ")", "{", "var", "args", "params", ".", "ListResourcesArgs", "\n", "var", "errs", "[", "]", "error", "\n", "for", "_", ",",...
// newListResourcesArgs returns the arguments for the ListResources endpoint.
[ "newListResourcesArgs", "returns", "the", "arguments", "for", "the", "ListResources", "endpoint", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/api/client/client.go#L89-L106
154,744
juju/juju
resource/api/client/client.go
Upload
func (c Client) Upload(application, name, filename string, reader io.ReadSeeker) error { uReq, err := api.NewUploadRequest(application, name, filename, reader) if err != nil { return errors.Trace(err) } req, err := uReq.HTTPRequest() if err != nil { return errors.Trace(err) } var response params.UploadResul...
go
func (c Client) Upload(application, name, filename string, reader io.ReadSeeker) error { uReq, err := api.NewUploadRequest(application, name, filename, reader) if err != nil { return errors.Trace(err) } req, err := uReq.HTTPRequest() if err != nil { return errors.Trace(err) } var response params.UploadResul...
[ "func", "(", "c", "Client", ")", "Upload", "(", "application", ",", "name", ",", "filename", "string", ",", "reader", "io", ".", "ReadSeeker", ")", "error", "{", "uReq", ",", "err", ":=", "api", ".", "NewUploadRequest", "(", "application", ",", "name", ...
// Upload sends the provided resource blob up to Juju.
[ "Upload", "sends", "the", "provided", "resource", "blob", "up", "to", "Juju", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/api/client/client.go#L109-L125
154,745
juju/juju
resource/api/client/client.go
AddPendingResources
func (c Client) AddPendingResources(args AddPendingResourcesArgs) (pendingIDs []string, err error) { apiArgs, err := newAddPendingResourcesArgs(args.ApplicationID, args.CharmID, args.CharmStoreMacaroon, args.Resources) if err != nil { return nil, errors.Trace(err) } var result params.AddPendingResourcesResult i...
go
func (c Client) AddPendingResources(args AddPendingResourcesArgs) (pendingIDs []string, err error) { apiArgs, err := newAddPendingResourcesArgs(args.ApplicationID, args.CharmID, args.CharmStoreMacaroon, args.Resources) if err != nil { return nil, errors.Trace(err) } var result params.AddPendingResourcesResult i...
[ "func", "(", "c", "Client", ")", "AddPendingResources", "(", "args", "AddPendingResourcesArgs", ")", "(", "pendingIDs", "[", "]", "string", ",", "err", "error", ")", "{", "apiArgs", ",", "err", ":=", "newAddPendingResourcesArgs", "(", "args", ".", "Application...
// AddPendingResources sends the provided resource info up to Juju // without making it available yet.
[ "AddPendingResources", "sends", "the", "provided", "resource", "info", "up", "to", "Juju", "without", "making", "it", "available", "yet", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/api/client/client.go#L146-L172
154,746
juju/juju
resource/api/client/client.go
newAddPendingResourcesArgs
func newAddPendingResourcesArgs(applicationID string, chID charmstore.CharmID, csMac *macaroon.Macaroon, resources []charmresource.Resource) (params.AddPendingResourcesArgs, error) { var args params.AddPendingResourcesArgs if !names.IsValidApplication(applicationID) { return args, errors.Errorf("invalid applicatio...
go
func newAddPendingResourcesArgs(applicationID string, chID charmstore.CharmID, csMac *macaroon.Macaroon, resources []charmresource.Resource) (params.AddPendingResourcesArgs, error) { var args params.AddPendingResourcesArgs if !names.IsValidApplication(applicationID) { return args, errors.Errorf("invalid applicatio...
[ "func", "newAddPendingResourcesArgs", "(", "applicationID", "string", ",", "chID", "charmstore", ".", "CharmID", ",", "csMac", "*", "macaroon", ".", "Macaroon", ",", "resources", "[", "]", "charmresource", ".", "Resource", ")", "(", "params", ".", "AddPendingRes...
// newAddPendingResourcesArgs returns the arguments for the // AddPendingResources API endpoint.
[ "newAddPendingResourcesArgs", "returns", "the", "arguments", "for", "the", "AddPendingResources", "API", "endpoint", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/api/client/client.go#L176-L200
154,747
juju/juju
resource/api/client/client.go
UploadPendingResource
func (c Client) UploadPendingResource(applicationID string, res charmresource.Resource, filename string, reader io.ReadSeeker) (pendingID string, err error) { ids, err := c.AddPendingResources(AddPendingResourcesArgs{ ApplicationID: applicationID, Resources: []charmresource.Resource{res}, }) if err != nil { ...
go
func (c Client) UploadPendingResource(applicationID string, res charmresource.Resource, filename string, reader io.ReadSeeker) (pendingID string, err error) { ids, err := c.AddPendingResources(AddPendingResourcesArgs{ ApplicationID: applicationID, Resources: []charmresource.Resource{res}, }) if err != nil { ...
[ "func", "(", "c", "Client", ")", "UploadPendingResource", "(", "applicationID", "string", ",", "res", "charmresource", ".", "Resource", ",", "filename", "string", ",", "reader", "io", ".", "ReadSeeker", ")", "(", "pendingID", "string", ",", "err", "error", "...
// UploadPendingResource sends the provided resource blob up to Juju // and makes it available.
[ "UploadPendingResource", "sends", "the", "provided", "resource", "blob", "up", "to", "Juju", "and", "makes", "it", "available", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/api/client/client.go#L204-L232
154,748
juju/juju
worker/instancemutater/mocks/machinemutater_mock.go
NewMockMutaterMachine
func NewMockMutaterMachine(ctrl *gomock.Controller) *MockMutaterMachine { mock := &MockMutaterMachine{ctrl: ctrl} mock.recorder = &MockMutaterMachineMockRecorder{mock} return mock }
go
func NewMockMutaterMachine(ctrl *gomock.Controller) *MockMutaterMachine { mock := &MockMutaterMachine{ctrl: ctrl} mock.recorder = &MockMutaterMachineMockRecorder{mock} return mock }
[ "func", "NewMockMutaterMachine", "(", "ctrl", "*", "gomock", ".", "Controller", ")", "*", "MockMutaterMachine", "{", "mock", ":=", "&", "MockMutaterMachine", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockMutaterMachineMockRecorder"...
// NewMockMutaterMachine creates a new mock instance
[ "NewMockMutaterMachine", "creates", "a", "new", "mock", "instance" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/instancemutater/mocks/machinemutater_mock.go#L29-L33
154,749
juju/juju
worker/instancemutater/mocks/machinemutater_mock.go
CharmProfilingInfo
func (m *MockMutaterMachine) CharmProfilingInfo() (*instancemutater.UnitProfileInfo, error) { ret := m.ctrl.Call(m, "CharmProfilingInfo") ret0, _ := ret[0].(*instancemutater.UnitProfileInfo) ret1, _ := ret[1].(error) return ret0, ret1 }
go
func (m *MockMutaterMachine) CharmProfilingInfo() (*instancemutater.UnitProfileInfo, error) { ret := m.ctrl.Call(m, "CharmProfilingInfo") ret0, _ := ret[0].(*instancemutater.UnitProfileInfo) ret1, _ := ret[1].(error) return ret0, ret1 }
[ "func", "(", "m", "*", "MockMutaterMachine", ")", "CharmProfilingInfo", "(", ")", "(", "*", "instancemutater", ".", "UnitProfileInfo", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", "...
// CharmProfilingInfo mocks base method
[ "CharmProfilingInfo", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/instancemutater/mocks/machinemutater_mock.go#L41-L46
154,750
juju/juju
worker/instancemutater/mocks/machinemutater_mock.go
Refresh
func (m *MockMutaterMachine) Refresh() error { ret := m.ctrl.Call(m, "Refresh") ret0, _ := ret[0].(error) return ret0 }
go
func (m *MockMutaterMachine) Refresh() error { ret := m.ctrl.Call(m, "Refresh") ret0, _ := ret[0].(error) return ret0 }
[ "func", "(", "m", "*", "MockMutaterMachine", ")", "Refresh", "(", ")", "error", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "error", ")", "\n",...
// Refresh mocks base method
[ "Refresh", "mocks", "base", "method" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/instancemutater/mocks/machinemutater_mock.go#L79-L83
154,751
juju/juju
worker/instancemutater/mocks/machinemutater_mock.go
SetCharmProfiles
func (mr *MockMutaterMachineMockRecorder) SetCharmProfiles(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetCharmProfiles", reflect.TypeOf((*MockMutaterMachine)(nil).SetCharmProfiles), arg0) }
go
func (mr *MockMutaterMachineMockRecorder) SetCharmProfiles(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetCharmProfiles", reflect.TypeOf((*MockMutaterMachine)(nil).SetCharmProfiles), arg0) }
[ "func", "(", "mr", "*", "MockMutaterMachineMockRecorder", ")", "SetCharmProfiles", "(", "arg0", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ...
// SetCharmProfiles indicates an expected call of SetCharmProfiles
[ "SetCharmProfiles", "indicates", "an", "expected", "call", "of", "SetCharmProfiles" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/instancemutater/mocks/machinemutater_mock.go#L98-L100
154,752
juju/juju
worker/instancemutater/mocks/machinemutater_mock.go
SetModificationStatus
func (mr *MockMutaterMachineMockRecorder) SetModificationStatus(arg0, arg1, arg2 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetModificationStatus", reflect.TypeOf((*MockMutaterMachine)(nil).SetModificationStatus), arg0, arg1, arg2) }
go
func (mr *MockMutaterMachineMockRecorder) SetModificationStatus(arg0, arg1, arg2 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetModificationStatus", reflect.TypeOf((*MockMutaterMachine)(nil).SetModificationStatus), arg0, arg1, arg2) }
[ "func", "(", "mr", "*", "MockMutaterMachineMockRecorder", ")", "SetModificationStatus", "(", "arg0", ",", "arg1", ",", "arg2", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodTy...
// SetModificationStatus indicates an expected call of SetModificationStatus
[ "SetModificationStatus", "indicates", "an", "expected", "call", "of", "SetModificationStatus" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/instancemutater/mocks/machinemutater_mock.go#L110-L112
154,753
juju/juju
api/caasunitprovisioner/client.go
WatchApplications
func (c *Client) WatchApplications() (watcher.StringsWatcher, error) { var result params.StringsWatchResult if err := c.facade.FacadeCall("WatchApplications", nil, &result); err != nil { return nil, err } if err := result.Error; err != nil { return nil, result.Error } w := apiwatcher.NewStringsWatcher(c.facad...
go
func (c *Client) WatchApplications() (watcher.StringsWatcher, error) { var result params.StringsWatchResult if err := c.facade.FacadeCall("WatchApplications", nil, &result); err != nil { return nil, err } if err := result.Error; err != nil { return nil, result.Error } w := apiwatcher.NewStringsWatcher(c.facad...
[ "func", "(", "c", "*", "Client", ")", "WatchApplications", "(", ")", "(", "watcher", ".", "StringsWatcher", ",", "error", ")", "{", "var", "result", "params", ".", "StringsWatchResult", "\n", "if", "err", ":=", "c", ".", "facade", ".", "FacadeCall", "(",...
// WatchApplications returns a StringsWatcher that notifies of // changes to the lifecycles of CAAS applications in the current model.
[ "WatchApplications", "returns", "a", "StringsWatcher", "that", "notifies", "of", "changes", "to", "the", "lifecycles", "of", "CAAS", "applications", "in", "the", "current", "model", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/caasunitprovisioner/client.go#L54-L64
154,754
juju/juju
api/caasunitprovisioner/client.go
ApplicationConfig
func (c *Client) ApplicationConfig(applicationName string) (application.ConfigAttributes, error) { var results params.ApplicationGetConfigResults args := params.Entities{ Entities: []params.Entity{{Tag: names.NewApplicationTag(applicationName).String()}}, } err := c.facade.FacadeCall("ApplicationsConfig", args, &...
go
func (c *Client) ApplicationConfig(applicationName string) (application.ConfigAttributes, error) { var results params.ApplicationGetConfigResults args := params.Entities{ Entities: []params.Entity{{Tag: names.NewApplicationTag(applicationName).String()}}, } err := c.facade.FacadeCall("ApplicationsConfig", args, &...
[ "func", "(", "c", "*", "Client", ")", "ApplicationConfig", "(", "applicationName", "string", ")", "(", "application", ".", "ConfigAttributes", ",", "error", ")", "{", "var", "results", "params", ".", "ApplicationGetConfigResults", "\n", "args", ":=", "params", ...
// ApplicationConfig returns the config for the specified application.
[ "ApplicationConfig", "returns", "the", "config", "for", "the", "specified", "application", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/caasunitprovisioner/client.go#L67-L80
154,755
juju/juju
api/caasunitprovisioner/client.go
WatchApplicationScale
func (c *Client) WatchApplicationScale(application string) (watcher.NotifyWatcher, error) { applicationTag, err := applicationTag(application) if err != nil { return nil, errors.Trace(err) } args := entities(applicationTag) var results params.NotifyWatchResults if err := c.facade.FacadeCall("WatchApplicationsS...
go
func (c *Client) WatchApplicationScale(application string) (watcher.NotifyWatcher, error) { applicationTag, err := applicationTag(application) if err != nil { return nil, errors.Trace(err) } args := entities(applicationTag) var results params.NotifyWatchResults if err := c.facade.FacadeCall("WatchApplicationsS...
[ "func", "(", "c", "*", "Client", ")", "WatchApplicationScale", "(", "application", "string", ")", "(", "watcher", ".", "NotifyWatcher", ",", "error", ")", "{", "applicationTag", ",", "err", ":=", "applicationTag", "(", "application", ")", "\n", "if", "err", ...
// WatchApplicationScale returns a NotifyWatcher that notifies of // changes to the lifecycles of units of the specified // CAAS application in the current model.
[ "WatchApplicationScale", "returns", "a", "NotifyWatcher", "that", "notifies", "of", "changes", "to", "the", "lifecycles", "of", "units", "of", "the", "specified", "CAAS", "application", "in", "the", "current", "model", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/caasunitprovisioner/client.go#L85-L104
154,756
juju/juju
api/caasunitprovisioner/client.go
ApplicationScale
func (c *Client) ApplicationScale(applicationName string) (int, error) { var results params.IntResults args := params.Entities{ Entities: []params.Entity{{Tag: names.NewApplicationTag(applicationName).String()}}, } err := c.facade.FacadeCall("ApplicationsScale", args, &results) if err != nil { return 0, errors...
go
func (c *Client) ApplicationScale(applicationName string) (int, error) { var results params.IntResults args := params.Entities{ Entities: []params.Entity{{Tag: names.NewApplicationTag(applicationName).String()}}, } err := c.facade.FacadeCall("ApplicationsScale", args, &results) if err != nil { return 0, errors...
[ "func", "(", "c", "*", "Client", ")", "ApplicationScale", "(", "applicationName", "string", ")", "(", "int", ",", "error", ")", "{", "var", "results", "params", ".", "IntResults", "\n", "args", ":=", "params", ".", "Entities", "{", "Entities", ":", "[", ...
// ApplicationScale returns the scale for the specified application.
[ "ApplicationScale", "returns", "the", "scale", "for", "the", "specified", "application", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/caasunitprovisioner/client.go#L107-L120
154,757
juju/juju
api/caasunitprovisioner/client.go
ProvisioningInfo
func (c *Client) ProvisioningInfo(appName string) (*ProvisioningInfo, error) { appTag, err := applicationTag(appName) if err != nil { return nil, errors.Trace(err) } args := entities(appTag) var results params.KubernetesProvisioningInfoResults if err := c.facade.FacadeCall("ProvisioningInfo", args, &results); ...
go
func (c *Client) ProvisioningInfo(appName string) (*ProvisioningInfo, error) { appTag, err := applicationTag(appName) if err != nil { return nil, errors.Trace(err) } args := entities(appTag) var results params.KubernetesProvisioningInfoResults if err := c.facade.FacadeCall("ProvisioningInfo", args, &results); ...
[ "func", "(", "c", "*", "Client", ")", "ProvisioningInfo", "(", "appName", "string", ")", "(", "*", "ProvisioningInfo", ",", "error", ")", "{", "appTag", ",", "err", ":=", "applicationTag", "(", "appName", ")", "\n", "if", "err", "!=", "nil", "{", "retu...
// ProvisioningInfo returns the provisioning info for the specified CAAS // application in the current model.
[ "ProvisioningInfo", "returns", "the", "provisioning", "info", "for", "the", "specified", "CAAS", "application", "in", "the", "current", "model", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/caasunitprovisioner/client.go#L164-L212
154,758
juju/juju
api/caasunitprovisioner/client.go
maybeNotFound
func maybeNotFound(err *params.Error) error { if err == nil || !params.IsCodeNotFound(err) { return err } return errors.NewNotFound(err, "") }
go
func maybeNotFound(err *params.Error) error { if err == nil || !params.IsCodeNotFound(err) { return err } return errors.NewNotFound(err, "") }
[ "func", "maybeNotFound", "(", "err", "*", "params", ".", "Error", ")", "error", "{", "if", "err", "==", "nil", "||", "!", "params", ".", "IsCodeNotFound", "(", "err", ")", "{", "return", "err", "\n", "}", "\n", "return", "errors", ".", "NewNotFound", ...
// maybeNotFound returns an error satisfying errors.IsNotFound // if the supplied error has a CodeNotFound error.
[ "maybeNotFound", "returns", "an", "error", "satisfying", "errors", ".", "IsNotFound", "if", "the", "supplied", "error", "has", "a", "CodeNotFound", "error", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/caasunitprovisioner/client.go#L272-L277
154,759
juju/juju
api/caasunitprovisioner/client.go
UpdateUnits
func (c *Client) UpdateUnits(arg params.UpdateApplicationUnits) error { var result params.ErrorResults args := params.UpdateApplicationUnitArgs{Args: []params.UpdateApplicationUnits{arg}} err := c.facade.FacadeCall("UpdateApplicationsUnits", args, &result) if err != nil { return errors.Trace(err) } if len(resul...
go
func (c *Client) UpdateUnits(arg params.UpdateApplicationUnits) error { var result params.ErrorResults args := params.UpdateApplicationUnitArgs{Args: []params.UpdateApplicationUnits{arg}} err := c.facade.FacadeCall("UpdateApplicationsUnits", args, &result) if err != nil { return errors.Trace(err) } if len(resul...
[ "func", "(", "c", "*", "Client", ")", "UpdateUnits", "(", "arg", "params", ".", "UpdateApplicationUnits", ")", "error", "{", "var", "result", "params", ".", "ErrorResults", "\n", "args", ":=", "params", ".", "UpdateApplicationUnitArgs", "{", "Args", ":", "["...
// UpdateUnits updates the state model to reflect the state of the units // as reported by the cloud.
[ "UpdateUnits", "updates", "the", "state", "model", "to", "reflect", "the", "state", "of", "the", "units", "as", "reported", "by", "the", "cloud", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/caasunitprovisioner/client.go#L281-L295
154,760
juju/juju
api/caasunitprovisioner/client.go
UpdateApplicationService
func (c *Client) UpdateApplicationService(arg params.UpdateApplicationServiceArg) error { var result params.ErrorResults args := params.UpdateApplicationServiceArgs{Args: []params.UpdateApplicationServiceArg{arg}} if err := c.facade.FacadeCall("UpdateApplicationsService", args, &result); err != nil { return errors...
go
func (c *Client) UpdateApplicationService(arg params.UpdateApplicationServiceArg) error { var result params.ErrorResults args := params.UpdateApplicationServiceArgs{Args: []params.UpdateApplicationServiceArg{arg}} if err := c.facade.FacadeCall("UpdateApplicationsService", args, &result); err != nil { return errors...
[ "func", "(", "c", "*", "Client", ")", "UpdateApplicationService", "(", "arg", "params", ".", "UpdateApplicationServiceArg", ")", "error", "{", "var", "result", "params", ".", "ErrorResults", "\n", "args", ":=", "params", ".", "UpdateApplicationServiceArgs", "{", ...
// UpdateApplicationService updates the state model to reflect the state of the application's // service as reported by the cloud.
[ "UpdateApplicationService", "updates", "the", "state", "model", "to", "reflect", "the", "state", "of", "the", "application", "s", "service", "as", "reported", "by", "the", "cloud", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/caasunitprovisioner/client.go#L299-L312
154,761
juju/juju
api/caasunitprovisioner/client.go
SetOperatorStatus
func (c *Client) SetOperatorStatus(appName string, status status.Status, message string, data map[string]interface{}) error { var result params.ErrorResults args := params.SetStatus{Entities: []params.EntityStatusArgs{ {Tag: names.NewApplicationTag(appName).String(), Status: status.String(), Info: message, Data: da...
go
func (c *Client) SetOperatorStatus(appName string, status status.Status, message string, data map[string]interface{}) error { var result params.ErrorResults args := params.SetStatus{Entities: []params.EntityStatusArgs{ {Tag: names.NewApplicationTag(appName).String(), Status: status.String(), Info: message, Data: da...
[ "func", "(", "c", "*", "Client", ")", "SetOperatorStatus", "(", "appName", "string", ",", "status", "status", ".", "Status", ",", "message", "string", ",", "data", "map", "[", "string", "]", "interface", "{", "}", ")", "error", "{", "var", "result", "p...
// SetOperatorStatus updates the provisioning status of an operator.
[ "SetOperatorStatus", "updates", "the", "provisioning", "status", "of", "an", "operator", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/caasunitprovisioner/client.go#L315-L325
154,762
juju/juju
worker/peergrouper/worker.go
New
func New(config Config) (worker.Worker, error) { if err := config.Validate(); err != nil { return nil, errors.Trace(err) } w := &pgWorker{ config: config, machineChanges: make(chan struct{}), machineTrackers: make(map[string]*machineTracker), detailsRequests: make(chan string), } err := cataco...
go
func New(config Config) (worker.Worker, error) { if err := config.Validate(); err != nil { return nil, errors.Trace(err) } w := &pgWorker{ config: config, machineChanges: make(chan struct{}), machineTrackers: make(map[string]*machineTracker), detailsRequests: make(chan string), } err := cataco...
[ "func", "New", "(", "config", "Config", ")", "(", "worker", ".", "Worker", ",", "error", ")", "{", "if", "err", ":=", "config", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Trace", "(", "err", ")"...
// New returns a new worker that maintains the mongo replica set // with respect to the given state.
[ "New", "returns", "a", "new", "worker", "that", "maintains", "the", "mongo", "replica", "set", "with", "respect", "to", "the", "given", "state", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/peergrouper/worker.go#L170-L189
154,763
juju/juju
worker/peergrouper/worker.go
watchForControllerChanges
func (w *pgWorker) watchForControllerChanges() (<-chan struct{}, error) { controllerInfoWatcher := w.config.State.WatchControllerInfo() if err := w.catacomb.Add(controllerInfoWatcher); err != nil { return nil, errors.Trace(err) } controllerStatusWatcher := w.config.State.WatchControllerStatusChanges() if err :=...
go
func (w *pgWorker) watchForControllerChanges() (<-chan struct{}, error) { controllerInfoWatcher := w.config.State.WatchControllerInfo() if err := w.catacomb.Add(controllerInfoWatcher); err != nil { return nil, errors.Trace(err) } controllerStatusWatcher := w.config.State.WatchControllerStatusChanges() if err :=...
[ "func", "(", "w", "*", "pgWorker", ")", "watchForControllerChanges", "(", ")", "(", "<-", "chan", "struct", "{", "}", ",", "error", ")", "{", "controllerInfoWatcher", ":=", "w", ".", "config", ".", "State", ".", "WatchControllerInfo", "(", ")", "\n", "if...
// watchForControllerChanges starts two watchers for changes to controller // info and status. // It returns a channel which will receive events if any of the watchers fires.
[ "watchForControllerChanges", "starts", "two", "watchers", "for", "changes", "to", "controller", "info", "and", "status", ".", "It", "returns", "a", "channel", "which", "will", "receive", "events", "if", "any", "of", "the", "watchers", "fires", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/peergrouper/worker.go#L317-L342
154,764
juju/juju
worker/peergrouper/worker.go
watchForConfigChanges
func (w *pgWorker) watchForConfigChanges() (<-chan struct{}, error) { controllerConfigWatcher := w.config.State.WatchControllerConfig() if err := w.catacomb.Add(controllerConfigWatcher); err != nil { return nil, errors.Trace(err) } return controllerConfigWatcher.Changes(), nil }
go
func (w *pgWorker) watchForConfigChanges() (<-chan struct{}, error) { controllerConfigWatcher := w.config.State.WatchControllerConfig() if err := w.catacomb.Add(controllerConfigWatcher); err != nil { return nil, errors.Trace(err) } return controllerConfigWatcher.Changes(), nil }
[ "func", "(", "w", "*", "pgWorker", ")", "watchForConfigChanges", "(", ")", "(", "<-", "chan", "struct", "{", "}", ",", "error", ")", "{", "controllerConfigWatcher", ":=", "w", ".", "config", ".", "State", ".", "WatchControllerConfig", "(", ")", "\n", "if...
// watchForConfigChanges starts a watcher for changes to controller config. // It returns a channel which will receive events if the watcher fires. // This is separate from watchForControllerChanges because of the worker loop // logic. If controller machines have not changed, then further processing // does not occur, ...
[ "watchForConfigChanges", "starts", "a", "watcher", "for", "changes", "to", "controller", "config", ".", "It", "returns", "a", "channel", "which", "will", "receive", "events", "if", "the", "watcher", "fires", ".", "This", "is", "separate", "from", "watchForContro...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/peergrouper/worker.go#L351-L357
154,765
juju/juju
worker/peergrouper/worker.go
updateControllerMachines
func (w *pgWorker) updateControllerMachines() (bool, error) { info, err := w.config.State.ControllerInfo() if err != nil { return false, fmt.Errorf("cannot get controller info: %v", err) } logger.Debugf("controller machines in state: %#v", info.MachineIds) changed := false // Stop machine goroutines that no l...
go
func (w *pgWorker) updateControllerMachines() (bool, error) { info, err := w.config.State.ControllerInfo() if err != nil { return false, fmt.Errorf("cannot get controller info: %v", err) } logger.Debugf("controller machines in state: %#v", info.MachineIds) changed := false // Stop machine goroutines that no l...
[ "func", "(", "w", "*", "pgWorker", ")", "updateControllerMachines", "(", ")", "(", "bool", ",", "error", ")", "{", "info", ",", "err", ":=", "w", ".", "config", ".", "State", ".", "ControllerInfo", "(", ")", "\n", "if", "err", "!=", "nil", "{", "re...
// updateControllerMachines updates the peergrouper's current list of // controller machines, as well as starting and stopping trackers for // them as they are added and removed.
[ "updateControllerMachines", "updates", "the", "peergrouper", "s", "current", "list", "of", "controller", "machines", "as", "well", "as", "starting", "and", "stopping", "trackers", "for", "them", "as", "they", "are", "added", "and", "removed", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/peergrouper/worker.go#L362-L424
154,766
juju/juju
worker/peergrouper/worker.go
apiServerHostPorts
func (w *pgWorker) apiServerHostPorts() map[string][]network.HostPort { servers := make(map[string][]network.HostPort) for _, m := range w.machineTrackers { hostPorts := network.AddressesWithPort(m.Addresses(), w.config.APIPort) if len(hostPorts) == 0 { continue } servers[m.Id()] = hostPorts } return ser...
go
func (w *pgWorker) apiServerHostPorts() map[string][]network.HostPort { servers := make(map[string][]network.HostPort) for _, m := range w.machineTrackers { hostPorts := network.AddressesWithPort(m.Addresses(), w.config.APIPort) if len(hostPorts) == 0 { continue } servers[m.Id()] = hostPorts } return ser...
[ "func", "(", "w", "*", "pgWorker", ")", "apiServerHostPorts", "(", ")", "map", "[", "string", "]", "[", "]", "network", ".", "HostPort", "{", "servers", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "network", ".", "HostPort", ")", "\n", ...
// apiServerHostPorts returns the host-ports for each apiserver machine.
[ "apiServerHostPorts", "returns", "the", "host", "-", "ports", "for", "each", "apiserver", "machine", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/peergrouper/worker.go#L448-L458
154,767
juju/juju
worker/peergrouper/worker.go
peerGroupInfo
func (w *pgWorker) peerGroupInfo() (*peerGroupInfo, error) { sts, err := w.config.MongoSession.CurrentStatus() if err != nil { return nil, errors.Annotate(err, "cannot get replica set status") } members, err := w.config.MongoSession.CurrentMembers() if err != nil { return nil, errors.Annotate(err, "cannot get...
go
func (w *pgWorker) peerGroupInfo() (*peerGroupInfo, error) { sts, err := w.config.MongoSession.CurrentStatus() if err != nil { return nil, errors.Annotate(err, "cannot get replica set status") } members, err := w.config.MongoSession.CurrentMembers() if err != nil { return nil, errors.Annotate(err, "cannot get...
[ "func", "(", "w", "*", "pgWorker", ")", "peerGroupInfo", "(", ")", "(", "*", "peerGroupInfo", ",", "error", ")", "{", "sts", ",", "err", ":=", "w", ".", "config", ".", "MongoSession", ".", "CurrentStatus", "(", ")", "\n", "if", "err", "!=", "nil", ...
// peerGroupInfo collates current session information about the // mongo peer group with information from state machines.
[ "peerGroupInfo", "collates", "current", "session", "information", "about", "the", "mongo", "peer", "group", "with", "information", "from", "state", "machines", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/peergrouper/worker.go#L662-L680
154,768
juju/juju
worker/peergrouper/worker.go
setHasVote
func setHasVote(ms []*machineTracker, hasVote bool) error { if len(ms) == 0 { return nil } logger.Infof("setting HasVote=%v on machines %v", hasVote, ms) for _, m := range ms { if err := m.stm.SetHasVote(hasVote); err != nil { return fmt.Errorf("cannot set voting status of %q to %v: %v", m.Id(), hasVote, err...
go
func setHasVote(ms []*machineTracker, hasVote bool) error { if len(ms) == 0 { return nil } logger.Infof("setting HasVote=%v on machines %v", hasVote, ms) for _, m := range ms { if err := m.stm.SetHasVote(hasVote); err != nil { return fmt.Errorf("cannot set voting status of %q to %v: %v", m.Id(), hasVote, err...
[ "func", "setHasVote", "(", "ms", "[", "]", "*", "machineTracker", ",", "hasVote", "bool", ")", "error", "{", "if", "len", "(", "ms", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "logger", ".", "Infof", "(", "\"", "\"", ",", "hasVote", "...
// setHasVote sets the HasVote status of all the given machines to hasVote.
[ "setHasVote", "sets", "the", "HasVote", "status", "of", "all", "the", "given", "machines", "to", "hasVote", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/peergrouper/worker.go#L693-L704
154,769
juju/juju
cmd/juju/application/config.go
getAPI
func (c *configCommand) getAPI() (applicationAPI, error) { if c.api != nil { return c.api, nil } root, err := c.NewAPIRoot() if err != nil { return nil, errors.Trace(err) } client := application.NewClient(root) return client, nil }
go
func (c *configCommand) getAPI() (applicationAPI, error) { if c.api != nil { return c.api, nil } root, err := c.NewAPIRoot() if err != nil { return nil, errors.Trace(err) } client := application.NewClient(root) return client, nil }
[ "func", "(", "c", "*", "configCommand", ")", "getAPI", "(", ")", "(", "applicationAPI", ",", "error", ")", "{", "if", "c", ".", "api", "!=", "nil", "{", "return", "c", ".", "api", ",", "nil", "\n", "}", "\n", "root", ",", "err", ":=", "c", ".",...
// getAPI either uses the fake API set at test time or that is nil, gets a real // API and sets that as the API.
[ "getAPI", "either", "uses", "the", "fake", "API", "set", "at", "test", "time", "or", "that", "is", "nil", "gets", "a", "real", "API", "and", "sets", "that", "as", "the", "API", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/application/config.go#L136-L146
154,770
juju/juju
cmd/juju/application/config.go
resetConfig
func (c *configCommand) resetConfig(client applicationAPI, ctx *cmd.Context) error { var err error if client.BestAPIVersion() < 6 { err = client.Unset(c.applicationName, c.resetKeys) } else { err = client.UnsetApplicationConfig(c.branchName, c.applicationName, c.resetKeys) } return block.ProcessBlockedError(er...
go
func (c *configCommand) resetConfig(client applicationAPI, ctx *cmd.Context) error { var err error if client.BestAPIVersion() < 6 { err = client.Unset(c.applicationName, c.resetKeys) } else { err = client.UnsetApplicationConfig(c.branchName, c.applicationName, c.resetKeys) } return block.ProcessBlockedError(er...
[ "func", "(", "c", "*", "configCommand", ")", "resetConfig", "(", "client", "applicationAPI", ",", "ctx", "*", "cmd", ".", "Context", ")", "error", "{", "var", "err", "error", "\n", "if", "client", ".", "BestAPIVersion", "(", ")", "<", "6", "{", "err", ...
// resetConfig is the run action when we are resetting attributes.
[ "resetConfig", "is", "the", "run", "action", "when", "we", "are", "resetting", "attributes", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/application/config.go#L317-L325
154,771
juju/juju
cmd/juju/application/config.go
setConfig
func (c *configCommand) setConfig(client applicationAPI, ctx *cmd.Context) error { if c.useFile { return c.setConfigFromFile(client, ctx) } settings, err := c.validateValues(ctx) if err != nil { return errors.Trace(err) } result, err := client.Get(c.branchName, c.applicationName) if err != nil { return e...
go
func (c *configCommand) setConfig(client applicationAPI, ctx *cmd.Context) error { if c.useFile { return c.setConfigFromFile(client, ctx) } settings, err := c.validateValues(ctx) if err != nil { return errors.Trace(err) } result, err := client.Get(c.branchName, c.applicationName) if err != nil { return e...
[ "func", "(", "c", "*", "configCommand", ")", "setConfig", "(", "client", "applicationAPI", ",", "ctx", "*", "cmd", ".", "Context", ")", "error", "{", "if", "c", ".", "useFile", "{", "return", "c", ".", "setConfigFromFile", "(", "client", ",", "ctx", ")...
// setConfig is the run action when we are setting new attribute values as args // or as a file passed in.
[ "setConfig", "is", "the", "run", "action", "when", "we", "are", "setting", "new", "attribute", "values", "as", "args", "or", "as", "a", "file", "passed", "in", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/application/config.go#L329-L362
154,772
juju/juju
cmd/juju/application/config.go
setConfigFromFile
func (c *configCommand) setConfigFromFile(client applicationAPI, ctx *cmd.Context) error { var ( b []byte err error ) if c.configFile.Path == "-" { buf := bytes.Buffer{} if _, err := buf.ReadFrom(ctx.Stdin); err != nil { return errors.Trace(err) } b = buf.Bytes() } else { b, err = c.configFile.Re...
go
func (c *configCommand) setConfigFromFile(client applicationAPI, ctx *cmd.Context) error { var ( b []byte err error ) if c.configFile.Path == "-" { buf := bytes.Buffer{} if _, err := buf.ReadFrom(ctx.Stdin); err != nil { return errors.Trace(err) } b = buf.Bytes() } else { b, err = c.configFile.Re...
[ "func", "(", "c", "*", "configCommand", ")", "setConfigFromFile", "(", "client", "applicationAPI", ",", "ctx", "*", "cmd", ".", "Context", ")", "error", "{", "var", "(", "b", "[", "]", "byte", "\n", "err", "error", "\n", ")", "\n", "if", "c", ".", ...
// setConfigFromFile sets the application configuration from settings passed // in a YAML file.
[ "setConfigFromFile", "sets", "the", "application", "configuration", "from", "settings", "passed", "in", "a", "YAML", "file", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/application/config.go#L366-L391
154,773
juju/juju
cmd/juju/application/config.go
getConfig
func (c *configCommand) getConfig(client applicationAPI, ctx *cmd.Context) error { results, err := client.Get(c.branchName, c.applicationName) if err != nil { return err } if len(c.keys) == 1 { logger.Infof("format %v is ignored", c.out.Name()) key := c.keys[0] info, found := results.CharmConfig[key].(map[s...
go
func (c *configCommand) getConfig(client applicationAPI, ctx *cmd.Context) error { results, err := client.Get(c.branchName, c.applicationName) if err != nil { return err } if len(c.keys) == 1 { logger.Infof("format %v is ignored", c.out.Name()) key := c.keys[0] info, found := results.CharmConfig[key].(map[s...
[ "func", "(", "c", "*", "configCommand", ")", "getConfig", "(", "client", "applicationAPI", ",", "ctx", "*", "cmd", ".", "Context", ")", "error", "{", "results", ",", "err", ":=", "client", ".", "Get", "(", "c", ".", "branchName", ",", "c", ".", "appl...
// getConfig is the run action to return one or all configuration values.
[ "getConfig", "is", "the", "run", "action", "to", "return", "one", "or", "all", "configuration", "values", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/application/config.go#L394-L440
154,774
juju/juju
cmd/juju/application/config.go
validateValues
func (c *configCommand) validateValues(ctx *cmd.Context) (map[string]string, error) { settings := map[string]string{} for k, v := range c.values { //empty string is also valid as a setting value if v == "" { settings[k] = v continue } if v[0] != '@' { if !utf8.ValidString(v) { return nil, errors...
go
func (c *configCommand) validateValues(ctx *cmd.Context) (map[string]string, error) { settings := map[string]string{} for k, v := range c.values { //empty string is also valid as a setting value if v == "" { settings[k] = v continue } if v[0] != '@' { if !utf8.ValidString(v) { return nil, errors...
[ "func", "(", "c", "*", "configCommand", ")", "validateValues", "(", "ctx", "*", "cmd", ".", "Context", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "settings", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "fo...
// validateValues reads the values provided as args and validates that they are // valid UTF-8.
[ "validateValues", "reads", "the", "values", "provided", "as", "args", "and", "validates", "that", "they", "are", "valid", "UTF", "-", "8", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/application/config.go#L444-L470
154,775
juju/juju
cmd/juju/application/config.go
readValue
func readValue(ctx *cmd.Context, filename string) (string, error) { absFilename := ctx.AbsPath(filename) fi, err := os.Stat(absFilename) if err != nil { return "", errors.Errorf("cannot read option from file %q: %v", filename, err) } if fi.Size() > maxValueSize { return "", errors.Errorf("size of option file i...
go
func readValue(ctx *cmd.Context, filename string) (string, error) { absFilename := ctx.AbsPath(filename) fi, err := os.Stat(absFilename) if err != nil { return "", errors.Errorf("cannot read option from file %q: %v", filename, err) } if fi.Size() > maxValueSize { return "", errors.Errorf("size of option file i...
[ "func", "readValue", "(", "ctx", "*", "cmd", ".", "Context", ",", "filename", "string", ")", "(", "string", ",", "error", ")", "{", "absFilename", ":=", "ctx", ".", "AbsPath", "(", "filename", ")", "\n", "fi", ",", "err", ":=", "os", ".", "Stat", "...
// readValue reads the value of an option out of the named file. // An empty content is valid, like in parsing the options. The upper // size is 5M.
[ "readValue", "reads", "the", "value", "of", "an", "option", "out", "of", "the", "named", "file", ".", "An", "empty", "content", "is", "valid", "like", "in", "parsing", "the", "options", ".", "The", "upper", "size", "is", "5M", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/application/config.go#L475-L489
154,776
juju/juju
mongo/mongometrics/dialmetrics.go
NewDialCollector
func NewDialCollector() *DialCollector { return &DialCollector{ dialsTotal: prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: "juju", Name: "mongo_dials_total", Help: "Total number of MongoDB server dials.", }, dialLabels), dialDuration: prometheus.NewSummaryVec(prometheus.SummaryOp...
go
func NewDialCollector() *DialCollector { return &DialCollector{ dialsTotal: prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: "juju", Name: "mongo_dials_total", Help: "Total number of MongoDB server dials.", }, dialLabels), dialDuration: prometheus.NewSummaryVec(prometheus.SummaryOp...
[ "func", "NewDialCollector", "(", ")", "*", "DialCollector", "{", "return", "&", "DialCollector", "{", "dialsTotal", ":", "prometheus", ".", "NewCounterVec", "(", "prometheus", ".", "CounterOpts", "{", "Namespace", ":", "\"", "\"", ",", "Name", ":", "\"", "\"...
// NewDialCollector returns a new DialCollector.
[ "NewDialCollector", "returns", "a", "new", "DialCollector", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/mongo/mongometrics/dialmetrics.go#L28-L42
154,777
juju/juju
mongo/mongometrics/dialmetrics.go
PostDialServer
func (c *DialCollector) PostDialServer(server string, duration time.Duration, dialErr error) { var failedValue, timeoutValue string if dialErr != nil { // TODO(axw) attempt to distinguish more types of // errors, e.g. failure due to TLS handshake vs. net // dial. failedValue = "failed" if err, ok := dialErr...
go
func (c *DialCollector) PostDialServer(server string, duration time.Duration, dialErr error) { var failedValue, timeoutValue string if dialErr != nil { // TODO(axw) attempt to distinguish more types of // errors, e.g. failure due to TLS handshake vs. net // dial. failedValue = "failed" if err, ok := dialErr...
[ "func", "(", "c", "*", "DialCollector", ")", "PostDialServer", "(", "server", "string", ",", "duration", "time", ".", "Duration", ",", "dialErr", "error", ")", "{", "var", "failedValue", ",", "timeoutValue", "string", "\n", "if", "dialErr", "!=", "nil", "{...
// PostDialServer is a function that may be used in // mongo.DialOpts.PostDialServer, to update metrics.
[ "PostDialServer", "is", "a", "function", "that", "may", "be", "used", "in", "mongo", ".", "DialOpts", ".", "PostDialServer", "to", "update", "metrics", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/mongo/mongometrics/dialmetrics.go#L58-L81
154,778
juju/juju
worker/logsender/worker.go
New
func New(logs LogRecordCh, logSenderAPI *logsender.API) worker.Worker { loop := func(stop <-chan struct{}) error { // It has been observed that sometimes the logsender.API gets wedged // attempting to get the LogWriter while the agent is being torn down, // and the call to logSenderAPI.LogWriter() doesn't return...
go
func New(logs LogRecordCh, logSenderAPI *logsender.API) worker.Worker { loop := func(stop <-chan struct{}) error { // It has been observed that sometimes the logsender.API gets wedged // attempting to get the LogWriter while the agent is being torn down, // and the call to logSenderAPI.LogWriter() doesn't return...
[ "func", "New", "(", "logs", "LogRecordCh", ",", "logSenderAPI", "*", "logsender", ".", "API", ")", "worker", ".", "Worker", "{", "loop", ":=", "func", "(", "stop", "<-", "chan", "struct", "{", "}", ")", "error", "{", "// It has been observed that sometimes t...
// New starts a logsender worker which reads log message structs from // a channel and sends them to the JES via the logsink API.
[ "New", "starts", "a", "logsender", "worker", "which", "reads", "log", "message", "structs", "from", "a", "channel", "and", "sends", "them", "to", "the", "JES", "via", "the", "logsink", "API", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/logsender/worker.go#L22-L104
154,779
juju/juju
state/block.go
ToParams
func (t BlockType) ToParams() multiwatcher.BlockType { if jujuBlock, ok := typeNames[t]; ok { return jujuBlock } panic(fmt.Sprintf("unknown block type %d", int(t))) }
go
func (t BlockType) ToParams() multiwatcher.BlockType { if jujuBlock, ok := typeNames[t]; ok { return jujuBlock } panic(fmt.Sprintf("unknown block type %d", int(t))) }
[ "func", "(", "t", "BlockType", ")", "ToParams", "(", ")", "multiwatcher", ".", "BlockType", "{", "if", "jujuBlock", ",", "ok", ":=", "typeNames", "[", "t", "]", ";", "ok", "{", "return", "jujuBlock", "\n", "}", "\n", "panic", "(", "fmt", ".", "Sprint...
// ToParams returns the type as multiwatcher.BlockType.
[ "ToParams", "returns", "the", "type", "as", "multiwatcher", ".", "BlockType", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/block.go#L78-L83
154,780
juju/juju
state/block.go
MigrationValue
func (t BlockType) MigrationValue() string { if value, ok := blockMigrationValue[t]; ok { return value } return "unknown" }
go
func (t BlockType) MigrationValue() string { if value, ok := blockMigrationValue[t]; ok { return value } return "unknown" }
[ "func", "(", "t", "BlockType", ")", "MigrationValue", "(", ")", "string", "{", "if", "value", ",", "ok", ":=", "blockMigrationValue", "[", "t", "]", ";", "ok", "{", "return", "value", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
// MigrationValue converts the block type value into a useful human readable // string for model migration.
[ "MigrationValue", "converts", "the", "block", "type", "value", "into", "a", "useful", "human", "readable", "string", "for", "model", "migration", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/block.go#L92-L97
154,781
juju/juju
state/block.go
ParseBlockType
func ParseBlockType(str string) BlockType { for _, one := range AllTypes() { if one.String() == str { return one } } panic(fmt.Sprintf("unknown block type %v", str)) }
go
func ParseBlockType(str string) BlockType { for _, one := range AllTypes() { if one.String() == str { return one } } panic(fmt.Sprintf("unknown block type %v", str)) }
[ "func", "ParseBlockType", "(", "str", "string", ")", "BlockType", "{", "for", "_", ",", "one", ":=", "range", "AllTypes", "(", ")", "{", "if", "one", ".", "String", "(", ")", "==", "str", "{", "return", "one", "\n", "}", "\n", "}", "\n", "panic", ...
// ParseBlockType returns BlockType from humanly readable type representation.
[ "ParseBlockType", "returns", "BlockType", "from", "humanly", "readable", "type", "representation", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/block.go#L100-L107
154,782
juju/juju
state/block.go
Tag
func (b *block) Tag() (names.Tag, error) { tag, err := names.ParseTag(b.doc.Tag) if err != nil { return nil, errors.Annotatef(err, "getting block information") } return tag, nil }
go
func (b *block) Tag() (names.Tag, error) { tag, err := names.ParseTag(b.doc.Tag) if err != nil { return nil, errors.Annotatef(err, "getting block information") } return tag, nil }
[ "func", "(", "b", "*", "block", ")", "Tag", "(", ")", "(", "names", ".", "Tag", ",", "error", ")", "{", "tag", ",", "err", ":=", "names", ".", "ParseTag", "(", "b", ".", "doc", ".", "Tag", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// Tag is part of the state.Block interface.
[ "Tag", "is", "part", "of", "the", "state", ".", "Block", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/block.go#L147-L153
154,783
juju/juju
state/block.go
SwitchBlockOn
func (st *State) SwitchBlockOn(t BlockType, msg string) error { return setModelBlock(st, t, msg) }
go
func (st *State) SwitchBlockOn(t BlockType, msg string) error { return setModelBlock(st, t, msg) }
[ "func", "(", "st", "*", "State", ")", "SwitchBlockOn", "(", "t", "BlockType", ",", "msg", "string", ")", "error", "{", "return", "setModelBlock", "(", "st", ",", "t", ",", "msg", ")", "\n", "}" ]
// SwitchBlockOn enables block of specified type for the // current model.
[ "SwitchBlockOn", "enables", "block", "of", "specified", "type", "for", "the", "current", "model", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/block.go#L162-L164
154,784
juju/juju
state/block.go
GetBlockForType
func (st *State) GetBlockForType(t BlockType) (Block, bool, error) { return getBlockForType(st, t) }
go
func (st *State) GetBlockForType(t BlockType) (Block, bool, error) { return getBlockForType(st, t) }
[ "func", "(", "st", "*", "State", ")", "GetBlockForType", "(", "t", "BlockType", ")", "(", "Block", ",", "bool", ",", "error", ")", "{", "return", "getBlockForType", "(", "st", ",", "t", ")", "\n", "}" ]
// GetBlockForType returns the Block of the specified type for the current model // where // not found -> nil, false, nil // found -> block, true, nil // error -> nil, false, err
[ "GetBlockForType", "returns", "the", "Block", "of", "the", "specified", "type", "for", "the", "current", "model", "where", "not", "found", "-", ">", "nil", "false", "nil", "found", "-", ">", "block", "true", "nil", "error", "-", ">", "nil", "false", "err...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/block.go#L177-L179
154,785
juju/juju
state/block.go
AllBlocks
func (st *State) AllBlocks() ([]Block, error) { blocksCollection, closer := st.db().GetCollection(blocksC) defer closer() var bdocs []blockDoc err := blocksCollection.Find(nil).All(&bdocs) if err != nil { return nil, errors.Annotatef(err, "cannot get all blocks") } blocks := make([]Block, len(bdocs)) for i, ...
go
func (st *State) AllBlocks() ([]Block, error) { blocksCollection, closer := st.db().GetCollection(blocksC) defer closer() var bdocs []blockDoc err := blocksCollection.Find(nil).All(&bdocs) if err != nil { return nil, errors.Annotatef(err, "cannot get all blocks") } blocks := make([]Block, len(bdocs)) for i, ...
[ "func", "(", "st", "*", "State", ")", "AllBlocks", "(", ")", "(", "[", "]", "Block", ",", "error", ")", "{", "blocksCollection", ",", "closer", ":=", "st", ".", "db", "(", ")", ".", "GetCollection", "(", "blocksC", ")", "\n", "defer", "closer", "("...
// AllBlocks returns all blocks in the model.
[ "AllBlocks", "returns", "all", "blocks", "in", "the", "model", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/block.go#L199-L213
154,786
juju/juju
state/block.go
AllBlocksForController
func (st *State) AllBlocksForController() ([]Block, error) { blocksCollection, closer := st.db().GetRawCollection(blocksC) defer closer() var bdocs []blockDoc err := blocksCollection.Find(nil).All(&bdocs) if err != nil { return nil, errors.Annotate(err, "cannot get all blocks") } blocks := make([]Block, len(b...
go
func (st *State) AllBlocksForController() ([]Block, error) { blocksCollection, closer := st.db().GetRawCollection(blocksC) defer closer() var bdocs []blockDoc err := blocksCollection.Find(nil).All(&bdocs) if err != nil { return nil, errors.Annotate(err, "cannot get all blocks") } blocks := make([]Block, len(b...
[ "func", "(", "st", "*", "State", ")", "AllBlocksForController", "(", ")", "(", "[", "]", "Block", ",", "error", ")", "{", "blocksCollection", ",", "closer", ":=", "st", ".", "db", "(", ")", ".", "GetRawCollection", "(", "blocksC", ")", "\n", "defer", ...
// AllBlocksForController returns all blocks in any models on // the controller.
[ "AllBlocksForController", "returns", "all", "blocks", "in", "any", "models", "on", "the", "controller", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/block.go#L217-L232
154,787
juju/juju
state/block.go
setModelBlock
func setModelBlock(mb modelBackend, t BlockType, msg string) error { buildTxn := func(attempt int) ([]txn.Op, error) { block, exists, err := getBlockForType(mb, t) if err != nil { return nil, errors.Trace(err) } // Cannot create blocks of the same type more than once per model. // Cannot update current bl...
go
func setModelBlock(mb modelBackend, t BlockType, msg string) error { buildTxn := func(attempt int) ([]txn.Op, error) { block, exists, err := getBlockForType(mb, t) if err != nil { return nil, errors.Trace(err) } // Cannot create blocks of the same type more than once per model. // Cannot update current bl...
[ "func", "setModelBlock", "(", "mb", "modelBackend", ",", "t", "BlockType", ",", "msg", "string", ")", "error", "{", "buildTxn", ":=", "func", "(", "attempt", "int", ")", "(", "[", "]", "txn", ".", "Op", ",", "error", ")", "{", "block", ",", "exists",...
// setModelBlock updates the blocks collection with the // specified block. // Only one instance of each block type can exist in model.
[ "setModelBlock", "updates", "the", "blocks", "collection", "with", "the", "specified", "block", ".", "Only", "one", "instance", "of", "each", "block", "type", "can", "exist", "in", "model", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/block.go#L260-L274
154,788
juju/juju
state/block.go
newBlockId
func newBlockId(mb modelBackend) (string, error) { seq, err := sequence(mb, "block") if err != nil { return "", errors.Trace(err) } return fmt.Sprint(seq), nil }
go
func newBlockId(mb modelBackend) (string, error) { seq, err := sequence(mb, "block") if err != nil { return "", errors.Trace(err) } return fmt.Sprint(seq), nil }
[ "func", "newBlockId", "(", "mb", "modelBackend", ")", "(", "string", ",", "error", ")", "{", "seq", ",", "err", ":=", "sequence", "(", "mb", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "errors", ".", "Tra...
// newBlockId returns a sequential block id for this model.
[ "newBlockId", "returns", "a", "sequential", "block", "id", "for", "this", "model", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/block.go#L277-L283
154,789
juju/juju
state/bakerystorage/storage.go
MongoIndexes
func MongoIndexes() []mgo.Index { // Note: this second-guesses the underlying document format // used by bakery's mgostorage package. // TODO change things so that we can use EnsureIndex instead. return []mgo.Index{{ Key: []string{"-created"}, }, { Key: []string{"expires"}, ExpireAfter: time.Second, ...
go
func MongoIndexes() []mgo.Index { // Note: this second-guesses the underlying document format // used by bakery's mgostorage package. // TODO change things so that we can use EnsureIndex instead. return []mgo.Index{{ Key: []string{"-created"}, }, { Key: []string{"expires"}, ExpireAfter: time.Second, ...
[ "func", "MongoIndexes", "(", ")", "[", "]", "mgo", ".", "Index", "{", "// Note: this second-guesses the underlying document format", "// used by bakery's mgostorage package.", "// TODO change things so that we can use EnsureIndex instead.", "return", "[", "]", "mgo", ".", "Index"...
// MongoIndexes returns the indexes to apply to the MongoDB collection.
[ "MongoIndexes", "returns", "the", "indexes", "to", "apply", "to", "the", "MongoDB", "collection", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/bakerystorage/storage.go#L17-L27
154,790
juju/juju
state/bakerystorage/storage.go
ExpireAfter
func (s *storage) ExpireAfter(expireAfter time.Duration) ExpirableStorage { newStorage := *s newStorage.expireAfter = expireAfter return &newStorage }
go
func (s *storage) ExpireAfter(expireAfter time.Duration) ExpirableStorage { newStorage := *s newStorage.expireAfter = expireAfter return &newStorage }
[ "func", "(", "s", "*", "storage", ")", "ExpireAfter", "(", "expireAfter", "time", ".", "Duration", ")", "ExpirableStorage", "{", "newStorage", ":=", "*", "s", "\n", "newStorage", ".", "expireAfter", "=", "expireAfter", "\n", "return", "&", "newStorage", "\n"...
// ExpireAfter implements ExpirableStorage.ExpireAfter.
[ "ExpireAfter", "implements", "ExpirableStorage", ".", "ExpireAfter", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/bakerystorage/storage.go#L46-L50
154,791
juju/juju
state/bakerystorage/storage.go
RootKey
func (s *storage) RootKey() ([]byte, []byte, error) { storage, closer := s.getStorage() defer closer() return storage.RootKey() }
go
func (s *storage) RootKey() ([]byte, []byte, error) { storage, closer := s.getStorage() defer closer() return storage.RootKey() }
[ "func", "(", "s", "*", "storage", ")", "RootKey", "(", ")", "(", "[", "]", "byte", ",", "[", "]", "byte", ",", "error", ")", "{", "storage", ",", "closer", ":=", "s", ".", "getStorage", "(", ")", "\n", "defer", "closer", "(", ")", "\n", "return...
// RootKey implements Storage.RootKey
[ "RootKey", "implements", "Storage", ".", "RootKey" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/bakerystorage/storage.go#L53-L57
154,792
juju/juju
state/bakerystorage/storage.go
legacyGet
func (s *storage) legacyGet(location []byte) ([]byte, error) { coll, closer := s.config.GetCollection() defer closer() var i storageDoc err := coll.FindId(string(location)).One(&i) if err != nil { if err == mgo.ErrNotFound { return nil, bakery.ErrNotFound } return nil, errors.Annotatef(err, "cannot get i...
go
func (s *storage) legacyGet(location []byte) ([]byte, error) { coll, closer := s.config.GetCollection() defer closer() var i storageDoc err := coll.FindId(string(location)).One(&i) if err != nil { if err == mgo.ErrNotFound { return nil, bakery.ErrNotFound } return nil, errors.Annotatef(err, "cannot get i...
[ "func", "(", "s", "*", "storage", ")", "legacyGet", "(", "location", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "coll", ",", "closer", ":=", "s", ".", "config", ".", "GetCollection", "(", ")", "\n", "defer", "closer", "...
// legacyGet is attempted as the id we're looking for was created in a previous // version of Juju while using v1 versions of the macaroon-bakery.
[ "legacyGet", "is", "attempted", "as", "the", "id", "we", "re", "looking", "for", "was", "created", "in", "a", "previous", "version", "of", "Juju", "while", "using", "v1", "versions", "of", "the", "macaroon", "-", "bakery", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/bakerystorage/storage.go#L80-L98
154,793
juju/juju
network/debinterfaces/format.go
FlattenStanzas
func FlattenStanzas(stanzas []Stanza) []Stanza { result := make([]Stanza, 0) for _, s := range stanzas { switch v := s.(type) { case SourceStanza: result = append(result, v.Stanzas...) case SourceDirectoryStanza: result = append(result, v.Stanzas...) default: result = append(result, v) } } retu...
go
func FlattenStanzas(stanzas []Stanza) []Stanza { result := make([]Stanza, 0) for _, s := range stanzas { switch v := s.(type) { case SourceStanza: result = append(result, v.Stanzas...) case SourceDirectoryStanza: result = append(result, v.Stanzas...) default: result = append(result, v) } } retu...
[ "func", "FlattenStanzas", "(", "stanzas", "[", "]", "Stanza", ")", "[", "]", "Stanza", "{", "result", ":=", "make", "(", "[", "]", "Stanza", ",", "0", ")", "\n\n", "for", "_", ",", "s", ":=", "range", "stanzas", "{", "switch", "v", ":=", "s", "."...
// FlattenStanzas flattens all stanzas, and recursively for all // 'source' and 'source-directory' stanzas, returning a single slice.
[ "FlattenStanzas", "flattens", "all", "stanzas", "and", "recursively", "for", "all", "source", "and", "source", "-", "directory", "stanzas", "returning", "a", "single", "slice", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/network/debinterfaces/format.go#L13-L28
154,794
juju/juju
network/debinterfaces/format.go
FormatStanzas
func FormatStanzas(stanzas []Stanza, count int) string { var buffer bytes.Buffer for i, s := range stanzas { buffer.WriteString(FormatDefinition(s.Definition(), count)) buffer.WriteString("\n") // If the current stanza is 'auto' and the next one is // 'iface' then don't add an additional blank line // betw...
go
func FormatStanzas(stanzas []Stanza, count int) string { var buffer bytes.Buffer for i, s := range stanzas { buffer.WriteString(FormatDefinition(s.Definition(), count)) buffer.WriteString("\n") // If the current stanza is 'auto' and the next one is // 'iface' then don't add an additional blank line // betw...
[ "func", "FormatStanzas", "(", "stanzas", "[", "]", "Stanza", ",", "count", "int", ")", "string", "{", "var", "buffer", "bytes", ".", "Buffer", "\n\n", "for", "i", ",", "s", ":=", "range", "stanzas", "{", "buffer", ".", "WriteString", "(", "FormatDefiniti...
// FormatStanzas returns a string representing all stanzas // definitions, recursively expanding stanzas found in both source and // source-directory definitions.
[ "FormatStanzas", "returns", "a", "string", "representing", "all", "stanzas", "definitions", "recursively", "expanding", "stanzas", "found", "in", "both", "source", "and", "source", "-", "directory", "definitions", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/network/debinterfaces/format.go#L33-L54
154,795
juju/juju
network/debinterfaces/format.go
FormatDefinition
func FormatDefinition(definition []string, count int) string { var buffer bytes.Buffer spacer := strings.Repeat(" ", count) for i, d := range definition { if i == 0 { buffer.WriteString(d) buffer.WriteString("\n") } else { buffer.WriteString(spacer) buffer.WriteString(d) buffer.WriteString("\n")...
go
func FormatDefinition(definition []string, count int) string { var buffer bytes.Buffer spacer := strings.Repeat(" ", count) for i, d := range definition { if i == 0 { buffer.WriteString(d) buffer.WriteString("\n") } else { buffer.WriteString(spacer) buffer.WriteString(d) buffer.WriteString("\n")...
[ "func", "FormatDefinition", "(", "definition", "[", "]", "string", ",", "count", "int", ")", "string", "{", "var", "buffer", "bytes", ".", "Buffer", "\n\n", "spacer", ":=", "strings", ".", "Repeat", "(", "\"", "\"", ",", "count", ")", "\n\n", "for", "i...
// FormatDefinition formats the complete stanza, indenting any options // with count leading spaces.
[ "FormatDefinition", "formats", "the", "complete", "stanza", "indenting", "any", "options", "with", "count", "leading", "spaces", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/network/debinterfaces/format.go#L58-L75
154,796
juju/juju
core/lxdprofile/validate.go
ValidateLXDProfile
func ValidateLXDProfile(profiler LXDProfiler) error { // if profiler is nil, there is no available profiler to call LXDProfile // then return out early if profiler == nil { return nil } // Profile from the api could be nil, so check that it isn't if profile := profiler.LXDProfile(); profile != nil { err := pr...
go
func ValidateLXDProfile(profiler LXDProfiler) error { // if profiler is nil, there is no available profiler to call LXDProfile // then return out early if profiler == nil { return nil } // Profile from the api could be nil, so check that it isn't if profile := profiler.LXDProfile(); profile != nil { err := pr...
[ "func", "ValidateLXDProfile", "(", "profiler", "LXDProfiler", ")", "error", "{", "// if profiler is nil, there is no available profiler to call LXDProfile", "// then return out early", "if", "profiler", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "// Profile from the ...
// ValidateLXDProfile will validate the profile to determin if the configuration // is valid or not before passing continuing on.
[ "ValidateLXDProfile", "will", "validate", "the", "profile", "to", "determin", "if", "the", "configuration", "is", "valid", "or", "not", "before", "passing", "continuing", "on", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/lxdprofile/validate.go#L43-L55
154,797
juju/juju
core/lxdprofile/validate.go
NotEmpty
func NotEmpty(profiler LXDProfiler) bool { if profile := profiler.LXDProfile(); profile != nil { return !profile.Empty() } return false }
go
func NotEmpty(profiler LXDProfiler) bool { if profile := profiler.LXDProfile(); profile != nil { return !profile.Empty() } return false }
[ "func", "NotEmpty", "(", "profiler", "LXDProfiler", ")", "bool", "{", "if", "profile", ":=", "profiler", ".", "LXDProfile", "(", ")", ";", "profile", "!=", "nil", "{", "return", "!", "profile", ".", "Empty", "(", ")", "\n", "}", "\n", "return", "false"...
// NotEmpty will return false if the profiler containers a profile, that is // empty. If the profile is empty, we'll return false. // If there is no valid profile in the profiler, it will return false
[ "NotEmpty", "will", "return", "false", "if", "the", "profiler", "containers", "a", "profile", "that", "is", "empty", ".", "If", "the", "profile", "is", "empty", "we", "ll", "return", "false", ".", "If", "there", "is", "no", "valid", "profile", "in", "the...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/lxdprofile/validate.go#L60-L65
154,798
juju/juju
payload/context/register.go
NewRegisterCmd
func NewRegisterCmd(ctx HookContext) (*RegisterCmd, error) { return &RegisterCmd{hookContextFunc: componentHookContext(ctx)}, nil }
go
func NewRegisterCmd(ctx HookContext) (*RegisterCmd, error) { return &RegisterCmd{hookContextFunc: componentHookContext(ctx)}, nil }
[ "func", "NewRegisterCmd", "(", "ctx", "HookContext", ")", "(", "*", "RegisterCmd", ",", "error", ")", "{", "return", "&", "RegisterCmd", "{", "hookContextFunc", ":", "componentHookContext", "(", "ctx", ")", "}", ",", "nil", "\n", "}" ]
// NewRegisterCmd returns a new RegisterCmd that wraps the given context.
[ "NewRegisterCmd", "returns", "a", "new", "RegisterCmd", "that", "wraps", "the", "given", "context", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/payload/context/register.go#L19-L21
154,799
juju/juju
apiserver/facades/client/machinemanager/machinemanager.go
NewFacade
func NewFacade(ctx facade.Context) (*MachineManagerAPI, error) { st := ctx.State() model, err := st.Model() if err != nil { return nil, errors.Trace(err) } backend := &stateShim{State: st} storageAccess, err := getStorageState(st) if err != nil { return nil, errors.Trace(err) } pool := &poolShim{ctx.StateP...
go
func NewFacade(ctx facade.Context) (*MachineManagerAPI, error) { st := ctx.State() model, err := st.Model() if err != nil { return nil, errors.Trace(err) } backend := &stateShim{State: st} storageAccess, err := getStorageState(st) if err != nil { return nil, errors.Trace(err) } pool := &poolShim{ctx.StateP...
[ "func", "NewFacade", "(", "ctx", "facade", ".", "Context", ")", "(", "*", "MachineManagerAPI", ",", "error", ")", "{", "st", ":=", "ctx", ".", "State", "(", ")", "\n", "model", ",", "err", ":=", "st", ".", "Model", "(", ")", "\n", "if", "err", "!...
// NewFacade create a new server-side MachineManager API facade. This // is used for facade registration.
[ "NewFacade", "create", "a", "new", "server", "-", "side", "MachineManager", "API", "facade", ".", "This", "is", "used", "for", "facade", "registration", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/machinemanager/machinemanager.go#L45-L58