I am using the AWS SDK for Java V2, and I want to delete a SageMaker endpoint and a SageMaker endpoint config. What is the best way to do this?
For example, I am currently first using the describeEndpoint
method to see if the endpoint already exists. I do this by calling describeEndpoint
and if I get an exception that includes the phrase Could not find endpoint
, then I know the endpoint does not exist.
That way, I can only call the deleteEndpoint
method if the endpoint already exists, as it will otherwise throw an exception. This feels like a very inelegant solution. Can we do better?