{-# 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.ServerlessApplicationRepository.GetApplicationPolicy
(
GetApplicationPolicy (..),
newGetApplicationPolicy,
getApplicationPolicy_applicationId,
GetApplicationPolicyResponse (..),
newGetApplicationPolicyResponse,
getApplicationPolicyResponse_statements,
getApplicationPolicyResponse_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.ServerlessApplicationRepository.Types
data GetApplicationPolicy = GetApplicationPolicy'
{
GetApplicationPolicy -> Text
applicationId :: Prelude.Text
}
deriving (GetApplicationPolicy -> GetApplicationPolicy -> Bool
(GetApplicationPolicy -> GetApplicationPolicy -> Bool)
-> (GetApplicationPolicy -> GetApplicationPolicy -> Bool)
-> Eq GetApplicationPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApplicationPolicy -> GetApplicationPolicy -> Bool
$c/= :: GetApplicationPolicy -> GetApplicationPolicy -> Bool
== :: GetApplicationPolicy -> GetApplicationPolicy -> Bool
$c== :: GetApplicationPolicy -> GetApplicationPolicy -> Bool
Prelude.Eq, ReadPrec [GetApplicationPolicy]
ReadPrec GetApplicationPolicy
Int -> ReadS GetApplicationPolicy
ReadS [GetApplicationPolicy]
(Int -> ReadS GetApplicationPolicy)
-> ReadS [GetApplicationPolicy]
-> ReadPrec GetApplicationPolicy
-> ReadPrec [GetApplicationPolicy]
-> Read GetApplicationPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApplicationPolicy]
$creadListPrec :: ReadPrec [GetApplicationPolicy]
readPrec :: ReadPrec GetApplicationPolicy
$creadPrec :: ReadPrec GetApplicationPolicy
readList :: ReadS [GetApplicationPolicy]
$creadList :: ReadS [GetApplicationPolicy]
readsPrec :: Int -> ReadS GetApplicationPolicy
$creadsPrec :: Int -> ReadS GetApplicationPolicy
Prelude.Read, Int -> GetApplicationPolicy -> ShowS
[GetApplicationPolicy] -> ShowS
GetApplicationPolicy -> String
(Int -> GetApplicationPolicy -> ShowS)
-> (GetApplicationPolicy -> String)
-> ([GetApplicationPolicy] -> ShowS)
-> Show GetApplicationPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApplicationPolicy] -> ShowS
$cshowList :: [GetApplicationPolicy] -> ShowS
show :: GetApplicationPolicy -> String
$cshow :: GetApplicationPolicy -> String
showsPrec :: Int -> GetApplicationPolicy -> ShowS
$cshowsPrec :: Int -> GetApplicationPolicy -> ShowS
Prelude.Show, (forall x. GetApplicationPolicy -> Rep GetApplicationPolicy x)
-> (forall x. Rep GetApplicationPolicy x -> GetApplicationPolicy)
-> Generic GetApplicationPolicy
forall x. Rep GetApplicationPolicy x -> GetApplicationPolicy
forall x. GetApplicationPolicy -> Rep GetApplicationPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetApplicationPolicy x -> GetApplicationPolicy
$cfrom :: forall x. GetApplicationPolicy -> Rep GetApplicationPolicy x
Prelude.Generic)
newGetApplicationPolicy ::
Prelude.Text ->
GetApplicationPolicy
newGetApplicationPolicy :: Text -> GetApplicationPolicy
newGetApplicationPolicy Text
pApplicationId_ =
GetApplicationPolicy' :: Text -> GetApplicationPolicy
GetApplicationPolicy'
{ $sel:applicationId:GetApplicationPolicy' :: Text
applicationId =
Text
pApplicationId_
}
getApplicationPolicy_applicationId :: Lens.Lens' GetApplicationPolicy Prelude.Text
getApplicationPolicy_applicationId :: (Text -> f Text) -> GetApplicationPolicy -> f GetApplicationPolicy
getApplicationPolicy_applicationId = (GetApplicationPolicy -> Text)
-> (GetApplicationPolicy -> Text -> GetApplicationPolicy)
-> Lens GetApplicationPolicy GetApplicationPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationPolicy' {Text
applicationId :: Text
$sel:applicationId:GetApplicationPolicy' :: GetApplicationPolicy -> Text
applicationId} -> Text
applicationId) (\s :: GetApplicationPolicy
s@GetApplicationPolicy' {} Text
a -> GetApplicationPolicy
s {$sel:applicationId:GetApplicationPolicy' :: Text
applicationId = Text
a} :: GetApplicationPolicy)
instance Core.AWSRequest GetApplicationPolicy where
type
AWSResponse GetApplicationPolicy =
GetApplicationPolicyResponse
request :: GetApplicationPolicy -> Request GetApplicationPolicy
request = Service -> GetApplicationPolicy -> Request GetApplicationPolicy
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetApplicationPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetApplicationPolicy)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetApplicationPolicy))
-> Logger
-> Service
-> Proxy GetApplicationPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetApplicationPolicy)))
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 [ApplicationPolicyStatement]
-> Int -> GetApplicationPolicyResponse
GetApplicationPolicyResponse'
(Maybe [ApplicationPolicyStatement]
-> Int -> GetApplicationPolicyResponse)
-> Either String (Maybe [ApplicationPolicyStatement])
-> Either String (Int -> GetApplicationPolicyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Either String (Maybe (Maybe [ApplicationPolicyStatement]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"statements" Either String (Maybe (Maybe [ApplicationPolicyStatement]))
-> Maybe [ApplicationPolicyStatement]
-> Either String (Maybe [ApplicationPolicyStatement])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ApplicationPolicyStatement]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> GetApplicationPolicyResponse)
-> Either String Int -> Either String GetApplicationPolicyResponse
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 GetApplicationPolicy
instance Prelude.NFData GetApplicationPolicy
instance Core.ToHeaders GetApplicationPolicy where
toHeaders :: GetApplicationPolicy -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetApplicationPolicy -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath GetApplicationPolicy where
toPath :: GetApplicationPolicy -> ByteString
toPath GetApplicationPolicy' {Text
applicationId :: Text
$sel:applicationId:GetApplicationPolicy' :: GetApplicationPolicy -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/applications/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
applicationId,
ByteString
"/policy"
]
instance Core.ToQuery GetApplicationPolicy where
toQuery :: GetApplicationPolicy -> QueryString
toQuery = QueryString -> GetApplicationPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetApplicationPolicyResponse = GetApplicationPolicyResponse'
{
GetApplicationPolicyResponse -> Maybe [ApplicationPolicyStatement]
statements :: Prelude.Maybe [ApplicationPolicyStatement],
GetApplicationPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetApplicationPolicyResponse
-> GetApplicationPolicyResponse -> Bool
(GetApplicationPolicyResponse
-> GetApplicationPolicyResponse -> Bool)
-> (GetApplicationPolicyResponse
-> GetApplicationPolicyResponse -> Bool)
-> Eq GetApplicationPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApplicationPolicyResponse
-> GetApplicationPolicyResponse -> Bool
$c/= :: GetApplicationPolicyResponse
-> GetApplicationPolicyResponse -> Bool
== :: GetApplicationPolicyResponse
-> GetApplicationPolicyResponse -> Bool
$c== :: GetApplicationPolicyResponse
-> GetApplicationPolicyResponse -> Bool
Prelude.Eq, ReadPrec [GetApplicationPolicyResponse]
ReadPrec GetApplicationPolicyResponse
Int -> ReadS GetApplicationPolicyResponse
ReadS [GetApplicationPolicyResponse]
(Int -> ReadS GetApplicationPolicyResponse)
-> ReadS [GetApplicationPolicyResponse]
-> ReadPrec GetApplicationPolicyResponse
-> ReadPrec [GetApplicationPolicyResponse]
-> Read GetApplicationPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApplicationPolicyResponse]
$creadListPrec :: ReadPrec [GetApplicationPolicyResponse]
readPrec :: ReadPrec GetApplicationPolicyResponse
$creadPrec :: ReadPrec GetApplicationPolicyResponse
readList :: ReadS [GetApplicationPolicyResponse]
$creadList :: ReadS [GetApplicationPolicyResponse]
readsPrec :: Int -> ReadS GetApplicationPolicyResponse
$creadsPrec :: Int -> ReadS GetApplicationPolicyResponse
Prelude.Read, Int -> GetApplicationPolicyResponse -> ShowS
[GetApplicationPolicyResponse] -> ShowS
GetApplicationPolicyResponse -> String
(Int -> GetApplicationPolicyResponse -> ShowS)
-> (GetApplicationPolicyResponse -> String)
-> ([GetApplicationPolicyResponse] -> ShowS)
-> Show GetApplicationPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApplicationPolicyResponse] -> ShowS
$cshowList :: [GetApplicationPolicyResponse] -> ShowS
show :: GetApplicationPolicyResponse -> String
$cshow :: GetApplicationPolicyResponse -> String
showsPrec :: Int -> GetApplicationPolicyResponse -> ShowS
$cshowsPrec :: Int -> GetApplicationPolicyResponse -> ShowS
Prelude.Show, (forall x.
GetApplicationPolicyResponse -> Rep GetApplicationPolicyResponse x)
-> (forall x.
Rep GetApplicationPolicyResponse x -> GetApplicationPolicyResponse)
-> Generic GetApplicationPolicyResponse
forall x.
Rep GetApplicationPolicyResponse x -> GetApplicationPolicyResponse
forall x.
GetApplicationPolicyResponse -> Rep GetApplicationPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetApplicationPolicyResponse x -> GetApplicationPolicyResponse
$cfrom :: forall x.
GetApplicationPolicyResponse -> Rep GetApplicationPolicyResponse x
Prelude.Generic)
newGetApplicationPolicyResponse ::
Prelude.Int ->
GetApplicationPolicyResponse
newGetApplicationPolicyResponse :: Int -> GetApplicationPolicyResponse
newGetApplicationPolicyResponse Int
pHttpStatus_ =
GetApplicationPolicyResponse' :: Maybe [ApplicationPolicyStatement]
-> Int -> GetApplicationPolicyResponse
GetApplicationPolicyResponse'
{ $sel:statements:GetApplicationPolicyResponse' :: Maybe [ApplicationPolicyStatement]
statements =
Maybe [ApplicationPolicyStatement]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetApplicationPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getApplicationPolicyResponse_statements :: Lens.Lens' GetApplicationPolicyResponse (Prelude.Maybe [ApplicationPolicyStatement])
getApplicationPolicyResponse_statements :: (Maybe [ApplicationPolicyStatement]
-> f (Maybe [ApplicationPolicyStatement]))
-> GetApplicationPolicyResponse -> f GetApplicationPolicyResponse
getApplicationPolicyResponse_statements = (GetApplicationPolicyResponse
-> Maybe [ApplicationPolicyStatement])
-> (GetApplicationPolicyResponse
-> Maybe [ApplicationPolicyStatement]
-> GetApplicationPolicyResponse)
-> Lens
GetApplicationPolicyResponse
GetApplicationPolicyResponse
(Maybe [ApplicationPolicyStatement])
(Maybe [ApplicationPolicyStatement])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationPolicyResponse' {Maybe [ApplicationPolicyStatement]
statements :: Maybe [ApplicationPolicyStatement]
$sel:statements:GetApplicationPolicyResponse' :: GetApplicationPolicyResponse -> Maybe [ApplicationPolicyStatement]
statements} -> Maybe [ApplicationPolicyStatement]
statements) (\s :: GetApplicationPolicyResponse
s@GetApplicationPolicyResponse' {} Maybe [ApplicationPolicyStatement]
a -> GetApplicationPolicyResponse
s {$sel:statements:GetApplicationPolicyResponse' :: Maybe [ApplicationPolicyStatement]
statements = Maybe [ApplicationPolicyStatement]
a} :: GetApplicationPolicyResponse) ((Maybe [ApplicationPolicyStatement]
-> f (Maybe [ApplicationPolicyStatement]))
-> GetApplicationPolicyResponse -> f GetApplicationPolicyResponse)
-> ((Maybe [ApplicationPolicyStatement]
-> f (Maybe [ApplicationPolicyStatement]))
-> Maybe [ApplicationPolicyStatement]
-> f (Maybe [ApplicationPolicyStatement]))
-> (Maybe [ApplicationPolicyStatement]
-> f (Maybe [ApplicationPolicyStatement]))
-> GetApplicationPolicyResponse
-> f GetApplicationPolicyResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[ApplicationPolicyStatement]
[ApplicationPolicyStatement]
[ApplicationPolicyStatement]
[ApplicationPolicyStatement]
-> Iso
(Maybe [ApplicationPolicyStatement])
(Maybe [ApplicationPolicyStatement])
(Maybe [ApplicationPolicyStatement])
(Maybe [ApplicationPolicyStatement])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[ApplicationPolicyStatement]
[ApplicationPolicyStatement]
[ApplicationPolicyStatement]
[ApplicationPolicyStatement]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getApplicationPolicyResponse_httpStatus :: Lens.Lens' GetApplicationPolicyResponse Prelude.Int
getApplicationPolicyResponse_httpStatus :: (Int -> f Int)
-> GetApplicationPolicyResponse -> f GetApplicationPolicyResponse
getApplicationPolicyResponse_httpStatus = (GetApplicationPolicyResponse -> Int)
-> (GetApplicationPolicyResponse
-> Int -> GetApplicationPolicyResponse)
-> Lens
GetApplicationPolicyResponse GetApplicationPolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetApplicationPolicyResponse' :: GetApplicationPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetApplicationPolicyResponse
s@GetApplicationPolicyResponse' {} Int
a -> GetApplicationPolicyResponse
s {$sel:httpStatus:GetApplicationPolicyResponse' :: Int
httpStatus = Int
a} :: GetApplicationPolicyResponse)
instance Prelude.NFData GetApplicationPolicyResponse