Find the service_id of a given service
498959
def resolve_service_id(self, service_name=None, service_type=None):
        """"""
        services = [s._info for s in self.api.services.list()]

        service_name = service_name.lower()
        for s in services:
            name = s['name'].lower()
            if service_type and service_name:
                if (service_name == name and service_type == s['type']):
                    return s['id']
            elif service_name and service_name == name:
                return s['id']
            elif service_type and service_type == s['type']:
                return s['id']
        return None
1327320
def get_service_name(self, service_id: str) -> str:
        
        # Raise an exception if we are not a manager
        if not self._manager:
            raise RuntimeError('Only the Swarm manager node can retrieve all'
                               ' the services details.')

        service = self._client.services.get(service_id)
        return service.name
1071259
def _get_service_keys(self, service_name):
        
        guid = self.get_instance_guid(service_name)
        uri = "/v2/service_instances/%s/service_keys" % (guid)
        return self.api.get(uri)
315093
def get_service(self, service_id):
		""""""
		content = self._fetch("/service/%s" % service_id)
		return FastlyService(self, content)
28332
private String getErrorForUnknownService(String id) {
		StringBuffer error = new StringBuffer();
		error.append("Services path: " + ServiceConfigurationManager.CONFIGURATION_DIR);
		error.append("The service with id: " + id + " is not registered");

		error.append("\n Available services are: ");

		Set<String> keys = serviceManager.getRegisteredConfigurations().keySet();

		Iterator<String> it = keys.iterator();

		while (it.hasNext()) {
			error.append(it.next()).append(" ");
		}

		return error.toString();
	}
368769
def read_service_ids_by_date(path: str) -> Dict[datetime.date, FrozenSet[str]]:
    """"""
    feed = load_raw_feed(path)
    return _service_ids_by_date(feed)
405377
def _get_device_id(self, bus):
        
        _dbus = bus.get(SERVICE_BUS, PATH)
        devices = _dbus.devices()

        if self.device is None and self.device_id is None and len(devices) == 1:
            return devices[0]

        for id in devices:
            self._dev = bus.get(SERVICE_BUS, DEVICE_PATH + "/%s" % id)
            if self.device == self._dev.name:
                return id

        return None
240440
def get_actual_replica(self, service_id: str) -> str:
        
        # Raise an exception if we are not a manager
        if not self._manager:
            raise RuntimeError('Only the Swarm manager node can retrieve '
                               'replication level of the service')

        service_details = self.get_service_details(service_id)
        actual_replica = service_details["Spec"]["Mode"][
            "Replicated"]["Replicas"]
        return actual_replica
16675
def introspect_service(self, service_name):
        
        data = {}
        service = self.get_service(service_name)

        for operation in service.operations:
            # These are ``Operation`` objects, not operation strings.
            op_data = self.introspect_operation(operation)
            data[op_data['method_name']] = op_data

        return data
535267
def service_list():
    '''
    
    '''
    r = salt.utils.http.query(DETAILS['url']+'service/list', decode_type='json', decode=True)
    return r['dict']
838156
def get_replicas(self, service_id: str) -> str:
        
        # Initialising empty list
        replicas = []

        # Raise an exception if we are not a manager
        if not self._manager:
            raise RuntimeError('Only the Swarm manager node can retrieve '
                               'replication level of the service')

        service_tasks = self._client.services.get(service_id).tasks()
        for task in service_tasks:
            if task['Status']['State'] == "running":
                replicas.append(task)
        return len(replicas)
780791
def service(self):
        '''
        
        '''
        service_class = getattr(self, 'service_class')
        service = service_class(self.http_request)
        return service
1089344
def _get_service(name):
    '''
    
    '''
    services = __utils__['mac_utils.available_services']()
    name = name.lower()

    service = _name_in_services(name, services)

    # if we would the service we can return it
    if service:
        return service

    # if we got here our service is not available, now we can check to see if
    # we received a cached batch of services, if not we did a fresh check
    # so we need to raise that the service could not be found.
    try:
        if not __context__['using_cached_services']:
            raise CommandExecutionError('Service not found: {0}'.format(name))
    except KeyError:
        pass

    # we used a cached version to check, a service could have been made
    # between now and then, we should refresh our available services.
    services = __utils__['mac_utils.available_services'](refresh=True)

    # check to see if we found the service we are looking for.
    service = _name_in_services(name, services)

    if not service:
        # Could not find the service after refresh raise.
        raise CommandExecutionError('Service not found: {0}'.format(name))

    # found it :)
    return service
616149
def provider(self, service):
        
        service_provider = default_provider.get_service(str(service.provider.name.name))

        # 1) get the data from the provider service
        module_name = 'th_' + service.provider.name.name.split('Service')[1].lower()
        kwargs = {'trigger_id': str(service.id), 'cache_stack': module_name}
        return getattr(service_provider, 'process_data')(**kwargs)
688030
def service_addresses(service, index = nil)
      loop do
        addresses, nindex = service_addresses!(service, index)
        return [addresses, nindex] if addresses && nindex
      end
    end
406567
def get_name(self):
        
        if hasattr(self, 'service_description'):
            return self.service_description
        if hasattr(self, 'name'):
            return self.name
        return 'SERVICE-DESCRIPTION-MISSING'
122872
def get_service_name(wrapped, instance, args, kwargs):
    """"""
    if 'serviceAbbreviation' not in instance._service_model.metadata:
        return instance._service_model.metadata['endpointPrefix']
    return instance._service_model.metadata['serviceAbbreviation']