Create a role
  @param resource_root: The root Resource object.
  @param service_name: Service name
  @param role_type: Role type
  @param role_name: Role name
  @param cluster_name: Cluster name
  @return: An ApiRole object
423475
def create_role(resource_root,
                service_name,
                role_type,
                role_name,
                host_id,
                cluster_name="default"):
  
  apirole = ApiRole(resource_root, role_name, role_type,
                    ApiHostRef(resource_root, host_id))
  return call(resource_root.post,
      _get_roles_path(cluster_name, service_name),
      ApiRole, True, data=[apirole])[0]
913970
def get_roles_by_type(self, role_type, view = None):
    
    return roles.get_roles_by_type(self._get_resource_root(), self.name,
        role_type, self._get_cluster_name(), view)
25755
def set_role_id(self, role_name, role_id, mount_point='approle'):
        

        url = '/v1/auth/{0}/role/{1}/role-id'.format(mount_point, role_name)
        params = {
            'role_id': role_id
        }
        return self._adapter.post(url, json=params)
1298998
def create(cls, action, **kwargs):
        """"""
        role = kwargs.pop('role', None)
        if role:
            assert role.method == 'system_role'
            kwargs['role_name'] = role.value
        return super(ActionSystemRoles, cls).create(action, **kwargs)
1294241
static function create( $roleName, $version = 0 )
    {
        $row = array( 'id' => null,
                      'name' => $roleName,
                      'version' => 0 );
        $role = new eZRole( $row );
        return $role;
    }
530124
public void setRoleService(
		com.liferay.portal.kernel.service.RoleService roleService) {
		this.roleService = roleService;
	}
698204
def delete_role(self, name):
    
    return roles.delete_role(self._get_resource_root(), self.name, name,
        self._get_cluster_name())
798156
def create(self, project, email, role, **attrs):
        
        attrs.update({'project': project, 'email': email, 'role': role})
        return self._new_resource(payload=attrs)
991052
def get_role(self, name):
        

        address = _create_role_address(name)
        role_list_bytes = None

        try:
            role_list_bytes = self._state_view.get(address=address)
        except KeyError:
            return None

        if role_list_bytes is not None:
            role_list = _create_from_bytes(role_list_bytes,
                                           identity_pb2.RoleList)
            for role in role_list.roles:
                if role.name == name:
                    return role
        return None
631107
def get_nodes_with_role(role_name, environment=None):
    
    prefix_search = role_name.endswith("*")
    if prefix_search:
        role_name = role_name.rstrip("*")
    for n in get_nodes(environment):
        roles = get_roles_in_node(n, recursive=True)
        if prefix_search:
            if any(role.startswith(role_name) for role in roles):
                yield n
        else:
            if role_name in roles:
                yield n
796875
def create_role(name, policy_document=None, path=None, region=None, key=None,
                keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    if role_exists(name, region, key, keyid, profile):
        return True
    if not policy_document:
        policy_document = None
    try:
        conn.create_role(name, assume_role_policy_document=policy_document,
                         path=path)
        log.info('Created IAM role %s.', name)
        return True
    except boto.exception.BotoServerError as e:
        log.error(e)
        log.error('Failed to create IAM role %s.', name)
        return False
705669
def create_role(self, role_name, mount_point='approle', **kwargs):
        

        return self._adapter.post('/v1/auth/{0}/role/{1}'.format(mount_point, role_name), json=kwargs)
814173
def custom_role(self):
        
        if self.api and self.custom_role_id:
            return self.api._get_custom_role(self.custom_role_id)
951911
def list_roles(self, principal_name, principal_type):
    
    self.send_list_roles(principal_name, principal_type)
    return self.recv_list_roles()
1237202
public RoleImpl buildRole(VertexElement vertex, Role type) {
        return getOrBuildConcept(vertex, (v) -> RoleImpl.create(v, type));
    }
443428
@Help(help = "Creates a new service")
  public String create(String serviceName, List<String> roles) throws SDKException {
    HashMap<String, Object> requestBody = new HashMap<>();
    requestBody.put("name", serviceName);
    requestBody.put("roles", roles);

    return new String(
        (byte[])
            requestPost(
                "create",
                requestBody,
                MediaType.APPLICATION_OCTET_STREAM_VALUE,
                MediaType.APPLICATION_JSON_VALUE));
  }
500990
public function createRole(Role $role)
    {
        $url = self::makeUrl($role->tenantId, $role->name);
        $this->service->prepAndSend($url, array(201, 200), 'PUT', json_encode($role), false, 'application/json', 'application/json');
    }