Search in sources :

Example 1 with DeleteFunctionRequest

use of software.amazon.awssdk.services.cloudfront.model.DeleteFunctionRequest in project aws-doc-sdk-examples by awsdocs.

the class DeleteFunction method deleteSpecificFunction.

// snippet-start:[cloudfront.java2.del_function.main]
public static void deleteSpecificFunction(CloudFrontClient cloudFrontClient, String functionName, String ifMatchVal) {
    try {
        DeleteFunctionRequest functionRequest = DeleteFunctionRequest.builder().name(functionName).ifMatch(ifMatchVal).build();
        cloudFrontClient.deleteFunction(functionRequest);
        System.out.println(functionName + " was successfully deleted.");
    } catch (CloudFrontException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}
Also used : CloudFrontException(software.amazon.awssdk.services.cloudfront.model.CloudFrontException) DeleteFunctionRequest(software.amazon.awssdk.services.cloudfront.model.DeleteFunctionRequest)

Aggregations

CloudFrontException (software.amazon.awssdk.services.cloudfront.model.CloudFrontException)1 DeleteFunctionRequest (software.amazon.awssdk.services.cloudfront.model.DeleteFunctionRequest)1