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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
155,700 | juju/juju | provider/azure/internal/azurestorage/interface.go | Blobs | func (c container) Blobs() ([]Blob, error) {
//TODO(axw) handle pagination.
resp, err := c.Container.ListBlobs(storage.ListBlobsParameters{})
if err != nil {
return nil, errors.Trace(err)
}
blobs := make([]Blob, len(resp.Blobs))
for i := range blobs {
blobs[i] = blob{&resp.Blobs[i]}
}
return blobs, nil
} | go | func (c container) Blobs() ([]Blob, error) {
//TODO(axw) handle pagination.
resp, err := c.Container.ListBlobs(storage.ListBlobsParameters{})
if err != nil {
return nil, errors.Trace(err)
}
blobs := make([]Blob, len(resp.Blobs))
for i := range blobs {
blobs[i] = blob{&resp.Blobs[i]}
}
return blobs, nil
} | [
"func",
"(",
"c",
"container",
")",
"Blobs",
"(",
")",
"(",
"[",
"]",
"Blob",
",",
"error",
")",
"{",
"//TODO(axw) handle pagination.",
"resp",
",",
"err",
":=",
"c",
".",
"Container",
".",
"ListBlobs",
"(",
"storage",
".",
"ListBlobsParameters",
"{",
"}... | // Blobs is part of the Container interface. | [
"Blobs",
"is",
"part",
"of",
"the",
"Container",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/internal/azurestorage/interface.go#L93-L104 |
155,701 | juju/juju | provider/azure/internal/azurestorage/interface.go | Blob | func (c container) Blob(name string) Blob {
return blob{c.Container.GetBlobReference(name)}
} | go | func (c container) Blob(name string) Blob {
return blob{c.Container.GetBlobReference(name)}
} | [
"func",
"(",
"c",
"container",
")",
"Blob",
"(",
"name",
"string",
")",
"Blob",
"{",
"return",
"blob",
"{",
"c",
".",
"Container",
".",
"GetBlobReference",
"(",
"name",
")",
"}",
"\n",
"}"
] | // Blob is part of the Container interface. | [
"Blob",
"is",
"part",
"of",
"the",
"Container",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/internal/azurestorage/interface.go#L107-L109 |
155,702 | juju/juju | worker/terminationworker/manifold.go | Manifold | func Manifold() dependency.Manifold {
return dependency.Manifold{
Start: func(_ dependency.Context) (worker.Worker, error) {
return NewWorker(), nil
},
}
} | go | func Manifold() dependency.Manifold {
return dependency.Manifold{
Start: func(_ dependency.Context) (worker.Worker, error) {
return NewWorker(), nil
},
}
} | [
"func",
"Manifold",
"(",
")",
"dependency",
".",
"Manifold",
"{",
"return",
"dependency",
".",
"Manifold",
"{",
"Start",
":",
"func",
"(",
"_",
"dependency",
".",
"Context",
")",
"(",
"worker",
".",
"Worker",
",",
"error",
")",
"{",
"return",
"NewWorker"... | // Manifold returns a manifold whose worker returns ErrTerminateAgent
// if a termination signal is received by the process it's running in. | [
"Manifold",
"returns",
"a",
"manifold",
"whose",
"worker",
"returns",
"ErrTerminateAgent",
"if",
"a",
"termination",
"signal",
"is",
"received",
"by",
"the",
"process",
"it",
"s",
"running",
"in",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/terminationworker/manifold.go#L13-L19 |
155,703 | juju/juju | state/ports.go | NewPortRange | func NewPortRange(unitName string, fromPort, toPort int, protocol string) (PortRange, error) {
p := PortRange{
UnitName: unitName,
FromPort: fromPort,
ToPort: toPort,
Protocol: strings.ToLower(protocol),
}
if err := p.Validate(); err != nil {
return PortRange{}, err
}
return p, nil
} | go | func NewPortRange(unitName string, fromPort, toPort int, protocol string) (PortRange, error) {
p := PortRange{
UnitName: unitName,
FromPort: fromPort,
ToPort: toPort,
Protocol: strings.ToLower(protocol),
}
if err := p.Validate(); err != nil {
return PortRange{}, err
}
return p, nil
} | [
"func",
"NewPortRange",
"(",
"unitName",
"string",
",",
"fromPort",
",",
"toPort",
"int",
",",
"protocol",
"string",
")",
"(",
"PortRange",
",",
"error",
")",
"{",
"p",
":=",
"PortRange",
"{",
"UnitName",
":",
"unitName",
",",
"FromPort",
":",
"fromPort",
... | // NewPortRange create a new port range and validate it. | [
"NewPortRange",
"create",
"a",
"new",
"port",
"range",
"and",
"validate",
"it",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L43-L54 |
155,704 | juju/juju | state/ports.go | Validate | func (p PortRange) Validate() error {
proto := strings.ToLower(p.Protocol)
if proto != "tcp" && proto != "udp" && proto != "icmp" {
return errors.Errorf("invalid protocol %q", proto)
}
if !names.IsValidUnit(p.UnitName) {
return errors.Errorf("invalid unit %q", p.UnitName)
}
if proto == "icmp" {
if p.FromPor... | go | func (p PortRange) Validate() error {
proto := strings.ToLower(p.Protocol)
if proto != "tcp" && proto != "udp" && proto != "icmp" {
return errors.Errorf("invalid protocol %q", proto)
}
if !names.IsValidUnit(p.UnitName) {
return errors.Errorf("invalid unit %q", p.UnitName)
}
if proto == "icmp" {
if p.FromPor... | [
"func",
"(",
"p",
"PortRange",
")",
"Validate",
"(",
")",
"error",
"{",
"proto",
":=",
"strings",
".",
"ToLower",
"(",
"p",
".",
"Protocol",
")",
"\n",
"if",
"proto",
"!=",
"\"",
"\"",
"&&",
"proto",
"!=",
"\"",
"\"",
"&&",
"proto",
"!=",
"\"",
"... | // Validate checks if the port range is valid. | [
"Validate",
"checks",
"if",
"the",
"port",
"range",
"is",
"valid",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L57-L79 |
155,705 | juju/juju | state/ports.go | Length | func (a PortRange) Length() int {
if err := a.Validate(); err != nil {
// Invalid range (from > to or something equally bad)
return 0
}
return (a.ToPort - a.FromPort) + 1
} | go | func (a PortRange) Length() int {
if err := a.Validate(); err != nil {
// Invalid range (from > to or something equally bad)
return 0
}
return (a.ToPort - a.FromPort) + 1
} | [
"func",
"(",
"a",
"PortRange",
")",
"Length",
"(",
")",
"int",
"{",
"if",
"err",
":=",
"a",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"// Invalid range (from > to or something equally bad)",
"return",
"0",
"\n",
"}",
"\n",
"return",
"(",
"... | // Length returns the number of ports in the range.
// If the range is not valid, it returns 0. | [
"Length",
"returns",
"the",
"number",
"of",
"ports",
"in",
"the",
"range",
".",
"If",
"the",
"range",
"is",
"not",
"valid",
"it",
"returns",
"0",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L83-L89 |
155,706 | juju/juju | state/ports.go | SanitizeBounds | func (a PortRange) SanitizeBounds() PortRange {
b := a
if a.Protocol == "icmp" {
return b
}
if b.FromPort > b.ToPort {
b.FromPort, b.ToPort = b.ToPort, b.FromPort
}
for _, bound := range []*int{&b.FromPort, &b.ToPort} {
switch {
case *bound <= 0:
*bound = 1
case *bound > 65535:
*bound = 65535
}
... | go | func (a PortRange) SanitizeBounds() PortRange {
b := a
if a.Protocol == "icmp" {
return b
}
if b.FromPort > b.ToPort {
b.FromPort, b.ToPort = b.ToPort, b.FromPort
}
for _, bound := range []*int{&b.FromPort, &b.ToPort} {
switch {
case *bound <= 0:
*bound = 1
case *bound > 65535:
*bound = 65535
}
... | [
"func",
"(",
"a",
"PortRange",
")",
"SanitizeBounds",
"(",
")",
"PortRange",
"{",
"b",
":=",
"a",
"\n",
"if",
"a",
".",
"Protocol",
"==",
"\"",
"\"",
"{",
"return",
"b",
"\n",
"}",
"\n",
"if",
"b",
".",
"FromPort",
">",
"b",
".",
"ToPort",
"{",
... | // Sanitize returns a copy of the port range, which is guaranteed to
// have FromPort >= ToPort and both FromPort and ToPort fit into the
// valid range from 1 to 65535, inclusive. | [
"Sanitize",
"returns",
"a",
"copy",
"of",
"the",
"port",
"range",
"which",
"is",
"guaranteed",
"to",
"have",
"FromPort",
">",
"=",
"ToPort",
"and",
"both",
"FromPort",
"and",
"ToPort",
"fit",
"into",
"the",
"valid",
"range",
"from",
"1",
"to",
"65535",
"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L94-L111 |
155,707 | juju/juju | state/ports.go | CheckConflicts | func (prA PortRange) CheckConflicts(prB PortRange) error {
if err := prA.Validate(); err != nil {
return err
}
if err := prB.Validate(); err != nil {
return err
}
// An exact port range match (including the associated unit name) is not
// considered a conflict due to the fact that many charms issue commands
... | go | func (prA PortRange) CheckConflicts(prB PortRange) error {
if err := prA.Validate(); err != nil {
return err
}
if err := prB.Validate(); err != nil {
return err
}
// An exact port range match (including the associated unit name) is not
// considered a conflict due to the fact that many charms issue commands
... | [
"func",
"(",
"prA",
"PortRange",
")",
"CheckConflicts",
"(",
"prB",
"PortRange",
")",
"error",
"{",
"if",
"err",
":=",
"prA",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"prB",
".",
... | // CheckConflicts determines if the two port ranges conflict. | [
"CheckConflicts",
"determines",
"if",
"the",
"two",
"port",
"ranges",
"conflict",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L114-L135 |
155,708 | juju/juju | state/ports.go | String | func (p PortRange) String() string {
proto := strings.ToLower(p.Protocol)
if proto == "icmp" {
return fmt.Sprintf("%s (%q)", proto, p.UnitName)
}
return fmt.Sprintf("%d-%d/%s (%q)", p.FromPort, p.ToPort, proto, p.UnitName)
} | go | func (p PortRange) String() string {
proto := strings.ToLower(p.Protocol)
if proto == "icmp" {
return fmt.Sprintf("%s (%q)", proto, p.UnitName)
}
return fmt.Sprintf("%d-%d/%s (%q)", p.FromPort, p.ToPort, proto, p.UnitName)
} | [
"func",
"(",
"p",
"PortRange",
")",
"String",
"(",
")",
"string",
"{",
"proto",
":=",
"strings",
".",
"ToLower",
"(",
"p",
".",
"Protocol",
")",
"\n",
"if",
"proto",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"p... | // Strings returns the port range as a string. | [
"Strings",
"returns",
"the",
"port",
"range",
"as",
"a",
"string",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L138-L144 |
155,709 | juju/juju | state/ports.go | String | func (p *Ports) String() string {
return fmt.Sprintf("ports for machine %q, subnet %q", p.doc.MachineID, p.doc.SubnetID)
} | go | func (p *Ports) String() string {
return fmt.Sprintf("ports for machine %q, subnet %q", p.doc.MachineID, p.doc.SubnetID)
} | [
"func",
"(",
"p",
"*",
"Ports",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"p",
".",
"doc",
".",
"MachineID",
",",
"p",
".",
"doc",
".",
"SubnetID",
")",
"\n",
"}"
] | // String returns p as a user-readable string. | [
"String",
"returns",
"p",
"as",
"a",
"user",
"-",
"readable",
"string",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L165-L167 |
155,710 | juju/juju | state/ports.go | extractPortsIDParts | func extractPortsIDParts(globalKey string) ([]string, error) {
if parts := portsIDRe.FindStringSubmatch(globalKey); len(parts) == 3 {
return parts, nil
}
return nil, errors.NotValidf("ports document key %q", globalKey)
} | go | func extractPortsIDParts(globalKey string) ([]string, error) {
if parts := portsIDRe.FindStringSubmatch(globalKey); len(parts) == 3 {
return parts, nil
}
return nil, errors.NotValidf("ports document key %q", globalKey)
} | [
"func",
"extractPortsIDParts",
"(",
"globalKey",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"if",
"parts",
":=",
"portsIDRe",
".",
"FindStringSubmatch",
"(",
"globalKey",
")",
";",
"len",
"(",
"parts",
")",
"==",
"3",
"{",
"return",
... | // extractPortsIDParts parses the given ports global key and extracts
// its parts. | [
"extractPortsIDParts",
"parses",
"the",
"given",
"ports",
"global",
"key",
"and",
"extracts",
"its",
"parts",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L177-L182 |
155,711 | juju/juju | state/ports.go | OpenPorts | func (p *Ports) OpenPorts(portRange PortRange) (err error) {
defer errors.DeferredAnnotatef(&err, "cannot open ports %s", portRange)
if err = portRange.Validate(); err != nil {
return errors.Trace(err)
}
ports := Ports{st: p.st, doc: p.doc, areNew: p.areNew}
buildTxn := func(attempt int) ([]txn.Op, error) {
... | go | func (p *Ports) OpenPorts(portRange PortRange) (err error) {
defer errors.DeferredAnnotatef(&err, "cannot open ports %s", portRange)
if err = portRange.Validate(); err != nil {
return errors.Trace(err)
}
ports := Ports{st: p.st, doc: p.doc, areNew: p.areNew}
buildTxn := func(attempt int) ([]txn.Op, error) {
... | [
"func",
"(",
"p",
"*",
"Ports",
")",
"OpenPorts",
"(",
"portRange",
"PortRange",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"errors",
".",
"DeferredAnnotatef",
"(",
"&",
"err",
",",
"\"",
"\"",
",",
"portRange",
")",
"\n\n",
"if",
"err",
"=",
"port... | // OpenPorts adds the specified port range to the list of ports
// maintained by this document. | [
"OpenPorts",
"adds",
"the",
"specified",
"port",
"range",
"to",
"the",
"list",
"of",
"ports",
"maintained",
"by",
"this",
"document",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L191-L255 |
155,712 | juju/juju | state/ports.go | ClosePorts | func (p *Ports) ClosePorts(portRange PortRange) (err error) {
defer errors.DeferredAnnotatef(&err, "cannot close ports %s", portRange)
if err = portRange.Validate(); err != nil {
return errors.Trace(err)
}
var newPorts []PortRange
ports := Ports{st: p.st, doc: p.doc, areNew: p.areNew}
buildTxn := func(attempt... | go | func (p *Ports) ClosePorts(portRange PortRange) (err error) {
defer errors.DeferredAnnotatef(&err, "cannot close ports %s", portRange)
if err = portRange.Validate(); err != nil {
return errors.Trace(err)
}
var newPorts []PortRange
ports := Ports{st: p.st, doc: p.doc, areNew: p.areNew}
buildTxn := func(attempt... | [
"func",
"(",
"p",
"*",
"Ports",
")",
"ClosePorts",
"(",
"portRange",
"PortRange",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"errors",
".",
"DeferredAnnotatef",
"(",
"&",
"err",
",",
"\"",
"\"",
",",
"portRange",
")",
"\n\n",
"if",
"err",
"=",
"por... | // ClosePorts removes the specified port range from the list of ports
// maintained by this document. | [
"ClosePorts",
"removes",
"the",
"specified",
"port",
"range",
"from",
"the",
"list",
"of",
"ports",
"maintained",
"by",
"this",
"document",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L273-L324 |
155,713 | juju/juju | state/ports.go | Refresh | func (p *Ports) Refresh() error {
openedPorts, closer := p.st.db().GetCollection(openedPortsC)
defer closer()
err := openedPorts.FindId(p.doc.DocID).One(&p.doc)
if err == mgo.ErrNotFound {
return errors.NotFoundf(p.String())
} else if err != nil {
return errors.Annotatef(err, "cannot refresh %s", p)
}
retur... | go | func (p *Ports) Refresh() error {
openedPorts, closer := p.st.db().GetCollection(openedPortsC)
defer closer()
err := openedPorts.FindId(p.doc.DocID).One(&p.doc)
if err == mgo.ErrNotFound {
return errors.NotFoundf(p.String())
} else if err != nil {
return errors.Annotatef(err, "cannot refresh %s", p)
}
retur... | [
"func",
"(",
"p",
"*",
"Ports",
")",
"Refresh",
"(",
")",
"error",
"{",
"openedPorts",
",",
"closer",
":=",
"p",
".",
"st",
".",
"db",
"(",
")",
".",
"GetCollection",
"(",
"openedPortsC",
")",
"\n",
"defer",
"closer",
"(",
")",
"\n\n",
"err",
":=",... | // Refresh refreshes the port document from state. | [
"Refresh",
"refreshes",
"the",
"port",
"document",
"from",
"state",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L339-L350 |
155,714 | juju/juju | state/ports.go | AllPortRanges | func (p *Ports) AllPortRanges() map[network.PortRange]string {
result := make(map[network.PortRange]string)
for _, portRange := range p.doc.Ports {
rawRange := network.PortRange{
FromPort: portRange.FromPort,
ToPort: portRange.ToPort,
Protocol: portRange.Protocol,
}
result[rawRange] = portRange.UnitN... | go | func (p *Ports) AllPortRanges() map[network.PortRange]string {
result := make(map[network.PortRange]string)
for _, portRange := range p.doc.Ports {
rawRange := network.PortRange{
FromPort: portRange.FromPort,
ToPort: portRange.ToPort,
Protocol: portRange.Protocol,
}
result[rawRange] = portRange.UnitN... | [
"func",
"(",
"p",
"*",
"Ports",
")",
"AllPortRanges",
"(",
")",
"map",
"[",
"network",
".",
"PortRange",
"]",
"string",
"{",
"result",
":=",
"make",
"(",
"map",
"[",
"network",
".",
"PortRange",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"portRange",... | // AllPortRanges returns a map with network.PortRange as keys and unit
// names as values. | [
"AllPortRanges",
"returns",
"a",
"map",
"with",
"network",
".",
"PortRange",
"as",
"keys",
"and",
"unit",
"names",
"as",
"values",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L354-L365 |
155,715 | juju/juju | state/ports.go | Remove | func (p *Ports) Remove() error {
ports := &Ports{st: p.st, doc: p.doc}
buildTxn := func(attempt int) ([]txn.Op, error) {
if attempt > 0 {
err := ports.Refresh()
if errors.IsNotFound(err) {
return nil, statetxn.ErrNoOperations
} else if err != nil {
return nil, errors.Trace(err)
}
}
return po... | go | func (p *Ports) Remove() error {
ports := &Ports{st: p.st, doc: p.doc}
buildTxn := func(attempt int) ([]txn.Op, error) {
if attempt > 0 {
err := ports.Refresh()
if errors.IsNotFound(err) {
return nil, statetxn.ErrNoOperations
} else if err != nil {
return nil, errors.Trace(err)
}
}
return po... | [
"func",
"(",
"p",
"*",
"Ports",
")",
"Remove",
"(",
")",
"error",
"{",
"ports",
":=",
"&",
"Ports",
"{",
"st",
":",
"p",
".",
"st",
",",
"doc",
":",
"p",
".",
"doc",
"}",
"\n",
"buildTxn",
":=",
"func",
"(",
"attempt",
"int",
")",
"(",
"[",
... | // Remove removes the ports document from state. | [
"Remove",
"removes",
"the",
"ports",
"document",
"from",
"state",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L368-L382 |
155,716 | juju/juju | state/ports.go | OpenedPorts | func (m *Machine) OpenedPorts(subnetID string) (*Ports, error) {
ports, err := getPorts(m.st, m.Id(), subnetID)
if err != nil && !errors.IsNotFound(err) {
return nil, errors.Trace(err)
}
return ports, nil
} | go | func (m *Machine) OpenedPorts(subnetID string) (*Ports, error) {
ports, err := getPorts(m.st, m.Id(), subnetID)
if err != nil && !errors.IsNotFound(err) {
return nil, errors.Trace(err)
}
return ports, nil
} | [
"func",
"(",
"m",
"*",
"Machine",
")",
"OpenedPorts",
"(",
"subnetID",
"string",
")",
"(",
"*",
"Ports",
",",
"error",
")",
"{",
"ports",
",",
"err",
":=",
"getPorts",
"(",
"m",
".",
"st",
",",
"m",
".",
"Id",
"(",
")",
",",
"subnetID",
")",
"\... | // OpenedPorts returns this machine ports document for the given subnetID. | [
"OpenedPorts",
"returns",
"this",
"machine",
"ports",
"document",
"for",
"the",
"given",
"subnetID",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L385-L391 |
155,717 | juju/juju | state/ports.go | removeOps | func (p *Ports) removeOps() []txn.Op {
return []txn.Op{{
C: openedPortsC,
Id: p.doc.DocID,
Assert: txn.DocExists,
Remove: true,
}}
} | go | func (p *Ports) removeOps() []txn.Op {
return []txn.Op{{
C: openedPortsC,
Id: p.doc.DocID,
Assert: txn.DocExists,
Remove: true,
}}
} | [
"func",
"(",
"p",
"*",
"Ports",
")",
"removeOps",
"(",
")",
"[",
"]",
"txn",
".",
"Op",
"{",
"return",
"[",
"]",
"txn",
".",
"Op",
"{",
"{",
"C",
":",
"openedPortsC",
",",
"Id",
":",
"p",
".",
"doc",
".",
"DocID",
",",
"Assert",
":",
"txn",
... | // removeOps returns the ops for removing the ports document from
// state. | [
"removeOps",
"returns",
"the",
"ops",
"for",
"removing",
"the",
"ports",
"document",
"from",
"state",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L481-L488 |
155,718 | juju/juju | state/ports.go | removePortsForUnitOps | func removePortsForUnitOps(st *State, unit *Unit) ([]txn.Op, error) {
machineId, err := unit.AssignedMachineId()
if err != nil {
// No assigned machine, so there won't be any ports.
return nil, nil
}
machine, err := st.Machine(machineId)
if errors.IsNotFound(err) {
// Machine is removed, so there won't be a ... | go | func removePortsForUnitOps(st *State, unit *Unit) ([]txn.Op, error) {
machineId, err := unit.AssignedMachineId()
if err != nil {
// No assigned machine, so there won't be any ports.
return nil, nil
}
machine, err := st.Machine(machineId)
if errors.IsNotFound(err) {
// Machine is removed, so there won't be a ... | [
"func",
"removePortsForUnitOps",
"(",
"st",
"*",
"State",
",",
"unit",
"*",
"Unit",
")",
"(",
"[",
"]",
"txn",
".",
"Op",
",",
"error",
")",
"{",
"machineId",
",",
"err",
":=",
"unit",
".",
"AssignedMachineId",
"(",
")",
"\n",
"if",
"err",
"!=",
"n... | // removePortsForUnitOps returns the ops needed to remove all opened
// ports for the given unit on its assigned machine. | [
"removePortsForUnitOps",
"returns",
"the",
"ops",
"needed",
"to",
"remove",
"all",
"opened",
"ports",
"for",
"the",
"given",
"unit",
"on",
"its",
"assigned",
"machine",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L492-L533 |
155,719 | juju/juju | state/ports.go | getPorts | func getPorts(st *State, machineID, subnetID string) (*Ports, error) {
openedPorts, closer := st.db().GetCollection(openedPortsC)
defer closer()
var doc portsDoc
key := portsGlobalKey(machineID, subnetID)
err := openedPorts.FindId(key).One(&doc)
if err != nil {
doc.MachineID = machineID
doc.SubnetID = subnet... | go | func getPorts(st *State, machineID, subnetID string) (*Ports, error) {
openedPorts, closer := st.db().GetCollection(openedPortsC)
defer closer()
var doc portsDoc
key := portsGlobalKey(machineID, subnetID)
err := openedPorts.FindId(key).One(&doc)
if err != nil {
doc.MachineID = machineID
doc.SubnetID = subnet... | [
"func",
"getPorts",
"(",
"st",
"*",
"State",
",",
"machineID",
",",
"subnetID",
"string",
")",
"(",
"*",
"Ports",
",",
"error",
")",
"{",
"openedPorts",
",",
"closer",
":=",
"st",
".",
"db",
"(",
")",
".",
"GetCollection",
"(",
"openedPortsC",
")",
"... | // getPorts returns the ports document for the specified machine and subnet. | [
"getPorts",
"returns",
"the",
"ports",
"document",
"for",
"the",
"specified",
"machine",
"and",
"subnet",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L536-L554 |
155,720 | juju/juju | state/ports.go | getOrCreatePorts | func getOrCreatePorts(st *State, machineID, subnetID string) (*Ports, error) {
ports, err := getPorts(st, machineID, subnetID)
if errors.IsNotFound(err) {
key := portsGlobalKey(machineID, subnetID)
doc := portsDoc{
DocID: st.docID(key),
MachineID: machineID,
SubnetID: subnetID,
ModelUUID: st.Mode... | go | func getOrCreatePorts(st *State, machineID, subnetID string) (*Ports, error) {
ports, err := getPorts(st, machineID, subnetID)
if errors.IsNotFound(err) {
key := portsGlobalKey(machineID, subnetID)
doc := portsDoc{
DocID: st.docID(key),
MachineID: machineID,
SubnetID: subnetID,
ModelUUID: st.Mode... | [
"func",
"getOrCreatePorts",
"(",
"st",
"*",
"State",
",",
"machineID",
",",
"subnetID",
"string",
")",
"(",
"*",
"Ports",
",",
"error",
")",
"{",
"ports",
",",
"err",
":=",
"getPorts",
"(",
"st",
",",
"machineID",
",",
"subnetID",
")",
"\n",
"if",
"e... | // getOrCreatePorts attempts to retrieve a ports document and returns a newly
// created one if it does not exist. | [
"getOrCreatePorts",
"attempts",
"to",
"retrieve",
"a",
"ports",
"document",
"and",
"returns",
"a",
"newly",
"created",
"one",
"if",
"it",
"does",
"not",
"exist",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/ports.go#L558-L573 |
155,721 | juju/juju | cmd/juju/space/list.go | printTabular | func (c *ListCommand) printTabular(writer io.Writer, value interface{}) error {
tw := output.TabWriter(writer)
if c.Short {
list, ok := value.(formattedShortList)
if !ok {
return errors.New("unexpected value")
}
fmt.Fprintln(tw, "Space")
spaces := list.Spaces
sort.Strings(spaces)
for _, space := rang... | go | func (c *ListCommand) printTabular(writer io.Writer, value interface{}) error {
tw := output.TabWriter(writer)
if c.Short {
list, ok := value.(formattedShortList)
if !ok {
return errors.New("unexpected value")
}
fmt.Fprintln(tw, "Space")
spaces := list.Spaces
sort.Strings(spaces)
for _, space := rang... | [
"func",
"(",
"c",
"*",
"ListCommand",
")",
"printTabular",
"(",
"writer",
"io",
".",
"Writer",
",",
"value",
"interface",
"{",
"}",
")",
"error",
"{",
"tw",
":=",
"output",
".",
"TabWriter",
"(",
"writer",
")",
"\n",
"if",
"c",
".",
"Short",
"{",
"... | // printTabular prints the list of spaces in tabular format | [
"printTabular",
"prints",
"the",
"list",
"of",
"spaces",
"in",
"tabular",
"format"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/space/list.go#L145-L189 |
155,722 | juju/juju | worker/raft/rafttransport/handler.go | NewHandler | func NewHandler(
connections chan<- net.Conn,
abort <-chan struct{},
) *Handler {
return &Handler{
connections: connections,
abort: abort,
}
} | go | func NewHandler(
connections chan<- net.Conn,
abort <-chan struct{},
) *Handler {
return &Handler{
connections: connections,
abort: abort,
}
} | [
"func",
"NewHandler",
"(",
"connections",
"chan",
"<-",
"net",
".",
"Conn",
",",
"abort",
"<-",
"chan",
"struct",
"{",
"}",
",",
")",
"*",
"Handler",
"{",
"return",
"&",
"Handler",
"{",
"connections",
":",
"connections",
",",
"abort",
":",
"abort",
","... | // NewHandler returns a new Handler that sends connections to the
// given connections channel, and stops accepting connections after
// the abort channel is closed. | [
"NewHandler",
"returns",
"a",
"new",
"Handler",
"that",
"sends",
"connections",
"to",
"the",
"given",
"connections",
"channel",
"and",
"stops",
"accepting",
"connections",
"after",
"the",
"abort",
"channel",
"is",
"closed",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/raft/rafttransport/handler.go#L22-L30 |
155,723 | juju/juju | juju/osenv/vars.go | FeatureFlags | func FeatureFlags() map[string]string {
result := make(map[string]string)
if envVar := featureflag.AsEnvironmentValue(); envVar != "" {
result[JujuFeatureFlagEnvKey] = envVar
}
return result
} | go | func FeatureFlags() map[string]string {
result := make(map[string]string)
if envVar := featureflag.AsEnvironmentValue(); envVar != "" {
result[JujuFeatureFlagEnvKey] = envVar
}
return result
} | [
"func",
"FeatureFlags",
"(",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"result",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"if",
"envVar",
":=",
"featureflag",
".",
"AsEnvironmentValue",
"(",
")",
";",
"envVar",
"!=",
"\""... | // FeatureFlags returns a map that can be merged with os.Environ. | [
"FeatureFlags",
"returns",
"a",
"map",
"that",
"can",
"be",
"merged",
"with",
"os",
".",
"Environ",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/juju/osenv/vars.go#L53-L59 |
155,724 | juju/juju | juju/osenv/vars.go | MergeEnvironment | func MergeEnvironment(current, newValues map[string]string) map[string]string {
if current == nil {
current = make(map[string]string)
}
if runtime.GOOS == "windows" {
return mergeEnvWin(current, newValues)
}
return mergeEnvUnix(current, newValues)
} | go | func MergeEnvironment(current, newValues map[string]string) map[string]string {
if current == nil {
current = make(map[string]string)
}
if runtime.GOOS == "windows" {
return mergeEnvWin(current, newValues)
}
return mergeEnvUnix(current, newValues)
} | [
"func",
"MergeEnvironment",
"(",
"current",
",",
"newValues",
"map",
"[",
"string",
"]",
"string",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"if",
"current",
"==",
"nil",
"{",
"current",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
... | // MergeEnvironment will return the current environment updated with
// all the values from newValues. If current is nil, a new map is
// created. If current is not nil, it is mutated. | [
"MergeEnvironment",
"will",
"return",
"the",
"current",
"environment",
"updated",
"with",
"all",
"the",
"values",
"from",
"newValues",
".",
"If",
"current",
"is",
"nil",
"a",
"new",
"map",
"is",
"created",
".",
"If",
"current",
"is",
"not",
"nil",
"it",
"i... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/juju/osenv/vars.go#L64-L72 |
155,725 | juju/juju | juju/osenv/vars.go | mergeEnvUnix | func mergeEnvUnix(current, newValues map[string]string) map[string]string {
for key, value := range newValues {
current[key] = value
}
return current
} | go | func mergeEnvUnix(current, newValues map[string]string) map[string]string {
for key, value := range newValues {
current[key] = value
}
return current
} | [
"func",
"mergeEnvUnix",
"(",
"current",
",",
"newValues",
"map",
"[",
"string",
"]",
"string",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"for",
"key",
",",
"value",
":=",
"range",
"newValues",
"{",
"current",
"[",
"key",
"]",
"=",
"value",
"\n",
... | // mergeEnvUnix merges the two evironment variable lists in a case sensitive way. | [
"mergeEnvUnix",
"merges",
"the",
"two",
"evironment",
"variable",
"lists",
"in",
"a",
"case",
"sensitive",
"way",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/juju/osenv/vars.go#L75-L80 |
155,726 | juju/juju | juju/osenv/vars.go | mergeEnvWin | func mergeEnvWin(current, newValues map[string]string) map[string]string {
uppers := make(map[string]string, len(current))
news := map[string]string{}
for k, v := range current {
uppers[strings.ToUpper(k)] = v
}
for k, v := range newValues {
up := strings.ToUpper(k)
if _, ok := uppers[up]; ok {
uppers[up... | go | func mergeEnvWin(current, newValues map[string]string) map[string]string {
uppers := make(map[string]string, len(current))
news := map[string]string{}
for k, v := range current {
uppers[strings.ToUpper(k)] = v
}
for k, v := range newValues {
up := strings.ToUpper(k)
if _, ok := uppers[up]; ok {
uppers[up... | [
"func",
"mergeEnvWin",
"(",
"current",
",",
"newValues",
"map",
"[",
"string",
"]",
"string",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"uppers",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"len",
"(",
"current",
")",
")",
"\n",... | // mergeEnvWin merges the two environment variable lists in a case insensitive,
// but case preserving way. Thus, if FOO=bar is set, and newValues has foo=baz,
// then the resultant map will contain FOO=baz. | [
"mergeEnvWin",
"merges",
"the",
"two",
"environment",
"variable",
"lists",
"in",
"a",
"case",
"insensitive",
"but",
"case",
"preserving",
"way",
".",
"Thus",
"if",
"FOO",
"=",
"bar",
"is",
"set",
"and",
"newValues",
"has",
"foo",
"=",
"baz",
"then",
"the",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/juju/osenv/vars.go#L85-L108 |
155,727 | juju/juju | apiserver/common/storagecommon/blockdevices.go | BlockDeviceFromState | func BlockDeviceFromState(in state.BlockDeviceInfo) storage.BlockDevice {
return storage.BlockDevice{
in.DeviceName,
in.DeviceLinks,
in.Label,
in.UUID,
in.HardwareId,
in.WWN,
in.BusAddress,
in.Size,
in.FilesystemType,
in.InUse,
in.MountPoint,
}
} | go | func BlockDeviceFromState(in state.BlockDeviceInfo) storage.BlockDevice {
return storage.BlockDevice{
in.DeviceName,
in.DeviceLinks,
in.Label,
in.UUID,
in.HardwareId,
in.WWN,
in.BusAddress,
in.Size,
in.FilesystemType,
in.InUse,
in.MountPoint,
}
} | [
"func",
"BlockDeviceFromState",
"(",
"in",
"state",
".",
"BlockDeviceInfo",
")",
"storage",
".",
"BlockDevice",
"{",
"return",
"storage",
".",
"BlockDevice",
"{",
"in",
".",
"DeviceName",
",",
"in",
".",
"DeviceLinks",
",",
"in",
".",
"Label",
",",
"in",
"... | // BlockDeviceFromState translates a state.BlockDeviceInfo to a
// storage.BlockDevice. | [
"BlockDeviceFromState",
"translates",
"a",
"state",
".",
"BlockDeviceInfo",
"to",
"a",
"storage",
".",
"BlockDevice",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/storagecommon/blockdevices.go#L17-L31 |
155,728 | juju/juju | apiserver/common/storagecommon/blockdevices.go | MatchingBlockDevice | func MatchingBlockDevice(
blockDevices []state.BlockDeviceInfo,
volumeInfo state.VolumeInfo,
attachmentInfo state.VolumeAttachmentInfo,
planBlockInfo state.BlockDeviceInfo,
) (*state.BlockDeviceInfo, bool) {
logger.Tracef("looking for block device for volume %#v", volumeInfo)
for _, dev := range blockDevices {
... | go | func MatchingBlockDevice(
blockDevices []state.BlockDeviceInfo,
volumeInfo state.VolumeInfo,
attachmentInfo state.VolumeAttachmentInfo,
planBlockInfo state.BlockDeviceInfo,
) (*state.BlockDeviceInfo, bool) {
logger.Tracef("looking for block device for volume %#v", volumeInfo)
for _, dev := range blockDevices {
... | [
"func",
"MatchingBlockDevice",
"(",
"blockDevices",
"[",
"]",
"state",
".",
"BlockDeviceInfo",
",",
"volumeInfo",
"state",
".",
"VolumeInfo",
",",
"attachmentInfo",
"state",
".",
"VolumeAttachmentInfo",
",",
"planBlockInfo",
"state",
".",
"BlockDeviceInfo",
",",
")"... | // MatchingBlockDevice finds the block device that matches the
// provided volume info and volume attachment info. | [
"MatchingBlockDevice",
"finds",
"the",
"block",
"device",
"that",
"matches",
"the",
"provided",
"volume",
"info",
"and",
"volume",
"attachment",
"info",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/storagecommon/blockdevices.go#L35-L106 |
155,729 | juju/juju | worker/featureflag/flag.go | NewWorker | func NewWorker(config Config) (worker.Worker, error) {
value, err := config.Value()
if err != nil {
return nil, errors.Trace(err)
}
flag := &Worker{
config: config,
value: value,
}
if err := catacomb.Invoke(catacomb.Plan{
Site: &flag.catacomb,
Work: flag.loop,
}); err != nil {
return nil, errors.Tra... | go | func NewWorker(config Config) (worker.Worker, error) {
value, err := config.Value()
if err != nil {
return nil, errors.Trace(err)
}
flag := &Worker{
config: config,
value: value,
}
if err := catacomb.Invoke(catacomb.Plan{
Site: &flag.catacomb,
Work: flag.loop,
}); err != nil {
return nil, errors.Tra... | [
"func",
"NewWorker",
"(",
"config",
"Config",
")",
"(",
"worker",
".",
"Worker",
",",
"error",
")",
"{",
"value",
",",
"err",
":=",
"config",
".",
"Value",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Trace",... | // NewWorker creates a feature flag worker with the specified config. | [
"NewWorker",
"creates",
"a",
"feature",
"flag",
"worker",
"with",
"the",
"specified",
"config",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/featureflag/flag.go#L63-L79 |
155,730 | juju/juju | jujuclient/file.go | generateStoreLockName | func generateStoreLockName() string {
h := sha256.New()
h.Write([]byte(JujuControllersPath()))
fullHash := fmt.Sprintf("%x", h.Sum(nil))
return fmt.Sprintf("store-lock-%x", fullHash[:8])
} | go | func generateStoreLockName() string {
h := sha256.New()
h.Write([]byte(JujuControllersPath()))
fullHash := fmt.Sprintf("%x", h.Sum(nil))
return fmt.Sprintf("store-lock-%x", fullHash[:8])
} | [
"func",
"generateStoreLockName",
"(",
")",
"string",
"{",
"h",
":=",
"sha256",
".",
"New",
"(",
")",
"\n",
"h",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"JujuControllersPath",
"(",
")",
")",
")",
"\n",
"fullHash",
":=",
"fmt",
".",
"Sprintf",
"(",
... | // generateStoreLockName uses part of the hash of the controller path as the
// name of the lock. This is to avoid contention between multiple users on a
// single machine with different controller files, but also helps with
// contention in tests. | [
"generateStoreLockName",
"uses",
"part",
"of",
"the",
"hash",
"of",
"the",
"controller",
"path",
"as",
"the",
"name",
"of",
"the",
"lock",
".",
"This",
"is",
"to",
"avoid",
"contention",
"between",
"multiple",
"users",
"on",
"a",
"single",
"machine",
"with",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/file.go#L63-L68 |
155,731 | juju/juju | jujuclient/file.go | AllControllers | func (s *store) AllControllers() (map[string]ControllerDetails, error) {
releaser, err := s.acquireLock()
if err != nil {
return nil, errors.Annotate(err,
"cannot acquire lock file to read all the controllers",
)
}
defer releaser.Release()
controllers, err := ReadControllersFile(JujuControllersPath())
if e... | go | func (s *store) AllControllers() (map[string]ControllerDetails, error) {
releaser, err := s.acquireLock()
if err != nil {
return nil, errors.Annotate(err,
"cannot acquire lock file to read all the controllers",
)
}
defer releaser.Release()
controllers, err := ReadControllersFile(JujuControllersPath())
if e... | [
"func",
"(",
"s",
"*",
"store",
")",
"AllControllers",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"ControllerDetails",
",",
"error",
")",
"{",
"releaser",
",",
"err",
":=",
"s",
".",
"acquireLock",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ret... | // AllControllers implements ControllersGetter. | [
"AllControllers",
"implements",
"ControllersGetter",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/file.go#L85-L98 |
155,732 | juju/juju | jujuclient/file.go | CurrentController | func (s *store) CurrentController() (string, error) {
releaser, err := s.acquireLock()
if err != nil {
return "", errors.Annotate(err,
"cannot acquire lock file to get the current controller name",
)
}
defer releaser.Release()
controllers, err := ReadControllersFile(JujuControllersPath())
if err != nil {
... | go | func (s *store) CurrentController() (string, error) {
releaser, err := s.acquireLock()
if err != nil {
return "", errors.Annotate(err,
"cannot acquire lock file to get the current controller name",
)
}
defer releaser.Release()
controllers, err := ReadControllersFile(JujuControllersPath())
if err != nil {
... | [
"func",
"(",
"s",
"*",
"store",
")",
"CurrentController",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"releaser",
",",
"err",
":=",
"s",
".",
"acquireLock",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
... | // CurrentController implements ControllersGetter. | [
"CurrentController",
"implements",
"ControllersGetter",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/file.go#L101-L117 |
155,733 | juju/juju | jujuclient/file.go | ControllerByName | func (s *store) ControllerByName(name string) (*ControllerDetails, error) {
if err := ValidateControllerName(name); err != nil {
return nil, errors.Trace(err)
}
releaser, err := s.acquireLock()
if err != nil {
return nil, errors.Annotatef(err,
"cannot acquire lock file to read controller %s", name,
)
}
... | go | func (s *store) ControllerByName(name string) (*ControllerDetails, error) {
if err := ValidateControllerName(name); err != nil {
return nil, errors.Trace(err)
}
releaser, err := s.acquireLock()
if err != nil {
return nil, errors.Annotatef(err,
"cannot acquire lock file to read controller %s", name,
)
}
... | [
"func",
"(",
"s",
"*",
"store",
")",
"ControllerByName",
"(",
"name",
"string",
")",
"(",
"*",
"ControllerDetails",
",",
"error",
")",
"{",
"if",
"err",
":=",
"ValidateControllerName",
"(",
"name",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",... | // ControllerByName implements ControllersGetter. | [
"ControllerByName",
"implements",
"ControllersGetter",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/file.go#L120-L141 |
155,734 | juju/juju | jujuclient/file.go | ControllerByAPIEndpoints | func (s *store) ControllerByAPIEndpoints(endpoints ...string) (*ControllerDetails, string, error) {
releaser, err := s.acquireLock()
if err != nil {
return nil, "", errors.Annotatef(err, "cannot acquire lock file to read controllers")
}
defer releaser.Release()
controllers, err := ReadControllersFile(JujuContro... | go | func (s *store) ControllerByAPIEndpoints(endpoints ...string) (*ControllerDetails, string, error) {
releaser, err := s.acquireLock()
if err != nil {
return nil, "", errors.Annotatef(err, "cannot acquire lock file to read controllers")
}
defer releaser.Release()
controllers, err := ReadControllersFile(JujuContro... | [
"func",
"(",
"s",
"*",
"store",
")",
"ControllerByAPIEndpoints",
"(",
"endpoints",
"...",
"string",
")",
"(",
"*",
"ControllerDetails",
",",
"string",
",",
"error",
")",
"{",
"releaser",
",",
"err",
":=",
"s",
".",
"acquireLock",
"(",
")",
"\n",
"if",
... | // ControllerByEndpoints implements ControllersGetter. | [
"ControllerByEndpoints",
"implements",
"ControllersGetter",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/file.go#L144-L165 |
155,735 | juju/juju | jujuclient/file.go | UpdateController | func (s *store) UpdateController(name string, details ControllerDetails) error {
if err := ValidateControllerName(name); err != nil {
return errors.Trace(err)
}
if err := ValidateControllerDetails(details); err != nil {
return errors.Trace(err)
}
releaser, err := s.acquireLock()
if err != nil {
return erro... | go | func (s *store) UpdateController(name string, details ControllerDetails) error {
if err := ValidateControllerName(name); err != nil {
return errors.Trace(err)
}
if err := ValidateControllerDetails(details); err != nil {
return errors.Trace(err)
}
releaser, err := s.acquireLock()
if err != nil {
return erro... | [
"func",
"(",
"s",
"*",
"store",
")",
"UpdateController",
"(",
"name",
"string",
",",
"details",
"ControllerDetails",
")",
"error",
"{",
"if",
"err",
":=",
"ValidateControllerName",
"(",
"name",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
... | // UpdateController implements ControllerUpdater. | [
"UpdateController",
"implements",
"ControllerUpdater",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/file.go#L209-L247 |
155,736 | juju/juju | jujuclient/file.go | SetCurrentController | func (s *store) SetCurrentController(name string) error {
if err := ValidateControllerName(name); err != nil {
return errors.Trace(err)
}
releaser, err := s.acquireLock()
if err != nil {
return errors.Annotate(err,
"cannot acquire lock file to set the current controller name",
)
}
defer releaser.Release... | go | func (s *store) SetCurrentController(name string) error {
if err := ValidateControllerName(name); err != nil {
return errors.Trace(err)
}
releaser, err := s.acquireLock()
if err != nil {
return errors.Annotate(err,
"cannot acquire lock file to set the current controller name",
)
}
defer releaser.Release... | [
"func",
"(",
"s",
"*",
"store",
")",
"SetCurrentController",
"(",
"name",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"ValidateControllerName",
"(",
"name",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Trace",
"(",
"err",
")",
"\n",... | // SetCurrentController implements ControllerUpdater. | [
"SetCurrentController",
"implements",
"ControllerUpdater",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/file.go#L250-L275 |
155,737 | juju/juju | jujuclient/file.go | RemoveController | func (s *store) RemoveController(name string) error {
if err := ValidateControllerName(name); err != nil {
return errors.Trace(err)
}
releaser, err := s.acquireLock()
if err != nil {
return errors.Annotatef(err,
"cannot acquire lock file to remove controller %s", name,
)
}
defer releaser.Release()
con... | go | func (s *store) RemoveController(name string) error {
if err := ValidateControllerName(name); err != nil {
return errors.Trace(err)
}
releaser, err := s.acquireLock()
if err != nil {
return errors.Annotatef(err,
"cannot acquire lock file to remove controller %s", name,
)
}
defer releaser.Release()
con... | [
"func",
"(",
"s",
"*",
"store",
")",
"RemoveController",
"(",
"name",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"ValidateControllerName",
"(",
"name",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Trace",
"(",
"err",
")",
"\n",
"... | // RemoveController implements ControllersRemover | [
"RemoveController",
"implements",
"ControllersRemover"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/file.go#L278-L365 |
155,738 | juju/juju | jujuclient/file.go | AllModels | func (s *store) AllModels(controllerName string) (map[string]ModelDetails, error) {
if err := ValidateControllerName(controllerName); err != nil {
return nil, errors.Trace(err)
}
releaser, err := s.acquireLock()
if err != nil {
return nil, errors.Annotatef(err,
"cannot acquire lock file for getting all mode... | go | func (s *store) AllModels(controllerName string) (map[string]ModelDetails, error) {
if err := ValidateControllerName(controllerName); err != nil {
return nil, errors.Trace(err)
}
releaser, err := s.acquireLock()
if err != nil {
return nil, errors.Annotatef(err,
"cannot acquire lock file for getting all mode... | [
"func",
"(",
"s",
"*",
"store",
")",
"AllModels",
"(",
"controllerName",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"ModelDetails",
",",
"error",
")",
"{",
"if",
"err",
":=",
"ValidateControllerName",
"(",
"controllerName",
")",
";",
"err",
"!=",
"ni... | // AllModels implements ModelGetter. | [
"AllModels",
"implements",
"ModelGetter",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/file.go#L447-L472 |
155,739 | juju/juju | jujuclient/file.go | AccountDetails | func (s *store) AccountDetails(controllerName string) (*AccountDetails, error) {
if err := ValidateControllerName(controllerName); err != nil {
return nil, errors.Trace(err)
}
releaser, err := s.acquireLock()
if err != nil {
return nil, errors.Annotatef(err,
"cannot acquire lock file for getting an account ... | go | func (s *store) AccountDetails(controllerName string) (*AccountDetails, error) {
if err := ValidateControllerName(controllerName); err != nil {
return nil, errors.Trace(err)
}
releaser, err := s.acquireLock()
if err != nil {
return nil, errors.Annotatef(err,
"cannot acquire lock file for getting an account ... | [
"func",
"(",
"s",
"*",
"store",
")",
"AccountDetails",
"(",
"controllerName",
"string",
")",
"(",
"*",
"AccountDetails",
",",
"error",
")",
"{",
"if",
"err",
":=",
"ValidateControllerName",
"(",
"controllerName",
")",
";",
"err",
"!=",
"nil",
"{",
"return"... | // AccountByName implements AccountGetter. | [
"AccountByName",
"implements",
"AccountGetter",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/file.go#L699-L721 |
155,740 | juju/juju | jujuclient/file.go | UpdateCredential | func (s *store) UpdateCredential(cloudName string, details cloud.CloudCredential) error {
releaser, err := s.acquireLock()
if err != nil {
return errors.Annotatef(err,
"cannot acquire lock file for updating credentials for %s", cloudName,
)
}
defer releaser.Release()
all, err := ReadCredentialsFile(JujuCre... | go | func (s *store) UpdateCredential(cloudName string, details cloud.CloudCredential) error {
releaser, err := s.acquireLock()
if err != nil {
return errors.Annotatef(err,
"cannot acquire lock file for updating credentials for %s", cloudName,
)
}
defer releaser.Release()
all, err := ReadCredentialsFile(JujuCre... | [
"func",
"(",
"s",
"*",
"store",
")",
"UpdateCredential",
"(",
"cloudName",
"string",
",",
"details",
"cloud",
".",
"CloudCredential",
")",
"error",
"{",
"releaser",
",",
"err",
":=",
"s",
".",
"acquireLock",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{... | // UpdateCredential implements CredentialUpdater. | [
"UpdateCredential",
"implements",
"CredentialUpdater",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/file.go#L750-L788 |
155,741 | juju/juju | jujuclient/file.go | CredentialForCloud | func (s *store) CredentialForCloud(cloudName string) (*cloud.CloudCredential, error) {
cloudCredentials, err := s.AllCredentials()
if err != nil {
return nil, errors.Trace(err)
}
credentials, ok := cloudCredentials[cloudName]
if !ok {
return nil, errors.NotFoundf("credentials for cloud %s", cloudName)
}
retu... | go | func (s *store) CredentialForCloud(cloudName string) (*cloud.CloudCredential, error) {
cloudCredentials, err := s.AllCredentials()
if err != nil {
return nil, errors.Trace(err)
}
credentials, ok := cloudCredentials[cloudName]
if !ok {
return nil, errors.NotFoundf("credentials for cloud %s", cloudName)
}
retu... | [
"func",
"(",
"s",
"*",
"store",
")",
"CredentialForCloud",
"(",
"cloudName",
"string",
")",
"(",
"*",
"cloud",
".",
"CloudCredential",
",",
"error",
")",
"{",
"cloudCredentials",
",",
"err",
":=",
"s",
".",
"AllCredentials",
"(",
")",
"\n",
"if",
"err",
... | // CredentialForCloud implements CredentialGetter. | [
"CredentialForCloud",
"implements",
"CredentialGetter",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/file.go#L791-L801 |
155,742 | juju/juju | jujuclient/file.go | AllCredentials | func (s *store) AllCredentials() (map[string]cloud.CloudCredential, error) {
cloudCredentials, err := ReadCredentialsFile(JujuCredentialsPath())
if err != nil {
return nil, errors.Trace(err)
}
return cloudCredentials, nil
} | go | func (s *store) AllCredentials() (map[string]cloud.CloudCredential, error) {
cloudCredentials, err := ReadCredentialsFile(JujuCredentialsPath())
if err != nil {
return nil, errors.Trace(err)
}
return cloudCredentials, nil
} | [
"func",
"(",
"s",
"*",
"store",
")",
"AllCredentials",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"cloud",
".",
"CloudCredential",
",",
"error",
")",
"{",
"cloudCredentials",
",",
"err",
":=",
"ReadCredentialsFile",
"(",
"JujuCredentialsPath",
"(",
")",
")"... | // AllCredentials implements CredentialGetter. | [
"AllCredentials",
"implements",
"CredentialGetter",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/file.go#L804-L810 |
155,743 | juju/juju | jujuclient/file.go | CookieJar | func (s *store) CookieJar(controllerName string) (CookieJar, error) {
if err := ValidateControllerName(controllerName); err != nil {
return nil, errors.Trace(err)
}
path := JujuCookiePath(controllerName)
jar, err := cookiejar.New(&cookiejar.Options{
Filename: path,
})
if err != nil {
return nil, errors.Trac... | go | func (s *store) CookieJar(controllerName string) (CookieJar, error) {
if err := ValidateControllerName(controllerName); err != nil {
return nil, errors.Trace(err)
}
path := JujuCookiePath(controllerName)
jar, err := cookiejar.New(&cookiejar.Options{
Filename: path,
})
if err != nil {
return nil, errors.Trac... | [
"func",
"(",
"s",
"*",
"store",
")",
"CookieJar",
"(",
"controllerName",
"string",
")",
"(",
"CookieJar",
",",
"error",
")",
"{",
"if",
"err",
":=",
"ValidateControllerName",
"(",
"controllerName",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",... | // CookieJar returns the cookie jar associated with the given controller. | [
"CookieJar",
"returns",
"the",
"cookie",
"jar",
"associated",
"with",
"the",
"given",
"controller",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/file.go#L855-L870 |
155,744 | juju/juju | cmd/juju/commands/scp.go | Run | func (c *scpCommand) Run(ctx *cmd.Context) error {
err := c.initRun()
if err != nil {
return errors.Trace(err)
}
defer c.cleanupRun()
args, targets, err := expandArgs(c.Args, c.resolveTarget)
if err != nil {
return err
}
options, err := c.getSSHOptions(false, targets...)
if err != nil {
return err
}
... | go | func (c *scpCommand) Run(ctx *cmd.Context) error {
err := c.initRun()
if err != nil {
return errors.Trace(err)
}
defer c.cleanupRun()
args, targets, err := expandArgs(c.Args, c.resolveTarget)
if err != nil {
return err
}
options, err := c.getSSHOptions(false, targets...)
if err != nil {
return err
}
... | [
"func",
"(",
"c",
"*",
"scpCommand",
")",
"Run",
"(",
"ctx",
"*",
"cmd",
".",
"Context",
")",
"error",
"{",
"err",
":=",
"c",
".",
"initRun",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Trace",
"(",
"err",
")",
"\n"... | // Run resolves c.Target to a machine, or host of a unit and
// forks ssh with c.Args, if provided. | [
"Run",
"resolves",
"c",
".",
"Target",
"to",
"a",
"machine",
"or",
"host",
"of",
"a",
"unit",
"and",
"forks",
"ssh",
"with",
"c",
".",
"Args",
"if",
"provided",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/scp.go#L107-L125 |
155,745 | juju/juju | provider/lxd/environ.go | Config | func (env *environ) Config() *config.Config {
env.lock.Lock()
defer env.lock.Unlock()
cfg := env.ecfgUnlocked.Config
return cfg
} | go | func (env *environ) Config() *config.Config {
env.lock.Lock()
defer env.lock.Unlock()
cfg := env.ecfgUnlocked.Config
return cfg
} | [
"func",
"(",
"env",
"*",
"environ",
")",
"Config",
"(",
")",
"*",
"config",
".",
"Config",
"{",
"env",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"env",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"cfg",
":=",
"env",
".",
"ecfgUnlocked"... | // Config returns the configuration data with which the env was created. | [
"Config",
"returns",
"the",
"configuration",
"data",
"with",
"which",
"the",
"env",
"was",
"created",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/lxd/environ.go#L152-L158 |
155,746 | juju/juju | provider/lxd/environ.go | LXDProfileNames | func (env *environ) LXDProfileNames(containerName string) ([]string, error) {
return env.server().GetContainerProfiles(containerName)
} | go | func (env *environ) LXDProfileNames(containerName string) ([]string, error) {
return env.server().GetContainerProfiles(containerName)
} | [
"func",
"(",
"env",
"*",
"environ",
")",
"LXDProfileNames",
"(",
"containerName",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"return",
"env",
".",
"server",
"(",
")",
".",
"GetContainerProfiles",
"(",
"containerName",
")",
"\n",
"}"
... | // LXDProfileNames implements environs.LXDProfiler. | [
"LXDProfileNames",
"implements",
"environs",
".",
"LXDProfiler",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/lxd/environ.go#L355-L357 |
155,747 | juju/juju | apiserver/facades/client/backups/shim.go | MachineSeries | func (s *stateShim) MachineSeries(id string) (string, error) {
m, err := s.State.Machine(id)
if err != nil {
return "", errors.Trace(err)
}
return m.Series(), nil
} | go | func (s *stateShim) MachineSeries(id string) (string, error) {
m, err := s.State.Machine(id)
if err != nil {
return "", errors.Trace(err)
}
return m.Series(), nil
} | [
"func",
"(",
"s",
"*",
"stateShim",
")",
"MachineSeries",
"(",
"id",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"m",
",",
"err",
":=",
"s",
".",
"State",
".",
"Machine",
"(",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | // MachineSeries implements backups.Backend | [
"MachineSeries",
"implements",
"backups",
".",
"Backend"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/backups/shim.go#L27-L33 |
155,748 | juju/juju | apiserver/facades/client/backups/shim.go | NewFacadeV2 | func NewFacadeV2(st *state.State, resources facade.Resources, authorizer facade.Authorizer) (*APIv2, error) {
model, err := st.Model()
if err != nil {
return nil, errors.Trace(err)
}
return NewAPIv2(&stateShim{st, model}, resources, authorizer)
} | go | func NewFacadeV2(st *state.State, resources facade.Resources, authorizer facade.Authorizer) (*APIv2, error) {
model, err := st.Model()
if err != nil {
return nil, errors.Trace(err)
}
return NewAPIv2(&stateShim{st, model}, resources, authorizer)
} | [
"func",
"NewFacadeV2",
"(",
"st",
"*",
"state",
".",
"State",
",",
"resources",
"facade",
".",
"Resources",
",",
"authorizer",
"facade",
".",
"Authorizer",
")",
"(",
"*",
"APIv2",
",",
"error",
")",
"{",
"model",
",",
"err",
":=",
"st",
".",
"Model",
... | // NewFacadeV2 provides the required signature for version 2 facade registration. | [
"NewFacadeV2",
"provides",
"the",
"required",
"signature",
"for",
"version",
"2",
"facade",
"registration",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/backups/shim.go#L36-L42 |
155,749 | juju/juju | state/cloudservice.go | CloudService | func (c *CloudService) CloudService() (*CloudService, error) {
doc, err := c.cloudServiceDoc()
if err != nil {
return nil, errors.Trace(err)
}
if doc == nil {
return nil, errors.NotFoundf("cloud service %v", c.Id())
}
c.doc = *doc
return c, nil
} | go | func (c *CloudService) CloudService() (*CloudService, error) {
doc, err := c.cloudServiceDoc()
if err != nil {
return nil, errors.Trace(err)
}
if doc == nil {
return nil, errors.NotFoundf("cloud service %v", c.Id())
}
c.doc = *doc
return c, nil
} | [
"func",
"(",
"c",
"*",
"CloudService",
")",
"CloudService",
"(",
")",
"(",
"*",
"CloudService",
",",
"error",
")",
"{",
"doc",
",",
"err",
":=",
"c",
".",
"cloudServiceDoc",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"erro... | // CloudService return the content of cloud service from the underlying state.
// It returns an error that satisfies errors.IsNotFound if the cloud service has been removed. | [
"CloudService",
"return",
"the",
"content",
"of",
"cloud",
"service",
"from",
"the",
"underlying",
"state",
".",
"It",
"returns",
"an",
"error",
"that",
"satisfies",
"errors",
".",
"IsNotFound",
"if",
"the",
"cloud",
"service",
"has",
"been",
"removed",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/cloudservice.go#L78-L88 |
155,750 | juju/juju | state/cloudservice.go | Refresh | func (c *CloudService) Refresh() error {
_, err := c.CloudService()
return errors.Trace(err)
} | go | func (c *CloudService) Refresh() error {
_, err := c.CloudService()
return errors.Trace(err)
} | [
"func",
"(",
"c",
"*",
"CloudService",
")",
"Refresh",
"(",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"CloudService",
"(",
")",
"\n",
"return",
"errors",
".",
"Trace",
"(",
"err",
")",
"\n",
"}"
] | // Refresh refreshes the content of cloud service from the underlying state.
// It returns an error that satisfies errors.IsNotFound if the cloud service has been removed. | [
"Refresh",
"refreshes",
"the",
"content",
"of",
"cloud",
"service",
"from",
"the",
"underlying",
"state",
".",
"It",
"returns",
"an",
"error",
"that",
"satisfies",
"errors",
".",
"IsNotFound",
"if",
"the",
"cloud",
"service",
"has",
"been",
"removed",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/cloudservice.go#L92-L95 |
155,751 | juju/juju | cmd/juju/machine/mocks/upgradeMachineSeriesAPI_mock.go | NewMockUpgradeMachineSeriesAPI | func NewMockUpgradeMachineSeriesAPI(ctrl *gomock.Controller) *MockUpgradeMachineSeriesAPI {
mock := &MockUpgradeMachineSeriesAPI{ctrl: ctrl}
mock.recorder = &MockUpgradeMachineSeriesAPIMockRecorder{mock}
return mock
} | go | func NewMockUpgradeMachineSeriesAPI(ctrl *gomock.Controller) *MockUpgradeMachineSeriesAPI {
mock := &MockUpgradeMachineSeriesAPI{ctrl: ctrl}
mock.recorder = &MockUpgradeMachineSeriesAPIMockRecorder{mock}
return mock
} | [
"func",
"NewMockUpgradeMachineSeriesAPI",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockUpgradeMachineSeriesAPI",
"{",
"mock",
":=",
"&",
"MockUpgradeMachineSeriesAPI",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"Mock... | // NewMockUpgradeMachineSeriesAPI creates a new mock instance | [
"NewMockUpgradeMachineSeriesAPI",
"creates",
"a",
"new",
"mock",
"instance"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/machine/mocks/upgradeMachineSeriesAPI_mock.go#L26-L30 |
155,752 | juju/juju | cmd/juju/machine/mocks/upgradeMachineSeriesAPI_mock.go | BestAPIVersion | func (m *MockUpgradeMachineSeriesAPI) BestAPIVersion() int {
ret := m.ctrl.Call(m, "BestAPIVersion")
ret0, _ := ret[0].(int)
return ret0
} | go | func (m *MockUpgradeMachineSeriesAPI) BestAPIVersion() int {
ret := m.ctrl.Call(m, "BestAPIVersion")
ret0, _ := ret[0].(int)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockUpgradeMachineSeriesAPI",
")",
"BestAPIVersion",
"(",
")",
"int",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"int",
... | // BestAPIVersion mocks base method | [
"BestAPIVersion",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/machine/mocks/upgradeMachineSeriesAPI_mock.go#L38-L42 |
155,753 | juju/juju | cmd/juju/machine/mocks/upgradeMachineSeriesAPI_mock.go | GetUpgradeSeriesMessages | func (mr *MockUpgradeMachineSeriesAPIMockRecorder) GetUpgradeSeriesMessages(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUpgradeSeriesMessages", reflect.TypeOf((*MockUpgradeMachineSeriesAPI)(nil).GetUpgradeSeriesMessages), arg0, arg1)
} | go | func (mr *MockUpgradeMachineSeriesAPIMockRecorder) GetUpgradeSeriesMessages(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUpgradeSeriesMessages", reflect.TypeOf((*MockUpgradeMachineSeriesAPI)(nil).GetUpgradeSeriesMessages), arg0, arg1)
} | [
"func",
"(",
"mr",
"*",
"MockUpgradeMachineSeriesAPIMockRecorder",
")",
"GetUpgradeSeriesMessages",
"(",
"arg0",
",",
"arg1",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
... | // GetUpgradeSeriesMessages indicates an expected call of GetUpgradeSeriesMessages | [
"GetUpgradeSeriesMessages",
"indicates",
"an",
"expected",
"call",
"of",
"GetUpgradeSeriesMessages"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/machine/mocks/upgradeMachineSeriesAPI_mock.go#L70-L72 |
155,754 | juju/juju | cmd/juju/machine/mocks/upgradeMachineSeriesAPI_mock.go | UpgradeSeriesComplete | func (m *MockUpgradeMachineSeriesAPI) UpgradeSeriesComplete(arg0 string) error {
ret := m.ctrl.Call(m, "UpgradeSeriesComplete", arg0)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockUpgradeMachineSeriesAPI) UpgradeSeriesComplete(arg0 string) error {
ret := m.ctrl.Call(m, "UpgradeSeriesComplete", arg0)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockUpgradeMachineSeriesAPI",
")",
"UpgradeSeriesComplete",
"(",
"arg0",
"string",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret"... | // UpgradeSeriesComplete mocks base method | [
"UpgradeSeriesComplete",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/machine/mocks/upgradeMachineSeriesAPI_mock.go#L75-L79 |
155,755 | juju/juju | cmd/juju/machine/mocks/upgradeMachineSeriesAPI_mock.go | UpgradeSeriesPrepare | func (m *MockUpgradeMachineSeriesAPI) UpgradeSeriesPrepare(arg0, arg1 string, arg2 bool) error {
ret := m.ctrl.Call(m, "UpgradeSeriesPrepare", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
} | go | func (m *MockUpgradeMachineSeriesAPI) UpgradeSeriesPrepare(arg0, arg1 string, arg2 bool) error {
ret := m.ctrl.Call(m, "UpgradeSeriesPrepare", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockUpgradeMachineSeriesAPI",
")",
"UpgradeSeriesPrepare",
"(",
"arg0",
",",
"arg1",
"string",
",",
"arg2",
"bool",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"a... | // UpgradeSeriesPrepare mocks base method | [
"UpgradeSeriesPrepare",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/machine/mocks/upgradeMachineSeriesAPI_mock.go#L87-L91 |
155,756 | juju/juju | cmd/juju/machine/mocks/upgradeMachineSeriesAPI_mock.go | UpgradeSeriesValidate | func (m *MockUpgradeMachineSeriesAPI) UpgradeSeriesValidate(arg0, arg1 string) ([]string, error) {
ret := m.ctrl.Call(m, "UpgradeSeriesValidate", arg0, arg1)
ret0, _ := ret[0].([]string)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockUpgradeMachineSeriesAPI) UpgradeSeriesValidate(arg0, arg1 string) ([]string, error) {
ret := m.ctrl.Call(m, "UpgradeSeriesValidate", arg0, arg1)
ret0, _ := ret[0].([]string)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockUpgradeMachineSeriesAPI",
")",
"UpgradeSeriesValidate",
"(",
"arg0",
",",
"arg1",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
... | // UpgradeSeriesValidate mocks base method | [
"UpgradeSeriesValidate",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/machine/mocks/upgradeMachineSeriesAPI_mock.go#L99-L104 |
155,757 | juju/juju | resource/context/utils.go | FingerprintMatches | func (fpm FingerprintMatcher) FingerprintMatches(filename string, expected charmresource.Fingerprint) (bool, error) {
open := fpm.Open
if open == nil {
open = func(filename string) (io.ReadCloser, error) { return os.Open(filename) }
}
generateFingerprint := fpm.GenerateFingerprint
if generateFingerprint == nil {... | go | func (fpm FingerprintMatcher) FingerprintMatches(filename string, expected charmresource.Fingerprint) (bool, error) {
open := fpm.Open
if open == nil {
open = func(filename string) (io.ReadCloser, error) { return os.Open(filename) }
}
generateFingerprint := fpm.GenerateFingerprint
if generateFingerprint == nil {... | [
"func",
"(",
"fpm",
"FingerprintMatcher",
")",
"FingerprintMatches",
"(",
"filename",
"string",
",",
"expected",
"charmresource",
".",
"Fingerprint",
")",
"(",
"bool",
",",
"error",
")",
"{",
"open",
":=",
"fpm",
".",
"Open",
"\n",
"if",
"open",
"==",
"nil... | // FingerprintMatches determines whether or not the identified file's
// fingerprint matches the expected fingerprint. | [
"FingerprintMatches",
"determines",
"whether",
"or",
"not",
"the",
"identified",
"file",
"s",
"fingerprint",
"matches",
"the",
"expected",
"fingerprint",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/context/utils.go#L29-L54 |
155,758 | juju/juju | worker/uniter/operation/runcommands.go | Prepare | func (rc *runCommands) Prepare(state State) (*State, error) {
rnr, err := rc.runnerFactory.NewCommandRunner(context.CommandInfo{
RelationId: rc.args.RelationId,
RemoteUnitName: rc.args.RemoteUnitName,
ForceRemoteUnit: rc.args.ForceRemoteUnit,
})
if err != nil {
return nil, err
}
err = rnr.Context().P... | go | func (rc *runCommands) Prepare(state State) (*State, error) {
rnr, err := rc.runnerFactory.NewCommandRunner(context.CommandInfo{
RelationId: rc.args.RelationId,
RemoteUnitName: rc.args.RemoteUnitName,
ForceRemoteUnit: rc.args.ForceRemoteUnit,
})
if err != nil {
return nil, err
}
err = rnr.Context().P... | [
"func",
"(",
"rc",
"*",
"runCommands",
")",
"Prepare",
"(",
"state",
"State",
")",
"(",
"*",
"State",
",",
"error",
")",
"{",
"rnr",
",",
"err",
":=",
"rc",
".",
"runnerFactory",
".",
"NewCommandRunner",
"(",
"context",
".",
"CommandInfo",
"{",
"Relati... | // Prepare ensures the commands can be run. It never returns a state change.
// Prepare is part of the Operation interface. | [
"Prepare",
"ensures",
"the",
"commands",
"can",
"be",
"run",
".",
"It",
"never",
"returns",
"a",
"state",
"change",
".",
"Prepare",
"is",
"part",
"of",
"the",
"Operation",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/operation/runcommands.go#L42-L58 |
155,759 | juju/juju | worker/uniter/operation/runcommands.go | Execute | func (rc *runCommands) Execute(state State) (*State, error) {
logger.Tracef("run commands: %s", rc)
if err := rc.callbacks.SetExecutingStatus("running commands"); err != nil {
return nil, errors.Trace(err)
}
response, err := rc.runner.RunCommands(rc.args.Commands)
switch err {
case context.ErrRequeueAndReboot:... | go | func (rc *runCommands) Execute(state State) (*State, error) {
logger.Tracef("run commands: %s", rc)
if err := rc.callbacks.SetExecutingStatus("running commands"); err != nil {
return nil, errors.Trace(err)
}
response, err := rc.runner.RunCommands(rc.args.Commands)
switch err {
case context.ErrRequeueAndReboot:... | [
"func",
"(",
"rc",
"*",
"runCommands",
")",
"Execute",
"(",
"state",
"State",
")",
"(",
"*",
"State",
",",
"error",
")",
"{",
"logger",
".",
"Tracef",
"(",
"\"",
"\"",
",",
"rc",
")",
"\n",
"if",
"err",
":=",
"rc",
".",
"callbacks",
".",
"SetExec... | // Execute runs the commands and dispatches their results. It never returns a
// state change.
// Execute is part of the Operation interface. | [
"Execute",
"runs",
"the",
"commands",
"and",
"dispatches",
"their",
"results",
".",
"It",
"never",
"returns",
"a",
"state",
"change",
".",
"Execute",
"is",
"part",
"of",
"the",
"Operation",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/operation/runcommands.go#L63-L81 |
155,760 | juju/juju | jujuclient/validation.go | ValidateModelDetails | func ValidateModelDetails(details ModelDetails) error {
if details.ModelUUID == "" {
return errors.NotValidf("missing uuid, model details")
}
if details.ModelType == "" {
return errors.NotValidf("missing type, model details")
}
return nil
} | go | func ValidateModelDetails(details ModelDetails) error {
if details.ModelUUID == "" {
return errors.NotValidf("missing uuid, model details")
}
if details.ModelType == "" {
return errors.NotValidf("missing type, model details")
}
return nil
} | [
"func",
"ValidateModelDetails",
"(",
"details",
"ModelDetails",
")",
"error",
"{",
"if",
"details",
".",
"ModelUUID",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"NotValidf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"details",
".",
"ModelType",
"... | // ValidateModelDetails ensures that given model details are valid. | [
"ValidateModelDetails",
"ensures",
"that",
"given",
"model",
"details",
"are",
"valid",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/validation.go#L20-L28 |
155,761 | juju/juju | jujuclient/validation.go | ValidateAccountDetails | func ValidateAccountDetails(details AccountDetails) error {
if err := validateUser(details.User); err != nil {
return errors.Trace(err)
}
// It is valid for a password to be blank, because the client
// may use macaroons instead.
return nil
} | go | func ValidateAccountDetails(details AccountDetails) error {
if err := validateUser(details.User); err != nil {
return errors.Trace(err)
}
// It is valid for a password to be blank, because the client
// may use macaroons instead.
return nil
} | [
"func",
"ValidateAccountDetails",
"(",
"details",
"AccountDetails",
")",
"error",
"{",
"if",
"err",
":=",
"validateUser",
"(",
"details",
".",
"User",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Trace",
"(",
"err",
")",
"\n",
"}",
"\n",
... | // ValidateModelDetails ensures that given account details are valid. | [
"ValidateModelDetails",
"ensures",
"that",
"given",
"account",
"details",
"are",
"valid",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/validation.go#L31-L38 |
155,762 | juju/juju | jujuclient/validation.go | ValidateModelName | func ValidateModelName(name string) error {
modelName, _, err := SplitModelName(name)
if err != nil {
return errors.Annotatef(err, "validating model name %q", name)
}
if !names.IsValidModelName(modelName) {
return errors.NotValidf("model name %q", name)
}
return nil
} | go | func ValidateModelName(name string) error {
modelName, _, err := SplitModelName(name)
if err != nil {
return errors.Annotatef(err, "validating model name %q", name)
}
if !names.IsValidModelName(modelName) {
return errors.NotValidf("model name %q", name)
}
return nil
} | [
"func",
"ValidateModelName",
"(",
"name",
"string",
")",
"error",
"{",
"modelName",
",",
"_",
",",
"err",
":=",
"SplitModelName",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Annotatef",
"(",
"err",
",",
"\"",
"\"",
... | // ValidateModelName validates the given model name. | [
"ValidateModelName",
"validates",
"the",
"given",
"model",
"name",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/validation.go#L53-L62 |
155,763 | juju/juju | jujuclient/validation.go | ValidateModel | func ValidateModel(name string, details ModelDetails) error {
if err := ValidateModelName(name); err != nil {
return err
}
if err := ValidateModelDetails(details); err != nil {
return err
}
return nil
} | go | func ValidateModel(name string, details ModelDetails) error {
if err := ValidateModelName(name); err != nil {
return err
}
if err := ValidateModelDetails(details); err != nil {
return err
}
return nil
} | [
"func",
"ValidateModel",
"(",
"name",
"string",
",",
"details",
"ModelDetails",
")",
"error",
"{",
"if",
"err",
":=",
"ValidateModelName",
"(",
"name",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"ValidateModel... | // ValidateModel validates the given model name and details. | [
"ValidateModel",
"validates",
"the",
"given",
"model",
"name",
"and",
"details",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/validation.go#L65-L73 |
155,764 | juju/juju | jujuclient/validation.go | ValidateBootstrapConfig | func ValidateBootstrapConfig(cfg BootstrapConfig) error {
if cfg.Cloud == "" {
return errors.NotValidf("empty cloud name")
}
if cfg.CloudType == "" {
return errors.NotValidf("empty cloud type")
}
if len(cfg.Config) == 0 {
return errors.NotValidf("empty config")
}
return nil
} | go | func ValidateBootstrapConfig(cfg BootstrapConfig) error {
if cfg.Cloud == "" {
return errors.NotValidf("empty cloud name")
}
if cfg.CloudType == "" {
return errors.NotValidf("empty cloud type")
}
if len(cfg.Config) == 0 {
return errors.NotValidf("empty config")
}
return nil
} | [
"func",
"ValidateBootstrapConfig",
"(",
"cfg",
"BootstrapConfig",
")",
"error",
"{",
"if",
"cfg",
".",
"Cloud",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"NotValidf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"cfg",
".",
"CloudType",
"==",
"\"... | // ValidateBootstrapConfig validates the given boostrap config. | [
"ValidateBootstrapConfig",
"validates",
"the",
"given",
"boostrap",
"config",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/validation.go#L76-L87 |
155,765 | juju/juju | provider/lxd/provider.go | NewProvider | func NewProvider() environs.CloudEnvironProvider {
configReader := lxcConfigReader{}
factory := NewServerFactory()
credentials := environProviderCredentials{
certReadWriter: certificateReadWriter{},
certGenerator: certificateGenerator{},
lookup: netLookup{},
serverFactory: factory,
lxcConfigR... | go | func NewProvider() environs.CloudEnvironProvider {
configReader := lxcConfigReader{}
factory := NewServerFactory()
credentials := environProviderCredentials{
certReadWriter: certificateReadWriter{},
certGenerator: certificateGenerator{},
lookup: netLookup{},
serverFactory: factory,
lxcConfigR... | [
"func",
"NewProvider",
"(",
")",
"environs",
".",
"CloudEnvironProvider",
"{",
"configReader",
":=",
"lxcConfigReader",
"{",
"}",
"\n",
"factory",
":=",
"NewServerFactory",
"(",
")",
"\n",
"credentials",
":=",
"environProviderCredentials",
"{",
"certReadWriter",
":"... | // NewProvider returns a new LXD EnvironProvider. | [
"NewProvider",
"returns",
"a",
"new",
"LXD",
"EnvironProvider",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/lxd/provider.go#L115-L132 |
155,766 | juju/juju | worker/uniter/storage/state.go | ValidateHook | func (s *state) ValidateHook(hi hook.Info) (err error) {
defer errors.DeferredAnnotatef(&err, "inappropriate %q hook for storage %q", hi.Kind, s.storage.Id())
if hi.StorageId != s.storage.Id() {
return errors.Errorf("expected storage %q, got storage %q", s.storage.Id(), hi.StorageId)
}
switch hi.Kind {
case hook... | go | func (s *state) ValidateHook(hi hook.Info) (err error) {
defer errors.DeferredAnnotatef(&err, "inappropriate %q hook for storage %q", hi.Kind, s.storage.Id())
if hi.StorageId != s.storage.Id() {
return errors.Errorf("expected storage %q, got storage %q", s.storage.Id(), hi.StorageId)
}
switch hi.Kind {
case hook... | [
"func",
"(",
"s",
"*",
"state",
")",
"ValidateHook",
"(",
"hi",
"hook",
".",
"Info",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"errors",
".",
"DeferredAnnotatef",
"(",
"&",
"err",
",",
"\"",
"\"",
",",
"hi",
".",
"Kind",
",",
"s",
".",
"storag... | // ValidateHook returns an error if the supplied hook.Info does not represent
// a valid change to the storage state. Hooks must always be validated
// against the current state before they are run, to ensure that the system
// meets its guarantees about hook execution order. | [
"ValidateHook",
"returns",
"an",
"error",
"if",
"the",
"supplied",
"hook",
".",
"Info",
"does",
"not",
"represent",
"a",
"valid",
"change",
"to",
"the",
"storage",
"state",
".",
"Hooks",
"must",
"always",
"be",
"validated",
"against",
"the",
"current",
"stat... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/storage/state.go#L34-L50 |
155,767 | juju/juju | worker/uniter/storage/state.go | readStateFile | func readStateFile(dirPath string, tag names.StorageTag) (d *stateFile, err error) {
filename := strings.Replace(tag.Id(), "/", "-", -1)
d = &stateFile{
filepath.Join(dirPath, filename),
state{storage: tag},
}
defer errors.DeferredAnnotatef(&err, "cannot load storage %q state from %q", tag.Id(), d.path)
if _, ... | go | func readStateFile(dirPath string, tag names.StorageTag) (d *stateFile, err error) {
filename := strings.Replace(tag.Id(), "/", "-", -1)
d = &stateFile{
filepath.Join(dirPath, filename),
state{storage: tag},
}
defer errors.DeferredAnnotatef(&err, "cannot load storage %q state from %q", tag.Id(), d.path)
if _, ... | [
"func",
"readStateFile",
"(",
"dirPath",
"string",
",",
"tag",
"names",
".",
"StorageTag",
")",
"(",
"d",
"*",
"stateFile",
",",
"err",
"error",
")",
"{",
"filename",
":=",
"strings",
".",
"Replace",
"(",
"tag",
".",
"Id",
"(",
")",
",",
"\"",
"\"",
... | // readStateFile loads a stateFile from the subdirectory of dirPath named
// for the supplied storage tag. If the directory does not exist, no error
// is returned. | [
"readStateFile",
"loads",
"a",
"stateFile",
"from",
"the",
"subdirectory",
"of",
"dirPath",
"named",
"for",
"the",
"supplied",
"storage",
"tag",
".",
"If",
"the",
"directory",
"does",
"not",
"exist",
"no",
"error",
"is",
"returned",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/storage/state.go#L68-L89 |
155,768 | juju/juju | worker/uniter/storage/state.go | readAllStateFiles | func readAllStateFiles(dirPath string) (files map[names.StorageTag]*stateFile, err error) {
defer errors.DeferredAnnotatef(&err, "cannot load storage state from %q", dirPath)
if _, err := os.Stat(dirPath); os.IsNotExist(err) {
return nil, nil
} else if err != nil {
return nil, err
}
fis, err := ioutil.ReadDir(... | go | func readAllStateFiles(dirPath string) (files map[names.StorageTag]*stateFile, err error) {
defer errors.DeferredAnnotatef(&err, "cannot load storage state from %q", dirPath)
if _, err := os.Stat(dirPath); os.IsNotExist(err) {
return nil, nil
} else if err != nil {
return nil, err
}
fis, err := ioutil.ReadDir(... | [
"func",
"readAllStateFiles",
"(",
"dirPath",
"string",
")",
"(",
"files",
"map",
"[",
"names",
".",
"StorageTag",
"]",
"*",
"stateFile",
",",
"err",
"error",
")",
"{",
"defer",
"errors",
".",
"DeferredAnnotatef",
"(",
"&",
"err",
",",
"\"",
"\"",
",",
... | // readAllStateFiles loads and returns every stateFile persisted inside
// the supplied dirPath. If dirPath does not exist, no error is returned. | [
"readAllStateFiles",
"loads",
"and",
"returns",
"every",
"stateFile",
"persisted",
"inside",
"the",
"supplied",
"dirPath",
".",
"If",
"dirPath",
"does",
"not",
"exist",
"no",
"error",
"is",
"returned",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/storage/state.go#L93-L127 |
155,769 | juju/juju | worker/uniter/storage/state.go | CommitHook | func (d *stateFile) CommitHook(hi hook.Info) (err error) {
defer errors.DeferredAnnotatef(&err, "failed to write %q hook info for %q on state directory", hi.Kind, hi.StorageId)
if hi.Kind == hooks.StorageDetaching {
return d.Remove()
}
attached := true
di := diskInfo{&attached}
if err := utils.WriteYaml(d.path,... | go | func (d *stateFile) CommitHook(hi hook.Info) (err error) {
defer errors.DeferredAnnotatef(&err, "failed to write %q hook info for %q on state directory", hi.Kind, hi.StorageId)
if hi.Kind == hooks.StorageDetaching {
return d.Remove()
}
attached := true
di := diskInfo{&attached}
if err := utils.WriteYaml(d.path,... | [
"func",
"(",
"d",
"*",
"stateFile",
")",
"CommitHook",
"(",
"hi",
"hook",
".",
"Info",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"errors",
".",
"DeferredAnnotatef",
"(",
"&",
"err",
",",
"\"",
"\"",
",",
"hi",
".",
"Kind",
",",
"hi",
".",
"Sto... | // CommitHook atomically writes to disk the storage state change in hi.
// It must be called after the respective hook was executed successfully.
// CommitHook doesn't validate hi but guarantees that successive writes
// of the same hi are idempotent. | [
"CommitHook",
"atomically",
"writes",
"to",
"disk",
"the",
"storage",
"state",
"change",
"in",
"hi",
".",
"It",
"must",
"be",
"called",
"after",
"the",
"respective",
"hook",
"was",
"executed",
"successfully",
".",
"CommitHook",
"doesn",
"t",
"validate",
"hi",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/storage/state.go#L133-L146 |
155,770 | juju/juju | environs/simplestreams/decode.go | DecodeCheckSignature | func DecodeCheckSignature(r io.Reader, armoredPublicKey string) ([]byte, error) {
data, err := ioutil.ReadAll(r)
if err != nil {
return nil, err
}
b, _ := clearsign.Decode(data)
if b == nil {
return nil, &NotPGPSignedError{}
}
keyring, err := openpgp.ReadArmoredKeyRing(bytes.NewBufferString(armoredPublicKey)... | go | func DecodeCheckSignature(r io.Reader, armoredPublicKey string) ([]byte, error) {
data, err := ioutil.ReadAll(r)
if err != nil {
return nil, err
}
b, _ := clearsign.Decode(data)
if b == nil {
return nil, &NotPGPSignedError{}
}
keyring, err := openpgp.ReadArmoredKeyRing(bytes.NewBufferString(armoredPublicKey)... | [
"func",
"DecodeCheckSignature",
"(",
"r",
"io",
".",
"Reader",
",",
"armoredPublicKey",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // DecodeCheckSignature parses the inline signed PGP text, checks the signature,
// and returns plain text if the signature matches. | [
"DecodeCheckSignature",
"parses",
"the",
"inline",
"signed",
"PGP",
"text",
"checks",
"the",
"signature",
"and",
"returns",
"plain",
"text",
"if",
"the",
"signature",
"matches",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/simplestreams/decode.go#L18-L37 |
155,771 | juju/juju | api/uniter/uniter.go | NewState | func NewState(
caller base.APICaller,
authTag names.UnitTag,
) *State {
facadeCaller := base.NewFacadeCaller(
caller,
uniterFacade,
)
state := &State{
ModelWatcher: common.NewModelWatcher(facadeCaller),
APIAddresser: common.NewAPIAddresser(facadeCaller),
UpgradeSeriesAPI: common.NewUpgradeSeriesA... | go | func NewState(
caller base.APICaller,
authTag names.UnitTag,
) *State {
facadeCaller := base.NewFacadeCaller(
caller,
uniterFacade,
)
state := &State{
ModelWatcher: common.NewModelWatcher(facadeCaller),
APIAddresser: common.NewAPIAddresser(facadeCaller),
UpgradeSeriesAPI: common.NewUpgradeSeriesA... | [
"func",
"NewState",
"(",
"caller",
"base",
".",
"APICaller",
",",
"authTag",
"names",
".",
"UnitTag",
",",
")",
"*",
"State",
"{",
"facadeCaller",
":=",
"base",
".",
"NewFacadeCaller",
"(",
"caller",
",",
"uniterFacade",
",",
")",
"\n",
"state",
":=",
"&... | // NewState creates a new client-side Uniter facade. | [
"NewState",
"creates",
"a",
"new",
"client",
"-",
"side",
"Uniter",
"facade",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/uniter/uniter.go#L40-L66 |
155,772 | juju/juju | api/uniter/uniter.go | life | func (st *State) life(tag names.Tag) (params.Life, error) {
return common.OneLife(st.facade, tag)
} | go | func (st *State) life(tag names.Tag) (params.Life, error) {
return common.OneLife(st.facade, tag)
} | [
"func",
"(",
"st",
"*",
"State",
")",
"life",
"(",
"tag",
"names",
".",
"Tag",
")",
"(",
"params",
".",
"Life",
",",
"error",
")",
"{",
"return",
"common",
".",
"OneLife",
"(",
"st",
".",
"facade",
",",
"tag",
")",
"\n",
"}"
] | // life requests the lifecycle of the given entity from the server. | [
"life",
"requests",
"the",
"lifecycle",
"of",
"the",
"given",
"entity",
"from",
"the",
"server",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/uniter/uniter.go#L80-L82 |
155,773 | juju/juju | api/uniter/uniter.go | relation | func (st *State) relation(relationTag, unitTag names.Tag) (params.RelationResult, error) {
nothing := params.RelationResult{}
var result params.RelationResults
args := params.RelationUnits{
RelationUnits: []params.RelationUnit{
{Relation: relationTag.String(), Unit: unitTag.String()},
},
}
err := st.facade.... | go | func (st *State) relation(relationTag, unitTag names.Tag) (params.RelationResult, error) {
nothing := params.RelationResult{}
var result params.RelationResults
args := params.RelationUnits{
RelationUnits: []params.RelationUnit{
{Relation: relationTag.String(), Unit: unitTag.String()},
},
}
err := st.facade.... | [
"func",
"(",
"st",
"*",
"State",
")",
"relation",
"(",
"relationTag",
",",
"unitTag",
"names",
".",
"Tag",
")",
"(",
"params",
".",
"RelationResult",
",",
"error",
")",
"{",
"nothing",
":=",
"params",
".",
"RelationResult",
"{",
"}",
"\n",
"var",
"resu... | // relation requests relation information from the server. | [
"relation",
"requests",
"relation",
"information",
"from",
"the",
"server",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/uniter/uniter.go#L85-L104 |
155,774 | juju/juju | api/uniter/uniter.go | getOneAction | func (st *State) getOneAction(tag *names.ActionTag) (params.ActionResult, error) {
nothing := params.ActionResult{}
args := params.Entities{
Entities: []params.Entity{
{Tag: tag.String()},
},
}
var results params.ActionResults
err := st.facade.FacadeCall("Actions", args, &results)
if err != nil {
retur... | go | func (st *State) getOneAction(tag *names.ActionTag) (params.ActionResult, error) {
nothing := params.ActionResult{}
args := params.Entities{
Entities: []params.Entity{
{Tag: tag.String()},
},
}
var results params.ActionResults
err := st.facade.FacadeCall("Actions", args, &results)
if err != nil {
retur... | [
"func",
"(",
"st",
"*",
"State",
")",
"getOneAction",
"(",
"tag",
"*",
"names",
".",
"ActionTag",
")",
"(",
"params",
".",
"ActionResult",
",",
"error",
")",
"{",
"nothing",
":=",
"params",
".",
"ActionResult",
"{",
"}",
"\n\n",
"args",
":=",
"params",... | // getOneAction retrieves a single Action from the controller. | [
"getOneAction",
"retrieves",
"a",
"single",
"Action",
"from",
"the",
"controller",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/uniter/uniter.go#L122-L148 |
155,775 | juju/juju | api/uniter/uniter.go | Application | func (st *State) Application(tag names.ApplicationTag) (*Application, error) {
life, err := st.life(tag)
if err != nil {
return nil, err
}
return &Application{
tag: tag,
life: life,
st: st,
}, nil
} | go | func (st *State) Application(tag names.ApplicationTag) (*Application, error) {
life, err := st.life(tag)
if err != nil {
return nil, err
}
return &Application{
tag: tag,
life: life,
st: st,
}, nil
} | [
"func",
"(",
"st",
"*",
"State",
")",
"Application",
"(",
"tag",
"names",
".",
"ApplicationTag",
")",
"(",
"*",
"Application",
",",
"error",
")",
"{",
"life",
",",
"err",
":=",
"st",
".",
"life",
"(",
"tag",
")",
"\n",
"if",
"err",
"!=",
"nil",
"... | // Application returns an application state by tag. | [
"Application",
"returns",
"an",
"application",
"state",
"by",
"tag",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/uniter/uniter.go#L164-L174 |
155,776 | juju/juju | api/uniter/uniter.go | Charm | func (st *State) Charm(curl *charm.URL) (*Charm, error) {
if curl == nil {
return nil, fmt.Errorf("charm url cannot be nil")
}
return &Charm{
st: st,
curl: curl,
}, nil
} | go | func (st *State) Charm(curl *charm.URL) (*Charm, error) {
if curl == nil {
return nil, fmt.Errorf("charm url cannot be nil")
}
return &Charm{
st: st,
curl: curl,
}, nil
} | [
"func",
"(",
"st",
"*",
"State",
")",
"Charm",
"(",
"curl",
"*",
"charm",
".",
"URL",
")",
"(",
"*",
"Charm",
",",
"error",
")",
"{",
"if",
"curl",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",... | // Charm returns the charm with the given URL. | [
"Charm",
"returns",
"the",
"charm",
"with",
"the",
"given",
"URL",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/uniter/uniter.go#L193-L201 |
155,777 | juju/juju | api/uniter/uniter.go | Relation | func (st *State) Relation(relationTag names.RelationTag) (*Relation, error) {
result, err := st.relation(relationTag, st.unitTag)
if err != nil {
return nil, err
}
return &Relation{
id: result.Id,
tag: relationTag,
life: result.Life,
suspended: result.Suspended,
st: st,
otherA... | go | func (st *State) Relation(relationTag names.RelationTag) (*Relation, error) {
result, err := st.relation(relationTag, st.unitTag)
if err != nil {
return nil, err
}
return &Relation{
id: result.Id,
tag: relationTag,
life: result.Life,
suspended: result.Suspended,
st: st,
otherA... | [
"func",
"(",
"st",
"*",
"State",
")",
"Relation",
"(",
"relationTag",
"names",
".",
"RelationTag",
")",
"(",
"*",
"Relation",
",",
"error",
")",
"{",
"result",
",",
"err",
":=",
"st",
".",
"relation",
"(",
"relationTag",
",",
"st",
".",
"unitTag",
")... | // Relation returns the existing relation with the given tag. | [
"Relation",
"returns",
"the",
"existing",
"relation",
"with",
"the",
"given",
"tag",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/uniter/uniter.go#L204-L217 |
155,778 | juju/juju | api/uniter/uniter.go | RelationById | func (st *State) RelationById(id int) (*Relation, error) {
var results params.RelationResults
args := params.RelationIds{
RelationIds: []int{id},
}
err := st.facade.FacadeCall("RelationById", args, &results)
if err != nil {
return nil, err
}
if len(results.Results) != 1 {
return nil, fmt.Errorf("expected 1... | go | func (st *State) RelationById(id int) (*Relation, error) {
var results params.RelationResults
args := params.RelationIds{
RelationIds: []int{id},
}
err := st.facade.FacadeCall("RelationById", args, &results)
if err != nil {
return nil, err
}
if len(results.Results) != 1 {
return nil, fmt.Errorf("expected 1... | [
"func",
"(",
"st",
"*",
"State",
")",
"RelationById",
"(",
"id",
"int",
")",
"(",
"*",
"Relation",
",",
"error",
")",
"{",
"var",
"results",
"params",
".",
"RelationResults",
"\n",
"args",
":=",
"params",
".",
"RelationIds",
"{",
"RelationIds",
":",
"[... | // RelationById returns the existing relation with the given id. | [
"RelationById",
"returns",
"the",
"existing",
"relation",
"with",
"the",
"given",
"id",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/uniter/uniter.go#L285-L310 |
155,779 | juju/juju | api/uniter/uniter.go | AllMachinePorts | func (st *State) AllMachinePorts(machineTag names.MachineTag) (map[corenetwork.PortRange]params.RelationUnit, error) {
if st.BestAPIVersion() < 1 {
// AllMachinePorts() was introduced in UniterAPIV1.
return nil, errors.NotImplementedf("AllMachinePorts() (need V1+)")
}
var results params.MachinePortsResults
args... | go | func (st *State) AllMachinePorts(machineTag names.MachineTag) (map[corenetwork.PortRange]params.RelationUnit, error) {
if st.BestAPIVersion() < 1 {
// AllMachinePorts() was introduced in UniterAPIV1.
return nil, errors.NotImplementedf("AllMachinePorts() (need V1+)")
}
var results params.MachinePortsResults
args... | [
"func",
"(",
"st",
"*",
"State",
")",
"AllMachinePorts",
"(",
"machineTag",
"names",
".",
"MachineTag",
")",
"(",
"map",
"[",
"corenetwork",
".",
"PortRange",
"]",
"params",
".",
"RelationUnit",
",",
"error",
")",
"{",
"if",
"st",
".",
"BestAPIVersion",
... | // AllMachinePorts returns all port ranges currently open on the given
// machine, mapped to the tags of the unit that opened them and the
// relation that applies. | [
"AllMachinePorts",
"returns",
"all",
"port",
"ranges",
"currently",
"open",
"on",
"the",
"given",
"machine",
"mapped",
"to",
"the",
"tags",
"of",
"the",
"unit",
"that",
"opened",
"them",
"and",
"the",
"relation",
"that",
"applies",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/uniter/uniter.go#L336-L365 |
155,780 | juju/juju | api/uniter/uniter.go | WatchRelationUnits | func (st *State) WatchRelationUnits(
relationTag names.RelationTag,
unitTag names.UnitTag,
) (watcher.RelationUnitsWatcher, error) {
var results params.RelationUnitsWatchResults
args := params.RelationUnits{
RelationUnits: []params.RelationUnit{{
Relation: relationTag.String(),
Unit: unitTag.String(),
... | go | func (st *State) WatchRelationUnits(
relationTag names.RelationTag,
unitTag names.UnitTag,
) (watcher.RelationUnitsWatcher, error) {
var results params.RelationUnitsWatchResults
args := params.RelationUnits{
RelationUnits: []params.RelationUnit{{
Relation: relationTag.String(),
Unit: unitTag.String(),
... | [
"func",
"(",
"st",
"*",
"State",
")",
"WatchRelationUnits",
"(",
"relationTag",
"names",
".",
"RelationTag",
",",
"unitTag",
"names",
".",
"UnitTag",
",",
")",
"(",
"watcher",
".",
"RelationUnitsWatcher",
",",
"error",
")",
"{",
"var",
"results",
"params",
... | // WatchRelationUnits returns a watcher that notifies of changes to the
// counterpart units in the relation for the given unit. | [
"WatchRelationUnits",
"returns",
"a",
"watcher",
"that",
"notifies",
"of",
"changes",
"to",
"the",
"counterpart",
"units",
"in",
"the",
"relation",
"for",
"the",
"given",
"unit",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/uniter/uniter.go#L369-L393 |
155,781 | juju/juju | api/uniter/uniter.go | ErrIfNotVersionFn | func ErrIfNotVersionFn(minVersion int, bestAPIVersion int) func(string) error {
return func(fnName string) error {
if minVersion <= bestAPIVersion {
return nil
}
return errors.NotImplementedf("%s(...) requires v%d+", fnName, minVersion)
}
} | go | func ErrIfNotVersionFn(minVersion int, bestAPIVersion int) func(string) error {
return func(fnName string) error {
if minVersion <= bestAPIVersion {
return nil
}
return errors.NotImplementedf("%s(...) requires v%d+", fnName, minVersion)
}
} | [
"func",
"ErrIfNotVersionFn",
"(",
"minVersion",
"int",
",",
"bestAPIVersion",
"int",
")",
"func",
"(",
"string",
")",
"error",
"{",
"return",
"func",
"(",
"fnName",
"string",
")",
"error",
"{",
"if",
"minVersion",
"<=",
"bestAPIVersion",
"{",
"return",
"nil"... | // ErrIfNotVersionFn returns a function which can be used to check for
// the minimum supported version, and, if appropriate, generate an
// error. | [
"ErrIfNotVersionFn",
"returns",
"a",
"function",
"which",
"can",
"be",
"used",
"to",
"check",
"for",
"the",
"minimum",
"supported",
"version",
"and",
"if",
"appropriate",
"generate",
"an",
"error",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/uniter/uniter.go#L398-L405 |
155,782 | juju/juju | api/uniter/uniter.go | SLALevel | func (st *State) SLALevel() (string, error) {
if st.BestAPIVersion() < 5 {
return "unsupported", nil
}
var result params.StringResult
err := st.facade.FacadeCall("SLALevel", nil, &result)
if err != nil {
return "", errors.Trace(err)
}
if err := result.Error; err != nil {
return "", errors.Trace(err)
}
re... | go | func (st *State) SLALevel() (string, error) {
if st.BestAPIVersion() < 5 {
return "unsupported", nil
}
var result params.StringResult
err := st.facade.FacadeCall("SLALevel", nil, &result)
if err != nil {
return "", errors.Trace(err)
}
if err := result.Error; err != nil {
return "", errors.Trace(err)
}
re... | [
"func",
"(",
"st",
"*",
"State",
")",
"SLALevel",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"st",
".",
"BestAPIVersion",
"(",
")",
"<",
"5",
"{",
"return",
"\"",
"\"",
",",
"nil",
"\n",
"}",
"\n",
"var",
"result",
"params",
".",
"S... | // SLALevel returns the SLA level set on the model. | [
"SLALevel",
"returns",
"the",
"SLA",
"level",
"set",
"on",
"the",
"model",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/uniter/uniter.go#L408-L421 |
155,783 | juju/juju | api/uniter/uniter.go | GoalState | func (st *State) GoalState() (application.GoalState, error) {
var result params.GoalStateResults
gs := application.GoalState{}
args := params.Entities{
Entities: []params.Entity{
{Tag: st.unitTag.String()},
},
}
err := st.facade.FacadeCall("GoalStates", args, &result)
if err != nil {
return gs, err
}... | go | func (st *State) GoalState() (application.GoalState, error) {
var result params.GoalStateResults
gs := application.GoalState{}
args := params.Entities{
Entities: []params.Entity{
{Tag: st.unitTag.String()},
},
}
err := st.facade.FacadeCall("GoalStates", args, &result)
if err != nil {
return gs, err
}... | [
"func",
"(",
"st",
"*",
"State",
")",
"GoalState",
"(",
")",
"(",
"application",
".",
"GoalState",
",",
"error",
")",
"{",
"var",
"result",
"params",
".",
"GoalStateResults",
"\n\n",
"gs",
":=",
"application",
".",
"GoalState",
"{",
"}",
"\n\n",
"args",
... | // GoalState returns a GoalState struct with the charm's
// peers and related units information. | [
"GoalState",
"returns",
"a",
"GoalState",
"struct",
"with",
"the",
"charm",
"s",
"peers",
"and",
"related",
"units",
"information",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/uniter/uniter.go#L441-L464 |
155,784 | juju/juju | api/uniter/uniter.go | CloudSpec | func (st *State) CloudSpec() (*params.CloudSpec, error) {
var result params.CloudSpecResult
err := st.facade.FacadeCall("CloudSpec", nil, &result)
if err != nil {
return nil, err
}
if err := result.Error; err != nil {
return nil, err
}
return result.Result, nil
} | go | func (st *State) CloudSpec() (*params.CloudSpec, error) {
var result params.CloudSpecResult
err := st.facade.FacadeCall("CloudSpec", nil, &result)
if err != nil {
return nil, err
}
if err := result.Error; err != nil {
return nil, err
}
return result.Result, nil
} | [
"func",
"(",
"st",
"*",
"State",
")",
"CloudSpec",
"(",
")",
"(",
"*",
"params",
".",
"CloudSpec",
",",
"error",
")",
"{",
"var",
"result",
"params",
".",
"CloudSpecResult",
"\n\n",
"err",
":=",
"st",
".",
"facade",
".",
"FacadeCall",
"(",
"\"",
"\""... | // CloudSpec returns the cloud spec for the model that calling unit or
// application resides in.
// If the application has not been authorised to access its cloud spec,
// then an authorisation error will be returned. | [
"CloudSpec",
"returns",
"the",
"cloud",
"spec",
"for",
"the",
"model",
"that",
"calling",
"unit",
"or",
"application",
"resides",
"in",
".",
"If",
"the",
"application",
"has",
"not",
"been",
"authorised",
"to",
"access",
"its",
"cloud",
"spec",
"then",
"an",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/uniter/uniter.go#L515-L526 |
155,785 | juju/juju | apiserver/facades/client/applicationoffers/applicationoffers.go | createOffersAPI | func createOffersAPI(
getApplicationOffers func(interface{}) jujucrossmodel.ApplicationOffers,
getEnviron environFromModelFunc,
getControllerInfo func() ([]string, string, error),
backend Backend,
statePool StatePool,
authorizer facade.Authorizer,
resources facade.Resources,
authContext *commoncrossmodel.AuthCo... | go | func createOffersAPI(
getApplicationOffers func(interface{}) jujucrossmodel.ApplicationOffers,
getEnviron environFromModelFunc,
getControllerInfo func() ([]string, string, error),
backend Backend,
statePool StatePool,
authorizer facade.Authorizer,
resources facade.Resources,
authContext *commoncrossmodel.AuthCo... | [
"func",
"createOffersAPI",
"(",
"getApplicationOffers",
"func",
"(",
"interface",
"{",
"}",
")",
"jujucrossmodel",
".",
"ApplicationOffers",
",",
"getEnviron",
"environFromModelFunc",
",",
"getControllerInfo",
"func",
"(",
")",
"(",
"[",
"]",
"string",
",",
"strin... | // createAPI returns a new application offers OffersAPI facade. | [
"createAPI",
"returns",
"a",
"new",
"application",
"offers",
"OffersAPI",
"facade",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/applicationoffers/applicationoffers.go#L44-L74 |
155,786 | juju/juju | apiserver/facades/client/applicationoffers/applicationoffers.go | Offer | func (api *OffersAPI) Offer(all params.AddApplicationOffers) (params.ErrorResults, error) {
result := make([]params.ErrorResult, len(all.Offers))
for i, one := range all.Offers {
modelTag, err := names.ParseModelTag(one.ModelTag)
if err != nil {
result[i].Error = common.ServerError(err)
continue
}
back... | go | func (api *OffersAPI) Offer(all params.AddApplicationOffers) (params.ErrorResults, error) {
result := make([]params.ErrorResult, len(all.Offers))
for i, one := range all.Offers {
modelTag, err := names.ParseModelTag(one.ModelTag)
if err != nil {
result[i].Error = common.ServerError(err)
continue
}
back... | [
"func",
"(",
"api",
"*",
"OffersAPI",
")",
"Offer",
"(",
"all",
"params",
".",
"AddApplicationOffers",
")",
"(",
"params",
".",
"ErrorResults",
",",
"error",
")",
"{",
"result",
":=",
"make",
"(",
"[",
"]",
"params",
".",
"ErrorResult",
",",
"len",
"("... | // Offer makes application endpoints available for consumption at a specified URL. | [
"Offer",
"makes",
"application",
"endpoints",
"available",
"for",
"consumption",
"at",
"a",
"specified",
"URL",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/applicationoffers/applicationoffers.go#L126-L156 |
155,787 | juju/juju | apiserver/facades/client/applicationoffers/applicationoffers.go | ListApplicationOffers | func (api *OffersAPI) ListApplicationOffers(filters params.OfferFilters) (params.QueryApplicationOffersResults, error) {
var result params.QueryApplicationOffersResults
offers, err := api.getApplicationOffersDetails(filters, permission.AdminAccess)
if err != nil {
return result, common.ServerError(err)
}
result.... | go | func (api *OffersAPI) ListApplicationOffers(filters params.OfferFilters) (params.QueryApplicationOffersResults, error) {
var result params.QueryApplicationOffersResults
offers, err := api.getApplicationOffersDetails(filters, permission.AdminAccess)
if err != nil {
return result, common.ServerError(err)
}
result.... | [
"func",
"(",
"api",
"*",
"OffersAPI",
")",
"ListApplicationOffers",
"(",
"filters",
"params",
".",
"OfferFilters",
")",
"(",
"params",
".",
"QueryApplicationOffersResults",
",",
"error",
")",
"{",
"var",
"result",
"params",
".",
"QueryApplicationOffersResults",
"\... | // ListApplicationOffers gets deployed details about application offers that match given filter.
// The results contain details about the deployed applications such as connection count. | [
"ListApplicationOffers",
"gets",
"deployed",
"details",
"about",
"application",
"offers",
"that",
"match",
"given",
"filter",
".",
"The",
"results",
"contain",
"details",
"about",
"the",
"deployed",
"applications",
"such",
"as",
"connection",
"count",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/applicationoffers/applicationoffers.go#L188-L196 |
155,788 | juju/juju | apiserver/facades/client/applicationoffers/applicationoffers.go | ModifyOfferAccess | func (api *OffersAPI) ModifyOfferAccess(args params.ModifyOfferAccessRequest) (result params.ErrorResults, _ error) {
result = params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Changes)),
}
if len(args.Changes) == 0 {
return result, nil
}
isControllerAdmin, err := api.Authorizer.HasPermission(... | go | func (api *OffersAPI) ModifyOfferAccess(args params.ModifyOfferAccessRequest) (result params.ErrorResults, _ error) {
result = params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Changes)),
}
if len(args.Changes) == 0 {
return result, nil
}
isControllerAdmin, err := api.Authorizer.HasPermission(... | [
"func",
"(",
"api",
"*",
"OffersAPI",
")",
"ModifyOfferAccess",
"(",
"args",
"params",
".",
"ModifyOfferAccessRequest",
")",
"(",
"result",
"params",
".",
"ErrorResults",
",",
"_",
"error",
")",
"{",
"result",
"=",
"params",
".",
"ErrorResults",
"{",
"Result... | // ModifyOfferAccess changes the application offer access granted to users. | [
"ModifyOfferAccess",
"changes",
"the",
"application",
"offer",
"access",
"granted",
"to",
"users",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/applicationoffers/applicationoffers.go#L199-L230 |
155,789 | juju/juju | apiserver/facades/client/applicationoffers/applicationoffers.go | changeOfferAccess | func (api *OffersAPI) changeOfferAccess(
backend Backend,
offerTag names.ApplicationOfferTag,
targetUserTag names.UserTag,
action params.OfferAction,
access permission.Access,
) error {
_, err := backend.ApplicationOffer(offerTag.Name)
if err != nil {
return errors.Trace(err)
}
switch action {
case params.G... | go | func (api *OffersAPI) changeOfferAccess(
backend Backend,
offerTag names.ApplicationOfferTag,
targetUserTag names.UserTag,
action params.OfferAction,
access permission.Access,
) error {
_, err := backend.ApplicationOffer(offerTag.Name)
if err != nil {
return errors.Trace(err)
}
switch action {
case params.G... | [
"func",
"(",
"api",
"*",
"OffersAPI",
")",
"changeOfferAccess",
"(",
"backend",
"Backend",
",",
"offerTag",
"names",
".",
"ApplicationOfferTag",
",",
"targetUserTag",
"names",
".",
"UserTag",
",",
"action",
"params",
".",
"OfferAction",
",",
"access",
"permissio... | // changeOfferAccess performs the requested access grant or revoke action for the
// specified user on the specified application offer. | [
"changeOfferAccess",
"performs",
"the",
"requested",
"access",
"grant",
"or",
"revoke",
"action",
"for",
"the",
"specified",
"user",
"on",
"the",
"specified",
"application",
"offer",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/applicationoffers/applicationoffers.go#L283-L302 |
155,790 | juju/juju | apiserver/facades/client/applicationoffers/applicationoffers.go | ApplicationOffers | func (api *OffersAPI) ApplicationOffers(urls params.OfferURLs) (params.ApplicationOffersResults, error) {
var results params.ApplicationOffersResults
results.Results = make([]params.ApplicationOfferResult, len(urls.OfferURLs))
var (
filters []params.OfferFilter
// fullURLs contains the URL strings from the url ... | go | func (api *OffersAPI) ApplicationOffers(urls params.OfferURLs) (params.ApplicationOffersResults, error) {
var results params.ApplicationOffersResults
results.Results = make([]params.ApplicationOfferResult, len(urls.OfferURLs))
var (
filters []params.OfferFilter
// fullURLs contains the URL strings from the url ... | [
"func",
"(",
"api",
"*",
"OffersAPI",
")",
"ApplicationOffers",
"(",
"urls",
"params",
".",
"OfferURLs",
")",
"(",
"params",
".",
"ApplicationOffersResults",
",",
"error",
")",
"{",
"var",
"results",
"params",
".",
"ApplicationOffersResults",
"\n",
"results",
... | // ApplicationOffers gets details about remote applications that match given URLs. | [
"ApplicationOffers",
"gets",
"details",
"about",
"remote",
"applications",
"that",
"match",
"given",
"URLs",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/applicationoffers/applicationoffers.go#L353-L408 |
155,791 | juju/juju | apiserver/facades/client/applicationoffers/applicationoffers.go | FindApplicationOffers | func (api *OffersAPI) FindApplicationOffers(filters params.OfferFilters) (params.QueryApplicationOffersResults, error) {
var result params.QueryApplicationOffersResults
var filtersToUse params.OfferFilters
// If there is only one filter term, and no model is specified, add in
// any models the user can see and que... | go | func (api *OffersAPI) FindApplicationOffers(filters params.OfferFilters) (params.QueryApplicationOffersResults, error) {
var result params.QueryApplicationOffersResults
var filtersToUse params.OfferFilters
// If there is only one filter term, and no model is specified, add in
// any models the user can see and que... | [
"func",
"(",
"api",
"*",
"OffersAPI",
")",
"FindApplicationOffers",
"(",
"filters",
"params",
".",
"OfferFilters",
")",
"(",
"params",
".",
"QueryApplicationOffersResults",
",",
"error",
")",
"{",
"var",
"result",
"params",
".",
"QueryApplicationOffersResults",
"\... | // FindApplicationOffers gets details about remote applications that match given filter. | [
"FindApplicationOffers",
"gets",
"details",
"about",
"remote",
"applications",
"that",
"match",
"given",
"filter",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/applicationoffers/applicationoffers.go#L411-L443 |
155,792 | juju/juju | apiserver/facades/client/applicationoffers/applicationoffers.go | GetConsumeDetails | func (api *OffersAPI) GetConsumeDetails(args params.OfferURLs) (params.ConsumeOfferDetailsResults, error) {
var consumeResults params.ConsumeOfferDetailsResults
results := make([]params.ConsumeOfferDetailsResult, len(args.OfferURLs))
offers, err := api.ApplicationOffers(args)
if err != nil {
return consumeResult... | go | func (api *OffersAPI) GetConsumeDetails(args params.OfferURLs) (params.ConsumeOfferDetailsResults, error) {
var consumeResults params.ConsumeOfferDetailsResults
results := make([]params.ConsumeOfferDetailsResult, len(args.OfferURLs))
offers, err := api.ApplicationOffers(args)
if err != nil {
return consumeResult... | [
"func",
"(",
"api",
"*",
"OffersAPI",
")",
"GetConsumeDetails",
"(",
"args",
"params",
".",
"OfferURLs",
")",
"(",
"params",
".",
"ConsumeOfferDetailsResults",
",",
"error",
")",
"{",
"var",
"consumeResults",
"params",
".",
"ConsumeOfferDetailsResults",
"\n",
"r... | // GetConsumeDetails returns the details necessary to pass to another model to
// consume the specified offers represented by the urls. | [
"GetConsumeDetails",
"returns",
"the",
"details",
"necessary",
"to",
"pass",
"to",
"another",
"model",
"to",
"consume",
"the",
"specified",
"offers",
"represented",
"by",
"the",
"urls",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/applicationoffers/applicationoffers.go#L447-L485 |
155,793 | juju/juju | apiserver/facades/client/applicationoffers/applicationoffers.go | RemoteApplicationInfo | func (api *OffersAPI) RemoteApplicationInfo(args params.OfferURLs) (params.RemoteApplicationInfoResults, error) {
results := make([]params.RemoteApplicationInfoResult, len(args.OfferURLs))
for i, url := range args.OfferURLs {
info, err := api.oneRemoteApplicationInfo(url)
results[i].Result = info
results[i].Err... | go | func (api *OffersAPI) RemoteApplicationInfo(args params.OfferURLs) (params.RemoteApplicationInfoResults, error) {
results := make([]params.RemoteApplicationInfoResult, len(args.OfferURLs))
for i, url := range args.OfferURLs {
info, err := api.oneRemoteApplicationInfo(url)
results[i].Result = info
results[i].Err... | [
"func",
"(",
"api",
"*",
"OffersAPI",
")",
"RemoteApplicationInfo",
"(",
"args",
"params",
".",
"OfferURLs",
")",
"(",
"params",
".",
"RemoteApplicationInfoResults",
",",
"error",
")",
"{",
"results",
":=",
"make",
"(",
"[",
"]",
"params",
".",
"RemoteApplic... | // RemoteApplicationInfo returns information about the requested remote application. | [
"RemoteApplicationInfo",
"returns",
"information",
"about",
"the",
"requested",
"remote",
"application",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/applicationoffers/applicationoffers.go#L488-L496 |
155,794 | juju/juju | apiserver/facades/client/applicationoffers/applicationoffers.go | DestroyOffers | func (api *OffersAPI) DestroyOffers(args params.DestroyApplicationOffers) (params.ErrorResults, error) {
return destroyOffers(api, args.OfferURLs, false)
} | go | func (api *OffersAPI) DestroyOffers(args params.DestroyApplicationOffers) (params.ErrorResults, error) {
return destroyOffers(api, args.OfferURLs, false)
} | [
"func",
"(",
"api",
"*",
"OffersAPI",
")",
"DestroyOffers",
"(",
"args",
"params",
".",
"DestroyApplicationOffers",
")",
"(",
"params",
".",
"ErrorResults",
",",
"error",
")",
"{",
"return",
"destroyOffers",
"(",
"api",
",",
"args",
".",
"OfferURLs",
",",
... | // DestroyOffers removes the offers specified by the given URLs. | [
"DestroyOffers",
"removes",
"the",
"offers",
"specified",
"by",
"the",
"given",
"URLs",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/applicationoffers/applicationoffers.go#L543-L545 |
155,795 | juju/juju | apiserver/facades/client/applicationoffers/applicationoffers.go | DestroyOffers | func (api *OffersAPIV2) DestroyOffers(args params.DestroyApplicationOffers) (params.ErrorResults, error) {
return destroyOffers(api.OffersAPI, args.OfferURLs, args.Force)
} | go | func (api *OffersAPIV2) DestroyOffers(args params.DestroyApplicationOffers) (params.ErrorResults, error) {
return destroyOffers(api.OffersAPI, args.OfferURLs, args.Force)
} | [
"func",
"(",
"api",
"*",
"OffersAPIV2",
")",
"DestroyOffers",
"(",
"args",
"params",
".",
"DestroyApplicationOffers",
")",
"(",
"params",
".",
"ErrorResults",
",",
"error",
")",
"{",
"return",
"destroyOffers",
"(",
"api",
".",
"OffersAPI",
",",
"args",
".",
... | // DestroyOffers removes the offers specified by the given URLs, forcing if necessary. | [
"DestroyOffers",
"removes",
"the",
"offers",
"specified",
"by",
"the",
"given",
"URLs",
"forcing",
"if",
"necessary",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/applicationoffers/applicationoffers.go#L548-L550 |
155,796 | juju/juju | payload/status/list.go | NewListCommand | func NewListCommand(newAPIClient func(c *ListCommand) (ListAPI, error)) *ListCommand {
cmd := &ListCommand{
newAPIClient: newAPIClient,
}
return cmd
} | go | func NewListCommand(newAPIClient func(c *ListCommand) (ListAPI, error)) *ListCommand {
cmd := &ListCommand{
newAPIClient: newAPIClient,
}
return cmd
} | [
"func",
"NewListCommand",
"(",
"newAPIClient",
"func",
"(",
"c",
"*",
"ListCommand",
")",
"(",
"ListAPI",
",",
"error",
")",
")",
"*",
"ListCommand",
"{",
"cmd",
":=",
"&",
"ListCommand",
"{",
"newAPIClient",
":",
"newAPIClient",
",",
"}",
"\n",
"return",
... | // NewListCommand returns a new command that lists charm payloads
// in the current environment. | [
"NewListCommand",
"returns",
"a",
"new",
"command",
"that",
"lists",
"charm",
"payloads",
"in",
"the",
"current",
"environment",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/payload/status/list.go#L36-L41 |
155,797 | juju/juju | apiserver/common/crossmodel/crossmodel.go | WatchRelationUnits | func WatchRelationUnits(backend Backend, tag names.RelationTag) (state.RelationUnitsWatcher, error) {
relation, err := backend.KeyRelation(tag.Id())
if err != nil {
return nil, errors.Trace(err)
}
for _, ep := range relation.Endpoints() {
_, err := backend.Application(ep.ApplicationName)
if errors.IsNotFound(... | go | func WatchRelationUnits(backend Backend, tag names.RelationTag) (state.RelationUnitsWatcher, error) {
relation, err := backend.KeyRelation(tag.Id())
if err != nil {
return nil, errors.Trace(err)
}
for _, ep := range relation.Endpoints() {
_, err := backend.Application(ep.ApplicationName)
if errors.IsNotFound(... | [
"func",
"WatchRelationUnits",
"(",
"backend",
"Backend",
",",
"tag",
"names",
".",
"RelationTag",
")",
"(",
"state",
".",
"RelationUnitsWatcher",
",",
"error",
")",
"{",
"relation",
",",
"err",
":=",
"backend",
".",
"KeyRelation",
"(",
"tag",
".",
"Id",
"(... | // WatchRelationUnits returns a watcher for changes to the units on the specified relation. | [
"WatchRelationUnits",
"returns",
"a",
"watcher",
"for",
"changes",
"to",
"the",
"units",
"on",
"the",
"specified",
"relation",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/crossmodel/crossmodel.go#L166-L186 |
155,798 | juju/juju | apiserver/common/crossmodel/crossmodel.go | RelationUnitSettings | func RelationUnitSettings(backend Backend, ru params.RelationUnit) (params.Settings, error) {
relationTag, err := names.ParseRelationTag(ru.Relation)
if err != nil {
return nil, errors.Trace(err)
}
rel, err := backend.KeyRelation(relationTag.Id())
if err != nil {
return nil, errors.Trace(err)
}
unitTag, err ... | go | func RelationUnitSettings(backend Backend, ru params.RelationUnit) (params.Settings, error) {
relationTag, err := names.ParseRelationTag(ru.Relation)
if err != nil {
return nil, errors.Trace(err)
}
rel, err := backend.KeyRelation(relationTag.Id())
if err != nil {
return nil, errors.Trace(err)
}
unitTag, err ... | [
"func",
"RelationUnitSettings",
"(",
"backend",
"Backend",
",",
"ru",
"params",
".",
"RelationUnit",
")",
"(",
"params",
".",
"Settings",
",",
"error",
")",
"{",
"relationTag",
",",
"err",
":=",
"names",
".",
"ParseRelationTag",
"(",
"ru",
".",
"Relation",
... | // RelationUnitSettings returns the unit settings for the specified relation unit. | [
"RelationUnitSettings",
"returns",
"the",
"unit",
"settings",
"for",
"the",
"specified",
"relation",
"unit",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/crossmodel/crossmodel.go#L189-L221 |
155,799 | juju/juju | apiserver/common/crossmodel/crossmodel.go | PublishIngressNetworkChange | func PublishIngressNetworkChange(backend Backend, relationTag names.Tag, change params.IngressNetworksChangeEvent) error {
logger.Debugf("publish into model %v network change for %v: %+v", backend.ModelUUID(), relationTag, change)
// Ensure the relation exists.
rel, err := backend.KeyRelation(relationTag.Id())
if ... | go | func PublishIngressNetworkChange(backend Backend, relationTag names.Tag, change params.IngressNetworksChangeEvent) error {
logger.Debugf("publish into model %v network change for %v: %+v", backend.ModelUUID(), relationTag, change)
// Ensure the relation exists.
rel, err := backend.KeyRelation(relationTag.Id())
if ... | [
"func",
"PublishIngressNetworkChange",
"(",
"backend",
"Backend",
",",
"relationTag",
"names",
".",
"Tag",
",",
"change",
"params",
".",
"IngressNetworksChangeEvent",
")",
"error",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"backend",
".",
"ModelUUID",
... | // PublishIngressNetworkChange saves the specified ingress networks for a relation. | [
"PublishIngressNetworkChange",
"saves",
"the",
"specified",
"ingress",
"networks",
"for",
"a",
"relation",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/crossmodel/crossmodel.go#L224-L243 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.