{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
      { $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 :: Lens' DeleteLogPattern Text
deleteLogPattern_resourceGroupName = 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 :: Lens' DeleteLogPattern Text
deleteLogPattern_patternSetName = 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 :: Lens' DeleteLogPattern Text
deleteLogPattern_patternName = 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 :: (Service -> Service)
-> DeleteLogPattern -> Request DeleteLogPattern
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteLogPattern
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteLogPattern)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteLogPatternResponse
DeleteLogPatternResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteLogPattern where
  hashWithSalt :: Int -> DeleteLogPattern -> Int
hashWithSalt Int
_salt DeleteLogPattern' {Text
patternName :: Text
patternSetName :: Text
resourceGroupName :: Text
$sel:patternName:DeleteLogPattern' :: DeleteLogPattern -> Text
$sel:patternSetName:DeleteLogPattern' :: DeleteLogPattern -> Text
$sel:resourceGroupName:DeleteLogPattern' :: DeleteLogPattern -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceGroupName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
patternSetName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
patternName

instance Prelude.NFData DeleteLogPattern where
  rnf :: DeleteLogPattern -> ()
rnf DeleteLogPattern' {Text
patternName :: Text
patternSetName :: Text
resourceGroupName :: Text
$sel:patternName:DeleteLogPattern' :: DeleteLogPattern -> Text
$sel:patternSetName:DeleteLogPattern' :: DeleteLogPattern -> Text
$sel:resourceGroupName:DeleteLogPattern' :: DeleteLogPattern -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
resourceGroupName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
patternSetName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
patternName

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

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"ResourceGroupName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
resourceGroupName),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"PatternSetName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
patternSetName),
            forall a. a -> Maybe a
Prelude.Just (Key
"PatternName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
patternName)
          ]
      )

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

instance Data.ToQuery DeleteLogPattern where
  toQuery :: DeleteLogPattern -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:httpStatus:DeleteLogPatternResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteLogPatternResponse_httpStatus :: Lens.Lens' DeleteLogPatternResponse Prelude.Int
deleteLogPatternResponse_httpStatus :: Lens' DeleteLogPatternResponse Int
deleteLogPatternResponse_httpStatus = 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 where
  rnf :: DeleteLogPatternResponse -> ()
rnf DeleteLogPatternResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteLogPatternResponse' :: DeleteLogPatternResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus