{-# 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.Shield.DisableApplicationLayerAutomaticResponse
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Disable the Shield Advanced automatic application layer DDoS mitigation
-- feature for the protected resource. This stops Shield Advanced from
-- creating, verifying, and applying WAF rules for attacks that it detects
-- for the resource.
module Amazonka.Shield.DisableApplicationLayerAutomaticResponse
  ( -- * Creating a Request
    DisableApplicationLayerAutomaticResponse (..),
    newDisableApplicationLayerAutomaticResponse,

    -- * Request Lenses
    disableApplicationLayerAutomaticResponse_resourceArn,

    -- * Destructuring the Response
    DisableApplicationLayerAutomaticResponseResponse (..),
    newDisableApplicationLayerAutomaticResponseResponse,

    -- * Response Lenses
    disableApplicationLayerAutomaticResponseResponse_httpStatus,
  )
where

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
import Amazonka.Shield.Types

-- | /See:/ 'newDisableApplicationLayerAutomaticResponse' smart constructor.
data DisableApplicationLayerAutomaticResponse = DisableApplicationLayerAutomaticResponse'
  { -- | The ARN (Amazon Resource Name) of the protected resource.
    DisableApplicationLayerAutomaticResponse -> Text
resourceArn :: Prelude.Text
  }
  deriving (DisableApplicationLayerAutomaticResponse
-> DisableApplicationLayerAutomaticResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisableApplicationLayerAutomaticResponse
-> DisableApplicationLayerAutomaticResponse -> Bool
$c/= :: DisableApplicationLayerAutomaticResponse
-> DisableApplicationLayerAutomaticResponse -> Bool
== :: DisableApplicationLayerAutomaticResponse
-> DisableApplicationLayerAutomaticResponse -> Bool
$c== :: DisableApplicationLayerAutomaticResponse
-> DisableApplicationLayerAutomaticResponse -> Bool
Prelude.Eq, ReadPrec [DisableApplicationLayerAutomaticResponse]
ReadPrec DisableApplicationLayerAutomaticResponse
Int -> ReadS DisableApplicationLayerAutomaticResponse
ReadS [DisableApplicationLayerAutomaticResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisableApplicationLayerAutomaticResponse]
$creadListPrec :: ReadPrec [DisableApplicationLayerAutomaticResponse]
readPrec :: ReadPrec DisableApplicationLayerAutomaticResponse
$creadPrec :: ReadPrec DisableApplicationLayerAutomaticResponse
readList :: ReadS [DisableApplicationLayerAutomaticResponse]
$creadList :: ReadS [DisableApplicationLayerAutomaticResponse]
readsPrec :: Int -> ReadS DisableApplicationLayerAutomaticResponse
$creadsPrec :: Int -> ReadS DisableApplicationLayerAutomaticResponse
Prelude.Read, Int -> DisableApplicationLayerAutomaticResponse -> ShowS
[DisableApplicationLayerAutomaticResponse] -> ShowS
DisableApplicationLayerAutomaticResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisableApplicationLayerAutomaticResponse] -> ShowS
$cshowList :: [DisableApplicationLayerAutomaticResponse] -> ShowS
show :: DisableApplicationLayerAutomaticResponse -> String
$cshow :: DisableApplicationLayerAutomaticResponse -> String
showsPrec :: Int -> DisableApplicationLayerAutomaticResponse -> ShowS
$cshowsPrec :: Int -> DisableApplicationLayerAutomaticResponse -> ShowS
Prelude.Show, forall x.
Rep DisableApplicationLayerAutomaticResponse x
-> DisableApplicationLayerAutomaticResponse
forall x.
DisableApplicationLayerAutomaticResponse
-> Rep DisableApplicationLayerAutomaticResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisableApplicationLayerAutomaticResponse x
-> DisableApplicationLayerAutomaticResponse
$cfrom :: forall x.
DisableApplicationLayerAutomaticResponse
-> Rep DisableApplicationLayerAutomaticResponse x
Prelude.Generic)

-- |
-- Create a value of 'DisableApplicationLayerAutomaticResponse' 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:
--
-- 'resourceArn', 'disableApplicationLayerAutomaticResponse_resourceArn' - The ARN (Amazon Resource Name) of the protected resource.
newDisableApplicationLayerAutomaticResponse ::
  -- | 'resourceArn'
  Prelude.Text ->
  DisableApplicationLayerAutomaticResponse
newDisableApplicationLayerAutomaticResponse :: Text -> DisableApplicationLayerAutomaticResponse
newDisableApplicationLayerAutomaticResponse
  Text
pResourceArn_ =
    DisableApplicationLayerAutomaticResponse'
      { $sel:resourceArn:DisableApplicationLayerAutomaticResponse' :: Text
resourceArn =
          Text
pResourceArn_
      }

-- | The ARN (Amazon Resource Name) of the protected resource.
disableApplicationLayerAutomaticResponse_resourceArn :: Lens.Lens' DisableApplicationLayerAutomaticResponse Prelude.Text
disableApplicationLayerAutomaticResponse_resourceArn :: Lens' DisableApplicationLayerAutomaticResponse Text
disableApplicationLayerAutomaticResponse_resourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableApplicationLayerAutomaticResponse' {Text
resourceArn :: Text
$sel:resourceArn:DisableApplicationLayerAutomaticResponse' :: DisableApplicationLayerAutomaticResponse -> Text
resourceArn} -> Text
resourceArn) (\s :: DisableApplicationLayerAutomaticResponse
s@DisableApplicationLayerAutomaticResponse' {} Text
a -> DisableApplicationLayerAutomaticResponse
s {$sel:resourceArn:DisableApplicationLayerAutomaticResponse' :: Text
resourceArn = Text
a} :: DisableApplicationLayerAutomaticResponse)

instance
  Core.AWSRequest
    DisableApplicationLayerAutomaticResponse
  where
  type
    AWSResponse
      DisableApplicationLayerAutomaticResponse =
      DisableApplicationLayerAutomaticResponseResponse
  request :: (Service -> Service)
-> DisableApplicationLayerAutomaticResponse
-> Request DisableApplicationLayerAutomaticResponse
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 DisableApplicationLayerAutomaticResponse
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DisableApplicationLayerAutomaticResponse)))
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 -> DisableApplicationLayerAutomaticResponseResponse
DisableApplicationLayerAutomaticResponseResponse'
            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
    DisableApplicationLayerAutomaticResponse
  where
  hashWithSalt :: Int -> DisableApplicationLayerAutomaticResponse -> Int
hashWithSalt
    Int
_salt
    DisableApplicationLayerAutomaticResponse' {Text
resourceArn :: Text
$sel:resourceArn:DisableApplicationLayerAutomaticResponse' :: DisableApplicationLayerAutomaticResponse -> Text
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceArn

instance
  Prelude.NFData
    DisableApplicationLayerAutomaticResponse
  where
  rnf :: DisableApplicationLayerAutomaticResponse -> ()
rnf DisableApplicationLayerAutomaticResponse' {Text
resourceArn :: Text
$sel:resourceArn:DisableApplicationLayerAutomaticResponse' :: DisableApplicationLayerAutomaticResponse -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
resourceArn

instance
  Data.ToHeaders
    DisableApplicationLayerAutomaticResponse
  where
  toHeaders :: DisableApplicationLayerAutomaticResponse -> 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
"AWSShield_20160616.DisableApplicationLayerAutomaticResponse" ::
                          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
    DisableApplicationLayerAutomaticResponse
  where
  toJSON :: DisableApplicationLayerAutomaticResponse -> Value
toJSON DisableApplicationLayerAutomaticResponse' {Text
resourceArn :: Text
$sel:resourceArn:DisableApplicationLayerAutomaticResponse' :: DisableApplicationLayerAutomaticResponse -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"ResourceArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
resourceArn)]
      )

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

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

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

-- |
-- Create a value of 'DisableApplicationLayerAutomaticResponseResponse' 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', 'disableApplicationLayerAutomaticResponseResponse_httpStatus' - The response's http status code.
newDisableApplicationLayerAutomaticResponseResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DisableApplicationLayerAutomaticResponseResponse
newDisableApplicationLayerAutomaticResponseResponse :: Int -> DisableApplicationLayerAutomaticResponseResponse
newDisableApplicationLayerAutomaticResponseResponse
  Int
pHttpStatus_ =
    DisableApplicationLayerAutomaticResponseResponse'
      { $sel:httpStatus:DisableApplicationLayerAutomaticResponseResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

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

instance
  Prelude.NFData
    DisableApplicationLayerAutomaticResponseResponse
  where
  rnf :: DisableApplicationLayerAutomaticResponseResponse -> ()
rnf
    DisableApplicationLayerAutomaticResponseResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisableApplicationLayerAutomaticResponseResponse' :: DisableApplicationLayerAutomaticResponseResponse -> Int
..} =
      forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus