// SetStage sets the Stage field's value.
489991
func (s *ApiStage) SetStage(v string) *ApiStage {
	s.Stage = &v
	return s
}
149244
func (api *API) SetPhase(args params.SetMigrationPhaseArgs) error {
	mig, err := api.backend.LatestMigration()
	if err != nil {
		return errors.Annotate(err, "could not get migration")
	}

	phase, ok := coremigration.ParsePhase(args.Phase)
	if !ok {
		return errors.Errorf("invalid phase: %q", args.Phase)
	}

	err = mig.SetPhase(phase)
	return errors.Annotate(err, "failed to set phase")
}
930690
func (s *DirectoryDescription) SetStage(v string) *DirectoryDescription {
	s.Stage = &v
	return s
}
227229
func (s *GetSdkInput) SetStageName(v string) *GetSdkInput {
	s.StageName = &v
	return s
}
591346
func (s *GetTemplateInput) SetTemplateStage(v string) *GetTemplateInput {
	s.TemplateStage = &v
	return s
}
1262803
func (s *GetPipelineStateOutput) SetStageStates(v []*StageState) *GetPipelineStateOutput {
	s.StageStates = v
	return s
}
795128
func (s *DeleteStageInput) SetStageName(v string) *DeleteStageInput {
	s.StageName = &v
	return s
}
1153015
func (s *CanarySettings) SetStageVariableOverrides(v map[string]*string) *CanarySettings {
	s.StageVariableOverrides = v
	return s
}
157268
func (s *LoggingOptions) SetLevel(v string) *LoggingOptions {
	s.Level = &v
	return s
}
499689
func (s *StageState) SetStageName(v string) *StageState {
	s.StageName = &v
	return s
}
916770
func (s *Branch) SetStage(v string) *Branch {
	s.Stage = &v
	return s
}
647642
func (mig *modelMigration) SetPhase(nextPhase migration.Phase) error {
	now := mig.st.clock().Now().UnixNano()

	phase, err := mig.Phase()
	if err != nil {
		return errors.Trace(err)
	}

	if nextPhase == phase {
		return nil // Already at that phase. Nothing to do.
	}
	if !phase.CanTransitionTo(nextPhase) {
		return errors.Errorf("illegal phase change: %s -> %s", phase, nextPhase)
	}

	nextDoc := mig.statusDoc
	nextDoc.Phase = nextPhase.String()
	nextDoc.PhaseChangedTime = now
	update := bson.M{
		"phase":              nextDoc.Phase,
		"phase-changed-time": now,
	}
	if nextPhase == migration.SUCCESS {
		nextDoc.SuccessTime = now
		update["success-time"] = now
	}

	ops, err := migStatusHistoryAndOps(mig.st, nextPhase, now, mig.StatusMessage())
	if err != nil {
		return errors.Trace(err)
	}

	// If the migration aborted, make the model active again.
	if nextPhase == migration.ABORTDONE {
		ops = append(ops, txn.Op{
			C:      modelsC,
			Id:     mig.doc.ModelUUID,
			Assert: txn.DocExists,
			Update: bson.M{
				"$set": bson.M{"migration-mode": MigrationModeNone},
			},
		})
	}

	// Set end timestamps and mark migration as no longer active if a
	// terminal phase is hit.
	if nextPhase.IsTerminal() {
		nextDoc.EndTime = now
		update["end-time"] = now
		ops = append(ops, txn.Op{
			C:      migrationsActiveC,
			Id:     mig.doc.ModelUUID,
			Assert: txn.DocExists,
			Remove: true,
		})
	}

	ops = append(ops, txn.Op{
		C:      migrationsStatusC,
		Id:     mig.statusDoc.Id,
		Update: bson.M{"$set": update},
		// Ensure phase hasn't changed underneath us
		Assert: bson.M{"phase": mig.statusDoc.Phase},
	})

	if err := mig.st.db().RunTransaction(ops); err == txn.ErrAborted {
		return errors.New("phase already changed")
	} else if err != nil {
		return errors.Annotate(err, "failed to update phase")
	}

	mig.statusDoc = nextDoc
	return nil
}
1102495
func (s *SetPermissionInput) SetLevel(v string) *SetPermissionInput {
	s.Level = &v
	return s
}
116629
func (s *UpdateBranchInput) SetStage(v string) *UpdateBranchInput {
	s.Stage = &v
	return s
}
1004849
func (s *Range) SetStep(v int64) *Range {
	s.Step = &v
	return s
}
385449
func (app *Application) SetScreen(scr tcell.Screen) {
	if app.screen == nil {
		app.screen = scr
		app.err = nil
	}
}
791279
func (sim *simra) SetScene(driver Driver) {
	simlog.FuncIn()

	sim.spritecontainer.RemoveSprites()
	sim.gl.Reset()
	sim.spritecontainer.Initialize(sim.gl)
	peer.GetTouchPeer().RemoveAllTouchListeners()
	sim.spritecontainer.RemoveSprites()

	sim.driver = driver
	sim.spritecontainer.Initialize(sim.gl)
	err := sim.spritecontainer.AddSprite(&peer.Sprite{}, nil, fps.Progress)
	if err != nil {
		simlog.Errorf("failed to add sprite. err: %s", err.Error())
		return
	}

	driver.Initialize(sim)

	simlog.FuncOut()
}