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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
4,300 | juju/juju | container/kvm/wrappedcmds.go | DestroyMachine | func DestroyMachine(c *kvmContainer) error {
if c.runCmd == nil {
c.runCmd = run
}
if c.pathfinder == nil {
c.pathfinder = paths.DataDir
}
// We don't return errors for virsh commands because it is possible that we
// didn't succeed in creating the domain. Additionally, we want all the
// commands to run. I... | go | func DestroyMachine(c *kvmContainer) error {
if c.runCmd == nil {
c.runCmd = run
}
if c.pathfinder == nil {
c.pathfinder = paths.DataDir
}
// We don't return errors for virsh commands because it is possible that we
// didn't succeed in creating the domain. Additionally, we want all the
// commands to run. I... | [
"func",
"DestroyMachine",
"(",
"c",
"*",
"kvmContainer",
")",
"error",
"{",
"if",
"c",
".",
"runCmd",
"==",
"nil",
"{",
"c",
".",
"runCmd",
"=",
"run",
"\n",
"}",
"\n",
"if",
"c",
".",
"pathfinder",
"==",
"nil",
"{",
"c",
".",
"pathfinder",
"=",
... | // DestroyMachine destroys the virtual machine represented by the kvmContainer. | [
"DestroyMachine",
"destroys",
"the",
"virtual",
"machine",
"represented",
"by",
"the",
"kvmContainer",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/kvm/wrappedcmds.go#L230-L272 |
4,301 | juju/juju | container/kvm/wrappedcmds.go | AutostartMachine | func AutostartMachine(c *kvmContainer) error {
if c.runCmd == nil {
c.runCmd = run
}
_, err := c.runCmd("", virsh, "autostart", c.Name())
return errors.Annotatef(err, "failed to autostart domain %q", c.Name())
} | go | func AutostartMachine(c *kvmContainer) error {
if c.runCmd == nil {
c.runCmd = run
}
_, err := c.runCmd("", virsh, "autostart", c.Name())
return errors.Annotatef(err, "failed to autostart domain %q", c.Name())
} | [
"func",
"AutostartMachine",
"(",
"c",
"*",
"kvmContainer",
")",
"error",
"{",
"if",
"c",
".",
"runCmd",
"==",
"nil",
"{",
"c",
".",
"runCmd",
"=",
"run",
"\n",
"}",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"runCmd",
"(",
"\"",
"\"",
",",
"virsh",
... | // AutostartMachine indicates that the virtual machines should automatically
// restart when the host restarts. | [
"AutostartMachine",
"indicates",
"that",
"the",
"virtual",
"machines",
"should",
"automatically",
"restart",
"when",
"the",
"host",
"restarts",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/kvm/wrappedcmds.go#L276-L282 |
4,302 | juju/juju | container/kvm/wrappedcmds.go | guestPath | func guestPath(pathfinder func(string) (string, error)) (string, error) {
baseDir, err := pathfinder(series.MustHostSeries())
if err != nil {
return "", errors.Trace(err)
}
return filepath.Join(baseDir, kvm, guestDir), nil
} | go | func guestPath(pathfinder func(string) (string, error)) (string, error) {
baseDir, err := pathfinder(series.MustHostSeries())
if err != nil {
return "", errors.Trace(err)
}
return filepath.Join(baseDir, kvm, guestDir), nil
} | [
"func",
"guestPath",
"(",
"pathfinder",
"func",
"(",
"string",
")",
"(",
"string",
",",
"error",
")",
")",
"(",
"string",
",",
"error",
")",
"{",
"baseDir",
",",
"err",
":=",
"pathfinder",
"(",
"series",
".",
"MustHostSeries",
"(",
")",
")",
"\n",
"i... | // guestPath returns the path to the guest directory from the given
// pathfinder. | [
"guestPath",
"returns",
"the",
"path",
"to",
"the",
"guest",
"directory",
"from",
"the",
"given",
"pathfinder",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/kvm/wrappedcmds.go#L310-L316 |
4,303 | juju/juju | container/kvm/wrappedcmds.go | writeDataSourceVolume | func writeDataSourceVolume(params CreateMachineParams) (string, error) {
templateDir := filepath.Dir(params.UserDataFile)
if err := writeMetadata(templateDir); err != nil {
return "", errors.Trace(err)
}
if err := writeNetworkConfig(params, templateDir); err != nil {
return "", errors.Trace(err)
}
// Creat... | go | func writeDataSourceVolume(params CreateMachineParams) (string, error) {
templateDir := filepath.Dir(params.UserDataFile)
if err := writeMetadata(templateDir); err != nil {
return "", errors.Trace(err)
}
if err := writeNetworkConfig(params, templateDir); err != nil {
return "", errors.Trace(err)
}
// Creat... | [
"func",
"writeDataSourceVolume",
"(",
"params",
"CreateMachineParams",
")",
"(",
"string",
",",
"error",
")",
"{",
"templateDir",
":=",
"filepath",
".",
"Dir",
"(",
"params",
".",
"UserDataFile",
")",
"\n\n",
"if",
"err",
":=",
"writeMetadata",
"(",
"templateD... | // writeDataSourceVolume creates a data source image for cloud init. | [
"writeDataSourceVolume",
"creates",
"a",
"data",
"source",
"image",
"for",
"cloud",
"init",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/kvm/wrappedcmds.go#L319-L375 |
4,304 | juju/juju | container/kvm/wrappedcmds.go | writeDomainXML | func writeDomainXML(templateDir string, p CreateMachineParams) (string, error) {
domainPath := filepath.Join(templateDir, fmt.Sprintf("%s.xml", p.Host()))
dom, err := libvirt.NewDomain(p)
if err != nil {
return "", errors.Trace(err)
}
ml, err := xml.MarshalIndent(&dom, "", " ")
if err != nil {
return "", ... | go | func writeDomainXML(templateDir string, p CreateMachineParams) (string, error) {
domainPath := filepath.Join(templateDir, fmt.Sprintf("%s.xml", p.Host()))
dom, err := libvirt.NewDomain(p)
if err != nil {
return "", errors.Trace(err)
}
ml, err := xml.MarshalIndent(&dom, "", " ")
if err != nil {
return "", ... | [
"func",
"writeDomainXML",
"(",
"templateDir",
"string",
",",
"p",
"CreateMachineParams",
")",
"(",
"string",
",",
"error",
")",
"{",
"domainPath",
":=",
"filepath",
".",
"Join",
"(",
"templateDir",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"p",
"... | // writeDomainXML writes out the configuration required to create a new guest
// domain. | [
"writeDomainXML",
"writes",
"out",
"the",
"configuration",
"required",
"to",
"create",
"a",
"new",
"guest",
"domain",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/kvm/wrappedcmds.go#L379-L408 |
4,305 | juju/juju | apiserver/facades/client/subnets/subnets.go | NewAPI | func NewAPI(st *state.State, res facade.Resources, auth facade.Authorizer) (SubnetsAPI, error) {
stateshim, err := networkingcommon.NewStateShim(st)
if err != nil {
return nil, errors.Trace(err)
}
return newAPIWithBacking(stateshim, state.CallContext(st), res, auth)
} | go | func NewAPI(st *state.State, res facade.Resources, auth facade.Authorizer) (SubnetsAPI, error) {
stateshim, err := networkingcommon.NewStateShim(st)
if err != nil {
return nil, errors.Trace(err)
}
return newAPIWithBacking(stateshim, state.CallContext(st), res, auth)
} | [
"func",
"NewAPI",
"(",
"st",
"*",
"state",
".",
"State",
",",
"res",
"facade",
".",
"Resources",
",",
"auth",
"facade",
".",
"Authorizer",
")",
"(",
"SubnetsAPI",
",",
"error",
")",
"{",
"stateshim",
",",
"err",
":=",
"networkingcommon",
".",
"NewStateSh... | // NewAPI creates a new Subnets API server-side facade with a
// state.State backing. | [
"NewAPI",
"creates",
"a",
"new",
"Subnets",
"API",
"server",
"-",
"side",
"facade",
"with",
"a",
"state",
".",
"State",
"backing",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/subnets/subnets.go#L47-L53 |
4,306 | juju/juju | apiserver/facades/client/subnets/subnets.go | AllSpaces | func (api *subnetsAPI) AllSpaces() (params.SpaceResults, error) {
if err := api.checkCanRead(); err != nil {
return params.SpaceResults{}, err
}
var results params.SpaceResults
spaces, err := api.backing.AllSpaces()
if err != nil {
return results, errors.Trace(err)
}
results.Results = make([]params.SpaceR... | go | func (api *subnetsAPI) AllSpaces() (params.SpaceResults, error) {
if err := api.checkCanRead(); err != nil {
return params.SpaceResults{}, err
}
var results params.SpaceResults
spaces, err := api.backing.AllSpaces()
if err != nil {
return results, errors.Trace(err)
}
results.Results = make([]params.SpaceR... | [
"func",
"(",
"api",
"*",
"subnetsAPI",
")",
"AllSpaces",
"(",
")",
"(",
"params",
".",
"SpaceResults",
",",
"error",
")",
"{",
"if",
"err",
":=",
"api",
".",
"checkCanRead",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"params",
".",
"SpaceResul... | // AllSpaces is defined on the API interface. | [
"AllSpaces",
"is",
"defined",
"on",
"the",
"API",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/subnets/subnets.go#L101-L121 |
4,307 | juju/juju | apiserver/facades/client/subnets/subnets.go | AddSubnets | func (api *subnetsAPI) AddSubnets(args params.AddSubnetsParams) (params.ErrorResults, error) {
if err := api.checkCanWrite(); err != nil {
return params.ErrorResults{}, err
}
return networkingcommon.AddSubnets(api.context, api.backing, args)
} | go | func (api *subnetsAPI) AddSubnets(args params.AddSubnetsParams) (params.ErrorResults, error) {
if err := api.checkCanWrite(); err != nil {
return params.ErrorResults{}, err
}
return networkingcommon.AddSubnets(api.context, api.backing, args)
} | [
"func",
"(",
"api",
"*",
"subnetsAPI",
")",
"AddSubnets",
"(",
"args",
"params",
".",
"AddSubnetsParams",
")",
"(",
"params",
".",
"ErrorResults",
",",
"error",
")",
"{",
"if",
"err",
":=",
"api",
".",
"checkCanWrite",
"(",
")",
";",
"err",
"!=",
"nil"... | // AddSubnets is defined on the API interface. | [
"AddSubnets",
"is",
"defined",
"on",
"the",
"API",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/subnets/subnets.go#L124-L129 |
4,308 | juju/juju | worker/uniter/runner/jujuc/leader-get.go | NewLeaderGetCommand | func NewLeaderGetCommand(ctx Context) (cmd.Command, error) {
return &leaderGetCommand{ctx: ctx}, nil
} | go | func NewLeaderGetCommand(ctx Context) (cmd.Command, error) {
return &leaderGetCommand{ctx: ctx}, nil
} | [
"func",
"NewLeaderGetCommand",
"(",
"ctx",
"Context",
")",
"(",
"cmd",
".",
"Command",
",",
"error",
")",
"{",
"return",
"&",
"leaderGetCommand",
"{",
"ctx",
":",
"ctx",
"}",
",",
"nil",
"\n",
"}"
] | // NewLeaderGetCommand returns a new leaderGetCommand with the given context. | [
"NewLeaderGetCommand",
"returns",
"a",
"new",
"leaderGetCommand",
"with",
"the",
"given",
"context",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runner/jujuc/leader-get.go#L25-L27 |
4,309 | juju/juju | cloud/personalclouds.go | PersonalCloudMetadata | func PersonalCloudMetadata() (map[string]Cloud, error) {
clouds, err := ParseCloudMetadataFile(JujuPersonalCloudsPath())
if err != nil && os.IsNotExist(err) {
return nil, nil
}
return clouds, err
} | go | func PersonalCloudMetadata() (map[string]Cloud, error) {
clouds, err := ParseCloudMetadataFile(JujuPersonalCloudsPath())
if err != nil && os.IsNotExist(err) {
return nil, nil
}
return clouds, err
} | [
"func",
"PersonalCloudMetadata",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"Cloud",
",",
"error",
")",
"{",
"clouds",
",",
"err",
":=",
"ParseCloudMetadataFile",
"(",
"JujuPersonalCloudsPath",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"os",
".... | // PersonalCloudMetadata loads any personal cloud metadata defined
// in the Juju Home directory. If not cloud metadata is found,
// that is not an error; nil is returned. | [
"PersonalCloudMetadata",
"loads",
"any",
"personal",
"cloud",
"metadata",
"defined",
"in",
"the",
"Juju",
"Home",
"directory",
".",
"If",
"not",
"cloud",
"metadata",
"is",
"found",
"that",
"is",
"not",
"an",
"error",
";",
"nil",
"is",
"returned",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloud/personalclouds.go#L27-L33 |
4,310 | juju/juju | cloud/personalclouds.go | ParseCloudMetadataFile | func ParseCloudMetadataFile(file string) (map[string]Cloud, error) {
data, err := ioutil.ReadFile(file)
if err != nil {
return nil, err
}
clouds, err := ParseCloudMetadata(data)
if err != nil {
return nil, err
}
return clouds, err
} | go | func ParseCloudMetadataFile(file string) (map[string]Cloud, error) {
data, err := ioutil.ReadFile(file)
if err != nil {
return nil, err
}
clouds, err := ParseCloudMetadata(data)
if err != nil {
return nil, err
}
return clouds, err
} | [
"func",
"ParseCloudMetadataFile",
"(",
"file",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"Cloud",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"file",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil"... | // ParseCloudMetadataFile loads any cloud metadata defined
// in the specified file. | [
"ParseCloudMetadataFile",
"loads",
"any",
"cloud",
"metadata",
"defined",
"in",
"the",
"specified",
"file",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloud/personalclouds.go#L37-L47 |
4,311 | juju/juju | cloud/personalclouds.go | WritePersonalCloudMetadata | func WritePersonalCloudMetadata(cloudsMap map[string]Cloud) error {
data, err := marshalCloudMetadata(cloudsMap)
if err != nil {
return errors.Trace(err)
}
return ioutil.WriteFile(JujuPersonalCloudsPath(), data, os.FileMode(0600))
} | go | func WritePersonalCloudMetadata(cloudsMap map[string]Cloud) error {
data, err := marshalCloudMetadata(cloudsMap)
if err != nil {
return errors.Trace(err)
}
return ioutil.WriteFile(JujuPersonalCloudsPath(), data, os.FileMode(0600))
} | [
"func",
"WritePersonalCloudMetadata",
"(",
"cloudsMap",
"map",
"[",
"string",
"]",
"Cloud",
")",
"error",
"{",
"data",
",",
"err",
":=",
"marshalCloudMetadata",
"(",
"cloudsMap",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Trace",
"... | // WritePersonalCloudMetadata marshals to YAML and writes the cloud metadata
// to the personal cloud file. | [
"WritePersonalCloudMetadata",
"marshals",
"to",
"YAML",
"and",
"writes",
"the",
"cloud",
"metadata",
"to",
"the",
"personal",
"cloud",
"file",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloud/personalclouds.go#L51-L57 |
4,312 | juju/juju | network/containerizer/bridgepolicy.go | inferContainerSpaces | func (p *BridgePolicy) inferContainerSpaces(m Machine, containerId, defaultSpaceName string) (set.Strings, error) {
if p.ContainerNetworkingMethod == "local" {
return set.NewStrings(""), nil
}
hostSpaces, err := m.AllSpaces()
if err != nil {
return nil, errors.Trace(err)
}
logger.Debugf("container %q not qual... | go | func (p *BridgePolicy) inferContainerSpaces(m Machine, containerId, defaultSpaceName string) (set.Strings, error) {
if p.ContainerNetworkingMethod == "local" {
return set.NewStrings(""), nil
}
hostSpaces, err := m.AllSpaces()
if err != nil {
return nil, errors.Trace(err)
}
logger.Debugf("container %q not qual... | [
"func",
"(",
"p",
"*",
"BridgePolicy",
")",
"inferContainerSpaces",
"(",
"m",
"Machine",
",",
"containerId",
",",
"defaultSpaceName",
"string",
")",
"(",
"set",
".",
"Strings",
",",
"error",
")",
"{",
"if",
"p",
".",
"ContainerNetworkingMethod",
"==",
"\"",
... | // inferContainerSpaces tries to find a valid space for the container to be
// on. This should only be used when the container itself doesn't have any
// valid constraints on what spaces it should be in.
// If ContainerNetworkingMethod is 'local' we fall back to "" and use lxdbr0.
// If this machine is in a single spac... | [
"inferContainerSpaces",
"tries",
"to",
"find",
"a",
"valid",
"space",
"for",
"the",
"container",
"to",
"be",
"on",
".",
"This",
"should",
"only",
"be",
"used",
"when",
"the",
"container",
"itself",
"doesn",
"t",
"have",
"any",
"valid",
"constraints",
"on",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/network/containerizer/bridgepolicy.go#L50-L74 |
4,313 | juju/juju | network/containerizer/bridgepolicy.go | determineContainerSpaces | func (p *BridgePolicy) determineContainerSpaces(m Machine, containerMachine Container, defaultSpaceName string) (set.Strings, error) {
containerSpaces, err := containerMachine.DesiredSpaces()
if err != nil {
return nil, errors.Trace(err)
}
logger.Debugf("for container %q, found desired spaces: %s",
containerMac... | go | func (p *BridgePolicy) determineContainerSpaces(m Machine, containerMachine Container, defaultSpaceName string) (set.Strings, error) {
containerSpaces, err := containerMachine.DesiredSpaces()
if err != nil {
return nil, errors.Trace(err)
}
logger.Debugf("for container %q, found desired spaces: %s",
containerMac... | [
"func",
"(",
"p",
"*",
"BridgePolicy",
")",
"determineContainerSpaces",
"(",
"m",
"Machine",
",",
"containerMachine",
"Container",
",",
"defaultSpaceName",
"string",
")",
"(",
"set",
".",
"Strings",
",",
"error",
")",
"{",
"containerSpaces",
",",
"err",
":=",
... | // determineContainerSpaces tries to use the direct information about a
// container to find what spaces it should be in, and then falls back to what
// we know about the host machine. | [
"determineContainerSpaces",
"tries",
"to",
"use",
"the",
"direct",
"information",
"about",
"a",
"container",
"to",
"find",
"what",
"spaces",
"it",
"should",
"be",
"in",
"and",
"then",
"falls",
"back",
"to",
"what",
"we",
"know",
"about",
"the",
"host",
"mach... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/network/containerizer/bridgepolicy.go#L79-L96 |
4,314 | juju/juju | network/containerizer/bridgepolicy.go | findSpacesAndDevicesForContainer | func (p *BridgePolicy) findSpacesAndDevicesForContainer(m Machine, containerMachine Container) (set.Strings, map[string][]LinkLayerDevice, error) {
containerSpaces, err := p.determineContainerSpaces(m, containerMachine, "")
if err != nil {
return nil, nil, errors.Trace(err)
}
devicesPerSpace, err := m.LinkLayerDe... | go | func (p *BridgePolicy) findSpacesAndDevicesForContainer(m Machine, containerMachine Container) (set.Strings, map[string][]LinkLayerDevice, error) {
containerSpaces, err := p.determineContainerSpaces(m, containerMachine, "")
if err != nil {
return nil, nil, errors.Trace(err)
}
devicesPerSpace, err := m.LinkLayerDe... | [
"func",
"(",
"p",
"*",
"BridgePolicy",
")",
"findSpacesAndDevicesForContainer",
"(",
"m",
"Machine",
",",
"containerMachine",
"Container",
")",
"(",
"set",
".",
"Strings",
",",
"map",
"[",
"string",
"]",
"[",
"]",
"LinkLayerDevice",
",",
"error",
")",
"{",
... | // findSpacesAndDevicesForContainer looks up what spaces the container wants
// to be in, and what spaces the host machine is already in, and tries to
// find the devices on the host that are useful for the container. | [
"findSpacesAndDevicesForContainer",
"looks",
"up",
"what",
"spaces",
"the",
"container",
"wants",
"to",
"be",
"in",
"and",
"what",
"spaces",
"the",
"host",
"machine",
"is",
"already",
"in",
"and",
"tries",
"to",
"find",
"the",
"devices",
"on",
"the",
"host",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/network/containerizer/bridgepolicy.go#L101-L113 |
4,315 | juju/juju | worker/agentconfigupdater/manifold.go | Manifold | func Manifold(config ManifoldConfig) dependency.Manifold {
return dependency.Manifold{
Inputs: []string{
config.AgentName,
config.APICallerName,
config.CentralHubName,
},
Start: func(context dependency.Context) (worker.Worker, error) {
// Get the agent.
var agent coreagent.Agent
if err := conte... | go | func Manifold(config ManifoldConfig) dependency.Manifold {
return dependency.Manifold{
Inputs: []string{
config.AgentName,
config.APICallerName,
config.CentralHubName,
},
Start: func(context dependency.Context) (worker.Worker, error) {
// Get the agent.
var agent coreagent.Agent
if err := conte... | [
"func",
"Manifold",
"(",
"config",
"ManifoldConfig",
")",
"dependency",
".",
"Manifold",
"{",
"return",
"dependency",
".",
"Manifold",
"{",
"Inputs",
":",
"[",
"]",
"string",
"{",
"config",
".",
"AgentName",
",",
"config",
".",
"APICallerName",
",",
"config"... | // Manifold defines a simple start function which
// runs after the API connection has come up. If the machine agent is
// a controller, it grabs the state serving info over the API and
// records it to agent configuration, and then stops. | [
"Manifold",
"defines",
"a",
"simple",
"start",
"function",
"which",
"runs",
"after",
"the",
"API",
"connection",
"has",
"come",
"up",
".",
"If",
"the",
"machine",
"agent",
"is",
"a",
"controller",
"it",
"grabs",
"the",
"state",
"serving",
"info",
"over",
"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/agentconfigupdater/manifold.go#L42-L150 |
4,316 | juju/juju | cmd/juju/storage/poollistformatters.go | formatPoolListTabular | func formatPoolListTabular(writer io.Writer, value interface{}) error {
pools, ok := value.(map[string]PoolInfo)
if !ok {
return errors.Errorf("expected value of type %T, got %T", pools, value)
}
formatPoolsTabular(writer, pools)
return nil
} | go | func formatPoolListTabular(writer io.Writer, value interface{}) error {
pools, ok := value.(map[string]PoolInfo)
if !ok {
return errors.Errorf("expected value of type %T, got %T", pools, value)
}
formatPoolsTabular(writer, pools)
return nil
} | [
"func",
"formatPoolListTabular",
"(",
"writer",
"io",
".",
"Writer",
",",
"value",
"interface",
"{",
"}",
")",
"error",
"{",
"pools",
",",
"ok",
":=",
"value",
".",
"(",
"map",
"[",
"string",
"]",
"PoolInfo",
")",
"\n",
"if",
"!",
"ok",
"{",
"return"... | // formatPoolListTabular returns a tabular summary of pool instances or
// errors out if parameter is not a map of PoolInfo. | [
"formatPoolListTabular",
"returns",
"a",
"tabular",
"summary",
"of",
"pool",
"instances",
"or",
"errors",
"out",
"if",
"parameter",
"is",
"not",
"a",
"map",
"of",
"PoolInfo",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/storage/poollistformatters.go#L19-L26 |
4,317 | juju/juju | cmd/juju/storage/poollistformatters.go | formatPoolsTabular | func formatPoolsTabular(writer io.Writer, pools map[string]PoolInfo) {
tw := output.TabWriter(writer)
print := func(values ...string) {
fmt.Fprintln(tw, strings.Join(values, "\t"))
}
print("Name", "Provider", "Attrs")
poolNames := make([]string, 0, len(pools))
for name := range pools {
poolNames = append(po... | go | func formatPoolsTabular(writer io.Writer, pools map[string]PoolInfo) {
tw := output.TabWriter(writer)
print := func(values ...string) {
fmt.Fprintln(tw, strings.Join(values, "\t"))
}
print("Name", "Provider", "Attrs")
poolNames := make([]string, 0, len(pools))
for name := range pools {
poolNames = append(po... | [
"func",
"formatPoolsTabular",
"(",
"writer",
"io",
".",
"Writer",
",",
"pools",
"map",
"[",
"string",
"]",
"PoolInfo",
")",
"{",
"tw",
":=",
"output",
".",
"TabWriter",
"(",
"writer",
")",
"\n",
"print",
":=",
"func",
"(",
"values",
"...",
"string",
")... | // formatPoolsTabular returns a tabular summary of pool instances. | [
"formatPoolsTabular",
"returns",
"a",
"tabular",
"summary",
"of",
"pool",
"instances",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/storage/poollistformatters.go#L29-L57 |
4,318 | juju/juju | provider/vsphere/errors.go | IsAuthorisationFailure | func IsAuthorisationFailure(err error) bool {
baseErr := errors.Cause(err)
if !soap.IsSoapFault(baseErr) {
return false
}
fault := soap.ToSoapFault(baseErr)
if fault.Code != serverFaultCode {
return false
}
_, isPermissionError := fault.Detail.Fault.(types.NoPermission)
if isPermissionError {
return true
... | go | func IsAuthorisationFailure(err error) bool {
baseErr := errors.Cause(err)
if !soap.IsSoapFault(baseErr) {
return false
}
fault := soap.ToSoapFault(baseErr)
if fault.Code != serverFaultCode {
return false
}
_, isPermissionError := fault.Detail.Fault.(types.NoPermission)
if isPermissionError {
return true
... | [
"func",
"IsAuthorisationFailure",
"(",
"err",
"error",
")",
"bool",
"{",
"baseErr",
":=",
"errors",
".",
"Cause",
"(",
"err",
")",
"\n",
"if",
"!",
"soap",
".",
"IsSoapFault",
"(",
"baseErr",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"fault",
":=",... | // IsAuthorisationFailure determines whether the given error indicates
// that the vsphere credential used is bad. | [
"IsAuthorisationFailure",
"determines",
"whether",
"the",
"given",
"error",
"indicates",
"that",
"the",
"vsphere",
"credential",
"used",
"is",
"bad",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/vsphere/errors.go#L31-L46 |
4,319 | juju/juju | state/undertaker.go | ProcessDyingModel | func (st *State) ProcessDyingModel() (err error) {
model, err := st.Model()
if err != nil {
return errors.Trace(err)
}
if model.Life() != Dying {
return errors.Trace(ErrModelNotDying)
}
if st.IsController() {
// We should not mark the controller model as Dead until
// all hosted models have been remove... | go | func (st *State) ProcessDyingModel() (err error) {
model, err := st.Model()
if err != nil {
return errors.Trace(err)
}
if model.Life() != Dying {
return errors.Trace(ErrModelNotDying)
}
if st.IsController() {
// We should not mark the controller model as Dead until
// all hosted models have been remove... | [
"func",
"(",
"st",
"*",
"State",
")",
"ProcessDyingModel",
"(",
")",
"(",
"err",
"error",
")",
"{",
"model",
",",
"err",
":=",
"st",
".",
"Model",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Trace",
"(",
"err",
")",
... | // ProcessDyingModel checks if the model is Dying and empty, and if so,
// transitions the model to Dead.
//
// If the model is non-empty because it is the controller model and still
// contains hosted models, an error satisfying IsHasHostedModelsError will
// be returned. If the model is otherwise non-empty, an error ... | [
"ProcessDyingModel",
"checks",
"if",
"the",
"model",
"is",
"Dying",
"and",
"empty",
"and",
"if",
"so",
"transitions",
"the",
"model",
"to",
"Dead",
".",
"If",
"the",
"model",
"is",
"non",
"-",
"empty",
"because",
"it",
"is",
"the",
"controller",
"model",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/undertaker.go#L19-L51 |
4,320 | juju/juju | apiserver/facades/client/metricsdebug/metricsdebug.go | NewMetricsDebugAPI | func NewMetricsDebugAPI(
st *state.State,
resources facade.Resources,
authorizer facade.Authorizer,
) (*MetricsDebugAPI, error) {
if !authorizer.AuthClient() {
return nil, common.ErrPerm
}
return &MetricsDebugAPI{
state: st,
}, nil
} | go | func NewMetricsDebugAPI(
st *state.State,
resources facade.Resources,
authorizer facade.Authorizer,
) (*MetricsDebugAPI, error) {
if !authorizer.AuthClient() {
return nil, common.ErrPerm
}
return &MetricsDebugAPI{
state: st,
}, nil
} | [
"func",
"NewMetricsDebugAPI",
"(",
"st",
"*",
"state",
".",
"State",
",",
"resources",
"facade",
".",
"Resources",
",",
"authorizer",
"facade",
".",
"Authorizer",
",",
")",
"(",
"*",
"MetricsDebugAPI",
",",
"error",
")",
"{",
"if",
"!",
"authorizer",
".",
... | // NewMetricsDebugAPI creates a new API endpoint for calling metrics debug functions. | [
"NewMetricsDebugAPI",
"creates",
"a",
"new",
"API",
"endpoint",
"for",
"calling",
"metrics",
"debug",
"functions",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/metricsdebug/metricsdebug.go#L57-L69 |
4,321 | juju/juju | apiserver/facades/client/metricsdebug/metricsdebug.go | GetMetrics | func (api *MetricsDebugAPI) GetMetrics(args params.Entities) (params.MetricResults, error) {
results := params.MetricResults{
Results: make([]params.EntityMetrics, len(args.Entities)),
}
if len(args.Entities) == 0 {
batches, err := api.state.MetricBatchesForModel()
if err != nil {
return results, errors.Ann... | go | func (api *MetricsDebugAPI) GetMetrics(args params.Entities) (params.MetricResults, error) {
results := params.MetricResults{
Results: make([]params.EntityMetrics, len(args.Entities)),
}
if len(args.Entities) == 0 {
batches, err := api.state.MetricBatchesForModel()
if err != nil {
return results, errors.Ann... | [
"func",
"(",
"api",
"*",
"MetricsDebugAPI",
")",
"GetMetrics",
"(",
"args",
"params",
".",
"Entities",
")",
"(",
"params",
".",
"MetricResults",
",",
"error",
")",
"{",
"results",
":=",
"params",
".",
"MetricResults",
"{",
"Results",
":",
"make",
"(",
"[... | // GetMetrics returns all metrics stored by the state server. | [
"GetMetrics",
"returns",
"all",
"metrics",
"stored",
"by",
"the",
"state",
"server",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/metricsdebug/metricsdebug.go#L72-L116 |
4,322 | juju/juju | apiserver/facades/client/metricsdebug/metricsdebug.go | SetMeterStatus | func (api *MetricsDebugAPI) SetMeterStatus(args params.MeterStatusParams) (params.ErrorResults, error) {
results := params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Statuses)),
}
for i, arg := range args.Statuses {
tag, err := names.ParseTag(arg.Tag)
if err != nil {
results.Results[i].Error... | go | func (api *MetricsDebugAPI) SetMeterStatus(args params.MeterStatusParams) (params.ErrorResults, error) {
results := params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Statuses)),
}
for i, arg := range args.Statuses {
tag, err := names.ParseTag(arg.Tag)
if err != nil {
results.Results[i].Error... | [
"func",
"(",
"api",
"*",
"MetricsDebugAPI",
")",
"SetMeterStatus",
"(",
"args",
"params",
".",
"MeterStatusParams",
")",
"(",
"params",
".",
"ErrorResults",
",",
"error",
")",
"{",
"results",
":=",
"params",
".",
"ErrorResults",
"{",
"Results",
":",
"make",
... | // SetMeterStatus sets meter statuses for entities. | [
"SetMeterStatus",
"sets",
"meter",
"statuses",
"for",
"entities",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/metricsdebug/metricsdebug.go#L170-L190 |
4,323 | juju/juju | apiserver/common/password.go | NewPasswordChanger | func NewPasswordChanger(st state.EntityFinder, getCanChange GetAuthFunc) *PasswordChanger {
return &PasswordChanger{
st: st,
getCanChange: getCanChange,
}
} | go | func NewPasswordChanger(st state.EntityFinder, getCanChange GetAuthFunc) *PasswordChanger {
return &PasswordChanger{
st: st,
getCanChange: getCanChange,
}
} | [
"func",
"NewPasswordChanger",
"(",
"st",
"state",
".",
"EntityFinder",
",",
"getCanChange",
"GetAuthFunc",
")",
"*",
"PasswordChanger",
"{",
"return",
"&",
"PasswordChanger",
"{",
"st",
":",
"st",
",",
"getCanChange",
":",
"getCanChange",
",",
"}",
"\n",
"}"
] | // NewPasswordChanger returns a new PasswordChanger. The GetAuthFunc will be
// used on each invocation of SetPasswords to determine current permissions. | [
"NewPasswordChanger",
"returns",
"a",
"new",
"PasswordChanger",
".",
"The",
"GetAuthFunc",
"will",
"be",
"used",
"on",
"each",
"invocation",
"of",
"SetPasswords",
"to",
"determine",
"current",
"permissions",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/password.go#L26-L31 |
4,324 | juju/juju | apiserver/common/password.go | SetPasswords | func (pc *PasswordChanger) SetPasswords(args params.EntityPasswords) (params.ErrorResults, error) {
result := params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Changes)),
}
if len(args.Changes) == 0 {
return result, nil
}
canChange, err := pc.getCanChange()
if err != nil {
return params.Erro... | go | func (pc *PasswordChanger) SetPasswords(args params.EntityPasswords) (params.ErrorResults, error) {
result := params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Changes)),
}
if len(args.Changes) == 0 {
return result, nil
}
canChange, err := pc.getCanChange()
if err != nil {
return params.Erro... | [
"func",
"(",
"pc",
"*",
"PasswordChanger",
")",
"SetPasswords",
"(",
"args",
"params",
".",
"EntityPasswords",
")",
"(",
"params",
".",
"ErrorResults",
",",
"error",
")",
"{",
"result",
":=",
"params",
".",
"ErrorResults",
"{",
"Results",
":",
"make",
"(",... | // SetPasswords sets the given password for each supplied entity, if possible. | [
"SetPasswords",
"sets",
"the",
"given",
"password",
"for",
"each",
"supplied",
"entity",
"if",
"possible",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/password.go#L34-L60 |
4,325 | juju/juju | cmd/juju/caas/add.go | NewAddCAASCommand | func NewAddCAASCommand(cloudMetadataStore CloudMetadataStore) cmd.Command {
store := jujuclient.NewFileClientStore()
cmd := &AddCAASCommand{
OptionalControllerCommand: modelcmd.OptionalControllerCommand{Store: store},
cloudMetadataStore: cloudMetadataStore,
store: store,
newClientCo... | go | func NewAddCAASCommand(cloudMetadataStore CloudMetadataStore) cmd.Command {
store := jujuclient.NewFileClientStore()
cmd := &AddCAASCommand{
OptionalControllerCommand: modelcmd.OptionalControllerCommand{Store: store},
cloudMetadataStore: cloudMetadataStore,
store: store,
newClientCo... | [
"func",
"NewAddCAASCommand",
"(",
"cloudMetadataStore",
"CloudMetadataStore",
")",
"cmd",
".",
"Command",
"{",
"store",
":=",
"jujuclient",
".",
"NewFileClientStore",
"(",
")",
"\n",
"cmd",
":=",
"&",
"AddCAASCommand",
"{",
"OptionalControllerCommand",
":",
"modelcm... | // NewAddCAASCommand returns a command to add caas information. | [
"NewAddCAASCommand",
"returns",
"a",
"command",
"to",
"add",
"caas",
"information",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/caas/add.go#L156-L177 |
4,326 | juju/juju | cmd/juju/caas/add.go | getStdinPipe | func getStdinPipe(ctx *cmd.Context) (io.Reader, error) {
if stdIn, ok := ctx.Stdin.(*os.File); ok && !terminal.IsTerminal(int(stdIn.Fd())) {
// stdIn from pipe but not terminal
stat, err := stdIn.Stat()
if err != nil {
return nil, err
}
content, err := ioutil.ReadAll(stdIn)
if err != nil {
return nil... | go | func getStdinPipe(ctx *cmd.Context) (io.Reader, error) {
if stdIn, ok := ctx.Stdin.(*os.File); ok && !terminal.IsTerminal(int(stdIn.Fd())) {
// stdIn from pipe but not terminal
stat, err := stdIn.Stat()
if err != nil {
return nil, err
}
content, err := ioutil.ReadAll(stdIn)
if err != nil {
return nil... | [
"func",
"getStdinPipe",
"(",
"ctx",
"*",
"cmd",
".",
"Context",
")",
"(",
"io",
".",
"Reader",
",",
"error",
")",
"{",
"if",
"stdIn",
",",
"ok",
":=",
"ctx",
".",
"Stdin",
".",
"(",
"*",
"os",
".",
"File",
")",
";",
"ok",
"&&",
"!",
"terminal",... | // getStdinPipe returns nil if the context's stdin is not a pipe. | [
"getStdinPipe",
"returns",
"nil",
"if",
"the",
"context",
"s",
"stdin",
"is",
"not",
"a",
"pipe",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/caas/add.go#L255-L272 |
4,327 | juju/juju | apiserver/common/unitswatcher.go | NewUnitsWatcher | func NewUnitsWatcher(st state.EntityFinder, resources facade.Resources, getCanWatch GetAuthFunc) *UnitsWatcher {
return &UnitsWatcher{
st: st,
resources: resources,
getCanWatch: getCanWatch,
}
} | go | func NewUnitsWatcher(st state.EntityFinder, resources facade.Resources, getCanWatch GetAuthFunc) *UnitsWatcher {
return &UnitsWatcher{
st: st,
resources: resources,
getCanWatch: getCanWatch,
}
} | [
"func",
"NewUnitsWatcher",
"(",
"st",
"state",
".",
"EntityFinder",
",",
"resources",
"facade",
".",
"Resources",
",",
"getCanWatch",
"GetAuthFunc",
")",
"*",
"UnitsWatcher",
"{",
"return",
"&",
"UnitsWatcher",
"{",
"st",
":",
"st",
",",
"resources",
":",
"r... | // NewUnitsWatcher returns a new UnitsWatcher. The GetAuthFunc will be
// used on each invocation of WatchUnits to determine current
// permissions. | [
"NewUnitsWatcher",
"returns",
"a",
"new",
"UnitsWatcher",
".",
"The",
"GetAuthFunc",
"will",
"be",
"used",
"on",
"each",
"invocation",
"of",
"WatchUnits",
"to",
"determine",
"current",
"permissions",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/unitswatcher.go#L27-L33 |
4,328 | juju/juju | upgrades/preupgradesteps.go | PreUpgradeSteps | func PreUpgradeSteps(_ *state.StatePool, agentConf agent.Config, isController, isMaster, isCaas bool) error {
if isCaas {
logger.Debugf("skipping disk space checks for k8s controllers")
return nil
}
if err := CheckFreeDiskSpace(agentConf.DataDir(), MinDiskSpaceMib); err != nil {
return errors.Trace(err)
}
if... | go | func PreUpgradeSteps(_ *state.StatePool, agentConf agent.Config, isController, isMaster, isCaas bool) error {
if isCaas {
logger.Debugf("skipping disk space checks for k8s controllers")
return nil
}
if err := CheckFreeDiskSpace(agentConf.DataDir(), MinDiskSpaceMib); err != nil {
return errors.Trace(err)
}
if... | [
"func",
"PreUpgradeSteps",
"(",
"_",
"*",
"state",
".",
"StatePool",
",",
"agentConf",
"agent",
".",
"Config",
",",
"isController",
",",
"isMaster",
",",
"isCaas",
"bool",
")",
"error",
"{",
"if",
"isCaas",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
... | // PreUpgradeSteps runs various checks and prepares for performing an upgrade.
// If any check fails, an error is returned which aborts the upgrade. | [
"PreUpgradeSteps",
"runs",
"various",
"checks",
"and",
"prepares",
"for",
"performing",
"an",
"upgrade",
".",
"If",
"any",
"check",
"fails",
"an",
"error",
"is",
"returned",
"which",
"aborts",
"the",
"upgrade",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/upgrades/preupgradesteps.go#L24-L41 |
4,329 | juju/juju | upgrades/preupgradesteps.go | CheckFreeDiskSpace | func CheckFreeDiskSpace(dir string, thresholdMib uint64) error {
usage := du.NewDiskUsage(dir)
available := usage.Available()
if available < thresholdMib*humanize.MiByte {
return errors.Errorf("not enough free disk space on %q for upgrade: %s available, require %dMiB",
dir, humanize.IBytes(available), threshold... | go | func CheckFreeDiskSpace(dir string, thresholdMib uint64) error {
usage := du.NewDiskUsage(dir)
available := usage.Available()
if available < thresholdMib*humanize.MiByte {
return errors.Errorf("not enough free disk space on %q for upgrade: %s available, require %dMiB",
dir, humanize.IBytes(available), threshold... | [
"func",
"CheckFreeDiskSpace",
"(",
"dir",
"string",
",",
"thresholdMib",
"uint64",
")",
"error",
"{",
"usage",
":=",
"du",
".",
"NewDiskUsage",
"(",
"dir",
")",
"\n",
"available",
":=",
"usage",
".",
"Available",
"(",
")",
"\n",
"if",
"available",
"<",
"... | // CheckFreeDiskSpace returns a helpful error if there isn't at
// least thresholdMib MiB of free space available on the volume
// containing dir. | [
"CheckFreeDiskSpace",
"returns",
"a",
"helpful",
"error",
"if",
"there",
"isn",
"t",
"at",
"least",
"thresholdMib",
"MiB",
"of",
"free",
"space",
"available",
"on",
"the",
"volume",
"containing",
"dir",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/upgrades/preupgradesteps.go#L50-L58 |
4,330 | juju/juju | payload/status.go | ValidateState | func ValidateState(state string) error {
if !okayStates.Contains(state) {
supported := okayStates.Values()
sort.Strings(supported)
states := strings.Join(supported, `", "`)
msg := fmt.Sprintf(`status %q not supported; expected one of ["%s"]`, state, states)
return errors.NewNotValid(nil, msg)
}
return nil
... | go | func ValidateState(state string) error {
if !okayStates.Contains(state) {
supported := okayStates.Values()
sort.Strings(supported)
states := strings.Join(supported, `", "`)
msg := fmt.Sprintf(`status %q not supported; expected one of ["%s"]`, state, states)
return errors.NewNotValid(nil, msg)
}
return nil
... | [
"func",
"ValidateState",
"(",
"state",
"string",
")",
"error",
"{",
"if",
"!",
"okayStates",
".",
"Contains",
"(",
"state",
")",
"{",
"supported",
":=",
"okayStates",
".",
"Values",
"(",
")",
"\n",
"sort",
".",
"Strings",
"(",
"supported",
")",
"\n",
"... | // ValidateState verifies the state passed in is a valid okayState. | [
"ValidateState",
"verifies",
"the",
"state",
"passed",
"in",
"is",
"a",
"valid",
"okayState",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/payload/status.go#L34-L43 |
4,331 | juju/juju | apiserver/facades/client/backups/backups.go | NewAPI | func NewAPI(backend Backend, resources facade.Resources, authorizer facade.Authorizer) (*API, error) {
isControllerAdmin, err := authorizer.HasPermission(permission.SuperuserAccess, backend.ControllerTag())
if err != nil && !errors.IsNotFound(err) {
return nil, errors.Trace(err)
}
if !authorizer.AuthClient() || ... | go | func NewAPI(backend Backend, resources facade.Resources, authorizer facade.Authorizer) (*API, error) {
isControllerAdmin, err := authorizer.HasPermission(permission.SuperuserAccess, backend.ControllerTag())
if err != nil && !errors.IsNotFound(err) {
return nil, errors.Trace(err)
}
if !authorizer.AuthClient() || ... | [
"func",
"NewAPI",
"(",
"backend",
"Backend",
",",
"resources",
"facade",
".",
"Resources",
",",
"authorizer",
"facade",
".",
"Authorizer",
")",
"(",
"*",
"API",
",",
"error",
")",
"{",
"isControllerAdmin",
",",
"err",
":=",
"authorizer",
".",
"HasPermission"... | // NewAPI creates a new instance of the Backups API facade. | [
"NewAPI",
"creates",
"a",
"new",
"instance",
"of",
"the",
"Backups",
"API",
"facade",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/backups/backups.go#L65-L117 |
4,332 | juju/juju | apiserver/facades/client/backups/backups.go | CreateResult | func CreateResult(meta *backups.Metadata, filename string) params.BackupsMetadataResult {
var result params.BackupsMetadataResult
result.ID = meta.ID()
result.Checksum = meta.Checksum()
result.ChecksumFormat = meta.ChecksumFormat()
result.Size = meta.Size()
if meta.Stored() != nil {
result.Stored = *(meta.Sto... | go | func CreateResult(meta *backups.Metadata, filename string) params.BackupsMetadataResult {
var result params.BackupsMetadataResult
result.ID = meta.ID()
result.Checksum = meta.Checksum()
result.ChecksumFormat = meta.ChecksumFormat()
result.Size = meta.Size()
if meta.Stored() != nil {
result.Stored = *(meta.Sto... | [
"func",
"CreateResult",
"(",
"meta",
"*",
"backups",
".",
"Metadata",
",",
"filename",
"string",
")",
"params",
".",
"BackupsMetadataResult",
"{",
"var",
"result",
"params",
".",
"BackupsMetadataResult",
"\n\n",
"result",
".",
"ID",
"=",
"meta",
".",
"ID",
"... | // CreateResult updates the result with the information in the
// metadata value. | [
"CreateResult",
"updates",
"the",
"result",
"with",
"the",
"information",
"in",
"the",
"metadata",
"value",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/backups/backups.go#L139-L174 |
4,333 | juju/juju | apiserver/facades/agent/instancemutater/instancemutater.go | NewInstanceMutaterAPI | func NewInstanceMutaterAPI(st InstanceMutaterState,
model ModelCache,
resources facade.Resources,
authorizer facade.Authorizer,
) (*InstanceMutaterAPI, error) {
if !authorizer.AuthMachineAgent() && !authorizer.AuthController() {
return nil, common.ErrPerm
}
getAuthFunc := common.AuthFuncForMachineAgent(authori... | go | func NewInstanceMutaterAPI(st InstanceMutaterState,
model ModelCache,
resources facade.Resources,
authorizer facade.Authorizer,
) (*InstanceMutaterAPI, error) {
if !authorizer.AuthMachineAgent() && !authorizer.AuthController() {
return nil, common.ErrPerm
}
getAuthFunc := common.AuthFuncForMachineAgent(authori... | [
"func",
"NewInstanceMutaterAPI",
"(",
"st",
"InstanceMutaterState",
",",
"model",
"ModelCache",
",",
"resources",
"facade",
".",
"Resources",
",",
"authorizer",
"facade",
".",
"Authorizer",
",",
")",
"(",
"*",
"InstanceMutaterAPI",
",",
"error",
")",
"{",
"if",
... | // NewInstanceMutaterAPI creates a new API server endpoint for managing
// charm profiles on juju lxd machines and containers. | [
"NewInstanceMutaterAPI",
"creates",
"a",
"new",
"API",
"server",
"endpoint",
"for",
"managing",
"charm",
"profiles",
"on",
"juju",
"lxd",
"machines",
"and",
"containers",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/instancemutater.go#L68-L86 |
4,334 | juju/juju | apiserver/facades/agent/instancemutater/instancemutater.go | CharmProfilingInfo | func (api *InstanceMutaterAPI) CharmProfilingInfo(arg params.Entity) (params.CharmProfilingInfoResult, error) {
result := params.CharmProfilingInfoResult{
ProfileChanges: make([]params.ProfileInfoResult, 0),
}
canAccess, err := api.getAuthFunc()
if err != nil {
return params.CharmProfilingInfoResult{}, errors.T... | go | func (api *InstanceMutaterAPI) CharmProfilingInfo(arg params.Entity) (params.CharmProfilingInfoResult, error) {
result := params.CharmProfilingInfoResult{
ProfileChanges: make([]params.ProfileInfoResult, 0),
}
canAccess, err := api.getAuthFunc()
if err != nil {
return params.CharmProfilingInfoResult{}, errors.T... | [
"func",
"(",
"api",
"*",
"InstanceMutaterAPI",
")",
"CharmProfilingInfo",
"(",
"arg",
"params",
".",
"Entity",
")",
"(",
"params",
".",
"CharmProfilingInfoResult",
",",
"error",
")",
"{",
"result",
":=",
"params",
".",
"CharmProfilingInfoResult",
"{",
"ProfileCh... | // CharmProfilingInfo returns info to update lxd profiles on the machine. If
// the machine is not provisioned, no profile change info will be returned,
// nor will an error. | [
"CharmProfilingInfo",
"returns",
"info",
"to",
"update",
"lxd",
"profiles",
"on",
"the",
"machine",
".",
"If",
"the",
"machine",
"is",
"not",
"provisioned",
"no",
"profile",
"change",
"info",
"will",
"be",
"returned",
"nor",
"will",
"an",
"error",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/instancemutater.go#L91-L122 |
4,335 | juju/juju | apiserver/facades/agent/instancemutater/instancemutater.go | SetCharmProfiles | func (api *InstanceMutaterAPI) SetCharmProfiles(args params.SetProfileArgs) (params.ErrorResults, error) {
results := make([]params.ErrorResult, len(args.Args))
canAccess, err := api.getAuthFunc()
if err != nil {
return params.ErrorResults{}, errors.Trace(err)
}
for i, a := range args.Args {
err := api.setOneM... | go | func (api *InstanceMutaterAPI) SetCharmProfiles(args params.SetProfileArgs) (params.ErrorResults, error) {
results := make([]params.ErrorResult, len(args.Args))
canAccess, err := api.getAuthFunc()
if err != nil {
return params.ErrorResults{}, errors.Trace(err)
}
for i, a := range args.Args {
err := api.setOneM... | [
"func",
"(",
"api",
"*",
"InstanceMutaterAPI",
")",
"SetCharmProfiles",
"(",
"args",
"params",
".",
"SetProfileArgs",
")",
"(",
"params",
".",
"ErrorResults",
",",
"error",
")",
"{",
"results",
":=",
"make",
"(",
"[",
"]",
"params",
".",
"ErrorResult",
","... | // SetCharmProfiles records the given slice of charm profile names. | [
"SetCharmProfiles",
"records",
"the",
"given",
"slice",
"of",
"charm",
"profile",
"names",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/instancemutater.go#L148-L159 |
4,336 | juju/juju | apiserver/facades/agent/instancemutater/instancemutater.go | WatchMachines | func (api *InstanceMutaterAPI) WatchMachines() (params.StringsWatchResult, error) {
result := params.StringsWatchResult{}
if !api.authorizer.AuthController() {
return result, common.ErrPerm
}
watch, err := api.model.WatchMachines()
if err != nil {
return result, err
}
if changes, ok := <-watch.Changes(); ok... | go | func (api *InstanceMutaterAPI) WatchMachines() (params.StringsWatchResult, error) {
result := params.StringsWatchResult{}
if !api.authorizer.AuthController() {
return result, common.ErrPerm
}
watch, err := api.model.WatchMachines()
if err != nil {
return result, err
}
if changes, ok := <-watch.Changes(); ok... | [
"func",
"(",
"api",
"*",
"InstanceMutaterAPI",
")",
"WatchMachines",
"(",
")",
"(",
"params",
".",
"StringsWatchResult",
",",
"error",
")",
"{",
"result",
":=",
"params",
".",
"StringsWatchResult",
"{",
"}",
"\n",
"if",
"!",
"api",
".",
"authorizer",
".",
... | // WatchMachines starts a watcher to track machines.
// WatchMachines does not consume the initial event of the watch response, as
// that returns the initial set of machines that are currently available. | [
"WatchMachines",
"starts",
"a",
"watcher",
"to",
"track",
"machines",
".",
"WatchMachines",
"does",
"not",
"consume",
"the",
"initial",
"event",
"of",
"the",
"watch",
"response",
"as",
"that",
"returns",
"the",
"initial",
"set",
"of",
"machines",
"that",
"are"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/instancemutater.go#L164-L181 |
4,337 | juju/juju | apiserver/facades/agent/instancemutater/instancemutater.go | WatchContainers | func (api *InstanceMutaterAPI) WatchContainers(arg params.Entity) (params.StringsWatchResult, error) {
result := params.StringsWatchResult{}
canAccess, err := api.getAuthFunc()
if err != nil {
return result, errors.Trace(err)
}
tag, err := names.ParseMachineTag(arg.Tag)
if err != nil {
return result, errors.T... | go | func (api *InstanceMutaterAPI) WatchContainers(arg params.Entity) (params.StringsWatchResult, error) {
result := params.StringsWatchResult{}
canAccess, err := api.getAuthFunc()
if err != nil {
return result, errors.Trace(err)
}
tag, err := names.ParseMachineTag(arg.Tag)
if err != nil {
return result, errors.T... | [
"func",
"(",
"api",
"*",
"InstanceMutaterAPI",
")",
"WatchContainers",
"(",
"arg",
"params",
".",
"Entity",
")",
"(",
"params",
".",
"StringsWatchResult",
",",
"error",
")",
"{",
"result",
":=",
"params",
".",
"StringsWatchResult",
"{",
"}",
"\n",
"canAccess... | // WatchContainers starts a watcher to track Containers on a given
// machine. | [
"WatchContainers",
"starts",
"a",
"watcher",
"to",
"track",
"Containers",
"on",
"a",
"given",
"machine",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/instancemutater.go#L185-L210 |
4,338 | juju/juju | apiserver/facades/agent/instancemutater/instancemutater.go | WatchLXDProfileVerificationNeeded | func (api *InstanceMutaterAPI) WatchLXDProfileVerificationNeeded(args params.Entities) (params.NotifyWatchResults, error) {
result := params.NotifyWatchResults{
Results: make([]params.NotifyWatchResult, len(args.Entities)),
}
if len(args.Entities) == 0 {
return result, nil
}
canAccess, err := api.getAuthFunc()... | go | func (api *InstanceMutaterAPI) WatchLXDProfileVerificationNeeded(args params.Entities) (params.NotifyWatchResults, error) {
result := params.NotifyWatchResults{
Results: make([]params.NotifyWatchResult, len(args.Entities)),
}
if len(args.Entities) == 0 {
return result, nil
}
canAccess, err := api.getAuthFunc()... | [
"func",
"(",
"api",
"*",
"InstanceMutaterAPI",
")",
"WatchLXDProfileVerificationNeeded",
"(",
"args",
"params",
".",
"Entities",
")",
"(",
"params",
".",
"NotifyWatchResults",
",",
"error",
")",
"{",
"result",
":=",
"params",
".",
"NotifyWatchResults",
"{",
"Res... | // WatchLXDProfileVerificationNeeded starts a watcher to track Applications with
// LXD Profiles. | [
"WatchLXDProfileVerificationNeeded",
"starts",
"a",
"watcher",
"to",
"track",
"Applications",
"with",
"LXD",
"Profiles",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/instancemutater.go#L214-L236 |
4,339 | juju/juju | cmd/juju/controller/killstatus.go | newTimedStatusUpdater | func newTimedStatusUpdater(ctx *cmd.Context, api destroyControllerAPI, controllerModelUUID string, clock clock.Clock) func(time.Duration) environmentStatus {
return func(wait time.Duration) environmentStatus {
if wait > 0 {
<-clock.After(wait)
}
// If we hit an error, status.HostedModelCount will be 0, the p... | go | func newTimedStatusUpdater(ctx *cmd.Context, api destroyControllerAPI, controllerModelUUID string, clock clock.Clock) func(time.Duration) environmentStatus {
return func(wait time.Duration) environmentStatus {
if wait > 0 {
<-clock.After(wait)
}
// If we hit an error, status.HostedModelCount will be 0, the p... | [
"func",
"newTimedStatusUpdater",
"(",
"ctx",
"*",
"cmd",
".",
"Context",
",",
"api",
"destroyControllerAPI",
",",
"controllerModelUUID",
"string",
",",
"clock",
"clock",
".",
"Clock",
")",
"func",
"(",
"time",
".",
"Duration",
")",
"environmentStatus",
"{",
"r... | // newTimedStatusUpdater returns a function which waits a given period of time
// before querying the apiserver for updated data. | [
"newTimedStatusUpdater",
"returns",
"a",
"function",
"which",
"waits",
"a",
"given",
"period",
"of",
"time",
"before",
"querying",
"the",
"apiserver",
"for",
"updated",
"data",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/controller/killstatus.go#L53-L71 |
4,340 | juju/juju | apiserver/common/cloudspec/statehelpers.go | MakeCloudSpecGetter | func MakeCloudSpecGetter(pool Pool) func(names.ModelTag) (environs.CloudSpec, error) {
return func(tag names.ModelTag) (environs.CloudSpec, error) {
st, err := pool.Get(tag.Id())
if err != nil {
return environs.CloudSpec{}, errors.Trace(err)
}
defer st.Release()
m, err := st.Model()
if err != nil {
... | go | func MakeCloudSpecGetter(pool Pool) func(names.ModelTag) (environs.CloudSpec, error) {
return func(tag names.ModelTag) (environs.CloudSpec, error) {
st, err := pool.Get(tag.Id())
if err != nil {
return environs.CloudSpec{}, errors.Trace(err)
}
defer st.Release()
m, err := st.Model()
if err != nil {
... | [
"func",
"MakeCloudSpecGetter",
"(",
"pool",
"Pool",
")",
"func",
"(",
"names",
".",
"ModelTag",
")",
"(",
"environs",
".",
"CloudSpec",
",",
"error",
")",
"{",
"return",
"func",
"(",
"tag",
"names",
".",
"ModelTag",
")",
"(",
"environs",
".",
"CloudSpec"... | // MakeCloudSpecGetter returns a function which returns a CloudSpec
// for a given model, using the given Pool. | [
"MakeCloudSpecGetter",
"returns",
"a",
"function",
"which",
"returns",
"a",
"CloudSpec",
"for",
"a",
"given",
"model",
"using",
"the",
"given",
"Pool",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/cloudspec/statehelpers.go#L23-L42 |
4,341 | juju/juju | apiserver/common/cloudspec/statehelpers.go | MakeCloudSpecGetterForModel | func MakeCloudSpecGetterForModel(st *state.State) func(names.ModelTag) (environs.CloudSpec, error) {
return func(tag names.ModelTag) (environs.CloudSpec, error) {
m, err := st.Model()
if err != nil {
return environs.CloudSpec{}, errors.Trace(err)
}
configGetter := stateenvirons.EnvironConfigGetter{State: st... | go | func MakeCloudSpecGetterForModel(st *state.State) func(names.ModelTag) (environs.CloudSpec, error) {
return func(tag names.ModelTag) (environs.CloudSpec, error) {
m, err := st.Model()
if err != nil {
return environs.CloudSpec{}, errors.Trace(err)
}
configGetter := stateenvirons.EnvironConfigGetter{State: st... | [
"func",
"MakeCloudSpecGetterForModel",
"(",
"st",
"*",
"state",
".",
"State",
")",
"func",
"(",
"names",
".",
"ModelTag",
")",
"(",
"environs",
".",
"CloudSpec",
",",
"error",
")",
"{",
"return",
"func",
"(",
"tag",
"names",
".",
"ModelTag",
")",
"(",
... | // MakeCloudSpecGetterForModel returns a function which returns a
// CloudSpec for a single model. Attempts to request a CloudSpec for
// any other model other than the one associated with the given
// state.State results in an error. | [
"MakeCloudSpecGetterForModel",
"returns",
"a",
"function",
"which",
"returns",
"a",
"CloudSpec",
"for",
"a",
"single",
"model",
".",
"Attempts",
"to",
"request",
"a",
"CloudSpec",
"for",
"any",
"other",
"model",
"other",
"than",
"the",
"one",
"associated",
"with... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/cloudspec/statehelpers.go#L48-L61 |
4,342 | juju/juju | apiserver/common/cloudspec/statehelpers.go | MakeCloudSpecWatcherForModel | func MakeCloudSpecWatcherForModel(st *state.State) func(names.ModelTag) (state.NotifyWatcher, error) {
return func(tag names.ModelTag) (state.NotifyWatcher, error) {
m, err := st.Model()
if err != nil {
return nil, errors.Trace(err)
}
if tag.Id() != st.ModelUUID() {
return nil, errors.New("cannot get clo... | go | func MakeCloudSpecWatcherForModel(st *state.State) func(names.ModelTag) (state.NotifyWatcher, error) {
return func(tag names.ModelTag) (state.NotifyWatcher, error) {
m, err := st.Model()
if err != nil {
return nil, errors.Trace(err)
}
if tag.Id() != st.ModelUUID() {
return nil, errors.New("cannot get clo... | [
"func",
"MakeCloudSpecWatcherForModel",
"(",
"st",
"*",
"state",
".",
"State",
")",
"func",
"(",
"names",
".",
"ModelTag",
")",
"(",
"state",
".",
"NotifyWatcher",
",",
"error",
")",
"{",
"return",
"func",
"(",
"tag",
"names",
".",
"ModelTag",
")",
"(",
... | // MakeCloudSpecWatcherForModel returns a function which returns a
// NotifyWatcher for cloud spec changes for a single model.
// Attempts to request a watcher for any other model other than the
// one associated with the given state.State results in an error. | [
"MakeCloudSpecWatcherForModel",
"returns",
"a",
"function",
"which",
"returns",
"a",
"NotifyWatcher",
"for",
"cloud",
"spec",
"changes",
"for",
"a",
"single",
"model",
".",
"Attempts",
"to",
"request",
"a",
"watcher",
"for",
"any",
"other",
"model",
"other",
"th... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/cloudspec/statehelpers.go#L67-L78 |
4,343 | juju/juju | core/model/upgradeseries.go | ValidateUpgradeSeriesStatus | func ValidateUpgradeSeriesStatus(status UpgradeSeriesStatus) (UpgradeSeriesStatus, error) {
if _, ok := UpgradeSeriesStatusOrder[status]; !ok {
return UpgradeSeriesNotStarted, errors.NotValidf("upgrade series status of %q is", status)
}
return status, nil
} | go | func ValidateUpgradeSeriesStatus(status UpgradeSeriesStatus) (UpgradeSeriesStatus, error) {
if _, ok := UpgradeSeriesStatusOrder[status]; !ok {
return UpgradeSeriesNotStarted, errors.NotValidf("upgrade series status of %q is", status)
}
return status, nil
} | [
"func",
"ValidateUpgradeSeriesStatus",
"(",
"status",
"UpgradeSeriesStatus",
")",
"(",
"UpgradeSeriesStatus",
",",
"error",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"UpgradeSeriesStatusOrder",
"[",
"status",
"]",
";",
"!",
"ok",
"{",
"return",
"UpgradeSeriesNotStarte... | // ValidateUpgradeSeriesStatus validates a the input status as valid for a
// unit, returning the valid status or an error. | [
"ValidateUpgradeSeriesStatus",
"validates",
"a",
"the",
"input",
"status",
"as",
"valid",
"for",
"a",
"unit",
"returning",
"the",
"valid",
"status",
"or",
"an",
"error",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/model/upgradeseries.go#L37-L42 |
4,344 | juju/juju | core/model/upgradeseries.go | CompareUpgradeSeriesStatus | func CompareUpgradeSeriesStatus(status1 UpgradeSeriesStatus, status2 UpgradeSeriesStatus) (int, error) {
var err error
st1, err := ValidateUpgradeSeriesStatus(status1)
st2, err := ValidateUpgradeSeriesStatus(status2)
if err != nil {
return 0, err
}
if UpgradeSeriesStatusOrder[st1] == UpgradeSeriesStatusOrder[s... | go | func CompareUpgradeSeriesStatus(status1 UpgradeSeriesStatus, status2 UpgradeSeriesStatus) (int, error) {
var err error
st1, err := ValidateUpgradeSeriesStatus(status1)
st2, err := ValidateUpgradeSeriesStatus(status2)
if err != nil {
return 0, err
}
if UpgradeSeriesStatusOrder[st1] == UpgradeSeriesStatusOrder[s... | [
"func",
"CompareUpgradeSeriesStatus",
"(",
"status1",
"UpgradeSeriesStatus",
",",
"status2",
"UpgradeSeriesStatus",
")",
"(",
"int",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"st1",
",",
"err",
":=",
"ValidateUpgradeSeriesStatus",
"(",
"status1",
")",
... | // CompareUpgradeSeriesStatus compares two upgrade series statuses and returns
// an integer; if the first argument equals the second then 0 is returned; if
// the second is greater -1 is returned; 1 is returned otherwise. An error is
// returned if either argument is an invalid status. | [
"CompareUpgradeSeriesStatus",
"compares",
"two",
"upgrade",
"series",
"statuses",
"and",
"returns",
"an",
"integer",
";",
"if",
"the",
"first",
"argument",
"equals",
"the",
"second",
"then",
"0",
"is",
"returned",
";",
"if",
"the",
"second",
"is",
"greater",
"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/model/upgradeseries.go#L48-L63 |
4,345 | juju/juju | apiserver/stateauthenticator/auth.go | NewAuthenticator | func NewAuthenticator(statePool *state.StatePool, clock clock.Clock) (*Authenticator, error) {
authContext, err := newAuthContext(statePool.SystemState(), clock)
if err != nil {
return nil, errors.Trace(err)
}
return &Authenticator{
statePool: statePool,
authContext: authContext,
}, nil
} | go | func NewAuthenticator(statePool *state.StatePool, clock clock.Clock) (*Authenticator, error) {
authContext, err := newAuthContext(statePool.SystemState(), clock)
if err != nil {
return nil, errors.Trace(err)
}
return &Authenticator{
statePool: statePool,
authContext: authContext,
}, nil
} | [
"func",
"NewAuthenticator",
"(",
"statePool",
"*",
"state",
".",
"StatePool",
",",
"clock",
"clock",
".",
"Clock",
")",
"(",
"*",
"Authenticator",
",",
"error",
")",
"{",
"authContext",
",",
"err",
":=",
"newAuthContext",
"(",
"statePool",
".",
"SystemState"... | // NewAuthenticator returns a new Authenticator using the given StatePool. | [
"NewAuthenticator",
"returns",
"a",
"new",
"Authenticator",
"using",
"the",
"given",
"StatePool",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/stateauthenticator/auth.go#L37-L46 |
4,346 | juju/juju | apiserver/stateauthenticator/auth.go | Maintain | func (a *Authenticator) Maintain(done <-chan struct{}) {
for {
select {
case <-done:
return
case <-a.authContext.clock.After(authentication.LocalLoginInteractionTimeout):
now := a.authContext.clock.Now()
a.authContext.localUserInteractions.Expire(now)
}
}
} | go | func (a *Authenticator) Maintain(done <-chan struct{}) {
for {
select {
case <-done:
return
case <-a.authContext.clock.After(authentication.LocalLoginInteractionTimeout):
now := a.authContext.clock.Now()
a.authContext.localUserInteractions.Expire(now)
}
}
} | [
"func",
"(",
"a",
"*",
"Authenticator",
")",
"Maintain",
"(",
"done",
"<-",
"chan",
"struct",
"{",
"}",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"<-",
"done",
":",
"return",
"\n",
"case",
"<-",
"a",
".",
"authContext",
".",
"clock",
".",
"After... | // Maintain periodically expires local login interactions. | [
"Maintain",
"periodically",
"expires",
"local",
"login",
"interactions",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/stateauthenticator/auth.go#L49-L59 |
4,347 | juju/juju | apiserver/stateauthenticator/auth.go | CreateLocalLoginMacaroon | func (a *Authenticator) CreateLocalLoginMacaroon(tag names.UserTag) (*macaroon.Macaroon, error) {
return a.authContext.CreateLocalLoginMacaroon(tag)
} | go | func (a *Authenticator) CreateLocalLoginMacaroon(tag names.UserTag) (*macaroon.Macaroon, error) {
return a.authContext.CreateLocalLoginMacaroon(tag)
} | [
"func",
"(",
"a",
"*",
"Authenticator",
")",
"CreateLocalLoginMacaroon",
"(",
"tag",
"names",
".",
"UserTag",
")",
"(",
"*",
"macaroon",
".",
"Macaroon",
",",
"error",
")",
"{",
"return",
"a",
".",
"authContext",
".",
"CreateLocalLoginMacaroon",
"(",
"tag",
... | // CreateLocalLoginMacaroon is part of the
// httpcontext.LocalMacaroonAuthenticator interface. | [
"CreateLocalLoginMacaroon",
"is",
"part",
"of",
"the",
"httpcontext",
".",
"LocalMacaroonAuthenticator",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/stateauthenticator/auth.go#L63-L65 |
4,348 | juju/juju | apiserver/stateauthenticator/auth.go | AddHandlers | func (a *Authenticator) AddHandlers(mux *apiserverhttp.Mux) {
h := &localLoginHandlers{
authCtxt: a.authContext,
finder: a.statePool.SystemState(),
}
h.AddHandlers(mux)
} | go | func (a *Authenticator) AddHandlers(mux *apiserverhttp.Mux) {
h := &localLoginHandlers{
authCtxt: a.authContext,
finder: a.statePool.SystemState(),
}
h.AddHandlers(mux)
} | [
"func",
"(",
"a",
"*",
"Authenticator",
")",
"AddHandlers",
"(",
"mux",
"*",
"apiserverhttp",
".",
"Mux",
")",
"{",
"h",
":=",
"&",
"localLoginHandlers",
"{",
"authCtxt",
":",
"a",
".",
"authContext",
",",
"finder",
":",
"a",
".",
"statePool",
".",
"Sy... | // AddHandlers adds the handlers to the given mux for handling local
// macaroon logins. | [
"AddHandlers",
"adds",
"the",
"handlers",
"to",
"the",
"given",
"mux",
"for",
"handling",
"local",
"macaroon",
"logins",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/stateauthenticator/auth.go#L69-L75 |
4,349 | juju/juju | apiserver/stateauthenticator/auth.go | Authenticate | func (a *Authenticator) Authenticate(req *http.Request) (httpcontext.AuthInfo, error) {
modelUUID := httpcontext.RequestModelUUID(req)
if modelUUID == "" {
return httpcontext.AuthInfo{}, errors.New("model UUID not found")
}
loginRequest, err := LoginRequest(req)
if err != nil {
return httpcontext.AuthInfo{}, e... | go | func (a *Authenticator) Authenticate(req *http.Request) (httpcontext.AuthInfo, error) {
modelUUID := httpcontext.RequestModelUUID(req)
if modelUUID == "" {
return httpcontext.AuthInfo{}, errors.New("model UUID not found")
}
loginRequest, err := LoginRequest(req)
if err != nil {
return httpcontext.AuthInfo{}, e... | [
"func",
"(",
"a",
"*",
"Authenticator",
")",
"Authenticate",
"(",
"req",
"*",
"http",
".",
"Request",
")",
"(",
"httpcontext",
".",
"AuthInfo",
",",
"error",
")",
"{",
"modelUUID",
":=",
"httpcontext",
".",
"RequestModelUUID",
"(",
"req",
")",
"\n",
"if"... | // Authenticate is part of the httpcontext.Authenticator interface. | [
"Authenticate",
"is",
"part",
"of",
"the",
"httpcontext",
".",
"Authenticator",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/stateauthenticator/auth.go#L78-L88 |
4,350 | juju/juju | provider/maas/volumes.go | mibToGb | func mibToGb(m uint64) uint64 {
return common.MiBToGiB(m) * (humanize.GiByte / humanize.GByte)
} | go | func mibToGb(m uint64) uint64 {
return common.MiBToGiB(m) * (humanize.GiByte / humanize.GByte)
} | [
"func",
"mibToGb",
"(",
"m",
"uint64",
")",
"uint64",
"{",
"return",
"common",
".",
"MiBToGiB",
"(",
"m",
")",
"*",
"(",
"humanize",
".",
"GiByte",
"/",
"humanize",
".",
"GByte",
")",
"\n",
"}"
] | // mibToGB converts the value in MiB to GB.
// Juju works in MiB, MAAS expects GB. | [
"mibToGB",
"converts",
"the",
"value",
"in",
"MiB",
"to",
"GB",
".",
"Juju",
"works",
"in",
"MiB",
"MAAS",
"expects",
"GB",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/volumes.go#L147-L149 |
4,351 | juju/juju | provider/maas/volumes.go | buildMAASVolumeParameters | func buildMAASVolumeParameters(args []storage.VolumeParams, cons constraints.Value) ([]volumeInfo, error) {
if len(args) == 0 && cons.RootDisk == nil {
return nil, nil
}
volumes := make([]volumeInfo, len(args)+1)
rootVolume := volumeInfo{name: rootDiskLabel}
if cons.RootDisk != nil {
rootVolume.sizeInGB = mibT... | go | func buildMAASVolumeParameters(args []storage.VolumeParams, cons constraints.Value) ([]volumeInfo, error) {
if len(args) == 0 && cons.RootDisk == nil {
return nil, nil
}
volumes := make([]volumeInfo, len(args)+1)
rootVolume := volumeInfo{name: rootDiskLabel}
if cons.RootDisk != nil {
rootVolume.sizeInGB = mibT... | [
"func",
"buildMAASVolumeParameters",
"(",
"args",
"[",
"]",
"storage",
".",
"VolumeParams",
",",
"cons",
"constraints",
".",
"Value",
")",
"(",
"[",
"]",
"volumeInfo",
",",
"error",
")",
"{",
"if",
"len",
"(",
"args",
")",
"==",
"0",
"&&",
"cons",
".",... | // buildMAASVolumeParameters creates the MAAS volume information to include
// in a request to acquire a MAAS node, based on the supplied storage parameters. | [
"buildMAASVolumeParameters",
"creates",
"the",
"MAAS",
"volume",
"information",
"to",
"include",
"in",
"a",
"request",
"to",
"acquire",
"a",
"MAAS",
"node",
"based",
"on",
"the",
"supplied",
"storage",
"parameters",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/volumes.go#L153-L176 |
4,352 | juju/juju | state/persistence.go | One | func (sp statePersistence) One(collName, id string, doc interface{}) error {
coll, closeColl := sp.st.db().GetCollection(collName)
defer closeColl()
err := coll.FindId(id).One(doc)
if err == mgo.ErrNotFound {
return errors.NotFoundf(id)
}
if err != nil {
return errors.Trace(err)
}
return nil
} | go | func (sp statePersistence) One(collName, id string, doc interface{}) error {
coll, closeColl := sp.st.db().GetCollection(collName)
defer closeColl()
err := coll.FindId(id).One(doc)
if err == mgo.ErrNotFound {
return errors.NotFoundf(id)
}
if err != nil {
return errors.Trace(err)
}
return nil
} | [
"func",
"(",
"sp",
"statePersistence",
")",
"One",
"(",
"collName",
",",
"id",
"string",
",",
"doc",
"interface",
"{",
"}",
")",
"error",
"{",
"coll",
",",
"closeColl",
":=",
"sp",
".",
"st",
".",
"db",
"(",
")",
".",
"GetCollection",
"(",
"collName"... | // One gets the identified document from the collection. | [
"One",
"gets",
"the",
"identified",
"document",
"from",
"the",
"collection",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/persistence.go#L51-L63 |
4,353 | juju/juju | state/persistence.go | All | func (sp statePersistence) All(collName string, query, docs interface{}) error {
coll, closeColl := sp.st.db().GetCollection(collName)
defer closeColl()
if err := coll.Find(query).All(docs); err != nil {
return errors.Trace(err)
}
return nil
} | go | func (sp statePersistence) All(collName string, query, docs interface{}) error {
coll, closeColl := sp.st.db().GetCollection(collName)
defer closeColl()
if err := coll.Find(query).All(docs); err != nil {
return errors.Trace(err)
}
return nil
} | [
"func",
"(",
"sp",
"statePersistence",
")",
"All",
"(",
"collName",
"string",
",",
"query",
",",
"docs",
"interface",
"{",
"}",
")",
"error",
"{",
"coll",
",",
"closeColl",
":=",
"sp",
".",
"st",
".",
"db",
"(",
")",
".",
"GetCollection",
"(",
"collN... | // All gets all documents from the collection matching the query. | [
"All",
"gets",
"all",
"documents",
"from",
"the",
"collection",
"matching",
"the",
"query",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/persistence.go#L66-L74 |
4,354 | juju/juju | state/persistence.go | Run | func (sp statePersistence) Run(transactions jujutxn.TransactionSource) error {
if err := sp.st.db().Run(transactions); err != nil {
return errors.Trace(err)
}
return nil
} | go | func (sp statePersistence) Run(transactions jujutxn.TransactionSource) error {
if err := sp.st.db().Run(transactions); err != nil {
return errors.Trace(err)
}
return nil
} | [
"func",
"(",
"sp",
"statePersistence",
")",
"Run",
"(",
"transactions",
"jujutxn",
".",
"TransactionSource",
")",
"error",
"{",
"if",
"err",
":=",
"sp",
".",
"st",
".",
"db",
"(",
")",
".",
"Run",
"(",
"transactions",
")",
";",
"err",
"!=",
"nil",
"{... | // Run runs the transaction produced by the provided factory function. | [
"Run",
"runs",
"the",
"transaction",
"produced",
"by",
"the",
"provided",
"factory",
"function",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/persistence.go#L77-L82 |
4,355 | juju/juju | state/persistence.go | NewStorage | func (sp *statePersistence) NewStorage() storage.Storage {
modelUUID := sp.st.ModelUUID()
// TODO(ericsnow) Copy the session?
session := sp.st.session
store := storage.NewStorage(modelUUID, session)
return store
} | go | func (sp *statePersistence) NewStorage() storage.Storage {
modelUUID := sp.st.ModelUUID()
// TODO(ericsnow) Copy the session?
session := sp.st.session
store := storage.NewStorage(modelUUID, session)
return store
} | [
"func",
"(",
"sp",
"*",
"statePersistence",
")",
"NewStorage",
"(",
")",
"storage",
".",
"Storage",
"{",
"modelUUID",
":=",
"sp",
".",
"st",
".",
"ModelUUID",
"(",
")",
"\n",
"// TODO(ericsnow) Copy the session?",
"session",
":=",
"sp",
".",
"st",
".",
"se... | // NewStorage returns a new blob storage for the model. | [
"NewStorage",
"returns",
"a",
"new",
"blob",
"storage",
"for",
"the",
"model",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/persistence.go#L85-L91 |
4,356 | juju/juju | state/persistence.go | ApplicationExistsOps | func (sp *statePersistence) ApplicationExistsOps(applicationID string) []txn.Op {
return []txn.Op{{
C: applicationsC,
Id: applicationID,
Assert: isAliveDoc,
}}
} | go | func (sp *statePersistence) ApplicationExistsOps(applicationID string) []txn.Op {
return []txn.Op{{
C: applicationsC,
Id: applicationID,
Assert: isAliveDoc,
}}
} | [
"func",
"(",
"sp",
"*",
"statePersistence",
")",
"ApplicationExistsOps",
"(",
"applicationID",
"string",
")",
"[",
"]",
"txn",
".",
"Op",
"{",
"return",
"[",
"]",
"txn",
".",
"Op",
"{",
"{",
"C",
":",
"applicationsC",
",",
"Id",
":",
"applicationID",
"... | // ApplicationExistsOps returns the operations that verify that the
// identified application exists. | [
"ApplicationExistsOps",
"returns",
"the",
"operations",
"that",
"verify",
"that",
"the",
"identified",
"application",
"exists",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/persistence.go#L95-L101 |
4,357 | juju/juju | cmd/modelcmd/modelcommand.go | ClientStore | func (c *ModelCommandBase) ClientStore() jujuclient.ClientStore {
// c.store is set in maybeInitModel() below.
if c.store == nil && !c.runStarted {
panic("inappropriate method called before init finished")
}
return c.store
} | go | func (c *ModelCommandBase) ClientStore() jujuclient.ClientStore {
// c.store is set in maybeInitModel() below.
if c.store == nil && !c.runStarted {
panic("inappropriate method called before init finished")
}
return c.store
} | [
"func",
"(",
"c",
"*",
"ModelCommandBase",
")",
"ClientStore",
"(",
")",
"jujuclient",
".",
"ClientStore",
"{",
"// c.store is set in maybeInitModel() below.",
"if",
"c",
".",
"store",
"==",
"nil",
"&&",
"!",
"c",
".",
"runStarted",
"{",
"panic",
"(",
"\"",
... | // ClientStore implements the ModelCommand interface. | [
"ClientStore",
"implements",
"the",
"ModelCommand",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/modelcommand.go#L122-L128 |
4,358 | juju/juju | cmd/modelcmd/modelcommand.go | SetModelName | func (c *ModelCommandBase) SetModelName(modelName string, allowDefault bool) error {
c._modelName = modelName
c.allowDefaultModel = allowDefault
// After setting the model name, we may need to ensure we have access to the
// other model details if not already done.
if err := c.maybeInitModel(); err != nil {
ret... | go | func (c *ModelCommandBase) SetModelName(modelName string, allowDefault bool) error {
c._modelName = modelName
c.allowDefaultModel = allowDefault
// After setting the model name, we may need to ensure we have access to the
// other model details if not already done.
if err := c.maybeInitModel(); err != nil {
ret... | [
"func",
"(",
"c",
"*",
"ModelCommandBase",
")",
"SetModelName",
"(",
"modelName",
"string",
",",
"allowDefault",
"bool",
")",
"error",
"{",
"c",
".",
"_modelName",
"=",
"modelName",
"\n",
"c",
".",
"allowDefaultModel",
"=",
"allowDefault",
"\n\n",
"// After se... | // SetModelName implements the ModelCommand interface. | [
"SetModelName",
"implements",
"the",
"ModelCommand",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/modelcommand.go#L194-L204 |
4,359 | juju/juju | cmd/modelcmd/modelcommand.go | ModelName | func (c *ModelCommandBase) ModelName() (string, error) {
c.assertRunStarted()
if err := c.maybeInitModel(); err != nil {
return "", errors.Trace(err)
}
return c._modelName, nil
} | go | func (c *ModelCommandBase) ModelName() (string, error) {
c.assertRunStarted()
if err := c.maybeInitModel(); err != nil {
return "", errors.Trace(err)
}
return c._modelName, nil
} | [
"func",
"(",
"c",
"*",
"ModelCommandBase",
")",
"ModelName",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
".",
"assertRunStarted",
"(",
")",
"\n",
"if",
"err",
":=",
"c",
".",
"maybeInitModel",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"retu... | // ModelName implements the ModelCommand interface. | [
"ModelName",
"implements",
"the",
"ModelCommand",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/modelcommand.go#L207-L213 |
4,360 | juju/juju | cmd/modelcmd/modelcommand.go | ModelType | func (c *ModelCommandBase) ModelType() (model.ModelType, error) {
if c._modelType != "" {
return c._modelType, nil
}
// If we need to look up the model type, we need to ensure we
// have access to the model details.
if err := c.maybeInitModel(); err != nil {
return "", errors.Trace(err)
}
details, err := c.s... | go | func (c *ModelCommandBase) ModelType() (model.ModelType, error) {
if c._modelType != "" {
return c._modelType, nil
}
// If we need to look up the model type, we need to ensure we
// have access to the model details.
if err := c.maybeInitModel(); err != nil {
return "", errors.Trace(err)
}
details, err := c.s... | [
"func",
"(",
"c",
"*",
"ModelCommandBase",
")",
"ModelType",
"(",
")",
"(",
"model",
".",
"ModelType",
",",
"error",
")",
"{",
"if",
"c",
".",
"_modelType",
"!=",
"\"",
"\"",
"{",
"return",
"c",
".",
"_modelType",
",",
"nil",
"\n",
"}",
"\n",
"// I... | // ModelType implements the ModelCommand interface. | [
"ModelType",
"implements",
"the",
"ModelCommand",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/modelcommand.go#L216-L237 |
4,361 | juju/juju | cmd/modelcmd/modelcommand.go | SetActiveBranch | func (c *ModelCommandBase) SetActiveBranch(branchName string) error {
_, modelDetails, err := c.ModelDetails()
if err != nil {
return errors.Annotate(err, "getting model details")
}
modelDetails.ActiveBranch = branchName
if err = c.store.UpdateModel(c._controllerName, c._modelName, *modelDetails); err != nil {
... | go | func (c *ModelCommandBase) SetActiveBranch(branchName string) error {
_, modelDetails, err := c.ModelDetails()
if err != nil {
return errors.Annotate(err, "getting model details")
}
modelDetails.ActiveBranch = branchName
if err = c.store.UpdateModel(c._controllerName, c._modelName, *modelDetails); err != nil {
... | [
"func",
"(",
"c",
"*",
"ModelCommandBase",
")",
"SetActiveBranch",
"(",
"branchName",
"string",
")",
"error",
"{",
"_",
",",
"modelDetails",
",",
"err",
":=",
"c",
".",
"ModelDetails",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
... | // SetModelGeneration implements the ModelCommand interface. | [
"SetModelGeneration",
"implements",
"the",
"ModelCommand",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/modelcommand.go#L240-L251 |
4,362 | juju/juju | cmd/modelcmd/modelcommand.go | ActiveBranch | func (c *ModelCommandBase) ActiveBranch() (string, error) {
if c._activeBranch != "" {
return c._activeBranch, nil
}
// If we need to look up the model generation, we need to ensure we
// have access to the model details.
if err := c.maybeInitModel(); err != nil {
return "", errors.Trace(err)
}
details, err ... | go | func (c *ModelCommandBase) ActiveBranch() (string, error) {
if c._activeBranch != "" {
return c._activeBranch, nil
}
// If we need to look up the model generation, we need to ensure we
// have access to the model details.
if err := c.maybeInitModel(); err != nil {
return "", errors.Trace(err)
}
details, err ... | [
"func",
"(",
"c",
"*",
"ModelCommandBase",
")",
"ActiveBranch",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"c",
".",
"_activeBranch",
"!=",
"\"",
"\"",
"{",
"return",
"c",
".",
"_activeBranch",
",",
"nil",
"\n",
"}",
"\n",
"// If we need to... | // ActiveBranch implements the ModelCommand interface. | [
"ActiveBranch",
"implements",
"the",
"ModelCommand",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/modelcommand.go#L254-L275 |
4,363 | juju/juju | cmd/modelcmd/modelcommand.go | ControllerName | func (c *ModelCommandBase) ControllerName() (string, error) {
c.assertRunStarted()
if err := c.maybeInitModel(); err != nil {
return "", errors.Trace(err)
}
return c._controllerName, nil
} | go | func (c *ModelCommandBase) ControllerName() (string, error) {
c.assertRunStarted()
if err := c.maybeInitModel(); err != nil {
return "", errors.Trace(err)
}
return c._controllerName, nil
} | [
"func",
"(",
"c",
"*",
"ModelCommandBase",
")",
"ControllerName",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
".",
"assertRunStarted",
"(",
")",
"\n",
"if",
"err",
":=",
"c",
".",
"maybeInitModel",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
... | // ControllerName implements the ModelCommand interface. | [
"ControllerName",
"implements",
"the",
"ModelCommand",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/modelcommand.go#L278-L284 |
4,364 | juju/juju | cmd/modelcmd/modelcommand.go | NewAPIRoot | func (c *ModelCommandBase) NewAPIRoot() (api.Connection, error) {
// We need to call ModelDetails() here and not just ModelName() to force
// a refresh of the internal model details if those are not yet stored locally.
modelName, _, err := c.ModelDetails()
if err != nil {
return nil, errors.Trace(err)
}
return ... | go | func (c *ModelCommandBase) NewAPIRoot() (api.Connection, error) {
// We need to call ModelDetails() here and not just ModelName() to force
// a refresh of the internal model details if those are not yet stored locally.
modelName, _, err := c.ModelDetails()
if err != nil {
return nil, errors.Trace(err)
}
return ... | [
"func",
"(",
"c",
"*",
"ModelCommandBase",
")",
"NewAPIRoot",
"(",
")",
"(",
"api",
".",
"Connection",
",",
"error",
")",
"{",
"// We need to call ModelDetails() here and not just ModelName() to force",
"// a refresh of the internal model details if those are not yet stored local... | // NewAPIRoot returns a new connection to the API server for the environment
// directed to the model specified on the command line. | [
"NewAPIRoot",
"returns",
"a",
"new",
"connection",
"to",
"the",
"API",
"server",
"for",
"the",
"environment",
"directed",
"to",
"the",
"model",
"specified",
"on",
"the",
"command",
"line",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/modelcommand.go#L345-L353 |
4,365 | juju/juju | cmd/modelcmd/modelcommand.go | newAPIRoot | func (c *ModelCommandBase) newAPIRoot(modelName string) (api.Connection, error) {
controllerName, err := c.ControllerName()
if err != nil {
return nil, errors.Trace(err)
}
return c.CommandBase.NewAPIRoot(c.store, controllerName, modelName)
} | go | func (c *ModelCommandBase) newAPIRoot(modelName string) (api.Connection, error) {
controllerName, err := c.ControllerName()
if err != nil {
return nil, errors.Trace(err)
}
return c.CommandBase.NewAPIRoot(c.store, controllerName, modelName)
} | [
"func",
"(",
"c",
"*",
"ModelCommandBase",
")",
"newAPIRoot",
"(",
"modelName",
"string",
")",
"(",
"api",
".",
"Connection",
",",
"error",
")",
"{",
"controllerName",
",",
"err",
":=",
"c",
".",
"ControllerName",
"(",
")",
"\n",
"if",
"err",
"!=",
"ni... | // newAPIRoot is the internal implementation of NewAPIRoot and NewControllerAPIRoot;
// if modelName is empty, it makes a controller-only connection. | [
"newAPIRoot",
"is",
"the",
"internal",
"implementation",
"of",
"NewAPIRoot",
"and",
"NewControllerAPIRoot",
";",
"if",
"modelName",
"is",
"empty",
"it",
"makes",
"a",
"controller",
"-",
"only",
"connection",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/modelcommand.go#L365-L371 |
4,366 | juju/juju | cmd/modelcmd/modelcommand.go | Wrap | func Wrap(c ModelCommand, options ...WrapOption) ModelCommand {
wrapper := &modelCommandWrapper{
ModelCommand: c,
skipModelFlags: false,
useDefaultModel: true,
}
for _, option := range options {
option(wrapper)
}
// Define a new type so that we can embed the ModelCommand
// interface one level deeper ... | go | func Wrap(c ModelCommand, options ...WrapOption) ModelCommand {
wrapper := &modelCommandWrapper{
ModelCommand: c,
skipModelFlags: false,
useDefaultModel: true,
}
for _, option := range options {
option(wrapper)
}
// Define a new type so that we can embed the ModelCommand
// interface one level deeper ... | [
"func",
"Wrap",
"(",
"c",
"ModelCommand",
",",
"options",
"...",
"WrapOption",
")",
"ModelCommand",
"{",
"wrapper",
":=",
"&",
"modelCommandWrapper",
"{",
"ModelCommand",
":",
"c",
",",
"skipModelFlags",
":",
"false",
",",
"useDefaultModel",
":",
"true",
",",
... | // Wrap wraps the specified ModelCommand, returning a ModelCommand
// that proxies to each of the ModelCommand methods.
// Any provided options are applied to the wrapped command
// before it is returned. | [
"Wrap",
"wraps",
"the",
"specified",
"ModelCommand",
"returning",
"a",
"ModelCommand",
"that",
"proxies",
"to",
"each",
"of",
"the",
"ModelCommand",
"methods",
".",
"Any",
"provided",
"options",
"are",
"applied",
"to",
"the",
"wrapped",
"command",
"before",
"it"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/modelcommand.go#L428-L452 |
4,367 | juju/juju | cmd/modelcmd/modelcommand.go | validateCommandForModelType | func (w *modelCommandWrapper) validateCommandForModelType(runStarted bool) error {
_, iaasOnly := w.inner().(IAASOnlyCommand)
_, caasOnly := w.inner().(CAASOnlyCommand)
if !caasOnly && !iaasOnly {
return nil
}
modelType, err := w.ModelCommand.ModelType()
if err != nil {
err = errors.Cause(err)
// We need t... | go | func (w *modelCommandWrapper) validateCommandForModelType(runStarted bool) error {
_, iaasOnly := w.inner().(IAASOnlyCommand)
_, caasOnly := w.inner().(CAASOnlyCommand)
if !caasOnly && !iaasOnly {
return nil
}
modelType, err := w.ModelCommand.ModelType()
if err != nil {
err = errors.Cause(err)
// We need t... | [
"func",
"(",
"w",
"*",
"modelCommandWrapper",
")",
"validateCommandForModelType",
"(",
"runStarted",
"bool",
")",
"error",
"{",
"_",
",",
"iaasOnly",
":=",
"w",
".",
"inner",
"(",
")",
".",
"(",
"IAASOnlyCommand",
")",
"\n",
"_",
",",
"caasOnly",
":=",
"... | // validateCommandForModelType returns an error if an IAAS-only command
// is run on a CAAS model. | [
"validateCommandForModelType",
"returns",
"an",
"error",
"if",
"an",
"IAAS",
"-",
"only",
"command",
"is",
"run",
"on",
"a",
"CAAS",
"model",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/modelcommand.go#L486-L515 |
4,368 | juju/juju | cmd/modelcmd/modelcommand.go | BootstrapContext | func BootstrapContext(cmdContext *cmd.Context) environs.BootstrapContext {
return &bootstrapContext{
Context: cmdContext,
verifyCredentials: true,
}
} | go | func BootstrapContext(cmdContext *cmd.Context) environs.BootstrapContext {
return &bootstrapContext{
Context: cmdContext,
verifyCredentials: true,
}
} | [
"func",
"BootstrapContext",
"(",
"cmdContext",
"*",
"cmd",
".",
"Context",
")",
"environs",
".",
"BootstrapContext",
"{",
"return",
"&",
"bootstrapContext",
"{",
"Context",
":",
"cmdContext",
",",
"verifyCredentials",
":",
"true",
",",
"}",
"\n",
"}"
] | // BootstrapContext returns a new BootstrapContext constructed from a command Context. | [
"BootstrapContext",
"returns",
"a",
"new",
"BootstrapContext",
"constructed",
"from",
"a",
"command",
"Context",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/modelcommand.go#L573-L578 |
4,369 | juju/juju | cmd/modelcmd/modelcommand.go | BootstrapContextNoVerify | func BootstrapContextNoVerify(cmdContext *cmd.Context) environs.BootstrapContext {
return &bootstrapContext{
Context: cmdContext,
verifyCredentials: false,
}
} | go | func BootstrapContextNoVerify(cmdContext *cmd.Context) environs.BootstrapContext {
return &bootstrapContext{
Context: cmdContext,
verifyCredentials: false,
}
} | [
"func",
"BootstrapContextNoVerify",
"(",
"cmdContext",
"*",
"cmd",
".",
"Context",
")",
"environs",
".",
"BootstrapContext",
"{",
"return",
"&",
"bootstrapContext",
"{",
"Context",
":",
"cmdContext",
",",
"verifyCredentials",
":",
"false",
",",
"}",
"\n",
"}"
] | // BootstrapContextNoVerify returns a new BootstrapContext constructed from a command Context
// where the validation of credentials is false. | [
"BootstrapContextNoVerify",
"returns",
"a",
"new",
"BootstrapContext",
"constructed",
"from",
"a",
"command",
"Context",
"where",
"the",
"validation",
"of",
"credentials",
"is",
"false",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/modelcommand.go#L582-L587 |
4,370 | juju/juju | cmd/modelcmd/modelcommand.go | SplitModelName | func SplitModelName(name string) (controller, model string) {
if i := strings.IndexRune(name, ':'); i >= 0 {
return name[:i], name[i+1:]
}
return "", name
} | go | func SplitModelName(name string) (controller, model string) {
if i := strings.IndexRune(name, ':'); i >= 0 {
return name[:i], name[i+1:]
}
return "", name
} | [
"func",
"SplitModelName",
"(",
"name",
"string",
")",
"(",
"controller",
",",
"model",
"string",
")",
"{",
"if",
"i",
":=",
"strings",
".",
"IndexRune",
"(",
"name",
",",
"':'",
")",
";",
"i",
">=",
"0",
"{",
"return",
"name",
"[",
":",
"i",
"]",
... | // SplitModelName splits a model name into its controller
// and model parts. If the model is unqualified, then the
// returned controller string will be empty, and the returned
// model string will be identical to the input. | [
"SplitModelName",
"splits",
"a",
"model",
"name",
"into",
"its",
"controller",
"and",
"model",
"parts",
".",
"If",
"the",
"model",
"is",
"unqualified",
"then",
"the",
"returned",
"controller",
"string",
"will",
"be",
"empty",
"and",
"the",
"returned",
"model",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/modelcommand.go#L593-L598 |
4,371 | juju/juju | provider/azure/vmextension.go | vmExtensionProperties | func vmExtensionProperties(os jujuos.OSType) (*compute.VirtualMachineExtensionProperties, error) {
var commandToExecute, extensionPublisher, extensionType, extensionVersion string
switch os {
case jujuos.Windows:
commandToExecute = windowsExecuteCustomScriptCommand
extensionPublisher = windowsCustomScriptPublis... | go | func vmExtensionProperties(os jujuos.OSType) (*compute.VirtualMachineExtensionProperties, error) {
var commandToExecute, extensionPublisher, extensionType, extensionVersion string
switch os {
case jujuos.Windows:
commandToExecute = windowsExecuteCustomScriptCommand
extensionPublisher = windowsCustomScriptPublis... | [
"func",
"vmExtensionProperties",
"(",
"os",
"jujuos",
".",
"OSType",
")",
"(",
"*",
"compute",
".",
"VirtualMachineExtensionProperties",
",",
"error",
")",
"{",
"var",
"commandToExecute",
",",
"extensionPublisher",
",",
"extensionType",
",",
"extensionVersion",
"str... | // vmExtension creates a CustomScript VM extension for the given VM
// which will execute the CustomData on the machine as a script. | [
"vmExtension",
"creates",
"a",
"CustomScript",
"VM",
"extension",
"for",
"the",
"given",
"VM",
"which",
"will",
"execute",
"the",
"CustomData",
"on",
"the",
"machine",
"as",
"a",
"script",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/vmextension.go#L36-L67 |
4,372 | juju/juju | cmd/juju/application/upgradecharm.go | NewUpgradeCharmCommand | func NewUpgradeCharmCommand() cmd.Command {
cmd := &upgradeCharmCommand{
DeployResources: resourceadapters.DeployResources,
ResolveCharm: resolveCharm,
NewCharmAdder: newCharmAdder,
NewCharmClient: func(conn base.APICallCloser) CharmClient {
return charms.NewClient(conn)
},
NewCharmUpgradeClient: f... | go | func NewUpgradeCharmCommand() cmd.Command {
cmd := &upgradeCharmCommand{
DeployResources: resourceadapters.DeployResources,
ResolveCharm: resolveCharm,
NewCharmAdder: newCharmAdder,
NewCharmClient: func(conn base.APICallCloser) CharmClient {
return charms.NewClient(conn)
},
NewCharmUpgradeClient: f... | [
"func",
"NewUpgradeCharmCommand",
"(",
")",
"cmd",
".",
"Command",
"{",
"cmd",
":=",
"&",
"upgradeCharmCommand",
"{",
"DeployResources",
":",
"resourceadapters",
".",
"DeployResources",
",",
"ResolveCharm",
":",
"resolveCharm",
",",
"NewCharmAdder",
":",
"newCharmAd... | // NewUpgradeCharmCommand returns a command which upgrades application's charm. | [
"NewUpgradeCharmCommand",
"returns",
"a",
"command",
"which",
"upgrades",
"application",
"s",
"charm",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/application/upgradecharm.go#L41-L65 |
4,373 | juju/juju | cmd/juju/application/upgradecharm.go | addCharm | func (c *upgradeCharmCommand) addCharm(
charmAdder CharmAdder,
charmRepo *charmrepo.CharmStore,
config *config.Config,
oldURL *charm.URL,
charmRef string,
deployedSeries string,
force bool,
) (charmstore.CharmID, *macaroon.Macaroon, error) {
var id charmstore.CharmID
// Charm may have been supplied via a path ... | go | func (c *upgradeCharmCommand) addCharm(
charmAdder CharmAdder,
charmRepo *charmrepo.CharmStore,
config *config.Config,
oldURL *charm.URL,
charmRef string,
deployedSeries string,
force bool,
) (charmstore.CharmID, *macaroon.Macaroon, error) {
var id charmstore.CharmID
// Charm may have been supplied via a path ... | [
"func",
"(",
"c",
"*",
"upgradeCharmCommand",
")",
"addCharm",
"(",
"charmAdder",
"CharmAdder",
",",
"charmRepo",
"*",
"charmrepo",
".",
"CharmStore",
",",
"config",
"*",
"config",
".",
"Config",
",",
"oldURL",
"*",
"charm",
".",
"URL",
",",
"charmRef",
"s... | // addCharm interprets the new charmRef and adds the specified charm if
// the new charm is different to what's already deployed as specified by
// oldURL. | [
"addCharm",
"interprets",
"the",
"new",
"charmRef",
"and",
"adds",
"the",
"specified",
"charm",
"if",
"the",
"new",
"charm",
"is",
"different",
"to",
"what",
"s",
"already",
"deployed",
"as",
"specified",
"by",
"oldURL",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/application/upgradecharm.go#L549-L620 |
4,374 | juju/juju | cmd/juju/status/output_oneline.go | FormatOneline | func FormatOneline(writer io.Writer, value interface{}) error {
return formatOneline(writer, value, func(out io.Writer, format, uName string, u unitStatus, level int) {
status := fmt.Sprintf(
"agent:%s, workload:%s",
u.JujuStatusInfo.Current,
u.WorkloadStatusInfo.Current,
)
fmt.Fprintf(out, format,
u... | go | func FormatOneline(writer io.Writer, value interface{}) error {
return formatOneline(writer, value, func(out io.Writer, format, uName string, u unitStatus, level int) {
status := fmt.Sprintf(
"agent:%s, workload:%s",
u.JujuStatusInfo.Current,
u.WorkloadStatusInfo.Current,
)
fmt.Fprintf(out, format,
u... | [
"func",
"FormatOneline",
"(",
"writer",
"io",
".",
"Writer",
",",
"value",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"formatOneline",
"(",
"writer",
",",
"value",
",",
"func",
"(",
"out",
"io",
".",
"Writer",
",",
"format",
",",
"uName",
"str... | // FormatOneline writes a brief list of units and their subordinates.
// Subordinates will be indented 2 spaces and listed under their
// superiors. This format works with version 2 of the CLI. | [
"FormatOneline",
"writes",
"a",
"brief",
"list",
"of",
"units",
"and",
"their",
"subordinates",
".",
"Subordinates",
"will",
"be",
"indented",
"2",
"spaces",
"and",
"listed",
"under",
"their",
"superiors",
".",
"This",
"format",
"works",
"with",
"version",
"2"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/status/output_oneline.go#L18-L31 |
4,375 | juju/juju | container/kvm/container.go | EnsureCachedImage | func (c *kvmContainer) EnsureCachedImage(params StartParams) error {
var srcFunc func() simplestreams.DataSource
if params.ImageDownloadURL != "" {
srcFunc = func() simplestreams.DataSource {
return imagedownloads.NewDataSource(params.ImageDownloadURL)
}
}
var fType = BIOSFType
if params.Arch == arch.ARM64 ... | go | func (c *kvmContainer) EnsureCachedImage(params StartParams) error {
var srcFunc func() simplestreams.DataSource
if params.ImageDownloadURL != "" {
srcFunc = func() simplestreams.DataSource {
return imagedownloads.NewDataSource(params.ImageDownloadURL)
}
}
var fType = BIOSFType
if params.Arch == arch.ARM64 ... | [
"func",
"(",
"c",
"*",
"kvmContainer",
")",
"EnsureCachedImage",
"(",
"params",
"StartParams",
")",
"error",
"{",
"var",
"srcFunc",
"func",
"(",
")",
"simplestreams",
".",
"DataSource",
"\n",
"if",
"params",
".",
"ImageDownloadURL",
"!=",
"\"",
"\"",
"{",
... | // EnsureCachedImage ensures that a container image suitable for satisfying
// the input start parameters has been cached on disk. | [
"EnsureCachedImage",
"ensures",
"that",
"a",
"container",
"image",
"suitable",
"for",
"satisfying",
"the",
"input",
"start",
"parameters",
"has",
"been",
"cached",
"on",
"disk",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/kvm/container.go#L40-L73 |
4,376 | juju/juju | container/kvm/container.go | Start | func (c *kvmContainer) Start(params StartParams) error {
var bridge string
var interfaces []libvirt.InterfaceInfo
if params.Network != nil {
if params.Network.NetworkType == container.BridgeNetwork {
bridge = params.Network.Device
for _, iface := range params.Network.Interfaces {
interfaces = append(inte... | go | func (c *kvmContainer) Start(params StartParams) error {
var bridge string
var interfaces []libvirt.InterfaceInfo
if params.Network != nil {
if params.Network.NetworkType == container.BridgeNetwork {
bridge = params.Network.Device
for _, iface := range params.Network.Interfaces {
interfaces = append(inte... | [
"func",
"(",
"c",
"*",
"kvmContainer",
")",
"Start",
"(",
"params",
"StartParams",
")",
"error",
"{",
"var",
"bridge",
"string",
"\n",
"var",
"interfaces",
"[",
"]",
"libvirt",
".",
"InterfaceInfo",
"\n",
"if",
"params",
".",
"Network",
"!=",
"nil",
"{",... | // Start creates and starts a new container.
// It assumes that the backing image is already cached on disk. | [
"Start",
"creates",
"and",
"starts",
"a",
"new",
"container",
".",
"It",
"assumes",
"that",
"the",
"backing",
"image",
"is",
"already",
"cached",
"on",
"disk",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/kvm/container.go#L77-L115 |
4,377 | juju/juju | provider/oracle/environ.go | InstanceAvailabilityZoneNames | func (o *OracleEnviron) InstanceAvailabilityZoneNames(ctx context.ProviderCallContext, ids []instance.Id) ([]string, error) {
instances, err := o.Instances(ctx, ids)
if err != nil && err != environs.ErrPartialInstances {
return nil, err
}
zones := make([]string, len(instances))
for idx := range instances {
zon... | go | func (o *OracleEnviron) InstanceAvailabilityZoneNames(ctx context.ProviderCallContext, ids []instance.Id) ([]string, error) {
instances, err := o.Instances(ctx, ids)
if err != nil && err != environs.ErrPartialInstances {
return nil, err
}
zones := make([]string, len(instances))
for idx := range instances {
zon... | [
"func",
"(",
"o",
"*",
"OracleEnviron",
")",
"InstanceAvailabilityZoneNames",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"ids",
"[",
"]",
"instance",
".",
"Id",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"instances",
",",
"err",
"... | // InstanceAvailabilityzoneNames is defined in the common.ZonedEnviron interface | [
"InstanceAvailabilityzoneNames",
"is",
"defined",
"in",
"the",
"common",
".",
"ZonedEnviron",
"interface"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/environ.go#L91-L101 |
4,378 | juju/juju | provider/oracle/environ.go | NewOracleEnviron | func NewOracleEnviron(p *EnvironProvider, args environs.OpenParams, client EnvironAPI, c clock.Clock) (env *OracleEnviron, err error) {
if client == nil {
return nil, errors.NotFoundf("oracle client")
}
if p == nil {
return nil, errors.NotFoundf("environ proivder")
}
env = &OracleEnviron{
p: p,
spec: ... | go | func NewOracleEnviron(p *EnvironProvider, args environs.OpenParams, client EnvironAPI, c clock.Clock) (env *OracleEnviron, err error) {
if client == nil {
return nil, errors.NotFoundf("oracle client")
}
if p == nil {
return nil, errors.NotFoundf("environ proivder")
}
env = &OracleEnviron{
p: p,
spec: ... | [
"func",
"NewOracleEnviron",
"(",
"p",
"*",
"EnvironProvider",
",",
"args",
"environs",
".",
"OpenParams",
",",
"client",
"EnvironAPI",
",",
"c",
"clock",
".",
"Clock",
")",
"(",
"env",
"*",
"OracleEnviron",
",",
"err",
"error",
")",
"{",
"if",
"client",
... | // NewOracleEnviron returns a new OracleEnviron | [
"NewOracleEnviron",
"returns",
"a",
"new",
"OracleEnviron"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/environ.go#L104-L131 |
4,379 | juju/juju | provider/oracle/environ.go | buildSpacesMap | func (e *OracleEnviron) buildSpacesMap(ctx context.ProviderCallContext) (map[string]network.SpaceInfo, map[string]string, error) {
empty := set.Strings{}
providerIdMap := map[string]string{}
// NOTE (gsamfira): This seems brittle to me, and I would much rather get this
// from state, as that information should alre... | go | func (e *OracleEnviron) buildSpacesMap(ctx context.ProviderCallContext) (map[string]network.SpaceInfo, map[string]string, error) {
empty := set.Strings{}
providerIdMap := map[string]string{}
// NOTE (gsamfira): This seems brittle to me, and I would much rather get this
// from state, as that information should alre... | [
"func",
"(",
"e",
"*",
"OracleEnviron",
")",
"buildSpacesMap",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
")",
"(",
"map",
"[",
"string",
"]",
"network",
".",
"SpaceInfo",
",",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"empty",... | // buildSpacesMap builds a map with juju converted names from provider space names
//
// shamelessly copied from the MAAS provider | [
"buildSpacesMap",
"builds",
"a",
"map",
"with",
"juju",
"converted",
"names",
"from",
"provider",
"space",
"names",
"shamelessly",
"copied",
"from",
"the",
"MAAS",
"provider"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/environ.go#L211-L233 |
4,380 | juju/juju | provider/oracle/environ.go | StopInstances | func (o *OracleEnviron) StopInstances(ctx context.ProviderCallContext, ids ...instance.Id) error {
oracleInstances, err := o.getOracleInstances(ids...)
if err == environs.ErrNoInstances {
return nil
} else if err != nil {
return err
}
logger.Debugf("terminating instances %v", ids)
if err := o.terminateInstan... | go | func (o *OracleEnviron) StopInstances(ctx context.ProviderCallContext, ids ...instance.Id) error {
oracleInstances, err := o.getOracleInstances(ids...)
if err == environs.ErrNoInstances {
return nil
} else if err != nil {
return err
}
logger.Debugf("terminating instances %v", ids)
if err := o.terminateInstan... | [
"func",
"(",
"o",
"*",
"OracleEnviron",
")",
"StopInstances",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"ids",
"...",
"instance",
".",
"Id",
")",
"error",
"{",
"oracleInstances",
",",
"err",
":=",
"o",
".",
"getOracleInstances",
"(",
"ids",
"... | // StopInstances is part of the InstanceBroker interface. | [
"StopInstances",
"is",
"part",
"of",
"the",
"InstanceBroker",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/environ.go#L487-L501 |
4,381 | juju/juju | provider/oracle/environ.go | getOracleInstances | func (o *OracleEnviron) getOracleInstances(ids ...instance.Id) ([]*oracleInstance, error) {
ret := make([]*oracleInstance, 0, len(ids))
resp, err := o.client.AllInstances(nil)
if err != nil {
return nil, errors.Trace(err)
}
if len(resp.Result) == 0 {
return nil, environs.ErrNoInstances
}
for _, val := rang... | go | func (o *OracleEnviron) getOracleInstances(ids ...instance.Id) ([]*oracleInstance, error) {
ret := make([]*oracleInstance, 0, len(ids))
resp, err := o.client.AllInstances(nil)
if err != nil {
return nil, errors.Trace(err)
}
if len(resp.Result) == 0 {
return nil, environs.ErrNoInstances
}
for _, val := rang... | [
"func",
"(",
"o",
"*",
"OracleEnviron",
")",
"getOracleInstances",
"(",
"ids",
"...",
"instance",
".",
"Id",
")",
"(",
"[",
"]",
"*",
"oracleInstance",
",",
"error",
")",
"{",
"ret",
":=",
"make",
"(",
"[",
"]",
"*",
"oracleInstance",
",",
"0",
",",
... | // getOracleInstances attempts to fetch information from the oracle API for the
// specified IDs. | [
"getOracleInstances",
"attempts",
"to",
"fetch",
"information",
"from",
"the",
"oracle",
"API",
"for",
"the",
"specified",
"IDs",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/environ.go#L553-L580 |
4,382 | juju/juju | provider/oracle/environ.go | AllInstances | func (o *OracleEnviron) AllInstances(ctx context.ProviderCallContext) ([]envinstance.Instance, error) {
tagFilter := tagValue{tags.JujuModel, o.Config().UUID()}
all, err := o.allInstances(tagFilter)
if err != nil {
return nil, err
}
ret := make([]envinstance.Instance, len(all))
for i, val := range all {
ret[... | go | func (o *OracleEnviron) AllInstances(ctx context.ProviderCallContext) ([]envinstance.Instance, error) {
tagFilter := tagValue{tags.JujuModel, o.Config().UUID()}
all, err := o.allInstances(tagFilter)
if err != nil {
return nil, err
}
ret := make([]envinstance.Instance, len(all))
for i, val := range all {
ret[... | [
"func",
"(",
"o",
"*",
"OracleEnviron",
")",
"AllInstances",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
")",
"(",
"[",
"]",
"envinstance",
".",
"Instance",
",",
"error",
")",
"{",
"tagFilter",
":=",
"tagValue",
"{",
"tags",
".",
"JujuModel",
",",
... | // AllInstances is part of the InstanceBroker interface. | [
"AllInstances",
"is",
"part",
"of",
"the",
"InstanceBroker",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/environ.go#L595-L607 |
4,383 | juju/juju | provider/oracle/environ.go | MaintainInstance | func (o *OracleEnviron) MaintainInstance(ctx context.ProviderCallContext, args environs.StartInstanceParams) error {
return nil
} | go | func (o *OracleEnviron) MaintainInstance(ctx context.ProviderCallContext, args environs.StartInstanceParams) error {
return nil
} | [
"func",
"(",
"o",
"*",
"OracleEnviron",
")",
"MaintainInstance",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"args",
"environs",
".",
"StartInstanceParams",
")",
"error",
"{",
"return",
"nil",
"\n",
"}"
] | // MaintainInstance is part of the InstanceBroker interface. | [
"MaintainInstance",
"is",
"part",
"of",
"the",
"InstanceBroker",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/environ.go#L636-L638 |
4,384 | juju/juju | provider/oracle/environ.go | Config | func (o *OracleEnviron) Config() *config.Config {
o.mutex.Lock()
defer o.mutex.Unlock()
return o.cfg
} | go | func (o *OracleEnviron) Config() *config.Config {
o.mutex.Lock()
defer o.mutex.Unlock()
return o.cfg
} | [
"func",
"(",
"o",
"*",
"OracleEnviron",
")",
"Config",
"(",
")",
"*",
"config",
".",
"Config",
"{",
"o",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"o",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"return",
"o",
".",
"cfg",
"\n",
"}"
... | // Config is part of the Environ interface. | [
"Config",
"is",
"part",
"of",
"the",
"Environ",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/environ.go#L641-L645 |
4,385 | juju/juju | provider/oracle/environ.go | ConstraintsValidator | func (o *OracleEnviron) ConstraintsValidator(ctx context.ProviderCallContext) (constraints.Validator, error) {
// list of unsupported oracle provider constraints
unsupportedConstraints := []string{
constraints.Container,
constraints.CpuPower,
constraints.RootDisk,
constraints.VirtType,
}
// we choose to us... | go | func (o *OracleEnviron) ConstraintsValidator(ctx context.ProviderCallContext) (constraints.Validator, error) {
// list of unsupported oracle provider constraints
unsupportedConstraints := []string{
constraints.Container,
constraints.CpuPower,
constraints.RootDisk,
constraints.VirtType,
}
// we choose to us... | [
"func",
"(",
"o",
"*",
"OracleEnviron",
")",
"ConstraintsValidator",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
")",
"(",
"constraints",
".",
"Validator",
",",
"error",
")",
"{",
"// list of unsupported oracle provider constraints",
"unsupportedConstraints",
":=... | // ConstraintsValidator is part of the environs.Environ interface. | [
"ConstraintsValidator",
"is",
"part",
"of",
"the",
"environs",
".",
"Environ",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/environ.go#L648-L665 |
4,386 | juju/juju | provider/oracle/environ.go | DestroyController | func (o *OracleEnviron) DestroyController(ctx context.ProviderCallContext, controllerUUID string) error {
err := o.Destroy(ctx)
if err != nil {
logger.Errorf("Failed to destroy environment through controller: %s", errors.Trace(err))
}
instances, err := o.allControllerManagedInstances(controllerUUID)
if err != ni... | go | func (o *OracleEnviron) DestroyController(ctx context.ProviderCallContext, controllerUUID string) error {
err := o.Destroy(ctx)
if err != nil {
logger.Errorf("Failed to destroy environment through controller: %s", errors.Trace(err))
}
instances, err := o.allControllerManagedInstances(controllerUUID)
if err != ni... | [
"func",
"(",
"o",
"*",
"OracleEnviron",
")",
"DestroyController",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"controllerUUID",
"string",
")",
"error",
"{",
"err",
":=",
"o",
".",
"Destroy",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{... | // DestroyController is part of the environs.Environ interface. | [
"DestroyController",
"is",
"part",
"of",
"the",
"environs",
".",
"Environ",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/environ.go#L745-L762 |
4,387 | juju/juju | provider/oracle/environ.go | InstanceTypes | func (o *OracleEnviron) InstanceTypes(context.ProviderCallContext, constraints.Value) (envinstance.InstanceTypesWithCostMetadata, error) {
var i envinstance.InstanceTypesWithCostMetadata
return i, nil
} | go | func (o *OracleEnviron) InstanceTypes(context.ProviderCallContext, constraints.Value) (envinstance.InstanceTypesWithCostMetadata, error) {
var i envinstance.InstanceTypesWithCostMetadata
return i, nil
} | [
"func",
"(",
"o",
"*",
"OracleEnviron",
")",
"InstanceTypes",
"(",
"context",
".",
"ProviderCallContext",
",",
"constraints",
".",
"Value",
")",
"(",
"envinstance",
".",
"InstanceTypesWithCostMetadata",
",",
"error",
")",
"{",
"var",
"i",
"envinstance",
".",
"... | // InstanceTypes is part of the environs.InstanceTypesFetcher interface. | [
"InstanceTypes",
"is",
"part",
"of",
"the",
"environs",
".",
"InstanceTypesFetcher",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/environ.go#L775-L778 |
4,388 | juju/juju | provider/oracle/environ.go | createInstance | func (e *OracleEnviron) createInstance(params oci.InstanceParams) (*oracleInstance, error) {
if len(params.Instances) > 1 {
return nil, errors.NotSupportedf("launching multiple instances")
}
logger.Debugf("running createInstance")
resp, err := e.client.CreateInstance(params)
if err != nil {
return nil, errors... | go | func (e *OracleEnviron) createInstance(params oci.InstanceParams) (*oracleInstance, error) {
if len(params.Instances) > 1 {
return nil, errors.NotSupportedf("launching multiple instances")
}
logger.Debugf("running createInstance")
resp, err := e.client.CreateInstance(params)
if err != nil {
return nil, errors... | [
"func",
"(",
"e",
"*",
"OracleEnviron",
")",
"createInstance",
"(",
"params",
"oci",
".",
"InstanceParams",
")",
"(",
"*",
"oracleInstance",
",",
"error",
")",
"{",
"if",
"len",
"(",
"params",
".",
"Instances",
")",
">",
"1",
"{",
"return",
"nil",
",",... | // createInstance creates a new instance inside the oracle infrastructure | [
"createInstance",
"creates",
"a",
"new",
"instance",
"inside",
"the",
"oracle",
"infrastructure"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/environ.go#L781-L798 |
4,389 | juju/juju | environs/errors.go | IsAvailabilityZoneIndependent | func IsAvailabilityZoneIndependent(err error) bool {
if err, ok := errors.Cause(err).(AvailabilityZoneError); ok {
return err.AvailabilityZoneIndependent()
}
return false
} | go | func IsAvailabilityZoneIndependent(err error) bool {
if err, ok := errors.Cause(err).(AvailabilityZoneError); ok {
return err.AvailabilityZoneIndependent()
}
return false
} | [
"func",
"IsAvailabilityZoneIndependent",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"err",
",",
"ok",
":=",
"errors",
".",
"Cause",
"(",
"err",
")",
".",
"(",
"AvailabilityZoneError",
")",
";",
"ok",
"{",
"return",
"err",
".",
"AvailabilityZoneIndependent"... | // IsAvailabilityZoneIndependent reports whether or not the given error,
// or its cause, is independent of any particular availability zone.
// Juju uses this to decide whether or not to attempt the failed operation
// in another availability zone; zone-independent failures will not be
// reattempted.
//
// If the err... | [
"IsAvailabilityZoneIndependent",
"reports",
"whether",
"or",
"not",
"the",
"given",
"error",
"or",
"its",
"cause",
"is",
"independent",
"of",
"any",
"particular",
"availability",
"zone",
".",
"Juju",
"uses",
"this",
"to",
"decide",
"whether",
"or",
"not",
"to",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/errors.go#L38-L43 |
4,390 | juju/juju | worker/uniter/runner/context/env.go | OSDependentEnvVars | func OSDependentEnvVars(paths Paths) []string {
switch jujuos.HostOS() {
case jujuos.Windows:
return windowsEnv(paths)
case jujuos.Ubuntu:
return ubuntuEnv(paths)
case jujuos.CentOS:
return centosEnv(paths)
case jujuos.OpenSUSE:
return opensuseEnv(paths)
}
return nil
} | go | func OSDependentEnvVars(paths Paths) []string {
switch jujuos.HostOS() {
case jujuos.Windows:
return windowsEnv(paths)
case jujuos.Ubuntu:
return ubuntuEnv(paths)
case jujuos.CentOS:
return centosEnv(paths)
case jujuos.OpenSUSE:
return opensuseEnv(paths)
}
return nil
} | [
"func",
"OSDependentEnvVars",
"(",
"paths",
"Paths",
")",
"[",
"]",
"string",
"{",
"switch",
"jujuos",
".",
"HostOS",
"(",
")",
"{",
"case",
"jujuos",
".",
"Windows",
":",
"return",
"windowsEnv",
"(",
"paths",
")",
"\n",
"case",
"jujuos",
".",
"Ubuntu",
... | // OSDependentEnvVars returns the OS-dependent environment variables that
// should be set for a hook context. | [
"OSDependentEnvVars",
"returns",
"the",
"OS",
"-",
"dependent",
"environment",
"variables",
"that",
"should",
"be",
"set",
"for",
"a",
"hook",
"context",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runner/context/env.go#L15-L27 |
4,391 | juju/juju | worker/uniter/runner/context/env.go | windowsEnv | func windowsEnv(paths Paths) []string {
charmDir := paths.GetCharmDir()
charmModules := filepath.Join(charmDir, "lib", "Modules")
return []string{
"Path=" + paths.GetToolsDir() + ";" + os.Getenv("Path"),
"PSModulePath=" + os.Getenv("PSModulePath") + ";" + charmModules,
}
} | go | func windowsEnv(paths Paths) []string {
charmDir := paths.GetCharmDir()
charmModules := filepath.Join(charmDir, "lib", "Modules")
return []string{
"Path=" + paths.GetToolsDir() + ";" + os.Getenv("Path"),
"PSModulePath=" + os.Getenv("PSModulePath") + ";" + charmModules,
}
} | [
"func",
"windowsEnv",
"(",
"paths",
"Paths",
")",
"[",
"]",
"string",
"{",
"charmDir",
":=",
"paths",
".",
"GetCharmDir",
"(",
")",
"\n",
"charmModules",
":=",
"filepath",
".",
"Join",
"(",
"charmDir",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"re... | // windowsEnv adds windows specific environment variables. PSModulePath
// helps hooks use normal imports instead of dot sourcing modules
// its a convenience variable. The PATH variable delimiter is
// a semicolon instead of a colon | [
"windowsEnv",
"adds",
"windows",
"specific",
"environment",
"variables",
".",
"PSModulePath",
"helps",
"hooks",
"use",
"normal",
"imports",
"instead",
"of",
"dot",
"sourcing",
"modules",
"its",
"a",
"convenience",
"variable",
".",
"The",
"PATH",
"variable",
"delim... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runner/context/env.go#L57-L64 |
4,392 | juju/juju | upgrades/steps_223.go | stateStepsFor223 | func stateStepsFor223() []Step {
return []Step{
&upgradeStep{
description: "add max-action-age and max-action-size config settings",
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return context.State().AddActionPruneSettings()
},
},
}
} | go | func stateStepsFor223() []Step {
return []Step{
&upgradeStep{
description: "add max-action-age and max-action-size config settings",
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return context.State().AddActionPruneSettings()
},
},
}
} | [
"func",
"stateStepsFor223",
"(",
")",
"[",
"]",
"Step",
"{",
"return",
"[",
"]",
"Step",
"{",
"&",
"upgradeStep",
"{",
"description",
":",
"\"",
"\"",
",",
"targets",
":",
"[",
"]",
"Target",
"{",
"DatabaseMaster",
"}",
",",
"run",
":",
"func",
"(",
... | // stateStepsFor223 returns upgrade steps for Juju 2.2.3 that manipulate state directly. | [
"stateStepsFor223",
"returns",
"upgrade",
"steps",
"for",
"Juju",
"2",
".",
"2",
".",
"3",
"that",
"manipulate",
"state",
"directly",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/upgrades/steps_223.go#L7-L17 |
4,393 | juju/juju | apiserver/facades/client/controller/destroy.go | DestroyController | func (c *ControllerAPIv3) DestroyController(args params.DestroyControllerArgs) error {
if args.DestroyStorage != nil {
return errors.New("destroy-storage unexpected on the v3 API")
}
destroyStorage := true
args.DestroyStorage = &destroyStorage
return destroyController(c.state, c.statePool, c.authorizer, args)
} | go | func (c *ControllerAPIv3) DestroyController(args params.DestroyControllerArgs) error {
if args.DestroyStorage != nil {
return errors.New("destroy-storage unexpected on the v3 API")
}
destroyStorage := true
args.DestroyStorage = &destroyStorage
return destroyController(c.state, c.statePool, c.authorizer, args)
} | [
"func",
"(",
"c",
"*",
"ControllerAPIv3",
")",
"DestroyController",
"(",
"args",
"params",
".",
"DestroyControllerArgs",
")",
"error",
"{",
"if",
"args",
".",
"DestroyStorage",
"!=",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
... | // DestroyController destroys the controller.
//
// The v3 implementation of DestroyController ignores the DestroyStorage
// field of the arguments, and unconditionally destroys all storage in
// the controller.
//
// See ControllerAPIv4.DestroyController for more details. | [
"DestroyController",
"destroys",
"the",
"controller",
".",
"The",
"v3",
"implementation",
"of",
"DestroyController",
"ignores",
"the",
"DestroyStorage",
"field",
"of",
"the",
"arguments",
"and",
"unconditionally",
"destroys",
"all",
"storage",
"in",
"the",
"controller... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/controller/destroy.go#L23-L30 |
4,394 | juju/juju | apiserver/facades/client/controller/destroy.go | DestroyController | func (c *ControllerAPI) DestroyController(args params.DestroyControllerArgs) error {
return destroyController(c.state, c.statePool, c.authorizer, args)
} | go | func (c *ControllerAPI) DestroyController(args params.DestroyControllerArgs) error {
return destroyController(c.state, c.statePool, c.authorizer, args)
} | [
"func",
"(",
"c",
"*",
"ControllerAPI",
")",
"DestroyController",
"(",
"args",
"params",
".",
"DestroyControllerArgs",
")",
"error",
"{",
"return",
"destroyController",
"(",
"c",
".",
"state",
",",
"c",
".",
"statePool",
",",
"c",
".",
"authorizer",
",",
"... | // DestroyController destroys the controller.
//
// If the args specify the destruction of the models, this method will
// attempt to do so. Otherwise, if the controller has any non-empty,
// non-Dead hosted models, then an error with the code
// params.CodeHasHostedModels will be transmitted. | [
"DestroyController",
"destroys",
"the",
"controller",
".",
"If",
"the",
"args",
"specify",
"the",
"destruction",
"of",
"the",
"models",
"this",
"method",
"will",
"attempt",
"to",
"do",
"so",
".",
"Otherwise",
"if",
"the",
"controller",
"has",
"any",
"non",
"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/controller/destroy.go#L38-L40 |
4,395 | juju/juju | resource/api/helpers.go | Resource2API | func Resource2API(res resource.Resource) params.Resource {
return params.Resource{
CharmResource: CharmResource2API(res.Resource),
ID: res.ID,
PendingID: res.PendingID,
ApplicationID: res.ApplicationID,
Username: res.Username,
Timestamp: res.Timestamp,
}
} | go | func Resource2API(res resource.Resource) params.Resource {
return params.Resource{
CharmResource: CharmResource2API(res.Resource),
ID: res.ID,
PendingID: res.PendingID,
ApplicationID: res.ApplicationID,
Username: res.Username,
Timestamp: res.Timestamp,
}
} | [
"func",
"Resource2API",
"(",
"res",
"resource",
".",
"Resource",
")",
"params",
".",
"Resource",
"{",
"return",
"params",
".",
"Resource",
"{",
"CharmResource",
":",
"CharmResource2API",
"(",
"res",
".",
"Resource",
")",
",",
"ID",
":",
"res",
".",
"ID",
... | // Resource2API converts a resource.Resource into
// a Resource struct. | [
"Resource2API",
"converts",
"a",
"resource",
".",
"Resource",
"into",
"a",
"Resource",
"struct",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/api/helpers.go#L18-L27 |
4,396 | juju/juju | resource/api/helpers.go | APIResult2ApplicationResources | func APIResult2ApplicationResources(apiResult params.ResourcesResult) (resource.ApplicationResources, error) {
var result resource.ApplicationResources
if apiResult.Error != nil {
// TODO(ericsnow) Return the resources too?
err := common.RestoreError(apiResult.Error)
return resource.ApplicationResources{}, err... | go | func APIResult2ApplicationResources(apiResult params.ResourcesResult) (resource.ApplicationResources, error) {
var result resource.ApplicationResources
if apiResult.Error != nil {
// TODO(ericsnow) Return the resources too?
err := common.RestoreError(apiResult.Error)
return resource.ApplicationResources{}, err... | [
"func",
"APIResult2ApplicationResources",
"(",
"apiResult",
"params",
".",
"ResourcesResult",
")",
"(",
"resource",
".",
"ApplicationResources",
",",
"error",
")",
"{",
"var",
"result",
"resource",
".",
"ApplicationResources",
"\n\n",
"if",
"apiResult",
".",
"Error"... | // APIResult2ApplicationResources converts a ResourcesResult into a resource.ApplicationResources. | [
"APIResult2ApplicationResources",
"converts",
"a",
"ResourcesResult",
"into",
"a",
"resource",
".",
"ApplicationResources",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/api/helpers.go#L30-L87 |
4,397 | juju/juju | resource/api/helpers.go | API2Resource | func API2Resource(apiRes params.Resource) (resource.Resource, error) {
var res resource.Resource
charmRes, err := API2CharmResource(apiRes.CharmResource)
if err != nil {
return res, errors.Trace(err)
}
res = resource.Resource{
Resource: charmRes,
ID: apiRes.ID,
PendingID: apiRes.Pendi... | go | func API2Resource(apiRes params.Resource) (resource.Resource, error) {
var res resource.Resource
charmRes, err := API2CharmResource(apiRes.CharmResource)
if err != nil {
return res, errors.Trace(err)
}
res = resource.Resource{
Resource: charmRes,
ID: apiRes.ID,
PendingID: apiRes.Pendi... | [
"func",
"API2Resource",
"(",
"apiRes",
"params",
".",
"Resource",
")",
"(",
"resource",
".",
"Resource",
",",
"error",
")",
"{",
"var",
"res",
"resource",
".",
"Resource",
"\n\n",
"charmRes",
",",
"err",
":=",
"API2CharmResource",
"(",
"apiRes",
".",
"Char... | // API2Resource converts an API Resource struct into
// a resource.Resource. | [
"API2Resource",
"converts",
"an",
"API",
"Resource",
"struct",
"into",
"a",
"resource",
".",
"Resource",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/api/helpers.go#L121-L143 |
4,398 | juju/juju | resource/api/helpers.go | CharmResource2API | func CharmResource2API(res charmresource.Resource) params.CharmResource {
return params.CharmResource{
Name: res.Name,
Type: res.Type.String(),
Path: res.Path,
Description: res.Description,
Origin: res.Origin.String(),
Revision: res.Revision,
Fingerprint: res.Fingerprint.Byte... | go | func CharmResource2API(res charmresource.Resource) params.CharmResource {
return params.CharmResource{
Name: res.Name,
Type: res.Type.String(),
Path: res.Path,
Description: res.Description,
Origin: res.Origin.String(),
Revision: res.Revision,
Fingerprint: res.Fingerprint.Byte... | [
"func",
"CharmResource2API",
"(",
"res",
"charmresource",
".",
"Resource",
")",
"params",
".",
"CharmResource",
"{",
"return",
"params",
".",
"CharmResource",
"{",
"Name",
":",
"res",
".",
"Name",
",",
"Type",
":",
"res",
".",
"Type",
".",
"String",
"(",
... | // CharmResource2API converts a charm resource into
// a CharmResource struct. | [
"CharmResource2API",
"converts",
"a",
"charm",
"resource",
"into",
"a",
"CharmResource",
"struct",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/api/helpers.go#L147-L158 |
4,399 | juju/juju | resource/api/helpers.go | API2CharmResource | func API2CharmResource(apiInfo params.CharmResource) (charmresource.Resource, error) {
var res charmresource.Resource
rtype, err := charmresource.ParseType(apiInfo.Type)
if err != nil {
return res, errors.Trace(err)
}
origin, err := charmresource.ParseOrigin(apiInfo.Origin)
if err != nil {
return res, error... | go | func API2CharmResource(apiInfo params.CharmResource) (charmresource.Resource, error) {
var res charmresource.Resource
rtype, err := charmresource.ParseType(apiInfo.Type)
if err != nil {
return res, errors.Trace(err)
}
origin, err := charmresource.ParseOrigin(apiInfo.Origin)
if err != nil {
return res, error... | [
"func",
"API2CharmResource",
"(",
"apiInfo",
"params",
".",
"CharmResource",
")",
"(",
"charmresource",
".",
"Resource",
",",
"error",
")",
"{",
"var",
"res",
"charmresource",
".",
"Resource",
"\n\n",
"rtype",
",",
"err",
":=",
"charmresource",
".",
"ParseType... | // API2CharmResource converts an API CharmResource struct into
// a charm resource. | [
"API2CharmResource",
"converts",
"an",
"API",
"CharmResource",
"struct",
"into",
"a",
"charm",
"resource",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/api/helpers.go#L162-L197 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.