/**
 * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * This file is licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License. A copy of
 * the License is located at
 *
 * http://aws.amazon.com/apache2.0/
 *
 * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 *
 */

// snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.]
// snippet-sourcedescription:[DeleteFunction.java demonstrates how to delete an AWS Lambda function by using the LambdaClient object]
// snippet-service:[Lambda]
// snippet-keyword:[Java]
// snippet-keyword:[Amazon Lambda]
// snippet-keyword:[Code Sample]
// snippet-sourcetype:[full-example]
// snippet-sourcedate:[2019-11-19]
// snippet-sourceauthor:[AWS-scmacdon]

// snippet-start:[lambda.java1.DeleteFunction.complete]
package com.example.lambda;

// snippet-start:[lambda.java1.delete.import]
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.lambda.AWSLambda;
import com.amazonaws.services.lambda.AWSLambdaClientBuilder;
import com.amazonaws.services.lambda.model.ServiceException;
import com.amazonaws.services.lambda.model.DeleteFunctionRequest;
// snippet-end:[lambda.java1.delete.import]


public class DeleteFunction {

    public static void main(String[] args) {

        if (args.length < 1) {
            System.out.println("Please specify a function name");
            System.exit(1);
        }

        // snippet-start:[lambda.java1.delete.main]
        String functionName = args[0];
        try {
        AWSLambda awsLambda = AWSLambdaClientBuilder.standard()
                .withCredentials(new ProfileCredentialsProvider())
                .withRegion(Regions.US_WEST_2).build();

        DeleteFunctionRequest delFunc = new DeleteFunctionRequest();
        delFunc.withFunctionName(functionName);

        //Delete the functiom
        awsLambda.deleteFunction(delFunc);
        System.out.println("The function is deleted");
    }
    catch (ServiceException e) {
        System.out.println(e);
    }
        // snippet-end:[lambda.java1.delete.main]
   }
}
// snippet-end:[lambda.java1.DeleteFunction.complete]

@@ -17,18 +17,18 @@
  2010-20
-19
+20
  Amazon.
@@ -1514,17 +1514,16 @@
 mport%5D%0A%0A
-%0A
 public c
@@ -1840,16 +1840,20 @@
         
+    
 AWSLambd
@@ -1912,24 +1912,28 @@
             
+    
 .withCredent
@@ -1971,16 +1971,20 @@
 ider())%0A
+    
         
@@ -2040,16 +2040,20 @@
         
+    
 DeleteFu
@@ -2113,16 +2113,20 @@
         
+    
 delFunc.
@@ -2166,16 +2166,20 @@
         
+   
+ 
 //Delete
@@ -2192,16 +2192,20 @@
 unctiom%0A
+    
         
@@ -2239,32 +2239,36 @@
 lFunc);%0A        
+ 
+   
 System.out.print
@@ -2298,25 +2298,26 @@
 eted%22);%0A
+%0A
     
-%7D%0A
+ 
    
+%7D
  catch (
@@ -2338,32 +2338,36 @@
 on e) %7B%0A        
+    
 System.out.print
@@ -2373,16 +2373,20 @@
 tln(e);%0A
+    
     %7D%0A  
@@ -2433,16 +2433,17 @@
 e.main%5D%0A
+ 
    %7D%0A%7D%0A/

Update DeleteFunction.java