{-# 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.RAM.GetPermission
(
GetPermission (..),
newGetPermission,
getPermission_permissionVersion,
getPermission_permissionArn,
GetPermissionResponse (..),
newGetPermissionResponse,
getPermissionResponse_permission,
getPermissionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RAM.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetPermission = GetPermission'
{
GetPermission -> Maybe Int
permissionVersion :: Prelude.Maybe Prelude.Int,
GetPermission -> Text
permissionArn :: Prelude.Text
}
deriving (GetPermission -> GetPermission -> Bool
(GetPermission -> GetPermission -> Bool)
-> (GetPermission -> GetPermission -> Bool) -> Eq GetPermission
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPermission -> GetPermission -> Bool
$c/= :: GetPermission -> GetPermission -> Bool
== :: GetPermission -> GetPermission -> Bool
$c== :: GetPermission -> GetPermission -> Bool
Prelude.Eq, ReadPrec [GetPermission]
ReadPrec GetPermission
Int -> ReadS GetPermission
ReadS [GetPermission]
(Int -> ReadS GetPermission)
-> ReadS [GetPermission]
-> ReadPrec GetPermission
-> ReadPrec [GetPermission]
-> Read GetPermission
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPermission]
$creadListPrec :: ReadPrec [GetPermission]
readPrec :: ReadPrec GetPermission
$creadPrec :: ReadPrec GetPermission
readList :: ReadS [GetPermission]
$creadList :: ReadS [GetPermission]
readsPrec :: Int -> ReadS GetPermission
$creadsPrec :: Int -> ReadS GetPermission
Prelude.Read, Int -> GetPermission -> ShowS
[GetPermission] -> ShowS
GetPermission -> String
(Int -> GetPermission -> ShowS)
-> (GetPermission -> String)
-> ([GetPermission] -> ShowS)
-> Show GetPermission
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPermission] -> ShowS
$cshowList :: [GetPermission] -> ShowS
show :: GetPermission -> String
$cshow :: GetPermission -> String
showsPrec :: Int -> GetPermission -> ShowS
$cshowsPrec :: Int -> GetPermission -> ShowS
Prelude.Show, (forall x. GetPermission -> Rep GetPermission x)
-> (forall x. Rep GetPermission x -> GetPermission)
-> Generic GetPermission
forall x. Rep GetPermission x -> GetPermission
forall x. GetPermission -> Rep GetPermission x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPermission x -> GetPermission
$cfrom :: forall x. GetPermission -> Rep GetPermission x
Prelude.Generic)
newGetPermission ::
Prelude.Text ->
GetPermission
newGetPermission :: Text -> GetPermission
newGetPermission Text
pPermissionArn_ =
GetPermission' :: Maybe Int -> Text -> GetPermission
GetPermission'
{ $sel:permissionVersion:GetPermission' :: Maybe Int
permissionVersion = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:permissionArn:GetPermission' :: Text
permissionArn = Text
pPermissionArn_
}
getPermission_permissionVersion :: Lens.Lens' GetPermission (Prelude.Maybe Prelude.Int)
getPermission_permissionVersion :: (Maybe Int -> f (Maybe Int)) -> GetPermission -> f GetPermission
getPermission_permissionVersion = (GetPermission -> Maybe Int)
-> (GetPermission -> Maybe Int -> GetPermission)
-> Lens GetPermission GetPermission (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPermission' {Maybe Int
permissionVersion :: Maybe Int
$sel:permissionVersion:GetPermission' :: GetPermission -> Maybe Int
permissionVersion} -> Maybe Int
permissionVersion) (\s :: GetPermission
s@GetPermission' {} Maybe Int
a -> GetPermission
s {$sel:permissionVersion:GetPermission' :: Maybe Int
permissionVersion = Maybe Int
a} :: GetPermission)
getPermission_permissionArn :: Lens.Lens' GetPermission Prelude.Text
getPermission_permissionArn :: (Text -> f Text) -> GetPermission -> f GetPermission
getPermission_permissionArn = (GetPermission -> Text)
-> (GetPermission -> Text -> GetPermission)
-> Lens GetPermission GetPermission Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPermission' {Text
permissionArn :: Text
$sel:permissionArn:GetPermission' :: GetPermission -> Text
permissionArn} -> Text
permissionArn) (\s :: GetPermission
s@GetPermission' {} Text
a -> GetPermission
s {$sel:permissionArn:GetPermission' :: Text
permissionArn = Text
a} :: GetPermission)
instance Core.AWSRequest GetPermission where
type
AWSResponse GetPermission =
GetPermissionResponse
request :: GetPermission -> Request GetPermission
request = Service -> GetPermission -> Request GetPermission
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetPermission
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetPermission)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetPermission))
-> Logger
-> Service
-> Proxy GetPermission
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetPermission)))
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 ResourceSharePermissionDetail -> Int -> GetPermissionResponse
GetPermissionResponse'
(Maybe ResourceSharePermissionDetail
-> Int -> GetPermissionResponse)
-> Either String (Maybe ResourceSharePermissionDetail)
-> Either String (Int -> GetPermissionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Either String (Maybe ResourceSharePermissionDetail)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"permission")
Either String (Int -> GetPermissionResponse)
-> Either String Int -> Either String GetPermissionResponse
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 GetPermission
instance Prelude.NFData GetPermission
instance Core.ToHeaders GetPermission where
toHeaders :: GetPermission -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetPermission -> 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.ToJSON GetPermission where
toJSON :: GetPermission -> Value
toJSON GetPermission' {Maybe Int
Text
permissionArn :: Text
permissionVersion :: Maybe Int
$sel:permissionArn:GetPermission' :: GetPermission -> Text
$sel:permissionVersion:GetPermission' :: GetPermission -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"permissionVersion" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
permissionVersion,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"permissionArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
permissionArn)
]
)
instance Core.ToPath GetPermission where
toPath :: GetPermission -> ByteString
toPath = ByteString -> GetPermission -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/getpermission"
instance Core.ToQuery GetPermission where
toQuery :: GetPermission -> QueryString
toQuery = QueryString -> GetPermission -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetPermissionResponse = GetPermissionResponse'
{
GetPermissionResponse -> Maybe ResourceSharePermissionDetail
permission :: Prelude.Maybe ResourceSharePermissionDetail,
GetPermissionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetPermissionResponse -> GetPermissionResponse -> Bool
(GetPermissionResponse -> GetPermissionResponse -> Bool)
-> (GetPermissionResponse -> GetPermissionResponse -> Bool)
-> Eq GetPermissionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPermissionResponse -> GetPermissionResponse -> Bool
$c/= :: GetPermissionResponse -> GetPermissionResponse -> Bool
== :: GetPermissionResponse -> GetPermissionResponse -> Bool
$c== :: GetPermissionResponse -> GetPermissionResponse -> Bool
Prelude.Eq, ReadPrec [GetPermissionResponse]
ReadPrec GetPermissionResponse
Int -> ReadS GetPermissionResponse
ReadS [GetPermissionResponse]
(Int -> ReadS GetPermissionResponse)
-> ReadS [GetPermissionResponse]
-> ReadPrec GetPermissionResponse
-> ReadPrec [GetPermissionResponse]
-> Read GetPermissionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPermissionResponse]
$creadListPrec :: ReadPrec [GetPermissionResponse]
readPrec :: ReadPrec GetPermissionResponse
$creadPrec :: ReadPrec GetPermissionResponse
readList :: ReadS [GetPermissionResponse]
$creadList :: ReadS [GetPermissionResponse]
readsPrec :: Int -> ReadS GetPermissionResponse
$creadsPrec :: Int -> ReadS GetPermissionResponse
Prelude.Read, Int -> GetPermissionResponse -> ShowS
[GetPermissionResponse] -> ShowS
GetPermissionResponse -> String
(Int -> GetPermissionResponse -> ShowS)
-> (GetPermissionResponse -> String)
-> ([GetPermissionResponse] -> ShowS)
-> Show GetPermissionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPermissionResponse] -> ShowS
$cshowList :: [GetPermissionResponse] -> ShowS
show :: GetPermissionResponse -> String
$cshow :: GetPermissionResponse -> String
showsPrec :: Int -> GetPermissionResponse -> ShowS
$cshowsPrec :: Int -> GetPermissionResponse -> ShowS
Prelude.Show, (forall x. GetPermissionResponse -> Rep GetPermissionResponse x)
-> (forall x. Rep GetPermissionResponse x -> GetPermissionResponse)
-> Generic GetPermissionResponse
forall x. Rep GetPermissionResponse x -> GetPermissionResponse
forall x. GetPermissionResponse -> Rep GetPermissionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPermissionResponse x -> GetPermissionResponse
$cfrom :: forall x. GetPermissionResponse -> Rep GetPermissionResponse x
Prelude.Generic)
newGetPermissionResponse ::
Prelude.Int ->
GetPermissionResponse
newGetPermissionResponse :: Int -> GetPermissionResponse
newGetPermissionResponse Int
pHttpStatus_ =
GetPermissionResponse' :: Maybe ResourceSharePermissionDetail -> Int -> GetPermissionResponse
GetPermissionResponse'
{ $sel:permission:GetPermissionResponse' :: Maybe ResourceSharePermissionDetail
permission =
Maybe ResourceSharePermissionDetail
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetPermissionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getPermissionResponse_permission :: Lens.Lens' GetPermissionResponse (Prelude.Maybe ResourceSharePermissionDetail)
getPermissionResponse_permission :: (Maybe ResourceSharePermissionDetail
-> f (Maybe ResourceSharePermissionDetail))
-> GetPermissionResponse -> f GetPermissionResponse
getPermissionResponse_permission = (GetPermissionResponse -> Maybe ResourceSharePermissionDetail)
-> (GetPermissionResponse
-> Maybe ResourceSharePermissionDetail -> GetPermissionResponse)
-> Lens
GetPermissionResponse
GetPermissionResponse
(Maybe ResourceSharePermissionDetail)
(Maybe ResourceSharePermissionDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPermissionResponse' {Maybe ResourceSharePermissionDetail
permission :: Maybe ResourceSharePermissionDetail
$sel:permission:GetPermissionResponse' :: GetPermissionResponse -> Maybe ResourceSharePermissionDetail
permission} -> Maybe ResourceSharePermissionDetail
permission) (\s :: GetPermissionResponse
s@GetPermissionResponse' {} Maybe ResourceSharePermissionDetail
a -> GetPermissionResponse
s {$sel:permission:GetPermissionResponse' :: Maybe ResourceSharePermissionDetail
permission = Maybe ResourceSharePermissionDetail
a} :: GetPermissionResponse)
getPermissionResponse_httpStatus :: Lens.Lens' GetPermissionResponse Prelude.Int
getPermissionResponse_httpStatus :: (Int -> f Int) -> GetPermissionResponse -> f GetPermissionResponse
getPermissionResponse_httpStatus = (GetPermissionResponse -> Int)
-> (GetPermissionResponse -> Int -> GetPermissionResponse)
-> Lens GetPermissionResponse GetPermissionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPermissionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetPermissionResponse' :: GetPermissionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetPermissionResponse
s@GetPermissionResponse' {} Int
a -> GetPermissionResponse
s {$sel:httpStatus:GetPermissionResponse' :: Int
httpStatus = Int
a} :: GetPermissionResponse)
instance Prelude.NFData GetPermissionResponse