{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Greengrass.Types.VersionInformation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 parent definition that the version is associated with.
    VersionInformation -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The ID of the version.
    VersionInformation -> Maybe Text
version :: Prelude.Maybe Prelude.Text
  }
  deriving (VersionInformation -> VersionInformation -> Bool
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]
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
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. 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.
--
-- 'id', 'versionInformation_id' - The ID of the parent definition that the version is associated with.
--
-- 'version', 'versionInformation_version' - The ID of the version.
newVersionInformation ::
  VersionInformation
newVersionInformation :: VersionInformation
newVersionInformation =
  VersionInformation'
    { $sel:arn:VersionInformation' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimestamp:VersionInformation' :: Maybe Text
creationTimestamp = forall a. Maybe a
Prelude.Nothing,
      $sel:id:VersionInformation' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:version:VersionInformation' :: Maybe Text
version = forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the version.
versionInformation_arn :: Lens.Lens' VersionInformation (Prelude.Maybe Prelude.Text)
versionInformation_arn :: Lens' VersionInformation (Maybe Text)
versionInformation_arn = 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 :: Lens' VersionInformation (Maybe Text)
versionInformation_creationTimestamp = 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 parent definition that the version is associated with.
versionInformation_id :: Lens.Lens' VersionInformation (Prelude.Maybe Prelude.Text)
versionInformation_id :: Lens' VersionInformation (Maybe Text)
versionInformation_id = 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)

-- | The ID of the version.
versionInformation_version :: Lens.Lens' VersionInformation (Prelude.Maybe Prelude.Text)
versionInformation_version :: Lens' VersionInformation (Maybe Text)
versionInformation_version = 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)

instance Data.FromJSON VersionInformation where
  parseJSON :: Value -> Parser VersionInformation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VersionInformation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> VersionInformation
VersionInformation'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CreationTimestamp")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Id")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Version")
      )

instance Prelude.Hashable VersionInformation where
  hashWithSalt :: Int -> VersionInformation -> Int
hashWithSalt Int
_salt VersionInformation' {Maybe Text
version :: Maybe Text
id :: Maybe Text
creationTimestamp :: Maybe Text
arn :: Maybe Text
$sel:version:VersionInformation' :: VersionInformation -> Maybe Text
$sel:id:VersionInformation' :: VersionInformation -> Maybe Text
$sel:creationTimestamp:VersionInformation' :: VersionInformation -> Maybe Text
$sel:arn:VersionInformation' :: VersionInformation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
creationTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
version

instance Prelude.NFData VersionInformation where
  rnf :: VersionInformation -> ()
rnf VersionInformation' {Maybe Text
version :: Maybe Text
id :: Maybe Text
creationTimestamp :: Maybe Text
arn :: Maybe Text
$sel:version:VersionInformation' :: VersionInformation -> Maybe Text
$sel:id:VersionInformation' :: VersionInformation -> Maybe Text
$sel:creationTimestamp:VersionInformation' :: VersionInformation -> Maybe Text
$sel:arn:VersionInformation' :: VersionInformation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
creationTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
version