{-# 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.ChimeSDKIdentity.CreateAppInstanceUser
-- 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 under an Amazon Chime @AppInstance@. The request consists
-- of a unique @appInstanceUserId@ and @Name@ for that user.
module Amazonka.ChimeSDKIdentity.CreateAppInstanceUser
  ( -- * Creating a Request
    CreateAppInstanceUser (..),
    newCreateAppInstanceUser,

    -- * Request Lenses
    createAppInstanceUser_metadata,
    createAppInstanceUser_tags,
    createAppInstanceUser_appInstanceArn,
    createAppInstanceUser_appInstanceUserId,
    createAppInstanceUser_name,
    createAppInstanceUser_clientRequestToken,

    -- * Destructuring the Response
    CreateAppInstanceUserResponse (..),
    newCreateAppInstanceUserResponse,

    -- * Response Lenses
    createAppInstanceUserResponse_appInstanceUserArn,
    createAppInstanceUserResponse_httpStatus,
  )
where

import Amazonka.ChimeSDKIdentity.Types
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

-- | /See:/ 'newCreateAppInstanceUser' smart constructor.
data CreateAppInstanceUser = CreateAppInstanceUser'
  { -- | The request\'s metadata. Limited to a 1KB string in UTF-8.
    CreateAppInstanceUser -> Maybe (Sensitive Text)
metadata :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | Tags assigned to the @AppInstanceUser@.
    CreateAppInstanceUser -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | The ARN of the @AppInstance@ request.
    CreateAppInstanceUser -> Text
appInstanceArn :: Prelude.Text,
    -- | The user ID of the @AppInstance@.
    CreateAppInstanceUser -> Sensitive Text
appInstanceUserId :: Core.Sensitive Prelude.Text,
    -- | The user\'s name.
    CreateAppInstanceUser -> Sensitive Text
name :: Core.Sensitive Prelude.Text,
    -- | The token assigned to the user requesting an @AppInstance@.
    CreateAppInstanceUser -> Sensitive Text
clientRequestToken :: Core.Sensitive Prelude.Text
  }
  deriving (CreateAppInstanceUser -> CreateAppInstanceUser -> Bool
(CreateAppInstanceUser -> CreateAppInstanceUser -> Bool)
-> (CreateAppInstanceUser -> CreateAppInstanceUser -> Bool)
-> Eq CreateAppInstanceUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAppInstanceUser -> CreateAppInstanceUser -> Bool
$c/= :: CreateAppInstanceUser -> CreateAppInstanceUser -> Bool
== :: CreateAppInstanceUser -> CreateAppInstanceUser -> Bool
$c== :: CreateAppInstanceUser -> CreateAppInstanceUser -> Bool
Prelude.Eq, Int -> CreateAppInstanceUser -> ShowS
[CreateAppInstanceUser] -> ShowS
CreateAppInstanceUser -> String
(Int -> CreateAppInstanceUser -> ShowS)
-> (CreateAppInstanceUser -> String)
-> ([CreateAppInstanceUser] -> ShowS)
-> Show CreateAppInstanceUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAppInstanceUser] -> ShowS
$cshowList :: [CreateAppInstanceUser] -> ShowS
show :: CreateAppInstanceUser -> String
$cshow :: CreateAppInstanceUser -> String
showsPrec :: Int -> CreateAppInstanceUser -> ShowS
$cshowsPrec :: Int -> CreateAppInstanceUser -> ShowS
Prelude.Show, (forall x. CreateAppInstanceUser -> Rep CreateAppInstanceUser x)
-> (forall x. Rep CreateAppInstanceUser x -> CreateAppInstanceUser)
-> Generic CreateAppInstanceUser
forall x. Rep CreateAppInstanceUser x -> CreateAppInstanceUser
forall x. CreateAppInstanceUser -> Rep CreateAppInstanceUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAppInstanceUser x -> CreateAppInstanceUser
$cfrom :: forall x. CreateAppInstanceUser -> Rep CreateAppInstanceUser x
Prelude.Generic)

-- |
-- Create a value of 'CreateAppInstanceUser' 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:
--
-- 'metadata', 'createAppInstanceUser_metadata' - The request\'s metadata. Limited to a 1KB string in UTF-8.
--
-- 'tags', 'createAppInstanceUser_tags' - Tags assigned to the @AppInstanceUser@.
--
-- 'appInstanceArn', 'createAppInstanceUser_appInstanceArn' - The ARN of the @AppInstance@ request.
--
-- 'appInstanceUserId', 'createAppInstanceUser_appInstanceUserId' - The user ID of the @AppInstance@.
--
-- 'name', 'createAppInstanceUser_name' - The user\'s name.
--
-- 'clientRequestToken', 'createAppInstanceUser_clientRequestToken' - The token assigned to the user requesting an @AppInstance@.
newCreateAppInstanceUser ::
  -- | 'appInstanceArn'
  Prelude.Text ->
  -- | 'appInstanceUserId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'clientRequestToken'
  Prelude.Text ->
  CreateAppInstanceUser
newCreateAppInstanceUser :: Text -> Text -> Text -> Text -> CreateAppInstanceUser
newCreateAppInstanceUser
  Text
pAppInstanceArn_
  Text
pAppInstanceUserId_
  Text
pName_
  Text
pClientRequestToken_ =
    CreateAppInstanceUser' :: Maybe (Sensitive Text)
-> Maybe (NonEmpty Tag)
-> Text
-> Sensitive Text
-> Sensitive Text
-> Sensitive Text
-> CreateAppInstanceUser
CreateAppInstanceUser'
      { $sel:metadata:CreateAppInstanceUser' :: Maybe (Sensitive Text)
metadata = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateAppInstanceUser' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
        $sel:appInstanceArn:CreateAppInstanceUser' :: Text
appInstanceArn = Text
pAppInstanceArn_,
        $sel:appInstanceUserId:CreateAppInstanceUser' :: Sensitive Text
appInstanceUserId =
          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
pAppInstanceUserId_,
        $sel:name:CreateAppInstanceUser' :: Sensitive Text
name = 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
pName_,
        $sel:clientRequestToken:CreateAppInstanceUser' :: Sensitive Text
clientRequestToken =
          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
pClientRequestToken_
      }

-- | The request\'s metadata. Limited to a 1KB string in UTF-8.
createAppInstanceUser_metadata :: Lens.Lens' CreateAppInstanceUser (Prelude.Maybe Prelude.Text)
createAppInstanceUser_metadata :: (Maybe Text -> f (Maybe Text))
-> CreateAppInstanceUser -> f CreateAppInstanceUser
createAppInstanceUser_metadata = (CreateAppInstanceUser -> Maybe (Sensitive Text))
-> (CreateAppInstanceUser
    -> Maybe (Sensitive Text) -> CreateAppInstanceUser)
-> Lens
     CreateAppInstanceUser
     CreateAppInstanceUser
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAppInstanceUser' {Maybe (Sensitive Text)
metadata :: Maybe (Sensitive Text)
$sel:metadata:CreateAppInstanceUser' :: CreateAppInstanceUser -> Maybe (Sensitive Text)
metadata} -> Maybe (Sensitive Text)
metadata) (\s :: CreateAppInstanceUser
s@CreateAppInstanceUser' {} Maybe (Sensitive Text)
a -> CreateAppInstanceUser
s {$sel:metadata:CreateAppInstanceUser' :: Maybe (Sensitive Text)
metadata = Maybe (Sensitive Text)
a} :: CreateAppInstanceUser) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateAppInstanceUser -> f CreateAppInstanceUser)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateAppInstanceUser
-> f CreateAppInstanceUser
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

-- | Tags assigned to the @AppInstanceUser@.
createAppInstanceUser_tags :: Lens.Lens' CreateAppInstanceUser (Prelude.Maybe (Prelude.NonEmpty Tag))
createAppInstanceUser_tags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateAppInstanceUser -> f CreateAppInstanceUser
createAppInstanceUser_tags = (CreateAppInstanceUser -> Maybe (NonEmpty Tag))
-> (CreateAppInstanceUser
    -> Maybe (NonEmpty Tag) -> CreateAppInstanceUser)
-> Lens
     CreateAppInstanceUser
     CreateAppInstanceUser
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAppInstanceUser' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateAppInstanceUser' :: CreateAppInstanceUser -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateAppInstanceUser
s@CreateAppInstanceUser' {} Maybe (NonEmpty Tag)
a -> CreateAppInstanceUser
s {$sel:tags:CreateAppInstanceUser' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateAppInstanceUser) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
 -> CreateAppInstanceUser -> f CreateAppInstanceUser)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
    -> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateAppInstanceUser
-> f CreateAppInstanceUser
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
-> Iso
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
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 (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ARN of the @AppInstance@ request.
createAppInstanceUser_appInstanceArn :: Lens.Lens' CreateAppInstanceUser Prelude.Text
createAppInstanceUser_appInstanceArn :: (Text -> f Text)
-> CreateAppInstanceUser -> f CreateAppInstanceUser
createAppInstanceUser_appInstanceArn = (CreateAppInstanceUser -> Text)
-> (CreateAppInstanceUser -> Text -> CreateAppInstanceUser)
-> Lens CreateAppInstanceUser CreateAppInstanceUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAppInstanceUser' {Text
appInstanceArn :: Text
$sel:appInstanceArn:CreateAppInstanceUser' :: CreateAppInstanceUser -> Text
appInstanceArn} -> Text
appInstanceArn) (\s :: CreateAppInstanceUser
s@CreateAppInstanceUser' {} Text
a -> CreateAppInstanceUser
s {$sel:appInstanceArn:CreateAppInstanceUser' :: Text
appInstanceArn = Text
a} :: CreateAppInstanceUser)

-- | The user ID of the @AppInstance@.
createAppInstanceUser_appInstanceUserId :: Lens.Lens' CreateAppInstanceUser Prelude.Text
createAppInstanceUser_appInstanceUserId :: (Text -> f Text)
-> CreateAppInstanceUser -> f CreateAppInstanceUser
createAppInstanceUser_appInstanceUserId = (CreateAppInstanceUser -> Sensitive Text)
-> (CreateAppInstanceUser
    -> Sensitive Text -> CreateAppInstanceUser)
-> Lens
     CreateAppInstanceUser
     CreateAppInstanceUser
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAppInstanceUser' {Sensitive Text
appInstanceUserId :: Sensitive Text
$sel:appInstanceUserId:CreateAppInstanceUser' :: CreateAppInstanceUser -> Sensitive Text
appInstanceUserId} -> Sensitive Text
appInstanceUserId) (\s :: CreateAppInstanceUser
s@CreateAppInstanceUser' {} Sensitive Text
a -> CreateAppInstanceUser
s {$sel:appInstanceUserId:CreateAppInstanceUser' :: Sensitive Text
appInstanceUserId = Sensitive Text
a} :: CreateAppInstanceUser) ((Sensitive Text -> f (Sensitive Text))
 -> CreateAppInstanceUser -> f CreateAppInstanceUser)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> CreateAppInstanceUser
-> f CreateAppInstanceUser
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

-- | The user\'s name.
createAppInstanceUser_name :: Lens.Lens' CreateAppInstanceUser Prelude.Text
createAppInstanceUser_name :: (Text -> f Text)
-> CreateAppInstanceUser -> f CreateAppInstanceUser
createAppInstanceUser_name = (CreateAppInstanceUser -> Sensitive Text)
-> (CreateAppInstanceUser
    -> Sensitive Text -> CreateAppInstanceUser)
-> Lens
     CreateAppInstanceUser
     CreateAppInstanceUser
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAppInstanceUser' {Sensitive Text
name :: Sensitive Text
$sel:name:CreateAppInstanceUser' :: CreateAppInstanceUser -> Sensitive Text
name} -> Sensitive Text
name) (\s :: CreateAppInstanceUser
s@CreateAppInstanceUser' {} Sensitive Text
a -> CreateAppInstanceUser
s {$sel:name:CreateAppInstanceUser' :: Sensitive Text
name = Sensitive Text
a} :: CreateAppInstanceUser) ((Sensitive Text -> f (Sensitive Text))
 -> CreateAppInstanceUser -> f CreateAppInstanceUser)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> CreateAppInstanceUser
-> f CreateAppInstanceUser
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

-- | The token assigned to the user requesting an @AppInstance@.
createAppInstanceUser_clientRequestToken :: Lens.Lens' CreateAppInstanceUser Prelude.Text
createAppInstanceUser_clientRequestToken :: (Text -> f Text)
-> CreateAppInstanceUser -> f CreateAppInstanceUser
createAppInstanceUser_clientRequestToken = (CreateAppInstanceUser -> Sensitive Text)
-> (CreateAppInstanceUser
    -> Sensitive Text -> CreateAppInstanceUser)
-> Lens
     CreateAppInstanceUser
     CreateAppInstanceUser
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAppInstanceUser' {Sensitive Text
clientRequestToken :: Sensitive Text
$sel:clientRequestToken:CreateAppInstanceUser' :: CreateAppInstanceUser -> Sensitive Text
clientRequestToken} -> Sensitive Text
clientRequestToken) (\s :: CreateAppInstanceUser
s@CreateAppInstanceUser' {} Sensitive Text
a -> CreateAppInstanceUser
s {$sel:clientRequestToken:CreateAppInstanceUser' :: Sensitive Text
clientRequestToken = Sensitive Text
a} :: CreateAppInstanceUser) ((Sensitive Text -> f (Sensitive Text))
 -> CreateAppInstanceUser -> f CreateAppInstanceUser)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> CreateAppInstanceUser
-> f CreateAppInstanceUser
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 CreateAppInstanceUser where
  type
    AWSResponse CreateAppInstanceUser =
      CreateAppInstanceUserResponse
  request :: CreateAppInstanceUser -> Request CreateAppInstanceUser
request = Service -> CreateAppInstanceUser -> Request CreateAppInstanceUser
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateAppInstanceUser
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateAppInstanceUser)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateAppInstanceUser))
-> Logger
-> Service
-> Proxy CreateAppInstanceUser
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateAppInstanceUser)))
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 -> CreateAppInstanceUserResponse
CreateAppInstanceUserResponse'
            (Maybe Text -> Int -> CreateAppInstanceUserResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateAppInstanceUserResponse)
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
"AppInstanceUserArn")
            Either String (Int -> CreateAppInstanceUserResponse)
-> Either String Int -> Either String CreateAppInstanceUserResponse
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 CreateAppInstanceUser

instance Prelude.NFData CreateAppInstanceUser

instance Core.ToHeaders CreateAppInstanceUser where
  toHeaders :: CreateAppInstanceUser -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateAppInstanceUser -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON CreateAppInstanceUser where
  toJSON :: CreateAppInstanceUser -> Value
toJSON CreateAppInstanceUser' {Maybe (NonEmpty Tag)
Maybe (Sensitive Text)
Text
Sensitive Text
clientRequestToken :: Sensitive Text
name :: Sensitive Text
appInstanceUserId :: Sensitive Text
appInstanceArn :: Text
tags :: Maybe (NonEmpty Tag)
metadata :: Maybe (Sensitive Text)
$sel:clientRequestToken:CreateAppInstanceUser' :: CreateAppInstanceUser -> Sensitive Text
$sel:name:CreateAppInstanceUser' :: CreateAppInstanceUser -> Sensitive Text
$sel:appInstanceUserId:CreateAppInstanceUser' :: CreateAppInstanceUser -> Sensitive Text
$sel:appInstanceArn:CreateAppInstanceUser' :: CreateAppInstanceUser -> Text
$sel:tags:CreateAppInstanceUser' :: CreateAppInstanceUser -> Maybe (NonEmpty Tag)
$sel:metadata:CreateAppInstanceUser' :: CreateAppInstanceUser -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Metadata" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
metadata,
            (Text
"Tags" Text -> NonEmpty Tag -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Tag -> Pair) -> Maybe (NonEmpty Tag) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AppInstanceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
appInstanceArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AppInstanceUserId" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
appInstanceUserId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ClientRequestToken" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
clientRequestToken)
          ]
      )

instance Core.ToPath CreateAppInstanceUser where
  toPath :: CreateAppInstanceUser -> ByteString
toPath = ByteString -> CreateAppInstanceUser -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/app-instance-users"

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

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

-- |
-- Create a value of 'CreateAppInstanceUserResponse' 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:
--
-- 'appInstanceUserArn', 'createAppInstanceUserResponse_appInstanceUserArn' - The user\'s ARN.
--
-- 'httpStatus', 'createAppInstanceUserResponse_httpStatus' - The response's http status code.
newCreateAppInstanceUserResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateAppInstanceUserResponse
newCreateAppInstanceUserResponse :: Int -> CreateAppInstanceUserResponse
newCreateAppInstanceUserResponse Int
pHttpStatus_ =
  CreateAppInstanceUserResponse' :: Maybe Text -> Int -> CreateAppInstanceUserResponse
CreateAppInstanceUserResponse'
    { $sel:appInstanceUserArn:CreateAppInstanceUserResponse' :: Maybe Text
appInstanceUserArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateAppInstanceUserResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The user\'s ARN.
createAppInstanceUserResponse_appInstanceUserArn :: Lens.Lens' CreateAppInstanceUserResponse (Prelude.Maybe Prelude.Text)
createAppInstanceUserResponse_appInstanceUserArn :: (Maybe Text -> f (Maybe Text))
-> CreateAppInstanceUserResponse -> f CreateAppInstanceUserResponse
createAppInstanceUserResponse_appInstanceUserArn = (CreateAppInstanceUserResponse -> Maybe Text)
-> (CreateAppInstanceUserResponse
    -> Maybe Text -> CreateAppInstanceUserResponse)
-> Lens
     CreateAppInstanceUserResponse
     CreateAppInstanceUserResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAppInstanceUserResponse' {Maybe Text
appInstanceUserArn :: Maybe Text
$sel:appInstanceUserArn:CreateAppInstanceUserResponse' :: CreateAppInstanceUserResponse -> Maybe Text
appInstanceUserArn} -> Maybe Text
appInstanceUserArn) (\s :: CreateAppInstanceUserResponse
s@CreateAppInstanceUserResponse' {} Maybe Text
a -> CreateAppInstanceUserResponse
s {$sel:appInstanceUserArn:CreateAppInstanceUserResponse' :: Maybe Text
appInstanceUserArn = Maybe Text
a} :: CreateAppInstanceUserResponse)

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

instance Prelude.NFData CreateAppInstanceUserResponse