Args:
      service_name: the name of the service in the service registry
    Returns:
      the name of the group the service is in, or None of the service was not found
483654
def service_group(self, service_name):
    
    for group in EFConfig.SERVICE_GROUPS:
      if self.services(group).has_key(service_name):
        return group
    return None
840247
def service_info(self, short_name):
        

        if short_name not in self.services:
            raise ArgumentError("Unknown service name", short_name=short_name)

        info = {}
        info['short_name'] = short_name
        info['long_name'] = self.services[short_name]['state'].long_name
        info['preregistered'] = self.services[short_name]['state'].preregistered

        return info
1331946
def service_name(doc):
    """"""
    for service_id, service in doc.get('services', {}).items():
        service['id'] = service_id
        service['organisation_id'] = doc['_id']

        name = service.get('name', None)
        if name:
            yield name, service
211677
public static servicegroup get(nitro_service service, String servicegroupname) throws Exception{
		servicegroup obj = new servicegroup();
		obj.set_servicegroupname(servicegroupname);
		servicegroup response = (servicegroup) obj.get_resource(service);
		return response;
	}
1120291
public static servicegroup_binding get(nitro_service service, String servicegroupname) throws Exception{
		servicegroup_binding obj = new servicegroup_binding();
		obj.set_servicegroupname(servicegroupname);
		servicegroup_binding response = (servicegroup_binding) obj.get_resource(service);
		return response;
	}
1129024
def valid_envs(self, service_name):
    
    service_record = self.service_record(service_name)
    if service_record is None:
      raise RuntimeError("service registry doesn't have service: {}".format(service_name))

    # Return empty list if service has no "environments" section
    if not (service_record.has_key("environments")):
      return []
    # Otherwise gather up the envs
    service_record_envs = service_record["environments"]
    result = []
    for service_env in service_record_envs:
      if service_env not in EFConfig.PROTECTED_ENVS and service_env in EFConfig.EPHEMERAL_ENVS:
        result.extend((lambda env=service_env: [env + str(x) for x in range(EFConfig.EPHEMERAL_ENVS[env])])())
      else:
        result.append(service_env)
    return result
505162
def add_member(self, service_name, servicegroup_name):
        
        servicegroup = self.find_by_name(servicegroup_name)
        if not servicegroup:
            servicegroup = Servicegroup({'servicegroup_name': servicegroup_name,
                                         'alias': servicegroup_name,
                                         'members': service_name})
            self.add(servicegroup)
        else:
            servicegroup.add_members(service_name)
710907
def get_group(self, group_name):
        
        response = self.client.get_group(GroupName=group_name,
                                         UserPoolId=self.user_pool_id)
        return self.get_group_obj(response.get('Group'))
723779
def service_status(self, name):
        

        return self._loop.run_coroutine(self._client.service_status(name))
294951
def _servicegroup_get_server(sg_name, s_name, s_port=None, **connection_args):
    '''
    
    '''
    ret = None
    servers = _servicegroup_get_servers(sg_name, **connection_args)
    if servers is None:
        return None
    for server in servers:
        if server.get_servername() == s_name:
            if s_port is not None and s_port != server.get_port():
                ret = None
            ret = server
    return ret
599995
def list_group_members(self, name):
        
        return self.service.list_group_members(
            name, self.url_prefix, self.auth, self.session,
            self.session_send_opts)
270175
def get_service_keys(self, service_name):
        
        keys = []
        for key in self._get_service_keys(service_name)['resources']:
            keys.append(key['entity']['name'])

        return keys
1181577
def service_name_from_scope_name(scope_name):
    

    def replace_char(match):
        c = match.group(0)
        return '-' if c in '. _' else "u{:04d}".format(ord(c))

    service_name = re.sub(r'[^a-z0-9\-]', replace_char, scope_name.lower())
    return service_name[0:230]
701553
def services(self, service_group=None):
    
    # Specific service group requested
    if service_group is not None:
      if service_group not in EFConfig.SERVICE_GROUPS:
        raise RuntimeError("service registry: {} doesn't have '{}' section listed in EFConfig".format(
          self._service_registry_file, service_group))
      else:
        return self.service_registry_json[service_group]
    # Specific service group not requested - flatten and return all service records
    else:
      result = dict()
      for service_group in EFConfig.SERVICE_GROUPS:
        result.update(self.service_registry_json[service_group])
      return result
367175
def __find(self, name):
        
        service = None
        if not self.__services:
            raise Exception, "No services defined"
        if isinstance(name, int):
            try:
                service = self.__services[name]
                name = service.name
            except IndexError:
                raise ServiceNotFound, "at [%d]" % (name,)
        else:
            for s in self.__services:
                if name == s.name:
                    service = s
                    break
        if service is None:
            raise ServiceNotFound, name
        return PortSelector(self.__client, service.ports, name)
142367
def filter_service_by_host_name(host_name):
    

    def inner_filter(items):
        """Inner filter for service. Accept if service.host.host_name == host_name"""
        service = items["service"]
        host = items["hosts"][service.host]
        if service is None or host is None:
            return False
        return host.host_name == host_name

    return inner_filter
92606
def _get_or_create_service_key(self):
        
        keys = self.service._get_service_keys(self.name)
        for key in keys['resources']:
            if key['entity']['name'] == self.service_name:
                return self.service.get_service_key(self.name,
                        self.service_name)

        self.service.create_service_key(self.name, self.service_name)
        return self.service.get_service_key(self.name, self.service_name)