{-# 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.RegisterAppInstanceUserEndpoint
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Registers an endpoint under an Amazon Chime @AppInstanceUser@. The
-- endpoint receives messages for a user. For push notifications, the
-- endpoint is a mobile device used to receive mobile push notifications
-- for a user.
module Amazonka.ChimeSDKIdentity.RegisterAppInstanceUserEndpoint
  ( -- * Creating a Request
    RegisterAppInstanceUserEndpoint (..),
    newRegisterAppInstanceUserEndpoint,

    -- * Request Lenses
    registerAppInstanceUserEndpoint_allowMessages,
    registerAppInstanceUserEndpoint_name,
    registerAppInstanceUserEndpoint_appInstanceUserArn,
    registerAppInstanceUserEndpoint_type,
    registerAppInstanceUserEndpoint_resourceArn,
    registerAppInstanceUserEndpoint_endpointAttributes,
    registerAppInstanceUserEndpoint_clientRequestToken,

    -- * Destructuring the Response
    RegisterAppInstanceUserEndpointResponse (..),
    newRegisterAppInstanceUserEndpointResponse,

    -- * Response Lenses
    registerAppInstanceUserEndpointResponse_appInstanceUserArn,
    registerAppInstanceUserEndpointResponse_endpointId,
    registerAppInstanceUserEndpointResponse_httpStatus,
  )
where

import Amazonka.ChimeSDKIdentity.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newRegisterAppInstanceUserEndpoint' smart constructor.
data RegisterAppInstanceUserEndpoint = RegisterAppInstanceUserEndpoint'
  { -- | Boolean that controls whether the AppInstanceUserEndpoint is opted in to
    -- receive messages. @ALL@ indicates the endpoint receives all messages.
    -- @NONE@ indicates the endpoint receives no messages.
    RegisterAppInstanceUserEndpoint -> Maybe AllowMessages
allowMessages :: Prelude.Maybe AllowMessages,
    -- | The name of the @AppInstanceUserEndpoint@.
    RegisterAppInstanceUserEndpoint -> Maybe (Sensitive Text)
name :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The ARN of the @AppInstanceUser@.
    RegisterAppInstanceUserEndpoint -> Sensitive Text
appInstanceUserArn :: Data.Sensitive Prelude.Text,
    -- | The type of the @AppInstanceUserEndpoint@. Supported types:
    --
    -- -   @APNS@: The mobile notification service for an Apple device.
    --
    -- -   @APNS_SANDBOX@: The sandbox environment of the mobile notification
    --     service for an Apple device.
    --
    -- -   @GCM@: The mobile notification service for an Android device.
    --
    -- Populate the @ResourceArn@ value of each type as @PinpointAppArn@.
    RegisterAppInstanceUserEndpoint -> AppInstanceUserEndpointType
type' :: AppInstanceUserEndpointType,
    -- | The ARN of the resource to which the endpoint belongs.
    RegisterAppInstanceUserEndpoint -> Sensitive Text
resourceArn :: Data.Sensitive Prelude.Text,
    -- | The attributes of an @Endpoint@.
    RegisterAppInstanceUserEndpoint -> EndpointAttributes
endpointAttributes :: EndpointAttributes,
    -- | The idempotency token for each client request.
    RegisterAppInstanceUserEndpoint -> Sensitive Text
clientRequestToken :: Data.Sensitive Prelude.Text
  }
  deriving (RegisterAppInstanceUserEndpoint
-> RegisterAppInstanceUserEndpoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterAppInstanceUserEndpoint
-> RegisterAppInstanceUserEndpoint -> Bool
$c/= :: RegisterAppInstanceUserEndpoint
-> RegisterAppInstanceUserEndpoint -> Bool
== :: RegisterAppInstanceUserEndpoint
-> RegisterAppInstanceUserEndpoint -> Bool
$c== :: RegisterAppInstanceUserEndpoint
-> RegisterAppInstanceUserEndpoint -> Bool
Prelude.Eq, Int -> RegisterAppInstanceUserEndpoint -> ShowS
[RegisterAppInstanceUserEndpoint] -> ShowS
RegisterAppInstanceUserEndpoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterAppInstanceUserEndpoint] -> ShowS
$cshowList :: [RegisterAppInstanceUserEndpoint] -> ShowS
show :: RegisterAppInstanceUserEndpoint -> String
$cshow :: RegisterAppInstanceUserEndpoint -> String
showsPrec :: Int -> RegisterAppInstanceUserEndpoint -> ShowS
$cshowsPrec :: Int -> RegisterAppInstanceUserEndpoint -> ShowS
Prelude.Show, forall x.
Rep RegisterAppInstanceUserEndpoint x
-> RegisterAppInstanceUserEndpoint
forall x.
RegisterAppInstanceUserEndpoint
-> Rep RegisterAppInstanceUserEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterAppInstanceUserEndpoint x
-> RegisterAppInstanceUserEndpoint
$cfrom :: forall x.
RegisterAppInstanceUserEndpoint
-> Rep RegisterAppInstanceUserEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'RegisterAppInstanceUserEndpoint' 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:
--
-- 'allowMessages', 'registerAppInstanceUserEndpoint_allowMessages' - Boolean that controls whether the AppInstanceUserEndpoint is opted in to
-- receive messages. @ALL@ indicates the endpoint receives all messages.
-- @NONE@ indicates the endpoint receives no messages.
--
-- 'name', 'registerAppInstanceUserEndpoint_name' - The name of the @AppInstanceUserEndpoint@.
--
-- 'appInstanceUserArn', 'registerAppInstanceUserEndpoint_appInstanceUserArn' - The ARN of the @AppInstanceUser@.
--
-- 'type'', 'registerAppInstanceUserEndpoint_type' - The type of the @AppInstanceUserEndpoint@. Supported types:
--
-- -   @APNS@: The mobile notification service for an Apple device.
--
-- -   @APNS_SANDBOX@: The sandbox environment of the mobile notification
--     service for an Apple device.
--
-- -   @GCM@: The mobile notification service for an Android device.
--
-- Populate the @ResourceArn@ value of each type as @PinpointAppArn@.
--
-- 'resourceArn', 'registerAppInstanceUserEndpoint_resourceArn' - The ARN of the resource to which the endpoint belongs.
--
-- 'endpointAttributes', 'registerAppInstanceUserEndpoint_endpointAttributes' - The attributes of an @Endpoint@.
--
-- 'clientRequestToken', 'registerAppInstanceUserEndpoint_clientRequestToken' - The idempotency token for each client request.
newRegisterAppInstanceUserEndpoint ::
  -- | 'appInstanceUserArn'
  Prelude.Text ->
  -- | 'type''
  AppInstanceUserEndpointType ->
  -- | 'resourceArn'
  Prelude.Text ->
  -- | 'endpointAttributes'
  EndpointAttributes ->
  -- | 'clientRequestToken'
  Prelude.Text ->
  RegisterAppInstanceUserEndpoint
newRegisterAppInstanceUserEndpoint :: Text
-> AppInstanceUserEndpointType
-> Text
-> EndpointAttributes
-> Text
-> RegisterAppInstanceUserEndpoint
newRegisterAppInstanceUserEndpoint
  Text
pAppInstanceUserArn_
  AppInstanceUserEndpointType
pType_
  Text
pResourceArn_
  EndpointAttributes
pEndpointAttributes_
  Text
pClientRequestToken_ =
    RegisterAppInstanceUserEndpoint'
      { $sel:allowMessages:RegisterAppInstanceUserEndpoint' :: Maybe AllowMessages
allowMessages =
          forall a. Maybe a
Prelude.Nothing,
        $sel:name:RegisterAppInstanceUserEndpoint' :: Maybe (Sensitive Text)
name = forall a. Maybe a
Prelude.Nothing,
        $sel:appInstanceUserArn:RegisterAppInstanceUserEndpoint' :: Sensitive Text
appInstanceUserArn =
          forall a. Iso' (Sensitive a) a
Data._Sensitive
            forall t b. AReview t b -> b -> t
Lens.# Text
pAppInstanceUserArn_,
        $sel:type':RegisterAppInstanceUserEndpoint' :: AppInstanceUserEndpointType
type' = AppInstanceUserEndpointType
pType_,
        $sel:resourceArn:RegisterAppInstanceUserEndpoint' :: Sensitive Text
resourceArn =
          forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pResourceArn_,
        $sel:endpointAttributes:RegisterAppInstanceUserEndpoint' :: EndpointAttributes
endpointAttributes = EndpointAttributes
pEndpointAttributes_,
        $sel:clientRequestToken:RegisterAppInstanceUserEndpoint' :: Sensitive Text
clientRequestToken =
          forall a. Iso' (Sensitive a) a
Data._Sensitive
            forall t b. AReview t b -> b -> t
Lens.# Text
pClientRequestToken_
      }

-- | Boolean that controls whether the AppInstanceUserEndpoint is opted in to
-- receive messages. @ALL@ indicates the endpoint receives all messages.
-- @NONE@ indicates the endpoint receives no messages.
registerAppInstanceUserEndpoint_allowMessages :: Lens.Lens' RegisterAppInstanceUserEndpoint (Prelude.Maybe AllowMessages)
registerAppInstanceUserEndpoint_allowMessages :: Lens' RegisterAppInstanceUserEndpoint (Maybe AllowMessages)
registerAppInstanceUserEndpoint_allowMessages = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterAppInstanceUserEndpoint' {Maybe AllowMessages
allowMessages :: Maybe AllowMessages
$sel:allowMessages:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Maybe AllowMessages
allowMessages} -> Maybe AllowMessages
allowMessages) (\s :: RegisterAppInstanceUserEndpoint
s@RegisterAppInstanceUserEndpoint' {} Maybe AllowMessages
a -> RegisterAppInstanceUserEndpoint
s {$sel:allowMessages:RegisterAppInstanceUserEndpoint' :: Maybe AllowMessages
allowMessages = Maybe AllowMessages
a} :: RegisterAppInstanceUserEndpoint)

-- | The name of the @AppInstanceUserEndpoint@.
registerAppInstanceUserEndpoint_name :: Lens.Lens' RegisterAppInstanceUserEndpoint (Prelude.Maybe Prelude.Text)
registerAppInstanceUserEndpoint_name :: Lens' RegisterAppInstanceUserEndpoint (Maybe Text)
registerAppInstanceUserEndpoint_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterAppInstanceUserEndpoint' {Maybe (Sensitive Text)
name :: Maybe (Sensitive Text)
$sel:name:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Maybe (Sensitive Text)
name} -> Maybe (Sensitive Text)
name) (\s :: RegisterAppInstanceUserEndpoint
s@RegisterAppInstanceUserEndpoint' {} Maybe (Sensitive Text)
a -> RegisterAppInstanceUserEndpoint
s {$sel:name:RegisterAppInstanceUserEndpoint' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
a} :: RegisterAppInstanceUserEndpoint) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The ARN of the @AppInstanceUser@.
registerAppInstanceUserEndpoint_appInstanceUserArn :: Lens.Lens' RegisterAppInstanceUserEndpoint Prelude.Text
registerAppInstanceUserEndpoint_appInstanceUserArn :: Lens' RegisterAppInstanceUserEndpoint Text
registerAppInstanceUserEndpoint_appInstanceUserArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterAppInstanceUserEndpoint' {Sensitive Text
appInstanceUserArn :: Sensitive Text
$sel:appInstanceUserArn:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Sensitive Text
appInstanceUserArn} -> Sensitive Text
appInstanceUserArn) (\s :: RegisterAppInstanceUserEndpoint
s@RegisterAppInstanceUserEndpoint' {} Sensitive Text
a -> RegisterAppInstanceUserEndpoint
s {$sel:appInstanceUserArn:RegisterAppInstanceUserEndpoint' :: Sensitive Text
appInstanceUserArn = Sensitive Text
a} :: RegisterAppInstanceUserEndpoint) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The type of the @AppInstanceUserEndpoint@. Supported types:
--
-- -   @APNS@: The mobile notification service for an Apple device.
--
-- -   @APNS_SANDBOX@: The sandbox environment of the mobile notification
--     service for an Apple device.
--
-- -   @GCM@: The mobile notification service for an Android device.
--
-- Populate the @ResourceArn@ value of each type as @PinpointAppArn@.
registerAppInstanceUserEndpoint_type :: Lens.Lens' RegisterAppInstanceUserEndpoint AppInstanceUserEndpointType
registerAppInstanceUserEndpoint_type :: Lens' RegisterAppInstanceUserEndpoint AppInstanceUserEndpointType
registerAppInstanceUserEndpoint_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterAppInstanceUserEndpoint' {AppInstanceUserEndpointType
type' :: AppInstanceUserEndpointType
$sel:type':RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> AppInstanceUserEndpointType
type'} -> AppInstanceUserEndpointType
type') (\s :: RegisterAppInstanceUserEndpoint
s@RegisterAppInstanceUserEndpoint' {} AppInstanceUserEndpointType
a -> RegisterAppInstanceUserEndpoint
s {$sel:type':RegisterAppInstanceUserEndpoint' :: AppInstanceUserEndpointType
type' = AppInstanceUserEndpointType
a} :: RegisterAppInstanceUserEndpoint)

-- | The ARN of the resource to which the endpoint belongs.
registerAppInstanceUserEndpoint_resourceArn :: Lens.Lens' RegisterAppInstanceUserEndpoint Prelude.Text
registerAppInstanceUserEndpoint_resourceArn :: Lens' RegisterAppInstanceUserEndpoint Text
registerAppInstanceUserEndpoint_resourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterAppInstanceUserEndpoint' {Sensitive Text
resourceArn :: Sensitive Text
$sel:resourceArn:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Sensitive Text
resourceArn} -> Sensitive Text
resourceArn) (\s :: RegisterAppInstanceUserEndpoint
s@RegisterAppInstanceUserEndpoint' {} Sensitive Text
a -> RegisterAppInstanceUserEndpoint
s {$sel:resourceArn:RegisterAppInstanceUserEndpoint' :: Sensitive Text
resourceArn = Sensitive Text
a} :: RegisterAppInstanceUserEndpoint) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The attributes of an @Endpoint@.
registerAppInstanceUserEndpoint_endpointAttributes :: Lens.Lens' RegisterAppInstanceUserEndpoint EndpointAttributes
registerAppInstanceUserEndpoint_endpointAttributes :: Lens' RegisterAppInstanceUserEndpoint EndpointAttributes
registerAppInstanceUserEndpoint_endpointAttributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterAppInstanceUserEndpoint' {EndpointAttributes
endpointAttributes :: EndpointAttributes
$sel:endpointAttributes:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> EndpointAttributes
endpointAttributes} -> EndpointAttributes
endpointAttributes) (\s :: RegisterAppInstanceUserEndpoint
s@RegisterAppInstanceUserEndpoint' {} EndpointAttributes
a -> RegisterAppInstanceUserEndpoint
s {$sel:endpointAttributes:RegisterAppInstanceUserEndpoint' :: EndpointAttributes
endpointAttributes = EndpointAttributes
a} :: RegisterAppInstanceUserEndpoint)

-- | The idempotency token for each client request.
registerAppInstanceUserEndpoint_clientRequestToken :: Lens.Lens' RegisterAppInstanceUserEndpoint Prelude.Text
registerAppInstanceUserEndpoint_clientRequestToken :: Lens' RegisterAppInstanceUserEndpoint Text
registerAppInstanceUserEndpoint_clientRequestToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterAppInstanceUserEndpoint' {Sensitive Text
clientRequestToken :: Sensitive Text
$sel:clientRequestToken:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Sensitive Text
clientRequestToken} -> Sensitive Text
clientRequestToken) (\s :: RegisterAppInstanceUserEndpoint
s@RegisterAppInstanceUserEndpoint' {} Sensitive Text
a -> RegisterAppInstanceUserEndpoint
s {$sel:clientRequestToken:RegisterAppInstanceUserEndpoint' :: Sensitive Text
clientRequestToken = Sensitive Text
a} :: RegisterAppInstanceUserEndpoint) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

instance
  Core.AWSRequest
    RegisterAppInstanceUserEndpoint
  where
  type
    AWSResponse RegisterAppInstanceUserEndpoint =
      RegisterAppInstanceUserEndpointResponse
  request :: (Service -> Service)
-> RegisterAppInstanceUserEndpoint
-> Request RegisterAppInstanceUserEndpoint
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 RegisterAppInstanceUserEndpoint
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse RegisterAppInstanceUserEndpoint)))
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 (Sensitive Text)
-> Maybe (Sensitive Text)
-> Int
-> RegisterAppInstanceUserEndpointResponse
RegisterAppInstanceUserEndpointResponse'
            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
"AppInstanceUserArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"EndpointId")
            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
    RegisterAppInstanceUserEndpoint
  where
  hashWithSalt :: Int -> RegisterAppInstanceUserEndpoint -> Int
hashWithSalt
    Int
_salt
    RegisterAppInstanceUserEndpoint' {Maybe (Sensitive Text)
Maybe AllowMessages
Sensitive Text
AppInstanceUserEndpointType
EndpointAttributes
clientRequestToken :: Sensitive Text
endpointAttributes :: EndpointAttributes
resourceArn :: Sensitive Text
type' :: AppInstanceUserEndpointType
appInstanceUserArn :: Sensitive Text
name :: Maybe (Sensitive Text)
allowMessages :: Maybe AllowMessages
$sel:clientRequestToken:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Sensitive Text
$sel:endpointAttributes:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> EndpointAttributes
$sel:resourceArn:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Sensitive Text
$sel:type':RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> AppInstanceUserEndpointType
$sel:appInstanceUserArn:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Sensitive Text
$sel:name:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Maybe (Sensitive Text)
$sel:allowMessages:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Maybe AllowMessages
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AllowMessages
allowMessages
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
name
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
appInstanceUserArn
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AppInstanceUserEndpointType
type'
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
resourceArn
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` EndpointAttributes
endpointAttributes
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
clientRequestToken

instance
  Prelude.NFData
    RegisterAppInstanceUserEndpoint
  where
  rnf :: RegisterAppInstanceUserEndpoint -> ()
rnf RegisterAppInstanceUserEndpoint' {Maybe (Sensitive Text)
Maybe AllowMessages
Sensitive Text
AppInstanceUserEndpointType
EndpointAttributes
clientRequestToken :: Sensitive Text
endpointAttributes :: EndpointAttributes
resourceArn :: Sensitive Text
type' :: AppInstanceUserEndpointType
appInstanceUserArn :: Sensitive Text
name :: Maybe (Sensitive Text)
allowMessages :: Maybe AllowMessages
$sel:clientRequestToken:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Sensitive Text
$sel:endpointAttributes:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> EndpointAttributes
$sel:resourceArn:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Sensitive Text
$sel:type':RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> AppInstanceUserEndpointType
$sel:appInstanceUserArn:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Sensitive Text
$sel:name:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Maybe (Sensitive Text)
$sel:allowMessages:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Maybe AllowMessages
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AllowMessages
allowMessages
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
appInstanceUserArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf AppInstanceUserEndpointType
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
resourceArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf EndpointAttributes
endpointAttributes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
clientRequestToken

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

instance Data.ToJSON RegisterAppInstanceUserEndpoint where
  toJSON :: RegisterAppInstanceUserEndpoint -> Value
toJSON RegisterAppInstanceUserEndpoint' {Maybe (Sensitive Text)
Maybe AllowMessages
Sensitive Text
AppInstanceUserEndpointType
EndpointAttributes
clientRequestToken :: Sensitive Text
endpointAttributes :: EndpointAttributes
resourceArn :: Sensitive Text
type' :: AppInstanceUserEndpointType
appInstanceUserArn :: Sensitive Text
name :: Maybe (Sensitive Text)
allowMessages :: Maybe AllowMessages
$sel:clientRequestToken:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Sensitive Text
$sel:endpointAttributes:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> EndpointAttributes
$sel:resourceArn:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Sensitive Text
$sel:type':RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> AppInstanceUserEndpointType
$sel:appInstanceUserArn:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Sensitive Text
$sel:name:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Maybe (Sensitive Text)
$sel:allowMessages:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Maybe AllowMessages
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AllowMessages" 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 AllowMessages
allowMessages,
            (Key
"Name" 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 (Sensitive Text)
name,
            forall a. a -> Maybe a
Prelude.Just (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= AppInstanceUserEndpointType
type'),
            forall a. a -> Maybe a
Prelude.Just (Key
"ResourceArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
resourceArn),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"EndpointAttributes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= EndpointAttributes
endpointAttributes),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"ClientRequestToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
clientRequestToken)
          ]
      )

instance Data.ToPath RegisterAppInstanceUserEndpoint where
  toPath :: RegisterAppInstanceUserEndpoint -> ByteString
toPath RegisterAppInstanceUserEndpoint' {Maybe (Sensitive Text)
Maybe AllowMessages
Sensitive Text
AppInstanceUserEndpointType
EndpointAttributes
clientRequestToken :: Sensitive Text
endpointAttributes :: EndpointAttributes
resourceArn :: Sensitive Text
type' :: AppInstanceUserEndpointType
appInstanceUserArn :: Sensitive Text
name :: Maybe (Sensitive Text)
allowMessages :: Maybe AllowMessages
$sel:clientRequestToken:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Sensitive Text
$sel:endpointAttributes:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> EndpointAttributes
$sel:resourceArn:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Sensitive Text
$sel:type':RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> AppInstanceUserEndpointType
$sel:appInstanceUserArn:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Sensitive Text
$sel:name:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Maybe (Sensitive Text)
$sel:allowMessages:RegisterAppInstanceUserEndpoint' :: RegisterAppInstanceUserEndpoint -> Maybe AllowMessages
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/app-instance-users/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Sensitive Text
appInstanceUserArn,
        ByteString
"/endpoints"
      ]

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

-- | /See:/ 'newRegisterAppInstanceUserEndpointResponse' smart constructor.
data RegisterAppInstanceUserEndpointResponse = RegisterAppInstanceUserEndpointResponse'
  { -- | The ARN of the @AppInstanceUser@.
    RegisterAppInstanceUserEndpointResponse -> Maybe (Sensitive Text)
appInstanceUserArn :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The unique identifier of the @AppInstanceUserEndpoint@.
    RegisterAppInstanceUserEndpointResponse -> Maybe (Sensitive Text)
endpointId :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The response's http status code.
    RegisterAppInstanceUserEndpointResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (RegisterAppInstanceUserEndpointResponse
-> RegisterAppInstanceUserEndpointResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterAppInstanceUserEndpointResponse
-> RegisterAppInstanceUserEndpointResponse -> Bool
$c/= :: RegisterAppInstanceUserEndpointResponse
-> RegisterAppInstanceUserEndpointResponse -> Bool
== :: RegisterAppInstanceUserEndpointResponse
-> RegisterAppInstanceUserEndpointResponse -> Bool
$c== :: RegisterAppInstanceUserEndpointResponse
-> RegisterAppInstanceUserEndpointResponse -> Bool
Prelude.Eq, Int -> RegisterAppInstanceUserEndpointResponse -> ShowS
[RegisterAppInstanceUserEndpointResponse] -> ShowS
RegisterAppInstanceUserEndpointResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterAppInstanceUserEndpointResponse] -> ShowS
$cshowList :: [RegisterAppInstanceUserEndpointResponse] -> ShowS
show :: RegisterAppInstanceUserEndpointResponse -> String
$cshow :: RegisterAppInstanceUserEndpointResponse -> String
showsPrec :: Int -> RegisterAppInstanceUserEndpointResponse -> ShowS
$cshowsPrec :: Int -> RegisterAppInstanceUserEndpointResponse -> ShowS
Prelude.Show, forall x.
Rep RegisterAppInstanceUserEndpointResponse x
-> RegisterAppInstanceUserEndpointResponse
forall x.
RegisterAppInstanceUserEndpointResponse
-> Rep RegisterAppInstanceUserEndpointResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterAppInstanceUserEndpointResponse x
-> RegisterAppInstanceUserEndpointResponse
$cfrom :: forall x.
RegisterAppInstanceUserEndpointResponse
-> Rep RegisterAppInstanceUserEndpointResponse x
Prelude.Generic)

-- |
-- Create a value of 'RegisterAppInstanceUserEndpointResponse' 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', 'registerAppInstanceUserEndpointResponse_appInstanceUserArn' - The ARN of the @AppInstanceUser@.
--
-- 'endpointId', 'registerAppInstanceUserEndpointResponse_endpointId' - The unique identifier of the @AppInstanceUserEndpoint@.
--
-- 'httpStatus', 'registerAppInstanceUserEndpointResponse_httpStatus' - The response's http status code.
newRegisterAppInstanceUserEndpointResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RegisterAppInstanceUserEndpointResponse
newRegisterAppInstanceUserEndpointResponse :: Int -> RegisterAppInstanceUserEndpointResponse
newRegisterAppInstanceUserEndpointResponse
  Int
pHttpStatus_ =
    RegisterAppInstanceUserEndpointResponse'
      { $sel:appInstanceUserArn:RegisterAppInstanceUserEndpointResponse' :: Maybe (Sensitive Text)
appInstanceUserArn =
          forall a. Maybe a
Prelude.Nothing,
        $sel:endpointId:RegisterAppInstanceUserEndpointResponse' :: Maybe (Sensitive Text)
endpointId = forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:RegisterAppInstanceUserEndpointResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The ARN of the @AppInstanceUser@.
registerAppInstanceUserEndpointResponse_appInstanceUserArn :: Lens.Lens' RegisterAppInstanceUserEndpointResponse (Prelude.Maybe Prelude.Text)
registerAppInstanceUserEndpointResponse_appInstanceUserArn :: Lens' RegisterAppInstanceUserEndpointResponse (Maybe Text)
registerAppInstanceUserEndpointResponse_appInstanceUserArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterAppInstanceUserEndpointResponse' {Maybe (Sensitive Text)
appInstanceUserArn :: Maybe (Sensitive Text)
$sel:appInstanceUserArn:RegisterAppInstanceUserEndpointResponse' :: RegisterAppInstanceUserEndpointResponse -> Maybe (Sensitive Text)
appInstanceUserArn} -> Maybe (Sensitive Text)
appInstanceUserArn) (\s :: RegisterAppInstanceUserEndpointResponse
s@RegisterAppInstanceUserEndpointResponse' {} Maybe (Sensitive Text)
a -> RegisterAppInstanceUserEndpointResponse
s {$sel:appInstanceUserArn:RegisterAppInstanceUserEndpointResponse' :: Maybe (Sensitive Text)
appInstanceUserArn = Maybe (Sensitive Text)
a} :: RegisterAppInstanceUserEndpointResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The unique identifier of the @AppInstanceUserEndpoint@.
registerAppInstanceUserEndpointResponse_endpointId :: Lens.Lens' RegisterAppInstanceUserEndpointResponse (Prelude.Maybe Prelude.Text)
registerAppInstanceUserEndpointResponse_endpointId :: Lens' RegisterAppInstanceUserEndpointResponse (Maybe Text)
registerAppInstanceUserEndpointResponse_endpointId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterAppInstanceUserEndpointResponse' {Maybe (Sensitive Text)
endpointId :: Maybe (Sensitive Text)
$sel:endpointId:RegisterAppInstanceUserEndpointResponse' :: RegisterAppInstanceUserEndpointResponse -> Maybe (Sensitive Text)
endpointId} -> Maybe (Sensitive Text)
endpointId) (\s :: RegisterAppInstanceUserEndpointResponse
s@RegisterAppInstanceUserEndpointResponse' {} Maybe (Sensitive Text)
a -> RegisterAppInstanceUserEndpointResponse
s {$sel:endpointId:RegisterAppInstanceUserEndpointResponse' :: Maybe (Sensitive Text)
endpointId = Maybe (Sensitive Text)
a} :: RegisterAppInstanceUserEndpointResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

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

instance
  Prelude.NFData
    RegisterAppInstanceUserEndpointResponse
  where
  rnf :: RegisterAppInstanceUserEndpointResponse -> ()
rnf RegisterAppInstanceUserEndpointResponse' {Int
Maybe (Sensitive Text)
httpStatus :: Int
endpointId :: Maybe (Sensitive Text)
appInstanceUserArn :: Maybe (Sensitive Text)
$sel:httpStatus:RegisterAppInstanceUserEndpointResponse' :: RegisterAppInstanceUserEndpointResponse -> Int
$sel:endpointId:RegisterAppInstanceUserEndpointResponse' :: RegisterAppInstanceUserEndpointResponse -> Maybe (Sensitive Text)
$sel:appInstanceUserArn:RegisterAppInstanceUserEndpointResponse' :: RegisterAppInstanceUserEndpointResponse -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
appInstanceUserArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
endpointId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus