{-# 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.CreateServiceLinkedRole
(
CreateServiceLinkedRole (..),
newCreateServiceLinkedRole,
createServiceLinkedRole_customSuffix,
createServiceLinkedRole_description,
createServiceLinkedRole_aWSServiceName,
CreateServiceLinkedRoleResponse (..),
newCreateServiceLinkedRoleResponse,
createServiceLinkedRoleResponse_role,
createServiceLinkedRoleResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IAM.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateServiceLinkedRole = CreateServiceLinkedRole'
{
CreateServiceLinkedRole -> Maybe Text
customSuffix :: Prelude.Maybe Prelude.Text,
CreateServiceLinkedRole -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateServiceLinkedRole -> Text
aWSServiceName :: Prelude.Text
}
deriving (CreateServiceLinkedRole -> CreateServiceLinkedRole -> Bool
(CreateServiceLinkedRole -> CreateServiceLinkedRole -> Bool)
-> (CreateServiceLinkedRole -> CreateServiceLinkedRole -> Bool)
-> Eq CreateServiceLinkedRole
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateServiceLinkedRole -> CreateServiceLinkedRole -> Bool
$c/= :: CreateServiceLinkedRole -> CreateServiceLinkedRole -> Bool
== :: CreateServiceLinkedRole -> CreateServiceLinkedRole -> Bool
$c== :: CreateServiceLinkedRole -> CreateServiceLinkedRole -> Bool
Prelude.Eq, ReadPrec [CreateServiceLinkedRole]
ReadPrec CreateServiceLinkedRole
Int -> ReadS CreateServiceLinkedRole
ReadS [CreateServiceLinkedRole]
(Int -> ReadS CreateServiceLinkedRole)
-> ReadS [CreateServiceLinkedRole]
-> ReadPrec CreateServiceLinkedRole
-> ReadPrec [CreateServiceLinkedRole]
-> Read CreateServiceLinkedRole
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateServiceLinkedRole]
$creadListPrec :: ReadPrec [CreateServiceLinkedRole]
readPrec :: ReadPrec CreateServiceLinkedRole
$creadPrec :: ReadPrec CreateServiceLinkedRole
readList :: ReadS [CreateServiceLinkedRole]
$creadList :: ReadS [CreateServiceLinkedRole]
readsPrec :: Int -> ReadS CreateServiceLinkedRole
$creadsPrec :: Int -> ReadS CreateServiceLinkedRole
Prelude.Read, Int -> CreateServiceLinkedRole -> ShowS
[CreateServiceLinkedRole] -> ShowS
CreateServiceLinkedRole -> String
(Int -> CreateServiceLinkedRole -> ShowS)
-> (CreateServiceLinkedRole -> String)
-> ([CreateServiceLinkedRole] -> ShowS)
-> Show CreateServiceLinkedRole
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateServiceLinkedRole] -> ShowS
$cshowList :: [CreateServiceLinkedRole] -> ShowS
show :: CreateServiceLinkedRole -> String
$cshow :: CreateServiceLinkedRole -> String
showsPrec :: Int -> CreateServiceLinkedRole -> ShowS
$cshowsPrec :: Int -> CreateServiceLinkedRole -> ShowS
Prelude.Show, (forall x.
CreateServiceLinkedRole -> Rep CreateServiceLinkedRole x)
-> (forall x.
Rep CreateServiceLinkedRole x -> CreateServiceLinkedRole)
-> Generic CreateServiceLinkedRole
forall x. Rep CreateServiceLinkedRole x -> CreateServiceLinkedRole
forall x. CreateServiceLinkedRole -> Rep CreateServiceLinkedRole x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateServiceLinkedRole x -> CreateServiceLinkedRole
$cfrom :: forall x. CreateServiceLinkedRole -> Rep CreateServiceLinkedRole x
Prelude.Generic)
newCreateServiceLinkedRole ::
Prelude.Text ->
CreateServiceLinkedRole
newCreateServiceLinkedRole :: Text -> CreateServiceLinkedRole
newCreateServiceLinkedRole Text
pAWSServiceName_ =
CreateServiceLinkedRole' :: Maybe Text -> Maybe Text -> Text -> CreateServiceLinkedRole
CreateServiceLinkedRole'
{ $sel:customSuffix:CreateServiceLinkedRole' :: Maybe Text
customSuffix =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:CreateServiceLinkedRole' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:aWSServiceName:CreateServiceLinkedRole' :: Text
aWSServiceName = Text
pAWSServiceName_
}
createServiceLinkedRole_customSuffix :: Lens.Lens' CreateServiceLinkedRole (Prelude.Maybe Prelude.Text)
createServiceLinkedRole_customSuffix :: (Maybe Text -> f (Maybe Text))
-> CreateServiceLinkedRole -> f CreateServiceLinkedRole
createServiceLinkedRole_customSuffix = (CreateServiceLinkedRole -> Maybe Text)
-> (CreateServiceLinkedRole
-> Maybe Text -> CreateServiceLinkedRole)
-> Lens
CreateServiceLinkedRole
CreateServiceLinkedRole
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceLinkedRole' {Maybe Text
customSuffix :: Maybe Text
$sel:customSuffix:CreateServiceLinkedRole' :: CreateServiceLinkedRole -> Maybe Text
customSuffix} -> Maybe Text
customSuffix) (\s :: CreateServiceLinkedRole
s@CreateServiceLinkedRole' {} Maybe Text
a -> CreateServiceLinkedRole
s {$sel:customSuffix:CreateServiceLinkedRole' :: Maybe Text
customSuffix = Maybe Text
a} :: CreateServiceLinkedRole)
createServiceLinkedRole_description :: Lens.Lens' CreateServiceLinkedRole (Prelude.Maybe Prelude.Text)
createServiceLinkedRole_description :: (Maybe Text -> f (Maybe Text))
-> CreateServiceLinkedRole -> f CreateServiceLinkedRole
createServiceLinkedRole_description = (CreateServiceLinkedRole -> Maybe Text)
-> (CreateServiceLinkedRole
-> Maybe Text -> CreateServiceLinkedRole)
-> Lens
CreateServiceLinkedRole
CreateServiceLinkedRole
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceLinkedRole' {Maybe Text
description :: Maybe Text
$sel:description:CreateServiceLinkedRole' :: CreateServiceLinkedRole -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateServiceLinkedRole
s@CreateServiceLinkedRole' {} Maybe Text
a -> CreateServiceLinkedRole
s {$sel:description:CreateServiceLinkedRole' :: Maybe Text
description = Maybe Text
a} :: CreateServiceLinkedRole)
createServiceLinkedRole_aWSServiceName :: Lens.Lens' CreateServiceLinkedRole Prelude.Text
createServiceLinkedRole_aWSServiceName :: (Text -> f Text)
-> CreateServiceLinkedRole -> f CreateServiceLinkedRole
createServiceLinkedRole_aWSServiceName = (CreateServiceLinkedRole -> Text)
-> (CreateServiceLinkedRole -> Text -> CreateServiceLinkedRole)
-> Lens CreateServiceLinkedRole CreateServiceLinkedRole Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceLinkedRole' {Text
aWSServiceName :: Text
$sel:aWSServiceName:CreateServiceLinkedRole' :: CreateServiceLinkedRole -> Text
aWSServiceName} -> Text
aWSServiceName) (\s :: CreateServiceLinkedRole
s@CreateServiceLinkedRole' {} Text
a -> CreateServiceLinkedRole
s {$sel:aWSServiceName:CreateServiceLinkedRole' :: Text
aWSServiceName = Text
a} :: CreateServiceLinkedRole)
instance Core.AWSRequest CreateServiceLinkedRole where
type
AWSResponse CreateServiceLinkedRole =
CreateServiceLinkedRoleResponse
request :: CreateServiceLinkedRole -> Request CreateServiceLinkedRole
request = Service
-> CreateServiceLinkedRole -> Request CreateServiceLinkedRole
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy CreateServiceLinkedRole
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateServiceLinkedRole)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateServiceLinkedRole))
-> Logger
-> Service
-> Proxy CreateServiceLinkedRole
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateServiceLinkedRole)))
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
"CreateServiceLinkedRoleResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Role -> Int -> CreateServiceLinkedRoleResponse
CreateServiceLinkedRoleResponse'
(Maybe Role -> Int -> CreateServiceLinkedRoleResponse)
-> Either String (Maybe Role)
-> Either String (Int -> CreateServiceLinkedRoleResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Role)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Role")
Either String (Int -> CreateServiceLinkedRoleResponse)
-> Either String Int
-> Either String CreateServiceLinkedRoleResponse
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 CreateServiceLinkedRole
instance Prelude.NFData CreateServiceLinkedRole
instance Core.ToHeaders CreateServiceLinkedRole where
toHeaders :: CreateServiceLinkedRole -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateServiceLinkedRole -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateServiceLinkedRole where
toPath :: CreateServiceLinkedRole -> ByteString
toPath = ByteString -> CreateServiceLinkedRole -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateServiceLinkedRole where
toQuery :: CreateServiceLinkedRole -> QueryString
toQuery CreateServiceLinkedRole' {Maybe Text
Text
aWSServiceName :: Text
description :: Maybe Text
customSuffix :: Maybe Text
$sel:aWSServiceName:CreateServiceLinkedRole' :: CreateServiceLinkedRole -> Text
$sel:description:CreateServiceLinkedRole' :: CreateServiceLinkedRole -> Maybe Text
$sel:customSuffix:CreateServiceLinkedRole' :: CreateServiceLinkedRole -> Maybe 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
"CreateServiceLinkedRole" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
ByteString
"CustomSuffix" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
customSuffix,
ByteString
"Description" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
description,
ByteString
"AWSServiceName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
aWSServiceName
]
data CreateServiceLinkedRoleResponse = CreateServiceLinkedRoleResponse'
{
CreateServiceLinkedRoleResponse -> Maybe Role
role' :: Prelude.Maybe Role,
CreateServiceLinkedRoleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateServiceLinkedRoleResponse
-> CreateServiceLinkedRoleResponse -> Bool
(CreateServiceLinkedRoleResponse
-> CreateServiceLinkedRoleResponse -> Bool)
-> (CreateServiceLinkedRoleResponse
-> CreateServiceLinkedRoleResponse -> Bool)
-> Eq CreateServiceLinkedRoleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateServiceLinkedRoleResponse
-> CreateServiceLinkedRoleResponse -> Bool
$c/= :: CreateServiceLinkedRoleResponse
-> CreateServiceLinkedRoleResponse -> Bool
== :: CreateServiceLinkedRoleResponse
-> CreateServiceLinkedRoleResponse -> Bool
$c== :: CreateServiceLinkedRoleResponse
-> CreateServiceLinkedRoleResponse -> Bool
Prelude.Eq, ReadPrec [CreateServiceLinkedRoleResponse]
ReadPrec CreateServiceLinkedRoleResponse
Int -> ReadS CreateServiceLinkedRoleResponse
ReadS [CreateServiceLinkedRoleResponse]
(Int -> ReadS CreateServiceLinkedRoleResponse)
-> ReadS [CreateServiceLinkedRoleResponse]
-> ReadPrec CreateServiceLinkedRoleResponse
-> ReadPrec [CreateServiceLinkedRoleResponse]
-> Read CreateServiceLinkedRoleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateServiceLinkedRoleResponse]
$creadListPrec :: ReadPrec [CreateServiceLinkedRoleResponse]
readPrec :: ReadPrec CreateServiceLinkedRoleResponse
$creadPrec :: ReadPrec CreateServiceLinkedRoleResponse
readList :: ReadS [CreateServiceLinkedRoleResponse]
$creadList :: ReadS [CreateServiceLinkedRoleResponse]
readsPrec :: Int -> ReadS CreateServiceLinkedRoleResponse
$creadsPrec :: Int -> ReadS CreateServiceLinkedRoleResponse
Prelude.Read, Int -> CreateServiceLinkedRoleResponse -> ShowS
[CreateServiceLinkedRoleResponse] -> ShowS
CreateServiceLinkedRoleResponse -> String
(Int -> CreateServiceLinkedRoleResponse -> ShowS)
-> (CreateServiceLinkedRoleResponse -> String)
-> ([CreateServiceLinkedRoleResponse] -> ShowS)
-> Show CreateServiceLinkedRoleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateServiceLinkedRoleResponse] -> ShowS
$cshowList :: [CreateServiceLinkedRoleResponse] -> ShowS
show :: CreateServiceLinkedRoleResponse -> String
$cshow :: CreateServiceLinkedRoleResponse -> String
showsPrec :: Int -> CreateServiceLinkedRoleResponse -> ShowS
$cshowsPrec :: Int -> CreateServiceLinkedRoleResponse -> ShowS
Prelude.Show, (forall x.
CreateServiceLinkedRoleResponse
-> Rep CreateServiceLinkedRoleResponse x)
-> (forall x.
Rep CreateServiceLinkedRoleResponse x
-> CreateServiceLinkedRoleResponse)
-> Generic CreateServiceLinkedRoleResponse
forall x.
Rep CreateServiceLinkedRoleResponse x
-> CreateServiceLinkedRoleResponse
forall x.
CreateServiceLinkedRoleResponse
-> Rep CreateServiceLinkedRoleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateServiceLinkedRoleResponse x
-> CreateServiceLinkedRoleResponse
$cfrom :: forall x.
CreateServiceLinkedRoleResponse
-> Rep CreateServiceLinkedRoleResponse x
Prelude.Generic)
newCreateServiceLinkedRoleResponse ::
Prelude.Int ->
CreateServiceLinkedRoleResponse
newCreateServiceLinkedRoleResponse :: Int -> CreateServiceLinkedRoleResponse
newCreateServiceLinkedRoleResponse Int
pHttpStatus_ =
CreateServiceLinkedRoleResponse' :: Maybe Role -> Int -> CreateServiceLinkedRoleResponse
CreateServiceLinkedRoleResponse'
{ $sel:role':CreateServiceLinkedRoleResponse' :: Maybe Role
role' =
Maybe Role
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateServiceLinkedRoleResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createServiceLinkedRoleResponse_role :: Lens.Lens' CreateServiceLinkedRoleResponse (Prelude.Maybe Role)
createServiceLinkedRoleResponse_role :: (Maybe Role -> f (Maybe Role))
-> CreateServiceLinkedRoleResponse
-> f CreateServiceLinkedRoleResponse
createServiceLinkedRoleResponse_role = (CreateServiceLinkedRoleResponse -> Maybe Role)
-> (CreateServiceLinkedRoleResponse
-> Maybe Role -> CreateServiceLinkedRoleResponse)
-> Lens
CreateServiceLinkedRoleResponse
CreateServiceLinkedRoleResponse
(Maybe Role)
(Maybe Role)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceLinkedRoleResponse' {Maybe Role
role' :: Maybe Role
$sel:role':CreateServiceLinkedRoleResponse' :: CreateServiceLinkedRoleResponse -> Maybe Role
role'} -> Maybe Role
role') (\s :: CreateServiceLinkedRoleResponse
s@CreateServiceLinkedRoleResponse' {} Maybe Role
a -> CreateServiceLinkedRoleResponse
s {$sel:role':CreateServiceLinkedRoleResponse' :: Maybe Role
role' = Maybe Role
a} :: CreateServiceLinkedRoleResponse)
createServiceLinkedRoleResponse_httpStatus :: Lens.Lens' CreateServiceLinkedRoleResponse Prelude.Int
createServiceLinkedRoleResponse_httpStatus :: (Int -> f Int)
-> CreateServiceLinkedRoleResponse
-> f CreateServiceLinkedRoleResponse
createServiceLinkedRoleResponse_httpStatus = (CreateServiceLinkedRoleResponse -> Int)
-> (CreateServiceLinkedRoleResponse
-> Int -> CreateServiceLinkedRoleResponse)
-> Lens
CreateServiceLinkedRoleResponse
CreateServiceLinkedRoleResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceLinkedRoleResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateServiceLinkedRoleResponse' :: CreateServiceLinkedRoleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateServiceLinkedRoleResponse
s@CreateServiceLinkedRoleResponse' {} Int
a -> CreateServiceLinkedRoleResponse
s {$sel:httpStatus:CreateServiceLinkedRoleResponse' :: Int
httpStatus = Int
a} :: CreateServiceLinkedRoleResponse)
instance
Prelude.NFData
CreateServiceLinkedRoleResponse