@Override public ResourceAction perform(ResourceAction resourceAction) throws Exception { AWSEC2SubnetRouteTableAssociationResourceAction action = (AWSEC2SubnetRouteTableAssociationResourceAction) resourceAction; ServiceConfiguration configuration = Topology.lookup(Compute.class); if (!Boolean.TRUE.equals(action.info.getCreatedEnoughToDelete())) return action; if (!action.associationIdExistsForDelete(configuration)) return action; if (!action.routeTableExistsForDelete(configuration)) return action; if (!action.subnetExistsForDelete(configuration)) return action; action.disassociateRouteTable(configuration, action.info.getPhysicalResourceId()); return action; }
@Override public ResourceAction perform( ResourceAction oldResourceAction, ResourceAction newResourceAction) throws Exception { AWSEC2SubnetRouteTableAssociationResourceAction oldAction = (AWSEC2SubnetRouteTableAssociationResourceAction) oldResourceAction; AWSEC2SubnetRouteTableAssociationResourceAction newAction = (AWSEC2SubnetRouteTableAssociationResourceAction) newResourceAction; ServiceConfiguration configuration = Topology.lookup(Compute.class); String newAssociationId = newAction.replaceAssociation( configuration, oldAction.info.getPhysicalResourceId(), newAction.properties.getRouteTableId()); newAction.info.setPhysicalResourceId(newAssociationId); newAction.info.setCreatedEnoughToDelete(true); newAction.info.setReferenceValueJson( JsonHelper.getStringFromJsonNode(new TextNode(newAction.info.getPhysicalResourceId()))); return newAction; }
@Override public ResourceAction perform(ResourceAction resourceAction) throws Exception { AWSEC2SubnetRouteTableAssociationResourceAction action = (AWSEC2SubnetRouteTableAssociationResourceAction) resourceAction; ServiceConfiguration configuration = Topology.lookup(Compute.class); // See if route table is there action.checkRouteTableExists(configuration); // See if subnet is there action.checkSubnetExists(configuration); String associationId = action.associateRouteTable( configuration, action.properties.getSubnetId(), action.properties.getRouteTableId()); action.info.setPhysicalResourceId(associationId); action.info.setCreatedEnoughToDelete(true); action.info.setReferenceValueJson( JsonHelper.getStringFromJsonNode(new TextNode(action.info.getPhysicalResourceId()))); return action; }