{-# 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.OpsWorks.CreateUserProfile
(
CreateUserProfile (..),
newCreateUserProfile,
createUserProfile_allowSelfManagement,
createUserProfile_sshPublicKey,
createUserProfile_sshUsername,
createUserProfile_iamUserArn,
CreateUserProfileResponse (..),
newCreateUserProfileResponse,
createUserProfileResponse_iamUserArn,
createUserProfileResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorks.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateUserProfile = CreateUserProfile'
{
CreateUserProfile -> Maybe Bool
allowSelfManagement :: Prelude.Maybe Prelude.Bool,
CreateUserProfile -> Maybe Text
sshPublicKey :: Prelude.Maybe Prelude.Text,
CreateUserProfile -> Maybe Text
sshUsername :: Prelude.Maybe Prelude.Text,
CreateUserProfile -> Text
iamUserArn :: Prelude.Text
}
deriving (CreateUserProfile -> CreateUserProfile -> Bool
(CreateUserProfile -> CreateUserProfile -> Bool)
-> (CreateUserProfile -> CreateUserProfile -> Bool)
-> Eq CreateUserProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateUserProfile -> CreateUserProfile -> Bool
$c/= :: CreateUserProfile -> CreateUserProfile -> Bool
== :: CreateUserProfile -> CreateUserProfile -> Bool
$c== :: CreateUserProfile -> CreateUserProfile -> Bool
Prelude.Eq, ReadPrec [CreateUserProfile]
ReadPrec CreateUserProfile
Int -> ReadS CreateUserProfile
ReadS [CreateUserProfile]
(Int -> ReadS CreateUserProfile)
-> ReadS [CreateUserProfile]
-> ReadPrec CreateUserProfile
-> ReadPrec [CreateUserProfile]
-> Read CreateUserProfile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateUserProfile]
$creadListPrec :: ReadPrec [CreateUserProfile]
readPrec :: ReadPrec CreateUserProfile
$creadPrec :: ReadPrec CreateUserProfile
readList :: ReadS [CreateUserProfile]
$creadList :: ReadS [CreateUserProfile]
readsPrec :: Int -> ReadS CreateUserProfile
$creadsPrec :: Int -> ReadS CreateUserProfile
Prelude.Read, Int -> CreateUserProfile -> ShowS
[CreateUserProfile] -> ShowS
CreateUserProfile -> String
(Int -> CreateUserProfile -> ShowS)
-> (CreateUserProfile -> String)
-> ([CreateUserProfile] -> ShowS)
-> Show CreateUserProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateUserProfile] -> ShowS
$cshowList :: [CreateUserProfile] -> ShowS
show :: CreateUserProfile -> String
$cshow :: CreateUserProfile -> String
showsPrec :: Int -> CreateUserProfile -> ShowS
$cshowsPrec :: Int -> CreateUserProfile -> ShowS
Prelude.Show, (forall x. CreateUserProfile -> Rep CreateUserProfile x)
-> (forall x. Rep CreateUserProfile x -> CreateUserProfile)
-> Generic CreateUserProfile
forall x. Rep CreateUserProfile x -> CreateUserProfile
forall x. CreateUserProfile -> Rep CreateUserProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateUserProfile x -> CreateUserProfile
$cfrom :: forall x. CreateUserProfile -> Rep CreateUserProfile x
Prelude.Generic)
newCreateUserProfile ::
Prelude.Text ->
CreateUserProfile
newCreateUserProfile :: Text -> CreateUserProfile
newCreateUserProfile Text
pIamUserArn_ =
CreateUserProfile' :: Maybe Bool -> Maybe Text -> Maybe Text -> Text -> CreateUserProfile
CreateUserProfile'
{ $sel:allowSelfManagement:CreateUserProfile' :: Maybe Bool
allowSelfManagement =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:sshPublicKey:CreateUserProfile' :: Maybe Text
sshPublicKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sshUsername:CreateUserProfile' :: Maybe Text
sshUsername = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:iamUserArn:CreateUserProfile' :: Text
iamUserArn = Text
pIamUserArn_
}
createUserProfile_allowSelfManagement :: Lens.Lens' CreateUserProfile (Prelude.Maybe Prelude.Bool)
createUserProfile_allowSelfManagement :: (Maybe Bool -> f (Maybe Bool))
-> CreateUserProfile -> f CreateUserProfile
createUserProfile_allowSelfManagement = (CreateUserProfile -> Maybe Bool)
-> (CreateUserProfile -> Maybe Bool -> CreateUserProfile)
-> Lens
CreateUserProfile CreateUserProfile (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserProfile' {Maybe Bool
allowSelfManagement :: Maybe Bool
$sel:allowSelfManagement:CreateUserProfile' :: CreateUserProfile -> Maybe Bool
allowSelfManagement} -> Maybe Bool
allowSelfManagement) (\s :: CreateUserProfile
s@CreateUserProfile' {} Maybe Bool
a -> CreateUserProfile
s {$sel:allowSelfManagement:CreateUserProfile' :: Maybe Bool
allowSelfManagement = Maybe Bool
a} :: CreateUserProfile)
createUserProfile_sshPublicKey :: Lens.Lens' CreateUserProfile (Prelude.Maybe Prelude.Text)
createUserProfile_sshPublicKey :: (Maybe Text -> f (Maybe Text))
-> CreateUserProfile -> f CreateUserProfile
createUserProfile_sshPublicKey = (CreateUserProfile -> Maybe Text)
-> (CreateUserProfile -> Maybe Text -> CreateUserProfile)
-> Lens
CreateUserProfile CreateUserProfile (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserProfile' {Maybe Text
sshPublicKey :: Maybe Text
$sel:sshPublicKey:CreateUserProfile' :: CreateUserProfile -> Maybe Text
sshPublicKey} -> Maybe Text
sshPublicKey) (\s :: CreateUserProfile
s@CreateUserProfile' {} Maybe Text
a -> CreateUserProfile
s {$sel:sshPublicKey:CreateUserProfile' :: Maybe Text
sshPublicKey = Maybe Text
a} :: CreateUserProfile)
createUserProfile_sshUsername :: Lens.Lens' CreateUserProfile (Prelude.Maybe Prelude.Text)
createUserProfile_sshUsername :: (Maybe Text -> f (Maybe Text))
-> CreateUserProfile -> f CreateUserProfile
createUserProfile_sshUsername = (CreateUserProfile -> Maybe Text)
-> (CreateUserProfile -> Maybe Text -> CreateUserProfile)
-> Lens
CreateUserProfile CreateUserProfile (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserProfile' {Maybe Text
sshUsername :: Maybe Text
$sel:sshUsername:CreateUserProfile' :: CreateUserProfile -> Maybe Text
sshUsername} -> Maybe Text
sshUsername) (\s :: CreateUserProfile
s@CreateUserProfile' {} Maybe Text
a -> CreateUserProfile
s {$sel:sshUsername:CreateUserProfile' :: Maybe Text
sshUsername = Maybe Text
a} :: CreateUserProfile)
createUserProfile_iamUserArn :: Lens.Lens' CreateUserProfile Prelude.Text
createUserProfile_iamUserArn :: (Text -> f Text) -> CreateUserProfile -> f CreateUserProfile
createUserProfile_iamUserArn = (CreateUserProfile -> Text)
-> (CreateUserProfile -> Text -> CreateUserProfile)
-> Lens CreateUserProfile CreateUserProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserProfile' {Text
iamUserArn :: Text
$sel:iamUserArn:CreateUserProfile' :: CreateUserProfile -> Text
iamUserArn} -> Text
iamUserArn) (\s :: CreateUserProfile
s@CreateUserProfile' {} Text
a -> CreateUserProfile
s {$sel:iamUserArn:CreateUserProfile' :: Text
iamUserArn = Text
a} :: CreateUserProfile)
instance Core.AWSRequest CreateUserProfile where
type
AWSResponse CreateUserProfile =
CreateUserProfileResponse
request :: CreateUserProfile -> Request CreateUserProfile
request = Service -> CreateUserProfile -> Request CreateUserProfile
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateUserProfile
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateUserProfile)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateUserProfile))
-> Logger
-> Service
-> Proxy CreateUserProfile
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateUserProfile)))
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 Text -> Int -> CreateUserProfileResponse
CreateUserProfileResponse'
(Maybe Text -> Int -> CreateUserProfileResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateUserProfileResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"IamUserArn")
Either String (Int -> CreateUserProfileResponse)
-> Either String Int -> Either String CreateUserProfileResponse
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 CreateUserProfile
instance Prelude.NFData CreateUserProfile
instance Core.ToHeaders CreateUserProfile where
toHeaders :: CreateUserProfile -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateUserProfile -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"OpsWorks_20130218.CreateUserProfile" ::
Prelude.ByteString
),
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 CreateUserProfile where
toJSON :: CreateUserProfile -> Value
toJSON CreateUserProfile' {Maybe Bool
Maybe Text
Text
iamUserArn :: Text
sshUsername :: Maybe Text
sshPublicKey :: Maybe Text
allowSelfManagement :: Maybe Bool
$sel:iamUserArn:CreateUserProfile' :: CreateUserProfile -> Text
$sel:sshUsername:CreateUserProfile' :: CreateUserProfile -> Maybe Text
$sel:sshPublicKey:CreateUserProfile' :: CreateUserProfile -> Maybe Text
$sel:allowSelfManagement:CreateUserProfile' :: CreateUserProfile -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AllowSelfManagement" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
allowSelfManagement,
(Text
"SshPublicKey" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sshPublicKey,
(Text
"SshUsername" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sshUsername,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"IamUserArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
iamUserArn)
]
)
instance Core.ToPath CreateUserProfile where
toPath :: CreateUserProfile -> ByteString
toPath = ByteString -> CreateUserProfile -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateUserProfile where
toQuery :: CreateUserProfile -> QueryString
toQuery = QueryString -> CreateUserProfile -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateUserProfileResponse = CreateUserProfileResponse'
{
CreateUserProfileResponse -> Maybe Text
iamUserArn :: Prelude.Maybe Prelude.Text,
CreateUserProfileResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateUserProfileResponse -> CreateUserProfileResponse -> Bool
(CreateUserProfileResponse -> CreateUserProfileResponse -> Bool)
-> (CreateUserProfileResponse -> CreateUserProfileResponse -> Bool)
-> Eq CreateUserProfileResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateUserProfileResponse -> CreateUserProfileResponse -> Bool
$c/= :: CreateUserProfileResponse -> CreateUserProfileResponse -> Bool
== :: CreateUserProfileResponse -> CreateUserProfileResponse -> Bool
$c== :: CreateUserProfileResponse -> CreateUserProfileResponse -> Bool
Prelude.Eq, ReadPrec [CreateUserProfileResponse]
ReadPrec CreateUserProfileResponse
Int -> ReadS CreateUserProfileResponse
ReadS [CreateUserProfileResponse]
(Int -> ReadS CreateUserProfileResponse)
-> ReadS [CreateUserProfileResponse]
-> ReadPrec CreateUserProfileResponse
-> ReadPrec [CreateUserProfileResponse]
-> Read CreateUserProfileResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateUserProfileResponse]
$creadListPrec :: ReadPrec [CreateUserProfileResponse]
readPrec :: ReadPrec CreateUserProfileResponse
$creadPrec :: ReadPrec CreateUserProfileResponse
readList :: ReadS [CreateUserProfileResponse]
$creadList :: ReadS [CreateUserProfileResponse]
readsPrec :: Int -> ReadS CreateUserProfileResponse
$creadsPrec :: Int -> ReadS CreateUserProfileResponse
Prelude.Read, Int -> CreateUserProfileResponse -> ShowS
[CreateUserProfileResponse] -> ShowS
CreateUserProfileResponse -> String
(Int -> CreateUserProfileResponse -> ShowS)
-> (CreateUserProfileResponse -> String)
-> ([CreateUserProfileResponse] -> ShowS)
-> Show CreateUserProfileResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateUserProfileResponse] -> ShowS
$cshowList :: [CreateUserProfileResponse] -> ShowS
show :: CreateUserProfileResponse -> String
$cshow :: CreateUserProfileResponse -> String
showsPrec :: Int -> CreateUserProfileResponse -> ShowS
$cshowsPrec :: Int -> CreateUserProfileResponse -> ShowS
Prelude.Show, (forall x.
CreateUserProfileResponse -> Rep CreateUserProfileResponse x)
-> (forall x.
Rep CreateUserProfileResponse x -> CreateUserProfileResponse)
-> Generic CreateUserProfileResponse
forall x.
Rep CreateUserProfileResponse x -> CreateUserProfileResponse
forall x.
CreateUserProfileResponse -> Rep CreateUserProfileResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateUserProfileResponse x -> CreateUserProfileResponse
$cfrom :: forall x.
CreateUserProfileResponse -> Rep CreateUserProfileResponse x
Prelude.Generic)
newCreateUserProfileResponse ::
Prelude.Int ->
CreateUserProfileResponse
newCreateUserProfileResponse :: Int -> CreateUserProfileResponse
newCreateUserProfileResponse Int
pHttpStatus_ =
CreateUserProfileResponse' :: Maybe Text -> Int -> CreateUserProfileResponse
CreateUserProfileResponse'
{ $sel:iamUserArn:CreateUserProfileResponse' :: Maybe Text
iamUserArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateUserProfileResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createUserProfileResponse_iamUserArn :: Lens.Lens' CreateUserProfileResponse (Prelude.Maybe Prelude.Text)
createUserProfileResponse_iamUserArn :: (Maybe Text -> f (Maybe Text))
-> CreateUserProfileResponse -> f CreateUserProfileResponse
createUserProfileResponse_iamUserArn = (CreateUserProfileResponse -> Maybe Text)
-> (CreateUserProfileResponse
-> Maybe Text -> CreateUserProfileResponse)
-> Lens
CreateUserProfileResponse
CreateUserProfileResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserProfileResponse' {Maybe Text
iamUserArn :: Maybe Text
$sel:iamUserArn:CreateUserProfileResponse' :: CreateUserProfileResponse -> Maybe Text
iamUserArn} -> Maybe Text
iamUserArn) (\s :: CreateUserProfileResponse
s@CreateUserProfileResponse' {} Maybe Text
a -> CreateUserProfileResponse
s {$sel:iamUserArn:CreateUserProfileResponse' :: Maybe Text
iamUserArn = Maybe Text
a} :: CreateUserProfileResponse)
createUserProfileResponse_httpStatus :: Lens.Lens' CreateUserProfileResponse Prelude.Int
createUserProfileResponse_httpStatus :: (Int -> f Int)
-> CreateUserProfileResponse -> f CreateUserProfileResponse
createUserProfileResponse_httpStatus = (CreateUserProfileResponse -> Int)
-> (CreateUserProfileResponse -> Int -> CreateUserProfileResponse)
-> Lens CreateUserProfileResponse CreateUserProfileResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserProfileResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateUserProfileResponse' :: CreateUserProfileResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateUserProfileResponse
s@CreateUserProfileResponse' {} Int
a -> CreateUserProfileResponse
s {$sel:httpStatus:CreateUserProfileResponse' :: Int
httpStatus = Int
a} :: CreateUserProfileResponse)
instance Prelude.NFData CreateUserProfileResponse