{-# 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.NetworkFirewall.DescribeFirewall
(
DescribeFirewall (..),
newDescribeFirewall,
describeFirewall_firewallArn,
describeFirewall_firewallName,
DescribeFirewallResponse (..),
newDescribeFirewallResponse,
describeFirewallResponse_firewallStatus,
describeFirewallResponse_updateToken,
describeFirewallResponse_firewall,
describeFirewallResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.NetworkFirewall.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeFirewall = DescribeFirewall'
{
DescribeFirewall -> Maybe Text
firewallArn :: Prelude.Maybe Prelude.Text,
DescribeFirewall -> Maybe Text
firewallName :: Prelude.Maybe Prelude.Text
}
deriving (DescribeFirewall -> DescribeFirewall -> Bool
(DescribeFirewall -> DescribeFirewall -> Bool)
-> (DescribeFirewall -> DescribeFirewall -> Bool)
-> Eq DescribeFirewall
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFirewall -> DescribeFirewall -> Bool
$c/= :: DescribeFirewall -> DescribeFirewall -> Bool
== :: DescribeFirewall -> DescribeFirewall -> Bool
$c== :: DescribeFirewall -> DescribeFirewall -> Bool
Prelude.Eq, ReadPrec [DescribeFirewall]
ReadPrec DescribeFirewall
Int -> ReadS DescribeFirewall
ReadS [DescribeFirewall]
(Int -> ReadS DescribeFirewall)
-> ReadS [DescribeFirewall]
-> ReadPrec DescribeFirewall
-> ReadPrec [DescribeFirewall]
-> Read DescribeFirewall
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFirewall]
$creadListPrec :: ReadPrec [DescribeFirewall]
readPrec :: ReadPrec DescribeFirewall
$creadPrec :: ReadPrec DescribeFirewall
readList :: ReadS [DescribeFirewall]
$creadList :: ReadS [DescribeFirewall]
readsPrec :: Int -> ReadS DescribeFirewall
$creadsPrec :: Int -> ReadS DescribeFirewall
Prelude.Read, Int -> DescribeFirewall -> ShowS
[DescribeFirewall] -> ShowS
DescribeFirewall -> String
(Int -> DescribeFirewall -> ShowS)
-> (DescribeFirewall -> String)
-> ([DescribeFirewall] -> ShowS)
-> Show DescribeFirewall
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFirewall] -> ShowS
$cshowList :: [DescribeFirewall] -> ShowS
show :: DescribeFirewall -> String
$cshow :: DescribeFirewall -> String
showsPrec :: Int -> DescribeFirewall -> ShowS
$cshowsPrec :: Int -> DescribeFirewall -> ShowS
Prelude.Show, (forall x. DescribeFirewall -> Rep DescribeFirewall x)
-> (forall x. Rep DescribeFirewall x -> DescribeFirewall)
-> Generic DescribeFirewall
forall x. Rep DescribeFirewall x -> DescribeFirewall
forall x. DescribeFirewall -> Rep DescribeFirewall x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeFirewall x -> DescribeFirewall
$cfrom :: forall x. DescribeFirewall -> Rep DescribeFirewall x
Prelude.Generic)
newDescribeFirewall ::
DescribeFirewall
newDescribeFirewall :: DescribeFirewall
newDescribeFirewall =
DescribeFirewall' :: Maybe Text -> Maybe Text -> DescribeFirewall
DescribeFirewall'
{ $sel:firewallArn:DescribeFirewall' :: Maybe Text
firewallArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:firewallName:DescribeFirewall' :: Maybe Text
firewallName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
describeFirewall_firewallArn :: Lens.Lens' DescribeFirewall (Prelude.Maybe Prelude.Text)
describeFirewall_firewallArn :: (Maybe Text -> f (Maybe Text))
-> DescribeFirewall -> f DescribeFirewall
describeFirewall_firewallArn = (DescribeFirewall -> Maybe Text)
-> (DescribeFirewall -> Maybe Text -> DescribeFirewall)
-> Lens DescribeFirewall DescribeFirewall (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFirewall' {Maybe Text
firewallArn :: Maybe Text
$sel:firewallArn:DescribeFirewall' :: DescribeFirewall -> Maybe Text
firewallArn} -> Maybe Text
firewallArn) (\s :: DescribeFirewall
s@DescribeFirewall' {} Maybe Text
a -> DescribeFirewall
s {$sel:firewallArn:DescribeFirewall' :: Maybe Text
firewallArn = Maybe Text
a} :: DescribeFirewall)
describeFirewall_firewallName :: Lens.Lens' DescribeFirewall (Prelude.Maybe Prelude.Text)
describeFirewall_firewallName :: (Maybe Text -> f (Maybe Text))
-> DescribeFirewall -> f DescribeFirewall
describeFirewall_firewallName = (DescribeFirewall -> Maybe Text)
-> (DescribeFirewall -> Maybe Text -> DescribeFirewall)
-> Lens DescribeFirewall DescribeFirewall (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFirewall' {Maybe Text
firewallName :: Maybe Text
$sel:firewallName:DescribeFirewall' :: DescribeFirewall -> Maybe Text
firewallName} -> Maybe Text
firewallName) (\s :: DescribeFirewall
s@DescribeFirewall' {} Maybe Text
a -> DescribeFirewall
s {$sel:firewallName:DescribeFirewall' :: Maybe Text
firewallName = Maybe Text
a} :: DescribeFirewall)
instance Core.AWSRequest DescribeFirewall where
type
AWSResponse DescribeFirewall =
DescribeFirewallResponse
request :: DescribeFirewall -> Request DescribeFirewall
request = Service -> DescribeFirewall -> Request DescribeFirewall
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeFirewall
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeFirewall)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeFirewall))
-> Logger
-> Service
-> Proxy DescribeFirewall
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeFirewall)))
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 FirewallStatus
-> Maybe Text -> Maybe Firewall -> Int -> DescribeFirewallResponse
DescribeFirewallResponse'
(Maybe FirewallStatus
-> Maybe Text -> Maybe Firewall -> Int -> DescribeFirewallResponse)
-> Either String (Maybe FirewallStatus)
-> Either
String
(Maybe Text -> Maybe Firewall -> Int -> DescribeFirewallResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe FirewallStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FirewallStatus")
Either
String
(Maybe Text -> Maybe Firewall -> Int -> DescribeFirewallResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Firewall -> Int -> DescribeFirewallResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"UpdateToken")
Either String (Maybe Firewall -> Int -> DescribeFirewallResponse)
-> Either String (Maybe Firewall)
-> Either String (Int -> DescribeFirewallResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Firewall)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Firewall")
Either String (Int -> DescribeFirewallResponse)
-> Either String Int -> Either String DescribeFirewallResponse
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 DescribeFirewall
instance Prelude.NFData DescribeFirewall
instance Core.ToHeaders DescribeFirewall where
toHeaders :: DescribeFirewall -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeFirewall -> 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
"NetworkFirewall_20201112.DescribeFirewall" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON DescribeFirewall where
toJSON :: DescribeFirewall -> Value
toJSON DescribeFirewall' {Maybe Text
firewallName :: Maybe Text
firewallArn :: Maybe Text
$sel:firewallName:DescribeFirewall' :: DescribeFirewall -> Maybe Text
$sel:firewallArn:DescribeFirewall' :: DescribeFirewall -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"FirewallArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
firewallArn,
(Text
"FirewallName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
firewallName
]
)
instance Core.ToPath DescribeFirewall where
toPath :: DescribeFirewall -> ByteString
toPath = ByteString -> DescribeFirewall -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeFirewall where
toQuery :: DescribeFirewall -> QueryString
toQuery = QueryString -> DescribeFirewall -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeFirewallResponse = DescribeFirewallResponse'
{
DescribeFirewallResponse -> Maybe FirewallStatus
firewallStatus :: Prelude.Maybe FirewallStatus,
DescribeFirewallResponse -> Maybe Text
updateToken :: Prelude.Maybe Prelude.Text,
DescribeFirewallResponse -> Maybe Firewall
firewall :: Prelude.Maybe Firewall,
DescribeFirewallResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeFirewallResponse -> DescribeFirewallResponse -> Bool
(DescribeFirewallResponse -> DescribeFirewallResponse -> Bool)
-> (DescribeFirewallResponse -> DescribeFirewallResponse -> Bool)
-> Eq DescribeFirewallResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFirewallResponse -> DescribeFirewallResponse -> Bool
$c/= :: DescribeFirewallResponse -> DescribeFirewallResponse -> Bool
== :: DescribeFirewallResponse -> DescribeFirewallResponse -> Bool
$c== :: DescribeFirewallResponse -> DescribeFirewallResponse -> Bool
Prelude.Eq, ReadPrec [DescribeFirewallResponse]
ReadPrec DescribeFirewallResponse
Int -> ReadS DescribeFirewallResponse
ReadS [DescribeFirewallResponse]
(Int -> ReadS DescribeFirewallResponse)
-> ReadS [DescribeFirewallResponse]
-> ReadPrec DescribeFirewallResponse
-> ReadPrec [DescribeFirewallResponse]
-> Read DescribeFirewallResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFirewallResponse]
$creadListPrec :: ReadPrec [DescribeFirewallResponse]
readPrec :: ReadPrec DescribeFirewallResponse
$creadPrec :: ReadPrec DescribeFirewallResponse
readList :: ReadS [DescribeFirewallResponse]
$creadList :: ReadS [DescribeFirewallResponse]
readsPrec :: Int -> ReadS DescribeFirewallResponse
$creadsPrec :: Int -> ReadS DescribeFirewallResponse
Prelude.Read, Int -> DescribeFirewallResponse -> ShowS
[DescribeFirewallResponse] -> ShowS
DescribeFirewallResponse -> String
(Int -> DescribeFirewallResponse -> ShowS)
-> (DescribeFirewallResponse -> String)
-> ([DescribeFirewallResponse] -> ShowS)
-> Show DescribeFirewallResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFirewallResponse] -> ShowS
$cshowList :: [DescribeFirewallResponse] -> ShowS
show :: DescribeFirewallResponse -> String
$cshow :: DescribeFirewallResponse -> String
showsPrec :: Int -> DescribeFirewallResponse -> ShowS
$cshowsPrec :: Int -> DescribeFirewallResponse -> ShowS
Prelude.Show, (forall x.
DescribeFirewallResponse -> Rep DescribeFirewallResponse x)
-> (forall x.
Rep DescribeFirewallResponse x -> DescribeFirewallResponse)
-> Generic DescribeFirewallResponse
forall x.
Rep DescribeFirewallResponse x -> DescribeFirewallResponse
forall x.
DescribeFirewallResponse -> Rep DescribeFirewallResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeFirewallResponse x -> DescribeFirewallResponse
$cfrom :: forall x.
DescribeFirewallResponse -> Rep DescribeFirewallResponse x
Prelude.Generic)
newDescribeFirewallResponse ::
Prelude.Int ->
DescribeFirewallResponse
newDescribeFirewallResponse :: Int -> DescribeFirewallResponse
newDescribeFirewallResponse Int
pHttpStatus_ =
DescribeFirewallResponse' :: Maybe FirewallStatus
-> Maybe Text -> Maybe Firewall -> Int -> DescribeFirewallResponse
DescribeFirewallResponse'
{ $sel:firewallStatus:DescribeFirewallResponse' :: Maybe FirewallStatus
firewallStatus =
Maybe FirewallStatus
forall a. Maybe a
Prelude.Nothing,
$sel:updateToken:DescribeFirewallResponse' :: Maybe Text
updateToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:firewall:DescribeFirewallResponse' :: Maybe Firewall
firewall = Maybe Firewall
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeFirewallResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeFirewallResponse_firewallStatus :: Lens.Lens' DescribeFirewallResponse (Prelude.Maybe FirewallStatus)
describeFirewallResponse_firewallStatus :: (Maybe FirewallStatus -> f (Maybe FirewallStatus))
-> DescribeFirewallResponse -> f DescribeFirewallResponse
describeFirewallResponse_firewallStatus = (DescribeFirewallResponse -> Maybe FirewallStatus)
-> (DescribeFirewallResponse
-> Maybe FirewallStatus -> DescribeFirewallResponse)
-> Lens
DescribeFirewallResponse
DescribeFirewallResponse
(Maybe FirewallStatus)
(Maybe FirewallStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFirewallResponse' {Maybe FirewallStatus
firewallStatus :: Maybe FirewallStatus
$sel:firewallStatus:DescribeFirewallResponse' :: DescribeFirewallResponse -> Maybe FirewallStatus
firewallStatus} -> Maybe FirewallStatus
firewallStatus) (\s :: DescribeFirewallResponse
s@DescribeFirewallResponse' {} Maybe FirewallStatus
a -> DescribeFirewallResponse
s {$sel:firewallStatus:DescribeFirewallResponse' :: Maybe FirewallStatus
firewallStatus = Maybe FirewallStatus
a} :: DescribeFirewallResponse)
describeFirewallResponse_updateToken :: Lens.Lens' DescribeFirewallResponse (Prelude.Maybe Prelude.Text)
describeFirewallResponse_updateToken :: (Maybe Text -> f (Maybe Text))
-> DescribeFirewallResponse -> f DescribeFirewallResponse
describeFirewallResponse_updateToken = (DescribeFirewallResponse -> Maybe Text)
-> (DescribeFirewallResponse
-> Maybe Text -> DescribeFirewallResponse)
-> Lens
DescribeFirewallResponse
DescribeFirewallResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFirewallResponse' {Maybe Text
updateToken :: Maybe Text
$sel:updateToken:DescribeFirewallResponse' :: DescribeFirewallResponse -> Maybe Text
updateToken} -> Maybe Text
updateToken) (\s :: DescribeFirewallResponse
s@DescribeFirewallResponse' {} Maybe Text
a -> DescribeFirewallResponse
s {$sel:updateToken:DescribeFirewallResponse' :: Maybe Text
updateToken = Maybe Text
a} :: DescribeFirewallResponse)
describeFirewallResponse_firewall :: Lens.Lens' DescribeFirewallResponse (Prelude.Maybe Firewall)
describeFirewallResponse_firewall :: (Maybe Firewall -> f (Maybe Firewall))
-> DescribeFirewallResponse -> f DescribeFirewallResponse
describeFirewallResponse_firewall = (DescribeFirewallResponse -> Maybe Firewall)
-> (DescribeFirewallResponse
-> Maybe Firewall -> DescribeFirewallResponse)
-> Lens
DescribeFirewallResponse
DescribeFirewallResponse
(Maybe Firewall)
(Maybe Firewall)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFirewallResponse' {Maybe Firewall
firewall :: Maybe Firewall
$sel:firewall:DescribeFirewallResponse' :: DescribeFirewallResponse -> Maybe Firewall
firewall} -> Maybe Firewall
firewall) (\s :: DescribeFirewallResponse
s@DescribeFirewallResponse' {} Maybe Firewall
a -> DescribeFirewallResponse
s {$sel:firewall:DescribeFirewallResponse' :: Maybe Firewall
firewall = Maybe Firewall
a} :: DescribeFirewallResponse)
describeFirewallResponse_httpStatus :: Lens.Lens' DescribeFirewallResponse Prelude.Int
describeFirewallResponse_httpStatus :: (Int -> f Int)
-> DescribeFirewallResponse -> f DescribeFirewallResponse
describeFirewallResponse_httpStatus = (DescribeFirewallResponse -> Int)
-> (DescribeFirewallResponse -> Int -> DescribeFirewallResponse)
-> Lens DescribeFirewallResponse DescribeFirewallResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFirewallResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeFirewallResponse' :: DescribeFirewallResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeFirewallResponse
s@DescribeFirewallResponse' {} Int
a -> DescribeFirewallResponse
s {$sel:httpStatus:DescribeFirewallResponse' :: Int
httpStatus = Int
a} :: DescribeFirewallResponse)
instance Prelude.NFData DescribeFirewallResponse