{-# 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.CodeDeploy.Types.GenericRevisionInfo
-- 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.CodeDeploy.Types.GenericRevisionInfo 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 an application revision.
--
-- /See:/ 'newGenericRevisionInfo' smart constructor.
data GenericRevisionInfo = GenericRevisionInfo'
  { -- | The deployment groups for which this is the current target revision.
    GenericRevisionInfo -> Maybe [Text]
deploymentGroups :: Prelude.Maybe [Prelude.Text],
    -- | A comment about the revision.
    GenericRevisionInfo -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | When the revision was first used by CodeDeploy.
    GenericRevisionInfo -> Maybe POSIX
firstUsedTime :: Prelude.Maybe Data.POSIX,
    -- | When the revision was last used by CodeDeploy.
    GenericRevisionInfo -> Maybe POSIX
lastUsedTime :: Prelude.Maybe Data.POSIX,
    -- | When the revision was registered with CodeDeploy.
    GenericRevisionInfo -> Maybe POSIX
registerTime :: Prelude.Maybe Data.POSIX
  }
  deriving (GenericRevisionInfo -> GenericRevisionInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GenericRevisionInfo -> GenericRevisionInfo -> Bool
$c/= :: GenericRevisionInfo -> GenericRevisionInfo -> Bool
== :: GenericRevisionInfo -> GenericRevisionInfo -> Bool
$c== :: GenericRevisionInfo -> GenericRevisionInfo -> Bool
Prelude.Eq, ReadPrec [GenericRevisionInfo]
ReadPrec GenericRevisionInfo
Int -> ReadS GenericRevisionInfo
ReadS [GenericRevisionInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GenericRevisionInfo]
$creadListPrec :: ReadPrec [GenericRevisionInfo]
readPrec :: ReadPrec GenericRevisionInfo
$creadPrec :: ReadPrec GenericRevisionInfo
readList :: ReadS [GenericRevisionInfo]
$creadList :: ReadS [GenericRevisionInfo]
readsPrec :: Int -> ReadS GenericRevisionInfo
$creadsPrec :: Int -> ReadS GenericRevisionInfo
Prelude.Read, Int -> GenericRevisionInfo -> ShowS
[GenericRevisionInfo] -> ShowS
GenericRevisionInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GenericRevisionInfo] -> ShowS
$cshowList :: [GenericRevisionInfo] -> ShowS
show :: GenericRevisionInfo -> String
$cshow :: GenericRevisionInfo -> String
showsPrec :: Int -> GenericRevisionInfo -> ShowS
$cshowsPrec :: Int -> GenericRevisionInfo -> ShowS
Prelude.Show, forall x. Rep GenericRevisionInfo x -> GenericRevisionInfo
forall x. GenericRevisionInfo -> Rep GenericRevisionInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GenericRevisionInfo x -> GenericRevisionInfo
$cfrom :: forall x. GenericRevisionInfo -> Rep GenericRevisionInfo x
Prelude.Generic)

-- |
-- Create a value of 'GenericRevisionInfo' 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:
--
-- 'deploymentGroups', 'genericRevisionInfo_deploymentGroups' - The deployment groups for which this is the current target revision.
--
-- 'description', 'genericRevisionInfo_description' - A comment about the revision.
--
-- 'firstUsedTime', 'genericRevisionInfo_firstUsedTime' - When the revision was first used by CodeDeploy.
--
-- 'lastUsedTime', 'genericRevisionInfo_lastUsedTime' - When the revision was last used by CodeDeploy.
--
-- 'registerTime', 'genericRevisionInfo_registerTime' - When the revision was registered with CodeDeploy.
newGenericRevisionInfo ::
  GenericRevisionInfo
newGenericRevisionInfo :: GenericRevisionInfo
newGenericRevisionInfo =
  GenericRevisionInfo'
    { $sel:deploymentGroups:GenericRevisionInfo' :: Maybe [Text]
deploymentGroups =
        forall a. Maybe a
Prelude.Nothing,
      $sel:description:GenericRevisionInfo' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:firstUsedTime:GenericRevisionInfo' :: Maybe POSIX
firstUsedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUsedTime:GenericRevisionInfo' :: Maybe POSIX
lastUsedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:registerTime:GenericRevisionInfo' :: Maybe POSIX
registerTime = forall a. Maybe a
Prelude.Nothing
    }

-- | The deployment groups for which this is the current target revision.
genericRevisionInfo_deploymentGroups :: Lens.Lens' GenericRevisionInfo (Prelude.Maybe [Prelude.Text])
genericRevisionInfo_deploymentGroups :: Lens' GenericRevisionInfo (Maybe [Text])
genericRevisionInfo_deploymentGroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GenericRevisionInfo' {Maybe [Text]
deploymentGroups :: Maybe [Text]
$sel:deploymentGroups:GenericRevisionInfo' :: GenericRevisionInfo -> Maybe [Text]
deploymentGroups} -> Maybe [Text]
deploymentGroups) (\s :: GenericRevisionInfo
s@GenericRevisionInfo' {} Maybe [Text]
a -> GenericRevisionInfo
s {$sel:deploymentGroups:GenericRevisionInfo' :: Maybe [Text]
deploymentGroups = Maybe [Text]
a} :: GenericRevisionInfo) 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

-- | A comment about the revision.
genericRevisionInfo_description :: Lens.Lens' GenericRevisionInfo (Prelude.Maybe Prelude.Text)
genericRevisionInfo_description :: Lens' GenericRevisionInfo (Maybe Text)
genericRevisionInfo_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GenericRevisionInfo' {Maybe Text
description :: Maybe Text
$sel:description:GenericRevisionInfo' :: GenericRevisionInfo -> Maybe Text
description} -> Maybe Text
description) (\s :: GenericRevisionInfo
s@GenericRevisionInfo' {} Maybe Text
a -> GenericRevisionInfo
s {$sel:description:GenericRevisionInfo' :: Maybe Text
description = Maybe Text
a} :: GenericRevisionInfo)

-- | When the revision was first used by CodeDeploy.
genericRevisionInfo_firstUsedTime :: Lens.Lens' GenericRevisionInfo (Prelude.Maybe Prelude.UTCTime)
genericRevisionInfo_firstUsedTime :: Lens' GenericRevisionInfo (Maybe UTCTime)
genericRevisionInfo_firstUsedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GenericRevisionInfo' {Maybe POSIX
firstUsedTime :: Maybe POSIX
$sel:firstUsedTime:GenericRevisionInfo' :: GenericRevisionInfo -> Maybe POSIX
firstUsedTime} -> Maybe POSIX
firstUsedTime) (\s :: GenericRevisionInfo
s@GenericRevisionInfo' {} Maybe POSIX
a -> GenericRevisionInfo
s {$sel:firstUsedTime:GenericRevisionInfo' :: Maybe POSIX
firstUsedTime = Maybe POSIX
a} :: GenericRevisionInfo) 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

-- | When the revision was last used by CodeDeploy.
genericRevisionInfo_lastUsedTime :: Lens.Lens' GenericRevisionInfo (Prelude.Maybe Prelude.UTCTime)
genericRevisionInfo_lastUsedTime :: Lens' GenericRevisionInfo (Maybe UTCTime)
genericRevisionInfo_lastUsedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GenericRevisionInfo' {Maybe POSIX
lastUsedTime :: Maybe POSIX
$sel:lastUsedTime:GenericRevisionInfo' :: GenericRevisionInfo -> Maybe POSIX
lastUsedTime} -> Maybe POSIX
lastUsedTime) (\s :: GenericRevisionInfo
s@GenericRevisionInfo' {} Maybe POSIX
a -> GenericRevisionInfo
s {$sel:lastUsedTime:GenericRevisionInfo' :: Maybe POSIX
lastUsedTime = Maybe POSIX
a} :: GenericRevisionInfo) 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

-- | When the revision was registered with CodeDeploy.
genericRevisionInfo_registerTime :: Lens.Lens' GenericRevisionInfo (Prelude.Maybe Prelude.UTCTime)
genericRevisionInfo_registerTime :: Lens' GenericRevisionInfo (Maybe UTCTime)
genericRevisionInfo_registerTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GenericRevisionInfo' {Maybe POSIX
registerTime :: Maybe POSIX
$sel:registerTime:GenericRevisionInfo' :: GenericRevisionInfo -> Maybe POSIX
registerTime} -> Maybe POSIX
registerTime) (\s :: GenericRevisionInfo
s@GenericRevisionInfo' {} Maybe POSIX
a -> GenericRevisionInfo
s {$sel:registerTime:GenericRevisionInfo' :: Maybe POSIX
registerTime = Maybe POSIX
a} :: GenericRevisionInfo) 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

instance Data.FromJSON GenericRevisionInfo where
  parseJSON :: Value -> Parser GenericRevisionInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"GenericRevisionInfo"
      ( \Object
x ->
          Maybe [Text]
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe POSIX
-> GenericRevisionInfo
GenericRevisionInfo'
            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
"deploymentGroups"
                            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
"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
"firstUsedTime")
            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
"lastUsedTime")
            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
"registerTime")
      )

instance Prelude.Hashable GenericRevisionInfo where
  hashWithSalt :: Int -> GenericRevisionInfo -> Int
hashWithSalt Int
_salt GenericRevisionInfo' {Maybe [Text]
Maybe Text
Maybe POSIX
registerTime :: Maybe POSIX
lastUsedTime :: Maybe POSIX
firstUsedTime :: Maybe POSIX
description :: Maybe Text
deploymentGroups :: Maybe [Text]
$sel:registerTime:GenericRevisionInfo' :: GenericRevisionInfo -> Maybe POSIX
$sel:lastUsedTime:GenericRevisionInfo' :: GenericRevisionInfo -> Maybe POSIX
$sel:firstUsedTime:GenericRevisionInfo' :: GenericRevisionInfo -> Maybe POSIX
$sel:description:GenericRevisionInfo' :: GenericRevisionInfo -> Maybe Text
$sel:deploymentGroups:GenericRevisionInfo' :: GenericRevisionInfo -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
deploymentGroups
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
firstUsedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUsedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
registerTime

instance Prelude.NFData GenericRevisionInfo where
  rnf :: GenericRevisionInfo -> ()
rnf GenericRevisionInfo' {Maybe [Text]
Maybe Text
Maybe POSIX
registerTime :: Maybe POSIX
lastUsedTime :: Maybe POSIX
firstUsedTime :: Maybe POSIX
description :: Maybe Text
deploymentGroups :: Maybe [Text]
$sel:registerTime:GenericRevisionInfo' :: GenericRevisionInfo -> Maybe POSIX
$sel:lastUsedTime:GenericRevisionInfo' :: GenericRevisionInfo -> Maybe POSIX
$sel:firstUsedTime:GenericRevisionInfo' :: GenericRevisionInfo -> Maybe POSIX
$sel:description:GenericRevisionInfo' :: GenericRevisionInfo -> Maybe Text
$sel:deploymentGroups:GenericRevisionInfo' :: GenericRevisionInfo -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
deploymentGroups
      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 POSIX
firstUsedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUsedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
registerTime