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

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

-- | Information about a definition.
--
-- /See:/ 'newDefinitionInformation' smart constructor.
data DefinitionInformation = DefinitionInformation'
  { -- | The ARN of the latest version associated with the definition.
    DefinitionInformation -> Maybe Text
latestVersionArn :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the definition.
    DefinitionInformation -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the definition.
    DefinitionInformation -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the definition was
    -- created.
    DefinitionInformation -> Maybe Text
creationTimestamp :: Prelude.Maybe Prelude.Text,
    -- | The ID of the definition.
    DefinitionInformation -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | Tag(s) attached to the resource arn.
    DefinitionInformation -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The ID of the latest version associated with the definition.
    DefinitionInformation -> Maybe Text
latestVersion :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the definition was last
    -- updated.
    DefinitionInformation -> Maybe Text
lastUpdatedTimestamp :: Prelude.Maybe Prelude.Text
  }
  deriving (DefinitionInformation -> DefinitionInformation -> Bool
(DefinitionInformation -> DefinitionInformation -> Bool)
-> (DefinitionInformation -> DefinitionInformation -> Bool)
-> Eq DefinitionInformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DefinitionInformation -> DefinitionInformation -> Bool
$c/= :: DefinitionInformation -> DefinitionInformation -> Bool
== :: DefinitionInformation -> DefinitionInformation -> Bool
$c== :: DefinitionInformation -> DefinitionInformation -> Bool
Prelude.Eq, ReadPrec [DefinitionInformation]
ReadPrec DefinitionInformation
Int -> ReadS DefinitionInformation
ReadS [DefinitionInformation]
(Int -> ReadS DefinitionInformation)
-> ReadS [DefinitionInformation]
-> ReadPrec DefinitionInformation
-> ReadPrec [DefinitionInformation]
-> Read DefinitionInformation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DefinitionInformation]
$creadListPrec :: ReadPrec [DefinitionInformation]
readPrec :: ReadPrec DefinitionInformation
$creadPrec :: ReadPrec DefinitionInformation
readList :: ReadS [DefinitionInformation]
$creadList :: ReadS [DefinitionInformation]
readsPrec :: Int -> ReadS DefinitionInformation
$creadsPrec :: Int -> ReadS DefinitionInformation
Prelude.Read, Int -> DefinitionInformation -> ShowS
[DefinitionInformation] -> ShowS
DefinitionInformation -> String
(Int -> DefinitionInformation -> ShowS)
-> (DefinitionInformation -> String)
-> ([DefinitionInformation] -> ShowS)
-> Show DefinitionInformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DefinitionInformation] -> ShowS
$cshowList :: [DefinitionInformation] -> ShowS
show :: DefinitionInformation -> String
$cshow :: DefinitionInformation -> String
showsPrec :: Int -> DefinitionInformation -> ShowS
$cshowsPrec :: Int -> DefinitionInformation -> ShowS
Prelude.Show, (forall x. DefinitionInformation -> Rep DefinitionInformation x)
-> (forall x. Rep DefinitionInformation x -> DefinitionInformation)
-> Generic DefinitionInformation
forall x. Rep DefinitionInformation x -> DefinitionInformation
forall x. DefinitionInformation -> Rep DefinitionInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DefinitionInformation x -> DefinitionInformation
$cfrom :: forall x. DefinitionInformation -> Rep DefinitionInformation x
Prelude.Generic)

-- |
-- Create a value of 'DefinitionInformation' 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:
--
-- 'latestVersionArn', 'definitionInformation_latestVersionArn' - The ARN of the latest version associated with the definition.
--
-- 'arn', 'definitionInformation_arn' - The ARN of the definition.
--
-- 'name', 'definitionInformation_name' - The name of the definition.
--
-- 'creationTimestamp', 'definitionInformation_creationTimestamp' - The time, in milliseconds since the epoch, when the definition was
-- created.
--
-- 'id', 'definitionInformation_id' - The ID of the definition.
--
-- 'tags', 'definitionInformation_tags' - Tag(s) attached to the resource arn.
--
-- 'latestVersion', 'definitionInformation_latestVersion' - The ID of the latest version associated with the definition.
--
-- 'lastUpdatedTimestamp', 'definitionInformation_lastUpdatedTimestamp' - The time, in milliseconds since the epoch, when the definition was last
-- updated.
newDefinitionInformation ::
  DefinitionInformation
newDefinitionInformation :: DefinitionInformation
newDefinitionInformation =
  DefinitionInformation' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> DefinitionInformation
DefinitionInformation'
    { $sel:latestVersionArn:DefinitionInformation' :: Maybe Text
latestVersionArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:DefinitionInformation' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:DefinitionInformation' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimestamp:DefinitionInformation' :: Maybe Text
creationTimestamp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:DefinitionInformation' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:DefinitionInformation' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:latestVersion:DefinitionInformation' :: Maybe Text
latestVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimestamp:DefinitionInformation' :: Maybe Text
lastUpdatedTimestamp = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the latest version associated with the definition.
definitionInformation_latestVersionArn :: Lens.Lens' DefinitionInformation (Prelude.Maybe Prelude.Text)
definitionInformation_latestVersionArn :: (Maybe Text -> f (Maybe Text))
-> DefinitionInformation -> f DefinitionInformation
definitionInformation_latestVersionArn = (DefinitionInformation -> Maybe Text)
-> (DefinitionInformation -> Maybe Text -> DefinitionInformation)
-> Lens
     DefinitionInformation
     DefinitionInformation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefinitionInformation' {Maybe Text
latestVersionArn :: Maybe Text
$sel:latestVersionArn:DefinitionInformation' :: DefinitionInformation -> Maybe Text
latestVersionArn} -> Maybe Text
latestVersionArn) (\s :: DefinitionInformation
s@DefinitionInformation' {} Maybe Text
a -> DefinitionInformation
s {$sel:latestVersionArn:DefinitionInformation' :: Maybe Text
latestVersionArn = Maybe Text
a} :: DefinitionInformation)

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

-- | The name of the definition.
definitionInformation_name :: Lens.Lens' DefinitionInformation (Prelude.Maybe Prelude.Text)
definitionInformation_name :: (Maybe Text -> f (Maybe Text))
-> DefinitionInformation -> f DefinitionInformation
definitionInformation_name = (DefinitionInformation -> Maybe Text)
-> (DefinitionInformation -> Maybe Text -> DefinitionInformation)
-> Lens
     DefinitionInformation
     DefinitionInformation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefinitionInformation' {Maybe Text
name :: Maybe Text
$sel:name:DefinitionInformation' :: DefinitionInformation -> Maybe Text
name} -> Maybe Text
name) (\s :: DefinitionInformation
s@DefinitionInformation' {} Maybe Text
a -> DefinitionInformation
s {$sel:name:DefinitionInformation' :: Maybe Text
name = Maybe Text
a} :: DefinitionInformation)

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

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

-- | Tag(s) attached to the resource arn.
definitionInformation_tags :: Lens.Lens' DefinitionInformation (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
definitionInformation_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DefinitionInformation -> f DefinitionInformation
definitionInformation_tags = (DefinitionInformation -> Maybe (HashMap Text Text))
-> (DefinitionInformation
    -> Maybe (HashMap Text Text) -> DefinitionInformation)
-> Lens
     DefinitionInformation
     DefinitionInformation
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefinitionInformation' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:DefinitionInformation' :: DefinitionInformation -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: DefinitionInformation
s@DefinitionInformation' {} Maybe (HashMap Text Text)
a -> DefinitionInformation
s {$sel:tags:DefinitionInformation' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: DefinitionInformation) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> DefinitionInformation -> f DefinitionInformation)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DefinitionInformation
-> f DefinitionInformation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the latest version associated with the definition.
definitionInformation_latestVersion :: Lens.Lens' DefinitionInformation (Prelude.Maybe Prelude.Text)
definitionInformation_latestVersion :: (Maybe Text -> f (Maybe Text))
-> DefinitionInformation -> f DefinitionInformation
definitionInformation_latestVersion = (DefinitionInformation -> Maybe Text)
-> (DefinitionInformation -> Maybe Text -> DefinitionInformation)
-> Lens
     DefinitionInformation
     DefinitionInformation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefinitionInformation' {Maybe Text
latestVersion :: Maybe Text
$sel:latestVersion:DefinitionInformation' :: DefinitionInformation -> Maybe Text
latestVersion} -> Maybe Text
latestVersion) (\s :: DefinitionInformation
s@DefinitionInformation' {} Maybe Text
a -> DefinitionInformation
s {$sel:latestVersion:DefinitionInformation' :: Maybe Text
latestVersion = Maybe Text
a} :: DefinitionInformation)

-- | The time, in milliseconds since the epoch, when the definition was last
-- updated.
definitionInformation_lastUpdatedTimestamp :: Lens.Lens' DefinitionInformation (Prelude.Maybe Prelude.Text)
definitionInformation_lastUpdatedTimestamp :: (Maybe Text -> f (Maybe Text))
-> DefinitionInformation -> f DefinitionInformation
definitionInformation_lastUpdatedTimestamp = (DefinitionInformation -> Maybe Text)
-> (DefinitionInformation -> Maybe Text -> DefinitionInformation)
-> Lens
     DefinitionInformation
     DefinitionInformation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DefinitionInformation' {Maybe Text
lastUpdatedTimestamp :: Maybe Text
$sel:lastUpdatedTimestamp:DefinitionInformation' :: DefinitionInformation -> Maybe Text
lastUpdatedTimestamp} -> Maybe Text
lastUpdatedTimestamp) (\s :: DefinitionInformation
s@DefinitionInformation' {} Maybe Text
a -> DefinitionInformation
s {$sel:lastUpdatedTimestamp:DefinitionInformation' :: Maybe Text
lastUpdatedTimestamp = Maybe Text
a} :: DefinitionInformation)

instance Core.FromJSON DefinitionInformation where
  parseJSON :: Value -> Parser DefinitionInformation
parseJSON =
    String
-> (Object -> Parser DefinitionInformation)
-> Value
-> Parser DefinitionInformation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DefinitionInformation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> DefinitionInformation
DefinitionInformation'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Maybe Text
 -> Maybe Text
 -> DefinitionInformation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe Text
      -> Maybe Text
      -> DefinitionInformation)
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
"LatestVersionArn")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe Text
   -> Maybe Text
   -> DefinitionInformation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe Text
      -> Maybe Text
      -> DefinitionInformation)
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 Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe Text
   -> Maybe Text
   -> DefinitionInformation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe Text
      -> Maybe Text
      -> DefinitionInformation)
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
"Name")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe Text
   -> Maybe Text
   -> DefinitionInformation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe Text
      -> Maybe Text
      -> DefinitionInformation)
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 (HashMap Text Text)
   -> Maybe Text
   -> Maybe Text
   -> DefinitionInformation)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> Maybe Text -> Maybe Text -> DefinitionInformation)
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")
            Parser
  (Maybe (HashMap Text Text)
   -> Maybe Text -> Maybe Text -> DefinitionInformation)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Maybe Text -> Maybe Text -> DefinitionInformation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> Maybe Text -> DefinitionInformation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> DefinitionInformation)
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
"LatestVersion")
            Parser (Maybe Text -> DefinitionInformation)
-> Parser (Maybe Text) -> Parser DefinitionInformation
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
"LastUpdatedTimestamp")
      )

instance Prelude.Hashable DefinitionInformation

instance Prelude.NFData DefinitionInformation