// SetMerge sets the Merge field's value.
326994
func (s *AttributePayload) SetMerge(v bool) *AttributePayload {
	s.Merge = &v
	return s
}
950766
func (s *RecognizeCelebritiesInput) SetImage(v *Image) *RecognizeCelebritiesInput {
	s.Image = v
	return s
}
769572
func (s *GetSegmentImportJobsInput) SetToken(v string) *GetSegmentImportJobsInput {
	s.Token = &v
	return s
}
1301586
func (s *DetectFacesInput) SetImage(v *Image) *DetectFacesInput {
	s.Image = v
	return s
}
1170977
func (s *PullRequestSourceReferenceUpdatedEventMetadata) SetMergeBase(v string) *PullRequestSourceReferenceUpdatedEventMetadata {
	s.MergeBase = &v
	return s
}
102462
func (s *MergeMetadata) SetMergedBy(v string) *MergeMetadata {
	s.MergedBy = &v
	return s
}
1279074
func (s *CreateGroupOutput) SetGroup(v *GroupType) *CreateGroupOutput {
	s.Group = v
	return s
}
172032
func (s *GetCampaignVersionsInput) SetToken(v string) *GetCampaignVersionsInput {
	s.Token = &v
	return s
}
1234525
func (s *DimensionGroup) SetGroup(v string) *DimensionGroup {
	s.Group = &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
}
1310204
func (s *ImportTerminologyInput) SetMergeStrategy(v string) *ImportTerminologyInput {
	s.MergeStrategy = &v
	return s
}
604980
func (s *CreatePlatformEndpointInput) SetToken(v string) *CreatePlatformEndpointInput {
	s.Token = &v
	return s
}
421543
func (s *MergeMetadata) SetIsMerged(v bool) *MergeMetadata {
	s.IsMerged = &v
	return s
}
1215820
func (s *GetSegmentVersionsInput) SetToken(v string) *GetSegmentVersionsInput {
	s.Token = &v
	return s
}
130475
func (s *DetectTextInput) SetImage(v *Image) *DetectTextInput {
	s.Image = v
	return s
}
722447
func appendMerge(target, sub []int) []int {
	lt, ls := len(target), len(sub)
	out := make([]int, 0, lt+ls)

	for x, y := 0, 0; x < lt || y < ls; {
		if x >= lt {
			out = append(out, sub[y:]...)
			break
		}

		if y >= ls {
			out = append(out, target[x:]...)
			break
		}

		xValue := target[x]
		yValue := sub[y]

		switch {

		case xValue == yValue:
			out = append(out, xValue)
			x++
			y++

		case xValue < yValue:
			out = append(out, xValue)
			x++

		case yValue < xValue:
			out = append(out, yValue)
			y++

		}
	}

	target = append(target[:0], out...)

	return target
}
1033417
func (s *PutObjectLockConfigurationInput) SetToken(v string) *PutObjectLockConfigurationInput {
	s.Token = &v
	return s
}