@Test public void translateToCreateRequest_notDefaultVersion() { ResourceModel model = ResourceModel.builder() .isDefaultVersion(false) .arn("arn:aws:cloudformation:us-west-2:123456789012:type/resource/AWS-Test-Resource") .build(); DeregisterTypeRequest request = Translator.translateToDeleteRequest(model, logger); assertThat(request.arn()).isEqualTo(model.getArn()); assertThat(request.type()).isNull(); assertThat(request.typeName()).isNull(); }
static DeregisterTypeRequest translateToDeleteRequest(@NonNull final ResourceModel model, @NonNull final Logger logger) { if (model.getIsDefaultVersion()) { logger.log("De-registering default version"); return DeregisterTypeRequest.builder() .type(RegistryType.RESOURCE) .typeName(model.getTypeName()) .build(); } else { logger.log("De-registering version"); return DeregisterTypeRequest.builder() .arn(model.getArn()) .build(); } }
Translator { static DeregisterTypeRequest translateToDeleteRequest(@NonNull final ResourceModel model, @NonNull final Logger logger) { if (model.getIsDefaultVersion()) { logger.log("De-registering default version"); return DeregisterTypeRequest.builder() .type(RegistryType.RESOURCE) .typeName(model.getTypeName()) .build(); } else { logger.log("De-registering version"); return DeregisterTypeRequest.builder() .arn(model.getArn()) .build(); } } }
Translator { static DeregisterTypeRequest translateToDeleteRequest(@NonNull final ResourceModel model, @NonNull final Logger logger) { if (model.getIsDefaultVersion()) { logger.log("De-registering default version"); return DeregisterTypeRequest.builder() .type(RegistryType.RESOURCE) .typeName(model.getTypeName()) .build(); } else { logger.log("De-registering version"); return DeregisterTypeRequest.builder() .arn(model.getArn()) .build(); } }  }
Translator { static DeregisterTypeRequest translateToDeleteRequest(@NonNull final ResourceModel model, @NonNull final Logger logger) { if (model.getIsDefaultVersion()) { logger.log("De-registering default version"); return DeregisterTypeRequest.builder() .type(RegistryType.RESOURCE) .typeName(model.getTypeName()) .build(); } else { logger.log("De-registering version"); return DeregisterTypeRequest.builder() .arn(model.getArn()) .build(); } }   }
Translator { static DeregisterTypeRequest translateToDeleteRequest(@NonNull final ResourceModel model, @NonNull final Logger logger) { if (model.getIsDefaultVersion()) { logger.log("De-registering default version"); return DeregisterTypeRequest.builder() .type(RegistryType.RESOURCE) .typeName(model.getTypeName()) .build(); } else { logger.log("De-registering version"); return DeregisterTypeRequest.builder() .arn(model.getArn()) .build(); } }    }