{-# 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.DescribeResourcePolicy
(
DescribeResourcePolicy (..),
newDescribeResourcePolicy,
describeResourcePolicy_resourceArn,
DescribeResourcePolicyResponse (..),
newDescribeResourcePolicyResponse,
describeResourcePolicyResponse_policy,
describeResourcePolicyResponse_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 DescribeResourcePolicy = DescribeResourcePolicy'
{
DescribeResourcePolicy -> Text
resourceArn :: Prelude.Text
}
deriving (DescribeResourcePolicy -> DescribeResourcePolicy -> Bool
(DescribeResourcePolicy -> DescribeResourcePolicy -> Bool)
-> (DescribeResourcePolicy -> DescribeResourcePolicy -> Bool)
-> Eq DescribeResourcePolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeResourcePolicy -> DescribeResourcePolicy -> Bool
$c/= :: DescribeResourcePolicy -> DescribeResourcePolicy -> Bool
== :: DescribeResourcePolicy -> DescribeResourcePolicy -> Bool
$c== :: DescribeResourcePolicy -> DescribeResourcePolicy -> Bool
Prelude.Eq, ReadPrec [DescribeResourcePolicy]
ReadPrec DescribeResourcePolicy
Int -> ReadS DescribeResourcePolicy
ReadS [DescribeResourcePolicy]
(Int -> ReadS DescribeResourcePolicy)
-> ReadS [DescribeResourcePolicy]
-> ReadPrec DescribeResourcePolicy
-> ReadPrec [DescribeResourcePolicy]
-> Read DescribeResourcePolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeResourcePolicy]
$creadListPrec :: ReadPrec [DescribeResourcePolicy]
readPrec :: ReadPrec DescribeResourcePolicy
$creadPrec :: ReadPrec DescribeResourcePolicy
readList :: ReadS [DescribeResourcePolicy]
$creadList :: ReadS [DescribeResourcePolicy]
readsPrec :: Int -> ReadS DescribeResourcePolicy
$creadsPrec :: Int -> ReadS DescribeResourcePolicy
Prelude.Read, Int -> DescribeResourcePolicy -> ShowS
[DescribeResourcePolicy] -> ShowS
DescribeResourcePolicy -> String
(Int -> DescribeResourcePolicy -> ShowS)
-> (DescribeResourcePolicy -> String)
-> ([DescribeResourcePolicy] -> ShowS)
-> Show DescribeResourcePolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeResourcePolicy] -> ShowS
$cshowList :: [DescribeResourcePolicy] -> ShowS
show :: DescribeResourcePolicy -> String
$cshow :: DescribeResourcePolicy -> String
showsPrec :: Int -> DescribeResourcePolicy -> ShowS
$cshowsPrec :: Int -> DescribeResourcePolicy -> ShowS
Prelude.Show, (forall x. DescribeResourcePolicy -> Rep DescribeResourcePolicy x)
-> (forall x.
Rep DescribeResourcePolicy x -> DescribeResourcePolicy)
-> Generic DescribeResourcePolicy
forall x. Rep DescribeResourcePolicy x -> DescribeResourcePolicy
forall x. DescribeResourcePolicy -> Rep DescribeResourcePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeResourcePolicy x -> DescribeResourcePolicy
$cfrom :: forall x. DescribeResourcePolicy -> Rep DescribeResourcePolicy x
Prelude.Generic)
newDescribeResourcePolicy ::
Prelude.Text ->
DescribeResourcePolicy
newDescribeResourcePolicy :: Text -> DescribeResourcePolicy
newDescribeResourcePolicy Text
pResourceArn_ =
DescribeResourcePolicy' :: Text -> DescribeResourcePolicy
DescribeResourcePolicy'
{ $sel:resourceArn:DescribeResourcePolicy' :: Text
resourceArn =
Text
pResourceArn_
}
describeResourcePolicy_resourceArn :: Lens.Lens' DescribeResourcePolicy Prelude.Text
describeResourcePolicy_resourceArn :: (Text -> f Text)
-> DescribeResourcePolicy -> f DescribeResourcePolicy
describeResourcePolicy_resourceArn = (DescribeResourcePolicy -> Text)
-> (DescribeResourcePolicy -> Text -> DescribeResourcePolicy)
-> Lens DescribeResourcePolicy DescribeResourcePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourcePolicy' {Text
resourceArn :: Text
$sel:resourceArn:DescribeResourcePolicy' :: DescribeResourcePolicy -> Text
resourceArn} -> Text
resourceArn) (\s :: DescribeResourcePolicy
s@DescribeResourcePolicy' {} Text
a -> DescribeResourcePolicy
s {$sel:resourceArn:DescribeResourcePolicy' :: Text
resourceArn = Text
a} :: DescribeResourcePolicy)
instance Core.AWSRequest DescribeResourcePolicy where
type
AWSResponse DescribeResourcePolicy =
DescribeResourcePolicyResponse
request :: DescribeResourcePolicy -> Request DescribeResourcePolicy
request = Service -> DescribeResourcePolicy -> Request DescribeResourcePolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeResourcePolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeResourcePolicy)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeResourcePolicy))
-> Logger
-> Service
-> Proxy DescribeResourcePolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeResourcePolicy)))
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 Text -> Int -> DescribeResourcePolicyResponse
DescribeResourcePolicyResponse'
(Maybe Text -> Int -> DescribeResourcePolicyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeResourcePolicyResponse)
forall (f :: * -> *) a b. Functor 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
"Policy")
Either String (Int -> DescribeResourcePolicyResponse)
-> Either String Int
-> Either String DescribeResourcePolicyResponse
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 DescribeResourcePolicy
instance Prelude.NFData DescribeResourcePolicy
instance Core.ToHeaders DescribeResourcePolicy where
toHeaders :: DescribeResourcePolicy -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeResourcePolicy -> 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.DescribeResourcePolicy" ::
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 DescribeResourcePolicy where
toJSON :: DescribeResourcePolicy -> Value
toJSON DescribeResourcePolicy' {Text
resourceArn :: Text
$sel:resourceArn:DescribeResourcePolicy' :: DescribeResourcePolicy -> 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
"ResourceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceArn)]
)
instance Core.ToPath DescribeResourcePolicy where
toPath :: DescribeResourcePolicy -> ByteString
toPath = ByteString -> DescribeResourcePolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeResourcePolicy where
toQuery :: DescribeResourcePolicy -> QueryString
toQuery = QueryString -> DescribeResourcePolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeResourcePolicyResponse = DescribeResourcePolicyResponse'
{
DescribeResourcePolicyResponse -> Maybe Text
policy :: Prelude.Maybe Prelude.Text,
DescribeResourcePolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeResourcePolicyResponse
-> DescribeResourcePolicyResponse -> Bool
(DescribeResourcePolicyResponse
-> DescribeResourcePolicyResponse -> Bool)
-> (DescribeResourcePolicyResponse
-> DescribeResourcePolicyResponse -> Bool)
-> Eq DescribeResourcePolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeResourcePolicyResponse
-> DescribeResourcePolicyResponse -> Bool
$c/= :: DescribeResourcePolicyResponse
-> DescribeResourcePolicyResponse -> Bool
== :: DescribeResourcePolicyResponse
-> DescribeResourcePolicyResponse -> Bool
$c== :: DescribeResourcePolicyResponse
-> DescribeResourcePolicyResponse -> Bool
Prelude.Eq, ReadPrec [DescribeResourcePolicyResponse]
ReadPrec DescribeResourcePolicyResponse
Int -> ReadS DescribeResourcePolicyResponse
ReadS [DescribeResourcePolicyResponse]
(Int -> ReadS DescribeResourcePolicyResponse)
-> ReadS [DescribeResourcePolicyResponse]
-> ReadPrec DescribeResourcePolicyResponse
-> ReadPrec [DescribeResourcePolicyResponse]
-> Read DescribeResourcePolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeResourcePolicyResponse]
$creadListPrec :: ReadPrec [DescribeResourcePolicyResponse]
readPrec :: ReadPrec DescribeResourcePolicyResponse
$creadPrec :: ReadPrec DescribeResourcePolicyResponse
readList :: ReadS [DescribeResourcePolicyResponse]
$creadList :: ReadS [DescribeResourcePolicyResponse]
readsPrec :: Int -> ReadS DescribeResourcePolicyResponse
$creadsPrec :: Int -> ReadS DescribeResourcePolicyResponse
Prelude.Read, Int -> DescribeResourcePolicyResponse -> ShowS
[DescribeResourcePolicyResponse] -> ShowS
DescribeResourcePolicyResponse -> String
(Int -> DescribeResourcePolicyResponse -> ShowS)
-> (DescribeResourcePolicyResponse -> String)
-> ([DescribeResourcePolicyResponse] -> ShowS)
-> Show DescribeResourcePolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeResourcePolicyResponse] -> ShowS
$cshowList :: [DescribeResourcePolicyResponse] -> ShowS
show :: DescribeResourcePolicyResponse -> String
$cshow :: DescribeResourcePolicyResponse -> String
showsPrec :: Int -> DescribeResourcePolicyResponse -> ShowS
$cshowsPrec :: Int -> DescribeResourcePolicyResponse -> ShowS
Prelude.Show, (forall x.
DescribeResourcePolicyResponse
-> Rep DescribeResourcePolicyResponse x)
-> (forall x.
Rep DescribeResourcePolicyResponse x
-> DescribeResourcePolicyResponse)
-> Generic DescribeResourcePolicyResponse
forall x.
Rep DescribeResourcePolicyResponse x
-> DescribeResourcePolicyResponse
forall x.
DescribeResourcePolicyResponse
-> Rep DescribeResourcePolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeResourcePolicyResponse x
-> DescribeResourcePolicyResponse
$cfrom :: forall x.
DescribeResourcePolicyResponse
-> Rep DescribeResourcePolicyResponse x
Prelude.Generic)
newDescribeResourcePolicyResponse ::
Prelude.Int ->
DescribeResourcePolicyResponse
newDescribeResourcePolicyResponse :: Int -> DescribeResourcePolicyResponse
newDescribeResourcePolicyResponse Int
pHttpStatus_ =
DescribeResourcePolicyResponse' :: Maybe Text -> Int -> DescribeResourcePolicyResponse
DescribeResourcePolicyResponse'
{ $sel:policy:DescribeResourcePolicyResponse' :: Maybe Text
policy =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeResourcePolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeResourcePolicyResponse_policy :: Lens.Lens' DescribeResourcePolicyResponse (Prelude.Maybe Prelude.Text)
describeResourcePolicyResponse_policy :: (Maybe Text -> f (Maybe Text))
-> DescribeResourcePolicyResponse
-> f DescribeResourcePolicyResponse
describeResourcePolicyResponse_policy = (DescribeResourcePolicyResponse -> Maybe Text)
-> (DescribeResourcePolicyResponse
-> Maybe Text -> DescribeResourcePolicyResponse)
-> Lens
DescribeResourcePolicyResponse
DescribeResourcePolicyResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourcePolicyResponse' {Maybe Text
policy :: Maybe Text
$sel:policy:DescribeResourcePolicyResponse' :: DescribeResourcePolicyResponse -> Maybe Text
policy} -> Maybe Text
policy) (\s :: DescribeResourcePolicyResponse
s@DescribeResourcePolicyResponse' {} Maybe Text
a -> DescribeResourcePolicyResponse
s {$sel:policy:DescribeResourcePolicyResponse' :: Maybe Text
policy = Maybe Text
a} :: DescribeResourcePolicyResponse)
describeResourcePolicyResponse_httpStatus :: Lens.Lens' DescribeResourcePolicyResponse Prelude.Int
describeResourcePolicyResponse_httpStatus :: (Int -> f Int)
-> DescribeResourcePolicyResponse
-> f DescribeResourcePolicyResponse
describeResourcePolicyResponse_httpStatus = (DescribeResourcePolicyResponse -> Int)
-> (DescribeResourcePolicyResponse
-> Int -> DescribeResourcePolicyResponse)
-> Lens
DescribeResourcePolicyResponse
DescribeResourcePolicyResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourcePolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeResourcePolicyResponse' :: DescribeResourcePolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeResourcePolicyResponse
s@DescribeResourcePolicyResponse' {} Int
a -> DescribeResourcePolicyResponse
s {$sel:httpStatus:DescribeResourcePolicyResponse' :: Int
httpStatus = Int
a} :: DescribeResourcePolicyResponse)
instance
Prelude.NFData
DescribeResourcePolicyResponse