{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.ApplicationInsights.DeleteLogPattern
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Removes the specified log pattern from a @LogPatternSet@.
module Amazonka.ApplicationInsights.DeleteLogPattern
  ( -- * Creating a Request
    DeleteLogPattern (..),
    newDeleteLogPattern,

    -- * Request Lenses
    deleteLogPattern_resourceGroupName,
    deleteLogPattern_patternSetName,
    deleteLogPattern_patternName,

    -- * Destructuring the Response
    DeleteLogPatternResponse (..),
    newDeleteLogPatternResponse,

    -- * Response Lenses
    deleteLogPatternResponse_httpStatus,
  )
where

import Amazonka.ApplicationInsights.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteLogPattern' smart constructor.
data DeleteLogPattern = DeleteLogPattern'
  { -- | The name of the resource group.
    DeleteLogPattern -> Text
resourceGroupName :: Prelude.Text,
    -- | The name of the log pattern set.
    DeleteLogPattern -> Text
patternSetName :: Prelude.Text,
    -- | The name of the log pattern.
    DeleteLogPattern -> Text
patternName :: Prelude.Text
  }
  deriving (DeleteLogPattern -> DeleteLogPattern -> Bool
(DeleteLogPattern -> DeleteLogPattern -> Bool)
-> (DeleteLogPattern -> DeleteLogPattern -> Bool)
-> Eq DeleteLogPattern
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteLogPattern -> DeleteLogPattern -> Bool
$c/= :: DeleteLogPattern -> DeleteLogPattern -> Bool
== :: DeleteLogPattern -> DeleteLogPattern -> Bool
$c== :: DeleteLogPattern -> DeleteLogPattern -> Bool
Prelude.Eq, ReadPrec [DeleteLogPattern]
ReadPrec DeleteLogPattern
Int -> ReadS DeleteLogPattern
ReadS [DeleteLogPattern]
(Int -> ReadS DeleteLogPattern)
-> ReadS [DeleteLogPattern]
-> ReadPrec DeleteLogPattern
-> ReadPrec [DeleteLogPattern]
-> Read DeleteLogPattern
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteLogPattern]
$creadListPrec :: ReadPrec [DeleteLogPattern]
readPrec :: ReadPrec DeleteLogPattern
$creadPrec :: ReadPrec DeleteLogPattern
readList :: ReadS [DeleteLogPattern]
$creadList :: ReadS [DeleteLogPattern]
readsPrec :: Int -> ReadS DeleteLogPattern
$creadsPrec :: Int -> ReadS DeleteLogPattern
Prelude.Read, Int -> DeleteLogPattern -> ShowS
[DeleteLogPattern] -> ShowS
DeleteLogPattern -> String
(Int -> DeleteLogPattern -> ShowS)
-> (DeleteLogPattern -> String)
-> ([DeleteLogPattern] -> ShowS)
-> Show DeleteLogPattern
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteLogPattern] -> ShowS
$cshowList :: [DeleteLogPattern] -> ShowS
show :: DeleteLogPattern -> String
$cshow :: DeleteLogPattern -> String
showsPrec :: Int -> DeleteLogPattern -> ShowS
$cshowsPrec :: Int -> DeleteLogPattern -> ShowS
Prelude.Show, (forall x. DeleteLogPattern -> Rep DeleteLogPattern x)
-> (forall x. Rep DeleteLogPattern x -> DeleteLogPattern)
-> Generic DeleteLogPattern
forall x. Rep DeleteLogPattern x -> DeleteLogPattern
forall x. DeleteLogPattern -> Rep DeleteLogPattern x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteLogPattern x -> DeleteLogPattern
$cfrom :: forall x. DeleteLogPattern -> Rep DeleteLogPattern x
Prelude.Generic)

-- |
-- Create a value of 'DeleteLogPattern' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'resourceGroupName', 'deleteLogPattern_resourceGroupName' - The name of the resource group.
--
-- 'patternSetName', 'deleteLogPattern_patternSetName' - The name of the log pattern set.
--
-- 'patternName', 'deleteLogPattern_patternName' - The name of the log pattern.
newDeleteLogPattern ::
  -- | 'resourceGroupName'
  Prelude.Text ->
  -- | 'patternSetName'
  Prelude.Text ->
  -- | 'patternName'
  Prelude.Text ->
  DeleteLogPattern
newDeleteLogPattern :: Text -> Text -> Text -> DeleteLogPattern
newDeleteLogPattern
  Text
pResourceGroupName_
  Text
pPatternSetName_
  Text
pPatternName_ =
    DeleteLogPattern' :: Text -> Text -> Text -> DeleteLogPattern
DeleteLogPattern'
      { $sel:resourceGroupName:DeleteLogPattern' :: Text
resourceGroupName =
          Text
pResourceGroupName_,
        $sel:patternSetName:DeleteLogPattern' :: Text
patternSetName = Text
pPatternSetName_,
        $sel:patternName:DeleteLogPattern' :: Text
patternName = Text
pPatternName_
      }

-- | The name of the resource group.
deleteLogPattern_resourceGroupName :: Lens.Lens' DeleteLogPattern Prelude.Text
deleteLogPattern_resourceGroupName :: (Text -> f Text) -> DeleteLogPattern -> f DeleteLogPattern
deleteLogPattern_resourceGroupName = (DeleteLogPattern -> Text)
-> (DeleteLogPattern -> Text -> DeleteLogPattern)
-> Lens DeleteLogPattern DeleteLogPattern Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLogPattern' {Text
resourceGroupName :: Text
$sel:resourceGroupName:DeleteLogPattern' :: DeleteLogPattern -> Text
resourceGroupName} -> Text
resourceGroupName) (\s :: DeleteLogPattern
s@DeleteLogPattern' {} Text
a -> DeleteLogPattern
s {$sel:resourceGroupName:DeleteLogPattern' :: Text
resourceGroupName = Text
a} :: DeleteLogPattern)

-- | The name of the log pattern set.
deleteLogPattern_patternSetName :: Lens.Lens' DeleteLogPattern Prelude.Text
deleteLogPattern_patternSetName :: (Text -> f Text) -> DeleteLogPattern -> f DeleteLogPattern
deleteLogPattern_patternSetName = (DeleteLogPattern -> Text)
-> (DeleteLogPattern -> Text -> DeleteLogPattern)
-> Lens DeleteLogPattern DeleteLogPattern Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLogPattern' {Text
patternSetName :: Text
$sel:patternSetName:DeleteLogPattern' :: DeleteLogPattern -> Text
patternSetName} -> Text
patternSetName) (\s :: DeleteLogPattern
s@DeleteLogPattern' {} Text
a -> DeleteLogPattern
s {$sel:patternSetName:DeleteLogPattern' :: Text
patternSetName = Text
a} :: DeleteLogPattern)

-- | The name of the log pattern.
deleteLogPattern_patternName :: Lens.Lens' DeleteLogPattern Prelude.Text
deleteLogPattern_patternName :: (Text -> f Text) -> DeleteLogPattern -> f DeleteLogPattern
deleteLogPattern_patternName = (DeleteLogPattern -> Text)
-> (DeleteLogPattern -> Text -> DeleteLogPattern)
-> Lens DeleteLogPattern DeleteLogPattern Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLogPattern' {Text
patternName :: Text
$sel:patternName:DeleteLogPattern' :: DeleteLogPattern -> Text
patternName} -> Text
patternName) (\s :: DeleteLogPattern
s@DeleteLogPattern' {} Text
a -> DeleteLogPattern
s {$sel:patternName:DeleteLogPattern' :: Text
patternName = Text
a} :: DeleteLogPattern)

instance Core.AWSRequest DeleteLogPattern where
  type
    AWSResponse DeleteLogPattern =
      DeleteLogPatternResponse
  request :: DeleteLogPattern -> Request DeleteLogPattern
request = Service -> DeleteLogPattern -> Request DeleteLogPattern
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteLogPattern
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteLogPattern)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteLogPattern))
-> Logger
-> Service
-> Proxy DeleteLogPattern
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteLogPattern)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteLogPatternResponse
DeleteLogPatternResponse'
            (Int -> DeleteLogPatternResponse)
-> Either String Int -> Either String DeleteLogPatternResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteLogPattern

instance Prelude.NFData DeleteLogPattern

instance Core.ToHeaders DeleteLogPattern where
  toHeaders :: DeleteLogPattern -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteLogPattern -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"EC2WindowsBarleyService.DeleteLogPattern" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DeleteLogPattern where
  toJSON :: DeleteLogPattern -> Value
toJSON DeleteLogPattern' {Text
patternName :: Text
patternSetName :: Text
resourceGroupName :: Text
$sel:patternName:DeleteLogPattern' :: DeleteLogPattern -> Text
$sel:patternSetName:DeleteLogPattern' :: DeleteLogPattern -> Text
$sel:resourceGroupName:DeleteLogPattern' :: DeleteLogPattern -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ResourceGroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceGroupName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"PatternSetName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
patternSetName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PatternName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
patternName)
          ]
      )

instance Core.ToPath DeleteLogPattern where
  toPath :: DeleteLogPattern -> ByteString
toPath = ByteString -> DeleteLogPattern -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DeleteLogPattern where
  toQuery :: DeleteLogPattern -> QueryString
toQuery = QueryString -> DeleteLogPattern -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDeleteLogPatternResponse' smart constructor.
data DeleteLogPatternResponse = DeleteLogPatternResponse'
  { -- | The response's http status code.
    DeleteLogPatternResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteLogPatternResponse -> DeleteLogPatternResponse -> Bool
(DeleteLogPatternResponse -> DeleteLogPatternResponse -> Bool)
-> (DeleteLogPatternResponse -> DeleteLogPatternResponse -> Bool)
-> Eq DeleteLogPatternResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteLogPatternResponse -> DeleteLogPatternResponse -> Bool
$c/= :: DeleteLogPatternResponse -> DeleteLogPatternResponse -> Bool
== :: DeleteLogPatternResponse -> DeleteLogPatternResponse -> Bool
$c== :: DeleteLogPatternResponse -> DeleteLogPatternResponse -> Bool
Prelude.Eq, ReadPrec [DeleteLogPatternResponse]
ReadPrec DeleteLogPatternResponse
Int -> ReadS DeleteLogPatternResponse
ReadS [DeleteLogPatternResponse]
(Int -> ReadS DeleteLogPatternResponse)
-> ReadS [DeleteLogPatternResponse]
-> ReadPrec DeleteLogPatternResponse
-> ReadPrec [DeleteLogPatternResponse]
-> Read DeleteLogPatternResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteLogPatternResponse]
$creadListPrec :: ReadPrec [DeleteLogPatternResponse]
readPrec :: ReadPrec DeleteLogPatternResponse
$creadPrec :: ReadPrec DeleteLogPatternResponse
readList :: ReadS [DeleteLogPatternResponse]
$creadList :: ReadS [DeleteLogPatternResponse]
readsPrec :: Int -> ReadS DeleteLogPatternResponse
$creadsPrec :: Int -> ReadS DeleteLogPatternResponse
Prelude.Read, Int -> DeleteLogPatternResponse -> ShowS
[DeleteLogPatternResponse] -> ShowS
DeleteLogPatternResponse -> String
(Int -> DeleteLogPatternResponse -> ShowS)
-> (DeleteLogPatternResponse -> String)
-> ([DeleteLogPatternResponse] -> ShowS)
-> Show DeleteLogPatternResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteLogPatternResponse] -> ShowS
$cshowList :: [DeleteLogPatternResponse] -> ShowS
show :: DeleteLogPatternResponse -> String
$cshow :: DeleteLogPatternResponse -> String
showsPrec :: Int -> DeleteLogPatternResponse -> ShowS
$cshowsPrec :: Int -> DeleteLogPatternResponse -> ShowS
Prelude.Show, (forall x.
 DeleteLogPatternResponse -> Rep DeleteLogPatternResponse x)
-> (forall x.
    Rep DeleteLogPatternResponse x -> DeleteLogPatternResponse)
-> Generic DeleteLogPatternResponse
forall x.
Rep DeleteLogPatternResponse x -> DeleteLogPatternResponse
forall x.
DeleteLogPatternResponse -> Rep DeleteLogPatternResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteLogPatternResponse x -> DeleteLogPatternResponse
$cfrom :: forall x.
DeleteLogPatternResponse -> Rep DeleteLogPatternResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteLogPatternResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'deleteLogPatternResponse_httpStatus' - The response's http status code.
newDeleteLogPatternResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteLogPatternResponse
newDeleteLogPatternResponse :: Int -> DeleteLogPatternResponse
newDeleteLogPatternResponse Int
pHttpStatus_ =
  DeleteLogPatternResponse' :: Int -> DeleteLogPatternResponse
DeleteLogPatternResponse'
    { $sel:httpStatus:DeleteLogPatternResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteLogPatternResponse_httpStatus :: Lens.Lens' DeleteLogPatternResponse Prelude.Int
deleteLogPatternResponse_httpStatus :: (Int -> f Int)
-> DeleteLogPatternResponse -> f DeleteLogPatternResponse
deleteLogPatternResponse_httpStatus = (DeleteLogPatternResponse -> Int)
-> (DeleteLogPatternResponse -> Int -> DeleteLogPatternResponse)
-> Lens DeleteLogPatternResponse DeleteLogPatternResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLogPatternResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteLogPatternResponse' :: DeleteLogPatternResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteLogPatternResponse
s@DeleteLogPatternResponse' {} Int
a -> DeleteLogPatternResponse
s {$sel:httpStatus:DeleteLogPatternResponse' :: Int
httpStatus = Int
a} :: DeleteLogPatternResponse)

instance Prelude.NFData DeleteLogPatternResponse