// disable proceeds disabling a task which consists of changing task state to disabled and emitting an appropriate event
322356
func (t *task) disable(failureMsg string) {
	t.Lock()
	t.state = core.TaskDisabled
	t.Unlock()

	// Send task disabled event
	event := new(scheduler_event.TaskDisabledEvent)
	event.TaskID = t.id
	event.Why = fmt.Sprintf("Task disabled with error: %s", failureMsg)
	defer t.eventEmitter.Emit(event)
}
906794
func (s *KeyMetadata) SetEnabled(v bool) *KeyMetadata {
	s.Enabled = &v
	return s
}
468861
func (s *JobReport) SetEnabled(v bool) *JobReport {
	s.Enabled = &v
	return s
}
470000
func (m *ARPMechanism) Disable() {
	m.BaseMechanism.Disable()

	// Remove installed handlers
	m.filter.Unhandle()

	// Match packets of ARP protocol.
	match := ofp.Match{ofp.MT_OXM, []ofp.OXM{
		ofputil.EthType(uint16(iana.ETHT_ARP), nil),
	}}

	err := of.Send(m.C.Switch.Conn(),
		// Flush installed flows
		ofputil.TableFlush(ofp.Table(m.tableNo)),
		// Flush redirect flow
		ofputil.FlowFlush(0, match),
	)

	// Release acquired table
	m.C.Switch.ReleaseTable(m.tableNo)

	if err != nil {
		log.ErrorLog("arp/DISABLE_HOOK",
			"Failed to send requests: ", err)
	}

	log.InfoLog("arp/DISABLE_HOOK", "Mechanism ARP disabled")
}
451936
func (m *Machine) Enable() {
	if !m.State.Enabled {
		m.State = State{
			Enabled:    true,
			Generation: m.nextGen(),
			LastRewind: m.Now,
		}
		m.scheduleTick(m.Now)
	}
}
1364920
func (s *GetMaintenanceWindowOutput) SetEnabled(v bool) *GetMaintenanceWindowOutput {
	s.Enabled = &v
	return s
}
546088
func (module *ODroidC1AnalogModule) Disable() error {
	// Unassign any pins we may have assigned
	for pin, _ := range module.definedPins {
		// attempt to assign this pin for this module.
		UnassignPin(pin)
	}

	// if there are any open analog pins, close them
	for _, openPin := range module.openPins {
		openPin.analogClose()
	}
	return nil
}
432421
func (s *UpdateEventSourceMappingInput) SetEnabled(v bool) *UpdateEventSourceMappingInput {
	s.Enabled = &v
	return s
}
1323497
func (t *taskCollection) remove(task *task) error {
	t.Lock()
	defer t.Unlock()
	if _, ok := t.table[task.id]; ok {
		if task.state != core.TaskStopped && task.state != core.TaskDisabled && task.state != core.TaskEnded {
			taskLogger.WithFields(log.Fields{
				"_block":  "remove",
				"task id": task.id,
			}).Error(ErrTaskNotStopped)
			return ErrTaskNotStopped
		}
		delete(t.table, task.id)
	} else {
		taskLogger.WithFields(log.Fields{
			"_block":  "remove",
			"task id": task.id,
		}).Error(ErrTaskNotFound)
		return ErrTaskNotFound
	}
	return nil
}
1035594
func (s *MaxAgeRule) SetEnabled(v bool) *MaxAgeRule {
	s.Enabled = &v
	return s
}
1094948
func (u *User) Disable() error {
	if err := u.ensureNotDeleted(); err != nil {
		return errors.Annotate(err, "cannot disable")
	}
	owner, err := u.st.ControllerOwner()
	if err != nil {
		return errors.Trace(err)
	}
	if u.doc.Name == owner.Name() {
		return errors.Unauthorizedf("cannot disable controller model owner")
	}
	return errors.Annotatef(u.setDeactivated(true), "cannot disable user %q", u.Name())
}
1042129
func (t *task) Delete(ctx context.Context, opts ...ProcessDeleteOpts) (*ExitStatus, error) {
	for _, o := range opts {
		if err := o(ctx, t); err != nil {
			return nil, err
		}
	}
	status, err := t.Status(ctx)
	if err != nil && errdefs.IsNotFound(err) {
		return nil, err
	}
	switch status.Status {
	case Stopped, Unknown, "":
	case Created:
		if t.client.runtime == fmt.Sprintf("%s.%s", plugin.RuntimePlugin, "windows") {
			// On windows Created is akin to Stopped
			break
		}
		fallthrough
	default:
		return nil, errors.Wrapf(errdefs.ErrFailedPrecondition, "task must be stopped before deletion: %s", status.Status)
	}
	if t.io != nil {
		t.io.Cancel()
		t.io.Wait()
	}
	r, err := t.client.TaskService().Delete(ctx, &tasks.DeleteTaskRequest{
		ContainerID: t.id,
	})
	if err != nil {
		return nil, errdefs.FromGRPC(err)
	}
	// Only cleanup the IO after a successful Delete
	if t.io != nil {
		t.io.Close()
	}
	return &ExitStatus{code: r.ExitStatus, exitedAt: r.ExitedAt}, nil
}
128213
func (module *BBPWMModule) Disable() error {
	for _, openPin := range module.openPins {
		openPin.closePin()
	}
	return nil
}
301722
func (s *CognitoOptions) SetEnabled(v bool) *CognitoOptions {
	s.Enabled = &v
	return s
}
1026612
func (q *PlanQueue) SetEnabled(enabled bool) {
	q.l.Lock()
	q.enabled = enabled
	q.l.Unlock()
	if !enabled {
		q.Flush()
	}
}
738261
func (ip *Interpreter) disable(args []string) {
	ip.simpleResponder(ip.Backend.DisableUser(args[0]))
}
238326
func (remoteAccessVpnApi *RemoteAccessVpnApi) Disable(id string) (bool, error) {
	_, err := remoteAccessVpnApi.entityService.Execute(id, REMOTE_ACCESS_VPN_DISABLE_OPERATION, []byte{}, map[string]string{})
	return err == nil, err
}