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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
156,100 | juju/juju | worker/uniter/charm/manifest_deployer.go | startDeploy | func (d *manifestDeployer) startDeploy() error {
logger.Debugf("preparing to deploy charm %q", d.staged.url)
if err := os.MkdirAll(d.charmPath, 0755); err != nil {
return err
}
return WriteCharmURL(d.CharmPath(deployingURLPath), d.staged.url)
} | go | func (d *manifestDeployer) startDeploy() error {
logger.Debugf("preparing to deploy charm %q", d.staged.url)
if err := os.MkdirAll(d.charmPath, 0755); err != nil {
return err
}
return WriteCharmURL(d.CharmPath(deployingURLPath), d.staged.url)
} | [
"func",
"(",
"d",
"*",
"manifestDeployer",
")",
"startDeploy",
"(",
")",
"error",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"d",
".",
"staged",
".",
"url",
")",
"\n",
"if",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"d",
".",
"charmPath",
... | // startDeploy persists the fact that we've started deploying the staged bundle. | [
"startDeploy",
"persists",
"the",
"fact",
"that",
"we",
"ve",
"started",
"deploying",
"the",
"staged",
"bundle",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/charm/manifest_deployer.go#L112-L118 |
156,101 | juju/juju | worker/uniter/charm/manifest_deployer.go | removeDiff | func (d *manifestDeployer) removeDiff(oldManifest, newManifest set.Strings) error {
diff := oldManifest.Difference(newManifest)
for _, path := range diff.SortedValues() {
fullPath := filepath.Join(d.charmPath, filepath.FromSlash(path))
if err := os.RemoveAll(fullPath); err != nil {
return err
}
}
return ni... | go | func (d *manifestDeployer) removeDiff(oldManifest, newManifest set.Strings) error {
diff := oldManifest.Difference(newManifest)
for _, path := range diff.SortedValues() {
fullPath := filepath.Join(d.charmPath, filepath.FromSlash(path))
if err := os.RemoveAll(fullPath); err != nil {
return err
}
}
return ni... | [
"func",
"(",
"d",
"*",
"manifestDeployer",
")",
"removeDiff",
"(",
"oldManifest",
",",
"newManifest",
"set",
".",
"Strings",
")",
"error",
"{",
"diff",
":=",
"oldManifest",
".",
"Difference",
"(",
"newManifest",
")",
"\n",
"for",
"_",
",",
"path",
":=",
... | // removeDiff removes every path in oldManifest that is not present in newManifest. | [
"removeDiff",
"removes",
"every",
"path",
"in",
"oldManifest",
"that",
"is",
"not",
"present",
"in",
"newManifest",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/charm/manifest_deployer.go#L121-L130 |
156,102 | juju/juju | worker/uniter/charm/manifest_deployer.go | finishDeploy | func (d *manifestDeployer) finishDeploy() error {
logger.Debugf("finishing deploy of charm %q", d.staged.url)
oldPath := d.CharmPath(deployingURLPath)
newPath := d.CharmPath(CharmURLPath)
return utils.ReplaceFile(oldPath, newPath)
} | go | func (d *manifestDeployer) finishDeploy() error {
logger.Debugf("finishing deploy of charm %q", d.staged.url)
oldPath := d.CharmPath(deployingURLPath)
newPath := d.CharmPath(CharmURLPath)
return utils.ReplaceFile(oldPath, newPath)
} | [
"func",
"(",
"d",
"*",
"manifestDeployer",
")",
"finishDeploy",
"(",
")",
"error",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"d",
".",
"staged",
".",
"url",
")",
"\n",
"oldPath",
":=",
"d",
".",
"CharmPath",
"(",
"deployingURLPath",
")",
"\... | // finishDeploy persists the fact that we've finished deploying the staged bundle. | [
"finishDeploy",
"persists",
"the",
"fact",
"that",
"we",
"ve",
"finished",
"deploying",
"the",
"staged",
"bundle",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/charm/manifest_deployer.go#L133-L138 |
156,103 | juju/juju | worker/uniter/charm/manifest_deployer.go | storeManifest | func (d *manifestDeployer) storeManifest(url *charm.URL, manifest set.Strings) error {
if err := os.MkdirAll(d.DataPath(manifestsDataPath), 0755); err != nil {
return err
}
name := charm.Quote(url.String())
path := filepath.Join(d.DataPath(manifestsDataPath), name)
return utils.WriteYaml(path, manifest.SortedVal... | go | func (d *manifestDeployer) storeManifest(url *charm.URL, manifest set.Strings) error {
if err := os.MkdirAll(d.DataPath(manifestsDataPath), 0755); err != nil {
return err
}
name := charm.Quote(url.String())
path := filepath.Join(d.DataPath(manifestsDataPath), name)
return utils.WriteYaml(path, manifest.SortedVal... | [
"func",
"(",
"d",
"*",
"manifestDeployer",
")",
"storeManifest",
"(",
"url",
"*",
"charm",
".",
"URL",
",",
"manifest",
"set",
".",
"Strings",
")",
"error",
"{",
"if",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"d",
".",
"DataPath",
"(",
"manifestsDataPa... | // storeManifest stores, into dataPath, the supplied manifest for the supplied charm. | [
"storeManifest",
"stores",
"into",
"dataPath",
"the",
"supplied",
"manifest",
"for",
"the",
"supplied",
"charm",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/charm/manifest_deployer.go#L167-L174 |
156,104 | juju/juju | worker/uniter/charm/manifest_deployer.go | loadManifest | func (d *manifestDeployer) loadManifest(urlFilePath string) (*charm.URL, set.Strings, error) {
url, err := ReadCharmURL(d.CharmPath(urlFilePath))
if err != nil {
return nil, nil, err
}
name := charm.Quote(url.String())
path := filepath.Join(d.DataPath(manifestsDataPath), name)
manifest := []string{}
err = util... | go | func (d *manifestDeployer) loadManifest(urlFilePath string) (*charm.URL, set.Strings, error) {
url, err := ReadCharmURL(d.CharmPath(urlFilePath))
if err != nil {
return nil, nil, err
}
name := charm.Quote(url.String())
path := filepath.Join(d.DataPath(manifestsDataPath), name)
manifest := []string{}
err = util... | [
"func",
"(",
"d",
"*",
"manifestDeployer",
")",
"loadManifest",
"(",
"urlFilePath",
"string",
")",
"(",
"*",
"charm",
".",
"URL",
",",
"set",
".",
"Strings",
",",
"error",
")",
"{",
"url",
",",
"err",
":=",
"ReadCharmURL",
"(",
"d",
".",
"CharmPath",
... | // loadManifest loads, from dataPath, the manifest for the charm identified by the
// identity file at the supplied path within the charm directory. | [
"loadManifest",
"loads",
"from",
"dataPath",
"the",
"manifest",
"for",
"the",
"charm",
"identified",
"by",
"the",
"identity",
"file",
"at",
"the",
"supplied",
"path",
"within",
"the",
"charm",
"directory",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/charm/manifest_deployer.go#L178-L192 |
156,105 | juju/juju | worker/uniter/charm/manifest_deployer.go | CharmPath | func (d *manifestDeployer) CharmPath(path string) string {
return filepath.Join(d.charmPath, path)
} | go | func (d *manifestDeployer) CharmPath(path string) string {
return filepath.Join(d.charmPath, path)
} | [
"func",
"(",
"d",
"*",
"manifestDeployer",
")",
"CharmPath",
"(",
"path",
"string",
")",
"string",
"{",
"return",
"filepath",
".",
"Join",
"(",
"d",
".",
"charmPath",
",",
"path",
")",
"\n",
"}"
] | // CharmPath returns the supplied path joined to the ManifestDeployer's charm directory. | [
"CharmPath",
"returns",
"the",
"supplied",
"path",
"joined",
"to",
"the",
"ManifestDeployer",
"s",
"charm",
"directory",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/charm/manifest_deployer.go#L195-L197 |
156,106 | juju/juju | worker/uniter/charm/manifest_deployer.go | DataPath | func (d *manifestDeployer) DataPath(path string) string {
return filepath.Join(d.dataPath, path)
} | go | func (d *manifestDeployer) DataPath(path string) string {
return filepath.Join(d.dataPath, path)
} | [
"func",
"(",
"d",
"*",
"manifestDeployer",
")",
"DataPath",
"(",
"path",
"string",
")",
"string",
"{",
"return",
"filepath",
".",
"Join",
"(",
"d",
".",
"dataPath",
",",
"path",
")",
"\n",
"}"
] | // DataPath returns the supplied path joined to the ManifestDeployer's data directory. | [
"DataPath",
"returns",
"the",
"supplied",
"path",
"joined",
"to",
"the",
"ManifestDeployer",
"s",
"data",
"directory",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/charm/manifest_deployer.go#L200-L202 |
156,107 | juju/juju | worker/uniter/charm/manifest_deployer.go | manifestDeployError | func manifestDeployError(err *error, upgrading bool) {
if *err != nil {
if upgrading {
// We now treat any failure to overwrite the charm -- or otherwise
// manipulate the charm directory -- as a conflict, because it's
// actually plausible for a user (or at least a charm author, who
// is the real audie... | go | func manifestDeployError(err *error, upgrading bool) {
if *err != nil {
if upgrading {
// We now treat any failure to overwrite the charm -- or otherwise
// manipulate the charm directory -- as a conflict, because it's
// actually plausible for a user (or at least a charm author, who
// is the real audie... | [
"func",
"manifestDeployError",
"(",
"err",
"*",
"error",
",",
"upgrading",
"bool",
")",
"{",
"if",
"*",
"err",
"!=",
"nil",
"{",
"if",
"upgrading",
"{",
"// We now treat any failure to overwrite the charm -- or otherwise",
"// manipulate the charm directory -- as a conflict... | // manifestDeployError annotates or replaces the supplied error according
// to whether or not an upgrade operation is in play. It was extracted from
// Deploy to aid that method's readability. | [
"manifestDeployError",
"annotates",
"or",
"replaces",
"the",
"supplied",
"error",
"according",
"to",
"whether",
"or",
"not",
"an",
"upgrade",
"operation",
"is",
"in",
"play",
".",
"It",
"was",
"extracted",
"from",
"Deploy",
"to",
"aid",
"that",
"method",
"s",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/charm/manifest_deployer.go#L207-L225 |
156,108 | juju/juju | cmd/juju/crossmodel/offer.go | NewOfferCommand | func NewOfferCommand() cmd.Command {
offerCmd := &offerCommand{}
offerCmd.newAPIFunc = func() (OfferAPI, error) {
return offerCmd.NewApplicationOffersAPI()
}
offerCmd.refreshModels = offerCmd.ControllerCommandBase.RefreshModels
return modelcmd.WrapController(offerCmd)
} | go | func NewOfferCommand() cmd.Command {
offerCmd := &offerCommand{}
offerCmd.newAPIFunc = func() (OfferAPI, error) {
return offerCmd.NewApplicationOffersAPI()
}
offerCmd.refreshModels = offerCmd.ControllerCommandBase.RefreshModels
return modelcmd.WrapController(offerCmd)
} | [
"func",
"NewOfferCommand",
"(",
")",
"cmd",
".",
"Command",
"{",
"offerCmd",
":=",
"&",
"offerCommand",
"{",
"}",
"\n",
"offerCmd",
".",
"newAPIFunc",
"=",
"func",
"(",
")",
"(",
"OfferAPI",
",",
"error",
")",
"{",
"return",
"offerCmd",
".",
"NewApplicat... | // NewOfferCommand constructs commands that enables endpoints for export. | [
"NewOfferCommand",
"constructs",
"commands",
"that",
"enables",
"endpoints",
"for",
"export",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/crossmodel/offer.go#L43-L50 |
156,109 | juju/juju | worker/uniter/operation/state.go | validate | func (st State) validate() (err error) {
defer errors.DeferredAnnotatef(&err, "invalid operation state")
hasHook := st.Hook != nil
hasActionId := st.ActionId != nil
hasCharm := st.CharmURL != nil
switch st.Kind {
case Install:
if st.Installed {
return errors.New("unexpected hook info with Kind Install")
}
... | go | func (st State) validate() (err error) {
defer errors.DeferredAnnotatef(&err, "invalid operation state")
hasHook := st.Hook != nil
hasActionId := st.ActionId != nil
hasCharm := st.CharmURL != nil
switch st.Kind {
case Install:
if st.Installed {
return errors.New("unexpected hook info with Kind Install")
}
... | [
"func",
"(",
"st",
"State",
")",
"validate",
"(",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"errors",
".",
"DeferredAnnotatef",
"(",
"&",
"err",
",",
"\"",
"\"",
")",
"\n",
"hasHook",
":=",
"st",
".",
"Hook",
"!=",
"nil",
"\n",
"hasActionId",
":... | // validate returns an error if the state violates expectations. | [
"validate",
"returns",
"an",
"error",
"if",
"the",
"state",
"violates",
"expectations",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/operation/state.go#L114-L173 |
156,110 | juju/juju | state/sshhostkeys.go | keysEqual | func keysEqual(a, b []string) bool {
if len(a) != len(b) {
return false
}
a = a[:]
b = b[:]
sort.Strings(a)
sort.Strings(b)
for i := range a {
if a[i] != b[i] {
return false
}
}
return true
} | go | func keysEqual(a, b []string) bool {
if len(a) != len(b) {
return false
}
a = a[:]
b = b[:]
sort.Strings(a)
sort.Strings(b)
for i := range a {
if a[i] != b[i] {
return false
}
}
return true
} | [
"func",
"keysEqual",
"(",
"a",
",",
"b",
"[",
"]",
"string",
")",
"bool",
"{",
"if",
"len",
"(",
"a",
")",
"!=",
"len",
"(",
"b",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"a",
"=",
"a",
"[",
":",
"]",
"\n",
"b",
"=",
"b",
"[",
":",
... | // keysEqual checks if the ssh host keys are the same between two sets.
// we shouldn't care about the order of the keys. | [
"keysEqual",
"checks",
"if",
"the",
"ssh",
"host",
"keys",
"are",
"the",
"same",
"between",
"two",
"sets",
".",
"we",
"shouldn",
"t",
"care",
"about",
"the",
"order",
"of",
"the",
"keys",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/sshhostkeys.go#L53-L67 |
156,111 | juju/juju | state/sshhostkeys.go | SetSSHHostKeys | func (st *State) SetSSHHostKeys(tag names.MachineTag, keys SSHHostKeys) error {
coll, closer := st.db().GetCollection(sshHostKeysC)
defer closer()
id := machineGlobalKey(tag.Id())
doc := sshHostKeysDoc{
Keys: keys,
}
var dbDoc sshHostKeysDoc
buildTxn := func(attempt int) ([]txn.Op, error) {
err := coll.FindI... | go | func (st *State) SetSSHHostKeys(tag names.MachineTag, keys SSHHostKeys) error {
coll, closer := st.db().GetCollection(sshHostKeysC)
defer closer()
id := machineGlobalKey(tag.Id())
doc := sshHostKeysDoc{
Keys: keys,
}
var dbDoc sshHostKeysDoc
buildTxn := func(attempt int) ([]txn.Op, error) {
err := coll.FindI... | [
"func",
"(",
"st",
"*",
"State",
")",
"SetSSHHostKeys",
"(",
"tag",
"names",
".",
"MachineTag",
",",
"keys",
"SSHHostKeys",
")",
"error",
"{",
"coll",
",",
"closer",
":=",
"st",
".",
"db",
"(",
")",
".",
"GetCollection",
"(",
"sshHostKeysC",
")",
"\n",... | // SetSSHHostKeys updates the stored SSH host keys for an entity.
//
// See the note for GetSSHHostKeys regarding supported entities. | [
"SetSSHHostKeys",
"updates",
"the",
"stored",
"SSH",
"host",
"keys",
"for",
"an",
"entity",
".",
"See",
"the",
"note",
"for",
"GetSSHHostKeys",
"regarding",
"supported",
"entities",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/sshhostkeys.go#L72-L106 |
156,112 | juju/juju | state/sshhostkeys.go | removeSSHHostKeyOp | func removeSSHHostKeyOp(globalKey string) txn.Op {
return txn.Op{
C: sshHostKeysC,
Id: globalKey,
Remove: true,
}
} | go | func removeSSHHostKeyOp(globalKey string) txn.Op {
return txn.Op{
C: sshHostKeysC,
Id: globalKey,
Remove: true,
}
} | [
"func",
"removeSSHHostKeyOp",
"(",
"globalKey",
"string",
")",
"txn",
".",
"Op",
"{",
"return",
"txn",
".",
"Op",
"{",
"C",
":",
"sshHostKeysC",
",",
"Id",
":",
"globalKey",
",",
"Remove",
":",
"true",
",",
"}",
"\n",
"}"
] | // removeSSHHostKeyOp returns the operation needed to remove the SSH
// host key document associated with the given globalKey. | [
"removeSSHHostKeyOp",
"returns",
"the",
"operation",
"needed",
"to",
"remove",
"the",
"SSH",
"host",
"key",
"document",
"associated",
"with",
"the",
"given",
"globalKey",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/sshhostkeys.go#L110-L116 |
156,113 | juju/juju | apiserver/facades/controller/applicationscaler/facade.go | NewFacade | func NewFacade(backend Backend, res facade.Resources, auth facade.Authorizer) (*Facade, error) {
if !auth.AuthController() {
return nil, common.ErrPerm
}
return &Facade{
backend: backend,
resources: res,
}, nil
} | go | func NewFacade(backend Backend, res facade.Resources, auth facade.Authorizer) (*Facade, error) {
if !auth.AuthController() {
return nil, common.ErrPerm
}
return &Facade{
backend: backend,
resources: res,
}, nil
} | [
"func",
"NewFacade",
"(",
"backend",
"Backend",
",",
"res",
"facade",
".",
"Resources",
",",
"auth",
"facade",
".",
"Authorizer",
")",
"(",
"*",
"Facade",
",",
"error",
")",
"{",
"if",
"!",
"auth",
".",
"AuthController",
"(",
")",
"{",
"return",
"nil",... | // NewFacade creates a new authorized Facade. | [
"NewFacade",
"creates",
"a",
"new",
"authorized",
"Facade",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/applicationscaler/facade.go#L36-L44 |
156,114 | juju/juju | apiserver/facades/controller/applicationscaler/facade.go | Watch | func (facade *Facade) Watch() (params.StringsWatchResult, error) {
watch := facade.backend.WatchScaledServices()
if changes, ok := <-watch.Changes(); ok {
id := facade.resources.Register(watch)
return params.StringsWatchResult{
StringsWatcherId: id,
Changes: changes,
}, nil
}
return params.Stri... | go | func (facade *Facade) Watch() (params.StringsWatchResult, error) {
watch := facade.backend.WatchScaledServices()
if changes, ok := <-watch.Changes(); ok {
id := facade.resources.Register(watch)
return params.StringsWatchResult{
StringsWatcherId: id,
Changes: changes,
}, nil
}
return params.Stri... | [
"func",
"(",
"facade",
"*",
"Facade",
")",
"Watch",
"(",
")",
"(",
"params",
".",
"StringsWatchResult",
",",
"error",
")",
"{",
"watch",
":=",
"facade",
".",
"backend",
".",
"WatchScaledServices",
"(",
")",
"\n",
"if",
"changes",
",",
"ok",
":=",
"<-",... | // Watch returns a watcher that sends the names of services whose
// unit count may be below their configured minimum. | [
"Watch",
"returns",
"a",
"watcher",
"that",
"sends",
"the",
"names",
"of",
"services",
"whose",
"unit",
"count",
"may",
"be",
"below",
"their",
"configured",
"minimum",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/applicationscaler/facade.go#L48-L58 |
156,115 | juju/juju | apiserver/facades/controller/applicationscaler/facade.go | Rescale | func (facade *Facade) Rescale(args params.Entities) params.ErrorResults {
result := params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Entities)),
}
for i, entity := range args.Entities {
err := facade.rescaleOne(entity.Tag)
result.Results[i].Error = common.ServerError(err)
}
return result
} | go | func (facade *Facade) Rescale(args params.Entities) params.ErrorResults {
result := params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Entities)),
}
for i, entity := range args.Entities {
err := facade.rescaleOne(entity.Tag)
result.Results[i].Error = common.ServerError(err)
}
return result
} | [
"func",
"(",
"facade",
"*",
"Facade",
")",
"Rescale",
"(",
"args",
"params",
".",
"Entities",
")",
"params",
".",
"ErrorResults",
"{",
"result",
":=",
"params",
".",
"ErrorResults",
"{",
"Results",
":",
"make",
"(",
"[",
"]",
"params",
".",
"ErrorResult"... | // Rescale causes any supplied services to be scaled up to their
// minimum size. | [
"Rescale",
"causes",
"any",
"supplied",
"services",
"to",
"be",
"scaled",
"up",
"to",
"their",
"minimum",
"size",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/applicationscaler/facade.go#L62-L71 |
156,116 | juju/juju | apiserver/facades/controller/applicationscaler/facade.go | rescaleOne | func (facade *Facade) rescaleOne(tagString string) error {
tag, err := names.ParseTag(tagString)
if err != nil {
return errors.Trace(err)
}
ApplicationTag, ok := tag.(names.ApplicationTag)
if !ok {
return common.ErrPerm
}
return facade.backend.RescaleService(ApplicationTag.Id())
} | go | func (facade *Facade) rescaleOne(tagString string) error {
tag, err := names.ParseTag(tagString)
if err != nil {
return errors.Trace(err)
}
ApplicationTag, ok := tag.(names.ApplicationTag)
if !ok {
return common.ErrPerm
}
return facade.backend.RescaleService(ApplicationTag.Id())
} | [
"func",
"(",
"facade",
"*",
"Facade",
")",
"rescaleOne",
"(",
"tagString",
"string",
")",
"error",
"{",
"tag",
",",
"err",
":=",
"names",
".",
"ParseTag",
"(",
"tagString",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Trace",
"... | // rescaleOne scales up the supplied service, if necessary; or returns a
// suitable error. | [
"rescaleOne",
"scales",
"up",
"the",
"supplied",
"service",
"if",
"necessary",
";",
"or",
"returns",
"a",
"suitable",
"error",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/applicationscaler/facade.go#L75-L85 |
156,117 | juju/juju | worker/httpserver/tls.go | NewTLSConfig | func NewTLSConfig(st *state.State, getCertificate func() *tls.Certificate) (*tls.Config, error) {
controllerConfig, err := st.ControllerConfig()
if err != nil {
return nil, errors.Trace(err)
}
return newTLSConfig(
controllerConfig.AutocertDNSName(),
controllerConfig.AutocertURL(),
st.AutocertCache(),
getC... | go | func NewTLSConfig(st *state.State, getCertificate func() *tls.Certificate) (*tls.Config, error) {
controllerConfig, err := st.ControllerConfig()
if err != nil {
return nil, errors.Trace(err)
}
return newTLSConfig(
controllerConfig.AutocertDNSName(),
controllerConfig.AutocertURL(),
st.AutocertCache(),
getC... | [
"func",
"NewTLSConfig",
"(",
"st",
"*",
"state",
".",
"State",
",",
"getCertificate",
"func",
"(",
")",
"*",
"tls",
".",
"Certificate",
")",
"(",
"*",
"tls",
".",
"Config",
",",
"error",
")",
"{",
"controllerConfig",
",",
"err",
":=",
"st",
".",
"Con... | // NewTLSConfig returns the TLS configuration for the HTTP server to use
// based on controller configuration stored in the state database. | [
"NewTLSConfig",
"returns",
"the",
"TLS",
"configuration",
"for",
"the",
"HTTP",
"server",
"to",
"use",
"based",
"on",
"controller",
"configuration",
"stored",
"in",
"the",
"state",
"database",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/httpserver/tls.go#L21-L32 |
156,118 | juju/juju | api/backups/create.go | Create | func (c *Client) Create(notes string, keepCopy, noDownload bool) (*params.BackupsMetadataResult, error) {
var result params.BackupsMetadataResult
args := params.BackupsCreateArgs{
Notes: notes,
KeepCopy: keepCopy,
NoDownload: noDownload,
}
if err := c.facade.FacadeCall("Create", args, &result); err !=... | go | func (c *Client) Create(notes string, keepCopy, noDownload bool) (*params.BackupsMetadataResult, error) {
var result params.BackupsMetadataResult
args := params.BackupsCreateArgs{
Notes: notes,
KeepCopy: keepCopy,
NoDownload: noDownload,
}
if err := c.facade.FacadeCall("Create", args, &result); err !=... | [
"func",
"(",
"c",
"*",
"Client",
")",
"Create",
"(",
"notes",
"string",
",",
"keepCopy",
",",
"noDownload",
"bool",
")",
"(",
"*",
"params",
".",
"BackupsMetadataResult",
",",
"error",
")",
"{",
"var",
"result",
"params",
".",
"BackupsMetadataResult",
"\n"... | // Create sends a request to create a backup of juju's state. It
// returns the metadata associated with the resulting backup and a
// filename for download. | [
"Create",
"sends",
"a",
"request",
"to",
"create",
"a",
"backup",
"of",
"juju",
"s",
"state",
".",
"It",
"returns",
"the",
"metadata",
"associated",
"with",
"the",
"resulting",
"backup",
"and",
"a",
"filename",
"for",
"download",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/backups/create.go#L15-L28 |
156,119 | juju/juju | worker/uniter/charm/bundles.go | NewBundlesDir | func NewBundlesDir(path string, dlr Downloader) *BundlesDir {
if dlr == nil {
dlr = downloader.New(downloader.NewArgs{
HostnameVerification: utils.NoVerifySSLHostnames,
})
}
return &BundlesDir{
path: path,
downloader: dlr,
}
} | go | func NewBundlesDir(path string, dlr Downloader) *BundlesDir {
if dlr == nil {
dlr = downloader.New(downloader.NewArgs{
HostnameVerification: utils.NoVerifySSLHostnames,
})
}
return &BundlesDir{
path: path,
downloader: dlr,
}
} | [
"func",
"NewBundlesDir",
"(",
"path",
"string",
",",
"dlr",
"Downloader",
")",
"*",
"BundlesDir",
"{",
"if",
"dlr",
"==",
"nil",
"{",
"dlr",
"=",
"downloader",
".",
"New",
"(",
"downloader",
".",
"NewArgs",
"{",
"HostnameVerification",
":",
"utils",
".",
... | // NewBundlesDir returns a new BundlesDir which uses path for storage. | [
"NewBundlesDir",
"returns",
"a",
"new",
"BundlesDir",
"which",
"uses",
"path",
"for",
"storage",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/charm/bundles.go#L33-L43 |
156,120 | juju/juju | worker/uniter/charm/bundles.go | Read | func (d *BundlesDir) Read(info BundleInfo, abort <-chan struct{}) (Bundle, error) {
path := d.bundlePath(info)
if _, err := os.Stat(path); err != nil {
if !os.IsNotExist(err) {
return nil, err
}
if err := d.download(info, path, abort); err != nil {
return nil, err
}
}
return charm.ReadCharmArchive(pat... | go | func (d *BundlesDir) Read(info BundleInfo, abort <-chan struct{}) (Bundle, error) {
path := d.bundlePath(info)
if _, err := os.Stat(path); err != nil {
if !os.IsNotExist(err) {
return nil, err
}
if err := d.download(info, path, abort); err != nil {
return nil, err
}
}
return charm.ReadCharmArchive(pat... | [
"func",
"(",
"d",
"*",
"BundlesDir",
")",
"Read",
"(",
"info",
"BundleInfo",
",",
"abort",
"<-",
"chan",
"struct",
"{",
"}",
")",
"(",
"Bundle",
",",
"error",
")",
"{",
"path",
":=",
"d",
".",
"bundlePath",
"(",
"info",
")",
"\n",
"if",
"_",
",",... | // Read returns a charm bundle from the directory. If no bundle exists yet,
// one will be downloaded and validated and copied into the directory before
// being returned. Downloads will be aborted if a value is received on abort. | [
"Read",
"returns",
"a",
"charm",
"bundle",
"from",
"the",
"directory",
".",
"If",
"no",
"bundle",
"exists",
"yet",
"one",
"will",
"be",
"downloaded",
"and",
"validated",
"and",
"copied",
"into",
"the",
"directory",
"before",
"being",
"returned",
".",
"Downlo... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/charm/bundles.go#L48-L59 |
156,121 | juju/juju | worker/uniter/charm/bundles.go | download | func (d *BundlesDir) download(info BundleInfo, target string, abort <-chan struct{}) (err error) {
// First download...
curl, err := url.Parse(info.URL().String())
if err != nil {
return errors.Annotate(err, "could not parse charm URL")
}
expectedSha256, err := info.ArchiveSha256()
req := downloader.Request{
... | go | func (d *BundlesDir) download(info BundleInfo, target string, abort <-chan struct{}) (err error) {
// First download...
curl, err := url.Parse(info.URL().String())
if err != nil {
return errors.Annotate(err, "could not parse charm URL")
}
expectedSha256, err := info.ArchiveSha256()
req := downloader.Request{
... | [
"func",
"(",
"d",
"*",
"BundlesDir",
")",
"download",
"(",
"info",
"BundleInfo",
",",
"target",
"string",
",",
"abort",
"<-",
"chan",
"struct",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"// First download...",
"curl",
",",
"err",
":=",
"url",
".",
... | // download fetches the supplied charm and checks that it has the correct sha256
// hash, then copies it into the directory. If a value is received on abort, the
// download will be stopped. | [
"download",
"fetches",
"the",
"supplied",
"charm",
"and",
"checks",
"that",
"it",
"has",
"the",
"correct",
"sha256",
"hash",
"then",
"copies",
"it",
"into",
"the",
"directory",
".",
"If",
"a",
"value",
"is",
"received",
"on",
"abort",
"the",
"download",
"w... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/charm/bundles.go#L64-L92 |
156,122 | juju/juju | worker/uniter/charm/bundles.go | bundlePath | func (d *BundlesDir) bundlePath(info BundleInfo) string {
return d.bundleURLPath(info.URL())
} | go | func (d *BundlesDir) bundlePath(info BundleInfo) string {
return d.bundleURLPath(info.URL())
} | [
"func",
"(",
"d",
"*",
"BundlesDir",
")",
"bundlePath",
"(",
"info",
"BundleInfo",
")",
"string",
"{",
"return",
"d",
".",
"bundleURLPath",
"(",
"info",
".",
"URL",
"(",
")",
")",
"\n",
"}"
] | // bundlePath returns the path to the location where the verified charm
// bundle identified by info will be, or has been, saved. | [
"bundlePath",
"returns",
"the",
"path",
"to",
"the",
"location",
"where",
"the",
"verified",
"charm",
"bundle",
"identified",
"by",
"info",
"will",
"be",
"or",
"has",
"been",
"saved",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/charm/bundles.go#L96-L98 |
156,123 | juju/juju | worker/uniter/charm/bundles.go | bundleURLPath | func (d *BundlesDir) bundleURLPath(url *charm.URL) string {
return path.Join(d.path, charm.Quote(url.String()))
} | go | func (d *BundlesDir) bundleURLPath(url *charm.URL) string {
return path.Join(d.path, charm.Quote(url.String()))
} | [
"func",
"(",
"d",
"*",
"BundlesDir",
")",
"bundleURLPath",
"(",
"url",
"*",
"charm",
".",
"URL",
")",
"string",
"{",
"return",
"path",
".",
"Join",
"(",
"d",
".",
"path",
",",
"charm",
".",
"Quote",
"(",
"url",
".",
"String",
"(",
")",
")",
")",
... | // bundleURLPath returns the path to the location where the verified charm
// bundle identified by url will be, or has been, saved. | [
"bundleURLPath",
"returns",
"the",
"path",
"to",
"the",
"location",
"where",
"the",
"verified",
"charm",
"bundle",
"identified",
"by",
"url",
"will",
"be",
"or",
"has",
"been",
"saved",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/charm/bundles.go#L102-L104 |
156,124 | juju/juju | worker/uniter/charm/bundles.go | ClearDownloads | func ClearDownloads(bundlesDir string) error {
downloadDir := downloadsPath(bundlesDir)
err := os.RemoveAll(downloadDir)
return errors.Annotate(err, "unable to clear bundle downloads")
} | go | func ClearDownloads(bundlesDir string) error {
downloadDir := downloadsPath(bundlesDir)
err := os.RemoveAll(downloadDir)
return errors.Annotate(err, "unable to clear bundle downloads")
} | [
"func",
"ClearDownloads",
"(",
"bundlesDir",
"string",
")",
"error",
"{",
"downloadDir",
":=",
"downloadsPath",
"(",
"bundlesDir",
")",
"\n",
"err",
":=",
"os",
".",
"RemoveAll",
"(",
"downloadDir",
")",
"\n",
"return",
"errors",
".",
"Annotate",
"(",
"err",... | // ClearDownloads removes any entries in the temporary bundle download
// directory. It is intended to be called on uniter startup. | [
"ClearDownloads",
"removes",
"any",
"entries",
"in",
"the",
"temporary",
"bundle",
"download",
"directory",
".",
"It",
"is",
"intended",
"to",
"be",
"called",
"on",
"uniter",
"startup",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/charm/bundles.go#L108-L112 |
156,125 | juju/juju | cmd/plugins/juju-metadata/listformatter.go | formatMetadataTabular | func formatMetadataTabular(writer io.Writer, metadata []MetadataInfo) {
tw := output.TabWriter(writer)
print := func(values ...string) {
fmt.Fprintln(tw, strings.Join(values, "\t"))
}
print("Source", "Series", "Arch", "Region", "Image id", "Stream", "Virt Type", "Storage Type")
for _, m := range metadata {
pr... | go | func formatMetadataTabular(writer io.Writer, metadata []MetadataInfo) {
tw := output.TabWriter(writer)
print := func(values ...string) {
fmt.Fprintln(tw, strings.Join(values, "\t"))
}
print("Source", "Series", "Arch", "Region", "Image id", "Stream", "Virt Type", "Storage Type")
for _, m := range metadata {
pr... | [
"func",
"formatMetadataTabular",
"(",
"writer",
"io",
".",
"Writer",
",",
"metadata",
"[",
"]",
"MetadataInfo",
")",
"{",
"tw",
":=",
"output",
".",
"TabWriter",
"(",
"writer",
")",
"\n",
"print",
":=",
"func",
"(",
"values",
"...",
"string",
")",
"{",
... | // formatMetadataTabular writes a tabular summary of cloud image metadata. | [
"formatMetadataTabular",
"writes",
"a",
"tabular",
"summary",
"of",
"cloud",
"image",
"metadata",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/plugins/juju-metadata/listformatter.go#L26-L37 |
156,126 | juju/juju | apiserver/facades/agent/agent/agent.go | NewAgentAPIV2 | func NewAgentAPIV2(st *state.State, resources facade.Resources, auth facade.Authorizer) (*AgentAPIV2, error) {
// Agents are defined to be any user that's not a client user.
if !auth.AuthMachineAgent() && !auth.AuthUnitAgent() {
return nil, common.ErrPerm
}
getCanChange := func() (common.AuthFunc, error) {
retu... | go | func NewAgentAPIV2(st *state.State, resources facade.Resources, auth facade.Authorizer) (*AgentAPIV2, error) {
// Agents are defined to be any user that's not a client user.
if !auth.AuthMachineAgent() && !auth.AuthUnitAgent() {
return nil, common.ErrPerm
}
getCanChange := func() (common.AuthFunc, error) {
retu... | [
"func",
"NewAgentAPIV2",
"(",
"st",
"*",
"state",
".",
"State",
",",
"resources",
"facade",
".",
"Resources",
",",
"auth",
"facade",
".",
"Authorizer",
")",
"(",
"*",
"AgentAPIV2",
",",
"error",
")",
"{",
"// Agents are defined to be any user that's not a client u... | // NewAgentAPIV2 returns an object implementing version 2 of the Agent API
// with the given authorizer representing the currently logged in client. | [
"NewAgentAPIV2",
"returns",
"an",
"object",
"implementing",
"version",
"2",
"of",
"the",
"Agent",
"API",
"with",
"the",
"given",
"authorizer",
"representing",
"the",
"currently",
"logged",
"in",
"client",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/agent/agent.go#L38-L66 |
156,127 | juju/juju | apiserver/facades/agent/agent/agent.go | WatchCredentials | func (api *AgentAPIV2) WatchCredentials(args params.Entities) (params.NotifyWatchResults, error) {
if !api.auth.AuthController() {
return params.NotifyWatchResults{}, common.ErrPerm
}
results := params.NotifyWatchResults{
Results: make([]params.NotifyWatchResult, len(args.Entities)),
}
for i, entity := range ... | go | func (api *AgentAPIV2) WatchCredentials(args params.Entities) (params.NotifyWatchResults, error) {
if !api.auth.AuthController() {
return params.NotifyWatchResults{}, common.ErrPerm
}
results := params.NotifyWatchResults{
Results: make([]params.NotifyWatchResult, len(args.Entities)),
}
for i, entity := range ... | [
"func",
"(",
"api",
"*",
"AgentAPIV2",
")",
"WatchCredentials",
"(",
"args",
"params",
".",
"Entities",
")",
"(",
"params",
".",
"NotifyWatchResults",
",",
"error",
")",
"{",
"if",
"!",
"api",
".",
"auth",
".",
"AuthController",
"(",
")",
"{",
"return",
... | // WatchCredentials watches for changes to the specified credentials. | [
"WatchCredentials",
"watches",
"for",
"changes",
"to",
"the",
"specified",
"credentials",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/agent/agent.go#L173-L199 |
156,128 | juju/juju | apiserver/observer/auditfilter.go | NewAuditLogFilter | func NewAuditLogFilter(log auditlog.AuditLog, filter func(auditlog.Request) bool) auditlog.AuditLog {
return &bufferedLog{
dest: log,
interesting: filter,
}
} | go | func NewAuditLogFilter(log auditlog.AuditLog, filter func(auditlog.Request) bool) auditlog.AuditLog {
return &bufferedLog{
dest: log,
interesting: filter,
}
} | [
"func",
"NewAuditLogFilter",
"(",
"log",
"auditlog",
".",
"AuditLog",
",",
"filter",
"func",
"(",
"auditlog",
".",
"Request",
")",
"bool",
")",
"auditlog",
".",
"AuditLog",
"{",
"return",
"&",
"bufferedLog",
"{",
"dest",
":",
"log",
",",
"interesting",
":"... | // NewAuditLogFilter returns an auditlog.AuditLog that will only log
// conversations to the underlying log passed in if they include a
// request that satisfies the filter function passed in. | [
"NewAuditLogFilter",
"returns",
"an",
"auditlog",
".",
"AuditLog",
"that",
"will",
"only",
"log",
"conversations",
"to",
"the",
"underlying",
"log",
"passed",
"in",
"if",
"they",
"include",
"a",
"request",
"that",
"satisfies",
"the",
"filter",
"function",
"passe... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/observer/auditfilter.go#L30-L35 |
156,129 | juju/juju | apiserver/observer/auditfilter.go | AddConversation | func (l *bufferedLog) AddConversation(c auditlog.Conversation) error {
l.mu.Lock()
defer l.mu.Unlock()
// We always buffer the conversation, since we don't know whether
// it will have any interesting requests yet.
l.deferMessage(c)
return nil
} | go | func (l *bufferedLog) AddConversation(c auditlog.Conversation) error {
l.mu.Lock()
defer l.mu.Unlock()
// We always buffer the conversation, since we don't know whether
// it will have any interesting requests yet.
l.deferMessage(c)
return nil
} | [
"func",
"(",
"l",
"*",
"bufferedLog",
")",
"AddConversation",
"(",
"c",
"auditlog",
".",
"Conversation",
")",
"error",
"{",
"l",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"// We always buffer the co... | // AddConversation implements auditlog.AuditLog. | [
"AddConversation",
"implements",
"auditlog",
".",
"AuditLog",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/observer/auditfilter.go#L38-L45 |
156,130 | juju/juju | apiserver/observer/auditfilter.go | AddRequest | func (l *bufferedLog) AddRequest(r auditlog.Request) error {
l.mu.Lock()
if len(l.buffer) > 0 {
l.deferMessage(r)
var err error
if l.interesting(r) {
err = l.flush()
}
l.mu.Unlock()
return err
}
l.mu.Unlock()
// We've already flushed messages, forward this on
// immediately.
return l.dest.AddReque... | go | func (l *bufferedLog) AddRequest(r auditlog.Request) error {
l.mu.Lock()
if len(l.buffer) > 0 {
l.deferMessage(r)
var err error
if l.interesting(r) {
err = l.flush()
}
l.mu.Unlock()
return err
}
l.mu.Unlock()
// We've already flushed messages, forward this on
// immediately.
return l.dest.AddReque... | [
"func",
"(",
"l",
"*",
"bufferedLog",
")",
"AddRequest",
"(",
"r",
"auditlog",
".",
"Request",
")",
"error",
"{",
"l",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"if",
"len",
"(",
"l",
".",
"buffer",
")",
">",
"0",
"{",
"l",
".",
"deferMessage",
"... | // AddRequest implements auditlog.AuditLog. | [
"AddRequest",
"implements",
"auditlog",
".",
"AuditLog",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/observer/auditfilter.go#L48-L63 |
156,131 | juju/juju | apiserver/observer/auditfilter.go | AddResponse | func (l *bufferedLog) AddResponse(r auditlog.ResponseErrors) error {
l.mu.Lock()
if len(l.buffer) > 0 {
l.deferMessage(r)
l.mu.Unlock()
return nil
}
l.mu.Unlock()
// We've already flushed messages, forward this on
// immediately.
return l.dest.AddResponse(r)
} | go | func (l *bufferedLog) AddResponse(r auditlog.ResponseErrors) error {
l.mu.Lock()
if len(l.buffer) > 0 {
l.deferMessage(r)
l.mu.Unlock()
return nil
}
l.mu.Unlock()
// We've already flushed messages, forward this on
// immediately.
return l.dest.AddResponse(r)
} | [
"func",
"(",
"l",
"*",
"bufferedLog",
")",
"AddResponse",
"(",
"r",
"auditlog",
".",
"ResponseErrors",
")",
"error",
"{",
"l",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"if",
"len",
"(",
"l",
".",
"buffer",
")",
">",
"0",
"{",
"l",
".",
"deferMessa... | // AddResponse implements auditlog.AuditLog. | [
"AddResponse",
"implements",
"auditlog",
".",
"AuditLog",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/observer/auditfilter.go#L66-L77 |
156,132 | juju/juju | state/linklayerdevices.go | IsValidLinkLayerDeviceType | func IsValidLinkLayerDeviceType(value string) bool {
switch LinkLayerDeviceType(value) {
case LoopbackDevice, EthernetDevice,
VLAN_8021QDevice,
BondDevice, BridgeDevice:
return true
}
return false
} | go | func IsValidLinkLayerDeviceType(value string) bool {
switch LinkLayerDeviceType(value) {
case LoopbackDevice, EthernetDevice,
VLAN_8021QDevice,
BondDevice, BridgeDevice:
return true
}
return false
} | [
"func",
"IsValidLinkLayerDeviceType",
"(",
"value",
"string",
")",
"bool",
"{",
"switch",
"LinkLayerDeviceType",
"(",
"value",
")",
"{",
"case",
"LoopbackDevice",
",",
"EthernetDevice",
",",
"VLAN_8021QDevice",
",",
"BondDevice",
",",
"BridgeDevice",
":",
"return",
... | // IsValidLinkLayerDeviceType returns whether the given value is a valid
// link-layer network device type. | [
"IsValidLinkLayerDeviceType",
"returns",
"whether",
"the",
"given",
"value",
"is",
"a",
"valid",
"link",
"-",
"layer",
"network",
"device",
"type",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L82-L90 |
156,133 | juju/juju | state/linklayerdevices.go | AllLinkLayerDevices | func (st *State) AllLinkLayerDevices() (devices []*LinkLayerDevice, err error) {
devicesCollection, closer := st.db().GetCollection(linkLayerDevicesC)
defer closer()
sdocs := []linkLayerDeviceDoc{}
err = devicesCollection.Find(nil).All(&sdocs)
if err != nil {
return nil, errors.Errorf("cannot get all link layer... | go | func (st *State) AllLinkLayerDevices() (devices []*LinkLayerDevice, err error) {
devicesCollection, closer := st.db().GetCollection(linkLayerDevicesC)
defer closer()
sdocs := []linkLayerDeviceDoc{}
err = devicesCollection.Find(nil).All(&sdocs)
if err != nil {
return nil, errors.Errorf("cannot get all link layer... | [
"func",
"(",
"st",
"*",
"State",
")",
"AllLinkLayerDevices",
"(",
")",
"(",
"devices",
"[",
"]",
"*",
"LinkLayerDevice",
",",
"err",
"error",
")",
"{",
"devicesCollection",
",",
"closer",
":=",
"st",
".",
"db",
"(",
")",
".",
"GetCollection",
"(",
"lin... | // AllLinkLayerDevices returns all link layer devices in the model. | [
"AllLinkLayerDevices",
"returns",
"all",
"link",
"layer",
"devices",
"in",
"the",
"model",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L104-L117 |
156,134 | juju/juju | state/linklayerdevices.go | DocID | func (dev *LinkLayerDevice) DocID() string {
return dev.st.docID(dev.doc.DocID)
} | go | func (dev *LinkLayerDevice) DocID() string {
return dev.st.docID(dev.doc.DocID)
} | [
"func",
"(",
"dev",
"*",
"LinkLayerDevice",
")",
"DocID",
"(",
")",
"string",
"{",
"return",
"dev",
".",
"st",
".",
"docID",
"(",
"dev",
".",
"doc",
".",
"DocID",
")",
"\n",
"}"
] | // DocID returns the globally unique ID of the link-layer device, including the
// model UUID as prefix. | [
"DocID",
"returns",
"the",
"globally",
"unique",
"ID",
"of",
"the",
"link",
"-",
"layer",
"device",
"including",
"the",
"model",
"UUID",
"as",
"prefix",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L121-L123 |
156,135 | juju/juju | state/linklayerdevices.go | ProviderID | func (dev *LinkLayerDevice) ProviderID() network.Id {
return network.Id(dev.doc.ProviderID)
} | go | func (dev *LinkLayerDevice) ProviderID() network.Id {
return network.Id(dev.doc.ProviderID)
} | [
"func",
"(",
"dev",
"*",
"LinkLayerDevice",
")",
"ProviderID",
"(",
")",
"network",
".",
"Id",
"{",
"return",
"network",
".",
"Id",
"(",
"dev",
".",
"doc",
".",
"ProviderID",
")",
"\n",
"}"
] | // ProviderID returns the provider-specific device ID, if set. | [
"ProviderID",
"returns",
"the",
"provider",
"-",
"specific",
"device",
"ID",
"if",
"set",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L136-L138 |
156,136 | juju/juju | state/linklayerdevices.go | Machine | func (dev *LinkLayerDevice) Machine() (*Machine, error) {
return dev.st.Machine(dev.doc.MachineID)
} | go | func (dev *LinkLayerDevice) Machine() (*Machine, error) {
return dev.st.Machine(dev.doc.MachineID)
} | [
"func",
"(",
"dev",
"*",
"LinkLayerDevice",
")",
"Machine",
"(",
")",
"(",
"*",
"Machine",
",",
"error",
")",
"{",
"return",
"dev",
".",
"st",
".",
"Machine",
"(",
"dev",
".",
"doc",
".",
"MachineID",
")",
"\n",
"}"
] | // Machine returns the Machine this device belongs to. | [
"Machine",
"returns",
"the",
"Machine",
"this",
"device",
"belongs",
"to",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L146-L148 |
156,137 | juju/juju | state/linklayerdevices.go | ParentDevice | func (dev *LinkLayerDevice) ParentDevice() (*LinkLayerDevice, error) {
if dev.doc.ParentName == "" {
return nil, nil
}
parentDeviceName, parentMachineID := dev.parentDeviceNameAndMachineID()
return dev.machineProxy(parentMachineID).LinkLayerDevice(parentDeviceName)
} | go | func (dev *LinkLayerDevice) ParentDevice() (*LinkLayerDevice, error) {
if dev.doc.ParentName == "" {
return nil, nil
}
parentDeviceName, parentMachineID := dev.parentDeviceNameAndMachineID()
return dev.machineProxy(parentMachineID).LinkLayerDevice(parentDeviceName)
} | [
"func",
"(",
"dev",
"*",
"LinkLayerDevice",
")",
"ParentDevice",
"(",
")",
"(",
"*",
"LinkLayerDevice",
",",
"error",
")",
"{",
"if",
"dev",
".",
"doc",
".",
"ParentName",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"parent... | // ParentDevice returns the LinkLayerDevice corresponding to the parent device
// of this device, if set. When no parent device name is set, it returns nil and
// no error. | [
"ParentDevice",
"returns",
"the",
"LinkLayerDevice",
"corresponding",
"to",
"the",
"parent",
"device",
"of",
"this",
"device",
"if",
"set",
".",
"When",
"no",
"parent",
"device",
"name",
"is",
"set",
"it",
"returns",
"nil",
"and",
"no",
"error",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L209-L216 |
156,138 | juju/juju | state/linklayerdevices.go | Remove | func (dev *LinkLayerDevice) Remove() (err error) {
defer errors.DeferredAnnotatef(&err, "cannot remove %s", dev)
buildTxn := func(attempt int) ([]txn.Op, error) {
if attempt > 0 {
if err = dev.errNoOperationsIfMissing(); err != nil {
return nil, err
}
}
ops, err := removeLinkLayerDeviceOps(dev.st, de... | go | func (dev *LinkLayerDevice) Remove() (err error) {
defer errors.DeferredAnnotatef(&err, "cannot remove %s", dev)
buildTxn := func(attempt int) ([]txn.Op, error) {
if attempt > 0 {
if err = dev.errNoOperationsIfMissing(); err != nil {
return nil, err
}
}
ops, err := removeLinkLayerDeviceOps(dev.st, de... | [
"func",
"(",
"dev",
"*",
"LinkLayerDevice",
")",
"Remove",
"(",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"errors",
".",
"DeferredAnnotatef",
"(",
"&",
"err",
",",
"\"",
"\"",
",",
"dev",
")",
"\n\n",
"buildTxn",
":=",
"func",
"(",
"attempt",
"int... | // Remove removes the device, if it exists. No error is returned when the device
// was already removed. ErrParentDeviceHasChildren is returned if this device is
// a parent to one or more existing devices and therefore cannot be removed. | [
"Remove",
"removes",
"the",
"device",
"if",
"it",
"exists",
".",
"No",
"error",
"is",
"returned",
"when",
"the",
"device",
"was",
"already",
"removed",
".",
"ErrParentDeviceHasChildren",
"is",
"returned",
"if",
"this",
"device",
"is",
"a",
"parent",
"to",
"o... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L236-L256 |
156,139 | juju/juju | state/linklayerdevices.go | removeLinkLayerDeviceOps | func removeLinkLayerDeviceOps(st *State, linkLayerDeviceDocID, parentDeviceDocID string) ([]txn.Op, error) {
var numChildren int
if parentDeviceDocID == "" {
// If not a child, verify it has no children.
var err error
numChildren, err = getParentDeviceNumChildrenRefs(st, linkLayerDeviceDocID)
if err != nil {
... | go | func removeLinkLayerDeviceOps(st *State, linkLayerDeviceDocID, parentDeviceDocID string) ([]txn.Op, error) {
var numChildren int
if parentDeviceDocID == "" {
// If not a child, verify it has no children.
var err error
numChildren, err = getParentDeviceNumChildrenRefs(st, linkLayerDeviceDocID)
if err != nil {
... | [
"func",
"removeLinkLayerDeviceOps",
"(",
"st",
"*",
"State",
",",
"linkLayerDeviceDocID",
",",
"parentDeviceDocID",
"string",
")",
"(",
"[",
"]",
"txn",
".",
"Op",
",",
"error",
")",
"{",
"var",
"numChildren",
"int",
"\n",
"if",
"parentDeviceDocID",
"==",
"\... | // removeLinkLayerDeviceOps returns the list of operations needed to remove the
// device with the given linkLayerDeviceDocID, asserting it still exists and has
// no children referring to it. If the device is a child, parentDeviceDocID will
// be non-empty and the operations includes decrementing the parent's
// NumCh... | [
"removeLinkLayerDeviceOps",
"returns",
"the",
"list",
"of",
"operations",
"needed",
"to",
"remove",
"the",
"device",
"with",
"the",
"given",
"linkLayerDeviceDocID",
"asserting",
"it",
"still",
"exists",
"and",
"has",
"no",
"children",
"referring",
"to",
"it",
".",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L273-L313 |
156,140 | juju/juju | state/linklayerdevices.go | removeLinkLayerDeviceDocOp | func removeLinkLayerDeviceDocOp(linkLayerDeviceDocID string) txn.Op {
return txn.Op{
C: linkLayerDevicesC,
Id: linkLayerDeviceDocID,
Assert: txn.DocExists,
Remove: true,
}
} | go | func removeLinkLayerDeviceDocOp(linkLayerDeviceDocID string) txn.Op {
return txn.Op{
C: linkLayerDevicesC,
Id: linkLayerDeviceDocID,
Assert: txn.DocExists,
Remove: true,
}
} | [
"func",
"removeLinkLayerDeviceDocOp",
"(",
"linkLayerDeviceDocID",
"string",
")",
"txn",
".",
"Op",
"{",
"return",
"txn",
".",
"Op",
"{",
"C",
":",
"linkLayerDevicesC",
",",
"Id",
":",
"linkLayerDeviceDocID",
",",
"Assert",
":",
"txn",
".",
"DocExists",
",",
... | // removeLinkLayerDeviceDocOp returns an operation to remove the
// linkLayerDeviceDoc matching the given linkLayerDeviceDocID, asserting it
// still exists. | [
"removeLinkLayerDeviceDocOp",
"returns",
"an",
"operation",
"to",
"remove",
"the",
"linkLayerDeviceDoc",
"matching",
"the",
"given",
"linkLayerDeviceDocID",
"asserting",
"it",
"still",
"exists",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L318-L325 |
156,141 | juju/juju | state/linklayerdevices.go | removeLinkLayerDeviceUnconditionallyOps | func removeLinkLayerDeviceUnconditionallyOps(linkLayerDeviceDocID string) []txn.Op {
// Reuse the regular remove ops, but drop their asserts.
removeDeviceDocOp := removeLinkLayerDeviceDocOp(linkLayerDeviceDocID)
removeDeviceDocOp.Assert = nil
removeRefsOp := removeLinkLayerDevicesRefsOp(linkLayerDeviceDocID)
remov... | go | func removeLinkLayerDeviceUnconditionallyOps(linkLayerDeviceDocID string) []txn.Op {
// Reuse the regular remove ops, but drop their asserts.
removeDeviceDocOp := removeLinkLayerDeviceDocOp(linkLayerDeviceDocID)
removeDeviceDocOp.Assert = nil
removeRefsOp := removeLinkLayerDevicesRefsOp(linkLayerDeviceDocID)
remov... | [
"func",
"removeLinkLayerDeviceUnconditionallyOps",
"(",
"linkLayerDeviceDocID",
"string",
")",
"[",
"]",
"txn",
".",
"Op",
"{",
"// Reuse the regular remove ops, but drop their asserts.",
"removeDeviceDocOp",
":=",
"removeLinkLayerDeviceDocOp",
"(",
"linkLayerDeviceDocID",
")",
... | // removeLinkLayerDeviceUnconditionallyOps returns the list of operations to
// unconditionally remove the device matching the given linkLayerDeviceDocID,
// along with its linkLayerDevicesRefsDoc. No asserts are included for the
// existence of both documents. | [
"removeLinkLayerDeviceUnconditionallyOps",
"returns",
"the",
"list",
"of",
"operations",
"to",
"unconditionally",
"remove",
"the",
"device",
"matching",
"the",
"given",
"linkLayerDeviceDocID",
"along",
"with",
"its",
"linkLayerDevicesRefsDoc",
".",
"No",
"asserts",
"are",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L331-L342 |
156,142 | juju/juju | state/linklayerdevices.go | insertLinkLayerDeviceDocOp | func insertLinkLayerDeviceDocOp(newDoc *linkLayerDeviceDoc) txn.Op {
return txn.Op{
C: linkLayerDevicesC,
Id: newDoc.DocID,
Assert: txn.DocMissing,
Insert: *newDoc,
}
} | go | func insertLinkLayerDeviceDocOp(newDoc *linkLayerDeviceDoc) txn.Op {
return txn.Op{
C: linkLayerDevicesC,
Id: newDoc.DocID,
Assert: txn.DocMissing,
Insert: *newDoc,
}
} | [
"func",
"insertLinkLayerDeviceDocOp",
"(",
"newDoc",
"*",
"linkLayerDeviceDoc",
")",
"txn",
".",
"Op",
"{",
"return",
"txn",
".",
"Op",
"{",
"C",
":",
"linkLayerDevicesC",
",",
"Id",
":",
"newDoc",
".",
"DocID",
",",
"Assert",
":",
"txn",
".",
"DocMissing"... | // insertLinkLayerDeviceDocOp returns an operation inserting the given newDoc,
// asserting it does not exist yet. | [
"insertLinkLayerDeviceDocOp",
"returns",
"an",
"operation",
"inserting",
"the",
"given",
"newDoc",
"asserting",
"it",
"does",
"not",
"exist",
"yet",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L346-L353 |
156,143 | juju/juju | state/linklayerdevices.go | updateLinkLayerDeviceDocOp | func updateLinkLayerDeviceDocOp(existingDoc, newDoc *linkLayerDeviceDoc) (txn.Op, bool) {
changes := make(bson.M)
if existingDoc.ProviderID == "" && newDoc.ProviderID != "" {
// Only allow changing the ProviderID if it was empty.
changes["providerid"] = newDoc.ProviderID
}
if existingDoc.Type != newDoc.Type {
... | go | func updateLinkLayerDeviceDocOp(existingDoc, newDoc *linkLayerDeviceDoc) (txn.Op, bool) {
changes := make(bson.M)
if existingDoc.ProviderID == "" && newDoc.ProviderID != "" {
// Only allow changing the ProviderID if it was empty.
changes["providerid"] = newDoc.ProviderID
}
if existingDoc.Type != newDoc.Type {
... | [
"func",
"updateLinkLayerDeviceDocOp",
"(",
"existingDoc",
",",
"newDoc",
"*",
"linkLayerDeviceDoc",
")",
"(",
"txn",
".",
"Op",
",",
"bool",
")",
"{",
"changes",
":=",
"make",
"(",
"bson",
".",
"M",
")",
"\n",
"if",
"existingDoc",
".",
"ProviderID",
"==",
... | // updateLinkLayerDeviceDocOp returns an operation updating the fields of
// existingDoc with the respective values of those fields in newDoc. DocID,
// ModelUUID, MachineID, and Name cannot be changed. ProviderID cannot be
// changed once set. In all other cases newDoc values overwrites existingDoc
// values. | [
"updateLinkLayerDeviceDocOp",
"returns",
"an",
"operation",
"updating",
"the",
"fields",
"of",
"existingDoc",
"with",
"the",
"respective",
"values",
"of",
"those",
"fields",
"in",
"newDoc",
".",
"DocID",
"ModelUUID",
"MachineID",
"and",
"Name",
"cannot",
"be",
"ch... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L360-L396 |
156,144 | juju/juju | state/linklayerdevices.go | assertLinkLayerDeviceExistsOp | func assertLinkLayerDeviceExistsOp(linkLayerDeviceDocID string) txn.Op {
return txn.Op{
C: linkLayerDevicesC,
Id: linkLayerDeviceDocID,
Assert: txn.DocExists,
}
} | go | func assertLinkLayerDeviceExistsOp(linkLayerDeviceDocID string) txn.Op {
return txn.Op{
C: linkLayerDevicesC,
Id: linkLayerDeviceDocID,
Assert: txn.DocExists,
}
} | [
"func",
"assertLinkLayerDeviceExistsOp",
"(",
"linkLayerDeviceDocID",
"string",
")",
"txn",
".",
"Op",
"{",
"return",
"txn",
".",
"Op",
"{",
"C",
":",
"linkLayerDevicesC",
",",
"Id",
":",
"linkLayerDeviceDocID",
",",
"Assert",
":",
"txn",
".",
"DocExists",
","... | // assertLinkLayerDeviceExistsOp returns an operation asserting the document
// matching linkLayerDeviceDocID exists. | [
"assertLinkLayerDeviceExistsOp",
"returns",
"an",
"operation",
"asserting",
"the",
"document",
"matching",
"linkLayerDeviceDocID",
"exists",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L400-L406 |
156,145 | juju/juju | state/linklayerdevices.go | String | func (dev *LinkLayerDevice) String() string {
return fmt.Sprintf("%s device %q on machine %q", dev.doc.Type, dev.doc.Name, dev.doc.MachineID)
} | go | func (dev *LinkLayerDevice) String() string {
return fmt.Sprintf("%s device %q on machine %q", dev.doc.Type, dev.doc.Name, dev.doc.MachineID)
} | [
"func",
"(",
"dev",
"*",
"LinkLayerDevice",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"dev",
".",
"doc",
".",
"Type",
",",
"dev",
".",
"doc",
".",
"Name",
",",
"dev",
".",
"doc",
".",
"MachineI... | // String returns a human-readable representation of the device. | [
"String",
"returns",
"a",
"human",
"-",
"readable",
"representation",
"of",
"the",
"device",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L409-L411 |
156,146 | juju/juju | state/linklayerdevices.go | IsValidLinkLayerDeviceName | func IsValidLinkLayerDeviceName(name string) bool {
if runtimeGOOS == "linux" {
return isValidLinuxDeviceName(name)
}
hasHash := strings.Contains(name, "#")
return !hasHash && stringLengthBetween(name, 1, 255)
} | go | func IsValidLinkLayerDeviceName(name string) bool {
if runtimeGOOS == "linux" {
return isValidLinuxDeviceName(name)
}
hasHash := strings.Contains(name, "#")
return !hasHash && stringLengthBetween(name, 1, 255)
} | [
"func",
"IsValidLinkLayerDeviceName",
"(",
"name",
"string",
")",
"bool",
"{",
"if",
"runtimeGOOS",
"==",
"\"",
"\"",
"{",
"return",
"isValidLinuxDeviceName",
"(",
"name",
")",
"\n",
"}",
"\n",
"hasHash",
":=",
"strings",
".",
"Contains",
"(",
"name",
",",
... | // IsValidLinkLayerDeviceName returns whether the given name is a valid network
// link-layer device name, depending on the runtime.GOOS value. | [
"IsValidLinkLayerDeviceName",
"returns",
"whether",
"the",
"given",
"name",
"is",
"a",
"valid",
"network",
"link",
"-",
"layer",
"device",
"name",
"depending",
"on",
"the",
"runtime",
".",
"GOOS",
"value",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L440-L446 |
156,147 | juju/juju | state/linklayerdevices.go | Addresses | func (dev *LinkLayerDevice) Addresses() ([]*Address, error) {
var allAddresses []*Address
callbackFunc := func(resultDoc *ipAddressDoc) {
allAddresses = append(allAddresses, newIPAddress(dev.st, *resultDoc))
}
findQuery := findAddressesQuery(dev.doc.MachineID, dev.doc.Name)
if err := dev.st.forEachIPAddressDoc(... | go | func (dev *LinkLayerDevice) Addresses() ([]*Address, error) {
var allAddresses []*Address
callbackFunc := func(resultDoc *ipAddressDoc) {
allAddresses = append(allAddresses, newIPAddress(dev.st, *resultDoc))
}
findQuery := findAddressesQuery(dev.doc.MachineID, dev.doc.Name)
if err := dev.st.forEachIPAddressDoc(... | [
"func",
"(",
"dev",
"*",
"LinkLayerDevice",
")",
"Addresses",
"(",
")",
"(",
"[",
"]",
"*",
"Address",
",",
"error",
")",
"{",
"var",
"allAddresses",
"[",
"]",
"*",
"Address",
"\n",
"callbackFunc",
":=",
"func",
"(",
"resultDoc",
"*",
"ipAddressDoc",
"... | // Addresses returns all IP addresses assigned to the device. | [
"Addresses",
"returns",
"all",
"IP",
"addresses",
"assigned",
"to",
"the",
"device",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L481-L492 |
156,148 | juju/juju | state/linklayerdevices.go | RemoveAddresses | func (dev *LinkLayerDevice) RemoveAddresses() error {
findQuery := findAddressesQuery(dev.doc.MachineID, dev.doc.Name)
ops, err := dev.st.removeMatchingIPAddressesDocOps(findQuery)
if err != nil {
return errors.Trace(err)
}
return dev.st.db().RunTransaction(ops)
} | go | func (dev *LinkLayerDevice) RemoveAddresses() error {
findQuery := findAddressesQuery(dev.doc.MachineID, dev.doc.Name)
ops, err := dev.st.removeMatchingIPAddressesDocOps(findQuery)
if err != nil {
return errors.Trace(err)
}
return dev.st.db().RunTransaction(ops)
} | [
"func",
"(",
"dev",
"*",
"LinkLayerDevice",
")",
"RemoveAddresses",
"(",
")",
"error",
"{",
"findQuery",
":=",
"findAddressesQuery",
"(",
"dev",
".",
"doc",
".",
"MachineID",
",",
"dev",
".",
"doc",
".",
"Name",
")",
"\n",
"ops",
",",
"err",
":=",
"dev... | // RemoveAddresses removes all IP addresses assigned to the device. | [
"RemoveAddresses",
"removes",
"all",
"IP",
"addresses",
"assigned",
"to",
"the",
"device",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L495-L503 |
156,149 | juju/juju | state/linklayerdevices.go | EthernetDeviceForBridge | func (dev *LinkLayerDevice) EthernetDeviceForBridge(name string) (LinkLayerDeviceArgs, error) {
if dev.Type() != BridgeDevice {
return LinkLayerDeviceArgs{}, errors.Errorf("device must be a Bridge Device, receiver has type %q", dev.Type())
}
return LinkLayerDeviceArgs{
Name: name,
Type: EthernetD... | go | func (dev *LinkLayerDevice) EthernetDeviceForBridge(name string) (LinkLayerDeviceArgs, error) {
if dev.Type() != BridgeDevice {
return LinkLayerDeviceArgs{}, errors.Errorf("device must be a Bridge Device, receiver has type %q", dev.Type())
}
return LinkLayerDeviceArgs{
Name: name,
Type: EthernetD... | [
"func",
"(",
"dev",
"*",
"LinkLayerDevice",
")",
"EthernetDeviceForBridge",
"(",
"name",
"string",
")",
"(",
"LinkLayerDeviceArgs",
",",
"error",
")",
"{",
"if",
"dev",
".",
"Type",
"(",
")",
"!=",
"BridgeDevice",
"{",
"return",
"LinkLayerDeviceArgs",
"{",
"... | // EthernetDeviceForBridge returns LinkLayerDeviceArgs representing an ethernet
// device with the input name and this device as its parent.
// If the device is not a bridge, an error is returned. | [
"EthernetDeviceForBridge",
"returns",
"LinkLayerDeviceArgs",
"representing",
"an",
"ethernet",
"device",
"with",
"the",
"input",
"name",
"and",
"this",
"device",
"as",
"its",
"parent",
".",
"If",
"the",
"device",
"is",
"not",
"a",
"bridge",
"an",
"error",
"is",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices.go#L508-L521 |
156,150 | juju/juju | cmd/juju/user/remove.go | SetFlags | func (c *removeCommand) SetFlags(f *gnuflag.FlagSet) {
c.ControllerCommandBase.SetFlags(f)
f.BoolVar(&c.ConfirmDelete, "y", false, "Confirm deletion of the user")
f.BoolVar(&c.ConfirmDelete, "yes", false, "")
} | go | func (c *removeCommand) SetFlags(f *gnuflag.FlagSet) {
c.ControllerCommandBase.SetFlags(f)
f.BoolVar(&c.ConfirmDelete, "y", false, "Confirm deletion of the user")
f.BoolVar(&c.ConfirmDelete, "yes", false, "")
} | [
"func",
"(",
"c",
"*",
"removeCommand",
")",
"SetFlags",
"(",
"f",
"*",
"gnuflag",
".",
"FlagSet",
")",
"{",
"c",
".",
"ControllerCommandBase",
".",
"SetFlags",
"(",
"f",
")",
"\n",
"f",
".",
"BoolVar",
"(",
"&",
"c",
".",
"ConfirmDelete",
",",
"\"",... | // SetFlags adds command specific flags and then returns the flagset. | [
"SetFlags",
"adds",
"command",
"specific",
"flags",
"and",
"then",
"returns",
"the",
"flagset",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/user/remove.go#L75-L79 |
156,151 | juju/juju | api/proxyupdater/proxyupdater.go | NewAPI | func NewAPI(caller base.APICaller, tag names.Tag) (*API, error) {
if caller == nil {
return nil, fmt.Errorf("caller is nil")
}
if tag == nil {
return nil, fmt.Errorf("tag is nil")
}
return &API{
facade: base.NewFacadeCaller(caller, proxyUpdaterFacade),
tag: tag,
}, nil
} | go | func NewAPI(caller base.APICaller, tag names.Tag) (*API, error) {
if caller == nil {
return nil, fmt.Errorf("caller is nil")
}
if tag == nil {
return nil, fmt.Errorf("tag is nil")
}
return &API{
facade: base.NewFacadeCaller(caller, proxyUpdaterFacade),
tag: tag,
}, nil
} | [
"func",
"NewAPI",
"(",
"caller",
"base",
".",
"APICaller",
",",
"tag",
"names",
".",
"Tag",
")",
"(",
"*",
"API",
",",
"error",
")",
"{",
"if",
"caller",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
... | // NewAPI returns a new api client facade instance. | [
"NewAPI",
"returns",
"a",
"new",
"api",
"client",
"facade",
"instance",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/proxyupdater/proxyupdater.go#L28-L41 |
156,152 | juju/juju | api/proxyupdater/proxyupdater.go | WatchForProxyConfigAndAPIHostPortChanges | func (api *API) WatchForProxyConfigAndAPIHostPortChanges() (watcher.NotifyWatcher, error) {
var results params.NotifyWatchResults
args := params.Entities{
Entities: []params.Entity{{Tag: api.tag.String()}},
}
err := api.facade.FacadeCall("WatchForProxyConfigAndAPIHostPortChanges", args, &results)
if err != nil {... | go | func (api *API) WatchForProxyConfigAndAPIHostPortChanges() (watcher.NotifyWatcher, error) {
var results params.NotifyWatchResults
args := params.Entities{
Entities: []params.Entity{{Tag: api.tag.String()}},
}
err := api.facade.FacadeCall("WatchForProxyConfigAndAPIHostPortChanges", args, &results)
if err != nil {... | [
"func",
"(",
"api",
"*",
"API",
")",
"WatchForProxyConfigAndAPIHostPortChanges",
"(",
")",
"(",
"watcher",
".",
"NotifyWatcher",
",",
"error",
")",
"{",
"var",
"results",
"params",
".",
"NotifyWatchResults",
"\n",
"args",
":=",
"params",
".",
"Entities",
"{",
... | // WatchForProxyConfigAndAPIHostPortChanges returns a NotifyWatcher waiting for
// changes in the proxy configuration or API host ports | [
"WatchForProxyConfigAndAPIHostPortChanges",
"returns",
"a",
"NotifyWatcher",
"waiting",
"for",
"changes",
"in",
"the",
"proxy",
"configuration",
"or",
"API",
"host",
"ports"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/proxyupdater/proxyupdater.go#L45-L63 |
156,153 | juju/juju | apiserver/facades/controller/caasoperatorupgrader/upgrader.go | NewStateCAASOperatorUpgraderAPI | func NewStateCAASOperatorUpgraderAPI(ctx facade.Context) (*API, error) {
authorizer := ctx.Auth()
broker, err := stateenvirons.GetNewCAASBrokerFunc(caas.New)(ctx.State())
if err != nil {
return nil, errors.Annotate(err, "getting caas client")
}
return NewCAASOperatorUpgraderAPI(authorizer, broker)
} | go | func NewStateCAASOperatorUpgraderAPI(ctx facade.Context) (*API, error) {
authorizer := ctx.Auth()
broker, err := stateenvirons.GetNewCAASBrokerFunc(caas.New)(ctx.State())
if err != nil {
return nil, errors.Annotate(err, "getting caas client")
}
return NewCAASOperatorUpgraderAPI(authorizer, broker)
} | [
"func",
"NewStateCAASOperatorUpgraderAPI",
"(",
"ctx",
"facade",
".",
"Context",
")",
"(",
"*",
"API",
",",
"error",
")",
"{",
"authorizer",
":=",
"ctx",
".",
"Auth",
"(",
")",
"\n",
"broker",
",",
"err",
":=",
"stateenvirons",
".",
"GetNewCAASBrokerFunc",
... | // NewStateCAASOperatorUpgraderAPI provides the signature required for facade registration. | [
"NewStateCAASOperatorUpgraderAPI",
"provides",
"the",
"signature",
"required",
"for",
"facade",
"registration",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/caasoperatorupgrader/upgrader.go#L28-L35 |
156,154 | juju/juju | apiserver/facades/controller/caasoperatorupgrader/upgrader.go | NewCAASOperatorUpgraderAPI | func NewCAASOperatorUpgraderAPI(
authorizer facade.Authorizer,
broker caas.Upgrader,
) (*API, error) {
if !authorizer.AuthController() && !authorizer.AuthApplicationAgent() {
return nil, common.ErrPerm
}
return &API{
auth: authorizer,
broker: broker,
}, nil
} | go | func NewCAASOperatorUpgraderAPI(
authorizer facade.Authorizer,
broker caas.Upgrader,
) (*API, error) {
if !authorizer.AuthController() && !authorizer.AuthApplicationAgent() {
return nil, common.ErrPerm
}
return &API{
auth: authorizer,
broker: broker,
}, nil
} | [
"func",
"NewCAASOperatorUpgraderAPI",
"(",
"authorizer",
"facade",
".",
"Authorizer",
",",
"broker",
"caas",
".",
"Upgrader",
",",
")",
"(",
"*",
"API",
",",
"error",
")",
"{",
"if",
"!",
"authorizer",
".",
"AuthController",
"(",
")",
"&&",
"!",
"authorize... | // NewCAASOperatorUpgraderAPI returns a new CAAS operator upgrader API facade. | [
"NewCAASOperatorUpgraderAPI",
"returns",
"a",
"new",
"CAAS",
"operator",
"upgrader",
"API",
"facade",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/caasoperatorupgrader/upgrader.go#L38-L49 |
156,155 | juju/juju | apiserver/facades/controller/caasoperatorupgrader/upgrader.go | UpgradeOperator | func (api *API) UpgradeOperator(arg params.KubernetesUpgradeArg) (params.ErrorResult, error) {
serverErr := func(err error) params.ErrorResult {
return params.ErrorResult{common.ServerError(err)}
}
tag, err := names.ParseTag(arg.AgentTag)
if err != nil {
return serverErr(err), nil
}
if !api.auth.AuthOwner(tag... | go | func (api *API) UpgradeOperator(arg params.KubernetesUpgradeArg) (params.ErrorResult, error) {
serverErr := func(err error) params.ErrorResult {
return params.ErrorResult{common.ServerError(err)}
}
tag, err := names.ParseTag(arg.AgentTag)
if err != nil {
return serverErr(err), nil
}
if !api.auth.AuthOwner(tag... | [
"func",
"(",
"api",
"*",
"API",
")",
"UpgradeOperator",
"(",
"arg",
"params",
".",
"KubernetesUpgradeArg",
")",
"(",
"params",
".",
"ErrorResult",
",",
"error",
")",
"{",
"serverErr",
":=",
"func",
"(",
"err",
"error",
")",
"params",
".",
"ErrorResult",
... | // UpgradeOperator upgrades the operator for the specified agents. | [
"UpgradeOperator",
"upgrades",
"the",
"operator",
"for",
"the",
"specified",
"agents",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/caasoperatorupgrader/upgrader.go#L52-L75 |
156,156 | juju/juju | cmd/juju/application/expose.go | Run | func (c *exposeCommand) Run(_ *cmd.Context) error {
client, err := c.getAPI()
if err != nil {
return err
}
defer client.Close()
return block.ProcessBlockedError(client.Expose(c.ApplicationName), block.BlockChange)
} | go | func (c *exposeCommand) Run(_ *cmd.Context) error {
client, err := c.getAPI()
if err != nil {
return err
}
defer client.Close()
return block.ProcessBlockedError(client.Expose(c.ApplicationName), block.BlockChange)
} | [
"func",
"(",
"c",
"*",
"exposeCommand",
")",
"Run",
"(",
"_",
"*",
"cmd",
".",
"Context",
")",
"error",
"{",
"client",
",",
"err",
":=",
"c",
".",
"getAPI",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer... | // Run changes the juju-managed firewall to expose any
// ports that were also explicitly marked by units as open. | [
"Run",
"changes",
"the",
"juju",
"-",
"managed",
"firewall",
"to",
"expose",
"any",
"ports",
"that",
"were",
"also",
"explicitly",
"marked",
"by",
"units",
"as",
"open",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/application/expose.go#L73-L80 |
156,157 | juju/juju | cmd/jujud/agent/engine/valueworker.go | NewValueWorker | func NewValueWorker(value interface{}) (worker.Worker, error) {
if value == nil {
return nil, errors.New("NewValueWorker expects a value")
}
w := &valueWorker{
value: value,
}
w.tomb.Go(func() error {
<-w.tomb.Dying()
return nil
})
return w, nil
} | go | func NewValueWorker(value interface{}) (worker.Worker, error) {
if value == nil {
return nil, errors.New("NewValueWorker expects a value")
}
w := &valueWorker{
value: value,
}
w.tomb.Go(func() error {
<-w.tomb.Dying()
return nil
})
return w, nil
} | [
"func",
"NewValueWorker",
"(",
"value",
"interface",
"{",
"}",
")",
"(",
"worker",
".",
"Worker",
",",
"error",
")",
"{",
"if",
"value",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"w",
":=... | // NewValueWorker returns a degenerate worker that exposes the supplied value
// when passed into ValueWorkerOutput. Please do not supply values that have
// their own dependency or lifecycle considerations; such values will subvert
// the operation of any containing dependency.Engine by insulating it from the
// failu... | [
"NewValueWorker",
"returns",
"a",
"degenerate",
"worker",
"that",
"exposes",
"the",
"supplied",
"value",
"when",
"passed",
"into",
"ValueWorkerOutput",
".",
"Please",
"do",
"not",
"supply",
"values",
"that",
"have",
"their",
"own",
"dependency",
"or",
"lifecycle",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/jujud/agent/engine/valueworker.go#L19-L31 |
156,158 | juju/juju | cmd/jujud/agent/engine/valueworker.go | ValueWorkerOutput | func ValueWorkerOutput(in worker.Worker, out interface{}) error {
inWorker, _ := in.(*valueWorker)
if inWorker == nil {
return errors.Errorf("in should be a *valueWorker; is %#v", in)
}
outV := reflect.ValueOf(out)
if outV.Kind() != reflect.Ptr {
return errors.Errorf("out should be a pointer; is %#v", out)
}
... | go | func ValueWorkerOutput(in worker.Worker, out interface{}) error {
inWorker, _ := in.(*valueWorker)
if inWorker == nil {
return errors.Errorf("in should be a *valueWorker; is %#v", in)
}
outV := reflect.ValueOf(out)
if outV.Kind() != reflect.Ptr {
return errors.Errorf("out should be a pointer; is %#v", out)
}
... | [
"func",
"ValueWorkerOutput",
"(",
"in",
"worker",
".",
"Worker",
",",
"out",
"interface",
"{",
"}",
")",
"error",
"{",
"inWorker",
",",
"_",
":=",
"in",
".",
"(",
"*",
"valueWorker",
")",
"\n",
"if",
"inWorker",
"==",
"nil",
"{",
"return",
"errors",
... | // ValueWorkerOutput sets the value wrapped by the supplied valueWorker into
// the out pointer, if type-compatible, or fails. | [
"ValueWorkerOutput",
"sets",
"the",
"value",
"wrapped",
"by",
"the",
"supplied",
"valueWorker",
"into",
"the",
"out",
"pointer",
"if",
"type",
"-",
"compatible",
"or",
"fails",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/jujud/agent/engine/valueworker.go#L35-L53 |
156,159 | juju/juju | cloudconfig/cloudinit/cloudinit_win.go | RenderScript | func (cfg *windowsCloudConfig) RenderScript() (string, error) {
// NOTE: This shouldn't really be called on windows as it's used only for
// initialization via ssh.
script, err := cfg.renderWindows()
if err != nil {
return "", err
}
return string(script), err
} | go | func (cfg *windowsCloudConfig) RenderScript() (string, error) {
// NOTE: This shouldn't really be called on windows as it's used only for
// initialization via ssh.
script, err := cfg.renderWindows()
if err != nil {
return "", err
}
return string(script), err
} | [
"func",
"(",
"cfg",
"*",
"windowsCloudConfig",
")",
"RenderScript",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"// NOTE: This shouldn't really be called on windows as it's used only for",
"// initialization via ssh.",
"script",
",",
"err",
":=",
"cfg",
".",
"rende... | // RenderScript is defined on the RenderConfig interface. | [
"RenderScript",
"is",
"defined",
"on",
"the",
"RenderConfig",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloudconfig/cloudinit/cloudinit_win.go#L72-L81 |
156,160 | juju/juju | cloudconfig/cloudinit/cloudinit_win.go | renderWindows | func (cfg *windowsCloudConfig) renderWindows() ([]byte, error) {
winCmds := cfg.RunCmds()
var script []byte
newline := "\r\n"
header := "#ps1_sysnative\r\n"
script = append(script, header...)
for _, cmd := range winCmds {
script = append(script, newline...)
script = append(script, cmd...)
}
return script, n... | go | func (cfg *windowsCloudConfig) renderWindows() ([]byte, error) {
winCmds := cfg.RunCmds()
var script []byte
newline := "\r\n"
header := "#ps1_sysnative\r\n"
script = append(script, header...)
for _, cmd := range winCmds {
script = append(script, newline...)
script = append(script, cmd...)
}
return script, n... | [
"func",
"(",
"cfg",
"*",
"windowsCloudConfig",
")",
"renderWindows",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"winCmds",
":=",
"cfg",
".",
"RunCmds",
"(",
")",
"\n",
"var",
"script",
"[",
"]",
"byte",
"\n",
"newline",
":=",
"\"",
"\... | // renderWindows is a helper function which renders the runCmds of the Windows
// CloudConfig to a PowerShell script. | [
"renderWindows",
"is",
"a",
"helper",
"function",
"which",
"renders",
"the",
"runCmds",
"of",
"the",
"Windows",
"CloudConfig",
"to",
"a",
"PowerShell",
"script",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloudconfig/cloudinit/cloudinit_win.go#L90-L101 |
156,161 | juju/juju | apiserver/facades/agent/retrystrategy/retrystrategy.go | NewRetryStrategyAPI | func NewRetryStrategyAPI(
st *state.State,
resources facade.Resources,
authorizer facade.Authorizer,
) (*RetryStrategyAPI, error) {
if !authorizer.AuthUnitAgent() && !authorizer.AuthApplicationAgent() {
return nil, common.ErrPerm
}
model, err := st.Model()
if err != nil {
return nil, errors.Trace(err)
}
... | go | func NewRetryStrategyAPI(
st *state.State,
resources facade.Resources,
authorizer facade.Authorizer,
) (*RetryStrategyAPI, error) {
if !authorizer.AuthUnitAgent() && !authorizer.AuthApplicationAgent() {
return nil, common.ErrPerm
}
model, err := st.Model()
if err != nil {
return nil, errors.Trace(err)
}
... | [
"func",
"NewRetryStrategyAPI",
"(",
"st",
"*",
"state",
".",
"State",
",",
"resources",
"facade",
".",
"Resources",
",",
"authorizer",
"facade",
".",
"Authorizer",
",",
")",
"(",
"*",
"RetryStrategyAPI",
",",
"error",
")",
"{",
"if",
"!",
"authorizer",
"."... | // NewRetryStrategyAPI creates a new API endpoint for getting retry strategies. | [
"NewRetryStrategyAPI",
"creates",
"a",
"new",
"API",
"endpoint",
"for",
"getting",
"retry",
"strategies",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/retrystrategy/retrystrategy.go#L46-L68 |
156,162 | juju/juju | apiserver/facades/agent/retrystrategy/retrystrategy.go | RetryStrategy | func (h *RetryStrategyAPI) RetryStrategy(args params.Entities) (params.RetryStrategyResults, error) {
results := params.RetryStrategyResults{
Results: make([]params.RetryStrategyResult, len(args.Entities)),
}
canAccess, err := h.canAccess()
if err != nil {
return params.RetryStrategyResults{}, errors.Trace(err)... | go | func (h *RetryStrategyAPI) RetryStrategy(args params.Entities) (params.RetryStrategyResults, error) {
results := params.RetryStrategyResults{
Results: make([]params.RetryStrategyResult, len(args.Entities)),
}
canAccess, err := h.canAccess()
if err != nil {
return params.RetryStrategyResults{}, errors.Trace(err)... | [
"func",
"(",
"h",
"*",
"RetryStrategyAPI",
")",
"RetryStrategy",
"(",
"args",
"params",
".",
"Entities",
")",
"(",
"params",
".",
"RetryStrategyResults",
",",
"error",
")",
"{",
"results",
":=",
"params",
".",
"RetryStrategyResults",
"{",
"Results",
":",
"ma... | // RetryStrategy returns RetryStrategyResults that can be used by any code that uses
// to configure the retry timer that's currently in juju utils. | [
"RetryStrategy",
"returns",
"RetryStrategyResults",
"that",
"can",
"be",
"used",
"by",
"any",
"code",
"that",
"uses",
"to",
"configure",
"the",
"retry",
"timer",
"that",
"s",
"currently",
"in",
"juju",
"utils",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/retrystrategy/retrystrategy.go#L72-L107 |
156,163 | juju/juju | apiserver/facades/agent/retrystrategy/retrystrategy.go | WatchRetryStrategy | func (h *RetryStrategyAPI) WatchRetryStrategy(args params.Entities) (params.NotifyWatchResults, error) {
results := params.NotifyWatchResults{
Results: make([]params.NotifyWatchResult, len(args.Entities)),
}
canAccess, err := h.canAccess()
if err != nil {
return params.NotifyWatchResults{}, errors.Trace(err)
}... | go | func (h *RetryStrategyAPI) WatchRetryStrategy(args params.Entities) (params.NotifyWatchResults, error) {
results := params.NotifyWatchResults{
Results: make([]params.NotifyWatchResult, len(args.Entities)),
}
canAccess, err := h.canAccess()
if err != nil {
return params.NotifyWatchResults{}, errors.Trace(err)
}... | [
"func",
"(",
"h",
"*",
"RetryStrategyAPI",
")",
"WatchRetryStrategy",
"(",
"args",
"params",
".",
"Entities",
")",
"(",
"params",
".",
"NotifyWatchResults",
",",
"error",
")",
"{",
"results",
":=",
"params",
".",
"NotifyWatchResults",
"{",
"Results",
":",
"m... | // WatchRetryStrategy watches for changes to the model. Currently we only allow
// changes to the boolean that determines whether retries should be attempted or not. | [
"WatchRetryStrategy",
"watches",
"for",
"changes",
"to",
"the",
"model",
".",
"Currently",
"we",
"only",
"allow",
"changes",
"to",
"the",
"boolean",
"that",
"determines",
"whether",
"retries",
"should",
"be",
"attempted",
"or",
"not",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/retrystrategy/retrystrategy.go#L111-L141 |
156,164 | juju/juju | cmd/juju/common/gui.go | GUIDataSourceBaseURL | func GUIDataSourceBaseURL() string {
url := os.Getenv(guiBaseURLEnvVar)
if url != "" {
return url
}
return gui.DefaultBaseURL
} | go | func GUIDataSourceBaseURL() string {
url := os.Getenv(guiBaseURLEnvVar)
if url != "" {
return url
}
return gui.DefaultBaseURL
} | [
"func",
"GUIDataSourceBaseURL",
"(",
")",
"string",
"{",
"url",
":=",
"os",
".",
"Getenv",
"(",
"guiBaseURLEnvVar",
")",
"\n",
"if",
"url",
"!=",
"\"",
"\"",
"{",
"return",
"url",
"\n",
"}",
"\n",
"return",
"gui",
".",
"DefaultBaseURL",
"\n",
"}"
] | // GUIDataSourceBaseURL returns the default base URL to use for the Juju GUI
// simplestreams data source. The default value can be overridden by setting
// the JUJU_GUI_SIMPLESTREAMS_URL environment variable. | [
"GUIDataSourceBaseURL",
"returns",
"the",
"default",
"base",
"URL",
"to",
"use",
"for",
"the",
"Juju",
"GUI",
"simplestreams",
"data",
"source",
".",
"The",
"default",
"value",
"can",
"be",
"overridden",
"by",
"setting",
"the",
"JUJU_GUI_SIMPLESTREAMS_URL",
"envir... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/common/gui.go#L17-L23 |
156,165 | juju/juju | core/watcher/multinotify.go | NewMultiNotifyWatcher | func NewMultiNotifyWatcher(w ...NotifyWatcher) *MultiNotifyWatcher {
m := &MultiNotifyWatcher{
watchers: w,
changes: make(chan struct{}),
}
var wg sync.WaitGroup
wg.Add(len(w))
staging := make(chan struct{})
for _, w := range w {
// Consume the first event of each watcher.
<-w.Changes()
go func(wCopy N... | go | func NewMultiNotifyWatcher(w ...NotifyWatcher) *MultiNotifyWatcher {
m := &MultiNotifyWatcher{
watchers: w,
changes: make(chan struct{}),
}
var wg sync.WaitGroup
wg.Add(len(w))
staging := make(chan struct{})
for _, w := range w {
// Consume the first event of each watcher.
<-w.Changes()
go func(wCopy N... | [
"func",
"NewMultiNotifyWatcher",
"(",
"w",
"...",
"NotifyWatcher",
")",
"*",
"MultiNotifyWatcher",
"{",
"m",
":=",
"&",
"MultiNotifyWatcher",
"{",
"watchers",
":",
"w",
",",
"changes",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"}",
"\n",
"v... | // NewMultiNotifyWatcher creates a NotifyWatcher that combines
// each of the NotifyWatchers passed in. Each watcher's initial
// event is consumed, and a single initial event is sent.
// Subsequent events are not coalesced. | [
"NewMultiNotifyWatcher",
"creates",
"a",
"NotifyWatcher",
"that",
"combines",
"each",
"of",
"the",
"NotifyWatchers",
"passed",
"in",
".",
"Each",
"watcher",
"s",
"initial",
"event",
"is",
"consumed",
"and",
"a",
"single",
"initial",
"event",
"is",
"sent",
".",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/watcher/multinotify.go#L25-L49 |
156,166 | juju/juju | core/watcher/multinotify.go | loop | func (w *MultiNotifyWatcher) loop(in <-chan struct{}) {
defer close(w.changes)
// out is initialised to m.changes to send the initial event.
out := w.changes
var timer <-chan time.Time
for {
select {
case <-w.tomb.Dying():
return
case <-in:
if timer == nil {
// TODO(fwereade): 2016-03-17 lp:1558657... | go | func (w *MultiNotifyWatcher) loop(in <-chan struct{}) {
defer close(w.changes)
// out is initialised to m.changes to send the initial event.
out := w.changes
var timer <-chan time.Time
for {
select {
case <-w.tomb.Dying():
return
case <-in:
if timer == nil {
// TODO(fwereade): 2016-03-17 lp:1558657... | [
"func",
"(",
"w",
"*",
"MultiNotifyWatcher",
")",
"loop",
"(",
"in",
"<-",
"chan",
"struct",
"{",
"}",
")",
"{",
"defer",
"close",
"(",
"w",
".",
"changes",
")",
"\n",
"// out is initialised to m.changes to send the initial event.",
"out",
":=",
"w",
".",
"c... | // loop copies events from the input channel to the output channel,
// coalescing events by waiting a short time between receiving and
// sending. | [
"loop",
"copies",
"events",
"from",
"the",
"input",
"channel",
"to",
"the",
"output",
"channel",
"coalescing",
"events",
"by",
"waiting",
"a",
"short",
"time",
"between",
"receiving",
"and",
"sending",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/watcher/multinotify.go#L54-L75 |
156,167 | juju/juju | core/watcher/multinotify.go | copyEvents | func copyEvents(out chan<- struct{}, in <-chan struct{}, tomb *tomb.Tomb) {
var outC chan<- struct{}
for {
select {
case <-tomb.Dying():
return
case _, ok := <-in:
if !ok {
return
}
outC = out
case outC <- struct{}{}:
outC = nil
}
}
} | go | func copyEvents(out chan<- struct{}, in <-chan struct{}, tomb *tomb.Tomb) {
var outC chan<- struct{}
for {
select {
case <-tomb.Dying():
return
case _, ok := <-in:
if !ok {
return
}
outC = out
case outC <- struct{}{}:
outC = nil
}
}
} | [
"func",
"copyEvents",
"(",
"out",
"chan",
"<-",
"struct",
"{",
"}",
",",
"in",
"<-",
"chan",
"struct",
"{",
"}",
",",
"tomb",
"*",
"tomb",
".",
"Tomb",
")",
"{",
"var",
"outC",
"chan",
"<-",
"struct",
"{",
"}",
"\n",
"for",
"{",
"select",
"{",
... | // copyEvents copies channel events from "in" to "out", coalescing. | [
"copyEvents",
"copies",
"channel",
"events",
"from",
"in",
"to",
"out",
"coalescing",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/watcher/multinotify.go#L78-L93 |
156,168 | juju/juju | provider/openstack/firewaller.go | GetFirewaller | func (f *firewallerFactory) GetFirewaller(env environs.Environ) Firewaller {
return &switchingFirewaller{env: env.(*Environ)}
} | go | func (f *firewallerFactory) GetFirewaller(env environs.Environ) Firewaller {
return &switchingFirewaller{env: env.(*Environ)}
} | [
"func",
"(",
"f",
"*",
"firewallerFactory",
")",
"GetFirewaller",
"(",
"env",
"environs",
".",
"Environ",
")",
"Firewaller",
"{",
"return",
"&",
"switchingFirewaller",
"{",
"env",
":",
"env",
".",
"(",
"*",
"Environ",
")",
"}",
"\n",
"}"
] | // GetFirewaller implements FirewallerFactory | [
"GetFirewaller",
"implements",
"FirewallerFactory"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/openstack/firewaller.go#L94-L96 |
156,169 | juju/juju | provider/openstack/firewaller.go | GetSecurityGroups | func (c *firewallerBase) GetSecurityGroups(ctx context.ProviderCallContext, ids ...instance.Id) ([]string, error) {
var securityGroupNames []string
if c.environ.Config().FirewallMode() == config.FwInstance {
instances, err := c.environ.Instances(ctx, ids)
if err != nil {
return nil, errors.Trace(err)
}
nov... | go | func (c *firewallerBase) GetSecurityGroups(ctx context.ProviderCallContext, ids ...instance.Id) ([]string, error) {
var securityGroupNames []string
if c.environ.Config().FirewallMode() == config.FwInstance {
instances, err := c.environ.Instances(ctx, ids)
if err != nil {
return nil, errors.Trace(err)
}
nov... | [
"func",
"(",
"c",
"*",
"firewallerBase",
")",
"GetSecurityGroups",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"ids",
"...",
"instance",
".",
"Id",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"securityGroupNames",
"[",
"]",
"... | // GetSecurityGroups implements Firewaller interface. | [
"GetSecurityGroups",
"implements",
"Firewaller",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/openstack/firewaller.go#L218-L251 |
156,170 | juju/juju | provider/openstack/firewaller.go | deleteSecurityGroup | func deleteSecurityGroup(
ctx context.ProviderCallContext,
deleteSecurityGroupById func(string) error,
name, id string,
clock clock.Clock,
) {
logger.Debugf("deleting security group %q", name)
err := retry.Call(retry.CallArgs{
Func: func() error {
if err := deleteSecurityGroupById(id); err != nil {
commo... | go | func deleteSecurityGroup(
ctx context.ProviderCallContext,
deleteSecurityGroupById func(string) error,
name, id string,
clock clock.Clock,
) {
logger.Debugf("deleting security group %q", name)
err := retry.Call(retry.CallArgs{
Func: func() error {
if err := deleteSecurityGroupById(id); err != nil {
commo... | [
"func",
"deleteSecurityGroup",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"deleteSecurityGroupById",
"func",
"(",
"string",
")",
"error",
",",
"name",
",",
"id",
"string",
",",
"clock",
"clock",
".",
"Clock",
",",
")",
"{",
"logger",
".",
"Debug... | // deleteSecurityGroup attempts to delete the security group. Should it fail,
// the deletion is retried due to timing issues in openstack. A security group
// cannot be deleted while it is in use. Theoretically we terminate all the
// instances before we attempt to delete the associated security groups, but
// in prac... | [
"deleteSecurityGroup",
"attempts",
"to",
"delete",
"the",
"security",
"group",
".",
"Should",
"it",
"fail",
"the",
"deletion",
"is",
"retried",
"due",
"to",
"timing",
"issues",
"in",
"openstack",
".",
"A",
"security",
"group",
"cannot",
"be",
"deleted",
"while... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/openstack/firewaller.go#L300-L331 |
156,171 | juju/juju | provider/openstack/firewaller.go | ensureGroup | func (c *neutronFirewaller) ensureGroup(name string, rules []neutron.RuleInfoV2) (neutron.SecurityGroupV2, error) {
neutronClient := c.environ.neutron()
var group neutron.SecurityGroupV2
// Due to parallelization of the provisioner, it's possible that we try
// to create the model security group a second time befo... | go | func (c *neutronFirewaller) ensureGroup(name string, rules []neutron.RuleInfoV2) (neutron.SecurityGroupV2, error) {
neutronClient := c.environ.neutron()
var group neutron.SecurityGroupV2
// Due to parallelization of the provisioner, it's possible that we try
// to create the model security group a second time befo... | [
"func",
"(",
"c",
"*",
"neutronFirewaller",
")",
"ensureGroup",
"(",
"name",
"string",
",",
"rules",
"[",
"]",
"neutron",
".",
"RuleInfoV2",
")",
"(",
"neutron",
".",
"SecurityGroupV2",
",",
"error",
")",
"{",
"neutronClient",
":=",
"c",
".",
"environ",
... | // ensureGroup returns the security group with name and rules.
// If a group with name does not exist, one will be created.
// If it exists, its permissions are set to rules. | [
"ensureGroup",
"returns",
"the",
"security",
"group",
"with",
"name",
"and",
"rules",
".",
"If",
"a",
"group",
"with",
"name",
"does",
"not",
"exist",
"one",
"will",
"be",
"created",
".",
"If",
"it",
"exists",
"its",
"permissions",
"are",
"set",
"to",
"r... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/openstack/firewaller.go#L563-L643 |
156,172 | juju/juju | provider/openstack/firewaller.go | newRuleInfoSetFromRules | func newRuleInfoSetFromRules(rules []neutron.SecurityGroupRuleV2) ruleInfoSet {
m := make(ruleInfoSet)
for _, r := range rules {
k := neutron.RuleInfoV2{
Direction: r.Direction,
EthernetType: r.EthernetType,
RemoteIPPrefix: r.RemoteIPPrefix,
}
if r.IPProtocol != nil {
k.IPProtocol = *r.IPProt... | go | func newRuleInfoSetFromRules(rules []neutron.SecurityGroupRuleV2) ruleInfoSet {
m := make(ruleInfoSet)
for _, r := range rules {
k := neutron.RuleInfoV2{
Direction: r.Direction,
EthernetType: r.EthernetType,
RemoteIPPrefix: r.RemoteIPPrefix,
}
if r.IPProtocol != nil {
k.IPProtocol = *r.IPProt... | [
"func",
"newRuleInfoSetFromRules",
"(",
"rules",
"[",
"]",
"neutron",
".",
"SecurityGroupRuleV2",
")",
"ruleInfoSet",
"{",
"m",
":=",
"make",
"(",
"ruleInfoSet",
")",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"rules",
"{",
"k",
":=",
"neutron",
".",
"Ru... | // newRuleSetForGroup returns a set of all of the permissions in a given
// slice of SecurityGroupRules. It ignores the group id, the
// remove group id, and tenant id. Keep the rule id to delete the rule if
// necessary. | [
"newRuleSetForGroup",
"returns",
"a",
"set",
"of",
"all",
"of",
"the",
"permissions",
"in",
"a",
"given",
"slice",
"of",
"SecurityGroupRules",
".",
"It",
"ignores",
"the",
"group",
"id",
"the",
"remove",
"group",
"id",
"and",
"tenant",
"id",
".",
"Keep",
"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/openstack/firewaller.go#L654-L674 |
156,173 | juju/juju | provider/openstack/firewaller.go | newRuleInfoSetFromRuleInfo | func newRuleInfoSetFromRuleInfo(rules []neutron.RuleInfoV2) ruleInfoSet {
m := make(ruleInfoSet)
for _, r := range rules {
k := neutron.RuleInfoV2{
Direction: r.Direction,
IPProtocol: r.IPProtocol,
PortRangeMin: r.PortRangeMin,
PortRangeMax: r.PortRangeMax,
EthernetType: r.EthernetType... | go | func newRuleInfoSetFromRuleInfo(rules []neutron.RuleInfoV2) ruleInfoSet {
m := make(ruleInfoSet)
for _, r := range rules {
k := neutron.RuleInfoV2{
Direction: r.Direction,
IPProtocol: r.IPProtocol,
PortRangeMin: r.PortRangeMin,
PortRangeMax: r.PortRangeMax,
EthernetType: r.EthernetType... | [
"func",
"newRuleInfoSetFromRuleInfo",
"(",
"rules",
"[",
"]",
"neutron",
".",
"RuleInfoV2",
")",
"ruleInfoSet",
"{",
"m",
":=",
"make",
"(",
"ruleInfoSet",
")",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"rules",
"{",
"k",
":=",
"neutron",
".",
"RuleInfo... | // newRuleSetForGroup returns a set of all of the permissions in a given
// slice of RuleInfo. It ignores the rule id, the group id, the
// remove group id, and tenant id. | [
"newRuleSetForGroup",
"returns",
"a",
"set",
"of",
"all",
"of",
"the",
"permissions",
"in",
"a",
"given",
"slice",
"of",
"RuleInfo",
".",
"It",
"ignores",
"the",
"rule",
"id",
"the",
"group",
"id",
"the",
"remove",
"group",
"id",
"and",
"tenant",
"id",
"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/openstack/firewaller.go#L679-L693 |
156,174 | juju/juju | provider/openstack/firewaller.go | DeleteAllControllerGroups | func (c *neutronFirewaller) DeleteAllControllerGroups(ctx context.ProviderCallContext, controllerUUID string) error {
return deleteSecurityGroupsMatchingName(ctx, c.deleteSecurityGroups, c.jujuControllerGroupPrefix(controllerUUID))
} | go | func (c *neutronFirewaller) DeleteAllControllerGroups(ctx context.ProviderCallContext, controllerUUID string) error {
return deleteSecurityGroupsMatchingName(ctx, c.deleteSecurityGroups, c.jujuControllerGroupPrefix(controllerUUID))
} | [
"func",
"(",
"c",
"*",
"neutronFirewaller",
")",
"DeleteAllControllerGroups",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"controllerUUID",
"string",
")",
"error",
"{",
"return",
"deleteSecurityGroupsMatchingName",
"(",
"ctx",
",",
"c",
".",
"deleteSecur... | // DeleteAllControllerGroups implements Firewaller interface. | [
"DeleteAllControllerGroups",
"implements",
"Firewaller",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/openstack/firewaller.go#L722-L724 |
156,175 | juju/juju | provider/openstack/firewaller.go | matchingGroup | func (c *neutronFirewaller) matchingGroup(ctx context.ProviderCallContext, nameRegExp string) (neutron.SecurityGroupV2, error) {
re, err := regexp.Compile(nameRegExp)
if err != nil {
return neutron.SecurityGroupV2{}, err
}
neutronClient := c.environ.neutron()
allGroups, err := neutronClient.ListSecurityGroupsV2(... | go | func (c *neutronFirewaller) matchingGroup(ctx context.ProviderCallContext, nameRegExp string) (neutron.SecurityGroupV2, error) {
re, err := regexp.Compile(nameRegExp)
if err != nil {
return neutron.SecurityGroupV2{}, err
}
neutronClient := c.environ.neutron()
allGroups, err := neutronClient.ListSecurityGroupsV2(... | [
"func",
"(",
"c",
"*",
"neutronFirewaller",
")",
"matchingGroup",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"nameRegExp",
"string",
")",
"(",
"neutron",
".",
"SecurityGroupV2",
",",
"error",
")",
"{",
"re",
",",
"err",
":=",
"regexp",
".",
"C... | // Matching a security group by name only works if each name is unqiue. Neutron
// security groups are not required to have unique names. Juju constructs unique
// names, but there are frequently multiple matches to 'default' | [
"Matching",
"a",
"security",
"group",
"by",
"name",
"only",
"works",
"if",
"each",
"name",
"is",
"unqiue",
".",
"Neutron",
"security",
"groups",
"are",
"not",
"required",
"to",
"have",
"unique",
"names",
".",
"Juju",
"constructs",
"unique",
"names",
"but",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/openstack/firewaller.go#L873-L897 |
156,176 | juju/juju | provider/openstack/firewaller.go | secGroupMatchesIngressRule | func secGroupMatchesIngressRule(secGroupRule neutron.SecurityGroupRuleV2, rule network.IngressRule) bool {
if secGroupRule.IPProtocol == nil ||
secGroupRule.PortRangeMax == nil || *secGroupRule.PortRangeMax == 0 ||
secGroupRule.PortRangeMin == nil || *secGroupRule.PortRangeMin == 0 {
return false
}
portsMatch ... | go | func secGroupMatchesIngressRule(secGroupRule neutron.SecurityGroupRuleV2, rule network.IngressRule) bool {
if secGroupRule.IPProtocol == nil ||
secGroupRule.PortRangeMax == nil || *secGroupRule.PortRangeMax == 0 ||
secGroupRule.PortRangeMin == nil || *secGroupRule.PortRangeMin == 0 {
return false
}
portsMatch ... | [
"func",
"secGroupMatchesIngressRule",
"(",
"secGroupRule",
"neutron",
".",
"SecurityGroupRuleV2",
",",
"rule",
"network",
".",
"IngressRule",
")",
"bool",
"{",
"if",
"secGroupRule",
".",
"IPProtocol",
"==",
"nil",
"||",
"secGroupRule",
".",
"PortRangeMax",
"==",
"... | // secGroupMatchesIngressRule checks if supplied nova security group rule matches the ingress rule | [
"secGroupMatchesIngressRule",
"checks",
"if",
"supplied",
"nova",
"security",
"group",
"rule",
"matches",
"the",
"ingress",
"rule"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/openstack/firewaller.go#L918-L941 |
156,177 | juju/juju | api/firewaller/machine.go | ActiveSubnets | func (m *Machine) ActiveSubnets() ([]names.SubnetTag, error) {
var results params.StringsResults
args := params.Entities{
Entities: []params.Entity{{Tag: m.tag.String()}},
}
err := m.st.facade.FacadeCall("GetMachineActiveSubnets", args, &results)
if err != nil {
return nil, err
}
if len(results.Results) != 1... | go | func (m *Machine) ActiveSubnets() ([]names.SubnetTag, error) {
var results params.StringsResults
args := params.Entities{
Entities: []params.Entity{{Tag: m.tag.String()}},
}
err := m.st.facade.FacadeCall("GetMachineActiveSubnets", args, &results)
if err != nil {
return nil, err
}
if len(results.Results) != 1... | [
"func",
"(",
"m",
"*",
"Machine",
")",
"ActiveSubnets",
"(",
")",
"(",
"[",
"]",
"names",
".",
"SubnetTag",
",",
"error",
")",
"{",
"var",
"results",
"params",
".",
"StringsResults",
"\n",
"args",
":=",
"params",
".",
"Entities",
"{",
"Entities",
":",
... | // ActiveSubnets returns a list of subnet tags for which the machine has opened
// ports. | [
"ActiveSubnets",
"returns",
"a",
"list",
"of",
"subnet",
"tags",
"for",
"which",
"the",
"machine",
"has",
"opened",
"ports",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/firewaller/machine.go#L80-L109 |
156,178 | juju/juju | api/firewaller/machine.go | OpenedPorts | func (m *Machine) OpenedPorts(subnetTag names.SubnetTag) (map[network.PortRange]names.UnitTag, error) {
var results params.MachinePortsResults
var subnetTagAsString string
if subnetTag.Id() != "" {
subnetTagAsString = subnetTag.String()
}
args := params.MachinePortsParams{
Params: []params.MachinePorts{
{Ma... | go | func (m *Machine) OpenedPorts(subnetTag names.SubnetTag) (map[network.PortRange]names.UnitTag, error) {
var results params.MachinePortsResults
var subnetTagAsString string
if subnetTag.Id() != "" {
subnetTagAsString = subnetTag.String()
}
args := params.MachinePortsParams{
Params: []params.MachinePorts{
{Ma... | [
"func",
"(",
"m",
"*",
"Machine",
")",
"OpenedPorts",
"(",
"subnetTag",
"names",
".",
"SubnetTag",
")",
"(",
"map",
"[",
"network",
".",
"PortRange",
"]",
"names",
".",
"UnitTag",
",",
"error",
")",
"{",
"var",
"results",
"params",
".",
"MachinePortsResu... | // OpenedPorts returns a map of network.PortRange to unit tag for all opened
// port ranges on the machine for the subnet matching given subnetTag. | [
"OpenedPorts",
"returns",
"a",
"map",
"of",
"network",
".",
"PortRange",
"to",
"unit",
"tag",
"for",
"all",
"opened",
"port",
"ranges",
"on",
"the",
"machine",
"for",
"the",
"subnet",
"matching",
"given",
"subnetTag",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/firewaller/machine.go#L113-L145 |
156,179 | juju/juju | state/txns.go | ResumeTransactions | func (st *State) ResumeTransactions() error {
runner, closer := st.database.TransactionRunner()
defer closer()
return runner.ResumeTransactions()
} | go | func (st *State) ResumeTransactions() error {
runner, closer := st.database.TransactionRunner()
defer closer()
return runner.ResumeTransactions()
} | [
"func",
"(",
"st",
"*",
"State",
")",
"ResumeTransactions",
"(",
")",
"error",
"{",
"runner",
",",
"closer",
":=",
"st",
".",
"database",
".",
"TransactionRunner",
"(",
")",
"\n",
"defer",
"closer",
"(",
")",
"\n",
"return",
"runner",
".",
"ResumeTransac... | // ResumeTransactions resumes all pending transactions. | [
"ResumeTransactions",
"resumes",
"all",
"pending",
"transactions",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/txns.go#L33-L37 |
156,180 | juju/juju | state/txns.go | MaybePruneTransactions | func (st *State) MaybePruneTransactions() error {
runner, closer := st.database.TransactionRunner()
defer closer()
cfg, err := st.ControllerConfig()
if err != nil {
return errors.Trace(err)
}
// Prune txns when txn count has increased by 10% since last prune.
return runner.MaybePruneTransactions(jujutxn.PruneO... | go | func (st *State) MaybePruneTransactions() error {
runner, closer := st.database.TransactionRunner()
defer closer()
cfg, err := st.ControllerConfig()
if err != nil {
return errors.Trace(err)
}
// Prune txns when txn count has increased by 10% since last prune.
return runner.MaybePruneTransactions(jujutxn.PruneO... | [
"func",
"(",
"st",
"*",
"State",
")",
"MaybePruneTransactions",
"(",
")",
"error",
"{",
"runner",
",",
"closer",
":=",
"st",
".",
"database",
".",
"TransactionRunner",
"(",
")",
"\n",
"defer",
"closer",
"(",
")",
"\n",
"cfg",
",",
"err",
":=",
"st",
... | // MaybePruneTransactions removes data for completed transactions. | [
"MaybePruneTransactions",
"removes",
"data",
"for",
"completed",
"transactions",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/txns.go#L40-L58 |
156,181 | juju/juju | state/txns.go | RunTransaction | func (r *multiModelRunner) RunTransaction(tx *jujutxn.Transaction) error {
if len(tx.Ops) == 0 {
stack := shortStack()
// It is a warning that should be reported to us, but we definitely
// don't want to clutter up logs so we'll only write it once.
if !seenShortStacks[stack] {
seenShortStacks[stack] = true
... | go | func (r *multiModelRunner) RunTransaction(tx *jujutxn.Transaction) error {
if len(tx.Ops) == 0 {
stack := shortStack()
// It is a warning that should be reported to us, but we definitely
// don't want to clutter up logs so we'll only write it once.
if !seenShortStacks[stack] {
seenShortStacks[stack] = true
... | [
"func",
"(",
"r",
"*",
"multiModelRunner",
")",
"RunTransaction",
"(",
"tx",
"*",
"jujutxn",
".",
"Transaction",
")",
"error",
"{",
"if",
"len",
"(",
"tx",
".",
"Ops",
")",
"==",
"0",
"{",
"stack",
":=",
"shortStack",
"(",
")",
"\n",
"// It is a warnin... | // RunTransaction is part of the jujutxn.Runner interface. Operations
// that affect multi-model collections will be modified to
// ensure correct interaction with these collections. | [
"RunTransaction",
"is",
"part",
"of",
"the",
"jujutxn",
".",
"Runner",
"interface",
".",
"Operations",
"that",
"affect",
"multi",
"-",
"model",
"collections",
"will",
"be",
"modified",
"to",
"ensure",
"correct",
"interaction",
"with",
"these",
"collections",
"."... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/txns.go#L82-L98 |
156,182 | juju/juju | state/txns.go | Run | func (r *multiModelRunner) Run(transactions jujutxn.TransactionSource) error {
return r.rawRunner.Run(func(attempt int) ([]txn.Op, error) {
ops, err := transactions(attempt)
if err != nil {
// Don't use Trace here as jujutxn doens't use juju/errors
// and won't deal correctly with some returned errors.
re... | go | func (r *multiModelRunner) Run(transactions jujutxn.TransactionSource) error {
return r.rawRunner.Run(func(attempt int) ([]txn.Op, error) {
ops, err := transactions(attempt)
if err != nil {
// Don't use Trace here as jujutxn doens't use juju/errors
// and won't deal correctly with some returned errors.
re... | [
"func",
"(",
"r",
"*",
"multiModelRunner",
")",
"Run",
"(",
"transactions",
"jujutxn",
".",
"TransactionSource",
")",
"error",
"{",
"return",
"r",
".",
"rawRunner",
".",
"Run",
"(",
"func",
"(",
"attempt",
"int",
")",
"(",
"[",
"]",
"txn",
".",
"Op",
... | // Run is part of the jujutxn.Runner interface. Operations returned by
// the given "transactions" function that affect multi-model
// collections will be modified to ensure correct interaction with
// these collections. | [
"Run",
"is",
"part",
"of",
"the",
"jujutxn",
".",
"Runner",
"interface",
".",
"Operations",
"returned",
"by",
"the",
"given",
"transactions",
"function",
"that",
"affect",
"multi",
"-",
"model",
"collections",
"will",
"be",
"modified",
"to",
"ensure",
"correct... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/txns.go#L104-L118 |
156,183 | juju/juju | state/txns.go | MaybePruneTransactions | func (r *multiModelRunner) MaybePruneTransactions(opts jujutxn.PruneOptions) error {
return r.rawRunner.MaybePruneTransactions(opts)
} | go | func (r *multiModelRunner) MaybePruneTransactions(opts jujutxn.PruneOptions) error {
return r.rawRunner.MaybePruneTransactions(opts)
} | [
"func",
"(",
"r",
"*",
"multiModelRunner",
")",
"MaybePruneTransactions",
"(",
"opts",
"jujutxn",
".",
"PruneOptions",
")",
"error",
"{",
"return",
"r",
".",
"rawRunner",
".",
"MaybePruneTransactions",
"(",
"opts",
")",
"\n",
"}"
] | // MaybePruneTransactions is part of the jujutxn.Runner interface. | [
"MaybePruneTransactions",
"is",
"part",
"of",
"the",
"jujutxn",
".",
"Runner",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/txns.go#L126-L128 |
156,184 | juju/juju | state/txns.go | mungeUpdate | func (r *multiModelRunner) mungeUpdate(updateDoc interface{}) (interface{}, error) {
switch doc := updateDoc.(type) {
case bson.D:
return r.mungeBsonDUpdate(doc)
case bson.M:
return r.mungeBsonMUpdate(doc)
default:
return nil, errors.Errorf("don't know how to handle %T", updateDoc)
}
} | go | func (r *multiModelRunner) mungeUpdate(updateDoc interface{}) (interface{}, error) {
switch doc := updateDoc.(type) {
case bson.D:
return r.mungeBsonDUpdate(doc)
case bson.M:
return r.mungeBsonMUpdate(doc)
default:
return nil, errors.Errorf("don't know how to handle %T", updateDoc)
}
} | [
"func",
"(",
"r",
"*",
"multiModelRunner",
")",
"mungeUpdate",
"(",
"updateDoc",
"interface",
"{",
"}",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"switch",
"doc",
":=",
"updateDoc",
".",
"(",
"type",
")",
"{",
"case",
"bson",
".",
"D",... | // mungeUpdate takes the value of an txn.Op Update field and modifies
// it to be multi-model safe, returning the modified document. | [
"mungeUpdate",
"takes",
"the",
"value",
"of",
"an",
"txn",
".",
"Op",
"Update",
"field",
"and",
"modifies",
"it",
"to",
"be",
"multi",
"-",
"model",
"safe",
"returning",
"the",
"modified",
"document",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/txns.go#L169-L178 |
156,185 | juju/juju | payload/context/status-set.go | NewStatusSetCmd | func NewStatusSetCmd(ctx HookContext) (*StatusSetCmd, error) {
return &StatusSetCmd{hookContextFunc: componentHookContext(ctx)}, nil
} | go | func NewStatusSetCmd(ctx HookContext) (*StatusSetCmd, error) {
return &StatusSetCmd{hookContextFunc: componentHookContext(ctx)}, nil
} | [
"func",
"NewStatusSetCmd",
"(",
"ctx",
"HookContext",
")",
"(",
"*",
"StatusSetCmd",
",",
"error",
")",
"{",
"return",
"&",
"StatusSetCmd",
"{",
"hookContextFunc",
":",
"componentHookContext",
"(",
"ctx",
")",
"}",
",",
"nil",
"\n",
"}"
] | // NewStatusSetCmd returns a new StatusSetCmd that wraps the given context. | [
"NewStatusSetCmd",
"returns",
"a",
"new",
"StatusSetCmd",
"that",
"wraps",
"the",
"given",
"context",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/payload/context/status-set.go#L18-L20 |
156,186 | juju/juju | state/linklayerdevices_refs.go | insertLinkLayerDevicesRefsOp | func insertLinkLayerDevicesRefsOp(modelUUID, linkLayerDeviceDocID string) txn.Op {
refsDoc := &linkLayerDevicesRefsDoc{
DocID: linkLayerDeviceDocID,
ModelUUID: modelUUID,
NumChildren: 0,
}
return txn.Op{
C: linkLayerDevicesRefsC,
Id: linkLayerDeviceDocID,
Assert: txn.DocMissing,
Insert... | go | func insertLinkLayerDevicesRefsOp(modelUUID, linkLayerDeviceDocID string) txn.Op {
refsDoc := &linkLayerDevicesRefsDoc{
DocID: linkLayerDeviceDocID,
ModelUUID: modelUUID,
NumChildren: 0,
}
return txn.Op{
C: linkLayerDevicesRefsC,
Id: linkLayerDeviceDocID,
Assert: txn.DocMissing,
Insert... | [
"func",
"insertLinkLayerDevicesRefsOp",
"(",
"modelUUID",
",",
"linkLayerDeviceDocID",
"string",
")",
"txn",
".",
"Op",
"{",
"refsDoc",
":=",
"&",
"linkLayerDevicesRefsDoc",
"{",
"DocID",
":",
"linkLayerDeviceDocID",
",",
"ModelUUID",
":",
"modelUUID",
",",
"NumChil... | // insertLinkLayerDevicesRefsOp returns an operation to insert a new
// linkLayerDevicesRefsDoc for the given modelUUID and linkLayerDeviceDocID,
// with NumChildren=0. | [
"insertLinkLayerDevicesRefsOp",
"returns",
"an",
"operation",
"to",
"insert",
"a",
"new",
"linkLayerDevicesRefsDoc",
"for",
"the",
"given",
"modelUUID",
"and",
"linkLayerDeviceDocID",
"with",
"NumChildren",
"=",
"0",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices_refs.go#L31-L43 |
156,187 | juju/juju | state/linklayerdevices_refs.go | removeLinkLayerDevicesRefsOp | func removeLinkLayerDevicesRefsOp(linkLayerDeviceDocID string) txn.Op {
hasNoChildren := bson.D{{"num-children", 0}}
return txn.Op{
C: linkLayerDevicesRefsC,
Id: linkLayerDeviceDocID,
Assert: hasNoChildren,
Remove: true,
}
} | go | func removeLinkLayerDevicesRefsOp(linkLayerDeviceDocID string) txn.Op {
hasNoChildren := bson.D{{"num-children", 0}}
return txn.Op{
C: linkLayerDevicesRefsC,
Id: linkLayerDeviceDocID,
Assert: hasNoChildren,
Remove: true,
}
} | [
"func",
"removeLinkLayerDevicesRefsOp",
"(",
"linkLayerDeviceDocID",
"string",
")",
"txn",
".",
"Op",
"{",
"hasNoChildren",
":=",
"bson",
".",
"D",
"{",
"{",
"\"",
"\"",
",",
"0",
"}",
"}",
"\n",
"return",
"txn",
".",
"Op",
"{",
"C",
":",
"linkLayerDevic... | // removeLinkLayerDevicesRefsOp returns an operation to remove the
// linkLayerDevicesRefsDoc for the given linkLayerDeviceDocID, asserting the
// document has NumChildren == 0. | [
"removeLinkLayerDevicesRefsOp",
"returns",
"an",
"operation",
"to",
"remove",
"the",
"linkLayerDevicesRefsDoc",
"for",
"the",
"given",
"linkLayerDeviceDocID",
"asserting",
"the",
"document",
"has",
"NumChildren",
"==",
"0",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices_refs.go#L48-L56 |
156,188 | juju/juju | state/linklayerdevices_refs.go | getParentDeviceNumChildrenRefs | func getParentDeviceNumChildrenRefs(st *State, linkLayerDeviceDocID string) (int, error) {
devicesRefs, closer := st.db().GetCollection(linkLayerDevicesRefsC)
defer closer()
var doc linkLayerDevicesRefsDoc
err := devicesRefs.FindId(linkLayerDeviceDocID).One(&doc)
if err == mgo.ErrNotFound {
return -1, nil
} el... | go | func getParentDeviceNumChildrenRefs(st *State, linkLayerDeviceDocID string) (int, error) {
devicesRefs, closer := st.db().GetCollection(linkLayerDevicesRefsC)
defer closer()
var doc linkLayerDevicesRefsDoc
err := devicesRefs.FindId(linkLayerDeviceDocID).One(&doc)
if err == mgo.ErrNotFound {
return -1, nil
} el... | [
"func",
"getParentDeviceNumChildrenRefs",
"(",
"st",
"*",
"State",
",",
"linkLayerDeviceDocID",
"string",
")",
"(",
"int",
",",
"error",
")",
"{",
"devicesRefs",
",",
"closer",
":=",
"st",
".",
"db",
"(",
")",
".",
"GetCollection",
"(",
"linkLayerDevicesRefsC"... | // getParentDeviceNumChildrenRefs returns the NumChildren value for the given
// linkLayerDeviceDocID. If the linkLayerDevicesRefsDoc is missing, no error and
// -1 children are returned. | [
"getParentDeviceNumChildrenRefs",
"returns",
"the",
"NumChildren",
"value",
"for",
"the",
"given",
"linkLayerDeviceDocID",
".",
"If",
"the",
"linkLayerDevicesRefsDoc",
"is",
"missing",
"no",
"error",
"and",
"-",
"1",
"children",
"are",
"returned",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices_refs.go#L61-L73 |
156,189 | juju/juju | state/linklayerdevices_refs.go | incrementDeviceNumChildrenOp | func incrementDeviceNumChildrenOp(linkLayerDeviceDocID string) txn.Op {
hasZeroOrMoreChildren := bson.D{{"num-children", bson.D{{"$gte", 0}}}}
return txn.Op{
C: linkLayerDevicesRefsC,
Id: linkLayerDeviceDocID,
Assert: hasZeroOrMoreChildren,
Update: bson.D{{"$inc", bson.D{{"num-children", 1}}}},
}
} | go | func incrementDeviceNumChildrenOp(linkLayerDeviceDocID string) txn.Op {
hasZeroOrMoreChildren := bson.D{{"num-children", bson.D{{"$gte", 0}}}}
return txn.Op{
C: linkLayerDevicesRefsC,
Id: linkLayerDeviceDocID,
Assert: hasZeroOrMoreChildren,
Update: bson.D{{"$inc", bson.D{{"num-children", 1}}}},
}
} | [
"func",
"incrementDeviceNumChildrenOp",
"(",
"linkLayerDeviceDocID",
"string",
")",
"txn",
".",
"Op",
"{",
"hasZeroOrMoreChildren",
":=",
"bson",
".",
"D",
"{",
"{",
"\"",
"\"",
",",
"bson",
".",
"D",
"{",
"{",
"\"",
"\"",
",",
"0",
"}",
"}",
"}",
"}",... | // incrementDeviceNumChildrenOp returns an operation that increments the
// NumChildren value of the linkLayerDevicesRefsDoc matching the given
// linkLayerDeviceDocID, and asserting the document has NumChildren >= 0. | [
"incrementDeviceNumChildrenOp",
"returns",
"an",
"operation",
"that",
"increments",
"the",
"NumChildren",
"value",
"of",
"the",
"linkLayerDevicesRefsDoc",
"matching",
"the",
"given",
"linkLayerDeviceDocID",
"and",
"asserting",
"the",
"document",
"has",
"NumChildren",
">",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices_refs.go#L78-L86 |
156,190 | juju/juju | state/linklayerdevices_refs.go | decrementDeviceNumChildrenOp | func decrementDeviceNumChildrenOp(linkLayerDeviceDocID string) txn.Op {
hasAtLeastOneMoreChild := bson.D{{"num-children", bson.D{{"$gte", 1}}}}
return txn.Op{
C: linkLayerDevicesRefsC,
Id: linkLayerDeviceDocID,
Assert: hasAtLeastOneMoreChild,
Update: bson.D{{"$inc", bson.D{{"num-children", -1}}}},
}... | go | func decrementDeviceNumChildrenOp(linkLayerDeviceDocID string) txn.Op {
hasAtLeastOneMoreChild := bson.D{{"num-children", bson.D{{"$gte", 1}}}}
return txn.Op{
C: linkLayerDevicesRefsC,
Id: linkLayerDeviceDocID,
Assert: hasAtLeastOneMoreChild,
Update: bson.D{{"$inc", bson.D{{"num-children", -1}}}},
}... | [
"func",
"decrementDeviceNumChildrenOp",
"(",
"linkLayerDeviceDocID",
"string",
")",
"txn",
".",
"Op",
"{",
"hasAtLeastOneMoreChild",
":=",
"bson",
".",
"D",
"{",
"{",
"\"",
"\"",
",",
"bson",
".",
"D",
"{",
"{",
"\"",
"\"",
",",
"1",
"}",
"}",
"}",
"}"... | // decrementDeviceNumChildrenOp returns an operation that decrements the
// NumChildren value of the linkLayerDevicesRefsDoc matching the given
// linkLayerDeviceDocID, and asserting the document has NumChildren >= 1. | [
"decrementDeviceNumChildrenOp",
"returns",
"an",
"operation",
"that",
"decrements",
"the",
"NumChildren",
"value",
"of",
"the",
"linkLayerDevicesRefsDoc",
"matching",
"the",
"given",
"linkLayerDeviceDocID",
"and",
"asserting",
"the",
"document",
"has",
"NumChildren",
">",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices_refs.go#L91-L99 |
156,191 | juju/juju | api/applicationoffers/client.go | Offer | func (c *Client) Offer(modelUUID, application string, endpoints []string, offerName string, desc string) ([]params.ErrorResult, error) {
// TODO(wallyworld) - support endpoint aliases
ep := make(map[string]string)
for _, name := range endpoints {
ep[name] = name
}
offers := []params.AddApplicationOffer{
{
M... | go | func (c *Client) Offer(modelUUID, application string, endpoints []string, offerName string, desc string) ([]params.ErrorResult, error) {
// TODO(wallyworld) - support endpoint aliases
ep := make(map[string]string)
for _, name := range endpoints {
ep[name] = name
}
offers := []params.AddApplicationOffer{
{
M... | [
"func",
"(",
"c",
"*",
"Client",
")",
"Offer",
"(",
"modelUUID",
",",
"application",
"string",
",",
"endpoints",
"[",
"]",
"string",
",",
"offerName",
"string",
",",
"desc",
"string",
")",
"(",
"[",
"]",
"params",
".",
"ErrorResult",
",",
"error",
")",... | // Offer prepares application's endpoints for consumption. | [
"Offer",
"prepares",
"application",
"s",
"endpoints",
"for",
"consumption",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/applicationoffers/client.go#L34-L54 |
156,192 | juju/juju | api/applicationoffers/client.go | ListOffers | func (c *Client) ListOffers(filters ...crossmodel.ApplicationOfferFilter) ([]*crossmodel.ApplicationOfferDetails, error) {
var paramsFilter params.OfferFilters
for _, f := range filters {
filterTerm := params.OfferFilter{
OwnerName: f.OwnerName,
ModelName: f.ModelName,
OfferName: ... | go | func (c *Client) ListOffers(filters ...crossmodel.ApplicationOfferFilter) ([]*crossmodel.ApplicationOfferDetails, error) {
var paramsFilter params.OfferFilters
for _, f := range filters {
filterTerm := params.OfferFilter{
OwnerName: f.OwnerName,
ModelName: f.ModelName,
OfferName: ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListOffers",
"(",
"filters",
"...",
"crossmodel",
".",
"ApplicationOfferFilter",
")",
"(",
"[",
"]",
"*",
"crossmodel",
".",
"ApplicationOfferDetails",
",",
"error",
")",
"{",
"var",
"paramsFilter",
"params",
".",
"Offe... | // ListOffers gets all remote applications that have been offered from this Juju model.
// Each returned application satisfies at least one of the the specified filters. | [
"ListOffers",
"gets",
"all",
"remote",
"applications",
"that",
"have",
"been",
"offered",
"from",
"this",
"Juju",
"model",
".",
"Each",
"returned",
"application",
"satisfies",
"at",
"least",
"one",
"of",
"the",
"the",
"specified",
"filters",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/applicationoffers/client.go#L58-L90 |
156,193 | juju/juju | api/applicationoffers/client.go | GrantOffer | func (c *Client) GrantOffer(user, access string, offerURLs ...string) error {
return c.modifyOfferUser(params.GrantOfferAccess, user, access, offerURLs)
} | go | func (c *Client) GrantOffer(user, access string, offerURLs ...string) error {
return c.modifyOfferUser(params.GrantOfferAccess, user, access, offerURLs)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GrantOffer",
"(",
"user",
",",
"access",
"string",
",",
"offerURLs",
"...",
"string",
")",
"error",
"{",
"return",
"c",
".",
"modifyOfferUser",
"(",
"params",
".",
"GrantOfferAccess",
",",
"user",
",",
"access",
","... | // GrantOffer grants a user access to the specified offers. | [
"GrantOffer",
"grants",
"a",
"user",
"access",
"to",
"the",
"specified",
"offers",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/applicationoffers/client.go#L147-L149 |
156,194 | juju/juju | api/applicationoffers/client.go | RevokeOffer | func (c *Client) RevokeOffer(user, access string, offerURLs ...string) error {
return c.modifyOfferUser(params.RevokeOfferAccess, user, access, offerURLs)
} | go | func (c *Client) RevokeOffer(user, access string, offerURLs ...string) error {
return c.modifyOfferUser(params.RevokeOfferAccess, user, access, offerURLs)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"RevokeOffer",
"(",
"user",
",",
"access",
"string",
",",
"offerURLs",
"...",
"string",
")",
"error",
"{",
"return",
"c",
".",
"modifyOfferUser",
"(",
"params",
".",
"RevokeOfferAccess",
",",
"user",
",",
"access",
"... | // RevokeOffer revokes a user's access to the specified offers. | [
"RevokeOffer",
"revokes",
"a",
"user",
"s",
"access",
"to",
"the",
"specified",
"offers",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/applicationoffers/client.go#L152-L154 |
156,195 | juju/juju | api/applicationoffers/client.go | ApplicationOffer | func (c *Client) ApplicationOffer(urlStr string) (*crossmodel.ApplicationOfferDetails, error) {
url, err := crossmodel.ParseOfferURL(urlStr)
if err != nil {
return nil, errors.Trace(err)
}
if url.Source != "" {
return nil, errors.NotSupportedf("query for non-local application offers")
}
found := params.Appl... | go | func (c *Client) ApplicationOffer(urlStr string) (*crossmodel.ApplicationOfferDetails, error) {
url, err := crossmodel.ParseOfferURL(urlStr)
if err != nil {
return nil, errors.Trace(err)
}
if url.Source != "" {
return nil, errors.NotSupportedf("query for non-local application offers")
}
found := params.Appl... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ApplicationOffer",
"(",
"urlStr",
"string",
")",
"(",
"*",
"crossmodel",
".",
"ApplicationOfferDetails",
",",
"error",
")",
"{",
"url",
",",
"err",
":=",
"crossmodel",
".",
"ParseOfferURL",
"(",
"urlStr",
")",
"\n",
... | // ApplicationOffer returns offered remote application details for a given URL. | [
"ApplicationOffer",
"returns",
"offered",
"remote",
"application",
"details",
"for",
"a",
"given",
"URL",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/applicationoffers/client.go#L196-L223 |
156,196 | juju/juju | api/applicationoffers/client.go | FindApplicationOffers | func (c *Client) FindApplicationOffers(filters ...crossmodel.ApplicationOfferFilter) ([]*crossmodel.ApplicationOfferDetails, error) {
// We need at least one filter. The default filter will list all local applications.
if len(filters) == 0 {
return nil, errors.New("at least one filter must be specified")
}
var pa... | go | func (c *Client) FindApplicationOffers(filters ...crossmodel.ApplicationOfferFilter) ([]*crossmodel.ApplicationOfferDetails, error) {
// We need at least one filter. The default filter will list all local applications.
if len(filters) == 0 {
return nil, errors.New("at least one filter must be specified")
}
var pa... | [
"func",
"(",
"c",
"*",
"Client",
")",
"FindApplicationOffers",
"(",
"filters",
"...",
"crossmodel",
".",
"ApplicationOfferFilter",
")",
"(",
"[",
"]",
"*",
"crossmodel",
".",
"ApplicationOfferDetails",
",",
"error",
")",
"{",
"// We need at least one filter. The def... | // FindApplicationOffers returns all application offers matching the supplied filter. | [
"FindApplicationOffers",
"returns",
"all",
"application",
"offers",
"matching",
"the",
"supplied",
"filter",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/applicationoffers/client.go#L226-L253 |
156,197 | juju/juju | api/applicationoffers/client.go | GetConsumeDetails | func (c *Client) GetConsumeDetails(urlStr string) (params.ConsumeOfferDetails, error) {
url, err := crossmodel.ParseOfferURL(urlStr)
if err != nil {
return params.ConsumeOfferDetails{}, errors.Trace(err)
}
if url.Source != "" {
return params.ConsumeOfferDetails{}, errors.NotSupportedf("query for application of... | go | func (c *Client) GetConsumeDetails(urlStr string) (params.ConsumeOfferDetails, error) {
url, err := crossmodel.ParseOfferURL(urlStr)
if err != nil {
return params.ConsumeOfferDetails{}, errors.Trace(err)
}
if url.Source != "" {
return params.ConsumeOfferDetails{}, errors.NotSupportedf("query for application of... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetConsumeDetails",
"(",
"urlStr",
"string",
")",
"(",
"params",
".",
"ConsumeOfferDetails",
",",
"error",
")",
"{",
"url",
",",
"err",
":=",
"crossmodel",
".",
"ParseOfferURL",
"(",
"urlStr",
")",
"\n",
"if",
"err"... | // GetConsumeDetails returns details necessary to consue an offer at a given URL. | [
"GetConsumeDetails",
"returns",
"details",
"necessary",
"to",
"consue",
"an",
"offer",
"at",
"a",
"given",
"URL",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/applicationoffers/client.go#L256-L287 |
156,198 | juju/juju | api/applicationoffers/client.go | DestroyOffers | func (c *Client) DestroyOffers(force bool, offerURLs ...string) error {
if len(offerURLs) == 0 {
return nil
}
if force {
if bestVer := c.BestAPIVersion(); bestVer < 2 {
return errors.NotImplementedf("DestroyOffers() with force (need v2+, have v%d)", bestVer)
}
}
args := params.DestroyApplicationOffers{
... | go | func (c *Client) DestroyOffers(force bool, offerURLs ...string) error {
if len(offerURLs) == 0 {
return nil
}
if force {
if bestVer := c.BestAPIVersion(); bestVer < 2 {
return errors.NotImplementedf("DestroyOffers() with force (need v2+, have v%d)", bestVer)
}
}
args := params.DestroyApplicationOffers{
... | [
"func",
"(",
"c",
"*",
"Client",
")",
"DestroyOffers",
"(",
"force",
"bool",
",",
"offerURLs",
"...",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"offerURLs",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"force",
"{",
"if",
"best... | // DestroyOffers removes the specified application offers. | [
"DestroyOffers",
"removes",
"the",
"specified",
"application",
"offers",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/applicationoffers/client.go#L290-L319 |
156,199 | juju/juju | api/leadership/client.go | NewClient | func NewClient(caller base.APICaller) leadership.Claimer {
return &client{base.NewFacadeCaller(caller, "LeadershipService")}
} | go | func NewClient(caller base.APICaller) leadership.Claimer {
return &client{base.NewFacadeCaller(caller, "LeadershipService")}
} | [
"func",
"NewClient",
"(",
"caller",
"base",
".",
"APICaller",
")",
"leadership",
".",
"Claimer",
"{",
"return",
"&",
"client",
"{",
"base",
".",
"NewFacadeCaller",
"(",
"caller",
",",
"\"",
"\"",
")",
"}",
"\n",
"}"
] | // NewClient returns a new leadership.Claimer backed by the supplied api caller. | [
"NewClient",
"returns",
"a",
"new",
"leadership",
".",
"Claimer",
"backed",
"by",
"the",
"supplied",
"api",
"caller",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/leadership/client.go#L26-L28 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.