id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
154,000 | juju/juju | state/watcher.go | makeIdFilter | func makeIdFilter(backend modelBackend, marker string, receivers ...ActionReceiver) func(interface{}) bool {
if len(receivers) == 0 {
return nil
}
ensureMarkerFn := ensureSuffixFn(marker)
prefixes := make([]string, len(receivers))
for ix, receiver := range receivers {
prefixes[ix] = backend.docID(ensureMarkerF... | go | func makeIdFilter(backend modelBackend, marker string, receivers ...ActionReceiver) func(interface{}) bool {
if len(receivers) == 0 {
return nil
}
ensureMarkerFn := ensureSuffixFn(marker)
prefixes := make([]string, len(receivers))
for ix, receiver := range receivers {
prefixes[ix] = backend.docID(ensureMarkerF... | [
"func",
"makeIdFilter",
"(",
"backend",
"modelBackend",
",",
"marker",
"string",
",",
"receivers",
"...",
"ActionReceiver",
")",
"func",
"(",
"interface",
"{",
"}",
")",
"bool",
"{",
"if",
"len",
"(",
"receivers",
")",
"==",
"0",
"{",
"return",
"nil",
"\... | // makeIdFilter constructs a predicate to filter keys that have the
// prefix matching one of the passed in ActionReceivers, or returns nil
// if tags is empty | [
"makeIdFilter",
"constructs",
"a",
"predicate",
"to",
"filter",
"keys",
"that",
"have",
"the",
"prefix",
"matching",
"one",
"of",
"the",
"passed",
"in",
"ActionReceivers",
"or",
"returns",
"nil",
"if",
"tags",
"is",
"empty"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/watcher.go#L2721-L2744 |
154,001 | juju/juju | state/watcher.go | initial | func (w *collectionWatcher) initial() ([]string, error) {
var ids []string
var doc struct {
DocId string `bson:"_id"`
}
coll, closer := w.db.GetCollection(w.col)
defer closer()
iter := coll.Find(nil).Iter()
for iter.Next(&doc) {
if w.filter == nil || w.filter(doc.DocId) {
id := doc.DocId
if !w.colWCfg.... | go | func (w *collectionWatcher) initial() ([]string, error) {
var ids []string
var doc struct {
DocId string `bson:"_id"`
}
coll, closer := w.db.GetCollection(w.col)
defer closer()
iter := coll.Find(nil).Iter()
for iter.Next(&doc) {
if w.filter == nil || w.filter(doc.DocId) {
id := doc.DocId
if !w.colWCfg.... | [
"func",
"(",
"w",
"*",
"collectionWatcher",
")",
"initial",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"ids",
"[",
"]",
"string",
"\n",
"var",
"doc",
"struct",
"{",
"DocId",
"string",
"`bson:\"_id\"`",
"\n",
"}",
"\n",
"coll",
... | // initial pre-loads the id's that have already been added to the
// collection that would otherwise not normally trigger the watcher | [
"initial",
"pre",
"-",
"loads",
"the",
"id",
"s",
"that",
"have",
"already",
"been",
"added",
"to",
"the",
"collection",
"that",
"would",
"otherwise",
"not",
"normally",
"trigger",
"the",
"watcher"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/watcher.go#L2748-L2769 |
154,002 | juju/juju | state/watcher.go | mergeIds | func (w *collectionWatcher) mergeIds(changes *[]string, updates map[interface{}]bool) error {
return mergeIds(w.backend, changes, updates, w.convertId)
} | go | func (w *collectionWatcher) mergeIds(changes *[]string, updates map[interface{}]bool) error {
return mergeIds(w.backend, changes, updates, w.convertId)
} | [
"func",
"(",
"w",
"*",
"collectionWatcher",
")",
"mergeIds",
"(",
"changes",
"*",
"[",
"]",
"string",
",",
"updates",
"map",
"[",
"interface",
"{",
"}",
"]",
"bool",
")",
"error",
"{",
"return",
"mergeIds",
"(",
"w",
".",
"backend",
",",
"changes",
"... | // mergeIds is used for merging actionId's and actionResultId's that
// come in via the updates map. It cleans up the pending changes to
// account for id's being removed before the watcher consumes them,
// and to account for the potential overlap between the id's that were
// pending before the watcher started, and t... | [
"mergeIds",
"is",
"used",
"for",
"merging",
"actionId",
"s",
"and",
"actionResultId",
"s",
"that",
"come",
"in",
"via",
"the",
"updates",
"map",
".",
"It",
"cleans",
"up",
"the",
"pending",
"changes",
"to",
"account",
"for",
"id",
"s",
"being",
"removed",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/watcher.go#L2779-L2781 |
154,003 | juju/juju | state/watcher.go | ensureSuffixFn | func ensureSuffixFn(marker string) func(string) string {
return func(p string) string {
if !strings.HasSuffix(p, marker) {
p = p + marker
}
return p
}
} | go | func ensureSuffixFn(marker string) func(string) string {
return func(p string) string {
if !strings.HasSuffix(p, marker) {
p = p + marker
}
return p
}
} | [
"func",
"ensureSuffixFn",
"(",
"marker",
"string",
")",
"func",
"(",
"string",
")",
"string",
"{",
"return",
"func",
"(",
"p",
"string",
")",
"string",
"{",
"if",
"!",
"strings",
".",
"HasSuffix",
"(",
"p",
",",
"marker",
")",
"{",
"p",
"=",
"p",
"... | // ensureSuffixFn returns a function that will make sure the passed in
// string has the marker token at the end of it | [
"ensureSuffixFn",
"returns",
"a",
"function",
"that",
"will",
"make",
"sure",
"the",
"passed",
"in",
"string",
"has",
"the",
"marker",
"token",
"at",
"the",
"end",
"of",
"it"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/watcher.go#L2845-L2852 |
154,004 | juju/juju | state/watcher.go | watchEnqueuedActionsFilteredBy | func (st *State) watchEnqueuedActionsFilteredBy(receivers ...ActionReceiver) StringsWatcher {
return newCollectionWatcher(st, colWCfg{
col: actionNotificationsC,
filter: makeIdFilter(st, actionMarker, receivers...),
idconv: actionNotificationIdToActionId,
})
} | go | func (st *State) watchEnqueuedActionsFilteredBy(receivers ...ActionReceiver) StringsWatcher {
return newCollectionWatcher(st, colWCfg{
col: actionNotificationsC,
filter: makeIdFilter(st, actionMarker, receivers...),
idconv: actionNotificationIdToActionId,
})
} | [
"func",
"(",
"st",
"*",
"State",
")",
"watchEnqueuedActionsFilteredBy",
"(",
"receivers",
"...",
"ActionReceiver",
")",
"StringsWatcher",
"{",
"return",
"newCollectionWatcher",
"(",
"st",
",",
"colWCfg",
"{",
"col",
":",
"actionNotificationsC",
",",
"filter",
":",... | // watchEnqueuedActionsFilteredBy starts and returns a StringsWatcher
// that notifies on new Actions being enqueued on the ActionRecevers
// being watched. | [
"watchEnqueuedActionsFilteredBy",
"starts",
"and",
"returns",
"a",
"StringsWatcher",
"that",
"notifies",
"on",
"new",
"Actions",
"being",
"enqueued",
"on",
"the",
"ActionRecevers",
"being",
"watched",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/watcher.go#L2857-L2863 |
154,005 | juju/juju | state/watcher.go | WatchActionResultsFilteredBy | func (m *Model) WatchActionResultsFilteredBy(receivers ...ActionReceiver) StringsWatcher {
return newActionStatusWatcher(m.st, receivers, []ActionStatus{ActionCompleted, ActionCancelled, ActionFailed}...)
} | go | func (m *Model) WatchActionResultsFilteredBy(receivers ...ActionReceiver) StringsWatcher {
return newActionStatusWatcher(m.st, receivers, []ActionStatus{ActionCompleted, ActionCancelled, ActionFailed}...)
} | [
"func",
"(",
"m",
"*",
"Model",
")",
"WatchActionResultsFilteredBy",
"(",
"receivers",
"...",
"ActionReceiver",
")",
"StringsWatcher",
"{",
"return",
"newActionStatusWatcher",
"(",
"m",
".",
"st",
",",
"receivers",
",",
"[",
"]",
"ActionStatus",
"{",
"ActionComp... | // WatchActionResultsFilteredBy starts and returns a StringsWatcher
// that notifies on new ActionResults being added for the ActionRecevers
// being watched. | [
"WatchActionResultsFilteredBy",
"starts",
"and",
"returns",
"a",
"StringsWatcher",
"that",
"notifies",
"on",
"new",
"ActionResults",
"being",
"added",
"for",
"the",
"ActionRecevers",
"being",
"watched",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/watcher.go#L2941-L2943 |
154,006 | juju/juju | state/watcher.go | WatchForRebootEvent | func (m *Machine) WatchForRebootEvent() NotifyWatcher {
machineIds := m.machinesToCareAboutRebootsFor()
machines := set.NewStrings(machineIds...)
filter := func(key interface{}) bool {
if id, ok := key.(string); ok {
if id, err := m.st.strictLocalID(id); err == nil {
return machines.Contains(id)
} else ... | go | func (m *Machine) WatchForRebootEvent() NotifyWatcher {
machineIds := m.machinesToCareAboutRebootsFor()
machines := set.NewStrings(machineIds...)
filter := func(key interface{}) bool {
if id, ok := key.(string); ok {
if id, err := m.st.strictLocalID(id); err == nil {
return machines.Contains(id)
} else ... | [
"func",
"(",
"m",
"*",
"Machine",
")",
"WatchForRebootEvent",
"(",
")",
"NotifyWatcher",
"{",
"machineIds",
":=",
"m",
".",
"machinesToCareAboutRebootsFor",
"(",
")",
"\n",
"machines",
":=",
"set",
".",
"NewStrings",
"(",
"machineIds",
"...",
")",
"\n\n",
"f... | // WatchForRebootEvent returns a notify watcher that will trigger an event
// when the reboot flag is set on our machine agent, our parent machine agent
// or grandparent machine agent | [
"WatchForRebootEvent",
"returns",
"a",
"notify",
"watcher",
"that",
"will",
"trigger",
"an",
"event",
"when",
"the",
"reboot",
"flag",
"is",
"set",
"on",
"our",
"machine",
"agent",
"our",
"parent",
"machine",
"agent",
"or",
"grandparent",
"machine",
"agent"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/watcher.go#L3090-L3105 |
154,007 | juju/juju | state/watcher.go | WatchRemoteRelations | func (st *State) WatchRemoteRelations() StringsWatcher {
// Use a no-op transform func to record the known ids.
known := make(map[interface{}]bool)
tr := func(id string) string {
known[id] = true
return id
}
filter := func(id interface{}) bool {
id, err := st.strictLocalID(id.(string))
if err != nil {
... | go | func (st *State) WatchRemoteRelations() StringsWatcher {
// Use a no-op transform func to record the known ids.
known := make(map[interface{}]bool)
tr := func(id string) string {
known[id] = true
return id
}
filter := func(id interface{}) bool {
id, err := st.strictLocalID(id.(string))
if err != nil {
... | [
"func",
"(",
"st",
"*",
"State",
")",
"WatchRemoteRelations",
"(",
")",
"StringsWatcher",
"{",
"// Use a no-op transform func to record the known ids.",
"known",
":=",
"make",
"(",
"map",
"[",
"interface",
"{",
"}",
"]",
"bool",
")",
"\n",
"tr",
":=",
"func",
... | // WatchRemoteRelations returns a StringsWatcher that notifies of changes to
// the lifecycles of the remote relations in the model. | [
"WatchRemoteRelations",
"returns",
"a",
"StringsWatcher",
"that",
"notifies",
"of",
"changes",
"to",
"the",
"lifecycles",
"of",
"the",
"remote",
"relations",
"in",
"the",
"model",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/watcher.go#L3313-L3369 |
154,008 | juju/juju | state/watcher.go | WatchSubnets | func (st *State) WatchSubnets(subnetFilter func(id interface{}) bool) StringsWatcher {
filter := func(id interface{}) bool {
subnet, err := st.strictLocalID(id.(string))
if err != nil {
return false
}
if subnetFilter == nil {
return true
}
return subnetFilter(subnet)
}
return newLifecycleWatcher(s... | go | func (st *State) WatchSubnets(subnetFilter func(id interface{}) bool) StringsWatcher {
filter := func(id interface{}) bool {
subnet, err := st.strictLocalID(id.(string))
if err != nil {
return false
}
if subnetFilter == nil {
return true
}
return subnetFilter(subnet)
}
return newLifecycleWatcher(s... | [
"func",
"(",
"st",
"*",
"State",
")",
"WatchSubnets",
"(",
"subnetFilter",
"func",
"(",
"id",
"interface",
"{",
"}",
")",
"bool",
")",
"StringsWatcher",
"{",
"filter",
":=",
"func",
"(",
"id",
"interface",
"{",
"}",
")",
"bool",
"{",
"subnet",
",",
"... | // WatchSubnets returns a StringsWatcher that notifies of changes to
// the lifecycles of the subnets in the model. | [
"WatchSubnets",
"returns",
"a",
"StringsWatcher",
"that",
"notifies",
"of",
"changes",
"to",
"the",
"lifecycles",
"of",
"the",
"subnets",
"in",
"the",
"model",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/watcher.go#L3373-L3386 |
154,009 | juju/juju | state/watcher.go | isLocalID | func isLocalID(st modelBackend) func(interface{}) bool {
return func(id interface{}) bool {
key, ok := id.(string)
if !ok {
return false
}
_, err := st.strictLocalID(key)
return err == nil
}
} | go | func isLocalID(st modelBackend) func(interface{}) bool {
return func(id interface{}) bool {
key, ok := id.(string)
if !ok {
return false
}
_, err := st.strictLocalID(key)
return err == nil
}
} | [
"func",
"isLocalID",
"(",
"st",
"modelBackend",
")",
"func",
"(",
"interface",
"{",
"}",
")",
"bool",
"{",
"return",
"func",
"(",
"id",
"interface",
"{",
"}",
")",
"bool",
"{",
"key",
",",
"ok",
":=",
"id",
".",
"(",
"string",
")",
"\n",
"if",
"!... | // isLocalID returns a watcher filter func that rejects ids not specific
// to the supplied modelBackend. | [
"isLocalID",
"returns",
"a",
"watcher",
"filter",
"func",
"that",
"rejects",
"ids",
"not",
"specific",
"to",
"the",
"supplied",
"modelBackend",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/watcher.go#L3390-L3399 |
154,010 | juju/juju | state/watcher.go | WatchRelationIngressNetworks | func (r *Relation) WatchRelationIngressNetworks() StringsWatcher {
return newrelationNetworksWatcher(r.st, r.Tag().Id(), ingress)
} | go | func (r *Relation) WatchRelationIngressNetworks() StringsWatcher {
return newrelationNetworksWatcher(r.st, r.Tag().Id(), ingress)
} | [
"func",
"(",
"r",
"*",
"Relation",
")",
"WatchRelationIngressNetworks",
"(",
")",
"StringsWatcher",
"{",
"return",
"newrelationNetworksWatcher",
"(",
"r",
".",
"st",
",",
"r",
".",
"Tag",
"(",
")",
".",
"Id",
"(",
")",
",",
"ingress",
")",
"\n",
"}"
] | // WatchRelationIngressNetworks starts and returns a StringsWatcher notifying
// of ingress changes to the relationNetworks collection for the relation. | [
"WatchRelationIngressNetworks",
"starts",
"and",
"returns",
"a",
"StringsWatcher",
"notifying",
"of",
"ingress",
"changes",
"to",
"the",
"relationNetworks",
"collection",
"for",
"the",
"relation",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/watcher.go#L3417-L3419 |
154,011 | juju/juju | state/watcher.go | WatchRelationEgressNetworks | func (r *Relation) WatchRelationEgressNetworks() StringsWatcher {
return newrelationNetworksWatcher(r.st, r.Tag().Id(), egress)
} | go | func (r *Relation) WatchRelationEgressNetworks() StringsWatcher {
return newrelationNetworksWatcher(r.st, r.Tag().Id(), egress)
} | [
"func",
"(",
"r",
"*",
"Relation",
")",
"WatchRelationEgressNetworks",
"(",
")",
"StringsWatcher",
"{",
"return",
"newrelationNetworksWatcher",
"(",
"r",
".",
"st",
",",
"r",
".",
"Tag",
"(",
")",
".",
"Id",
"(",
")",
",",
"egress",
")",
"\n",
"}"
] | // WatchRelationEgressNetworks starts and returns a StringsWatcher notifying
// of egress changes to the relationNetworks collection for the relation. | [
"WatchRelationEgressNetworks",
"starts",
"and",
"returns",
"a",
"StringsWatcher",
"notifying",
"of",
"egress",
"changes",
"to",
"the",
"relationNetworks",
"collection",
"for",
"the",
"relation",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/watcher.go#L3423-L3425 |
154,012 | juju/juju | state/watcher.go | WatchPodSpec | func (m *CAASModel) WatchPodSpec(appTag names.ApplicationTag) (NotifyWatcher, error) {
docKeys := []docKey{{
podSpecsC,
m.st.docID(applicationGlobalKey(appTag.Id())),
}}
return newDocWatcher(m.st, docKeys), nil
} | go | func (m *CAASModel) WatchPodSpec(appTag names.ApplicationTag) (NotifyWatcher, error) {
docKeys := []docKey{{
podSpecsC,
m.st.docID(applicationGlobalKey(appTag.Id())),
}}
return newDocWatcher(m.st, docKeys), nil
} | [
"func",
"(",
"m",
"*",
"CAASModel",
")",
"WatchPodSpec",
"(",
"appTag",
"names",
".",
"ApplicationTag",
")",
"(",
"NotifyWatcher",
",",
"error",
")",
"{",
"docKeys",
":=",
"[",
"]",
"docKey",
"{",
"{",
"podSpecsC",
",",
"m",
".",
"st",
".",
"docID",
... | // WatchPodSpec returns a watcher observing changes that affect the
// pod spec for an application or unit. | [
"WatchPodSpec",
"returns",
"a",
"watcher",
"observing",
"changes",
"that",
"affect",
"the",
"pod",
"spec",
"for",
"an",
"application",
"or",
"unit",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/watcher.go#L3630-L3636 |
154,013 | juju/juju | state/watcher.go | WatchContainerAddressesHash | func (u *Unit) WatchContainerAddressesHash() StringsWatcher {
firstCall := true
w := &hashWatcher{
commonWatcher: newCommonWatcher(u.st),
out: make(chan []string),
collection: cloudContainersC,
id: u.st.docID(u.globalKey()),
hash: func() (string, error) {
result, err := hashContai... | go | func (u *Unit) WatchContainerAddressesHash() StringsWatcher {
firstCall := true
w := &hashWatcher{
commonWatcher: newCommonWatcher(u.st),
out: make(chan []string),
collection: cloudContainersC,
id: u.st.docID(u.globalKey()),
hash: func() (string, error) {
result, err := hashContai... | [
"func",
"(",
"u",
"*",
"Unit",
")",
"WatchContainerAddressesHash",
"(",
")",
"StringsWatcher",
"{",
"firstCall",
":=",
"true",
"\n",
"w",
":=",
"&",
"hashWatcher",
"{",
"commonWatcher",
":",
"newCommonWatcher",
"(",
"u",
".",
"st",
")",
",",
"out",
":",
... | // WatchContainerAddressesHash returns a StringsWatcher that emits a
// hash of the unit's container address whenever it changes. | [
"WatchContainerAddressesHash",
"returns",
"a",
"StringsWatcher",
"that",
"emits",
"a",
"hash",
"of",
"the",
"unit",
"s",
"container",
"address",
"whenever",
"it",
"changes",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/watcher.go#L3792-L3807 |
154,014 | juju/juju | cmd/juju/subnet/subnet.go | NewAPI | func (c *SubnetCommandBase) NewAPI() (SubnetAPI, error) {
if c.api != nil {
// Already created.
return c.api, nil
}
root, err := c.NewAPIRoot()
if err != nil {
return nil, errors.Trace(err)
}
// This is tested with a feature test.
shim := &mvpAPIShim{
apiState: root,
facade: subnets.NewAPI(root),
}... | go | func (c *SubnetCommandBase) NewAPI() (SubnetAPI, error) {
if c.api != nil {
// Already created.
return c.api, nil
}
root, err := c.NewAPIRoot()
if err != nil {
return nil, errors.Trace(err)
}
// This is tested with a feature test.
shim := &mvpAPIShim{
apiState: root,
facade: subnets.NewAPI(root),
}... | [
"func",
"(",
"c",
"*",
"SubnetCommandBase",
")",
"NewAPI",
"(",
")",
"(",
"SubnetAPI",
",",
"error",
")",
"{",
"if",
"c",
".",
"api",
"!=",
"nil",
"{",
"// Already created.",
"return",
"c",
".",
"api",
",",
"nil",
"\n",
"}",
"\n",
"root",
",",
"err... | // NewAPI returns a SubnetAPI for the root api endpoint that the
// environment command returns. | [
"NewAPI",
"returns",
"a",
"SubnetAPI",
"for",
"the",
"root",
"api",
"endpoint",
"that",
"the",
"environment",
"command",
"returns",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/subnet/subnet.go#L83-L99 |
154,015 | juju/juju | cmd/juju/subnet/subnet.go | ValidateSpace | func (s *SubnetCommandBase) ValidateSpace(given string) (names.SpaceTag, error) {
if !names.IsValidSpace(given) {
return names.SpaceTag{}, errors.Errorf("%q is not a valid space name", given)
}
return names.NewSpaceTag(given), nil
} | go | func (s *SubnetCommandBase) ValidateSpace(given string) (names.SpaceTag, error) {
if !names.IsValidSpace(given) {
return names.SpaceTag{}, errors.Errorf("%q is not a valid space name", given)
}
return names.NewSpaceTag(given), nil
} | [
"func",
"(",
"s",
"*",
"SubnetCommandBase",
")",
"ValidateSpace",
"(",
"given",
"string",
")",
"(",
"names",
".",
"SpaceTag",
",",
"error",
")",
"{",
"if",
"!",
"names",
".",
"IsValidSpace",
"(",
"given",
")",
"{",
"return",
"names",
".",
"SpaceTag",
"... | // ValidateSpace parses given and returns an error if it's not a valid
// space name, otherwise returns the parsed tag and no error. | [
"ValidateSpace",
"parses",
"given",
"and",
"returns",
"an",
"error",
"if",
"it",
"s",
"not",
"a",
"valid",
"space",
"name",
"otherwise",
"returns",
"the",
"parsed",
"tag",
"and",
"no",
"error",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/subnet/subnet.go#L154-L159 |
154,016 | juju/juju | worker/state/statetracker.go | Use | func (c *stateTracker) Use() (*state.StatePool, error) {
c.mu.Lock()
defer c.mu.Unlock()
if c.references == 0 {
return nil, ErrStateClosed
}
c.references++
return c.pool, nil
} | go | func (c *stateTracker) Use() (*state.StatePool, error) {
c.mu.Lock()
defer c.mu.Unlock()
if c.references == 0 {
return nil, ErrStateClosed
}
c.references++
return c.pool, nil
} | [
"func",
"(",
"c",
"*",
"stateTracker",
")",
"Use",
"(",
")",
"(",
"*",
"state",
".",
"StatePool",
",",
"error",
")",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"c",
".",
... | // Use implements StateTracker. | [
"Use",
"implements",
"StateTracker",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/state/statetracker.go#L53-L62 |
154,017 | juju/juju | worker/state/statetracker.go | Done | func (c *stateTracker) Done() error {
c.mu.Lock()
defer c.mu.Unlock()
if c.references == 0 {
return ErrStateClosed
}
c.references--
if c.references == 0 {
if err := c.pool.Close(); err != nil {
logger.Errorf("error when closing state pool: %v", err)
}
}
return nil
} | go | func (c *stateTracker) Done() error {
c.mu.Lock()
defer c.mu.Unlock()
if c.references == 0 {
return ErrStateClosed
}
c.references--
if c.references == 0 {
if err := c.pool.Close(); err != nil {
logger.Errorf("error when closing state pool: %v", err)
}
}
return nil
} | [
"func",
"(",
"c",
"*",
"stateTracker",
")",
"Done",
"(",
")",
"error",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"c",
".",
"references",
"==",
"0",
"{",
"return",
"ErrState... | // Done implements StateTracker. | [
"Done",
"implements",
"StateTracker",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/state/statetracker.go#L65-L79 |
154,018 | juju/juju | cmd/juju/controller/listmodels.go | tabularSummaries | func (c *modelsCommand) tabularSummaries(writer io.Writer, modelSet ModelSummarySet) error {
tw := output.TabWriter(writer)
w := output.Wrapper{tw}
c.tabularColumns(tw, w)
for _, model := range modelSet.Models {
cloudRegion := strings.Trim(model.Cloud+"/"+model.CloudRegion, "/")
owner := names.NewUserTag(model... | go | func (c *modelsCommand) tabularSummaries(writer io.Writer, modelSet ModelSummarySet) error {
tw := output.TabWriter(writer)
w := output.Wrapper{tw}
c.tabularColumns(tw, w)
for _, model := range modelSet.Models {
cloudRegion := strings.Trim(model.Cloud+"/"+model.CloudRegion, "/")
owner := names.NewUserTag(model... | [
"func",
"(",
"c",
"*",
"modelsCommand",
")",
"tabularSummaries",
"(",
"writer",
"io",
".",
"Writer",
",",
"modelSet",
"ModelSummarySet",
")",
"error",
"{",
"tw",
":=",
"output",
".",
"TabWriter",
"(",
"writer",
")",
"\n",
"w",
":=",
"output",
".",
"Wrapp... | // tabularSummaries takes model summaries set to adhere to the cmd.Formatter interface | [
"tabularSummaries",
"takes",
"model",
"summaries",
"set",
"to",
"adhere",
"to",
"the",
"cmd",
".",
"Formatter",
"interface"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/controller/listmodels.go#L404-L460 |
154,019 | juju/juju | api/client.go | Status | func (c *Client) Status(patterns []string) (*params.FullStatus, error) {
var result params.FullStatus
p := params.StatusParams{Patterns: patterns}
if err := c.facade.FacadeCall("FullStatus", p, &result); err != nil {
return nil, err
}
// Older servers don't fill out model type, but
// we know a missing type is ... | go | func (c *Client) Status(patterns []string) (*params.FullStatus, error) {
var result params.FullStatus
p := params.StatusParams{Patterns: patterns}
if err := c.facade.FacadeCall("FullStatus", p, &result); err != nil {
return nil, err
}
// Older servers don't fill out model type, but
// we know a missing type is ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"Status",
"(",
"patterns",
"[",
"]",
"string",
")",
"(",
"*",
"params",
".",
"FullStatus",
",",
"error",
")",
"{",
"var",
"result",
"params",
".",
"FullStatus",
"\n",
"p",
":=",
"params",
".",
"StatusParams",
"{"... | // Status returns the status of the juju model. | [
"Status",
"returns",
"the",
"status",
"of",
"the",
"juju",
"model",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L51-L63 |
154,020 | juju/juju | api/client.go | Resolved | func (c *Client) Resolved(unit string, retry bool) error {
p := params.Resolved{
UnitName: unit,
Retry: retry,
}
return c.facade.FacadeCall("Resolved", p, nil)
} | go | func (c *Client) Resolved(unit string, retry bool) error {
p := params.Resolved{
UnitName: unit,
Retry: retry,
}
return c.facade.FacadeCall("Resolved", p, nil)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"Resolved",
"(",
"unit",
"string",
",",
"retry",
"bool",
")",
"error",
"{",
"p",
":=",
"params",
".",
"Resolved",
"{",
"UnitName",
":",
"unit",
",",
"Retry",
":",
"retry",
",",
"}",
"\n",
"return",
"c",
".",
... | // Resolved clears errors on a unit. | [
"Resolved",
"clears",
"errors",
"on",
"a",
"unit",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L116-L122 |
154,021 | juju/juju | api/client.go | RetryProvisioning | func (c *Client) RetryProvisioning(machines ...names.MachineTag) ([]params.ErrorResult, error) {
p := params.Entities{}
p.Entities = make([]params.Entity, len(machines))
for i, machine := range machines {
p.Entities[i] = params.Entity{Tag: machine.String()}
}
var results params.ErrorResults
err := c.facade.Faca... | go | func (c *Client) RetryProvisioning(machines ...names.MachineTag) ([]params.ErrorResult, error) {
p := params.Entities{}
p.Entities = make([]params.Entity, len(machines))
for i, machine := range machines {
p.Entities[i] = params.Entity{Tag: machine.String()}
}
var results params.ErrorResults
err := c.facade.Faca... | [
"func",
"(",
"c",
"*",
"Client",
")",
"RetryProvisioning",
"(",
"machines",
"...",
"names",
".",
"MachineTag",
")",
"(",
"[",
"]",
"params",
".",
"ErrorResult",
",",
"error",
")",
"{",
"p",
":=",
"params",
".",
"Entities",
"{",
"}",
"\n",
"p",
".",
... | // RetryProvisioning updates the provisioning status of a machine allowing the
// provisioner to retry. | [
"RetryProvisioning",
"updates",
"the",
"provisioning",
"status",
"of",
"a",
"machine",
"allowing",
"the",
"provisioner",
"to",
"retry",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L126-L135 |
154,022 | juju/juju | api/client.go | PublicAddress | func (c *Client) PublicAddress(target string) (string, error) {
var results params.PublicAddressResults
p := params.PublicAddress{Target: target}
err := c.facade.FacadeCall("PublicAddress", p, &results)
return results.PublicAddress, err
} | go | func (c *Client) PublicAddress(target string) (string, error) {
var results params.PublicAddressResults
p := params.PublicAddress{Target: target}
err := c.facade.FacadeCall("PublicAddress", p, &results)
return results.PublicAddress, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"PublicAddress",
"(",
"target",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"results",
"params",
".",
"PublicAddressResults",
"\n",
"p",
":=",
"params",
".",
"PublicAddress",
"{",
"Target",
":",
"tar... | // PublicAddress returns the public address of the specified
// machine or unit. For a machine, target is an id not a tag. | [
"PublicAddress",
"returns",
"the",
"public",
"address",
"of",
"the",
"specified",
"machine",
"or",
"unit",
".",
"For",
"a",
"machine",
"target",
"is",
"an",
"id",
"not",
"a",
"tag",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L139-L144 |
154,023 | juju/juju | api/client.go | PrivateAddress | func (c *Client) PrivateAddress(target string) (string, error) {
var results params.PrivateAddressResults
p := params.PrivateAddress{Target: target}
err := c.facade.FacadeCall("PrivateAddress", p, &results)
return results.PrivateAddress, err
} | go | func (c *Client) PrivateAddress(target string) (string, error) {
var results params.PrivateAddressResults
p := params.PrivateAddress{Target: target}
err := c.facade.FacadeCall("PrivateAddress", p, &results)
return results.PrivateAddress, err
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"PrivateAddress",
"(",
"target",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"results",
"params",
".",
"PrivateAddressResults",
"\n",
"p",
":=",
"params",
".",
"PrivateAddress",
"{",
"Target",
":",
"... | // PrivateAddress returns the private address of the specified
// machine or unit. | [
"PrivateAddress",
"returns",
"the",
"private",
"address",
"of",
"the",
"specified",
"machine",
"or",
"unit",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L148-L153 |
154,024 | juju/juju | api/client.go | SetModelConstraints | func (c *Client) SetModelConstraints(constraints constraints.Value) error {
params := params.SetConstraints{
Constraints: constraints,
}
return c.facade.FacadeCall("SetModelConstraints", params, nil)
} | go | func (c *Client) SetModelConstraints(constraints constraints.Value) error {
params := params.SetConstraints{
Constraints: constraints,
}
return c.facade.FacadeCall("SetModelConstraints", params, nil)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"SetModelConstraints",
"(",
"constraints",
"constraints",
".",
"Value",
")",
"error",
"{",
"params",
":=",
"params",
".",
"SetConstraints",
"{",
"Constraints",
":",
"constraints",
",",
"}",
"\n",
"return",
"c",
".",
"f... | // SetModelConstraints specifies the constraints for the model. | [
"SetModelConstraints",
"specifies",
"the",
"constraints",
"for",
"the",
"model",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L224-L229 |
154,025 | juju/juju | api/client.go | ModelUUID | func (c *Client) ModelUUID() (string, bool) {
tag, ok := c.st.ModelTag()
if !ok {
return "", false
}
return tag.Id(), true
} | go | func (c *Client) ModelUUID() (string, bool) {
tag, ok := c.st.ModelTag()
if !ok {
return "", false
}
return tag.Id(), true
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ModelUUID",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"tag",
",",
"ok",
":=",
"c",
".",
"st",
".",
"ModelTag",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
... | // ModelUUID returns the model UUID from the client connection
// and reports whether it is valued. | [
"ModelUUID",
"returns",
"the",
"model",
"UUID",
"from",
"the",
"client",
"connection",
"and",
"reports",
"whether",
"it",
"is",
"valued",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L233-L239 |
154,026 | juju/juju | api/client.go | WatchAll | func (c *Client) WatchAll() (*AllWatcher, error) {
var info params.AllWatcherId
if err := c.facade.FacadeCall("WatchAll", nil, &info); err != nil {
return nil, err
}
return NewAllWatcher(c.st, &info.AllWatcherId), nil
} | go | func (c *Client) WatchAll() (*AllWatcher, error) {
var info params.AllWatcherId
if err := c.facade.FacadeCall("WatchAll", nil, &info); err != nil {
return nil, err
}
return NewAllWatcher(c.st, &info.AllWatcherId), nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"WatchAll",
"(",
")",
"(",
"*",
"AllWatcher",
",",
"error",
")",
"{",
"var",
"info",
"params",
".",
"AllWatcherId",
"\n",
"if",
"err",
":=",
"c",
".",
"facade",
".",
"FacadeCall",
"(",
"\"",
"\"",
",",
"nil",
... | // WatchAll returns an AllWatcher, from which you can request the Next
// collection of Deltas. | [
"WatchAll",
"returns",
"an",
"AllWatcher",
"from",
"which",
"you",
"can",
"request",
"the",
"Next",
"collection",
"of",
"Deltas",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L261-L267 |
154,027 | juju/juju | api/client.go | SetModelAgentVersion | func (c *Client) SetModelAgentVersion(version version.Number, ignoreAgentVersions bool) error {
args := params.SetModelAgentVersion{Version: version, IgnoreAgentVersions: ignoreAgentVersions}
return c.facade.FacadeCall("SetModelAgentVersion", args, nil)
} | go | func (c *Client) SetModelAgentVersion(version version.Number, ignoreAgentVersions bool) error {
args := params.SetModelAgentVersion{Version: version, IgnoreAgentVersions: ignoreAgentVersions}
return c.facade.FacadeCall("SetModelAgentVersion", args, nil)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"SetModelAgentVersion",
"(",
"version",
"version",
".",
"Number",
",",
"ignoreAgentVersions",
"bool",
")",
"error",
"{",
"args",
":=",
"params",
".",
"SetModelAgentVersion",
"{",
"Version",
":",
"version",
",",
"IgnoreAgen... | // SetModelAgentVersion sets the model agent-version setting
// to the given value. | [
"SetModelAgentVersion",
"sets",
"the",
"model",
"agent",
"-",
"version",
"setting",
"to",
"the",
"given",
"value",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L279-L282 |
154,028 | juju/juju | api/client.go | FindTools | func (c *Client) FindTools(majorVersion, minorVersion int, series, arch, agentStream string) (result params.FindToolsResult, err error) {
if c.facade.BestAPIVersion() == 1 && agentStream != "" {
return params.FindToolsResult{}, errors.New(
"passing agent-stream not supported by the controller")
}
args := params... | go | func (c *Client) FindTools(majorVersion, minorVersion int, series, arch, agentStream string) (result params.FindToolsResult, err error) {
if c.facade.BestAPIVersion() == 1 && agentStream != "" {
return params.FindToolsResult{}, errors.New(
"passing agent-stream not supported by the controller")
}
args := params... | [
"func",
"(",
"c",
"*",
"Client",
")",
"FindTools",
"(",
"majorVersion",
",",
"minorVersion",
"int",
",",
"series",
",",
"arch",
",",
"agentStream",
"string",
")",
"(",
"result",
"params",
".",
"FindToolsResult",
",",
"err",
"error",
")",
"{",
"if",
"c",
... | // FindTools returns a List containing all tools matching the specified parameters. | [
"FindTools",
"returns",
"a",
"List",
"containing",
"all",
"tools",
"matching",
"the",
"specified",
"parameters",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L291-L305 |
154,029 | juju/juju | api/client.go | UploadCharm | func (c *Client) UploadCharm(curl *charm.URL, content io.ReadSeeker) (*charm.URL, error) {
args := url.Values{}
args.Add("series", curl.Series)
args.Add("schema", curl.Schema)
args.Add("revision", strconv.Itoa(curl.Revision))
apiURI := url.URL{Path: "/charms", RawQuery: args.Encode()}
contentType := "application... | go | func (c *Client) UploadCharm(curl *charm.URL, content io.ReadSeeker) (*charm.URL, error) {
args := url.Values{}
args.Add("series", curl.Series)
args.Add("schema", curl.Schema)
args.Add("revision", strconv.Itoa(curl.Revision))
apiURI := url.URL{Path: "/charms", RawQuery: args.Encode()}
contentType := "application... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UploadCharm",
"(",
"curl",
"*",
"charm",
".",
"URL",
",",
"content",
"io",
".",
"ReadSeeker",
")",
"(",
"*",
"charm",
".",
"URL",
",",
"error",
")",
"{",
"args",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
... | // UploadCharm sends the content to the API server using an HTTP post. | [
"UploadCharm",
"sends",
"the",
"content",
"to",
"the",
"API",
"server",
"using",
"an",
"HTTP",
"post",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L396-L414 |
154,030 | juju/juju | api/client.go | OpenURI | func (c *Client) OpenURI(uri string, query url.Values) (io.ReadCloser, error) {
return openURI(c.st, uri, query)
} | go | func (c *Client) OpenURI(uri string, query url.Values) (io.ReadCloser, error) {
return openURI(c.st, uri, query)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"OpenURI",
"(",
"uri",
"string",
",",
"query",
"url",
".",
"Values",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"return",
"openURI",
"(",
"c",
".",
"st",
",",
"uri",
",",
"query",
")",
"\n",
... | // OpenURI performs a GET on a Juju HTTP endpoint returning the | [
"OpenURI",
"performs",
"a",
"GET",
"on",
"a",
"Juju",
"HTTP",
"endpoint",
"returning",
"the"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L531-L533 |
154,031 | juju/juju | api/client.go | NewCharmDownloader | func NewCharmDownloader(apiCaller base.APICaller) *downloader.Downloader {
dlr := &downloader.Downloader{
OpenBlob: func(url *url.URL) (io.ReadCloser, error) {
curl, err := charm.ParseURL(url.String())
if err != nil {
return nil, errors.Annotate(err, "did not receive a valid charm URL")
}
reader, err... | go | func NewCharmDownloader(apiCaller base.APICaller) *downloader.Downloader {
dlr := &downloader.Downloader{
OpenBlob: func(url *url.URL) (io.ReadCloser, error) {
curl, err := charm.ParseURL(url.String())
if err != nil {
return nil, errors.Annotate(err, "did not receive a valid charm URL")
}
reader, err... | [
"func",
"NewCharmDownloader",
"(",
"apiCaller",
"base",
".",
"APICaller",
")",
"*",
"downloader",
".",
"Downloader",
"{",
"dlr",
":=",
"&",
"downloader",
".",
"Downloader",
"{",
"OpenBlob",
":",
"func",
"(",
"url",
"*",
"url",
".",
"URL",
")",
"(",
"io",... | // NewCharmDownloader returns a new charm downloader that wraps the
// provided API caller. | [
"NewCharmDownloader",
"returns",
"a",
"new",
"charm",
"downloader",
"that",
"wraps",
"the",
"provided",
"API",
"caller",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L550-L565 |
154,032 | juju/juju | api/client.go | APIHostPorts | func (c *Client) APIHostPorts() ([][]network.HostPort, error) {
var result params.APIHostPortsResult
if err := c.facade.FacadeCall("APIHostPorts", nil, &result); err != nil {
return nil, err
}
return result.NetworkHostsPorts(), nil
} | go | func (c *Client) APIHostPorts() ([][]network.HostPort, error) {
var result params.APIHostPortsResult
if err := c.facade.FacadeCall("APIHostPorts", nil, &result); err != nil {
return nil, err
}
return result.NetworkHostsPorts(), nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"APIHostPorts",
"(",
")",
"(",
"[",
"]",
"[",
"]",
"network",
".",
"HostPort",
",",
"error",
")",
"{",
"var",
"result",
"params",
".",
"APIHostPortsResult",
"\n",
"if",
"err",
":=",
"c",
".",
"facade",
".",
"Fa... | // APIHostPorts returns a slice of network.HostPort for each API server. | [
"APIHostPorts",
"returns",
"a",
"slice",
"of",
"network",
".",
"HostPort",
"for",
"each",
"API",
"server",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L598-L604 |
154,033 | juju/juju | api/client.go | AgentVersion | func (c *Client) AgentVersion() (version.Number, error) {
var result params.AgentVersionResult
if err := c.facade.FacadeCall("AgentVersion", nil, &result); err != nil {
return version.Number{}, err
}
return result.Version, nil
} | go | func (c *Client) AgentVersion() (version.Number, error) {
var result params.AgentVersionResult
if err := c.facade.FacadeCall("AgentVersion", nil, &result); err != nil {
return version.Number{}, err
}
return result.Version, nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"AgentVersion",
"(",
")",
"(",
"version",
".",
"Number",
",",
"error",
")",
"{",
"var",
"result",
"params",
".",
"AgentVersionResult",
"\n",
"if",
"err",
":=",
"c",
".",
"facade",
".",
"FacadeCall",
"(",
"\"",
"\... | // AgentVersion reports the version number of the api server. | [
"AgentVersion",
"reports",
"the",
"version",
"number",
"of",
"the",
"api",
"server",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L607-L613 |
154,034 | juju/juju | api/client.go | websocketDialWithErrors | func websocketDialWithErrors(dialer WebsocketDialer, urlStr string, requestHeader http.Header) (base.Stream, error) {
c, resp, err := dialer.Dial(urlStr, requestHeader)
if err != nil {
if err == websocket.ErrBadHandshake {
// If ErrBadHandshake is returned, a non-nil response
// is returned so the client can ... | go | func websocketDialWithErrors(dialer WebsocketDialer, urlStr string, requestHeader http.Header) (base.Stream, error) {
c, resp, err := dialer.Dial(urlStr, requestHeader)
if err != nil {
if err == websocket.ErrBadHandshake {
// If ErrBadHandshake is returned, a non-nil response
// is returned so the client can ... | [
"func",
"websocketDialWithErrors",
"(",
"dialer",
"WebsocketDialer",
",",
"urlStr",
"string",
",",
"requestHeader",
"http",
".",
"Header",
")",
"(",
"base",
".",
"Stream",
",",
"error",
")",
"{",
"c",
",",
"resp",
",",
"err",
":=",
"dialer",
".",
"Dial",
... | // websocketDialWithErrors dials the websocket and extracts any error
// from the response if there's a handshake error setting up the
// socket. Any other errors are returned normally. | [
"websocketDialWithErrors",
"dials",
"the",
"websocket",
"and",
"extracts",
"any",
"error",
"from",
"the",
"response",
"if",
"there",
"s",
"a",
"handshake",
"error",
"setting",
"up",
"the",
"socket",
".",
"Any",
"other",
"errors",
"are",
"returned",
"normally",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L628-L664 |
154,035 | juju/juju | api/client.go | WriteJSON | func (s *DeadlineStream) WriteJSON(v interface{}) error {
// This uses a real clock rather than trying to use a clock passed
// in because the websocket will use a real clock to determine
// whether the deadline has passed anyway.
deadline := time.Now().Add(s.Timeout)
if err := s.Conn.SetWriteDeadline(deadline); e... | go | func (s *DeadlineStream) WriteJSON(v interface{}) error {
// This uses a real clock rather than trying to use a clock passed
// in because the websocket will use a real clock to determine
// whether the deadline has passed anyway.
deadline := time.Now().Add(s.Timeout)
if err := s.Conn.SetWriteDeadline(deadline); e... | [
"func",
"(",
"s",
"*",
"DeadlineStream",
")",
"WriteJSON",
"(",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"// This uses a real clock rather than trying to use a clock passed",
"// in because the websocket will use a real clock to determine",
"// whether the deadline has passed... | // WriteJSON is part of base.Stream. | [
"WriteJSON",
"is",
"part",
"of",
"base",
".",
"Stream",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L675-L684 |
154,036 | juju/juju | api/client.go | WatchDebugLog | func (c *Client) WatchDebugLog(args common.DebugLogParams) (<-chan common.LogMessage, error) {
return common.StreamDebugLog(c.st, args)
} | go | func (c *Client) WatchDebugLog(args common.DebugLogParams) (<-chan common.LogMessage, error) {
return common.StreamDebugLog(c.st, args)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"WatchDebugLog",
"(",
"args",
"common",
".",
"DebugLogParams",
")",
"(",
"<-",
"chan",
"common",
".",
"LogMessage",
",",
"error",
")",
"{",
"return",
"common",
".",
"StreamDebugLog",
"(",
"c",
".",
"st",
",",
"args... | // WatchDebugLog returns a channel of structured Log Messages. Only log entries
// that match the filtering specified in the DebugLogParams are returned. | [
"WatchDebugLog",
"returns",
"a",
"channel",
"of",
"structured",
"Log",
"Messages",
".",
"Only",
"log",
"entries",
"that",
"match",
"the",
"filtering",
"specified",
"in",
"the",
"DebugLogParams",
"are",
"returned",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/client.go#L688-L690 |
154,037 | juju/juju | docker/docker.go | ListOperatorImages | func ListOperatorImages(imagePath string) (tools.Versions, error) {
tagsURL := fmt.Sprintf("%s/%s/tags", baseRegistryURL, imagePath)
logger.Debugf("operater image tags URL: %v", tagsURL)
data, err := HttpGet(tagsURL, 30*time.Second)
if err != nil {
return nil, errors.Trace(err)
}
type info struct {
Tag strin... | go | func ListOperatorImages(imagePath string) (tools.Versions, error) {
tagsURL := fmt.Sprintf("%s/%s/tags", baseRegistryURL, imagePath)
logger.Debugf("operater image tags URL: %v", tagsURL)
data, err := HttpGet(tagsURL, 30*time.Second)
if err != nil {
return nil, errors.Trace(err)
}
type info struct {
Tag strin... | [
"func",
"ListOperatorImages",
"(",
"imagePath",
"string",
")",
"(",
"tools",
".",
"Versions",
",",
"error",
")",
"{",
"tagsURL",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"baseRegistryURL",
",",
"imagePath",
")",
"\n",
"logger",
".",
"Debugf",
"... | // ListOperatorImages queries the standard docker registry and
// returns the version tags for images matching imagePath.
// The results are used when upgrading Juju to see what's available. | [
"ListOperatorImages",
"queries",
"the",
"standard",
"docker",
"registry",
"and",
"returns",
"the",
"version",
"tags",
"for",
"images",
"matching",
"imagePath",
".",
"The",
"results",
"are",
"used",
"when",
"upgrading",
"Juju",
"to",
"see",
"what",
"s",
"availabl... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/docker/docker.go#L38-L65 |
154,038 | juju/juju | apiserver/common/unitstatus.go | UnitStatus | func (c *ModelPresenceContext) UnitStatus(unit UnitStatusGetter) (agent StatusAndErr, workload StatusAndErr) {
agent.Status, agent.Err = unit.AgentStatus()
workload.Status, workload.Err = unit.Status()
if !canBeLost(agent.Status, workload.Status) {
// The unit is allocating or installing - there's no point in
/... | go | func (c *ModelPresenceContext) UnitStatus(unit UnitStatusGetter) (agent StatusAndErr, workload StatusAndErr) {
agent.Status, agent.Err = unit.AgentStatus()
workload.Status, workload.Err = unit.Status()
if !canBeLost(agent.Status, workload.Status) {
// The unit is allocating or installing - there's no point in
/... | [
"func",
"(",
"c",
"*",
"ModelPresenceContext",
")",
"UnitStatus",
"(",
"unit",
"UnitStatusGetter",
")",
"(",
"agent",
"StatusAndErr",
",",
"workload",
"StatusAndErr",
")",
"{",
"agent",
".",
"Status",
",",
"agent",
".",
"Err",
"=",
"unit",
".",
"AgentStatus"... | // UnitStatus returns the unit agent and workload status for a given
// unit, with special handling for agent presence. | [
"UnitStatus",
"returns",
"the",
"unit",
"agent",
"and",
"workload",
"status",
"for",
"a",
"given",
"unit",
"with",
"special",
"handling",
"for",
"agent",
"presence",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/unitstatus.go#L36-L62 |
154,039 | juju/juju | api/upgrader/upgrader.go | SetVersion | func (st *State) SetVersion(tag string, v version.Binary) error {
var results params.ErrorResults
args := params.EntitiesVersion{
AgentTools: []params.EntityVersion{{
Tag: tag,
Tools: ¶ms.Version{v},
}},
}
err := st.facade.FacadeCall("SetTools", args, &results)
if err != nil {
// TODO: Not direct... | go | func (st *State) SetVersion(tag string, v version.Binary) error {
var results params.ErrorResults
args := params.EntitiesVersion{
AgentTools: []params.EntityVersion{{
Tag: tag,
Tools: ¶ms.Version{v},
}},
}
err := st.facade.FacadeCall("SetTools", args, &results)
if err != nil {
// TODO: Not direct... | [
"func",
"(",
"st",
"*",
"State",
")",
"SetVersion",
"(",
"tag",
"string",
",",
"v",
"version",
".",
"Binary",
")",
"error",
"{",
"var",
"results",
"params",
".",
"ErrorResults",
"\n",
"args",
":=",
"params",
".",
"EntitiesVersion",
"{",
"AgentTools",
":"... | // SetVersion sets the tools version associated with the entity with
// the given tag, which must be the tag of the entity that the
// upgrader is running on behalf of. | [
"SetVersion",
"sets",
"the",
"tools",
"version",
"associated",
"with",
"the",
"entity",
"with",
"the",
"given",
"tag",
"which",
"must",
"be",
"the",
"tag",
"of",
"the",
"entity",
"that",
"the",
"upgrader",
"is",
"running",
"on",
"behalf",
"of",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/upgrader/upgrader.go#L32-L46 |
154,040 | juju/juju | api/upgrader/upgrader.go | Tools | func (st *State) Tools(tag string) (tools.List, error) {
var results params.ToolsResults
args := params.Entities{
Entities: []params.Entity{{Tag: tag}},
}
err := st.facade.FacadeCall("Tools", args, &results)
if err != nil {
// TODO: Not directly tested
return nil, err
}
if len(results.Results) != 1 {
// ... | go | func (st *State) Tools(tag string) (tools.List, error) {
var results params.ToolsResults
args := params.Entities{
Entities: []params.Entity{{Tag: tag}},
}
err := st.facade.FacadeCall("Tools", args, &results)
if err != nil {
// TODO: Not directly tested
return nil, err
}
if len(results.Results) != 1 {
// ... | [
"func",
"(",
"st",
"*",
"State",
")",
"Tools",
"(",
"tag",
"string",
")",
"(",
"tools",
".",
"List",
",",
"error",
")",
"{",
"var",
"results",
"params",
".",
"ToolsResults",
"\n",
"args",
":=",
"params",
".",
"Entities",
"{",
"Entities",
":",
"[",
... | // Tools returns the agent tools that should run on the given entity,
// along with a flag whether to disable SSL hostname verification. | [
"Tools",
"returns",
"the",
"agent",
"tools",
"that",
"should",
"run",
"on",
"the",
"given",
"entity",
"along",
"with",
"a",
"flag",
"whether",
"to",
"disable",
"SSL",
"hostname",
"verification",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/upgrader/upgrader.go#L75-L94 |
154,041 | juju/juju | state/relation.go | Tag | func (r *Relation) Tag() names.Tag {
return names.NewRelationTag(r.doc.Key)
} | go | func (r *Relation) Tag() names.Tag {
return names.NewRelationTag(r.doc.Key)
} | [
"func",
"(",
"r",
"*",
"Relation",
")",
"Tag",
"(",
")",
"names",
".",
"Tag",
"{",
"return",
"names",
".",
"NewRelationTag",
"(",
"r",
".",
"doc",
".",
"Key",
")",
"\n",
"}"
] | // Tag returns a name identifying the relation. | [
"Tag",
"returns",
"a",
"name",
"identifying",
"the",
"relation",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/relation.go#L71-L73 |
154,042 | juju/juju | state/relation.go | Status | func (r *Relation) Status() (status.StatusInfo, error) {
rStatus, err := getStatus(r.st.db(), r.globalScope(), "relation")
if err != nil {
return rStatus, err
}
return rStatus, nil
} | go | func (r *Relation) Status() (status.StatusInfo, error) {
rStatus, err := getStatus(r.st.db(), r.globalScope(), "relation")
if err != nil {
return rStatus, err
}
return rStatus, nil
} | [
"func",
"(",
"r",
"*",
"Relation",
")",
"Status",
"(",
")",
"(",
"status",
".",
"StatusInfo",
",",
"error",
")",
"{",
"rStatus",
",",
"err",
":=",
"getStatus",
"(",
"r",
".",
"st",
".",
"db",
"(",
")",
",",
"r",
".",
"globalScope",
"(",
")",
",... | // Status returns the relation's current status data. | [
"Status",
"returns",
"the",
"relation",
"s",
"current",
"status",
"data",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/relation.go#L116-L122 |
154,043 | juju/juju | state/relation.go | SetStatus | func (r *Relation) SetStatus(statusInfo status.StatusInfo) error {
currentStatus, err := r.Status()
if err != nil {
return errors.Trace(err)
}
if currentStatus.Status != statusInfo.Status {
validTransition := true
switch statusInfo.Status {
case status.Broken:
case status.Suspending:
validTransition =... | go | func (r *Relation) SetStatus(statusInfo status.StatusInfo) error {
currentStatus, err := r.Status()
if err != nil {
return errors.Trace(err)
}
if currentStatus.Status != statusInfo.Status {
validTransition := true
switch statusInfo.Status {
case status.Broken:
case status.Suspending:
validTransition =... | [
"func",
"(",
"r",
"*",
"Relation",
")",
"SetStatus",
"(",
"statusInfo",
"status",
".",
"StatusInfo",
")",
"error",
"{",
"currentStatus",
",",
"err",
":=",
"r",
".",
"Status",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Tr... | // SetStatus sets the status of the relation. | [
"SetStatus",
"sets",
"the",
"status",
"of",
"the",
"relation",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/relation.go#L125-L161 |
154,044 | juju/juju | state/relation.go | DestroyOperation | func (r *Relation) DestroyOperation(force bool) *DestroyRelationOperation {
return &DestroyRelationOperation{
r: &Relation{r.st, r.doc},
ForcedOperation: ForcedOperation{Force: force},
}
} | go | func (r *Relation) DestroyOperation(force bool) *DestroyRelationOperation {
return &DestroyRelationOperation{
r: &Relation{r.st, r.doc},
ForcedOperation: ForcedOperation{Force: force},
}
} | [
"func",
"(",
"r",
"*",
"Relation",
")",
"DestroyOperation",
"(",
"force",
"bool",
")",
"*",
"DestroyRelationOperation",
"{",
"return",
"&",
"DestroyRelationOperation",
"{",
"r",
":",
"&",
"Relation",
"{",
"r",
".",
"st",
",",
"r",
".",
"doc",
"}",
",",
... | // DestroyOperation returns a model operation that will allow relation to leave scope. | [
"DestroyOperation",
"returns",
"a",
"model",
"operation",
"that",
"will",
"allow",
"relation",
"to",
"leave",
"scope",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/relation.go#L254-L259 |
154,045 | juju/juju | state/relation.go | DestroyWithForce | func (r *Relation) DestroyWithForce(force bool, maxWait time.Duration) ([]error, error) {
op := r.DestroyOperation(force)
op.MaxWait = maxWait
err := r.st.ApplyOperation(op)
return op.Errors, err
} | go | func (r *Relation) DestroyWithForce(force bool, maxWait time.Duration) ([]error, error) {
op := r.DestroyOperation(force)
op.MaxWait = maxWait
err := r.st.ApplyOperation(op)
return op.Errors, err
} | [
"func",
"(",
"r",
"*",
"Relation",
")",
"DestroyWithForce",
"(",
"force",
"bool",
",",
"maxWait",
"time",
".",
"Duration",
")",
"(",
"[",
"]",
"error",
",",
"error",
")",
"{",
"op",
":=",
"r",
".",
"DestroyOperation",
"(",
"force",
")",
"\n",
"op",
... | // DestroyWithForce may force the destruction of the relation.
// In addition, this function also returns all non-fatal operational errors
// encountered. | [
"DestroyWithForce",
"may",
"force",
"the",
"destruction",
"of",
"the",
"relation",
".",
"In",
"addition",
"this",
"function",
"also",
"returns",
"all",
"non",
"-",
"fatal",
"operational",
"errors",
"encountered",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/relation.go#L312-L317 |
154,046 | juju/juju | state/relation.go | Destroy | func (r *Relation) Destroy() error {
_, err := r.DestroyWithForce(false, time.Duration(0))
return err
} | go | func (r *Relation) Destroy() error {
_, err := r.DestroyWithForce(false, time.Duration(0))
return err
} | [
"func",
"(",
"r",
"*",
"Relation",
")",
"Destroy",
"(",
")",
"error",
"{",
"_",
",",
"err",
":=",
"r",
".",
"DestroyWithForce",
"(",
"false",
",",
"time",
".",
"Duration",
"(",
"0",
")",
")",
"\n",
"return",
"err",
"\n",
"}"
] | // Destroy ensures that the relation will be removed at some point; if no units
// are currently in scope, it will be removed immediately. | [
"Destroy",
"ensures",
"that",
"the",
"relation",
"will",
"be",
"removed",
"at",
"some",
"point",
";",
"if",
"no",
"units",
"are",
"currently",
"in",
"scope",
"it",
"will",
"be",
"removed",
"immediately",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/relation.go#L321-L324 |
154,047 | juju/juju | state/relation.go | internalDestroy | func (op *DestroyRelationOperation) internalDestroy() (ops []txn.Op, err error) {
if len(op.r.doc.Endpoints) == 1 && op.r.doc.Endpoints[0].Role == charm.RolePeer {
return nil, errors.Errorf("is a peer relation")
}
defer func() {
if err == nil {
// This is a white lie; the document might actually be removed.
... | go | func (op *DestroyRelationOperation) internalDestroy() (ops []txn.Op, err error) {
if len(op.r.doc.Endpoints) == 1 && op.r.doc.Endpoints[0].Role == charm.RolePeer {
return nil, errors.Errorf("is a peer relation")
}
defer func() {
if err == nil {
// This is a white lie; the document might actually be removed.
... | [
"func",
"(",
"op",
"*",
"DestroyRelationOperation",
")",
"internalDestroy",
"(",
")",
"(",
"ops",
"[",
"]",
"txn",
".",
"Op",
",",
"err",
"error",
")",
"{",
"if",
"len",
"(",
"op",
".",
"r",
".",
"doc",
".",
"Endpoints",
")",
"==",
"1",
"&&",
"op... | // When 'force' is set, this call will construct and apply needed operations
// as well as accumulate all operational errors encountered.
// If the 'force' is not set, any error will be fatal and no operations will be applied. | [
"When",
"force",
"is",
"set",
"this",
"call",
"will",
"construct",
"and",
"apply",
"needed",
"operations",
"as",
"well",
"as",
"accumulate",
"all",
"operational",
"errors",
"encountered",
".",
"If",
"the",
"force",
"is",
"not",
"set",
"any",
"error",
"will",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/relation.go#L329-L401 |
154,048 | juju/juju | state/relation.go | destroyOps | func (r *Relation) destroyOps(ignoreApplication string, op *ForcedOperation) (ops []txn.Op, isRemove bool, err error) {
if r.doc.Life != Alive {
if !op.Force {
return nil, false, errAlreadyDying
}
}
if r.doc.UnitCount == 0 {
// When 'force' is set, this call will return both needed operations
// as well a... | go | func (r *Relation) destroyOps(ignoreApplication string, op *ForcedOperation) (ops []txn.Op, isRemove bool, err error) {
if r.doc.Life != Alive {
if !op.Force {
return nil, false, errAlreadyDying
}
}
if r.doc.UnitCount == 0 {
// When 'force' is set, this call will return both needed operations
// as well a... | [
"func",
"(",
"r",
"*",
"Relation",
")",
"destroyOps",
"(",
"ignoreApplication",
"string",
",",
"op",
"*",
"ForcedOperation",
")",
"(",
"ops",
"[",
"]",
"txn",
".",
"Op",
",",
"isRemove",
"bool",
",",
"err",
"error",
")",
"{",
"if",
"r",
".",
"doc",
... | // destroyOps returns the operations necessary to destroy the relation, and
// whether those operations will lead to the relation's removal. These
// operations may include changes to the relation's applications; however, if
// ignoreApplication is not empty, no operations modifying that application will
// be generate... | [
"destroyOps",
"returns",
"the",
"operations",
"necessary",
"to",
"destroy",
"the",
"relation",
"and",
"whether",
"those",
"operations",
"will",
"lead",
"to",
"the",
"relation",
"s",
"removal",
".",
"These",
"operations",
"may",
"include",
"changes",
"to",
"the",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/relation.go#L411-L436 |
154,049 | juju/juju | state/relation.go | removeOps | func (r *Relation) removeOps(ignoreApplication string, departingUnitName string, op *ForcedOperation) ([]txn.Op, error) {
relOp := txn.Op{
C: relationsC,
Id: r.doc.DocID,
Remove: true,
}
if departingUnitName != "" {
relOp.Assert = bson.D{{"life", Dying}, {"unitcount", 1}}
} else {
relOp.Assert = ... | go | func (r *Relation) removeOps(ignoreApplication string, departingUnitName string, op *ForcedOperation) ([]txn.Op, error) {
relOp := txn.Op{
C: relationsC,
Id: r.doc.DocID,
Remove: true,
}
if departingUnitName != "" {
relOp.Assert = bson.D{{"life", Dying}, {"unitcount", 1}}
} else {
relOp.Assert = ... | [
"func",
"(",
"r",
"*",
"Relation",
")",
"removeOps",
"(",
"ignoreApplication",
"string",
",",
"departingUnitName",
"string",
",",
"op",
"*",
"ForcedOperation",
")",
"(",
"[",
"]",
"txn",
".",
"Op",
",",
"error",
")",
"{",
"relOp",
":=",
"txn",
".",
"Op... | // removeOps returns the operations necessary to remove the relation. If
// ignoreApplication is not empty, no operations affecting that application will be
// included; if departingUnitName is non-empty, this implies that the
// relation's applications may be Dying and otherwise unreferenced, and may thus
// require r... | [
"removeOps",
"returns",
"the",
"operations",
"necessary",
"to",
"remove",
"the",
"relation",
".",
"If",
"ignoreApplication",
"is",
"not",
"empty",
"no",
"operations",
"affecting",
"that",
"application",
"will",
"be",
"included",
";",
"if",
"departingUnitName",
"is... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/relation.go#L446-L494 |
154,050 | juju/juju | state/relation.go | removeLocalEndpointOps | func (r *Relation) removeLocalEndpointOps(ep Endpoint, departingUnitName string, op *ForcedOperation) ([]txn.Op, error) {
var asserts bson.D
hasRelation := bson.D{{"relationcount", bson.D{{"$gt", 0}}}}
departingUnitApplicationMatchesEndpoint := func() bool {
s, err := names.UnitApplication(departingUnitName)
ret... | go | func (r *Relation) removeLocalEndpointOps(ep Endpoint, departingUnitName string, op *ForcedOperation) ([]txn.Op, error) {
var asserts bson.D
hasRelation := bson.D{{"relationcount", bson.D{{"$gt", 0}}}}
departingUnitApplicationMatchesEndpoint := func() bool {
s, err := names.UnitApplication(departingUnitName)
ret... | [
"func",
"(",
"r",
"*",
"Relation",
")",
"removeLocalEndpointOps",
"(",
"ep",
"Endpoint",
",",
"departingUnitName",
"string",
",",
"op",
"*",
"ForcedOperation",
")",
"(",
"[",
"]",
"txn",
".",
"Op",
",",
"error",
")",
"{",
"var",
"asserts",
"bson",
".",
... | // When 'force' is set, this call will return both needed operations
// as well as all operational errors encountered.
// If the 'force' is not set, any error will be fatal and no operations will be returned. | [
"When",
"force",
"is",
"set",
"this",
"call",
"will",
"return",
"both",
"needed",
"operations",
"as",
"well",
"as",
"all",
"operational",
"errors",
"encountered",
".",
"If",
"the",
"force",
"is",
"not",
"set",
"any",
"error",
"will",
"be",
"fatal",
"and",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/relation.go#L499-L545 |
154,051 | juju/juju | state/relation.go | Endpoint | func (r *Relation) Endpoint(applicationname string) (Endpoint, error) {
for _, ep := range r.doc.Endpoints {
if ep.ApplicationName == applicationname {
return ep, nil
}
}
msg := fmt.Sprintf("application %q is not a member of %q", applicationname, r)
return Endpoint{}, errors.NewNotFound(nil, msg)
} | go | func (r *Relation) Endpoint(applicationname string) (Endpoint, error) {
for _, ep := range r.doc.Endpoints {
if ep.ApplicationName == applicationname {
return ep, nil
}
}
msg := fmt.Sprintf("application %q is not a member of %q", applicationname, r)
return Endpoint{}, errors.NewNotFound(nil, msg)
} | [
"func",
"(",
"r",
"*",
"Relation",
")",
"Endpoint",
"(",
"applicationname",
"string",
")",
"(",
"Endpoint",
",",
"error",
")",
"{",
"for",
"_",
",",
"ep",
":=",
"range",
"r",
".",
"doc",
".",
"Endpoints",
"{",
"if",
"ep",
".",
"ApplicationName",
"=="... | // Endpoint returns the endpoint of the relation for the named application.
// If the application is not part of the relation, an error will be returned. | [
"Endpoint",
"returns",
"the",
"endpoint",
"of",
"the",
"relation",
"for",
"the",
"named",
"application",
".",
"If",
"the",
"application",
"is",
"not",
"part",
"of",
"the",
"relation",
"an",
"error",
"will",
"be",
"returned",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/relation.go#L597-L605 |
154,052 | juju/juju | state/relation.go | RelatedEndpoints | func (r *Relation) RelatedEndpoints(applicationname string) ([]Endpoint, error) {
local, err := r.Endpoint(applicationname)
if err != nil {
return nil, err
}
role := counterpartRole(local.Role)
var eps []Endpoint
for _, ep := range r.doc.Endpoints {
if ep.Role == role {
eps = append(eps, ep)
}
}
if eps... | go | func (r *Relation) RelatedEndpoints(applicationname string) ([]Endpoint, error) {
local, err := r.Endpoint(applicationname)
if err != nil {
return nil, err
}
role := counterpartRole(local.Role)
var eps []Endpoint
for _, ep := range r.doc.Endpoints {
if ep.Role == role {
eps = append(eps, ep)
}
}
if eps... | [
"func",
"(",
"r",
"*",
"Relation",
")",
"RelatedEndpoints",
"(",
"applicationname",
"string",
")",
"(",
"[",
"]",
"Endpoint",
",",
"error",
")",
"{",
"local",
",",
"err",
":=",
"r",
".",
"Endpoint",
"(",
"applicationname",
")",
"\n",
"if",
"err",
"!=",... | // RelatedEndpoints returns the endpoints of the relation r with which
// units of the named application will establish relations. If the service
// is not part of the relation r, an error will be returned. | [
"RelatedEndpoints",
"returns",
"the",
"endpoints",
"of",
"the",
"relation",
"r",
"with",
"which",
"units",
"of",
"the",
"named",
"application",
"will",
"establish",
"relations",
".",
"If",
"the",
"service",
"is",
"not",
"part",
"of",
"the",
"relation",
"r",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/relation.go#L615-L631 |
154,053 | juju/juju | state/relation.go | RemoteUnit | func (r *Relation) RemoteUnit(unitName string) (*RelationUnit, error) {
// Verify that the unit belongs to a remote application.
appName, err := names.UnitApplication(unitName)
if err != nil {
return nil, errors.Trace(err)
}
if _, err := r.st.RemoteApplication(appName); err != nil {
return nil, errors.Trace(er... | go | func (r *Relation) RemoteUnit(unitName string) (*RelationUnit, error) {
// Verify that the unit belongs to a remote application.
appName, err := names.UnitApplication(unitName)
if err != nil {
return nil, errors.Trace(err)
}
if _, err := r.st.RemoteApplication(appName); err != nil {
return nil, errors.Trace(er... | [
"func",
"(",
"r",
"*",
"Relation",
")",
"RemoteUnit",
"(",
"unitName",
"string",
")",
"(",
"*",
"RelationUnit",
",",
"error",
")",
"{",
"// Verify that the unit belongs to a remote application.",
"appName",
",",
"err",
":=",
"names",
".",
"UnitApplication",
"(",
... | // RemoteUnit returns a RelationUnit for the supplied unit
// of a remote application. | [
"RemoteUnit",
"returns",
"a",
"RelationUnit",
"for",
"the",
"supplied",
"unit",
"of",
"a",
"remote",
"application",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/relation.go#L641-L656 |
154,054 | juju/juju | state/relation.go | AllRemoteUnits | func (r *Relation) AllRemoteUnits(appName string) ([]*RelationUnit, error) {
// Verify that the unit belongs to a remote application.
if _, err := r.st.RemoteApplication(appName); err != nil {
return nil, errors.Trace(err)
}
relationScopes, closer := r.st.db().GetCollection(relationScopesC)
defer closer()
ep,... | go | func (r *Relation) AllRemoteUnits(appName string) ([]*RelationUnit, error) {
// Verify that the unit belongs to a remote application.
if _, err := r.st.RemoteApplication(appName); err != nil {
return nil, errors.Trace(err)
}
relationScopes, closer := r.st.db().GetCollection(relationScopesC)
defer closer()
ep,... | [
"func",
"(",
"r",
"*",
"Relation",
")",
"AllRemoteUnits",
"(",
"appName",
"string",
")",
"(",
"[",
"]",
"*",
"RelationUnit",
",",
"error",
")",
"{",
"// Verify that the unit belongs to a remote application.",
"if",
"_",
",",
"err",
":=",
"r",
".",
"st",
".",... | // AllRemoteUnits returns all the RelationUnits for the remote
// application units for a given application. | [
"AllRemoteUnits",
"returns",
"all",
"the",
"RelationUnits",
"for",
"the",
"remote",
"application",
"units",
"for",
"a",
"given",
"application",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/relation.go#L660-L694 |
154,055 | juju/juju | state/relation.go | RemoteApplication | func (r *Relation) RemoteApplication() (*RemoteApplication, bool, error) {
for _, ep := range r.Endpoints() {
app, err := r.st.RemoteApplication(ep.ApplicationName)
if err == nil {
return app, true, nil
} else if !errors.IsNotFound(err) {
return nil, false, errors.Trace(err)
}
}
return nil, false, nil
... | go | func (r *Relation) RemoteApplication() (*RemoteApplication, bool, error) {
for _, ep := range r.Endpoints() {
app, err := r.st.RemoteApplication(ep.ApplicationName)
if err == nil {
return app, true, nil
} else if !errors.IsNotFound(err) {
return nil, false, errors.Trace(err)
}
}
return nil, false, nil
... | [
"func",
"(",
"r",
"*",
"Relation",
")",
"RemoteApplication",
"(",
")",
"(",
"*",
"RemoteApplication",
",",
"bool",
",",
"error",
")",
"{",
"for",
"_",
",",
"ep",
":=",
"range",
"r",
".",
"Endpoints",
"(",
")",
"{",
"app",
",",
"err",
":=",
"r",
"... | // RemoteApplication returns the remote application if
// this relation is a cross-model relation, and a bool
// indicating if it cross-model or not. | [
"RemoteApplication",
"returns",
"the",
"remote",
"application",
"if",
"this",
"relation",
"is",
"a",
"cross",
"-",
"model",
"relation",
"and",
"a",
"bool",
"indicating",
"if",
"it",
"cross",
"-",
"model",
"or",
"not",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/relation.go#L699-L709 |
154,056 | juju/juju | cloudconfig/userdatacfg_unix.go | ConfigureCustomOverrides | func (w *unixConfigure) ConfigureCustomOverrides() error {
for k, v := range w.icfg.CloudInitUserData {
// preruncmd was handled in ConfigureBasic()
// packages and postruncmd have been handled in ConfigureJuju()
if isAllowedOverrideAttr(k) {
w.conf.SetAttr(k, v)
}
}
return nil
} | go | func (w *unixConfigure) ConfigureCustomOverrides() error {
for k, v := range w.icfg.CloudInitUserData {
// preruncmd was handled in ConfigureBasic()
// packages and postruncmd have been handled in ConfigureJuju()
if isAllowedOverrideAttr(k) {
w.conf.SetAttr(k, v)
}
}
return nil
} | [
"func",
"(",
"w",
"*",
"unixConfigure",
")",
"ConfigureCustomOverrides",
"(",
")",
"error",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"w",
".",
"icfg",
".",
"CloudInitUserData",
"{",
"// preruncmd was handled in ConfigureBasic()",
"// packages and postruncmd have been... | // ConfigureCustomOverrides implements UserdataConfig.ConfigureCustomOverrides | [
"ConfigureCustomOverrides",
"implements",
"UserdataConfig",
".",
"ConfigureCustomOverrides"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloudconfig/userdatacfg_unix.go#L403-L412 |
154,057 | juju/juju | cloudconfig/userdatacfg_unix.go | setUpGUI | func (w *unixConfigure) setUpGUI() (func(), error) {
if w.icfg.Bootstrap.GUI == nil {
// No GUI archives were found on simplestreams, and no development
// GUI path has been passed with the JUJU_GUI environment variable.
return nil, nil
}
u, err := url.Parse(w.icfg.Bootstrap.GUI.URL)
if err != nil {
return ... | go | func (w *unixConfigure) setUpGUI() (func(), error) {
if w.icfg.Bootstrap.GUI == nil {
// No GUI archives were found on simplestreams, and no development
// GUI path has been passed with the JUJU_GUI environment variable.
return nil, nil
}
u, err := url.Parse(w.icfg.Bootstrap.GUI.URL)
if err != nil {
return ... | [
"func",
"(",
"w",
"*",
"unixConfigure",
")",
"setUpGUI",
"(",
")",
"(",
"func",
"(",
")",
",",
"error",
")",
"{",
"if",
"w",
".",
"icfg",
".",
"Bootstrap",
".",
"GUI",
"==",
"nil",
"{",
"// No GUI archives were found on simplestreams, and no development",
"/... | // setUpGUI fetches the Juju GUI archive and save it to the controller.
// The returned clean up function must be called when the bootstrapping
// process is completed. | [
"setUpGUI",
"fetches",
"the",
"Juju",
"GUI",
"archive",
"and",
"save",
"it",
"to",
"the",
"controller",
".",
"The",
"returned",
"clean",
"up",
"function",
"must",
"be",
"called",
"when",
"the",
"bootstrapping",
"process",
"is",
"completed",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloudconfig/userdatacfg_unix.go#L554-L606 |
154,058 | juju/juju | cloudconfig/userdatacfg_unix.go | toolsDownloadCommand | func toolsDownloadCommand(curlCommand string, urls []string) string {
parsedTemplate := template.Must(
template.New("ToolsDownload").Funcs(
template.FuncMap{"shquote": shquote},
).Parse(toolsDownloadTemplate),
)
var buf bytes.Buffer
err := parsedTemplate.Execute(&buf, map[string]interface{}{
"ToolsDownload... | go | func toolsDownloadCommand(curlCommand string, urls []string) string {
parsedTemplate := template.Must(
template.New("ToolsDownload").Funcs(
template.FuncMap{"shquote": shquote},
).Parse(toolsDownloadTemplate),
)
var buf bytes.Buffer
err := parsedTemplate.Execute(&buf, map[string]interface{}{
"ToolsDownload... | [
"func",
"toolsDownloadCommand",
"(",
"curlCommand",
"string",
",",
"urls",
"[",
"]",
"string",
")",
"string",
"{",
"parsedTemplate",
":=",
"template",
".",
"Must",
"(",
"template",
".",
"New",
"(",
"\"",
"\"",
")",
".",
"Funcs",
"(",
"template",
".",
"Fu... | // toolsDownloadCommand takes a curl command minus the source URL,
// and generates a command that will cycle through the URLs until
// one succeeds. | [
"toolsDownloadCommand",
"takes",
"a",
"curl",
"command",
"minus",
"the",
"source",
"URL",
"and",
"generates",
"a",
"command",
"that",
"will",
"cycle",
"through",
"the",
"URLs",
"until",
"one",
"succeeds",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloudconfig/userdatacfg_unix.go#L611-L627 |
154,059 | juju/juju | cmd/juju/application/bundlediff.go | SetFlags | func (c *bundleDiffCommand) SetFlags(f *gnuflag.FlagSet) {
c.ModelCommandBase.SetFlags(f)
f.StringVar((*string)(&c.channel), "channel", "", "Channel to use when getting the bundle from the charm store")
f.Var(cmd.NewAppendStringsValue(&c.bundleOverlays), "overlay", "Bundles to overlay on the primary bundle, applied ... | go | func (c *bundleDiffCommand) SetFlags(f *gnuflag.FlagSet) {
c.ModelCommandBase.SetFlags(f)
f.StringVar((*string)(&c.channel), "channel", "", "Channel to use when getting the bundle from the charm store")
f.Var(cmd.NewAppendStringsValue(&c.bundleOverlays), "overlay", "Bundles to overlay on the primary bundle, applied ... | [
"func",
"(",
"c",
"*",
"bundleDiffCommand",
")",
"SetFlags",
"(",
"f",
"*",
"gnuflag",
".",
"FlagSet",
")",
"{",
"c",
".",
"ModelCommandBase",
".",
"SetFlags",
"(",
"f",
")",
"\n",
"f",
".",
"StringVar",
"(",
"(",
"*",
"string",
")",
"(",
"&",
"c",... | // SetFlags is part of cmd.Command. | [
"SetFlags",
"is",
"part",
"of",
"cmd",
".",
"Command",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/application/bundlediff.go#L89-L95 |
154,060 | juju/juju | cmd/juju/application/bundlediff.go | GetAnnotations | func (e *extractorImpl) GetAnnotations(tags []string) ([]params.AnnotationsGetResult, error) {
return e.annotations.Get(tags)
} | go | func (e *extractorImpl) GetAnnotations(tags []string) ([]params.AnnotationsGetResult, error) {
return e.annotations.Get(tags)
} | [
"func",
"(",
"e",
"*",
"extractorImpl",
")",
"GetAnnotations",
"(",
"tags",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"params",
".",
"AnnotationsGetResult",
",",
"error",
")",
"{",
"return",
"e",
".",
"annotations",
".",
"Get",
"(",
"tags",
")",
"\n",
... | // GetAnnotations is part of ModelExtractor. | [
"GetAnnotations",
"is",
"part",
"of",
"ModelExtractor",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/application/bundlediff.go#L258-L260 |
154,061 | juju/juju | cmd/juju/application/bundlediff.go | GetConstraints | func (e *extractorImpl) GetConstraints(applications ...string) ([]constraints.Value, error) {
return e.application.GetConstraints(applications...)
} | go | func (e *extractorImpl) GetConstraints(applications ...string) ([]constraints.Value, error) {
return e.application.GetConstraints(applications...)
} | [
"func",
"(",
"e",
"*",
"extractorImpl",
")",
"GetConstraints",
"(",
"applications",
"...",
"string",
")",
"(",
"[",
"]",
"constraints",
".",
"Value",
",",
"error",
")",
"{",
"return",
"e",
".",
"application",
".",
"GetConstraints",
"(",
"applications",
"..... | // GetConstraints is part of ModelExtractor. | [
"GetConstraints",
"is",
"part",
"of",
"ModelExtractor",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/application/bundlediff.go#L263-L265 |
154,062 | juju/juju | cmd/juju/application/bundlediff.go | GetConfig | func (e *extractorImpl) GetConfig(branchName string, applications ...string) ([]map[string]interface{}, error) {
return e.application.GetConfig(branchName, applications...)
} | go | func (e *extractorImpl) GetConfig(branchName string, applications ...string) ([]map[string]interface{}, error) {
return e.application.GetConfig(branchName, applications...)
} | [
"func",
"(",
"e",
"*",
"extractorImpl",
")",
"GetConfig",
"(",
"branchName",
"string",
",",
"applications",
"...",
"string",
")",
"(",
"[",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"e",
".",
"application"... | // GetConfig is part of ModelExtractor. | [
"GetConfig",
"is",
"part",
"of",
"ModelExtractor",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/application/bundlediff.go#L268-L270 |
154,063 | juju/juju | cmd/jujud/agent/engine/flag.go | FlagOutput | func FlagOutput(in worker.Worker, out interface{}) error {
inFlag, ok := in.(Flag)
if !ok {
return errors.Errorf("expected in to implement Flag; got a %T", in)
}
outFlag, ok := out.(*Flag)
if !ok {
return errors.Errorf("expected out to be a *Flag; got a %T", out)
}
*outFlag = inFlag
return nil
} | go | func FlagOutput(in worker.Worker, out interface{}) error {
inFlag, ok := in.(Flag)
if !ok {
return errors.Errorf("expected in to implement Flag; got a %T", in)
}
outFlag, ok := out.(*Flag)
if !ok {
return errors.Errorf("expected out to be a *Flag; got a %T", out)
}
*outFlag = inFlag
return nil
} | [
"func",
"FlagOutput",
"(",
"in",
"worker",
".",
"Worker",
",",
"out",
"interface",
"{",
"}",
")",
"error",
"{",
"inFlag",
",",
"ok",
":=",
"in",
".",
"(",
"Flag",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\""... | // FlagOutput will expose, as a Flag, any worker that implements Flag. | [
"FlagOutput",
"will",
"expose",
"as",
"a",
"Flag",
"any",
"worker",
"that",
"implements",
"Flag",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/jujud/agent/engine/flag.go#L23-L34 |
154,064 | juju/juju | cmd/jujud/agent/engine/flag.go | NewStaticFlagWorker | func NewStaticFlagWorker(value bool) worker.Worker {
w := &staticFlagWorker{value: value}
w.tomb.Go(func() error {
<-w.tomb.Dying()
return tomb.ErrDying
})
return w
} | go | func NewStaticFlagWorker(value bool) worker.Worker {
w := &staticFlagWorker{value: value}
w.tomb.Go(func() error {
<-w.tomb.Dying()
return tomb.ErrDying
})
return w
} | [
"func",
"NewStaticFlagWorker",
"(",
"value",
"bool",
")",
"worker",
".",
"Worker",
"{",
"w",
":=",
"&",
"staticFlagWorker",
"{",
"value",
":",
"value",
"}",
"\n",
"w",
".",
"tomb",
".",
"Go",
"(",
"func",
"(",
")",
"error",
"{",
"<-",
"w",
".",
"to... | // NewStaticFlagWorker returns a new Worker that implements Flag,
// whose Check method always returns the specified value. | [
"NewStaticFlagWorker",
"returns",
"a",
"new",
"Worker",
"that",
"implements",
"Flag",
"whose",
"Check",
"method",
"always",
"returns",
"the",
"specified",
"value",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/jujud/agent/engine/flag.go#L43-L50 |
154,065 | juju/juju | apiserver/facades/controller/remoterelations/remoterelations.go | NewStateRemoteRelationsAPI | func NewStateRemoteRelationsAPI(ctx facade.Context) (*RemoteRelationsAPI, error) {
return NewRemoteRelationsAPI(
stateShim{st: ctx.State(), Backend: commoncrossmodel.GetBackend(ctx.State())},
common.NewStateControllerConfig(ctx.State()),
ctx.Resources(), ctx.Auth(),
)
} | go | func NewStateRemoteRelationsAPI(ctx facade.Context) (*RemoteRelationsAPI, error) {
return NewRemoteRelationsAPI(
stateShim{st: ctx.State(), Backend: commoncrossmodel.GetBackend(ctx.State())},
common.NewStateControllerConfig(ctx.State()),
ctx.Resources(), ctx.Auth(),
)
} | [
"func",
"NewStateRemoteRelationsAPI",
"(",
"ctx",
"facade",
".",
"Context",
")",
"(",
"*",
"RemoteRelationsAPI",
",",
"error",
")",
"{",
"return",
"NewRemoteRelationsAPI",
"(",
"stateShim",
"{",
"st",
":",
"ctx",
".",
"State",
"(",
")",
",",
"Backend",
":",
... | // NewStateRemoteRelationsAPI creates a new server-side RemoteRelationsAPI facade
// backed by global state. | [
"NewStateRemoteRelationsAPI",
"creates",
"a",
"new",
"server",
"-",
"side",
"RemoteRelationsAPI",
"facade",
"backed",
"by",
"global",
"state",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/remoterelations/remoterelations.go#L28-L35 |
154,066 | juju/juju | apiserver/facades/controller/remoterelations/remoterelations.go | NewRemoteRelationsAPI | func NewRemoteRelationsAPI(
st RemoteRelationsState,
controllerCfgAPI *common.ControllerConfigAPI,
resources facade.Resources,
authorizer facade.Authorizer,
) (*RemoteRelationsAPI, error) {
if !authorizer.AuthController() {
return nil, common.ErrPerm
}
return &RemoteRelationsAPI{
st: st,
C... | go | func NewRemoteRelationsAPI(
st RemoteRelationsState,
controllerCfgAPI *common.ControllerConfigAPI,
resources facade.Resources,
authorizer facade.Authorizer,
) (*RemoteRelationsAPI, error) {
if !authorizer.AuthController() {
return nil, common.ErrPerm
}
return &RemoteRelationsAPI{
st: st,
C... | [
"func",
"NewRemoteRelationsAPI",
"(",
"st",
"RemoteRelationsState",
",",
"controllerCfgAPI",
"*",
"common",
".",
"ControllerConfigAPI",
",",
"resources",
"facade",
".",
"Resources",
",",
"authorizer",
"facade",
".",
"Authorizer",
",",
")",
"(",
"*",
"RemoteRelations... | // NewRemoteRelationsAPI returns a new server-side RemoteRelationsAPI facade. | [
"NewRemoteRelationsAPI",
"returns",
"a",
"new",
"server",
"-",
"side",
"RemoteRelationsAPI",
"facade",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/remoterelations/remoterelations.go#L38-L53 |
154,067 | juju/juju | apiserver/facades/controller/remoterelations/remoterelations.go | ImportRemoteEntities | func (api *RemoteRelationsAPI) ImportRemoteEntities(args params.RemoteEntityTokenArgs) (params.ErrorResults, error) {
results := params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Args)),
}
for i, arg := range args.Args {
err := api.importRemoteEntity(arg)
results.Results[i].Error = common.Serve... | go | func (api *RemoteRelationsAPI) ImportRemoteEntities(args params.RemoteEntityTokenArgs) (params.ErrorResults, error) {
results := params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Args)),
}
for i, arg := range args.Args {
err := api.importRemoteEntity(arg)
results.Results[i].Error = common.Serve... | [
"func",
"(",
"api",
"*",
"RemoteRelationsAPI",
")",
"ImportRemoteEntities",
"(",
"args",
"params",
".",
"RemoteEntityTokenArgs",
")",
"(",
"params",
".",
"ErrorResults",
",",
"error",
")",
"{",
"results",
":=",
"params",
".",
"ErrorResults",
"{",
"Results",
":... | // ImportRemoteEntities adds entities to the remote entities collection with the specified opaque tokens. | [
"ImportRemoteEntities",
"adds",
"entities",
"to",
"the",
"remote",
"entities",
"collection",
"with",
"the",
"specified",
"opaque",
"tokens",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/remoterelations/remoterelations.go#L56-L65 |
154,068 | juju/juju | apiserver/facades/controller/remoterelations/remoterelations.go | GetTokens | func (api *RemoteRelationsAPI) GetTokens(args params.GetTokenArgs) (params.StringResults, error) {
results := params.StringResults{
Results: make([]params.StringResult, len(args.Args)),
}
for i, arg := range args.Args {
entityTag, err := names.ParseTag(arg.Tag)
if err != nil {
results.Results[i].Error = com... | go | func (api *RemoteRelationsAPI) GetTokens(args params.GetTokenArgs) (params.StringResults, error) {
results := params.StringResults{
Results: make([]params.StringResult, len(args.Args)),
}
for i, arg := range args.Args {
entityTag, err := names.ParseTag(arg.Tag)
if err != nil {
results.Results[i].Error = com... | [
"func",
"(",
"api",
"*",
"RemoteRelationsAPI",
")",
"GetTokens",
"(",
"args",
"params",
".",
"GetTokenArgs",
")",
"(",
"params",
".",
"StringResults",
",",
"error",
")",
"{",
"results",
":=",
"params",
".",
"StringResults",
"{",
"Results",
":",
"make",
"("... | // GetTokens returns the token associated with the entities with the given tags for the given models. | [
"GetTokens",
"returns",
"the",
"token",
"associated",
"with",
"the",
"entities",
"with",
"the",
"given",
"tags",
"for",
"the",
"given",
"models",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/remoterelations/remoterelations.go#L99-L116 |
154,069 | juju/juju | apiserver/facades/controller/remoterelations/remoterelations.go | SaveMacaroons | func (api *RemoteRelationsAPI) SaveMacaroons(args params.EntityMacaroonArgs) (params.ErrorResults, error) {
results := params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Args)),
}
for i, arg := range args.Args {
entityTag, err := names.ParseTag(arg.Tag)
if err != nil {
results.Results[i].Erro... | go | func (api *RemoteRelationsAPI) SaveMacaroons(args params.EntityMacaroonArgs) (params.ErrorResults, error) {
results := params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Args)),
}
for i, arg := range args.Args {
entityTag, err := names.ParseTag(arg.Tag)
if err != nil {
results.Results[i].Erro... | [
"func",
"(",
"api",
"*",
"RemoteRelationsAPI",
")",
"SaveMacaroons",
"(",
"args",
"params",
".",
"EntityMacaroonArgs",
")",
"(",
"params",
".",
"ErrorResults",
",",
"error",
")",
"{",
"results",
":=",
"params",
".",
"ErrorResults",
"{",
"Results",
":",
"make... | // SaveMacaroons saves the macaroons for the given entities. | [
"SaveMacaroons",
"saves",
"the",
"macaroons",
"for",
"the",
"given",
"entities",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/remoterelations/remoterelations.go#L119-L133 |
154,070 | juju/juju | apiserver/facades/controller/remoterelations/remoterelations.go | WatchLocalRelationUnits | func (api *RemoteRelationsAPI) WatchLocalRelationUnits(args params.Entities) (params.RelationUnitsWatchResults, error) {
results := params.RelationUnitsWatchResults{
make([]params.RelationUnitsWatchResult, len(args.Entities)),
}
for i, arg := range args.Entities {
relationTag, err := names.ParseRelationTag(arg.T... | go | func (api *RemoteRelationsAPI) WatchLocalRelationUnits(args params.Entities) (params.RelationUnitsWatchResults, error) {
results := params.RelationUnitsWatchResults{
make([]params.RelationUnitsWatchResult, len(args.Entities)),
}
for i, arg := range args.Entities {
relationTag, err := names.ParseRelationTag(arg.T... | [
"func",
"(",
"api",
"*",
"RemoteRelationsAPI",
")",
"WatchLocalRelationUnits",
"(",
"args",
"params",
".",
"Entities",
")",
"(",
"params",
".",
"RelationUnitsWatchResults",
",",
"error",
")",
"{",
"results",
":=",
"params",
".",
"RelationUnitsWatchResults",
"{",
... | // WatchLocalRelationUnits starts a RelationUnitsWatcher for watching the local
// relation units involved in each specified relation in the local model,
// and returns the watcher IDs and initial values, or an error if the relation
// units could not be watched. | [
"WatchLocalRelationUnits",
"starts",
"a",
"RelationUnitsWatcher",
"for",
"watching",
"the",
"local",
"relation",
"units",
"involved",
"in",
"each",
"specified",
"relation",
"in",
"the",
"local",
"model",
"and",
"returns",
"the",
"watcher",
"IDs",
"and",
"initial",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/remoterelations/remoterelations.go#L302-L326 |
154,071 | juju/juju | apiserver/facades/controller/remoterelations/remoterelations.go | WatchRemoteApplicationRelations | func (api *RemoteRelationsAPI) WatchRemoteApplicationRelations(args params.Entities) (params.StringsWatchResults, error) {
results := params.StringsWatchResults{
make([]params.StringsWatchResult, len(args.Entities)),
}
for i, arg := range args.Entities {
applicationTag, err := names.ParseApplicationTag(arg.Tag)
... | go | func (api *RemoteRelationsAPI) WatchRemoteApplicationRelations(args params.Entities) (params.StringsWatchResults, error) {
results := params.StringsWatchResults{
make([]params.StringsWatchResult, len(args.Entities)),
}
for i, arg := range args.Entities {
applicationTag, err := names.ParseApplicationTag(arg.Tag)
... | [
"func",
"(",
"api",
"*",
"RemoteRelationsAPI",
")",
"WatchRemoteApplicationRelations",
"(",
"args",
"params",
".",
"Entities",
")",
"(",
"params",
".",
"StringsWatchResults",
",",
"error",
")",
"{",
"results",
":=",
"params",
".",
"StringsWatchResults",
"{",
"ma... | // WatchRemoteApplicationRelations starts a StringsWatcher for watching the relations of
// each specified application in the local model, and returns the watcher IDs
// and initial values, or an error if the services' relations could not be
// watched. | [
"WatchRemoteApplicationRelations",
"starts",
"a",
"StringsWatcher",
"for",
"watching",
"the",
"relations",
"of",
"each",
"specified",
"application",
"in",
"the",
"local",
"model",
"and",
"returns",
"the",
"watcher",
"IDs",
"and",
"initial",
"values",
"or",
"an",
"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/remoterelations/remoterelations.go#L332-L357 |
154,072 | juju/juju | apiserver/facades/controller/remoterelations/remoterelations.go | WatchRemoteRelations | func (api *RemoteRelationsAPI) WatchRemoteRelations() (params.StringsWatchResult, error) {
w := api.st.WatchRemoteRelations()
if changes, ok := <-w.Changes(); ok {
return params.StringsWatchResult{
StringsWatcherId: api.resources.Register(w),
Changes: changes,
}, nil
}
return params.StringsWatchR... | go | func (api *RemoteRelationsAPI) WatchRemoteRelations() (params.StringsWatchResult, error) {
w := api.st.WatchRemoteRelations()
if changes, ok := <-w.Changes(); ok {
return params.StringsWatchResult{
StringsWatcherId: api.resources.Register(w),
Changes: changes,
}, nil
}
return params.StringsWatchR... | [
"func",
"(",
"api",
"*",
"RemoteRelationsAPI",
")",
"WatchRemoteRelations",
"(",
")",
"(",
"params",
".",
"StringsWatchResult",
",",
"error",
")",
"{",
"w",
":=",
"api",
".",
"st",
".",
"WatchRemoteRelations",
"(",
")",
"\n",
"if",
"changes",
",",
"ok",
... | // WatchRemoteRelations starts a strings watcher that notifies of the addition,
// removal, and lifecycle changes of remote relations in the model; and
// returns the watcher ID and initial IDs of remote relations, or an error if
// watching failed. | [
"WatchRemoteRelations",
"starts",
"a",
"strings",
"watcher",
"that",
"notifies",
"of",
"the",
"addition",
"removal",
"and",
"lifecycle",
"changes",
"of",
"remote",
"relations",
"in",
"the",
"model",
";",
"and",
"returns",
"the",
"watcher",
"ID",
"and",
"initial"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/remoterelations/remoterelations.go#L363-L372 |
154,073 | juju/juju | apiserver/facades/controller/remoterelations/remoterelations.go | SetRemoteApplicationsStatus | func (f *RemoteRelationsAPI) SetRemoteApplicationsStatus(args params.SetStatus) (params.ErrorResults, error) {
var result params.ErrorResults
result.Results = make([]params.ErrorResult, len(args.Entities))
for i, entity := range args.Entities {
remoteAppTag, err := names.ParseApplicationTag(entity.Tag)
if err !=... | go | func (f *RemoteRelationsAPI) SetRemoteApplicationsStatus(args params.SetStatus) (params.ErrorResults, error) {
var result params.ErrorResults
result.Results = make([]params.ErrorResult, len(args.Entities))
for i, entity := range args.Entities {
remoteAppTag, err := names.ParseApplicationTag(entity.Tag)
if err !=... | [
"func",
"(",
"f",
"*",
"RemoteRelationsAPI",
")",
"SetRemoteApplicationsStatus",
"(",
"args",
"params",
".",
"SetStatus",
")",
"(",
"params",
".",
"ErrorResults",
",",
"error",
")",
"{",
"var",
"result",
"params",
".",
"ErrorResults",
"\n",
"result",
".",
"R... | // SetRemoteApplicationsStatus sets the status for the specified remote applications. | [
"SetRemoteApplicationsStatus",
"sets",
"the",
"status",
"for",
"the",
"specified",
"remote",
"applications",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/remoterelations/remoterelations.go#L400-L421 |
154,074 | juju/juju | cloudconfig/cloudinit/cloudinit_centos.go | addPackageMirrorCmd | func addPackageMirrorCmd(cfg CloudConfig, url string) string {
return fmt.Sprintf(config.ReplaceCentOSMirror, url)
} | go | func addPackageMirrorCmd(cfg CloudConfig, url string) string {
return fmt.Sprintf(config.ReplaceCentOSMirror, url)
} | [
"func",
"addPackageMirrorCmd",
"(",
"cfg",
"CloudConfig",
",",
"url",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"config",
".",
"ReplaceCentOSMirror",
",",
"url",
")",
"\n",
"}"
] | // addPackageMirrorCmd is a helper function that returns the corresponding runcmds
// to apply the package mirror settings on a CentOS machine. | [
"addPackageMirrorCmd",
"is",
"a",
"helper",
"function",
"that",
"returns",
"the",
"corresponding",
"runcmds",
"to",
"apply",
"the",
"package",
"mirror",
"settings",
"on",
"a",
"CentOS",
"machine",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloudconfig/cloudinit/cloudinit_centos.go#L82-L84 |
154,075 | juju/juju | cloudconfig/cloudinit/cloudinit_centos.go | RenderYAML | func (cfg *centOSCloudConfig) RenderYAML() ([]byte, error) {
// Save the fields that we will modify
var oldruncmds []string
oldruncmds = copyStringSlice(cfg.RunCmds())
// check for package proxy setting and add commands:
var proxy string
if proxy = cfg.PackageProxy(); proxy != "" {
cfg.AddRunCmd(cfg.helper.add... | go | func (cfg *centOSCloudConfig) RenderYAML() ([]byte, error) {
// Save the fields that we will modify
var oldruncmds []string
oldruncmds = copyStringSlice(cfg.RunCmds())
// check for package proxy setting and add commands:
var proxy string
if proxy = cfg.PackageProxy(); proxy != "" {
cfg.AddRunCmd(cfg.helper.add... | [
"func",
"(",
"cfg",
"*",
"centOSCloudConfig",
")",
"RenderYAML",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// Save the fields that we will modify",
"var",
"oldruncmds",
"[",
"]",
"string",
"\n",
"oldruncmds",
"=",
"copyStringSlice",
"(",
"cfg",... | // Render is defined on the the Renderer interface. | [
"Render",
"is",
"defined",
"on",
"the",
"the",
"Renderer",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloudconfig/cloudinit/cloudinit_centos.go#L121-L163 |
154,076 | juju/juju | provider/common/availabilityzones.go | AvailabilityZoneAllocations | func AvailabilityZoneAllocations(
env ZonedEnviron, ctx context.ProviderCallContext, group []instance.Id,
) ([]AvailabilityZoneInstances, error) {
if len(group) == 0 {
instances, err := env.AllInstances(ctx)
if err != nil {
return nil, err
}
group = make([]instance.Id, len(instances))
for i, inst := rang... | go | func AvailabilityZoneAllocations(
env ZonedEnviron, ctx context.ProviderCallContext, group []instance.Id,
) ([]AvailabilityZoneInstances, error) {
if len(group) == 0 {
instances, err := env.AllInstances(ctx)
if err != nil {
return nil, err
}
group = make([]instance.Id, len(instances))
for i, inst := rang... | [
"func",
"AvailabilityZoneAllocations",
"(",
"env",
"ZonedEnviron",
",",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"group",
"[",
"]",
"instance",
".",
"Id",
",",
")",
"(",
"[",
"]",
"AvailabilityZoneInstances",
",",
"error",
")",
"{",
"if",
"len",
"(... | // AvailabilityZoneAllocations returns the availability zones and their
// instance allocations from the specified group, in ascending order of
// population. Availability zones with the same population size are
// ordered by name.
//
// If the specified group is empty, then it will behave as if the result of
// AllIns... | [
"AvailabilityZoneAllocations",
"returns",
"the",
"availability",
"zones",
"and",
"their",
"instance",
"allocations",
"from",
"the",
"specified",
"group",
"in",
"ascending",
"order",
"of",
"population",
".",
"Availability",
"zones",
"with",
"the",
"same",
"population",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/common/availabilityzones.go#L88-L149 |
154,077 | juju/juju | provider/common/availabilityzones.go | ValidateAvailabilityZone | func ValidateAvailabilityZone(env ZonedEnviron, ctx context.ProviderCallContext, zone string) error {
zones, err := env.AvailabilityZones(ctx)
if err != nil {
return err
}
for _, z := range zones {
if z.Name() == zone {
if z.Available() {
return nil
}
return errors.Errorf("availability zone %q is u... | go | func ValidateAvailabilityZone(env ZonedEnviron, ctx context.ProviderCallContext, zone string) error {
zones, err := env.AvailabilityZones(ctx)
if err != nil {
return err
}
for _, z := range zones {
if z.Name() == zone {
if z.Available() {
return nil
}
return errors.Errorf("availability zone %q is u... | [
"func",
"ValidateAvailabilityZone",
"(",
"env",
"ZonedEnviron",
",",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"zone",
"string",
")",
"error",
"{",
"zones",
",",
"err",
":=",
"env",
".",
"AvailabilityZones",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",... | // ValidateAvailabilityZone returns nil iff the availability
// zone exists and is available, otherwise returns a NotValid
// error. | [
"ValidateAvailabilityZone",
"returns",
"nil",
"iff",
"the",
"availability",
"zone",
"exists",
"and",
"is",
"available",
"otherwise",
"returns",
"a",
"NotValid",
"error",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/common/availabilityzones.go#L210-L224 |
154,078 | juju/juju | core/instance/namespace.go | NewNamespace | func NewNamespace(modelUUID string) (Namespace, error) {
if !names.IsValidModel(modelUUID) {
return nil, errors.Errorf("model ID %q is not a valid model", modelUUID)
}
// The suffix is the last six hex digits of the model uuid.
suffix := modelUUID[len(modelUUID)-uuidSuffixDigits:]
return &namespace{name: suffix... | go | func NewNamespace(modelUUID string) (Namespace, error) {
if !names.IsValidModel(modelUUID) {
return nil, errors.Errorf("model ID %q is not a valid model", modelUUID)
}
// The suffix is the last six hex digits of the model uuid.
suffix := modelUUID[len(modelUUID)-uuidSuffixDigits:]
return &namespace{name: suffix... | [
"func",
"NewNamespace",
"(",
"modelUUID",
"string",
")",
"(",
"Namespace",
",",
"error",
")",
"{",
"if",
"!",
"names",
".",
"IsValidModel",
"(",
"modelUUID",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"modelUUID",
")... | // NewNamespace returns a Namespace identified by the last six hex digits of the
// model UUID. NewNamespace returns an error if the model tag is invalid. | [
"NewNamespace",
"returns",
"a",
"Namespace",
"identified",
"by",
"the",
"last",
"six",
"hex",
"digits",
"of",
"the",
"model",
"UUID",
".",
"NewNamespace",
"returns",
"an",
"error",
"if",
"the",
"model",
"tag",
"is",
"invalid",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/instance/namespace.go#L41-L49 |
154,079 | juju/juju | cmd/modelcmd/base.go | IsModelMigratedError | func IsModelMigratedError(err error) bool {
_, ok := errors.Cause(err).(modelMigratedError)
return ok
} | go | func IsModelMigratedError(err error) bool {
_, ok := errors.Cause(err).(modelMigratedError)
return ok
} | [
"func",
"IsModelMigratedError",
"(",
"err",
"error",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"errors",
".",
"Cause",
"(",
"err",
")",
".",
"(",
"modelMigratedError",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // IsModelMigratedError returns true if err is of type modelMigratedError. | [
"IsModelMigratedError",
"returns",
"true",
"if",
"err",
"is",
"of",
"type",
"modelMigratedError",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/base.go#L44-L47 |
154,080 | juju/juju | cmd/modelcmd/base.go | closeAPIContexts | func (c *CommandBase) closeAPIContexts() {
for name, ctx := range c.apiContexts {
if err := ctx.Close(); err != nil {
logger.Errorf("%v", err)
}
delete(c.apiContexts, name)
}
} | go | func (c *CommandBase) closeAPIContexts() {
for name, ctx := range c.apiContexts {
if err := ctx.Close(); err != nil {
logger.Errorf("%v", err)
}
delete(c.apiContexts, name)
}
} | [
"func",
"(",
"c",
"*",
"CommandBase",
")",
"closeAPIContexts",
"(",
")",
"{",
"for",
"name",
",",
"ctx",
":=",
"range",
"c",
".",
"apiContexts",
"{",
"if",
"err",
":=",
"ctx",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"logger",
".",
"... | // closeAPIContexts closes any API contexts that have
// been created. | [
"closeAPIContexts",
"closes",
"any",
"API",
"contexts",
"that",
"have",
"been",
"created",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/base.go#L100-L107 |
154,081 | juju/juju | cmd/modelcmd/base.go | SetModelRefresh | func (c *CommandBase) SetModelRefresh(refresh func(jujuclient.ClientStore, string) error) {
c.refreshModels = refresh
} | go | func (c *CommandBase) SetModelRefresh(refresh func(jujuclient.ClientStore, string) error) {
c.refreshModels = refresh
} | [
"func",
"(",
"c",
"*",
"CommandBase",
")",
"SetModelRefresh",
"(",
"refresh",
"func",
"(",
"jujuclient",
".",
"ClientStore",
",",
"string",
")",
"error",
")",
"{",
"c",
".",
"refreshModels",
"=",
"refresh",
"\n",
"}"
] | // SetModelRefresh sets the function used for refreshing models. | [
"SetModelRefresh",
"sets",
"the",
"function",
"used",
"for",
"refreshing",
"models",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/base.go#L125-L127 |
154,082 | juju/juju | cmd/modelcmd/base.go | NewAPIRoot | func (c *CommandBase) NewAPIRoot(
store jujuclient.ClientStore,
controllerName, modelName string,
) (api.Connection, error) {
c.assertRunStarted()
accountDetails, err := store.AccountDetails(controllerName)
if err != nil && !errors.IsNotFound(err) {
return nil, errors.Trace(err)
}
// If there are no account de... | go | func (c *CommandBase) NewAPIRoot(
store jujuclient.ClientStore,
controllerName, modelName string,
) (api.Connection, error) {
c.assertRunStarted()
accountDetails, err := store.AccountDetails(controllerName)
if err != nil && !errors.IsNotFound(err) {
return nil, errors.Trace(err)
}
// If there are no account de... | [
"func",
"(",
"c",
"*",
"CommandBase",
")",
"NewAPIRoot",
"(",
"store",
"jujuclient",
".",
"ClientStore",
",",
"controllerName",
",",
"modelName",
"string",
",",
")",
"(",
"api",
".",
"Connection",
",",
"error",
")",
"{",
"c",
".",
"assertRunStarted",
"(",
... | // NewAPIRoot returns a new connection to the API server for the given
// model or controller. | [
"NewAPIRoot",
"returns",
"a",
"new",
"connection",
"to",
"the",
"API",
"server",
"for",
"the",
"given",
"model",
"or",
"controller",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/base.go#L144-L179 |
154,083 | juju/juju | cmd/modelcmd/base.go | NewAPIConnectionParams | func (c *CommandBase) NewAPIConnectionParams(
store jujuclient.ClientStore,
controllerName, modelName string,
accountDetails *jujuclient.AccountDetails,
) (juju.NewAPIConnectionParams, error) {
c.assertRunStarted()
bakeryClient, err := c.BakeryClient(store, controllerName)
if err != nil {
return juju.NewAPIConn... | go | func (c *CommandBase) NewAPIConnectionParams(
store jujuclient.ClientStore,
controllerName, modelName string,
accountDetails *jujuclient.AccountDetails,
) (juju.NewAPIConnectionParams, error) {
c.assertRunStarted()
bakeryClient, err := c.BakeryClient(store, controllerName)
if err != nil {
return juju.NewAPIConn... | [
"func",
"(",
"c",
"*",
"CommandBase",
")",
"NewAPIConnectionParams",
"(",
"store",
"jujuclient",
".",
"ClientStore",
",",
"controllerName",
",",
"modelName",
"string",
",",
"accountDetails",
"*",
"jujuclient",
".",
"AccountDetails",
",",
")",
"(",
"juju",
".",
... | // NewAPIConnectionParams returns a juju.NewAPIConnectionParams with the
// given arguments such that a call to juju.NewAPIConnection with the
// result behaves the same as a call to CommandBase.NewAPIRoot with
// the same arguments. | [
"NewAPIConnectionParams",
"returns",
"a",
"juju",
".",
"NewAPIConnectionParams",
"with",
"the",
"given",
"arguments",
"such",
"that",
"a",
"call",
"to",
"juju",
".",
"NewAPIConnection",
"with",
"the",
"result",
"behaves",
"the",
"same",
"as",
"a",
"call",
"to",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/base.go#L254-L284 |
154,084 | juju/juju | cmd/modelcmd/base.go | HTTPClient | func (c *CommandBase) HTTPClient(store jujuclient.ClientStore, controllerName string) (*http.Client, error) {
c.assertRunStarted()
bakeryClient, err := c.BakeryClient(store, controllerName)
if err != nil {
return nil, errors.Trace(err)
}
return bakeryClient.Client, nil
} | go | func (c *CommandBase) HTTPClient(store jujuclient.ClientStore, controllerName string) (*http.Client, error) {
c.assertRunStarted()
bakeryClient, err := c.BakeryClient(store, controllerName)
if err != nil {
return nil, errors.Trace(err)
}
return bakeryClient.Client, nil
} | [
"func",
"(",
"c",
"*",
"CommandBase",
")",
"HTTPClient",
"(",
"store",
"jujuclient",
".",
"ClientStore",
",",
"controllerName",
"string",
")",
"(",
"*",
"http",
".",
"Client",
",",
"error",
")",
"{",
"c",
".",
"assertRunStarted",
"(",
")",
"\n",
"bakeryC... | // HTTPClient returns an http.Client that contains the loaded
// persistent cookie jar. Note that this client is not good for
// connecting to the Juju API itself because it does not
// have the correct TLS setup - use api.Connection.HTTPClient
// for that. | [
"HTTPClient",
"returns",
"an",
"http",
".",
"Client",
"that",
"contains",
"the",
"loaded",
"persistent",
"cookie",
"jar",
".",
"Note",
"that",
"this",
"client",
"is",
"not",
"good",
"for",
"connecting",
"to",
"the",
"Juju",
"API",
"itself",
"because",
"it",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/base.go#L291-L298 |
154,085 | juju/juju | cmd/modelcmd/base.go | BakeryClient | func (c *CommandBase) BakeryClient(store jujuclient.CookieStore, controllerName string) (*httpbakery.Client, error) {
c.assertRunStarted()
ctx, err := c.getAPIContext(store, controllerName)
if err != nil {
return nil, errors.Trace(err)
}
return ctx.NewBakeryClient(), nil
} | go | func (c *CommandBase) BakeryClient(store jujuclient.CookieStore, controllerName string) (*httpbakery.Client, error) {
c.assertRunStarted()
ctx, err := c.getAPIContext(store, controllerName)
if err != nil {
return nil, errors.Trace(err)
}
return ctx.NewBakeryClient(), nil
} | [
"func",
"(",
"c",
"*",
"CommandBase",
")",
"BakeryClient",
"(",
"store",
"jujuclient",
".",
"CookieStore",
",",
"controllerName",
"string",
")",
"(",
"*",
"httpbakery",
".",
"Client",
",",
"error",
")",
"{",
"c",
".",
"assertRunStarted",
"(",
")",
"\n",
... | // BakeryClient returns a macaroon bakery client that
// uses the same HTTP client returned by HTTPClient. | [
"BakeryClient",
"returns",
"a",
"macaroon",
"bakery",
"client",
"that",
"uses",
"the",
"same",
"HTTP",
"client",
"returned",
"by",
"HTTPClient",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/base.go#L302-L309 |
154,086 | juju/juju | cmd/modelcmd/base.go | APIOpen | func (c *CommandBase) APIOpen(info *api.Info, opts api.DialOpts) (api.Connection, error) {
c.assertRunStarted()
return c.apiOpen(info, opts)
} | go | func (c *CommandBase) APIOpen(info *api.Info, opts api.DialOpts) (api.Connection, error) {
c.assertRunStarted()
return c.apiOpen(info, opts)
} | [
"func",
"(",
"c",
"*",
"CommandBase",
")",
"APIOpen",
"(",
"info",
"*",
"api",
".",
"Info",
",",
"opts",
"api",
".",
"DialOpts",
")",
"(",
"api",
".",
"Connection",
",",
"error",
")",
"{",
"c",
".",
"assertRunStarted",
"(",
")",
"\n",
"return",
"c"... | // APIOpen establishes a connection to the API server using the
// the given api.Info and api.DialOpts, and associating any stored
// authorization tokens with the given controller name. | [
"APIOpen",
"establishes",
"a",
"connection",
"to",
"the",
"API",
"server",
"using",
"the",
"the",
"given",
"api",
".",
"Info",
"and",
"api",
".",
"DialOpts",
"and",
"associating",
"any",
"stored",
"authorization",
"tokens",
"with",
"the",
"given",
"controller"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/base.go#L314-L317 |
154,087 | juju/juju | cmd/modelcmd/base.go | apiOpen | func (c *CommandBase) apiOpen(info *api.Info, opts api.DialOpts) (api.Connection, error) {
if c.apiOpenFunc != nil {
return c.apiOpenFunc(info, opts)
}
return api.Open(info, opts)
} | go | func (c *CommandBase) apiOpen(info *api.Info, opts api.DialOpts) (api.Connection, error) {
if c.apiOpenFunc != nil {
return c.apiOpenFunc(info, opts)
}
return api.Open(info, opts)
} | [
"func",
"(",
"c",
"*",
"CommandBase",
")",
"apiOpen",
"(",
"info",
"*",
"api",
".",
"Info",
",",
"opts",
"api",
".",
"DialOpts",
")",
"(",
"api",
".",
"Connection",
",",
"error",
")",
"{",
"if",
"c",
".",
"apiOpenFunc",
"!=",
"nil",
"{",
"return",
... | // apiOpen establishes a connection to the API server using the
// the give api.Info and api.DialOpts. | [
"apiOpen",
"establishes",
"a",
"connection",
"to",
"the",
"API",
"server",
"using",
"the",
"the",
"give",
"api",
".",
"Info",
"and",
"api",
".",
"DialOpts",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/base.go#L321-L326 |
154,088 | juju/juju | cmd/modelcmd/base.go | RefreshModels | func (c *CommandBase) RefreshModels(store jujuclient.ClientStore, controllerName string) error {
if c.refreshModels == nil {
return c.doRefreshModels(store, controllerName)
}
return c.refreshModels(store, controllerName)
} | go | func (c *CommandBase) RefreshModels(store jujuclient.ClientStore, controllerName string) error {
if c.refreshModels == nil {
return c.doRefreshModels(store, controllerName)
}
return c.refreshModels(store, controllerName)
} | [
"func",
"(",
"c",
"*",
"CommandBase",
")",
"RefreshModels",
"(",
"store",
"jujuclient",
".",
"ClientStore",
",",
"controllerName",
"string",
")",
"error",
"{",
"if",
"c",
".",
"refreshModels",
"==",
"nil",
"{",
"return",
"c",
".",
"doRefreshModels",
"(",
"... | // RefreshModels refreshes the local models cache for the current user
// on the specified controller. | [
"RefreshModels",
"refreshes",
"the",
"local",
"models",
"cache",
"for",
"the",
"current",
"user",
"on",
"the",
"specified",
"controller",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/base.go#L330-L335 |
154,089 | juju/juju | cmd/modelcmd/base.go | ControllerUUID | func (c *CommandBase) ControllerUUID(store jujuclient.ClientStore, controllerName string) (string, error) {
ctrl, err := store.ControllerByName(controllerName)
if err != nil {
return "", errors.Annotate(err, "resolving controller name")
}
return ctrl.ControllerUUID, nil
} | go | func (c *CommandBase) ControllerUUID(store jujuclient.ClientStore, controllerName string) (string, error) {
ctrl, err := store.ControllerByName(controllerName)
if err != nil {
return "", errors.Annotate(err, "resolving controller name")
}
return ctrl.ControllerUUID, nil
} | [
"func",
"(",
"c",
"*",
"CommandBase",
")",
"ControllerUUID",
"(",
"store",
"jujuclient",
".",
"ClientStore",
",",
"controllerName",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"ctrl",
",",
"err",
":=",
"store",
".",
"ControllerByName",
"(",
"cont... | // ControllerUUID returns the controller UUID for specified controller name. | [
"ControllerUUID",
"returns",
"the",
"controller",
"UUID",
"for",
"specified",
"controller",
"name",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/base.go#L396-L402 |
154,090 | juju/juju | cmd/modelcmd/base.go | getAPIContext | func (c *CommandBase) getAPIContext(store jujuclient.CookieStore, controllerName string) (*apiContext, error) {
c.assertRunStarted()
if ctx := c.apiContexts[controllerName]; ctx != nil {
return ctx, nil
}
if controllerName == "" {
return nil, errors.New("cannot get API context from empty controller name")
}
c... | go | func (c *CommandBase) getAPIContext(store jujuclient.CookieStore, controllerName string) (*apiContext, error) {
c.assertRunStarted()
if ctx := c.apiContexts[controllerName]; ctx != nil {
return ctx, nil
}
if controllerName == "" {
return nil, errors.New("cannot get API context from empty controller name")
}
c... | [
"func",
"(",
"c",
"*",
"CommandBase",
")",
"getAPIContext",
"(",
"store",
"jujuclient",
".",
"CookieStore",
",",
"controllerName",
"string",
")",
"(",
"*",
"apiContext",
",",
"error",
")",
"{",
"c",
".",
"assertRunStarted",
"(",
")",
"\n",
"if",
"ctx",
"... | // getAPIContext returns an apiContext for the given controller.
// It will return the same context if called twice for the same controller.
// The context will be closed when closeAPIContexts is called. | [
"getAPIContext",
"returns",
"an",
"apiContext",
"for",
"the",
"given",
"controller",
".",
"It",
"will",
"return",
"the",
"same",
"context",
"if",
"called",
"twice",
"for",
"the",
"same",
"controller",
".",
"The",
"context",
"will",
"be",
"closed",
"when",
"c... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/base.go#L407-L421 |
154,091 | juju/juju | cmd/modelcmd/base.go | CookieJar | func (c *CommandBase) CookieJar(store jujuclient.CookieStore, controllerName string) (http.CookieJar, error) {
ctx, err := c.getAPIContext(store, controllerName)
if err != nil {
return nil, errors.Trace(err)
}
return ctx.CookieJar(), nil
} | go | func (c *CommandBase) CookieJar(store jujuclient.CookieStore, controllerName string) (http.CookieJar, error) {
ctx, err := c.getAPIContext(store, controllerName)
if err != nil {
return nil, errors.Trace(err)
}
return ctx.CookieJar(), nil
} | [
"func",
"(",
"c",
"*",
"CommandBase",
")",
"CookieJar",
"(",
"store",
"jujuclient",
".",
"CookieStore",
",",
"controllerName",
"string",
")",
"(",
"http",
".",
"CookieJar",
",",
"error",
")",
"{",
"ctx",
",",
"err",
":=",
"c",
".",
"getAPIContext",
"(",
... | // CookieJar returns the cookie jar that is used to store auth credentials
// when connecting to the API. | [
"CookieJar",
"returns",
"the",
"cookie",
"jar",
"that",
"is",
"used",
"to",
"store",
"auth",
"credentials",
"when",
"connecting",
"to",
"the",
"API",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/base.go#L425-L431 |
154,092 | juju/juju | cmd/modelcmd/base.go | ClearControllerMacaroons | func (c *CommandBase) ClearControllerMacaroons(store jujuclient.CookieStore, controllerName string) error {
ctx, err := c.getAPIContext(store, controllerName)
if err != nil {
return errors.Trace(err)
}
ctx.jar.RemoveAll()
return nil
} | go | func (c *CommandBase) ClearControllerMacaroons(store jujuclient.CookieStore, controllerName string) error {
ctx, err := c.getAPIContext(store, controllerName)
if err != nil {
return errors.Trace(err)
}
ctx.jar.RemoveAll()
return nil
} | [
"func",
"(",
"c",
"*",
"CommandBase",
")",
"ClearControllerMacaroons",
"(",
"store",
"jujuclient",
".",
"CookieStore",
",",
"controllerName",
"string",
")",
"error",
"{",
"ctx",
",",
"err",
":=",
"c",
".",
"getAPIContext",
"(",
"store",
",",
"controllerName",
... | // ClearControllerMacaroons will remove all macaroons stored
// for the given controller from the persistent cookie jar.
// This is called both from 'juju logout' and a failed 'juju register'. | [
"ClearControllerMacaroons",
"will",
"remove",
"all",
"macaroons",
"stored",
"for",
"the",
"given",
"controller",
"from",
"the",
"persistent",
"cookie",
"jar",
".",
"This",
"is",
"called",
"both",
"from",
"juju",
"logout",
"and",
"a",
"failed",
"juju",
"register"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/base.go#L436-L443 |
154,093 | juju/juju | cmd/modelcmd/base.go | NewGetBootstrapConfigParamsFunc | func NewGetBootstrapConfigParamsFunc(
ctx *cmd.Context,
store jujuclient.ClientStore,
providerRegistry environs.ProviderRegistry,
) func(string) (*jujuclient.BootstrapConfig, *environs.PrepareConfigParams, error) {
return bootstrapConfigGetter{ctx, store, providerRegistry}.getBootstrapConfigParams
} | go | func NewGetBootstrapConfigParamsFunc(
ctx *cmd.Context,
store jujuclient.ClientStore,
providerRegistry environs.ProviderRegistry,
) func(string) (*jujuclient.BootstrapConfig, *environs.PrepareConfigParams, error) {
return bootstrapConfigGetter{ctx, store, providerRegistry}.getBootstrapConfigParams
} | [
"func",
"NewGetBootstrapConfigParamsFunc",
"(",
"ctx",
"*",
"cmd",
".",
"Context",
",",
"store",
"jujuclient",
".",
"ClientStore",
",",
"providerRegistry",
"environs",
".",
"ProviderRegistry",
",",
")",
"func",
"(",
"string",
")",
"(",
"*",
"jujuclient",
".",
... | // NewGetBootstrapConfigParamsFunc returns a function that, given a controller name,
// returns the params needed to bootstrap a fresh copy of that controller in the given client store. | [
"NewGetBootstrapConfigParamsFunc",
"returns",
"a",
"function",
"that",
"given",
"a",
"controller",
"name",
"returns",
"the",
"params",
"needed",
"to",
"bootstrap",
"a",
"fresh",
"copy",
"of",
"that",
"controller",
"in",
"the",
"given",
"client",
"store",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/base.go#L517-L523 |
154,094 | juju/juju | cmd/modelcmd/base.go | InnerCommand | func InnerCommand(c cmd.Command) cmd.Command {
for {
c1, ok := c.(wrapper)
if !ok {
return c
}
c = c1.inner()
}
} | go | func InnerCommand(c cmd.Command) cmd.Command {
for {
c1, ok := c.(wrapper)
if !ok {
return c
}
c = c1.inner()
}
} | [
"func",
"InnerCommand",
"(",
"c",
"cmd",
".",
"Command",
")",
"cmd",
".",
"Command",
"{",
"for",
"{",
"c1",
",",
"ok",
":=",
"c",
".",
"(",
"wrapper",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"c",
"\n",
"}",
"\n",
"c",
"=",
"c1",
".",
"inne... | // InnerCommand returns the command that has been wrapped
// by one of the Wrap functions. This is useful for
// tests that wish to inspect internal details of a command
// instance. If c isn't wrapping anything, it returns c. | [
"InnerCommand",
"returns",
"the",
"command",
"that",
"has",
"been",
"wrapped",
"by",
"one",
"of",
"the",
"Wrap",
"functions",
".",
"This",
"is",
"useful",
"for",
"tests",
"that",
"wish",
"to",
"inspect",
"internal",
"details",
"of",
"a",
"command",
"instance... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/modelcmd/base.go#L666-L674 |
154,095 | juju/juju | jujuclient/bootstrapconfig.go | ReadBootstrapConfigFile | func ReadBootstrapConfigFile(file string) (map[string]BootstrapConfig, error) {
data, err := ioutil.ReadFile(file)
if err != nil {
if os.IsNotExist(err) {
return nil, nil
}
return nil, err
}
configs, err := ParseBootstrapConfig(data)
if err != nil {
return nil, err
}
return configs, nil
} | go | func ReadBootstrapConfigFile(file string) (map[string]BootstrapConfig, error) {
data, err := ioutil.ReadFile(file)
if err != nil {
if os.IsNotExist(err) {
return nil, nil
}
return nil, err
}
configs, err := ParseBootstrapConfig(data)
if err != nil {
return nil, err
}
return configs, nil
} | [
"func",
"ReadBootstrapConfigFile",
"(",
"file",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"BootstrapConfig",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"file",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
... | // ReadBootstrapConfigFile loads all bootstrap configurations defined in a
// given file. If the file is not found, it is not an error. | [
"ReadBootstrapConfigFile",
"loads",
"all",
"bootstrap",
"configurations",
"defined",
"in",
"a",
"given",
"file",
".",
"If",
"the",
"file",
"is",
"not",
"found",
"it",
"is",
"not",
"an",
"error",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/bootstrapconfig.go#L25-L38 |
154,096 | juju/juju | jujuclient/bootstrapconfig.go | WriteBootstrapConfigFile | func WriteBootstrapConfigFile(configs map[string]BootstrapConfig) error {
data, err := yaml.Marshal(bootstrapConfigCollection{configs})
if err != nil {
return errors.Annotate(err, "cannot marshal bootstrap configurations")
}
return utils.AtomicWriteFile(JujuBootstrapConfigPath(), data, os.FileMode(0600))
} | go | func WriteBootstrapConfigFile(configs map[string]BootstrapConfig) error {
data, err := yaml.Marshal(bootstrapConfigCollection{configs})
if err != nil {
return errors.Annotate(err, "cannot marshal bootstrap configurations")
}
return utils.AtomicWriteFile(JujuBootstrapConfigPath(), data, os.FileMode(0600))
} | [
"func",
"WriteBootstrapConfigFile",
"(",
"configs",
"map",
"[",
"string",
"]",
"BootstrapConfig",
")",
"error",
"{",
"data",
",",
"err",
":=",
"yaml",
".",
"Marshal",
"(",
"bootstrapConfigCollection",
"{",
"configs",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",... | // WriteBootstrapConfigFile marshals to YAML details of the given bootstrap
// configurations and writes it to the bootstrap config file. | [
"WriteBootstrapConfigFile",
"marshals",
"to",
"YAML",
"details",
"of",
"the",
"given",
"bootstrap",
"configurations",
"and",
"writes",
"it",
"to",
"the",
"bootstrap",
"config",
"file",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/bootstrapconfig.go#L42-L48 |
154,097 | juju/juju | jujuclient/bootstrapconfig.go | ParseBootstrapConfig | func ParseBootstrapConfig(data []byte) (map[string]BootstrapConfig, error) {
var result bootstrapConfigCollection
err := yaml.Unmarshal(data, &result)
if err != nil {
return nil, errors.Annotate(err, "cannot unmarshal bootstrap config")
}
return result.ControllerBootstrapConfig, nil
} | go | func ParseBootstrapConfig(data []byte) (map[string]BootstrapConfig, error) {
var result bootstrapConfigCollection
err := yaml.Unmarshal(data, &result)
if err != nil {
return nil, errors.Annotate(err, "cannot unmarshal bootstrap config")
}
return result.ControllerBootstrapConfig, nil
} | [
"func",
"ParseBootstrapConfig",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"map",
"[",
"string",
"]",
"BootstrapConfig",
",",
"error",
")",
"{",
"var",
"result",
"bootstrapConfigCollection",
"\n",
"err",
":=",
"yaml",
".",
"Unmarshal",
"(",
"data",
",",
"&",... | // ParseBootstrapConfig parses the given YAML bytes into bootstrap config
// metadata. | [
"ParseBootstrapConfig",
"parses",
"the",
"given",
"YAML",
"bytes",
"into",
"bootstrap",
"config",
"metadata",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/jujuclient/bootstrapconfig.go#L52-L59 |
154,098 | juju/juju | cmd/juju/resource/output_tabular.go | FormatCharmTabular | func FormatCharmTabular(writer io.Writer, value interface{}) error {
resources, valueConverted := value.([]FormattedCharmResource)
if !valueConverted {
return errors.Errorf("expected value of type %T, got %T", resources, value)
}
// Sort by resource name
names, resourcesByName := groupCharmResourcesByName(resou... | go | func FormatCharmTabular(writer io.Writer, value interface{}) error {
resources, valueConverted := value.([]FormattedCharmResource)
if !valueConverted {
return errors.Errorf("expected value of type %T, got %T", resources, value)
}
// Sort by resource name
names, resourcesByName := groupCharmResourcesByName(resou... | [
"func",
"FormatCharmTabular",
"(",
"writer",
"io",
".",
"Writer",
",",
"value",
"interface",
"{",
"}",
")",
"error",
"{",
"resources",
",",
"valueConverted",
":=",
"value",
".",
"(",
"[",
"]",
"FormattedCharmResource",
")",
"\n",
"if",
"!",
"valueConverted",... | // FormatCharmTabular returns a tabular summary of charm resources. | [
"FormatCharmTabular",
"returns",
"a",
"tabular",
"summary",
"of",
"charm",
"resources",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/resource/output_tabular.go#L18-L47 |
154,099 | juju/juju | cmd/juju/resource/output_tabular.go | FormatAppTabular | func FormatAppTabular(writer io.Writer, value interface{}) error {
switch resources := value.(type) {
case FormattedApplicationInfo:
formatApplicationTabular(writer, resources)
return nil
case []FormattedAppResource:
formatUnitTabular(writer, resources)
return nil
case FormattedApplicationDetails:
formatA... | go | func FormatAppTabular(writer io.Writer, value interface{}) error {
switch resources := value.(type) {
case FormattedApplicationInfo:
formatApplicationTabular(writer, resources)
return nil
case []FormattedAppResource:
formatUnitTabular(writer, resources)
return nil
case FormattedApplicationDetails:
formatA... | [
"func",
"FormatAppTabular",
"(",
"writer",
"io",
".",
"Writer",
",",
"value",
"interface",
"{",
"}",
")",
"error",
"{",
"switch",
"resources",
":=",
"value",
".",
"(",
"type",
")",
"{",
"case",
"FormattedApplicationInfo",
":",
"formatApplicationTabular",
"(",
... | // FormatAppTabular returns a tabular summary of resources. | [
"FormatAppTabular",
"returns",
"a",
"tabular",
"summary",
"of",
"resources",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/resource/output_tabular.go#L66-L83 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.