{-# 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 #-}
module Amazonka.Route53Resolver.GetFirewallConfig
(
GetFirewallConfig (..),
newGetFirewallConfig,
getFirewallConfig_resourceId,
GetFirewallConfigResponse (..),
newGetFirewallConfigResponse,
getFirewallConfigResponse_firewallConfig,
getFirewallConfigResponse_httpStatus,
)
where
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
import Amazonka.Route53Resolver.Types
data GetFirewallConfig = GetFirewallConfig'
{
GetFirewallConfig -> Text
resourceId :: Prelude.Text
}
deriving (GetFirewallConfig -> GetFirewallConfig -> Bool
(GetFirewallConfig -> GetFirewallConfig -> Bool)
-> (GetFirewallConfig -> GetFirewallConfig -> Bool)
-> Eq GetFirewallConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFirewallConfig -> GetFirewallConfig -> Bool
$c/= :: GetFirewallConfig -> GetFirewallConfig -> Bool
== :: GetFirewallConfig -> GetFirewallConfig -> Bool
$c== :: GetFirewallConfig -> GetFirewallConfig -> Bool
Prelude.Eq, ReadPrec [GetFirewallConfig]
ReadPrec GetFirewallConfig
Int -> ReadS GetFirewallConfig
ReadS [GetFirewallConfig]
(Int -> ReadS GetFirewallConfig)
-> ReadS [GetFirewallConfig]
-> ReadPrec GetFirewallConfig
-> ReadPrec [GetFirewallConfig]
-> Read GetFirewallConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFirewallConfig]
$creadListPrec :: ReadPrec [GetFirewallConfig]
readPrec :: ReadPrec GetFirewallConfig
$creadPrec :: ReadPrec GetFirewallConfig
readList :: ReadS [GetFirewallConfig]
$creadList :: ReadS [GetFirewallConfig]
readsPrec :: Int -> ReadS GetFirewallConfig
$creadsPrec :: Int -> ReadS GetFirewallConfig
Prelude.Read, Int -> GetFirewallConfig -> ShowS
[GetFirewallConfig] -> ShowS
GetFirewallConfig -> String
(Int -> GetFirewallConfig -> ShowS)
-> (GetFirewallConfig -> String)
-> ([GetFirewallConfig] -> ShowS)
-> Show GetFirewallConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFirewallConfig] -> ShowS
$cshowList :: [GetFirewallConfig] -> ShowS
show :: GetFirewallConfig -> String
$cshow :: GetFirewallConfig -> String
showsPrec :: Int -> GetFirewallConfig -> ShowS
$cshowsPrec :: Int -> GetFirewallConfig -> ShowS
Prelude.Show, (forall x. GetFirewallConfig -> Rep GetFirewallConfig x)
-> (forall x. Rep GetFirewallConfig x -> GetFirewallConfig)
-> Generic GetFirewallConfig
forall x. Rep GetFirewallConfig x -> GetFirewallConfig
forall x. GetFirewallConfig -> Rep GetFirewallConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetFirewallConfig x -> GetFirewallConfig
$cfrom :: forall x. GetFirewallConfig -> Rep GetFirewallConfig x
Prelude.Generic)
newGetFirewallConfig ::
Prelude.Text ->
GetFirewallConfig
newGetFirewallConfig :: Text -> GetFirewallConfig
newGetFirewallConfig Text
pResourceId_ =
GetFirewallConfig' :: Text -> GetFirewallConfig
GetFirewallConfig' {$sel:resourceId:GetFirewallConfig' :: Text
resourceId = Text
pResourceId_}
getFirewallConfig_resourceId :: Lens.Lens' GetFirewallConfig Prelude.Text
getFirewallConfig_resourceId :: (Text -> f Text) -> GetFirewallConfig -> f GetFirewallConfig
getFirewallConfig_resourceId = (GetFirewallConfig -> Text)
-> (GetFirewallConfig -> Text -> GetFirewallConfig)
-> Lens GetFirewallConfig GetFirewallConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFirewallConfig' {Text
resourceId :: Text
$sel:resourceId:GetFirewallConfig' :: GetFirewallConfig -> Text
resourceId} -> Text
resourceId) (\s :: GetFirewallConfig
s@GetFirewallConfig' {} Text
a -> GetFirewallConfig
s {$sel:resourceId:GetFirewallConfig' :: Text
resourceId = Text
a} :: GetFirewallConfig)
instance Core.AWSRequest GetFirewallConfig where
type
AWSResponse GetFirewallConfig =
GetFirewallConfigResponse
request :: GetFirewallConfig -> Request GetFirewallConfig
request = Service -> GetFirewallConfig -> Request GetFirewallConfig
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetFirewallConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetFirewallConfig)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetFirewallConfig))
-> Logger
-> Service
-> Proxy GetFirewallConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetFirewallConfig)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe FirewallConfig -> Int -> GetFirewallConfigResponse
GetFirewallConfigResponse'
(Maybe FirewallConfig -> Int -> GetFirewallConfigResponse)
-> Either String (Maybe FirewallConfig)
-> Either String (Int -> GetFirewallConfigResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe FirewallConfig)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FirewallConfig")
Either String (Int -> GetFirewallConfigResponse)
-> Either String Int -> Either String GetFirewallConfigResponse
forall (f :: * -> *) a b. Applicative f => 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 GetFirewallConfig
instance Prelude.NFData GetFirewallConfig
instance Core.ToHeaders GetFirewallConfig where
toHeaders :: GetFirewallConfig -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetFirewallConfig -> 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
"Route53Resolver.GetFirewallConfig" ::
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 GetFirewallConfig where
toJSON :: GetFirewallConfig -> Value
toJSON GetFirewallConfig' {Text
resourceId :: Text
$sel:resourceId:GetFirewallConfig' :: GetFirewallConfig -> 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
"ResourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceId)]
)
instance Core.ToPath GetFirewallConfig where
toPath :: GetFirewallConfig -> ByteString
toPath = ByteString -> GetFirewallConfig -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetFirewallConfig where
toQuery :: GetFirewallConfig -> QueryString
toQuery = QueryString -> GetFirewallConfig -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetFirewallConfigResponse = GetFirewallConfigResponse'
{
GetFirewallConfigResponse -> Maybe FirewallConfig
firewallConfig :: Prelude.Maybe FirewallConfig,
GetFirewallConfigResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetFirewallConfigResponse -> GetFirewallConfigResponse -> Bool
(GetFirewallConfigResponse -> GetFirewallConfigResponse -> Bool)
-> (GetFirewallConfigResponse -> GetFirewallConfigResponse -> Bool)
-> Eq GetFirewallConfigResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFirewallConfigResponse -> GetFirewallConfigResponse -> Bool
$c/= :: GetFirewallConfigResponse -> GetFirewallConfigResponse -> Bool
== :: GetFirewallConfigResponse -> GetFirewallConfigResponse -> Bool
$c== :: GetFirewallConfigResponse -> GetFirewallConfigResponse -> Bool
Prelude.Eq, ReadPrec [GetFirewallConfigResponse]
ReadPrec GetFirewallConfigResponse
Int -> ReadS GetFirewallConfigResponse
ReadS [GetFirewallConfigResponse]
(Int -> ReadS GetFirewallConfigResponse)
-> ReadS [GetFirewallConfigResponse]
-> ReadPrec GetFirewallConfigResponse
-> ReadPrec [GetFirewallConfigResponse]
-> Read GetFirewallConfigResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFirewallConfigResponse]
$creadListPrec :: ReadPrec [GetFirewallConfigResponse]
readPrec :: ReadPrec GetFirewallConfigResponse
$creadPrec :: ReadPrec GetFirewallConfigResponse
readList :: ReadS [GetFirewallConfigResponse]
$creadList :: ReadS [GetFirewallConfigResponse]
readsPrec :: Int -> ReadS GetFirewallConfigResponse
$creadsPrec :: Int -> ReadS GetFirewallConfigResponse
Prelude.Read, Int -> GetFirewallConfigResponse -> ShowS
[GetFirewallConfigResponse] -> ShowS
GetFirewallConfigResponse -> String
(Int -> GetFirewallConfigResponse -> ShowS)
-> (GetFirewallConfigResponse -> String)
-> ([GetFirewallConfigResponse] -> ShowS)
-> Show GetFirewallConfigResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFirewallConfigResponse] -> ShowS
$cshowList :: [GetFirewallConfigResponse] -> ShowS
show :: GetFirewallConfigResponse -> String
$cshow :: GetFirewallConfigResponse -> String
showsPrec :: Int -> GetFirewallConfigResponse -> ShowS
$cshowsPrec :: Int -> GetFirewallConfigResponse -> ShowS
Prelude.Show, (forall x.
GetFirewallConfigResponse -> Rep GetFirewallConfigResponse x)
-> (forall x.
Rep GetFirewallConfigResponse x -> GetFirewallConfigResponse)
-> Generic GetFirewallConfigResponse
forall x.
Rep GetFirewallConfigResponse x -> GetFirewallConfigResponse
forall x.
GetFirewallConfigResponse -> Rep GetFirewallConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetFirewallConfigResponse x -> GetFirewallConfigResponse
$cfrom :: forall x.
GetFirewallConfigResponse -> Rep GetFirewallConfigResponse x
Prelude.Generic)
newGetFirewallConfigResponse ::
Prelude.Int ->
GetFirewallConfigResponse
newGetFirewallConfigResponse :: Int -> GetFirewallConfigResponse
newGetFirewallConfigResponse Int
pHttpStatus_ =
GetFirewallConfigResponse' :: Maybe FirewallConfig -> Int -> GetFirewallConfigResponse
GetFirewallConfigResponse'
{ $sel:firewallConfig:GetFirewallConfigResponse' :: Maybe FirewallConfig
firewallConfig =
Maybe FirewallConfig
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetFirewallConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getFirewallConfigResponse_firewallConfig :: Lens.Lens' GetFirewallConfigResponse (Prelude.Maybe FirewallConfig)
getFirewallConfigResponse_firewallConfig :: (Maybe FirewallConfig -> f (Maybe FirewallConfig))
-> GetFirewallConfigResponse -> f GetFirewallConfigResponse
getFirewallConfigResponse_firewallConfig = (GetFirewallConfigResponse -> Maybe FirewallConfig)
-> (GetFirewallConfigResponse
-> Maybe FirewallConfig -> GetFirewallConfigResponse)
-> Lens
GetFirewallConfigResponse
GetFirewallConfigResponse
(Maybe FirewallConfig)
(Maybe FirewallConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFirewallConfigResponse' {Maybe FirewallConfig
firewallConfig :: Maybe FirewallConfig
$sel:firewallConfig:GetFirewallConfigResponse' :: GetFirewallConfigResponse -> Maybe FirewallConfig
firewallConfig} -> Maybe FirewallConfig
firewallConfig) (\s :: GetFirewallConfigResponse
s@GetFirewallConfigResponse' {} Maybe FirewallConfig
a -> GetFirewallConfigResponse
s {$sel:firewallConfig:GetFirewallConfigResponse' :: Maybe FirewallConfig
firewallConfig = Maybe FirewallConfig
a} :: GetFirewallConfigResponse)
getFirewallConfigResponse_httpStatus :: Lens.Lens' GetFirewallConfigResponse Prelude.Int
getFirewallConfigResponse_httpStatus :: (Int -> f Int)
-> GetFirewallConfigResponse -> f GetFirewallConfigResponse
getFirewallConfigResponse_httpStatus = (GetFirewallConfigResponse -> Int)
-> (GetFirewallConfigResponse -> Int -> GetFirewallConfigResponse)
-> Lens GetFirewallConfigResponse GetFirewallConfigResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFirewallConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetFirewallConfigResponse' :: GetFirewallConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetFirewallConfigResponse
s@GetFirewallConfigResponse' {} Int
a -> GetFirewallConfigResponse
s {$sel:httpStatus:GetFirewallConfigResponse' :: Int
httpStatus = Int
a} :: GetFirewallConfigResponse)
instance Prelude.NFData GetFirewallConfigResponse