id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
154,600 | juju/juju | state/resources_state_resource.go | ListPendingResources | func (st resourceState) ListPendingResources(applicationID string) ([]resource.Resource, error) {
resources, err := st.persist.ListPendingResources(applicationID)
if err != nil {
return nil, errors.Trace(err)
}
return resources, err
} | go | func (st resourceState) ListPendingResources(applicationID string) ([]resource.Resource, error) {
resources, err := st.persist.ListPendingResources(applicationID)
if err != nil {
return nil, errors.Trace(err)
}
return resources, err
} | [
"func",
"(",
"st",
"resourceState",
")",
"ListPendingResources",
"(",
"applicationID",
"string",
")",
"(",
"[",
"]",
"resource",
".",
"Resource",
",",
"error",
")",
"{",
"resources",
",",
"err",
":=",
"st",
".",
"persist",
".",
"ListPendingResources",
"(",
... | // ListPendinglResources returns the resource data for the given
// application ID for pending resources only. | [
"ListPendinglResources",
"returns",
"the",
"resource",
"data",
"for",
"the",
"given",
"application",
"ID",
"for",
"pending",
"resources",
"only",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_state_resource.go#L123-L129 |
154,601 | juju/juju | state/resources_state_resource.go | GetResource | func (st resourceState) GetResource(applicationID, name string) (resource.Resource, error) {
id := newResourceID(applicationID, name)
res, _, err := st.persist.GetResource(id)
if err != nil {
if err := st.raw.VerifyApplication(applicationID); err != nil {
return resource.Resource{}, errors.Trace(err)
}
retu... | go | func (st resourceState) GetResource(applicationID, name string) (resource.Resource, error) {
id := newResourceID(applicationID, name)
res, _, err := st.persist.GetResource(id)
if err != nil {
if err := st.raw.VerifyApplication(applicationID); err != nil {
return resource.Resource{}, errors.Trace(err)
}
retu... | [
"func",
"(",
"st",
"resourceState",
")",
"GetResource",
"(",
"applicationID",
",",
"name",
"string",
")",
"(",
"resource",
".",
"Resource",
",",
"error",
")",
"{",
"id",
":=",
"newResourceID",
"(",
"applicationID",
",",
"name",
")",
"\n",
"res",
",",
"_"... | // GetResource returns the resource data for the identified resource. | [
"GetResource",
"returns",
"the",
"resource",
"data",
"for",
"the",
"identified",
"resource",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_state_resource.go#L139-L149 |
154,602 | juju/juju | state/resources_state_resource.go | GetPendingResource | func (st resourceState) GetPendingResource(applicationID, name, pendingID string) (resource.Resource, error) {
var res resource.Resource
resources, err := st.persist.ListPendingResources(applicationID)
if err != nil {
// We do not call VerifyApplication() here because pending resources
// do not have to have an... | go | func (st resourceState) GetPendingResource(applicationID, name, pendingID string) (resource.Resource, error) {
var res resource.Resource
resources, err := st.persist.ListPendingResources(applicationID)
if err != nil {
// We do not call VerifyApplication() here because pending resources
// do not have to have an... | [
"func",
"(",
"st",
"resourceState",
")",
"GetPendingResource",
"(",
"applicationID",
",",
"name",
",",
"pendingID",
"string",
")",
"(",
"resource",
".",
"Resource",
",",
"error",
")",
"{",
"var",
"res",
"resource",
".",
"Resource",
"\n\n",
"resources",
",",
... | // GetPendingResource returns the resource data for the identified resource. | [
"GetPendingResource",
"returns",
"the",
"resource",
"data",
"for",
"the",
"identified",
"resource",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_state_resource.go#L152-L168 |
154,603 | juju/juju | state/resources_state_resource.go | SetUnitResource | func (st resourceState) SetUnitResource(unitName, userID string, chRes charmresource.Resource) (_ resource.Resource, outErr error) {
logger.Tracef("adding resource %q for unit %q", chRes.Name, unitName)
var empty resource.Resource
applicationID, err := names.UnitApplication(unitName)
if err != nil {
return empty... | go | func (st resourceState) SetUnitResource(unitName, userID string, chRes charmresource.Resource) (_ resource.Resource, outErr error) {
logger.Tracef("adding resource %q for unit %q", chRes.Name, unitName)
var empty resource.Resource
applicationID, err := names.UnitApplication(unitName)
if err != nil {
return empty... | [
"func",
"(",
"st",
"resourceState",
")",
"SetUnitResource",
"(",
"unitName",
",",
"userID",
"string",
",",
"chRes",
"charmresource",
".",
"Resource",
")",
"(",
"_",
"resource",
".",
"Resource",
",",
"outErr",
"error",
")",
"{",
"logger",
".",
"Tracef",
"("... | // SetUnitResource sets the resource metadata for a specific unit. | [
"SetUnitResource",
"sets",
"the",
"resource",
"metadata",
"for",
"a",
"specific",
"unit",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_state_resource.go#L184-L209 |
154,604 | juju/juju | state/resources_state_resource.go | AddPendingResource | func (st resourceState) AddPendingResource(applicationID, userID string, chRes charmresource.Resource) (pendingID string, err error) {
pendingID, err = newPendingID()
if err != nil {
return "", errors.Annotate(err, "could not generate resource ID")
}
logger.Debugf("adding pending resource %q for application %q (I... | go | func (st resourceState) AddPendingResource(applicationID, userID string, chRes charmresource.Resource) (pendingID string, err error) {
pendingID, err = newPendingID()
if err != nil {
return "", errors.Annotate(err, "could not generate resource ID")
}
logger.Debugf("adding pending resource %q for application %q (I... | [
"func",
"(",
"st",
"resourceState",
")",
"AddPendingResource",
"(",
"applicationID",
",",
"userID",
"string",
",",
"chRes",
"charmresource",
".",
"Resource",
")",
"(",
"pendingID",
"string",
",",
"err",
"error",
")",
"{",
"pendingID",
",",
"err",
"=",
"newPe... | // AddPendingResource stores the resource in the Juju model. | [
"AddPendingResource",
"stores",
"the",
"resource",
"in",
"the",
"Juju",
"model",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_state_resource.go#L212-L224 |
154,605 | juju/juju | state/resources_state_resource.go | UpdatePendingResource | func (st resourceState) UpdatePendingResource(applicationID, pendingID, userID string, chRes charmresource.Resource, r io.Reader) (resource.Resource, error) {
logger.Tracef("updating pending resource %q (%s) for application %q", chRes.Name, pendingID, applicationID)
res, err := st.setResource(pendingID, applicationID... | go | func (st resourceState) UpdatePendingResource(applicationID, pendingID, userID string, chRes charmresource.Resource, r io.Reader) (resource.Resource, error) {
logger.Tracef("updating pending resource %q (%s) for application %q", chRes.Name, pendingID, applicationID)
res, err := st.setResource(pendingID, applicationID... | [
"func",
"(",
"st",
"resourceState",
")",
"UpdatePendingResource",
"(",
"applicationID",
",",
"pendingID",
",",
"userID",
"string",
",",
"chRes",
"charmresource",
".",
"Resource",
",",
"r",
"io",
".",
"Reader",
")",
"(",
"resource",
".",
"Resource",
",",
"err... | // UpdatePendingResource stores the resource in the Juju model. | [
"UpdatePendingResource",
"stores",
"the",
"resource",
"in",
"the",
"Juju",
"model",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_state_resource.go#L227-L234 |
154,606 | juju/juju | state/resources_state_resource.go | OpenResource | func (st resourceState) OpenResource(applicationID, name string) (resource.Resource, io.ReadCloser, error) {
id := newResourceID(applicationID, name)
resourceInfo, storagePath, err := st.persist.GetResource(id)
if err != nil {
if err := st.raw.VerifyApplication(applicationID); err != nil {
return resource.Resou... | go | func (st resourceState) OpenResource(applicationID, name string) (resource.Resource, io.ReadCloser, error) {
id := newResourceID(applicationID, name)
resourceInfo, storagePath, err := st.persist.GetResource(id)
if err != nil {
if err := st.raw.VerifyApplication(applicationID); err != nil {
return resource.Resou... | [
"func",
"(",
"st",
"resourceState",
")",
"OpenResource",
"(",
"applicationID",
",",
"name",
"string",
")",
"(",
"resource",
".",
"Resource",
",",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"id",
":=",
"newResourceID",
"(",
"applicationID",
",",
"name... | // OpenResource returns metadata about the resource, and a reader for
// the resource. | [
"OpenResource",
"returns",
"metadata",
"about",
"the",
"resource",
"and",
"a",
"reader",
"for",
"the",
"resource",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_state_resource.go#L322-L365 |
154,607 | juju/juju | state/resources_state_resource.go | OpenResourceForUniter | func (st resourceState) OpenResourceForUniter(unit resource.Unit, name string) (resource.Resource, io.ReadCloser, error) {
applicationID := unit.ApplicationName()
pendingID, err := newPendingID()
if err != nil {
return resource.Resource{}, nil, errors.Trace(err)
}
resourceInfo, resourceReader, err := st.OpenRe... | go | func (st resourceState) OpenResourceForUniter(unit resource.Unit, name string) (resource.Resource, io.ReadCloser, error) {
applicationID := unit.ApplicationName()
pendingID, err := newPendingID()
if err != nil {
return resource.Resource{}, nil, errors.Trace(err)
}
resourceInfo, resourceReader, err := st.OpenRe... | [
"func",
"(",
"st",
"resourceState",
")",
"OpenResourceForUniter",
"(",
"unit",
"resource",
".",
"Unit",
",",
"name",
"string",
")",
"(",
"resource",
".",
"Resource",
",",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"applicationID",
":=",
"unit",
".",
... | // OpenResourceForUniter returns metadata about the resource and
// a reader for the resource. The resource is associated with
// the unit once the reader is completely exhausted. | [
"OpenResourceForUniter",
"returns",
"metadata",
"about",
"the",
"resource",
"and",
"a",
"reader",
"for",
"the",
"resource",
".",
"The",
"resource",
"is",
"associated",
"with",
"the",
"unit",
"once",
"the",
"reader",
"is",
"completely",
"exhausted",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_state_resource.go#L370-L401 |
154,608 | juju/juju | state/resources_state_resource.go | SetCharmStoreResources | func (st resourceState) SetCharmStoreResources(applicationID string, info []charmresource.Resource, lastPolled time.Time) error {
for _, chRes := range info {
id := newResourceID(applicationID, chRes.Name)
if err := st.persist.SetCharmStoreResource(id, applicationID, chRes, lastPolled); err != nil {
return erro... | go | func (st resourceState) SetCharmStoreResources(applicationID string, info []charmresource.Resource, lastPolled time.Time) error {
for _, chRes := range info {
id := newResourceID(applicationID, chRes.Name)
if err := st.persist.SetCharmStoreResource(id, applicationID, chRes, lastPolled); err != nil {
return erro... | [
"func",
"(",
"st",
"resourceState",
")",
"SetCharmStoreResources",
"(",
"applicationID",
"string",
",",
"info",
"[",
"]",
"charmresource",
".",
"Resource",
",",
"lastPolled",
"time",
".",
"Time",
")",
"error",
"{",
"for",
"_",
",",
"chRes",
":=",
"range",
... | // SetCharmStoreResources sets the "polled" resources for the
// application to the provided values. | [
"SetCharmStoreResources",
"sets",
"the",
"polled",
"resources",
"for",
"the",
"application",
"to",
"the",
"provided",
"values",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources_state_resource.go#L405-L415 |
154,609 | juju/juju | worker/uniter/runner/jujuc/action-fail.go | NewActionFailCommand | func NewActionFailCommand(ctx Context) (cmd.Command, error) {
return &ActionFailCommand{ctx: ctx}, nil
} | go | func NewActionFailCommand(ctx Context) (cmd.Command, error) {
return &ActionFailCommand{ctx: ctx}, nil
} | [
"func",
"NewActionFailCommand",
"(",
"ctx",
"Context",
")",
"(",
"cmd",
".",
"Command",
",",
"error",
")",
"{",
"return",
"&",
"ActionFailCommand",
"{",
"ctx",
":",
"ctx",
"}",
",",
"nil",
"\n",
"}"
] | // NewActionFailCommand returns a new ActionFailCommand with the given context. | [
"NewActionFailCommand",
"returns",
"a",
"new",
"ActionFailCommand",
"with",
"the",
"given",
"context",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runner/jujuc/action-fail.go#L21-L23 |
154,610 | juju/juju | worker/uniter/runner/jujuc/action-fail.go | Init | func (c *ActionFailCommand) Init(args []string) error {
if len(args) == 0 {
c.failMessage = "action failed without reason given, check action for errors"
return nil
}
c.failMessage = args[0]
return cmd.CheckEmpty(args[1:])
} | go | func (c *ActionFailCommand) Init(args []string) error {
if len(args) == 0 {
c.failMessage = "action failed without reason given, check action for errors"
return nil
}
c.failMessage = args[0]
return cmd.CheckEmpty(args[1:])
} | [
"func",
"(",
"c",
"*",
"ActionFailCommand",
")",
"Init",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"args",
")",
"==",
"0",
"{",
"c",
".",
"failMessage",
"=",
"\"",
"\"",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"c",
"... | // Init sets the fail message and checks for malformed invocations. | [
"Init",
"sets",
"the",
"fail",
"message",
"and",
"checks",
"for",
"malformed",
"invocations",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runner/jujuc/action-fail.go#L45-L52 |
154,611 | juju/juju | worker/uniter/runner/jujuc/action-fail.go | Run | func (c *ActionFailCommand) Run(ctx *cmd.Context) error {
err := c.ctx.SetActionMessage(c.failMessage)
if err != nil {
return err
}
return c.ctx.SetActionFailed()
} | go | func (c *ActionFailCommand) Run(ctx *cmd.Context) error {
err := c.ctx.SetActionMessage(c.failMessage)
if err != nil {
return err
}
return c.ctx.SetActionFailed()
} | [
"func",
"(",
"c",
"*",
"ActionFailCommand",
")",
"Run",
"(",
"ctx",
"*",
"cmd",
".",
"Context",
")",
"error",
"{",
"err",
":=",
"c",
".",
"ctx",
".",
"SetActionMessage",
"(",
"c",
".",
"failMessage",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"retur... | // Run sets the Action's fail state. | [
"Run",
"sets",
"the",
"Action",
"s",
"fail",
"state",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runner/jujuc/action-fail.go#L55-L61 |
154,612 | juju/juju | state/machineremovals.go | MarkForRemoval | func (m *Machine) MarkForRemoval() (err error) {
defer errors.DeferredAnnotatef(&err, "cannot remove machine %s", m.doc.Id)
// Local variable so we can refresh the machine if needed.
machine := m
buildTxn := func(attempt int) ([]txn.Op, error) {
if attempt != 0 {
if machine, err = machine.st.Machine(machine.Id... | go | func (m *Machine) MarkForRemoval() (err error) {
defer errors.DeferredAnnotatef(&err, "cannot remove machine %s", m.doc.Id)
// Local variable so we can refresh the machine if needed.
machine := m
buildTxn := func(attempt int) ([]txn.Op, error) {
if attempt != 0 {
if machine, err = machine.st.Machine(machine.Id... | [
"func",
"(",
"m",
"*",
"Machine",
")",
"MarkForRemoval",
"(",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"errors",
".",
"DeferredAnnotatef",
"(",
"&",
"err",
",",
"\"",
"\"",
",",
"m",
".",
"doc",
".",
"Id",
")",
"\n",
"// Local variable so we can re... | // MarkForRemoval requests that this machine be removed after any
// needed provider-level cleanup is done. | [
"MarkForRemoval",
"requests",
"that",
"this",
"machine",
"be",
"removed",
"after",
"any",
"needed",
"provider",
"-",
"level",
"cleanup",
"is",
"done",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/machineremovals.go#L46-L63 |
154,613 | juju/juju | state/machineremovals.go | CompleteMachineRemovals | func (st *State) CompleteMachineRemovals(ids ...string) error {
if err := checkValidMachineIds(ids); err != nil {
return errors.Trace(err)
}
buildTxn := func(int) ([]txn.Op, error) {
// We don't need to reget state for subsequent attempts since
// completeMachineRemovalsOps gets the removals and the
// mach... | go | func (st *State) CompleteMachineRemovals(ids ...string) error {
if err := checkValidMachineIds(ids); err != nil {
return errors.Trace(err)
}
buildTxn := func(int) ([]txn.Op, error) {
// We don't need to reget state for subsequent attempts since
// completeMachineRemovalsOps gets the removals and the
// mach... | [
"func",
"(",
"st",
"*",
"State",
")",
"CompleteMachineRemovals",
"(",
"ids",
"...",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"checkValidMachineIds",
"(",
"ids",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Trace",
"(",
"err",
")"... | // CompleteMachineRemovals finishes the removal of the specified
// machines. The machines must have been marked for removal
// previously. Valid-looking-but-unknown machine ids are ignored so
// that this is idempotent. | [
"CompleteMachineRemovals",
"finishes",
"the",
"removal",
"of",
"the",
"specified",
"machines",
".",
"The",
"machines",
"must",
"have",
"been",
"marked",
"for",
"removal",
"previously",
".",
"Valid",
"-",
"looking",
"-",
"but",
"-",
"unknown",
"machine",
"ids",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/machineremovals.go#L191-L207 |
154,614 | juju/juju | cmd/juju/setmeterstatus/setmeterstatus.go | Init | func (c *SetMeterStatusCommand) Init(args []string) error {
if len(args) != 2 {
return errors.New("you need to specify an entity (application or unit) and a status")
}
if names.IsValidUnit(args[0]) {
c.Tag = names.NewUnitTag(args[0])
} else if names.IsValidApplication(args[0]) {
c.Tag = names.NewApplicationTa... | go | func (c *SetMeterStatusCommand) Init(args []string) error {
if len(args) != 2 {
return errors.New("you need to specify an entity (application or unit) and a status")
}
if names.IsValidUnit(args[0]) {
c.Tag = names.NewUnitTag(args[0])
} else if names.IsValidApplication(args[0]) {
c.Tag = names.NewApplicationTa... | [
"func",
"(",
"c",
"*",
"SetMeterStatusCommand",
")",
"Init",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"args",
")",
"!=",
"2",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"names",
... | // Init reads and verifies the cli arguments for the SetMeterStatusCommand | [
"Init",
"reads",
"and",
"verifies",
"the",
"cli",
"arguments",
"for",
"the",
"SetMeterStatusCommand"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/setmeterstatus/setmeterstatus.go#L52-L69 |
154,615 | juju/juju | cmd/juju/cloud/show.go | NewShowCloudCommand | func NewShowCloudCommand() cmd.Command {
store := jujuclient.NewFileClientStore()
c := &showCloudCommand{
OptionalControllerCommand: modelcmd.OptionalControllerCommand{Store: store},
store: store,
}
c.showCloudAPIFunc = c.cloudAPI
return modelcmd.WrapBase(c)
} | go | func NewShowCloudCommand() cmd.Command {
store := jujuclient.NewFileClientStore()
c := &showCloudCommand{
OptionalControllerCommand: modelcmd.OptionalControllerCommand{Store: store},
store: store,
}
c.showCloudAPIFunc = c.cloudAPI
return modelcmd.WrapBase(c)
} | [
"func",
"NewShowCloudCommand",
"(",
")",
"cmd",
".",
"Command",
"{",
"store",
":=",
"jujuclient",
".",
"NewFileClientStore",
"(",
")",
"\n",
"c",
":=",
"&",
"showCloudCommand",
"{",
"OptionalControllerCommand",
":",
"modelcmd",
".",
"OptionalControllerCommand",
"{... | // NewShowCloudCommand returns a command to list cloud information. | [
"NewShowCloudCommand",
"returns",
"a",
"command",
"to",
"list",
"cloud",
"information",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/cloud/show.go#L67-L75 |
154,616 | juju/juju | cmd/juju/cloud/show.go | GetAllCloudDetails | func GetAllCloudDetails() (map[string]*CloudDetails, error) {
result, err := listCloudDetails()
if err != nil {
return nil, errors.Trace(err)
}
return result.all(), nil
} | go | func GetAllCloudDetails() (map[string]*CloudDetails, error) {
result, err := listCloudDetails()
if err != nil {
return nil, errors.Trace(err)
}
return result.all(), nil
} | [
"func",
"GetAllCloudDetails",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"*",
"CloudDetails",
",",
"error",
")",
"{",
"result",
",",
"err",
":=",
"listCloudDetails",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"... | // GetAllCloudDetails returns a list of all cloud details. | [
"GetAllCloudDetails",
"returns",
"a",
"list",
"of",
"all",
"cloud",
"details",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/cloud/show.go#L264-L270 |
154,617 | juju/juju | cmd/juju/storage/volumelistformatters.go | formatVolumeListTabular | func formatVolumeListTabular(writer io.Writer, infos map[string]VolumeInfo) error {
tw := output.TabWriter(writer)
print := func(values ...string) {
fmt.Fprintln(tw, strings.Join(values, "\t"))
}
haveMachines := false
volumeAttachmentInfos := make(volumeAttachmentInfos, 0, len(infos))
for volumeId, info := ra... | go | func formatVolumeListTabular(writer io.Writer, infos map[string]VolumeInfo) error {
tw := output.TabWriter(writer)
print := func(values ...string) {
fmt.Fprintln(tw, strings.Join(values, "\t"))
}
haveMachines := false
volumeAttachmentInfos := make(volumeAttachmentInfos, 0, len(infos))
for volumeId, info := ra... | [
"func",
"formatVolumeListTabular",
"(",
"writer",
"io",
".",
"Writer",
",",
"infos",
"map",
"[",
"string",
"]",
"VolumeInfo",
")",
"error",
"{",
"tw",
":=",
"output",
".",
"TabWriter",
"(",
"writer",
")",
"\n\n",
"print",
":=",
"func",
"(",
"values",
"..... | // formatVolumeListTabular returns a tabular summary of volume instances. | [
"formatVolumeListTabular",
"returns",
"a",
"tabular",
"summary",
"of",
"volume",
"instances",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/storage/volumelistformatters.go#L18-L99 |
154,618 | juju/juju | state/spacesdiscovery.go | SaveSpacesFromProvider | func (st *State) SaveSpacesFromProvider(providerSpaces []network.SpaceInfo) error {
stateSpaces, err := st.AllSpaces()
if err != nil {
return errors.Trace(err)
}
modelSpaceMap := make(map[network.Id]*Space)
spaceNames := make(set.Strings)
for _, space := range stateSpaces {
modelSpaceMap[space.ProviderId()] =... | go | func (st *State) SaveSpacesFromProvider(providerSpaces []network.SpaceInfo) error {
stateSpaces, err := st.AllSpaces()
if err != nil {
return errors.Trace(err)
}
modelSpaceMap := make(map[network.Id]*Space)
spaceNames := make(set.Strings)
for _, space := range stateSpaces {
modelSpaceMap[space.ProviderId()] =... | [
"func",
"(",
"st",
"*",
"State",
")",
"SaveSpacesFromProvider",
"(",
"providerSpaces",
"[",
"]",
"network",
".",
"SpaceInfo",
")",
"error",
"{",
"stateSpaces",
",",
"err",
":=",
"st",
".",
"AllSpaces",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"re... | // SaveSpacesFromProvider loads providerSpaces into state.
// Currently it does not delete removed spaces. | [
"SaveSpacesFromProvider",
"loads",
"providerSpaces",
"into",
"state",
".",
"Currently",
"it",
"does",
"not",
"delete",
"removed",
"spaces",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/spacesdiscovery.go#L161-L215 |
154,619 | juju/juju | apiserver/facades/client/action/action.go | NewActionAPIV2 | func NewActionAPIV2(ctx facade.Context) (*APIv2, error) {
api, err := NewActionAPIV3(ctx)
if err != nil {
return nil, errors.Trace(err)
}
return &APIv2{api}, nil
} | go | func NewActionAPIV2(ctx facade.Context) (*APIv2, error) {
api, err := NewActionAPIV3(ctx)
if err != nil {
return nil, errors.Trace(err)
}
return &APIv2{api}, nil
} | [
"func",
"NewActionAPIV2",
"(",
"ctx",
"facade",
".",
"Context",
")",
"(",
"*",
"APIv2",
",",
"error",
")",
"{",
"api",
",",
"err",
":=",
"NewActionAPIV3",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"T... | // NewActionAPIV2 returns an initialized ActionAPI for version 2. | [
"NewActionAPIV2",
"returns",
"an",
"initialized",
"ActionAPI",
"for",
"version",
"2",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/action/action.go#L39-L45 |
154,620 | juju/juju | apiserver/facades/client/action/action.go | NewActionAPIV3 | func NewActionAPIV3(ctx facade.Context) (*APIv3, error) {
api, err := newActionAPI(ctx.State(), ctx.Resources(), ctx.Auth())
if err != nil {
return nil, errors.Trace(err)
}
return &APIv3{api}, nil
} | go | func NewActionAPIV3(ctx facade.Context) (*APIv3, error) {
api, err := newActionAPI(ctx.State(), ctx.Resources(), ctx.Auth())
if err != nil {
return nil, errors.Trace(err)
}
return &APIv3{api}, nil
} | [
"func",
"NewActionAPIV3",
"(",
"ctx",
"facade",
".",
"Context",
")",
"(",
"*",
"APIv3",
",",
"error",
")",
"{",
"api",
",",
"err",
":=",
"newActionAPI",
"(",
"ctx",
".",
"State",
"(",
")",
",",
"ctx",
".",
"Resources",
"(",
")",
",",
"ctx",
".",
... | // NewActionAPIV3 returns an initialized ActionAPI for version 3. | [
"NewActionAPIV3",
"returns",
"an",
"initialized",
"ActionAPI",
"for",
"version",
"3",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/action/action.go#L48-L54 |
154,621 | juju/juju | apiserver/facades/client/action/action.go | Actions | func (a *ActionAPI) Actions(arg params.Entities) (params.ActionResults, error) {
if err := a.checkCanRead(); err != nil {
return params.ActionResults{}, errors.Trace(err)
}
response := params.ActionResults{Results: make([]params.ActionResult, len(arg.Entities))}
for i, entity := range arg.Entities {
currentRes... | go | func (a *ActionAPI) Actions(arg params.Entities) (params.ActionResults, error) {
if err := a.checkCanRead(); err != nil {
return params.ActionResults{}, errors.Trace(err)
}
response := params.ActionResults{Results: make([]params.ActionResult, len(arg.Entities))}
for i, entity := range arg.Entities {
currentRes... | [
"func",
"(",
"a",
"*",
"ActionAPI",
")",
"Actions",
"(",
"arg",
"params",
".",
"Entities",
")",
"(",
"params",
".",
"ActionResults",
",",
"error",
")",
"{",
"if",
"err",
":=",
"a",
".",
"checkCanRead",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"retur... | // Actions takes a list of ActionTags, and returns the full Action for
// each ID. | [
"Actions",
"takes",
"a",
"list",
"of",
"ActionTags",
"and",
"returns",
"the",
"full",
"Action",
"for",
"each",
"ID",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/action/action.go#L110-L145 |
154,622 | juju/juju | apiserver/facades/client/action/action.go | Enqueue | func (a *ActionAPI) Enqueue(arg params.Actions) (params.ActionResults, error) {
if err := a.checkCanWrite(); err != nil {
return params.ActionResults{}, errors.Trace(err)
}
var leaders map[string]string
getLeader := func(appName string) (string, error) {
if leaders == nil {
var err error
leaders, err = a... | go | func (a *ActionAPI) Enqueue(arg params.Actions) (params.ActionResults, error) {
if err := a.checkCanWrite(); err != nil {
return params.ActionResults{}, errors.Trace(err)
}
var leaders map[string]string
getLeader := func(appName string) (string, error) {
if leaders == nil {
var err error
leaders, err = a... | [
"func",
"(",
"a",
"*",
"ActionAPI",
")",
"Enqueue",
"(",
"arg",
"params",
".",
"Actions",
")",
"(",
"params",
".",
"ActionResults",
",",
"error",
")",
"{",
"if",
"err",
":=",
"a",
".",
"checkCanWrite",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"retur... | // Enqueue takes a list of Actions and queues them up to be executed by
// the designated ActionReceiver, returning the params.Action for each
// enqueued Action, or an error if there was a problem enqueueing the
// Action. | [
"Enqueue",
"takes",
"a",
"list",
"of",
"Actions",
"and",
"queues",
"them",
"up",
"to",
"be",
"executed",
"by",
"the",
"designated",
"ActionReceiver",
"returning",
"the",
"params",
".",
"Action",
"for",
"each",
"enqueued",
"Action",
"or",
"an",
"error",
"if",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/action/action.go#L207-L255 |
154,623 | juju/juju | apiserver/facades/client/action/action.go | ListAll | func (a *ActionAPI) ListAll(arg params.Entities) (params.ActionsByReceivers, error) {
if err := a.checkCanRead(); err != nil {
return params.ActionsByReceivers{}, errors.Trace(err)
}
return a.internalList(arg, combine(pendingActions, runningActions, completedActions))
} | go | func (a *ActionAPI) ListAll(arg params.Entities) (params.ActionsByReceivers, error) {
if err := a.checkCanRead(); err != nil {
return params.ActionsByReceivers{}, errors.Trace(err)
}
return a.internalList(arg, combine(pendingActions, runningActions, completedActions))
} | [
"func",
"(",
"a",
"*",
"ActionAPI",
")",
"ListAll",
"(",
"arg",
"params",
".",
"Entities",
")",
"(",
"params",
".",
"ActionsByReceivers",
",",
"error",
")",
"{",
"if",
"err",
":=",
"a",
".",
"checkCanRead",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"... | // ListAll takes a list of Entities representing ActionReceivers and
// returns all of the Actions that have been enqueued or run by each of
// those Entities. | [
"ListAll",
"takes",
"a",
"list",
"of",
"Entities",
"representing",
"ActionReceivers",
"and",
"returns",
"all",
"of",
"the",
"Actions",
"that",
"have",
"been",
"enqueued",
"or",
"run",
"by",
"each",
"of",
"those",
"Entities",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/action/action.go#L260-L266 |
154,624 | juju/juju | apiserver/facades/client/action/action.go | ListPending | func (a *ActionAPI) ListPending(arg params.Entities) (params.ActionsByReceivers, error) {
if err := a.checkCanRead(); err != nil {
return params.ActionsByReceivers{}, errors.Trace(err)
}
return a.internalList(arg, pendingActions)
} | go | func (a *ActionAPI) ListPending(arg params.Entities) (params.ActionsByReceivers, error) {
if err := a.checkCanRead(); err != nil {
return params.ActionsByReceivers{}, errors.Trace(err)
}
return a.internalList(arg, pendingActions)
} | [
"func",
"(",
"a",
"*",
"ActionAPI",
")",
"ListPending",
"(",
"arg",
"params",
".",
"Entities",
")",
"(",
"params",
".",
"ActionsByReceivers",
",",
"error",
")",
"{",
"if",
"err",
":=",
"a",
".",
"checkCanRead",
"(",
")",
";",
"err",
"!=",
"nil",
"{",... | // ListPending takes a list of Entities representing ActionReceivers
// and returns all of the Actions that are enqueued for each of those
// Entities. | [
"ListPending",
"takes",
"a",
"list",
"of",
"Entities",
"representing",
"ActionReceivers",
"and",
"returns",
"all",
"of",
"the",
"Actions",
"that",
"are",
"enqueued",
"for",
"each",
"of",
"those",
"Entities",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/action/action.go#L271-L277 |
154,625 | juju/juju | apiserver/facades/client/action/action.go | ListRunning | func (a *ActionAPI) ListRunning(arg params.Entities) (params.ActionsByReceivers, error) {
if err := a.checkCanRead(); err != nil {
return params.ActionsByReceivers{}, errors.Trace(err)
}
return a.internalList(arg, runningActions)
} | go | func (a *ActionAPI) ListRunning(arg params.Entities) (params.ActionsByReceivers, error) {
if err := a.checkCanRead(); err != nil {
return params.ActionsByReceivers{}, errors.Trace(err)
}
return a.internalList(arg, runningActions)
} | [
"func",
"(",
"a",
"*",
"ActionAPI",
")",
"ListRunning",
"(",
"arg",
"params",
".",
"Entities",
")",
"(",
"params",
".",
"ActionsByReceivers",
",",
"error",
")",
"{",
"if",
"err",
":=",
"a",
".",
"checkCanRead",
"(",
")",
";",
"err",
"!=",
"nil",
"{",... | // ListRunning takes a list of Entities representing ActionReceivers and
// returns all of the Actions that have are running on each of those
// Entities. | [
"ListRunning",
"takes",
"a",
"list",
"of",
"Entities",
"representing",
"ActionReceivers",
"and",
"returns",
"all",
"of",
"the",
"Actions",
"that",
"have",
"are",
"running",
"on",
"each",
"of",
"those",
"Entities",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/action/action.go#L282-L288 |
154,626 | juju/juju | apiserver/facades/client/action/action.go | ListCompleted | func (a *ActionAPI) ListCompleted(arg params.Entities) (params.ActionsByReceivers, error) {
if err := a.checkCanRead(); err != nil {
return params.ActionsByReceivers{}, errors.Trace(err)
}
return a.internalList(arg, completedActions)
} | go | func (a *ActionAPI) ListCompleted(arg params.Entities) (params.ActionsByReceivers, error) {
if err := a.checkCanRead(); err != nil {
return params.ActionsByReceivers{}, errors.Trace(err)
}
return a.internalList(arg, completedActions)
} | [
"func",
"(",
"a",
"*",
"ActionAPI",
")",
"ListCompleted",
"(",
"arg",
"params",
".",
"Entities",
")",
"(",
"params",
".",
"ActionsByReceivers",
",",
"error",
")",
"{",
"if",
"err",
":=",
"a",
".",
"checkCanRead",
"(",
")",
";",
"err",
"!=",
"nil",
"{... | // ListCompleted takes a list of Entities representing ActionReceivers
// and returns all of the Actions that have been run on each of those
// Entities. | [
"ListCompleted",
"takes",
"a",
"list",
"of",
"Entities",
"representing",
"ActionReceivers",
"and",
"returns",
"all",
"of",
"the",
"Actions",
"that",
"have",
"been",
"run",
"on",
"each",
"of",
"those",
"Entities",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/action/action.go#L293-L299 |
154,627 | juju/juju | apiserver/facades/client/action/action.go | Cancel | func (a *ActionAPI) Cancel(arg params.Entities) (params.ActionResults, error) {
if err := a.checkCanWrite(); err != nil {
return params.ActionResults{}, errors.Trace(err)
}
response := params.ActionResults{Results: make([]params.ActionResult, len(arg.Entities))}
for i, entity := range arg.Entities {
currentRe... | go | func (a *ActionAPI) Cancel(arg params.Entities) (params.ActionResults, error) {
if err := a.checkCanWrite(); err != nil {
return params.ActionResults{}, errors.Trace(err)
}
response := params.ActionResults{Results: make([]params.ActionResult, len(arg.Entities))}
for i, entity := range arg.Entities {
currentRe... | [
"func",
"(",
"a",
"*",
"ActionAPI",
")",
"Cancel",
"(",
"arg",
"params",
".",
"Entities",
")",
"(",
"params",
".",
"ActionResults",
",",
"error",
")",
"{",
"if",
"err",
":=",
"a",
".",
"checkCanWrite",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"retur... | // Cancel attempts to cancel enqueued Actions from running. | [
"Cancel",
"attempts",
"to",
"cancel",
"enqueued",
"Actions",
"from",
"running",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/action/action.go#L302-L347 |
154,628 | juju/juju | apiserver/facades/client/action/action.go | ApplicationsCharmsActions | func (a *ActionAPI) ApplicationsCharmsActions(args params.Entities) (params.ApplicationsCharmActionsResults, error) {
result := params.ApplicationsCharmActionsResults{Results: make([]params.ApplicationCharmActionsResult, len(args.Entities))}
if err := a.checkCanWrite(); err != nil {
return result, errors.Trace(err)... | go | func (a *ActionAPI) ApplicationsCharmsActions(args params.Entities) (params.ApplicationsCharmActionsResults, error) {
result := params.ApplicationsCharmActionsResults{Results: make([]params.ApplicationCharmActionsResult, len(args.Entities))}
if err := a.checkCanWrite(); err != nil {
return result, errors.Trace(err)... | [
"func",
"(",
"a",
"*",
"ActionAPI",
")",
"ApplicationsCharmsActions",
"(",
"args",
"params",
".",
"Entities",
")",
"(",
"params",
".",
"ApplicationsCharmActionsResults",
",",
"error",
")",
"{",
"result",
":=",
"params",
".",
"ApplicationsCharmActionsResults",
"{",... | // ApplicationsCharmsActions returns a slice of charm Actions for a slice of
// services. | [
"ApplicationsCharmsActions",
"returns",
"a",
"slice",
"of",
"charm",
"Actions",
"for",
"a",
"slice",
"of",
"services",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/action/action.go#L351-L387 |
154,629 | juju/juju | apiserver/facades/client/action/action.go | internalList | func (a *ActionAPI) internalList(arg params.Entities, fn extractorFn) (params.ActionsByReceivers, error) {
tagToActionReceiver := common.TagToActionReceiverFn(a.state.FindEntity)
response := params.ActionsByReceivers{Actions: make([]params.ActionsByReceiver, len(arg.Entities))}
for i, entity := range arg.Entities {
... | go | func (a *ActionAPI) internalList(arg params.Entities, fn extractorFn) (params.ActionsByReceivers, error) {
tagToActionReceiver := common.TagToActionReceiverFn(a.state.FindEntity)
response := params.ActionsByReceivers{Actions: make([]params.ActionsByReceiver, len(arg.Entities))}
for i, entity := range arg.Entities {
... | [
"func",
"(",
"a",
"*",
"ActionAPI",
")",
"internalList",
"(",
"arg",
"params",
".",
"Entities",
",",
"fn",
"extractorFn",
")",
"(",
"params",
".",
"ActionsByReceivers",
",",
"error",
")",
"{",
"tagToActionReceiver",
":=",
"common",
".",
"TagToActionReceiverFn"... | // internalList takes a list of Entities representing ActionReceivers
// and returns all of the Actions the extractorFn can get out of the
// ActionReceiver. | [
"internalList",
"takes",
"a",
"list",
"of",
"Entities",
"representing",
"ActionReceivers",
"and",
"returns",
"all",
"of",
"the",
"Actions",
"the",
"extractorFn",
"can",
"get",
"out",
"of",
"the",
"ActionReceiver",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/action/action.go#L392-L412 |
154,630 | juju/juju | apiserver/facades/client/action/action.go | combine | func combine(funcs ...extractorFn) extractorFn {
return func(ar state.ActionReceiver) ([]params.ActionResult, error) {
result := []params.ActionResult{}
for _, fn := range funcs {
items, err := fn(ar)
if err != nil {
return result, errors.Trace(err)
}
result = append(result, items...)
}
return ... | go | func combine(funcs ...extractorFn) extractorFn {
return func(ar state.ActionReceiver) ([]params.ActionResult, error) {
result := []params.ActionResult{}
for _, fn := range funcs {
items, err := fn(ar)
if err != nil {
return result, errors.Trace(err)
}
result = append(result, items...)
}
return ... | [
"func",
"combine",
"(",
"funcs",
"...",
"extractorFn",
")",
"extractorFn",
"{",
"return",
"func",
"(",
"ar",
"state",
".",
"ActionReceiver",
")",
"(",
"[",
"]",
"params",
".",
"ActionResult",
",",
"error",
")",
"{",
"result",
":=",
"[",
"]",
"params",
... | // combine takes multiple extractorFn's and combines them into one
// function. | [
"combine",
"takes",
"multiple",
"extractorFn",
"s",
"and",
"combines",
"them",
"into",
"one",
"function",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/action/action.go#L421-L433 |
154,631 | juju/juju | worker/resumer/manifold.go | newWorker | func (config ManifoldConfig) newWorker(a agent.Agent, apiCaller base.APICaller) (worker.Worker, error) {
// This bit should be encapsulated in another manifold
// satisfying jujud/agent/engine.Flag, as described in
// the implementation below. Shouldn't be a concern here.
if ok, err := isModelManager(a, apiCaller)... | go | func (config ManifoldConfig) newWorker(a agent.Agent, apiCaller base.APICaller) (worker.Worker, error) {
// This bit should be encapsulated in another manifold
// satisfying jujud/agent/engine.Flag, as described in
// the implementation below. Shouldn't be a concern here.
if ok, err := isModelManager(a, apiCaller)... | [
"func",
"(",
"config",
"ManifoldConfig",
")",
"newWorker",
"(",
"a",
"agent",
".",
"Agent",
",",
"apiCaller",
"base",
".",
"APICaller",
")",
"(",
"worker",
".",
"Worker",
",",
"error",
")",
"{",
"// This bit should be encapsulated in another manifold",
"// satisfy... | // newWorker is an engine.AgentAPIStartFunc that draws context from the
// ManifoldConfig on which it is defined. | [
"newWorker",
"is",
"an",
"engine",
".",
"AgentAPIStartFunc",
"that",
"draws",
"context",
"from",
"the",
"ManifoldConfig",
"on",
"which",
"it",
"is",
"defined",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/resumer/manifold.go#L34-L72 |
154,632 | juju/juju | worker/resumer/manifold.go | isModelManager | func isModelManager(a agent.Agent, apiCaller base.APICaller) (bool, error) {
agentFacade, err := apiagent.NewState(apiCaller)
if err != nil {
return false, errors.Trace(err)
}
entity, err := agentFacade.Entity(a.CurrentConfig().Tag())
if err != nil {
return false, errors.Trace(err)
}
for _, job := range enti... | go | func isModelManager(a agent.Agent, apiCaller base.APICaller) (bool, error) {
agentFacade, err := apiagent.NewState(apiCaller)
if err != nil {
return false, errors.Trace(err)
}
entity, err := agentFacade.Entity(a.CurrentConfig().Tag())
if err != nil {
return false, errors.Trace(err)
}
for _, job := range enti... | [
"func",
"isModelManager",
"(",
"a",
"agent",
".",
"Agent",
",",
"apiCaller",
"base",
".",
"APICaller",
")",
"(",
"bool",
",",
"error",
")",
"{",
"agentFacade",
",",
"err",
":=",
"apiagent",
".",
"NewState",
"(",
"apiCaller",
")",
"\n",
"if",
"err",
"!=... | // isModelManager returns whether the agent has JobManageModel,
// or an error. | [
"isModelManager",
"returns",
"whether",
"the",
"agent",
"has",
"JobManageModel",
"or",
"an",
"error",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/resumer/manifold.go#L86-L101 |
154,633 | juju/juju | worker/machineundertaker/manifold.go | Manifold | func Manifold(config ManifoldConfig) dependency.Manifold {
return dependency.Manifold{
Inputs: []string{config.APICallerName, config.EnvironName},
Start: func(context dependency.Context) (worker.Worker, error) {
var apiCaller base.APICaller
if err := context.Get(config.APICallerName, &apiCaller); err != nil ... | go | func Manifold(config ManifoldConfig) dependency.Manifold {
return dependency.Manifold{
Inputs: []string{config.APICallerName, config.EnvironName},
Start: func(context dependency.Context) (worker.Worker, error) {
var apiCaller base.APICaller
if err := context.Get(config.APICallerName, &apiCaller); err != nil ... | [
"func",
"Manifold",
"(",
"config",
"ManifoldConfig",
")",
"dependency",
".",
"Manifold",
"{",
"return",
"dependency",
".",
"Manifold",
"{",
"Inputs",
":",
"[",
"]",
"string",
"{",
"config",
".",
"APICallerName",
",",
"config",
".",
"EnvironName",
"}",
",",
... | // Manifold returns a dependency.Manifold that runs a machine
// undertaker. | [
"Manifold",
"returns",
"a",
"dependency",
".",
"Manifold",
"that",
"runs",
"a",
"machine",
"undertaker",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/machineundertaker/manifold.go#L30-L59 |
154,634 | juju/juju | jujuclient/mem.go | AllControllers | func (c *MemStore) AllControllers() (map[string]ControllerDetails, error) {
c.mu.Lock()
defer c.mu.Unlock()
result := make(map[string]ControllerDetails)
for name, details := range c.Controllers {
result[name] = details
}
return result, nil
} | go | func (c *MemStore) AllControllers() (map[string]ControllerDetails, error) {
c.mu.Lock()
defer c.mu.Unlock()
result := make(map[string]ControllerDetails)
for name, details := range c.Controllers {
result[name] = details
}
return result, nil
} | [
"func",
"(",
"c",
"*",
"MemStore",
")",
"AllControllers",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"ControllerDetails",
",",
"error",
")",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n"... | // AllController implements ControllerGetter.AllController | [
"AllController",
"implements",
"ControllerGetter",
".",
"AllController"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/mem.go#L41-L50 |
154,635 | juju/juju | jujuclient/mem.go | ControllerByName | func (c *MemStore) ControllerByName(name string) (*ControllerDetails, error) {
c.mu.Lock()
defer c.mu.Unlock()
if err := ValidateControllerName(name); err != nil {
return nil, err
}
if result, ok := c.Controllers[name]; ok {
return &result, nil
}
return nil, errors.NotFoundf("controller %s", name)
} | go | func (c *MemStore) ControllerByName(name string) (*ControllerDetails, error) {
c.mu.Lock()
defer c.mu.Unlock()
if err := ValidateControllerName(name); err != nil {
return nil, err
}
if result, ok := c.Controllers[name]; ok {
return &result, nil
}
return nil, errors.NotFoundf("controller %s", name)
} | [
"func",
"(",
"c",
"*",
"MemStore",
")",
"ControllerByName",
"(",
"name",
"string",
")",
"(",
"*",
"ControllerDetails",
",",
"error",
")",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
... | // ControllerByName implements ControllerGetter.ControllerByName | [
"ControllerByName",
"implements",
"ControllerGetter",
".",
"ControllerByName"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/mem.go#L53-L64 |
154,636 | juju/juju | jujuclient/mem.go | ControllerByAPIEndpoints | func (c *MemStore) ControllerByAPIEndpoints(endpoints ...string) (*ControllerDetails, string, error) {
c.mu.Lock()
defer c.mu.Unlock()
matchEps := set.NewStrings(endpoints...)
for name, ctrl := range c.Controllers {
if matchEps.Intersection(set.NewStrings(ctrl.APIEndpoints...)).IsEmpty() {
continue
}
ret... | go | func (c *MemStore) ControllerByAPIEndpoints(endpoints ...string) (*ControllerDetails, string, error) {
c.mu.Lock()
defer c.mu.Unlock()
matchEps := set.NewStrings(endpoints...)
for name, ctrl := range c.Controllers {
if matchEps.Intersection(set.NewStrings(ctrl.APIEndpoints...)).IsEmpty() {
continue
}
ret... | [
"func",
"(",
"c",
"*",
"MemStore",
")",
"ControllerByAPIEndpoints",
"(",
"endpoints",
"...",
"string",
")",
"(",
"*",
"ControllerDetails",
",",
"string",
",",
"error",
")",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".... | // ControllerByAPIEndpoints implements ControllersGetter.ControllerByAPIEndpoints | [
"ControllerByAPIEndpoints",
"implements",
"ControllersGetter",
".",
"ControllerByAPIEndpoints"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/mem.go#L67-L80 |
154,637 | juju/juju | jujuclient/mem.go | CurrentController | func (c *MemStore) CurrentController() (string, error) {
c.mu.Lock()
defer c.mu.Unlock()
if c.CurrentControllerName == "" {
return "", errors.NotFoundf("current controller")
}
return c.CurrentControllerName, nil
} | go | func (c *MemStore) CurrentController() (string, error) {
c.mu.Lock()
defer c.mu.Unlock()
if c.CurrentControllerName == "" {
return "", errors.NotFoundf("current controller")
}
return c.CurrentControllerName, nil
} | [
"func",
"(",
"c",
"*",
"MemStore",
")",
"CurrentController",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"c",
".",
"CurrentControlle... | // CurrentController implements ControllerGetter.CurrentController | [
"CurrentController",
"implements",
"ControllerGetter",
".",
"CurrentController"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/mem.go#L83-L91 |
154,638 | juju/juju | jujuclient/mem.go | SetCurrentController | func (c *MemStore) SetCurrentController(name string) error {
c.mu.Lock()
defer c.mu.Unlock()
if err := ValidateControllerName(name); err != nil {
return err
}
if _, ok := c.Controllers[name]; !ok {
return errors.NotFoundf("controller %s", name)
}
c.CurrentControllerName = name
return nil
} | go | func (c *MemStore) SetCurrentController(name string) error {
c.mu.Lock()
defer c.mu.Unlock()
if err := ValidateControllerName(name); err != nil {
return err
}
if _, ok := c.Controllers[name]; !ok {
return errors.NotFoundf("controller %s", name)
}
c.CurrentControllerName = name
return nil
} | [
"func",
"(",
"c",
"*",
"MemStore",
")",
"SetCurrentController",
"(",
"name",
"string",
")",
"error",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"err",
":=",
"ValidateControllerNam... | // SetCurrentController implements ControllerUpdater.SetCurrentController | [
"SetCurrentController",
"implements",
"ControllerUpdater",
".",
"SetCurrentController"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/mem.go#L94-L106 |
154,639 | juju/juju | jujuclient/mem.go | AddController | func (c *MemStore) AddController(name string, one ControllerDetails) error {
c.mu.Lock()
defer c.mu.Unlock()
if err := ValidateControllerName(name); err != nil {
return err
}
if err := ValidateControllerDetails(one); err != nil {
return err
}
if _, ok := c.Controllers[name]; ok {
return errors.AlreadyExi... | go | func (c *MemStore) AddController(name string, one ControllerDetails) error {
c.mu.Lock()
defer c.mu.Unlock()
if err := ValidateControllerName(name); err != nil {
return err
}
if err := ValidateControllerDetails(one); err != nil {
return err
}
if _, ok := c.Controllers[name]; ok {
return errors.AlreadyExi... | [
"func",
"(",
"c",
"*",
"MemStore",
")",
"AddController",
"(",
"name",
"string",
",",
"one",
"ControllerDetails",
")",
"error",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"err",
... | // AddController implements ControllerUpdater.AddController | [
"AddController",
"implements",
"ControllerUpdater",
".",
"AddController"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/mem.go#L109-L132 |
154,640 | juju/juju | jujuclient/mem.go | RemoveController | func (c *MemStore) RemoveController(name string) error {
c.mu.Lock()
defer c.mu.Unlock()
if err := ValidateControllerName(name); err != nil {
return err
}
names := set.NewStrings(name)
if namedControllerDetails, ok := c.Controllers[name]; ok {
for name, details := range c.Controllers {
if details.Controll... | go | func (c *MemStore) RemoveController(name string) error {
c.mu.Lock()
defer c.mu.Unlock()
if err := ValidateControllerName(name); err != nil {
return err
}
names := set.NewStrings(name)
if namedControllerDetails, ok := c.Controllers[name]; ok {
for name, details := range c.Controllers {
if details.Controll... | [
"func",
"(",
"c",
"*",
"MemStore",
")",
"RemoveController",
"(",
"name",
"string",
")",
"error",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"err",
":=",
"ValidateControllerName",
... | // RemoveController implements ControllerRemover.RemoveController | [
"RemoveController",
"implements",
"ControllerRemover",
".",
"RemoveController"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/mem.go#L166-L192 |
154,641 | juju/juju | jujuclient/mem.go | SetCurrentModel | func (c *MemStore) SetCurrentModel(controllerName, modelName string) error {
c.mu.Lock()
defer c.mu.Unlock()
if err := ValidateControllerName(controllerName); err != nil {
return errors.Trace(err)
}
controllerModels, ok := c.Models[controllerName]
if !ok {
return errors.NotFoundf("model %s:%s", controllerNam... | go | func (c *MemStore) SetCurrentModel(controllerName, modelName string) error {
c.mu.Lock()
defer c.mu.Unlock()
if err := ValidateControllerName(controllerName); err != nil {
return errors.Trace(err)
}
controllerModels, ok := c.Models[controllerName]
if !ok {
return errors.NotFoundf("model %s:%s", controllerNam... | [
"func",
"(",
"c",
"*",
"MemStore",
")",
"SetCurrentModel",
"(",
"controllerName",
",",
"modelName",
"string",
")",
"error",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"err",
":=... | // SetCurrentModel implements ModelUpdater. | [
"SetCurrentModel",
"implements",
"ModelUpdater",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/mem.go#L245-L270 |
154,642 | juju/juju | jujuclient/mem.go | CurrentModel | func (c *MemStore) CurrentModel(controller string) (string, error) {
c.mu.Lock()
defer c.mu.Unlock()
if err := ValidateControllerName(controller); err != nil {
return "", err
}
controllerModels, ok := c.Models[controller]
if !ok {
return "", errors.NotFoundf("current model for controller %s", controller)
}
... | go | func (c *MemStore) CurrentModel(controller string) (string, error) {
c.mu.Lock()
defer c.mu.Unlock()
if err := ValidateControllerName(controller); err != nil {
return "", err
}
controllerModels, ok := c.Models[controller]
if !ok {
return "", errors.NotFoundf("current model for controller %s", controller)
}
... | [
"func",
"(",
"c",
"*",
"MemStore",
")",
"CurrentModel",
"(",
"controller",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"err",
... | // CurrentModel implements ModelGetter. | [
"CurrentModel",
"implements",
"ModelGetter",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/mem.go#L310-L325 |
154,643 | juju/juju | jujuclient/mem.go | AccountDetails | func (c *MemStore) AccountDetails(controllerName string) (*AccountDetails, error) {
c.mu.Lock()
defer c.mu.Unlock()
if err := ValidateControllerName(controllerName); err != nil {
return nil, err
}
details, ok := c.Accounts[controllerName]
if !ok {
return nil, errors.NotFoundf("account for controller %s", con... | go | func (c *MemStore) AccountDetails(controllerName string) (*AccountDetails, error) {
c.mu.Lock()
defer c.mu.Unlock()
if err := ValidateControllerName(controllerName); err != nil {
return nil, err
}
details, ok := c.Accounts[controllerName]
if !ok {
return nil, errors.NotFoundf("account for controller %s", con... | [
"func",
"(",
"c",
"*",
"MemStore",
")",
"AccountDetails",
"(",
"controllerName",
"string",
")",
"(",
"*",
"AccountDetails",
",",
"error",
")",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n... | // AccountDetails implements AccountGetter. | [
"AccountDetails",
"implements",
"AccountGetter",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/mem.go#L370-L382 |
154,644 | juju/juju | jujuclient/mem.go | UpdateCredential | func (c *MemStore) UpdateCredential(cloudName string, details cloud.CloudCredential) error {
c.mu.Lock()
defer c.mu.Unlock()
if len(details.AuthCredentials) > 0 {
c.Credentials[cloudName] = details
} else {
delete(c.Credentials, cloudName)
}
return nil
} | go | func (c *MemStore) UpdateCredential(cloudName string, details cloud.CloudCredential) error {
c.mu.Lock()
defer c.mu.Unlock()
if len(details.AuthCredentials) > 0 {
c.Credentials[cloudName] = details
} else {
delete(c.Credentials, cloudName)
}
return nil
} | [
"func",
"(",
"c",
"*",
"MemStore",
")",
"UpdateCredential",
"(",
"cloudName",
"string",
",",
"details",
"cloud",
".",
"CloudCredential",
")",
"error",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",... | // UpdateCredential implements CredentialsUpdater. | [
"UpdateCredential",
"implements",
"CredentialsUpdater",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/mem.go#L400-L410 |
154,645 | juju/juju | jujuclient/mem.go | CredentialForCloud | func (c *MemStore) CredentialForCloud(cloudName string) (*cloud.CloudCredential, error) {
c.mu.Lock()
defer c.mu.Unlock()
if result, ok := c.Credentials[cloudName]; ok {
return &result, nil
}
return nil, errors.NotFoundf("credentials for cloud %s", cloudName)
} | go | func (c *MemStore) CredentialForCloud(cloudName string) (*cloud.CloudCredential, error) {
c.mu.Lock()
defer c.mu.Unlock()
if result, ok := c.Credentials[cloudName]; ok {
return &result, nil
}
return nil, errors.NotFoundf("credentials for cloud %s", cloudName)
} | [
"func",
"(",
"c",
"*",
"MemStore",
")",
"CredentialForCloud",
"(",
"cloudName",
"string",
")",
"(",
"*",
"cloud",
".",
"CloudCredential",
",",
"error",
")",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"... | // CredentialForCloud implements CredentialsGetter. | [
"CredentialForCloud",
"implements",
"CredentialsGetter",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/mem.go#L413-L421 |
154,646 | juju/juju | jujuclient/mem.go | AllCredentials | func (c *MemStore) AllCredentials() (map[string]cloud.CloudCredential, error) {
c.mu.Lock()
defer c.mu.Unlock()
result := make(map[string]cloud.CloudCredential)
for k, v := range c.Credentials {
result[k] = v
}
return result, nil
} | go | func (c *MemStore) AllCredentials() (map[string]cloud.CloudCredential, error) {
c.mu.Lock()
defer c.mu.Unlock()
result := make(map[string]cloud.CloudCredential)
for k, v := range c.Credentials {
result[k] = v
}
return result, nil
} | [
"func",
"(",
"c",
"*",
"MemStore",
")",
"AllCredentials",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"cloud",
".",
"CloudCredential",
",",
"error",
")",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",... | // AllCredentials implements CredentialsGetter. | [
"AllCredentials",
"implements",
"CredentialsGetter",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/mem.go#L424-L433 |
154,647 | juju/juju | cmd/juju/application/resumerelation.go | NewResumeRelationCommand | func NewResumeRelationCommand() cmd.Command {
cmd := &resumeRelationCommand{}
cmd.newAPIFunc = func() (SetRelationSuspendedAPI, error) {
root, err := cmd.NewAPIRoot()
if err != nil {
return nil, errors.Trace(err)
}
return application.NewClient(root), nil
}
return modelcmd.Wrap(cmd)
} | go | func NewResumeRelationCommand() cmd.Command {
cmd := &resumeRelationCommand{}
cmd.newAPIFunc = func() (SetRelationSuspendedAPI, error) {
root, err := cmd.NewAPIRoot()
if err != nil {
return nil, errors.Trace(err)
}
return application.NewClient(root), nil
}
return modelcmd.Wrap(cmd)
} | [
"func",
"NewResumeRelationCommand",
"(",
")",
"cmd",
".",
"Command",
"{",
"cmd",
":=",
"&",
"resumeRelationCommand",
"{",
"}",
"\n",
"cmd",
".",
"newAPIFunc",
"=",
"func",
"(",
")",
"(",
"SetRelationSuspendedAPI",
",",
"error",
")",
"{",
"root",
",",
"err"... | // NewResumeRelationCommand returns a command to resume a relation. | [
"NewResumeRelationCommand",
"returns",
"a",
"command",
"to",
"resume",
"a",
"relation",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/application/resumerelation.go#L38-L49 |
154,648 | juju/juju | worker/deployer/deployer.go | NewDeployer | func NewDeployer(st *apideployer.State, ctx Context) (worker.Worker, error) {
d := &Deployer{
st: st,
ctx: ctx,
deployed: make(set.Strings),
}
w, err := watcher.NewStringsWorker(watcher.StringsConfig{
Handler: d,
})
if err != nil {
return nil, errors.Trace(err)
}
return w, nil
} | go | func NewDeployer(st *apideployer.State, ctx Context) (worker.Worker, error) {
d := &Deployer{
st: st,
ctx: ctx,
deployed: make(set.Strings),
}
w, err := watcher.NewStringsWorker(watcher.StringsConfig{
Handler: d,
})
if err != nil {
return nil, errors.Trace(err)
}
return w, nil
} | [
"func",
"NewDeployer",
"(",
"st",
"*",
"apideployer",
".",
"State",
",",
"ctx",
"Context",
")",
"(",
"worker",
".",
"Worker",
",",
"error",
")",
"{",
"d",
":=",
"&",
"Deployer",
"{",
"st",
":",
"st",
",",
"ctx",
":",
"ctx",
",",
"deployed",
":",
... | // NewDeployer returns a Worker that deploys and recalls unit agents
// via ctx, taking a machine id to operate on. | [
"NewDeployer",
"returns",
"a",
"Worker",
"that",
"deploys",
"and",
"recalls",
"unit",
"agents",
"via",
"ctx",
"taking",
"a",
"machine",
"id",
"to",
"operate",
"on",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/deployer/deployer.go#L58-L71 |
154,649 | juju/juju | worker/deployer/deployer.go | changed | func (d *Deployer) changed(unitName string) error {
unitTag := names.NewUnitTag(unitName)
// Determine unit life state, and whether we're responsible for it.
logger.Infof("checking unit %q", unitName)
var life params.Life
unit, err := d.st.Unit(unitTag)
if params.IsCodeNotFoundOrCodeUnauthorized(err) {
life = p... | go | func (d *Deployer) changed(unitName string) error {
unitTag := names.NewUnitTag(unitName)
// Determine unit life state, and whether we're responsible for it.
logger.Infof("checking unit %q", unitName)
var life params.Life
unit, err := d.st.Unit(unitTag)
if params.IsCodeNotFoundOrCodeUnauthorized(err) {
life = p... | [
"func",
"(",
"d",
"*",
"Deployer",
")",
"changed",
"(",
"unitName",
"string",
")",
"error",
"{",
"unitTag",
":=",
"names",
".",
"NewUnitTag",
"(",
"unitName",
")",
"\n",
"// Determine unit life state, and whether we're responsible for it.",
"logger",
".",
"Infof",
... | // changed ensures that the named unit is deployed, recalled, or removed, as
// indicated by its state. | [
"changed",
"ensures",
"that",
"the",
"named",
"unit",
"is",
"deployed",
"recalled",
"or",
"removed",
"as",
"indicated",
"by",
"its",
"state",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/deployer/deployer.go#L112-L146 |
154,650 | juju/juju | worker/deployer/deployer.go | deploy | func (d *Deployer) deploy(unit *apideployer.Unit) error {
unitName := unit.Name()
if d.deployed.Contains(unit.Name()) {
panic("must not re-deploy a deployed unit")
}
if err := unit.SetStatus(status.Waiting, status.MessageInstallingAgent, nil); err != nil {
return errors.Trace(err)
}
logger.Infof("deploying un... | go | func (d *Deployer) deploy(unit *apideployer.Unit) error {
unitName := unit.Name()
if d.deployed.Contains(unit.Name()) {
panic("must not re-deploy a deployed unit")
}
if err := unit.SetStatus(status.Waiting, status.MessageInstallingAgent, nil); err != nil {
return errors.Trace(err)
}
logger.Infof("deploying un... | [
"func",
"(",
"d",
"*",
"Deployer",
")",
"deploy",
"(",
"unit",
"*",
"apideployer",
".",
"Unit",
")",
"error",
"{",
"unitName",
":=",
"unit",
".",
"Name",
"(",
")",
"\n",
"if",
"d",
".",
"deployed",
".",
"Contains",
"(",
"unit",
".",
"Name",
"(",
... | // deploy will deploy the supplied unit with the deployer's manager. It will
// panic if it observes inconsistent internal state. | [
"deploy",
"will",
"deploy",
"the",
"supplied",
"unit",
"with",
"the",
"deployer",
"s",
"manager",
".",
"It",
"will",
"panic",
"if",
"it",
"observes",
"inconsistent",
"internal",
"state",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/deployer/deployer.go#L150-L171 |
154,651 | juju/juju | worker/deployer/deployer.go | recall | func (d *Deployer) recall(unitName string) error {
if !d.deployed.Contains(unitName) {
panic("must not recall a unit that is not deployed")
}
logger.Infof("recalling unit %q", unitName)
if err := d.ctx.RecallUnit(unitName); err != nil {
return err
}
d.deployed.Remove(unitName)
return nil
} | go | func (d *Deployer) recall(unitName string) error {
if !d.deployed.Contains(unitName) {
panic("must not recall a unit that is not deployed")
}
logger.Infof("recalling unit %q", unitName)
if err := d.ctx.RecallUnit(unitName); err != nil {
return err
}
d.deployed.Remove(unitName)
return nil
} | [
"func",
"(",
"d",
"*",
"Deployer",
")",
"recall",
"(",
"unitName",
"string",
")",
"error",
"{",
"if",
"!",
"d",
".",
"deployed",
".",
"Contains",
"(",
"unitName",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"logger",
".",
"Infof",
"... | // recall will recall the named unit with the deployer's manager. It will
// panic if it observes inconsistent internal state. | [
"recall",
"will",
"recall",
"the",
"named",
"unit",
"with",
"the",
"deployer",
"s",
"manager",
".",
"It",
"will",
"panic",
"if",
"it",
"observes",
"inconsistent",
"internal",
"state",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/deployer/deployer.go#L175-L185 |
154,652 | juju/juju | worker/deployer/deployer.go | remove | func (d *Deployer) remove(unit *apideployer.Unit) error {
unitName := unit.Name()
if d.deployed.Contains(unitName) {
panic("must not remove a deployed unit")
} else if unit.Life() == params.Alive {
panic("must not remove an Alive unit")
}
logger.Infof("removing unit %q", unitName)
return unit.Remove()
} | go | func (d *Deployer) remove(unit *apideployer.Unit) error {
unitName := unit.Name()
if d.deployed.Contains(unitName) {
panic("must not remove a deployed unit")
} else if unit.Life() == params.Alive {
panic("must not remove an Alive unit")
}
logger.Infof("removing unit %q", unitName)
return unit.Remove()
} | [
"func",
"(",
"d",
"*",
"Deployer",
")",
"remove",
"(",
"unit",
"*",
"apideployer",
".",
"Unit",
")",
"error",
"{",
"unitName",
":=",
"unit",
".",
"Name",
"(",
")",
"\n",
"if",
"d",
".",
"deployed",
".",
"Contains",
"(",
"unitName",
")",
"{",
"panic... | // remove will remove the supplied unit from state. It will panic if it
// observes inconsistent internal state. | [
"remove",
"will",
"remove",
"the",
"supplied",
"unit",
"from",
"state",
".",
"It",
"will",
"panic",
"if",
"it",
"observes",
"inconsistent",
"internal",
"state",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/deployer/deployer.go#L189-L198 |
154,653 | juju/juju | provider/azure/async.go | asyncCreationRespondDecorator | func asyncCreationRespondDecorator(original autorest.RespondDecorator) autorest.RespondDecorator {
return func(r autorest.Responder) autorest.Responder {
return autorest.ResponderFunc(func(resp *http.Response) error {
if resp.Body != nil {
if err := overrideProvisioningState(resp); err != nil {
return er... | go | func asyncCreationRespondDecorator(original autorest.RespondDecorator) autorest.RespondDecorator {
return func(r autorest.Responder) autorest.Responder {
return autorest.ResponderFunc(func(resp *http.Response) error {
if resp.Body != nil {
if err := overrideProvisioningState(resp); err != nil {
return er... | [
"func",
"asyncCreationRespondDecorator",
"(",
"original",
"autorest",
".",
"RespondDecorator",
")",
"autorest",
".",
"RespondDecorator",
"{",
"return",
"func",
"(",
"r",
"autorest",
".",
"Responder",
")",
"autorest",
".",
"Responder",
"{",
"return",
"autorest",
".... | // asyncCreationRespondDecorator returns an autorest.RespondDecorator
// that replaces non-failure provisioning states with "Succeeded", to
// prevent the autorest code from blocking until the resource is completely
// provisioned. | [
"asyncCreationRespondDecorator",
"returns",
"an",
"autorest",
".",
"RespondDecorator",
"that",
"replaces",
"non",
"-",
"failure",
"provisioning",
"states",
"with",
"Succeeded",
"to",
"prevent",
"the",
"autorest",
"code",
"from",
"blocking",
"until",
"the",
"resource",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/async.go#L19-L30 |
154,654 | juju/juju | wrench/wrench.go | SetEnabled | func SetEnabled(next bool) bool {
enabledMu.Lock()
defer enabledMu.Unlock()
previous := enabled
enabled = next
return previous
} | go | func SetEnabled(next bool) bool {
enabledMu.Lock()
defer enabledMu.Unlock()
previous := enabled
enabled = next
return previous
} | [
"func",
"SetEnabled",
"(",
"next",
"bool",
")",
"bool",
"{",
"enabledMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"enabledMu",
".",
"Unlock",
"(",
")",
"\n",
"previous",
":=",
"enabled",
"\n",
"enabled",
"=",
"next",
"\n",
"return",
"previous",
"\n",
"}"... | // SetEnabled turns the wrench feature on or off globally.
//
// If false is given, all future IsActive calls will unconditionally
// return false. If true is given, all future IsActive calls will
// return true for active wrenches.
//
// The previous value for the global wrench enable flag is returned. | [
"SetEnabled",
"turns",
"the",
"wrench",
"feature",
"on",
"or",
"off",
"globally",
".",
"If",
"false",
"is",
"given",
"all",
"future",
"IsActive",
"calls",
"will",
"unconditionally",
"return",
"false",
".",
"If",
"true",
"is",
"given",
"all",
"future",
"IsAct... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/wrench/wrench.go#L92-L98 |
154,655 | juju/juju | state/migration_import.go | makeStatusDoc | func (i *importer) makeStatusDoc(statusVal description.Status) statusDoc {
return statusDoc{
Status: status.Status(statusVal.Value()),
StatusInfo: statusVal.Message(),
StatusData: statusVal.Data(),
Updated: statusVal.Updated().UnixNano(),
NeverSet: statusVal.NeverSet(),
}
} | go | func (i *importer) makeStatusDoc(statusVal description.Status) statusDoc {
return statusDoc{
Status: status.Status(statusVal.Value()),
StatusInfo: statusVal.Message(),
StatusData: statusVal.Data(),
Updated: statusVal.Updated().UnixNano(),
NeverSet: statusVal.NeverSet(),
}
} | [
"func",
"(",
"i",
"*",
"importer",
")",
"makeStatusDoc",
"(",
"statusVal",
"description",
".",
"Status",
")",
"statusDoc",
"{",
"return",
"statusDoc",
"{",
"Status",
":",
"status",
".",
"Status",
"(",
"statusVal",
".",
"Value",
"(",
")",
")",
",",
"Statu... | // makeStatusDoc assumes status is non-nil. | [
"makeStatusDoc",
"assumes",
"status",
"is",
"non",
"-",
"nil",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/migration_import.go#L734-L742 |
154,656 | juju/juju | provider/gce/config.go | newConfig | func newConfig(cfg, old *config.Config) (*environConfig, error) {
// Ensure that the provided config is valid.
if err := config.Validate(cfg, old); err != nil {
return nil, errors.Trace(err)
}
attrs, err := cfg.ValidateUnknownAttrs(configFields, configDefaults)
if err != nil {
return nil, errors.Trace(err)
}
... | go | func newConfig(cfg, old *config.Config) (*environConfig, error) {
// Ensure that the provided config is valid.
if err := config.Validate(cfg, old); err != nil {
return nil, errors.Trace(err)
}
attrs, err := cfg.ValidateUnknownAttrs(configFields, configDefaults)
if err != nil {
return nil, errors.Trace(err)
}
... | [
"func",
"newConfig",
"(",
"cfg",
",",
"old",
"*",
"config",
".",
"Config",
")",
"(",
"*",
"environConfig",
",",
"error",
")",
"{",
"// Ensure that the provided config is valid.",
"if",
"err",
":=",
"config",
".",
"Validate",
"(",
"cfg",
",",
"old",
")",
";... | // newConfig builds a new environConfig from the provided Config
// filling in default values, if any. It returns an error if the
// resulting configuration is not valid. | [
"newConfig",
"builds",
"a",
"new",
"environConfig",
"from",
"the",
"provided",
"Config",
"filling",
"in",
"default",
"values",
"if",
"any",
".",
"It",
"returns",
"an",
"error",
"if",
"the",
"resulting",
"configuration",
"is",
"not",
"valid",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/gce/config.go#L48-L82 |
154,657 | juju/juju | cmd/plugins/juju-metadata/addimage.go | constructMetadataParam | func (c *addImageMetadataCommand) constructMetadataParam() params.CloudImageMetadata {
info := params.CloudImageMetadata{
ImageId: c.ImageId,
Region: c.Region,
Series: c.Series,
Arch: c.Arch,
VirtType: c.VirtType,
RootStorageType: c.RootStorageType,
Stream: ... | go | func (c *addImageMetadataCommand) constructMetadataParam() params.CloudImageMetadata {
info := params.CloudImageMetadata{
ImageId: c.ImageId,
Region: c.Region,
Series: c.Series,
Arch: c.Arch,
VirtType: c.VirtType,
RootStorageType: c.RootStorageType,
Stream: ... | [
"func",
"(",
"c",
"*",
"addImageMetadataCommand",
")",
"constructMetadataParam",
"(",
")",
"params",
".",
"CloudImageMetadata",
"{",
"info",
":=",
"params",
".",
"CloudImageMetadata",
"{",
"ImageId",
":",
"c",
".",
"ImageId",
",",
"Region",
":",
"c",
".",
"R... | // constructMetadataParam returns cloud image metadata as a param. | [
"constructMetadataParam",
"returns",
"cloud",
"image",
"metadata",
"as",
"a",
"param",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/plugins/juju-metadata/addimage.go#L139-L154 |
154,658 | juju/juju | worker/raft/raftflag/flag.go | Validate | func (config Config) Validate() error {
if config.Raft == nil {
return errors.NotValidf("nil Raft")
}
return nil
} | go | func (config Config) Validate() error {
if config.Raft == nil {
return errors.NotValidf("nil Raft")
}
return nil
} | [
"func",
"(",
"config",
"Config",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"config",
".",
"Raft",
"==",
"nil",
"{",
"return",
"errors",
".",
"NotValidf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // Validate returns an error if the config cannot be expected to run a
// raftflag.Worker. | [
"Validate",
"returns",
"an",
"error",
"if",
"the",
"config",
"cannot",
"be",
"expected",
"to",
"run",
"a",
"raftflag",
".",
"Worker",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/raft/raftflag/flag.go#L23-L28 |
154,659 | juju/juju | core/instance/container.go | ParseContainerTypeOrNone | func ParseContainerTypeOrNone(ctype string) (ContainerType, error) {
if ContainerType(ctype) == NONE {
return NONE, nil
}
return ParseContainerType(ctype)
} | go | func ParseContainerTypeOrNone(ctype string) (ContainerType, error) {
if ContainerType(ctype) == NONE {
return NONE, nil
}
return ParseContainerType(ctype)
} | [
"func",
"ParseContainerTypeOrNone",
"(",
"ctype",
"string",
")",
"(",
"ContainerType",
",",
"error",
")",
"{",
"if",
"ContainerType",
"(",
"ctype",
")",
"==",
"NONE",
"{",
"return",
"NONE",
",",
"nil",
"\n",
"}",
"\n",
"return",
"ParseContainerType",
"(",
... | // ParseContainerTypeOrNone converts the specified string into a supported
// ContainerType instance or returns an error if the container type is invalid.
// For this version of the function, 'none' is a valid value. | [
"ParseContainerTypeOrNone",
"converts",
"the",
"specified",
"string",
"into",
"a",
"supported",
"ContainerType",
"instance",
"or",
"returns",
"an",
"error",
"if",
"the",
"container",
"type",
"is",
"invalid",
".",
"For",
"this",
"version",
"of",
"the",
"function",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/instance/container.go#L29-L34 |
154,660 | juju/juju | core/instance/container.go | ParseContainerType | func ParseContainerType(ctype string) (ContainerType, error) {
for _, supportedType := range ContainerTypes {
if ContainerType(ctype) == supportedType {
return supportedType, nil
}
}
return "", fmt.Errorf("invalid container type %q", ctype)
} | go | func ParseContainerType(ctype string) (ContainerType, error) {
for _, supportedType := range ContainerTypes {
if ContainerType(ctype) == supportedType {
return supportedType, nil
}
}
return "", fmt.Errorf("invalid container type %q", ctype)
} | [
"func",
"ParseContainerType",
"(",
"ctype",
"string",
")",
"(",
"ContainerType",
",",
"error",
")",
"{",
"for",
"_",
",",
"supportedType",
":=",
"range",
"ContainerTypes",
"{",
"if",
"ContainerType",
"(",
"ctype",
")",
"==",
"supportedType",
"{",
"return",
"... | // ParseContainerType converts the specified string into a supported
// ContainerType instance or returns an error if the container type is invalid. | [
"ParseContainerType",
"converts",
"the",
"specified",
"string",
"into",
"a",
"supported",
"ContainerType",
"instance",
"or",
"returns",
"an",
"error",
"if",
"the",
"container",
"type",
"is",
"invalid",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/instance/container.go#L38-L45 |
154,661 | juju/juju | worker/pubsub/subscriber.go | Validate | func (c *WorkerConfig) Validate() error {
if c.Origin == "" {
return errors.NotValidf("missing origin")
}
if c.Clock == nil {
return errors.NotValidf("missing clock")
}
if c.Hub == nil {
return errors.NotValidf("missing hub")
}
if c.Logger == nil {
return errors.NotValidf("missing logger")
}
if c.APIIn... | go | func (c *WorkerConfig) Validate() error {
if c.Origin == "" {
return errors.NotValidf("missing origin")
}
if c.Clock == nil {
return errors.NotValidf("missing clock")
}
if c.Hub == nil {
return errors.NotValidf("missing hub")
}
if c.Logger == nil {
return errors.NotValidf("missing logger")
}
if c.APIIn... | [
"func",
"(",
"c",
"*",
"WorkerConfig",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"c",
".",
"Origin",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"NotValidf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"Clock",
"==",
"nil",
... | // Validate checks that all the values have been set. | [
"Validate",
"checks",
"that",
"all",
"the",
"values",
"have",
"been",
"set",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/pubsub/subscriber.go#L39-L62 |
154,662 | juju/juju | worker/pubsub/subscriber.go | Report | func (s *subscriber) Report() map[string]interface{} {
s.mutex.Lock()
defer s.mutex.Unlock()
result := map[string]interface{}{
"source": s.config.Origin,
}
targets := make(map[string]interface{})
for target, remote := range s.servers {
targets[target] = remote.Report()
}
if len(targets) > 0 {
result["targ... | go | func (s *subscriber) Report() map[string]interface{} {
s.mutex.Lock()
defer s.mutex.Unlock()
result := map[string]interface{}{
"source": s.config.Origin,
}
targets := make(map[string]interface{})
for target, remote := range s.servers {
targets[target] = remote.Report()
}
if len(targets) > 0 {
result["targ... | [
"func",
"(",
"s",
"*",
"subscriber",
")",
"Report",
"(",
")",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"s",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"result",
":=",
"map... | // Report returns the same information as the introspection report
// but in the map for for the dependency engine report. | [
"Report",
"returns",
"the",
"same",
"information",
"as",
"the",
"introspection",
"report",
"but",
"in",
"the",
"map",
"for",
"for",
"the",
"dependency",
"engine",
"report",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/pubsub/subscriber.go#L123-L138 |
154,663 | juju/juju | api/agenttools/agenttools.go | NewFacade | func NewFacade(caller base.APICaller) *Facade {
facadeCaller := base.NewFacadeCaller(caller, apiName)
return &Facade{facadeCaller}
} | go | func NewFacade(caller base.APICaller) *Facade {
facadeCaller := base.NewFacadeCaller(caller, apiName)
return &Facade{facadeCaller}
} | [
"func",
"NewFacade",
"(",
"caller",
"base",
".",
"APICaller",
")",
"*",
"Facade",
"{",
"facadeCaller",
":=",
"base",
".",
"NewFacadeCaller",
"(",
"caller",
",",
"apiName",
")",
"\n",
"return",
"&",
"Facade",
"{",
"facadeCaller",
"}",
"\n",
"}"
] | // NewFacade returns a new api client facade instance. | [
"NewFacade",
"returns",
"a",
"new",
"api",
"client",
"facade",
"instance",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/agenttools/agenttools.go#L18-L21 |
154,664 | juju/juju | provider/vsphere/internal/vsphereclient/client.go | Dial | func Dial(
ctx context.Context,
u *url.URL,
datacenter string,
logger loggo.Logger,
) (*Client, error) {
client, err := govmomi.NewClient(ctx, u, true)
if err != nil {
return nil, errors.Trace(err)
}
return &Client{
client: client,
datacenter: datacenter,
logger: logger,
clock: clock.Wall... | go | func Dial(
ctx context.Context,
u *url.URL,
datacenter string,
logger loggo.Logger,
) (*Client, error) {
client, err := govmomi.NewClient(ctx, u, true)
if err != nil {
return nil, errors.Trace(err)
}
return &Client{
client: client,
datacenter: datacenter,
logger: logger,
clock: clock.Wall... | [
"func",
"Dial",
"(",
"ctx",
"context",
".",
"Context",
",",
"u",
"*",
"url",
".",
"URL",
",",
"datacenter",
"string",
",",
"logger",
"loggo",
".",
"Logger",
",",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"client",
",",
"err",
":=",
"govmomi"... | // Dial dials a new vSphere client connection using the given URL,
// scoped to the specified dataceter. The resulting Client's Close
// method must be called in order to release resources allocated by
// Dial. | [
"Dial",
"dials",
"a",
"new",
"vSphere",
"client",
"connection",
"using",
"the",
"given",
"URL",
"scoped",
"to",
"the",
"specified",
"dataceter",
".",
"The",
"resulting",
"Client",
"s",
"Close",
"method",
"must",
"be",
"called",
"in",
"order",
"to",
"release"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/vsphere/internal/vsphereclient/client.go#L69-L85 |
154,665 | juju/juju | provider/vsphere/internal/vsphereclient/client.go | Close | func (c *Client) Close(ctx context.Context) error {
return c.client.Logout(ctx)
} | go | func (c *Client) Close(ctx context.Context) error {
return c.client.Logout(ctx)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"Close",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"return",
"c",
".",
"client",
".",
"Logout",
"(",
"ctx",
")",
"\n",
"}"
] | // Close logs out and closes the client connection. | [
"Close",
"logs",
"out",
"and",
"closes",
"the",
"client",
"connection",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/vsphere/internal/vsphereclient/client.go#L88-L90 |
154,666 | juju/juju | provider/vsphere/internal/vsphereclient/client.go | RemoveVirtualMachines | func (c *Client) RemoveVirtualMachines(ctx context.Context, path string) error {
finder, _, err := c.finder(ctx)
if err != nil {
return errors.Trace(err)
}
vms, err := finder.VirtualMachineList(ctx, path)
if err != nil {
if _, ok := err.(*find.NotFoundError); ok {
c.logger.Debugf("no VMs matching path %q",... | go | func (c *Client) RemoveVirtualMachines(ctx context.Context, path string) error {
finder, _, err := c.finder(ctx)
if err != nil {
return errors.Trace(err)
}
vms, err := finder.VirtualMachineList(ctx, path)
if err != nil {
if _, ok := err.(*find.NotFoundError); ok {
c.logger.Debugf("no VMs matching path %q",... | [
"func",
"(",
"c",
"*",
"Client",
")",
"RemoveVirtualMachines",
"(",
"ctx",
"context",
".",
"Context",
",",
"path",
"string",
")",
"error",
"{",
"finder",
",",
"_",
",",
"err",
":=",
"c",
".",
"finder",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil... | // RemoveVirtualMachines removes VMs matching the given path from the
// system. The path may include wildcards, to match multiple VMs. | [
"RemoveVirtualMachines",
"removes",
"VMs",
"matching",
"the",
"given",
"path",
"from",
"the",
"system",
".",
"The",
"path",
"may",
"include",
"wildcards",
"to",
"match",
"multiple",
"VMs",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/vsphere/internal/vsphereclient/client.go#L112-L169 |
154,667 | juju/juju | provider/vsphere/internal/vsphereclient/client.go | VirtualMachines | func (c *Client) VirtualMachines(ctx context.Context, path string) ([]*mo.VirtualMachine, error) {
finder, _, err := c.finder(ctx)
if err != nil {
return nil, errors.Trace(err)
}
items, err := finder.VirtualMachineList(ctx, path)
if err != nil {
if _, ok := err.(*find.NotFoundError); ok {
return nil, nil
... | go | func (c *Client) VirtualMachines(ctx context.Context, path string) ([]*mo.VirtualMachine, error) {
finder, _, err := c.finder(ctx)
if err != nil {
return nil, errors.Trace(err)
}
items, err := finder.VirtualMachineList(ctx, path)
if err != nil {
if _, ok := err.(*find.NotFoundError); ok {
return nil, nil
... | [
"func",
"(",
"c",
"*",
"Client",
")",
"VirtualMachines",
"(",
"ctx",
"context",
".",
"Context",
",",
"path",
"string",
")",
"(",
"[",
"]",
"*",
"mo",
".",
"VirtualMachine",
",",
"error",
")",
"{",
"finder",
",",
"_",
",",
"err",
":=",
"c",
".",
"... | // VirtualMachines return list of all VMs in the system matching the given path. | [
"VirtualMachines",
"return",
"list",
"of",
"all",
"VMs",
"in",
"the",
"system",
"matching",
"the",
"given",
"path",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/vsphere/internal/vsphereclient/client.go#L172-L195 |
154,668 | juju/juju | provider/vsphere/internal/vsphereclient/client.go | ComputeResources | func (c *Client) ComputeResources(ctx context.Context) ([]*mo.ComputeResource, error) {
_, datacenter, err := c.finder(ctx)
if err != nil {
return nil, errors.Trace(err)
}
folders, err := datacenter.Folders(ctx)
if err != nil {
return nil, errors.Trace(err)
}
es, err := c.lister(folders.HostFolder.Reference... | go | func (c *Client) ComputeResources(ctx context.Context) ([]*mo.ComputeResource, error) {
_, datacenter, err := c.finder(ctx)
if err != nil {
return nil, errors.Trace(err)
}
folders, err := datacenter.Folders(ctx)
if err != nil {
return nil, errors.Trace(err)
}
es, err := c.lister(folders.HostFolder.Reference... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ComputeResources",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"*",
"mo",
".",
"ComputeResource",
",",
"error",
")",
"{",
"_",
",",
"datacenter",
",",
"err",
":=",
"c",
".",
"finder",
"(",
"ctx"... | // ComputeResources returns list of all root compute resources in the system. | [
"ComputeResources",
"returns",
"list",
"of",
"all",
"root",
"compute",
"resources",
"in",
"the",
"system",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/vsphere/internal/vsphereclient/client.go#L198-L223 |
154,669 | juju/juju | provider/vsphere/internal/vsphereclient/client.go | Datastores | func (c *Client) Datastores(ctx context.Context) ([]*mo.Datastore, error) {
_, datacenter, err := c.finder(ctx)
if err != nil {
return nil, errors.Trace(err)
}
folders, err := datacenter.Folders(ctx)
if err != nil {
return nil, errors.Trace(err)
}
es, err := c.lister(folders.DatastoreFolder.Reference()).Lis... | go | func (c *Client) Datastores(ctx context.Context) ([]*mo.Datastore, error) {
_, datacenter, err := c.finder(ctx)
if err != nil {
return nil, errors.Trace(err)
}
folders, err := datacenter.Folders(ctx)
if err != nil {
return nil, errors.Trace(err)
}
es, err := c.lister(folders.DatastoreFolder.Reference()).Lis... | [
"func",
"(",
"c",
"*",
"Client",
")",
"Datastores",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"*",
"mo",
".",
"Datastore",
",",
"error",
")",
"{",
"_",
",",
"datacenter",
",",
"err",
":=",
"c",
".",
"finder",
"(",
"ctx",
")",
"... | // Datastores returns list of all datastores in the system. | [
"Datastores",
"returns",
"list",
"of",
"all",
"datastores",
"in",
"the",
"system",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/vsphere/internal/vsphereclient/client.go#L226-L249 |
154,670 | juju/juju | provider/vsphere/internal/vsphereclient/client.go | EnsureVMFolder | func (c *Client) EnsureVMFolder(ctx context.Context, folderPath string) (*object.Folder, error) {
finder, datacenter, err := c.finder(ctx)
if err != nil {
return nil, errors.Trace(err)
}
folders, err := datacenter.Folders(ctx)
if err != nil {
return nil, errors.Trace(err)
}
createFolder := func(parent *obje... | go | func (c *Client) EnsureVMFolder(ctx context.Context, folderPath string) (*object.Folder, error) {
finder, datacenter, err := c.finder(ctx)
if err != nil {
return nil, errors.Trace(err)
}
folders, err := datacenter.Folders(ctx)
if err != nil {
return nil, errors.Trace(err)
}
createFolder := func(parent *obje... | [
"func",
"(",
"c",
"*",
"Client",
")",
"EnsureVMFolder",
"(",
"ctx",
"context",
".",
"Context",
",",
"folderPath",
"string",
")",
"(",
"*",
"object",
".",
"Folder",
",",
"error",
")",
"{",
"finder",
",",
"datacenter",
",",
"err",
":=",
"c",
".",
"find... | // EnsureVMFolder creates the a VM folder with the given path if it doesn't
// already exist. | [
"EnsureVMFolder",
"creates",
"the",
"a",
"VM",
"folder",
"with",
"the",
"given",
"path",
"if",
"it",
"doesn",
"t",
"already",
"exist",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/vsphere/internal/vsphereclient/client.go#L272-L305 |
154,671 | juju/juju | provider/vsphere/internal/vsphereclient/client.go | DestroyVMFolder | func (c *Client) DestroyVMFolder(ctx context.Context, folderPath string) error {
finder, datacenter, err := c.finder(ctx)
if err != nil {
return errors.Trace(err)
}
folders, err := datacenter.Folders(ctx)
if err != nil {
return errors.Trace(err)
}
folderPath = path.Join(folders.VmFolder.InventoryPath, folder... | go | func (c *Client) DestroyVMFolder(ctx context.Context, folderPath string) error {
finder, datacenter, err := c.finder(ctx)
if err != nil {
return errors.Trace(err)
}
folders, err := datacenter.Folders(ctx)
if err != nil {
return errors.Trace(err)
}
folderPath = path.Join(folders.VmFolder.InventoryPath, folder... | [
"func",
"(",
"c",
"*",
"Client",
")",
"DestroyVMFolder",
"(",
"ctx",
"context",
".",
"Context",
",",
"folderPath",
"string",
")",
"error",
"{",
"finder",
",",
"datacenter",
",",
"err",
":=",
"c",
".",
"finder",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=... | // DestroyVMFolder destroys a folder rooted at the datacenter's base VM folder. | [
"DestroyVMFolder",
"destroys",
"a",
"folder",
"rooted",
"at",
"the",
"datacenter",
"s",
"base",
"VM",
"folder",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/vsphere/internal/vsphereclient/client.go#L308-L335 |
154,672 | juju/juju | provider/vsphere/internal/vsphereclient/client.go | MoveVMFolderInto | func (c *Client) MoveVMFolderInto(ctx context.Context, parentPath, childPath string) error {
finder, datacenter, err := c.finder(ctx)
if err != nil {
return errors.Trace(err)
}
folders, err := datacenter.Folders(ctx)
if err != nil {
return errors.Trace(err)
}
parentPath = path.Join(folders.VmFolder.Inventor... | go | func (c *Client) MoveVMFolderInto(ctx context.Context, parentPath, childPath string) error {
finder, datacenter, err := c.finder(ctx)
if err != nil {
return errors.Trace(err)
}
folders, err := datacenter.Folders(ctx)
if err != nil {
return errors.Trace(err)
}
parentPath = path.Join(folders.VmFolder.Inventor... | [
"func",
"(",
"c",
"*",
"Client",
")",
"MoveVMFolderInto",
"(",
"ctx",
"context",
".",
"Context",
",",
"parentPath",
",",
"childPath",
"string",
")",
"error",
"{",
"finder",
",",
"datacenter",
",",
"err",
":=",
"c",
".",
"finder",
"(",
"ctx",
")",
"\n",... | // MoveVMFolderInto moves one VM folder into another. | [
"MoveVMFolderInto",
"moves",
"one",
"VM",
"folder",
"into",
"another",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/vsphere/internal/vsphereclient/client.go#L338-L367 |
154,673 | juju/juju | provider/vsphere/internal/vsphereclient/client.go | MoveVMsInto | func (c *Client) MoveVMsInto(
ctx context.Context,
folderPath string,
vms ...types.ManagedObjectReference,
) error {
finder, datacenter, err := c.finder(ctx)
if err != nil {
return errors.Trace(err)
}
folders, err := datacenter.Folders(ctx)
if err != nil {
return errors.Trace(err)
}
folderPath = path.Join... | go | func (c *Client) MoveVMsInto(
ctx context.Context,
folderPath string,
vms ...types.ManagedObjectReference,
) error {
finder, datacenter, err := c.finder(ctx)
if err != nil {
return errors.Trace(err)
}
folders, err := datacenter.Folders(ctx)
if err != nil {
return errors.Trace(err)
}
folderPath = path.Join... | [
"func",
"(",
"c",
"*",
"Client",
")",
"MoveVMsInto",
"(",
"ctx",
"context",
".",
"Context",
",",
"folderPath",
"string",
",",
"vms",
"...",
"types",
".",
"ManagedObjectReference",
",",
")",
"error",
"{",
"finder",
",",
"datacenter",
",",
"err",
":=",
"c"... | // MoveVMsInto moves a set of VMs into a folder. | [
"MoveVMsInto",
"moves",
"a",
"set",
"of",
"VMs",
"into",
"a",
"folder",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/vsphere/internal/vsphereclient/client.go#L370-L397 |
154,674 | juju/juju | provider/vsphere/internal/vsphereclient/client.go | UpdateVirtualMachineExtraConfig | func (c *Client) UpdateVirtualMachineExtraConfig(
ctx context.Context,
vmInfo *mo.VirtualMachine,
metadata map[string]string,
) error {
var spec types.VirtualMachineConfigSpec
for k, v := range metadata {
opt := &types.OptionValue{Key: k, Value: v}
spec.ExtraConfig = append(spec.ExtraConfig, opt)
}
vm := obj... | go | func (c *Client) UpdateVirtualMachineExtraConfig(
ctx context.Context,
vmInfo *mo.VirtualMachine,
metadata map[string]string,
) error {
var spec types.VirtualMachineConfigSpec
for k, v := range metadata {
opt := &types.OptionValue{Key: k, Value: v}
spec.ExtraConfig = append(spec.ExtraConfig, opt)
}
vm := obj... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateVirtualMachineExtraConfig",
"(",
"ctx",
"context",
".",
"Context",
",",
"vmInfo",
"*",
"mo",
".",
"VirtualMachine",
",",
"metadata",
"map",
"[",
"string",
"]",
"string",
",",
")",
"error",
"{",
"var",
"spec",
... | // UpdateVirtualMachineExtraConfig updates the "ExtraConfig" attributes
// of the specified virtual machine. Keys with empty values will be
// removed from the config; existing keys that are unspecified in the
// map will be untouched. | [
"UpdateVirtualMachineExtraConfig",
"updates",
"the",
"ExtraConfig",
"attributes",
"of",
"the",
"specified",
"virtual",
"machine",
".",
"Keys",
"with",
"empty",
"values",
"will",
"be",
"removed",
"from",
"the",
"config",
";",
"existing",
"keys",
"that",
"are",
"uns... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/vsphere/internal/vsphereclient/client.go#L403-L422 |
154,675 | juju/juju | provider/vsphere/internal/vsphereclient/client.go | DeleteDatastoreFile | func (c *Client) DeleteDatastoreFile(ctx context.Context, datastorePath string) error {
_, datacenter, err := c.finder(ctx)
if err != nil {
return errors.Trace(err)
}
fileManager := object.NewFileManager(c.client.Client)
deleteTask, err := fileManager.DeleteDatastoreFile(ctx, datastorePath, datacenter)
if err !... | go | func (c *Client) DeleteDatastoreFile(ctx context.Context, datastorePath string) error {
_, datacenter, err := c.finder(ctx)
if err != nil {
return errors.Trace(err)
}
fileManager := object.NewFileManager(c.client.Client)
deleteTask, err := fileManager.DeleteDatastoreFile(ctx, datastorePath, datacenter)
if err !... | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteDatastoreFile",
"(",
"ctx",
"context",
".",
"Context",
",",
"datastorePath",
"string",
")",
"error",
"{",
"_",
",",
"datacenter",
",",
"err",
":=",
"c",
".",
"finder",
"(",
"ctx",
")",
"\n",
"if",
"err",
"... | // DeleteDatastoreFile deletes a file or directory in the datastore. | [
"DeleteDatastoreFile",
"deletes",
"a",
"file",
"or",
"directory",
"in",
"the",
"datastore",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/vsphere/internal/vsphereclient/client.go#L425-L442 |
154,676 | juju/juju | cmd/jujud/reboot/reboot_nix.go | scheduleAction | func scheduleAction(action params.RebootAction, after int) error {
if action == params.ShouldDoNothing {
return nil
}
args := []string{"shutdown"}
switch action {
case params.ShouldReboot:
args = append(args, "-r")
case params.ShouldShutdown:
args = append(args, "-h")
}
args = append(args, "now")
script... | go | func scheduleAction(action params.RebootAction, after int) error {
if action == params.ShouldDoNothing {
return nil
}
args := []string{"shutdown"}
switch action {
case params.ShouldReboot:
args = append(args, "-r")
case params.ShouldShutdown:
args = append(args, "-h")
}
args = append(args, "now")
script... | [
"func",
"scheduleAction",
"(",
"action",
"params",
".",
"RebootAction",
",",
"after",
"int",
")",
"error",
"{",
"if",
"action",
"==",
"params",
".",
"ShouldDoNothing",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"args",
":=",
"[",
"]",
"string",
"{",
"\"",
... | // scheduleAction will do a reboot or shutdown after given number of seconds
// this function executes the operating system's reboot binary with appropriate
// parameters to schedule the reboot
// If action is params.ShouldDoNothing, it will return immediately. | [
"scheduleAction",
"will",
"do",
"a",
"reboot",
"or",
"shutdown",
"after",
"given",
"number",
"of",
"seconds",
"this",
"function",
"executes",
"the",
"operating",
"system",
"s",
"reboot",
"binary",
"with",
"appropriate",
"parameters",
"to",
"schedule",
"the",
"re... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/jujud/reboot/reboot_nix.go#L47-L72 |
154,677 | juju/juju | api/keymanager/client.go | AddKeys | func (c *Client) AddKeys(user string, keys ...string) ([]params.ErrorResult, error) {
p := params.ModifyUserSSHKeys{User: user, Keys: keys}
results := new(params.ErrorResults)
err := c.facade.FacadeCall("AddKeys", p, results)
return results.Results, err
} | go | func (c *Client) AddKeys(user string, keys ...string) ([]params.ErrorResult, error) {
p := params.ModifyUserSSHKeys{User: user, Keys: keys}
results := new(params.ErrorResults)
err := c.facade.FacadeCall("AddKeys", p, results)
return results.Results, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"AddKeys",
"(",
"user",
"string",
",",
"keys",
"...",
"string",
")",
"(",
"[",
"]",
"params",
".",
"ErrorResult",
",",
"error",
")",
"{",
"p",
":=",
"params",
".",
"ModifyUserSSHKeys",
"{",
"User",
":",
"user",
... | // AddKeys adds the authorised ssh keys for the specified user. | [
"AddKeys",
"adds",
"the",
"authorised",
"ssh",
"keys",
"for",
"the",
"specified",
"user",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/keymanager/client.go#L38-L43 |
154,678 | juju/juju | worker/instancemutater/mocks/namestag_mock.go | NewMockTag | func NewMockTag(ctrl *gomock.Controller) *MockTag {
mock := &MockTag{ctrl: ctrl}
mock.recorder = &MockTagMockRecorder{mock}
return mock
} | go | func NewMockTag(ctrl *gomock.Controller) *MockTag {
mock := &MockTag{ctrl: ctrl}
mock.recorder = &MockTagMockRecorder{mock}
return mock
} | [
"func",
"NewMockTag",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockTag",
"{",
"mock",
":=",
"&",
"MockTag",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockTagMockRecorder",
"{",
"mock",
"}",
"\n",
"return"... | // NewMockTag creates a new mock instance | [
"NewMockTag",
"creates",
"a",
"new",
"mock",
"instance"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/instancemutater/mocks/namestag_mock.go#L24-L28 |
154,679 | juju/juju | worker/instancemutater/mocks/namestag_mock.go | Id | func (mr *MockTagMockRecorder) Id() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Id", reflect.TypeOf((*MockTag)(nil).Id))
} | go | func (mr *MockTagMockRecorder) Id() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Id", reflect.TypeOf((*MockTag)(nil).Id))
} | [
"func",
"(",
"mr",
"*",
"MockTagMockRecorder",
")",
"Id",
"(",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(... | // Id indicates an expected call of Id | [
"Id",
"indicates",
"an",
"expected",
"call",
"of",
"Id"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/instancemutater/mocks/namestag_mock.go#L43-L45 |
154,680 | juju/juju | worker/containerbroker/mocks/environs_mock.go | NewMockLXDProfiler | func NewMockLXDProfiler(ctrl *gomock.Controller) *MockLXDProfiler {
mock := &MockLXDProfiler{ctrl: ctrl}
mock.recorder = &MockLXDProfilerMockRecorder{mock}
return mock
} | go | func NewMockLXDProfiler(ctrl *gomock.Controller) *MockLXDProfiler {
mock := &MockLXDProfiler{ctrl: ctrl}
mock.recorder = &MockLXDProfilerMockRecorder{mock}
return mock
} | [
"func",
"NewMockLXDProfiler",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockLXDProfiler",
"{",
"mock",
":=",
"&",
"MockLXDProfiler",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockLXDProfilerMockRecorder",
"{",
"... | // NewMockLXDProfiler creates a new mock instance | [
"NewMockLXDProfiler",
"creates",
"a",
"new",
"mock",
"instance"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/containerbroker/mocks/environs_mock.go#L30-L34 |
154,681 | juju/juju | worker/containerbroker/mocks/environs_mock.go | NewMockInstanceBroker | func NewMockInstanceBroker(ctrl *gomock.Controller) *MockInstanceBroker {
mock := &MockInstanceBroker{ctrl: ctrl}
mock.recorder = &MockInstanceBrokerMockRecorder{mock}
return mock
} | go | func NewMockInstanceBroker(ctrl *gomock.Controller) *MockInstanceBroker {
mock := &MockInstanceBroker{ctrl: ctrl}
mock.recorder = &MockInstanceBrokerMockRecorder{mock}
return mock
} | [
"func",
"NewMockInstanceBroker",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockInstanceBroker",
"{",
"mock",
":=",
"&",
"MockInstanceBroker",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockInstanceBrokerMockRecorder"... | // NewMockInstanceBroker creates a new mock instance | [
"NewMockInstanceBroker",
"creates",
"a",
"new",
"mock",
"instance"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/containerbroker/mocks/environs_mock.go#L91-L95 |
154,682 | juju/juju | worker/containerbroker/mocks/environs_mock.go | AllInstances | func (mr *MockInstanceBrokerMockRecorder) AllInstances(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AllInstances", reflect.TypeOf((*MockInstanceBroker)(nil).AllInstances), arg0)
} | go | func (mr *MockInstanceBrokerMockRecorder) AllInstances(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AllInstances", reflect.TypeOf((*MockInstanceBroker)(nil).AllInstances), arg0)
} | [
"func",
"(",
"mr",
"*",
"MockInstanceBrokerMockRecorder",
")",
"AllInstances",
"(",
"arg0",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",... | // AllInstances indicates an expected call of AllInstances | [
"AllInstances",
"indicates",
"an",
"expected",
"call",
"of",
"AllInstances"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/containerbroker/mocks/environs_mock.go#L111-L113 |
154,683 | juju/juju | apiserver/common/networkingcommon/types.go | NetworkConfigFromInterfaceInfo | func NetworkConfigFromInterfaceInfo(interfaceInfos []network.InterfaceInfo) []params.NetworkConfig {
result := make([]params.NetworkConfig, len(interfaceInfos))
for i, v := range interfaceInfos {
var dnsServers []string
for _, nameserver := range v.DNSServers {
dnsServers = append(dnsServers, nameserver.Value)... | go | func NetworkConfigFromInterfaceInfo(interfaceInfos []network.InterfaceInfo) []params.NetworkConfig {
result := make([]params.NetworkConfig, len(interfaceInfos))
for i, v := range interfaceInfos {
var dnsServers []string
for _, nameserver := range v.DNSServers {
dnsServers = append(dnsServers, nameserver.Value)... | [
"func",
"NetworkConfigFromInterfaceInfo",
"(",
"interfaceInfos",
"[",
"]",
"network",
".",
"InterfaceInfo",
")",
"[",
"]",
"params",
".",
"NetworkConfig",
"{",
"result",
":=",
"make",
"(",
"[",
"]",
"params",
".",
"NetworkConfig",
",",
"len",
"(",
"interfaceIn... | // NetworkConfigFromInterfaceInfo converts a slice of network.InterfaceInfo into
// the equivalent params.NetworkConfig slice. | [
"NetworkConfigFromInterfaceInfo",
"converts",
"a",
"slice",
"of",
"network",
".",
"InterfaceInfo",
"into",
"the",
"equivalent",
"params",
".",
"NetworkConfig",
"slice",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/networkingcommon/types.go#L154-L195 |
154,684 | juju/juju | apiserver/common/networkingcommon/types.go | NetworkConfigsToStateArgs | func NetworkConfigsToStateArgs(networkConfig []params.NetworkConfig) (
[]state.LinkLayerDeviceArgs,
[]state.LinkLayerDeviceAddress,
) {
var devicesArgs []state.LinkLayerDeviceArgs
var devicesAddrs []state.LinkLayerDeviceAddress
logger.Tracef("transforming network config to state args: %+v", networkConfig)
seenDe... | go | func NetworkConfigsToStateArgs(networkConfig []params.NetworkConfig) (
[]state.LinkLayerDeviceArgs,
[]state.LinkLayerDeviceAddress,
) {
var devicesArgs []state.LinkLayerDeviceArgs
var devicesAddrs []state.LinkLayerDeviceAddress
logger.Tracef("transforming network config to state args: %+v", networkConfig)
seenDe... | [
"func",
"NetworkConfigsToStateArgs",
"(",
"networkConfig",
"[",
"]",
"params",
".",
"NetworkConfig",
")",
"(",
"[",
"]",
"state",
".",
"LinkLayerDeviceArgs",
",",
"[",
"]",
"state",
".",
"LinkLayerDeviceAddress",
",",
")",
"{",
"var",
"devicesArgs",
"[",
"]",
... | // NetworkConfigsToStateArgs splits the given networkConfig into a slice of
// state.LinkLayerDeviceArgs and a slice of state.LinkLayerDeviceAddress. The
// input is expected to come from MergeProviderAndObservedNetworkConfigs and to
// be sorted. | [
"NetworkConfigsToStateArgs",
"splits",
"the",
"given",
"networkConfig",
"into",
"a",
"slice",
"of",
"state",
".",
"LinkLayerDeviceArgs",
"and",
"a",
"slice",
"of",
"state",
".",
"LinkLayerDeviceAddress",
".",
"The",
"input",
"is",
"expected",
"to",
"come",
"from",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/networkingcommon/types.go#L201-L280 |
154,685 | juju/juju | apiserver/common/networkingcommon/types.go | MergeProviderAndObservedNetworkConfigs | func MergeProviderAndObservedNetworkConfigs(
providerConfigs, observedConfigs []params.NetworkConfig,
) []params.NetworkConfig {
providerConfigByName := networkConfigsByName(providerConfigs)
logger.Tracef("known provider config by name: %+v", providerConfigByName)
providerConfigByAddress := networkConfigsByAddres... | go | func MergeProviderAndObservedNetworkConfigs(
providerConfigs, observedConfigs []params.NetworkConfig,
) []params.NetworkConfig {
providerConfigByName := networkConfigsByName(providerConfigs)
logger.Tracef("known provider config by name: %+v", providerConfigByName)
providerConfigByAddress := networkConfigsByAddres... | [
"func",
"MergeProviderAndObservedNetworkConfigs",
"(",
"providerConfigs",
",",
"observedConfigs",
"[",
"]",
"params",
".",
"NetworkConfig",
",",
")",
"[",
"]",
"params",
".",
"NetworkConfig",
"{",
"providerConfigByName",
":=",
"networkConfigsByName",
"(",
"providerConfi... | // MergeProviderAndObservedNetworkConfigs returns the effective network configs,
// using observedConfigs as a base and selectively updating it using the
// matching providerConfigs for each interface. | [
"MergeProviderAndObservedNetworkConfigs",
"returns",
"the",
"effective",
"network",
"configs",
"using",
"observedConfigs",
"as",
"a",
"base",
"and",
"selectively",
"updating",
"it",
"using",
"the",
"matching",
"providerConfigs",
"for",
"each",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/networkingcommon/types.go#L330-L363 |
154,686 | juju/juju | apiserver/facades/agent/meterstatus/meterstatus.go | NewMeterStatusFacade | func NewMeterStatusFacade(ctx facade.Context) (*MeterStatusAPI, error) {
authorizer := ctx.Auth()
resources := ctx.Resources()
return NewMeterStatusAPI(ctx.State(), resources, authorizer)
} | go | func NewMeterStatusFacade(ctx facade.Context) (*MeterStatusAPI, error) {
authorizer := ctx.Auth()
resources := ctx.Resources()
return NewMeterStatusAPI(ctx.State(), resources, authorizer)
} | [
"func",
"NewMeterStatusFacade",
"(",
"ctx",
"facade",
".",
"Context",
")",
"(",
"*",
"MeterStatusAPI",
",",
"error",
")",
"{",
"authorizer",
":=",
"ctx",
".",
"Auth",
"(",
")",
"\n",
"resources",
":=",
"ctx",
".",
"Resources",
"(",
")",
"\n",
"return",
... | // NewMeterStatusFacade provides the signature required for facade registration. | [
"NewMeterStatusFacade",
"provides",
"the",
"signature",
"required",
"for",
"facade",
"registration",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/meterstatus/meterstatus.go#L44-L48 |
154,687 | juju/juju | apiserver/facades/agent/meterstatus/meterstatus.go | NewMeterStatusAPI | func NewMeterStatusAPI(
st MeterStatusState,
resources facade.Resources,
authorizer facade.Authorizer,
) (*MeterStatusAPI, error) {
if !authorizer.AuthUnitAgent() && !authorizer.AuthApplicationAgent() {
return nil, common.ErrPerm
}
return &MeterStatusAPI{
state: st,
accessUnit: func() (common.AuthFunc, erro... | go | func NewMeterStatusAPI(
st MeterStatusState,
resources facade.Resources,
authorizer facade.Authorizer,
) (*MeterStatusAPI, error) {
if !authorizer.AuthUnitAgent() && !authorizer.AuthApplicationAgent() {
return nil, common.ErrPerm
}
return &MeterStatusAPI{
state: st,
accessUnit: func() (common.AuthFunc, erro... | [
"func",
"NewMeterStatusAPI",
"(",
"st",
"MeterStatusState",
",",
"resources",
"facade",
".",
"Resources",
",",
"authorizer",
"facade",
".",
"Authorizer",
",",
")",
"(",
"*",
"MeterStatusAPI",
",",
"error",
")",
"{",
"if",
"!",
"authorizer",
".",
"AuthUnitAgent... | // NewMeterStatusAPI creates a new API endpoint for dealing with unit meter status. | [
"NewMeterStatusAPI",
"creates",
"a",
"new",
"API",
"endpoint",
"for",
"dealing",
"with",
"unit",
"meter",
"status",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/meterstatus/meterstatus.go#L51-L92 |
154,688 | juju/juju | apiserver/facades/agent/meterstatus/meterstatus.go | WatchMeterStatus | func (m *MeterStatusAPI) WatchMeterStatus(args params.Entities) (params.NotifyWatchResults, error) {
result := params.NotifyWatchResults{
Results: make([]params.NotifyWatchResult, len(args.Entities)),
}
canAccess, err := m.accessUnit()
if err != nil {
return params.NotifyWatchResults{}, err
}
for i, entity :=... | go | func (m *MeterStatusAPI) WatchMeterStatus(args params.Entities) (params.NotifyWatchResults, error) {
result := params.NotifyWatchResults{
Results: make([]params.NotifyWatchResult, len(args.Entities)),
}
canAccess, err := m.accessUnit()
if err != nil {
return params.NotifyWatchResults{}, err
}
for i, entity :=... | [
"func",
"(",
"m",
"*",
"MeterStatusAPI",
")",
"WatchMeterStatus",
"(",
"args",
"params",
".",
"Entities",
")",
"(",
"params",
".",
"NotifyWatchResults",
",",
"error",
")",
"{",
"result",
":=",
"params",
".",
"NotifyWatchResults",
"{",
"Results",
":",
"make",... | // WatchMeterStatus returns a NotifyWatcher for observing changes
// to each unit's meter status. | [
"WatchMeterStatus",
"returns",
"a",
"NotifyWatcher",
"for",
"observing",
"changes",
"to",
"each",
"unit",
"s",
"meter",
"status",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/meterstatus/meterstatus.go#L96-L119 |
154,689 | juju/juju | apiserver/facades/agent/meterstatus/meterstatus.go | GetMeterStatus | func (m *MeterStatusAPI) GetMeterStatus(args params.Entities) (params.MeterStatusResults, error) {
result := params.MeterStatusResults{
Results: make([]params.MeterStatusResult, len(args.Entities)),
}
canAccess, err := m.accessUnit()
if err != nil {
return params.MeterStatusResults{}, common.ErrPerm
}
for i, ... | go | func (m *MeterStatusAPI) GetMeterStatus(args params.Entities) (params.MeterStatusResults, error) {
result := params.MeterStatusResults{
Results: make([]params.MeterStatusResult, len(args.Entities)),
}
canAccess, err := m.accessUnit()
if err != nil {
return params.MeterStatusResults{}, common.ErrPerm
}
for i, ... | [
"func",
"(",
"m",
"*",
"MeterStatusAPI",
")",
"GetMeterStatus",
"(",
"args",
"params",
".",
"Entities",
")",
"(",
"params",
".",
"MeterStatusResults",
",",
"error",
")",
"{",
"result",
":=",
"params",
".",
"MeterStatusResults",
"{",
"Results",
":",
"make",
... | // GetMeterStatus returns meter status information for each unit. | [
"GetMeterStatus",
"returns",
"meter",
"status",
"information",
"for",
"each",
"unit",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/meterstatus/meterstatus.go#L134-L162 |
154,690 | juju/juju | core/annotations/annotations.go | New | func New(as map[string]string) Annotation {
newA := Annotation{}
if as == nil {
return newA
}
for k, v := range as {
newA.Add(k, v)
}
return newA
} | go | func New(as map[string]string) Annotation {
newA := Annotation{}
if as == nil {
return newA
}
for k, v := range as {
newA.Add(k, v)
}
return newA
} | [
"func",
"New",
"(",
"as",
"map",
"[",
"string",
"]",
"string",
")",
"Annotation",
"{",
"newA",
":=",
"Annotation",
"{",
"}",
"\n",
"if",
"as",
"==",
"nil",
"{",
"return",
"newA",
"\n",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"as",
"{",
... | // New contructs an annotation. | [
"New",
"contructs",
"an",
"annotation",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/annotations/annotations.go#L17-L26 |
154,691 | juju/juju | core/annotations/annotations.go | HasAll | func (a Annotation) HasAll(expected map[string]string) bool {
for k, v := range expected {
if !a.Has(k, v) {
return false
}
}
return true
} | go | func (a Annotation) HasAll(expected map[string]string) bool {
for k, v := range expected {
if !a.Has(k, v) {
return false
}
}
return true
} | [
"func",
"(",
"a",
"Annotation",
")",
"HasAll",
"(",
"expected",
"map",
"[",
"string",
"]",
"string",
")",
"bool",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"expected",
"{",
"if",
"!",
"a",
".",
"Has",
"(",
"k",
",",
"v",
")",
"{",
"return",
"fa... | // HasAll checks if all the provided key value pairs exist in this annotation or not. | [
"HasAll",
"checks",
"if",
"all",
"the",
"provided",
"key",
"value",
"pairs",
"exist",
"in",
"this",
"annotation",
"or",
"not",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/annotations/annotations.go#L35-L42 |
154,692 | juju/juju | core/annotations/annotations.go | Add | func (a Annotation) Add(key, value string) Annotation {
a.setVal(key, value)
return a
} | go | func (a Annotation) Add(key, value string) Annotation {
a.setVal(key, value)
return a
} | [
"func",
"(",
"a",
"Annotation",
")",
"Add",
"(",
"key",
",",
"value",
"string",
")",
"Annotation",
"{",
"a",
".",
"setVal",
"(",
"key",
",",
"value",
")",
"\n",
"return",
"a",
"\n",
"}"
] | // Add inserts a new key value pair. | [
"Add",
"inserts",
"a",
"new",
"key",
"value",
"pair",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/annotations/annotations.go#L55-L58 |
154,693 | juju/juju | core/annotations/annotations.go | Merge | func (a Annotation) Merge(as Annotation) Annotation {
for k, v := range as {
a.Add(k, v)
}
return a
} | go | func (a Annotation) Merge(as Annotation) Annotation {
for k, v := range as {
a.Add(k, v)
}
return a
} | [
"func",
"(",
"a",
"Annotation",
")",
"Merge",
"(",
"as",
"Annotation",
")",
"Annotation",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"as",
"{",
"a",
".",
"Add",
"(",
"k",
",",
"v",
")",
"\n",
"}",
"\n",
"return",
"a",
"\n",
"}"
] | // Merge merges an annotation with current one. | [
"Merge",
"merges",
"an",
"annotation",
"with",
"current",
"one",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/annotations/annotations.go#L61-L66 |
154,694 | juju/juju | core/annotations/annotations.go | ToMap | func (a Annotation) ToMap() map[string]string {
out := make(map[string]string)
for k, v := range a {
out[k] = v
}
return out
} | go | func (a Annotation) ToMap() map[string]string {
out := make(map[string]string)
for k, v := range a {
out[k] = v
}
return out
} | [
"func",
"(",
"a",
"Annotation",
")",
"ToMap",
"(",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"out",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"a",
"{",
"out",
"[",
"k",
"]",
"... | // ToMap returns the map format of the annotation. | [
"ToMap",
"returns",
"the",
"map",
"format",
"of",
"the",
"annotation",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/annotations/annotations.go#L69-L75 |
154,695 | juju/juju | core/annotations/annotations.go | CheckKeysNonEmpty | func (a Annotation) CheckKeysNonEmpty(keys ...string) error {
for _, k := range keys {
v, ok := a.getVal(k)
if !ok {
return errors.NotFoundf("annotation key %q", k)
}
if v == "" {
return errors.NotValidf("annotation key %q has empty value", k)
}
}
return nil
} | go | func (a Annotation) CheckKeysNonEmpty(keys ...string) error {
for _, k := range keys {
v, ok := a.getVal(k)
if !ok {
return errors.NotFoundf("annotation key %q", k)
}
if v == "" {
return errors.NotValidf("annotation key %q has empty value", k)
}
}
return nil
} | [
"func",
"(",
"a",
"Annotation",
")",
"CheckKeysNonEmpty",
"(",
"keys",
"...",
"string",
")",
"error",
"{",
"for",
"_",
",",
"k",
":=",
"range",
"keys",
"{",
"v",
",",
"ok",
":=",
"a",
".",
"getVal",
"(",
"k",
")",
"\n",
"if",
"!",
"ok",
"{",
"r... | // CheckKeysNonEmpty checks if the provided keys are all set to non empty value. | [
"CheckKeysNonEmpty",
"checks",
"if",
"the",
"provided",
"keys",
"are",
"all",
"set",
"to",
"non",
"empty",
"value",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/annotations/annotations.go#L83-L94 |
154,696 | juju/juju | core/annotations/annotations.go | getVal | func (a Annotation) getVal(key string) (string, bool) {
v, ok := a[key]
return v, ok
} | go | func (a Annotation) getVal(key string) (string, bool) {
v, ok := a[key]
return v, ok
} | [
"func",
"(",
"a",
"Annotation",
")",
"getVal",
"(",
"key",
"string",
")",
"(",
"string",
",",
"bool",
")",
"{",
"v",
",",
"ok",
":=",
"a",
"[",
"key",
"]",
"\n",
"return",
"v",
",",
"ok",
"\n",
"}"
] | // getVal returns the value for the specified key and also indicates if it exists. | [
"getVal",
"returns",
"the",
"value",
"for",
"the",
"specified",
"key",
"and",
"also",
"indicates",
"if",
"it",
"exists",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/annotations/annotations.go#L97-L100 |
154,697 | juju/juju | state/backups/files.go | GetFilesToBackUp | func GetFilesToBackUp(rootDir string, paths *Paths, oldmachine string) ([]string, error) {
var glob string
glob = filepath.Join(rootDir, paths.DataDir, agentsDir, agentsConfs)
agentConfs, err := filepath.Glob(glob)
if err != nil {
return nil, errors.Annotate(err, "failed to fetch agent config files")
}
glob =... | go | func GetFilesToBackUp(rootDir string, paths *Paths, oldmachine string) ([]string, error) {
var glob string
glob = filepath.Join(rootDir, paths.DataDir, agentsDir, agentsConfs)
agentConfs, err := filepath.Glob(glob)
if err != nil {
return nil, errors.Annotate(err, "failed to fetch agent config files")
}
glob =... | [
"func",
"GetFilesToBackUp",
"(",
"rootDir",
"string",
",",
"paths",
"*",
"Paths",
",",
"oldmachine",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"glob",
"string",
"\n\n",
"glob",
"=",
"filepath",
".",
"Join",
"(",
"rootDir",
... | // GetFilesToBackUp returns the paths that should be included in the
// backup archive. | [
"GetFilesToBackUp",
"returns",
"the",
"paths",
"that",
"should",
"be",
"included",
"in",
"the",
"backup",
"archive",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/files.go#L46-L95 |
154,698 | juju/juju | state/backups/files.go | replaceableFoldersFunc | func replaceableFoldersFunc(dataDir string, mongoVersion mongo.Version) (map[string]os.FileMode, error) {
replaceables := map[string]os.FileMode{}
// NOTE: never put dataDir in here directly as that will unconditionally
// remove the database.
dirs := []string{
filepath.Join(dataDir, "init"),
filepath.Join(dat... | go | func replaceableFoldersFunc(dataDir string, mongoVersion mongo.Version) (map[string]os.FileMode, error) {
replaceables := map[string]os.FileMode{}
// NOTE: never put dataDir in here directly as that will unconditionally
// remove the database.
dirs := []string{
filepath.Join(dataDir, "init"),
filepath.Join(dat... | [
"func",
"replaceableFoldersFunc",
"(",
"dataDir",
"string",
",",
"mongoVersion",
"mongo",
".",
"Version",
")",
"(",
"map",
"[",
"string",
"]",
"os",
".",
"FileMode",
",",
"error",
")",
"{",
"replaceables",
":=",
"map",
"[",
"string",
"]",
"os",
".",
"Fil... | // replaceableFoldersFunc will return a map with the folders that need to
// be replaced so they can be deleted prior to a restore.
// Mongo 2.4 requires that the database directory be removed, while
// Mongo 3.2 requires that it not be removed | [
"replaceableFoldersFunc",
"will",
"return",
"a",
"map",
"with",
"the",
"folders",
"that",
"need",
"to",
"be",
"replaced",
"so",
"they",
"can",
"be",
"deleted",
"prior",
"to",
"a",
"restore",
".",
"Mongo",
"2",
".",
"4",
"requires",
"that",
"the",
"database... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/files.go#L104-L129 |
154,699 | juju/juju | api/credentialvalidator/credentialvalidator.go | ModelCredential | func (c *Facade) ModelCredential() (base.StoredCredential, bool, error) {
out := params.ModelCredential{}
emptyResult := base.StoredCredential{}
if err := c.facade.FacadeCall("ModelCredential", nil, &out); err != nil {
return emptyResult, false, errors.Trace(err)
}
if !out.Exists {
// On some clouds, model cr... | go | func (c *Facade) ModelCredential() (base.StoredCredential, bool, error) {
out := params.ModelCredential{}
emptyResult := base.StoredCredential{}
if err := c.facade.FacadeCall("ModelCredential", nil, &out); err != nil {
return emptyResult, false, errors.Trace(err)
}
if !out.Exists {
// On some clouds, model cr... | [
"func",
"(",
"c",
"*",
"Facade",
")",
"ModelCredential",
"(",
")",
"(",
"base",
".",
"StoredCredential",
",",
"bool",
",",
"error",
")",
"{",
"out",
":=",
"params",
".",
"ModelCredential",
"{",
"}",
"\n",
"emptyResult",
":=",
"base",
".",
"StoredCredenti... | // ModelCredential gets the cloud credential that a given model uses, including
// useful data such as "is this credential valid"...
// Some clouds do not require a credential and support the "empty" authentication
// type. Models on these clouds will have no credentials set, and thus, will return
// a false as 2nd arg... | [
"ModelCredential",
"gets",
"the",
"cloud",
"credential",
"that",
"a",
"given",
"model",
"uses",
"including",
"useful",
"data",
"such",
"as",
"is",
"this",
"credential",
"valid",
"...",
"Some",
"clouds",
"do",
"not",
"require",
"a",
"credential",
"and",
"suppor... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/credentialvalidator/credentialvalidator.go#L36-L57 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.