{-# 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.IamRegistrationResponse
-- 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.IamRegistrationResponse 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 registering an Identity and Access Management (IAM)
-- resource so Amazon Web Services IoT FleetWise edge agent software can
-- transfer your vehicle data to Amazon Timestream.
--
-- /See:/ 'newIamRegistrationResponse' smart constructor.
data IamRegistrationResponse = IamRegistrationResponse'
  { -- | A message associated with a registration error.
    IamRegistrationResponse -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM role to register.
    IamRegistrationResponse -> Text
roleArn :: Prelude.Text,
    -- | The status of registering your IAM resource. The status can be one of
    -- @REGISTRATION_SUCCESS@, @REGISTRATION_PENDING@, @REGISTRATION_FAILURE@.
    IamRegistrationResponse -> RegistrationStatus
registrationStatus :: RegistrationStatus
  }
  deriving (IamRegistrationResponse -> IamRegistrationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IamRegistrationResponse -> IamRegistrationResponse -> Bool
$c/= :: IamRegistrationResponse -> IamRegistrationResponse -> Bool
== :: IamRegistrationResponse -> IamRegistrationResponse -> Bool
$c== :: IamRegistrationResponse -> IamRegistrationResponse -> Bool
Prelude.Eq, ReadPrec [IamRegistrationResponse]
ReadPrec IamRegistrationResponse
Int -> ReadS IamRegistrationResponse
ReadS [IamRegistrationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IamRegistrationResponse]
$creadListPrec :: ReadPrec [IamRegistrationResponse]
readPrec :: ReadPrec IamRegistrationResponse
$creadPrec :: ReadPrec IamRegistrationResponse
readList :: ReadS [IamRegistrationResponse]
$creadList :: ReadS [IamRegistrationResponse]
readsPrec :: Int -> ReadS IamRegistrationResponse
$creadsPrec :: Int -> ReadS IamRegistrationResponse
Prelude.Read, Int -> IamRegistrationResponse -> ShowS
[IamRegistrationResponse] -> ShowS
IamRegistrationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IamRegistrationResponse] -> ShowS
$cshowList :: [IamRegistrationResponse] -> ShowS
show :: IamRegistrationResponse -> String
$cshow :: IamRegistrationResponse -> String
showsPrec :: Int -> IamRegistrationResponse -> ShowS
$cshowsPrec :: Int -> IamRegistrationResponse -> ShowS
Prelude.Show, forall x. Rep IamRegistrationResponse x -> IamRegistrationResponse
forall x. IamRegistrationResponse -> Rep IamRegistrationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IamRegistrationResponse x -> IamRegistrationResponse
$cfrom :: forall x. IamRegistrationResponse -> Rep IamRegistrationResponse x
Prelude.Generic)

-- |
-- Create a value of 'IamRegistrationResponse' 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', 'iamRegistrationResponse_errorMessage' - A message associated with a registration error.
--
-- 'roleArn', 'iamRegistrationResponse_roleArn' - The Amazon Resource Name (ARN) of the IAM role to register.
--
-- 'registrationStatus', 'iamRegistrationResponse_registrationStatus' - The status of registering your IAM resource. The status can be one of
-- @REGISTRATION_SUCCESS@, @REGISTRATION_PENDING@, @REGISTRATION_FAILURE@.
newIamRegistrationResponse ::
  -- | 'roleArn'
  Prelude.Text ->
  -- | 'registrationStatus'
  RegistrationStatus ->
  IamRegistrationResponse
newIamRegistrationResponse :: Text -> RegistrationStatus -> IamRegistrationResponse
newIamRegistrationResponse
  Text
pRoleArn_
  RegistrationStatus
pRegistrationStatus_ =
    IamRegistrationResponse'
      { $sel:errorMessage:IamRegistrationResponse' :: Maybe Text
errorMessage =
          forall a. Maybe a
Prelude.Nothing,
        $sel:roleArn:IamRegistrationResponse' :: Text
roleArn = Text
pRoleArn_,
        $sel:registrationStatus:IamRegistrationResponse' :: RegistrationStatus
registrationStatus = RegistrationStatus
pRegistrationStatus_
      }

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

-- | The Amazon Resource Name (ARN) of the IAM role to register.
iamRegistrationResponse_roleArn :: Lens.Lens' IamRegistrationResponse Prelude.Text
iamRegistrationResponse_roleArn :: Lens' IamRegistrationResponse Text
iamRegistrationResponse_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IamRegistrationResponse' {Text
roleArn :: Text
$sel:roleArn:IamRegistrationResponse' :: IamRegistrationResponse -> Text
roleArn} -> Text
roleArn) (\s :: IamRegistrationResponse
s@IamRegistrationResponse' {} Text
a -> IamRegistrationResponse
s {$sel:roleArn:IamRegistrationResponse' :: Text
roleArn = Text
a} :: IamRegistrationResponse)

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

instance Data.FromJSON IamRegistrationResponse where
  parseJSON :: Value -> Parser IamRegistrationResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"IamRegistrationResponse"
      ( \Object
x ->
          Maybe Text -> Text -> RegistrationStatus -> IamRegistrationResponse
IamRegistrationResponse'
            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 a
Data..: Key
"roleArn")
            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 IamRegistrationResponse where
  hashWithSalt :: Int -> IamRegistrationResponse -> Int
hashWithSalt Int
_salt IamRegistrationResponse' {Maybe Text
Text
RegistrationStatus
registrationStatus :: RegistrationStatus
roleArn :: Text
errorMessage :: Maybe Text
$sel:registrationStatus:IamRegistrationResponse' :: IamRegistrationResponse -> RegistrationStatus
$sel:roleArn:IamRegistrationResponse' :: IamRegistrationResponse -> Text
$sel:errorMessage:IamRegistrationResponse' :: IamRegistrationResponse -> 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` Text
roleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RegistrationStatus
registrationStatus

instance Prelude.NFData IamRegistrationResponse where
  rnf :: IamRegistrationResponse -> ()
rnf IamRegistrationResponse' {Maybe Text
Text
RegistrationStatus
registrationStatus :: RegistrationStatus
roleArn :: Text
errorMessage :: Maybe Text
$sel:registrationStatus:IamRegistrationResponse' :: IamRegistrationResponse -> RegistrationStatus
$sel:roleArn:IamRegistrationResponse' :: IamRegistrationResponse -> Text
$sel:errorMessage:IamRegistrationResponse' :: IamRegistrationResponse -> 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 Text
roleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RegistrationStatus
registrationStatus