private void disassociateRouteTable(ServiceConfiguration configuration, String associationId)
     throws Exception {
   DisassociateRouteTableType disassociateRouteTableType =
       MessageHelper.createMessage(DisassociateRouteTableType.class, info.getEffectiveUserId());
   disassociateRouteTableType.setAssociationId(associationId);
   AsyncRequests.<DisassociateRouteTableType, DisassociateRouteTableResponseType>sendSync(
       configuration, disassociateRouteTableType);
 }
 private String associateRouteTable(
     ServiceConfiguration configuration, String subnetId, String routeTableId) throws Exception {
   AssociateRouteTableType associateRouteTableType =
       MessageHelper.createMessage(AssociateRouteTableType.class, info.getEffectiveUserId());
   associateRouteTableType.setRouteTableId(routeTableId);
   associateRouteTableType.setSubnetId(subnetId);
   AssociateRouteTableResponseType associateRouteTableResponseType =
       AsyncRequests.<AssociateRouteTableType, AssociateRouteTableResponseType>sendSync(
           configuration, associateRouteTableType);
   return associateRouteTableResponseType.getAssociationId();
 }
 private boolean associationIdExistsForDelete(ServiceConfiguration configuration)
     throws Exception {
   DescribeRouteTablesType describeRouteTablesType =
       MessageHelper.createMessage(DescribeRouteTablesType.class, info.getEffectiveUserId());
   ArrayList<Filter> filterSet = Lists.newArrayList();
   ;
   Filter filter = new Filter();
   filter.setName("association.route-table-association-id");
   filter.setValueSet(Lists.<String>newArrayList(info.getPhysicalResourceId()));
   filterSet.add(filter);
   describeRouteTablesType.setFilterSet(filterSet);
   DescribeRouteTablesResponseType describeRouteTablesResponseType =
       AsyncRequests.<DescribeRouteTablesType, DescribeRouteTablesResponseType>sendSync(
           configuration, describeRouteTablesType);
   if (describeRouteTablesResponseType.getRouteTableSet() == null
       || describeRouteTablesResponseType.getRouteTableSet().getItem() == null
       || describeRouteTablesResponseType.getRouteTableSet().getItem().isEmpty()) {
     return false;
   }
   return true;
 }
 private void checkSubnetExists(ServiceConfiguration configuration) throws Exception {
   DescribeSubnetsType describeSubnetsType =
       MessageHelper.createMessage(DescribeSubnetsType.class, info.getEffectiveUserId());
   describeSubnetsType.getFilterSet().add(Filter.filter("subnet-id", properties.getSubnetId()));
   DescribeSubnetsResponseType describeSubnetsResponseType =
       AsyncRequests.sendSync(configuration, describeSubnetsType);
   if (describeSubnetsResponseType.getSubnetSet() == null
       || describeSubnetsResponseType.getSubnetSet().getItem() == null
       || describeSubnetsResponseType.getSubnetSet().getItem().isEmpty()) {
     throw new ValidationErrorException("No such subnet with id '" + properties.getSubnetId());
   }
 }
 private boolean subnetExistsForDelete(ServiceConfiguration configuration) throws Exception {
   DescribeSubnetsType describeSubnetsType =
       MessageHelper.createMessage(DescribeSubnetsType.class, info.getEffectiveUserId());
   describeSubnetsType.getFilterSet().add(Filter.filter("subnet-id", properties.getSubnetId()));
   DescribeSubnetsResponseType describeSubnetsResponseType =
       AsyncRequests.sendSync(configuration, describeSubnetsType);
   if (describeSubnetsResponseType.getSubnetSet() == null
       || describeSubnetsResponseType.getSubnetSet().getItem() == null
       || describeSubnetsResponseType.getSubnetSet().getItem().isEmpty()) {
     return false;
   }
   return true;
 }
 @Override
 public UpdateType getUpdateType(ResourceAction resourceAction, boolean stackTagsChanged) {
   UpdateType updateType =
       info.supportsTags() && stackTagsChanged ? UpdateType.NO_INTERRUPTION : UpdateType.NONE;
   AWSEC2SubnetRouteTableAssociationResourceAction otherAction =
       (AWSEC2SubnetRouteTableAssociationResourceAction) resourceAction;
   if (!Objects.equals(properties.getRouteTableId(), otherAction.properties.getRouteTableId())) {
     updateType = UpdateType.max(updateType, UpdateType.NO_INTERRUPTION);
   }
   if (!Objects.equals(properties.getSubnetId(), otherAction.properties.getSubnetId())) {
     updateType = UpdateType.max(updateType, UpdateType.NEEDS_REPLACEMENT);
   }
   return updateType;
 }
 private String replaceAssociation(
     ServiceConfiguration configuration, String oldAssociationId, String routeTableId)
     throws Exception {
   ReplaceRouteTableAssociationType replaceRouteTableAssociationType =
       MessageHelper.createMessage(
           ReplaceRouteTableAssociationType.class, info.getEffectiveUserId());
   replaceRouteTableAssociationType.setRouteTableId(routeTableId);
   replaceRouteTableAssociationType.setAssociationId(oldAssociationId);
   ReplaceRouteTableAssociationResponseType replaceRouteTableAssociationResponseType =
       AsyncRequests
           .<ReplaceRouteTableAssociationType, ReplaceRouteTableAssociationResponseType>sendSync(
               configuration, replaceRouteTableAssociationType);
   return replaceRouteTableAssociationResponseType.getNewAssociationId();
 }