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);
}
}
Aggregations