{-# 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.AppFlow.Types.RegistrationOutput
-- 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.AppFlow.Types.RegistrationOutput where

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

-- | Describes the status of an attempt from Amazon AppFlow to register a
-- resource.
--
-- When you run a flow that you\'ve configured to use a metadata catalog,
-- Amazon AppFlow registers a metadata table and data partitions with that
-- catalog. This operation provides the status of that registration
-- attempt. The operation also indicates how many related resources Amazon
-- AppFlow created or updated.
--
-- /See:/ 'newRegistrationOutput' smart constructor.
data RegistrationOutput = RegistrationOutput'
  { -- | Explains the status of the registration attempt from Amazon AppFlow. If
    -- the attempt fails, the message explains why.
    RegistrationOutput -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | Indicates the number of resources that Amazon AppFlow created or
    -- updated. Possible resources include metadata tables and data partitions.
    RegistrationOutput -> Maybe Text
result :: Prelude.Maybe Prelude.Text,
    -- | Indicates the status of the registration attempt from Amazon AppFlow.
    RegistrationOutput -> Maybe ExecutionStatus
status :: Prelude.Maybe ExecutionStatus
  }
  deriving (RegistrationOutput -> RegistrationOutput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegistrationOutput -> RegistrationOutput -> Bool
$c/= :: RegistrationOutput -> RegistrationOutput -> Bool
== :: RegistrationOutput -> RegistrationOutput -> Bool
$c== :: RegistrationOutput -> RegistrationOutput -> Bool
Prelude.Eq, ReadPrec [RegistrationOutput]
ReadPrec RegistrationOutput
Int -> ReadS RegistrationOutput
ReadS [RegistrationOutput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegistrationOutput]
$creadListPrec :: ReadPrec [RegistrationOutput]
readPrec :: ReadPrec RegistrationOutput
$creadPrec :: ReadPrec RegistrationOutput
readList :: ReadS [RegistrationOutput]
$creadList :: ReadS [RegistrationOutput]
readsPrec :: Int -> ReadS RegistrationOutput
$creadsPrec :: Int -> ReadS RegistrationOutput
Prelude.Read, Int -> RegistrationOutput -> ShowS
[RegistrationOutput] -> ShowS
RegistrationOutput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegistrationOutput] -> ShowS
$cshowList :: [RegistrationOutput] -> ShowS
show :: RegistrationOutput -> String
$cshow :: RegistrationOutput -> String
showsPrec :: Int -> RegistrationOutput -> ShowS
$cshowsPrec :: Int -> RegistrationOutput -> ShowS
Prelude.Show, forall x. Rep RegistrationOutput x -> RegistrationOutput
forall x. RegistrationOutput -> Rep RegistrationOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegistrationOutput x -> RegistrationOutput
$cfrom :: forall x. RegistrationOutput -> Rep RegistrationOutput x
Prelude.Generic)

-- |
-- Create a value of 'RegistrationOutput' 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:
--
-- 'message', 'registrationOutput_message' - Explains the status of the registration attempt from Amazon AppFlow. If
-- the attempt fails, the message explains why.
--
-- 'result', 'registrationOutput_result' - Indicates the number of resources that Amazon AppFlow created or
-- updated. Possible resources include metadata tables and data partitions.
--
-- 'status', 'registrationOutput_status' - Indicates the status of the registration attempt from Amazon AppFlow.
newRegistrationOutput ::
  RegistrationOutput
newRegistrationOutput :: RegistrationOutput
newRegistrationOutput =
  RegistrationOutput'
    { $sel:message:RegistrationOutput' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing,
      $sel:result:RegistrationOutput' :: Maybe Text
result = forall a. Maybe a
Prelude.Nothing,
      $sel:status:RegistrationOutput' :: Maybe ExecutionStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | Explains the status of the registration attempt from Amazon AppFlow. If
-- the attempt fails, the message explains why.
registrationOutput_message :: Lens.Lens' RegistrationOutput (Prelude.Maybe Prelude.Text)
registrationOutput_message :: Lens' RegistrationOutput (Maybe Text)
registrationOutput_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegistrationOutput' {Maybe Text
message :: Maybe Text
$sel:message:RegistrationOutput' :: RegistrationOutput -> Maybe Text
message} -> Maybe Text
message) (\s :: RegistrationOutput
s@RegistrationOutput' {} Maybe Text
a -> RegistrationOutput
s {$sel:message:RegistrationOutput' :: Maybe Text
message = Maybe Text
a} :: RegistrationOutput)

-- | Indicates the number of resources that Amazon AppFlow created or
-- updated. Possible resources include metadata tables and data partitions.
registrationOutput_result :: Lens.Lens' RegistrationOutput (Prelude.Maybe Prelude.Text)
registrationOutput_result :: Lens' RegistrationOutput (Maybe Text)
registrationOutput_result = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegistrationOutput' {Maybe Text
result :: Maybe Text
$sel:result:RegistrationOutput' :: RegistrationOutput -> Maybe Text
result} -> Maybe Text
result) (\s :: RegistrationOutput
s@RegistrationOutput' {} Maybe Text
a -> RegistrationOutput
s {$sel:result:RegistrationOutput' :: Maybe Text
result = Maybe Text
a} :: RegistrationOutput)

-- | Indicates the status of the registration attempt from Amazon AppFlow.
registrationOutput_status :: Lens.Lens' RegistrationOutput (Prelude.Maybe ExecutionStatus)
registrationOutput_status :: Lens' RegistrationOutput (Maybe ExecutionStatus)
registrationOutput_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegistrationOutput' {Maybe ExecutionStatus
status :: Maybe ExecutionStatus
$sel:status:RegistrationOutput' :: RegistrationOutput -> Maybe ExecutionStatus
status} -> Maybe ExecutionStatus
status) (\s :: RegistrationOutput
s@RegistrationOutput' {} Maybe ExecutionStatus
a -> RegistrationOutput
s {$sel:status:RegistrationOutput' :: Maybe ExecutionStatus
status = Maybe ExecutionStatus
a} :: RegistrationOutput)

instance Data.FromJSON RegistrationOutput where
  parseJSON :: Value -> Parser RegistrationOutput
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RegistrationOutput"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe ExecutionStatus -> RegistrationOutput
RegistrationOutput'
            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
"message")
            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
"result")
            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
"status")
      )

instance Prelude.Hashable RegistrationOutput where
  hashWithSalt :: Int -> RegistrationOutput -> Int
hashWithSalt Int
_salt RegistrationOutput' {Maybe Text
Maybe ExecutionStatus
status :: Maybe ExecutionStatus
result :: Maybe Text
message :: Maybe Text
$sel:status:RegistrationOutput' :: RegistrationOutput -> Maybe ExecutionStatus
$sel:result:RegistrationOutput' :: RegistrationOutput -> Maybe Text
$sel:message:RegistrationOutput' :: RegistrationOutput -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
result
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExecutionStatus
status

instance Prelude.NFData RegistrationOutput where
  rnf :: RegistrationOutput -> ()
rnf RegistrationOutput' {Maybe Text
Maybe ExecutionStatus
status :: Maybe ExecutionStatus
result :: Maybe Text
message :: Maybe Text
$sel:status:RegistrationOutput' :: RegistrationOutput -> Maybe ExecutionStatus
$sel:result:RegistrationOutput' :: RegistrationOutput -> Maybe Text
$sel:message:RegistrationOutput' :: RegistrationOutput -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
result
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ExecutionStatus
status