func deleteLogGroups(ctx context.Context, l []cloudwatchlogs.LogGroup, cw *cloudwatchlogs.CloudWatchLogs) {

	// will cancel deletion after 10 seconds of activity (in case of hung process)
	ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
	defer cancel()

	// go through each log group
	for _, v := range l {

		name := v.LogGroupName
		params := &cloudwatchlogs.DeleteLogGroupInput{
			LogGroupName: name,
		}

		// Create delete request
		del := cw.DeleteLogGroupRequest(params)
		// Send the request to delete the log group
		_, err := del.Send(ctx)
		if err != nil {
			log.Fatalf("Could not delete log group %v\n", err)
		}
		fmt.Printf("Deleted log group %v\n", *name)
	}
}
// deleteLogGroups runs the delete operation on l[] for each group contianed
deleteLogGroups runs the delete operation on l[] for each group contianed
// deleteLogGroups runs the delete operation on l [] for each group contianed
func deleteLogGroups(ctx context.Context, l []cloudwatchlogs.LogGroup, cw *cloudwatchlogs.CloudWatchLogs) {
	ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
	defer cancel()
	for _, v := range l {
		name := v.LogGroupName
		params := &cloudwatchlogs.DeleteLogGroupInput{
			LogGroupName: name,
		}
		del := cw.DeleteLogGroupRequest(params)
		_, err := del.Send(ctx)
		if err != nil {
			log.Fatalf("Could not delete log group %v\n", err)
		}
		fmt.Printf("Deleted log group %v\n", *name)
	}
}
func deleteLogGroups ( ctx context . Context , l [ ] cloudwatchlogs . LogGroup , cw * cloudwatchlogs . CloudWatchLogs ) { ctx , cancel := context . WithTimeout ( ctx , 10 * time . Second ) defer cancel ( ) for _ , v := range l { name := v . LogGroupName params := & cloudwatchlogs . DeleteLogGroupInput { LogGroupName : name , } del := cw . DeleteLogGroupRequest ( params ) _ , err := del . Send ( ctx ) if err != nil { log . Fatalf ( " \n " , err ) } fmt . Printf ( " \n " , * name ) } }
deleteLogGroups runs the delete operation on l[] for each group contianed
deleteLogGroups runs the delete operation on l [] for each group contianed
// will cancel deletion after 10 seconds of activity (in case of hung process) // go through each log group // Create delete request // Send the request to delete the log group