{-# 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.WAFRegional.GetPermissionPolicy
(
GetPermissionPolicy (..),
newGetPermissionPolicy,
getPermissionPolicy_resourceArn,
GetPermissionPolicyResponse (..),
newGetPermissionPolicyResponse,
getPermissionPolicyResponse_policy,
getPermissionPolicyResponse_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.WAFRegional.Types
data GetPermissionPolicy = GetPermissionPolicy'
{
GetPermissionPolicy -> Text
resourceArn :: Prelude.Text
}
deriving (GetPermissionPolicy -> GetPermissionPolicy -> Bool
(GetPermissionPolicy -> GetPermissionPolicy -> Bool)
-> (GetPermissionPolicy -> GetPermissionPolicy -> Bool)
-> Eq GetPermissionPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPermissionPolicy -> GetPermissionPolicy -> Bool
$c/= :: GetPermissionPolicy -> GetPermissionPolicy -> Bool
== :: GetPermissionPolicy -> GetPermissionPolicy -> Bool
$c== :: GetPermissionPolicy -> GetPermissionPolicy -> Bool
Prelude.Eq, ReadPrec [GetPermissionPolicy]
ReadPrec GetPermissionPolicy
Int -> ReadS GetPermissionPolicy
ReadS [GetPermissionPolicy]
(Int -> ReadS GetPermissionPolicy)
-> ReadS [GetPermissionPolicy]
-> ReadPrec GetPermissionPolicy
-> ReadPrec [GetPermissionPolicy]
-> Read GetPermissionPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPermissionPolicy]
$creadListPrec :: ReadPrec [GetPermissionPolicy]
readPrec :: ReadPrec GetPermissionPolicy
$creadPrec :: ReadPrec GetPermissionPolicy
readList :: ReadS [GetPermissionPolicy]
$creadList :: ReadS [GetPermissionPolicy]
readsPrec :: Int -> ReadS GetPermissionPolicy
$creadsPrec :: Int -> ReadS GetPermissionPolicy
Prelude.Read, Int -> GetPermissionPolicy -> ShowS
[GetPermissionPolicy] -> ShowS
GetPermissionPolicy -> String
(Int -> GetPermissionPolicy -> ShowS)
-> (GetPermissionPolicy -> String)
-> ([GetPermissionPolicy] -> ShowS)
-> Show GetPermissionPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPermissionPolicy] -> ShowS
$cshowList :: [GetPermissionPolicy] -> ShowS
show :: GetPermissionPolicy -> String
$cshow :: GetPermissionPolicy -> String
showsPrec :: Int -> GetPermissionPolicy -> ShowS
$cshowsPrec :: Int -> GetPermissionPolicy -> ShowS
Prelude.Show, (forall x. GetPermissionPolicy -> Rep GetPermissionPolicy x)
-> (forall x. Rep GetPermissionPolicy x -> GetPermissionPolicy)
-> Generic GetPermissionPolicy
forall x. Rep GetPermissionPolicy x -> GetPermissionPolicy
forall x. GetPermissionPolicy -> Rep GetPermissionPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPermissionPolicy x -> GetPermissionPolicy
$cfrom :: forall x. GetPermissionPolicy -> Rep GetPermissionPolicy x
Prelude.Generic)
newGetPermissionPolicy ::
Prelude.Text ->
GetPermissionPolicy
newGetPermissionPolicy :: Text -> GetPermissionPolicy
newGetPermissionPolicy Text
pResourceArn_ =
GetPermissionPolicy' :: Text -> GetPermissionPolicy
GetPermissionPolicy' {$sel:resourceArn:GetPermissionPolicy' :: Text
resourceArn = Text
pResourceArn_}
getPermissionPolicy_resourceArn :: Lens.Lens' GetPermissionPolicy Prelude.Text
getPermissionPolicy_resourceArn :: (Text -> f Text) -> GetPermissionPolicy -> f GetPermissionPolicy
getPermissionPolicy_resourceArn = (GetPermissionPolicy -> Text)
-> (GetPermissionPolicy -> Text -> GetPermissionPolicy)
-> Lens GetPermissionPolicy GetPermissionPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPermissionPolicy' {Text
resourceArn :: Text
$sel:resourceArn:GetPermissionPolicy' :: GetPermissionPolicy -> Text
resourceArn} -> Text
resourceArn) (\s :: GetPermissionPolicy
s@GetPermissionPolicy' {} Text
a -> GetPermissionPolicy
s {$sel:resourceArn:GetPermissionPolicy' :: Text
resourceArn = Text
a} :: GetPermissionPolicy)
instance Core.AWSRequest GetPermissionPolicy where
type
AWSResponse GetPermissionPolicy =
GetPermissionPolicyResponse
request :: GetPermissionPolicy -> Request GetPermissionPolicy
request = Service -> GetPermissionPolicy -> Request GetPermissionPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetPermissionPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetPermissionPolicy)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetPermissionPolicy))
-> Logger
-> Service
-> Proxy GetPermissionPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetPermissionPolicy)))
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 -> GetPermissionPolicyResponse
GetPermissionPolicyResponse'
(Maybe Text -> Int -> GetPermissionPolicyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetPermissionPolicyResponse)
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 -> GetPermissionPolicyResponse)
-> Either String Int -> Either String GetPermissionPolicyResponse
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 GetPermissionPolicy
instance Prelude.NFData GetPermissionPolicy
instance Core.ToHeaders GetPermissionPolicy where
toHeaders :: GetPermissionPolicy -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetPermissionPolicy -> 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
"AWSWAF_Regional_20161128.GetPermissionPolicy" ::
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 GetPermissionPolicy where
toJSON :: GetPermissionPolicy -> Value
toJSON GetPermissionPolicy' {Text
resourceArn :: Text
$sel:resourceArn:GetPermissionPolicy' :: GetPermissionPolicy -> 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 GetPermissionPolicy where
toPath :: GetPermissionPolicy -> ByteString
toPath = ByteString -> GetPermissionPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetPermissionPolicy where
toQuery :: GetPermissionPolicy -> QueryString
toQuery = QueryString -> GetPermissionPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetPermissionPolicyResponse = GetPermissionPolicyResponse'
{
GetPermissionPolicyResponse -> Maybe Text
policy :: Prelude.Maybe Prelude.Text,
GetPermissionPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetPermissionPolicyResponse -> GetPermissionPolicyResponse -> Bool
(GetPermissionPolicyResponse
-> GetPermissionPolicyResponse -> Bool)
-> (GetPermissionPolicyResponse
-> GetPermissionPolicyResponse -> Bool)
-> Eq GetPermissionPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPermissionPolicyResponse -> GetPermissionPolicyResponse -> Bool
$c/= :: GetPermissionPolicyResponse -> GetPermissionPolicyResponse -> Bool
== :: GetPermissionPolicyResponse -> GetPermissionPolicyResponse -> Bool
$c== :: GetPermissionPolicyResponse -> GetPermissionPolicyResponse -> Bool
Prelude.Eq, ReadPrec [GetPermissionPolicyResponse]
ReadPrec GetPermissionPolicyResponse
Int -> ReadS GetPermissionPolicyResponse
ReadS [GetPermissionPolicyResponse]
(Int -> ReadS GetPermissionPolicyResponse)
-> ReadS [GetPermissionPolicyResponse]
-> ReadPrec GetPermissionPolicyResponse
-> ReadPrec [GetPermissionPolicyResponse]
-> Read GetPermissionPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPermissionPolicyResponse]
$creadListPrec :: ReadPrec [GetPermissionPolicyResponse]
readPrec :: ReadPrec GetPermissionPolicyResponse
$creadPrec :: ReadPrec GetPermissionPolicyResponse
readList :: ReadS [GetPermissionPolicyResponse]
$creadList :: ReadS [GetPermissionPolicyResponse]
readsPrec :: Int -> ReadS GetPermissionPolicyResponse
$creadsPrec :: Int -> ReadS GetPermissionPolicyResponse
Prelude.Read, Int -> GetPermissionPolicyResponse -> ShowS
[GetPermissionPolicyResponse] -> ShowS
GetPermissionPolicyResponse -> String
(Int -> GetPermissionPolicyResponse -> ShowS)
-> (GetPermissionPolicyResponse -> String)
-> ([GetPermissionPolicyResponse] -> ShowS)
-> Show GetPermissionPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPermissionPolicyResponse] -> ShowS
$cshowList :: [GetPermissionPolicyResponse] -> ShowS
show :: GetPermissionPolicyResponse -> String
$cshow :: GetPermissionPolicyResponse -> String
showsPrec :: Int -> GetPermissionPolicyResponse -> ShowS
$cshowsPrec :: Int -> GetPermissionPolicyResponse -> ShowS
Prelude.Show, (forall x.
GetPermissionPolicyResponse -> Rep GetPermissionPolicyResponse x)
-> (forall x.
Rep GetPermissionPolicyResponse x -> GetPermissionPolicyResponse)
-> Generic GetPermissionPolicyResponse
forall x.
Rep GetPermissionPolicyResponse x -> GetPermissionPolicyResponse
forall x.
GetPermissionPolicyResponse -> Rep GetPermissionPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetPermissionPolicyResponse x -> GetPermissionPolicyResponse
$cfrom :: forall x.
GetPermissionPolicyResponse -> Rep GetPermissionPolicyResponse x
Prelude.Generic)
newGetPermissionPolicyResponse ::
Prelude.Int ->
GetPermissionPolicyResponse
newGetPermissionPolicyResponse :: Int -> GetPermissionPolicyResponse
newGetPermissionPolicyResponse Int
pHttpStatus_ =
GetPermissionPolicyResponse' :: Maybe Text -> Int -> GetPermissionPolicyResponse
GetPermissionPolicyResponse'
{ $sel:policy:GetPermissionPolicyResponse' :: Maybe Text
policy =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetPermissionPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getPermissionPolicyResponse_policy :: Lens.Lens' GetPermissionPolicyResponse (Prelude.Maybe Prelude.Text)
getPermissionPolicyResponse_policy :: (Maybe Text -> f (Maybe Text))
-> GetPermissionPolicyResponse -> f GetPermissionPolicyResponse
getPermissionPolicyResponse_policy = (GetPermissionPolicyResponse -> Maybe Text)
-> (GetPermissionPolicyResponse
-> Maybe Text -> GetPermissionPolicyResponse)
-> Lens
GetPermissionPolicyResponse
GetPermissionPolicyResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPermissionPolicyResponse' {Maybe Text
policy :: Maybe Text
$sel:policy:GetPermissionPolicyResponse' :: GetPermissionPolicyResponse -> Maybe Text
policy} -> Maybe Text
policy) (\s :: GetPermissionPolicyResponse
s@GetPermissionPolicyResponse' {} Maybe Text
a -> GetPermissionPolicyResponse
s {$sel:policy:GetPermissionPolicyResponse' :: Maybe Text
policy = Maybe Text
a} :: GetPermissionPolicyResponse)
getPermissionPolicyResponse_httpStatus :: Lens.Lens' GetPermissionPolicyResponse Prelude.Int
getPermissionPolicyResponse_httpStatus :: (Int -> f Int)
-> GetPermissionPolicyResponse -> f GetPermissionPolicyResponse
getPermissionPolicyResponse_httpStatus = (GetPermissionPolicyResponse -> Int)
-> (GetPermissionPolicyResponse
-> Int -> GetPermissionPolicyResponse)
-> Lens
GetPermissionPolicyResponse GetPermissionPolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPermissionPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetPermissionPolicyResponse' :: GetPermissionPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetPermissionPolicyResponse
s@GetPermissionPolicyResponse' {} Int
a -> GetPermissionPolicyResponse
s {$sel:httpStatus:GetPermissionPolicyResponse' :: Int
httpStatus = Int
a} :: GetPermissionPolicyResponse)
instance Prelude.NFData GetPermissionPolicyResponse