{-# 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.SES.GetIdentityPolicies
(
GetIdentityPolicies (..),
newGetIdentityPolicies,
getIdentityPolicies_identity,
getIdentityPolicies_policyNames,
GetIdentityPoliciesResponse (..),
newGetIdentityPoliciesResponse,
getIdentityPoliciesResponse_httpStatus,
getIdentityPoliciesResponse_policies,
)
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.SES.Types
data GetIdentityPolicies = GetIdentityPolicies'
{
GetIdentityPolicies -> Text
identity :: Prelude.Text,
GetIdentityPolicies -> [Text]
policyNames :: [Prelude.Text]
}
deriving (GetIdentityPolicies -> GetIdentityPolicies -> Bool
(GetIdentityPolicies -> GetIdentityPolicies -> Bool)
-> (GetIdentityPolicies -> GetIdentityPolicies -> Bool)
-> Eq GetIdentityPolicies
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetIdentityPolicies -> GetIdentityPolicies -> Bool
$c/= :: GetIdentityPolicies -> GetIdentityPolicies -> Bool
== :: GetIdentityPolicies -> GetIdentityPolicies -> Bool
$c== :: GetIdentityPolicies -> GetIdentityPolicies -> Bool
Prelude.Eq, ReadPrec [GetIdentityPolicies]
ReadPrec GetIdentityPolicies
Int -> ReadS GetIdentityPolicies
ReadS [GetIdentityPolicies]
(Int -> ReadS GetIdentityPolicies)
-> ReadS [GetIdentityPolicies]
-> ReadPrec GetIdentityPolicies
-> ReadPrec [GetIdentityPolicies]
-> Read GetIdentityPolicies
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetIdentityPolicies]
$creadListPrec :: ReadPrec [GetIdentityPolicies]
readPrec :: ReadPrec GetIdentityPolicies
$creadPrec :: ReadPrec GetIdentityPolicies
readList :: ReadS [GetIdentityPolicies]
$creadList :: ReadS [GetIdentityPolicies]
readsPrec :: Int -> ReadS GetIdentityPolicies
$creadsPrec :: Int -> ReadS GetIdentityPolicies
Prelude.Read, Int -> GetIdentityPolicies -> ShowS
[GetIdentityPolicies] -> ShowS
GetIdentityPolicies -> String
(Int -> GetIdentityPolicies -> ShowS)
-> (GetIdentityPolicies -> String)
-> ([GetIdentityPolicies] -> ShowS)
-> Show GetIdentityPolicies
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetIdentityPolicies] -> ShowS
$cshowList :: [GetIdentityPolicies] -> ShowS
show :: GetIdentityPolicies -> String
$cshow :: GetIdentityPolicies -> String
showsPrec :: Int -> GetIdentityPolicies -> ShowS
$cshowsPrec :: Int -> GetIdentityPolicies -> ShowS
Prelude.Show, (forall x. GetIdentityPolicies -> Rep GetIdentityPolicies x)
-> (forall x. Rep GetIdentityPolicies x -> GetIdentityPolicies)
-> Generic GetIdentityPolicies
forall x. Rep GetIdentityPolicies x -> GetIdentityPolicies
forall x. GetIdentityPolicies -> Rep GetIdentityPolicies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetIdentityPolicies x -> GetIdentityPolicies
$cfrom :: forall x. GetIdentityPolicies -> Rep GetIdentityPolicies x
Prelude.Generic)
newGetIdentityPolicies ::
Prelude.Text ->
GetIdentityPolicies
newGetIdentityPolicies :: Text -> GetIdentityPolicies
newGetIdentityPolicies Text
pIdentity_ =
GetIdentityPolicies' :: Text -> [Text] -> GetIdentityPolicies
GetIdentityPolicies'
{ $sel:identity:GetIdentityPolicies' :: Text
identity = Text
pIdentity_,
$sel:policyNames:GetIdentityPolicies' :: [Text]
policyNames = [Text]
forall a. Monoid a => a
Prelude.mempty
}
getIdentityPolicies_identity :: Lens.Lens' GetIdentityPolicies Prelude.Text
getIdentityPolicies_identity :: (Text -> f Text) -> GetIdentityPolicies -> f GetIdentityPolicies
getIdentityPolicies_identity = (GetIdentityPolicies -> Text)
-> (GetIdentityPolicies -> Text -> GetIdentityPolicies)
-> Lens GetIdentityPolicies GetIdentityPolicies Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIdentityPolicies' {Text
identity :: Text
$sel:identity:GetIdentityPolicies' :: GetIdentityPolicies -> Text
identity} -> Text
identity) (\s :: GetIdentityPolicies
s@GetIdentityPolicies' {} Text
a -> GetIdentityPolicies
s {$sel:identity:GetIdentityPolicies' :: Text
identity = Text
a} :: GetIdentityPolicies)
getIdentityPolicies_policyNames :: Lens.Lens' GetIdentityPolicies [Prelude.Text]
getIdentityPolicies_policyNames :: ([Text] -> f [Text])
-> GetIdentityPolicies -> f GetIdentityPolicies
getIdentityPolicies_policyNames = (GetIdentityPolicies -> [Text])
-> (GetIdentityPolicies -> [Text] -> GetIdentityPolicies)
-> Lens GetIdentityPolicies GetIdentityPolicies [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIdentityPolicies' {[Text]
policyNames :: [Text]
$sel:policyNames:GetIdentityPolicies' :: GetIdentityPolicies -> [Text]
policyNames} -> [Text]
policyNames) (\s :: GetIdentityPolicies
s@GetIdentityPolicies' {} [Text]
a -> GetIdentityPolicies
s {$sel:policyNames:GetIdentityPolicies' :: [Text]
policyNames = [Text]
a} :: GetIdentityPolicies) (([Text] -> f [Text])
-> GetIdentityPolicies -> f GetIdentityPolicies)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> GetIdentityPolicies
-> f GetIdentityPolicies
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest GetIdentityPolicies where
type
AWSResponse GetIdentityPolicies =
GetIdentityPoliciesResponse
request :: GetIdentityPolicies -> Request GetIdentityPolicies
request = Service -> GetIdentityPolicies -> Request GetIdentityPolicies
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetIdentityPolicies
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetIdentityPolicies)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetIdentityPolicies))
-> Logger
-> Service
-> Proxy GetIdentityPolicies
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetIdentityPolicies)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"GetIdentityPoliciesResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> HashMap Text Text -> GetIdentityPoliciesResponse
GetIdentityPoliciesResponse'
(Int -> HashMap Text Text -> GetIdentityPoliciesResponse)
-> Either String Int
-> Either String (HashMap Text Text -> GetIdentityPoliciesResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (HashMap Text Text -> GetIdentityPoliciesResponse)
-> Either String (HashMap Text Text)
-> Either String GetIdentityPoliciesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Policies" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (HashMap Text Text))
-> Either String (HashMap Text Text)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= Text -> Text -> Text -> [Node] -> Either String (HashMap Text Text)
forall k v.
(Eq k, Hashable k, FromText k, FromXML v) =>
Text -> Text -> Text -> [Node] -> Either String (HashMap k v)
Core.parseXMLMap Text
"entry" Text
"key" Text
"value"
)
)
instance Prelude.Hashable GetIdentityPolicies
instance Prelude.NFData GetIdentityPolicies
instance Core.ToHeaders GetIdentityPolicies where
toHeaders :: GetIdentityPolicies -> ResponseHeaders
toHeaders = ResponseHeaders -> GetIdentityPolicies -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetIdentityPolicies where
toPath :: GetIdentityPolicies -> ByteString
toPath = ByteString -> GetIdentityPolicies -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetIdentityPolicies where
toQuery :: GetIdentityPolicies -> QueryString
toQuery GetIdentityPolicies' {[Text]
Text
policyNames :: [Text]
identity :: Text
$sel:policyNames:GetIdentityPolicies' :: GetIdentityPolicies -> [Text]
$sel:identity:GetIdentityPolicies' :: GetIdentityPolicies -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"GetIdentityPolicies" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
ByteString
"Identity" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
identity,
ByteString
"PolicyNames"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" [Text]
policyNames
]
data GetIdentityPoliciesResponse = GetIdentityPoliciesResponse'
{
GetIdentityPoliciesResponse -> Int
httpStatus :: Prelude.Int,
GetIdentityPoliciesResponse -> HashMap Text Text
policies :: Prelude.HashMap Prelude.Text Prelude.Text
}
deriving (GetIdentityPoliciesResponse -> GetIdentityPoliciesResponse -> Bool
(GetIdentityPoliciesResponse
-> GetIdentityPoliciesResponse -> Bool)
-> (GetIdentityPoliciesResponse
-> GetIdentityPoliciesResponse -> Bool)
-> Eq GetIdentityPoliciesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetIdentityPoliciesResponse -> GetIdentityPoliciesResponse -> Bool
$c/= :: GetIdentityPoliciesResponse -> GetIdentityPoliciesResponse -> Bool
== :: GetIdentityPoliciesResponse -> GetIdentityPoliciesResponse -> Bool
$c== :: GetIdentityPoliciesResponse -> GetIdentityPoliciesResponse -> Bool
Prelude.Eq, ReadPrec [GetIdentityPoliciesResponse]
ReadPrec GetIdentityPoliciesResponse
Int -> ReadS GetIdentityPoliciesResponse
ReadS [GetIdentityPoliciesResponse]
(Int -> ReadS GetIdentityPoliciesResponse)
-> ReadS [GetIdentityPoliciesResponse]
-> ReadPrec GetIdentityPoliciesResponse
-> ReadPrec [GetIdentityPoliciesResponse]
-> Read GetIdentityPoliciesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetIdentityPoliciesResponse]
$creadListPrec :: ReadPrec [GetIdentityPoliciesResponse]
readPrec :: ReadPrec GetIdentityPoliciesResponse
$creadPrec :: ReadPrec GetIdentityPoliciesResponse
readList :: ReadS [GetIdentityPoliciesResponse]
$creadList :: ReadS [GetIdentityPoliciesResponse]
readsPrec :: Int -> ReadS GetIdentityPoliciesResponse
$creadsPrec :: Int -> ReadS GetIdentityPoliciesResponse
Prelude.Read, Int -> GetIdentityPoliciesResponse -> ShowS
[GetIdentityPoliciesResponse] -> ShowS
GetIdentityPoliciesResponse -> String
(Int -> GetIdentityPoliciesResponse -> ShowS)
-> (GetIdentityPoliciesResponse -> String)
-> ([GetIdentityPoliciesResponse] -> ShowS)
-> Show GetIdentityPoliciesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetIdentityPoliciesResponse] -> ShowS
$cshowList :: [GetIdentityPoliciesResponse] -> ShowS
show :: GetIdentityPoliciesResponse -> String
$cshow :: GetIdentityPoliciesResponse -> String
showsPrec :: Int -> GetIdentityPoliciesResponse -> ShowS
$cshowsPrec :: Int -> GetIdentityPoliciesResponse -> ShowS
Prelude.Show, (forall x.
GetIdentityPoliciesResponse -> Rep GetIdentityPoliciesResponse x)
-> (forall x.
Rep GetIdentityPoliciesResponse x -> GetIdentityPoliciesResponse)
-> Generic GetIdentityPoliciesResponse
forall x.
Rep GetIdentityPoliciesResponse x -> GetIdentityPoliciesResponse
forall x.
GetIdentityPoliciesResponse -> Rep GetIdentityPoliciesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetIdentityPoliciesResponse x -> GetIdentityPoliciesResponse
$cfrom :: forall x.
GetIdentityPoliciesResponse -> Rep GetIdentityPoliciesResponse x
Prelude.Generic)
newGetIdentityPoliciesResponse ::
Prelude.Int ->
GetIdentityPoliciesResponse
newGetIdentityPoliciesResponse :: Int -> GetIdentityPoliciesResponse
newGetIdentityPoliciesResponse Int
pHttpStatus_ =
GetIdentityPoliciesResponse' :: Int -> HashMap Text Text -> GetIdentityPoliciesResponse
GetIdentityPoliciesResponse'
{ $sel:httpStatus:GetIdentityPoliciesResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:policies:GetIdentityPoliciesResponse' :: HashMap Text Text
policies = HashMap Text Text
forall a. Monoid a => a
Prelude.mempty
}
getIdentityPoliciesResponse_httpStatus :: Lens.Lens' GetIdentityPoliciesResponse Prelude.Int
getIdentityPoliciesResponse_httpStatus :: (Int -> f Int)
-> GetIdentityPoliciesResponse -> f GetIdentityPoliciesResponse
getIdentityPoliciesResponse_httpStatus = (GetIdentityPoliciesResponse -> Int)
-> (GetIdentityPoliciesResponse
-> Int -> GetIdentityPoliciesResponse)
-> Lens
GetIdentityPoliciesResponse GetIdentityPoliciesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIdentityPoliciesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetIdentityPoliciesResponse' :: GetIdentityPoliciesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetIdentityPoliciesResponse
s@GetIdentityPoliciesResponse' {} Int
a -> GetIdentityPoliciesResponse
s {$sel:httpStatus:GetIdentityPoliciesResponse' :: Int
httpStatus = Int
a} :: GetIdentityPoliciesResponse)
getIdentityPoliciesResponse_policies :: Lens.Lens' GetIdentityPoliciesResponse (Prelude.HashMap Prelude.Text Prelude.Text)
getIdentityPoliciesResponse_policies :: (HashMap Text Text -> f (HashMap Text Text))
-> GetIdentityPoliciesResponse -> f GetIdentityPoliciesResponse
getIdentityPoliciesResponse_policies = (GetIdentityPoliciesResponse -> HashMap Text Text)
-> (GetIdentityPoliciesResponse
-> HashMap Text Text -> GetIdentityPoliciesResponse)
-> Lens
GetIdentityPoliciesResponse
GetIdentityPoliciesResponse
(HashMap Text Text)
(HashMap Text Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIdentityPoliciesResponse' {HashMap Text Text
policies :: HashMap Text Text
$sel:policies:GetIdentityPoliciesResponse' :: GetIdentityPoliciesResponse -> HashMap Text Text
policies} -> HashMap Text Text
policies) (\s :: GetIdentityPoliciesResponse
s@GetIdentityPoliciesResponse' {} HashMap Text Text
a -> GetIdentityPoliciesResponse
s {$sel:policies:GetIdentityPoliciesResponse' :: HashMap Text Text
policies = HashMap Text Text
a} :: GetIdentityPoliciesResponse) ((HashMap Text Text -> f (HashMap Text Text))
-> GetIdentityPoliciesResponse -> f GetIdentityPoliciesResponse)
-> ((HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> GetIdentityPoliciesResponse
-> f GetIdentityPoliciesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData GetIdentityPoliciesResponse