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

项目:photon-model    文件:TestAWSSetupUtils.java   
/**
 * Attach a provided AWS NIC to a given AWS VM with deviceIndex = number of NICs + 1
 * returns the attachment ID of the newly created and attached NIC. This is necessary for
 * removing it later for the goals of the test. The NIC is as well configured to be deleted on
 * instance termination for sanity purposes.
 */
public static String addNICDirectlyWithEC2Client(ComputeState vm, AmazonEC2Client client,
        VerificationHost host, String newNicId) {

    // attach the new AWS NIC to the AWS VM
    AttachNetworkInterfaceRequest attachNewNic = new AttachNetworkInterfaceRequest()
            .withInstanceId(vm.id)
            .withDeviceIndex(vm.networkInterfaceLinks.size())
            .withNetworkInterfaceId(newNicId);

    AttachNetworkInterfaceResult attachmetnResult = client.attachNetworkInterface(attachNewNic);
    String attachmentId = attachmetnResult.getAttachmentId();

    // ensure the new NIC is deleted when the VM is terminated
    NetworkInterfaceAttachmentChanges attachTerm = new NetworkInterfaceAttachmentChanges()
            .withAttachmentId(attachmentId)
            .withDeleteOnTermination(true);
    ModifyNetworkInterfaceAttributeRequest setDeleteOnTerm = new ModifyNetworkInterfaceAttributeRequest()
            .withAttachment(attachTerm)
            .withNetworkInterfaceId(newNicId);
    client.modifyNetworkInterfaceAttribute(setDeleteOnTerm);
    host.log("Created new NIC with id: %s to vm id: %s with attachment id: %s", newNicId,
            vm.id, attachmentId);
    return attachmentId;
}
项目:vpc2vpc    文件:CreateConnection.java   
private void disableSrcDestCheck(List<VPNEndpoint> vpnEndpoints) {

    for (VPNEndpoint vpnEndpoint : vpnEndpoints) {
      ec2Client.setEndpoint(vpnEndpoint.getRegion().getEndpoint());

      Instance instance = vpnEndpoint.getInstance();

      List<NetworkInterface> networkInterfaces = ec2Client.describeNetworkInterfaces().getNetworkInterfaces();
      for (NetworkInterface nic : networkInterfaces) {
        if (nic.getAttachment().getInstanceId().equals(instance.getInstanceId())) {
          ModifyNetworkInterfaceAttributeRequest modifyNicAttribute = new ModifyNetworkInterfaceAttributeRequest();
          modifyNicAttribute.setNetworkInterfaceId(nic.getNetworkInterfaceId());
          modifyNicAttribute.setSourceDestCheck(false);
          ec2Client.modifyNetworkInterfaceAttribute(modifyNicAttribute);
          LOG.debug("Disabled Src/Dest check on " + instance.getInstanceId());
        }
      }
    }
  }
项目:elasticsearch_my    文件:AmazonEC2Mock.java   
@Override
public void modifyNetworkInterfaceAttribute(ModifyNetworkInterfaceAttributeRequest modifyNetworkInterfaceAttributeRequest) throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Not supported in mock");
}
项目:aws-sdk-java-resources    文件:NetworkInterfaceImpl.java   
@Override
public void modifyAttribute(ModifyNetworkInterfaceAttributeRequest request)
        {

    modifyAttribute(request, null);
}
项目:aws-sdk-java-resources    文件:NetworkInterfaceImpl.java   
@Override
public void modifyAttribute(ModifyNetworkInterfaceAttributeRequest request,
        ResultCapture<Void> extractor) {

    resource.performAction("ModifyAttribute", request, extractor);
}
项目:aws-sdk-java-resources    文件:NetworkInterface.java   
/**
 * Performs the <code>ModifyAttribute</code> action.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>NetworkInterface</code> resource, and any conflicting parameter
 * value set in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>NetworkInterfaceId</code></b>
 *         - mapped from the <code>Id</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @see ModifyNetworkInterfaceAttributeRequest
 */
void modifyAttribute(ModifyNetworkInterfaceAttributeRequest request);
项目:aws-sdk-java-resources    文件:NetworkInterface.java   
/**
 * Performs the <code>ModifyAttribute</code> action and use a ResultCapture
 * to retrieve the low-level client response.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>NetworkInterface</code> resource, and any conflicting parameter
 * value set in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>NetworkInterfaceId</code></b>
 *         - mapped from the <code>Id</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @see ModifyNetworkInterfaceAttributeRequest
 */
void modifyAttribute(ModifyNetworkInterfaceAttributeRequest request,
        ResultCapture<Void> extractor);