{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:allowSelfManagement:CreateUserProfile' :: Maybe Bool
allowSelfManagement =
forall a. Maybe a
Prelude.Nothing,
$sel:sshPublicKey:CreateUserProfile' :: Maybe Text
sshPublicKey = forall a. Maybe a
Prelude.Nothing,
$sel:sshUsername:CreateUserProfile' :: Maybe Text
sshUsername = forall a. Maybe a
Prelude.Nothing,
$sel:iamUserArn:CreateUserProfile' :: Text
iamUserArn = Text
pIamUserArn_
}
createUserProfile_allowSelfManagement :: Lens.Lens' CreateUserProfile (Prelude.Maybe Prelude.Bool)
createUserProfile_allowSelfManagement :: Lens' CreateUserProfile (Maybe Bool)
createUserProfile_allowSelfManagement = 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 :: Lens' CreateUserProfile (Maybe Text)
createUserProfile_sshPublicKey = 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 :: Lens' CreateUserProfile (Maybe Text)
createUserProfile_sshUsername = 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 :: Lens' CreateUserProfile Text
createUserProfile_iamUserArn = 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 :: (Service -> Service)
-> CreateUserProfile -> Request CreateUserProfile
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateUserProfile
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateUserProfile)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> CreateUserProfileResponse
CreateUserProfileResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"IamUserArn")
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 CreateUserProfile where
hashWithSalt :: Int -> CreateUserProfile -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
allowSelfManagement
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sshPublicKey
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sshUsername
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
iamUserArn
instance Prelude.NFData CreateUserProfile where
rnf :: CreateUserProfile -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
allowSelfManagement
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sshPublicKey
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sshUsername
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
iamUserArn
instance Data.ToHeaders CreateUserProfile where
toHeaders :: CreateUserProfile -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"OpsWorks_20130218.CreateUserProfile" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"AllowSelfManagement" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
allowSelfManagement,
(Key
"SshPublicKey" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sshPublicKey,
(Key
"SshUsername" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sshUsername,
forall a. a -> Maybe a
Prelude.Just (Key
"IamUserArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
iamUserArn)
]
)
instance Data.ToPath CreateUserProfile where
toPath :: CreateUserProfile -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateUserProfile where
toQuery :: CreateUserProfile -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
{ $sel:iamUserArn:CreateUserProfileResponse' :: Maybe Text
iamUserArn =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateUserProfileResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createUserProfileResponse_iamUserArn :: Lens.Lens' CreateUserProfileResponse (Prelude.Maybe Prelude.Text)
createUserProfileResponse_iamUserArn :: Lens' CreateUserProfileResponse (Maybe Text)
createUserProfileResponse_iamUserArn = 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 :: Lens' CreateUserProfileResponse Int
createUserProfileResponse_httpStatus = 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 where
rnf :: CreateUserProfileResponse -> ()
rnf CreateUserProfileResponse' {Int
Maybe Text
httpStatus :: Int
iamUserArn :: Maybe Text
$sel:httpStatus:CreateUserProfileResponse' :: CreateUserProfileResponse -> Int
$sel:iamUserArn:CreateUserProfileResponse' :: CreateUserProfileResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
iamUserArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus