{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.WorkDocs.CreateUser
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a user in a Simple AD or Microsoft AD directory. The status of a
-- newly created user is \"ACTIVE\". New users can access Amazon WorkDocs.
module Amazonka.WorkDocs.CreateUser
  ( -- * Creating a Request
    CreateUser (..),
    newCreateUser,

    -- * Request Lenses
    createUser_authenticationToken,
    createUser_storageRule,
    createUser_emailAddress,
    createUser_timeZoneId,
    createUser_organizationId,
    createUser_username,
    createUser_givenName,
    createUser_surname,
    createUser_password,

    -- * Destructuring the Response
    CreateUserResponse (..),
    newCreateUserResponse,

    -- * Response Lenses
    createUserResponse_user,
    createUserResponse_httpStatus,
  )
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.WorkDocs.Types

-- | /See:/ 'newCreateUser' smart constructor.
data CreateUser = CreateUser'
  { -- | Amazon WorkDocs authentication token. Not required when using AWS
    -- administrator credentials to access the API.
    CreateUser -> Maybe (Sensitive Text)
authenticationToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The amount of storage for the user.
    CreateUser -> Maybe StorageRuleType
storageRule :: Prelude.Maybe StorageRuleType,
    -- | The email address of the user.
    CreateUser -> Maybe Text
emailAddress :: Prelude.Maybe Prelude.Text,
    -- | The time zone ID of the user.
    CreateUser -> Maybe Text
timeZoneId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the organization.
    CreateUser -> Maybe Text
organizationId :: Prelude.Maybe Prelude.Text,
    -- | The login name of the user.
    CreateUser -> Text
username :: Prelude.Text,
    -- | The given name of the user.
    CreateUser -> Text
givenName :: Prelude.Text,
    -- | The surname of the user.
    CreateUser -> Text
surname :: Prelude.Text,
    -- | The password of the user.
    CreateUser -> Sensitive Text
password :: Core.Sensitive Prelude.Text
  }
  deriving (CreateUser -> CreateUser -> Bool
(CreateUser -> CreateUser -> Bool)
-> (CreateUser -> CreateUser -> Bool) -> Eq CreateUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateUser -> CreateUser -> Bool
$c/= :: CreateUser -> CreateUser -> Bool
== :: CreateUser -> CreateUser -> Bool
$c== :: CreateUser -> CreateUser -> Bool
Prelude.Eq, Int -> CreateUser -> ShowS
[CreateUser] -> ShowS
CreateUser -> String
(Int -> CreateUser -> ShowS)
-> (CreateUser -> String)
-> ([CreateUser] -> ShowS)
-> Show CreateUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateUser] -> ShowS
$cshowList :: [CreateUser] -> ShowS
show :: CreateUser -> String
$cshow :: CreateUser -> String
showsPrec :: Int -> CreateUser -> ShowS
$cshowsPrec :: Int -> CreateUser -> ShowS
Prelude.Show, (forall x. CreateUser -> Rep CreateUser x)
-> (forall x. Rep CreateUser x -> CreateUser) -> Generic CreateUser
forall x. Rep CreateUser x -> CreateUser
forall x. CreateUser -> Rep CreateUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateUser x -> CreateUser
$cfrom :: forall x. CreateUser -> Rep CreateUser x
Prelude.Generic)

-- |
-- Create a value of 'CreateUser' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'authenticationToken', 'createUser_authenticationToken' - Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
--
-- 'storageRule', 'createUser_storageRule' - The amount of storage for the user.
--
-- 'emailAddress', 'createUser_emailAddress' - The email address of the user.
--
-- 'timeZoneId', 'createUser_timeZoneId' - The time zone ID of the user.
--
-- 'organizationId', 'createUser_organizationId' - The ID of the organization.
--
-- 'username', 'createUser_username' - The login name of the user.
--
-- 'givenName', 'createUser_givenName' - The given name of the user.
--
-- 'surname', 'createUser_surname' - The surname of the user.
--
-- 'password', 'createUser_password' - The password of the user.
newCreateUser ::
  -- | 'username'
  Prelude.Text ->
  -- | 'givenName'
  Prelude.Text ->
  -- | 'surname'
  Prelude.Text ->
  -- | 'password'
  Prelude.Text ->
  CreateUser
newCreateUser :: Text -> Text -> Text -> Text -> CreateUser
newCreateUser
  Text
pUsername_
  Text
pGivenName_
  Text
pSurname_
  Text
pPassword_ =
    CreateUser' :: Maybe (Sensitive Text)
-> Maybe StorageRuleType
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> Text
-> Sensitive Text
-> CreateUser
CreateUser'
      { $sel:authenticationToken:CreateUser' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:storageRule:CreateUser' :: Maybe StorageRuleType
storageRule = Maybe StorageRuleType
forall a. Maybe a
Prelude.Nothing,
        $sel:emailAddress:CreateUser' :: Maybe Text
emailAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:timeZoneId:CreateUser' :: Maybe Text
timeZoneId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:organizationId:CreateUser' :: Maybe Text
organizationId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:username:CreateUser' :: Text
username = Text
pUsername_,
        $sel:givenName:CreateUser' :: Text
givenName = Text
pGivenName_,
        $sel:surname:CreateUser' :: Text
surname = Text
pSurname_,
        $sel:password:CreateUser' :: 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_
      }

-- | Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
createUser_authenticationToken :: Lens.Lens' CreateUser (Prelude.Maybe Prelude.Text)
createUser_authenticationToken :: (Maybe Text -> f (Maybe Text)) -> CreateUser -> f CreateUser
createUser_authenticationToken = (CreateUser -> Maybe (Sensitive Text))
-> (CreateUser -> Maybe (Sensitive Text) -> CreateUser)
-> Lens
     CreateUser
     CreateUser
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUser' {Maybe (Sensitive Text)
authenticationToken :: Maybe (Sensitive Text)
$sel:authenticationToken:CreateUser' :: CreateUser -> Maybe (Sensitive Text)
authenticationToken} -> Maybe (Sensitive Text)
authenticationToken) (\s :: CreateUser
s@CreateUser' {} Maybe (Sensitive Text)
a -> CreateUser
s {$sel:authenticationToken:CreateUser' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
a} :: CreateUser) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateUser -> f CreateUser)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateUser
-> f CreateUser
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The amount of storage for the user.
createUser_storageRule :: Lens.Lens' CreateUser (Prelude.Maybe StorageRuleType)
createUser_storageRule :: (Maybe StorageRuleType -> f (Maybe StorageRuleType))
-> CreateUser -> f CreateUser
createUser_storageRule = (CreateUser -> Maybe StorageRuleType)
-> (CreateUser -> Maybe StorageRuleType -> CreateUser)
-> Lens
     CreateUser
     CreateUser
     (Maybe StorageRuleType)
     (Maybe StorageRuleType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUser' {Maybe StorageRuleType
storageRule :: Maybe StorageRuleType
$sel:storageRule:CreateUser' :: CreateUser -> Maybe StorageRuleType
storageRule} -> Maybe StorageRuleType
storageRule) (\s :: CreateUser
s@CreateUser' {} Maybe StorageRuleType
a -> CreateUser
s {$sel:storageRule:CreateUser' :: Maybe StorageRuleType
storageRule = Maybe StorageRuleType
a} :: CreateUser)

-- | The email address of the user.
createUser_emailAddress :: Lens.Lens' CreateUser (Prelude.Maybe Prelude.Text)
createUser_emailAddress :: (Maybe Text -> f (Maybe Text)) -> CreateUser -> f CreateUser
createUser_emailAddress = (CreateUser -> Maybe Text)
-> (CreateUser -> Maybe Text -> CreateUser)
-> Lens CreateUser CreateUser (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUser' {Maybe Text
emailAddress :: Maybe Text
$sel:emailAddress:CreateUser' :: CreateUser -> Maybe Text
emailAddress} -> Maybe Text
emailAddress) (\s :: CreateUser
s@CreateUser' {} Maybe Text
a -> CreateUser
s {$sel:emailAddress:CreateUser' :: Maybe Text
emailAddress = Maybe Text
a} :: CreateUser)

-- | The time zone ID of the user.
createUser_timeZoneId :: Lens.Lens' CreateUser (Prelude.Maybe Prelude.Text)
createUser_timeZoneId :: (Maybe Text -> f (Maybe Text)) -> CreateUser -> f CreateUser
createUser_timeZoneId = (CreateUser -> Maybe Text)
-> (CreateUser -> Maybe Text -> CreateUser)
-> Lens CreateUser CreateUser (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUser' {Maybe Text
timeZoneId :: Maybe Text
$sel:timeZoneId:CreateUser' :: CreateUser -> Maybe Text
timeZoneId} -> Maybe Text
timeZoneId) (\s :: CreateUser
s@CreateUser' {} Maybe Text
a -> CreateUser
s {$sel:timeZoneId:CreateUser' :: Maybe Text
timeZoneId = Maybe Text
a} :: CreateUser)

-- | The ID of the organization.
createUser_organizationId :: Lens.Lens' CreateUser (Prelude.Maybe Prelude.Text)
createUser_organizationId :: (Maybe Text -> f (Maybe Text)) -> CreateUser -> f CreateUser
createUser_organizationId = (CreateUser -> Maybe Text)
-> (CreateUser -> Maybe Text -> CreateUser)
-> Lens CreateUser CreateUser (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUser' {Maybe Text
organizationId :: Maybe Text
$sel:organizationId:CreateUser' :: CreateUser -> Maybe Text
organizationId} -> Maybe Text
organizationId) (\s :: CreateUser
s@CreateUser' {} Maybe Text
a -> CreateUser
s {$sel:organizationId:CreateUser' :: Maybe Text
organizationId = Maybe Text
a} :: CreateUser)

-- | The login name of the user.
createUser_username :: Lens.Lens' CreateUser Prelude.Text
createUser_username :: (Text -> f Text) -> CreateUser -> f CreateUser
createUser_username = (CreateUser -> Text)
-> (CreateUser -> Text -> CreateUser)
-> Lens CreateUser CreateUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUser' {Text
username :: Text
$sel:username:CreateUser' :: CreateUser -> Text
username} -> Text
username) (\s :: CreateUser
s@CreateUser' {} Text
a -> CreateUser
s {$sel:username:CreateUser' :: Text
username = Text
a} :: CreateUser)

-- | The given name of the user.
createUser_givenName :: Lens.Lens' CreateUser Prelude.Text
createUser_givenName :: (Text -> f Text) -> CreateUser -> f CreateUser
createUser_givenName = (CreateUser -> Text)
-> (CreateUser -> Text -> CreateUser)
-> Lens CreateUser CreateUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUser' {Text
givenName :: Text
$sel:givenName:CreateUser' :: CreateUser -> Text
givenName} -> Text
givenName) (\s :: CreateUser
s@CreateUser' {} Text
a -> CreateUser
s {$sel:givenName:CreateUser' :: Text
givenName = Text
a} :: CreateUser)

-- | The surname of the user.
createUser_surname :: Lens.Lens' CreateUser Prelude.Text
createUser_surname :: (Text -> f Text) -> CreateUser -> f CreateUser
createUser_surname = (CreateUser -> Text)
-> (CreateUser -> Text -> CreateUser)
-> Lens CreateUser CreateUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUser' {Text
surname :: Text
$sel:surname:CreateUser' :: CreateUser -> Text
surname} -> Text
surname) (\s :: CreateUser
s@CreateUser' {} Text
a -> CreateUser
s {$sel:surname:CreateUser' :: Text
surname = Text
a} :: CreateUser)

-- | The password of the user.
createUser_password :: Lens.Lens' CreateUser Prelude.Text
createUser_password :: (Text -> f Text) -> CreateUser -> f CreateUser
createUser_password = (CreateUser -> Sensitive Text)
-> (CreateUser -> Sensitive Text -> CreateUser)
-> Lens CreateUser CreateUser (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUser' {Sensitive Text
password :: Sensitive Text
$sel:password:CreateUser' :: CreateUser -> Sensitive Text
password} -> Sensitive Text
password) (\s :: CreateUser
s@CreateUser' {} Sensitive Text
a -> CreateUser
s {$sel:password:CreateUser' :: Sensitive Text
password = Sensitive Text
a} :: CreateUser) ((Sensitive Text -> f (Sensitive Text))
 -> CreateUser -> f CreateUser)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> CreateUser
-> f CreateUser
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 CreateUser where
  type AWSResponse CreateUser = CreateUserResponse
  request :: CreateUser -> Request CreateUser
request = Service -> CreateUser -> Request CreateUser
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateUser)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateUser))
-> Logger
-> Service
-> Proxy CreateUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateUser)))
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 User -> Int -> CreateUserResponse
CreateUserResponse'
            (Maybe User -> Int -> CreateUserResponse)
-> Either String (Maybe User)
-> Either String (Int -> CreateUserResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe User)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"User")
            Either String (Int -> CreateUserResponse)
-> Either String Int -> Either String CreateUserResponse
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 CreateUser

instance Prelude.NFData CreateUser

instance Core.ToHeaders CreateUser where
  toHeaders :: CreateUser -> ResponseHeaders
toHeaders CreateUser' {Maybe Text
Maybe (Sensitive Text)
Maybe StorageRuleType
Text
Sensitive Text
password :: Sensitive Text
surname :: Text
givenName :: Text
username :: Text
organizationId :: Maybe Text
timeZoneId :: Maybe Text
emailAddress :: Maybe Text
storageRule :: Maybe StorageRuleType
authenticationToken :: Maybe (Sensitive Text)
$sel:password:CreateUser' :: CreateUser -> Sensitive Text
$sel:surname:CreateUser' :: CreateUser -> Text
$sel:givenName:CreateUser' :: CreateUser -> Text
$sel:username:CreateUser' :: CreateUser -> Text
$sel:organizationId:CreateUser' :: CreateUser -> Maybe Text
$sel:timeZoneId:CreateUser' :: CreateUser -> Maybe Text
$sel:emailAddress:CreateUser' :: CreateUser -> Maybe Text
$sel:storageRule:CreateUser' :: CreateUser -> Maybe StorageRuleType
$sel:authenticationToken:CreateUser' :: CreateUser -> Maybe (Sensitive Text)
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"Authentication" HeaderName -> Maybe (Sensitive Text) -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe (Sensitive Text)
authenticationToken,
        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 CreateUser where
  toJSON :: CreateUser -> Value
toJSON CreateUser' {Maybe Text
Maybe (Sensitive Text)
Maybe StorageRuleType
Text
Sensitive Text
password :: Sensitive Text
surname :: Text
givenName :: Text
username :: Text
organizationId :: Maybe Text
timeZoneId :: Maybe Text
emailAddress :: Maybe Text
storageRule :: Maybe StorageRuleType
authenticationToken :: Maybe (Sensitive Text)
$sel:password:CreateUser' :: CreateUser -> Sensitive Text
$sel:surname:CreateUser' :: CreateUser -> Text
$sel:givenName:CreateUser' :: CreateUser -> Text
$sel:username:CreateUser' :: CreateUser -> Text
$sel:organizationId:CreateUser' :: CreateUser -> Maybe Text
$sel:timeZoneId:CreateUser' :: CreateUser -> Maybe Text
$sel:emailAddress:CreateUser' :: CreateUser -> Maybe Text
$sel:storageRule:CreateUser' :: CreateUser -> Maybe StorageRuleType
$sel:authenticationToken:CreateUser' :: CreateUser -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"StorageRule" Text -> StorageRuleType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (StorageRuleType -> Pair) -> Maybe StorageRuleType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StorageRuleType
storageRule,
            (Text
"EmailAddress" 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
emailAddress,
            (Text
"TimeZoneId" 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
timeZoneId,
            (Text
"OrganizationId" 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
organizationId,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Username" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
username),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GivenName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
givenName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Surname" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
surname),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Password" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
password)
          ]
      )

instance Core.ToPath CreateUser where
  toPath :: CreateUser -> ByteString
toPath = ByteString -> CreateUser -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/api/v1/users"

instance Core.ToQuery CreateUser where
  toQuery :: CreateUser -> QueryString
toQuery = QueryString -> CreateUser -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateUserResponse' smart constructor.
data CreateUserResponse = CreateUserResponse'
  { -- | The user information.
    CreateUserResponse -> Maybe User
user :: Prelude.Maybe User,
    -- | The response's http status code.
    CreateUserResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateUserResponse -> CreateUserResponse -> Bool
(CreateUserResponse -> CreateUserResponse -> Bool)
-> (CreateUserResponse -> CreateUserResponse -> Bool)
-> Eq CreateUserResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateUserResponse -> CreateUserResponse -> Bool
$c/= :: CreateUserResponse -> CreateUserResponse -> Bool
== :: CreateUserResponse -> CreateUserResponse -> Bool
$c== :: CreateUserResponse -> CreateUserResponse -> Bool
Prelude.Eq, ReadPrec [CreateUserResponse]
ReadPrec CreateUserResponse
Int -> ReadS CreateUserResponse
ReadS [CreateUserResponse]
(Int -> ReadS CreateUserResponse)
-> ReadS [CreateUserResponse]
-> ReadPrec CreateUserResponse
-> ReadPrec [CreateUserResponse]
-> Read CreateUserResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateUserResponse]
$creadListPrec :: ReadPrec [CreateUserResponse]
readPrec :: ReadPrec CreateUserResponse
$creadPrec :: ReadPrec CreateUserResponse
readList :: ReadS [CreateUserResponse]
$creadList :: ReadS [CreateUserResponse]
readsPrec :: Int -> ReadS CreateUserResponse
$creadsPrec :: Int -> ReadS CreateUserResponse
Prelude.Read, Int -> CreateUserResponse -> ShowS
[CreateUserResponse] -> ShowS
CreateUserResponse -> String
(Int -> CreateUserResponse -> ShowS)
-> (CreateUserResponse -> String)
-> ([CreateUserResponse] -> ShowS)
-> Show CreateUserResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateUserResponse] -> ShowS
$cshowList :: [CreateUserResponse] -> ShowS
show :: CreateUserResponse -> String
$cshow :: CreateUserResponse -> String
showsPrec :: Int -> CreateUserResponse -> ShowS
$cshowsPrec :: Int -> CreateUserResponse -> ShowS
Prelude.Show, (forall x. CreateUserResponse -> Rep CreateUserResponse x)
-> (forall x. Rep CreateUserResponse x -> CreateUserResponse)
-> Generic CreateUserResponse
forall x. Rep CreateUserResponse x -> CreateUserResponse
forall x. CreateUserResponse -> Rep CreateUserResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateUserResponse x -> CreateUserResponse
$cfrom :: forall x. CreateUserResponse -> Rep CreateUserResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateUserResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'user', 'createUserResponse_user' - The user information.
--
-- 'httpStatus', 'createUserResponse_httpStatus' - The response's http status code.
newCreateUserResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateUserResponse
newCreateUserResponse :: Int -> CreateUserResponse
newCreateUserResponse Int
pHttpStatus_ =
  CreateUserResponse' :: Maybe User -> Int -> CreateUserResponse
CreateUserResponse'
    { $sel:user:CreateUserResponse' :: Maybe User
user = Maybe User
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateUserResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The user information.
createUserResponse_user :: Lens.Lens' CreateUserResponse (Prelude.Maybe User)
createUserResponse_user :: (Maybe User -> f (Maybe User))
-> CreateUserResponse -> f CreateUserResponse
createUserResponse_user = (CreateUserResponse -> Maybe User)
-> (CreateUserResponse -> Maybe User -> CreateUserResponse)
-> Lens
     CreateUserResponse CreateUserResponse (Maybe User) (Maybe User)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserResponse' {Maybe User
user :: Maybe User
$sel:user:CreateUserResponse' :: CreateUserResponse -> Maybe User
user} -> Maybe User
user) (\s :: CreateUserResponse
s@CreateUserResponse' {} Maybe User
a -> CreateUserResponse
s {$sel:user:CreateUserResponse' :: Maybe User
user = Maybe User
a} :: CreateUserResponse)

-- | The response's http status code.
createUserResponse_httpStatus :: Lens.Lens' CreateUserResponse Prelude.Int
createUserResponse_httpStatus :: (Int -> f Int) -> CreateUserResponse -> f CreateUserResponse
createUserResponse_httpStatus = (CreateUserResponse -> Int)
-> (CreateUserResponse -> Int -> CreateUserResponse)
-> Lens CreateUserResponse CreateUserResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateUserResponse' :: CreateUserResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateUserResponse
s@CreateUserResponse' {} Int
a -> CreateUserResponse
s {$sel:httpStatus:CreateUserResponse' :: Int
httpStatus = Int
a} :: CreateUserResponse)

instance Prelude.NFData CreateUserResponse