// NewTUFChange initializes a TUFChange object
324435
func NewTUFChange(action string, role data.RoleName, changeType, changePath string, content []byte) *TUFChange {
	return &TUFChange{
		Actn:       action,
		Role:       role,
		ChangeType: changeType,
		ChangePath: changePath,
		Data:       content,
	}
}
155458
func RequireKeyUnchanged(key string) PreconditionFunc {
	return func(diff interface{}) bool {
		m, ok := diff.(map[string]interface{})
		if !ok {
			return true
		}
		// the presence of key in a diff means that its value has been changed, therefore
		// we should fail the precondition.
		_, ok = m[key]
		return !ok
	}
}
517496
func (f *FS) UserChanged(ctx context.Context, oldName, newName kbname.NormalizedUsername) {
	f.log.CDebugf(ctx, "User changed: %q -> %q", oldName, newName)
	f.root.public.userChanged(ctx, oldName, newName)
	f.root.private.userChanged(ctx, oldName, newName)
}
509247
func CreateStackChangeSet(changeSetRequestName string,
	serviceName string,
	cfTemplate *gocf.Template,
	templateURL string,
	awsTags []*cloudformation.Tag,
	awsCloudFormation *cloudformation.CloudFormation,
	logger *logrus.Logger) (*cloudformation.DescribeChangeSetOutput, error) {

	capabilities := stackCapabilities(cfTemplate)
	changeSetInput := &cloudformation.CreateChangeSetInput{
		Capabilities:  capabilities,
		ChangeSetName: aws.String(changeSetRequestName),
		ClientToken:   aws.String(changeSetRequestName),
		Description:   aws.String(fmt.Sprintf("Change set for service: %s", serviceName)),
		StackName:     aws.String(serviceName),
		TemplateURL:   aws.String(templateURL),
	}
	if len(awsTags) != 0 {
		changeSetInput.Tags = awsTags
	}
	_, changeSetError := awsCloudFormation.CreateChangeSet(changeSetInput)
	if nil != changeSetError {
		return nil, changeSetError
	}

	logger.WithFields(logrus.Fields{
		"StackName": serviceName,
	}).Info("Issued CreateChangeSet request")

	describeChangeSetInput := cloudformation.DescribeChangeSetInput{
		ChangeSetName: aws.String(changeSetRequestName),
		StackName:     aws.String(serviceName),
	}

	var describeChangeSetOutput *cloudformation.DescribeChangeSetOutput

	// Loop, with a total timeout of 3 minutes
	startTime := time.Now()
	changeSetStabilized := false
	for !changeSetStabilized {
		sleepDuration := cloudformationPollingDelay()
		time.Sleep(sleepDuration)

		changeSetOutput, describeChangeSetError := awsCloudFormation.DescribeChangeSet(&describeChangeSetInput)

		if nil != describeChangeSetError {
			return nil, describeChangeSetError
		}
		describeChangeSetOutput = changeSetOutput
		// The current status of the change set, such as CREATE_IN_PROGRESS, CREATE_COMPLETE,
		// or FAILED.
		if nil != describeChangeSetOutput {
			switch *describeChangeSetOutput.Status {
			case "CREATE_IN_PROGRESS":
				// If this has taken more than 3 minutes, then that's an error
				elapsedTime := time.Since(startTime)
				if elapsedTime > cloudformationPollingTimeout {
					return nil, fmt.Errorf("failed to finalize ChangeSet within window: %s", elapsedTime.String())
				}
			case "CREATE_COMPLETE":
				changeSetStabilized = true
			case "FAILED":
				return nil, fmt.Errorf("failed to create ChangeSet: %#v", *describeChangeSetOutput)
			}
		}
	}

	logger.WithFields(logrus.Fields{
		"DescribeChangeSetOutput": describeChangeSetOutput,
	}).Debug("DescribeChangeSet result")

	//////////////////////////////////////////////////////////////////////////////
	// If there aren't any changes, then skip it...
	if len(describeChangeSetOutput.Changes) <= 0 {
		logger.WithFields(logrus.Fields{
			"StackName": serviceName,
		}).Info("No changes detected for service")

		// Delete it...
		_, deleteChangeSetResultErr := DeleteChangeSet(serviceName,
			changeSetRequestName,
			awsCloudFormation)
		return nil, deleteChangeSetResultErr
	}
	return describeChangeSetOutput, nil
}
276602
func (act ActionNil) OnChange(newContext change.Detector, contextChanges change.Set, configuration string, actionChanges *change.Set) (change.Detector, change.Set, error) {
	return newContext, nil, nil
}
423926
func (d *ResourceDiff) diffChange(key string) (interface{}, interface{}, bool, bool, bool) {
	old, new, customized := d.getChange(key)

	if !old.Exists {
		old.Value = nil
	}
	if !new.Exists || d.removed(key) {
		new.Value = nil
	}

	return old.Value, new.Value, !reflect.DeepEqual(old.Value, new.Value), new.Computed, customized
}
662877
func (l Listener) OnChannelChange(e *gumble.ChannelChangeEvent) {
	if l.ChannelChange != nil {
		l.ChannelChange(e)
	}
}
167055
func (i *InputField) SetChangedFunc(handler func(text string)) *InputField {
	i.changed = handler
	return i
}
844476
func (d *ResourceDiff) HasChange(key string) bool {
	old, new := d.GetChange(key)

	// If the type implements the Equal interface, then call that
	// instead of just doing a reflect.DeepEqual. An example where this is
	// needed is *Set
	if eq, ok := old.(Equal); ok {
		return !eq.Equal(new)
	}

	return !reflect.DeepEqual(old, new)
}
1085523
func DeviceChange(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "devicechange", Listener: listener}
}
866816
func NewTwoAccountChangePolicyType(Description string) *TwoAccountChangePolicyType {
	s := new(TwoAccountChangePolicyType)
	s.Description = Description
	return s
}
417314
func (s *RouterService) NewChangeServiceForRouterParams(id string, serviceofferingid string) *ChangeServiceForRouterParams {
	p := &ChangeServiceForRouterParams{}
	p.p = make(map[string]interface{})
	p.p["id"] = id
	p.p["serviceofferingid"] = serviceofferingid
	return p
}
1305274
func (ui *UI) DisplayChangeForPush(header string, stringTypePadding int, hiddenValue bool, originalValue interface{}, newValue interface{}) error {
	ui.terminalLock.Lock()
	defer ui.terminalLock.Unlock()

	originalType := reflect.ValueOf(originalValue).Type()
	newType := reflect.ValueOf(newValue).Type()
	if originalType != newType {
		return ErrValueMissmatch
	}

	offset := strings.Repeat(" ", stringTypePadding)

	switch oVal := originalValue.(type) {
	case int:
		nVal := newValue.(int)
		ui.displayDiffForInt(offset, header, oVal, nVal)
	case types.NullInt:
		nVal := newValue.(types.NullInt)
		ui.displayDiffForNullInt(offset, header, oVal, nVal)
	case uint64:
		nVal := newValue.(uint64)
		ui.displayDiffForUint64(offset, header, oVal, nVal)
	case string:
		nVal := newValue.(string)
		ui.displayDiffForString(offset, header, hiddenValue, oVal, nVal)
	case []string:
		nVal := newValue.([]string)
		if len(oVal) == 0 && len(nVal) == 0 {
			return nil
		}

		ui.displayDiffForStrings(offset, header, oVal, nVal)
	case map[string]string:
		nVal := newValue.(map[string]string)
		if len(oVal) == 0 && len(nVal) == 0 {
			return nil
		}

		ui.displayDiffForMapStringString(offset, header, oVal, nVal)
	default:
		panic(fmt.Sprintf("diff display does not have case for '%s'", header))
	}
	return nil
}
17642
func (s *Settings) AddOnChange(key string, cb OnChangeCallback) {
	s.lock.Lock()
	defer s.lock.Unlock()
	if s.onChangeCallbacks == nil {
		s.onChangeCallbacks = make(map[string]OnChangeCallback)
	}
	s.onChangeCallbacks[key] = cb
}
1178820
func (fs *KBFSOpsStandard) PushStatusChange() {
	fs.currentStatus.PushStatusChange()

	fs.log.CDebugf(nil, "Asking for an edit re-init after status change")
	fs.editActivity.Add(1)
	go fs.initTlfsForEditHistories()
}
101766
func (s *CloudBackupServer) StateChange(
	ctx context.Context,
	req *api.SdkCloudBackupStateChangeRequest,
) (*api.SdkCloudBackupStateChangeResponse, error) {
	if s.driver(ctx) == nil {
		return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
	}

	// TODO
	// XXX Get vid from tid

	if len(req.GetTaskId()) == 0 {
		return nil, status.Error(codes.InvalidArgument, "Must provide taskid")
	} else if req.GetRequestedState() == api.SdkCloudBackupRequestedState_SdkCloudBackupRequestedStateUnknown {
		return nil, status.Error(codes.InvalidArgument, "Must provide requested state")
	}

	var rs string
	switch req.GetRequestedState() {
	// Not supported yet
	/*
		case api.SdkCloudBackupRequestedState_SdkCloudBackupRequestedStatePause:
			rs = api.CloudBackupRequestedStatePause
		case api.SdkCloudBackupRequestedState_SdkCloudBackupRequestedStateResume:
			rs = api.CloudBackupRequestedStateResume
	*/
	case api.SdkCloudBackupRequestedState_SdkCloudBackupRequestedStateStop:
		rs = api.CloudBackupRequestedStateStop
	default:
		return nil, status.Errorf(codes.InvalidArgument, "Invalid requested state: %v", req.GetRequestedState())
	}

	// Get Status to get the volId
	r, err := s.driver(ctx).CloudBackupStatus(&api.CloudBackupStatusRequest{
		ID: req.GetTaskId(),
	})
	if err != nil {
		return nil, status.Errorf(codes.Internal, "Failed to get status of backup: %v", err)
	}
	// Get volume id from task id
	// remove the volumes that dont belong to caller
	for _, sts := range r.Statuses {
		if err := checkAccessFromDriverForVolumeId(ctx, s.driver(ctx), sts.SrcVolumeID, api.Ownership_Write); err != nil {
			return nil, err
		}
	}
	err = s.driver(ctx).CloudBackupStateChange(&api.CloudBackupStateChangeRequest{
		Name:           req.GetTaskId(),
		RequestedState: rs,
	})
	if err != nil {
		return nil, status.Errorf(codes.Internal, "Failed to change state: %v", err)
	}

	return &api.SdkCloudBackupStateChangeResponse{}, nil
}
639103
func VisibilityChange(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "visibilitychange", Listener: listener}
}