{-# 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.DatasetActionSummary
-- 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.DatasetActionSummary where

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

-- | Information about the action that automatically creates the dataset\'s
-- contents.
--
-- /See:/ 'newDatasetActionSummary' smart constructor.
data DatasetActionSummary = DatasetActionSummary'
  { -- | The name of the action that automatically creates the dataset\'s
    -- contents.
    DatasetActionSummary -> Maybe Text
actionName :: Prelude.Maybe Prelude.Text,
    -- | The type of action by which the dataset\'s contents are automatically
    -- created.
    DatasetActionSummary -> Maybe DatasetActionType
actionType :: Prelude.Maybe DatasetActionType
  }
  deriving (DatasetActionSummary -> DatasetActionSummary -> Bool
(DatasetActionSummary -> DatasetActionSummary -> Bool)
-> (DatasetActionSummary -> DatasetActionSummary -> Bool)
-> Eq DatasetActionSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DatasetActionSummary -> DatasetActionSummary -> Bool
$c/= :: DatasetActionSummary -> DatasetActionSummary -> Bool
== :: DatasetActionSummary -> DatasetActionSummary -> Bool
$c== :: DatasetActionSummary -> DatasetActionSummary -> Bool
Prelude.Eq, ReadPrec [DatasetActionSummary]
ReadPrec DatasetActionSummary
Int -> ReadS DatasetActionSummary
ReadS [DatasetActionSummary]
(Int -> ReadS DatasetActionSummary)
-> ReadS [DatasetActionSummary]
-> ReadPrec DatasetActionSummary
-> ReadPrec [DatasetActionSummary]
-> Read DatasetActionSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DatasetActionSummary]
$creadListPrec :: ReadPrec [DatasetActionSummary]
readPrec :: ReadPrec DatasetActionSummary
$creadPrec :: ReadPrec DatasetActionSummary
readList :: ReadS [DatasetActionSummary]
$creadList :: ReadS [DatasetActionSummary]
readsPrec :: Int -> ReadS DatasetActionSummary
$creadsPrec :: Int -> ReadS DatasetActionSummary
Prelude.Read, Int -> DatasetActionSummary -> ShowS
[DatasetActionSummary] -> ShowS
DatasetActionSummary -> String
(Int -> DatasetActionSummary -> ShowS)
-> (DatasetActionSummary -> String)
-> ([DatasetActionSummary] -> ShowS)
-> Show DatasetActionSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DatasetActionSummary] -> ShowS
$cshowList :: [DatasetActionSummary] -> ShowS
show :: DatasetActionSummary -> String
$cshow :: DatasetActionSummary -> String
showsPrec :: Int -> DatasetActionSummary -> ShowS
$cshowsPrec :: Int -> DatasetActionSummary -> ShowS
Prelude.Show, (forall x. DatasetActionSummary -> Rep DatasetActionSummary x)
-> (forall x. Rep DatasetActionSummary x -> DatasetActionSummary)
-> Generic DatasetActionSummary
forall x. Rep DatasetActionSummary x -> DatasetActionSummary
forall x. DatasetActionSummary -> Rep DatasetActionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DatasetActionSummary x -> DatasetActionSummary
$cfrom :: forall x. DatasetActionSummary -> Rep DatasetActionSummary x
Prelude.Generic)

-- |
-- Create a value of 'DatasetActionSummary' 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:
--
-- 'actionName', 'datasetActionSummary_actionName' - The name of the action that automatically creates the dataset\'s
-- contents.
--
-- 'actionType', 'datasetActionSummary_actionType' - The type of action by which the dataset\'s contents are automatically
-- created.
newDatasetActionSummary ::
  DatasetActionSummary
newDatasetActionSummary :: DatasetActionSummary
newDatasetActionSummary =
  DatasetActionSummary' :: Maybe Text -> Maybe DatasetActionType -> DatasetActionSummary
DatasetActionSummary'
    { $sel:actionName:DatasetActionSummary' :: Maybe Text
actionName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:actionType:DatasetActionSummary' :: Maybe DatasetActionType
actionType = Maybe DatasetActionType
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the action that automatically creates the dataset\'s
-- contents.
datasetActionSummary_actionName :: Lens.Lens' DatasetActionSummary (Prelude.Maybe Prelude.Text)
datasetActionSummary_actionName :: (Maybe Text -> f (Maybe Text))
-> DatasetActionSummary -> f DatasetActionSummary
datasetActionSummary_actionName = (DatasetActionSummary -> Maybe Text)
-> (DatasetActionSummary -> Maybe Text -> DatasetActionSummary)
-> Lens
     DatasetActionSummary DatasetActionSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetActionSummary' {Maybe Text
actionName :: Maybe Text
$sel:actionName:DatasetActionSummary' :: DatasetActionSummary -> Maybe Text
actionName} -> Maybe Text
actionName) (\s :: DatasetActionSummary
s@DatasetActionSummary' {} Maybe Text
a -> DatasetActionSummary
s {$sel:actionName:DatasetActionSummary' :: Maybe Text
actionName = Maybe Text
a} :: DatasetActionSummary)

-- | The type of action by which the dataset\'s contents are automatically
-- created.
datasetActionSummary_actionType :: Lens.Lens' DatasetActionSummary (Prelude.Maybe DatasetActionType)
datasetActionSummary_actionType :: (Maybe DatasetActionType -> f (Maybe DatasetActionType))
-> DatasetActionSummary -> f DatasetActionSummary
datasetActionSummary_actionType = (DatasetActionSummary -> Maybe DatasetActionType)
-> (DatasetActionSummary
    -> Maybe DatasetActionType -> DatasetActionSummary)
-> Lens
     DatasetActionSummary
     DatasetActionSummary
     (Maybe DatasetActionType)
     (Maybe DatasetActionType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetActionSummary' {Maybe DatasetActionType
actionType :: Maybe DatasetActionType
$sel:actionType:DatasetActionSummary' :: DatasetActionSummary -> Maybe DatasetActionType
actionType} -> Maybe DatasetActionType
actionType) (\s :: DatasetActionSummary
s@DatasetActionSummary' {} Maybe DatasetActionType
a -> DatasetActionSummary
s {$sel:actionType:DatasetActionSummary' :: Maybe DatasetActionType
actionType = Maybe DatasetActionType
a} :: DatasetActionSummary)

instance Core.FromJSON DatasetActionSummary where
  parseJSON :: Value -> Parser DatasetActionSummary
parseJSON =
    String
-> (Object -> Parser DatasetActionSummary)
-> Value
-> Parser DatasetActionSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DatasetActionSummary"
      ( \Object
x ->
          Maybe Text -> Maybe DatasetActionType -> DatasetActionSummary
DatasetActionSummary'
            (Maybe Text -> Maybe DatasetActionType -> DatasetActionSummary)
-> Parser (Maybe Text)
-> Parser (Maybe DatasetActionType -> DatasetActionSummary)
forall (f :: * -> *) a b. Functor 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
"actionName")
            Parser (Maybe DatasetActionType -> DatasetActionSummary)
-> Parser (Maybe DatasetActionType) -> Parser DatasetActionSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DatasetActionType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"actionType")
      )

instance Prelude.Hashable DatasetActionSummary

instance Prelude.NFData DatasetActionSummary