{-# 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.GreengrassV2.Types.ComponentLatestVersion
-- 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.GreengrassV2.Types.ComponentLatestVersion where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GreengrassV2.Types.ComponentPlatform
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the latest version of a component.
--
-- /See:/ 'newComponentLatestVersion' smart constructor.
data ComponentLatestVersion = ComponentLatestVersion'
  { -- | The
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
    -- of the component version.
    ComponentLatestVersion -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The version of the component.
    ComponentLatestVersion -> Maybe Text
componentVersion :: Prelude.Maybe Prelude.Text,
    -- | The time at which the component was created, expressed in ISO 8601
    -- format.
    ComponentLatestVersion -> Maybe POSIX
creationTimestamp :: Prelude.Maybe Data.POSIX,
    -- | The description of the component version.
    ComponentLatestVersion -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The platforms that the component version supports.
    ComponentLatestVersion -> Maybe [ComponentPlatform]
platforms :: Prelude.Maybe [ComponentPlatform],
    -- | The publisher of the component version.
    ComponentLatestVersion -> Maybe Text
publisher :: Prelude.Maybe Prelude.Text
  }
  deriving (ComponentLatestVersion -> ComponentLatestVersion -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComponentLatestVersion -> ComponentLatestVersion -> Bool
$c/= :: ComponentLatestVersion -> ComponentLatestVersion -> Bool
== :: ComponentLatestVersion -> ComponentLatestVersion -> Bool
$c== :: ComponentLatestVersion -> ComponentLatestVersion -> Bool
Prelude.Eq, ReadPrec [ComponentLatestVersion]
ReadPrec ComponentLatestVersion
Int -> ReadS ComponentLatestVersion
ReadS [ComponentLatestVersion]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComponentLatestVersion]
$creadListPrec :: ReadPrec [ComponentLatestVersion]
readPrec :: ReadPrec ComponentLatestVersion
$creadPrec :: ReadPrec ComponentLatestVersion
readList :: ReadS [ComponentLatestVersion]
$creadList :: ReadS [ComponentLatestVersion]
readsPrec :: Int -> ReadS ComponentLatestVersion
$creadsPrec :: Int -> ReadS ComponentLatestVersion
Prelude.Read, Int -> ComponentLatestVersion -> ShowS
[ComponentLatestVersion] -> ShowS
ComponentLatestVersion -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComponentLatestVersion] -> ShowS
$cshowList :: [ComponentLatestVersion] -> ShowS
show :: ComponentLatestVersion -> String
$cshow :: ComponentLatestVersion -> String
showsPrec :: Int -> ComponentLatestVersion -> ShowS
$cshowsPrec :: Int -> ComponentLatestVersion -> ShowS
Prelude.Show, forall x. Rep ComponentLatestVersion x -> ComponentLatestVersion
forall x. ComponentLatestVersion -> Rep ComponentLatestVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComponentLatestVersion x -> ComponentLatestVersion
$cfrom :: forall x. ComponentLatestVersion -> Rep ComponentLatestVersion x
Prelude.Generic)

-- |
-- Create a value of 'ComponentLatestVersion' 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', 'componentLatestVersion_arn' - The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
-- of the component version.
--
-- 'componentVersion', 'componentLatestVersion_componentVersion' - The version of the component.
--
-- 'creationTimestamp', 'componentLatestVersion_creationTimestamp' - The time at which the component was created, expressed in ISO 8601
-- format.
--
-- 'description', 'componentLatestVersion_description' - The description of the component version.
--
-- 'platforms', 'componentLatestVersion_platforms' - The platforms that the component version supports.
--
-- 'publisher', 'componentLatestVersion_publisher' - The publisher of the component version.
newComponentLatestVersion ::
  ComponentLatestVersion
newComponentLatestVersion :: ComponentLatestVersion
newComponentLatestVersion =
  ComponentLatestVersion'
    { $sel:arn:ComponentLatestVersion' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:componentVersion:ComponentLatestVersion' :: Maybe Text
componentVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimestamp:ComponentLatestVersion' :: Maybe POSIX
creationTimestamp = forall a. Maybe a
Prelude.Nothing,
      $sel:description:ComponentLatestVersion' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:platforms:ComponentLatestVersion' :: Maybe [ComponentPlatform]
platforms = forall a. Maybe a
Prelude.Nothing,
      $sel:publisher:ComponentLatestVersion' :: Maybe Text
publisher = forall a. Maybe a
Prelude.Nothing
    }

-- | The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
-- of the component version.
componentLatestVersion_arn :: Lens.Lens' ComponentLatestVersion (Prelude.Maybe Prelude.Text)
componentLatestVersion_arn :: Lens' ComponentLatestVersion (Maybe Text)
componentLatestVersion_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentLatestVersion' {Maybe Text
arn :: Maybe Text
$sel:arn:ComponentLatestVersion' :: ComponentLatestVersion -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ComponentLatestVersion
s@ComponentLatestVersion' {} Maybe Text
a -> ComponentLatestVersion
s {$sel:arn:ComponentLatestVersion' :: Maybe Text
arn = Maybe Text
a} :: ComponentLatestVersion)

-- | The version of the component.
componentLatestVersion_componentVersion :: Lens.Lens' ComponentLatestVersion (Prelude.Maybe Prelude.Text)
componentLatestVersion_componentVersion :: Lens' ComponentLatestVersion (Maybe Text)
componentLatestVersion_componentVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentLatestVersion' {Maybe Text
componentVersion :: Maybe Text
$sel:componentVersion:ComponentLatestVersion' :: ComponentLatestVersion -> Maybe Text
componentVersion} -> Maybe Text
componentVersion) (\s :: ComponentLatestVersion
s@ComponentLatestVersion' {} Maybe Text
a -> ComponentLatestVersion
s {$sel:componentVersion:ComponentLatestVersion' :: Maybe Text
componentVersion = Maybe Text
a} :: ComponentLatestVersion)

-- | The time at which the component was created, expressed in ISO 8601
-- format.
componentLatestVersion_creationTimestamp :: Lens.Lens' ComponentLatestVersion (Prelude.Maybe Prelude.UTCTime)
componentLatestVersion_creationTimestamp :: Lens' ComponentLatestVersion (Maybe UTCTime)
componentLatestVersion_creationTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentLatestVersion' {Maybe POSIX
creationTimestamp :: Maybe POSIX
$sel:creationTimestamp:ComponentLatestVersion' :: ComponentLatestVersion -> Maybe POSIX
creationTimestamp} -> Maybe POSIX
creationTimestamp) (\s :: ComponentLatestVersion
s@ComponentLatestVersion' {} Maybe POSIX
a -> ComponentLatestVersion
s {$sel:creationTimestamp:ComponentLatestVersion' :: Maybe POSIX
creationTimestamp = Maybe POSIX
a} :: ComponentLatestVersion) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The description of the component version.
componentLatestVersion_description :: Lens.Lens' ComponentLatestVersion (Prelude.Maybe Prelude.Text)
componentLatestVersion_description :: Lens' ComponentLatestVersion (Maybe Text)
componentLatestVersion_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentLatestVersion' {Maybe Text
description :: Maybe Text
$sel:description:ComponentLatestVersion' :: ComponentLatestVersion -> Maybe Text
description} -> Maybe Text
description) (\s :: ComponentLatestVersion
s@ComponentLatestVersion' {} Maybe Text
a -> ComponentLatestVersion
s {$sel:description:ComponentLatestVersion' :: Maybe Text
description = Maybe Text
a} :: ComponentLatestVersion)

-- | The platforms that the component version supports.
componentLatestVersion_platforms :: Lens.Lens' ComponentLatestVersion (Prelude.Maybe [ComponentPlatform])
componentLatestVersion_platforms :: Lens' ComponentLatestVersion (Maybe [ComponentPlatform])
componentLatestVersion_platforms = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentLatestVersion' {Maybe [ComponentPlatform]
platforms :: Maybe [ComponentPlatform]
$sel:platforms:ComponentLatestVersion' :: ComponentLatestVersion -> Maybe [ComponentPlatform]
platforms} -> Maybe [ComponentPlatform]
platforms) (\s :: ComponentLatestVersion
s@ComponentLatestVersion' {} Maybe [ComponentPlatform]
a -> ComponentLatestVersion
s {$sel:platforms:ComponentLatestVersion' :: Maybe [ComponentPlatform]
platforms = Maybe [ComponentPlatform]
a} :: ComponentLatestVersion) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The publisher of the component version.
componentLatestVersion_publisher :: Lens.Lens' ComponentLatestVersion (Prelude.Maybe Prelude.Text)
componentLatestVersion_publisher :: Lens' ComponentLatestVersion (Maybe Text)
componentLatestVersion_publisher = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentLatestVersion' {Maybe Text
publisher :: Maybe Text
$sel:publisher:ComponentLatestVersion' :: ComponentLatestVersion -> Maybe Text
publisher} -> Maybe Text
publisher) (\s :: ComponentLatestVersion
s@ComponentLatestVersion' {} Maybe Text
a -> ComponentLatestVersion
s {$sel:publisher:ComponentLatestVersion' :: Maybe Text
publisher = Maybe Text
a} :: ComponentLatestVersion)

instance Data.FromJSON ComponentLatestVersion where
  parseJSON :: Value -> Parser ComponentLatestVersion
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ComponentLatestVersion"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe [ComponentPlatform]
-> Maybe Text
-> ComponentLatestVersion
ComponentLatestVersion'
            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
"componentVersion")
            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
"description")
            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
"platforms" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"publisher")
      )

instance Prelude.Hashable ComponentLatestVersion where
  hashWithSalt :: Int -> ComponentLatestVersion -> Int
hashWithSalt Int
_salt ComponentLatestVersion' {Maybe [ComponentPlatform]
Maybe Text
Maybe POSIX
publisher :: Maybe Text
platforms :: Maybe [ComponentPlatform]
description :: Maybe Text
creationTimestamp :: Maybe POSIX
componentVersion :: Maybe Text
arn :: Maybe Text
$sel:publisher:ComponentLatestVersion' :: ComponentLatestVersion -> Maybe Text
$sel:platforms:ComponentLatestVersion' :: ComponentLatestVersion -> Maybe [ComponentPlatform]
$sel:description:ComponentLatestVersion' :: ComponentLatestVersion -> Maybe Text
$sel:creationTimestamp:ComponentLatestVersion' :: ComponentLatestVersion -> Maybe POSIX
$sel:componentVersion:ComponentLatestVersion' :: ComponentLatestVersion -> Maybe Text
$sel:arn:ComponentLatestVersion' :: ComponentLatestVersion -> 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
componentVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ComponentPlatform]
platforms
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
publisher

instance Prelude.NFData ComponentLatestVersion where
  rnf :: ComponentLatestVersion -> ()
rnf ComponentLatestVersion' {Maybe [ComponentPlatform]
Maybe Text
Maybe POSIX
publisher :: Maybe Text
platforms :: Maybe [ComponentPlatform]
description :: Maybe Text
creationTimestamp :: Maybe POSIX
componentVersion :: Maybe Text
arn :: Maybe Text
$sel:publisher:ComponentLatestVersion' :: ComponentLatestVersion -> Maybe Text
$sel:platforms:ComponentLatestVersion' :: ComponentLatestVersion -> Maybe [ComponentPlatform]
$sel:description:ComponentLatestVersion' :: ComponentLatestVersion -> Maybe Text
$sel:creationTimestamp:ComponentLatestVersion' :: ComponentLatestVersion -> Maybe POSIX
$sel:componentVersion:ComponentLatestVersion' :: ComponentLatestVersion -> Maybe Text
$sel:arn:ComponentLatestVersion' :: ComponentLatestVersion -> 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
componentVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ComponentPlatform]
platforms
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
publisher