creates a role for a portal/agol site.
        Inputs:
           names - name of the role
           description - brief text string stating the nature of this
            role.
        Ouput:
           dictionary
346396
def createRole(self, name, description):
        
        params = {
            "name" : name,
            "description" : description,
            "f" : "json"
        }
        url = self.root + "/createRole"
        return self._post(url=url,
                             param_dict=params,
                             securityHandler=self._securityHandler,
                             proxy_url=self._proxy_url,
                             proxy_port=self._proxy_port)
631595
def describe_role(name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    try:
        info = conn.get_role(name)
        if not info:
            return False
        role = info.get_role_response.get_role_result.role
        role['assume_role_policy_document'] = salt.utils.json.loads(_unquote(
            role.assume_role_policy_document
        ))
        # If Sid wasn't defined by the user, boto will still return a Sid in
        # each policy. To properly check idempotently, let's remove the Sid
        # from the return if it's not actually set.
        for policy_key, policy in role['assume_role_policy_document'].items():
            if policy_key == 'Statement':
                for val in policy:
                    if 'Sid' in val and not val['Sid']:
                        del val['Sid']
        return role
    except boto.exception.BotoServerError as e:
        log.debug(e)
        log.error('Failed to get %s information.', name)
        return False
195564
def updateRole(self, roleID, name, description):
        """"""
        params = {
            "name" : name,
            "description" : description,
            "f" : "json"
        }
        url = self._url + "/%s/update"
        return self._post(url=url,
                             param_dict=params,
                             proxy_url=self._proxy_url,
                             proxy_port=self._proxy_port)
702142
def role_create(role, principal, endpoint_id):
    
    principal_type, principal_val = principal

    client = get_client()

    if principal_type == "identity":
        principal_val = maybe_lookup_identity_id(principal_val)
        if not principal_val:
            raise click.UsageError(
                "Identity does not exist. "
                "Use --provision-identity to auto-provision an identity."
            )
    elif principal_type == "provision-identity":
        principal_val = maybe_lookup_identity_id(principal_val, provision=True)
        principal_type = "identity"

    role_doc = assemble_generic_doc(
        "role", principal_type=principal_type, principal=principal_val, role=role
    )

    res = client.add_endpoint_role(endpoint_id, role_doc)
    formatted_print(res, simple_text="ID: {}".format(res["id"]))
1351146
def find_or_create_role(self, name, **kwargs):
        
        kwargs["name"] = name
        return self.find_role(name) or self.create_role(**kwargs)
364998
def role?(role_sym)
      role_sym = [role_sym] unless role_sym.is_a?(Array)

      roles.map { |r| r.name.underscore.to_sym }.any? { |user_role| role_sym.include?(user_role) }
    end
563359
def addUsersToRole(self, rolename, users):
        
        params = {
            "f" : "json",
            "rolename" : rolename,
            "users" : users
        }
        rURL = self._url + "/roles/addUsersToRole"
        return self._post(url=rURL, param_dict=params,
                             securityHandler=self._securityHandler,
                             proxy_url=self._proxy_url,
                             proxy_port=self._proxy_port)
529109
def _get_role_description(self, role):
        

        parameter = 'role-' + role.lower()
        if self.configure.has_parameter(parameter):
            return self.configure.get_parameter(parameter)
        return None
731532
def add_role(self, role):
        
        schema = RoleSchema()
        ok = schema.process(role)
        if not ok or not role.id:
            err = 'Role must be valid and saved before adding to user'
            raise x.UserException(err)

        self.__roles.append(role)
857767
def name_build(self, name, is_policy=False, prefix=True):
        
        str = name

        # Add prefix
        if prefix:
            str = self.__role_name_prefix + str

        # Add policy suffix
        if is_policy:
            str = str + "-policy"

        return str
195175
function buildRole(options, roleName='LambdaCfnRole') {
  let role = {
    Resources: {}
  };

  role.Resources[roleName] = {
    Type: 'AWS::IAM::Role',
    Properties: {
      AssumeRolePolicyDocument: {
        Statement: [
          {
            Sid: '',
            Effect: 'Allow',
            Principal: {
              Service: 'lambda.amazonaws.com'
            },
            Action: 'sts:AssumeRole'
          },
          {
            Sid: '',
            Effect: 'Allow',
            Principal: {
              Service: 'events.amazonaws.com'
            },
            Action: 'sts:AssumeRole'
          }
        ]
      },
      Path: '/',
      Policies: [
        {
          PolicyName: 'basic',
          PolicyDocument: {
            Statement: [
              {
                Effect: 'Allow',
                Action: [
                  'logs:*'
                ],
                Resource: cf.join(['arn:aws:logs:*:', cf.accountId, ':*'])
              },
              {
                Effect: 'Allow',
                Action: [
                  'sns:Publish'
                ],
                Resource: cf.ref('ServiceAlarmSNSTopic')
              },
              {
                Effect: 'Allow',
                Action: [
                  'iam:SimulateCustomPolicy'
                ],
                Resource: '*'
              }
            ]
          }
        },
      ]
    }
  };

  if (options.eventSources && options.eventSources.webhook) {
    role.Resources[roleName].Properties.AssumeRolePolicyDocument.Statement.push({
      Sid: '',
      Effect: 'Allow',
      Principal: {
        Service: 'apigateway.amazonaws.com'
      },
      Action: 'sts:AssumeRole'
    });
  }

  if (options.statements) {
    statementValidation(options);

    role.Resources[roleName].Properties.Policies.push({
      PolicyName: options.name,
      PolicyDocument: {
        Statement: options.statements
      }
    });
  }

  return role;
}
822301
async def role(self, *args, **kwargs):
        

        return await self._makeApiCall(self.funcinfo["role"], *args, **kwargs)
698210
def role(self, role_name):
        
        field_name = self.name
        field_roles = {field_name: MLField.translate_role_name(role_name)}
        if field_roles:
            return _change_singleton_roles(self, field_roles, True)
        else:
            return self
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
613547
def role(ctx, dependency_name, driver_name, lint_name, provisioner_name,
         role_name, verifier_name, template):  # pragma: no cover
    
    command_args = {
        'dependency_name': dependency_name,
        'driver_name': driver_name,
        'lint_name': lint_name,
        'provisioner_name': provisioner_name,
        'role_name': role_name,
        'scenario_name': command_base.MOLECULE_DEFAULT_SCENARIO_NAME,
        'subcommand': __name__,
        'verifier_name': verifier_name,
    }

    if verifier_name == 'inspec':
        command_args['verifier_lint_name'] = 'rubocop'

    if verifier_name == 'goss':
        command_args['verifier_lint_name'] = 'yamllint'

    if verifier_name == 'ansible':
        command_args['verifier_lint_name'] = 'ansible-lint'

    if template is not None:
        command_args['template'] = template

    r = Role(command_args)
    r.execute()
724349
def get_docs_url(self, role, name):
        

        # Expand partial names to full names
        name = self.get_full_name(role, name)
        # Look up domain corresponding to role
        dom = IntersphinxInventory.roledomain[role]
        # Get the inventory entry tuple corresponding to the name
        # of the referenced type
        itpl = self.inv[dom][name]
        # Get the required path postfix from the inventory entry
        # tuple
        path = itpl[2]
        # Construct link url, appending the base url or note
        # depending on the addbase flag
        return self.baseurl + path if self.addbase else path
1104194
def add(self, roles):
        
        return self._client.post(
            url=self._client.get_full_url(
                self.get_path(
                    'single', realm=self._realm_name, id=self._user_id
                )
            ),
            data=json.dumps(roles, sort_keys=True)
        )