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

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

-- | Contains information about the latest version of a component.
--
-- /See:/ 'newComponentLatestVersion' smart constructor.
data ComponentLatestVersion = ComponentLatestVersion'
  { -- | The platforms that the component version supports.
    ComponentLatestVersion -> Maybe [ComponentPlatform]
platforms :: Prelude.Maybe [ComponentPlatform],
    -- | 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 Core.POSIX,
    -- | The publisher of the component version.
    ComponentLatestVersion -> Maybe Text
publisher :: Prelude.Maybe Prelude.Text,
    -- | The description of the component version.
    ComponentLatestVersion -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (ComponentLatestVersion -> ComponentLatestVersion -> Bool
(ComponentLatestVersion -> ComponentLatestVersion -> Bool)
-> (ComponentLatestVersion -> ComponentLatestVersion -> Bool)
-> Eq ComponentLatestVersion
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]
(Int -> ReadS ComponentLatestVersion)
-> ReadS [ComponentLatestVersion]
-> ReadPrec ComponentLatestVersion
-> ReadPrec [ComponentLatestVersion]
-> Read 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
(Int -> ComponentLatestVersion -> ShowS)
-> (ComponentLatestVersion -> String)
-> ([ComponentLatestVersion] -> ShowS)
-> Show ComponentLatestVersion
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. ComponentLatestVersion -> Rep ComponentLatestVersion x)
-> (forall x.
    Rep ComponentLatestVersion x -> ComponentLatestVersion)
-> Generic ComponentLatestVersion
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:
--
-- 'platforms', 'componentLatestVersion_platforms' - The platforms that the component version supports.
--
-- '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.
--
-- 'publisher', 'componentLatestVersion_publisher' - The publisher of the component version.
--
-- 'description', 'componentLatestVersion_description' - The description of the component version.
newComponentLatestVersion ::
  ComponentLatestVersion
newComponentLatestVersion :: ComponentLatestVersion
newComponentLatestVersion =
  ComponentLatestVersion' :: Maybe [ComponentPlatform]
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> ComponentLatestVersion
ComponentLatestVersion'
    { $sel:platforms:ComponentLatestVersion' :: Maybe [ComponentPlatform]
platforms =
        Maybe [ComponentPlatform]
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:ComponentLatestVersion' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:componentVersion:ComponentLatestVersion' :: Maybe Text
componentVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimestamp:ComponentLatestVersion' :: Maybe POSIX
creationTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:publisher:ComponentLatestVersion' :: Maybe Text
publisher = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:ComponentLatestVersion' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The platforms that the component version supports.
componentLatestVersion_platforms :: Lens.Lens' ComponentLatestVersion (Prelude.Maybe [ComponentPlatform])
componentLatestVersion_platforms :: (Maybe [ComponentPlatform] -> f (Maybe [ComponentPlatform]))
-> ComponentLatestVersion -> f ComponentLatestVersion
componentLatestVersion_platforms = (ComponentLatestVersion -> Maybe [ComponentPlatform])
-> (ComponentLatestVersion
    -> Maybe [ComponentPlatform] -> ComponentLatestVersion)
-> Lens
     ComponentLatestVersion
     ComponentLatestVersion
     (Maybe [ComponentPlatform])
     (Maybe [ComponentPlatform])
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) ((Maybe [ComponentPlatform] -> f (Maybe [ComponentPlatform]))
 -> ComponentLatestVersion -> f ComponentLatestVersion)
-> ((Maybe [ComponentPlatform] -> f (Maybe [ComponentPlatform]))
    -> Maybe [ComponentPlatform] -> f (Maybe [ComponentPlatform]))
-> (Maybe [ComponentPlatform] -> f (Maybe [ComponentPlatform]))
-> ComponentLatestVersion
-> f ComponentLatestVersion
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ComponentPlatform]
  [ComponentPlatform]
  [ComponentPlatform]
  [ComponentPlatform]
-> Iso
     (Maybe [ComponentPlatform])
     (Maybe [ComponentPlatform])
     (Maybe [ComponentPlatform])
     (Maybe [ComponentPlatform])
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 AnIso
  [ComponentPlatform]
  [ComponentPlatform]
  [ComponentPlatform]
  [ComponentPlatform]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> ComponentLatestVersion -> f ComponentLatestVersion
componentLatestVersion_arn = (ComponentLatestVersion -> Maybe Text)
-> (ComponentLatestVersion -> Maybe Text -> ComponentLatestVersion)
-> Lens
     ComponentLatestVersion
     ComponentLatestVersion
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> ComponentLatestVersion -> f ComponentLatestVersion
componentLatestVersion_componentVersion = (ComponentLatestVersion -> Maybe Text)
-> (ComponentLatestVersion -> Maybe Text -> ComponentLatestVersion)
-> Lens
     ComponentLatestVersion
     ComponentLatestVersion
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ComponentLatestVersion -> f ComponentLatestVersion
componentLatestVersion_creationTimestamp = (ComponentLatestVersion -> Maybe POSIX)
-> (ComponentLatestVersion
    -> Maybe POSIX -> ComponentLatestVersion)
-> Lens
     ComponentLatestVersion
     ComponentLatestVersion
     (Maybe POSIX)
     (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> ComponentLatestVersion -> f ComponentLatestVersion)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ComponentLatestVersion
-> f ComponentLatestVersion
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The publisher of the component version.
componentLatestVersion_publisher :: Lens.Lens' ComponentLatestVersion (Prelude.Maybe Prelude.Text)
componentLatestVersion_publisher :: (Maybe Text -> f (Maybe Text))
-> ComponentLatestVersion -> f ComponentLatestVersion
componentLatestVersion_publisher = (ComponentLatestVersion -> Maybe Text)
-> (ComponentLatestVersion -> Maybe Text -> ComponentLatestVersion)
-> Lens
     ComponentLatestVersion
     ComponentLatestVersion
     (Maybe Text)
     (Maybe Text)
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)

-- | The description of the component version.
componentLatestVersion_description :: Lens.Lens' ComponentLatestVersion (Prelude.Maybe Prelude.Text)
componentLatestVersion_description :: (Maybe Text -> f (Maybe Text))
-> ComponentLatestVersion -> f ComponentLatestVersion
componentLatestVersion_description = (ComponentLatestVersion -> Maybe Text)
-> (ComponentLatestVersion -> Maybe Text -> ComponentLatestVersion)
-> Lens
     ComponentLatestVersion
     ComponentLatestVersion
     (Maybe Text)
     (Maybe Text)
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)

instance Core.FromJSON ComponentLatestVersion where
  parseJSON :: Value -> Parser ComponentLatestVersion
parseJSON =
    String
-> (Object -> Parser ComponentLatestVersion)
-> Value
-> Parser ComponentLatestVersion
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ComponentLatestVersion"
      ( \Object
x ->
          Maybe [ComponentPlatform]
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> ComponentLatestVersion
ComponentLatestVersion'
            (Maybe [ComponentPlatform]
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> ComponentLatestVersion)
-> Parser (Maybe [ComponentPlatform])
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> ComponentLatestVersion)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [ComponentPlatform]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"platforms" Parser (Maybe (Maybe [ComponentPlatform]))
-> Maybe [ComponentPlatform] -> Parser (Maybe [ComponentPlatform])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ComponentPlatform]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> ComponentLatestVersion)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> ComponentLatestVersion)
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
"arn")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> ComponentLatestVersion)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX -> Maybe Text -> Maybe Text -> ComponentLatestVersion)
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
"componentVersion")
            Parser
  (Maybe POSIX -> Maybe Text -> Maybe Text -> ComponentLatestVersion)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Text -> ComponentLatestVersion)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"creationTimestamp")
            Parser (Maybe Text -> Maybe Text -> ComponentLatestVersion)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ComponentLatestVersion)
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
"publisher")
            Parser (Maybe Text -> ComponentLatestVersion)
-> Parser (Maybe Text) -> Parser ComponentLatestVersion
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
"description")
      )

instance Prelude.Hashable ComponentLatestVersion

instance Prelude.NFData ComponentLatestVersion