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

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

-- | A revision is a container for one or more assets.
--
-- /See:/ 'newRevisionEntry' smart constructor.
data RevisionEntry = RevisionEntry'
  { -- | The revision ID of the owned revision corresponding to the entitled
    -- revision being viewed. This parameter is returned when a revision owner
    -- is viewing the entitled copy of its owned revision.
    RevisionEntry -> Maybe Text
sourceId :: Prelude.Maybe Prelude.Text,
    -- | To publish a revision to a data set in a product, the revision must
    -- first be finalized. Finalizing a revision tells AWS Data Exchange that
    -- your changes to the assets in the revision are complete. After it\'s in
    -- this read-only state, you can publish the revision to your products.
    --
    -- Finalized revisions can be published through the AWS Data Exchange
    -- console or the AWS Marketplace Catalog API, using the StartChangeSet AWS
    -- Marketplace Catalog API action. When using the API, revisions are
    -- uniquely identified by their ARN.
    RevisionEntry -> Maybe Bool
finalized :: Prelude.Maybe Prelude.Bool,
    -- | An optional comment about the revision.
    RevisionEntry -> Maybe Text
comment :: Prelude.Maybe Prelude.Text,
    -- | The date and time that the revision was created, in ISO 8601 format.
    RevisionEntry -> POSIX
createdAt :: Core.POSIX,
    -- | The unique identifier for the data set associated with this revision.
    RevisionEntry -> Text
dataSetId :: Prelude.Text,
    -- | The unique identifier for the revision.
    RevisionEntry -> Text
id :: Prelude.Text,
    -- | The ARN for the revision.
    RevisionEntry -> Text
arn :: Prelude.Text,
    -- | The date and time that the revision was last updated, in ISO 8601
    -- format.
    RevisionEntry -> POSIX
updatedAt :: Core.POSIX
  }
  deriving (RevisionEntry -> RevisionEntry -> Bool
(RevisionEntry -> RevisionEntry -> Bool)
-> (RevisionEntry -> RevisionEntry -> Bool) -> Eq RevisionEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RevisionEntry -> RevisionEntry -> Bool
$c/= :: RevisionEntry -> RevisionEntry -> Bool
== :: RevisionEntry -> RevisionEntry -> Bool
$c== :: RevisionEntry -> RevisionEntry -> Bool
Prelude.Eq, ReadPrec [RevisionEntry]
ReadPrec RevisionEntry
Int -> ReadS RevisionEntry
ReadS [RevisionEntry]
(Int -> ReadS RevisionEntry)
-> ReadS [RevisionEntry]
-> ReadPrec RevisionEntry
-> ReadPrec [RevisionEntry]
-> Read RevisionEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RevisionEntry]
$creadListPrec :: ReadPrec [RevisionEntry]
readPrec :: ReadPrec RevisionEntry
$creadPrec :: ReadPrec RevisionEntry
readList :: ReadS [RevisionEntry]
$creadList :: ReadS [RevisionEntry]
readsPrec :: Int -> ReadS RevisionEntry
$creadsPrec :: Int -> ReadS RevisionEntry
Prelude.Read, Int -> RevisionEntry -> ShowS
[RevisionEntry] -> ShowS
RevisionEntry -> String
(Int -> RevisionEntry -> ShowS)
-> (RevisionEntry -> String)
-> ([RevisionEntry] -> ShowS)
-> Show RevisionEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RevisionEntry] -> ShowS
$cshowList :: [RevisionEntry] -> ShowS
show :: RevisionEntry -> String
$cshow :: RevisionEntry -> String
showsPrec :: Int -> RevisionEntry -> ShowS
$cshowsPrec :: Int -> RevisionEntry -> ShowS
Prelude.Show, (forall x. RevisionEntry -> Rep RevisionEntry x)
-> (forall x. Rep RevisionEntry x -> RevisionEntry)
-> Generic RevisionEntry
forall x. Rep RevisionEntry x -> RevisionEntry
forall x. RevisionEntry -> Rep RevisionEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RevisionEntry x -> RevisionEntry
$cfrom :: forall x. RevisionEntry -> Rep RevisionEntry x
Prelude.Generic)

-- |
-- Create a value of 'RevisionEntry' 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:
--
-- 'sourceId', 'revisionEntry_sourceId' - The revision ID of the owned revision corresponding to the entitled
-- revision being viewed. This parameter is returned when a revision owner
-- is viewing the entitled copy of its owned revision.
--
-- 'finalized', 'revisionEntry_finalized' - To publish a revision to a data set in a product, the revision must
-- first be finalized. Finalizing a revision tells AWS Data Exchange that
-- your changes to the assets in the revision are complete. After it\'s in
-- this read-only state, you can publish the revision to your products.
--
-- Finalized revisions can be published through the AWS Data Exchange
-- console or the AWS Marketplace Catalog API, using the StartChangeSet AWS
-- Marketplace Catalog API action. When using the API, revisions are
-- uniquely identified by their ARN.
--
-- 'comment', 'revisionEntry_comment' - An optional comment about the revision.
--
-- 'createdAt', 'revisionEntry_createdAt' - The date and time that the revision was created, in ISO 8601 format.
--
-- 'dataSetId', 'revisionEntry_dataSetId' - The unique identifier for the data set associated with this revision.
--
-- 'id', 'revisionEntry_id' - The unique identifier for the revision.
--
-- 'arn', 'revisionEntry_arn' - The ARN for the revision.
--
-- 'updatedAt', 'revisionEntry_updatedAt' - The date and time that the revision was last updated, in ISO 8601
-- format.
newRevisionEntry ::
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'dataSetId'
  Prelude.Text ->
  -- | 'id'
  Prelude.Text ->
  -- | 'arn'
  Prelude.Text ->
  -- | 'updatedAt'
  Prelude.UTCTime ->
  RevisionEntry
newRevisionEntry :: UTCTime -> Text -> Text -> Text -> UTCTime -> RevisionEntry
newRevisionEntry
  UTCTime
pCreatedAt_
  Text
pDataSetId_
  Text
pId_
  Text
pArn_
  UTCTime
pUpdatedAt_ =
    RevisionEntry' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> POSIX
-> Text
-> Text
-> Text
-> POSIX
-> RevisionEntry
RevisionEntry'
      { $sel:sourceId:RevisionEntry' :: Maybe Text
sourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:finalized:RevisionEntry' :: Maybe Bool
finalized = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:comment:RevisionEntry' :: Maybe Text
comment = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:createdAt:RevisionEntry' :: POSIX
createdAt = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedAt_,
        $sel:dataSetId:RevisionEntry' :: Text
dataSetId = Text
pDataSetId_,
        $sel:id:RevisionEntry' :: Text
id = Text
pId_,
        $sel:arn:RevisionEntry' :: Text
arn = Text
pArn_,
        $sel:updatedAt:RevisionEntry' :: POSIX
updatedAt = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pUpdatedAt_
      }

-- | The revision ID of the owned revision corresponding to the entitled
-- revision being viewed. This parameter is returned when a revision owner
-- is viewing the entitled copy of its owned revision.
revisionEntry_sourceId :: Lens.Lens' RevisionEntry (Prelude.Maybe Prelude.Text)
revisionEntry_sourceId :: (Maybe Text -> f (Maybe Text)) -> RevisionEntry -> f RevisionEntry
revisionEntry_sourceId = (RevisionEntry -> Maybe Text)
-> (RevisionEntry -> Maybe Text -> RevisionEntry)
-> Lens RevisionEntry RevisionEntry (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevisionEntry' {Maybe Text
sourceId :: Maybe Text
$sel:sourceId:RevisionEntry' :: RevisionEntry -> Maybe Text
sourceId} -> Maybe Text
sourceId) (\s :: RevisionEntry
s@RevisionEntry' {} Maybe Text
a -> RevisionEntry
s {$sel:sourceId:RevisionEntry' :: Maybe Text
sourceId = Maybe Text
a} :: RevisionEntry)

-- | To publish a revision to a data set in a product, the revision must
-- first be finalized. Finalizing a revision tells AWS Data Exchange that
-- your changes to the assets in the revision are complete. After it\'s in
-- this read-only state, you can publish the revision to your products.
--
-- Finalized revisions can be published through the AWS Data Exchange
-- console or the AWS Marketplace Catalog API, using the StartChangeSet AWS
-- Marketplace Catalog API action. When using the API, revisions are
-- uniquely identified by their ARN.
revisionEntry_finalized :: Lens.Lens' RevisionEntry (Prelude.Maybe Prelude.Bool)
revisionEntry_finalized :: (Maybe Bool -> f (Maybe Bool)) -> RevisionEntry -> f RevisionEntry
revisionEntry_finalized = (RevisionEntry -> Maybe Bool)
-> (RevisionEntry -> Maybe Bool -> RevisionEntry)
-> Lens RevisionEntry RevisionEntry (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevisionEntry' {Maybe Bool
finalized :: Maybe Bool
$sel:finalized:RevisionEntry' :: RevisionEntry -> Maybe Bool
finalized} -> Maybe Bool
finalized) (\s :: RevisionEntry
s@RevisionEntry' {} Maybe Bool
a -> RevisionEntry
s {$sel:finalized:RevisionEntry' :: Maybe Bool
finalized = Maybe Bool
a} :: RevisionEntry)

-- | An optional comment about the revision.
revisionEntry_comment :: Lens.Lens' RevisionEntry (Prelude.Maybe Prelude.Text)
revisionEntry_comment :: (Maybe Text -> f (Maybe Text)) -> RevisionEntry -> f RevisionEntry
revisionEntry_comment = (RevisionEntry -> Maybe Text)
-> (RevisionEntry -> Maybe Text -> RevisionEntry)
-> Lens RevisionEntry RevisionEntry (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevisionEntry' {Maybe Text
comment :: Maybe Text
$sel:comment:RevisionEntry' :: RevisionEntry -> Maybe Text
comment} -> Maybe Text
comment) (\s :: RevisionEntry
s@RevisionEntry' {} Maybe Text
a -> RevisionEntry
s {$sel:comment:RevisionEntry' :: Maybe Text
comment = Maybe Text
a} :: RevisionEntry)

-- | The date and time that the revision was created, in ISO 8601 format.
revisionEntry_createdAt :: Lens.Lens' RevisionEntry Prelude.UTCTime
revisionEntry_createdAt :: (UTCTime -> f UTCTime) -> RevisionEntry -> f RevisionEntry
revisionEntry_createdAt = (RevisionEntry -> POSIX)
-> (RevisionEntry -> POSIX -> RevisionEntry)
-> Lens RevisionEntry RevisionEntry POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevisionEntry' {POSIX
createdAt :: POSIX
$sel:createdAt:RevisionEntry' :: RevisionEntry -> POSIX
createdAt} -> POSIX
createdAt) (\s :: RevisionEntry
s@RevisionEntry' {} POSIX
a -> RevisionEntry
s {$sel:createdAt:RevisionEntry' :: POSIX
createdAt = POSIX
a} :: RevisionEntry) ((POSIX -> f POSIX) -> RevisionEntry -> f RevisionEntry)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> RevisionEntry
-> f RevisionEntry
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The unique identifier for the data set associated with this revision.
revisionEntry_dataSetId :: Lens.Lens' RevisionEntry Prelude.Text
revisionEntry_dataSetId :: (Text -> f Text) -> RevisionEntry -> f RevisionEntry
revisionEntry_dataSetId = (RevisionEntry -> Text)
-> (RevisionEntry -> Text -> RevisionEntry)
-> Lens RevisionEntry RevisionEntry Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevisionEntry' {Text
dataSetId :: Text
$sel:dataSetId:RevisionEntry' :: RevisionEntry -> Text
dataSetId} -> Text
dataSetId) (\s :: RevisionEntry
s@RevisionEntry' {} Text
a -> RevisionEntry
s {$sel:dataSetId:RevisionEntry' :: Text
dataSetId = Text
a} :: RevisionEntry)

-- | The unique identifier for the revision.
revisionEntry_id :: Lens.Lens' RevisionEntry Prelude.Text
revisionEntry_id :: (Text -> f Text) -> RevisionEntry -> f RevisionEntry
revisionEntry_id = (RevisionEntry -> Text)
-> (RevisionEntry -> Text -> RevisionEntry)
-> Lens RevisionEntry RevisionEntry Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevisionEntry' {Text
id :: Text
$sel:id:RevisionEntry' :: RevisionEntry -> Text
id} -> Text
id) (\s :: RevisionEntry
s@RevisionEntry' {} Text
a -> RevisionEntry
s {$sel:id:RevisionEntry' :: Text
id = Text
a} :: RevisionEntry)

-- | The ARN for the revision.
revisionEntry_arn :: Lens.Lens' RevisionEntry Prelude.Text
revisionEntry_arn :: (Text -> f Text) -> RevisionEntry -> f RevisionEntry
revisionEntry_arn = (RevisionEntry -> Text)
-> (RevisionEntry -> Text -> RevisionEntry)
-> Lens RevisionEntry RevisionEntry Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevisionEntry' {Text
arn :: Text
$sel:arn:RevisionEntry' :: RevisionEntry -> Text
arn} -> Text
arn) (\s :: RevisionEntry
s@RevisionEntry' {} Text
a -> RevisionEntry
s {$sel:arn:RevisionEntry' :: Text
arn = Text
a} :: RevisionEntry)

-- | The date and time that the revision was last updated, in ISO 8601
-- format.
revisionEntry_updatedAt :: Lens.Lens' RevisionEntry Prelude.UTCTime
revisionEntry_updatedAt :: (UTCTime -> f UTCTime) -> RevisionEntry -> f RevisionEntry
revisionEntry_updatedAt = (RevisionEntry -> POSIX)
-> (RevisionEntry -> POSIX -> RevisionEntry)
-> Lens RevisionEntry RevisionEntry POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevisionEntry' {POSIX
updatedAt :: POSIX
$sel:updatedAt:RevisionEntry' :: RevisionEntry -> POSIX
updatedAt} -> POSIX
updatedAt) (\s :: RevisionEntry
s@RevisionEntry' {} POSIX
a -> RevisionEntry
s {$sel:updatedAt:RevisionEntry' :: POSIX
updatedAt = POSIX
a} :: RevisionEntry) ((POSIX -> f POSIX) -> RevisionEntry -> f RevisionEntry)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> RevisionEntry
-> f RevisionEntry
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON RevisionEntry where
  parseJSON :: Value -> Parser RevisionEntry
parseJSON =
    String
-> (Object -> Parser RevisionEntry)
-> Value
-> Parser RevisionEntry
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RevisionEntry"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool
-> Maybe Text
-> POSIX
-> Text
-> Text
-> Text
-> POSIX
-> RevisionEntry
RevisionEntry'
            (Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> POSIX
 -> Text
 -> Text
 -> Text
 -> POSIX
 -> RevisionEntry)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> POSIX
      -> Text
      -> Text
      -> Text
      -> POSIX
      -> RevisionEntry)
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
"SourceId")
            Parser
  (Maybe Bool
   -> Maybe Text
   -> POSIX
   -> Text
   -> Text
   -> Text
   -> POSIX
   -> RevisionEntry)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> POSIX -> Text -> Text -> Text -> POSIX -> RevisionEntry)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Finalized")
            Parser
  (Maybe Text
   -> POSIX -> Text -> Text -> Text -> POSIX -> RevisionEntry)
-> Parser (Maybe Text)
-> Parser (POSIX -> Text -> Text -> Text -> POSIX -> RevisionEntry)
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
"Comment")
            Parser (POSIX -> Text -> Text -> Text -> POSIX -> RevisionEntry)
-> Parser POSIX
-> Parser (Text -> Text -> Text -> POSIX -> RevisionEntry)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CreatedAt")
            Parser (Text -> Text -> Text -> POSIX -> RevisionEntry)
-> Parser Text -> Parser (Text -> Text -> POSIX -> RevisionEntry)
forall (f :: * -> *) a b. Applicative f => 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")
            Parser (Text -> Text -> POSIX -> RevisionEntry)
-> Parser Text -> Parser (Text -> POSIX -> RevisionEntry)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Id")
            Parser (Text -> POSIX -> RevisionEntry)
-> Parser Text -> Parser (POSIX -> RevisionEntry)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Arn")
            Parser (POSIX -> RevisionEntry)
-> Parser POSIX -> Parser RevisionEntry
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"UpdatedAt")
      )

instance Prelude.Hashable RevisionEntry

instance Prelude.NFData RevisionEntry