// DisableServiceMaintenance will deregister the fake maintenance mode check
// if the service has been marked as in maintenance.
349991
func (a *Agent) DisableServiceMaintenance(serviceID string) error {
	if _, ok := a.State.Services()[serviceID]; !ok {
		return fmt.Errorf("No service registered with ID %q", serviceID)
	}

	// Check if maintenance mode is enabled
	checkID := serviceMaintCheckID(serviceID)
	if _, ok := a.State.Checks()[checkID]; !ok {
		return nil
	}

	// Deregister the maintenance check
	a.RemoveCheck(checkID, true)
	a.logger.Printf("[INFO] agent: Service %q left maintenance mode", serviceID)

	return nil
}
522748
func (ep *endpoint) isServiceEnabled() bool {
	ep.Lock()
	defer ep.Unlock()
	return ep.serviceEnabled
}
708292
func (s *ServiceSpecificCredential) SetServiceName(v string) *ServiceSpecificCredential {
	s.ServiceName = &v
	return s
}
126415
func (c *AuthorizationService) Deactivate(authzURL string) error {
	if len(authzURL) == 0 {
		return errors.New("authorization[deactivate]: empty URL")
	}

	var disabledAuth acme.Authorization
	_, err := c.core.post(authzURL, acme.Authorization{Status: acme.StatusDeactivated}, &disabledAuth)
	return err
}
538143
func (c *Client) ClearEmergency(serviceID string) (int, error) {
	affected := 0
	err := c.call("ClearEmergency", serviceID, &affected)
	return affected, err
}
1080604
func (s *SamplingRuleUpdate) SetServiceName(v string) *SamplingRuleUpdate {
	s.ServiceName = &v
	return s
}
1220103
func (_m *API) AttachServiceInstance(serviceID string, instanceID int, command string, args []string) error {
	ret := _m.Called(serviceID, instanceID, command, args)

	var r0 error
	if rf, ok := ret.Get(0).(func(string, int, string, []string) error); ok {
		r0 = rf(serviceID, instanceID, command, args)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}
1093438
func (_m *Balancer) DeleteService(_a0 string) error {
	ret := _m.Called(_a0)

	var r0 error
	if rf, ok := ret.Get(0).(func(string) error); ok {
		r0 = rf(_a0)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}
543016
func (client *Client) DeactivateScalingConfiguration(args *DeactivateScalingConfigurationArgs) (resp *DeactivateScalingConfigurationResponse, err error) {
	response := DeactivateScalingConfigurationResponse{}
	err = client.InvokeByFlattenMethod("DeactivateScalingConfiguration", args, &response)

	if err != nil {
		return nil, err
	}
	return &response, nil
}
1036078
func DeleteServiceLB(key string) error {
	collections.serviceLBMutex.Lock()
	obj := collections.serviceLBs[key]
	collections.serviceLBMutex.Unlock()
	if obj == nil {
		log.Errorf("serviceLB %s not found", key)
		return errors.New("serviceLB not found")
	}

	// Check if we handle this object
	if objCallbackHandler.ServiceLBCb == nil {
		log.Errorf("No callback registered for serviceLB object")
		return errors.New("Invalid object type")
	}

	// Perform callback
	err := objCallbackHandler.ServiceLBCb.ServiceLBDelete(obj)
	if err != nil {
		log.Errorf("ServiceLBDelete retruned error for: %+v. Err: %v", obj, err)
		return err
	}

	// delete it from modeldb
	collections.serviceLBMutex.Lock()
	err = obj.Delete()
	collections.serviceLBMutex.Unlock()
	if err != nil {
		log.Errorf("Error deleting serviceLB %s. Err: %v", obj.Key, err)
	}

	// delete it from cache
	collections.serviceLBMutex.Lock()
	delete(collections.serviceLBs, key)
	collections.serviceLBMutex.Unlock()

	return nil
}
1235153
func (f *Facade) DeleteServiceConfig(ctx datastore.Context, fileID string) error {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.DeleteServiceConfig"))
	logger := plog.WithField("fileid", fileID)

	alog := f.auditLogger.Message(ctx, "Removing Service Configuration").
		Action(audit.Remove).ID(fileID).Type(servicedefinition.GetConfigFileType())

	if err := f.configStore.Delete(ctx, serviceconfigfile.Key(fileID)); err != nil {
		logger.WithError(err).Debug("Could not delete service config file")
		return alog.Error(err)
	}

	logger.Debug("Deleted service config file")
	alog.Succeeded()
	return nil
}
813999
func (s *SamplingRule) SetServiceName(v string) *SamplingRule {
	s.ServiceName = &v
	return s
}
1161866
func (s *HostService) CancelHostMaintenance(p *CancelHostMaintenanceParams) (*CancelHostMaintenanceResponse, error) {
	resp, err := s.cs.newRequest("cancelHostMaintenance", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r CancelHostMaintenanceResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	// If we have a async client, we need to wait for the async result
	if s.cs.async {
		b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
		if err != nil {
			if err == AsyncTimeoutErr {
				return &r, err
			}
			return nil, err
		}

		b, err = getRawValue(b)
		if err != nil {
			return nil, err
		}

		if err := json.Unmarshal(b, &r); err != nil {
			return nil, err
		}
	}

	return &r, nil
}
173544
func (s *Fleet) SetEnableDefaultInternetAccess(v bool) *Fleet {
	s.EnableDefaultInternetAccess = &v
	return s
}
45369
func (actor Actor) DisableServiceForOrg(serviceName, orgName, brokerName string) (Warnings, error) {
	servicePlans, allWarnings, err := actor.GetServicePlansForService(serviceName, brokerName)
	if err != nil {
		return allWarnings, err
	}

	org, orgWarnings, err := actor.GetOrganizationByName(orgName)
	allWarnings = append(allWarnings, orgWarnings...)
	if err != nil {
		return allWarnings, err
	}

	for _, plan := range servicePlans {
		warnings, err := actor.removeOrgLevelServicePlanVisibilities(plan.GUID, org.GUID)
		allWarnings = append(allWarnings, warnings...)
		if err != nil {
			return allWarnings, err
		}
	}
	return allWarnings, nil
}
472261
func (j *JournalManager) DisableAuto(ctx context.Context) error {
	j.lock.Lock()
	defer j.lock.Unlock()
	if enabled, _ := j.getEnableAutoLocked(); !enabled {
		// Nothing to do.
		return nil
	}

	j.log.CDebugf(ctx, "Disabling auto-journaling")
	j.serverConfig.EnableAuto = false
	j.serverConfig.EnableAutoSetByUser = true
	return j.writeConfig()
}
243343
func (s *Server) StopServiceInstance(req ServiceInstanceRequest, unused *string) (err error) {
	err = s.f.StopServiceInstance(s.context(), req.ServiceID, req.InstanceID)
	return
}