{-# 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.DataExchange.Types.RevisionPublished
-- 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.DataExchange.Types.RevisionPublished where

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

-- | Information about the published revision.
--
-- /See:/ 'newRevisionPublished' smart constructor.
data RevisionPublished = RevisionPublished'
  { -- | The data set ID of the published revision.
    RevisionPublished -> Text
dataSetId :: Prelude.Text
  }
  deriving (RevisionPublished -> RevisionPublished -> Bool
(RevisionPublished -> RevisionPublished -> Bool)
-> (RevisionPublished -> RevisionPublished -> Bool)
-> Eq RevisionPublished
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RevisionPublished -> RevisionPublished -> Bool
$c/= :: RevisionPublished -> RevisionPublished -> Bool
== :: RevisionPublished -> RevisionPublished -> Bool
$c== :: RevisionPublished -> RevisionPublished -> Bool
Prelude.Eq, ReadPrec [RevisionPublished]
ReadPrec RevisionPublished
Int -> ReadS RevisionPublished
ReadS [RevisionPublished]
(Int -> ReadS RevisionPublished)
-> ReadS [RevisionPublished]
-> ReadPrec RevisionPublished
-> ReadPrec [RevisionPublished]
-> Read RevisionPublished
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RevisionPublished]
$creadListPrec :: ReadPrec [RevisionPublished]
readPrec :: ReadPrec RevisionPublished
$creadPrec :: ReadPrec RevisionPublished
readList :: ReadS [RevisionPublished]
$creadList :: ReadS [RevisionPublished]
readsPrec :: Int -> ReadS RevisionPublished
$creadsPrec :: Int -> ReadS RevisionPublished
Prelude.Read, Int -> RevisionPublished -> ShowS
[RevisionPublished] -> ShowS
RevisionPublished -> String
(Int -> RevisionPublished -> ShowS)
-> (RevisionPublished -> String)
-> ([RevisionPublished] -> ShowS)
-> Show RevisionPublished
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RevisionPublished] -> ShowS
$cshowList :: [RevisionPublished] -> ShowS
show :: RevisionPublished -> String
$cshow :: RevisionPublished -> String
showsPrec :: Int -> RevisionPublished -> ShowS
$cshowsPrec :: Int -> RevisionPublished -> ShowS
Prelude.Show, (forall x. RevisionPublished -> Rep RevisionPublished x)
-> (forall x. Rep RevisionPublished x -> RevisionPublished)
-> Generic RevisionPublished
forall x. Rep RevisionPublished x -> RevisionPublished
forall x. RevisionPublished -> Rep RevisionPublished x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RevisionPublished x -> RevisionPublished
$cfrom :: forall x. RevisionPublished -> Rep RevisionPublished x
Prelude.Generic)

-- |
-- Create a value of 'RevisionPublished' 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:
--
-- 'dataSetId', 'revisionPublished_dataSetId' - The data set ID of the published revision.
newRevisionPublished ::
  -- | 'dataSetId'
  Prelude.Text ->
  RevisionPublished
newRevisionPublished :: Text -> RevisionPublished
newRevisionPublished Text
pDataSetId_ =
  RevisionPublished' :: Text -> RevisionPublished
RevisionPublished' {$sel:dataSetId:RevisionPublished' :: Text
dataSetId = Text
pDataSetId_}

-- | The data set ID of the published revision.
revisionPublished_dataSetId :: Lens.Lens' RevisionPublished Prelude.Text
revisionPublished_dataSetId :: (Text -> f Text) -> RevisionPublished -> f RevisionPublished
revisionPublished_dataSetId = (RevisionPublished -> Text)
-> (RevisionPublished -> Text -> RevisionPublished)
-> Lens RevisionPublished RevisionPublished Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevisionPublished' {Text
dataSetId :: Text
$sel:dataSetId:RevisionPublished' :: RevisionPublished -> Text
dataSetId} -> Text
dataSetId) (\s :: RevisionPublished
s@RevisionPublished' {} Text
a -> RevisionPublished
s {$sel:dataSetId:RevisionPublished' :: Text
dataSetId = Text
a} :: RevisionPublished)

instance Core.FromJSON RevisionPublished where
  parseJSON :: Value -> Parser RevisionPublished
parseJSON =
    String
-> (Object -> Parser RevisionPublished)
-> Value
-> Parser RevisionPublished
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RevisionPublished"
      ( \Object
x ->
          Text -> RevisionPublished
RevisionPublished'
            (Text -> RevisionPublished)
-> Parser Text -> Parser RevisionPublished
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
"DataSetId")
      )

instance Prelude.Hashable RevisionPublished

instance Prelude.NFData RevisionPublished

instance Core.ToJSON RevisionPublished where
  toJSON :: RevisionPublished -> Value
toJSON RevisionPublished' {Text
dataSetId :: Text
$sel:dataSetId:RevisionPublished' :: RevisionPublished -> 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
"DataSetId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
dataSetId)]
      )