{-# 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.IoTAnalytics.Types.DatasetContentStatus
-- 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)
module Amazonka.IoTAnalytics.Types.DatasetContentStatus where

import qualified Amazonka.Core as Core
import Amazonka.IoTAnalytics.Types.DatasetContentState
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The state of the dataset contents and the reason they are in this state.
--
-- /See:/ 'newDatasetContentStatus' smart constructor.
data DatasetContentStatus = DatasetContentStatus'
  { -- | The state of the dataset contents. Can be one of READY, CREATING,
    -- SUCCEEDED, or FAILED.
    DatasetContentStatus -> Maybe DatasetContentState
state :: Prelude.Maybe DatasetContentState,
    -- | The reason the dataset contents are in this state.
    DatasetContentStatus -> Maybe Text
reason :: Prelude.Maybe Prelude.Text
  }
  deriving (DatasetContentStatus -> DatasetContentStatus -> Bool
(DatasetContentStatus -> DatasetContentStatus -> Bool)
-> (DatasetContentStatus -> DatasetContentStatus -> Bool)
-> Eq DatasetContentStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DatasetContentStatus -> DatasetContentStatus -> Bool
$c/= :: DatasetContentStatus -> DatasetContentStatus -> Bool
== :: DatasetContentStatus -> DatasetContentStatus -> Bool
$c== :: DatasetContentStatus -> DatasetContentStatus -> Bool
Prelude.Eq, ReadPrec [DatasetContentStatus]
ReadPrec DatasetContentStatus
Int -> ReadS DatasetContentStatus
ReadS [DatasetContentStatus]
(Int -> ReadS DatasetContentStatus)
-> ReadS [DatasetContentStatus]
-> ReadPrec DatasetContentStatus
-> ReadPrec [DatasetContentStatus]
-> Read DatasetContentStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DatasetContentStatus]
$creadListPrec :: ReadPrec [DatasetContentStatus]
readPrec :: ReadPrec DatasetContentStatus
$creadPrec :: ReadPrec DatasetContentStatus
readList :: ReadS [DatasetContentStatus]
$creadList :: ReadS [DatasetContentStatus]
readsPrec :: Int -> ReadS DatasetContentStatus
$creadsPrec :: Int -> ReadS DatasetContentStatus
Prelude.Read, Int -> DatasetContentStatus -> ShowS
[DatasetContentStatus] -> ShowS
DatasetContentStatus -> String
(Int -> DatasetContentStatus -> ShowS)
-> (DatasetContentStatus -> String)
-> ([DatasetContentStatus] -> ShowS)
-> Show DatasetContentStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DatasetContentStatus] -> ShowS
$cshowList :: [DatasetContentStatus] -> ShowS
show :: DatasetContentStatus -> String
$cshow :: DatasetContentStatus -> String
showsPrec :: Int -> DatasetContentStatus -> ShowS
$cshowsPrec :: Int -> DatasetContentStatus -> ShowS
Prelude.Show, (forall x. DatasetContentStatus -> Rep DatasetContentStatus x)
-> (forall x. Rep DatasetContentStatus x -> DatasetContentStatus)
-> Generic DatasetContentStatus
forall x. Rep DatasetContentStatus x -> DatasetContentStatus
forall x. DatasetContentStatus -> Rep DatasetContentStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DatasetContentStatus x -> DatasetContentStatus
$cfrom :: forall x. DatasetContentStatus -> Rep DatasetContentStatus x
Prelude.Generic)

-- |
-- Create a value of 'DatasetContentStatus' 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:
--
-- 'state', 'datasetContentStatus_state' - The state of the dataset contents. Can be one of READY, CREATING,
-- SUCCEEDED, or FAILED.
--
-- 'reason', 'datasetContentStatus_reason' - The reason the dataset contents are in this state.
newDatasetContentStatus ::
  DatasetContentStatus
newDatasetContentStatus :: DatasetContentStatus
newDatasetContentStatus =
  DatasetContentStatus' :: Maybe DatasetContentState -> Maybe Text -> DatasetContentStatus
DatasetContentStatus'
    { $sel:state:DatasetContentStatus' :: Maybe DatasetContentState
state = Maybe DatasetContentState
forall a. Maybe a
Prelude.Nothing,
      $sel:reason:DatasetContentStatus' :: Maybe Text
reason = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The state of the dataset contents. Can be one of READY, CREATING,
-- SUCCEEDED, or FAILED.
datasetContentStatus_state :: Lens.Lens' DatasetContentStatus (Prelude.Maybe DatasetContentState)
datasetContentStatus_state :: (Maybe DatasetContentState -> f (Maybe DatasetContentState))
-> DatasetContentStatus -> f DatasetContentStatus
datasetContentStatus_state = (DatasetContentStatus -> Maybe DatasetContentState)
-> (DatasetContentStatus
    -> Maybe DatasetContentState -> DatasetContentStatus)
-> Lens
     DatasetContentStatus
     DatasetContentStatus
     (Maybe DatasetContentState)
     (Maybe DatasetContentState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetContentStatus' {Maybe DatasetContentState
state :: Maybe DatasetContentState
$sel:state:DatasetContentStatus' :: DatasetContentStatus -> Maybe DatasetContentState
state} -> Maybe DatasetContentState
state) (\s :: DatasetContentStatus
s@DatasetContentStatus' {} Maybe DatasetContentState
a -> DatasetContentStatus
s {$sel:state:DatasetContentStatus' :: Maybe DatasetContentState
state = Maybe DatasetContentState
a} :: DatasetContentStatus)

-- | The reason the dataset contents are in this state.
datasetContentStatus_reason :: Lens.Lens' DatasetContentStatus (Prelude.Maybe Prelude.Text)
datasetContentStatus_reason :: (Maybe Text -> f (Maybe Text))
-> DatasetContentStatus -> f DatasetContentStatus
datasetContentStatus_reason = (DatasetContentStatus -> Maybe Text)
-> (DatasetContentStatus -> Maybe Text -> DatasetContentStatus)
-> Lens
     DatasetContentStatus DatasetContentStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetContentStatus' {Maybe Text
reason :: Maybe Text
$sel:reason:DatasetContentStatus' :: DatasetContentStatus -> Maybe Text
reason} -> Maybe Text
reason) (\s :: DatasetContentStatus
s@DatasetContentStatus' {} Maybe Text
a -> DatasetContentStatus
s {$sel:reason:DatasetContentStatus' :: Maybe Text
reason = Maybe Text
a} :: DatasetContentStatus)

instance Core.FromJSON DatasetContentStatus where
  parseJSON :: Value -> Parser DatasetContentStatus
parseJSON =
    String
-> (Object -> Parser DatasetContentStatus)
-> Value
-> Parser DatasetContentStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DatasetContentStatus"
      ( \Object
x ->
          Maybe DatasetContentState -> Maybe Text -> DatasetContentStatus
DatasetContentStatus'
            (Maybe DatasetContentState -> Maybe Text -> DatasetContentStatus)
-> Parser (Maybe DatasetContentState)
-> Parser (Maybe Text -> DatasetContentStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DatasetContentState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"state")
            Parser (Maybe Text -> DatasetContentStatus)
-> Parser (Maybe Text) -> Parser DatasetContentStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"reason")
      )

instance Prelude.Hashable DatasetContentStatus

instance Prelude.NFData DatasetContentStatus