//snippet-sourcedescription:[DeleteSubscriptionFilter.java demonstrates how to delete CloudWatch log subscription filters.]
//snippet-keyword:[SDK for Java 2.0]
//snippet-keyword:[Code Sample]
//snippet-service:[cloudwatch]
//snippet-sourcetype:[full-example]
//snippet-sourcedate:[]
//snippet-sourceauthor:[soo-aws]
// snippet-start:[cloudwatch.java2.delete_subscription_filter.complete]
/*
 * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * 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
 *
 * or in the "license" file accompanying this file. 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.
 */
package com.example.cloudwatch;
// snippet-start:[cloudwatch.java2.delete_subscription_filter.import]
import software.amazon.awssdk.services.cloudwatchlogs.CloudWatchLogsClient;
import software.amazon.awssdk.services.cloudwatchlogs.model.CloudWatchLogsException;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteSubscriptionFilterRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteSubscriptionFilterResponse;
// snippet-end:[cloudwatch.java2.delete_subscription_filter.import]

/**
 * Deletes a CloudWatch Logs subscription filter.
 */
// snippet-start:[cloudwatch.java2.delete_subscription_filter.main]
public class DeleteSubscriptionFilter {
    public static void main(String[] args) {

        final String USAGE =
            "To run this example, supply a filter name and log group name\n" +
            "Ex: DeleteSubscriptionFilter <filter-name> <log-group-name>\n";

        if (args.length != 2) {
            System.out.println(USAGE);
            System.exit(1);
        }

        String filter = args[0];
        String log_group = args[1];

        CloudWatchLogsClient logs = CloudWatchLogsClient.builder().build();

        DeleteSubscriptionFilterRequest request =
            DeleteSubscriptionFilterRequest.builder()
                .filterName(filter)
                .logGroupName(log_group).build();

        DeleteSubscriptionFilterResponse response =
                logs.deleteSubscriptionFilter(request);
    	System.out.printf(
                "Successfully deleted CloudWatch logs subscription filter %s",
                filter);
    }
}
// snippet-end:[cloudwatch.java2.delete_subscription_filter.main]
// snippet-end:[cloudwatch.java2.delete_subscription_filter.complete]
@@ -280,16 +280,26 @@
 cedate:%5B
+12/12/2020
 %5D%0D%0A//sni
@@ -325,16 +325,17 @@
 soo-aws%5D
+%0D
 %0A// snip
@@ -428,10 +428,10 @@
 0-20
-19
+20
  Ama
@@ -997,16 +997,17 @@
 se.%0D%0A */
+%0D
 %0Apackage
@@ -1152,20 +1152,22 @@
 oudwatch
-logs
+.model
 .CloudWa
@@ -1169,26 +1169,25 @@
 oudWatch
-LogsClient
+Exception
 ;%0D%0Aimpor
@@ -1235,22 +1235,16 @@
 tchlogs.
-model.
 CloudWat
@@ -1249,25 +1249,22 @@
 atchLogs
-Exception
+Client
 ;%0D%0Aimpor
@@ -1577,16 +1577,17 @@
 er.%0D%0A */
+%0D
 %0A// snip
@@ -1646,16 +1646,17 @@
 er.main%5D
+%0D
 %0Apublic 
@@ -1779,16 +1779,20 @@
         
+    
 %22To run 
@@ -1851,16 +1851,28 @@
 e%5Cn%22 +%0D%0A
+            
         
@@ -2110,18 +2110,17 @@
 ring log
-_g
+G
 roup = a
@@ -2126,24 +2126,43 @@
 args%5B1%5D;%0D%0A%0D%0A
+       try %7B%0D%0A%0D%0A   
         Clou
@@ -2215,16 +2215,37 @@
 uilder()
+%0D%0A                   
 .build()
@@ -2249,32 +2249,35 @@
 d();%0D%0A%0D%0A        
+  
+ 
 DeleteSubscripti
@@ -2299,24 +2299,28 @@
  request =%0D%0A
+    
             
@@ -2378,16 +2378,24 @@
         
+   
+     
 .filterN
@@ -2423,16 +2423,24 @@
         
+   
+     
 .logGrou
@@ -2452,10 +2452,9 @@
 (log
-_g
+G
 roup
@@ -2459,32 +2459,35 @@
 up).build();%0D%0A%0D%0A
+   
         DeleteSu
@@ -2584,13 +2584,167 @@
 );%0D%0A
+%0D%0A       %7D catch (CloudWatchException e) %7B%0D%0A           System.err.println(e.awsErrorDetails().errorMessage());%0D%0A           System.exit(1);%0D%0A       %7D%0D%0A%0D%0A   
     
-%09
 Syst
@@ -2991,28 +2991,30 @@
 ubscription_filter.complete%5D
+%0D%0A

Update DeleteSubscriptionFilter.java