{-# 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.IAM.GetPolicyVersion
(
GetPolicyVersion (..),
newGetPolicyVersion,
getPolicyVersion_policyArn,
getPolicyVersion_versionId,
GetPolicyVersionResponse (..),
newGetPolicyVersionResponse,
getPolicyVersionResponse_policyVersion,
getPolicyVersionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IAM.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetPolicyVersion = GetPolicyVersion'
{
GetPolicyVersion -> Text
policyArn :: Prelude.Text,
GetPolicyVersion -> Text
versionId :: Prelude.Text
}
deriving (GetPolicyVersion -> GetPolicyVersion -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPolicyVersion -> GetPolicyVersion -> Bool
$c/= :: GetPolicyVersion -> GetPolicyVersion -> Bool
== :: GetPolicyVersion -> GetPolicyVersion -> Bool
$c== :: GetPolicyVersion -> GetPolicyVersion -> Bool
Prelude.Eq, ReadPrec [GetPolicyVersion]
ReadPrec GetPolicyVersion
Int -> ReadS GetPolicyVersion
ReadS [GetPolicyVersion]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPolicyVersion]
$creadListPrec :: ReadPrec [GetPolicyVersion]
readPrec :: ReadPrec GetPolicyVersion
$creadPrec :: ReadPrec GetPolicyVersion
readList :: ReadS [GetPolicyVersion]
$creadList :: ReadS [GetPolicyVersion]
readsPrec :: Int -> ReadS GetPolicyVersion
$creadsPrec :: Int -> ReadS GetPolicyVersion
Prelude.Read, Int -> GetPolicyVersion -> ShowS
[GetPolicyVersion] -> ShowS
GetPolicyVersion -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPolicyVersion] -> ShowS
$cshowList :: [GetPolicyVersion] -> ShowS
show :: GetPolicyVersion -> String
$cshow :: GetPolicyVersion -> String
showsPrec :: Int -> GetPolicyVersion -> ShowS
$cshowsPrec :: Int -> GetPolicyVersion -> ShowS
Prelude.Show, forall x. Rep GetPolicyVersion x -> GetPolicyVersion
forall x. GetPolicyVersion -> Rep GetPolicyVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPolicyVersion x -> GetPolicyVersion
$cfrom :: forall x. GetPolicyVersion -> Rep GetPolicyVersion x
Prelude.Generic)
newGetPolicyVersion ::
Prelude.Text ->
Prelude.Text ->
GetPolicyVersion
newGetPolicyVersion :: Text -> Text -> GetPolicyVersion
newGetPolicyVersion Text
pPolicyArn_ Text
pVersionId_ =
GetPolicyVersion'
{ $sel:policyArn:GetPolicyVersion' :: Text
policyArn = Text
pPolicyArn_,
$sel:versionId:GetPolicyVersion' :: Text
versionId = Text
pVersionId_
}
getPolicyVersion_policyArn :: Lens.Lens' GetPolicyVersion Prelude.Text
getPolicyVersion_policyArn :: Lens' GetPolicyVersion Text
getPolicyVersion_policyArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPolicyVersion' {Text
policyArn :: Text
$sel:policyArn:GetPolicyVersion' :: GetPolicyVersion -> Text
policyArn} -> Text
policyArn) (\s :: GetPolicyVersion
s@GetPolicyVersion' {} Text
a -> GetPolicyVersion
s {$sel:policyArn:GetPolicyVersion' :: Text
policyArn = Text
a} :: GetPolicyVersion)
getPolicyVersion_versionId :: Lens.Lens' GetPolicyVersion Prelude.Text
getPolicyVersion_versionId :: Lens' GetPolicyVersion Text
getPolicyVersion_versionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPolicyVersion' {Text
versionId :: Text
$sel:versionId:GetPolicyVersion' :: GetPolicyVersion -> Text
versionId} -> Text
versionId) (\s :: GetPolicyVersion
s@GetPolicyVersion' {} Text
a -> GetPolicyVersion
s {$sel:versionId:GetPolicyVersion' :: Text
versionId = Text
a} :: GetPolicyVersion)
instance Core.AWSRequest GetPolicyVersion where
type
AWSResponse GetPolicyVersion =
GetPolicyVersionResponse
request :: (Service -> Service)
-> GetPolicyVersion -> Request GetPolicyVersion
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetPolicyVersion
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetPolicyVersion)))
response =
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"GetPolicyVersionResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe PolicyVersion -> Int -> GetPolicyVersionResponse
GetPolicyVersionResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"PolicyVersion")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetPolicyVersion where
hashWithSalt :: Int -> GetPolicyVersion -> Int
hashWithSalt Int
_salt GetPolicyVersion' {Text
versionId :: Text
policyArn :: Text
$sel:versionId:GetPolicyVersion' :: GetPolicyVersion -> Text
$sel:policyArn:GetPolicyVersion' :: GetPolicyVersion -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
policyArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
versionId
instance Prelude.NFData GetPolicyVersion where
rnf :: GetPolicyVersion -> ()
rnf GetPolicyVersion' {Text
versionId :: Text
policyArn :: Text
$sel:versionId:GetPolicyVersion' :: GetPolicyVersion -> Text
$sel:policyArn:GetPolicyVersion' :: GetPolicyVersion -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
policyArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
versionId
instance Data.ToHeaders GetPolicyVersion where
toHeaders :: GetPolicyVersion -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath GetPolicyVersion where
toPath :: GetPolicyVersion -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetPolicyVersion where
toQuery :: GetPolicyVersion -> QueryString
toQuery GetPolicyVersion' {Text
versionId :: Text
policyArn :: Text
$sel:versionId:GetPolicyVersion' :: GetPolicyVersion -> Text
$sel:policyArn:GetPolicyVersion' :: GetPolicyVersion -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"GetPolicyVersion" :: Prelude.ByteString),
ByteString
"Version"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
ByteString
"PolicyArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
policyArn,
ByteString
"VersionId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
versionId
]
data GetPolicyVersionResponse = GetPolicyVersionResponse'
{
GetPolicyVersionResponse -> Maybe PolicyVersion
policyVersion :: Prelude.Maybe PolicyVersion,
GetPolicyVersionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetPolicyVersionResponse -> GetPolicyVersionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPolicyVersionResponse -> GetPolicyVersionResponse -> Bool
$c/= :: GetPolicyVersionResponse -> GetPolicyVersionResponse -> Bool
== :: GetPolicyVersionResponse -> GetPolicyVersionResponse -> Bool
$c== :: GetPolicyVersionResponse -> GetPolicyVersionResponse -> Bool
Prelude.Eq, ReadPrec [GetPolicyVersionResponse]
ReadPrec GetPolicyVersionResponse
Int -> ReadS GetPolicyVersionResponse
ReadS [GetPolicyVersionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPolicyVersionResponse]
$creadListPrec :: ReadPrec [GetPolicyVersionResponse]
readPrec :: ReadPrec GetPolicyVersionResponse
$creadPrec :: ReadPrec GetPolicyVersionResponse
readList :: ReadS [GetPolicyVersionResponse]
$creadList :: ReadS [GetPolicyVersionResponse]
readsPrec :: Int -> ReadS GetPolicyVersionResponse
$creadsPrec :: Int -> ReadS GetPolicyVersionResponse
Prelude.Read, Int -> GetPolicyVersionResponse -> ShowS
[GetPolicyVersionResponse] -> ShowS
GetPolicyVersionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPolicyVersionResponse] -> ShowS
$cshowList :: [GetPolicyVersionResponse] -> ShowS
show :: GetPolicyVersionResponse -> String
$cshow :: GetPolicyVersionResponse -> String
showsPrec :: Int -> GetPolicyVersionResponse -> ShowS
$cshowsPrec :: Int -> GetPolicyVersionResponse -> ShowS
Prelude.Show, forall x.
Rep GetPolicyVersionResponse x -> GetPolicyVersionResponse
forall x.
GetPolicyVersionResponse -> Rep GetPolicyVersionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetPolicyVersionResponse x -> GetPolicyVersionResponse
$cfrom :: forall x.
GetPolicyVersionResponse -> Rep GetPolicyVersionResponse x
Prelude.Generic)
newGetPolicyVersionResponse ::
Prelude.Int ->
GetPolicyVersionResponse
newGetPolicyVersionResponse :: Int -> GetPolicyVersionResponse
newGetPolicyVersionResponse Int
pHttpStatus_ =
GetPolicyVersionResponse'
{ $sel:policyVersion:GetPolicyVersionResponse' :: Maybe PolicyVersion
policyVersion =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetPolicyVersionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getPolicyVersionResponse_policyVersion :: Lens.Lens' GetPolicyVersionResponse (Prelude.Maybe PolicyVersion)
getPolicyVersionResponse_policyVersion :: Lens' GetPolicyVersionResponse (Maybe PolicyVersion)
getPolicyVersionResponse_policyVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPolicyVersionResponse' {Maybe PolicyVersion
policyVersion :: Maybe PolicyVersion
$sel:policyVersion:GetPolicyVersionResponse' :: GetPolicyVersionResponse -> Maybe PolicyVersion
policyVersion} -> Maybe PolicyVersion
policyVersion) (\s :: GetPolicyVersionResponse
s@GetPolicyVersionResponse' {} Maybe PolicyVersion
a -> GetPolicyVersionResponse
s {$sel:policyVersion:GetPolicyVersionResponse' :: Maybe PolicyVersion
policyVersion = Maybe PolicyVersion
a} :: GetPolicyVersionResponse)
getPolicyVersionResponse_httpStatus :: Lens.Lens' GetPolicyVersionResponse Prelude.Int
getPolicyVersionResponse_httpStatus :: Lens' GetPolicyVersionResponse Int
getPolicyVersionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPolicyVersionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetPolicyVersionResponse' :: GetPolicyVersionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetPolicyVersionResponse
s@GetPolicyVersionResponse' {} Int
a -> GetPolicyVersionResponse
s {$sel:httpStatus:GetPolicyVersionResponse' :: Int
httpStatus = Int
a} :: GetPolicyVersionResponse)
instance Prelude.NFData GetPolicyVersionResponse where
rnf :: GetPolicyVersionResponse -> ()
rnf GetPolicyVersionResponse' {Int
Maybe PolicyVersion
httpStatus :: Int
policyVersion :: Maybe PolicyVersion
$sel:httpStatus:GetPolicyVersionResponse' :: GetPolicyVersionResponse -> Int
$sel:policyVersion:GetPolicyVersionResponse' :: GetPolicyVersionResponse -> Maybe PolicyVersion
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe PolicyVersion
policyVersion
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus