Java 类com.amazonaws.services.ec2.model.AssociateAddressResult 实例源码

项目:aws-doc-sdk-examples    文件:AllocateAddress.java   
public static void main(String[] args)
{
    final String USAGE =
        "To run this example, supply an instance id\n" +
        "Ex: AllocateAddress <instance_id>\n";

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

    String instance_id = args[0];

    final AmazonEC2 ec2 = AmazonEC2ClientBuilder.defaultClient();

    AllocateAddressRequest allocate_request = new AllocateAddressRequest()
        .withDomain(DomainType.Vpc);

    AllocateAddressResult allocate_response =
        ec2.allocateAddress(allocate_request);

    String allocation_id = allocate_response.getAllocationId();

    AssociateAddressRequest associate_request =
        new AssociateAddressRequest()
            .withInstanceId(instance_id)
            .withAllocationId(allocation_id);

    AssociateAddressResult associate_response =
        ec2.associateAddress(associate_request);

    System.out.printf(
        "Successfully associated Elastic IP address %s " +
        "with instance %s",
        associate_response.getAssociationId(),
        instance_id);
}
项目:ec2-util    文件:AwsEc2Client.java   
public static String associateAddress(AmazonEC2 ec2, Address address, String instanceId) {
    AssociateAddressRequest addressRequest = new AssociateAddressRequest()
            .withAllocationId(address.getAllocationId()).withInstanceId(instanceId);
    AssociateAddressResult addressResult = ec2.associateAddress(addressRequest);
    String associationId = addressResult.getAssociationId();
    return associationId;
}
项目:elasticsearch_my    文件:AmazonEC2Mock.java   
@Override
public AssociateAddressResult associateAddress(AssociateAddressRequest associateAddressRequest) throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Not supported in mock");
}