id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
156,600 | juju/juju | container/lxd/network.go | ensureDefaultNetworking | func (s *Server) ensureDefaultNetworking(profile *api.Profile, eTag string) error {
net, _, err := s.GetNetwork(network.DefaultLXDBridge)
if err != nil {
if !IsLXDNotFound(err) {
return errors.Trace(err)
}
req := api.NetworksPost{
Name: network.DefaultLXDBridge,
Type: "bridge",
Managed: true,
... | go | func (s *Server) ensureDefaultNetworking(profile *api.Profile, eTag string) error {
net, _, err := s.GetNetwork(network.DefaultLXDBridge)
if err != nil {
if !IsLXDNotFound(err) {
return errors.Trace(err)
}
req := api.NetworksPost{
Name: network.DefaultLXDBridge,
Type: "bridge",
Managed: true,
... | [
"func",
"(",
"s",
"*",
"Server",
")",
"ensureDefaultNetworking",
"(",
"profile",
"*",
"api",
".",
"Profile",
",",
"eTag",
"string",
")",
"error",
"{",
"net",
",",
"_",
",",
"err",
":=",
"s",
".",
"GetNetwork",
"(",
"network",
".",
"DefaultLXDBridge",
"... | // ensureDefaultNetworking ensures that the default LXD bridge exists,
// that it is not configured to use IPv6, and that a NIC device exists in
// the input profile.
// An error is returned if the bridge exists with IPv6 configuration.
// If the bridge does not exist, it is created. | [
"ensureDefaultNetworking",
"ensures",
"that",
"the",
"default",
"LXD",
"bridge",
"exists",
"that",
"it",
"is",
"not",
"configured",
"to",
"use",
"IPv6",
"and",
"that",
"a",
"NIC",
"device",
"exists",
"in",
"the",
"input",
"profile",
".",
"An",
"error",
"is",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/lxd/network.go#L132-L186 |
156,601 | juju/juju | container/lxd/network.go | verifyNICsWithAPI | func (s *Server) verifyNICsWithAPI(nics map[string]device) error {
checked := make([]string, 0, len(nics))
var ipV6ErrMsg error
for name, nic := range nics {
checked = append(checked, name)
if !isValidNICType(nic) {
continue
}
netName := nic["parent"]
if netName == "" {
continue
}
net, _, err ... | go | func (s *Server) verifyNICsWithAPI(nics map[string]device) error {
checked := make([]string, 0, len(nics))
var ipV6ErrMsg error
for name, nic := range nics {
checked = append(checked, name)
if !isValidNICType(nic) {
continue
}
netName := nic["parent"]
if netName == "" {
continue
}
net, _, err ... | [
"func",
"(",
"s",
"*",
"Server",
")",
"verifyNICsWithAPI",
"(",
"nics",
"map",
"[",
"string",
"]",
"device",
")",
"error",
"{",
"checked",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"nics",
")",
")",
"\n",
"var",
"ipV6ErrMsg"... | // verifyNICsWithAPI uses the LXD network API to check if one of the input NIC
// devices is suitable for LXD to work with Juju. | [
"verifyNICsWithAPI",
"uses",
"the",
"LXD",
"network",
"API",
"to",
"check",
"if",
"one",
"of",
"the",
"input",
"NIC",
"devices",
"is",
"suitable",
"for",
"LXD",
"to",
"work",
"with",
"Juju",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/lxd/network.go#L190-L231 |
156,602 | juju/juju | container/lxd/network.go | verifyNICsWithConfigFile | func (s *Server) verifyNICsWithConfigFile(nics map[string]device, reader func(string) ([]byte, error)) error {
netName, err := checkBridgeConfigFile(reader)
if err != nil {
return errors.Trace(err)
}
checked := make([]string, 0, len(nics))
for name, nic := range nics {
checked = append(checked, name)
if ni... | go | func (s *Server) verifyNICsWithConfigFile(nics map[string]device, reader func(string) ([]byte, error)) error {
netName, err := checkBridgeConfigFile(reader)
if err != nil {
return errors.Trace(err)
}
checked := make([]string, 0, len(nics))
for name, nic := range nics {
checked = append(checked, name)
if ni... | [
"func",
"(",
"s",
"*",
"Server",
")",
"verifyNICsWithConfigFile",
"(",
"nics",
"map",
"[",
"string",
"]",
"device",
",",
"reader",
"func",
"(",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
")",
"error",
"{",
"netName",
",",
"err",
":=",
... | // verifyNICsWithConfigFile is recruited for legacy LXD installations.
// It checks the LXD bridge configuration file and ensure that one of the input
// devices is suitable for LXD to work with Juju. | [
"verifyNICsWithConfigFile",
"is",
"recruited",
"for",
"legacy",
"LXD",
"installations",
".",
"It",
"checks",
"the",
"LXD",
"bridge",
"configuration",
"file",
"and",
"ensure",
"that",
"one",
"of",
"the",
"input",
"devices",
"is",
"suitable",
"for",
"LXD",
"to",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/lxd/network.go#L236-L260 |
156,603 | juju/juju | container/lxd/network.go | getProfileNICs | func getProfileNICs(profile *api.Profile) map[string]device {
nics := make(map[string]device, len(profile.Devices))
for k, v := range profile.Devices {
if v["type"] == nic {
nics[k] = v
}
}
return nics
} | go | func getProfileNICs(profile *api.Profile) map[string]device {
nics := make(map[string]device, len(profile.Devices))
for k, v := range profile.Devices {
if v["type"] == nic {
nics[k] = v
}
}
return nics
} | [
"func",
"getProfileNICs",
"(",
"profile",
"*",
"api",
".",
"Profile",
")",
"map",
"[",
"string",
"]",
"device",
"{",
"nics",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"device",
",",
"len",
"(",
"profile",
".",
"Devices",
")",
")",
"\n",
"for",
... | // getProfileNICs iterates over the devices in the input profile and returns
// any that are of type "nic". | [
"getProfileNICs",
"iterates",
"over",
"the",
"devices",
"in",
"the",
"input",
"profile",
"and",
"returns",
"any",
"that",
"are",
"of",
"type",
"nic",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/lxd/network.go#L286-L294 |
156,604 | juju/juju | container/lxd/network.go | InterfaceInfoFromDevices | func InterfaceInfoFromDevices(nics map[string]device) ([]network.InterfaceInfo, error) {
interfaces := make([]network.InterfaceInfo, len(nics))
var i int
for name, device := range nics {
iInfo := network.InterfaceInfo{
InterfaceName: name,
ParentInterfaceName: device["parent"],
MACAddress: ... | go | func InterfaceInfoFromDevices(nics map[string]device) ([]network.InterfaceInfo, error) {
interfaces := make([]network.InterfaceInfo, len(nics))
var i int
for name, device := range nics {
iInfo := network.InterfaceInfo{
InterfaceName: name,
ParentInterfaceName: device["parent"],
MACAddress: ... | [
"func",
"InterfaceInfoFromDevices",
"(",
"nics",
"map",
"[",
"string",
"]",
"device",
")",
"(",
"[",
"]",
"network",
".",
"InterfaceInfo",
",",
"error",
")",
"{",
"interfaces",
":=",
"make",
"(",
"[",
"]",
"network",
".",
"InterfaceInfo",
",",
"len",
"("... | // InterfaceInfoFromDevices returns a slice of interface info congruent with the
// input LXD NIC devices.
// The output is used to generate cloud-init user-data congruent with the NICs
// that end up in the container. | [
"InterfaceInfoFromDevices",
"returns",
"a",
"slice",
"of",
"interface",
"info",
"congruent",
"with",
"the",
"input",
"LXD",
"NIC",
"devices",
".",
"The",
"output",
"is",
"used",
"to",
"generate",
"cloud",
"-",
"init",
"user",
"-",
"data",
"congruent",
"with",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/lxd/network.go#L410-L434 |
156,605 | juju/juju | container/lxd/network.go | DevicesFromInterfaceInfo | func DevicesFromInterfaceInfo(interfaces []network.InterfaceInfo) (map[string]device, []string, error) {
nics := make(map[string]device, len(interfaces))
var unknown []string
for _, v := range interfaces {
if v.InterfaceType == network.LoopbackInterface {
continue
}
if v.InterfaceType != network.EthernetIn... | go | func DevicesFromInterfaceInfo(interfaces []network.InterfaceInfo) (map[string]device, []string, error) {
nics := make(map[string]device, len(interfaces))
var unknown []string
for _, v := range interfaces {
if v.InterfaceType == network.LoopbackInterface {
continue
}
if v.InterfaceType != network.EthernetIn... | [
"func",
"DevicesFromInterfaceInfo",
"(",
"interfaces",
"[",
"]",
"network",
".",
"InterfaceInfo",
")",
"(",
"map",
"[",
"string",
"]",
"device",
",",
"[",
"]",
"string",
",",
"error",
")",
"{",
"nics",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"dev... | // DevicesFromInterfaceInfo uses the input interface info collection to create a
// map of network device configuration in the LXD format.
// Names for any networks without a known CIDR are returned in a slice. | [
"DevicesFromInterfaceInfo",
"uses",
"the",
"input",
"interface",
"info",
"collection",
"to",
"create",
"a",
"map",
"of",
"network",
"device",
"configuration",
"in",
"the",
"LXD",
"format",
".",
"Names",
"for",
"any",
"networks",
"without",
"a",
"known",
"CIDR",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/container/lxd/network.go#L455-L476 |
156,606 | juju/juju | apiserver/common/setstatus.go | NewApplicationStatusSetter | func NewApplicationStatusSetter(st *state.State, getCanModify GetAuthFunc, leadershipChecker leadership.Checker) *ApplicationStatusSetter {
return &ApplicationStatusSetter{
leadershipChecker: leadershipChecker,
st: st,
getCanModify: getCanModify,
}
} | go | func NewApplicationStatusSetter(st *state.State, getCanModify GetAuthFunc, leadershipChecker leadership.Checker) *ApplicationStatusSetter {
return &ApplicationStatusSetter{
leadershipChecker: leadershipChecker,
st: st,
getCanModify: getCanModify,
}
} | [
"func",
"NewApplicationStatusSetter",
"(",
"st",
"*",
"state",
".",
"State",
",",
"getCanModify",
"GetAuthFunc",
",",
"leadershipChecker",
"leadership",
".",
"Checker",
")",
"*",
"ApplicationStatusSetter",
"{",
"return",
"&",
"ApplicationStatusSetter",
"{",
"leadershi... | // NewApplicationStatusSetter returns a ServiceStatusSetter. | [
"NewApplicationStatusSetter",
"returns",
"a",
"ServiceStatusSetter",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/setstatus.go#L31-L37 |
156,607 | juju/juju | apiserver/common/setstatus.go | SetStatus | func (s *ApplicationStatusSetter) SetStatus(args params.SetStatus) (params.ErrorResults, error) {
result := params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Entities)),
}
if len(args.Entities) == 0 {
return result, nil
}
canModify, err := s.getCanModify()
if err != nil {
return params.Erro... | go | func (s *ApplicationStatusSetter) SetStatus(args params.SetStatus) (params.ErrorResults, error) {
result := params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Entities)),
}
if len(args.Entities) == 0 {
return result, nil
}
canModify, err := s.getCanModify()
if err != nil {
return params.Erro... | [
"func",
"(",
"s",
"*",
"ApplicationStatusSetter",
")",
"SetStatus",
"(",
"args",
"params",
".",
"SetStatus",
")",
"(",
"params",
".",
"ErrorResults",
",",
"error",
")",
"{",
"result",
":=",
"params",
".",
"ErrorResults",
"{",
"Results",
":",
"make",
"(",
... | // SetStatus sets the status on the service given by the unit in args if the unit is the leader. | [
"SetStatus",
"sets",
"the",
"status",
"on",
"the",
"service",
"given",
"by",
"the",
"unit",
"in",
"args",
"if",
"the",
"unit",
"is",
"the",
"leader",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/setstatus.go#L40-L120 |
156,608 | juju/juju | apiserver/common/setstatus.go | NewStatusSetter | func NewStatusSetter(st state.EntityFinder, getCanModify GetAuthFunc) *StatusSetter {
return &StatusSetter{
st: st,
getCanModify: getCanModify,
}
} | go | func NewStatusSetter(st state.EntityFinder, getCanModify GetAuthFunc) *StatusSetter {
return &StatusSetter{
st: st,
getCanModify: getCanModify,
}
} | [
"func",
"NewStatusSetter",
"(",
"st",
"state",
".",
"EntityFinder",
",",
"getCanModify",
"GetAuthFunc",
")",
"*",
"StatusSetter",
"{",
"return",
"&",
"StatusSetter",
"{",
"st",
":",
"st",
",",
"getCanModify",
":",
"getCanModify",
",",
"}",
"\n",
"}"
] | // NewStatusSetter returns a new StatusSetter. The GetAuthFunc will be
// used on each invocation of SetStatus to determine current
// permissions. | [
"NewStatusSetter",
"returns",
"a",
"new",
"StatusSetter",
".",
"The",
"GetAuthFunc",
"will",
"be",
"used",
"on",
"each",
"invocation",
"of",
"SetStatus",
"to",
"determine",
"current",
"permissions",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/setstatus.go#L132-L137 |
156,609 | juju/juju | apiserver/common/setstatus.go | FindEntity | func (ua *UnitAgentFinder) FindEntity(tag names.Tag) (state.Entity, error) {
_, ok := tag.(names.UnitTag)
if !ok {
return nil, errors.Errorf("unsupported tag %T", tag)
}
entity, err := ua.EntityFinder.FindEntity(tag)
if err != nil {
return nil, errors.Trace(err)
}
// this returns a state.Unit, but for testin... | go | func (ua *UnitAgentFinder) FindEntity(tag names.Tag) (state.Entity, error) {
_, ok := tag.(names.UnitTag)
if !ok {
return nil, errors.Errorf("unsupported tag %T", tag)
}
entity, err := ua.EntityFinder.FindEntity(tag)
if err != nil {
return nil, errors.Trace(err)
}
// this returns a state.Unit, but for testin... | [
"func",
"(",
"ua",
"*",
"UnitAgentFinder",
")",
"FindEntity",
"(",
"tag",
"names",
".",
"Tag",
")",
"(",
"state",
".",
"Entity",
",",
"error",
")",
"{",
"_",
",",
"ok",
":=",
"tag",
".",
"(",
"names",
".",
"UnitTag",
")",
"\n",
"if",
"!",
"ok",
... | // FindEntity implements state.EntityFinder and returns unit agents. | [
"FindEntity",
"implements",
"state",
".",
"EntityFinder",
"and",
"returns",
"unit",
"agents",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/setstatus.go#L264-L276 |
156,610 | juju/juju | provider/maas/storage.go | addressFileObject | func (stor *maas1Storage) addressFileObject(name string) gomaasapi.MAASObject {
return stor.maasClient.GetSubObject(name)
} | go | func (stor *maas1Storage) addressFileObject(name string) gomaasapi.MAASObject {
return stor.maasClient.GetSubObject(name)
} | [
"func",
"(",
"stor",
"*",
"maas1Storage",
")",
"addressFileObject",
"(",
"name",
"string",
")",
"gomaasapi",
".",
"MAASObject",
"{",
"return",
"stor",
".",
"maasClient",
".",
"GetSubObject",
"(",
"name",
")",
"\n",
"}"
] | // addressFileObject creates a MAASObject pointing to a given file.
// Takes out a lock on the storage object to get a consistent view. | [
"addressFileObject",
"creates",
"a",
"MAASObject",
"pointing",
"to",
"a",
"given",
"file",
".",
"Takes",
"out",
"a",
"lock",
"on",
"the",
"storage",
"object",
"to",
"get",
"a",
"consistent",
"view",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/storage.go#L50-L52 |
156,611 | juju/juju | provider/maas/storage.go | retrieveFileObject | func (stor *maas1Storage) retrieveFileObject(name string) (gomaasapi.MAASObject, error) {
obj, err := stor.addressFileObject(name).Get()
if err != nil {
noObj := gomaasapi.MAASObject{}
serverErr, ok := errors.Cause(err).(gomaasapi.ServerError)
if ok && serverErr.StatusCode == 404 {
return noObj, errors.NotFo... | go | func (stor *maas1Storage) retrieveFileObject(name string) (gomaasapi.MAASObject, error) {
obj, err := stor.addressFileObject(name).Get()
if err != nil {
noObj := gomaasapi.MAASObject{}
serverErr, ok := errors.Cause(err).(gomaasapi.ServerError)
if ok && serverErr.StatusCode == 404 {
return noObj, errors.NotFo... | [
"func",
"(",
"stor",
"*",
"maas1Storage",
")",
"retrieveFileObject",
"(",
"name",
"string",
")",
"(",
"gomaasapi",
".",
"MAASObject",
",",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"stor",
".",
"addressFileObject",
"(",
"name",
")",
".",
"Get",
"(",
... | // retrieveFileObject retrieves the information of the named file,
// including its download URL and its contents, as a MAASObject.
//
// This may return many different errors, but specifically, it returns
// an error that satisfies errors.IsNotFound if the file did not
// exist.
//
// The function takes out a lock on ... | [
"retrieveFileObject",
"retrieves",
"the",
"information",
"of",
"the",
"named",
"file",
"including",
"its",
"download",
"URL",
"and",
"its",
"contents",
"as",
"a",
"MAASObject",
".",
"This",
"may",
"return",
"many",
"different",
"errors",
"but",
"specifically",
"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/storage.go#L73-L85 |
156,612 | juju/juju | provider/maas/storage.go | Get | func (stor *maas1Storage) Get(name string) (io.ReadCloser, error) {
name = stor.prefixWithPrivateNamespace(name)
fileObj, err := stor.retrieveFileObject(name)
if err != nil {
return nil, err
}
data, err := fileObj.GetField("content")
if err != nil {
return nil, fmt.Errorf("could not extract file content for %... | go | func (stor *maas1Storage) Get(name string) (io.ReadCloser, error) {
name = stor.prefixWithPrivateNamespace(name)
fileObj, err := stor.retrieveFileObject(name)
if err != nil {
return nil, err
}
data, err := fileObj.GetField("content")
if err != nil {
return nil, fmt.Errorf("could not extract file content for %... | [
"func",
"(",
"stor",
"*",
"maas1Storage",
")",
"Get",
"(",
"name",
"string",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"name",
"=",
"stor",
".",
"prefixWithPrivateNamespace",
"(",
"name",
")",
"\n",
"fileObj",
",",
"err",
":=",
"stor",... | // Get is specified in the StorageReader interface. | [
"Get",
"is",
"specified",
"in",
"the",
"StorageReader",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/storage.go#L88-L103 |
156,613 | juju/juju | provider/maas/storage.go | extractFilenames | func (stor *maas1Storage) extractFilenames(listResult gomaasapi.JSONObject) ([]string, error) {
privatePrefix := stor.prefixWithPrivateNamespace("")
list, err := listResult.GetArray()
if err != nil {
return nil, err
}
result := make([]string, len(list))
for index, entry := range list {
file, err := entry.GetM... | go | func (stor *maas1Storage) extractFilenames(listResult gomaasapi.JSONObject) ([]string, error) {
privatePrefix := stor.prefixWithPrivateNamespace("")
list, err := listResult.GetArray()
if err != nil {
return nil, err
}
result := make([]string, len(list))
for index, entry := range list {
file, err := entry.GetM... | [
"func",
"(",
"stor",
"*",
"maas1Storage",
")",
"extractFilenames",
"(",
"listResult",
"gomaasapi",
".",
"JSONObject",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"privatePrefix",
":=",
"stor",
".",
"prefixWithPrivateNamespace",
"(",
"\"",
"\"",
")"... | // extractFilenames returns the filenames from a "list" operation on the
// MAAS API, sorted by name. | [
"extractFilenames",
"returns",
"the",
"filenames",
"from",
"a",
"list",
"operation",
"on",
"the",
"MAAS",
"API",
"sorted",
"by",
"name",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/storage.go#L107-L128 |
156,614 | juju/juju | provider/maas/storage.go | List | func (stor *maas1Storage) List(prefix string) ([]string, error) {
prefix = stor.prefixWithPrivateNamespace(prefix)
params := make(url.Values)
params.Add("prefix", prefix)
obj, err := stor.maasClient.CallGet("list", params)
if err != nil {
return nil, err
}
return stor.extractFilenames(obj)
} | go | func (stor *maas1Storage) List(prefix string) ([]string, error) {
prefix = stor.prefixWithPrivateNamespace(prefix)
params := make(url.Values)
params.Add("prefix", prefix)
obj, err := stor.maasClient.CallGet("list", params)
if err != nil {
return nil, err
}
return stor.extractFilenames(obj)
} | [
"func",
"(",
"stor",
"*",
"maas1Storage",
")",
"List",
"(",
"prefix",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"prefix",
"=",
"stor",
".",
"prefixWithPrivateNamespace",
"(",
"prefix",
")",
"\n",
"params",
":=",
"make",
"(",
"url"... | // List is specified in the StorageReader interface. | [
"List",
"is",
"specified",
"in",
"the",
"StorageReader",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/storage.go#L131-L140 |
156,615 | juju/juju | provider/maas/storage.go | URL | func (stor *maas1Storage) URL(name string) (string, error) {
name = stor.prefixWithPrivateNamespace(name)
fileObj, err := stor.retrieveFileObject(name)
if err != nil {
return "", err
}
uri, err := fileObj.GetField("anon_resource_uri")
if err != nil {
msg := fmt.Errorf("could not get file's download URL (may b... | go | func (stor *maas1Storage) URL(name string) (string, error) {
name = stor.prefixWithPrivateNamespace(name)
fileObj, err := stor.retrieveFileObject(name)
if err != nil {
return "", err
}
uri, err := fileObj.GetField("anon_resource_uri")
if err != nil {
msg := fmt.Errorf("could not get file's download URL (may b... | [
"func",
"(",
"stor",
"*",
"maas1Storage",
")",
"URL",
"(",
"name",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"name",
"=",
"stor",
".",
"prefixWithPrivateNamespace",
"(",
"name",
")",
"\n",
"fileObj",
",",
"err",
":=",
"stor",
".",
"retrieve... | // URL is specified in the StorageReader interface. | [
"URL",
"is",
"specified",
"in",
"the",
"StorageReader",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/storage.go#L143-L161 |
156,616 | juju/juju | provider/maas/storage.go | Put | func (stor *maas1Storage) Put(name string, r io.Reader, length int64) error {
name = stor.prefixWithPrivateNamespace(name)
data, err := ioutil.ReadAll(io.LimitReader(r, length))
if err != nil {
return err
}
params := url.Values{"filename": {name}}
files := map[string][]byte{"file": data}
_, err = stor.maasClie... | go | func (stor *maas1Storage) Put(name string, r io.Reader, length int64) error {
name = stor.prefixWithPrivateNamespace(name)
data, err := ioutil.ReadAll(io.LimitReader(r, length))
if err != nil {
return err
}
params := url.Values{"filename": {name}}
files := map[string][]byte{"file": data}
_, err = stor.maasClie... | [
"func",
"(",
"stor",
"*",
"maas1Storage",
")",
"Put",
"(",
"name",
"string",
",",
"r",
"io",
".",
"Reader",
",",
"length",
"int64",
")",
"error",
"{",
"name",
"=",
"stor",
".",
"prefixWithPrivateNamespace",
"(",
"name",
")",
"\n",
"data",
",",
"err",
... | // Put is specified in the StorageWriter interface. | [
"Put",
"is",
"specified",
"in",
"the",
"StorageWriter",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/storage.go#L176-L186 |
156,617 | juju/juju | provider/maas/storage.go | Remove | func (stor *maas1Storage) Remove(name string) error {
name = stor.prefixWithPrivateNamespace(name)
// The only thing that can go wrong here, really, is that the file
// does not exist. But deletion is idempotent: deleting a file that
// is no longer there anyway is success, not failure.
stor.maasClient.GetSubObje... | go | func (stor *maas1Storage) Remove(name string) error {
name = stor.prefixWithPrivateNamespace(name)
// The only thing that can go wrong here, really, is that the file
// does not exist. But deletion is idempotent: deleting a file that
// is no longer there anyway is success, not failure.
stor.maasClient.GetSubObje... | [
"func",
"(",
"stor",
"*",
"maas1Storage",
")",
"Remove",
"(",
"name",
"string",
")",
"error",
"{",
"name",
"=",
"stor",
".",
"prefixWithPrivateNamespace",
"(",
"name",
")",
"\n",
"// The only thing that can go wrong here, really, is that the file",
"// does not exist. ... | // Remove is specified in the StorageWriter interface. | [
"Remove",
"is",
"specified",
"in",
"the",
"StorageWriter",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/maas/storage.go#L189-L196 |
156,618 | juju/juju | apiserver/common/errors.go | IsUpgradeInProgressError | func IsUpgradeInProgressError(err error) bool {
if state.IsUpgradeInProgressError(err) {
return true
}
return errors.Cause(err) == params.UpgradeInProgressError
} | go | func IsUpgradeInProgressError(err error) bool {
if state.IsUpgradeInProgressError(err) {
return true
}
return errors.Cause(err) == params.UpgradeInProgressError
} | [
"func",
"IsUpgradeInProgressError",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"state",
".",
"IsUpgradeInProgressError",
"(",
"err",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"errors",
".",
"Cause",
"(",
"err",
")",
"==",
"params",
".",
"U... | // IsUpgradeInProgress returns true if this error is caused
// by an upgrade in progress. | [
"IsUpgradeInProgress",
"returns",
"true",
"if",
"this",
"error",
"is",
"caused",
"by",
"an",
"upgrade",
"in",
"progress",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/errors.go#L83-L88 |
156,619 | juju/juju | apiserver/common/errors.go | IsRedirectError | func IsRedirectError(err error) bool {
_, ok := errors.Cause(err).(*RedirectError)
return ok
} | go | func IsRedirectError(err error) bool {
_, ok := errors.Cause(err).(*RedirectError)
return ok
} | [
"func",
"IsRedirectError",
"(",
"err",
"error",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"errors",
".",
"Cause",
"(",
"err",
")",
".",
"(",
"*",
"RedirectError",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // IsRedirectError returns true if err is caused by a RedirectError. | [
"IsRedirectError",
"returns",
"true",
"if",
"err",
"is",
"caused",
"by",
"a",
"RedirectError",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/errors.go#L109-L112 |
156,620 | juju/juju | apiserver/common/errors.go | OperationBlockedError | func OperationBlockedError(msg string) error {
if msg == "" {
msg = "the operation has been blocked"
}
return ¶ms.Error{
Message: msg,
Code: params.CodeOperationBlocked,
}
} | go | func OperationBlockedError(msg string) error {
if msg == "" {
msg = "the operation has been blocked"
}
return ¶ms.Error{
Message: msg,
Code: params.CodeOperationBlocked,
}
} | [
"func",
"OperationBlockedError",
"(",
"msg",
"string",
")",
"error",
"{",
"if",
"msg",
"==",
"\"",
"\"",
"{",
"msg",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"&",
"params",
".",
"Error",
"{",
"Message",
":",
"msg",
",",
"Code",
":",
"params",
".... | // OperationBlockedError returns an error which signifies that
// an operation has been blocked; the message should describe
// what has been blocked. | [
"OperationBlockedError",
"returns",
"an",
"error",
"which",
"signifies",
"that",
"an",
"operation",
"has",
"been",
"blocked",
";",
"the",
"message",
"should",
"describe",
"what",
"has",
"been",
"blocked",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/errors.go#L131-L139 |
156,621 | juju/juju | apiserver/common/errors.go | ServerErrorAndStatus | func ServerErrorAndStatus(err error) (*params.Error, int) {
err1 := ServerError(err)
if err1 == nil {
return nil, http.StatusOK
}
status := http.StatusInternalServerError
switch err1.Code {
case params.CodeUnauthorized:
status = http.StatusUnauthorized
case params.CodeNotFound,
params.CodeUserNotFound,
p... | go | func ServerErrorAndStatus(err error) (*params.Error, int) {
err1 := ServerError(err)
if err1 == nil {
return nil, http.StatusOK
}
status := http.StatusInternalServerError
switch err1.Code {
case params.CodeUnauthorized:
status = http.StatusUnauthorized
case params.CodeNotFound,
params.CodeUserNotFound,
p... | [
"func",
"ServerErrorAndStatus",
"(",
"err",
"error",
")",
"(",
"*",
"params",
".",
"Error",
",",
"int",
")",
"{",
"err1",
":=",
"ServerError",
"(",
"err",
")",
"\n",
"if",
"err1",
"==",
"nil",
"{",
"return",
"nil",
",",
"http",
".",
"StatusOK",
"\n",... | // ServerErrorAndStatus is like ServerError but also
// returns an HTTP status code appropriate for using
// in a response holding the given error. | [
"ServerErrorAndStatus",
"is",
"like",
"ServerError",
"but",
"also",
"returns",
"an",
"HTTP",
"status",
"code",
"appropriate",
"for",
"using",
"in",
"a",
"response",
"holding",
"the",
"given",
"error",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/errors.go#L185-L216 |
156,622 | juju/juju | apiserver/common/errors.go | ServerError | func ServerError(err error) *params.Error {
if err == nil {
return nil
}
logger.Tracef("server RPC error %v", errors.Details(err))
var (
info map[string]interface{}
msg = err.Error()
)
// Skip past annotations when looking for the code.
err = errors.Cause(err)
code, ok := singletonCode(err)
switch {
... | go | func ServerError(err error) *params.Error {
if err == nil {
return nil
}
logger.Tracef("server RPC error %v", errors.Details(err))
var (
info map[string]interface{}
msg = err.Error()
)
// Skip past annotations when looking for the code.
err = errors.Cause(err)
code, ok := singletonCode(err)
switch {
... | [
"func",
"ServerError",
"(",
"err",
"error",
")",
"*",
"params",
".",
"Error",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"logger",
".",
"Tracef",
"(",
"\"",
"\"",
",",
"errors",
".",
"Details",
"(",
"err",
")",
")",
"\n... | // ServerError returns an error suitable for returning to an API
// client, with an error code suitable for various kinds of errors
// generated in packages outside the API. | [
"ServerError",
"returns",
"an",
"error",
"suitable",
"for",
"returning",
"to",
"an",
"API",
"client",
"with",
"an",
"error",
"code",
"suitable",
"for",
"various",
"kinds",
"of",
"errors",
"generated",
"in",
"packages",
"outside",
"the",
"API",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/errors.go#L221-L302 |
156,623 | juju/juju | service/windows/service.go | NewService | func NewService(name string, conf common.Conf) (*Service, error) {
m, err := NewServiceManager()
if err != nil {
return nil, errors.Trace(err)
}
return newService(name, conf, m), nil
} | go | func NewService(name string, conf common.Conf) (*Service, error) {
m, err := NewServiceManager()
if err != nil {
return nil, errors.Trace(err)
}
return newService(name, conf, m), nil
} | [
"func",
"NewService",
"(",
"name",
"string",
",",
"conf",
"common",
".",
"Conf",
")",
"(",
"*",
"Service",
",",
"error",
")",
"{",
"m",
",",
"err",
":=",
"NewServiceManager",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err... | // NewService returns a new Service type | [
"NewService",
"returns",
"a",
"new",
"Service",
"type"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/windows/service.go#L98-L104 |
156,624 | juju/juju | service/windows/service.go | Validate | func (s *Service) Validate() error {
if err := s.Service.Validate(renderer); err != nil {
return errors.Trace(err)
}
if s.Service.Conf.Transient {
return errors.NotSupportedf("transient services")
}
if s.Service.Conf.AfterStopped != "" {
return errors.NotSupportedf("Conf.AfterStopped")
}
return nil
} | go | func (s *Service) Validate() error {
if err := s.Service.Validate(renderer); err != nil {
return errors.Trace(err)
}
if s.Service.Conf.Transient {
return errors.NotSupportedf("transient services")
}
if s.Service.Conf.AfterStopped != "" {
return errors.NotSupportedf("Conf.AfterStopped")
}
return nil
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"s",
".",
"Service",
".",
"Validate",
"(",
"renderer",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Trace",
"(",
"err",
")",
"\n",
"}",
... | // Validate checks the service for invalid values. | [
"Validate",
"checks",
"the",
"service",
"for",
"invalid",
"values",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/windows/service.go#L117-L131 |
156,625 | juju/juju | service/windows/service.go | Installed | func (s *Service) Installed() (bool, error) {
services, err := ListServices()
if err != nil {
return false, errors.Trace(err)
}
for _, val := range services {
if s.Name() == val {
return true, nil
}
}
return false, nil
} | go | func (s *Service) Installed() (bool, error) {
services, err := ListServices()
if err != nil {
return false, errors.Trace(err)
}
for _, val := range services {
if s.Name() == val {
return true, nil
}
}
return false, nil
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"Installed",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"services",
",",
"err",
":=",
"ListServices",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"errors",
".",
"Trace",
"(",
"... | // Installed returns whether the service is installed | [
"Installed",
"returns",
"whether",
"the",
"service",
"is",
"installed"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/windows/service.go#L143-L154 |
156,626 | juju/juju | service/windows/service.go | Exists | func (s *Service) Exists() (bool, error) {
return s.manager.Exists(s.Name(), s.Conf())
} | go | func (s *Service) Exists() (bool, error) {
return s.manager.Exists(s.Name(), s.Conf())
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"Exists",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"return",
"s",
".",
"manager",
".",
"Exists",
"(",
"s",
".",
"Name",
"(",
")",
",",
"s",
".",
"Conf",
"(",
")",
")",
"\n",
"}"
] | // Exists returns whether the service configuration reflects the
// desired state | [
"Exists",
"returns",
"whether",
"the",
"service",
"configuration",
"reflects",
"the",
"desired",
"state"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/windows/service.go#L158-L160 |
156,627 | juju/juju | service/windows/service.go | Stop | func (s *Service) Stop() error {
running, err := s.Running()
if err != nil {
return errors.Trace(err)
}
if !running {
return nil
}
err = s.manager.Stop(s.Name())
return err
} | go | func (s *Service) Stop() error {
running, err := s.Running()
if err != nil {
return errors.Trace(err)
}
if !running {
return nil
}
err = s.manager.Stop(s.Name())
return err
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"Stop",
"(",
")",
"error",
"{",
"running",
",",
"err",
":=",
"s",
".",
"Running",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Trace",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
... | // Stop stops the service. | [
"Stop",
"stops",
"the",
"service",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/windows/service.go#L178-L188 |
156,628 | juju/juju | service/windows/service.go | Remove | func (s *Service) Remove() error {
installed, err := s.Installed()
if err != nil {
return err
}
if !installed {
return nil
}
err = s.Stop()
if err != nil {
return errors.Trace(err)
}
err = s.manager.Delete(s.Name())
return err
} | go | func (s *Service) Remove() error {
installed, err := s.Installed()
if err != nil {
return err
}
if !installed {
return nil
}
err = s.Stop()
if err != nil {
return errors.Trace(err)
}
err = s.manager.Delete(s.Name())
return err
} | [
"func",
"(",
"s",
"*",
"Service",
")",
"Remove",
"(",
")",
"error",
"{",
"installed",
",",
"err",
":=",
"s",
".",
"Installed",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"!",
"installed",
"{",
"return",... | // Remove deletes the service. | [
"Remove",
"deletes",
"the",
"service",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/windows/service.go#L191-L206 |
156,629 | juju/juju | juju/api.go | usableHostPorts | func usableHostPorts(hps [][]network.HostPort) []network.HostPort {
collapsed := network.CollapseHostPorts(hps)
usable := network.FilterUnusableHostPorts(collapsed)
unique := network.UniqueHostPorts(usable)
return unique
} | go | func usableHostPorts(hps [][]network.HostPort) []network.HostPort {
collapsed := network.CollapseHostPorts(hps)
usable := network.FilterUnusableHostPorts(collapsed)
unique := network.UniqueHostPorts(usable)
return unique
} | [
"func",
"usableHostPorts",
"(",
"hps",
"[",
"]",
"[",
"]",
"network",
".",
"HostPort",
")",
"[",
"]",
"network",
".",
"HostPort",
"{",
"collapsed",
":=",
"network",
".",
"CollapseHostPorts",
"(",
"hps",
")",
"\n",
"usable",
":=",
"network",
".",
"FilterU... | // usableHostPorts returns hps with unusable and non-unique
// host-ports filtered out. | [
"usableHostPorts",
"returns",
"hps",
"with",
"unusable",
"and",
"non",
"-",
"unique",
"host",
"-",
"ports",
"filtered",
"out",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/juju/api.go#L200-L205 |
156,630 | juju/juju | juju/api.go | UpdateControllerDetailsFromLogin | func UpdateControllerDetailsFromLogin(
store jujuclient.ControllerStore, controllerName string,
params UpdateControllerParams,
) error {
controllerDetails, err := store.ControllerByName(controllerName)
if err != nil {
return errors.Trace(err)
}
return updateControllerDetailsFromLogin(store, controllerName, cont... | go | func UpdateControllerDetailsFromLogin(
store jujuclient.ControllerStore, controllerName string,
params UpdateControllerParams,
) error {
controllerDetails, err := store.ControllerByName(controllerName)
if err != nil {
return errors.Trace(err)
}
return updateControllerDetailsFromLogin(store, controllerName, cont... | [
"func",
"UpdateControllerDetailsFromLogin",
"(",
"store",
"jujuclient",
".",
"ControllerStore",
",",
"controllerName",
"string",
",",
"params",
"UpdateControllerParams",
",",
")",
"error",
"{",
"controllerDetails",
",",
"err",
":=",
"store",
".",
"ControllerByName",
"... | // UpdateControllerDetailsFromLogin writes any new api addresses and other relevant details
// to the client controller file.
// Controller may be specified by a UUID or name, and must already exist. | [
"UpdateControllerDetailsFromLogin",
"writes",
"any",
"new",
"api",
"addresses",
"and",
"other",
"relevant",
"details",
"to",
"the",
"client",
"controller",
"file",
".",
"Controller",
"may",
"be",
"specified",
"by",
"a",
"UUID",
"or",
"name",
"and",
"must",
"alre... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/juju/api.go#L254-L263 |
156,631 | juju/juju | apiserver/facades/client/credentialmanager/client.go | NewCredentialManagerAPI | func NewCredentialManagerAPI(ctx facade.Context) (*CredentialManagerAPI, error) {
return internalNewCredentialManagerAPI(newStateShim(ctx.State()), ctx.Resources(), ctx.Auth())
} | go | func NewCredentialManagerAPI(ctx facade.Context) (*CredentialManagerAPI, error) {
return internalNewCredentialManagerAPI(newStateShim(ctx.State()), ctx.Resources(), ctx.Auth())
} | [
"func",
"NewCredentialManagerAPI",
"(",
"ctx",
"facade",
".",
"Context",
")",
"(",
"*",
"CredentialManagerAPI",
",",
"error",
")",
"{",
"return",
"internalNewCredentialManagerAPI",
"(",
"newStateShim",
"(",
"ctx",
".",
"State",
"(",
")",
")",
",",
"ctx",
".",
... | // NewCredentialManagerAPI creates a new CredentialManager API endpoint on server-side. | [
"NewCredentialManagerAPI",
"creates",
"a",
"new",
"CredentialManager",
"API",
"endpoint",
"on",
"server",
"-",
"side",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/credentialmanager/client.go#L31-L33 |
156,632 | juju/juju | state/resources.go | Resources | func (st *State) Resources() (Resources, error) {
persist := st.newPersistence()
resources := NewResourceState(persist, st)
return resources, nil
} | go | func (st *State) Resources() (Resources, error) {
persist := st.newPersistence()
resources := NewResourceState(persist, st)
return resources, nil
} | [
"func",
"(",
"st",
"*",
"State",
")",
"Resources",
"(",
")",
"(",
"Resources",
",",
"error",
")",
"{",
"persist",
":=",
"st",
".",
"newPersistence",
"(",
")",
"\n",
"resources",
":=",
"NewResourceState",
"(",
"persist",
",",
"st",
")",
"\n",
"return",
... | // Resources returns the resources functionality for the current state. | [
"Resources",
"returns",
"the",
"resources",
"functionality",
"for",
"the",
"current",
"state",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources.go#L69-L73 |
156,633 | juju/juju | state/resources.go | ResourcesPersistence | func (st *State) ResourcesPersistence() (ResourcesPersistence, error) {
base := st.newPersistence()
persist := NewResourcePersistence(base)
return persist, nil
} | go | func (st *State) ResourcesPersistence() (ResourcesPersistence, error) {
base := st.newPersistence()
persist := NewResourcePersistence(base)
return persist, nil
} | [
"func",
"(",
"st",
"*",
"State",
")",
"ResourcesPersistence",
"(",
")",
"(",
"ResourcesPersistence",
",",
"error",
")",
"{",
"base",
":=",
"st",
".",
"newPersistence",
"(",
")",
"\n",
"persist",
":=",
"NewResourcePersistence",
"(",
"base",
")",
"\n",
"retu... | // ResourcesPersistence returns the resources persistence functionality
// for the current state. | [
"ResourcesPersistence",
"returns",
"the",
"resources",
"persistence",
"functionality",
"for",
"the",
"current",
"state",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/resources.go#L89-L93 |
156,634 | juju/juju | apiserver/restrict_controller.go | IsControllerFacade | func IsControllerFacade(facadeName string) bool {
return controllerFacadeNames.Contains(facadeName) || commonFacadeNames.Contains(facadeName)
} | go | func IsControllerFacade(facadeName string) bool {
return controllerFacadeNames.Contains(facadeName) || commonFacadeNames.Contains(facadeName)
} | [
"func",
"IsControllerFacade",
"(",
"facadeName",
"string",
")",
"bool",
"{",
"return",
"controllerFacadeNames",
".",
"Contains",
"(",
"facadeName",
")",
"||",
"commonFacadeNames",
".",
"Contains",
"(",
"facadeName",
")",
"\n",
"}"
] | // IsControllerFacade reports whether the given facade name can be accessed
// using a controller connection. | [
"IsControllerFacade",
"reports",
"whether",
"the",
"given",
"facade",
"name",
"can",
"be",
"accessed",
"using",
"a",
"controller",
"connection",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/restrict_controller.go#L55-L57 |
156,635 | juju/juju | cmd/juju/commands/sshkeys.go | NewKeyManagerClient | func (c *SSHKeysBase) NewKeyManagerClient() (*keymanager.Client, error) {
root, err := c.NewAPIRoot()
if err != nil {
return nil, err
}
return keymanager.NewClient(root), nil
} | go | func (c *SSHKeysBase) NewKeyManagerClient() (*keymanager.Client, error) {
root, err := c.NewAPIRoot()
if err != nil {
return nil, err
}
return keymanager.NewClient(root), nil
} | [
"func",
"(",
"c",
"*",
"SSHKeysBase",
")",
"NewKeyManagerClient",
"(",
")",
"(",
"*",
"keymanager",
".",
"Client",
",",
"error",
")",
"{",
"root",
",",
"err",
":=",
"c",
".",
"NewAPIRoot",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"n... | // NewKeyManagerClient returns a keymanager client for the root api endpoint
// that the environment command returns. | [
"NewKeyManagerClient",
"returns",
"a",
"keymanager",
"client",
"for",
"the",
"root",
"api",
"endpoint",
"that",
"the",
"environment",
"command",
"returns",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/sshkeys.go#L18-L24 |
156,636 | juju/juju | cmd/juju/machine/flags.go | String | func (f disksFlag) String() string {
strs := make([]string, len(*f.disks))
for i, cons := range *f.disks {
strs[i] = fmt.Sprint(cons)
}
return strings.Join(strs, " ")
} | go | func (f disksFlag) String() string {
strs := make([]string, len(*f.disks))
for i, cons := range *f.disks {
strs[i] = fmt.Sprint(cons)
}
return strings.Join(strs, " ")
} | [
"func",
"(",
"f",
"disksFlag",
")",
"String",
"(",
")",
"string",
"{",
"strs",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"*",
"f",
".",
"disks",
")",
")",
"\n",
"for",
"i",
",",
"cons",
":=",
"range",
"*",
"f",
".",
"disks",
"{"... | // Set implements gnuflag.Value.String. | [
"Set",
"implements",
"gnuflag",
".",
"Value",
".",
"String",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/machine/flags.go#L32-L38 |
156,637 | juju/juju | provider/oracle/instance.go | hardwareCharacteristics | func (o *oracleInstance) hardwareCharacteristics() *instance.HardwareCharacteristics {
if o.arch == nil {
return nil
}
hc := &instance.HardwareCharacteristics{Arch: o.arch}
if o.instType != nil {
hc.Mem = &o.instType.Mem
hc.RootDisk = &o.instType.RootDisk
hc.CpuCores = &o.instType.CpuCores
}
return hc
} | go | func (o *oracleInstance) hardwareCharacteristics() *instance.HardwareCharacteristics {
if o.arch == nil {
return nil
}
hc := &instance.HardwareCharacteristics{Arch: o.arch}
if o.instType != nil {
hc.Mem = &o.instType.Mem
hc.RootDisk = &o.instType.RootDisk
hc.CpuCores = &o.instType.CpuCores
}
return hc
} | [
"func",
"(",
"o",
"*",
"oracleInstance",
")",
"hardwareCharacteristics",
"(",
")",
"*",
"instance",
".",
"HardwareCharacteristics",
"{",
"if",
"o",
".",
"arch",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"hc",
":=",
"&",
"instance",
".",
"Hard... | // hardwareCharacteristics returns the hardware characteristics of the current
// instance | [
"hardwareCharacteristics",
"returns",
"the",
"hardware",
"characteristics",
"of",
"the",
"current",
"instance"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/instance.go#L43-L56 |
156,638 | juju/juju | provider/oracle/instance.go | Id | func (o *oracleInstance) Id() instance.Id {
if o.machine.Name != "" {
name, err := extractInstanceIDFromMachineName(o.machine.Name)
if err != nil {
return instance.Id(o.machine.Name)
}
return name
}
return instance.Id(o.name)
} | go | func (o *oracleInstance) Id() instance.Id {
if o.machine.Name != "" {
name, err := extractInstanceIDFromMachineName(o.machine.Name)
if err != nil {
return instance.Id(o.machine.Name)
}
return name
}
return instance.Id(o.name)
} | [
"func",
"(",
"o",
"*",
"oracleInstance",
")",
"Id",
"(",
")",
"instance",
".",
"Id",
"{",
"if",
"o",
".",
"machine",
".",
"Name",
"!=",
"\"",
"\"",
"{",
"name",
",",
"err",
":=",
"extractInstanceIDFromMachineName",
"(",
"o",
".",
"machine",
".",
"Nam... | // Id is defined on the instances.Instance interface. | [
"Id",
"is",
"defined",
"on",
"the",
"instances",
".",
"Instance",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/instance.go#L99-L109 |
156,639 | juju/juju | provider/oracle/instance.go | Status | func (o *oracleInstance) Status(ctx context.ProviderCallContext) instance.Status {
return o.status
} | go | func (o *oracleInstance) Status(ctx context.ProviderCallContext) instance.Status {
return o.status
} | [
"func",
"(",
"o",
"*",
"oracleInstance",
")",
"Status",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
")",
"instance",
".",
"Status",
"{",
"return",
"o",
".",
"status",
"\n",
"}"
] | // Status is defined on the instances.Instance interface. | [
"Status",
"is",
"defined",
"on",
"the",
"instances",
".",
"Instance",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/instance.go#L112-L114 |
156,640 | juju/juju | provider/oracle/instance.go | StorageAttachments | func (o *oracleInstance) StorageAttachments() []response.Storage {
o.mutex.Lock()
defer o.mutex.Unlock()
return o.machine.Storage_attachments
} | go | func (o *oracleInstance) StorageAttachments() []response.Storage {
o.mutex.Lock()
defer o.mutex.Unlock()
return o.machine.Storage_attachments
} | [
"func",
"(",
"o",
"*",
"oracleInstance",
")",
"StorageAttachments",
"(",
")",
"[",
"]",
"response",
".",
"Storage",
"{",
"o",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"o",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"return",
"o",
".",
... | // StorageAttachments returns the storage that was attached in the moment
// of instance creation. This storage cannot be detached dynamically.
// this is also needed if you wish to determine the free disk index
// you can use when attaching a new disk | [
"StorageAttachments",
"returns",
"the",
"storage",
"that",
"was",
"attached",
"in",
"the",
"moment",
"of",
"instance",
"creation",
".",
"This",
"storage",
"cannot",
"be",
"detached",
"dynamically",
".",
"this",
"is",
"also",
"needed",
"if",
"you",
"wish",
"to"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/instance.go#L120-L124 |
156,641 | juju/juju | provider/oracle/instance.go | refresh | func (o *oracleInstance) refresh() error {
o.mutex.Lock()
defer o.mutex.Unlock()
machine, err := o.env.client.InstanceDetails(o.machine.Name)
// if the request failed for any reason
// we should not update the information and
// let the old one persist
if err != nil {
return err
}
o.machine = machine
retu... | go | func (o *oracleInstance) refresh() error {
o.mutex.Lock()
defer o.mutex.Unlock()
machine, err := o.env.client.InstanceDetails(o.machine.Name)
// if the request failed for any reason
// we should not update the information and
// let the old one persist
if err != nil {
return err
}
o.machine = machine
retu... | [
"func",
"(",
"o",
"*",
"oracleInstance",
")",
"refresh",
"(",
")",
"error",
"{",
"o",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"o",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n\n",
"machine",
",",
"err",
":=",
"o",
".",
"env",
".",
"cl... | // refresh refreshes the instance raw details from the oracle api
// this method is mutex protected | [
"refresh",
"refreshes",
"the",
"instance",
"raw",
"details",
"from",
"the",
"oracle",
"api",
"this",
"method",
"is",
"mutex",
"protected"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/instance.go#L128-L142 |
156,642 | juju/juju | provider/oracle/instance.go | waitForMachineStatus | func (o *oracleInstance) waitForMachineStatus(state ociCommon.InstanceState, timeout time.Duration) error {
timer := o.env.clock.NewTimer(timeout)
defer timer.Stop()
for {
select {
case <-timer.Chan():
return errors.Errorf(
"Timed out waiting for instance to transition from %v to %v",
o.machine.State... | go | func (o *oracleInstance) waitForMachineStatus(state ociCommon.InstanceState, timeout time.Duration) error {
timer := o.env.clock.NewTimer(timeout)
defer timer.Stop()
for {
select {
case <-timer.Chan():
return errors.Errorf(
"Timed out waiting for instance to transition from %v to %v",
o.machine.State... | [
"func",
"(",
"o",
"*",
"oracleInstance",
")",
"waitForMachineStatus",
"(",
"state",
"ociCommon",
".",
"InstanceState",
",",
"timeout",
"time",
".",
"Duration",
")",
"error",
"{",
"timer",
":=",
"o",
".",
"env",
".",
"clock",
".",
"NewTimer",
"(",
"timeout"... | // waitForMachineStatus will ping the machine status until the timeout
// duration is reached or an error appeared | [
"waitForMachineStatus",
"will",
"ping",
"the",
"machine",
"status",
"until",
"the",
"timeout",
"duration",
"is",
"reached",
"or",
"an",
"error",
"appeared"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/instance.go#L146-L167 |
156,643 | juju/juju | provider/oracle/instance.go | deleteInstanceAndResources | func (o *oracleInstance) deleteInstanceAndResources(cleanup bool) error {
if cleanup {
err := o.disassociatePublicIps(true)
if err != nil {
return err
}
}
if err := o.env.client.DeleteInstance(o.machine.Name); err != nil {
return errors.Trace(err)
}
if cleanup {
// Wait for instance to be deleted. T... | go | func (o *oracleInstance) deleteInstanceAndResources(cleanup bool) error {
if cleanup {
err := o.disassociatePublicIps(true)
if err != nil {
return err
}
}
if err := o.env.client.DeleteInstance(o.machine.Name); err != nil {
return errors.Trace(err)
}
if cleanup {
// Wait for instance to be deleted. T... | [
"func",
"(",
"o",
"*",
"oracleInstance",
")",
"deleteInstanceAndResources",
"(",
"cleanup",
"bool",
")",
"error",
"{",
"if",
"cleanup",
"{",
"err",
":=",
"o",
".",
"disassociatePublicIps",
"(",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | // delete will delete the instance and attempt to cleanup any instance related
// resources | [
"delete",
"will",
"delete",
"the",
"instance",
"and",
"attempt",
"to",
"cleanup",
"any",
"instance",
"related",
"resources"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/instance.go#L171-L237 |
156,644 | juju/juju | provider/oracle/instance.go | unusedPublicIps | func (o *oracleInstance) unusedPublicIps() ([]response.IpReservation, error) {
filter := []oci.Filter{
{
Arg: "permanent",
Value: "true",
},
{
Arg: "used",
Value: "false",
},
}
res, err := o.env.client.AllIpReservations(filter)
if err != nil {
return nil, err
}
return res.Result, nil
} | go | func (o *oracleInstance) unusedPublicIps() ([]response.IpReservation, error) {
filter := []oci.Filter{
{
Arg: "permanent",
Value: "true",
},
{
Arg: "used",
Value: "false",
},
}
res, err := o.env.client.AllIpReservations(filter)
if err != nil {
return nil, err
}
return res.Result, nil
} | [
"func",
"(",
"o",
"*",
"oracleInstance",
")",
"unusedPublicIps",
"(",
")",
"(",
"[",
"]",
"response",
".",
"IpReservation",
",",
"error",
")",
"{",
"filter",
":=",
"[",
"]",
"oci",
".",
"Filter",
"{",
"{",
"Arg",
":",
"\"",
"\"",
",",
"Value",
":",... | // unusedPublicIps returns a slice of IpReservation that are currently not used | [
"unusedPublicIps",
"returns",
"a",
"slice",
"of",
"IpReservation",
"that",
"are",
"currently",
"not",
"used"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/instance.go#L240-L258 |
156,645 | juju/juju | provider/oracle/instance.go | associatePublicIP | func (o *oracleInstance) associatePublicIP() error {
// return all unused public IPs
unusedIps, err := o.unusedPublicIps()
if err != nil {
return err
}
for _, val := range unusedIps {
assocPoolName := ociCommon.NewIPPool(
ociCommon.IPPool(val.Name),
ociCommon.IPReservationType,
)
// create the assoc... | go | func (o *oracleInstance) associatePublicIP() error {
// return all unused public IPs
unusedIps, err := o.unusedPublicIps()
if err != nil {
return err
}
for _, val := range unusedIps {
assocPoolName := ociCommon.NewIPPool(
ociCommon.IPPool(val.Name),
ociCommon.IPReservationType,
)
// create the assoc... | [
"func",
"(",
"o",
"*",
"oracleInstance",
")",
"associatePublicIP",
"(",
")",
"error",
"{",
"// return all unused public IPs",
"unusedIps",
",",
"err",
":=",
"o",
".",
"unusedPublicIps",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
... | // associatePublicIP associates a public IP with the current instance | [
"associatePublicIP",
"associates",
"a",
"public",
"IP",
"with",
"the",
"current",
"instance"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/instance.go#L261-L315 |
156,646 | juju/juju | provider/oracle/instance.go | disassociatePublicIps | func (o *oracleInstance) disassociatePublicIps(remove bool) error {
associations, err := o.publicAddressesAssociations()
if err != nil {
return err
}
for _, ipAssoc := range associations {
reservation := ipAssoc.Reservation
name := ipAssoc.Name
if err := o.env.client.DeleteIpAssociation(name); err != nil {... | go | func (o *oracleInstance) disassociatePublicIps(remove bool) error {
associations, err := o.publicAddressesAssociations()
if err != nil {
return err
}
for _, ipAssoc := range associations {
reservation := ipAssoc.Reservation
name := ipAssoc.Name
if err := o.env.client.DeleteIpAssociation(name); err != nil {... | [
"func",
"(",
"o",
"*",
"oracleInstance",
")",
"disassociatePublicIps",
"(",
"remove",
"bool",
")",
"error",
"{",
"associations",
",",
"err",
":=",
"o",
".",
"publicAddressesAssociations",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n"... | // dissasociatePublicIps disassociates the public IP address from the current instance.
// Optionally, the remove flag will also remove the IP reservation after the IP was disassociated | [
"dissasociatePublicIps",
"disassociates",
"the",
"public",
"IP",
"address",
"from",
"the",
"current",
"instance",
".",
"Optionally",
"the",
"remove",
"flag",
"will",
"also",
"remove",
"the",
"IP",
"reservation",
"after",
"the",
"IP",
"was",
"disassociated"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/instance.go#L319-L347 |
156,647 | juju/juju | provider/oracle/instance.go | publicAddressesAssociations | func (o *oracleInstance) publicAddressesAssociations() ([]response.IpAssociation, error) {
o.mutex.Lock()
defer o.mutex.Unlock()
filter := []oci.Filter{
{
Arg: "vcable",
Value: string(o.machine.Vcable_id),
},
}
assoc, err := o.env.client.AllIpAssociations(filter)
if err != nil {
return nil, errors... | go | func (o *oracleInstance) publicAddressesAssociations() ([]response.IpAssociation, error) {
o.mutex.Lock()
defer o.mutex.Unlock()
filter := []oci.Filter{
{
Arg: "vcable",
Value: string(o.machine.Vcable_id),
},
}
assoc, err := o.env.client.AllIpAssociations(filter)
if err != nil {
return nil, errors... | [
"func",
"(",
"o",
"*",
"oracleInstance",
")",
"publicAddressesAssociations",
"(",
")",
"(",
"[",
"]",
"response",
".",
"IpAssociation",
",",
"error",
")",
"{",
"o",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"o",
".",
"mutex",
".",
"Unlock",
... | // publicAddressesAssociations returns a slice of all IP associations for the current instance | [
"publicAddressesAssociations",
"returns",
"a",
"slice",
"of",
"all",
"IP",
"associations",
"for",
"the",
"current",
"instance"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/instance.go#L350-L367 |
156,648 | juju/juju | provider/oracle/instance.go | Addresses | func (o *oracleInstance) Addresses(ctx context.ProviderCallContext) ([]network.Address, error) {
addresses := []network.Address{}
ips, err := o.publicAddressesAssociations()
if err != nil {
return nil, errors.Trace(err)
}
if len(o.machine.Attributes.Network) > 0 {
for name, val := range o.machine.Attributes.... | go | func (o *oracleInstance) Addresses(ctx context.ProviderCallContext) ([]network.Address, error) {
addresses := []network.Address{}
ips, err := o.publicAddressesAssociations()
if err != nil {
return nil, errors.Trace(err)
}
if len(o.machine.Attributes.Network) > 0 {
for name, val := range o.machine.Attributes.... | [
"func",
"(",
"o",
"*",
"oracleInstance",
")",
"Addresses",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
")",
"(",
"[",
"]",
"network",
".",
"Address",
",",
"error",
")",
"{",
"addresses",
":=",
"[",
"]",
"network",
".",
"Address",
"{",
"}",
"\n\n... | // Addresses is defined on the instances.Instance interface. | [
"Addresses",
"is",
"defined",
"on",
"the",
"instances",
".",
"Instance",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/instance.go#L370-L395 |
156,649 | juju/juju | provider/oracle/instance.go | OpenPorts | func (o *oracleInstance) OpenPorts(ctx context.ProviderCallContext, machineId string, rules []network.IngressRule) error {
if o.env.Config().FirewallMode() != config.FwInstance {
return errors.Errorf(
"invalid firewall mode %q for opening ports on instance",
o.env.Config().FirewallMode(),
)
}
return o.env... | go | func (o *oracleInstance) OpenPorts(ctx context.ProviderCallContext, machineId string, rules []network.IngressRule) error {
if o.env.Config().FirewallMode() != config.FwInstance {
return errors.Errorf(
"invalid firewall mode %q for opening ports on instance",
o.env.Config().FirewallMode(),
)
}
return o.env... | [
"func",
"(",
"o",
"*",
"oracleInstance",
")",
"OpenPorts",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"machineId",
"string",
",",
"rules",
"[",
"]",
"network",
".",
"IngressRule",
")",
"error",
"{",
"if",
"o",
".",
"env",
".",
"Config",
"(",... | // OpenPorts is defined on the instances.Instance interface. | [
"OpenPorts",
"is",
"defined",
"on",
"the",
"instances",
".",
"Instance",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/instance.go#L398-L407 |
156,650 | juju/juju | provider/oracle/instance.go | IngressRules | func (o *oracleInstance) IngressRules(ctx context.ProviderCallContext, machineId string) ([]network.IngressRule, error) {
return o.env.MachineIngressRules(ctx, machineId)
} | go | func (o *oracleInstance) IngressRules(ctx context.ProviderCallContext, machineId string) ([]network.IngressRule, error) {
return o.env.MachineIngressRules(ctx, machineId)
} | [
"func",
"(",
"o",
"*",
"oracleInstance",
")",
"IngressRules",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"machineId",
"string",
")",
"(",
"[",
"]",
"network",
".",
"IngressRule",
",",
"error",
")",
"{",
"return",
"o",
".",
"env",
".",
"Machi... | // IngressRules is defined on the instances.Instance interface. | [
"IngressRules",
"is",
"defined",
"on",
"the",
"instances",
".",
"Instance",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oracle/instance.go#L422-L424 |
156,651 | juju/juju | api/deployer/deployer.go | NewState | func NewState(caller base.APICaller) *State {
facadeCaller := base.NewFacadeCaller(caller, deployerFacade)
return &State{facade: facadeCaller}
} | go | func NewState(caller base.APICaller) *State {
facadeCaller := base.NewFacadeCaller(caller, deployerFacade)
return &State{facade: facadeCaller}
} | [
"func",
"NewState",
"(",
"caller",
"base",
".",
"APICaller",
")",
"*",
"State",
"{",
"facadeCaller",
":=",
"base",
".",
"NewFacadeCaller",
"(",
"caller",
",",
"deployerFacade",
")",
"\n",
"return",
"&",
"State",
"{",
"facade",
":",
"facadeCaller",
"}",
"\n... | // NewState creates a new State instance that makes API calls
// through the given caller. | [
"NewState",
"creates",
"a",
"new",
"State",
"instance",
"that",
"makes",
"API",
"calls",
"through",
"the",
"given",
"caller",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/deployer/deployer.go#L23-L27 |
156,652 | juju/juju | api/deployer/deployer.go | unitLife | func (st *State) unitLife(tag names.UnitTag) (params.Life, error) {
return common.OneLife(st.facade, tag)
} | go | func (st *State) unitLife(tag names.UnitTag) (params.Life, error) {
return common.OneLife(st.facade, tag)
} | [
"func",
"(",
"st",
"*",
"State",
")",
"unitLife",
"(",
"tag",
"names",
".",
"UnitTag",
")",
"(",
"params",
".",
"Life",
",",
"error",
")",
"{",
"return",
"common",
".",
"OneLife",
"(",
"st",
".",
"facade",
",",
"tag",
")",
"\n",
"}"
] | // unitLife returns the lifecycle state of the given unit. | [
"unitLife",
"returns",
"the",
"lifecycle",
"state",
"of",
"the",
"given",
"unit",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/deployer/deployer.go#L30-L32 |
156,653 | juju/juju | api/deployer/deployer.go | Unit | func (st *State) Unit(tag names.UnitTag) (*Unit, error) {
life, err := st.unitLife(tag)
if err != nil {
return nil, err
}
return &Unit{
tag: tag,
life: life,
st: st,
}, nil
} | go | func (st *State) Unit(tag names.UnitTag) (*Unit, error) {
life, err := st.unitLife(tag)
if err != nil {
return nil, err
}
return &Unit{
tag: tag,
life: life,
st: st,
}, nil
} | [
"func",
"(",
"st",
"*",
"State",
")",
"Unit",
"(",
"tag",
"names",
".",
"UnitTag",
")",
"(",
"*",
"Unit",
",",
"error",
")",
"{",
"life",
",",
"err",
":=",
"st",
".",
"unitLife",
"(",
"tag",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | // Unit returns the unit with the given tag. | [
"Unit",
"returns",
"the",
"unit",
"with",
"the",
"given",
"tag",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/deployer/deployer.go#L35-L45 |
156,654 | juju/juju | api/deployer/deployer.go | Machine | func (st *State) Machine(tag names.MachineTag) (*Machine, error) {
// TODO(dfc) this cannot return an error any more
return &Machine{
tag: tag,
st: st,
}, nil
} | go | func (st *State) Machine(tag names.MachineTag) (*Machine, error) {
// TODO(dfc) this cannot return an error any more
return &Machine{
tag: tag,
st: st,
}, nil
} | [
"func",
"(",
"st",
"*",
"State",
")",
"Machine",
"(",
"tag",
"names",
".",
"MachineTag",
")",
"(",
"*",
"Machine",
",",
"error",
")",
"{",
"// TODO(dfc) this cannot return an error any more",
"return",
"&",
"Machine",
"{",
"tag",
":",
"tag",
",",
"st",
":"... | // Machine returns the machine with the given tag. | [
"Machine",
"returns",
"the",
"machine",
"with",
"the",
"given",
"tag",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/deployer/deployer.go#L48-L54 |
156,655 | juju/juju | core/auditlog/config.go | Validate | func (cfg Config) Validate() error {
if cfg.Enabled && cfg.Target == nil {
return errors.NewNotValid(nil, "logging enabled but no target provided")
}
return nil
} | go | func (cfg Config) Validate() error {
if cfg.Enabled && cfg.Target == nil {
return errors.NewNotValid(nil, "logging enabled but no target provided")
}
return nil
} | [
"func",
"(",
"cfg",
"Config",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"cfg",
".",
"Enabled",
"&&",
"cfg",
".",
"Target",
"==",
"nil",
"{",
"return",
"errors",
".",
"NewNotValid",
"(",
"nil",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
... | // Validate checks the audit logging configuration. | [
"Validate",
"checks",
"the",
"audit",
"logging",
"configuration",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/auditlog/config.go#L37-L42 |
156,656 | juju/juju | service/agentinfo.go | NewAgentInfo | func NewAgentInfo(kind AgentKind, id, dataDir, logDir string) AgentInfo {
name := fmt.Sprintf("%s-%s", kind, strings.Replace(id, "/", "-", -1))
info := AgentInfo{
Kind: kind,
ID: id,
DataDir: dataDir,
LogDir: logDir,
name: name,
}
return info
} | go | func NewAgentInfo(kind AgentKind, id, dataDir, logDir string) AgentInfo {
name := fmt.Sprintf("%s-%s", kind, strings.Replace(id, "/", "-", -1))
info := AgentInfo{
Kind: kind,
ID: id,
DataDir: dataDir,
LogDir: logDir,
name: name,
}
return info
} | [
"func",
"NewAgentInfo",
"(",
"kind",
"AgentKind",
",",
"id",
",",
"dataDir",
",",
"logDir",
"string",
")",
"AgentInfo",
"{",
"name",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"kind",
",",
"strings",
".",
"Replace",
"(",
"id",
",",
"\"",
"\""... | // NewAgentInfo composes a new AgentInfo for the given essentials. | [
"NewAgentInfo",
"composes",
"a",
"new",
"AgentInfo",
"for",
"the",
"given",
"essentials",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/agentinfo.go#L48-L60 |
156,657 | juju/juju | service/agentinfo.go | NewMachineAgentInfo | func NewMachineAgentInfo(id, dataDir, logDir string) AgentInfo {
return NewAgentInfo(AgentKindMachine, id, dataDir, logDir)
} | go | func NewMachineAgentInfo(id, dataDir, logDir string) AgentInfo {
return NewAgentInfo(AgentKindMachine, id, dataDir, logDir)
} | [
"func",
"NewMachineAgentInfo",
"(",
"id",
",",
"dataDir",
",",
"logDir",
"string",
")",
"AgentInfo",
"{",
"return",
"NewAgentInfo",
"(",
"AgentKindMachine",
",",
"id",
",",
"dataDir",
",",
"logDir",
")",
"\n",
"}"
] | // NewMachineAgentInfo returns a new AgentInfo for a machine agent. | [
"NewMachineAgentInfo",
"returns",
"a",
"new",
"AgentInfo",
"for",
"a",
"machine",
"agent",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/agentinfo.go#L63-L65 |
156,658 | juju/juju | service/agentinfo.go | NewUnitAgentInfo | func NewUnitAgentInfo(id, dataDir, logDir string) AgentInfo {
return NewAgentInfo(AgentKindUnit, id, dataDir, logDir)
} | go | func NewUnitAgentInfo(id, dataDir, logDir string) AgentInfo {
return NewAgentInfo(AgentKindUnit, id, dataDir, logDir)
} | [
"func",
"NewUnitAgentInfo",
"(",
"id",
",",
"dataDir",
",",
"logDir",
"string",
")",
"AgentInfo",
"{",
"return",
"NewAgentInfo",
"(",
"AgentKindUnit",
",",
"id",
",",
"dataDir",
",",
"logDir",
")",
"\n",
"}"
] | // NewUnitAgentInfo returns a new AgentInfo for a unit agent. | [
"NewUnitAgentInfo",
"returns",
"a",
"new",
"AgentInfo",
"for",
"a",
"unit",
"agent",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/agentinfo.go#L68-L70 |
156,659 | juju/juju | service/agentinfo.go | ToolsDir | func (ai AgentInfo) ToolsDir(renderer shell.Renderer) string {
return renderer.FromSlash(tools.ToolsDir(ai.DataDir, ai.name))
} | go | func (ai AgentInfo) ToolsDir(renderer shell.Renderer) string {
return renderer.FromSlash(tools.ToolsDir(ai.DataDir, ai.name))
} | [
"func",
"(",
"ai",
"AgentInfo",
")",
"ToolsDir",
"(",
"renderer",
"shell",
".",
"Renderer",
")",
"string",
"{",
"return",
"renderer",
".",
"FromSlash",
"(",
"tools",
".",
"ToolsDir",
"(",
"ai",
".",
"DataDir",
",",
"ai",
".",
"name",
")",
")",
"\n",
... | // ToolsDir returns the path to the agent's tools dir. | [
"ToolsDir",
"returns",
"the",
"path",
"to",
"the",
"agent",
"s",
"tools",
"dir",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/agentinfo.go#L73-L75 |
156,660 | juju/juju | service/agentinfo.go | execArgs | func (ai AgentInfo) execArgs(renderer shell.Renderer) []string {
return []string{
string(ai.Kind),
"--data-dir", renderer.FromSlash(ai.DataDir),
idOptions[ai.Kind], ai.ID,
"--debug",
}
} | go | func (ai AgentInfo) execArgs(renderer shell.Renderer) []string {
return []string{
string(ai.Kind),
"--data-dir", renderer.FromSlash(ai.DataDir),
idOptions[ai.Kind], ai.ID,
"--debug",
}
} | [
"func",
"(",
"ai",
"AgentInfo",
")",
"execArgs",
"(",
"renderer",
"shell",
".",
"Renderer",
")",
"[",
"]",
"string",
"{",
"return",
"[",
"]",
"string",
"{",
"string",
"(",
"ai",
".",
"Kind",
")",
",",
"\"",
"\"",
",",
"renderer",
".",
"FromSlash",
... | // execArgs returns an unquoted array of service arguments in case we need
// them later. One notable place where this is needed, is the windows service
// package, where CreateService correctly does quoting of executable path and
// individual arguments | [
"execArgs",
"returns",
"an",
"unquoted",
"array",
"of",
"service",
"arguments",
"in",
"case",
"we",
"need",
"them",
"later",
".",
"One",
"notable",
"place",
"where",
"this",
"is",
"needed",
"is",
"the",
"windows",
"service",
"package",
"where",
"CreateService"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/service/agentinfo.go#L99-L106 |
156,661 | juju/juju | apiserver/common/block.go | RemoveAllowed | func (c *BlockChecker) RemoveAllowed() error {
if err := c.checkBlock(state.RemoveBlock); err != nil {
return err
}
// Check if change block has been enabled
return c.checkBlock(state.ChangeBlock)
} | go | func (c *BlockChecker) RemoveAllowed() error {
if err := c.checkBlock(state.RemoveBlock); err != nil {
return err
}
// Check if change block has been enabled
return c.checkBlock(state.ChangeBlock)
} | [
"func",
"(",
"c",
"*",
"BlockChecker",
")",
"RemoveAllowed",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"c",
".",
"checkBlock",
"(",
"state",
".",
"RemoveBlock",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// Check if change b... | // RemoveAllowed checks if remove block is in place.
// Remove block prevents removal of machine, service, unit
// and relation from current model. | [
"RemoveAllowed",
"checks",
"if",
"remove",
"block",
"is",
"in",
"place",
".",
"Remove",
"block",
"prevents",
"removal",
"of",
"machine",
"service",
"unit",
"and",
"relation",
"from",
"current",
"model",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/block.go#L35-L41 |
156,662 | juju/juju | apiserver/common/block.go | DestroyAllowed | func (c *BlockChecker) DestroyAllowed() error {
if err := c.checkBlock(state.DestroyBlock); err != nil {
return err
}
// Check if remove block has been enabled
if err := c.checkBlock(state.RemoveBlock); err != nil {
return err
}
// Check if change block has been enabled
return c.checkBlock(state.ChangeBlock)... | go | func (c *BlockChecker) DestroyAllowed() error {
if err := c.checkBlock(state.DestroyBlock); err != nil {
return err
}
// Check if remove block has been enabled
if err := c.checkBlock(state.RemoveBlock); err != nil {
return err
}
// Check if change block has been enabled
return c.checkBlock(state.ChangeBlock)... | [
"func",
"(",
"c",
"*",
"BlockChecker",
")",
"DestroyAllowed",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"c",
".",
"checkBlock",
"(",
"state",
".",
"DestroyBlock",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// Check if remove... | // DestroyAllowed checks if destroy block is in place.
// Destroy block prevents destruction of current model. | [
"DestroyAllowed",
"checks",
"if",
"destroy",
"block",
"is",
"in",
"place",
".",
"Destroy",
"block",
"prevents",
"destruction",
"of",
"current",
"model",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/block.go#L45-L55 |
156,663 | juju/juju | apiserver/common/block.go | checkBlock | func (c *BlockChecker) checkBlock(blockType state.BlockType) error {
aBlock, isEnabled, err := c.getter.GetBlockForType(blockType)
if err != nil {
return errors.Trace(err)
}
if isEnabled {
return OperationBlockedError(aBlock.Message())
}
return nil
} | go | func (c *BlockChecker) checkBlock(blockType state.BlockType) error {
aBlock, isEnabled, err := c.getter.GetBlockForType(blockType)
if err != nil {
return errors.Trace(err)
}
if isEnabled {
return OperationBlockedError(aBlock.Message())
}
return nil
} | [
"func",
"(",
"c",
"*",
"BlockChecker",
")",
"checkBlock",
"(",
"blockType",
"state",
".",
"BlockType",
")",
"error",
"{",
"aBlock",
",",
"isEnabled",
",",
"err",
":=",
"c",
".",
"getter",
".",
"GetBlockForType",
"(",
"blockType",
")",
"\n",
"if",
"err",
... | // checkBlock checks if specified operation must be blocked.
// If it does, the method throws specific error that can be examined
// to stop operation execution. | [
"checkBlock",
"checks",
"if",
"specified",
"operation",
"must",
"be",
"blocked",
".",
"If",
"it",
"does",
"the",
"method",
"throws",
"specific",
"error",
"that",
"can",
"be",
"examined",
"to",
"stop",
"operation",
"execution",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/block.go#L60-L69 |
156,664 | juju/juju | provider/azure/storage.go | createManagedDiskVolumes | func (v *azureVolumeSource) createManagedDiskVolumes(ctx context.ProviderCallContext, params []storage.VolumeParams, results []storage.CreateVolumesResult) {
for i, p := range params {
if results[i].Error != nil {
continue
}
volume, err := v.createManagedDiskVolume(ctx, p)
if err != nil {
results[i].Erro... | go | func (v *azureVolumeSource) createManagedDiskVolumes(ctx context.ProviderCallContext, params []storage.VolumeParams, results []storage.CreateVolumesResult) {
for i, p := range params {
if results[i].Error != nil {
continue
}
volume, err := v.createManagedDiskVolume(ctx, p)
if err != nil {
results[i].Erro... | [
"func",
"(",
"v",
"*",
"azureVolumeSource",
")",
"createManagedDiskVolumes",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"params",
"[",
"]",
"storage",
".",
"VolumeParams",
",",
"results",
"[",
"]",
"storage",
".",
"CreateVolumesResult",
")",
"{",
... | // createManagedDiskVolumes creates volumes with associated managed disks. | [
"createManagedDiskVolumes",
"creates",
"volumes",
"with",
"associated",
"managed",
"disks",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/storage.go#L181-L193 |
156,665 | juju/juju | provider/azure/storage.go | createManagedDiskVolume | func (v *azureVolumeSource) createManagedDiskVolume(ctx context.ProviderCallContext, p storage.VolumeParams) (*storage.Volume, error) {
cfg, err := newAzureStorageConfig(p.Attributes)
if err != nil {
return nil, errors.Trace(err)
}
diskTags := make(map[string]*string)
for k, v := range p.ResourceTags {
diskTa... | go | func (v *azureVolumeSource) createManagedDiskVolume(ctx context.ProviderCallContext, p storage.VolumeParams) (*storage.Volume, error) {
cfg, err := newAzureStorageConfig(p.Attributes)
if err != nil {
return nil, errors.Trace(err)
}
diskTags := make(map[string]*string)
for k, v := range p.ResourceTags {
diskTa... | [
"func",
"(",
"v",
"*",
"azureVolumeSource",
")",
"createManagedDiskVolume",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"p",
"storage",
".",
"VolumeParams",
")",
"(",
"*",
"storage",
".",
"Volume",
",",
"error",
")",
"{",
"cfg",
",",
"err",
":=... | // createManagedDiskVolume creates a managed disk. | [
"createManagedDiskVolume",
"creates",
"a",
"managed",
"disk",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/storage.go#L196-L245 |
156,666 | juju/juju | provider/azure/storage.go | createUnmanagedDiskVolume | func (v *azureVolumeSource) createUnmanagedDiskVolume(
vm *compute.VirtualMachine,
p storage.VolumeParams,
) (*storage.Volume, *storage.VolumeAttachment, error) {
diskName := p.Tag.String()
sizeInGib := mibToGib(p.Size)
volumeAttachment, err := v.addDataDisk(
vm,
diskName,
p.Tag,
p.Attachment.Machine,
c... | go | func (v *azureVolumeSource) createUnmanagedDiskVolume(
vm *compute.VirtualMachine,
p storage.VolumeParams,
) (*storage.Volume, *storage.VolumeAttachment, error) {
diskName := p.Tag.String()
sizeInGib := mibToGib(p.Size)
volumeAttachment, err := v.addDataDisk(
vm,
diskName,
p.Tag,
p.Attachment.Machine,
c... | [
"func",
"(",
"v",
"*",
"azureVolumeSource",
")",
"createUnmanagedDiskVolume",
"(",
"vm",
"*",
"compute",
".",
"VirtualMachine",
",",
"p",
"storage",
".",
"VolumeParams",
",",
")",
"(",
"*",
"storage",
".",
"Volume",
",",
"*",
"storage",
".",
"VolumeAttachmen... | // createUnmanagedDiskVolume updates the provided VirtualMachine's
// StorageProfile with the parameters for creating a new unmanaged
// data disk. We don't actually interact with the Azure API until
// after all changes to the VirtualMachine are made. | [
"createUnmanagedDiskVolume",
"updates",
"the",
"provided",
"VirtualMachine",
"s",
"StorageProfile",
"with",
"the",
"parameters",
"for",
"creating",
"a",
"new",
"unmanaged",
"data",
"disk",
".",
"We",
"don",
"t",
"actually",
"interact",
"with",
"the",
"Azure",
"API... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/storage.go#L306-L335 |
156,667 | juju/juju | provider/azure/storage.go | listBlobs | func (v *azureVolumeSource) listBlobs(ctx context.ProviderCallContext) ([]internalazurestorage.Blob, error) {
blobsClient := v.maybeStorageClient.GetBlobService()
vhdContainer := blobsClient.GetContainerReference(dataDiskVHDContainer)
// TODO(axw) consider taking a set of IDs and computing the
// longest ... | go | func (v *azureVolumeSource) listBlobs(ctx context.ProviderCallContext) ([]internalazurestorage.Blob, error) {
blobsClient := v.maybeStorageClient.GetBlobService()
vhdContainer := blobsClient.GetContainerReference(dataDiskVHDContainer)
// TODO(axw) consider taking a set of IDs and computing the
// longest ... | [
"func",
"(",
"v",
"*",
"azureVolumeSource",
")",
"listBlobs",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
")",
"(",
"[",
"]",
"internalazurestorage",
".",
"Blob",
",",
"error",
")",
"{",
"blobsClient",
":=",
"v",
".",
"maybeStorageClient",
".",
"GetBl... | // listBlobs returns a list of blobs in the data-disk container. | [
"listBlobs",
"returns",
"a",
"list",
"of",
"blobs",
"in",
"the",
"data",
"-",
"disk",
"container",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/storage.go#L383-L400 |
156,668 | juju/juju | provider/azure/storage.go | diskResourceID | func (v *azureVolumeSource) diskResourceID(name string) string {
return path.Join(
"/subscriptions",
v.env.subscriptionId,
"resourceGroups",
v.env.resourceGroup,
"providers",
"Microsoft.Compute",
"disks",
name,
)
} | go | func (v *azureVolumeSource) diskResourceID(name string) string {
return path.Join(
"/subscriptions",
v.env.subscriptionId,
"resourceGroups",
v.env.resourceGroup,
"providers",
"Microsoft.Compute",
"disks",
name,
)
} | [
"func",
"(",
"v",
"*",
"azureVolumeSource",
")",
"diskResourceID",
"(",
"name",
"string",
")",
"string",
"{",
"return",
"path",
".",
"Join",
"(",
"\"",
"\"",
",",
"v",
".",
"env",
".",
"subscriptionId",
",",
"\"",
"\"",
",",
"v",
".",
"env",
".",
"... | // diskResourceID returns the full resource ID for a disk, given its name. | [
"diskResourceID",
"returns",
"the",
"full",
"resource",
"ID",
"for",
"a",
"disk",
"given",
"its",
"name",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/storage.go#L768-L779 |
156,669 | juju/juju | provider/azure/storage.go | virtualMachines | func (v *azureVolumeSource) virtualMachines(ctx context.ProviderCallContext, instanceIds []instance.Id) (map[instance.Id]*maybeVirtualMachine, error) {
vmsClient := compute.VirtualMachinesClient{v.env.compute}
sdkCtx := stdcontext.Background()
result, err := vmsClient.ListComplete(sdkCtx, v.env.resourceGroup)
if er... | go | func (v *azureVolumeSource) virtualMachines(ctx context.ProviderCallContext, instanceIds []instance.Id) (map[instance.Id]*maybeVirtualMachine, error) {
vmsClient := compute.VirtualMachinesClient{v.env.compute}
sdkCtx := stdcontext.Background()
result, err := vmsClient.ListComplete(sdkCtx, v.env.resourceGroup)
if er... | [
"func",
"(",
"v",
"*",
"azureVolumeSource",
")",
"virtualMachines",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"instanceIds",
"[",
"]",
"instance",
".",
"Id",
")",
"(",
"map",
"[",
"instance",
".",
"Id",
"]",
"*",
"maybeVirtualMachine",
",",
"... | // virtualMachines returns a mapping of instance IDs to VirtualMachines and
// errors, for each of the specified instance IDs. | [
"virtualMachines",
"returns",
"a",
"mapping",
"of",
"instance",
"IDs",
"to",
"VirtualMachines",
"and",
"errors",
"for",
"each",
"of",
"the",
"specified",
"instance",
"IDs",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/storage.go#L788-L813 |
156,670 | juju/juju | provider/azure/storage.go | updateVirtualMachines | func (v *azureVolumeSource) updateVirtualMachines(
ctx context.ProviderCallContext,
virtualMachines map[instance.Id]*maybeVirtualMachine, instanceIds []instance.Id,
) ([]error, error) {
results := make([]error, len(instanceIds))
vmsClient := compute.VirtualMachinesClient{v.env.compute}
for i, instanceId := range i... | go | func (v *azureVolumeSource) updateVirtualMachines(
ctx context.ProviderCallContext,
virtualMachines map[instance.Id]*maybeVirtualMachine, instanceIds []instance.Id,
) ([]error, error) {
results := make([]error, len(instanceIds))
vmsClient := compute.VirtualMachinesClient{v.env.compute}
for i, instanceId := range i... | [
"func",
"(",
"v",
"*",
"azureVolumeSource",
")",
"updateVirtualMachines",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"virtualMachines",
"map",
"[",
"instance",
".",
"Id",
"]",
"*",
"maybeVirtualMachine",
",",
"instanceIds",
"[",
"]",
"instance",
"."... | // updateVirtualMachines updates virtual machines in the given map by iterating
// through the list of instance IDs in order, and updating each corresponding
// virtual machine at most once. | [
"updateVirtualMachines",
"updates",
"virtual",
"machines",
"in",
"the",
"given",
"map",
"by",
"iterating",
"through",
"the",
"list",
"of",
"instance",
"IDs",
"in",
"order",
"and",
"updating",
"each",
"corresponding",
"virtual",
"machine",
"at",
"most",
"once",
"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/storage.go#L818-L862 |
156,671 | juju/juju | provider/azure/storage.go | blobContainerURL | func blobContainerURL(storageAccount *armstorage.Account, container string) string {
return fmt.Sprintf(
"%s%s/",
to.String(storageAccount.PrimaryEndpoints.Blob),
container,
)
} | go | func blobContainerURL(storageAccount *armstorage.Account, container string) string {
return fmt.Sprintf(
"%s%s/",
to.String(storageAccount.PrimaryEndpoints.Blob),
container,
)
} | [
"func",
"blobContainerURL",
"(",
"storageAccount",
"*",
"armstorage",
".",
"Account",
",",
"container",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"to",
".",
"String",
"(",
"storageAccount",
".",
"PrimaryEndpoints",
... | // blobContainer returns the URL to the named blob container. | [
"blobContainer",
"returns",
"the",
"URL",
"to",
"the",
"named",
"blob",
"container",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/storage.go#L911-L917 |
156,672 | juju/juju | provider/azure/storage.go | blobVolumeId | func blobVolumeId(blob internalazurestorage.Blob) (string, bool) {
blobName := blob.Name()
if !strings.HasSuffix(blobName, vhdExtension) {
return "", false
}
volumeId := blobName[:len(blobName)-len(vhdExtension)]
if _, err := names.ParseVolumeTag(volumeId); err != nil {
return "", false
}
return volumeId, tr... | go | func blobVolumeId(blob internalazurestorage.Blob) (string, bool) {
blobName := blob.Name()
if !strings.HasSuffix(blobName, vhdExtension) {
return "", false
}
volumeId := blobName[:len(blobName)-len(vhdExtension)]
if _, err := names.ParseVolumeTag(volumeId); err != nil {
return "", false
}
return volumeId, tr... | [
"func",
"blobVolumeId",
"(",
"blob",
"internalazurestorage",
".",
"Blob",
")",
"(",
"string",
",",
"bool",
")",
"{",
"blobName",
":=",
"blob",
".",
"Name",
"(",
")",
"\n",
"if",
"!",
"strings",
".",
"HasSuffix",
"(",
"blobName",
",",
"vhdExtension",
")",... | // blobVolumeId returns the volume ID for a blob, and a boolean reporting
// whether or not the blob's name matches the scheme we use. | [
"blobVolumeId",
"returns",
"the",
"volume",
"ID",
"for",
"a",
"blob",
"and",
"a",
"boolean",
"reporting",
"whether",
"or",
"not",
"the",
"blob",
"s",
"name",
"matches",
"the",
"scheme",
"we",
"use",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/storage.go#L921-L931 |
156,673 | juju/juju | provider/azure/storage.go | getStorageClient | func getStorageClient(
newClient internalazurestorage.NewClientFunc,
storageEndpoint string,
storageAccount *armstorage.Account,
storageAccountKey *armstorage.AccountKey,
) (internalazurestorage.Client, error) {
storageAccountName := to.String(storageAccount.Name)
const useHTTPS = true
return newClient(
storag... | go | func getStorageClient(
newClient internalazurestorage.NewClientFunc,
storageEndpoint string,
storageAccount *armstorage.Account,
storageAccountKey *armstorage.AccountKey,
) (internalazurestorage.Client, error) {
storageAccountName := to.String(storageAccount.Name)
const useHTTPS = true
return newClient(
storag... | [
"func",
"getStorageClient",
"(",
"newClient",
"internalazurestorage",
".",
"NewClientFunc",
",",
"storageEndpoint",
"string",
",",
"storageAccount",
"*",
"armstorage",
".",
"Account",
",",
"storageAccountKey",
"*",
"armstorage",
".",
"AccountKey",
",",
")",
"(",
"in... | // getStorageClient returns a new storage client, given an environ config
// and a constructor. | [
"getStorageClient",
"returns",
"a",
"new",
"storage",
"client",
"given",
"an",
"environ",
"config",
"and",
"a",
"constructor",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/storage.go#L935-L950 |
156,674 | juju/juju | provider/azure/storage.go | getStorageAccountKey | func getStorageAccountKey(
client armstorage.AccountsClient,
resourceGroup, accountName string,
) (*armstorage.AccountKey, error) {
logger.Debugf("getting keys for storage account %q", accountName)
sdkCtx := stdcontext.Background()
listKeysResult, err := client.ListKeys(sdkCtx, resourceGroup, accountName)
if err ... | go | func getStorageAccountKey(
client armstorage.AccountsClient,
resourceGroup, accountName string,
) (*armstorage.AccountKey, error) {
logger.Debugf("getting keys for storage account %q", accountName)
sdkCtx := stdcontext.Background()
listKeysResult, err := client.ListKeys(sdkCtx, resourceGroup, accountName)
if err ... | [
"func",
"getStorageAccountKey",
"(",
"client",
"armstorage",
".",
"AccountsClient",
",",
"resourceGroup",
",",
"accountName",
"string",
",",
")",
"(",
"*",
"armstorage",
".",
"AccountKey",
",",
"error",
")",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
","... | // getStorageAccountKey returns the key for the storage account. | [
"getStorageAccountKey",
"returns",
"the",
"key",
"for",
"the",
"storage",
"account",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/storage.go#L953-L989 |
156,675 | juju/juju | provider/azure/storage.go | storageAccountTemplateResource | func storageAccountTemplateResource(
location string,
envTags map[string]string,
accountName, accountType string,
) armtemplates.Resource {
return armtemplates.Resource{
APIVersion: storageAPIVersion,
Type: "Microsoft.Storage/storageAccounts",
Name: accountName,
Location: location,
Tags: ... | go | func storageAccountTemplateResource(
location string,
envTags map[string]string,
accountName, accountType string,
) armtemplates.Resource {
return armtemplates.Resource{
APIVersion: storageAPIVersion,
Type: "Microsoft.Storage/storageAccounts",
Name: accountName,
Location: location,
Tags: ... | [
"func",
"storageAccountTemplateResource",
"(",
"location",
"string",
",",
"envTags",
"map",
"[",
"string",
"]",
"string",
",",
"accountName",
",",
"accountType",
"string",
",",
")",
"armtemplates",
".",
"Resource",
"{",
"return",
"armtemplates",
".",
"Resource",
... | // storageAccountTemplateResource returns a template resource definition
// for creating a storage account. | [
"storageAccountTemplateResource",
"returns",
"a",
"template",
"resource",
"definition",
"for",
"creating",
"a",
"storage",
"account",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/azure/storage.go#L993-L1008 |
156,676 | juju/juju | apiserver/common/modelmachineswatcher.go | NewModelMachinesWatcher | func NewModelMachinesWatcher(st state.ModelMachinesWatcher, resources facade.Resources, authorizer facade.Authorizer) *ModelMachinesWatcher {
return &ModelMachinesWatcher{
st: st,
resources: resources,
authorizer: authorizer,
}
} | go | func NewModelMachinesWatcher(st state.ModelMachinesWatcher, resources facade.Resources, authorizer facade.Authorizer) *ModelMachinesWatcher {
return &ModelMachinesWatcher{
st: st,
resources: resources,
authorizer: authorizer,
}
} | [
"func",
"NewModelMachinesWatcher",
"(",
"st",
"state",
".",
"ModelMachinesWatcher",
",",
"resources",
"facade",
".",
"Resources",
",",
"authorizer",
"facade",
".",
"Authorizer",
")",
"*",
"ModelMachinesWatcher",
"{",
"return",
"&",
"ModelMachinesWatcher",
"{",
"st",... | // NewModelMachinesWatcher returns a new ModelMachinesWatcher. The
// GetAuthFunc will be used on each invocation of WatchUnits to
// determine current permissions. | [
"NewModelMachinesWatcher",
"returns",
"a",
"new",
"ModelMachinesWatcher",
".",
"The",
"GetAuthFunc",
"will",
"be",
"used",
"on",
"each",
"invocation",
"of",
"WatchUnits",
"to",
"determine",
"current",
"permissions",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/modelmachineswatcher.go#L26-L32 |
156,677 | juju/juju | apiserver/common/modelmachineswatcher.go | WatchModelMachines | func (e *ModelMachinesWatcher) WatchModelMachines() (params.StringsWatchResult, error) {
result := params.StringsWatchResult{}
if !e.authorizer.AuthController() {
return result, ErrPerm
}
watch := e.st.WatchModelMachines()
// Consume the initial event and forward it to the result.
if changes, ok := <-watch.Chan... | go | func (e *ModelMachinesWatcher) WatchModelMachines() (params.StringsWatchResult, error) {
result := params.StringsWatchResult{}
if !e.authorizer.AuthController() {
return result, ErrPerm
}
watch := e.st.WatchModelMachines()
// Consume the initial event and forward it to the result.
if changes, ok := <-watch.Chan... | [
"func",
"(",
"e",
"*",
"ModelMachinesWatcher",
")",
"WatchModelMachines",
"(",
")",
"(",
"params",
".",
"StringsWatchResult",
",",
"error",
")",
"{",
"result",
":=",
"params",
".",
"StringsWatchResult",
"{",
"}",
"\n",
"if",
"!",
"e",
".",
"authorizer",
".... | // WatchModelMachines returns a StringsWatcher that notifies of
// changes to the life cycles of the top level machines in the current
// model. | [
"WatchModelMachines",
"returns",
"a",
"StringsWatcher",
"that",
"notifies",
"of",
"changes",
"to",
"the",
"life",
"cycles",
"of",
"the",
"top",
"level",
"machines",
"in",
"the",
"current",
"model",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/modelmachineswatcher.go#L37-L52 |
156,678 | juju/juju | apiserver/stateauthenticator/modeluser.go | FindEntity | func (f modelUserEntityFinder) FindEntity(tag names.Tag) (state.Entity, error) {
utag, ok := tag.(names.UserTag)
if !ok {
return f.st.FindEntity(tag)
}
model, err := f.st.Model()
if err != nil {
return nil, errors.Trace(err)
}
modelUser, err := f.st.UserAccess(utag, model.ModelTag())
if err != nil && !erro... | go | func (f modelUserEntityFinder) FindEntity(tag names.Tag) (state.Entity, error) {
utag, ok := tag.(names.UserTag)
if !ok {
return f.st.FindEntity(tag)
}
model, err := f.st.Model()
if err != nil {
return nil, errors.Trace(err)
}
modelUser, err := f.st.UserAccess(utag, model.ModelTag())
if err != nil && !erro... | [
"func",
"(",
"f",
"modelUserEntityFinder",
")",
"FindEntity",
"(",
"tag",
"names",
".",
"Tag",
")",
"(",
"state",
".",
"Entity",
",",
"error",
")",
"{",
"utag",
",",
"ok",
":=",
"tag",
".",
"(",
"names",
".",
"UserTag",
")",
"\n",
"if",
"!",
"ok",
... | // FindEntity implements state.EntityFinder. | [
"FindEntity",
"implements",
"state",
".",
"EntityFinder",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/stateauthenticator/modeluser.go#L34-L86 |
156,679 | juju/juju | apiserver/stateauthenticator/modeluser.go | Refresh | func (u *modelUserEntity) Refresh() error {
if u.user == nil {
return nil
}
return u.user.Refresh()
} | go | func (u *modelUserEntity) Refresh() error {
if u.user == nil {
return nil
}
return u.user.Refresh()
} | [
"func",
"(",
"u",
"*",
"modelUserEntity",
")",
"Refresh",
"(",
")",
"error",
"{",
"if",
"u",
".",
"user",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"u",
".",
"user",
".",
"Refresh",
"(",
")",
"\n",
"}"
] | // Refresh implements state.Authenticator.Refresh. | [
"Refresh",
"implements",
"state",
".",
"Authenticator",
".",
"Refresh",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/stateauthenticator/modeluser.go#L102-L107 |
156,680 | juju/juju | apiserver/stateauthenticator/modeluser.go | SetPassword | func (u *modelUserEntity) SetPassword(pass string) error {
if u.user == nil {
return errors.New("cannot set password on external user")
}
return u.user.SetPassword(pass)
} | go | func (u *modelUserEntity) SetPassword(pass string) error {
if u.user == nil {
return errors.New("cannot set password on external user")
}
return u.user.SetPassword(pass)
} | [
"func",
"(",
"u",
"*",
"modelUserEntity",
")",
"SetPassword",
"(",
"pass",
"string",
")",
"error",
"{",
"if",
"u",
".",
"user",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"u",
".",
"user",
"... | // SetPassword implements state.Authenticator.SetPassword
// by setting the password on the local user. | [
"SetPassword",
"implements",
"state",
".",
"Authenticator",
".",
"SetPassword",
"by",
"setting",
"the",
"password",
"on",
"the",
"local",
"user",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/stateauthenticator/modeluser.go#L111-L116 |
156,681 | juju/juju | apiserver/stateauthenticator/modeluser.go | PasswordValid | func (u *modelUserEntity) PasswordValid(pass string) bool {
if u.user == nil {
return false
}
return u.user.PasswordValid(pass)
} | go | func (u *modelUserEntity) PasswordValid(pass string) bool {
if u.user == nil {
return false
}
return u.user.PasswordValid(pass)
} | [
"func",
"(",
"u",
"*",
"modelUserEntity",
")",
"PasswordValid",
"(",
"pass",
"string",
")",
"bool",
"{",
"if",
"u",
".",
"user",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"u",
".",
"user",
".",
"PasswordValid",
"(",
"pass",
")",... | // PasswordValid implements state.Authenticator.PasswordValid. | [
"PasswordValid",
"implements",
"state",
".",
"Authenticator",
".",
"PasswordValid",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/stateauthenticator/modeluser.go#L119-L124 |
156,682 | juju/juju | apiserver/stateauthenticator/modeluser.go | LastLogin | func (u *modelUserEntity) LastLogin() (time.Time, error) {
// The last connection for the model takes precedence over
// the local user last login time.
var err error
var t time.Time
model, err := u.st.Model()
if err != nil {
return t, errors.Trace(err)
}
if !permission.IsEmptyUserAccess(u.modelUser) {
t,... | go | func (u *modelUserEntity) LastLogin() (time.Time, error) {
// The last connection for the model takes precedence over
// the local user last login time.
var err error
var t time.Time
model, err := u.st.Model()
if err != nil {
return t, errors.Trace(err)
}
if !permission.IsEmptyUserAccess(u.modelUser) {
t,... | [
"func",
"(",
"u",
"*",
"modelUserEntity",
")",
"LastLogin",
"(",
")",
"(",
"time",
".",
"Time",
",",
"error",
")",
"{",
"// The last connection for the model takes precedence over",
"// the local user last login time.",
"var",
"err",
"error",
"\n",
"var",
"t",
"time... | // LastLogin implements loginEntity.LastLogin. | [
"LastLogin",
"implements",
"loginEntity",
".",
"LastLogin",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/stateauthenticator/modeluser.go#L132-L158 |
156,683 | juju/juju | apiserver/stateauthenticator/modeluser.go | UpdateLastLogin | func (u *modelUserEntity) UpdateLastLogin() error {
var err error
if !permission.IsEmptyUserAccess(u.modelUser) {
if u.modelUser.Object.Kind() != names.ModelTagKind {
return errors.NotValidf("%s as model user", u.modelUser.Object.Kind())
}
model, err := u.st.Model()
if err != nil {
return errors.Trace... | go | func (u *modelUserEntity) UpdateLastLogin() error {
var err error
if !permission.IsEmptyUserAccess(u.modelUser) {
if u.modelUser.Object.Kind() != names.ModelTagKind {
return errors.NotValidf("%s as model user", u.modelUser.Object.Kind())
}
model, err := u.st.Model()
if err != nil {
return errors.Trace... | [
"func",
"(",
"u",
"*",
"modelUserEntity",
")",
"UpdateLastLogin",
"(",
")",
"error",
"{",
"var",
"err",
"error",
"\n\n",
"if",
"!",
"permission",
".",
"IsEmptyUserAccess",
"(",
"u",
".",
"modelUser",
")",
"{",
"if",
"u",
".",
"modelUser",
".",
"Object",
... | // UpdateLastLogin implements loginEntity.UpdateLastLogin. | [
"UpdateLastLogin",
"implements",
"loginEntity",
".",
"UpdateLastLogin",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/stateauthenticator/modeluser.go#L161-L187 |
156,684 | juju/juju | apiserver/facades/client/backups/restore.go | Restore | func (a *API) Restore(p params.RestoreArgs) error {
logger.Infof("Starting server side restore")
// Get hold of a backup file Reader
backup, closer := newBackups(a.backend)
defer closer.Close()
// Obtain the address of current machine, where we will be performing restore.
machine, err := a.backend.Machine(a.mac... | go | func (a *API) Restore(p params.RestoreArgs) error {
logger.Infof("Starting server side restore")
// Get hold of a backup file Reader
backup, closer := newBackups(a.backend)
defer closer.Close()
// Obtain the address of current machine, where we will be performing restore.
machine, err := a.backend.Machine(a.mac... | [
"func",
"(",
"a",
"*",
"API",
")",
"Restore",
"(",
"p",
"params",
".",
"RestoreArgs",
")",
"error",
"{",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n\n",
"// Get hold of a backup file Reader",
"backup",
",",
"closer",
":=",
"newBackups",
"(",
"a",
"... | // Restore implements the server side of Backups.Restore. | [
"Restore",
"implements",
"the",
"server",
"side",
"of",
"Backups",
".",
"Restore",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/backups/restore.go#L23-L122 |
156,685 | juju/juju | apiserver/facades/client/backups/restore.go | PrepareRestore | func (a *API) PrepareRestore() error {
info := a.backend.RestoreInfo()
logger.Infof("entering restore preparation mode")
return info.SetStatus(state.RestorePending)
} | go | func (a *API) PrepareRestore() error {
info := a.backend.RestoreInfo()
logger.Infof("entering restore preparation mode")
return info.SetStatus(state.RestorePending)
} | [
"func",
"(",
"a",
"*",
"API",
")",
"PrepareRestore",
"(",
")",
"error",
"{",
"info",
":=",
"a",
".",
"backend",
".",
"RestoreInfo",
"(",
")",
"\n",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"return",
"info",
".",
"SetStatus",
"(",
"state"... | // PrepareRestore implements the server side of Backups.PrepareRestore. | [
"PrepareRestore",
"implements",
"the",
"server",
"side",
"of",
"Backups",
".",
"PrepareRestore",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/backups/restore.go#L125-L129 |
156,686 | juju/juju | apiserver/facades/client/backups/restore.go | FinishRestore | func (a *API) FinishRestore() error {
info := a.backend.RestoreInfo()
currentStatus, err := info.Status()
if err != nil {
return errors.Trace(err)
}
if currentStatus != state.RestoreFinished {
if err := info.SetStatus(state.RestoreFailed); err != nil {
return errors.Trace(err)
}
return errors.Errorf("Re... | go | func (a *API) FinishRestore() error {
info := a.backend.RestoreInfo()
currentStatus, err := info.Status()
if err != nil {
return errors.Trace(err)
}
if currentStatus != state.RestoreFinished {
if err := info.SetStatus(state.RestoreFailed); err != nil {
return errors.Trace(err)
}
return errors.Errorf("Re... | [
"func",
"(",
"a",
"*",
"API",
")",
"FinishRestore",
"(",
")",
"error",
"{",
"info",
":=",
"a",
".",
"backend",
".",
"RestoreInfo",
"(",
")",
"\n",
"currentStatus",
",",
"err",
":=",
"info",
".",
"Status",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // FinishRestore implements the server side of Backups.FinishRestore. | [
"FinishRestore",
"implements",
"the",
"server",
"side",
"of",
"Backups",
".",
"FinishRestore",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/backups/restore.go#L132-L146 |
156,687 | juju/juju | mongo/mongometrics/mgostatsmetrics.go | NewMgoStatsCollector | func NewMgoStatsCollector(getCurrentStats func() mgo.Stats) *MgoStatsCollector {
// We need to track previous statistics so we can
// compute the delta for counter metrics.
var mu sync.Mutex
var prevStats stats
getStats := func() (current, previous stats) {
mu.Lock()
defer mu.Unlock()
previous = prevStats
... | go | func NewMgoStatsCollector(getCurrentStats func() mgo.Stats) *MgoStatsCollector {
// We need to track previous statistics so we can
// compute the delta for counter metrics.
var mu sync.Mutex
var prevStats stats
getStats := func() (current, previous stats) {
mu.Lock()
defer mu.Unlock()
previous = prevStats
... | [
"func",
"NewMgoStatsCollector",
"(",
"getCurrentStats",
"func",
"(",
")",
"mgo",
".",
"Stats",
")",
"*",
"MgoStatsCollector",
"{",
"// We need to track previous statistics so we can",
"// compute the delta for counter metrics.",
"var",
"mu",
"sync",
".",
"Mutex",
"\n",
"v... | // NewMgoStatsCollector returns a new MgoStatsCollector. | [
"NewMgoStatsCollector",
"returns",
"a",
"new",
"MgoStatsCollector",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/mongo/mongometrics/mgostatsmetrics.go#L42-L116 |
156,688 | juju/juju | apiserver/facades/controller/applicationscaler/shim.go | RescaleService | func (shim backendShim) RescaleService(name string) error {
service, err := shim.st.Application(name)
if err != nil {
return errors.Trace(err)
}
return service.EnsureMinUnits()
} | go | func (shim backendShim) RescaleService(name string) error {
service, err := shim.st.Application(name)
if err != nil {
return errors.Trace(err)
}
return service.EnsureMinUnits()
} | [
"func",
"(",
"shim",
"backendShim",
")",
"RescaleService",
"(",
"name",
"string",
")",
"error",
"{",
"service",
",",
"err",
":=",
"shim",
".",
"st",
".",
"Application",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"... | // RescaleService is part of the Backend interface. | [
"RescaleService",
"is",
"part",
"of",
"the",
"Backend",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/applicationscaler/shim.go#L40-L46 |
156,689 | juju/juju | worker/raft/raftforwarder/worker.go | Validate | func (config Config) Validate() error {
if config.Hub == nil {
return errors.NotValidf("nil Hub")
}
if config.Raft == nil {
return errors.NotValidf("nil Raft")
}
if config.Logger == nil {
return errors.NotValidf("nil Logger")
}
if config.Topic == "" {
return errors.NotValidf("empty Topic")
}
if config.... | go | func (config Config) Validate() error {
if config.Hub == nil {
return errors.NotValidf("nil Hub")
}
if config.Raft == nil {
return errors.NotValidf("nil Raft")
}
if config.Logger == nil {
return errors.NotValidf("nil Logger")
}
if config.Topic == "" {
return errors.NotValidf("empty Topic")
}
if config.... | [
"func",
"(",
"config",
"Config",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"config",
".",
"Hub",
"==",
"nil",
"{",
"return",
"errors",
".",
"NotValidf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"config",
".",
"Raft",
"==",
"nil",
"{",
"r... | // Validate checks that this config can be used. | [
"Validate",
"checks",
"that",
"this",
"config",
"can",
"be",
"used",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/raft/raftforwarder/worker.go#L45-L62 |
156,690 | juju/juju | worker/raft/raftforwarder/worker.go | NewWorker | func NewWorker(config Config) (worker.Worker, error) {
if err := config.Validate(); err != nil {
return nil, errors.Trace(err)
}
w := &forwarder{
config: config,
}
unsubscribe, err := w.config.Hub.Subscribe(w.config.Topic, w.handleRequest)
if err != nil {
return nil, errors.Annotatef(err, "subscribing to %q... | go | func NewWorker(config Config) (worker.Worker, error) {
if err := config.Validate(); err != nil {
return nil, errors.Trace(err)
}
w := &forwarder{
config: config,
}
unsubscribe, err := w.config.Hub.Subscribe(w.config.Topic, w.handleRequest)
if err != nil {
return nil, errors.Annotatef(err, "subscribing to %q... | [
"func",
"NewWorker",
"(",
"config",
"Config",
")",
"(",
"worker",
".",
"Worker",
",",
"error",
")",
"{",
"if",
"err",
":=",
"config",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Trace",
"(",
"err",... | // NewWorker creates and starts a worker that will forward leadership
// claims from non-raft-leader machines. | [
"NewWorker",
"creates",
"and",
"starts",
"a",
"worker",
"that",
"will",
"forward",
"leadership",
"claims",
"from",
"non",
"-",
"raft",
"-",
"leader",
"machines",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/raft/raftforwarder/worker.go#L66-L86 |
156,691 | juju/juju | cloudconfig/cloudinit/cloudinit_ubuntu.go | AddPackageSource | func (cfg *ubuntuCloudConfig) AddPackageSource(src packaging.PackageSource) {
cfg.attrs["apt_sources"] = append(cfg.PackageSources(), src)
} | go | func (cfg *ubuntuCloudConfig) AddPackageSource(src packaging.PackageSource) {
cfg.attrs["apt_sources"] = append(cfg.PackageSources(), src)
} | [
"func",
"(",
"cfg",
"*",
"ubuntuCloudConfig",
")",
"AddPackageSource",
"(",
"src",
"packaging",
".",
"PackageSource",
")",
"{",
"cfg",
".",
"attrs",
"[",
"\"",
"\"",
"]",
"=",
"append",
"(",
"cfg",
".",
"PackageSources",
"(",
")",
",",
"src",
")",
"\n"... | // AddPackageSource is defined on the PackageSourcesConfig interface. | [
"AddPackageSource",
"is",
"defined",
"on",
"the",
"PackageSourcesConfig",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloudconfig/cloudinit/cloudinit_ubuntu.go#L60-L62 |
156,692 | juju/juju | cloudconfig/cloudinit/cloudinit_ubuntu.go | AddPackagePreferences | func (cfg *ubuntuCloudConfig) AddPackagePreferences(prefs packaging.PackagePreferences) {
cfg.attrs["apt_preferences"] = append(cfg.PackagePreferences(), prefs)
} | go | func (cfg *ubuntuCloudConfig) AddPackagePreferences(prefs packaging.PackagePreferences) {
cfg.attrs["apt_preferences"] = append(cfg.PackagePreferences(), prefs)
} | [
"func",
"(",
"cfg",
"*",
"ubuntuCloudConfig",
")",
"AddPackagePreferences",
"(",
"prefs",
"packaging",
".",
"PackagePreferences",
")",
"{",
"cfg",
".",
"attrs",
"[",
"\"",
"\"",
"]",
"=",
"append",
"(",
"cfg",
".",
"PackagePreferences",
"(",
")",
",",
"pre... | // AddPackagePreferences is defined on the PackageSourcesConfig interface. | [
"AddPackagePreferences",
"is",
"defined",
"on",
"the",
"PackageSourcesConfig",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloudconfig/cloudinit/cloudinit_ubuntu.go#L71-L73 |
156,693 | juju/juju | cloudconfig/cloudinit/cloudinit_ubuntu.go | PackagePreferences | func (cfg *ubuntuCloudConfig) PackagePreferences() []packaging.PackagePreferences {
prefs, _ := cfg.attrs["apt_preferences"].([]packaging.PackagePreferences)
return prefs
} | go | func (cfg *ubuntuCloudConfig) PackagePreferences() []packaging.PackagePreferences {
prefs, _ := cfg.attrs["apt_preferences"].([]packaging.PackagePreferences)
return prefs
} | [
"func",
"(",
"cfg",
"*",
"ubuntuCloudConfig",
")",
"PackagePreferences",
"(",
")",
"[",
"]",
"packaging",
".",
"PackagePreferences",
"{",
"prefs",
",",
"_",
":=",
"cfg",
".",
"attrs",
"[",
"\"",
"\"",
"]",
".",
"(",
"[",
"]",
"packaging",
".",
"Package... | // PackagePreferences is defined on the PackageSourcesConfig interface. | [
"PackagePreferences",
"is",
"defined",
"on",
"the",
"PackageSourcesConfig",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloudconfig/cloudinit/cloudinit_ubuntu.go#L76-L79 |
156,694 | juju/juju | cloudconfig/cloudinit/cloudinit_ubuntu.go | AddCloudArchiveCloudTools | func (cfg *ubuntuCloudConfig) AddCloudArchiveCloudTools() {
src, pref := config.GetCloudArchiveSource(cfg.series)
cfg.AddPackageSource(src)
cfg.AddPackagePreferences(pref)
} | go | func (cfg *ubuntuCloudConfig) AddCloudArchiveCloudTools() {
src, pref := config.GetCloudArchiveSource(cfg.series)
cfg.AddPackageSource(src)
cfg.AddPackagePreferences(pref)
} | [
"func",
"(",
"cfg",
"*",
"ubuntuCloudConfig",
")",
"AddCloudArchiveCloudTools",
"(",
")",
"{",
"src",
",",
"pref",
":=",
"config",
".",
"GetCloudArchiveSource",
"(",
"cfg",
".",
"series",
")",
"\n",
"cfg",
".",
"AddPackageSource",
"(",
"src",
")",
"\n",
"c... | // AddCloudArchiveCloudTools is defined on the AdvancedPackagingConfig
// interface. | [
"AddCloudArchiveCloudTools",
"is",
"defined",
"on",
"the",
"AdvancedPackagingConfig",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloudconfig/cloudinit/cloudinit_ubuntu.go#L137-L141 |
156,695 | juju/juju | cloudconfig/cloudinit/cloudinit_ubuntu.go | renameAptListFilesCommands | func renameAptListFilesCommands(newMirror, oldMirror string) []string {
oldPrefix := "old_prefix=" + config.AptListsDirectory + "/$(echo " + oldMirror + " | " + config.AptSourceListPrefix + ")"
newPrefix := "new_prefix=" + config.AptListsDirectory + "/$(echo " + newMirror + " | " + config.AptSourceListPrefix + ")"
r... | go | func renameAptListFilesCommands(newMirror, oldMirror string) []string {
oldPrefix := "old_prefix=" + config.AptListsDirectory + "/$(echo " + oldMirror + " | " + config.AptSourceListPrefix + ")"
newPrefix := "new_prefix=" + config.AptListsDirectory + "/$(echo " + newMirror + " | " + config.AptSourceListPrefix + ")"
r... | [
"func",
"renameAptListFilesCommands",
"(",
"newMirror",
",",
"oldMirror",
"string",
")",
"[",
"]",
"string",
"{",
"oldPrefix",
":=",
"\"",
"\"",
"+",
"config",
".",
"AptListsDirectory",
"+",
"\"",
"\"",
"+",
"oldMirror",
"+",
"\"",
"\"",
"+",
"config",
"."... | // renameAptListFilesCommands takes a new and old mirror string,
// and returns a sequence of commands that will rename the files
// in aptListsDirectory. | [
"renameAptListFilesCommands",
"takes",
"a",
"new",
"and",
"old",
"mirror",
"string",
"and",
"returns",
"a",
"sequence",
"of",
"commands",
"that",
"will",
"rename",
"the",
"files",
"in",
"aptListsDirectory",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloudconfig/cloudinit/cloudinit_ubuntu.go#L246-L261 |
156,696 | juju/juju | cloudconfig/cloudinit/cloudinit_ubuntu.go | updateProxySettings | func (cfg *ubuntuCloudConfig) updateProxySettings(proxySettings proxy.Settings) {
// Write out the apt proxy settings
if (proxySettings != proxy.Settings{}) {
filename := config.AptProxyConfigFile
cfg.AddBootCmd(fmt.Sprintf(
`printf '%%s\n' %s > %s`,
utils.ShQuote(cfg.paccmder.ProxyConfigContents(proxySetti... | go | func (cfg *ubuntuCloudConfig) updateProxySettings(proxySettings proxy.Settings) {
// Write out the apt proxy settings
if (proxySettings != proxy.Settings{}) {
filename := config.AptProxyConfigFile
cfg.AddBootCmd(fmt.Sprintf(
`printf '%%s\n' %s > %s`,
utils.ShQuote(cfg.paccmder.ProxyConfigContents(proxySetti... | [
"func",
"(",
"cfg",
"*",
"ubuntuCloudConfig",
")",
"updateProxySettings",
"(",
"proxySettings",
"proxy",
".",
"Settings",
")",
"{",
"// Write out the apt proxy settings",
"if",
"(",
"proxySettings",
"!=",
"proxy",
".",
"Settings",
"{",
"}",
")",
"{",
"filename",
... | // Updates proxy settings used when rendering the conf as a script | [
"Updates",
"proxy",
"settings",
"used",
"when",
"rendering",
"the",
"conf",
"as",
"a",
"script"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cloudconfig/cloudinit/cloudinit_ubuntu.go#L303-L312 |
156,697 | juju/juju | cmd/juju/commands/upgrademodel.go | Run | func (c *upgradeJujuCommand) Run(ctx *cmd.Context) (err error) {
modelType, err := c.ModelType()
if err != nil {
return errors.Trace(err)
}
if modelType == model.CAAS {
return c.upgradeCAASModel(ctx)
}
return c.upgradeIAASModel(ctx)
} | go | func (c *upgradeJujuCommand) Run(ctx *cmd.Context) (err error) {
modelType, err := c.ModelType()
if err != nil {
return errors.Trace(err)
}
if modelType == model.CAAS {
return c.upgradeCAASModel(ctx)
}
return c.upgradeIAASModel(ctx)
} | [
"func",
"(",
"c",
"*",
"upgradeJujuCommand",
")",
"Run",
"(",
"ctx",
"*",
"cmd",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"modelType",
",",
"err",
":=",
"c",
".",
"ModelType",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"e... | // Run changes the version proposed for the juju envtools. | [
"Run",
"changes",
"the",
"version",
"proposed",
"for",
"the",
"juju",
"envtools",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/upgrademodel.go#L359-L368 |
156,698 | juju/juju | cmd/juju/commands/upgrademodel.go | initVersions | func (c *upgradeJujuCommand) initVersions(
client toolsAPI, cfg *config.Config, agentVersion version.Number, filterOnPrior bool,
) (*upgradeContext, bool, error) {
if c.Version == agentVersion {
return nil, false, errUpToDate
}
filterVersion := jujuversion.Current
if c.Version != version.Zero {
filterVersion =... | go | func (c *upgradeJujuCommand) initVersions(
client toolsAPI, cfg *config.Config, agentVersion version.Number, filterOnPrior bool,
) (*upgradeContext, bool, error) {
if c.Version == agentVersion {
return nil, false, errUpToDate
}
filterVersion := jujuversion.Current
if c.Version != version.Zero {
filterVersion =... | [
"func",
"(",
"c",
"*",
"upgradeJujuCommand",
")",
"initVersions",
"(",
"client",
"toolsAPI",
",",
"cfg",
"*",
"config",
".",
"Config",
",",
"agentVersion",
"version",
".",
"Number",
",",
"filterOnPrior",
"bool",
",",
")",
"(",
"*",
"upgradeContext",
",",
"... | // initVersions collects state relevant to an upgrade decision. The returned
// agent and client versions, and the list of currently available tools, will
// always be accurate; the chosen version, and the flag indicating development
// mode, may remain blank until uploadTools or validate is called. | [
"initVersions",
"collects",
"state",
"relevant",
"to",
"an",
"upgrade",
"decision",
".",
"The",
"returned",
"agent",
"and",
"client",
"versions",
"and",
"the",
"list",
"of",
"currently",
"available",
"tools",
"will",
"always",
"be",
"accurate",
";",
"the",
"ch... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/upgrademodel.go#L628-L677 |
156,699 | juju/juju | cmd/juju/commands/upgrademodel.go | validate | func (context *upgradeContext) validate() (err error) {
if context.chosen == context.agent {
return errUpToDate
}
// Disallow major.minor version downgrades.
if context.chosen.Major < context.agent.Major ||
context.chosen.Major == context.agent.Major && context.chosen.Minor < context.agent.Minor {
// TODO(fw... | go | func (context *upgradeContext) validate() (err error) {
if context.chosen == context.agent {
return errUpToDate
}
// Disallow major.minor version downgrades.
if context.chosen.Major < context.agent.Major ||
context.chosen.Major == context.agent.Major && context.chosen.Minor < context.agent.Minor {
// TODO(fw... | [
"func",
"(",
"context",
"*",
"upgradeContext",
")",
"validate",
"(",
")",
"(",
"err",
"error",
")",
"{",
"if",
"context",
".",
"chosen",
"==",
"context",
".",
"agent",
"{",
"return",
"errUpToDate",
"\n",
"}",
"\n\n",
"// Disallow major.minor version downgrades... | // validate ensures an upgrade can be done using the chosen agent version.
// If validate returns no error, the environment agent-version can be set to
// the value of the chosen agent field. | [
"validate",
"ensures",
"an",
"upgrade",
"can",
"be",
"done",
"using",
"the",
"chosen",
"agent",
"version",
".",
"If",
"validate",
"returns",
"no",
"error",
"the",
"environment",
"agent",
"-",
"version",
"can",
"be",
"set",
"to",
"the",
"value",
"of",
"the"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/upgrademodel.go#L814-L832 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.