id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
154,400 | juju/juju | api/migrationtarget/client.go | Import | func (c *Client) Import(bytes []byte) error {
serialized := params.SerializedModel{Bytes: bytes}
return c.caller.FacadeCall("Import", serialized, nil)
} | go | func (c *Client) Import(bytes []byte) error {
serialized := params.SerializedModel{Bytes: bytes}
return c.caller.FacadeCall("Import", serialized, nil)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"Import",
"(",
"bytes",
"[",
"]",
"byte",
")",
"error",
"{",
"serialized",
":=",
"params",
".",
"SerializedModel",
"{",
"Bytes",
":",
"bytes",
"}",
"\n",
"return",
"c",
".",
"caller",
".",
"FacadeCall",
"(",
"\""... | // Import takes a serialized model and imports it into the target
// controller. | [
"Import",
"takes",
"a",
"serialized",
"model",
"and",
"imports",
"it",
"into",
"the",
"target",
"controller",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/migrationtarget/client.go#L58-L61 |
154,401 | juju/juju | api/migrationtarget/client.go | Abort | func (c *Client) Abort(modelUUID string) error {
args := params.ModelArgs{ModelTag: names.NewModelTag(modelUUID).String()}
return c.caller.FacadeCall("Abort", args, nil)
} | go | func (c *Client) Abort(modelUUID string) error {
args := params.ModelArgs{ModelTag: names.NewModelTag(modelUUID).String()}
return c.caller.FacadeCall("Abort", args, nil)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"Abort",
"(",
"modelUUID",
"string",
")",
"error",
"{",
"args",
":=",
"params",
".",
"ModelArgs",
"{",
"ModelTag",
":",
"names",
".",
"NewModelTag",
"(",
"modelUUID",
")",
".",
"String",
"(",
")",
"}",
"\n",
"ret... | // Abort removes all data relating to a previously imported model. | [
"Abort",
"removes",
"all",
"data",
"relating",
"to",
"a",
"previously",
"imported",
"model",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/migrationtarget/client.go#L64-L67 |
154,402 | juju/juju | api/migrationtarget/client.go | UploadTools | func (c *Client) UploadTools(modelUUID string, r io.ReadSeeker, vers version.Binary, additionalSeries ...string) (tools.List, error) {
endpoint := fmt.Sprintf("/migrate/tools?binaryVersion=%s&series=%s", vers, strings.Join(additionalSeries, ","))
contentType := "application/x-tar-gz"
var resp params.ToolsResult
if ... | go | func (c *Client) UploadTools(modelUUID string, r io.ReadSeeker, vers version.Binary, additionalSeries ...string) (tools.List, error) {
endpoint := fmt.Sprintf("/migrate/tools?binaryVersion=%s&series=%s", vers, strings.Join(additionalSeries, ","))
contentType := "application/x-tar-gz"
var resp params.ToolsResult
if ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UploadTools",
"(",
"modelUUID",
"string",
",",
"r",
"io",
".",
"ReadSeeker",
",",
"vers",
"version",
".",
"Binary",
",",
"additionalSeries",
"...",
"string",
")",
"(",
"tools",
".",
"List",
",",
"error",
")",
"{",... | // UploadTools uploads tools at the specified location to the API server over HTTPS
// for the specified model. | [
"UploadTools",
"uploads",
"tools",
"at",
"the",
"specified",
"location",
"to",
"the",
"API",
"server",
"over",
"HTTPS",
"for",
"the",
"specified",
"model",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/migrationtarget/client.go#L100-L108 |
154,403 | juju/juju | api/migrationtarget/client.go | UploadResource | func (c *Client) UploadResource(modelUUID string, res resource.Resource, r io.ReadSeeker) error {
args := makeResourceArgs(res)
args.Add("application", res.ApplicationID)
err := c.resourcePost(modelUUID, args, r)
return errors.Trace(err)
} | go | func (c *Client) UploadResource(modelUUID string, res resource.Resource, r io.ReadSeeker) error {
args := makeResourceArgs(res)
args.Add("application", res.ApplicationID)
err := c.resourcePost(modelUUID, args, r)
return errors.Trace(err)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"UploadResource",
"(",
"modelUUID",
"string",
",",
"res",
"resource",
".",
"Resource",
",",
"r",
"io",
".",
"ReadSeeker",
")",
"error",
"{",
"args",
":=",
"makeResourceArgs",
"(",
"res",
")",
"\n",
"args",
".",
"Ad... | // UploadResource uploads a resource to the migration endpoint. | [
"UploadResource",
"uploads",
"a",
"resource",
"to",
"the",
"migration",
"endpoint",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/migrationtarget/client.go#L111-L116 |
154,404 | juju/juju | api/migrationtarget/client.go | SetUnitResource | func (c *Client) SetUnitResource(modelUUID, unit string, res resource.Resource) error {
args := makeResourceArgs(res)
args.Add("unit", unit)
err := c.resourcePost(modelUUID, args, nil)
return errors.Trace(err)
} | go | func (c *Client) SetUnitResource(modelUUID, unit string, res resource.Resource) error {
args := makeResourceArgs(res)
args.Add("unit", unit)
err := c.resourcePost(modelUUID, args, nil)
return errors.Trace(err)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"SetUnitResource",
"(",
"modelUUID",
",",
"unit",
"string",
",",
"res",
"resource",
".",
"Resource",
")",
"error",
"{",
"args",
":=",
"makeResourceArgs",
"(",
"res",
")",
"\n",
"args",
".",
"Add",
"(",
"\"",
"\"",
... | // SetUnitResource sets the metadata for a particular unit resource. | [
"SetUnitResource",
"sets",
"the",
"metadata",
"for",
"a",
"particular",
"unit",
"resource",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/migrationtarget/client.go#L127-L132 |
154,405 | juju/juju | api/migrationtarget/client.go | OpenLogTransferStream | func (c *Client) OpenLogTransferStream(modelUUID string) (base.Stream, error) {
attrs := url.Values{}
attrs.Set("jujuclientversion", jujuversion.Current.String())
headers := http.Header{}
headers.Set(params.MigrationModelHTTPHeader, modelUUID)
caller := c.caller.RawAPICaller()
stream, err := caller.ConnectControl... | go | func (c *Client) OpenLogTransferStream(modelUUID string) (base.Stream, error) {
attrs := url.Values{}
attrs.Set("jujuclientversion", jujuversion.Current.String())
headers := http.Header{}
headers.Set(params.MigrationModelHTTPHeader, modelUUID)
caller := c.caller.RawAPICaller()
stream, err := caller.ConnectControl... | [
"func",
"(",
"c",
"*",
"Client",
")",
"OpenLogTransferStream",
"(",
"modelUUID",
"string",
")",
"(",
"base",
".",
"Stream",
",",
"error",
")",
"{",
"attrs",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"attrs",
".",
"Set",
"(",
"\"",
"\"",
",",
"juj... | // OpenLogTransferStream connects to the migration logtransfer
// endpoint on the target controller and returns a stream that JSON
// logs records can be fed into. The objects written should be params.LogRecords. | [
"OpenLogTransferStream",
"connects",
"to",
"the",
"migration",
"logtransfer",
"endpoint",
"on",
"the",
"target",
"controller",
"and",
"returns",
"a",
"stream",
"that",
"JSON",
"logs",
"records",
"can",
"be",
"fed",
"into",
".",
"The",
"objects",
"written",
"shou... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/migrationtarget/client.go#L186-L197 |
154,406 | juju/juju | api/migrationtarget/client.go | CACert | func (c *Client) CACert() (string, error) {
var result params.BytesResult
err := c.caller.FacadeCall("CACert", nil, &result)
if err != nil {
return "", err
}
return string(result.Result), nil
} | go | func (c *Client) CACert() (string, error) {
var result params.BytesResult
err := c.caller.FacadeCall("CACert", nil, &result)
if err != nil {
return "", err
}
return string(result.Result), nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"CACert",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"result",
"params",
".",
"BytesResult",
"\n",
"err",
":=",
"c",
".",
"caller",
".",
"FacadeCall",
"(",
"\"",
"\"",
",",
"nil",
",",
"&",
"resu... | // CACert returns the CA certificate associated with
// the connection. | [
"CACert",
"returns",
"the",
"CA",
"certificate",
"associated",
"with",
"the",
"connection",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/migrationtarget/client.go#L226-L233 |
154,407 | juju/juju | core/cache/unit.go | Name | func (u *Unit) Name() string {
u.mu.Lock()
defer u.mu.Unlock()
return u.details.Name
} | go | func (u *Unit) Name() string {
u.mu.Lock()
defer u.mu.Unlock()
return u.details.Name
} | [
"func",
"(",
"u",
"*",
"Unit",
")",
"Name",
"(",
")",
"string",
"{",
"u",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"u",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"u",
".",
"details",
".",
"Name",
"\n",
"}"
] | // Name returns the name of this unit. | [
"Name",
"returns",
"the",
"name",
"of",
"this",
"unit",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/cache/unit.go#L36-L40 |
154,408 | juju/juju | core/cache/unit.go | Application | func (u *Unit) Application() string {
u.mu.Lock()
defer u.mu.Unlock()
return u.details.Application
} | go | func (u *Unit) Application() string {
u.mu.Lock()
defer u.mu.Unlock()
return u.details.Application
} | [
"func",
"(",
"u",
"*",
"Unit",
")",
"Application",
"(",
")",
"string",
"{",
"u",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"u",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"u",
".",
"details",
".",
"Application",
"\n",
"}"
] | // Application returns the application name of this unit. | [
"Application",
"returns",
"the",
"application",
"name",
"of",
"this",
"unit",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/cache/unit.go#L43-L47 |
154,409 | juju/juju | core/cache/unit.go | MachineId | func (u *Unit) MachineId() string {
u.mu.Lock()
defer u.mu.Unlock()
return u.details.MachineId
} | go | func (u *Unit) MachineId() string {
u.mu.Lock()
defer u.mu.Unlock()
return u.details.MachineId
} | [
"func",
"(",
"u",
"*",
"Unit",
")",
"MachineId",
"(",
")",
"string",
"{",
"u",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"u",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"u",
".",
"details",
".",
"MachineId",
"\n",
"}"
] | // MachineId returns the ID of the machine hosting this unit. | [
"MachineId",
"returns",
"the",
"ID",
"of",
"the",
"machine",
"hosting",
"this",
"unit",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/cache/unit.go#L50-L54 |
154,410 | juju/juju | core/cache/unit.go | Subordinate | func (u *Unit) Subordinate() bool {
u.mu.Lock()
defer u.mu.Unlock()
return u.details.Subordinate
} | go | func (u *Unit) Subordinate() bool {
u.mu.Lock()
defer u.mu.Unlock()
return u.details.Subordinate
} | [
"func",
"(",
"u",
"*",
"Unit",
")",
"Subordinate",
"(",
")",
"bool",
"{",
"u",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"u",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"u",
".",
"details",
".",
"Subordinate",
"\n",
"}"
] | // Subordinate returns a bool indicating whether this unit is a subordinate. | [
"Subordinate",
"returns",
"a",
"bool",
"indicating",
"whether",
"this",
"unit",
"is",
"a",
"subordinate",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/cache/unit.go#L57-L61 |
154,411 | juju/juju | core/cache/unit.go | Principal | func (u *Unit) Principal() string {
u.mu.Lock()
defer u.mu.Unlock()
return u.details.Principal
} | go | func (u *Unit) Principal() string {
u.mu.Lock()
defer u.mu.Unlock()
return u.details.Principal
} | [
"func",
"(",
"u",
"*",
"Unit",
")",
"Principal",
"(",
")",
"string",
"{",
"u",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"u",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"u",
".",
"details",
".",
"Principal",
"\n",
"}"
] | // Principal returns the name of the principal unit for the same application. | [
"Principal",
"returns",
"the",
"name",
"of",
"the",
"principal",
"unit",
"for",
"the",
"same",
"application",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/cache/unit.go#L64-L68 |
154,412 | juju/juju | core/cache/unit.go | CharmURL | func (u *Unit) CharmURL() string {
u.mu.Lock()
defer u.mu.Unlock()
return u.details.CharmURL
} | go | func (u *Unit) CharmURL() string {
u.mu.Lock()
defer u.mu.Unlock()
return u.details.CharmURL
} | [
"func",
"(",
"u",
"*",
"Unit",
")",
"CharmURL",
"(",
")",
"string",
"{",
"u",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"u",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"u",
".",
"details",
".",
"CharmURL",
"\n",
"}"
] | // CharmURL returns the charm URL for this unit's application. | [
"CharmURL",
"returns",
"the",
"charm",
"URL",
"for",
"this",
"unit",
"s",
"application",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/cache/unit.go#L71-L75 |
154,413 | juju/juju | apiserver/params/params.go | OneError | func (result ErrorResults) OneError() error {
if n := len(result.Results); n != 1 {
return fmt.Errorf("expected 1 result, got %d", n)
}
if err := result.Results[0].Error; err != nil {
return err
}
return nil
} | go | func (result ErrorResults) OneError() error {
if n := len(result.Results); n != 1 {
return fmt.Errorf("expected 1 result, got %d", n)
}
if err := result.Results[0].Error; err != nil {
return err
}
return nil
} | [
"func",
"(",
"result",
"ErrorResults",
")",
"OneError",
"(",
")",
"error",
"{",
"if",
"n",
":=",
"len",
"(",
"result",
".",
"Results",
")",
";",
"n",
"!=",
"1",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"n",
")",
"\n",
"}",
"\n... | // OneError returns the error from the result
// of a bulk operation on a single value. | [
"OneError",
"returns",
"the",
"error",
"from",
"the",
"result",
"of",
"a",
"bulk",
"operation",
"on",
"a",
"single",
"value",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/params/params.go#L84-L92 |
154,414 | juju/juju | apiserver/params/params.go | Combine | func (result ErrorResults) Combine() error {
var errorStrings []string
for _, r := range result.Results {
if r.Error != nil {
errorStrings = append(errorStrings, r.Error.Error())
}
}
if errorStrings != nil {
return errors.New(strings.Join(errorStrings, "\n"))
}
return nil
} | go | func (result ErrorResults) Combine() error {
var errorStrings []string
for _, r := range result.Results {
if r.Error != nil {
errorStrings = append(errorStrings, r.Error.Error())
}
}
if errorStrings != nil {
return errors.New(strings.Join(errorStrings, "\n"))
}
return nil
} | [
"func",
"(",
"result",
"ErrorResults",
")",
"Combine",
"(",
")",
"error",
"{",
"var",
"errorStrings",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"result",
".",
"Results",
"{",
"if",
"r",
".",
"Error",
"!=",
"nil",
"{",
"errorStrin... | // Combine returns one error from the result which is an accumulation of the
// errors. If there are no errors in the result, the return value is nil.
// Otherwise the error values are combined with new-line characters. | [
"Combine",
"returns",
"one",
"error",
"from",
"the",
"result",
"which",
"is",
"an",
"accumulation",
"of",
"the",
"errors",
".",
"If",
"there",
"are",
"no",
"errors",
"in",
"the",
"result",
"the",
"return",
"value",
"is",
"nil",
".",
"Otherwise",
"the",
"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/params/params.go#L97-L108 |
154,415 | juju/juju | apiserver/facades/client/resources/facade.go | NewPublicFacade | func NewPublicFacade(st *state.State, _ facade.Resources, authorizer facade.Authorizer) (*Facade, error) {
if !authorizer.AuthClient() {
return nil, common.ErrPerm
}
rst, err := st.Resources()
if err != nil {
return nil, errors.Trace(err)
}
controllerCfg, err := st.ControllerConfig()
if err != nil {
retur... | go | func NewPublicFacade(st *state.State, _ facade.Resources, authorizer facade.Authorizer) (*Facade, error) {
if !authorizer.AuthClient() {
return nil, common.ErrPerm
}
rst, err := st.Resources()
if err != nil {
return nil, errors.Trace(err)
}
controllerCfg, err := st.ControllerConfig()
if err != nil {
retur... | [
"func",
"NewPublicFacade",
"(",
"st",
"*",
"state",
".",
"State",
",",
"_",
"facade",
".",
"Resources",
",",
"authorizer",
"facade",
".",
"Authorizer",
")",
"(",
"*",
"Facade",
",",
"error",
")",
"{",
"if",
"!",
"authorizer",
".",
"AuthClient",
"(",
")... | // NewPublicFacade creates a public API facade for resources. It is
// used for API registration. | [
"NewPublicFacade",
"creates",
"a",
"public",
"API",
"facade",
"for",
"resources",
".",
"It",
"is",
"used",
"for",
"API",
"registration",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/resources/facade.go#L60-L81 |
154,416 | juju/juju | apiserver/facades/client/resources/facade.go | NewFacade | func NewFacade(store Backend, newClient func() (CharmStore, error)) (*Facade, error) {
if store == nil {
return nil, errors.Errorf("missing data store")
}
if newClient == nil {
// Technically this only matters for one code path through
// AddPendingResources(). However, that functionality should be
// provid... | go | func NewFacade(store Backend, newClient func() (CharmStore, error)) (*Facade, error) {
if store == nil {
return nil, errors.Errorf("missing data store")
}
if newClient == nil {
// Technically this only matters for one code path through
// AddPendingResources(). However, that functionality should be
// provid... | [
"func",
"NewFacade",
"(",
"store",
"Backend",
",",
"newClient",
"func",
"(",
")",
"(",
"CharmStore",
",",
"error",
")",
")",
"(",
"*",
"Facade",
",",
"error",
")",
"{",
"if",
"store",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
... | // NewFacade returns a new resoures API facade. | [
"NewFacade",
"returns",
"a",
"new",
"resoures",
"API",
"facade",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/resources/facade.go#L84-L101 |
154,417 | juju/juju | apiserver/facades/client/resources/facade.go | ListResources | func (f Facade) ListResources(args params.ListResourcesArgs) (params.ResourcesResults, error) {
var r params.ResourcesResults
r.Results = make([]params.ResourcesResult, len(args.Entities))
for i, e := range args.Entities {
logger.Tracef("Listing resources for %q", e.Tag)
tag, apierr := parseApplicationTag(e.Tag... | go | func (f Facade) ListResources(args params.ListResourcesArgs) (params.ResourcesResults, error) {
var r params.ResourcesResults
r.Results = make([]params.ResourcesResult, len(args.Entities))
for i, e := range args.Entities {
logger.Tracef("Listing resources for %q", e.Tag)
tag, apierr := parseApplicationTag(e.Tag... | [
"func",
"(",
"f",
"Facade",
")",
"ListResources",
"(",
"args",
"params",
".",
"ListResourcesArgs",
")",
"(",
"params",
".",
"ResourcesResults",
",",
"error",
")",
"{",
"var",
"r",
"params",
".",
"ResourcesResults",
"\n",
"r",
".",
"Results",
"=",
"make",
... | // ListResources returns the list of resources for the given application. | [
"ListResources",
"returns",
"the",
"list",
"of",
"resources",
"for",
"the",
"given",
"application",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/resources/facade.go#L104-L129 |
154,418 | juju/juju | apiserver/facades/client/resources/facade.go | resourcesFromCharmstore | func (f Facade) resourcesFromCharmstore(charms []charmstore.CharmID, client CharmStore) (map[string]charmresource.Resource, error) {
results, err := client.ListResources(charms)
if err != nil {
return nil, errors.Trace(err)
}
storeResources := make(map[string]charmresource.Resource)
if len(results) != 0 {
for ... | go | func (f Facade) resourcesFromCharmstore(charms []charmstore.CharmID, client CharmStore) (map[string]charmresource.Resource, error) {
results, err := client.ListResources(charms)
if err != nil {
return nil, errors.Trace(err)
}
storeResources := make(map[string]charmresource.Resource)
if len(results) != 0 {
for ... | [
"func",
"(",
"f",
"Facade",
")",
"resourcesFromCharmstore",
"(",
"charms",
"[",
"]",
"charmstore",
".",
"CharmID",
",",
"client",
"CharmStore",
")",
"(",
"map",
"[",
"string",
"]",
"charmresource",
".",
"Resource",
",",
"error",
")",
"{",
"results",
",",
... | // resourcesFromCharmstore gets the info for the charm's resources in
// the charm store. If the charm URL has a revision then that revision's
// resources are returned. Otherwise the latest info for each of the
// resources is returned. | [
"resourcesFromCharmstore",
"gets",
"the",
"info",
"for",
"the",
"charm",
"s",
"resources",
"in",
"the",
"charm",
"store",
".",
"If",
"the",
"charm",
"URL",
"has",
"a",
"revision",
"then",
"that",
"revision",
"s",
"resources",
"are",
"returned",
".",
"Otherwi... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/resources/facade.go#L238-L250 |
154,419 | juju/juju | apiserver/facades/client/resources/facade.go | resolveStoreResource | func resolveStoreResource(res charmresource.Resource, storeResources map[string]charmresource.Resource, id charmstore.CharmID, client CharmStore) (charmresource.Resource, error) {
storeRes, ok := storeResources[res.Name]
if !ok {
// This indicates that AddPendingResources() was called for
// a resource the charm ... | go | func resolveStoreResource(res charmresource.Resource, storeResources map[string]charmresource.Resource, id charmstore.CharmID, client CharmStore) (charmresource.Resource, error) {
storeRes, ok := storeResources[res.Name]
if !ok {
// This indicates that AddPendingResources() was called for
// a resource the charm ... | [
"func",
"resolveStoreResource",
"(",
"res",
"charmresource",
".",
"Resource",
",",
"storeResources",
"map",
"[",
"string",
"]",
"charmresource",
".",
"Resource",
",",
"id",
"charmstore",
".",
"CharmID",
",",
"client",
"CharmStore",
")",
"(",
"charmresource",
"."... | // resolveStoreResource selects the resource info to use. It decides
// between the provided and latest info based on the revision. | [
"resolveStoreResource",
"selects",
"the",
"resource",
"info",
"to",
"use",
".",
"It",
"decides",
"between",
"the",
"provided",
"and",
"latest",
"info",
"based",
"on",
"the",
"revision",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/resources/facade.go#L277-L319 |
154,420 | juju/juju | provider/maas/environ.go | ecfg | func (env *maasEnviron) ecfg() *maasModelConfig {
env.ecfgMutex.Lock()
cfg := *env.ecfgUnlocked
env.ecfgMutex.Unlock()
return &cfg
} | go | func (env *maasEnviron) ecfg() *maasModelConfig {
env.ecfgMutex.Lock()
cfg := *env.ecfgUnlocked
env.ecfgMutex.Unlock()
return &cfg
} | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"ecfg",
"(",
")",
"*",
"maasModelConfig",
"{",
"env",
".",
"ecfgMutex",
".",
"Lock",
"(",
")",
"\n",
"cfg",
":=",
"*",
"env",
".",
"ecfgUnlocked",
"\n",
"env",
".",
"ecfgMutex",
".",
"Unlock",
"(",
")",
... | // ecfg returns the environment's maasModelConfig, and protects it with a
// mutex. | [
"ecfg",
"returns",
"the",
"environment",
"s",
"maasModelConfig",
"and",
"protects",
"it",
"with",
"a",
"mutex",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L236-L241 |
154,421 | juju/juju | provider/maas/environ.go | allArchitectures2 | func (env *maasEnviron) allArchitectures2(ctx context.ProviderCallContext) ([]string, error) {
resources, err := env.maasController.BootResources()
if err != nil {
common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
return nil, errors.Trace(err)
}
architectures := set.NewStrings()
for _, resource :=... | go | func (env *maasEnviron) allArchitectures2(ctx context.ProviderCallContext) ([]string, error) {
resources, err := env.maasController.BootResources()
if err != nil {
common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
return nil, errors.Trace(err)
}
architectures := set.NewStrings()
for _, resource :=... | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"allArchitectures2",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"resources",
",",
"err",
":=",
"env",
".",
"maasController",
".",
"BootResources",
"(... | // allArchitectures2 uses the MAAS2 controller to get architectures from boot
// resources. | [
"allArchitectures2",
"uses",
"the",
"MAAS2",
"controller",
"to",
"get",
"architectures",
"from",
"boot",
"resources",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L351-L362 |
154,422 | juju/juju | provider/maas/environ.go | allArchitecturesWithFallback | func (env *maasEnviron) allArchitecturesWithFallback(ctx context.ProviderCallContext) ([]string, error) {
architectures, err := env.allArchitectures(ctx)
if err != nil || len(architectures) == 0 {
logger.Debugf("error querying boot-images: %v", err)
logger.Debugf("falling back to listing nodes")
architectures, ... | go | func (env *maasEnviron) allArchitecturesWithFallback(ctx context.ProviderCallContext) ([]string, error) {
architectures, err := env.allArchitectures(ctx)
if err != nil || len(architectures) == 0 {
logger.Debugf("error querying boot-images: %v", err)
logger.Debugf("falling back to listing nodes")
architectures, ... | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"allArchitecturesWithFallback",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"architectures",
",",
"err",
":=",
"env",
".",
"allArchitectures",
"(",
"ctx... | // allArchitectureWithFallback queries MAAS for all of the boot-images
// across all registered nodegroups and collapses them down to unique
// architectures. | [
"allArchitectureWithFallback",
"queries",
"MAAS",
"for",
"all",
"of",
"the",
"boot",
"-",
"images",
"across",
"all",
"registered",
"nodegroups",
"and",
"collapses",
"them",
"down",
"to",
"unique",
"architectures",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L367-L380 |
154,423 | juju/juju | provider/maas/environ.go | getNodegroups | func (env *maasEnviron) getNodegroups(ctx context.ProviderCallContext) ([]string, error) {
nodegroupsListing := env.getMAASClient().GetSubObject("nodegroups")
nodegroupsResult, err := nodegroupsListing.CallGet("list", nil)
if err != nil {
common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
return nil,... | go | func (env *maasEnviron) getNodegroups(ctx context.ProviderCallContext) ([]string, error) {
nodegroupsListing := env.getMAASClient().GetSubObject("nodegroups")
nodegroupsResult, err := nodegroupsListing.CallGet("list", nil)
if err != nil {
common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
return nil,... | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"getNodegroups",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"nodegroupsListing",
":=",
"env",
".",
"getMAASClient",
"(",
")",
".",
"GetSubObject",
"(... | // getNodegroups returns the UUID corresponding to each nodegroup
// in the MAAS installation. | [
"getNodegroups",
"returns",
"the",
"UUID",
"corresponding",
"to",
"each",
"nodegroup",
"in",
"the",
"MAAS",
"installation",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L402-L427 |
154,424 | juju/juju | provider/maas/environ.go | nodegroupBootImages | func (env *maasEnviron) nodegroupBootImages(ctx context.ProviderCallContext, nodegroupUUID string) ([]bootImage, error) {
nodegroupObject := env.getMAASClient().GetSubObject("nodegroups").GetSubObject(nodegroupUUID)
bootImagesObject := nodegroupObject.GetSubObject("boot-images/")
result, err := bootImagesObject.Call... | go | func (env *maasEnviron) nodegroupBootImages(ctx context.ProviderCallContext, nodegroupUUID string) ([]bootImage, error) {
nodegroupObject := env.getMAASClient().GetSubObject("nodegroups").GetSubObject(nodegroupUUID)
bootImagesObject := nodegroupObject.GetSubObject("boot-images/")
result, err := bootImagesObject.Call... | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"nodegroupBootImages",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"nodegroupUUID",
"string",
")",
"(",
"[",
"]",
"bootImage",
",",
"error",
")",
"{",
"nodegroupObject",
":=",
"env",
".",
"getMAASClient"... | // nodegroupBootImages returns the set of boot-images for the specified nodegroup. | [
"nodegroupBootImages",
"returns",
"the",
"set",
"of",
"boot",
"-",
"images",
"for",
"the",
"specified",
"nodegroup",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L435-L467 |
154,425 | juju/juju | provider/maas/environ.go | getCapabilities | func getCapabilities(client *gomaasapi.MAASObject, serverURL string) (set.Strings, error) {
caps := make(set.Strings)
var result gomaasapi.JSONObject
var err error
for a := shortAttempt.Start(); a.Next(); {
version := client.GetSubObject("version/")
result, err = version.CallGet("", nil)
if err == nil {
b... | go | func getCapabilities(client *gomaasapi.MAASObject, serverURL string) (set.Strings, error) {
caps := make(set.Strings)
var result gomaasapi.JSONObject
var err error
for a := shortAttempt.Start(); a.Next(); {
version := client.GetSubObject("version/")
result, err = version.CallGet("", nil)
if err == nil {
b... | [
"func",
"getCapabilities",
"(",
"client",
"*",
"gomaasapi",
".",
"MAASObject",
",",
"serverURL",
"string",
")",
"(",
"set",
".",
"Strings",
",",
"error",
")",
"{",
"caps",
":=",
"make",
"(",
"set",
".",
"Strings",
")",
"\n",
"var",
"result",
"gomaasapi",... | // getCapabilities asks the MAAS server for its capabilities, if
// supported by the server. | [
"getCapabilities",
"asks",
"the",
"MAAS",
"server",
"for",
"its",
"capabilities",
"if",
"supported",
"by",
"the",
"server",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L658-L708 |
154,426 | juju/juju | provider/maas/environ.go | getMAASClient | func (env *maasEnviron) getMAASClient() *gomaasapi.MAASObject {
env.ecfgMutex.Lock()
defer env.ecfgMutex.Unlock()
return env.maasClientUnlocked
} | go | func (env *maasEnviron) getMAASClient() *gomaasapi.MAASObject {
env.ecfgMutex.Lock()
defer env.ecfgMutex.Unlock()
return env.maasClientUnlocked
} | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"getMAASClient",
"(",
")",
"*",
"gomaasapi",
".",
"MAASObject",
"{",
"env",
".",
"ecfgMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"env",
".",
"ecfgMutex",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"env",
... | // getMAASClient returns a MAAS client object to use for a request, in a
// lock-protected fashion. | [
"getMAASClient",
"returns",
"a",
"MAAS",
"client",
"object",
"to",
"use",
"for",
"a",
"request",
"in",
"a",
"lock",
"-",
"protected",
"fashion",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L712-L717 |
154,427 | juju/juju | provider/maas/environ.go | acquireNode2 | func (env *maasEnviron) acquireNode2(
ctx context.ProviderCallContext,
nodeName, zoneName, systemId string,
cons constraints.Value,
interfaces []interfaceBinding,
volumes []volumeInfo,
) (maasInstance, error) {
acquireParams := convertConstraints2(cons)
positiveSpaceNames, negativeSpaceNames := convertSpacesFrom... | go | func (env *maasEnviron) acquireNode2(
ctx context.ProviderCallContext,
nodeName, zoneName, systemId string,
cons constraints.Value,
interfaces []interfaceBinding,
volumes []volumeInfo,
) (maasInstance, error) {
acquireParams := convertConstraints2(cons)
positiveSpaceNames, negativeSpaceNames := convertSpacesFrom... | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"acquireNode2",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"nodeName",
",",
"zoneName",
",",
"systemId",
"string",
",",
"cons",
"constraints",
".",
"Value",
",",
"interfaces",
"[",
"]",
"interfaceBindin... | // acquireNode2 allocates a machine from MAAS2. | [
"acquireNode2",
"allocates",
"a",
"machine",
"from",
"MAAS2",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L774-L815 |
154,428 | juju/juju | provider/maas/environ.go | acquireNode | func (env *maasEnviron) acquireNode(
ctx context.ProviderCallContext,
nodeName, zoneName, systemId string,
cons constraints.Value,
interfaces []interfaceBinding,
volumes []volumeInfo,
) (gomaasapi.MAASObject, error) {
// TODO(axw) 2014-08-18 #1358219
// We should be requesting preferred architectures if unspeci... | go | func (env *maasEnviron) acquireNode(
ctx context.ProviderCallContext,
nodeName, zoneName, systemId string,
cons constraints.Value,
interfaces []interfaceBinding,
volumes []volumeInfo,
) (gomaasapi.MAASObject, error) {
// TODO(axw) 2014-08-18 #1358219
// We should be requesting preferred architectures if unspeci... | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"acquireNode",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"nodeName",
",",
"zoneName",
",",
"systemId",
"string",
",",
"cons",
"constraints",
".",
"Value",
",",
"interfaces",
"[",
"]",
"interfaceBinding... | // acquireNode allocates a node from the MAAS. | [
"acquireNode",
"allocates",
"a",
"node",
"from",
"the",
"MAAS",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L818-L876 |
154,429 | juju/juju | provider/maas/environ.go | startNode | func (env *maasEnviron) startNode(node gomaasapi.MAASObject, series string, userdata []byte) (*gomaasapi.MAASObject, error) {
params := url.Values{
"distro_series": {series},
"user_data": {string(userdata)},
}
// Initialize err to a non-nil value as a sentinel for the following
// loop.
err := fmt.Errorf("... | go | func (env *maasEnviron) startNode(node gomaasapi.MAASObject, series string, userdata []byte) (*gomaasapi.MAASObject, error) {
params := url.Values{
"distro_series": {series},
"user_data": {string(userdata)},
}
// Initialize err to a non-nil value as a sentinel for the following
// loop.
err := fmt.Errorf("... | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"startNode",
"(",
"node",
"gomaasapi",
".",
"MAASObject",
",",
"series",
"string",
",",
"userdata",
"[",
"]",
"byte",
")",
"(",
"*",
"gomaasapi",
".",
"MAASObject",
",",
"error",
")",
"{",
"params",
":=",
"u... | // startNode installs and boots a node. | [
"startNode",
"installs",
"and",
"boots",
"a",
"node",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L879-L905 |
154,430 | juju/juju | provider/maas/environ.go | newCloudinitConfig | func (env *maasEnviron) newCloudinitConfig(hostname, forSeries string) (cloudinit.CloudConfig, error) {
cloudcfg, err := cloudinit.New(forSeries)
if err != nil {
return nil, err
}
info := machineInfo{hostname}
runCmd, err := info.cloudinitRunCmd(cloudcfg)
if err != nil {
return nil, errors.Trace(err)
}
op... | go | func (env *maasEnviron) newCloudinitConfig(hostname, forSeries string) (cloudinit.CloudConfig, error) {
cloudcfg, err := cloudinit.New(forSeries)
if err != nil {
return nil, err
}
info := machineInfo{hostname}
runCmd, err := info.cloudinitRunCmd(cloudcfg)
if err != nil {
return nil, errors.Trace(err)
}
op... | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"newCloudinitConfig",
"(",
"hostname",
",",
"forSeries",
"string",
")",
"(",
"cloudinit",
".",
"CloudConfig",
",",
"error",
")",
"{",
"cloudcfg",
",",
"err",
":=",
"cloudinit",
".",
"New",
"(",
"forSeries",
")",... | // newCloudinitConfig creates a cloudinit.Config structure suitable as a base
// for initialising a MAAS node. | [
"newCloudinitConfig",
"creates",
"a",
"cloudinit",
".",
"Config",
"structure",
"suitable",
"as",
"a",
"base",
"for",
"initialising",
"a",
"MAAS",
"node",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L1395-L1428 |
154,431 | juju/juju | provider/maas/environ.go | Instances | func (env *maasEnviron) Instances(ctx context.ProviderCallContext, ids []instance.Id) ([]instances.Instance, error) {
if len(ids) == 0 {
// This would be treated as "return all instances" below, so
// treat it as a special case.
// The interface requires us to return this particular error
// if no instances we... | go | func (env *maasEnviron) Instances(ctx context.ProviderCallContext, ids []instance.Id) ([]instances.Instance, error) {
if len(ids) == 0 {
// This would be treated as "return all instances" below, so
// treat it as a special case.
// The interface requires us to return this particular error
// if no instances we... | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"Instances",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"ids",
"[",
"]",
"instance",
".",
"Id",
")",
"(",
"[",
"]",
"instances",
".",
"Instance",
",",
"error",
")",
"{",
"if",
"len",
"(",
"ids... | // Instances returns the instances.Instance objects corresponding to the given
// slice of instance.Id. The error is ErrNoInstances if no instances
// were found. | [
"Instances",
"returns",
"the",
"instances",
".",
"Instance",
"objects",
"corresponding",
"to",
"the",
"given",
"slice",
"of",
"instance",
".",
"Id",
".",
"The",
"error",
"is",
"ErrNoInstances",
"if",
"no",
"instances",
"were",
"found",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L1568-L1604 |
154,432 | juju/juju | provider/maas/environ.go | instances1 | func (env *maasEnviron) instances1(ctx context.ProviderCallContext, filter url.Values) ([]instances.Instance, error) {
nodeListing := env.getMAASClient().GetSubObject("nodes")
listNodeObjects, err := nodeListing.CallGet("list", filter)
if err != nil {
common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
... | go | func (env *maasEnviron) instances1(ctx context.ProviderCallContext, filter url.Values) ([]instances.Instance, error) {
nodeListing := env.getMAASClient().GetSubObject("nodes")
listNodeObjects, err := nodeListing.CallGet("list", filter)
if err != nil {
common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
... | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"instances1",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"filter",
"url",
".",
"Values",
")",
"(",
"[",
"]",
"instances",
".",
"Instance",
",",
"error",
")",
"{",
"nodeListing",
":=",
"env",
".",
... | // instances calls the MAAS API to list nodes matching the given filter. | [
"instances",
"calls",
"the",
"MAAS",
"API",
"to",
"list",
"nodes",
"matching",
"the",
"given",
"filter",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L1625-L1650 |
154,433 | juju/juju | provider/maas/environ.go | subnetsFromNode | func (env *maasEnviron) subnetsFromNode(ctx context.ProviderCallContext, nodeId string) ([]gomaasapi.JSONObject, error) {
client := env.getMAASClient().GetSubObject("nodes").GetSubObject(nodeId)
json, err := client.CallGet("", nil)
if err != nil {
if maasErr, ok := errors.Cause(err).(gomaasapi.ServerError); ok && ... | go | func (env *maasEnviron) subnetsFromNode(ctx context.ProviderCallContext, nodeId string) ([]gomaasapi.JSONObject, error) {
client := env.getMAASClient().GetSubObject("nodes").GetSubObject(nodeId)
json, err := client.CallGet("", nil)
if err != nil {
if maasErr, ok := errors.Cause(err).(gomaasapi.ServerError); ok && ... | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"subnetsFromNode",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"nodeId",
"string",
")",
"(",
"[",
"]",
"gomaasapi",
".",
"JSONObject",
",",
"error",
")",
"{",
"client",
":=",
"env",
".",
"getMAASClie... | // subnetsFromNode fetches all the subnets for a specific node. | [
"subnetsFromNode",
"fetches",
"all",
"the",
"subnets",
"for",
"a",
"specific",
"node",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L1666-L1707 |
154,434 | juju/juju | provider/maas/environ.go | subnetFromJson | func (env *maasEnviron) subnetFromJson(subnet gomaasapi.JSONObject, spaceId network.Id) (network.SubnetInfo, error) {
var subnetInfo network.SubnetInfo
fields, err := subnet.GetMap()
if err != nil {
return subnetInfo, errors.Trace(err)
}
subnetIdFloat, err := fields["id"].GetFloat64()
if err != nil {
return s... | go | func (env *maasEnviron) subnetFromJson(subnet gomaasapi.JSONObject, spaceId network.Id) (network.SubnetInfo, error) {
var subnetInfo network.SubnetInfo
fields, err := subnet.GetMap()
if err != nil {
return subnetInfo, errors.Trace(err)
}
subnetIdFloat, err := fields["id"].GetFloat64()
if err != nil {
return s... | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"subnetFromJson",
"(",
"subnet",
"gomaasapi",
".",
"JSONObject",
",",
"spaceId",
"network",
".",
"Id",
")",
"(",
"network",
".",
"SubnetInfo",
",",
"error",
")",
"{",
"var",
"subnetInfo",
"network",
".",
"Subnet... | // subnetFromJson populates a network.SubnetInfo from a gomaasapi.JSONObject
// representing a single subnet. This can come from either the subnets api
// endpoint or the node endpoint. | [
"subnetFromJson",
"populates",
"a",
"network",
".",
"SubnetInfo",
"from",
"a",
"gomaasapi",
".",
"JSONObject",
"representing",
"a",
"single",
"subnet",
".",
"This",
"can",
"come",
"from",
"either",
"the",
"subnets",
"api",
"endpoint",
"or",
"the",
"node",
"end... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L1712-L1745 |
154,435 | juju/juju | provider/maas/environ.go | fetchAllSubnets | func (env *maasEnviron) fetchAllSubnets(ctx context.ProviderCallContext) ([]gomaasapi.JSONObject, error) {
client := env.getMAASClient().GetSubObject("subnets")
json, err := client.CallGet("", nil)
if err != nil {
common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
return nil, errors.Trace(err)
}
r... | go | func (env *maasEnviron) fetchAllSubnets(ctx context.ProviderCallContext) ([]gomaasapi.JSONObject, error) {
client := env.getMAASClient().GetSubObject("subnets")
json, err := client.CallGet("", nil)
if err != nil {
common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
return nil, errors.Trace(err)
}
r... | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"fetchAllSubnets",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
")",
"(",
"[",
"]",
"gomaasapi",
".",
"JSONObject",
",",
"error",
")",
"{",
"client",
":=",
"env",
".",
"getMAASClient",
"(",
")",
".",
"Ge... | // fetchAllSubnets calls the MAAS subnets API to get all subnets and returns the
// JSON response or an error. If capNetworkDeploymentUbuntu is not available, an
// error satisfying errors.IsNotSupported will be returned. | [
"fetchAllSubnets",
"calls",
"the",
"MAAS",
"subnets",
"API",
"to",
"get",
"all",
"subnets",
"and",
"returns",
"the",
"JSON",
"response",
"or",
"an",
"error",
".",
"If",
"capNetworkDeploymentUbuntu",
"is",
"not",
"available",
"an",
"error",
"satisfying",
"errors"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L1837-L1846 |
154,436 | juju/juju | provider/maas/environ.go | subnetToSpaceIds | func (env *maasEnviron) subnetToSpaceIds(ctx context.ProviderCallContext) (map[string]network.Id, error) {
subnetsMap := make(map[string]network.Id)
spaces, err := env.Spaces(ctx)
if err != nil {
return subnetsMap, errors.Trace(err)
}
for _, space := range spaces {
for _, subnet := range space.Subnets {
sub... | go | func (env *maasEnviron) subnetToSpaceIds(ctx context.ProviderCallContext) (map[string]network.Id, error) {
subnetsMap := make(map[string]network.Id)
spaces, err := env.Spaces(ctx)
if err != nil {
return subnetsMap, errors.Trace(err)
}
for _, space := range spaces {
for _, subnet := range space.Subnets {
sub... | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"subnetToSpaceIds",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
")",
"(",
"map",
"[",
"string",
"]",
"network",
".",
"Id",
",",
"error",
")",
"{",
"subnetsMap",
":=",
"make",
"(",
"map",
"[",
"string",
... | // subnetToSpaceIds fetches the spaces from MAAS and builds a map of subnets to
// space ids. | [
"subnetToSpaceIds",
"fetches",
"the",
"spaces",
"from",
"MAAS",
"and",
"builds",
"a",
"map",
"of",
"subnets",
"to",
"space",
"ids",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L1850-L1862 |
154,437 | juju/juju | provider/maas/environ.go | Spaces | func (env *maasEnviron) Spaces(ctx context.ProviderCallContext) ([]network.SpaceInfo, error) {
if !env.usingMAAS2() {
return env.spaces1(ctx)
}
return env.spaces2(ctx)
} | go | func (env *maasEnviron) Spaces(ctx context.ProviderCallContext) ([]network.SpaceInfo, error) {
if !env.usingMAAS2() {
return env.spaces1(ctx)
}
return env.spaces2(ctx)
} | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"Spaces",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
")",
"(",
"[",
"]",
"network",
".",
"SpaceInfo",
",",
"error",
")",
"{",
"if",
"!",
"env",
".",
"usingMAAS2",
"(",
")",
"{",
"return",
"env",
".... | // Spaces returns all the spaces, that have subnets, known to the provider.
// Space name is not filled in as the provider doesn't know the juju name for
// the space. | [
"Spaces",
"returns",
"all",
"the",
"spaces",
"that",
"have",
"subnets",
"known",
"to",
"the",
"provider",
".",
"Space",
"name",
"is",
"not",
"filled",
"in",
"as",
"the",
"provider",
"doesn",
"t",
"know",
"the",
"juju",
"name",
"for",
"the",
"space",
"."
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L1867-L1872 |
154,438 | juju/juju | provider/maas/environ.go | Subnets | func (env *maasEnviron) Subnets(ctx context.ProviderCallContext, instId instance.Id, subnetIds []network.Id) ([]network.SubnetInfo, error) {
if env.usingMAAS2() {
return env.subnets2(ctx, instId, subnetIds)
}
return env.subnets1(ctx, instId, subnetIds)
} | go | func (env *maasEnviron) Subnets(ctx context.ProviderCallContext, instId instance.Id, subnetIds []network.Id) ([]network.SubnetInfo, error) {
if env.usingMAAS2() {
return env.subnets2(ctx, instId, subnetIds)
}
return env.subnets1(ctx, instId, subnetIds)
} | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"Subnets",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"instId",
"instance",
".",
"Id",
",",
"subnetIds",
"[",
"]",
"network",
".",
"Id",
")",
"(",
"[",
"]",
"network",
".",
"SubnetInfo",
",",
"e... | // Subnets returns basic information about the specified subnets known
// by the provider for the specified instance. subnetIds must not be
// empty. Implements NetworkingEnviron.Subnets. | [
"Subnets",
"returns",
"basic",
"information",
"about",
"the",
"specified",
"subnets",
"known",
"by",
"the",
"provider",
"for",
"the",
"specified",
"instance",
".",
"subnetIds",
"must",
"not",
"be",
"empty",
".",
"Implements",
"NetworkingEnviron",
".",
"Subnets",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L1954-L1959 |
154,439 | juju/juju | provider/maas/environ.go | AllInstances | func (env *maasEnviron) AllInstances(ctx context.ProviderCallContext) ([]instances.Instance, error) {
return env.acquiredInstances(ctx, nil)
} | go | func (env *maasEnviron) AllInstances(ctx context.ProviderCallContext) ([]instances.Instance, error) {
return env.acquiredInstances(ctx, nil)
} | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"AllInstances",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
")",
"(",
"[",
"]",
"instances",
".",
"Instance",
",",
"error",
")",
"{",
"return",
"env",
".",
"acquiredInstances",
"(",
"ctx",
",",
"nil",
"... | // AllInstances returns all the instances.Instance in this provider. | [
"AllInstances",
"returns",
"all",
"the",
"instances",
".",
"Instance",
"in",
"this",
"provider",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L2080-L2082 |
154,440 | juju/juju | provider/maas/environ.go | Storage | func (env *maasEnviron) Storage() storage.Storage {
env.ecfgMutex.Lock()
defer env.ecfgMutex.Unlock()
return env.storageUnlocked
} | go | func (env *maasEnviron) Storage() storage.Storage {
env.ecfgMutex.Lock()
defer env.ecfgMutex.Unlock()
return env.storageUnlocked
} | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"Storage",
"(",
")",
"storage",
".",
"Storage",
"{",
"env",
".",
"ecfgMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"env",
".",
"ecfgMutex",
".",
"Unlock",
"(",
")",
"\n",
"return",
"env",
".",
"storageUnl... | // Storage is defined by the Environ interface. | [
"Storage",
"is",
"defined",
"by",
"the",
"Environ",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L2085-L2089 |
154,441 | juju/juju | provider/maas/environ.go | AdoptResources | func (env *maasEnviron) AdoptResources(ctx context.ProviderCallContext, controllerUUID string, fromVersion version.Number) error {
if !env.usingMAAS2() {
// We don't track instance -> controller for MAAS1.
return nil
}
instances, err := env.AllInstances(ctx)
if err != nil {
return errors.Trace(err)
}
var f... | go | func (env *maasEnviron) AdoptResources(ctx context.ProviderCallContext, controllerUUID string, fromVersion version.Number) error {
if !env.usingMAAS2() {
// We don't track instance -> controller for MAAS1.
return nil
}
instances, err := env.AllInstances(ctx)
if err != nil {
return errors.Trace(err)
}
var f... | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"AdoptResources",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"controllerUUID",
"string",
",",
"fromVersion",
"version",
".",
"Number",
")",
"error",
"{",
"if",
"!",
"env",
".",
"usingMAAS2",
"(",
")",... | // AdoptResources updates all the instances to indicate they
// are now associated with the specified controller. | [
"AdoptResources",
"updates",
"all",
"the",
"instances",
"to",
"indicate",
"they",
"are",
"now",
"associated",
"with",
"the",
"specified",
"controller",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L2368-L2400 |
154,442 | juju/juju | provider/maas/environ.go | AreSpacesRoutable | func (*maasEnviron) AreSpacesRoutable(ctx context.ProviderCallContext, space1, space2 *environs.ProviderSpaceInfo) (bool, error) {
return false, nil
} | go | func (*maasEnviron) AreSpacesRoutable(ctx context.ProviderCallContext, space1, space2 *environs.ProviderSpaceInfo) (bool, error) {
return false, nil
} | [
"func",
"(",
"*",
"maasEnviron",
")",
"AreSpacesRoutable",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"space1",
",",
"space2",
"*",
"environs",
".",
"ProviderSpaceInfo",
")",
"(",
"bool",
",",
"error",
")",
"{",
"return",
"false",
",",
"nil",
... | // AreSpacesRoutable implements environs.NetworkingEnviron. | [
"AreSpacesRoutable",
"implements",
"environs",
".",
"NetworkingEnviron",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L2408-L2410 |
154,443 | juju/juju | provider/maas/environ.go | Domains | func (env *maasEnviron) Domains(ctx context.ProviderCallContext) ([]string, error) {
maasDomains, err := env.maasController.Domains()
if err != nil {
common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
return nil, errors.Trace(err)
}
result := []string{}
for _, domain := range maasDomains {
result... | go | func (env *maasEnviron) Domains(ctx context.ProviderCallContext) ([]string, error) {
maasDomains, err := env.maasController.Domains()
if err != nil {
common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
return nil, errors.Trace(err)
}
result := []string{}
for _, domain := range maasDomains {
result... | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"Domains",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"maasDomains",
",",
"err",
":=",
"env",
".",
"maasController",
".",
"Domains",
"(",
")",
"\... | // Get the domains managed by MAAS. Currently we only need the name of the domain. If more information is needed
// This function can be updated to parse and return a structure. Client code would need to be updated. | [
"Get",
"the",
"domains",
"managed",
"by",
"MAAS",
".",
"Currently",
"we",
"only",
"need",
"the",
"name",
"of",
"the",
"domain",
".",
"If",
"more",
"information",
"is",
"needed",
"This",
"function",
"can",
"be",
"updated",
"to",
"parse",
"and",
"return",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/environ.go#L2424-L2435 |
154,444 | juju/juju | environs/imagemetadata.go | RegisterUserImageDataSourceFunc | func RegisterUserImageDataSourceFunc(id string, f ImageDataSourceFunc) {
datasourceFuncsMu.Lock()
defer datasourceFuncsMu.Unlock()
for i := range datasourceFuncs {
if datasourceFuncs[i].id == id {
datasourceFuncs[i].f = f
return
}
}
logger.Debugf("new user image datasource registered: %v", id)
datasourc... | go | func RegisterUserImageDataSourceFunc(id string, f ImageDataSourceFunc) {
datasourceFuncsMu.Lock()
defer datasourceFuncsMu.Unlock()
for i := range datasourceFuncs {
if datasourceFuncs[i].id == id {
datasourceFuncs[i].f = f
return
}
}
logger.Debugf("new user image datasource registered: %v", id)
datasourc... | [
"func",
"RegisterUserImageDataSourceFunc",
"(",
"id",
"string",
",",
"f",
"ImageDataSourceFunc",
")",
"{",
"datasourceFuncsMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"datasourceFuncsMu",
".",
"Unlock",
"(",
")",
"\n",
"for",
"i",
":=",
"range",
"datasourceFuncs"... | // RegisterUserImageDataSourceFunc registers an ImageDataSourceFunc
// with the specified id at the start of the search path, overwriting
// any function previously registered with the same id. | [
"RegisterUserImageDataSourceFunc",
"registers",
"an",
"ImageDataSourceFunc",
"with",
"the",
"specified",
"id",
"at",
"the",
"start",
"of",
"the",
"search",
"path",
"overwriting",
"any",
"function",
"previously",
"registered",
"with",
"the",
"same",
"id",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/imagemetadata.go#L37-L48 |
154,445 | juju/juju | environs/imagemetadata.go | UnregisterImageDataSourceFunc | func UnregisterImageDataSourceFunc(id string) {
datasourceFuncsMu.Lock()
defer datasourceFuncsMu.Unlock()
for i, f := range datasourceFuncs {
if f.id == id {
head := datasourceFuncs[:i]
tail := datasourceFuncs[i+1:]
datasourceFuncs = append(head, tail...)
return
}
}
} | go | func UnregisterImageDataSourceFunc(id string) {
datasourceFuncsMu.Lock()
defer datasourceFuncsMu.Unlock()
for i, f := range datasourceFuncs {
if f.id == id {
head := datasourceFuncs[:i]
tail := datasourceFuncs[i+1:]
datasourceFuncs = append(head, tail...)
return
}
}
} | [
"func",
"UnregisterImageDataSourceFunc",
"(",
"id",
"string",
")",
"{",
"datasourceFuncsMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"datasourceFuncsMu",
".",
"Unlock",
"(",
")",
"\n",
"for",
"i",
",",
"f",
":=",
"range",
"datasourceFuncs",
"{",
"if",
"f",
"... | // UnregisterImageDataSourceFunc unregisters an ImageDataSourceFunc
// with the specified id. | [
"UnregisterImageDataSourceFunc",
"unregisters",
"an",
"ImageDataSourceFunc",
"with",
"the",
"specified",
"id",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/imagemetadata.go#L68-L79 |
154,446 | juju/juju | environs/imagemetadata.go | ImageMetadataSources | func ImageMetadataSources(env BootstrapEnviron) ([]simplestreams.DataSource, error) {
config := env.Config()
// Add configured and environment-specific datasources.
var sources []simplestreams.DataSource
if userURL, ok := config.ImageMetadataURL(); ok {
verify := utils.VerifySSLHostnames
if !config.SSLHostname... | go | func ImageMetadataSources(env BootstrapEnviron) ([]simplestreams.DataSource, error) {
config := env.Config()
// Add configured and environment-specific datasources.
var sources []simplestreams.DataSource
if userURL, ok := config.ImageMetadataURL(); ok {
verify := utils.VerifySSLHostnames
if !config.SSLHostname... | [
"func",
"ImageMetadataSources",
"(",
"env",
"BootstrapEnviron",
")",
"(",
"[",
"]",
"simplestreams",
".",
"DataSource",
",",
"error",
")",
"{",
"config",
":=",
"env",
".",
"Config",
"(",
")",
"\n\n",
"// Add configured and environment-specific datasources.",
"var",
... | // ImageMetadataSources returns the sources to use when looking for
// simplestreams image id metadata for the given stream. | [
"ImageMetadataSources",
"returns",
"the",
"sources",
"to",
"use",
"when",
"looking",
"for",
"simplestreams",
"image",
"id",
"metadata",
"for",
"the",
"given",
"stream",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/imagemetadata.go#L83-L115 |
154,447 | juju/juju | environs/imagemetadata.go | environmentDataSources | func environmentDataSources(bootstrapEnviron BootstrapEnviron) ([]simplestreams.DataSource, error) {
datasourceFuncsMu.RLock()
defer datasourceFuncsMu.RUnlock()
var datasources []simplestreams.DataSource
env, ok := bootstrapEnviron.(Environ)
if !ok {
logger.Debugf("environmentDataSources is supported for IAAS, e... | go | func environmentDataSources(bootstrapEnviron BootstrapEnviron) ([]simplestreams.DataSource, error) {
datasourceFuncsMu.RLock()
defer datasourceFuncsMu.RUnlock()
var datasources []simplestreams.DataSource
env, ok := bootstrapEnviron.(Environ)
if !ok {
logger.Debugf("environmentDataSources is supported for IAAS, e... | [
"func",
"environmentDataSources",
"(",
"bootstrapEnviron",
"BootstrapEnviron",
")",
"(",
"[",
"]",
"simplestreams",
".",
"DataSource",
",",
"error",
")",
"{",
"datasourceFuncsMu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"datasourceFuncsMu",
".",
"RUnlock",
"(",
"... | // environmentDataSources returns simplestreams datasources for the environment
// by calling the functions registered in RegisterImageDataSourceFunc.
// The datasources returned will be in the same order the functions were registered. | [
"environmentDataSources",
"returns",
"simplestreams",
"datasources",
"for",
"the",
"environment",
"by",
"calling",
"the",
"functions",
"registered",
"in",
"RegisterImageDataSourceFunc",
".",
"The",
"datasources",
"returned",
"will",
"be",
"in",
"the",
"same",
"order",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/imagemetadata.go#L120-L141 |
154,448 | juju/juju | environs/config.go | UnregisterProvider | func (r *globalProviderRegistry) UnregisterProvider(providerType string) {
delete(r.providers, providerType)
for a, p := range r.aliases {
if p == providerType {
delete(r.aliases, a)
}
}
} | go | func (r *globalProviderRegistry) UnregisterProvider(providerType string) {
delete(r.providers, providerType)
for a, p := range r.aliases {
if p == providerType {
delete(r.aliases, a)
}
}
} | [
"func",
"(",
"r",
"*",
"globalProviderRegistry",
")",
"UnregisterProvider",
"(",
"providerType",
"string",
")",
"{",
"delete",
"(",
"r",
".",
"providers",
",",
"providerType",
")",
"\n",
"for",
"a",
",",
"p",
":=",
"range",
"r",
".",
"aliases",
"{",
"if"... | // UnregisterProvider removes the named provider from the list of available providers. | [
"UnregisterProvider",
"removes",
"the",
"named",
"provider",
"from",
"the",
"list",
"of",
"available",
"providers",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/config.go#L67-L74 |
154,449 | juju/juju | environs/config.go | RegisterProvider | func RegisterProvider(name string, p CloudEnvironProvider, alias ...string) (unregister func()) {
if err := GlobalProviderRegistry().RegisterProvider(p, name, alias...); err != nil {
panic(fmt.Errorf("juju: %v", err))
}
return func() {
GlobalProviderRegistry().UnregisterProvider(name)
}
} | go | func RegisterProvider(name string, p CloudEnvironProvider, alias ...string) (unregister func()) {
if err := GlobalProviderRegistry().RegisterProvider(p, name, alias...); err != nil {
panic(fmt.Errorf("juju: %v", err))
}
return func() {
GlobalProviderRegistry().UnregisterProvider(name)
}
} | [
"func",
"RegisterProvider",
"(",
"name",
"string",
",",
"p",
"CloudEnvironProvider",
",",
"alias",
"...",
"string",
")",
"(",
"unregister",
"func",
"(",
")",
")",
"{",
"if",
"err",
":=",
"GlobalProviderRegistry",
"(",
")",
".",
"RegisterProvider",
"(",
"p",
... | // RegisterProvider registers a new environment provider. Name gives the name
// of the provider, and p the interface to that provider.
//
// RegisterProvider will panic if the provider name or any of the aliases
// are registered more than once.
// The return function can be used to unregister the provider and is used... | [
"RegisterProvider",
"registers",
"a",
"new",
"environment",
"provider",
".",
"Name",
"gives",
"the",
"name",
"of",
"the",
"provider",
"and",
"p",
"the",
"interface",
"to",
"that",
"provider",
".",
"RegisterProvider",
"will",
"panic",
"if",
"the",
"provider",
"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/config.go#L103-L110 |
154,450 | juju/juju | logfwd/syslog/client.go | Open | func Open(cfg RawConfig) (*Client, error) {
client, err := OpenForSender(cfg, &senderOpener{})
return client, errors.Trace(err)
} | go | func Open(cfg RawConfig) (*Client, error) {
client, err := OpenForSender(cfg, &senderOpener{})
return client, errors.Trace(err)
} | [
"func",
"Open",
"(",
"cfg",
"RawConfig",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"client",
",",
"err",
":=",
"OpenForSender",
"(",
"cfg",
",",
"&",
"senderOpener",
"{",
"}",
")",
"\n",
"return",
"client",
",",
"errors",
".",
"Trace",
"(",
... | // Open connects to a remote syslog host and wraps that connection
// in a new client. | [
"Open",
"connects",
"to",
"a",
"remote",
"syslog",
"host",
"and",
"wraps",
"that",
"connection",
"in",
"a",
"new",
"client",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/logfwd/syslog/client.go#L55-L58 |
154,451 | juju/juju | logfwd/syslog/client.go | OpenForSender | func OpenForSender(cfg RawConfig, opener SenderOpener) (*Client, error) {
if err := cfg.Validate(); err != nil {
return nil, errors.Trace(err)
}
sender, err := open(cfg, opener)
if err != nil {
return nil, errors.Trace(err)
}
client := &Client{
Sender: sender,
}
return client, nil
} | go | func OpenForSender(cfg RawConfig, opener SenderOpener) (*Client, error) {
if err := cfg.Validate(); err != nil {
return nil, errors.Trace(err)
}
sender, err := open(cfg, opener)
if err != nil {
return nil, errors.Trace(err)
}
client := &Client{
Sender: sender,
}
return client, nil
} | [
"func",
"OpenForSender",
"(",
"cfg",
"RawConfig",
",",
"opener",
"SenderOpener",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"if",
"err",
":=",
"cfg",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
... | // OpenForSender connects to a remote syslog host and wraps that
// connection in a new client. | [
"OpenForSender",
"connects",
"to",
"a",
"remote",
"syslog",
"host",
"and",
"wraps",
"that",
"connection",
"in",
"a",
"new",
"client",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/logfwd/syslog/client.go#L62-L76 |
154,452 | juju/juju | logfwd/syslog/client.go | Close | func (client Client) Close() error {
err := client.Sender.Close()
return errors.Trace(err)
} | go | func (client Client) Close() error {
err := client.Sender.Close()
return errors.Trace(err)
} | [
"func",
"(",
"client",
"Client",
")",
"Close",
"(",
")",
"error",
"{",
"err",
":=",
"client",
".",
"Sender",
".",
"Close",
"(",
")",
"\n",
"return",
"errors",
".",
"Trace",
"(",
"err",
")",
"\n",
"}"
] | // Close closes the client's connection. | [
"Close",
"closes",
"the",
"client",
"s",
"connection",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/logfwd/syslog/client.go#L96-L99 |
154,453 | juju/juju | logfwd/syslog/client.go | Send | func (client Client) Send(records []logfwd.Record) error {
for _, rec := range records {
msg, err := messageFromRecord(rec)
if err != nil {
return errors.Trace(err)
}
if err := client.Sender.Send(msg); err != nil {
return errors.Trace(err)
}
}
return nil
} | go | func (client Client) Send(records []logfwd.Record) error {
for _, rec := range records {
msg, err := messageFromRecord(rec)
if err != nil {
return errors.Trace(err)
}
if err := client.Sender.Send(msg); err != nil {
return errors.Trace(err)
}
}
return nil
} | [
"func",
"(",
"client",
"Client",
")",
"Send",
"(",
"records",
"[",
"]",
"logfwd",
".",
"Record",
")",
"error",
"{",
"for",
"_",
",",
"rec",
":=",
"range",
"records",
"{",
"msg",
",",
"err",
":=",
"messageFromRecord",
"(",
"rec",
")",
"\n",
"if",
"e... | // Send sends the record to the remote syslog host. | [
"Send",
"sends",
"the",
"record",
"to",
"the",
"remote",
"syslog",
"host",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/logfwd/syslog/client.go#L102-L113 |
154,454 | juju/juju | mongo/collections.go | CollectionFromName | func CollectionFromName(db *mgo.Database, coll string) (Collection, func()) {
session := db.Session.Copy()
newColl := db.C(coll).With(session)
return WrapCollection(newColl), session.Close
} | go | func CollectionFromName(db *mgo.Database, coll string) (Collection, func()) {
session := db.Session.Copy()
newColl := db.C(coll).With(session)
return WrapCollection(newColl), session.Close
} | [
"func",
"CollectionFromName",
"(",
"db",
"*",
"mgo",
".",
"Database",
",",
"coll",
"string",
")",
"(",
"Collection",
",",
"func",
"(",
")",
")",
"{",
"session",
":=",
"db",
".",
"Session",
".",
"Copy",
"(",
")",
"\n",
"newColl",
":=",
"db",
".",
"C... | // CollectionFromName returns a named collection on the specified database,
// initialised with a new session. Also returned is a close function which
// must be called when the collection is no longer required. | [
"CollectionFromName",
"returns",
"a",
"named",
"collection",
"on",
"the",
"specified",
"database",
"initialised",
"with",
"a",
"new",
"session",
".",
"Also",
"returned",
"is",
"a",
"close",
"function",
"which",
"must",
"be",
"called",
"when",
"the",
"collection"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/mongo/collections.go#L15-L19 |
154,455 | juju/juju | mongo/collections.go | Find | func (cw collectionWrapper) Find(query interface{}) Query {
return queryWrapper{cw.Collection.Find(query)}
} | go | func (cw collectionWrapper) Find(query interface{}) Query {
return queryWrapper{cw.Collection.Find(query)}
} | [
"func",
"(",
"cw",
"collectionWrapper",
")",
"Find",
"(",
"query",
"interface",
"{",
"}",
")",
"Query",
"{",
"return",
"queryWrapper",
"{",
"cw",
".",
"Collection",
".",
"Find",
"(",
"query",
")",
"}",
"\n",
"}"
] | // Find is part of the Collection interface. | [
"Find",
"is",
"part",
"of",
"the",
"Collection",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/mongo/collections.go#L112-L114 |
154,456 | juju/juju | mongo/collections.go | Pipe | func (cw collectionWrapper) Pipe(pipeline interface{}) *mgo.Pipe {
return cw.Collection.Pipe(pipeline)
} | go | func (cw collectionWrapper) Pipe(pipeline interface{}) *mgo.Pipe {
return cw.Collection.Pipe(pipeline)
} | [
"func",
"(",
"cw",
"collectionWrapper",
")",
"Pipe",
"(",
"pipeline",
"interface",
"{",
"}",
")",
"*",
"mgo",
".",
"Pipe",
"{",
"return",
"cw",
".",
"Collection",
".",
"Pipe",
"(",
"pipeline",
")",
"\n",
"}"
] | // Pipe is part of the Collection interface | [
"Pipe",
"is",
"part",
"of",
"the",
"Collection",
"interface"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/mongo/collections.go#L117-L119 |
154,457 | juju/juju | mongo/collections.go | FindId | func (cw collectionWrapper) FindId(id interface{}) Query {
return queryWrapper{cw.Collection.FindId(id)}
} | go | func (cw collectionWrapper) FindId(id interface{}) Query {
return queryWrapper{cw.Collection.FindId(id)}
} | [
"func",
"(",
"cw",
"collectionWrapper",
")",
"FindId",
"(",
"id",
"interface",
"{",
"}",
")",
"Query",
"{",
"return",
"queryWrapper",
"{",
"cw",
".",
"Collection",
".",
"FindId",
"(",
"id",
")",
"}",
"\n",
"}"
] | // FindId is part of the Collection interface. | [
"FindId",
"is",
"part",
"of",
"the",
"Collection",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/mongo/collections.go#L122-L124 |
154,458 | juju/juju | cmd/juju/cloud/listcredentials.go | NewListCredentialsCommand | func NewListCredentialsCommand() cmd.Command {
return &listCredentialsCommand{
store: jujuclient.NewFileCredentialStore(),
cloudByNameFunc: jujucloud.CloudByName,
}
} | go | func NewListCredentialsCommand() cmd.Command {
return &listCredentialsCommand{
store: jujuclient.NewFileCredentialStore(),
cloudByNameFunc: jujucloud.CloudByName,
}
} | [
"func",
"NewListCredentialsCommand",
"(",
")",
"cmd",
".",
"Command",
"{",
"return",
"&",
"listCredentialsCommand",
"{",
"store",
":",
"jujuclient",
".",
"NewFileCredentialStore",
"(",
")",
",",
"cloudByNameFunc",
":",
"jujucloud",
".",
"CloudByName",
",",
"}",
... | // NewListCredentialsCommand returns a command to list cloud credentials. | [
"NewListCredentialsCommand",
"returns",
"a",
"command",
"to",
"list",
"cloud",
"credentials",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/cloud/listcredentials.go#L116-L121 |
154,459 | juju/juju | cmd/juju/cloud/listcredentials.go | formatCredentialsTabular | func formatCredentialsTabular(writer io.Writer, value interface{}) error {
credentials, ok := value.(credentialsMap)
if !ok {
return errors.Errorf("expected value of type %T, got %T", credentials, value)
}
if len(credentials.Credentials) == 0 {
fmt.Fprintln(writer, "No locally stored credentials to display.")
... | go | func formatCredentialsTabular(writer io.Writer, value interface{}) error {
credentials, ok := value.(credentialsMap)
if !ok {
return errors.Errorf("expected value of type %T, got %T", credentials, value)
}
if len(credentials.Credentials) == 0 {
fmt.Fprintln(writer, "No locally stored credentials to display.")
... | [
"func",
"formatCredentialsTabular",
"(",
"writer",
"io",
".",
"Writer",
",",
"value",
"interface",
"{",
"}",
")",
"error",
"{",
"credentials",
",",
"ok",
":=",
"value",
".",
"(",
"credentialsMap",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"errors",
".",... | // formatCredentialsTabular writes a tabular summary of cloud information. | [
"formatCredentialsTabular",
"writes",
"a",
"tabular",
"summary",
"of",
"cloud",
"information",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/cloud/listcredentials.go#L240-L283 |
154,460 | juju/juju | apiserver/facades/controller/instancepoller/instancepoller.go | NewFacade | func NewFacade(
st *state.State,
resources facade.Resources,
authorizer facade.Authorizer,
) (*InstancePollerAPI, error) {
m, err := st.Model()
if err != nil {
return nil, errors.Trace(err)
}
return NewInstancePollerAPI(st, m, resources, authorizer, clock.WallClock)
} | go | func NewFacade(
st *state.State,
resources facade.Resources,
authorizer facade.Authorizer,
) (*InstancePollerAPI, error) {
m, err := st.Model()
if err != nil {
return nil, errors.Trace(err)
}
return NewInstancePollerAPI(st, m, resources, authorizer, clock.WallClock)
} | [
"func",
"NewFacade",
"(",
"st",
"*",
"state",
".",
"State",
",",
"resources",
"facade",
".",
"Resources",
",",
"authorizer",
"facade",
".",
"Authorizer",
",",
")",
"(",
"*",
"InstancePollerAPI",
",",
"error",
")",
"{",
"m",
",",
"err",
":=",
"st",
".",... | // NewFacade wraps NewInstancePollerAPI for facade registration. | [
"NewFacade",
"wraps",
"NewInstancePollerAPI",
"for",
"facade",
"registration",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/instancepoller/instancepoller.go#L36-L46 |
154,461 | juju/juju | apiserver/facades/controller/instancepoller/instancepoller.go | NewInstancePollerAPI | func NewInstancePollerAPI(
st *state.State,
m *state.Model,
resources facade.Resources,
authorizer facade.Authorizer,
clock clock.Clock,
) (*InstancePollerAPI, error) {
if !authorizer.AuthController() {
// InstancePoller must run as a controller.
return nil, common.ErrPerm
}
accessMachine := common.AuthFun... | go | func NewInstancePollerAPI(
st *state.State,
m *state.Model,
resources facade.Resources,
authorizer facade.Authorizer,
clock clock.Clock,
) (*InstancePollerAPI, error) {
if !authorizer.AuthController() {
// InstancePoller must run as a controller.
return nil, common.ErrPerm
}
accessMachine := common.AuthFun... | [
"func",
"NewInstancePollerAPI",
"(",
"st",
"*",
"state",
".",
"State",
",",
"m",
"*",
"state",
".",
"Model",
",",
"resources",
"facade",
".",
"Resources",
",",
"authorizer",
"facade",
".",
"Authorizer",
",",
"clock",
"clock",
".",
"Clock",
",",
")",
"(",... | // NewInstancePollerAPI creates a new server-side InstancePoller API
// facade. | [
"NewInstancePollerAPI",
"creates",
"a",
"new",
"server",
"-",
"side",
"InstancePoller",
"API",
"facade",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/instancepoller/instancepoller.go#L50-L106 |
154,462 | juju/juju | apiserver/facades/controller/instancepoller/instancepoller.go | ProviderAddresses | func (a *InstancePollerAPI) ProviderAddresses(args params.Entities) (params.MachineAddressesResults, error) {
result := params.MachineAddressesResults{
Results: make([]params.MachineAddressesResult, len(args.Entities)),
}
canAccess, err := a.accessMachine()
if err != nil {
return result, err
}
for i, arg := r... | go | func (a *InstancePollerAPI) ProviderAddresses(args params.Entities) (params.MachineAddressesResults, error) {
result := params.MachineAddressesResults{
Results: make([]params.MachineAddressesResult, len(args.Entities)),
}
canAccess, err := a.accessMachine()
if err != nil {
return result, err
}
for i, arg := r... | [
"func",
"(",
"a",
"*",
"InstancePollerAPI",
")",
"ProviderAddresses",
"(",
"args",
"params",
".",
"Entities",
")",
"(",
"params",
".",
"MachineAddressesResults",
",",
"error",
")",
"{",
"result",
":=",
"params",
".",
"MachineAddressesResults",
"{",
"Results",
... | // ProviderAddresses returns the list of all known provider addresses
// for each given entity. Only machine tags are accepted. | [
"ProviderAddresses",
"returns",
"the",
"list",
"of",
"all",
"known",
"provider",
"addresses",
"for",
"each",
"given",
"entity",
".",
"Only",
"machine",
"tags",
"are",
"accepted",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/instancepoller/instancepoller.go#L131-L148 |
154,463 | juju/juju | apiserver/facades/controller/instancepoller/instancepoller.go | SetProviderAddresses | func (a *InstancePollerAPI) SetProviderAddresses(args params.SetMachinesAddresses) (params.ErrorResults, error) {
result := params.ErrorResults{
Results: make([]params.ErrorResult, len(args.MachineAddresses)),
}
canAccess, err := a.accessMachine()
if err != nil {
return result, err
}
for i, arg := range args.... | go | func (a *InstancePollerAPI) SetProviderAddresses(args params.SetMachinesAddresses) (params.ErrorResults, error) {
result := params.ErrorResults{
Results: make([]params.ErrorResult, len(args.MachineAddresses)),
}
canAccess, err := a.accessMachine()
if err != nil {
return result, err
}
for i, arg := range args.... | [
"func",
"(",
"a",
"*",
"InstancePollerAPI",
")",
"SetProviderAddresses",
"(",
"args",
"params",
".",
"SetMachinesAddresses",
")",
"(",
"params",
".",
"ErrorResults",
",",
"error",
")",
"{",
"result",
":=",
"params",
".",
"ErrorResults",
"{",
"Results",
":",
... | // SetProviderAddresses updates the list of known provider addresses
// for each given entity. Only machine tags are accepted. | [
"SetProviderAddresses",
"updates",
"the",
"list",
"of",
"known",
"provider",
"addresses",
"for",
"each",
"given",
"entity",
".",
"Only",
"machine",
"tags",
"are",
"accepted",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/instancepoller/instancepoller.go#L152-L169 |
154,464 | juju/juju | apiserver/facades/controller/instancepoller/instancepoller.go | SetInstanceStatus | func (a *InstancePollerAPI) SetInstanceStatus(args params.SetStatus) (params.ErrorResults, error) {
result := params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Entities)),
}
canAccess, err := a.accessMachine()
if err != nil {
return result, err
}
for i, arg := range args.Entities {
machine, ... | go | func (a *InstancePollerAPI) SetInstanceStatus(args params.SetStatus) (params.ErrorResults, error) {
result := params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Entities)),
}
canAccess, err := a.accessMachine()
if err != nil {
return result, err
}
for i, arg := range args.Entities {
machine, ... | [
"func",
"(",
"a",
"*",
"InstancePollerAPI",
")",
"SetInstanceStatus",
"(",
"args",
"params",
".",
"SetStatus",
")",
"(",
"params",
".",
"ErrorResults",
",",
"error",
")",
"{",
"result",
":=",
"params",
".",
"ErrorResults",
"{",
"Results",
":",
"make",
"(",... | // SetInstanceStatus updates the instance status for each given
// entity. Only machine tags are accepted. | [
"SetInstanceStatus",
"updates",
"the",
"instance",
"status",
"for",
"each",
"given",
"entity",
".",
"Only",
"machine",
"tags",
"are",
"accepted",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/instancepoller/instancepoller.go#L198-L227 |
154,465 | juju/juju | apiserver/allfacades.go | AdminFacadeDetails | func AdminFacadeDetails() []facade.Details {
var fs []facade.Details
for v, f := range adminAPIFactories {
api := f(nil, nil, nil)
t := reflect.TypeOf(api)
fs = append(fs, facade.Details{
Name: "Admin",
Version: v,
Type: t,
})
}
return fs
} | go | func AdminFacadeDetails() []facade.Details {
var fs []facade.Details
for v, f := range adminAPIFactories {
api := f(nil, nil, nil)
t := reflect.TypeOf(api)
fs = append(fs, facade.Details{
Name: "Admin",
Version: v,
Type: t,
})
}
return fs
} | [
"func",
"AdminFacadeDetails",
"(",
")",
"[",
"]",
"facade",
".",
"Details",
"{",
"var",
"fs",
"[",
"]",
"facade",
".",
"Details",
"\n",
"for",
"v",
",",
"f",
":=",
"range",
"adminAPIFactories",
"{",
"api",
":=",
"f",
"(",
"nil",
",",
"nil",
",",
"n... | // AdminFacadeDetails returns information on the Admin facade provided
// at login time. The Facade field of the returned slice elements will
// be nil. | [
"AdminFacadeDetails",
"returns",
"information",
"on",
"the",
"Admin",
"facade",
"provided",
"at",
"login",
"time",
".",
"The",
"Facade",
"field",
"of",
"the",
"returned",
"slice",
"elements",
"will",
"be",
"nil",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/allfacades.go#L342-L354 |
154,466 | juju/juju | provider/azure/config.go | isKnownStorageAccountType | func isKnownStorageAccountType(t string) bool {
for _, knownStorageAccountType := range knownStorageAccountTypes {
if t == knownStorageAccountType {
return true
}
}
return false
} | go | func isKnownStorageAccountType(t string) bool {
for _, knownStorageAccountType := range knownStorageAccountTypes {
if t == knownStorageAccountType {
return true
}
}
return false
} | [
"func",
"isKnownStorageAccountType",
"(",
"t",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"knownStorageAccountType",
":=",
"range",
"knownStorageAccountTypes",
"{",
"if",
"t",
"==",
"knownStorageAccountType",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
... | // isKnownStorageAccountType reports whether or not the given string identifies
// a known storage account type. | [
"isKnownStorageAccountType",
"reports",
"whether",
"or",
"not",
"the",
"given",
"string",
"identifies",
"a",
"known",
"storage",
"account",
"type",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/config.go#L130-L137 |
154,467 | juju/juju | provider/azure/config.go | canonicalLocation | func canonicalLocation(s string) string {
s = strings.Replace(s, " ", "", -1)
return strings.ToLower(s)
} | go | func canonicalLocation(s string) string {
s = strings.Replace(s, " ", "", -1)
return strings.ToLower(s)
} | [
"func",
"canonicalLocation",
"(",
"s",
"string",
")",
"string",
"{",
"s",
"=",
"strings",
".",
"Replace",
"(",
"s",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"return",
"strings",
".",
"ToLower",
"(",
"s",
")",
"\n",
"}"
] | // canonicalLocation returns the canonicalized location string. This involves
// stripping whitespace, and lowercasing. The ARM APIs do not support embedded
// whitespace, whereas the old Service Management APIs used to; we allow the
// user to provide either, and canonicalize them to one form that ARM allows. | [
"canonicalLocation",
"returns",
"the",
"canonicalized",
"location",
"string",
".",
"This",
"involves",
"stripping",
"whitespace",
"and",
"lowercasing",
".",
"The",
"ARM",
"APIs",
"do",
"not",
"support",
"embedded",
"whitespace",
"whereas",
"the",
"old",
"Service",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/config.go#L143-L146 |
154,468 | juju/juju | network/firewall.go | NewIngressRule | func NewIngressRule(protocol string, from, to int, sourceCIDRs ...string) (IngressRule, error) {
rule := IngressRule{
PortRange: network.PortRange{
Protocol: protocol,
FromPort: from,
ToPort: to,
},
}
for _, cidr := range sourceCIDRs {
if _, _, err := net.ParseCIDR(cidr); err != nil {
return Ingr... | go | func NewIngressRule(protocol string, from, to int, sourceCIDRs ...string) (IngressRule, error) {
rule := IngressRule{
PortRange: network.PortRange{
Protocol: protocol,
FromPort: from,
ToPort: to,
},
}
for _, cidr := range sourceCIDRs {
if _, _, err := net.ParseCIDR(cidr); err != nil {
return Ingr... | [
"func",
"NewIngressRule",
"(",
"protocol",
"string",
",",
"from",
",",
"to",
"int",
",",
"sourceCIDRs",
"...",
"string",
")",
"(",
"IngressRule",
",",
"error",
")",
"{",
"rule",
":=",
"IngressRule",
"{",
"PortRange",
":",
"network",
".",
"PortRange",
"{",
... | // NewIngressRule returns an IngressRule for the specified port
// range. If no explicit source ranges are specified, there is no
// restriction from where incoming traffic originates. | [
"NewIngressRule",
"returns",
"an",
"IngressRule",
"for",
"the",
"specified",
"port",
"range",
".",
"If",
"no",
"explicit",
"source",
"ranges",
"are",
"specified",
"there",
"is",
"no",
"restriction",
"from",
"where",
"incoming",
"traffic",
"originates",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/network/firewall.go#L31-L48 |
154,469 | juju/juju | network/firewall.go | MustNewIngressRule | func MustNewIngressRule(protocol string, from, to int, sourceCIDRs ...string) IngressRule {
rule, err := NewIngressRule(protocol, from, to, sourceCIDRs...)
if err != nil {
panic(err)
}
return rule
} | go | func MustNewIngressRule(protocol string, from, to int, sourceCIDRs ...string) IngressRule {
rule, err := NewIngressRule(protocol, from, to, sourceCIDRs...)
if err != nil {
panic(err)
}
return rule
} | [
"func",
"MustNewIngressRule",
"(",
"protocol",
"string",
",",
"from",
",",
"to",
"int",
",",
"sourceCIDRs",
"...",
"string",
")",
"IngressRule",
"{",
"rule",
",",
"err",
":=",
"NewIngressRule",
"(",
"protocol",
",",
"from",
",",
"to",
",",
"sourceCIDRs",
"... | // MustNewIngressRule returns an IngressRule for the specified port
// range. If no explicit source ranges are specified, there is no
// restriction from where incoming traffic originates.
// The method will panic if there is an error. | [
"MustNewIngressRule",
"returns",
"an",
"IngressRule",
"for",
"the",
"specified",
"port",
"range",
".",
"If",
"no",
"explicit",
"source",
"ranges",
"are",
"specified",
"there",
"is",
"no",
"restriction",
"from",
"where",
"incoming",
"traffic",
"originates",
".",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/network/firewall.go#L54-L60 |
154,470 | juju/juju | network/firewall.go | NewOpenIngressRule | func NewOpenIngressRule(protocol string, from, to int) IngressRule {
rule, _ := NewIngressRule(protocol, from, to)
return rule
} | go | func NewOpenIngressRule(protocol string, from, to int) IngressRule {
rule, _ := NewIngressRule(protocol, from, to)
return rule
} | [
"func",
"NewOpenIngressRule",
"(",
"protocol",
"string",
",",
"from",
",",
"to",
"int",
")",
"IngressRule",
"{",
"rule",
",",
"_",
":=",
"NewIngressRule",
"(",
"protocol",
",",
"from",
",",
"to",
")",
"\n",
"return",
"rule",
"\n",
"}"
] | // NewOpenIngressRule returns an IngressRule for the specified port
// range. There is no restriction from where incoming traffic originates. | [
"NewOpenIngressRule",
"returns",
"an",
"IngressRule",
"for",
"the",
"specified",
"port",
"range",
".",
"There",
"is",
"no",
"restriction",
"from",
"where",
"incoming",
"traffic",
"originates",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/network/firewall.go#L64-L67 |
154,471 | juju/juju | network/firewall.go | String | func (r IngressRule) String() string {
source := ""
from := strings.Join(r.SourceCIDRs, ",")
if from != "" && from != "0.0.0.0/0" {
source = " from " + from
}
if r.FromPort == r.ToPort {
return fmt.Sprintf("%d/%s%s", r.FromPort, strings.ToLower(r.Protocol), source)
}
return fmt.Sprintf("%d-%d/%s%s", r.FromPo... | go | func (r IngressRule) String() string {
source := ""
from := strings.Join(r.SourceCIDRs, ",")
if from != "" && from != "0.0.0.0/0" {
source = " from " + from
}
if r.FromPort == r.ToPort {
return fmt.Sprintf("%d/%s%s", r.FromPort, strings.ToLower(r.Protocol), source)
}
return fmt.Sprintf("%d-%d/%s%s", r.FromPo... | [
"func",
"(",
"r",
"IngressRule",
")",
"String",
"(",
")",
"string",
"{",
"source",
":=",
"\"",
"\"",
"\n",
"from",
":=",
"strings",
".",
"Join",
"(",
"r",
".",
"SourceCIDRs",
",",
"\"",
"\"",
")",
"\n",
"if",
"from",
"!=",
"\"",
"\"",
"&&",
"from... | // String is the string representation of IngressRule. | [
"String",
"is",
"the",
"string",
"representation",
"of",
"IngressRule",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/network/firewall.go#L70-L80 |
154,472 | juju/juju | state/container.go | removeContainerRefOps | func removeContainerRefOps(mb modelBackend, machineId string) []txn.Op {
removeRefOp := txn.Op{
C: containerRefsC,
Id: mb.docID(machineId),
Assert: txn.DocExists,
Remove: true,
}
// If the machine is a container, figure out its parent host.
parentId := ParentId(machineId)
if parentId == "" {
ret... | go | func removeContainerRefOps(mb modelBackend, machineId string) []txn.Op {
removeRefOp := txn.Op{
C: containerRefsC,
Id: mb.docID(machineId),
Assert: txn.DocExists,
Remove: true,
}
// If the machine is a container, figure out its parent host.
parentId := ParentId(machineId)
if parentId == "" {
ret... | [
"func",
"removeContainerRefOps",
"(",
"mb",
"modelBackend",
",",
"machineId",
"string",
")",
"[",
"]",
"txn",
".",
"Op",
"{",
"removeRefOp",
":=",
"txn",
".",
"Op",
"{",
"C",
":",
"containerRefsC",
",",
"Id",
":",
"mb",
".",
"docID",
"(",
"machineId",
... | // removeContainerRefOps returns the txn.Op's necessary to remove a machine container record.
// These include removing the record itself and updating the host machine's children property. | [
"removeContainerRefOps",
"returns",
"the",
"txn",
".",
"Op",
"s",
"necessary",
"to",
"remove",
"a",
"machine",
"container",
"record",
".",
"These",
"include",
"removing",
"the",
"record",
"itself",
"and",
"updating",
"the",
"host",
"machine",
"s",
"children",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/container.go#L47-L66 |
154,473 | juju/juju | state/container.go | ParentId | func ParentId(machineId string) string {
idParts := strings.Split(machineId, "/")
if len(idParts) < 3 {
return ""
}
return strings.Join(idParts[:len(idParts)-2], "/")
} | go | func ParentId(machineId string) string {
idParts := strings.Split(machineId, "/")
if len(idParts) < 3 {
return ""
}
return strings.Join(idParts[:len(idParts)-2], "/")
} | [
"func",
"ParentId",
"(",
"machineId",
"string",
")",
"string",
"{",
"idParts",
":=",
"strings",
".",
"Split",
"(",
"machineId",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"idParts",
")",
"<",
"3",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"ret... | // ParentId returns the id of the host machine if machineId a container id, or ""
// if machineId is not for a container. | [
"ParentId",
"returns",
"the",
"id",
"of",
"the",
"host",
"machine",
"if",
"machineId",
"a",
"container",
"id",
"or",
"if",
"machineId",
"is",
"not",
"for",
"a",
"container",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/container.go#L70-L76 |
154,474 | juju/juju | state/container.go | ContainerTypeFromId | func ContainerTypeFromId(machineId string) instance.ContainerType {
idParts := strings.Split(machineId, "/")
if len(idParts) < 3 {
return instance.ContainerType("")
}
return instance.ContainerType(idParts[len(idParts)-2])
} | go | func ContainerTypeFromId(machineId string) instance.ContainerType {
idParts := strings.Split(machineId, "/")
if len(idParts) < 3 {
return instance.ContainerType("")
}
return instance.ContainerType(idParts[len(idParts)-2])
} | [
"func",
"ContainerTypeFromId",
"(",
"machineId",
"string",
")",
"instance",
".",
"ContainerType",
"{",
"idParts",
":=",
"strings",
".",
"Split",
"(",
"machineId",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"idParts",
")",
"<",
"3",
"{",
"return",
"ins... | // ContainerTypeFromId returns the container type if machineId is a container id, or ""
// if machineId is not for a container. | [
"ContainerTypeFromId",
"returns",
"the",
"container",
"type",
"if",
"machineId",
"is",
"a",
"container",
"id",
"or",
"if",
"machineId",
"is",
"not",
"for",
"a",
"container",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/container.go#L80-L86 |
154,475 | juju/juju | state/container.go | NestingLevel | func NestingLevel(machineId string) int {
idParts := strings.Split(machineId, "/")
return (len(idParts) - 1) / 2
} | go | func NestingLevel(machineId string) int {
idParts := strings.Split(machineId, "/")
return (len(idParts) - 1) / 2
} | [
"func",
"NestingLevel",
"(",
"machineId",
"string",
")",
"int",
"{",
"idParts",
":=",
"strings",
".",
"Split",
"(",
"machineId",
",",
"\"",
"\"",
")",
"\n",
"return",
"(",
"len",
"(",
"idParts",
")",
"-",
"1",
")",
"/",
"2",
"\n",
"}"
] | // NestingLevel returns how many levels of nesting exist for a machine id. | [
"NestingLevel",
"returns",
"how",
"many",
"levels",
"of",
"nesting",
"exist",
"for",
"a",
"machine",
"id",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/container.go#L89-L92 |
154,476 | juju/juju | state/endpoint_bindings.go | createEndpointBindingsOp | func createEndpointBindingsOp(st *State, key string, givenMap map[string]string, meta *charm.Meta) (txn.Op, error) {
// No existing map to merge, just use the defaults.
initialMap, _, err := mergeBindings(givenMap, nil, meta)
if err != nil {
return txn.Op{}, errors.Trace(err)
}
// Validate the bindings before ... | go | func createEndpointBindingsOp(st *State, key string, givenMap map[string]string, meta *charm.Meta) (txn.Op, error) {
// No existing map to merge, just use the defaults.
initialMap, _, err := mergeBindings(givenMap, nil, meta)
if err != nil {
return txn.Op{}, errors.Trace(err)
}
// Validate the bindings before ... | [
"func",
"createEndpointBindingsOp",
"(",
"st",
"*",
"State",
",",
"key",
"string",
",",
"givenMap",
"map",
"[",
"string",
"]",
"string",
",",
"meta",
"*",
"charm",
".",
"Meta",
")",
"(",
"txn",
".",
"Op",
",",
"error",
")",
"{",
"// No existing map to me... | // createEndpointBindingsOp returns the op needed to create new endpoint
// bindings using the optional givenMap and the specified charm metadata to for
// determining defaults and to validate the effective bindings. | [
"createEndpointBindingsOp",
"returns",
"the",
"op",
"needed",
"to",
"create",
"new",
"endpoint",
"bindings",
"using",
"the",
"optional",
"givenMap",
"and",
"the",
"specified",
"charm",
"metadata",
"to",
"for",
"determining",
"defaults",
"and",
"to",
"validate",
"t... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/endpoint_bindings.go#L147-L168 |
154,477 | juju/juju | state/endpoint_bindings.go | updateEndpointBindingsOp | func updateEndpointBindingsOp(st *State, key string, givenMap map[string]string, newMeta *charm.Meta) (txn.Op, error) {
// Fetch existing bindings.
existingMap, txnRevno, err := readEndpointBindings(st, key)
if err != nil && !errors.IsNotFound(err) {
return txn.Op{}, errors.Trace(err)
}
// Merge existing with g... | go | func updateEndpointBindingsOp(st *State, key string, givenMap map[string]string, newMeta *charm.Meta) (txn.Op, error) {
// Fetch existing bindings.
existingMap, txnRevno, err := readEndpointBindings(st, key)
if err != nil && !errors.IsNotFound(err) {
return txn.Op{}, errors.Trace(err)
}
// Merge existing with g... | [
"func",
"updateEndpointBindingsOp",
"(",
"st",
"*",
"State",
",",
"key",
"string",
",",
"givenMap",
"map",
"[",
"string",
"]",
"string",
",",
"newMeta",
"*",
"charm",
".",
"Meta",
")",
"(",
"txn",
".",
"Op",
",",
"error",
")",
"{",
"// Fetch existing bin... | // updateEndpointBindingsOp returns an op that merges the existing bindings with
// givenMap, using newMeta to validate the merged bindings, and asserting the
// existing ones haven't changed in the since we fetched them. | [
"updateEndpointBindingsOp",
"returns",
"an",
"op",
"that",
"merges",
"the",
"existing",
"bindings",
"with",
"givenMap",
"using",
"newMeta",
"to",
"validate",
"the",
"merged",
"bindings",
"and",
"asserting",
"the",
"existing",
"ones",
"haven",
"t",
"changed",
"in",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/endpoint_bindings.go#L173-L211 |
154,478 | juju/juju | state/endpoint_bindings.go | removeEndpointBindingsOp | func removeEndpointBindingsOp(key string) txn.Op {
return txn.Op{
C: endpointBindingsC,
Id: key,
Remove: true,
}
} | go | func removeEndpointBindingsOp(key string) txn.Op {
return txn.Op{
C: endpointBindingsC,
Id: key,
Remove: true,
}
} | [
"func",
"removeEndpointBindingsOp",
"(",
"key",
"string",
")",
"txn",
".",
"Op",
"{",
"return",
"txn",
".",
"Op",
"{",
"C",
":",
"endpointBindingsC",
",",
"Id",
":",
"key",
",",
"Remove",
":",
"true",
",",
"}",
"\n",
"}"
] | // removeEndpointBindingsOp returns an op removing the bindings for the given
// key, without asserting they exist in the first place. | [
"removeEndpointBindingsOp",
"returns",
"an",
"op",
"removing",
"the",
"bindings",
"for",
"the",
"given",
"key",
"without",
"asserting",
"they",
"exist",
"in",
"the",
"first",
"place",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/endpoint_bindings.go#L215-L221 |
154,479 | juju/juju | provider/openstack/networking.go | DefaultNetworks | func (n *switchingNetworking) DefaultNetworks() ([]nova.ServerNetworks, error) {
if err := n.initNetworking(); err != nil {
return nil, errors.Trace(err)
}
return n.networking.DefaultNetworks()
} | go | func (n *switchingNetworking) DefaultNetworks() ([]nova.ServerNetworks, error) {
if err := n.initNetworking(); err != nil {
return nil, errors.Trace(err)
}
return n.networking.DefaultNetworks()
} | [
"func",
"(",
"n",
"*",
"switchingNetworking",
")",
"DefaultNetworks",
"(",
")",
"(",
"[",
"]",
"nova",
".",
"ServerNetworks",
",",
"error",
")",
"{",
"if",
"err",
":=",
"n",
".",
"initNetworking",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"ni... | // DefaultNetworks is part of the Networking interface. | [
"DefaultNetworks",
"is",
"part",
"of",
"the",
"Networking",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/openstack/networking.go#L100-L105 |
154,480 | juju/juju | provider/openstack/networking.go | NetworkInterfaces | func (n *switchingNetworking) NetworkInterfaces(instId instance.Id) ([]network.InterfaceInfo, error) {
if err := n.initNetworking(); err != nil {
return nil, errors.Trace(err)
}
return n.networking.NetworkInterfaces(instId)
} | go | func (n *switchingNetworking) NetworkInterfaces(instId instance.Id) ([]network.InterfaceInfo, error) {
if err := n.initNetworking(); err != nil {
return nil, errors.Trace(err)
}
return n.networking.NetworkInterfaces(instId)
} | [
"func",
"(",
"n",
"*",
"switchingNetworking",
")",
"NetworkInterfaces",
"(",
"instId",
"instance",
".",
"Id",
")",
"(",
"[",
"]",
"network",
".",
"InterfaceInfo",
",",
"error",
")",
"{",
"if",
"err",
":=",
"n",
".",
"initNetworking",
"(",
")",
";",
"er... | // NetworkInterfaces is part of the Networking interface | [
"NetworkInterfaces",
"is",
"part",
"of",
"the",
"Networking",
"interface"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/openstack/networking.go#L124-L129 |
154,481 | juju/juju | provider/openstack/networking.go | getExternalNeutronNetworksByAZ | func getExternalNeutronNetworksByAZ(e *Environ, azName string) ([]string, error) {
neutron := e.neutron()
// Find all external networks in availability zone
networks, err := neutron.ListNetworksV2(externalNetworkFilter())
if err != nil {
return nil, errors.Trace(err)
}
netIds := make([]string, 0)
for _, networ... | go | func getExternalNeutronNetworksByAZ(e *Environ, azName string) ([]string, error) {
neutron := e.neutron()
// Find all external networks in availability zone
networks, err := neutron.ListNetworksV2(externalNetworkFilter())
if err != nil {
return nil, errors.Trace(err)
}
netIds := make([]string, 0)
for _, networ... | [
"func",
"getExternalNeutronNetworksByAZ",
"(",
"e",
"*",
"Environ",
",",
"azName",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"neutron",
":=",
"e",
".",
"neutron",
"(",
")",
"\n",
"// Find all external networks in availability zone",
"networ... | // getExternalNeutronNetworksByAZ returns all external networks within the
// given availability zone. If azName is empty, return all external networks. | [
"getExternalNeutronNetworksByAZ",
"returns",
"all",
"external",
"networks",
"within",
"the",
"given",
"availability",
"zone",
".",
"If",
"azName",
"is",
"empty",
"return",
"all",
"external",
"networks",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/openstack/networking.go#L246-L266 |
154,482 | juju/juju | provider/openstack/networking.go | Subnets | func (n *NeutronNetworking) Subnets(instId instance.Id, subnetIds []network.Id) ([]network.SubnetInfo, error) {
netIds := set.NewStrings()
neutron := n.env.neutron()
internalNet := n.env.ecfg().network()
netId, err := resolveNeutronNetwork(neutron, internalNet, false)
if err != nil {
// Note: (jam 2018-05-23) We... | go | func (n *NeutronNetworking) Subnets(instId instance.Id, subnetIds []network.Id) ([]network.SubnetInfo, error) {
netIds := set.NewStrings()
neutron := n.env.neutron()
internalNet := n.env.ecfg().network()
netId, err := resolveNeutronNetwork(neutron, internalNet, false)
if err != nil {
// Note: (jam 2018-05-23) We... | [
"func",
"(",
"n",
"*",
"NeutronNetworking",
")",
"Subnets",
"(",
"instId",
"instance",
".",
"Id",
",",
"subnetIds",
"[",
"]",
"network",
".",
"Id",
")",
"(",
"[",
"]",
"network",
".",
"SubnetInfo",
",",
"error",
")",
"{",
"netIds",
":=",
"set",
".",
... | // Subnets returns basic information about the specified subnets known
// by the provider for the specified instance or list of ids. subnetIds can be
// empty, in which case all known are returned. | [
"Subnets",
"returns",
"basic",
"information",
"about",
"the",
"specified",
"subnets",
"known",
"by",
"the",
"provider",
"for",
"the",
"specified",
"instance",
"or",
"list",
"of",
"ids",
".",
"subnetIds",
"can",
"be",
"empty",
"in",
"which",
"case",
"all",
"k... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/openstack/networking.go#L329-L408 |
154,483 | juju/juju | container/lxd/cluster.go | UseTargetServer | func (s Server) UseTargetServer(name string) (*Server, error) {
logger.Debugf("creating LXD server for cluster node %q", name)
return NewServer(s.UseTarget(name))
} | go | func (s Server) UseTargetServer(name string) (*Server, error) {
logger.Debugf("creating LXD server for cluster node %q", name)
return NewServer(s.UseTarget(name))
} | [
"func",
"(",
"s",
"Server",
")",
"UseTargetServer",
"(",
"name",
"string",
")",
"(",
"*",
"Server",
",",
"error",
")",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"return",
"NewServer",
"(",
"s",
".",
"UseTarget",
"(",
"n... | // UseTargetServer returns a new Server based on the input target node name.
// It is intended for use when operations must target specific nodes in a
// cluster. | [
"UseTargetServer",
"returns",
"a",
"new",
"Server",
"based",
"on",
"the",
"input",
"target",
"node",
"name",
".",
"It",
"is",
"intended",
"for",
"use",
"when",
"operations",
"must",
"target",
"specific",
"nodes",
"in",
"a",
"cluster",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/lxd/cluster.go#L13-L16 |
154,484 | juju/juju | apiserver/facades/agent/instancemutater/mocks/state_mock.go | NewMockEntityFinder | func NewMockEntityFinder(ctrl *gomock.Controller) *MockEntityFinder {
mock := &MockEntityFinder{ctrl: ctrl}
mock.recorder = &MockEntityFinderMockRecorder{mock}
return mock
} | go | func NewMockEntityFinder(ctrl *gomock.Controller) *MockEntityFinder {
mock := &MockEntityFinder{ctrl: ctrl}
mock.recorder = &MockEntityFinderMockRecorder{mock}
return mock
} | [
"func",
"NewMockEntityFinder",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockEntityFinder",
"{",
"mock",
":=",
"&",
"MockEntityFinder",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockEntityFinderMockRecorder",
"{",... | // NewMockEntityFinder creates a new mock instance | [
"NewMockEntityFinder",
"creates",
"a",
"new",
"mock",
"instance"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/state_mock.go#L26-L30 |
154,485 | juju/juju | apiserver/facades/agent/instancemutater/mocks/state_mock.go | NewMockEntity | func NewMockEntity(ctrl *gomock.Controller) *MockEntity {
mock := &MockEntity{ctrl: ctrl}
mock.recorder = &MockEntityMockRecorder{mock}
return mock
} | go | func NewMockEntity(ctrl *gomock.Controller) *MockEntity {
mock := &MockEntity{ctrl: ctrl}
mock.recorder = &MockEntityMockRecorder{mock}
return mock
} | [
"func",
"NewMockEntity",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockEntity",
"{",
"mock",
":=",
"&",
"MockEntity",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockEntityMockRecorder",
"{",
"mock",
"}",
"\n"... | // NewMockEntity creates a new mock instance | [
"NewMockEntity",
"creates",
"a",
"new",
"mock",
"instance"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/state_mock.go#L62-L66 |
154,486 | juju/juju | apiserver/facades/agent/instancemutater/mocks/state_mock.go | Tag | func (mr *MockEntityMockRecorder) Tag() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tag", reflect.TypeOf((*MockEntity)(nil).Tag))
} | go | func (mr *MockEntityMockRecorder) Tag() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tag", reflect.TypeOf((*MockEntity)(nil).Tag))
} | [
"func",
"(",
"mr",
"*",
"MockEntityMockRecorder",
")",
"Tag",
"(",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
... | // Tag indicates an expected call of Tag | [
"Tag",
"indicates",
"an",
"expected",
"call",
"of",
"Tag"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/state_mock.go#L81-L83 |
154,487 | juju/juju | apiserver/facades/agent/instancemutater/mocks/state_mock.go | NewMockLifer | func NewMockLifer(ctrl *gomock.Controller) *MockLifer {
mock := &MockLifer{ctrl: ctrl}
mock.recorder = &MockLiferMockRecorder{mock}
return mock
} | go | func NewMockLifer(ctrl *gomock.Controller) *MockLifer {
mock := &MockLifer{ctrl: ctrl}
mock.recorder = &MockLiferMockRecorder{mock}
return mock
} | [
"func",
"NewMockLifer",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockLifer",
"{",
"mock",
":=",
"&",
"MockLifer",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockLiferMockRecorder",
"{",
"mock",
"}",
"\n",
... | // NewMockLifer creates a new mock instance | [
"NewMockLifer",
"creates",
"a",
"new",
"mock",
"instance"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/state_mock.go#L97-L101 |
154,488 | juju/juju | provider/maas/devices.go | checkForExistingDevice | func (env *maasEnviron) checkForExistingDevice(params deviceCreatorParams) (gomaasapi.Device, error) {
devicesArgs := gomaasapi.DevicesArgs{
Hostname: []string{params.Name},
}
maybeDevices, err := params.Machine.Devices(devicesArgs)
if err != nil {
logger.Warningf("error while trying to lookup %q: %v", params.N... | go | func (env *maasEnviron) checkForExistingDevice(params deviceCreatorParams) (gomaasapi.Device, error) {
devicesArgs := gomaasapi.DevicesArgs{
Hostname: []string{params.Name},
}
maybeDevices, err := params.Machine.Devices(devicesArgs)
if err != nil {
logger.Warningf("error while trying to lookup %q: %v", params.N... | [
"func",
"(",
"env",
"*",
"maasEnviron",
")",
"checkForExistingDevice",
"(",
"params",
"deviceCreatorParams",
")",
"(",
"gomaasapi",
".",
"Device",
",",
"error",
")",
"{",
"devicesArgs",
":=",
"gomaasapi",
".",
"DevicesArgs",
"{",
"Hostname",
":",
"[",
"]",
"... | // checkForExistingDevice checks to see if we've already registered a device
// with this name, and if its information is appropriately populated. If we
// have, then we just return the existing interface info. If we find it, but
// it doesn't match, then we ask MAAS to remove it, which should cause the
// calling code... | [
"checkForExistingDevice",
"checks",
"to",
"see",
"if",
"we",
"ve",
"already",
"registered",
"a",
"device",
"with",
"this",
"name",
"and",
"if",
"its",
"information",
"is",
"appropriately",
"populated",
".",
"If",
"we",
"have",
"then",
"we",
"just",
"return",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/devices.go#L580-L614 |
154,489 | juju/juju | cmd/juju/crossmodel/showformatter.go | formatShowTabular | func formatShowTabular(writer io.Writer, value interface{}) error {
endpoints, ok := value.(map[string]ShowOfferedApplication)
if !ok {
return errors.Errorf("expected value of type %T, got %T", endpoints, value)
}
return formatOfferedEndpointsTabular(writer, endpoints)
} | go | func formatShowTabular(writer io.Writer, value interface{}) error {
endpoints, ok := value.(map[string]ShowOfferedApplication)
if !ok {
return errors.Errorf("expected value of type %T, got %T", endpoints, value)
}
return formatOfferedEndpointsTabular(writer, endpoints)
} | [
"func",
"formatShowTabular",
"(",
"writer",
"io",
".",
"Writer",
",",
"value",
"interface",
"{",
"}",
")",
"error",
"{",
"endpoints",
",",
"ok",
":=",
"value",
".",
"(",
"map",
"[",
"string",
"]",
"ShowOfferedApplication",
")",
"\n",
"if",
"!",
"ok",
"... | // formatShowTabular returns a tabular summary of remote applications or
// errors out if parameter is not of expected type. | [
"formatShowTabular",
"returns",
"a",
"tabular",
"summary",
"of",
"remote",
"applications",
"or",
"errors",
"out",
"if",
"parameter",
"is",
"not",
"of",
"expected",
"type",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/crossmodel/showformatter.go#L28-L34 |
154,490 | juju/juju | cmd/juju/crossmodel/showformatter.go | formatOfferedEndpointsTabular | func formatOfferedEndpointsTabular(writer io.Writer, all map[string]ShowOfferedApplication) error {
tw := output.TabWriter(writer)
w := output.Wrapper{tw}
w.Println("Store", "URL", "Access", "Description", "Endpoint", "Interface", "Role")
for urlStr, one := range all {
url, err := crossmodel.ParseOfferURL(urlSt... | go | func formatOfferedEndpointsTabular(writer io.Writer, all map[string]ShowOfferedApplication) error {
tw := output.TabWriter(writer)
w := output.Wrapper{tw}
w.Println("Store", "URL", "Access", "Description", "Endpoint", "Interface", "Role")
for urlStr, one := range all {
url, err := crossmodel.ParseOfferURL(urlSt... | [
"func",
"formatOfferedEndpointsTabular",
"(",
"writer",
"io",
".",
"Writer",
",",
"all",
"map",
"[",
"string",
"]",
"ShowOfferedApplication",
")",
"error",
"{",
"tw",
":=",
"output",
".",
"TabWriter",
"(",
"writer",
")",
"\n",
"w",
":=",
"output",
".",
"Wr... | // formatOfferedEndpointsTabular returns a tabular summary of offered applications' endpoints. | [
"formatOfferedEndpointsTabular",
"returns",
"a",
"tabular",
"summary",
"of",
"offered",
"applications",
"endpoints",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/crossmodel/showformatter.go#L37-L82 |
154,491 | juju/juju | cmd/juju/commands/bootstrap_interactive.go | queryCloud | func queryCloud(clouds []string, defCloud string, scanner *bufio.Scanner, w io.Writer) (string, error) {
list := strings.Join(clouds, "\n")
if _, err := fmt.Fprint(w, "Clouds\n", list, "\n\n"); err != nil {
return "", errors.Trace(err)
}
// add support for a default (empty) selection.
clouds = append(clouds, ""... | go | func queryCloud(clouds []string, defCloud string, scanner *bufio.Scanner, w io.Writer) (string, error) {
list := strings.Join(clouds, "\n")
if _, err := fmt.Fprint(w, "Clouds\n", list, "\n\n"); err != nil {
return "", errors.Trace(err)
}
// add support for a default (empty) selection.
clouds = append(clouds, ""... | [
"func",
"queryCloud",
"(",
"clouds",
"[",
"]",
"string",
",",
"defCloud",
"string",
",",
"scanner",
"*",
"bufio",
".",
"Scanner",
",",
"w",
"io",
".",
"Writer",
")",
"(",
"string",
",",
"error",
")",
"{",
"list",
":=",
"strings",
".",
"Join",
"(",
... | // queryCloud asks the user to choose a cloud. | [
"queryCloud",
"asks",
"the",
"user",
"to",
"choose",
"a",
"cloud",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/bootstrap_interactive.go#L42-L72 |
154,492 | juju/juju | cmd/juju/commands/bootstrap_interactive.go | queryRegion | func queryRegion(cloud string, regions []jujucloud.Region, scanner *bufio.Scanner, w io.Writer) (string, error) {
fmt.Fprintf(w, "Regions in %s:\n", cloud)
names := jujucloud.RegionNames(regions)
// add an empty string to allow for a default value. Also gives us an extra
// line return after the list of names.
nam... | go | func queryRegion(cloud string, regions []jujucloud.Region, scanner *bufio.Scanner, w io.Writer) (string, error) {
fmt.Fprintf(w, "Regions in %s:\n", cloud)
names := jujucloud.RegionNames(regions)
// add an empty string to allow for a default value. Also gives us an extra
// line return after the list of names.
nam... | [
"func",
"queryRegion",
"(",
"cloud",
"string",
",",
"regions",
"[",
"]",
"jujucloud",
".",
"Region",
",",
"scanner",
"*",
"bufio",
".",
"Scanner",
",",
"w",
"io",
".",
"Writer",
")",
"(",
"string",
",",
"error",
")",
"{",
"fmt",
".",
"Fprintf",
"(",
... | // queryRegion asks the user to pick a region of the ones passed in. The first
// region in the list will be the default. | [
"queryRegion",
"asks",
"the",
"user",
"to",
"pick",
"a",
"region",
"of",
"the",
"ones",
"passed",
"in",
".",
"The",
"first",
"region",
"in",
"the",
"list",
"will",
"be",
"the",
"default",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/bootstrap_interactive.go#L76-L102 |
154,493 | juju/juju | worker/uniter/relation/relations.go | NextOp | func (s *relationsResolver) NextOp(
localState resolver.LocalState,
remoteState remotestate.Snapshot,
opFactory operation.Factory,
) (operation.Operation, error) {
hook, err := s.relations.NextHook(localState, remoteState)
if err != nil {
return nil, errors.Trace(err)
}
return opFactory.NewRunHook(hook)
} | go | func (s *relationsResolver) NextOp(
localState resolver.LocalState,
remoteState remotestate.Snapshot,
opFactory operation.Factory,
) (operation.Operation, error) {
hook, err := s.relations.NextHook(localState, remoteState)
if err != nil {
return nil, errors.Trace(err)
}
return opFactory.NewRunHook(hook)
} | [
"func",
"(",
"s",
"*",
"relationsResolver",
")",
"NextOp",
"(",
"localState",
"resolver",
".",
"LocalState",
",",
"remoteState",
"remotestate",
".",
"Snapshot",
",",
"opFactory",
"operation",
".",
"Factory",
",",
")",
"(",
"operation",
".",
"Operation",
",",
... | // NextOp implements resolver.Resolver. | [
"NextOp",
"implements",
"resolver",
".",
"Resolver",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/relation/relations.go#L63-L73 |
154,494 | juju/juju | worker/uniter/relation/relations.go | NewRelations | func NewRelations(config RelationsConfig) (Relations, error) {
unit, err := config.State.Unit(config.UnitTag)
if err != nil {
return nil, errors.Trace(err)
}
principalName, subordinate, err := unit.PrincipalName()
if err != nil {
return nil, errors.Trace(err)
}
leadershipContext := config.NewLeadershipContex... | go | func NewRelations(config RelationsConfig) (Relations, error) {
unit, err := config.State.Unit(config.UnitTag)
if err != nil {
return nil, errors.Trace(err)
}
principalName, subordinate, err := unit.PrincipalName()
if err != nil {
return nil, errors.Trace(err)
}
leadershipContext := config.NewLeadershipContex... | [
"func",
"NewRelations",
"(",
"config",
"RelationsConfig",
")",
"(",
"Relations",
",",
"error",
")",
"{",
"unit",
",",
"err",
":=",
"config",
".",
"State",
".",
"Unit",
"(",
"config",
".",
"UnitTag",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | // NewRelations returns a new Relations instance. | [
"NewRelations",
"returns",
"a",
"new",
"Relations",
"instance",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/relation/relations.go#L104-L133 |
154,495 | juju/juju | worker/uniter/relation/relations.go | NextHook | func (r *relations) NextHook(
localState resolver.LocalState,
remoteState remotestate.Snapshot,
) (hook.Info, error) {
if remoteState.Life == params.Dying {
// The unit is Dying, so make sure all subordinates are dying.
var destroyAllSubordinates bool
for relationId, relationSnapshot := range remoteState.Rela... | go | func (r *relations) NextHook(
localState resolver.LocalState,
remoteState remotestate.Snapshot,
) (hook.Info, error) {
if remoteState.Life == params.Dying {
// The unit is Dying, so make sure all subordinates are dying.
var destroyAllSubordinates bool
for relationId, relationSnapshot := range remoteState.Rela... | [
"func",
"(",
"r",
"*",
"relations",
")",
"NextHook",
"(",
"localState",
"resolver",
".",
"LocalState",
",",
"remoteState",
"remotestate",
".",
"Snapshot",
",",
")",
"(",
"hook",
".",
"Info",
",",
"error",
")",
"{",
"if",
"remoteState",
".",
"Life",
"==",... | // NextHook implements Relations. | [
"NextHook",
"implements",
"Relations",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/relation/relations.go#L196-L256 |
154,496 | juju/juju | worker/uniter/relation/relations.go | nextRelationHook | func nextRelationHook(
dir *StateDir,
remote remotestate.RelationSnapshot,
remoteBroken bool,
) (hook.Info, error) {
local := dir.State()
// If there's a guaranteed next hook, return that.
relationId := local.RelationId
if local.ChangedPending != "" {
unitName := local.ChangedPending
return hook.Info{
Ki... | go | func nextRelationHook(
dir *StateDir,
remote remotestate.RelationSnapshot,
remoteBroken bool,
) (hook.Info, error) {
local := dir.State()
// If there's a guaranteed next hook, return that.
relationId := local.RelationId
if local.ChangedPending != "" {
unitName := local.ChangedPending
return hook.Info{
Ki... | [
"func",
"nextRelationHook",
"(",
"dir",
"*",
"StateDir",
",",
"remote",
"remotestate",
".",
"RelationSnapshot",
",",
"remoteBroken",
"bool",
",",
")",
"(",
"hook",
".",
"Info",
",",
"error",
")",
"{",
"local",
":=",
"dir",
".",
"State",
"(",
")",
"\n",
... | // nextRelationHook returns the next hook op that should be executed in the
// relation characterised by the supplied local and remote state; or an error
// if the states do not refer to the same relation; or ErrRelationUpToDate if
// no hooks need to be executed. | [
"nextRelationHook",
"returns",
"the",
"next",
"hook",
"op",
"that",
"should",
"be",
"executed",
"in",
"the",
"relation",
"characterised",
"by",
"the",
"supplied",
"local",
"and",
"remote",
"state",
";",
"or",
"an",
"error",
"if",
"the",
"states",
"do",
"not"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/relation/relations.go#L262-L365 |
154,497 | juju/juju | worker/uniter/relation/relations.go | Name | func (r *relations) Name(id int) (string, error) {
relationer, found := r.relationers[id]
if !found {
return "", errors.Errorf("unknown relation: %d", id)
}
return relationer.ru.Endpoint().Name, nil
} | go | func (r *relations) Name(id int) (string, error) {
relationer, found := r.relationers[id]
if !found {
return "", errors.Errorf("unknown relation: %d", id)
}
return relationer.ru.Endpoint().Name, nil
} | [
"func",
"(",
"r",
"*",
"relations",
")",
"Name",
"(",
"id",
"int",
")",
"(",
"string",
",",
"error",
")",
"{",
"relationer",
",",
"found",
":=",
"r",
".",
"relationers",
"[",
"id",
"]",
"\n",
"if",
"!",
"found",
"{",
"return",
"\"",
"\"",
",",
... | // Name is part of the Relations interface. | [
"Name",
"is",
"part",
"of",
"the",
"Relations",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/relation/relations.go#L368-L374 |
154,498 | juju/juju | worker/uniter/relation/relations.go | PrepareHook | func (r *relations) PrepareHook(hookInfo hook.Info) (string, error) {
if !hookInfo.Kind.IsRelation() {
return "", errors.Errorf("not a relation hook: %#v", hookInfo)
}
relationer, found := r.relationers[hookInfo.RelationId]
if !found {
return "", errors.Errorf("unknown relation: %d", hookInfo.RelationId)
}
re... | go | func (r *relations) PrepareHook(hookInfo hook.Info) (string, error) {
if !hookInfo.Kind.IsRelation() {
return "", errors.Errorf("not a relation hook: %#v", hookInfo)
}
relationer, found := r.relationers[hookInfo.RelationId]
if !found {
return "", errors.Errorf("unknown relation: %d", hookInfo.RelationId)
}
re... | [
"func",
"(",
"r",
"*",
"relations",
")",
"PrepareHook",
"(",
"hookInfo",
"hook",
".",
"Info",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"!",
"hookInfo",
".",
"Kind",
".",
"IsRelation",
"(",
")",
"{",
"return",
"\"",
"\"",
",",
"errors",
"."... | // PrepareHook is part of the Relations interface. | [
"PrepareHook",
"is",
"part",
"of",
"the",
"Relations",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/relation/relations.go#L377-L386 |
154,499 | juju/juju | worker/uniter/relation/relations.go | CommitHook | func (r *relations) CommitHook(hookInfo hook.Info) (err error) {
defer func() {
if err == nil && hookInfo.Kind == hooks.RelationBroken {
delete(r.relationers, hookInfo.RelationId)
}
}()
if !hookInfo.Kind.IsRelation() {
return errors.Errorf("not a relation hook: %#v", hookInfo)
}
relationer, found := r.rel... | go | func (r *relations) CommitHook(hookInfo hook.Info) (err error) {
defer func() {
if err == nil && hookInfo.Kind == hooks.RelationBroken {
delete(r.relationers, hookInfo.RelationId)
}
}()
if !hookInfo.Kind.IsRelation() {
return errors.Errorf("not a relation hook: %#v", hookInfo)
}
relationer, found := r.rel... | [
"func",
"(",
"r",
"*",
"relations",
")",
"CommitHook",
"(",
"hookInfo",
"hook",
".",
"Info",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
"==",
"nil",
"&&",
"hookInfo",
".",
"Kind",
"==",
"hooks",
".",
"RelationB... | // CommitHook is part of the Relations interface. | [
"CommitHook",
"is",
"part",
"of",
"the",
"Relations",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/relation/relations.go#L389-L403 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.