{-# 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.Greengrass.Types.VersionInformation
-- 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.Greengrass.Types.VersionInformation where

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

-- | Information about a version.
--
-- /See:/ 'newVersionInformation' smart constructor.
data VersionInformation = VersionInformation'
  { -- | The ARN of the version.
    VersionInformation -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the version was created.
    VersionInformation -> Maybe Text
creationTimestamp :: Prelude.Maybe Prelude.Text,
    -- | The ID of the version.
    VersionInformation -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | The ID of the parent definition that the version is associated with.
    VersionInformation -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (VersionInformation -> VersionInformation -> Bool
(VersionInformation -> VersionInformation -> Bool)
-> (VersionInformation -> VersionInformation -> Bool)
-> Eq VersionInformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VersionInformation -> VersionInformation -> Bool
$c/= :: VersionInformation -> VersionInformation -> Bool
== :: VersionInformation -> VersionInformation -> Bool
$c== :: VersionInformation -> VersionInformation -> Bool
Prelude.Eq, ReadPrec [VersionInformation]
ReadPrec VersionInformation
Int -> ReadS VersionInformation
ReadS [VersionInformation]
(Int -> ReadS VersionInformation)
-> ReadS [VersionInformation]
-> ReadPrec VersionInformation
-> ReadPrec [VersionInformation]
-> Read VersionInformation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VersionInformation]
$creadListPrec :: ReadPrec [VersionInformation]
readPrec :: ReadPrec VersionInformation
$creadPrec :: ReadPrec VersionInformation
readList :: ReadS [VersionInformation]
$creadList :: ReadS [VersionInformation]
readsPrec :: Int -> ReadS VersionInformation
$creadsPrec :: Int -> ReadS VersionInformation
Prelude.Read, Int -> VersionInformation -> ShowS
[VersionInformation] -> ShowS
VersionInformation -> String
(Int -> VersionInformation -> ShowS)
-> (VersionInformation -> String)
-> ([VersionInformation] -> ShowS)
-> Show VersionInformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VersionInformation] -> ShowS
$cshowList :: [VersionInformation] -> ShowS
show :: VersionInformation -> String
$cshow :: VersionInformation -> String
showsPrec :: Int -> VersionInformation -> ShowS
$cshowsPrec :: Int -> VersionInformation -> ShowS
Prelude.Show, (forall x. VersionInformation -> Rep VersionInformation x)
-> (forall x. Rep VersionInformation x -> VersionInformation)
-> Generic VersionInformation
forall x. Rep VersionInformation x -> VersionInformation
forall x. VersionInformation -> Rep VersionInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VersionInformation x -> VersionInformation
$cfrom :: forall x. VersionInformation -> Rep VersionInformation x
Prelude.Generic)

-- |
-- Create a value of 'VersionInformation' 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:
--
-- 'arn', 'versionInformation_arn' - The ARN of the version.
--
-- 'creationTimestamp', 'versionInformation_creationTimestamp' - The time, in milliseconds since the epoch, when the version was created.
--
-- 'version', 'versionInformation_version' - The ID of the version.
--
-- 'id', 'versionInformation_id' - The ID of the parent definition that the version is associated with.
newVersionInformation ::
  VersionInformation
newVersionInformation :: VersionInformation
newVersionInformation =
  VersionInformation' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> VersionInformation
VersionInformation'
    { $sel:arn:VersionInformation' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimestamp:VersionInformation' :: Maybe Text
creationTimestamp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:version:VersionInformation' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:VersionInformation' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the version.
versionInformation_arn :: Lens.Lens' VersionInformation (Prelude.Maybe Prelude.Text)
versionInformation_arn :: (Maybe Text -> f (Maybe Text))
-> VersionInformation -> f VersionInformation
versionInformation_arn = (VersionInformation -> Maybe Text)
-> (VersionInformation -> Maybe Text -> VersionInformation)
-> Lens
     VersionInformation VersionInformation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VersionInformation' {Maybe Text
arn :: Maybe Text
$sel:arn:VersionInformation' :: VersionInformation -> Maybe Text
arn} -> Maybe Text
arn) (\s :: VersionInformation
s@VersionInformation' {} Maybe Text
a -> VersionInformation
s {$sel:arn:VersionInformation' :: Maybe Text
arn = Maybe Text
a} :: VersionInformation)

-- | The time, in milliseconds since the epoch, when the version was created.
versionInformation_creationTimestamp :: Lens.Lens' VersionInformation (Prelude.Maybe Prelude.Text)
versionInformation_creationTimestamp :: (Maybe Text -> f (Maybe Text))
-> VersionInformation -> f VersionInformation
versionInformation_creationTimestamp = (VersionInformation -> Maybe Text)
-> (VersionInformation -> Maybe Text -> VersionInformation)
-> Lens
     VersionInformation VersionInformation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VersionInformation' {Maybe Text
creationTimestamp :: Maybe Text
$sel:creationTimestamp:VersionInformation' :: VersionInformation -> Maybe Text
creationTimestamp} -> Maybe Text
creationTimestamp) (\s :: VersionInformation
s@VersionInformation' {} Maybe Text
a -> VersionInformation
s {$sel:creationTimestamp:VersionInformation' :: Maybe Text
creationTimestamp = Maybe Text
a} :: VersionInformation)

-- | The ID of the version.
versionInformation_version :: Lens.Lens' VersionInformation (Prelude.Maybe Prelude.Text)
versionInformation_version :: (Maybe Text -> f (Maybe Text))
-> VersionInformation -> f VersionInformation
versionInformation_version = (VersionInformation -> Maybe Text)
-> (VersionInformation -> Maybe Text -> VersionInformation)
-> Lens
     VersionInformation VersionInformation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VersionInformation' {Maybe Text
version :: Maybe Text
$sel:version:VersionInformation' :: VersionInformation -> Maybe Text
version} -> Maybe Text
version) (\s :: VersionInformation
s@VersionInformation' {} Maybe Text
a -> VersionInformation
s {$sel:version:VersionInformation' :: Maybe Text
version = Maybe Text
a} :: VersionInformation)

-- | The ID of the parent definition that the version is associated with.
versionInformation_id :: Lens.Lens' VersionInformation (Prelude.Maybe Prelude.Text)
versionInformation_id :: (Maybe Text -> f (Maybe Text))
-> VersionInformation -> f VersionInformation
versionInformation_id = (VersionInformation -> Maybe Text)
-> (VersionInformation -> Maybe Text -> VersionInformation)
-> Lens
     VersionInformation VersionInformation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VersionInformation' {Maybe Text
id :: Maybe Text
$sel:id:VersionInformation' :: VersionInformation -> Maybe Text
id} -> Maybe Text
id) (\s :: VersionInformation
s@VersionInformation' {} Maybe Text
a -> VersionInformation
s {$sel:id:VersionInformation' :: Maybe Text
id = Maybe Text
a} :: VersionInformation)

instance Core.FromJSON VersionInformation where
  parseJSON :: Value -> Parser VersionInformation
parseJSON =
    String
-> (Object -> Parser VersionInformation)
-> Value
-> Parser VersionInformation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VersionInformation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> VersionInformation
VersionInformation'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Maybe Text -> VersionInformation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> VersionInformation)
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
"Arn")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> VersionInformation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> VersionInformation)
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
"CreationTimestamp")
            Parser (Maybe Text -> Maybe Text -> VersionInformation)
-> Parser (Maybe Text) -> Parser (Maybe Text -> VersionInformation)
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
"Version")
            Parser (Maybe Text -> VersionInformation)
-> Parser (Maybe Text) -> Parser VersionInformation
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
"Id")
      )

instance Prelude.Hashable VersionInformation

instance Prelude.NFData VersionInformation