{-# 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.Amplify.Types.ProductionBranch
-- 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.Amplify.Types.ProductionBranch where

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

-- | Describes the information about a production branch for an Amplify app.
--
-- /See:/ 'newProductionBranch' smart constructor.
data ProductionBranch = ProductionBranch'
  { -- | The last deploy time of the production branch.
    ProductionBranch -> Maybe POSIX
lastDeployTime :: Prelude.Maybe Core.POSIX,
    -- | The status of the production branch.
    ProductionBranch -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The thumbnail URL for the production branch.
    ProductionBranch -> Maybe Text
thumbnailUrl :: Prelude.Maybe Prelude.Text,
    -- | The branch name for the production branch.
    ProductionBranch -> Maybe Text
branchName :: Prelude.Maybe Prelude.Text
  }
  deriving (ProductionBranch -> ProductionBranch -> Bool
(ProductionBranch -> ProductionBranch -> Bool)
-> (ProductionBranch -> ProductionBranch -> Bool)
-> Eq ProductionBranch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProductionBranch -> ProductionBranch -> Bool
$c/= :: ProductionBranch -> ProductionBranch -> Bool
== :: ProductionBranch -> ProductionBranch -> Bool
$c== :: ProductionBranch -> ProductionBranch -> Bool
Prelude.Eq, ReadPrec [ProductionBranch]
ReadPrec ProductionBranch
Int -> ReadS ProductionBranch
ReadS [ProductionBranch]
(Int -> ReadS ProductionBranch)
-> ReadS [ProductionBranch]
-> ReadPrec ProductionBranch
-> ReadPrec [ProductionBranch]
-> Read ProductionBranch
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProductionBranch]
$creadListPrec :: ReadPrec [ProductionBranch]
readPrec :: ReadPrec ProductionBranch
$creadPrec :: ReadPrec ProductionBranch
readList :: ReadS [ProductionBranch]
$creadList :: ReadS [ProductionBranch]
readsPrec :: Int -> ReadS ProductionBranch
$creadsPrec :: Int -> ReadS ProductionBranch
Prelude.Read, Int -> ProductionBranch -> ShowS
[ProductionBranch] -> ShowS
ProductionBranch -> String
(Int -> ProductionBranch -> ShowS)
-> (ProductionBranch -> String)
-> ([ProductionBranch] -> ShowS)
-> Show ProductionBranch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProductionBranch] -> ShowS
$cshowList :: [ProductionBranch] -> ShowS
show :: ProductionBranch -> String
$cshow :: ProductionBranch -> String
showsPrec :: Int -> ProductionBranch -> ShowS
$cshowsPrec :: Int -> ProductionBranch -> ShowS
Prelude.Show, (forall x. ProductionBranch -> Rep ProductionBranch x)
-> (forall x. Rep ProductionBranch x -> ProductionBranch)
-> Generic ProductionBranch
forall x. Rep ProductionBranch x -> ProductionBranch
forall x. ProductionBranch -> Rep ProductionBranch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProductionBranch x -> ProductionBranch
$cfrom :: forall x. ProductionBranch -> Rep ProductionBranch x
Prelude.Generic)

-- |
-- Create a value of 'ProductionBranch' 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:
--
-- 'lastDeployTime', 'productionBranch_lastDeployTime' - The last deploy time of the production branch.
--
-- 'status', 'productionBranch_status' - The status of the production branch.
--
-- 'thumbnailUrl', 'productionBranch_thumbnailUrl' - The thumbnail URL for the production branch.
--
-- 'branchName', 'productionBranch_branchName' - The branch name for the production branch.
newProductionBranch ::
  ProductionBranch
newProductionBranch :: ProductionBranch
newProductionBranch =
  ProductionBranch' :: Maybe POSIX
-> Maybe Text -> Maybe Text -> Maybe Text -> ProductionBranch
ProductionBranch'
    { $sel:lastDeployTime:ProductionBranch' :: Maybe POSIX
lastDeployTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:status:ProductionBranch' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:thumbnailUrl:ProductionBranch' :: Maybe Text
thumbnailUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:branchName:ProductionBranch' :: Maybe Text
branchName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The last deploy time of the production branch.
productionBranch_lastDeployTime :: Lens.Lens' ProductionBranch (Prelude.Maybe Prelude.UTCTime)
productionBranch_lastDeployTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ProductionBranch -> f ProductionBranch
productionBranch_lastDeployTime = (ProductionBranch -> Maybe POSIX)
-> (ProductionBranch -> Maybe POSIX -> ProductionBranch)
-> Lens
     ProductionBranch ProductionBranch (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionBranch' {Maybe POSIX
lastDeployTime :: Maybe POSIX
$sel:lastDeployTime:ProductionBranch' :: ProductionBranch -> Maybe POSIX
lastDeployTime} -> Maybe POSIX
lastDeployTime) (\s :: ProductionBranch
s@ProductionBranch' {} Maybe POSIX
a -> ProductionBranch
s {$sel:lastDeployTime:ProductionBranch' :: Maybe POSIX
lastDeployTime = Maybe POSIX
a} :: ProductionBranch) ((Maybe POSIX -> f (Maybe POSIX))
 -> ProductionBranch -> f ProductionBranch)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ProductionBranch
-> f ProductionBranch
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 status of the production branch.
productionBranch_status :: Lens.Lens' ProductionBranch (Prelude.Maybe Prelude.Text)
productionBranch_status :: (Maybe Text -> f (Maybe Text))
-> ProductionBranch -> f ProductionBranch
productionBranch_status = (ProductionBranch -> Maybe Text)
-> (ProductionBranch -> Maybe Text -> ProductionBranch)
-> Lens ProductionBranch ProductionBranch (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionBranch' {Maybe Text
status :: Maybe Text
$sel:status:ProductionBranch' :: ProductionBranch -> Maybe Text
status} -> Maybe Text
status) (\s :: ProductionBranch
s@ProductionBranch' {} Maybe Text
a -> ProductionBranch
s {$sel:status:ProductionBranch' :: Maybe Text
status = Maybe Text
a} :: ProductionBranch)

-- | The thumbnail URL for the production branch.
productionBranch_thumbnailUrl :: Lens.Lens' ProductionBranch (Prelude.Maybe Prelude.Text)
productionBranch_thumbnailUrl :: (Maybe Text -> f (Maybe Text))
-> ProductionBranch -> f ProductionBranch
productionBranch_thumbnailUrl = (ProductionBranch -> Maybe Text)
-> (ProductionBranch -> Maybe Text -> ProductionBranch)
-> Lens ProductionBranch ProductionBranch (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionBranch' {Maybe Text
thumbnailUrl :: Maybe Text
$sel:thumbnailUrl:ProductionBranch' :: ProductionBranch -> Maybe Text
thumbnailUrl} -> Maybe Text
thumbnailUrl) (\s :: ProductionBranch
s@ProductionBranch' {} Maybe Text
a -> ProductionBranch
s {$sel:thumbnailUrl:ProductionBranch' :: Maybe Text
thumbnailUrl = Maybe Text
a} :: ProductionBranch)

-- | The branch name for the production branch.
productionBranch_branchName :: Lens.Lens' ProductionBranch (Prelude.Maybe Prelude.Text)
productionBranch_branchName :: (Maybe Text -> f (Maybe Text))
-> ProductionBranch -> f ProductionBranch
productionBranch_branchName = (ProductionBranch -> Maybe Text)
-> (ProductionBranch -> Maybe Text -> ProductionBranch)
-> Lens ProductionBranch ProductionBranch (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionBranch' {Maybe Text
branchName :: Maybe Text
$sel:branchName:ProductionBranch' :: ProductionBranch -> Maybe Text
branchName} -> Maybe Text
branchName) (\s :: ProductionBranch
s@ProductionBranch' {} Maybe Text
a -> ProductionBranch
s {$sel:branchName:ProductionBranch' :: Maybe Text
branchName = Maybe Text
a} :: ProductionBranch)

instance Core.FromJSON ProductionBranch where
  parseJSON :: Value -> Parser ProductionBranch
parseJSON =
    String
-> (Object -> Parser ProductionBranch)
-> Value
-> Parser ProductionBranch
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProductionBranch"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text -> Maybe Text -> Maybe Text -> ProductionBranch
ProductionBranch'
            (Maybe POSIX
 -> Maybe Text -> Maybe Text -> Maybe Text -> ProductionBranch)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> ProductionBranch)
forall (f :: * -> *) a b. Functor 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
"lastDeployTime")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> ProductionBranch)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ProductionBranch)
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
"status")
            Parser (Maybe Text -> Maybe Text -> ProductionBranch)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ProductionBranch)
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
"thumbnailUrl")
            Parser (Maybe Text -> ProductionBranch)
-> Parser (Maybe Text) -> Parser ProductionBranch
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
"branchName")
      )

instance Prelude.Hashable ProductionBranch

instance Prelude.NFData ProductionBranch