当前位置: 首页>>代码示例>>Java>>正文


Java AmazonIdentityManagement类代码示例

本文整理汇总了Java中com.amazonaws.services.identitymanagement.AmazonIdentityManagement的典型用法代码示例。如果您正苦于以下问题:Java AmazonIdentityManagement类的具体用法?Java AmazonIdentityManagement怎么用?Java AmazonIdentityManagement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AmazonIdentityManagement类属于com.amazonaws.services.identitymanagement包,在下文中一共展示了AmazonIdentityManagement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: client

import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; //导入依赖的package包/类
private AmazonIdentityManagement client() {
    return AmazonIdentityManagementClientBuilder.standard()
            .withCredentials(new AWSStaticCredentialsProvider(new AWSCredentials() {
                @Override
                public String getAWSAccessKeyId() {
                    return bookmark.getCredentials().getUsername();
                }

                @Override
                public String getAWSSecretKey() {
                    return bookmark.getCredentials().getPassword();
                }
            }))
            .withClientConfiguration(configuration)
            .withRegion(Regions.DEFAULT_REGION).build();
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:17,代码来源:AmazonIdentityConfiguration.java

示例2: addRolesToIdentityPool

import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; //导入依赖的package包/类
void addRolesToIdentityPool(String unauthenticatedRoleName, String unauthenticatedRole,
    String authenticatedRoleName, String authenticatedRole, String identityPoolId,
    AmazonCognitoIdentity client, LambdaLogger logger) {
  // First update the roles to use the actual pool id in their conditions
  logger
      .log("Updating authenticated and unauthenticated roles to use the actual identity pool id: "
          + identityPoolId);
  AmazonIdentityManagement iamClient = AmazonIdentityManagementClientBuilder.standard().build();
  UpdateAssumeRolePolicyRequest updateAssumeRolePolicyRequest = new UpdateAssumeRolePolicyRequest();
  updateAssumeRolePolicyRequest.setRoleName(unauthenticatedRoleName);
  updateAssumeRolePolicyRequest.setPolicyDocument(getAssumeRolePolicyDocument(false,
      identityPoolId, logger));
  iamClient.updateAssumeRolePolicy(updateAssumeRolePolicyRequest);
  updateAssumeRolePolicyRequest.setRoleName(authenticatedRoleName);
  updateAssumeRolePolicyRequest.setPolicyDocument(getAssumeRolePolicyDocument(true,
      identityPoolId, logger));
  iamClient.updateAssumeRolePolicy(updateAssumeRolePolicyRequest);

  // And add the updated roles to the pool
  logger.log("Adding updated authenticated and unauthenticated roles to the identity pool");
  SetIdentityPoolRolesRequest setIdentityPoolRolesRequest = new SetIdentityPoolRolesRequest();
  setIdentityPoolRolesRequest.addRolesEntry("authenticated", authenticatedRole);
  setIdentityPoolRolesRequest.addRolesEntry("unauthenticated", unauthenticatedRole);
  setIdentityPoolRolesRequest.setIdentityPoolId(identityPoolId);
  client.setIdentityPoolRoles(setIdentityPoolRolesRequest);
}
 
开发者ID:robinsteel,项目名称:Sqawsh,代码行数:27,代码来源:CognitoCustomResourceLambda.java

示例3: main

import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; //导入依赖的package包/类
public static void main(String[] args) {

        final String USAGE =
            "To run this example, supply a username\n" +
            "Ex: CreateUser <username>\n";

        if (args.length != 1) {
            System.out.println(USAGE);
            System.exit(1);
        }

        String username = args[0];

        final AmazonIdentityManagement iam =
            AmazonIdentityManagementClientBuilder.defaultClient();

        CreateUserRequest request = new CreateUserRequest()
            .withUserName(username);

        CreateUserResult response = iam.createUser(request);

        System.out.println("Successfully created user: " +
                response.getUser().getUserName());
    }
 
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:25,代码来源:CreateUser.java

示例4: main

import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; //导入依赖的package包/类
public static void main(String[] args) {

        final String USAGE =
            "To run this example, supply a certificate name\n" +
            "Ex: GetServerCertificate <certificate-name>\n";

        if (args.length != 1) {
            System.out.println(USAGE);
            System.exit(1);
        }

        String cert_name = args[0];

        final AmazonIdentityManagement iam =
            AmazonIdentityManagementClientBuilder.defaultClient();

        GetServerCertificateRequest request = new GetServerCertificateRequest()
                    .withServerCertificateName(cert_name);

        GetServerCertificateResult response = iam.getServerCertificate(request);

        System.out.format("Successfully retrieved certificate with body %s",
                response.getServerCertificate().getCertificateBody());
    }
 
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:25,代码来源:GetServerCertificate.java

示例5: main

import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; //导入依赖的package包/类
public static void main(String[] args) {

        final String USAGE =
            "To run this example, supply a policy arn\n" +
            "Ex: GetPolicy <policy-arn>\n";

        if (args.length != 1) {
            System.out.println(USAGE);
            System.exit(1);
        }

        String policy_arn = args[0];

        final AmazonIdentityManagement iam =
            AmazonIdentityManagementClientBuilder.defaultClient();

        GetPolicyRequest request = new GetPolicyRequest()
            .withPolicyArn(policy_arn);

        GetPolicyResult response = iam.getPolicy(request);

        System.out.format("Successfully retrieved policy %s",
                response.getPolicy().getPolicyName());
    }
 
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:25,代码来源:GetPolicy.java

示例6: main

import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; //导入依赖的package包/类
public static void main(String[] args) {

        final String USAGE =
            "To run this example, supply a certificate name\n" +
            "Ex: DeleteServerCertificate <certificate-name>\n";

        if (args.length != 1) {
            System.out.println(USAGE);
            System.exit(1);
        }

        String cert_name = args[0];

        final AmazonIdentityManagement iam =
            AmazonIdentityManagementClientBuilder.defaultClient();

        DeleteServerCertificateRequest request =
            new DeleteServerCertificateRequest()
                .withServerCertificateName(cert_name);

        DeleteServerCertificateResult response =
            iam.deleteServerCertificate(request);

        System.out.println("Successfully deleted server certificate " +
                cert_name);
    }
 
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:27,代码来源:DeleteServerCertificate.java

示例7: main

import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; //导入依赖的package包/类
public static void main(String[] args) {

        final String USAGE =
            "To run this example, supply a role name and policy arn\n" +
            "Ex: DetachRolePolicy <role-name> <policy-arn>>\n";

        if (args.length != 1) {
            System.out.println(USAGE);
            System.exit(1);
        }

        String role_name = args[0];
        String policy_arn = args[1];

        final AmazonIdentityManagement iam =
            AmazonIdentityManagementClientBuilder.defaultClient();

        DetachRolePolicyRequest request = new DetachRolePolicyRequest()
            .withRoleName(role_name)
            .withPolicyArn(policy_arn);

        DetachRolePolicyResult response = iam.detachRolePolicy(request);

        System.out.println("Successfully detached policy " + policy_arn +
                " from role " + role_name);
    }
 
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:27,代码来源:DetachRolePolicy.java

示例8: main

import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; //导入依赖的package包/类
public static void main(String[] args) {

        final String USAGE =
            "To run this example, supply an account alias\n" +
            "Ex: DeleteAccountAlias <account-alias>\n";

        if (args.length != 1) {
            System.out.println(USAGE);
            System.exit(1);
        }

        String alias = args[0];

        final AmazonIdentityManagement iam =
            AmazonIdentityManagementClientBuilder.defaultClient();

        DeleteAccountAliasRequest request = new DeleteAccountAliasRequest()
            .withAccountAlias(alias);

        DeleteAccountAliasResult response = iam.deleteAccountAlias(request);

        System.out.println("Successfully deleted account alias " + alias);
    }
 
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:24,代码来源:DeleteAccountAlias.java

示例9: main

import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; //导入依赖的package包/类
public static void main(String[] args) {

        final AmazonIdentityManagement iam =
            AmazonIdentityManagementClientBuilder.defaultClient();

        boolean done = false;
        ListUsersRequest request = new ListUsersRequest();

        while(!done) {
            ListUsersResult response = iam.listUsers(request);

            for(User user : response.getUsers()) {
                System.out.format("Retrieved user %s", user.getUserName());
            }

            request.setMarker(response.getMarker());

            if(!response.getIsTruncated()) {
                done = true;
            }
        }
    }
 
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:23,代码来源:ListUsers.java

示例10: main

import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; //导入依赖的package包/类
public static void main(String[] args) {

        final String USAGE =
            "To run this example, supply an IAM user\n" +
            "Ex: CreateAccessKey <user>\n";

        if (args.length != 1) {
            System.out.println(USAGE);
            System.exit(1);
        }

        String user = args[0];

        final AmazonIdentityManagement iam =
            AmazonIdentityManagementClientBuilder.defaultClient();

        CreateAccessKeyRequest request = new CreateAccessKeyRequest()
            .withUserName(user);

        CreateAccessKeyResult response = iam.createAccessKey(request);

        System.out.println("Created access key: " + response.getAccessKey());
    }
 
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:24,代码来源:CreateAccessKey.java

示例11: main

import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; //导入依赖的package包/类
public static void main(String[] args) {

        final String USAGE =
            "To run this example, supply an access key id\n" +
            "Ex: AccessKeyLastUsed <access-key-id>\n";

        if (args.length != 1) {
            System.out.println(USAGE);
            System.exit(1);
        }

        String access_id = args[0];

        final AmazonIdentityManagement iam =
            AmazonIdentityManagementClientBuilder.defaultClient();

        GetAccessKeyLastUsedRequest request = new GetAccessKeyLastUsedRequest()
            .withAccessKeyId(access_id);

        GetAccessKeyLastUsedResult response = iam.getAccessKeyLastUsed(request);

        System.out.println("Access key was last used at: " +
                response.getAccessKeyLastUsed().getLastUsedDate());
    }
 
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:25,代码来源:AccessKeyLastUsed.java

示例12: main

import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; //导入依赖的package包/类
public static void main(String[] args) {

        final String USAGE =
            "To run this example, supply a policy name\n" +
            "Ex: CreatePolicy <policy-name>\n";

        if (args.length != 1) {
            System.out.println(USAGE);
            System.exit(1);
        }

        String policy_name = args[0];

        final AmazonIdentityManagement iam =
            AmazonIdentityManagementClientBuilder.defaultClient();

        CreatePolicyRequest request = new CreatePolicyRequest()
            .withPolicyName(policy_name)
            .withPolicyDocument(POLICY_DOCUMENT);

        CreatePolicyResult response = iam.createPolicy(request);

        System.out.println("Successfully created policy: " +
                response.getPolicy().getPolicyName());
    }
 
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:26,代码来源:CreatePolicy.java

示例13: main

import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; //导入依赖的package包/类
public static void main(String[] args) {

        final String USAGE =
            "To run this example, supply a username and access key id\n" +
            "Ex: DeleteAccessKey <username> <access-key-id>\n";

        if (args.length != 2) {
            System.out.println(USAGE);
            System.exit(1);
        }

        String username = args[0];
        String access_key = args[1];

        final AmazonIdentityManagement iam =
            AmazonIdentityManagementClientBuilder.defaultClient();

        DeleteAccessKeyRequest request = new DeleteAccessKeyRequest()
            .withAccessKeyId(access_key)
            .withUserName(username);

        DeleteAccessKeyResult response = iam.deleteAccessKey(request);

        System.out.println("Successfully deleted access key " + access_key +
                " from user " + username);
    }
 
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:27,代码来源:DeleteAccessKey.java

示例14: main

import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; //导入依赖的package包/类
public static void main(String[] args) {

        final String USAGE =
            "To run this example, supply an alias\n" +
            "Ex: CreateAccountAlias <alias>\n";

        if (args.length != 1) {
            System.out.println(USAGE);
            System.exit(1);
        }

        String alias = args[0];

        final AmazonIdentityManagement iam =
            AmazonIdentityManagementClientBuilder.defaultClient();

        CreateAccountAliasRequest request = new CreateAccountAliasRequest()
            .withAccountAlias(alias);

        CreateAccountAliasResult response = iam.createAccountAlias(request);

        System.out.println("Successfully created account alias: " + alias);
    }
 
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:24,代码来源:CreateAccountAlias.java

示例15: execute

import com.amazonaws.services.identitymanagement.AmazonIdentityManagement; //导入依赖的package包/类
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    Proxy proxy = new Proxy(httpsProxyHost, httpsProxyPort, httpsProxyUsername,
            httpsProxyPassword);
    AwsKeyPair keyPair = Util.getAwsKeyPair(serverId, awsAccessKey, awsSecretAccessKey,
            settings, decrypter);
    final AWSCredentialsProvider credentials = new AWSStaticCredentialsProvider(
            new BasicAWSCredentials(keyPair.key, keyPair.secret));
    ClientConfiguration cc = Util.createConfiguration(proxy);

    AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder //
            .standard() //
            .withRegion(region) //
            .withCredentials(credentials) //
            .withClientConfiguration(cc) //
            .build();
    String accountId = iam.getUser().getUser().getUserId();
    project.getProperties().setProperty("aws.account.id", accountId);
    getLog().info("The following properties have been set for the project");
    getLog().info("aws.account.id=" + accountId);
}
 
开发者ID:davidmoten,项目名称:aws-maven-plugin,代码行数:22,代码来源:AwsPropertyMojo.java


注:本文中的com.amazonaws.services.identitymanagement.AmazonIdentityManagement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。