{-# 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.IoTThingsGraph.Types.DependencyRevision
-- 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.IoTThingsGraph.Types.DependencyRevision where

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

-- | An object that contains the ID and revision number of a workflow or
-- system that is part of a deployment.
--
-- /See:/ 'newDependencyRevision' smart constructor.
data DependencyRevision = DependencyRevision'
  { -- | The revision number of the workflow or system.
    DependencyRevision -> Maybe Integer
revisionNumber :: Prelude.Maybe Prelude.Integer,
    -- | The ID of the workflow or system.
    DependencyRevision -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (DependencyRevision -> DependencyRevision -> Bool
(DependencyRevision -> DependencyRevision -> Bool)
-> (DependencyRevision -> DependencyRevision -> Bool)
-> Eq DependencyRevision
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DependencyRevision -> DependencyRevision -> Bool
$c/= :: DependencyRevision -> DependencyRevision -> Bool
== :: DependencyRevision -> DependencyRevision -> Bool
$c== :: DependencyRevision -> DependencyRevision -> Bool
Prelude.Eq, ReadPrec [DependencyRevision]
ReadPrec DependencyRevision
Int -> ReadS DependencyRevision
ReadS [DependencyRevision]
(Int -> ReadS DependencyRevision)
-> ReadS [DependencyRevision]
-> ReadPrec DependencyRevision
-> ReadPrec [DependencyRevision]
-> Read DependencyRevision
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DependencyRevision]
$creadListPrec :: ReadPrec [DependencyRevision]
readPrec :: ReadPrec DependencyRevision
$creadPrec :: ReadPrec DependencyRevision
readList :: ReadS [DependencyRevision]
$creadList :: ReadS [DependencyRevision]
readsPrec :: Int -> ReadS DependencyRevision
$creadsPrec :: Int -> ReadS DependencyRevision
Prelude.Read, Int -> DependencyRevision -> ShowS
[DependencyRevision] -> ShowS
DependencyRevision -> String
(Int -> DependencyRevision -> ShowS)
-> (DependencyRevision -> String)
-> ([DependencyRevision] -> ShowS)
-> Show DependencyRevision
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DependencyRevision] -> ShowS
$cshowList :: [DependencyRevision] -> ShowS
show :: DependencyRevision -> String
$cshow :: DependencyRevision -> String
showsPrec :: Int -> DependencyRevision -> ShowS
$cshowsPrec :: Int -> DependencyRevision -> ShowS
Prelude.Show, (forall x. DependencyRevision -> Rep DependencyRevision x)
-> (forall x. Rep DependencyRevision x -> DependencyRevision)
-> Generic DependencyRevision
forall x. Rep DependencyRevision x -> DependencyRevision
forall x. DependencyRevision -> Rep DependencyRevision x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DependencyRevision x -> DependencyRevision
$cfrom :: forall x. DependencyRevision -> Rep DependencyRevision x
Prelude.Generic)

-- |
-- Create a value of 'DependencyRevision' 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:
--
-- 'revisionNumber', 'dependencyRevision_revisionNumber' - The revision number of the workflow or system.
--
-- 'id', 'dependencyRevision_id' - The ID of the workflow or system.
newDependencyRevision ::
  DependencyRevision
newDependencyRevision :: DependencyRevision
newDependencyRevision =
  DependencyRevision' :: Maybe Integer -> Maybe Text -> DependencyRevision
DependencyRevision'
    { $sel:revisionNumber:DependencyRevision' :: Maybe Integer
revisionNumber =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:id:DependencyRevision' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The revision number of the workflow or system.
dependencyRevision_revisionNumber :: Lens.Lens' DependencyRevision (Prelude.Maybe Prelude.Integer)
dependencyRevision_revisionNumber :: (Maybe Integer -> f (Maybe Integer))
-> DependencyRevision -> f DependencyRevision
dependencyRevision_revisionNumber = (DependencyRevision -> Maybe Integer)
-> (DependencyRevision -> Maybe Integer -> DependencyRevision)
-> Lens
     DependencyRevision
     DependencyRevision
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DependencyRevision' {Maybe Integer
revisionNumber :: Maybe Integer
$sel:revisionNumber:DependencyRevision' :: DependencyRevision -> Maybe Integer
revisionNumber} -> Maybe Integer
revisionNumber) (\s :: DependencyRevision
s@DependencyRevision' {} Maybe Integer
a -> DependencyRevision
s {$sel:revisionNumber:DependencyRevision' :: Maybe Integer
revisionNumber = Maybe Integer
a} :: DependencyRevision)

-- | The ID of the workflow or system.
dependencyRevision_id :: Lens.Lens' DependencyRevision (Prelude.Maybe Prelude.Text)
dependencyRevision_id :: (Maybe Text -> f (Maybe Text))
-> DependencyRevision -> f DependencyRevision
dependencyRevision_id = (DependencyRevision -> Maybe Text)
-> (DependencyRevision -> Maybe Text -> DependencyRevision)
-> Lens
     DependencyRevision DependencyRevision (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DependencyRevision' {Maybe Text
id :: Maybe Text
$sel:id:DependencyRevision' :: DependencyRevision -> Maybe Text
id} -> Maybe Text
id) (\s :: DependencyRevision
s@DependencyRevision' {} Maybe Text
a -> DependencyRevision
s {$sel:id:DependencyRevision' :: Maybe Text
id = Maybe Text
a} :: DependencyRevision)

instance Core.FromJSON DependencyRevision where
  parseJSON :: Value -> Parser DependencyRevision
parseJSON =
    String
-> (Object -> Parser DependencyRevision)
-> Value
-> Parser DependencyRevision
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DependencyRevision"
      ( \Object
x ->
          Maybe Integer -> Maybe Text -> DependencyRevision
DependencyRevision'
            (Maybe Integer -> Maybe Text -> DependencyRevision)
-> Parser (Maybe Integer)
-> Parser (Maybe Text -> DependencyRevision)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"revisionNumber")
            Parser (Maybe Text -> DependencyRevision)
-> Parser (Maybe Text) -> Parser DependencyRevision
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 DependencyRevision

instance Prelude.NFData DependencyRevision