_id stringlengths 2 7 | title stringlengths 1 118 | partition stringclasses 3
values | text stringlengths 52 85.5k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q3300 | UnsetApplicationConfig | train | func (c *Client) UnsetApplicationConfig(branchName, application string, options []string) error {
if c.BestAPIVersion() < 6 {
return errors.NotSupportedf("UnsetApplicationConfig not supported by this version of Juju")
}
args := params.ApplicationConfigUnsetArgs{
Args: []params.ApplicationUnset{{
ApplicationNa... | go | {
"resource": ""
} |
q3301 | ResolveUnitErrors | train | func (c *Client) ResolveUnitErrors(units []string, all, retry bool) error {
if len(units) > 0 && all {
return errors.NotSupportedf("specifying units with all=true")
}
if len(units) != set.NewStrings(units...).Size() {
return errors.New("duplicate unit specified")
}
args := params.UnitsResolved{
All: all,
... | go | {
"resource": ""
} |
q3302 | ApplicationsInfo | train | func (c *Client) ApplicationsInfo(applications []names.ApplicationTag) ([]params.ApplicationInfoResult, error) {
if apiVersion := c.BestAPIVersion(); apiVersion < 9 {
return nil, errors.NotSupportedf("ApplicationsInfo for Application facade v%v", apiVersion)
}
all := make([]params.Entity, len(applications))
for i... | go | {
"resource": ""
} |
q3303 | NewFacadeV7 | train | func NewFacadeV7(ctx facade.Context) (*ModelManagerAPI, error) {
st := ctx.State()
pool := ctx.StatePool()
ctlrSt := pool.SystemState()
auth := ctx.Auth()
var err error
model, err := st.Model()
if err != nil {
return nil, errors.Trace(err)
}
configGetter := stateenvirons.EnvironConfigGetter{State: st, Mode... | go | {
"resource": ""
} |
q3304 | NewFacadeV6 | train | func NewFacadeV6(ctx facade.Context) (*ModelManagerAPIV6, error) {
v7, err := NewFacadeV7(ctx)
if err != nil {
return nil, err
}
return &ModelManagerAPIV6{v7}, nil
} | go | {
"resource": ""
} |
q3305 | NewFacadeV4 | train | func NewFacadeV4(ctx facade.Context) (*ModelManagerAPIV4, error) {
v5, err := NewFacadeV5(ctx)
if err != nil {
return nil, err
}
return &ModelManagerAPIV4{v5}, nil
} | go | {
"resource": ""
} |
q3306 | NewModelManagerAPI | train | func NewModelManagerAPI(
st common.ModelManagerBackend,
ctlrSt common.ModelManagerBackend,
configGetter environs.EnvironConfigGetter,
getBroker newCaasBrokerFunc,
authorizer facade.Authorizer,
m common.Model,
callCtx context.ProviderCallContext,
) (*ModelManagerAPI, error) {
if !authorizer.AuthClient() {
retu... | go | {
"resource": ""
} |
q3307 | authCheck | train | func (m *ModelManagerAPI) authCheck(user names.UserTag) error {
if m.isAdmin {
logger.Tracef("%q is a controller admin", m.apiUser.Id())
return nil
}
// We can't just compare the UserTags themselves as the provider part
// may be unset, and gets replaced with 'local'. We must compare against
// the Canonical ... | go | {
"resource": ""
} |
q3308 | DumpModelsDB | train | func (m *ModelManagerAPI) DumpModelsDB(args params.Entities) params.MapResults {
results := params.MapResults{
Results: make([]params.MapResult, len(args.Entities)),
}
for i, entity := range args.Entities {
dumped, err := m.dumpModelDB(entity)
if err != nil {
results.Results[i].Error = common.ServerError(er... | go | {
"resource": ""
} |
q3309 | DestroyModels | train | func (m *ModelManagerAPIV3) DestroyModels(args params.Entities) (params.ErrorResults, error) {
// v3 DestroyModels is implemented in terms of v4:
// storage is unconditionally destroyed, as was the
// old behaviour.
destroyStorage := true
v4Args := params.DestroyModelsParams{
Models: make([]params.DestroyModelPa... | go | {
"resource": ""
} |
q3310 | DestroyModels | train | func (m *ModelManagerAPI) DestroyModels(args params.DestroyModelsParams) (params.ErrorResults, error) {
results := params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Models)),
}
destroyModel := func(modelUUID string, destroyStorage, force *bool, maxWait *time.Duration) error {
st, releaseSt, err ... | go | {
"resource": ""
} |
q3311 | ModelInfo | train | func (m *ModelManagerAPI) ModelInfo(args params.Entities) (params.ModelInfoResults, error) {
results := params.ModelInfoResults{
Results: make([]params.ModelInfoResult, len(args.Entities)),
}
getModelInfo := func(arg params.Entity) (params.ModelInfo, error) {
tag, err := names.ParseModelTag(arg.Tag)
if err !=... | go | {
"resource": ""
} |
q3312 | ModifyModelAccess | train | func (m *ModelManagerAPI) ModifyModelAccess(args params.ModifyModelAccessRequest) (result params.ErrorResults, _ error) {
result = params.ErrorResults{
Results: make([]params.ErrorResult, len(args.Changes)),
}
canModifyController, err := m.authorizer.HasPermission(permission.SuperuserAccess, m.state.ControllerTag... | go | {
"resource": ""
} |
q3313 | changeModelAccess | train | func changeModelAccess(accessor common.ModelManagerBackend, modelTag names.ModelTag, apiUser, targetUserTag names.UserTag, action params.ModelAction, access permission.Access, userIsAdmin bool) error {
st, release, err := accessor.GetBackend(modelTag.Id())
if err != nil {
return errors.Annotate(err, "could not look... | go | {
"resource": ""
} |
q3314 | ModelDefaultsForClouds | train | func (m *ModelManagerAPI) ModelDefaultsForClouds(args params.Entities) (params.ModelDefaultsResults, error) {
result := params.ModelDefaultsResults{}
if !m.isAdmin {
return result, common.ErrPerm
}
result.Results = make([]params.ModelDefaultsResult, len(args.Entities))
for i, entity := range args.Entities {
cl... | go | {
"resource": ""
} |
q3315 | ModelDefaults | train | func (m *ModelManagerAPIV5) ModelDefaults() (params.ModelDefaultsResult, error) {
result := params.ModelDefaultsResult{}
if !m.isAdmin {
return result, common.ErrPerm
}
return m.modelDefaults(m.model.Cloud()), nil
} | go | {
"resource": ""
} |
q3316 | SetModelDefaults | train | func (m *ModelManagerAPI) SetModelDefaults(args params.SetModelDefaults) (params.ErrorResults, error) {
results := params.ErrorResults{Results: make([]params.ErrorResult, len(args.Config))}
if err := m.check.ChangeAllowed(); err != nil {
return results, errors.Trace(err)
}
for i, arg := range args.Config {
resu... | go | {
"resource": ""
} |
q3317 | UnsetModelDefaults | train | func (m *ModelManagerAPI) UnsetModelDefaults(args params.UnsetModelDefaults) (params.ErrorResults, error) {
results := params.ErrorResults{Results: make([]params.ErrorResult, len(args.Keys))}
if !m.isAdmin {
return results, common.ErrPerm
}
if err := m.check.ChangeAllowed(); err != nil {
return results, errors... | go | {
"resource": ""
} |
q3318 | makeRegionSpec | train | func (m *ModelManagerAPI) makeRegionSpec(cloudTag, r string) (*environs.CloudRegionSpec, error) {
cTag, err := names.ParseCloudTag(cloudTag)
if err != nil {
return nil, errors.Trace(err)
}
rspec, err := environs.NewCloudRegionSpec(cTag.Id(), r)
if err != nil {
return nil, errors.Trace(err)
}
return rspec, ni... | go | {
"resource": ""
} |
q3319 | ChangeModelCredential | train | func (m *ModelManagerAPI) ChangeModelCredential(args params.ChangeModelCredentialsParams) (params.ErrorResults, error) {
if err := m.check.ChangeAllowed(); err != nil {
return params.ErrorResults{}, errors.Trace(err)
}
controllerAdmin, err := m.authorizer.HasPermission(permission.SuperuserAccess, m.state.Controll... | go | {
"resource": ""
} |
q3320 | UnitStatus | train | func (u *Unit) UnitStatus() (params.StatusResult, error) {
var results params.StatusResults
args := params.Entities{
Entities: []params.Entity{
{Tag: u.tag.String()},
},
}
err := u.st.facade.FacadeCall("UnitStatus", args, &results)
if err != nil {
return params.StatusResult{}, errors.Trace(err)
}
if len... | go | {
"resource": ""
} |
q3321 | AddMetrics | train | func (u *Unit) AddMetrics(metrics []params.Metric) error {
var result params.ErrorResults
args := params.MetricsParams{
Metrics: []params.MetricsParam{{
Tag: u.tag.String(),
Metrics: metrics,
}},
}
err := u.st.facade.FacadeCall("AddMetrics", args, &result)
if err != nil {
return errors.Annotate(err... | go | {
"resource": ""
} |
q3322 | AddMetricBatches | train | func (u *Unit) AddMetricBatches(batches []params.MetricBatch) (map[string]error, error) {
p := params.MetricBatchParams{
Batches: make([]params.MetricBatchParam, len(batches)),
}
batchResults := make(map[string]error, len(batches))
for i, batch := range batches {
p.Batches[i].Tag = u.tag.String()
p.Batches[... | go | {
"resource": ""
} |
q3323 | Watch | train | func (u *Unit) Watch() (watcher.NotifyWatcher, error) {
return common.Watch(u.st.facade, "Watch", u.tag)
} | go | {
"resource": ""
} |
q3324 | Application | train | func (u *Unit) Application() (*Application, error) {
application := &Application{
st: u.st,
tag: u.ApplicationTag(),
}
// Call Refresh() immediately to get the up-to-date
// life and other needed locally cached fields.
err := application.Refresh()
if err != nil {
return nil, err
}
return application, nil... | go | {
"resource": ""
} |
q3325 | ApplicationName | train | func (u *Unit) ApplicationName() string {
application, err := names.UnitApplication(u.Name())
if err != nil {
panic(err)
}
return application
} | go | {
"resource": ""
} |
q3326 | DestroyAllSubordinates | train | func (u *Unit) DestroyAllSubordinates() error {
var result params.ErrorResults
args := params.Entities{
Entities: []params.Entity{{Tag: u.tag.String()}},
}
err := u.st.facade.FacadeCall("DestroyAllSubordinates", args, &result)
if err != nil {
return err
}
return result.OneError()
} | go | {
"resource": ""
} |
q3327 | HasSubordinates | train | func (u *Unit) HasSubordinates() (bool, error) {
var results params.BoolResults
args := params.Entities{
Entities: []params.Entity{{Tag: u.tag.String()}},
}
err := u.st.facade.FacadeCall("HasSubordinates", args, &results)
if err != nil {
return false, err
}
if len(results.Results) != 1 {
return false, erro... | go | {
"resource": ""
} |
q3328 | ClosePorts | train | func (u *Unit) ClosePorts(protocol string, fromPort, toPort int) error {
var result params.ErrorResults
args := params.EntitiesPortRanges{
Entities: []params.EntityPortRange{{
Tag: u.tag.String(),
Protocol: protocol,
FromPort: fromPort,
ToPort: toPort,
}},
}
err := u.st.facade.FacadeCall("Clo... | go | {
"resource": ""
} |
q3329 | WatchActionNotifications | train | func (u *Unit) WatchActionNotifications() (watcher.StringsWatcher, error) {
var results params.StringsWatchResults
args := params.Entities{
Entities: []params.Entity{{Tag: u.tag.String()}},
}
err := u.st.facade.FacadeCall("WatchActionNotifications", args, &results)
if err != nil {
return nil, err
}
if len(re... | go | {
"resource": ""
} |
q3330 | UpgradeSeriesStatus | train | func (u *Unit) UpgradeSeriesStatus() (model.UpgradeSeriesStatus, error) {
res, err := u.st.UpgradeSeriesUnitStatus()
if err != nil {
return "", errors.Trace(err)
}
if len(res) != 1 {
return "", errors.Errorf("expected 1 result, got %d", len(res))
}
return res[0], nil
} | go | {
"resource": ""
} |
q3331 | SetUpgradeSeriesStatus | train | func (u *Unit) SetUpgradeSeriesStatus(status model.UpgradeSeriesStatus, reason string) error {
return u.st.SetUpgradeSeriesUnitStatus(status, reason)
} | go | {
"resource": ""
} |
q3332 | RequestReboot | train | func (u *Unit) RequestReboot() error {
machineId, err := u.AssignedMachine()
if err != nil {
return err
}
var result params.ErrorResults
args := params.Entities{
Entities: []params.Entity{{Tag: machineId.String()}},
}
err = u.st.facade.FacadeCall("RequestReboot", args, &result)
if err != nil {
return err
... | go | {
"resource": ""
} |
q3333 | RelationsStatus | train | func (u *Unit) RelationsStatus() ([]RelationStatus, error) {
args := params.Entities{
Entities: []params.Entity{{Tag: u.tag.String()}},
}
var results params.RelationUnitStatusResults
err := u.st.facade.FacadeCall("RelationsStatus", args, &results)
if err != nil {
return nil, err
}
if len(results.Results) != ... | go | {
"resource": ""
} |
q3334 | WatchStorage | train | func (u *Unit) WatchStorage() (watcher.StringsWatcher, error) {
return u.st.WatchUnitStorageAttachments(u.tag)
} | go | {
"resource": ""
} |
q3335 | AddStorage | train | func (u *Unit) AddStorage(constraints map[string][]params.StorageConstraints) error {
if u.st.facade.BestAPIVersion() < 2 {
return errors.NotImplementedf("AddStorage() (need V2+)")
}
all := make([]params.StorageAddParams, 0, len(constraints))
for storage, cons := range constraints {
for _, one := range cons {
... | go | {
"resource": ""
} |
q3336 | StoreArchive | train | func StoreArchive(stor filestorage.FileStorage, meta *Metadata, file io.Reader) error {
id, err := stor.Add(meta, file)
if err != nil {
return errors.Trace(err)
}
meta.SetID(id)
stored, err := stor.Metadata(id)
if err != nil {
return errors.Trace(err)
}
meta.SetStored(stored.Stored())
return nil
} | go | {
"resource": ""
} |
q3337 | NewBackups | train | func NewBackups(stor filestorage.FileStorage) Backups {
b := backups{
storage: stor,
}
return &b
} | go | {
"resource": ""
} |
q3338 | Add | train | func (b *backups) Add(archive io.Reader, meta *Metadata) (string, error) {
// Store the archive.
err := storeArchive(b.storage, meta, archive)
if err != nil {
return "", errors.Annotate(err, "while storing backup archive")
}
return meta.ID(), nil
} | go | {
"resource": ""
} |
q3339 | Get | train | func (b *backups) Get(id string) (*Metadata, io.ReadCloser, error) {
if strings.Contains(id, TempFilename) {
return b.getArchiveFromFilename(id)
}
rawmeta, archiveFile, err := b.storage.Get(id)
if err != nil {
return nil, nil, errors.Trace(err)
}
meta, ok := rawmeta.(*Metadata)
if !ok {
return nil, nil, e... | go | {
"resource": ""
} |
q3340 | List | train | func (b *backups) List() ([]*Metadata, error) {
metaList, err := b.storage.List()
if err != nil {
return nil, errors.Trace(err)
}
result := make([]*Metadata, len(metaList))
for i, meta := range metaList {
m, ok := meta.(*Metadata)
if !ok {
msg := "expected backups.Metadata value from storage for %q, got %... | go | {
"resource": ""
} |
q3341 | Remove | train | func (b *backups) Remove(id string) error {
return errors.Trace(b.storage.Remove(id))
} | go | {
"resource": ""
} |
q3342 | NewFileWriter | train | func NewFileWriter(logPath string) (io.WriteCloser, error) {
if err := primeLogFile(logPath); err != nil {
// This isn't a fatal error so log and continue if priming fails.
logger.Warningf("Unable to prime %s (proceeding anyway): %v", logPath, err)
}
return &lumberjack.Logger{
Filename: logPath,
MaxSize: ... | go | {
"resource": ""
} |
q3343 | primeLogFile | train | func primeLogFile(path string) error {
f, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY, 0600)
if err != nil {
return errors.Trace(err)
}
f.Close()
err = utils.ChownPath(path, "syslog")
return errors.Trace(err)
} | go | {
"resource": ""
} |
q3344 | NewClient | train | func NewClient(caller base.APICaller, newWatcher NewWatcherFunc) *Client {
return &Client{
caller: base.NewFacadeCaller(caller, "MigrationMaster"),
newWatcher: newWatcher,
httpClientFactory: caller.HTTPClient,
}
} | go | {
"resource": ""
} |
q3345 | Watch | train | func (c *Client) Watch() (watcher.NotifyWatcher, error) {
var result params.NotifyWatchResult
err := c.caller.FacadeCall("Watch", nil, &result)
if err != nil {
return nil, errors.Trace(err)
}
if result.Error != nil {
return nil, result.Error
}
return c.newWatcher(c.caller.RawAPICaller(), result), nil
} | go | {
"resource": ""
} |
q3346 | SetPhase | train | func (c *Client) SetPhase(phase migration.Phase) error {
args := params.SetMigrationPhaseArgs{
Phase: phase.String(),
}
return c.caller.FacadeCall("SetPhase", args, nil)
} | go | {
"resource": ""
} |
q3347 | SetStatusMessage | train | func (c *Client) SetStatusMessage(message string) error {
args := params.SetMigrationStatusMessageArgs{
Message: message,
}
return c.caller.FacadeCall("SetStatusMessage", args, nil)
} | go | {
"resource": ""
} |
q3348 | ModelInfo | train | func (c *Client) ModelInfo() (migration.ModelInfo, error) {
var info params.MigrationModelInfo
err := c.caller.FacadeCall("ModelInfo", nil, &info)
if err != nil {
return migration.ModelInfo{}, errors.Trace(err)
}
owner, err := names.ParseUserTag(info.OwnerTag)
if err != nil {
return migration.ModelInfo{}, err... | go | {
"resource": ""
} |
q3349 | Export | train | func (c *Client) Export() (migration.SerializedModel, error) {
var empty migration.SerializedModel
var serialized params.SerializedModel
err := c.caller.FacadeCall("Export", nil, &serialized)
if err != nil {
return empty, errors.Trace(err)
}
// Convert tools info to output map.
tools := make(map[version.Binar... | go | {
"resource": ""
} |
q3350 | OpenResource | train | func (c *Client) OpenResource(application, name string) (io.ReadCloser, error) {
httpClient, err := c.httpClientFactory()
if err != nil {
return nil, errors.Annotate(err, "unable to create HTTP client")
}
uri := fmt.Sprintf("/applications/%s/resources/%s", application, name)
var resp *http.Response
if err := h... | go | {
"resource": ""
} |
q3351 | StreamModelLog | train | func (c *Client) StreamModelLog(start time.Time) (<-chan common.LogMessage, error) {
return common.StreamDebugLog(c.caller.RawAPICaller(), common.DebugLogParams{
Replay: true,
NoTail: true,
StartTime: start,
})
} | go | {
"resource": ""
} |
q3352 | NewUpgraderFacade | train | func NewUpgraderFacade(st *state.State, resources facade.Resources, auth facade.Authorizer) (Upgrader, error) {
// The type of upgrader we return depends on who is asking.
// Machines get an UpgraderAPI, units get a UnitUpgraderAPI.
// This is tested in the api/upgrader package since there
// are currently no direc... | go | {
"resource": ""
} |
q3353 | NewUpgraderAPI | train | func NewUpgraderAPI(
st *state.State,
resources facade.Resources,
authorizer facade.Authorizer,
) (*UpgraderAPI, error) {
if !authorizer.AuthMachineAgent() && !authorizer.AuthApplicationAgent() {
return nil, common.ErrPerm
}
getCanReadWrite := func() (common.AuthFunc, error) {
return authorizer.AuthOwner, nil... | go | {
"resource": ""
} |
q3354 | WatchAPIVersion | train | func (u *UpgraderAPI) WatchAPIVersion(args params.Entities) (params.NotifyWatchResults, error) {
result := params.NotifyWatchResults{
Results: make([]params.NotifyWatchResult, len(args.Entities)),
}
for i, agent := range args.Entities {
tag, err := names.ParseTag(agent.Tag)
if err != nil {
return params.Not... | go | {
"resource": ""
} |
q3355 | DesiredVersion | train | func (u *UpgraderAPI) DesiredVersion(args params.Entities) (params.VersionResults, error) {
results := make([]params.VersionResult, len(args.Entities))
if len(args.Entities) == 0 {
return params.VersionResults{}, nil
}
agentVersion, _, err := u.getGlobalAgentVersion()
if err != nil {
return params.VersionResul... | go | {
"resource": ""
} |
q3356 | newValidConfig | train | func newValidConfig(cfg *config.Config) (*environConfig, error) {
// Ensure that the provided config is valid.
if err := config.Validate(cfg, nil); err != nil {
return nil, errors.Trace(err)
}
// Apply the defaults and coerce/validate the custom config attrs.
validated, err := cfg.ValidateUnknownAttrs(configFie... | go | {
"resource": ""
} |
q3357 | validate | train | func (c environConfig) validate() error {
// All fields must be populated, even with just the default.
for _, field := range configRequiredFields {
if c.attrs[field].(string) == "" {
return errors.Errorf("%s: must not be empty", field)
}
}
return nil
} | go | {
"resource": ""
} |
q3358 | update | train | func (c *environConfig) update(cfg *config.Config) error {
// Validate the updates. newValidConfig does not modify the "known"
// config attributes so it is safe to call Validate here first.
if err := config.Validate(cfg, c.Config); err != nil {
return errors.Trace(err)
}
updates, err := newValidConfig(cfg)
if... | go | {
"resource": ""
} |
q3359 | Validate | train | func (info *ControllerInfo) Validate() error {
if !names.IsValidController(info.ControllerTag.Id()) {
return errors.NotValidf("ControllerTag")
}
if len(info.Addrs) < 1 {
return errors.NotValidf("empty controller api addresses")
}
for _, addr := range info.Addrs {
_, err := network.ParseHostPort(addr)
if e... | go | {
"resource": ""
} |
q3360 | NewFacade | train | func NewFacade(ctx facade.Context) (*API, error) {
controllerState := ctx.StatePool().SystemState()
precheckBackend, err := migration.PrecheckShim(ctx.State(), controllerState)
if err != nil {
return nil, errors.Annotate(err, "creating precheck backend")
}
return NewAPI(
&backendShim{ctx.State()},
precheckBa... | go | {
"resource": ""
} |
q3361 | ModelName | train | func (s *backendShim) ModelName() (string, error) {
model, err := s.Model()
if err != nil {
return "", errors.Trace(err)
}
return model.Name(), nil
} | go | {
"resource": ""
} |
q3362 | ModelOwner | train | func (s *backendShim) ModelOwner() (names.UserTag, error) {
model, err := s.Model()
if err != nil {
return names.UserTag{}, errors.Trace(err)
}
return model.Owner(), nil
} | go | {
"resource": ""
} |
q3363 | AgentVersion | train | func (s *backendShim) AgentVersion() (version.Number, error) {
m, err := s.Model()
if err != nil {
return version.Zero, errors.Trace(err)
}
cfg, err := m.ModelConfig()
if err != nil {
return version.Zero, errors.Trace(err)
}
vers, ok := cfg.AgentVersion()
if !ok {
return version.Zero, errors.New("no agen... | go | {
"resource": ""
} |
q3364 | ensureHostedModel | train | func ensureHostedModel(
isCAAS bool,
cloudSpec environs.CloudSpec,
provider environs.EnvironProvider,
args InitializeStateParams,
st *state.State,
ctrl *state.Controller,
adminUser names.UserTag,
cloudCredentialTag names.CloudCredentialTag,
) error {
if len(args.HostedModelConfig) == 0 {
logger.Debugf("no ho... | go | {
"resource": ""
} |
q3365 | initMongo | train | func initMongo(info mongo.Info, dialOpts mongo.DialOpts, password string) (*mgo.Session, error) {
session, err := mongo.DialWithInfo(mongo.MongoInfo{Info: info}, dialOpts)
if err != nil {
return nil, errors.Trace(err)
}
if err := mongo.SetAdminMongoPassword(session, mongo.AdminUser, password); err != nil {
sess... | go | {
"resource": ""
} |
q3366 | initBootstrapMachine | train | func initBootstrapMachine(
c agent.ConfigSetter,
st *state.State,
args InitializeStateParams,
) (*state.Machine, error) {
model, err := st.Model()
if err != nil {
return nil, errors.Trace(err)
}
logger.Infof("initialising bootstrap machine for %q model with config: %+v", model.Type(), args)
jobs := make([]st... | go | {
"resource": ""
} |
q3367 | initControllerCloudService | train | func initControllerCloudService(
cloudSpec environs.CloudSpec,
provider environs.EnvironProvider,
st *state.State,
args InitializeStateParams,
) error {
controllerUUID := args.ControllerConfig.ControllerUUID()
env, err := getEnviron(controllerUUID, cloudSpec, args.ControllerModelConfig, provider)
if err != nil {... | go | {
"resource": ""
} |
q3368 | Render | train | func (lxdRenderer) Render(cfg cloudinit.CloudConfig, os jujuos.OSType) ([]byte, error) {
switch os {
case jujuos.Ubuntu, jujuos.CentOS, jujuos.OpenSUSE:
bytes, err := renderers.RenderYAML(cfg)
return bytes, errors.Trace(err)
default:
return nil, errors.Errorf("cannot encode userdata for OS %q", os)
}
} | go | {
"resource": ""
} |
q3369 | preallocOplog | train | func preallocOplog(dir string, oplogSizeMB int) error {
// preallocFiles expects sizes in bytes.
sizes := preallocFileSizes(oplogSizeMB * 1024 * 1024)
prefix := filepath.Join(dir, "local.")
return preallocFiles(prefix, sizes...)
} | go | {
"resource": ""
} |
q3370 | defaultOplogSize | train | func defaultOplogSize(dir string) (int, error) {
if hostWordSize == 32 {
// "For 32-bit systems, MongoDB allocates about 48 megabytes
// of space to the oplog."
return 48, nil
}
// "For 64-bit OS X systems, MongoDB allocates 183 megabytes of
// space to the oplog."
if runtimeGOOS == "darwin" {
return 183,... | go | {
"resource": ""
} |
q3371 | fsAvailSpace | train | func fsAvailSpace(dir string) (avail float64, err error) {
var stderr bytes.Buffer
cmd := exec.Command("df", dir)
cmd.Stderr = &stderr
out, err := cmd.Output()
if err != nil {
err := fmt.Errorf("df failed: %v", err)
if stderr.Len() > 0 {
err = fmt.Errorf("%s (%q)", err, stderr.String())
}
return -1, err... | go | {
"resource": ""
} |
q3372 | preallocFiles | train | func preallocFiles(prefix string, sizes ...int) error {
var err error
var createdFiles []string
for i, size := range sizes {
var created bool
filename := fmt.Sprintf("%s%d", prefix, i)
created, err = preallocFile(filename, size)
if created {
createdFiles = append(createdFiles, filename)
}
if err != ni... | go | {
"resource": ""
} |
q3373 | preallocFileSizes | train | func preallocFileSizes(totalSize int) []int {
// Divide the total size into 512MB chunks, and
// then round up the remaining chunk to a multiple
// of 4096 bytes.
const maxChunkSize = 512 * 1024 * 1024
var sizes []int
remainder := totalSize % maxChunkSize
if remainder > 0 {
aligned := remainder + preallocAlign... | go | {
"resource": ""
} |
q3374 | doPreallocFile | train | func doPreallocFile(filename string, size int) (created bool, err error) {
if size%preallocAlign != 0 {
return false, fmt.Errorf("specified size %v for file %q is not a multiple of %d", size, filename, preallocAlign)
}
f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0700)
if os.IsExist(err) {
... | go | {
"resource": ""
} |
q3375 | NewMockExtensionsV1beta1Interface | train | func NewMockExtensionsV1beta1Interface(ctrl *gomock.Controller) *MockExtensionsV1beta1Interface {
mock := &MockExtensionsV1beta1Interface{ctrl: ctrl}
mock.recorder = &MockExtensionsV1beta1InterfaceMockRecorder{mock}
return mock
} | go | {
"resource": ""
} |
q3376 | DaemonSets | train | func (mr *MockExtensionsV1beta1InterfaceMockRecorder) DaemonSets(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DaemonSets", reflect.TypeOf((*MockExtensionsV1beta1Interface)(nil).DaemonSets), arg0)
} | go | {
"resource": ""
} |
q3377 | Ingresses | train | func (m *MockExtensionsV1beta1Interface) Ingresses(arg0 string) v1beta10.IngressInterface {
ret := m.ctrl.Call(m, "Ingresses", arg0)
ret0, _ := ret[0].(v1beta10.IngressInterface)
return ret0
} | go | {
"resource": ""
} |
q3378 | PodSecurityPolicies | train | func (m *MockExtensionsV1beta1Interface) PodSecurityPolicies() v1beta10.PodSecurityPolicyInterface {
ret := m.ctrl.Call(m, "PodSecurityPolicies")
ret0, _ := ret[0].(v1beta10.PodSecurityPolicyInterface)
return ret0
} | go | {
"resource": ""
} |
q3379 | PodSecurityPolicies | train | func (mr *MockExtensionsV1beta1InterfaceMockRecorder) PodSecurityPolicies() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PodSecurityPolicies", reflect.TypeOf((*MockExtensionsV1beta1Interface)(nil).PodSecurityPolicies))
} | go | {
"resource": ""
} |
q3380 | Scales | train | func (m *MockExtensionsV1beta1Interface) Scales(arg0 string) v1beta10.ScaleInterface {
ret := m.ctrl.Call(m, "Scales", arg0)
ret0, _ := ret[0].(v1beta10.ScaleInterface)
return ret0
} | go | {
"resource": ""
} |
q3381 | NewMockIngressInterface | train | func NewMockIngressInterface(ctrl *gomock.Controller) *MockIngressInterface {
mock := &MockIngressInterface{ctrl: ctrl}
mock.recorder = &MockIngressInterfaceMockRecorder{mock}
return mock
} | go | {
"resource": ""
} |
q3382 | UpdateStatus | train | func (mr *MockIngressInterfaceMockRecorder) UpdateStatus(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateStatus", reflect.TypeOf((*MockIngressInterface)(nil).UpdateStatus), arg0)
} | go | {
"resource": ""
} |
q3383 | ConstructClient | train | func ConstructClient(clientFacade base.ClientFacade, facadeCaller base.FacadeCaller) *Client {
return &Client{ClientFacade: clientFacade, facade: facadeCaller}
} | go | {
"resource": ""
} |
q3384 | NewClient | train | func NewClient(st base.APICallCloser) *Client {
frontend, backend := base.NewClientFacade(st, machineManagerFacade)
return ConstructClient(frontend, backend)
} | go | {
"resource": ""
} |
q3385 | AddMachines | train | func (client *Client) AddMachines(machineParams []params.AddMachineParams) ([]params.AddMachinesResult, error) {
args := params.AddMachines{
MachineParams: machineParams,
}
results := new(params.AddMachinesResults)
err := client.facade.FacadeCall("AddMachines", args, results)
if len(results.Machines) != len(mach... | go | {
"resource": ""
} |
q3386 | UpgradeSeriesPrepare | train | func (client *Client) UpgradeSeriesPrepare(machineName, series string, force bool) error {
if client.BestAPIVersion() < 5 {
return errors.NotSupportedf("upgrade-series prepare")
}
args := params.UpdateSeriesArg{
Entity: params.Entity{
Tag: names.NewMachineTag(machineName).String()},
Series: series,
Force:... | go | {
"resource": ""
} |
q3387 | UpgradeSeriesComplete | train | func (client *Client) UpgradeSeriesComplete(machineName string) error {
if client.BestAPIVersion() < 5 {
return errors.NotSupportedf("UpgradeSeriesComplete")
}
args := params.UpdateSeriesArg{
Entity: params.Entity{Tag: names.NewMachineTag(machineName).String()},
}
result := new(params.ErrorResult)
err := clie... | go | {
"resource": ""
} |
q3388 | GetUpgradeSeriesMessages | train | func (client *Client) GetUpgradeSeriesMessages(machineName, watcherId string) ([]string, error) {
if client.BestAPIVersion() < 5 {
return nil, errors.NotSupportedf("GetUpgradeSeriesMessages")
}
var results params.StringsResults
args := params.UpgradeSeriesNotificationParams{
Params: []params.UpgradeSeriesNotifi... | go | {
"resource": ""
} |
q3389 | NewClient | train | func NewClient(caller base.APICaller) *Client {
facadeCaller := base.NewFacadeCaller(caller, "CAASOperator")
return &Client{
facade: facadeCaller,
APIAddresser: common.NewAPIAddresser(facadeCaller),
}
} | go | {
"resource": ""
} |
q3390 | SetStatus | train | func (c *Client) SetStatus(
application string,
status status.Status,
info string,
data map[string]interface{},
) error {
tag, err := c.appTag(application)
if err != nil {
return errors.Trace(err)
}
var result params.ErrorResults
args := params.SetStatus{
Entities: []params.EntityStatusArgs{{
Tag: ta... | go | {
"resource": ""
} |
q3391 | Charm | train | func (c *Client) Charm(application string) (_ *charm.URL, forceUpgrade bool, sha256 string, vers int, _ error) {
tag, err := c.appTag(application)
if err != nil {
return nil, false, "", 0, errors.Trace(err)
}
var results params.ApplicationCharmResults
args := params.Entities{
Entities: []params.Entity{{Tag: ta... | go | {
"resource": ""
} |
q3392 | WatchUnits | train | func (c *Client) WatchUnits(application string) (watcher.StringsWatcher, error) {
applicationTag, err := applicationTag(application)
if err != nil {
return nil, errors.Trace(err)
}
args := entities(applicationTag)
var results params.StringsWatchResults
if err := c.facade.FacadeCall("WatchUnits", args, &results... | go | {
"resource": ""
} |
q3393 | RemoveUnit | train | func (c *Client) RemoveUnit(unitName string) error {
if !names.IsValidUnit(unitName) {
return errors.NotValidf("unit name %q", unitName)
}
var result params.ErrorResults
args := params.Entities{
Entities: []params.Entity{{Tag: names.NewUnitTag(unitName).String()}},
}
err := c.facade.FacadeCall("Remove", args,... | go | {
"resource": ""
} |
q3394 | SetVersion | train | func (c *Client) SetVersion(appName string, v version.Binary) error {
if !names.IsValidApplication(appName) {
return errors.NotValidf("application name %q", appName)
}
var results params.ErrorResults
args := params.EntitiesVersion{
AgentTools: []params.EntityVersion{{
Tag: names.NewApplicationTag(appName).... | go | {
"resource": ""
} |
q3395 | VolumeTag | train | func (v *volume) VolumeTag() names.VolumeTag {
return names.NewVolumeTag(v.doc.Name)
} | go | {
"resource": ""
} |
q3396 | StorageInstance | train | func (v *volume) StorageInstance() (names.StorageTag, error) {
if v.doc.StorageId == "" {
msg := fmt.Sprintf("volume %q is not assigned to any storage instance", v.Tag().Id())
return names.StorageTag{}, errors.NewNotAssigned(nil, msg)
}
return names.NewStorageTag(v.doc.StorageId), nil
} | go | {
"resource": ""
} |
q3397 | Info | train | func (v *volume) Info() (VolumeInfo, error) {
if v.doc.Info == nil {
return VolumeInfo{}, errors.NotProvisionedf("volume %q", v.doc.Name)
}
return *v.doc.Info, nil
} | go | {
"resource": ""
} |
q3398 | Params | train | func (v *volume) Params() (VolumeParams, bool) {
if v.doc.Params == nil {
return VolumeParams{}, false
}
return *v.doc.Params, true
} | go | {
"resource": ""
} |
q3399 | Machine | train | func (v *volumeAttachmentPlan) Machine() names.MachineTag {
return names.NewMachineTag(v.doc.Machine)
} | go | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.