{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.IoTFleetWise.Types.TimestreamRegistrationResponse
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTFleetWise.Types.TimestreamRegistrationResponse where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTFleetWise.Types.RegistrationStatus
import qualified Amazonka.Prelude as Prelude

-- | Information about the registered Amazon Timestream resources or errors,
-- if any.
--
-- /See:/ 'newTimestreamRegistrationResponse' smart constructor.
data TimestreamRegistrationResponse = TimestreamRegistrationResponse'
  { -- | A message associated with a registration error.
    TimestreamRegistrationResponse -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the Timestream database.
    TimestreamRegistrationResponse -> Maybe Text
timestreamDatabaseArn :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the Timestream database table.
    TimestreamRegistrationResponse -> Maybe Text
timestreamTableArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the Timestream database.
    TimestreamRegistrationResponse -> Text
timestreamDatabaseName :: Prelude.Text,
    -- | The name of the Timestream database table.
    TimestreamRegistrationResponse -> Text
timestreamTableName :: Prelude.Text,
    -- | The status of registering your Amazon Timestream resources. The status
    -- can be one of @REGISTRATION_SUCCESS@, @REGISTRATION_PENDING@,
    -- @REGISTRATION_FAILURE@.
    TimestreamRegistrationResponse -> RegistrationStatus
registrationStatus :: RegistrationStatus
  }
  deriving (TimestreamRegistrationResponse
-> TimestreamRegistrationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimestreamRegistrationResponse
-> TimestreamRegistrationResponse -> Bool
$c/= :: TimestreamRegistrationResponse
-> TimestreamRegistrationResponse -> Bool
== :: TimestreamRegistrationResponse
-> TimestreamRegistrationResponse -> Bool
$c== :: TimestreamRegistrationResponse
-> TimestreamRegistrationResponse -> Bool
Prelude.Eq, ReadPrec [TimestreamRegistrationResponse]
ReadPrec TimestreamRegistrationResponse
Int -> ReadS TimestreamRegistrationResponse
ReadS [TimestreamRegistrationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimestreamRegistrationResponse]
$creadListPrec :: ReadPrec [TimestreamRegistrationResponse]
readPrec :: ReadPrec TimestreamRegistrationResponse
$creadPrec :: ReadPrec TimestreamRegistrationResponse
readList :: ReadS [TimestreamRegistrationResponse]
$creadList :: ReadS [TimestreamRegistrationResponse]
readsPrec :: Int -> ReadS TimestreamRegistrationResponse
$creadsPrec :: Int -> ReadS TimestreamRegistrationResponse
Prelude.Read, Int -> TimestreamRegistrationResponse -> ShowS
[TimestreamRegistrationResponse] -> ShowS
TimestreamRegistrationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimestreamRegistrationResponse] -> ShowS
$cshowList :: [TimestreamRegistrationResponse] -> ShowS
show :: TimestreamRegistrationResponse -> String
$cshow :: TimestreamRegistrationResponse -> String
showsPrec :: Int -> TimestreamRegistrationResponse -> ShowS
$cshowsPrec :: Int -> TimestreamRegistrationResponse -> ShowS
Prelude.Show, forall x.
Rep TimestreamRegistrationResponse x
-> TimestreamRegistrationResponse
forall x.
TimestreamRegistrationResponse
-> Rep TimestreamRegistrationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TimestreamRegistrationResponse x
-> TimestreamRegistrationResponse
$cfrom :: forall x.
TimestreamRegistrationResponse
-> Rep TimestreamRegistrationResponse x
Prelude.Generic)

-- |
-- Create a value of 'TimestreamRegistrationResponse' 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:
--
-- 'errorMessage', 'timestreamRegistrationResponse_errorMessage' - A message associated with a registration error.
--
-- 'timestreamDatabaseArn', 'timestreamRegistrationResponse_timestreamDatabaseArn' - The Amazon Resource Name (ARN) of the Timestream database.
--
-- 'timestreamTableArn', 'timestreamRegistrationResponse_timestreamTableArn' - The ARN of the Timestream database table.
--
-- 'timestreamDatabaseName', 'timestreamRegistrationResponse_timestreamDatabaseName' - The name of the Timestream database.
--
-- 'timestreamTableName', 'timestreamRegistrationResponse_timestreamTableName' - The name of the Timestream database table.
--
-- 'registrationStatus', 'timestreamRegistrationResponse_registrationStatus' - The status of registering your Amazon Timestream resources. The status
-- can be one of @REGISTRATION_SUCCESS@, @REGISTRATION_PENDING@,
-- @REGISTRATION_FAILURE@.
newTimestreamRegistrationResponse ::
  -- | 'timestreamDatabaseName'
  Prelude.Text ->
  -- | 'timestreamTableName'
  Prelude.Text ->
  -- | 'registrationStatus'
  RegistrationStatus ->
  TimestreamRegistrationResponse
newTimestreamRegistrationResponse :: Text
-> Text -> RegistrationStatus -> TimestreamRegistrationResponse
newTimestreamRegistrationResponse
  Text
pTimestreamDatabaseName_
  Text
pTimestreamTableName_
  RegistrationStatus
pRegistrationStatus_ =
    TimestreamRegistrationResponse'
      { $sel:errorMessage:TimestreamRegistrationResponse' :: Maybe Text
errorMessage =
          forall a. Maybe a
Prelude.Nothing,
        $sel:timestreamDatabaseArn:TimestreamRegistrationResponse' :: Maybe Text
timestreamDatabaseArn = forall a. Maybe a
Prelude.Nothing,
        $sel:timestreamTableArn:TimestreamRegistrationResponse' :: Maybe Text
timestreamTableArn = forall a. Maybe a
Prelude.Nothing,
        $sel:timestreamDatabaseName:TimestreamRegistrationResponse' :: Text
timestreamDatabaseName =
          Text
pTimestreamDatabaseName_,
        $sel:timestreamTableName:TimestreamRegistrationResponse' :: Text
timestreamTableName = Text
pTimestreamTableName_,
        $sel:registrationStatus:TimestreamRegistrationResponse' :: RegistrationStatus
registrationStatus = RegistrationStatus
pRegistrationStatus_
      }

-- | A message associated with a registration error.
timestreamRegistrationResponse_errorMessage :: Lens.Lens' TimestreamRegistrationResponse (Prelude.Maybe Prelude.Text)
timestreamRegistrationResponse_errorMessage :: Lens' TimestreamRegistrationResponse (Maybe Text)
timestreamRegistrationResponse_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamRegistrationResponse' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: TimestreamRegistrationResponse
s@TimestreamRegistrationResponse' {} Maybe Text
a -> TimestreamRegistrationResponse
s {$sel:errorMessage:TimestreamRegistrationResponse' :: Maybe Text
errorMessage = Maybe Text
a} :: TimestreamRegistrationResponse)

-- | The Amazon Resource Name (ARN) of the Timestream database.
timestreamRegistrationResponse_timestreamDatabaseArn :: Lens.Lens' TimestreamRegistrationResponse (Prelude.Maybe Prelude.Text)
timestreamRegistrationResponse_timestreamDatabaseArn :: Lens' TimestreamRegistrationResponse (Maybe Text)
timestreamRegistrationResponse_timestreamDatabaseArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamRegistrationResponse' {Maybe Text
timestreamDatabaseArn :: Maybe Text
$sel:timestreamDatabaseArn:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> Maybe Text
timestreamDatabaseArn} -> Maybe Text
timestreamDatabaseArn) (\s :: TimestreamRegistrationResponse
s@TimestreamRegistrationResponse' {} Maybe Text
a -> TimestreamRegistrationResponse
s {$sel:timestreamDatabaseArn:TimestreamRegistrationResponse' :: Maybe Text
timestreamDatabaseArn = Maybe Text
a} :: TimestreamRegistrationResponse)

-- | The ARN of the Timestream database table.
timestreamRegistrationResponse_timestreamTableArn :: Lens.Lens' TimestreamRegistrationResponse (Prelude.Maybe Prelude.Text)
timestreamRegistrationResponse_timestreamTableArn :: Lens' TimestreamRegistrationResponse (Maybe Text)
timestreamRegistrationResponse_timestreamTableArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamRegistrationResponse' {Maybe Text
timestreamTableArn :: Maybe Text
$sel:timestreamTableArn:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> Maybe Text
timestreamTableArn} -> Maybe Text
timestreamTableArn) (\s :: TimestreamRegistrationResponse
s@TimestreamRegistrationResponse' {} Maybe Text
a -> TimestreamRegistrationResponse
s {$sel:timestreamTableArn:TimestreamRegistrationResponse' :: Maybe Text
timestreamTableArn = Maybe Text
a} :: TimestreamRegistrationResponse)

-- | The name of the Timestream database.
timestreamRegistrationResponse_timestreamDatabaseName :: Lens.Lens' TimestreamRegistrationResponse Prelude.Text
timestreamRegistrationResponse_timestreamDatabaseName :: Lens' TimestreamRegistrationResponse Text
timestreamRegistrationResponse_timestreamDatabaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamRegistrationResponse' {Text
timestreamDatabaseName :: Text
$sel:timestreamDatabaseName:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> Text
timestreamDatabaseName} -> Text
timestreamDatabaseName) (\s :: TimestreamRegistrationResponse
s@TimestreamRegistrationResponse' {} Text
a -> TimestreamRegistrationResponse
s {$sel:timestreamDatabaseName:TimestreamRegistrationResponse' :: Text
timestreamDatabaseName = Text
a} :: TimestreamRegistrationResponse)

-- | The name of the Timestream database table.
timestreamRegistrationResponse_timestreamTableName :: Lens.Lens' TimestreamRegistrationResponse Prelude.Text
timestreamRegistrationResponse_timestreamTableName :: Lens' TimestreamRegistrationResponse Text
timestreamRegistrationResponse_timestreamTableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamRegistrationResponse' {Text
timestreamTableName :: Text
$sel:timestreamTableName:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> Text
timestreamTableName} -> Text
timestreamTableName) (\s :: TimestreamRegistrationResponse
s@TimestreamRegistrationResponse' {} Text
a -> TimestreamRegistrationResponse
s {$sel:timestreamTableName:TimestreamRegistrationResponse' :: Text
timestreamTableName = Text
a} :: TimestreamRegistrationResponse)

-- | The status of registering your Amazon Timestream resources. The status
-- can be one of @REGISTRATION_SUCCESS@, @REGISTRATION_PENDING@,
-- @REGISTRATION_FAILURE@.
timestreamRegistrationResponse_registrationStatus :: Lens.Lens' TimestreamRegistrationResponse RegistrationStatus
timestreamRegistrationResponse_registrationStatus :: Lens' TimestreamRegistrationResponse RegistrationStatus
timestreamRegistrationResponse_registrationStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamRegistrationResponse' {RegistrationStatus
registrationStatus :: RegistrationStatus
$sel:registrationStatus:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> RegistrationStatus
registrationStatus} -> RegistrationStatus
registrationStatus) (\s :: TimestreamRegistrationResponse
s@TimestreamRegistrationResponse' {} RegistrationStatus
a -> TimestreamRegistrationResponse
s {$sel:registrationStatus:TimestreamRegistrationResponse' :: RegistrationStatus
registrationStatus = RegistrationStatus
a} :: TimestreamRegistrationResponse)

instance Data.FromJSON TimestreamRegistrationResponse where
  parseJSON :: Value -> Parser TimestreamRegistrationResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TimestreamRegistrationResponse"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> RegistrationStatus
-> TimestreamRegistrationResponse
TimestreamRegistrationResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"errorMessage")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"timestreamDatabaseArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"timestreamTableArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"timestreamDatabaseName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"timestreamTableName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"registrationStatus")
      )

instance
  Prelude.Hashable
    TimestreamRegistrationResponse
  where
  hashWithSalt :: Int -> TimestreamRegistrationResponse -> Int
hashWithSalt
    Int
_salt
    TimestreamRegistrationResponse' {Maybe Text
Text
RegistrationStatus
registrationStatus :: RegistrationStatus
timestreamTableName :: Text
timestreamDatabaseName :: Text
timestreamTableArn :: Maybe Text
timestreamDatabaseArn :: Maybe Text
errorMessage :: Maybe Text
$sel:registrationStatus:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> RegistrationStatus
$sel:timestreamTableName:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> Text
$sel:timestreamDatabaseName:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> Text
$sel:timestreamTableArn:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> Maybe Text
$sel:timestreamDatabaseArn:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> Maybe Text
$sel:errorMessage:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
timestreamDatabaseArn
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
timestreamTableArn
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
timestreamDatabaseName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
timestreamTableName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RegistrationStatus
registrationStatus

instance
  Prelude.NFData
    TimestreamRegistrationResponse
  where
  rnf :: TimestreamRegistrationResponse -> ()
rnf TimestreamRegistrationResponse' {Maybe Text
Text
RegistrationStatus
registrationStatus :: RegistrationStatus
timestreamTableName :: Text
timestreamDatabaseName :: Text
timestreamTableArn :: Maybe Text
timestreamDatabaseArn :: Maybe Text
errorMessage :: Maybe Text
$sel:registrationStatus:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> RegistrationStatus
$sel:timestreamTableName:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> Text
$sel:timestreamDatabaseName:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> Text
$sel:timestreamTableArn:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> Maybe Text
$sel:timestreamDatabaseArn:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> Maybe Text
$sel:errorMessage:TimestreamRegistrationResponse' :: TimestreamRegistrationResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
timestreamDatabaseArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
timestreamTableArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
timestreamDatabaseName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
timestreamTableName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RegistrationStatus
registrationStatus