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

项目:photon-model    文件:TestAWSSetupUtils.java   
/**
 * Removes a specified AWS NIC from the VM it is currently attached to
 */
public static void detachNICDirectlyWithEC2Client(String instanceId, String nicAttachmentId, String nicId,
        AmazonEC2Client client, VerificationHost host) {

    // detach the new AWS NIC to the AWS VM
    DetachNetworkInterfaceRequest detachNic = new DetachNetworkInterfaceRequest();
    detachNic.withAttachmentId(nicAttachmentId);

    host.log("Detaching NIC with id: %s and attachment id: %s", nicId, nicAttachmentId);
    client.detachNetworkInterface(detachNic);

    host.waitFor("Timeout waiting for AWS to detach a NIC from " + instanceId
            + " with attachment id: " + nicAttachmentId, () -> {
                DescribeInstancesRequest describeInstancesRequest = new DescribeInstancesRequest()
                        .withFilters(new Filter("instance-id", Collections.singletonList(instanceId)));
                DescribeInstancesResult result = client.describeInstances(describeInstancesRequest);

                Instance currentInstance = result.getReservations().get(0).getInstances().get(0);
                for (InstanceNetworkInterface awsNic : currentInstance.getNetworkInterfaces()) {
                    if (awsNic.getNetworkInterfaceId().equals(nicId)) {
                        //Requested NIC was not detached from the instance
                        return false;
                    }
                }
                host.log("Detached NIC with attachment id: %s", nicAttachmentId);
                return true;
            });
}
项目:elasticsearch_my    文件:AmazonEC2Mock.java   
@Override
public void detachNetworkInterface(DetachNetworkInterfaceRequest detachNetworkInterfaceRequest) throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Not supported in mock");
}
项目:aws-sdk-java-resources    文件:NetworkInterfaceImpl.java   
@Override
public void detach(DetachNetworkInterfaceRequest request) {
    detach(request, null);
}
项目:aws-sdk-java-resources    文件:NetworkInterfaceImpl.java   
@Override
public void detach(DetachNetworkInterfaceRequest request,
        ResultCapture<Void> extractor) {

    resource.performAction("Detach", request, extractor);
}
项目:aws-sdk-java-resources    文件:NetworkInterface.java   
/**
 * Performs the <code>Detach</code> action.
 *
 * <p>
 *
 * @see DetachNetworkInterfaceRequest
 */
void detach(DetachNetworkInterfaceRequest request);
项目:aws-sdk-java-resources    文件:NetworkInterface.java   
/**
 * Performs the <code>Detach</code> action and use a ResultCapture to
 * retrieve the low-level client response.
 *
 * <p>
 *
 * @see DetachNetworkInterfaceRequest
 */
void detach(DetachNetworkInterfaceRequest request, ResultCapture<Void>
        extractor);