Example usage for com.amazonaws.services.identitymanagement.model Role getRoleId

List of usage examples for com.amazonaws.services.identitymanagement.model Role getRoleId

Introduction

In this page you can find the example usage for com.amazonaws.services.identitymanagement.model Role getRoleId.

Prototype


public String getRoleId() 

Source Link

Document

The stable and unique string identifying the role.

Usage

From source file:com.denismo.aws.iam.LDAPIAMPoller.java

License:Apache License

private Entry getOrCreateRoleGroup(Role role) throws Exception {
    Group group = new Group(role.getPath(), role.getRoleName(), role.getRoleId(), role.getArn(),
            role.getCreateDate());// ww  w .ja v  a  2s . c om
    return addGroup(group);
}

From source file:com.denismo.aws.iam.LDAPIAMPoller.java

License:Apache License

private void addRole(Role role, Entry roleGroup) throws LdapException {
    Entry existingRole = getExistingRole(role);
    if (existingRole != null) {
        directory.getAdminSession().modify(existingRole.getDn(),
                new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, "accessKey", role.getRoleId()),
                new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, "gidNumber",
                        roleGroup.get("gidNumber").getString()));
        if (!roleGroup.contains("memberUid", role.getRoleName())) {
            directory.getAdminSession().modify(roleGroup.getDn(), new DefaultModification(
                    ModificationOperation.ADD_ATTRIBUTE, "memberUid", role.getRoleName()));
        }/*from  www. ja  v  a 2  s .  c  o  m*/
        return;
    }

    DefaultEntry ent = new DefaultEntry(directory.getSchemaManager(),
            directory.getDnFactory().create(String.format(ROLE_FMT, role.getRoleName())));
    ent.put(SchemaConstants.OBJECT_CLASS_AT, "posixAccount", "shadowAccount", "iamaccount", "iamrole");
    ent.put("accessKey", role.getRoleId());
    ent.put("uid", role.getRoleName());
    ent.put(SchemaConstants.ENTRY_CSN_AT, directory.getCSN().toString());
    ent.put(SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString());
    ent.put("cn", role.getRoleName());
    ent.put("uidNumber", allocateUserID(role.getArn()));
    ent.put("gidNumber", roleGroup.get("gidNumber").getString());
    ent.put("shadowLastChange", "10877");
    ent.put("shadowExpire", "-1");
    ent.put("shadowInactive", "-1");
    ent.put("shadowFlag", "0");
    ent.put("shadowWarning", "7");
    ent.put("shadowMin", "0");
    ent.put("shadowMax", "999999");
    ent.put("loginshell", "/bin/bash");
    ent.put("homedirectory", "/home/" + role.getRoleName());
    add(ent);

    directory.getAdminSession().modify(roleGroup.getDn(),
            new DefaultModification(ModificationOperation.ADD_ATTRIBUTE, "memberUid", role.getRoleName()));
}

From source file:com.haskins.cloudtrailviewer.dialog.resourcedetail.detailpanels.IamRoleDetail.java

License:Open Source License

private void buildUI(GetRoleResult detail) {

    this.add(primaryScrollPane, BorderLayout.CENTER);

    if (detail.getRole() != null) {

        Role role = detail.getRole();

        if (role.getCreateDate() != null) {
            primaryTableModel.addRow(new Object[] { "Created", getDateString(role.getCreateDate()) });
        }//from   ww w  .  j  a  v  a 2  s. co  m
        if (role.getArn() != null) {
            primaryTableModel.addRow(new Object[] { "Arn", role.getArn() });
        }
        if (role.getAssumeRolePolicyDocument() != null) {
            primaryTableModel
                    .addRow(new Object[] { "Assume Role Policy Document", role.getAssumeRolePolicyDocument() });
        }
        if (role.getPath() != null) {
            primaryTableModel.addRow(new Object[] { "Path", role.getPath() });
        }
        if (role.getRoleId() != null) {
            primaryTableModel.addRow(new Object[] { "Role Id", role.getRoleId() });
        }
        if (role.getRoleName() != null) {
            primaryTableModel.addRow(new Object[] { "Role Name", role.getRoleName() });
        }

    }

}