id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
156,300 | juju/juju | state/storage.go | AttachStorage | func (sb *storageBackend) AttachStorage(storage names.StorageTag, unit names.UnitTag) (err error) {
defer errors.DeferredAnnotatef(&err,
"cannot attach %s to %s",
names.ReadableString(storage),
names.ReadableString(unit),
)
buildTxn := func(attempt int) ([]txn.Op, error) {
si, err := sb.storageInstance(stora... | go | func (sb *storageBackend) AttachStorage(storage names.StorageTag, unit names.UnitTag) (err error) {
defer errors.DeferredAnnotatef(&err,
"cannot attach %s to %s",
names.ReadableString(storage),
names.ReadableString(unit),
)
buildTxn := func(attempt int) ([]txn.Op, error) {
si, err := sb.storageInstance(stora... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"AttachStorage",
"(",
"storage",
"names",
".",
"StorageTag",
",",
"unit",
"names",
".",
"UnitTag",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"errors",
".",
"DeferredAnnotatef",
"(",
"&",
"err",
",",
"\"",... | // AttachStorage attaches storage to a unit, creating and attaching machine
// storage as necessary. | [
"AttachStorage",
"attaches",
"storage",
"to",
"a",
"unit",
"creating",
"and",
"attaching",
"machine",
"storage",
"as",
"necessary",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/storage.go#L1021-L1075 |
156,301 | juju/juju | state/storage.go | DestroyUnitStorageAttachments | func (sb *storageBackend) DestroyUnitStorageAttachments(unit names.UnitTag) (err error) {
defer errors.DeferredAnnotatef(&err, "cannot destroy unit %s storage attachments", unit.Id())
buildTxn := func(attempt int) ([]txn.Op, error) {
attachments, err := sb.UnitStorageAttachments(unit)
if err != nil {
return ni... | go | func (sb *storageBackend) DestroyUnitStorageAttachments(unit names.UnitTag) (err error) {
defer errors.DeferredAnnotatef(&err, "cannot destroy unit %s storage attachments", unit.Id())
buildTxn := func(attempt int) ([]txn.Op, error) {
attachments, err := sb.UnitStorageAttachments(unit)
if err != nil {
return ni... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"DestroyUnitStorageAttachments",
"(",
"unit",
"names",
".",
"UnitTag",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"errors",
".",
"DeferredAnnotatef",
"(",
"&",
"err",
",",
"\"",
"\"",
",",
"unit",
".",
"Id... | // DetachStorage ensures that the existing storage attachments of
// the specified unit are removed at some point. | [
"DetachStorage",
"ensures",
"that",
"the",
"existing",
"storage",
"attachments",
"of",
"the",
"specified",
"unit",
"are",
"removed",
"at",
"some",
"point",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/storage.go#L1171-L1193 |
156,302 | juju/juju | state/storage.go | RemoveStorageAttachment | func (sb *storageBackend) RemoveStorageAttachment(storage names.StorageTag, unit names.UnitTag, force bool) (err error) {
defer errors.DeferredAnnotatef(&err, "cannot remove storage attachment %s:%s", storage.Id(), unit.Id())
buildTxn := func(attempt int) ([]txn.Op, error) {
s, err := sb.storageAttachment(storage, ... | go | func (sb *storageBackend) RemoveStorageAttachment(storage names.StorageTag, unit names.UnitTag, force bool) (err error) {
defer errors.DeferredAnnotatef(&err, "cannot remove storage attachment %s:%s", storage.Id(), unit.Id())
buildTxn := func(attempt int) ([]txn.Op, error) {
s, err := sb.storageAttachment(storage, ... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"RemoveStorageAttachment",
"(",
"storage",
"names",
".",
"StorageTag",
",",
"unit",
"names",
".",
"UnitTag",
",",
"force",
"bool",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"errors",
".",
"DeferredAnnotatef",... | // Remove removes the storage attachment from state, and may remove its storage
// instance as well, if the storage instance is Dying and no other references to
// it exist. It will fail if the storage attachment is not Dying. | [
"Remove",
"removes",
"the",
"storage",
"attachment",
"from",
"state",
"and",
"may",
"remove",
"its",
"storage",
"instance",
"as",
"well",
"if",
"the",
"storage",
"instance",
"is",
"Dying",
"and",
"no",
"other",
"references",
"to",
"it",
"exist",
".",
"It",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/storage.go#L1363-L1392 |
156,303 | juju/juju | state/storage.go | removeStorageInstancesOps | func removeStorageInstancesOps(im *storageBackend, owner names.Tag, force bool) ([]txn.Op, error) {
coll, closer := im.mb.db().GetCollection(storageInstancesC)
defer closer()
var docs []storageInstanceDoc
err := coll.Find(bson.D{{"owner", owner.String()}}).Select(bson.D{{"id", true}}).All(&docs)
if err != nil {
... | go | func removeStorageInstancesOps(im *storageBackend, owner names.Tag, force bool) ([]txn.Op, error) {
coll, closer := im.mb.db().GetCollection(storageInstancesC)
defer closer()
var docs []storageInstanceDoc
err := coll.Find(bson.D{{"owner", owner.String()}}).Select(bson.D{{"id", true}}).All(&docs)
if err != nil {
... | [
"func",
"removeStorageInstancesOps",
"(",
"im",
"*",
"storageBackend",
",",
"owner",
"names",
".",
"Tag",
",",
"force",
"bool",
")",
"(",
"[",
"]",
"txn",
".",
"Op",
",",
"error",
")",
"{",
"coll",
",",
"closer",
":=",
"im",
".",
"mb",
".",
"db",
"... | // removeStorageInstancesOps returns the transaction operations to remove all
// storage instances owned by the specified entity. | [
"removeStorageInstancesOps",
"returns",
"the",
"transaction",
"operations",
"to",
"remove",
"all",
"storage",
"instances",
"owned",
"by",
"the",
"specified",
"entity",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/storage.go#L1627-L1651 |
156,304 | juju/juju | state/storage.go | validateStoragePool | func validateStoragePool(
sb *storageBackend, poolName string, kind storage.StorageKind, machineId *string,
) error {
if poolName == "" {
return errors.New("pool name is required")
}
providerType, aProvider, poolConfig, err := poolStorageProvider(sb, poolName)
if err != nil {
return errors.Trace(err)
}
// E... | go | func validateStoragePool(
sb *storageBackend, poolName string, kind storage.StorageKind, machineId *string,
) error {
if poolName == "" {
return errors.New("pool name is required")
}
providerType, aProvider, poolConfig, err := poolStorageProvider(sb, poolName)
if err != nil {
return errors.Trace(err)
}
// E... | [
"func",
"validateStoragePool",
"(",
"sb",
"*",
"storageBackend",
",",
"poolName",
"string",
",",
"kind",
"storage",
".",
"StorageKind",
",",
"machineId",
"*",
"string",
",",
")",
"error",
"{",
"if",
"poolName",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".... | // validateStoragePool validates the storage pool for the model.
// If machineId is non-nil, the storage scope will be validated against
// the machineId; if the storage is not machine-scoped, then the machineId
// will be updated to "". | [
"validateStoragePool",
"validates",
"the",
"storage",
"pool",
"for",
"the",
"model",
".",
"If",
"machineId",
"is",
"non",
"-",
"nil",
"the",
"storage",
"scope",
"will",
"be",
"validated",
"against",
"the",
"machineId",
";",
"if",
"the",
"storage",
"is",
"not... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/storage.go#L1838-L1884 |
156,305 | juju/juju | state/storage.go | storageConstraintsWithDefaults | func storageConstraintsWithDefaults(
modelType ModelType,
cfg *config.Config,
charmStorage charm.Storage,
name string,
cons StorageConstraints,
) (StorageConstraints, error) {
withDefaults := cons
// If no pool is specified, determine the pool from the env config and other constraints.
if cons.Pool == "" {
k... | go | func storageConstraintsWithDefaults(
modelType ModelType,
cfg *config.Config,
charmStorage charm.Storage,
name string,
cons StorageConstraints,
) (StorageConstraints, error) {
withDefaults := cons
// If no pool is specified, determine the pool from the env config and other constraints.
if cons.Pool == "" {
k... | [
"func",
"storageConstraintsWithDefaults",
"(",
"modelType",
"ModelType",
",",
"cfg",
"*",
"config",
".",
"Config",
",",
"charmStorage",
"charm",
".",
"Storage",
",",
"name",
"string",
",",
"cons",
"StorageConstraints",
",",
")",
"(",
"StorageConstraints",
",",
"... | // storageConstraintsWithDefaults returns a constraints
// derived from cons, with any defaults filled in. | [
"storageConstraintsWithDefaults",
"returns",
"a",
"constraints",
"derived",
"from",
"cons",
"with",
"any",
"defaults",
"filled",
"in",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/storage.go#L1947-L1979 |
156,306 | juju/juju | state/storage.go | defaultStoragePool | func defaultStoragePool(modelType ModelType, cfg *config.Config, kind storage.StorageKind, cons StorageConstraints) (string, error) {
switch kind {
case storage.StorageKindBlock:
fallbackPool := string(provider.LoopProviderType)
if modelType == ModelTypeCAAS {
fallbackPool = string(k8sprovider.K8s_ProviderType... | go | func defaultStoragePool(modelType ModelType, cfg *config.Config, kind storage.StorageKind, cons StorageConstraints) (string, error) {
switch kind {
case storage.StorageKindBlock:
fallbackPool := string(provider.LoopProviderType)
if modelType == ModelTypeCAAS {
fallbackPool = string(k8sprovider.K8s_ProviderType... | [
"func",
"defaultStoragePool",
"(",
"modelType",
"ModelType",
",",
"cfg",
"*",
"config",
".",
"Config",
",",
"kind",
"storage",
".",
"StorageKind",
",",
"cons",
"StorageConstraints",
")",
"(",
"string",
",",
"error",
")",
"{",
"switch",
"kind",
"{",
"case",
... | // defaultStoragePool returns the default storage pool for the model.
// The default pool is either user specified, or one that is registered by the provider itself. | [
"defaultStoragePool",
"returns",
"the",
"default",
"storage",
"pool",
"for",
"the",
"model",
".",
"The",
"default",
"pool",
"is",
"either",
"user",
"specified",
"or",
"one",
"that",
"is",
"registered",
"by",
"the",
"provider",
"itself",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/storage.go#L1983-L2028 |
156,307 | juju/juju | state/storage.go | AddStorageForUnit | func (sb *storageBackend) AddStorageForUnit(
tag names.UnitTag, name string, cons StorageConstraints,
) ([]names.StorageTag, error) {
u, err := sb.unit(tag.Id())
if err != nil {
return nil, errors.Trace(err)
}
var tags []names.StorageTag
buildTxn := func(attempt int) ([]txn.Op, error) {
if attempt > 0 {
if... | go | func (sb *storageBackend) AddStorageForUnit(
tag names.UnitTag, name string, cons StorageConstraints,
) ([]names.StorageTag, error) {
u, err := sb.unit(tag.Id())
if err != nil {
return nil, errors.Trace(err)
}
var tags []names.StorageTag
buildTxn := func(attempt int) ([]txn.Op, error) {
if attempt > 0 {
if... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"AddStorageForUnit",
"(",
"tag",
"names",
".",
"UnitTag",
",",
"name",
"string",
",",
"cons",
"StorageConstraints",
",",
")",
"(",
"[",
"]",
"names",
".",
"StorageTag",
",",
"error",
")",
"{",
"u",
",",
"e... | // AddStorageForUnit adds storage instances to given unit as specified.
//
// Missing storage constraints are populated based on model defaults.
// Storage store name is used to retrieve existing storage instances
// for this store. Combination of existing storage instances and
// anticipated additional storage instanc... | [
"AddStorageForUnit",
"adds",
"storage",
"instances",
"to",
"given",
"unit",
"as",
"specified",
".",
"Missing",
"storage",
"constraints",
"are",
"populated",
"based",
"on",
"model",
"defaults",
".",
"Storage",
"store",
"name",
"is",
"used",
"to",
"retrieve",
"exi... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/storage.go#L2037-L2060 |
156,308 | juju/juju | state/storage.go | addStorageForUnitOps | func (sb *storageBackend) addStorageForUnitOps(
u *Unit,
storageName string,
cons StorageConstraints,
) ([]names.StorageTag, []txn.Op, error) {
if u.Life() != Alive {
return nil, nil, unitNotAliveErr
}
// Storage addition is based on the charm metadata; u.charm()
// returns txn.Ops that ensure the charm URL d... | go | func (sb *storageBackend) addStorageForUnitOps(
u *Unit,
storageName string,
cons StorageConstraints,
) ([]names.StorageTag, []txn.Op, error) {
if u.Life() != Alive {
return nil, nil, unitNotAliveErr
}
// Storage addition is based on the charm metadata; u.charm()
// returns txn.Ops that ensure the charm URL d... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"addStorageForUnitOps",
"(",
"u",
"*",
"Unit",
",",
"storageName",
"string",
",",
"cons",
"StorageConstraints",
",",
")",
"(",
"[",
"]",
"names",
".",
"StorageTag",
",",
"[",
"]",
"txn",
".",
"Op",
",",
"e... | // addStorage adds storage instances to given unit as specified. | [
"addStorage",
"adds",
"storage",
"instances",
"to",
"given",
"unit",
"as",
"specified",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/storage.go#L2063-L2135 |
156,309 | juju/juju | state/storage.go | addUnitStorageOps | func (sb *storageBackend) addUnitStorageOps(
charmMeta *charm.Meta,
u *Unit,
storageName string,
cons StorageConstraints,
countMin int,
) ([]names.StorageTag, []txn.Op, error) {
var ops []txn.Op
consTotal := cons
if countMin < 0 {
// Validate that the requested number of storage
// instances can be added t... | go | func (sb *storageBackend) addUnitStorageOps(
charmMeta *charm.Meta,
u *Unit,
storageName string,
cons StorageConstraints,
countMin int,
) ([]names.StorageTag, []txn.Op, error) {
var ops []txn.Op
consTotal := cons
if countMin < 0 {
// Validate that the requested number of storage
// instances can be added t... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"addUnitStorageOps",
"(",
"charmMeta",
"*",
"charm",
".",
"Meta",
",",
"u",
"*",
"Unit",
",",
"storageName",
"string",
",",
"cons",
"StorageConstraints",
",",
"countMin",
"int",
",",
")",
"(",
"[",
"]",
"nam... | // addUnitStorageOps returns transaction ops to create storage for the given
// unit. If countMin is non-negative, the Count field of the constraints will
// be ignored, and as many storage instances as necessary to make up the
// shortfall will be created. | [
"addUnitStorageOps",
"returns",
"transaction",
"ops",
"to",
"create",
"storage",
"for",
"the",
"given",
"unit",
".",
"If",
"countMin",
"is",
"non",
"-",
"negative",
"the",
"Count",
"field",
"of",
"the",
"constraints",
"will",
"be",
"ignored",
"and",
"as",
"m... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/storage.go#L2141-L2215 |
156,310 | juju/juju | state/storage.go | hostStorageOps | func (sb *storageBackend) hostStorageOps(
hostId string, args *storageParams,
) ([]txn.Op, []volumeAttachmentTemplate, []filesystemAttachmentTemplate, error) {
var filesystemOps, volumeOps []txn.Op
var fsAttachments []filesystemAttachmentTemplate
var volumeAttachments []volumeAttachmentTemplate
const (
createAn... | go | func (sb *storageBackend) hostStorageOps(
hostId string, args *storageParams,
) ([]txn.Op, []volumeAttachmentTemplate, []filesystemAttachmentTemplate, error) {
var filesystemOps, volumeOps []txn.Op
var fsAttachments []filesystemAttachmentTemplate
var volumeAttachments []volumeAttachmentTemplate
const (
createAn... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"hostStorageOps",
"(",
"hostId",
"string",
",",
"args",
"*",
"storageParams",
",",
")",
"(",
"[",
"]",
"txn",
".",
"Op",
",",
"[",
"]",
"volumeAttachmentTemplate",
",",
"[",
"]",
"filesystemAttachmentTemplate",
... | // hostStorageOps creates txn.Ops for creating volumes, filesystems,
// and attachments to the specified host. The results are the txn.Ops,
// and the tags of volumes and filesystems newly attached to the host. | [
"hostStorageOps",
"creates",
"txn",
".",
"Ops",
"for",
"creating",
"volumes",
"filesystems",
"and",
"attachments",
"to",
"the",
"specified",
"host",
".",
"The",
"results",
"are",
"the",
"txn",
".",
"Ops",
"and",
"the",
"tags",
"of",
"volumes",
"and",
"filesy... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/storage.go#L2259-L2323 |
156,311 | juju/juju | state/storage.go | addMachineStorageAttachmentsOps | func addMachineStorageAttachmentsOps(
machine *Machine,
volumes []volumeAttachmentTemplate,
filesystems []filesystemAttachmentTemplate,
) ([]txn.Op, error) {
var addToSet bson.D
assert := isAliveDoc
if len(volumes) > 0 {
volumeIds := make([]string, len(volumes))
for i, v := range volumes {
volumeIds[i] = v... | go | func addMachineStorageAttachmentsOps(
machine *Machine,
volumes []volumeAttachmentTemplate,
filesystems []filesystemAttachmentTemplate,
) ([]txn.Op, error) {
var addToSet bson.D
assert := isAliveDoc
if len(volumes) > 0 {
volumeIds := make([]string, len(volumes))
for i, v := range volumes {
volumeIds[i] = v... | [
"func",
"addMachineStorageAttachmentsOps",
"(",
"machine",
"*",
"Machine",
",",
"volumes",
"[",
"]",
"volumeAttachmentTemplate",
",",
"filesystems",
"[",
"]",
"filesystemAttachmentTemplate",
",",
")",
"(",
"[",
"]",
"txn",
".",
"Op",
",",
"error",
")",
"{",
"v... | // addMachineStorageAttachmentsOps returns txn.Ops for adding the IDs of
// attached volumes and filesystems to an existing machine. Filesystem
// mount points are checked against existing filesystem attachments for
// conflicts, with a txn.Op added to prevent concurrent additions as
// necessary. | [
"addMachineStorageAttachmentsOps",
"returns",
"txn",
".",
"Ops",
"for",
"adding",
"the",
"IDs",
"of",
"attached",
"volumes",
"and",
"filesystems",
"to",
"an",
"existing",
"machine",
".",
"Filesystem",
"mount",
"points",
"are",
"checked",
"against",
"existing",
"fi... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/storage.go#L2330-L2387 |
156,312 | juju/juju | worker/logforwarder/sinks/syslog.go | OpenSyslog | func OpenSyslog(cfg *syslog.RawConfig) (*logforwarder.LogSink, error) {
if !cfg.Enabled {
return nil, errors.New("log forwarding not enabled")
}
client, err := syslog.Open(*cfg)
if err != nil {
return nil, errors.Trace(err)
}
if client == nil {
// TODO(axw) we should be returning an error
// which we inte... | go | func OpenSyslog(cfg *syslog.RawConfig) (*logforwarder.LogSink, error) {
if !cfg.Enabled {
return nil, errors.New("log forwarding not enabled")
}
client, err := syslog.Open(*cfg)
if err != nil {
return nil, errors.Trace(err)
}
if client == nil {
// TODO(axw) we should be returning an error
// which we inte... | [
"func",
"OpenSyslog",
"(",
"cfg",
"*",
"syslog",
".",
"RawConfig",
")",
"(",
"*",
"logforwarder",
".",
"LogSink",
",",
"error",
")",
"{",
"if",
"!",
"cfg",
".",
"Enabled",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",... | // OpenSyslog returns a sink used to receive log messages to be forwarded. | [
"OpenSyslog",
"returns",
"a",
"sink",
"used",
"to",
"receive",
"log",
"messages",
"to",
"be",
"forwarded",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/logforwarder/sinks/syslog.go#L15-L34 |
156,313 | juju/juju | apiserver/restrict_restore.go | aboutToRestoreMethodsOnly | func aboutToRestoreMethodsOnly(facadeName string, methodName string) error {
fullName := facadeName + "." + methodName
if !allowedMethodsAboutToRestore.Contains(fullName) {
return aboutToRestoreError
}
return nil
} | go | func aboutToRestoreMethodsOnly(facadeName string, methodName string) error {
fullName := facadeName + "." + methodName
if !allowedMethodsAboutToRestore.Contains(fullName) {
return aboutToRestoreError
}
return nil
} | [
"func",
"aboutToRestoreMethodsOnly",
"(",
"facadeName",
"string",
",",
"methodName",
"string",
")",
"error",
"{",
"fullName",
":=",
"facadeName",
"+",
"\"",
"\"",
"+",
"methodName",
"\n",
"if",
"!",
"allowedMethodsAboutToRestore",
".",
"Contains",
"(",
"fullName",... | // aboutToRestoreMethodsOnly can be used with restrictRoot to restrict
// the API to the methods allowed when the server is in
// state.RestorePreparing mode. | [
"aboutToRestoreMethodsOnly",
"can",
"be",
"used",
"with",
"restrictRoot",
"to",
"restrict",
"the",
"API",
"to",
"the",
"methods",
"allowed",
"when",
"the",
"server",
"is",
"in",
"state",
".",
"RestorePreparing",
"mode",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/restrict_restore.go#L17-L23 |
156,314 | juju/juju | caas/kubernetes/provider/mocks/serviceaccount_mock.go | NewMockServiceAccountInterface | func NewMockServiceAccountInterface(ctrl *gomock.Controller) *MockServiceAccountInterface {
mock := &MockServiceAccountInterface{ctrl: ctrl}
mock.recorder = &MockServiceAccountInterfaceMockRecorder{mock}
return mock
} | go | func NewMockServiceAccountInterface(ctrl *gomock.Controller) *MockServiceAccountInterface {
mock := &MockServiceAccountInterface{ctrl: ctrl}
mock.recorder = &MockServiceAccountInterfaceMockRecorder{mock}
return mock
} | [
"func",
"NewMockServiceAccountInterface",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockServiceAccountInterface",
"{",
"mock",
":=",
"&",
"MockServiceAccountInterface",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"Mock... | // NewMockServiceAccountInterface creates a new mock instance | [
"NewMockServiceAccountInterface",
"creates",
"a",
"new",
"mock",
"instance"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/caas/kubernetes/provider/mocks/serviceaccount_mock.go#L29-L33 |
156,315 | juju/juju | caas/kubernetes/provider/mocks/serviceaccount_mock.go | CreateToken | func (m *MockServiceAccountInterface) CreateToken(arg0 string, arg1 *v1.TokenRequest) (*v1.TokenRequest, error) {
ret := m.ctrl.Call(m, "CreateToken", arg0, arg1)
ret0, _ := ret[0].(*v1.TokenRequest)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockServiceAccountInterface) CreateToken(arg0 string, arg1 *v1.TokenRequest) (*v1.TokenRequest, error) {
ret := m.ctrl.Call(m, "CreateToken", arg0, arg1)
ret0, _ := ret[0].(*v1.TokenRequest)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockServiceAccountInterface",
")",
"CreateToken",
"(",
"arg0",
"string",
",",
"arg1",
"*",
"v1",
".",
"TokenRequest",
")",
"(",
"*",
"v1",
".",
"TokenRequest",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
... | // CreateToken mocks base method | [
"CreateToken",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/caas/kubernetes/provider/mocks/serviceaccount_mock.go#L54-L59 |
156,316 | juju/juju | apiserver/params/network.go | FromNetworkPort | func FromNetworkPort(p corenetwork.Port) Port {
return Port{
Protocol: p.Protocol,
Number: p.Number,
}
} | go | func FromNetworkPort(p corenetwork.Port) Port {
return Port{
Protocol: p.Protocol,
Number: p.Number,
}
} | [
"func",
"FromNetworkPort",
"(",
"p",
"corenetwork",
".",
"Port",
")",
"Port",
"{",
"return",
"Port",
"{",
"Protocol",
":",
"p",
".",
"Protocol",
",",
"Number",
":",
"p",
".",
"Number",
",",
"}",
"\n",
"}"
] | // FromNetworkPort is a convenience helper to create a parameter
// out of the network type, here for Port. | [
"FromNetworkPort",
"is",
"a",
"convenience",
"helper",
"to",
"create",
"a",
"parameter",
"out",
"of",
"the",
"network",
"type",
"here",
"for",
"Port",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/params/network.go#L209-L214 |
156,317 | juju/juju | apiserver/params/network.go | NetworkPort | func (p Port) NetworkPort() corenetwork.Port {
return corenetwork.Port{
Protocol: p.Protocol,
Number: p.Number,
}
} | go | func (p Port) NetworkPort() corenetwork.Port {
return corenetwork.Port{
Protocol: p.Protocol,
Number: p.Number,
}
} | [
"func",
"(",
"p",
"Port",
")",
"NetworkPort",
"(",
")",
"corenetwork",
".",
"Port",
"{",
"return",
"corenetwork",
".",
"Port",
"{",
"Protocol",
":",
"p",
".",
"Protocol",
",",
"Number",
":",
"p",
".",
"Number",
",",
"}",
"\n",
"}"
] | // NetworkPort is a convenience helper to return the parameter
// as network type, here for Port. | [
"NetworkPort",
"is",
"a",
"convenience",
"helper",
"to",
"return",
"the",
"parameter",
"as",
"network",
"type",
"here",
"for",
"Port",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/params/network.go#L218-L223 |
156,318 | juju/juju | apiserver/params/network.go | FromNetworkPortRange | func FromNetworkPortRange(pr corenetwork.PortRange) PortRange {
return PortRange{
FromPort: pr.FromPort,
ToPort: pr.ToPort,
Protocol: pr.Protocol,
}
} | go | func FromNetworkPortRange(pr corenetwork.PortRange) PortRange {
return PortRange{
FromPort: pr.FromPort,
ToPort: pr.ToPort,
Protocol: pr.Protocol,
}
} | [
"func",
"FromNetworkPortRange",
"(",
"pr",
"corenetwork",
".",
"PortRange",
")",
"PortRange",
"{",
"return",
"PortRange",
"{",
"FromPort",
":",
"pr",
".",
"FromPort",
",",
"ToPort",
":",
"pr",
".",
"ToPort",
",",
"Protocol",
":",
"pr",
".",
"Protocol",
","... | // FromNetworkPortRange is a convenience helper to create a parameter
// out of the network type, here for PortRange. | [
"FromNetworkPortRange",
"is",
"a",
"convenience",
"helper",
"to",
"create",
"a",
"parameter",
"out",
"of",
"the",
"network",
"type",
"here",
"for",
"PortRange",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/params/network.go#L236-L242 |
156,319 | juju/juju | apiserver/params/network.go | NetworkPortRange | func (pr PortRange) NetworkPortRange() corenetwork.PortRange {
return corenetwork.PortRange{
FromPort: pr.FromPort,
ToPort: pr.ToPort,
Protocol: pr.Protocol,
}
} | go | func (pr PortRange) NetworkPortRange() corenetwork.PortRange {
return corenetwork.PortRange{
FromPort: pr.FromPort,
ToPort: pr.ToPort,
Protocol: pr.Protocol,
}
} | [
"func",
"(",
"pr",
"PortRange",
")",
"NetworkPortRange",
"(",
")",
"corenetwork",
".",
"PortRange",
"{",
"return",
"corenetwork",
".",
"PortRange",
"{",
"FromPort",
":",
"pr",
".",
"FromPort",
",",
"ToPort",
":",
"pr",
".",
"ToPort",
",",
"Protocol",
":",
... | // NetworkPortRange is a convenience helper to return the parameter
// as network type, here for PortRange. | [
"NetworkPortRange",
"is",
"a",
"convenience",
"helper",
"to",
"return",
"the",
"parameter",
"as",
"network",
"type",
"here",
"for",
"PortRange",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/params/network.go#L246-L252 |
156,320 | juju/juju | apiserver/params/network.go | FromNetworkAddress | func FromNetworkAddress(naddr network.Address) Address {
return Address{
Value: naddr.Value,
Type: string(naddr.Type),
Scope: string(naddr.Scope),
SpaceName: string(naddr.SpaceName),
}
} | go | func FromNetworkAddress(naddr network.Address) Address {
return Address{
Value: naddr.Value,
Type: string(naddr.Type),
Scope: string(naddr.Scope),
SpaceName: string(naddr.SpaceName),
}
} | [
"func",
"FromNetworkAddress",
"(",
"naddr",
"network",
".",
"Address",
")",
"Address",
"{",
"return",
"Address",
"{",
"Value",
":",
"naddr",
".",
"Value",
",",
"Type",
":",
"string",
"(",
"naddr",
".",
"Type",
")",
",",
"Scope",
":",
"string",
"(",
"na... | // FromNetworkAddress is a convenience helper to create a parameter
// out of the network type, here for Address. | [
"FromNetworkAddress",
"is",
"a",
"convenience",
"helper",
"to",
"create",
"a",
"parameter",
"out",
"of",
"the",
"network",
"type",
"here",
"for",
"Address",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/params/network.go#L294-L301 |
156,321 | juju/juju | apiserver/params/network.go | NetworkAddress | func (addr Address) NetworkAddress() network.Address {
return network.Address{
Value: addr.Value,
Type: network.AddressType(addr.Type),
Scope: network.Scope(addr.Scope),
SpaceName: network.SpaceName(addr.SpaceName),
}
} | go | func (addr Address) NetworkAddress() network.Address {
return network.Address{
Value: addr.Value,
Type: network.AddressType(addr.Type),
Scope: network.Scope(addr.Scope),
SpaceName: network.SpaceName(addr.SpaceName),
}
} | [
"func",
"(",
"addr",
"Address",
")",
"NetworkAddress",
"(",
")",
"network",
".",
"Address",
"{",
"return",
"network",
".",
"Address",
"{",
"Value",
":",
"addr",
".",
"Value",
",",
"Type",
":",
"network",
".",
"AddressType",
"(",
"addr",
".",
"Type",
")... | // NetworkAddress is a convenience helper to return the parameter
// as network type, here for Address. | [
"NetworkAddress",
"is",
"a",
"convenience",
"helper",
"to",
"return",
"the",
"parameter",
"as",
"network",
"type",
"here",
"for",
"Address",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/params/network.go#L305-L312 |
156,322 | juju/juju | apiserver/params/network.go | FromNetworkAddresses | func FromNetworkAddresses(naddrs ...network.Address) []Address {
addrs := make([]Address, len(naddrs))
for i, naddr := range naddrs {
addrs[i] = FromNetworkAddress(naddr)
}
return addrs
} | go | func FromNetworkAddresses(naddrs ...network.Address) []Address {
addrs := make([]Address, len(naddrs))
for i, naddr := range naddrs {
addrs[i] = FromNetworkAddress(naddr)
}
return addrs
} | [
"func",
"FromNetworkAddresses",
"(",
"naddrs",
"...",
"network",
".",
"Address",
")",
"[",
"]",
"Address",
"{",
"addrs",
":=",
"make",
"(",
"[",
"]",
"Address",
",",
"len",
"(",
"naddrs",
")",
")",
"\n",
"for",
"i",
",",
"naddr",
":=",
"range",
"nadd... | // FromNetworkAddresses is a convenience helper to create a parameter
// out of the network type, here for a slice of Address. | [
"FromNetworkAddresses",
"is",
"a",
"convenience",
"helper",
"to",
"create",
"a",
"parameter",
"out",
"of",
"the",
"network",
"type",
"here",
"for",
"a",
"slice",
"of",
"Address",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/params/network.go#L316-L322 |
156,323 | juju/juju | apiserver/params/network.go | NetworkAddresses | func NetworkAddresses(addrs ...Address) []network.Address {
naddrs := make([]network.Address, len(addrs))
for i, addr := range addrs {
naddrs[i] = addr.NetworkAddress()
}
return naddrs
} | go | func NetworkAddresses(addrs ...Address) []network.Address {
naddrs := make([]network.Address, len(addrs))
for i, addr := range addrs {
naddrs[i] = addr.NetworkAddress()
}
return naddrs
} | [
"func",
"NetworkAddresses",
"(",
"addrs",
"...",
"Address",
")",
"[",
"]",
"network",
".",
"Address",
"{",
"naddrs",
":=",
"make",
"(",
"[",
"]",
"network",
".",
"Address",
",",
"len",
"(",
"addrs",
")",
")",
"\n",
"for",
"i",
",",
"addr",
":=",
"r... | // NetworkAddresses is a convenience helper to return the parameter
// as network type, here for a slice of Address. | [
"NetworkAddresses",
"is",
"a",
"convenience",
"helper",
"to",
"return",
"the",
"parameter",
"as",
"network",
"type",
"here",
"for",
"a",
"slice",
"of",
"Address",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/params/network.go#L326-L332 |
156,324 | juju/juju | apiserver/params/network.go | FromNetworkHostPort | func FromNetworkHostPort(nhp network.HostPort) HostPort {
return HostPort{FromNetworkAddress(nhp.Address), nhp.Port}
} | go | func FromNetworkHostPort(nhp network.HostPort) HostPort {
return HostPort{FromNetworkAddress(nhp.Address), nhp.Port}
} | [
"func",
"FromNetworkHostPort",
"(",
"nhp",
"network",
".",
"HostPort",
")",
"HostPort",
"{",
"return",
"HostPort",
"{",
"FromNetworkAddress",
"(",
"nhp",
".",
"Address",
")",
",",
"nhp",
".",
"Port",
"}",
"\n",
"}"
] | // FromNetworkHostPort is a convenience helper to create a parameter
// out of the network type, here for HostPort. | [
"FromNetworkHostPort",
"is",
"a",
"convenience",
"helper",
"to",
"create",
"a",
"parameter",
"out",
"of",
"the",
"network",
"type",
"here",
"for",
"HostPort",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/params/network.go#L344-L346 |
156,325 | juju/juju | apiserver/params/network.go | NetworkHostPort | func (hp HostPort) NetworkHostPort() network.HostPort {
return network.HostPort{hp.Address.NetworkAddress(), hp.Port}
} | go | func (hp HostPort) NetworkHostPort() network.HostPort {
return network.HostPort{hp.Address.NetworkAddress(), hp.Port}
} | [
"func",
"(",
"hp",
"HostPort",
")",
"NetworkHostPort",
"(",
")",
"network",
".",
"HostPort",
"{",
"return",
"network",
".",
"HostPort",
"{",
"hp",
".",
"Address",
".",
"NetworkAddress",
"(",
")",
",",
"hp",
".",
"Port",
"}",
"\n",
"}"
] | // NetworkHostPort is a convenience helper to return the parameter
// as network type, here for HostPort. | [
"NetworkHostPort",
"is",
"a",
"convenience",
"helper",
"to",
"return",
"the",
"parameter",
"as",
"network",
"type",
"here",
"for",
"HostPort",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/params/network.go#L350-L352 |
156,326 | juju/juju | apiserver/params/network.go | FromNetworkHostPorts | func FromNetworkHostPorts(nhps []network.HostPort) []HostPort {
hps := make([]HostPort, len(nhps))
for i, nhp := range nhps {
hps[i] = FromNetworkHostPort(nhp)
}
return hps
} | go | func FromNetworkHostPorts(nhps []network.HostPort) []HostPort {
hps := make([]HostPort, len(nhps))
for i, nhp := range nhps {
hps[i] = FromNetworkHostPort(nhp)
}
return hps
} | [
"func",
"FromNetworkHostPorts",
"(",
"nhps",
"[",
"]",
"network",
".",
"HostPort",
")",
"[",
"]",
"HostPort",
"{",
"hps",
":=",
"make",
"(",
"[",
"]",
"HostPort",
",",
"len",
"(",
"nhps",
")",
")",
"\n",
"for",
"i",
",",
"nhp",
":=",
"range",
"nhps... | // FromNetworkHostPorts is a helper to create a parameter
// out of the network type, here for a slice of HostPort. | [
"FromNetworkHostPorts",
"is",
"a",
"helper",
"to",
"create",
"a",
"parameter",
"out",
"of",
"the",
"network",
"type",
"here",
"for",
"a",
"slice",
"of",
"HostPort",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/params/network.go#L356-L362 |
156,327 | juju/juju | apiserver/params/network.go | NetworkHostPorts | func NetworkHostPorts(hps []HostPort) []network.HostPort {
nhps := make([]network.HostPort, len(hps))
for i, hp := range hps {
nhps[i] = hp.NetworkHostPort()
}
return nhps
} | go | func NetworkHostPorts(hps []HostPort) []network.HostPort {
nhps := make([]network.HostPort, len(hps))
for i, hp := range hps {
nhps[i] = hp.NetworkHostPort()
}
return nhps
} | [
"func",
"NetworkHostPorts",
"(",
"hps",
"[",
"]",
"HostPort",
")",
"[",
"]",
"network",
".",
"HostPort",
"{",
"nhps",
":=",
"make",
"(",
"[",
"]",
"network",
".",
"HostPort",
",",
"len",
"(",
"hps",
")",
")",
"\n",
"for",
"i",
",",
"hp",
":=",
"r... | // NetworkHostPorts is a convenience helper to return the parameter
// as network type, here for a slice of HostPort. | [
"NetworkHostPorts",
"is",
"a",
"convenience",
"helper",
"to",
"return",
"the",
"parameter",
"as",
"network",
"type",
"here",
"for",
"a",
"slice",
"of",
"HostPort",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/params/network.go#L366-L372 |
156,328 | juju/juju | apiserver/params/network.go | FromNetworkHostsPorts | func FromNetworkHostsPorts(nhpm [][]network.HostPort) [][]HostPort {
hpm := make([][]HostPort, len(nhpm))
for i, nhps := range nhpm {
hpm[i] = FromNetworkHostPorts(nhps)
}
return hpm
} | go | func FromNetworkHostsPorts(nhpm [][]network.HostPort) [][]HostPort {
hpm := make([][]HostPort, len(nhpm))
for i, nhps := range nhpm {
hpm[i] = FromNetworkHostPorts(nhps)
}
return hpm
} | [
"func",
"FromNetworkHostsPorts",
"(",
"nhpm",
"[",
"]",
"[",
"]",
"network",
".",
"HostPort",
")",
"[",
"]",
"[",
"]",
"HostPort",
"{",
"hpm",
":=",
"make",
"(",
"[",
"]",
"[",
"]",
"HostPort",
",",
"len",
"(",
"nhpm",
")",
")",
"\n",
"for",
"i",... | // FromNetworkHostsPorts is a helper to create a parameter
// out of the network type, here for a nested slice of HostPort. | [
"FromNetworkHostsPorts",
"is",
"a",
"helper",
"to",
"create",
"a",
"parameter",
"out",
"of",
"the",
"network",
"type",
"here",
"for",
"a",
"nested",
"slice",
"of",
"HostPort",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/params/network.go#L376-L382 |
156,329 | juju/juju | apiserver/params/network.go | NetworkHostsPorts | func NetworkHostsPorts(hpm [][]HostPort) [][]network.HostPort {
nhpm := make([][]network.HostPort, len(hpm))
for i, hps := range hpm {
nhpm[i] = NetworkHostPorts(hps)
}
return nhpm
} | go | func NetworkHostsPorts(hpm [][]HostPort) [][]network.HostPort {
nhpm := make([][]network.HostPort, len(hpm))
for i, hps := range hpm {
nhpm[i] = NetworkHostPorts(hps)
}
return nhpm
} | [
"func",
"NetworkHostsPorts",
"(",
"hpm",
"[",
"]",
"[",
"]",
"HostPort",
")",
"[",
"]",
"[",
"]",
"network",
".",
"HostPort",
"{",
"nhpm",
":=",
"make",
"(",
"[",
"]",
"[",
"]",
"network",
".",
"HostPort",
",",
"len",
"(",
"hpm",
")",
")",
"\n",
... | // NetworkHostsPorts is a convenience helper to return the parameter
// as network type, here for a nested slice of HostPort. | [
"NetworkHostsPorts",
"is",
"a",
"convenience",
"helper",
"to",
"return",
"the",
"parameter",
"as",
"network",
"type",
"here",
"for",
"a",
"nested",
"slice",
"of",
"HostPort",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/params/network.go#L386-L392 |
156,330 | juju/juju | upgrades/steps_25.go | stateStepsFor25 | func stateStepsFor25() []Step {
return []Step{
&upgradeStep{
description: `migrate storage records to use "hostid" field`,
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return context.State().MigrateStorageMachineIdFields()
},
},
&upgradeStep{
description: "migrate ... | go | func stateStepsFor25() []Step {
return []Step{
&upgradeStep{
description: `migrate storage records to use "hostid" field`,
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return context.State().MigrateStorageMachineIdFields()
},
},
&upgradeStep{
description: "migrate ... | [
"func",
"stateStepsFor25",
"(",
")",
"[",
"]",
"Step",
"{",
"return",
"[",
"]",
"Step",
"{",
"&",
"upgradeStep",
"{",
"description",
":",
"`migrate storage records to use \"hostid\" field`",
",",
"targets",
":",
"[",
"]",
"Target",
"{",
"DatabaseMaster",
"}",
... | // stateStepsFor25 returns upgrade steps for Juju 2.5.0 that manipulate state directly. | [
"stateStepsFor25",
"returns",
"upgrade",
"steps",
"for",
"Juju",
"2",
".",
"5",
".",
"0",
"that",
"manipulate",
"state",
"directly",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/upgrades/steps_25.go#L7-L36 |
156,331 | juju/juju | apiserver/root.go | newAPIHandler | func newAPIHandler(srv *Server, st *state.State, rpcConn *rpc.Conn, modelUUID string, connectionID uint64, serverHost string) (*apiHandler, error) {
m, err := st.Model()
if err != nil {
if !errors.IsNotFound(err) {
return nil, errors.Trace(err)
}
// If this model used to be hosted on this controller but got... | go | func newAPIHandler(srv *Server, st *state.State, rpcConn *rpc.Conn, modelUUID string, connectionID uint64, serverHost string) (*apiHandler, error) {
m, err := st.Model()
if err != nil {
if !errors.IsNotFound(err) {
return nil, errors.Trace(err)
}
// If this model used to be hosted on this controller but got... | [
"func",
"newAPIHandler",
"(",
"srv",
"*",
"Server",
",",
"st",
"*",
"state",
".",
"State",
",",
"rpcConn",
"*",
"rpc",
".",
"Conn",
",",
"modelUUID",
"string",
",",
"connectionID",
"uint64",
",",
"serverHost",
"string",
")",
"(",
"*",
"apiHandler",
",",
... | // newAPIHandler returns a new apiHandler. | [
"newAPIHandler",
"returns",
"a",
"new",
"apiHandler",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L73-L125 |
156,332 | juju/juju | apiserver/root.go | Call | func (s *srvCaller) Call(ctx context.Context, objId string, arg reflect.Value) (reflect.Value, error) {
objVal, err := s.creator(objId)
if err != nil {
return reflect.Value{}, err
}
return s.objMethod.Call(ctx, objVal, arg)
} | go | func (s *srvCaller) Call(ctx context.Context, objId string, arg reflect.Value) (reflect.Value, error) {
objVal, err := s.creator(objId)
if err != nil {
return reflect.Value{}, err
}
return s.objMethod.Call(ctx, objVal, arg)
} | [
"func",
"(",
"s",
"*",
"srvCaller",
")",
"Call",
"(",
"ctx",
"context",
".",
"Context",
",",
"objId",
"string",
",",
"arg",
"reflect",
".",
"Value",
")",
"(",
"reflect",
".",
"Value",
",",
"error",
")",
"{",
"objVal",
",",
"err",
":=",
"s",
".",
... | // Call takes the object Id and an instance of ParamsType to create an object and place
// a call on its method. It then returns an instance of ResultType. | [
"Call",
"takes",
"the",
"object",
"Id",
"and",
"an",
"instance",
"of",
"ParamsType",
"to",
"create",
"an",
"object",
"and",
"place",
"a",
"call",
"on",
"its",
"method",
".",
"It",
"then",
"returns",
"an",
"instance",
"of",
"ResultType",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L165-L171 |
156,333 | juju/juju | apiserver/root.go | newAPIRoot | func newAPIRoot(st *state.State, shared *sharedServerContext, facades *facade.Registry, resources *common.Resources, authorizer facade.Authorizer) *apiRoot {
r := &apiRoot{
state: st,
shared: shared,
facades: facades,
resources: resources,
authorizer: authorizer,
objectCache: make(map[obj... | go | func newAPIRoot(st *state.State, shared *sharedServerContext, facades *facade.Registry, resources *common.Resources, authorizer facade.Authorizer) *apiRoot {
r := &apiRoot{
state: st,
shared: shared,
facades: facades,
resources: resources,
authorizer: authorizer,
objectCache: make(map[obj... | [
"func",
"newAPIRoot",
"(",
"st",
"*",
"state",
".",
"State",
",",
"shared",
"*",
"sharedServerContext",
",",
"facades",
"*",
"facade",
".",
"Registry",
",",
"resources",
"*",
"common",
".",
"Resources",
",",
"authorizer",
"facade",
".",
"Authorizer",
")",
... | // newAPIRoot returns a new apiRoot. | [
"newAPIRoot",
"returns",
"a",
"new",
"apiRoot",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L185-L195 |
156,334 | juju/juju | apiserver/root.go | restrictAPIRoot | func restrictAPIRoot(
srv *Server,
apiRoot rpc.Root,
model *state.Model,
auth authResult,
) (rpc.Root, error) {
if !auth.controllerMachineLogin {
// Controller agents are allowed to
// connect even during maintenance.
restrictedRoot, err := restrictAPIRootDuringMaintenance(
srv, apiRoot, model, auth.tag, ... | go | func restrictAPIRoot(
srv *Server,
apiRoot rpc.Root,
model *state.Model,
auth authResult,
) (rpc.Root, error) {
if !auth.controllerMachineLogin {
// Controller agents are allowed to
// connect even during maintenance.
restrictedRoot, err := restrictAPIRootDuringMaintenance(
srv, apiRoot, model, auth.tag, ... | [
"func",
"restrictAPIRoot",
"(",
"srv",
"*",
"Server",
",",
"apiRoot",
"rpc",
".",
"Root",
",",
"model",
"*",
"state",
".",
"Model",
",",
"auth",
"authResult",
",",
")",
"(",
"rpc",
".",
"Root",
",",
"error",
")",
"{",
"if",
"!",
"auth",
".",
"contr... | // restrictAPIRoot calls restrictAPIRootDuringMaintenance, and
// then restricts the result further to the controller or model
// facades, depending on the type of login. | [
"restrictAPIRoot",
"calls",
"restrictAPIRootDuringMaintenance",
"and",
"then",
"restricts",
"the",
"result",
"further",
"to",
"the",
"controller",
"or",
"model",
"facades",
"depending",
"on",
"the",
"type",
"of",
"login",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L200-L226 |
156,335 | juju/juju | apiserver/root.go | ModelPresence | func (ctx *facadeContext) ModelPresence(modelUUID string) facade.ModelPresence {
if ctx.r.shared.featureEnabled(feature.OldPresence) {
// Used in common/presence.go to determine which code path to follow.
return nil
}
return ctx.r.shared.presence.Connections().ForModel(modelUUID)
} | go | func (ctx *facadeContext) ModelPresence(modelUUID string) facade.ModelPresence {
if ctx.r.shared.featureEnabled(feature.OldPresence) {
// Used in common/presence.go to determine which code path to follow.
return nil
}
return ctx.r.shared.presence.Connections().ForModel(modelUUID)
} | [
"func",
"(",
"ctx",
"*",
"facadeContext",
")",
"ModelPresence",
"(",
"modelUUID",
"string",
")",
"facade",
".",
"ModelPresence",
"{",
"if",
"ctx",
".",
"r",
".",
"shared",
".",
"featureEnabled",
"(",
"feature",
".",
"OldPresence",
")",
"{",
"// Used in commo... | // ModelPresence implements facade.ModelPresence. | [
"ModelPresence",
"implements",
"facade",
".",
"ModelPresence",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L422-L428 |
156,336 | juju/juju | apiserver/root.go | LeadershipClaimer | func (ctx *facadeContext) LeadershipClaimer(modelUUID string) (leadership.Claimer, error) {
if ctx.r.shared.featureEnabled(feature.LegacyLeases) {
if modelUUID != ctx.State().ModelUUID() {
return nil, errors.Errorf("can't get leadership claimer for different model with legacy lease manager")
}
return ctx.Stat... | go | func (ctx *facadeContext) LeadershipClaimer(modelUUID string) (leadership.Claimer, error) {
if ctx.r.shared.featureEnabled(feature.LegacyLeases) {
if modelUUID != ctx.State().ModelUUID() {
return nil, errors.Errorf("can't get leadership claimer for different model with legacy lease manager")
}
return ctx.Stat... | [
"func",
"(",
"ctx",
"*",
"facadeContext",
")",
"LeadershipClaimer",
"(",
"modelUUID",
"string",
")",
"(",
"leadership",
".",
"Claimer",
",",
"error",
")",
"{",
"if",
"ctx",
".",
"r",
".",
"shared",
".",
"featureEnabled",
"(",
"feature",
".",
"LegacyLeases"... | // LeadershipClaimer is part of the facade.Context interface. Getting
// a claimer for an arbitrary model is only supported for raft leases
// - only a claimer for the current model can be obtained with legacy
// leases. | [
"LeadershipClaimer",
"is",
"part",
"of",
"the",
"facade",
".",
"Context",
"interface",
".",
"Getting",
"a",
"claimer",
"for",
"an",
"arbitrary",
"model",
"is",
"only",
"supported",
"for",
"raft",
"leases",
"-",
"only",
"a",
"claimer",
"for",
"the",
"current"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L459-L474 |
156,337 | juju/juju | apiserver/root.go | LeadershipChecker | func (ctx *facadeContext) LeadershipChecker() (leadership.Checker, error) {
if ctx.r.shared.featureEnabled(feature.LegacyLeases) {
return ctx.State().LeadershipChecker(), nil
}
checker, err := ctx.r.shared.leaseManager.Checker(
lease.ApplicationLeadershipNamespace,
ctx.State().ModelUUID(),
)
if err != nil {
... | go | func (ctx *facadeContext) LeadershipChecker() (leadership.Checker, error) {
if ctx.r.shared.featureEnabled(feature.LegacyLeases) {
return ctx.State().LeadershipChecker(), nil
}
checker, err := ctx.r.shared.leaseManager.Checker(
lease.ApplicationLeadershipNamespace,
ctx.State().ModelUUID(),
)
if err != nil {
... | [
"func",
"(",
"ctx",
"*",
"facadeContext",
")",
"LeadershipChecker",
"(",
")",
"(",
"leadership",
".",
"Checker",
",",
"error",
")",
"{",
"if",
"ctx",
".",
"r",
".",
"shared",
".",
"featureEnabled",
"(",
"feature",
".",
"LegacyLeases",
")",
"{",
"return",... | // LeadershipChecker is part of the facade.Context interface. | [
"LeadershipChecker",
"is",
"part",
"of",
"the",
"facade",
".",
"Context",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L477-L489 |
156,338 | juju/juju | apiserver/root.go | LeadershipPinner | func (ctx *facadeContext) LeadershipPinner(modelUUID string) (leadership.Pinner, error) {
if ctx.r.shared.featureEnabled(feature.LegacyLeases) {
return nil, errors.NotImplementedf(
"unable to get leadership pinner; pinning is not available with the legacy lease manager")
}
pinner, err := ctx.r.shared.leaseManag... | go | func (ctx *facadeContext) LeadershipPinner(modelUUID string) (leadership.Pinner, error) {
if ctx.r.shared.featureEnabled(feature.LegacyLeases) {
return nil, errors.NotImplementedf(
"unable to get leadership pinner; pinning is not available with the legacy lease manager")
}
pinner, err := ctx.r.shared.leaseManag... | [
"func",
"(",
"ctx",
"*",
"facadeContext",
")",
"LeadershipPinner",
"(",
"modelUUID",
"string",
")",
"(",
"leadership",
".",
"Pinner",
",",
"error",
")",
"{",
"if",
"ctx",
".",
"r",
".",
"shared",
".",
"featureEnabled",
"(",
"feature",
".",
"LegacyLeases",
... | // LeadershipPinner is part of the facade.Context interface.
// Pinning functionality is only available with the Raft leases implementation. | [
"LeadershipPinner",
"is",
"part",
"of",
"the",
"facade",
".",
"Context",
"interface",
".",
"Pinning",
"functionality",
"is",
"only",
"available",
"with",
"the",
"Raft",
"leases",
"implementation",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L493-L506 |
156,339 | juju/juju | apiserver/root.go | LeadershipReader | func (ctx *facadeContext) LeadershipReader(modelUUID string) (leadership.Reader, error) {
if ctx.r.shared.featureEnabled(feature.LegacyLeases) {
return legacyLeadershipReader{ctx.State()}, nil
}
reader, err := ctx.r.shared.leaseManager.Reader(
lease.ApplicationLeadershipNamespace,
modelUUID,
)
if err != nil ... | go | func (ctx *facadeContext) LeadershipReader(modelUUID string) (leadership.Reader, error) {
if ctx.r.shared.featureEnabled(feature.LegacyLeases) {
return legacyLeadershipReader{ctx.State()}, nil
}
reader, err := ctx.r.shared.leaseManager.Reader(
lease.ApplicationLeadershipNamespace,
modelUUID,
)
if err != nil ... | [
"func",
"(",
"ctx",
"*",
"facadeContext",
")",
"LeadershipReader",
"(",
"modelUUID",
"string",
")",
"(",
"leadership",
".",
"Reader",
",",
"error",
")",
"{",
"if",
"ctx",
".",
"r",
".",
"shared",
".",
"featureEnabled",
"(",
"feature",
".",
"LegacyLeases",
... | // LeadershipReader is part of the facade.Context interface.
// It returns a reader that can be used to return all application leaders
// in the model. | [
"LeadershipReader",
"is",
"part",
"of",
"the",
"facade",
".",
"Context",
"interface",
".",
"It",
"returns",
"a",
"reader",
"that",
"can",
"be",
"used",
"to",
"return",
"all",
"application",
"leaders",
"in",
"the",
"model",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L511-L523 |
156,340 | juju/juju | apiserver/root.go | SingularClaimer | func (ctx *facadeContext) SingularClaimer() (lease.Claimer, error) {
if ctx.r.shared.featureEnabled(feature.LegacyLeases) {
return ctx.State().SingularClaimer(), nil
}
return ctx.r.shared.leaseManager.Claimer(
lease.SingularControllerNamespace,
ctx.State().ModelUUID(),
)
} | go | func (ctx *facadeContext) SingularClaimer() (lease.Claimer, error) {
if ctx.r.shared.featureEnabled(feature.LegacyLeases) {
return ctx.State().SingularClaimer(), nil
}
return ctx.r.shared.leaseManager.Claimer(
lease.SingularControllerNamespace,
ctx.State().ModelUUID(),
)
} | [
"func",
"(",
"ctx",
"*",
"facadeContext",
")",
"SingularClaimer",
"(",
")",
"(",
"lease",
".",
"Claimer",
",",
"error",
")",
"{",
"if",
"ctx",
".",
"r",
".",
"shared",
".",
"featureEnabled",
"(",
"feature",
".",
"LegacyLeases",
")",
"{",
"return",
"ctx... | // SingularClaimer is part of the facade.Context interface. | [
"SingularClaimer",
"is",
"part",
"of",
"the",
"facade",
".",
"Context",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L526-L534 |
156,341 | juju/juju | apiserver/root.go | newAdminRoot | func newAdminRoot(h *apiHandler, adminAPIs map[int]interface{}) *adminRoot {
r := &adminRoot{
apiHandler: h,
adminAPIs: adminAPIs,
}
return r
} | go | func newAdminRoot(h *apiHandler, adminAPIs map[int]interface{}) *adminRoot {
r := &adminRoot{
apiHandler: h,
adminAPIs: adminAPIs,
}
return r
} | [
"func",
"newAdminRoot",
"(",
"h",
"*",
"apiHandler",
",",
"adminAPIs",
"map",
"[",
"int",
"]",
"interface",
"{",
"}",
")",
"*",
"adminRoot",
"{",
"r",
":=",
"&",
"adminRoot",
"{",
"apiHandler",
":",
"h",
",",
"adminAPIs",
":",
"adminAPIs",
",",
"}",
... | // newAdminRoot creates a new AnonRoot which dispatches to the given Admin API implementation. | [
"newAdminRoot",
"creates",
"a",
"new",
"AnonRoot",
"which",
"dispatches",
"to",
"the",
"given",
"Admin",
"API",
"implementation",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L544-L550 |
156,342 | juju/juju | apiserver/root.go | AuthMachineAgent | func (r *apiHandler) AuthMachineAgent() bool {
_, isMachine := r.GetAuthTag().(names.MachineTag)
return isMachine
} | go | func (r *apiHandler) AuthMachineAgent() bool {
_, isMachine := r.GetAuthTag().(names.MachineTag)
return isMachine
} | [
"func",
"(",
"r",
"*",
"apiHandler",
")",
"AuthMachineAgent",
"(",
")",
"bool",
"{",
"_",
",",
"isMachine",
":=",
"r",
".",
"GetAuthTag",
"(",
")",
".",
"(",
"names",
".",
"MachineTag",
")",
"\n",
"return",
"isMachine",
"\n",
"}"
] | // AuthMachineAgent returns whether the current client is a machine agent. | [
"AuthMachineAgent",
"returns",
"whether",
"the",
"current",
"client",
"is",
"a",
"machine",
"agent",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L569-L572 |
156,343 | juju/juju | apiserver/root.go | AuthApplicationAgent | func (r *apiHandler) AuthApplicationAgent() bool {
_, isApp := r.GetAuthTag().(names.ApplicationTag)
return isApp
} | go | func (r *apiHandler) AuthApplicationAgent() bool {
_, isApp := r.GetAuthTag().(names.ApplicationTag)
return isApp
} | [
"func",
"(",
"r",
"*",
"apiHandler",
")",
"AuthApplicationAgent",
"(",
")",
"bool",
"{",
"_",
",",
"isApp",
":=",
"r",
".",
"GetAuthTag",
"(",
")",
".",
"(",
"names",
".",
"ApplicationTag",
")",
"\n",
"return",
"isApp",
"\n",
"}"
] | // AuthApplicationAgent returns whether the current client is an application operator. | [
"AuthApplicationAgent",
"returns",
"whether",
"the",
"current",
"client",
"is",
"an",
"application",
"operator",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L575-L578 |
156,344 | juju/juju | apiserver/root.go | AuthUnitAgent | func (r *apiHandler) AuthUnitAgent() bool {
_, isUnit := r.GetAuthTag().(names.UnitTag)
return isUnit
} | go | func (r *apiHandler) AuthUnitAgent() bool {
_, isUnit := r.GetAuthTag().(names.UnitTag)
return isUnit
} | [
"func",
"(",
"r",
"*",
"apiHandler",
")",
"AuthUnitAgent",
"(",
")",
"bool",
"{",
"_",
",",
"isUnit",
":=",
"r",
".",
"GetAuthTag",
"(",
")",
".",
"(",
"names",
".",
"UnitTag",
")",
"\n",
"return",
"isUnit",
"\n",
"}"
] | // AuthUnitAgent returns whether the current client is a unit agent. | [
"AuthUnitAgent",
"returns",
"whether",
"the",
"current",
"client",
"is",
"a",
"unit",
"agent",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L581-L584 |
156,345 | juju/juju | apiserver/root.go | AuthOwner | func (r *apiHandler) AuthOwner(tag names.Tag) bool {
return r.entity.Tag() == tag
} | go | func (r *apiHandler) AuthOwner(tag names.Tag) bool {
return r.entity.Tag() == tag
} | [
"func",
"(",
"r",
"*",
"apiHandler",
")",
"AuthOwner",
"(",
"tag",
"names",
".",
"Tag",
")",
"bool",
"{",
"return",
"r",
".",
"entity",
".",
"Tag",
"(",
")",
"==",
"tag",
"\n",
"}"
] | // AuthOwner returns whether the authenticated user's tag matches the
// given entity tag. | [
"AuthOwner",
"returns",
"whether",
"the",
"authenticated",
"user",
"s",
"tag",
"matches",
"the",
"given",
"entity",
"tag",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L588-L590 |
156,346 | juju/juju | apiserver/root.go | AuthController | func (r *apiHandler) AuthController() bool {
type hasIsManager interface {
IsManager() bool
}
m, ok := r.entity.(hasIsManager)
return ok && m.IsManager()
} | go | func (r *apiHandler) AuthController() bool {
type hasIsManager interface {
IsManager() bool
}
m, ok := r.entity.(hasIsManager)
return ok && m.IsManager()
} | [
"func",
"(",
"r",
"*",
"apiHandler",
")",
"AuthController",
"(",
")",
"bool",
"{",
"type",
"hasIsManager",
"interface",
"{",
"IsManager",
"(",
")",
"bool",
"\n",
"}",
"\n",
"m",
",",
"ok",
":=",
"r",
".",
"entity",
".",
"(",
"hasIsManager",
")",
"\n"... | // AuthController returns whether the authenticated user is a
// machine with running the ManageEnviron job. | [
"AuthController",
"returns",
"whether",
"the",
"authenticated",
"user",
"is",
"a",
"machine",
"with",
"running",
"the",
"ManageEnviron",
"job",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L594-L600 |
156,347 | juju/juju | apiserver/root.go | AuthClient | func (r *apiHandler) AuthClient() bool {
_, isUser := r.GetAuthTag().(names.UserTag)
return isUser
} | go | func (r *apiHandler) AuthClient() bool {
_, isUser := r.GetAuthTag().(names.UserTag)
return isUser
} | [
"func",
"(",
"r",
"*",
"apiHandler",
")",
"AuthClient",
"(",
")",
"bool",
"{",
"_",
",",
"isUser",
":=",
"r",
".",
"GetAuthTag",
"(",
")",
".",
"(",
"names",
".",
"UserTag",
")",
"\n",
"return",
"isUser",
"\n",
"}"
] | // AuthClient returns whether the authenticated entity is a client
// user. | [
"AuthClient",
"returns",
"whether",
"the",
"authenticated",
"entity",
"is",
"a",
"client",
"user",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L604-L607 |
156,348 | juju/juju | apiserver/root.go | GetAuthTag | func (r *apiHandler) GetAuthTag() names.Tag {
if r.entity == nil {
return nil
}
return r.entity.Tag()
} | go | func (r *apiHandler) GetAuthTag() names.Tag {
if r.entity == nil {
return nil
}
return r.entity.Tag()
} | [
"func",
"(",
"r",
"*",
"apiHandler",
")",
"GetAuthTag",
"(",
")",
"names",
".",
"Tag",
"{",
"if",
"r",
".",
"entity",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"r",
".",
"entity",
".",
"Tag",
"(",
")",
"\n",
"}"
] | // GetAuthTag returns the tag of the authenticated entity, if any. | [
"GetAuthTag",
"returns",
"the",
"tag",
"of",
"the",
"authenticated",
"entity",
"if",
"any",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L610-L615 |
156,349 | juju/juju | apiserver/root.go | DescribeFacades | func DescribeFacades(registry *facade.Registry) []params.FacadeVersions {
facades := registry.List()
result := make([]params.FacadeVersions, len(facades))
for i, f := range facades {
result[i].Name = f.Name
result[i].Versions = f.Versions
}
return result
} | go | func DescribeFacades(registry *facade.Registry) []params.FacadeVersions {
facades := registry.List()
result := make([]params.FacadeVersions, len(facades))
for i, f := range facades {
result[i].Name = f.Name
result[i].Versions = f.Versions
}
return result
} | [
"func",
"DescribeFacades",
"(",
"registry",
"*",
"facade",
".",
"Registry",
")",
"[",
"]",
"params",
".",
"FacadeVersions",
"{",
"facades",
":=",
"registry",
".",
"List",
"(",
")",
"\n",
"result",
":=",
"make",
"(",
"[",
"]",
"params",
".",
"FacadeVersio... | // DescribeFacades returns the list of available Facades and their Versions | [
"DescribeFacades",
"returns",
"the",
"list",
"of",
"available",
"Facades",
"and",
"their",
"Versions"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/root.go#L636-L644 |
156,350 | juju/juju | cmd/juju/gui/gui.go | guiAddr | func guiAddr(conn api.Connection) string {
if dnsName := conn.PublicDNSName(); dnsName != "" {
return dnsName
}
return conn.Addr()
} | go | func guiAddr(conn api.Connection) string {
if dnsName := conn.PublicDNSName(); dnsName != "" {
return dnsName
}
return conn.Addr()
} | [
"func",
"guiAddr",
"(",
"conn",
"api",
".",
"Connection",
")",
"string",
"{",
"if",
"dnsName",
":=",
"conn",
".",
"PublicDNSName",
"(",
")",
";",
"dnsName",
"!=",
"\"",
"\"",
"{",
"return",
"dnsName",
"\n",
"}",
"\n",
"return",
"conn",
".",
"Addr",
"... | // guiAddr returns an address where the GUI is available. | [
"guiAddr",
"returns",
"an",
"address",
"where",
"the",
"GUI",
"is",
"available",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/gui/gui.go#L159-L164 |
156,351 | juju/juju | cmd/juju/gui/gui.go | checkAvailable | func (c *guiCommand) checkAvailable(rawURL, newRawURL string, conn api.Connection) (string, error) {
client, err := conn.HTTPClient()
if err != nil {
return "", errors.Annotate(err, "cannot retrieve HTTP client")
}
if err = clientGet(client, newRawURL); err == nil {
return newRawURL, nil
}
if err = clientGet(... | go | func (c *guiCommand) checkAvailable(rawURL, newRawURL string, conn api.Connection) (string, error) {
client, err := conn.HTTPClient()
if err != nil {
return "", errors.Annotate(err, "cannot retrieve HTTP client")
}
if err = clientGet(client, newRawURL); err == nil {
return newRawURL, nil
}
if err = clientGet(... | [
"func",
"(",
"c",
"*",
"guiCommand",
")",
"checkAvailable",
"(",
"rawURL",
",",
"newRawURL",
"string",
",",
"conn",
"api",
".",
"Connection",
")",
"(",
"string",
",",
"error",
")",
"{",
"client",
",",
"err",
":=",
"conn",
".",
"HTTPClient",
"(",
")",
... | // checkAvailable ensures the Juju GUI is available on the controller at
// one of the given URLs, returning the successful URL. | [
"checkAvailable",
"ensures",
"the",
"Juju",
"GUI",
"is",
"available",
"on",
"the",
"controller",
"at",
"one",
"of",
"the",
"given",
"URLs",
"returning",
"the",
"successful",
"URL",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/gui/gui.go#L168-L180 |
156,352 | juju/juju | cmd/juju/gui/gui.go | openBrowser | func (c *guiCommand) openBrowser(ctx *cmd.Context, rawURL string, vers *version.Number) error {
u, err := url.Parse(rawURL)
if err != nil {
return errors.Annotate(err, "cannot parse Juju GUI URL")
}
if c.noBrowser && !c.browser {
versInfo := ""
if vers != nil {
versInfo = fmt.Sprintf("%v ", vers)
}
mod... | go | func (c *guiCommand) openBrowser(ctx *cmd.Context, rawURL string, vers *version.Number) error {
u, err := url.Parse(rawURL)
if err != nil {
return errors.Annotate(err, "cannot parse Juju GUI URL")
}
if c.noBrowser && !c.browser {
versInfo := ""
if vers != nil {
versInfo = fmt.Sprintf("%v ", vers)
}
mod... | [
"func",
"(",
"c",
"*",
"guiCommand",
")",
"openBrowser",
"(",
"ctx",
"*",
"cmd",
".",
"Context",
",",
"rawURL",
"string",
",",
"vers",
"*",
"version",
".",
"Number",
")",
"error",
"{",
"u",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"rawURL",
")",... | // openBrowser opens the Juju GUI at the given URL. | [
"openBrowser",
"opens",
"the",
"Juju",
"GUI",
"at",
"the",
"given",
"URL",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/gui/gui.go#L183-L211 |
156,353 | juju/juju | cmd/juju/gui/gui.go | showCredentials | func (c *guiCommand) showCredentials(ctx *cmd.Context) error {
if c.hideCreds || !c.showCreds {
return nil
}
// TODO(wallyworld) - what to do if we are using a macaroon.
accountDetails, err := c.CurrentAccountDetails()
if err != nil {
return errors.Annotate(err, "cannot retrieve credentials")
}
password := a... | go | func (c *guiCommand) showCredentials(ctx *cmd.Context) error {
if c.hideCreds || !c.showCreds {
return nil
}
// TODO(wallyworld) - what to do if we are using a macaroon.
accountDetails, err := c.CurrentAccountDetails()
if err != nil {
return errors.Annotate(err, "cannot retrieve credentials")
}
password := a... | [
"func",
"(",
"c",
"*",
"guiCommand",
")",
"showCredentials",
"(",
"ctx",
"*",
"cmd",
".",
"Context",
")",
"error",
"{",
"if",
"c",
".",
"hideCreds",
"||",
"!",
"c",
".",
"showCreds",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"// TODO(wallyworld) - what to d... | // showCredentials shows the admin username and password. | [
"showCredentials",
"shows",
"the",
"admin",
"username",
"and",
"password",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/gui/gui.go#L214-L230 |
156,354 | juju/juju | apiserver/common/storagecommon/storage.go | volumeAttachmentDevicePath | func volumeAttachmentDevicePath(
volumeInfo state.VolumeInfo,
volumeAttachmentInfo state.VolumeAttachmentInfo,
blockDevice state.BlockDeviceInfo,
) (string, error) {
if volumeInfo.HardwareId != "" ||
volumeInfo.WWN != "" ||
volumeAttachmentInfo.DeviceName != "" ||
volumeAttachmentInfo.DeviceLink != "" {
// ... | go | func volumeAttachmentDevicePath(
volumeInfo state.VolumeInfo,
volumeAttachmentInfo state.VolumeAttachmentInfo,
blockDevice state.BlockDeviceInfo,
) (string, error) {
if volumeInfo.HardwareId != "" ||
volumeInfo.WWN != "" ||
volumeAttachmentInfo.DeviceName != "" ||
volumeAttachmentInfo.DeviceLink != "" {
// ... | [
"func",
"volumeAttachmentDevicePath",
"(",
"volumeInfo",
"state",
".",
"VolumeInfo",
",",
"volumeAttachmentInfo",
"state",
".",
"VolumeAttachmentInfo",
",",
"blockDevice",
"state",
".",
"BlockDeviceInfo",
",",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"vol... | // volumeAttachmentDevicePath returns the absolute device path for
// a volume attachment. The value is only meaningful in the context
// of the machine that the volume is attached to. | [
"volumeAttachmentDevicePath",
"returns",
"the",
"absolute",
"device",
"path",
"for",
"a",
"volume",
"attachment",
".",
"The",
"value",
"is",
"only",
"meaningful",
"in",
"the",
"context",
"of",
"the",
"machine",
"that",
"the",
"volume",
"is",
"attached",
"to",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/storagecommon/storage.go#L210-L241 |
156,355 | juju/juju | apiserver/common/storagecommon/storage.go | StorageTags | func StorageTags(
storageInstance state.StorageInstance,
modelUUID, controllerUUID string,
tagger tags.ResourceTagger,
) (map[string]string, error) {
storageTags := tags.ResourceTags(
names.NewModelTag(modelUUID),
names.NewControllerTag(controllerUUID),
tagger,
)
if storageInstance != nil {
storageTags[ta... | go | func StorageTags(
storageInstance state.StorageInstance,
modelUUID, controllerUUID string,
tagger tags.ResourceTagger,
) (map[string]string, error) {
storageTags := tags.ResourceTags(
names.NewModelTag(modelUUID),
names.NewControllerTag(controllerUUID),
tagger,
)
if storageInstance != nil {
storageTags[ta... | [
"func",
"StorageTags",
"(",
"storageInstance",
"state",
".",
"StorageInstance",
",",
"modelUUID",
",",
"controllerUUID",
"string",
",",
"tagger",
"tags",
".",
"ResourceTagger",
",",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"stor... | // StorageTags returns the tags that should be set on a volume or filesystem,
// if the provider supports them. | [
"StorageTags",
"returns",
"the",
"tags",
"that",
"should",
"be",
"set",
"on",
"a",
"volume",
"or",
"filesystem",
"if",
"the",
"provider",
"supports",
"them",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/storagecommon/storage.go#L266-L283 |
156,356 | juju/juju | apiserver/common/storagecommon/storage.go | ClassifyDetachedStorage | func ClassifyDetachedStorage(
stVolume VolumeAccess,
stFile FilesystemAccess,
storage []state.StorageInstance,
) (destroyed, detached []params.Entity, _ error) {
for _, storage := range storage {
var detachable bool
switch storage.Kind() {
case state.StorageKindFilesystem:
if stFile == nil {
return nil... | go | func ClassifyDetachedStorage(
stVolume VolumeAccess,
stFile FilesystemAccess,
storage []state.StorageInstance,
) (destroyed, detached []params.Entity, _ error) {
for _, storage := range storage {
var detachable bool
switch storage.Kind() {
case state.StorageKindFilesystem:
if stFile == nil {
return nil... | [
"func",
"ClassifyDetachedStorage",
"(",
"stVolume",
"VolumeAccess",
",",
"stFile",
"FilesystemAccess",
",",
"storage",
"[",
"]",
"state",
".",
"StorageInstance",
",",
")",
"(",
"destroyed",
",",
"detached",
"[",
"]",
"params",
".",
"Entity",
",",
"_",
"error",... | // ClassifyDetachedStorage classifies storage instances into those that will
// be destroyed, and those that will be detached, when their attachment is
// removed. Any storage that is not found will be omitted. | [
"ClassifyDetachedStorage",
"classifies",
"storage",
"instances",
"into",
"those",
"that",
"will",
"be",
"destroyed",
"and",
"those",
"that",
"will",
"be",
"detached",
"when",
"their",
"attachment",
"is",
"removed",
".",
"Any",
"storage",
"that",
"is",
"not",
"fo... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/storagecommon/storage.go#L310-L351 |
156,357 | juju/juju | cmd/juju/controller/listcontrollers.go | NewListControllersCommand | func NewListControllersCommand() cmd.Command {
cmd := &listControllersCommand{
store: jujuclient.NewFileClientStore(),
}
return modelcmd.WrapBase(cmd)
} | go | func NewListControllersCommand() cmd.Command {
cmd := &listControllersCommand{
store: jujuclient.NewFileClientStore(),
}
return modelcmd.WrapBase(cmd)
} | [
"func",
"NewListControllersCommand",
"(",
")",
"cmd",
".",
"Command",
"{",
"cmd",
":=",
"&",
"listControllersCommand",
"{",
"store",
":",
"jujuclient",
".",
"NewFileClientStore",
"(",
")",
",",
"}",
"\n",
"return",
"modelcmd",
".",
"WrapBase",
"(",
"cmd",
")... | // NewListControllersCommand returns a command to list registered controllers. | [
"NewListControllersCommand",
"returns",
"a",
"command",
"to",
"list",
"registered",
"controllers",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/controller/listcontrollers.go#L41-L46 |
156,358 | juju/juju | watcher/legacy/stringsworker.go | NewStringsWorker | func NewStringsWorker(handler StringsWatchHandler) worker.Worker {
sw := &stringsWorker{
handler: handler,
}
sw.tomb.Go(sw.loop)
return sw
} | go | func NewStringsWorker(handler StringsWatchHandler) worker.Worker {
sw := &stringsWorker{
handler: handler,
}
sw.tomb.Go(sw.loop)
return sw
} | [
"func",
"NewStringsWorker",
"(",
"handler",
"StringsWatchHandler",
")",
"worker",
".",
"Worker",
"{",
"sw",
":=",
"&",
"stringsWorker",
"{",
"handler",
":",
"handler",
",",
"}",
"\n",
"sw",
".",
"tomb",
".",
"Go",
"(",
"sw",
".",
"loop",
")",
"\n",
"re... | // NewStringsWorker starts a new worker running the business logic
// from the handler. The worker loop is started in another goroutine
// as a side effect of calling this. | [
"NewStringsWorker",
"starts",
"a",
"new",
"worker",
"running",
"the",
"business",
"logic",
"from",
"the",
"handler",
".",
"The",
"worker",
"loop",
"is",
"started",
"in",
"another",
"goroutine",
"as",
"a",
"side",
"effect",
"of",
"calling",
"this",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/watcher/legacy/stringsworker.go#L41-L47 |
156,359 | juju/juju | provider/cloudsigma/instance.go | Id | func (i sigmaInstance) Id() instance.Id {
id := instance.Id(i.server.UUID())
logger.Tracef("sigmaInstance.Id: %s", id)
return id
} | go | func (i sigmaInstance) Id() instance.Id {
id := instance.Id(i.server.UUID())
logger.Tracef("sigmaInstance.Id: %s", id)
return id
} | [
"func",
"(",
"i",
"sigmaInstance",
")",
"Id",
"(",
")",
"instance",
".",
"Id",
"{",
"id",
":=",
"instance",
".",
"Id",
"(",
"i",
".",
"server",
".",
"UUID",
"(",
")",
")",
"\n",
"logger",
".",
"Tracef",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
... | // Id returns a provider-generated identifier for the Instance. | [
"Id",
"returns",
"a",
"provider",
"-",
"generated",
"identifier",
"for",
"the",
"Instance",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/cloudsigma/instance.go#L26-L30 |
156,360 | juju/juju | provider/cloudsigma/instance.go | Status | func (i sigmaInstance) Status(ctx context.ProviderCallContext) instance.Status {
entityStatus := i.server.Status()
logger.Tracef("sigmaInstance.Status: %s", entityStatus)
jujuStatus := status.Pending
switch entityStatus {
case gosigma.ServerStarting:
jujuStatus = status.Allocating
case gosigma.ServerRunning:
... | go | func (i sigmaInstance) Status(ctx context.ProviderCallContext) instance.Status {
entityStatus := i.server.Status()
logger.Tracef("sigmaInstance.Status: %s", entityStatus)
jujuStatus := status.Pending
switch entityStatus {
case gosigma.ServerStarting:
jujuStatus = status.Allocating
case gosigma.ServerRunning:
... | [
"func",
"(",
"i",
"sigmaInstance",
")",
"Status",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
")",
"instance",
".",
"Status",
"{",
"entityStatus",
":=",
"i",
".",
"server",
".",
"Status",
"(",
")",
"\n",
"logger",
".",
"Tracef",
"(",
"\"",
"\"",
... | // Status returns the provider-specific status for the instance. | [
"Status",
"returns",
"the",
"provider",
"-",
"specific",
"status",
"for",
"the",
"instance",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/cloudsigma/instance.go#L33-L56 |
156,361 | juju/juju | provider/cloudsigma/instance.go | Addresses | func (i sigmaInstance) Addresses(ctx context.ProviderCallContext) ([]network.Address, error) {
ip := i.findIPv4()
if ip != "" {
addr := network.Address{
Value: ip,
Type: network.IPv4Address,
Scope: network.ScopePublic,
}
logger.Tracef("sigmaInstance.Addresses: %v", addr)
return []network.Address{... | go | func (i sigmaInstance) Addresses(ctx context.ProviderCallContext) ([]network.Address, error) {
ip := i.findIPv4()
if ip != "" {
addr := network.Address{
Value: ip,
Type: network.IPv4Address,
Scope: network.ScopePublic,
}
logger.Tracef("sigmaInstance.Addresses: %v", addr)
return []network.Address{... | [
"func",
"(",
"i",
"sigmaInstance",
")",
"Addresses",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
")",
"(",
"[",
"]",
"network",
".",
"Address",
",",
"error",
")",
"{",
"ip",
":=",
"i",
".",
"findIPv4",
"(",
")",
"\n\n",
"if",
"ip",
"!=",
"\"",... | // Addresses returns a list of hostnames or ip addresses
// associated with the instance. This will supercede DNSName
// which can be implemented by selecting a preferred address. | [
"Addresses",
"returns",
"a",
"list",
"of",
"hostnames",
"or",
"ip",
"addresses",
"associated",
"with",
"the",
"instance",
".",
"This",
"will",
"supercede",
"DNSName",
"which",
"can",
"be",
"implemented",
"by",
"selecting",
"a",
"preferred",
"address",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/cloudsigma/instance.go#L61-L76 |
156,362 | juju/juju | provider/cloudsigma/instance.go | OpenPorts | func (i sigmaInstance) OpenPorts(ctx context.ProviderCallContext, machineID string, ports []network.IngressRule) error {
return errors.NotImplementedf("OpenPorts")
} | go | func (i sigmaInstance) OpenPorts(ctx context.ProviderCallContext, machineID string, ports []network.IngressRule) error {
return errors.NotImplementedf("OpenPorts")
} | [
"func",
"(",
"i",
"sigmaInstance",
")",
"OpenPorts",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"machineID",
"string",
",",
"ports",
"[",
"]",
"network",
".",
"IngressRule",
")",
"error",
"{",
"return",
"errors",
".",
"NotImplementedf",
"(",
"\"... | // OpenPorts opens the given ports on the instance, which
// should have been started with the given machine id. | [
"OpenPorts",
"opens",
"the",
"given",
"ports",
"on",
"the",
"instance",
"which",
"should",
"have",
"been",
"started",
"with",
"the",
"given",
"machine",
"id",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/cloudsigma/instance.go#L80-L82 |
156,363 | juju/juju | provider/cloudsigma/instance.go | IngressRules | func (i sigmaInstance) IngressRules(ctx context.ProviderCallContext, machineID string) ([]network.IngressRule, error) {
return nil, errors.NotImplementedf("InstanceRules")
} | go | func (i sigmaInstance) IngressRules(ctx context.ProviderCallContext, machineID string) ([]network.IngressRule, error) {
return nil, errors.NotImplementedf("InstanceRules")
} | [
"func",
"(",
"i",
"sigmaInstance",
")",
"IngressRules",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"machineID",
"string",
")",
"(",
"[",
"]",
"network",
".",
"IngressRule",
",",
"error",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"NotImple... | // IngressRules returns the set of ports open on the instance, which
// should have been started with the given machine id.
// The rules are returned as sorted by SortInstanceRules. | [
"IngressRules",
"returns",
"the",
"set",
"of",
"ports",
"open",
"on",
"the",
"instance",
"which",
"should",
"have",
"been",
"started",
"with",
"the",
"given",
"machine",
"id",
".",
"The",
"rules",
"are",
"returned",
"as",
"sorted",
"by",
"SortInstanceRules",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/cloudsigma/instance.go#L93-L95 |
156,364 | juju/juju | state/linklayerdevices_ipaddresses.go | IsValidAddressConfigMethod | func IsValidAddressConfigMethod(value string) bool {
switch AddressConfigMethod(value) {
case LoopbackAddress, StaticAddress, DynamicAddress, ManualAddress:
return true
}
return false
} | go | func IsValidAddressConfigMethod(value string) bool {
switch AddressConfigMethod(value) {
case LoopbackAddress, StaticAddress, DynamicAddress, ManualAddress:
return true
}
return false
} | [
"func",
"IsValidAddressConfigMethod",
"(",
"value",
"string",
")",
"bool",
"{",
"switch",
"AddressConfigMethod",
"(",
"value",
")",
"{",
"case",
"LoopbackAddress",
",",
"StaticAddress",
",",
"DynamicAddress",
",",
"ManualAddress",
":",
"return",
"true",
"\n",
"}",... | // IsValidAddressConfigMethod returns whether the given value is a valid method
// to configure a link-layer network device's IP address. | [
"IsValidAddressConfigMethod",
"returns",
"whether",
"the",
"given",
"value",
"is",
"a",
"valid",
"method",
"to",
"configure",
"a",
"link",
"-",
"layer",
"network",
"device",
"s",
"IP",
"address",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices_ipaddresses.go#L84-L90 |
156,365 | juju/juju | state/linklayerdevices_ipaddresses.go | DocID | func (addr *Address) DocID() string {
return addr.st.docID(addr.doc.DocID)
} | go | func (addr *Address) DocID() string {
return addr.st.docID(addr.doc.DocID)
} | [
"func",
"(",
"addr",
"*",
"Address",
")",
"DocID",
"(",
")",
"string",
"{",
"return",
"addr",
".",
"st",
".",
"docID",
"(",
"addr",
".",
"doc",
".",
"DocID",
")",
"\n",
"}"
] | // DocID returns the globally unique ID of the IP address, including the model
// UUID as prefix. | [
"DocID",
"returns",
"the",
"globally",
"unique",
"ID",
"of",
"the",
"IP",
"address",
"including",
"the",
"model",
"UUID",
"as",
"prefix",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices_ipaddresses.go#L110-L112 |
156,366 | juju/juju | state/linklayerdevices_ipaddresses.go | ProviderID | func (addr *Address) ProviderID() network.Id {
return network.Id(addr.doc.ProviderID)
} | go | func (addr *Address) ProviderID() network.Id {
return network.Id(addr.doc.ProviderID)
} | [
"func",
"(",
"addr",
"*",
"Address",
")",
"ProviderID",
"(",
")",
"network",
".",
"Id",
"{",
"return",
"network",
".",
"Id",
"(",
"addr",
".",
"doc",
".",
"ProviderID",
")",
"\n",
"}"
] | // ProviderID returns the provider-specific IP address ID, if set. | [
"ProviderID",
"returns",
"the",
"provider",
"-",
"specific",
"IP",
"address",
"ID",
"if",
"set",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices_ipaddresses.go#L115-L117 |
156,367 | juju/juju | state/linklayerdevices_ipaddresses.go | Machine | func (addr *Address) Machine() (*Machine, error) {
return addr.st.Machine(addr.doc.MachineID)
} | go | func (addr *Address) Machine() (*Machine, error) {
return addr.st.Machine(addr.doc.MachineID)
} | [
"func",
"(",
"addr",
"*",
"Address",
")",
"Machine",
"(",
")",
"(",
"*",
"Machine",
",",
"error",
")",
"{",
"return",
"addr",
".",
"st",
".",
"Machine",
"(",
"addr",
".",
"doc",
".",
"MachineID",
")",
"\n",
"}"
] | // Machine returns the Machine this IP address belongs to. | [
"Machine",
"returns",
"the",
"Machine",
"this",
"IP",
"address",
"belongs",
"to",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices_ipaddresses.go#L125-L127 |
156,368 | juju/juju | state/linklayerdevices_ipaddresses.go | Device | func (addr *Address) Device() (*LinkLayerDevice, error) {
return addr.machineProxy().LinkLayerDevice(addr.doc.DeviceName)
} | go | func (addr *Address) Device() (*LinkLayerDevice, error) {
return addr.machineProxy().LinkLayerDevice(addr.doc.DeviceName)
} | [
"func",
"(",
"addr",
"*",
"Address",
")",
"Device",
"(",
")",
"(",
"*",
"LinkLayerDevice",
",",
"error",
")",
"{",
"return",
"addr",
".",
"machineProxy",
"(",
")",
".",
"LinkLayerDevice",
"(",
"addr",
".",
"doc",
".",
"DeviceName",
")",
"\n",
"}"
] | // Device returns the LinkLayeyDevice this IP address is assigned to. | [
"Device",
"returns",
"the",
"LinkLayeyDevice",
"this",
"IP",
"address",
"is",
"assigned",
"to",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices_ipaddresses.go#L142-L144 |
156,369 | juju/juju | state/linklayerdevices_ipaddresses.go | String | func (addr *Address) String() string {
return fmt.Sprintf(
"%s address %q of device %q on machine %q",
addr.doc.ConfigMethod, addr.doc.Value,
addr.doc.DeviceName, addr.doc.MachineID,
)
} | go | func (addr *Address) String() string {
return fmt.Sprintf(
"%s address %q of device %q on machine %q",
addr.doc.ConfigMethod, addr.doc.Value,
addr.doc.DeviceName, addr.doc.MachineID,
)
} | [
"func",
"(",
"addr",
"*",
"Address",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"addr",
".",
"doc",
".",
"ConfigMethod",
",",
"addr",
".",
"doc",
".",
"Value",
",",
"addr",
".",
"doc",
".",
"Dev... | // String returns a human-readable representation of the IP address. | [
"String",
"returns",
"a",
"human",
"-",
"readable",
"representation",
"of",
"the",
"IP",
"address",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices_ipaddresses.go#L196-L202 |
156,370 | juju/juju | state/linklayerdevices_ipaddresses.go | Remove | func (addr *Address) Remove() (err error) {
defer errors.DeferredAnnotatef(&err, "cannot remove %s", addr)
removeOp := removeIPAddressDocOp(addr.doc.DocID)
ops := []txn.Op{removeOp}
if addr.ProviderID() != "" {
op := addr.st.networkEntityGlobalKeyRemoveOp("address", addr.ProviderID())
ops = append(ops, op)
}
... | go | func (addr *Address) Remove() (err error) {
defer errors.DeferredAnnotatef(&err, "cannot remove %s", addr)
removeOp := removeIPAddressDocOp(addr.doc.DocID)
ops := []txn.Op{removeOp}
if addr.ProviderID() != "" {
op := addr.st.networkEntityGlobalKeyRemoveOp("address", addr.ProviderID())
ops = append(ops, op)
}
... | [
"func",
"(",
"addr",
"*",
"Address",
")",
"Remove",
"(",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"errors",
".",
"DeferredAnnotatef",
"(",
"&",
"err",
",",
"\"",
"\"",
",",
"addr",
")",
"\n\n",
"removeOp",
":=",
"removeIPAddressDocOp",
"(",
"addr",... | // Remove removes the IP address, if it exists. No error is returned when the
// address was already removed. | [
"Remove",
"removes",
"the",
"IP",
"address",
"if",
"it",
"exists",
".",
"No",
"error",
"is",
"returned",
"when",
"the",
"address",
"was",
"already",
"removed",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices_ipaddresses.go#L218-L228 |
156,371 | juju/juju | state/linklayerdevices_ipaddresses.go | removeIPAddressDocOp | func removeIPAddressDocOp(ipAddressDocID string) txn.Op {
return txn.Op{
C: ipAddressesC,
Id: ipAddressDocID,
Remove: true,
}
} | go | func removeIPAddressDocOp(ipAddressDocID string) txn.Op {
return txn.Op{
C: ipAddressesC,
Id: ipAddressDocID,
Remove: true,
}
} | [
"func",
"removeIPAddressDocOp",
"(",
"ipAddressDocID",
"string",
")",
"txn",
".",
"Op",
"{",
"return",
"txn",
".",
"Op",
"{",
"C",
":",
"ipAddressesC",
",",
"Id",
":",
"ipAddressDocID",
",",
"Remove",
":",
"true",
",",
"}",
"\n",
"}"
] | // removeIPAddressDocOpOp returns an operation to remove the ipAddressDoc
// matching the given ipAddressDocID, without asserting it still exists. | [
"removeIPAddressDocOpOp",
"returns",
"an",
"operation",
"to",
"remove",
"the",
"ipAddressDoc",
"matching",
"the",
"given",
"ipAddressDocID",
"without",
"asserting",
"it",
"still",
"exists",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices_ipaddresses.go#L232-L238 |
156,372 | juju/juju | state/linklayerdevices_ipaddresses.go | insertIPAddressDocOp | func insertIPAddressDocOp(newDoc *ipAddressDoc) txn.Op {
return txn.Op{
C: ipAddressesC,
Id: newDoc.DocID,
Assert: txn.DocMissing,
Insert: *newDoc,
}
} | go | func insertIPAddressDocOp(newDoc *ipAddressDoc) txn.Op {
return txn.Op{
C: ipAddressesC,
Id: newDoc.DocID,
Assert: txn.DocMissing,
Insert: *newDoc,
}
} | [
"func",
"insertIPAddressDocOp",
"(",
"newDoc",
"*",
"ipAddressDoc",
")",
"txn",
".",
"Op",
"{",
"return",
"txn",
".",
"Op",
"{",
"C",
":",
"ipAddressesC",
",",
"Id",
":",
"newDoc",
".",
"DocID",
",",
"Assert",
":",
"txn",
".",
"DocMissing",
",",
"Inser... | // insertIPAddressDocOp returns an operation inserting the given newDoc,
// asserting it does not exist yet. | [
"insertIPAddressDocOp",
"returns",
"an",
"operation",
"inserting",
"the",
"given",
"newDoc",
"asserting",
"it",
"does",
"not",
"exist",
"yet",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices_ipaddresses.go#L242-L249 |
156,373 | juju/juju | state/linklayerdevices_ipaddresses.go | updateIPAddressDocOp | func updateIPAddressDocOp(existingDoc, newDoc *ipAddressDoc) (txn.Op, bool) {
changes := make(bson.M)
deletes := make(bson.M)
if existingDoc.ProviderID == "" && newDoc.ProviderID != "" {
// Only allow changing the ProviderID if it was empty.
changes["providerid"] = newDoc.ProviderID
}
if existingDoc.ConfigMeth... | go | func updateIPAddressDocOp(existingDoc, newDoc *ipAddressDoc) (txn.Op, bool) {
changes := make(bson.M)
deletes := make(bson.M)
if existingDoc.ProviderID == "" && newDoc.ProviderID != "" {
// Only allow changing the ProviderID if it was empty.
changes["providerid"] = newDoc.ProviderID
}
if existingDoc.ConfigMeth... | [
"func",
"updateIPAddressDocOp",
"(",
"existingDoc",
",",
"newDoc",
"*",
"ipAddressDoc",
")",
"(",
"txn",
".",
"Op",
",",
"bool",
")",
"{",
"changes",
":=",
"make",
"(",
"bson",
".",
"M",
")",
"\n",
"deletes",
":=",
"make",
"(",
"bson",
".",
"M",
")",... | // updateIPAddressDocOp returns an operation updating the fields of existingDoc
// with the respective values of those fields in newDoc. DocID, ModelUUID,
// Value, MachineID, and DeviceName cannot be changed. ProviderID cannot be
// changed once set. DNSServers and DNSSearchDomains are deleted when nil. In
// all othe... | [
"updateIPAddressDocOp",
"returns",
"an",
"operation",
"updating",
"the",
"fields",
"of",
"existingDoc",
"with",
"the",
"respective",
"values",
"of",
"those",
"fields",
"in",
"newDoc",
".",
"DocID",
"ModelUUID",
"Value",
"MachineID",
"and",
"DeviceName",
"cannot",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices_ipaddresses.go#L268-L316 |
156,374 | juju/juju | state/linklayerdevices_ipaddresses.go | AllIPAddresses | func (st *State) AllIPAddresses() (addresses []*Address, err error) {
addressesCollection, closer := st.db().GetCollection(ipAddressesC)
defer closer()
sdocs := []ipAddressDoc{}
err = addressesCollection.Find(bson.D{}).All(&sdocs)
if err != nil {
return nil, errors.Errorf("cannot get all ip addresses")
}
for ... | go | func (st *State) AllIPAddresses() (addresses []*Address, err error) {
addressesCollection, closer := st.db().GetCollection(ipAddressesC)
defer closer()
sdocs := []ipAddressDoc{}
err = addressesCollection.Find(bson.D{}).All(&sdocs)
if err != nil {
return nil, errors.Errorf("cannot get all ip addresses")
}
for ... | [
"func",
"(",
"st",
"*",
"State",
")",
"AllIPAddresses",
"(",
")",
"(",
"addresses",
"[",
"]",
"*",
"Address",
",",
"err",
"error",
")",
"{",
"addressesCollection",
",",
"closer",
":=",
"st",
".",
"db",
"(",
")",
".",
"GetCollection",
"(",
"ipAddressesC... | // AllIPAddresses returns all ip addresses in the model. | [
"AllIPAddresses",
"returns",
"all",
"ip",
"addresses",
"in",
"the",
"model",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/linklayerdevices_ipaddresses.go#L364-L377 |
156,375 | juju/juju | cmd/juju/commands/ssh_common.go | defaultReachableChecker | func defaultReachableChecker() jujussh.ReachableChecker {
return jujussh.NewReachableChecker(&net.Dialer{Timeout: SSHRetryDelay}, SSHTimeout)
} | go | func defaultReachableChecker() jujussh.ReachableChecker {
return jujussh.NewReachableChecker(&net.Dialer{Timeout: SSHRetryDelay}, SSHTimeout)
} | [
"func",
"defaultReachableChecker",
"(",
")",
"jujussh",
".",
"ReachableChecker",
"{",
"return",
"jujussh",
".",
"NewReachableChecker",
"(",
"&",
"net",
".",
"Dialer",
"{",
"Timeout",
":",
"SSHRetryDelay",
"}",
",",
"SSHTimeout",
")",
"\n",
"}"
] | // defaultReachableChecker returns a jujussh.ReachableChecker with a connection
// timeout of SSHRetryDelay and an overall timout of SSHTimeout | [
"defaultReachableChecker",
"returns",
"a",
"jujussh",
".",
"ReachableChecker",
"with",
"a",
"connection",
"timeout",
"of",
"SSHRetryDelay",
"and",
"an",
"overall",
"timout",
"of",
"SSHTimeout"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/ssh_common.go#L120-L122 |
156,376 | juju/juju | cmd/juju/commands/ssh_common.go | initRun | func (c *SSHCommon) initRun() error {
if err := c.ensureAPIClient(); err != nil {
return errors.Trace(err)
}
if proxy, err := c.proxySSH(); err != nil {
return errors.Trace(err)
} else {
c.proxy = proxy
}
// Used mostly for testing, but useful for debugging and/or
// backwards-compatibility with some scr... | go | func (c *SSHCommon) initRun() error {
if err := c.ensureAPIClient(); err != nil {
return errors.Trace(err)
}
if proxy, err := c.proxySSH(); err != nil {
return errors.Trace(err)
} else {
c.proxy = proxy
}
// Used mostly for testing, but useful for debugging and/or
// backwards-compatibility with some scr... | [
"func",
"(",
"c",
"*",
"SSHCommon",
")",
"initRun",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"c",
".",
"ensureAPIClient",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Trace",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"proxy... | // initRun initializes the API connection if required, and determines
// if SSH proxying is required. It must be called at the top of the
// command's Run method.
//
// The apiClient, apiAddr and proxy fields are initialized after this call. | [
"initRun",
"initializes",
"the",
"API",
"connection",
"if",
"required",
"and",
"determines",
"if",
"SSH",
"proxying",
"is",
"required",
".",
"It",
"must",
"be",
"called",
"at",
"the",
"top",
"of",
"the",
"command",
"s",
"Run",
"method",
".",
"The",
"apiCli... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/ssh_common.go#L136-L151 |
156,377 | juju/juju | cmd/juju/commands/ssh_common.go | getSSHOptions | func (c *SSHCommon) getSSHOptions(enablePty bool, targets ...*resolvedTarget) (*ssh.Options, error) {
var options ssh.Options
if c.noHostKeyChecks {
options.SetStrictHostKeyChecking(ssh.StrictHostChecksNo)
options.SetKnownHostsFile(os.DevNull)
} else {
knownHostsPath, err := c.generateKnownHosts(targets)
if... | go | func (c *SSHCommon) getSSHOptions(enablePty bool, targets ...*resolvedTarget) (*ssh.Options, error) {
var options ssh.Options
if c.noHostKeyChecks {
options.SetStrictHostKeyChecking(ssh.StrictHostChecksNo)
options.SetKnownHostsFile(os.DevNull)
} else {
knownHostsPath, err := c.generateKnownHosts(targets)
if... | [
"func",
"(",
"c",
"*",
"SSHCommon",
")",
"getSSHOptions",
"(",
"enablePty",
"bool",
",",
"targets",
"...",
"*",
"resolvedTarget",
")",
"(",
"*",
"ssh",
".",
"Options",
",",
"error",
")",
"{",
"var",
"options",
"ssh",
".",
"Options",
"\n\n",
"if",
"c",
... | // getSSHOptions configures SSH options based on command line
// arguments and the SSH targets specified. | [
"getSSHOptions",
"configures",
"SSH",
"options",
"based",
"on",
"command",
"line",
"arguments",
"and",
"the",
"SSH",
"targets",
"specified",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/ssh_common.go#L169-L205 |
156,378 | juju/juju | cmd/juju/commands/ssh_common.go | generateKnownHosts | func (c *SSHCommon) generateKnownHosts(targets []*resolvedTarget) (string, error) {
knownHosts := newKnownHostsBuilder()
agentCount := 0
nonAgentCount := 0
for _, target := range targets {
if target.isAgent() {
agentCount++
keys, err := c.apiClient.PublicKeys(target.entity)
if err != nil {
return "",... | go | func (c *SSHCommon) generateKnownHosts(targets []*resolvedTarget) (string, error) {
knownHosts := newKnownHostsBuilder()
agentCount := 0
nonAgentCount := 0
for _, target := range targets {
if target.isAgent() {
agentCount++
keys, err := c.apiClient.PublicKeys(target.entity)
if err != nil {
return "",... | [
"func",
"(",
"c",
"*",
"SSHCommon",
")",
"generateKnownHosts",
"(",
"targets",
"[",
"]",
"*",
"resolvedTarget",
")",
"(",
"string",
",",
"error",
")",
"{",
"knownHosts",
":=",
"newKnownHostsBuilder",
"(",
")",
"\n",
"agentCount",
":=",
"0",
"\n",
"nonAgent... | // generateKnownHosts takes the provided targets, retrieves the SSH
// public host keys for them and generates a temporary known_hosts
// file for them. | [
"generateKnownHosts",
"takes",
"the",
"provided",
"targets",
"retrieves",
"the",
"SSH",
"public",
"host",
"keys",
"for",
"them",
"and",
"generates",
"a",
"temporary",
"known_hosts",
"file",
"for",
"them",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/ssh_common.go#L210-L246 |
156,379 | juju/juju | cmd/juju/commands/ssh_common.go | setProxyCommand | func (c *SSHCommon) setProxyCommand(options *ssh.Options) error {
apiServerHost, _, err := net.SplitHostPort(c.apiAddr)
if err != nil {
return errors.Errorf("failed to get proxy address: %v", err)
}
juju, err := getJujuExecutable()
if err != nil {
return errors.Errorf("failed to get juju executable path: %v", ... | go | func (c *SSHCommon) setProxyCommand(options *ssh.Options) error {
apiServerHost, _, err := net.SplitHostPort(c.apiAddr)
if err != nil {
return errors.Errorf("failed to get proxy address: %v", err)
}
juju, err := getJujuExecutable()
if err != nil {
return errors.Errorf("failed to get juju executable path: %v", ... | [
"func",
"(",
"c",
"*",
"SSHCommon",
")",
"setProxyCommand",
"(",
"options",
"*",
"ssh",
".",
"Options",
")",
"error",
"{",
"apiServerHost",
",",
"_",
",",
"err",
":=",
"net",
".",
"SplitHostPort",
"(",
"c",
".",
"apiAddr",
")",
"\n",
"if",
"err",
"!=... | // setProxyCommand sets the proxy command option. | [
"setProxyCommand",
"sets",
"the",
"proxy",
"command",
"option",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/ssh_common.go#L265-L296 |
156,380 | juju/juju | cmd/juju/commands/ssh_common.go | initAPIClient | func (c *SSHCommon) initAPIClient() error {
conn, err := c.NewAPIRoot()
if err != nil {
return errors.Trace(err)
}
c.apiClient = sshclient.NewFacade(conn)
c.apiAddr = conn.Addr()
return nil
} | go | func (c *SSHCommon) initAPIClient() error {
conn, err := c.NewAPIRoot()
if err != nil {
return errors.Trace(err)
}
c.apiClient = sshclient.NewFacade(conn)
c.apiAddr = conn.Addr()
return nil
} | [
"func",
"(",
"c",
"*",
"SSHCommon",
")",
"initAPIClient",
"(",
")",
"error",
"{",
"conn",
",",
"err",
":=",
"c",
".",
"NewAPIRoot",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Trace",
"(",
"err",
")",
"\n",
"}",
"\n",... | // initAPIClient initialises the API connection. | [
"initAPIClient",
"initialises",
"the",
"API",
"connection",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/ssh_common.go#L306-L314 |
156,381 | juju/juju | cmd/juju/commands/ssh_common.go | reachableAddressGetter | func (c *SSHCommon) reachableAddressGetter(entity string) (string, error) {
addresses, err := c.apiClient.AllAddresses(entity)
if err != nil {
return "", errors.Trace(err)
} else if len(addresses) == 0 {
return "", network.NoAddressError("available")
} else if len(addresses) == 1 {
logger.Debugf("Only one SSH... | go | func (c *SSHCommon) reachableAddressGetter(entity string) (string, error) {
addresses, err := c.apiClient.AllAddresses(entity)
if err != nil {
return "", errors.Trace(err)
} else if len(addresses) == 0 {
return "", network.NoAddressError("available")
} else if len(addresses) == 1 {
logger.Debugf("Only one SSH... | [
"func",
"(",
"c",
"*",
"SSHCommon",
")",
"reachableAddressGetter",
"(",
"entity",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"addresses",
",",
"err",
":=",
"c",
".",
"apiClient",
".",
"AllAddresses",
"(",
"entity",
")",
"\n",
"if",
"err",
"!... | // reachableAddressGetter dials all addresses of the given entity, returning the
// first one that succeeds. Only used with SSHClient API facade v2 or later is
// available. It does not try to dial if only one address is available. | [
"reachableAddressGetter",
"dials",
"all",
"addresses",
"of",
"the",
"given",
"entity",
"returning",
"the",
"first",
"one",
"that",
"succeeds",
".",
"Only",
"used",
"with",
"SSHClient",
"API",
"facade",
"v2",
"or",
"later",
"is",
"available",
".",
"It",
"does",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/ssh_common.go#L402-L428 |
156,382 | juju/juju | environs/tools/simplestreams.go | NewVersionedToolsConstraint | func NewVersionedToolsConstraint(vers version.Number, params simplestreams.LookupParams) *ToolsConstraint {
return &ToolsConstraint{LookupParams: params, Version: vers}
} | go | func NewVersionedToolsConstraint(vers version.Number, params simplestreams.LookupParams) *ToolsConstraint {
return &ToolsConstraint{LookupParams: params, Version: vers}
} | [
"func",
"NewVersionedToolsConstraint",
"(",
"vers",
"version",
".",
"Number",
",",
"params",
"simplestreams",
".",
"LookupParams",
")",
"*",
"ToolsConstraint",
"{",
"return",
"&",
"ToolsConstraint",
"{",
"LookupParams",
":",
"params",
",",
"Version",
":",
"vers",
... | // NewVersionedToolsConstraint returns a ToolsConstraint for a tools with a specific version. | [
"NewVersionedToolsConstraint",
"returns",
"a",
"ToolsConstraint",
"for",
"a",
"tools",
"with",
"a",
"specific",
"version",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/tools/simplestreams.go#L76-L78 |
156,383 | juju/juju | environs/tools/simplestreams.go | sortString | func (t *ToolsMetadata) sortString() string {
return fmt.Sprintf("%v-%s-%s", t.Version, t.Release, t.Arch)
} | go | func (t *ToolsMetadata) sortString() string {
return fmt.Sprintf("%v-%s-%s", t.Version, t.Release, t.Arch)
} | [
"func",
"(",
"t",
"*",
"ToolsMetadata",
")",
"sortString",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"t",
".",
"Version",
",",
"t",
".",
"Release",
",",
"t",
".",
"Arch",
")",
"\n",
"}"
] | // sortString is used by byVersion to sort a list of ToolsMetadata. | [
"sortString",
"is",
"used",
"by",
"byVersion",
"to",
"sort",
"a",
"list",
"of",
"ToolsMetadata",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/tools/simplestreams.go#L132-L134 |
156,384 | juju/juju | environs/tools/simplestreams.go | binary | func (t *ToolsMetadata) binary() (version.Binary, error) {
num, err := version.Parse(t.Version)
if err != nil {
return version.Binary{}, errors.Trace(err)
}
return version.Binary{
Number: num,
Series: t.Release,
Arch: t.Arch,
}, nil
} | go | func (t *ToolsMetadata) binary() (version.Binary, error) {
num, err := version.Parse(t.Version)
if err != nil {
return version.Binary{}, errors.Trace(err)
}
return version.Binary{
Number: num,
Series: t.Release,
Arch: t.Arch,
}, nil
} | [
"func",
"(",
"t",
"*",
"ToolsMetadata",
")",
"binary",
"(",
")",
"(",
"version",
".",
"Binary",
",",
"error",
")",
"{",
"num",
",",
"err",
":=",
"version",
".",
"Parse",
"(",
"t",
".",
"Version",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return"... | // binary returns the tools metadata's binary version, which may be used for
// map lookup. | [
"binary",
"returns",
"the",
"tools",
"metadata",
"s",
"binary",
"version",
"which",
"may",
"be",
"used",
"for",
"map",
"lookup",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/tools/simplestreams.go#L138-L148 |
156,385 | juju/juju | environs/tools/simplestreams.go | Fetch | func Fetch(
sources []simplestreams.DataSource, cons *ToolsConstraint,
) ([]*ToolsMetadata, *simplestreams.ResolveInfo, error) {
params := simplestreams.GetMetadataParams{
StreamsVersion: currentStreamsVersion,
LookupConstraint: cons,
ValueParams: simplestreams.ValueParams{
DataType: ContentDownloa... | go | func Fetch(
sources []simplestreams.DataSource, cons *ToolsConstraint,
) ([]*ToolsMetadata, *simplestreams.ResolveInfo, error) {
params := simplestreams.GetMetadataParams{
StreamsVersion: currentStreamsVersion,
LookupConstraint: cons,
ValueParams: simplestreams.ValueParams{
DataType: ContentDownloa... | [
"func",
"Fetch",
"(",
"sources",
"[",
"]",
"simplestreams",
".",
"DataSource",
",",
"cons",
"*",
"ToolsConstraint",
",",
")",
"(",
"[",
"]",
"*",
"ToolsMetadata",
",",
"*",
"simplestreams",
".",
"ResolveInfo",
",",
"error",
")",
"{",
"params",
":=",
"sim... | // Fetch returns a list of tools for the specified cloud matching the constraint.
// The base URL locations are as specified - the first location which has a file is the one used.
// Signed data is preferred, but if there is no signed data available and onlySigned is false,
// then unsigned data is used. | [
"Fetch",
"returns",
"a",
"list",
"of",
"tools",
"for",
"the",
"specified",
"cloud",
"matching",
"the",
"constraint",
".",
"The",
"base",
"URL",
"locations",
"are",
"as",
"specified",
"-",
"the",
"first",
"location",
"which",
"has",
"a",
"file",
"is",
"the"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/tools/simplestreams.go#L162-L188 |
156,386 | juju/juju | environs/tools/simplestreams.go | appendMatchingTools | func appendMatchingTools(source simplestreams.DataSource, matchingTools []interface{},
tools map[string]interface{}, cons simplestreams.LookupConstraint) ([]interface{}, error) {
toolsMap := make(map[version.Binary]*ToolsMetadata, len(matchingTools))
for _, val := range matchingTools {
tm := val.(*ToolsMetadata)
... | go | func appendMatchingTools(source simplestreams.DataSource, matchingTools []interface{},
tools map[string]interface{}, cons simplestreams.LookupConstraint) ([]interface{}, error) {
toolsMap := make(map[version.Binary]*ToolsMetadata, len(matchingTools))
for _, val := range matchingTools {
tm := val.(*ToolsMetadata)
... | [
"func",
"appendMatchingTools",
"(",
"source",
"simplestreams",
".",
"DataSource",
",",
"matchingTools",
"[",
"]",
"interface",
"{",
"}",
",",
"tools",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"cons",
"simplestreams",
".",
"LookupConstraint",
")",... | // appendMatchingTools updates matchingTools with tools metadata records from tools which belong to the
// specified series. If a tools record already exists in matchingTools, it is not overwritten. | [
"appendMatchingTools",
"updates",
"matchingTools",
"with",
"tools",
"metadata",
"records",
"from",
"tools",
"which",
"belong",
"to",
"the",
"specified",
"series",
".",
"If",
"a",
"tools",
"record",
"already",
"exists",
"in",
"matchingTools",
"it",
"is",
"not",
"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/tools/simplestreams.go#L204-L246 |
156,387 | juju/juju | environs/tools/simplestreams.go | MetadataFromTools | func MetadataFromTools(toolsList coretools.List, toolsDir string) []*ToolsMetadata {
metadata := make([]*ToolsMetadata, len(toolsList))
for i, t := range toolsList {
path := fmt.Sprintf("%s/juju-%s-%s-%s.tgz", toolsDir, t.Version.Number, t.Version.Series, t.Version.Arch)
metadata[i] = &ToolsMetadata{
Release: ... | go | func MetadataFromTools(toolsList coretools.List, toolsDir string) []*ToolsMetadata {
metadata := make([]*ToolsMetadata, len(toolsList))
for i, t := range toolsList {
path := fmt.Sprintf("%s/juju-%s-%s-%s.tgz", toolsDir, t.Version.Number, t.Version.Series, t.Version.Arch)
metadata[i] = &ToolsMetadata{
Release: ... | [
"func",
"MetadataFromTools",
"(",
"toolsList",
"coretools",
".",
"List",
",",
"toolsDir",
"string",
")",
"[",
"]",
"*",
"ToolsMetadata",
"{",
"metadata",
":=",
"make",
"(",
"[",
"]",
"*",
"ToolsMetadata",
",",
"len",
"(",
"toolsList",
")",
")",
"\n",
"fo... | // MetadataFromTools returns a tools metadata list derived from the
// given tools list. The size and sha256 will not be computed if
// missing. | [
"MetadataFromTools",
"returns",
"a",
"tools",
"metadata",
"list",
"derived",
"from",
"the",
"given",
"tools",
"list",
".",
"The",
"size",
"and",
"sha256",
"will",
"not",
"be",
"computed",
"if",
"missing",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/tools/simplestreams.go#L256-L271 |
156,388 | juju/juju | environs/tools/simplestreams.go | ResolveMetadata | func ResolveMetadata(stor storage.StorageReader, toolsDir string, metadata []*ToolsMetadata) error {
for _, md := range metadata {
if md.Size != 0 {
continue
}
binary, err := md.binary()
if err != nil {
return errors.Annotate(err, "cannot resolve metadata")
}
logger.Infof("Fetching agent binaries fro... | go | func ResolveMetadata(stor storage.StorageReader, toolsDir string, metadata []*ToolsMetadata) error {
for _, md := range metadata {
if md.Size != 0 {
continue
}
binary, err := md.binary()
if err != nil {
return errors.Annotate(err, "cannot resolve metadata")
}
logger.Infof("Fetching agent binaries fro... | [
"func",
"ResolveMetadata",
"(",
"stor",
"storage",
".",
"StorageReader",
",",
"toolsDir",
"string",
",",
"metadata",
"[",
"]",
"*",
"ToolsMetadata",
")",
"error",
"{",
"for",
"_",
",",
"md",
":=",
"range",
"metadata",
"{",
"if",
"md",
".",
"Size",
"!=",
... | // ResolveMetadata resolves incomplete metadata
// by fetching the tools from storage and computing
// the size and hash locally. | [
"ResolveMetadata",
"resolves",
"incomplete",
"metadata",
"by",
"fetching",
"the",
"tools",
"from",
"storage",
"and",
"computing",
"the",
"size",
"and",
"hash",
"locally",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/tools/simplestreams.go#L276-L302 |
156,389 | juju/juju | environs/tools/simplestreams.go | ReadMetadata | func ReadMetadata(store storage.StorageReader, stream string) ([]*ToolsMetadata, error) {
dataSource := storage.NewStorageSimpleStreamsDataSource("existing metadata", store, storage.BaseToolsPath, simplestreams.EXISTING_CLOUD_DATA, false)
toolsConstraint, err := makeToolsConstraint(simplestreams.CloudSpec{}, stream, ... | go | func ReadMetadata(store storage.StorageReader, stream string) ([]*ToolsMetadata, error) {
dataSource := storage.NewStorageSimpleStreamsDataSource("existing metadata", store, storage.BaseToolsPath, simplestreams.EXISTING_CLOUD_DATA, false)
toolsConstraint, err := makeToolsConstraint(simplestreams.CloudSpec{}, stream, ... | [
"func",
"ReadMetadata",
"(",
"store",
"storage",
".",
"StorageReader",
",",
"stream",
"string",
")",
"(",
"[",
"]",
"*",
"ToolsMetadata",
",",
"error",
")",
"{",
"dataSource",
":=",
"storage",
".",
"NewStorageSimpleStreamsDataSource",
"(",
"\"",
"\"",
",",
"... | // ReadMetadata returns the tools metadata from the given storage for the specified stream. | [
"ReadMetadata",
"returns",
"the",
"tools",
"metadata",
"from",
"the",
"given",
"storage",
"for",
"the",
"specified",
"stream",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/tools/simplestreams.go#L349-L360 |
156,390 | juju/juju | environs/tools/simplestreams.go | ReadAllMetadata | func ReadAllMetadata(store storage.StorageReader) (map[string][]*ToolsMetadata, error) {
streamMetadata := make(map[string][]*ToolsMetadata)
for _, stream := range AllMetadataStreams {
metadata, err := ReadMetadata(store, stream)
if err != nil {
return nil, err
}
if len(metadata) == 0 {
continue
}
s... | go | func ReadAllMetadata(store storage.StorageReader) (map[string][]*ToolsMetadata, error) {
streamMetadata := make(map[string][]*ToolsMetadata)
for _, stream := range AllMetadataStreams {
metadata, err := ReadMetadata(store, stream)
if err != nil {
return nil, err
}
if len(metadata) == 0 {
continue
}
s... | [
"func",
"ReadAllMetadata",
"(",
"store",
"storage",
".",
"StorageReader",
")",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"ToolsMetadata",
",",
"error",
")",
"{",
"streamMetadata",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"Tools... | // ReadAllMetadata returns the tools metadata from the given storage for all streams.
// The result is a map of metadata slices, keyed on stream. | [
"ReadAllMetadata",
"returns",
"the",
"tools",
"metadata",
"from",
"the",
"given",
"storage",
"for",
"all",
"streams",
".",
"The",
"result",
"is",
"a",
"map",
"of",
"metadata",
"slices",
"keyed",
"on",
"stream",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/tools/simplestreams.go#L367-L380 |
156,391 | juju/juju | environs/tools/simplestreams.go | removeMetadataUpdated | func removeMetadataUpdated(metadataBytes []byte) (string, error) {
var metadata map[string]interface{}
err := json.Unmarshal(metadataBytes, &metadata)
if err != nil {
return "", err
}
delete(metadata, "updated")
metadataJson, err := json.Marshal(metadata)
if err != nil {
return "", err
}
return string(met... | go | func removeMetadataUpdated(metadataBytes []byte) (string, error) {
var metadata map[string]interface{}
err := json.Unmarshal(metadataBytes, &metadata)
if err != nil {
return "", err
}
delete(metadata, "updated")
metadataJson, err := json.Marshal(metadata)
if err != nil {
return "", err
}
return string(met... | [
"func",
"removeMetadataUpdated",
"(",
"metadataBytes",
"[",
"]",
"byte",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"metadata",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"\n",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"metadataBytes",
"... | // removeMetadataUpdated unmarshalls simplestreams metadata, clears the
// updated attribute, and then marshalls back to a string. | [
"removeMetadataUpdated",
"unmarshalls",
"simplestreams",
"metadata",
"clears",
"the",
"updated",
"attribute",
"and",
"then",
"marshalls",
"back",
"to",
"a",
"string",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/tools/simplestreams.go#L384-L397 |
156,392 | juju/juju | environs/tools/simplestreams.go | metadataUnchanged | func metadataUnchanged(stor storage.Storage, stream string, generatedMetadata []byte) (bool, error) {
mdPath := ProductMetadataPath(stream)
filePath := path.Join(storage.BaseToolsPath, mdPath)
existingDataReader, err := stor.Get(filePath)
// If the file can't be retrieved, consider it has changed.
if err != nil {
... | go | func metadataUnchanged(stor storage.Storage, stream string, generatedMetadata []byte) (bool, error) {
mdPath := ProductMetadataPath(stream)
filePath := path.Join(storage.BaseToolsPath, mdPath)
existingDataReader, err := stor.Get(filePath)
// If the file can't be retrieved, consider it has changed.
if err != nil {
... | [
"func",
"metadataUnchanged",
"(",
"stor",
"storage",
".",
"Storage",
",",
"stream",
"string",
",",
"generatedMetadata",
"[",
"]",
"byte",
")",
"(",
"bool",
",",
"error",
")",
"{",
"mdPath",
":=",
"ProductMetadataPath",
"(",
"stream",
")",
"\n",
"filePath",
... | // metadataUnchanged returns true if the content of metadata for stream in stor is the same
// as generatedMetadata, ignoring the "updated" attribute. | [
"metadataUnchanged",
"returns",
"true",
"if",
"the",
"content",
"of",
"metadata",
"for",
"stream",
"in",
"stor",
"is",
"the",
"same",
"as",
"generatedMetadata",
"ignoring",
"the",
"updated",
"attribute",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/tools/simplestreams.go#L401-L426 |
156,393 | juju/juju | environs/tools/simplestreams.go | WriteMetadata | func WriteMetadata(stor storage.Storage, streamMetadata map[string][]*ToolsMetadata, streams []string, writeMirrors ShouldWriteMirrors) error {
// TODO(perrito666) 2016-05-02 lp:1558657
updated := time.Now()
index, legacyIndex, products, err := MarshalToolsMetadataJSON(streamMetadata, updated)
if err != nil {
ret... | go | func WriteMetadata(stor storage.Storage, streamMetadata map[string][]*ToolsMetadata, streams []string, writeMirrors ShouldWriteMirrors) error {
// TODO(perrito666) 2016-05-02 lp:1558657
updated := time.Now()
index, legacyIndex, products, err := MarshalToolsMetadataJSON(streamMetadata, updated)
if err != nil {
ret... | [
"func",
"WriteMetadata",
"(",
"stor",
"storage",
".",
"Storage",
",",
"streamMetadata",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"ToolsMetadata",
",",
"streams",
"[",
"]",
"string",
",",
"writeMirrors",
"ShouldWriteMirrors",
")",
"error",
"{",
"// TODO(perrit... | // WriteMetadata writes the given tools metadata for the specified streams to the given storage.
// streamMetadata contains all known metadata so that the correct index files can be written.
// Only product files for the specified streams are written. | [
"WriteMetadata",
"writes",
"the",
"given",
"tools",
"metadata",
"for",
"the",
"specified",
"streams",
"to",
"the",
"given",
"storage",
".",
"streamMetadata",
"contains",
"all",
"known",
"metadata",
"so",
"that",
"the",
"correct",
"index",
"files",
"can",
"be",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/tools/simplestreams.go#L431-L482 |
156,394 | juju/juju | environs/tools/simplestreams.go | fetchToolsHash | func fetchToolsHash(stor storage.StorageReader, stream string, ver version.Binary) (size int64, sha256hash hash.Hash, err error) {
r, err := storage.Get(stor, StorageName(ver, stream))
if err != nil {
return 0, nil, err
}
defer r.Close()
sha256hash = sha256.New()
size, err = io.Copy(sha256hash, r)
return size,... | go | func fetchToolsHash(stor storage.StorageReader, stream string, ver version.Binary) (size int64, sha256hash hash.Hash, err error) {
r, err := storage.Get(stor, StorageName(ver, stream))
if err != nil {
return 0, nil, err
}
defer r.Close()
sha256hash = sha256.New()
size, err = io.Copy(sha256hash, r)
return size,... | [
"func",
"fetchToolsHash",
"(",
"stor",
"storage",
".",
"StorageReader",
",",
"stream",
"string",
",",
"ver",
"version",
".",
"Binary",
")",
"(",
"size",
"int64",
",",
"sha256hash",
"hash",
".",
"Hash",
",",
"err",
"error",
")",
"{",
"r",
",",
"err",
":... | // fetchToolsHash fetches the tools from storage and calculates
// its size in bytes and computes a SHA256 hash of its contents. | [
"fetchToolsHash",
"fetches",
"the",
"tools",
"from",
"storage",
"and",
"calculates",
"its",
"size",
"in",
"bytes",
"and",
"computes",
"a",
"SHA256",
"hash",
"of",
"its",
"contents",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/tools/simplestreams.go#L521-L530 |
156,395 | juju/juju | worker/uniter/runner/context/action.go | NewActionData | func NewActionData(name string, tag *names.ActionTag, params map[string]interface{}) *ActionData {
return &ActionData{
Name: name,
Tag: *tag,
Params: params,
ResultsMap: map[string]interface{}{},
}
} | go | func NewActionData(name string, tag *names.ActionTag, params map[string]interface{}) *ActionData {
return &ActionData{
Name: name,
Tag: *tag,
Params: params,
ResultsMap: map[string]interface{}{},
}
} | [
"func",
"NewActionData",
"(",
"name",
"string",
",",
"tag",
"*",
"names",
".",
"ActionTag",
",",
"params",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"*",
"ActionData",
"{",
"return",
"&",
"ActionData",
"{",
"Name",
":",
"name",
",",
"Tag",... | // NewActionData builds a suitable ActionData struct with no nil members.
// this should only be called in the event that an Action hook is being requested. | [
"NewActionData",
"builds",
"a",
"suitable",
"ActionData",
"struct",
"with",
"no",
"nil",
"members",
".",
"this",
"should",
"only",
"be",
"called",
"in",
"the",
"event",
"that",
"an",
"Action",
"hook",
"is",
"being",
"requested",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runner/context/action.go#L22-L29 |
156,396 | juju/juju | container/kvm/run_linux.go | runAsLibvirt | func runAsLibvirt(dir, command string, args ...string) (string, error) {
uid, gid, err := getUserUIDGID(libvirtUser)
if err != nil {
return "", errors.Trace(err)
}
cmd := exec.Command(command, args...)
if dir != "" {
cmd.Dir = dir
}
if dir == "" {
dir, _ = os.Getwd()
}
logger.Debugf("running: %s %v fro... | go | func runAsLibvirt(dir, command string, args ...string) (string, error) {
uid, gid, err := getUserUIDGID(libvirtUser)
if err != nil {
return "", errors.Trace(err)
}
cmd := exec.Command(command, args...)
if dir != "" {
cmd.Dir = dir
}
if dir == "" {
dir, _ = os.Getwd()
}
logger.Debugf("running: %s %v fro... | [
"func",
"runAsLibvirt",
"(",
"dir",
",",
"command",
"string",
",",
"args",
"...",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"uid",
",",
"gid",
",",
"err",
":=",
"getUserUIDGID",
"(",
"libvirtUser",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{"... | // Run the command as user libvirt-qemu and return the combined output.
// If dir is non-empty, use it as the working directory. | [
"Run",
"the",
"command",
"as",
"user",
"libvirt",
"-",
"qemu",
"and",
"return",
"the",
"combined",
"output",
".",
"If",
"dir",
"is",
"non",
"-",
"empty",
"use",
"it",
"as",
"the",
"working",
"directory",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/kvm/run_linux.go#L20-L49 |
156,397 | juju/juju | cloudconfig/cloudinit/network_ubuntu.go | GenerateNetplan | func GenerateNetplan(interfaces []network.InterfaceInfo) (string, error) {
if len(interfaces) == 0 {
return "", errors.Errorf("missing container network config")
}
logger.Debugf("generating netplan from %#v", interfaces)
var netPlan netplan.Netplan
netPlan.Network.Ethernets = make(map[string]netplan.Ethernet)
n... | go | func GenerateNetplan(interfaces []network.InterfaceInfo) (string, error) {
if len(interfaces) == 0 {
return "", errors.Errorf("missing container network config")
}
logger.Debugf("generating netplan from %#v", interfaces)
var netPlan netplan.Netplan
netPlan.Network.Ethernets = make(map[string]netplan.Ethernet)
n... | [
"func",
"GenerateNetplan",
"(",
"interfaces",
"[",
"]",
"network",
".",
"InterfaceInfo",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"len",
"(",
"interfaces",
")",
"==",
"0",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"... | // GenerateNetplan renders a netplan file for one or more network
// interfaces, using the given non-empty list of interfaces. | [
"GenerateNetplan",
"renders",
"a",
"netplan",
"file",
"for",
"one",
"or",
"more",
"network",
"interfaces",
"using",
"the",
"given",
"non",
"-",
"empty",
"list",
"of",
"interfaces",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloudconfig/cloudinit/network_ubuntu.go#L140-L194 |
156,398 | juju/juju | cloudconfig/cloudinit/network_ubuntu.go | PrepareNetworkConfigFromInterfaces | func PrepareNetworkConfigFromInterfaces(interfaces []network.InterfaceInfo) *PreparedConfig {
dnsServers := set.NewStrings()
dnsSearchDomains := set.NewStrings()
gateway4Address := ""
gateway6Address := ""
namesInOrder := make([]string, 1, len(interfaces)+1)
nameToAddress := make(map[string]string)
nameToRoutes ... | go | func PrepareNetworkConfigFromInterfaces(interfaces []network.InterfaceInfo) *PreparedConfig {
dnsServers := set.NewStrings()
dnsSearchDomains := set.NewStrings()
gateway4Address := ""
gateway6Address := ""
namesInOrder := make([]string, 1, len(interfaces)+1)
nameToAddress := make(map[string]string)
nameToRoutes ... | [
"func",
"PrepareNetworkConfigFromInterfaces",
"(",
"interfaces",
"[",
"]",
"network",
".",
"InterfaceInfo",
")",
"*",
"PreparedConfig",
"{",
"dnsServers",
":=",
"set",
".",
"NewStrings",
"(",
")",
"\n",
"dnsSearchDomains",
":=",
"set",
".",
"NewStrings",
"(",
")... | // PrepareNetworkConfigFromInterfaces collects the necessary information to
// render a persistent network config from the given slice of
// network.InterfaceInfo. The result always includes the loopback interface. | [
"PrepareNetworkConfigFromInterfaces",
"collects",
"the",
"necessary",
"information",
"to",
"render",
"a",
"persistent",
"network",
"config",
"from",
"the",
"given",
"slice",
"of",
"network",
".",
"InterfaceInfo",
".",
"The",
"result",
"always",
"includes",
"the",
"l... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloudconfig/cloudinit/network_ubuntu.go#L213-L294 |
156,399 | juju/juju | worker/storageprovisioner/config.go | Validate | func (config Config) Validate() error {
switch config.Scope.(type) {
case nil:
return errors.NotValidf("nil Scope")
case names.ModelTag:
if config.StorageDir != "" {
return errors.NotValidf("environ Scope with non-empty StorageDir")
}
case names.MachineTag:
if config.StorageDir == "" {
return errors.N... | go | func (config Config) Validate() error {
switch config.Scope.(type) {
case nil:
return errors.NotValidf("nil Scope")
case names.ModelTag:
if config.StorageDir != "" {
return errors.NotValidf("environ Scope with non-empty StorageDir")
}
case names.MachineTag:
if config.StorageDir == "" {
return errors.N... | [
"func",
"(",
"config",
"Config",
")",
"Validate",
"(",
")",
"error",
"{",
"switch",
"config",
".",
"Scope",
".",
"(",
"type",
")",
"{",
"case",
"nil",
":",
"return",
"errors",
".",
"NotValidf",
"(",
"\"",
"\"",
")",
"\n",
"case",
"names",
".",
"Mod... | // Validate returns an error if the config cannot be relied upon to start a worker. | [
"Validate",
"returns",
"an",
"error",
"if",
"the",
"config",
"cannot",
"be",
"relied",
"upon",
"to",
"start",
"a",
"worker",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/storageprovisioner/config.go#L32-L79 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.