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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The dataset whose latest contents are used as input to the notebook or
-- application.
--
-- /See:/ 'newDatasetContentVersionValue' smart constructor.
data DatasetContentVersionValue = DatasetContentVersionValue'
  { -- | The name of the dataset whose latest contents are used as input to the
    -- notebook or application.
    DatasetContentVersionValue -> Text
datasetName :: Prelude.Text
  }
  deriving (DatasetContentVersionValue -> DatasetContentVersionValue -> Bool
(DatasetContentVersionValue -> DatasetContentVersionValue -> Bool)
-> (DatasetContentVersionValue
    -> DatasetContentVersionValue -> Bool)
-> Eq DatasetContentVersionValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DatasetContentVersionValue -> DatasetContentVersionValue -> Bool
$c/= :: DatasetContentVersionValue -> DatasetContentVersionValue -> Bool
== :: DatasetContentVersionValue -> DatasetContentVersionValue -> Bool
$c== :: DatasetContentVersionValue -> DatasetContentVersionValue -> Bool
Prelude.Eq, ReadPrec [DatasetContentVersionValue]
ReadPrec DatasetContentVersionValue
Int -> ReadS DatasetContentVersionValue
ReadS [DatasetContentVersionValue]
(Int -> ReadS DatasetContentVersionValue)
-> ReadS [DatasetContentVersionValue]
-> ReadPrec DatasetContentVersionValue
-> ReadPrec [DatasetContentVersionValue]
-> Read DatasetContentVersionValue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DatasetContentVersionValue]
$creadListPrec :: ReadPrec [DatasetContentVersionValue]
readPrec :: ReadPrec DatasetContentVersionValue
$creadPrec :: ReadPrec DatasetContentVersionValue
readList :: ReadS [DatasetContentVersionValue]
$creadList :: ReadS [DatasetContentVersionValue]
readsPrec :: Int -> ReadS DatasetContentVersionValue
$creadsPrec :: Int -> ReadS DatasetContentVersionValue
Prelude.Read, Int -> DatasetContentVersionValue -> ShowS
[DatasetContentVersionValue] -> ShowS
DatasetContentVersionValue -> String
(Int -> DatasetContentVersionValue -> ShowS)
-> (DatasetContentVersionValue -> String)
-> ([DatasetContentVersionValue] -> ShowS)
-> Show DatasetContentVersionValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DatasetContentVersionValue] -> ShowS
$cshowList :: [DatasetContentVersionValue] -> ShowS
show :: DatasetContentVersionValue -> String
$cshow :: DatasetContentVersionValue -> String
showsPrec :: Int -> DatasetContentVersionValue -> ShowS
$cshowsPrec :: Int -> DatasetContentVersionValue -> ShowS
Prelude.Show, (forall x.
 DatasetContentVersionValue -> Rep DatasetContentVersionValue x)
-> (forall x.
    Rep DatasetContentVersionValue x -> DatasetContentVersionValue)
-> Generic DatasetContentVersionValue
forall x.
Rep DatasetContentVersionValue x -> DatasetContentVersionValue
forall x.
DatasetContentVersionValue -> Rep DatasetContentVersionValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DatasetContentVersionValue x -> DatasetContentVersionValue
$cfrom :: forall x.
DatasetContentVersionValue -> Rep DatasetContentVersionValue x
Prelude.Generic)

-- |
-- Create a value of 'DatasetContentVersionValue' 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:
--
-- 'datasetName', 'datasetContentVersionValue_datasetName' - The name of the dataset whose latest contents are used as input to the
-- notebook or application.
newDatasetContentVersionValue ::
  -- | 'datasetName'
  Prelude.Text ->
  DatasetContentVersionValue
newDatasetContentVersionValue :: Text -> DatasetContentVersionValue
newDatasetContentVersionValue Text
pDatasetName_ =
  DatasetContentVersionValue' :: Text -> DatasetContentVersionValue
DatasetContentVersionValue'
    { $sel:datasetName:DatasetContentVersionValue' :: Text
datasetName =
        Text
pDatasetName_
    }

-- | The name of the dataset whose latest contents are used as input to the
-- notebook or application.
datasetContentVersionValue_datasetName :: Lens.Lens' DatasetContentVersionValue Prelude.Text
datasetContentVersionValue_datasetName :: (Text -> f Text)
-> DatasetContentVersionValue -> f DatasetContentVersionValue
datasetContentVersionValue_datasetName = (DatasetContentVersionValue -> Text)
-> (DatasetContentVersionValue
    -> Text -> DatasetContentVersionValue)
-> Lens
     DatasetContentVersionValue DatasetContentVersionValue Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetContentVersionValue' {Text
datasetName :: Text
$sel:datasetName:DatasetContentVersionValue' :: DatasetContentVersionValue -> Text
datasetName} -> Text
datasetName) (\s :: DatasetContentVersionValue
s@DatasetContentVersionValue' {} Text
a -> DatasetContentVersionValue
s {$sel:datasetName:DatasetContentVersionValue' :: Text
datasetName = Text
a} :: DatasetContentVersionValue)

instance Core.FromJSON DatasetContentVersionValue where
  parseJSON :: Value -> Parser DatasetContentVersionValue
parseJSON =
    String
-> (Object -> Parser DatasetContentVersionValue)
-> Value
-> Parser DatasetContentVersionValue
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DatasetContentVersionValue"
      ( \Object
x ->
          Text -> DatasetContentVersionValue
DatasetContentVersionValue'
            (Text -> DatasetContentVersionValue)
-> Parser Text -> Parser DatasetContentVersionValue
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"datasetName")
      )

instance Prelude.Hashable DatasetContentVersionValue

instance Prelude.NFData DatasetContentVersionValue

instance Core.ToJSON DatasetContentVersionValue where
  toJSON :: DatasetContentVersionValue -> Value
toJSON DatasetContentVersionValue' {Text
datasetName :: Text
$sel:datasetName:DatasetContentVersionValue' :: DatasetContentVersionValue -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"datasetName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
datasetName)]
      )