{-# 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.CreateLoginProfile
(
CreateLoginProfile (..),
newCreateLoginProfile,
createLoginProfile_passwordResetRequired,
createLoginProfile_userName,
createLoginProfile_password,
CreateLoginProfileResponse (..),
newCreateLoginProfileResponse,
createLoginProfileResponse_httpStatus,
createLoginProfileResponse_loginProfile,
)
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 CreateLoginProfile = CreateLoginProfile'
{
CreateLoginProfile -> Maybe Bool
passwordResetRequired :: Prelude.Maybe Prelude.Bool,
CreateLoginProfile -> Text
userName :: Prelude.Text,
CreateLoginProfile -> Sensitive Text
password :: Core.Sensitive Prelude.Text
}
deriving (CreateLoginProfile -> CreateLoginProfile -> Bool
(CreateLoginProfile -> CreateLoginProfile -> Bool)
-> (CreateLoginProfile -> CreateLoginProfile -> Bool)
-> Eq CreateLoginProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLoginProfile -> CreateLoginProfile -> Bool
$c/= :: CreateLoginProfile -> CreateLoginProfile -> Bool
== :: CreateLoginProfile -> CreateLoginProfile -> Bool
$c== :: CreateLoginProfile -> CreateLoginProfile -> Bool
Prelude.Eq, Int -> CreateLoginProfile -> ShowS
[CreateLoginProfile] -> ShowS
CreateLoginProfile -> String
(Int -> CreateLoginProfile -> ShowS)
-> (CreateLoginProfile -> String)
-> ([CreateLoginProfile] -> ShowS)
-> Show CreateLoginProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLoginProfile] -> ShowS
$cshowList :: [CreateLoginProfile] -> ShowS
show :: CreateLoginProfile -> String
$cshow :: CreateLoginProfile -> String
showsPrec :: Int -> CreateLoginProfile -> ShowS
$cshowsPrec :: Int -> CreateLoginProfile -> ShowS
Prelude.Show, (forall x. CreateLoginProfile -> Rep CreateLoginProfile x)
-> (forall x. Rep CreateLoginProfile x -> CreateLoginProfile)
-> Generic CreateLoginProfile
forall x. Rep CreateLoginProfile x -> CreateLoginProfile
forall x. CreateLoginProfile -> Rep CreateLoginProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLoginProfile x -> CreateLoginProfile
$cfrom :: forall x. CreateLoginProfile -> Rep CreateLoginProfile x
Prelude.Generic)
newCreateLoginProfile ::
Prelude.Text ->
Prelude.Text ->
CreateLoginProfile
newCreateLoginProfile :: Text -> Text -> CreateLoginProfile
newCreateLoginProfile Text
pUserName_ Text
pPassword_ =
CreateLoginProfile' :: Maybe Bool -> Text -> Sensitive Text -> CreateLoginProfile
CreateLoginProfile'
{ $sel:passwordResetRequired:CreateLoginProfile' :: Maybe Bool
passwordResetRequired =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:userName:CreateLoginProfile' :: Text
userName = Text
pUserName_,
$sel:password:CreateLoginProfile' :: Sensitive Text
password = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pPassword_
}
createLoginProfile_passwordResetRequired :: Lens.Lens' CreateLoginProfile (Prelude.Maybe Prelude.Bool)
createLoginProfile_passwordResetRequired :: (Maybe Bool -> f (Maybe Bool))
-> CreateLoginProfile -> f CreateLoginProfile
createLoginProfile_passwordResetRequired = (CreateLoginProfile -> Maybe Bool)
-> (CreateLoginProfile -> Maybe Bool -> CreateLoginProfile)
-> Lens
CreateLoginProfile CreateLoginProfile (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoginProfile' {Maybe Bool
passwordResetRequired :: Maybe Bool
$sel:passwordResetRequired:CreateLoginProfile' :: CreateLoginProfile -> Maybe Bool
passwordResetRequired} -> Maybe Bool
passwordResetRequired) (\s :: CreateLoginProfile
s@CreateLoginProfile' {} Maybe Bool
a -> CreateLoginProfile
s {$sel:passwordResetRequired:CreateLoginProfile' :: Maybe Bool
passwordResetRequired = Maybe Bool
a} :: CreateLoginProfile)
createLoginProfile_userName :: Lens.Lens' CreateLoginProfile Prelude.Text
createLoginProfile_userName :: (Text -> f Text) -> CreateLoginProfile -> f CreateLoginProfile
createLoginProfile_userName = (CreateLoginProfile -> Text)
-> (CreateLoginProfile -> Text -> CreateLoginProfile)
-> Lens CreateLoginProfile CreateLoginProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoginProfile' {Text
userName :: Text
$sel:userName:CreateLoginProfile' :: CreateLoginProfile -> Text
userName} -> Text
userName) (\s :: CreateLoginProfile
s@CreateLoginProfile' {} Text
a -> CreateLoginProfile
s {$sel:userName:CreateLoginProfile' :: Text
userName = Text
a} :: CreateLoginProfile)
createLoginProfile_password :: Lens.Lens' CreateLoginProfile Prelude.Text
createLoginProfile_password :: (Text -> f Text) -> CreateLoginProfile -> f CreateLoginProfile
createLoginProfile_password = (CreateLoginProfile -> Sensitive Text)
-> (CreateLoginProfile -> Sensitive Text -> CreateLoginProfile)
-> Lens
CreateLoginProfile
CreateLoginProfile
(Sensitive Text)
(Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoginProfile' {Sensitive Text
password :: Sensitive Text
$sel:password:CreateLoginProfile' :: CreateLoginProfile -> Sensitive Text
password} -> Sensitive Text
password) (\s :: CreateLoginProfile
s@CreateLoginProfile' {} Sensitive Text
a -> CreateLoginProfile
s {$sel:password:CreateLoginProfile' :: Sensitive Text
password = Sensitive Text
a} :: CreateLoginProfile) ((Sensitive Text -> f (Sensitive Text))
-> CreateLoginProfile -> f CreateLoginProfile)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> CreateLoginProfile
-> f CreateLoginProfile
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive
instance Core.AWSRequest CreateLoginProfile where
type
AWSResponse CreateLoginProfile =
CreateLoginProfileResponse
request :: CreateLoginProfile -> Request CreateLoginProfile
request = Service -> CreateLoginProfile -> Request CreateLoginProfile
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy CreateLoginProfile
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateLoginProfile)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateLoginProfile))
-> Logger
-> Service
-> Proxy CreateLoginProfile
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateLoginProfile)))
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
"CreateLoginProfileResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> LoginProfile -> CreateLoginProfileResponse
CreateLoginProfileResponse'
(Int -> LoginProfile -> CreateLoginProfileResponse)
-> Either String Int
-> Either String (LoginProfile -> CreateLoginProfileResponse)
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 (LoginProfile -> CreateLoginProfileResponse)
-> Either String LoginProfile
-> Either String CreateLoginProfileResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String LoginProfile
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"LoginProfile")
)
instance Prelude.Hashable CreateLoginProfile
instance Prelude.NFData CreateLoginProfile
instance Core.ToHeaders CreateLoginProfile where
toHeaders :: CreateLoginProfile -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateLoginProfile -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateLoginProfile where
toPath :: CreateLoginProfile -> ByteString
toPath = ByteString -> CreateLoginProfile -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateLoginProfile where
toQuery :: CreateLoginProfile -> QueryString
toQuery CreateLoginProfile' {Maybe Bool
Text
Sensitive Text
password :: Sensitive Text
userName :: Text
passwordResetRequired :: Maybe Bool
$sel:password:CreateLoginProfile' :: CreateLoginProfile -> Sensitive Text
$sel:userName:CreateLoginProfile' :: CreateLoginProfile -> Text
$sel:passwordResetRequired:CreateLoginProfile' :: CreateLoginProfile -> Maybe Bool
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"CreateLoginProfile" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
ByteString
"PasswordResetRequired"
ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
passwordResetRequired,
ByteString
"UserName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
userName,
ByteString
"Password" ByteString -> Sensitive Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Sensitive Text
password
]
data CreateLoginProfileResponse = CreateLoginProfileResponse'
{
CreateLoginProfileResponse -> Int
httpStatus :: Prelude.Int,
CreateLoginProfileResponse -> LoginProfile
loginProfile :: LoginProfile
}
deriving (CreateLoginProfileResponse -> CreateLoginProfileResponse -> Bool
(CreateLoginProfileResponse -> CreateLoginProfileResponse -> Bool)
-> (CreateLoginProfileResponse
-> CreateLoginProfileResponse -> Bool)
-> Eq CreateLoginProfileResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLoginProfileResponse -> CreateLoginProfileResponse -> Bool
$c/= :: CreateLoginProfileResponse -> CreateLoginProfileResponse -> Bool
== :: CreateLoginProfileResponse -> CreateLoginProfileResponse -> Bool
$c== :: CreateLoginProfileResponse -> CreateLoginProfileResponse -> Bool
Prelude.Eq, ReadPrec [CreateLoginProfileResponse]
ReadPrec CreateLoginProfileResponse
Int -> ReadS CreateLoginProfileResponse
ReadS [CreateLoginProfileResponse]
(Int -> ReadS CreateLoginProfileResponse)
-> ReadS [CreateLoginProfileResponse]
-> ReadPrec CreateLoginProfileResponse
-> ReadPrec [CreateLoginProfileResponse]
-> Read CreateLoginProfileResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLoginProfileResponse]
$creadListPrec :: ReadPrec [CreateLoginProfileResponse]
readPrec :: ReadPrec CreateLoginProfileResponse
$creadPrec :: ReadPrec CreateLoginProfileResponse
readList :: ReadS [CreateLoginProfileResponse]
$creadList :: ReadS [CreateLoginProfileResponse]
readsPrec :: Int -> ReadS CreateLoginProfileResponse
$creadsPrec :: Int -> ReadS CreateLoginProfileResponse
Prelude.Read, Int -> CreateLoginProfileResponse -> ShowS
[CreateLoginProfileResponse] -> ShowS
CreateLoginProfileResponse -> String
(Int -> CreateLoginProfileResponse -> ShowS)
-> (CreateLoginProfileResponse -> String)
-> ([CreateLoginProfileResponse] -> ShowS)
-> Show CreateLoginProfileResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLoginProfileResponse] -> ShowS
$cshowList :: [CreateLoginProfileResponse] -> ShowS
show :: CreateLoginProfileResponse -> String
$cshow :: CreateLoginProfileResponse -> String
showsPrec :: Int -> CreateLoginProfileResponse -> ShowS
$cshowsPrec :: Int -> CreateLoginProfileResponse -> ShowS
Prelude.Show, (forall x.
CreateLoginProfileResponse -> Rep CreateLoginProfileResponse x)
-> (forall x.
Rep CreateLoginProfileResponse x -> CreateLoginProfileResponse)
-> Generic CreateLoginProfileResponse
forall x.
Rep CreateLoginProfileResponse x -> CreateLoginProfileResponse
forall x.
CreateLoginProfileResponse -> Rep CreateLoginProfileResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateLoginProfileResponse x -> CreateLoginProfileResponse
$cfrom :: forall x.
CreateLoginProfileResponse -> Rep CreateLoginProfileResponse x
Prelude.Generic)
newCreateLoginProfileResponse ::
Prelude.Int ->
LoginProfile ->
CreateLoginProfileResponse
newCreateLoginProfileResponse :: Int -> LoginProfile -> CreateLoginProfileResponse
newCreateLoginProfileResponse
Int
pHttpStatus_
LoginProfile
pLoginProfile_ =
CreateLoginProfileResponse' :: Int -> LoginProfile -> CreateLoginProfileResponse
CreateLoginProfileResponse'
{ $sel:httpStatus:CreateLoginProfileResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:loginProfile:CreateLoginProfileResponse' :: LoginProfile
loginProfile = LoginProfile
pLoginProfile_
}
createLoginProfileResponse_httpStatus :: Lens.Lens' CreateLoginProfileResponse Prelude.Int
createLoginProfileResponse_httpStatus :: (Int -> f Int)
-> CreateLoginProfileResponse -> f CreateLoginProfileResponse
createLoginProfileResponse_httpStatus = (CreateLoginProfileResponse -> Int)
-> (CreateLoginProfileResponse
-> Int -> CreateLoginProfileResponse)
-> Lens
CreateLoginProfileResponse CreateLoginProfileResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoginProfileResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateLoginProfileResponse' :: CreateLoginProfileResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateLoginProfileResponse
s@CreateLoginProfileResponse' {} Int
a -> CreateLoginProfileResponse
s {$sel:httpStatus:CreateLoginProfileResponse' :: Int
httpStatus = Int
a} :: CreateLoginProfileResponse)
createLoginProfileResponse_loginProfile :: Lens.Lens' CreateLoginProfileResponse LoginProfile
createLoginProfileResponse_loginProfile :: (LoginProfile -> f LoginProfile)
-> CreateLoginProfileResponse -> f CreateLoginProfileResponse
createLoginProfileResponse_loginProfile = (CreateLoginProfileResponse -> LoginProfile)
-> (CreateLoginProfileResponse
-> LoginProfile -> CreateLoginProfileResponse)
-> Lens
CreateLoginProfileResponse
CreateLoginProfileResponse
LoginProfile
LoginProfile
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoginProfileResponse' {LoginProfile
loginProfile :: LoginProfile
$sel:loginProfile:CreateLoginProfileResponse' :: CreateLoginProfileResponse -> LoginProfile
loginProfile} -> LoginProfile
loginProfile) (\s :: CreateLoginProfileResponse
s@CreateLoginProfileResponse' {} LoginProfile
a -> CreateLoginProfileResponse
s {$sel:loginProfile:CreateLoginProfileResponse' :: LoginProfile
loginProfile = LoginProfile
a} :: CreateLoginProfileResponse)
instance Prelude.NFData CreateLoginProfileResponse