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

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

-- | Describes the backend environment for an Amplify app.
--
-- /See:/ 'newBackendEnvironment' smart constructor.
data BackendEnvironment = BackendEnvironment'
  { -- | The name of deployment artifacts.
    BackendEnvironment -> Maybe Text
deploymentArtifacts :: Prelude.Maybe Prelude.Text,
    -- | The AWS CloudFormation stack name of a backend environment.
    BackendEnvironment -> Maybe Text
stackName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) for a backend environment that is part of
    -- an Amplify app.
    BackendEnvironment -> Text
backendEnvironmentArn :: Prelude.Text,
    -- | The name for a backend environment that is part of an Amplify app.
    BackendEnvironment -> Text
environmentName :: Prelude.Text,
    -- | The creation date and time for a backend environment that is part of an
    -- Amplify app.
    BackendEnvironment -> POSIX
createTime :: Core.POSIX,
    -- | The last updated date and time for a backend environment that is part of
    -- an Amplify app.
    BackendEnvironment -> POSIX
updateTime :: Core.POSIX
  }
  deriving (BackendEnvironment -> BackendEnvironment -> Bool
(BackendEnvironment -> BackendEnvironment -> Bool)
-> (BackendEnvironment -> BackendEnvironment -> Bool)
-> Eq BackendEnvironment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BackendEnvironment -> BackendEnvironment -> Bool
$c/= :: BackendEnvironment -> BackendEnvironment -> Bool
== :: BackendEnvironment -> BackendEnvironment -> Bool
$c== :: BackendEnvironment -> BackendEnvironment -> Bool
Prelude.Eq, ReadPrec [BackendEnvironment]
ReadPrec BackendEnvironment
Int -> ReadS BackendEnvironment
ReadS [BackendEnvironment]
(Int -> ReadS BackendEnvironment)
-> ReadS [BackendEnvironment]
-> ReadPrec BackendEnvironment
-> ReadPrec [BackendEnvironment]
-> Read BackendEnvironment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BackendEnvironment]
$creadListPrec :: ReadPrec [BackendEnvironment]
readPrec :: ReadPrec BackendEnvironment
$creadPrec :: ReadPrec BackendEnvironment
readList :: ReadS [BackendEnvironment]
$creadList :: ReadS [BackendEnvironment]
readsPrec :: Int -> ReadS BackendEnvironment
$creadsPrec :: Int -> ReadS BackendEnvironment
Prelude.Read, Int -> BackendEnvironment -> ShowS
[BackendEnvironment] -> ShowS
BackendEnvironment -> String
(Int -> BackendEnvironment -> ShowS)
-> (BackendEnvironment -> String)
-> ([BackendEnvironment] -> ShowS)
-> Show BackendEnvironment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BackendEnvironment] -> ShowS
$cshowList :: [BackendEnvironment] -> ShowS
show :: BackendEnvironment -> String
$cshow :: BackendEnvironment -> String
showsPrec :: Int -> BackendEnvironment -> ShowS
$cshowsPrec :: Int -> BackendEnvironment -> ShowS
Prelude.Show, (forall x. BackendEnvironment -> Rep BackendEnvironment x)
-> (forall x. Rep BackendEnvironment x -> BackendEnvironment)
-> Generic BackendEnvironment
forall x. Rep BackendEnvironment x -> BackendEnvironment
forall x. BackendEnvironment -> Rep BackendEnvironment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BackendEnvironment x -> BackendEnvironment
$cfrom :: forall x. BackendEnvironment -> Rep BackendEnvironment x
Prelude.Generic)

-- |
-- Create a value of 'BackendEnvironment' 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:
--
-- 'deploymentArtifacts', 'backendEnvironment_deploymentArtifacts' - The name of deployment artifacts.
--
-- 'stackName', 'backendEnvironment_stackName' - The AWS CloudFormation stack name of a backend environment.
--
-- 'backendEnvironmentArn', 'backendEnvironment_backendEnvironmentArn' - The Amazon Resource Name (ARN) for a backend environment that is part of
-- an Amplify app.
--
-- 'environmentName', 'backendEnvironment_environmentName' - The name for a backend environment that is part of an Amplify app.
--
-- 'createTime', 'backendEnvironment_createTime' - The creation date and time for a backend environment that is part of an
-- Amplify app.
--
-- 'updateTime', 'backendEnvironment_updateTime' - The last updated date and time for a backend environment that is part of
-- an Amplify app.
newBackendEnvironment ::
  -- | 'backendEnvironmentArn'
  Prelude.Text ->
  -- | 'environmentName'
  Prelude.Text ->
  -- | 'createTime'
  Prelude.UTCTime ->
  -- | 'updateTime'
  Prelude.UTCTime ->
  BackendEnvironment
newBackendEnvironment :: Text -> Text -> UTCTime -> UTCTime -> BackendEnvironment
newBackendEnvironment
  Text
pBackendEnvironmentArn_
  Text
pEnvironmentName_
  UTCTime
pCreateTime_
  UTCTime
pUpdateTime_ =
    BackendEnvironment' :: Maybe Text
-> Maybe Text
-> Text
-> Text
-> POSIX
-> POSIX
-> BackendEnvironment
BackendEnvironment'
      { $sel:deploymentArtifacts:BackendEnvironment' :: Maybe Text
deploymentArtifacts =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:stackName:BackendEnvironment' :: Maybe Text
stackName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:backendEnvironmentArn:BackendEnvironment' :: Text
backendEnvironmentArn = Text
pBackendEnvironmentArn_,
        $sel:environmentName:BackendEnvironment' :: Text
environmentName = Text
pEnvironmentName_,
        $sel:createTime:BackendEnvironment' :: POSIX
createTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreateTime_,
        $sel:updateTime:BackendEnvironment' :: POSIX
updateTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pUpdateTime_
      }

-- | The name of deployment artifacts.
backendEnvironment_deploymentArtifacts :: Lens.Lens' BackendEnvironment (Prelude.Maybe Prelude.Text)
backendEnvironment_deploymentArtifacts :: (Maybe Text -> f (Maybe Text))
-> BackendEnvironment -> f BackendEnvironment
backendEnvironment_deploymentArtifacts = (BackendEnvironment -> Maybe Text)
-> (BackendEnvironment -> Maybe Text -> BackendEnvironment)
-> Lens
     BackendEnvironment BackendEnvironment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendEnvironment' {Maybe Text
deploymentArtifacts :: Maybe Text
$sel:deploymentArtifacts:BackendEnvironment' :: BackendEnvironment -> Maybe Text
deploymentArtifacts} -> Maybe Text
deploymentArtifacts) (\s :: BackendEnvironment
s@BackendEnvironment' {} Maybe Text
a -> BackendEnvironment
s {$sel:deploymentArtifacts:BackendEnvironment' :: Maybe Text
deploymentArtifacts = Maybe Text
a} :: BackendEnvironment)

-- | The AWS CloudFormation stack name of a backend environment.
backendEnvironment_stackName :: Lens.Lens' BackendEnvironment (Prelude.Maybe Prelude.Text)
backendEnvironment_stackName :: (Maybe Text -> f (Maybe Text))
-> BackendEnvironment -> f BackendEnvironment
backendEnvironment_stackName = (BackendEnvironment -> Maybe Text)
-> (BackendEnvironment -> Maybe Text -> BackendEnvironment)
-> Lens
     BackendEnvironment BackendEnvironment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendEnvironment' {Maybe Text
stackName :: Maybe Text
$sel:stackName:BackendEnvironment' :: BackendEnvironment -> Maybe Text
stackName} -> Maybe Text
stackName) (\s :: BackendEnvironment
s@BackendEnvironment' {} Maybe Text
a -> BackendEnvironment
s {$sel:stackName:BackendEnvironment' :: Maybe Text
stackName = Maybe Text
a} :: BackendEnvironment)

-- | The Amazon Resource Name (ARN) for a backend environment that is part of
-- an Amplify app.
backendEnvironment_backendEnvironmentArn :: Lens.Lens' BackendEnvironment Prelude.Text
backendEnvironment_backendEnvironmentArn :: (Text -> f Text) -> BackendEnvironment -> f BackendEnvironment
backendEnvironment_backendEnvironmentArn = (BackendEnvironment -> Text)
-> (BackendEnvironment -> Text -> BackendEnvironment)
-> Lens BackendEnvironment BackendEnvironment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendEnvironment' {Text
backendEnvironmentArn :: Text
$sel:backendEnvironmentArn:BackendEnvironment' :: BackendEnvironment -> Text
backendEnvironmentArn} -> Text
backendEnvironmentArn) (\s :: BackendEnvironment
s@BackendEnvironment' {} Text
a -> BackendEnvironment
s {$sel:backendEnvironmentArn:BackendEnvironment' :: Text
backendEnvironmentArn = Text
a} :: BackendEnvironment)

-- | The name for a backend environment that is part of an Amplify app.
backendEnvironment_environmentName :: Lens.Lens' BackendEnvironment Prelude.Text
backendEnvironment_environmentName :: (Text -> f Text) -> BackendEnvironment -> f BackendEnvironment
backendEnvironment_environmentName = (BackendEnvironment -> Text)
-> (BackendEnvironment -> Text -> BackendEnvironment)
-> Lens BackendEnvironment BackendEnvironment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendEnvironment' {Text
environmentName :: Text
$sel:environmentName:BackendEnvironment' :: BackendEnvironment -> Text
environmentName} -> Text
environmentName) (\s :: BackendEnvironment
s@BackendEnvironment' {} Text
a -> BackendEnvironment
s {$sel:environmentName:BackendEnvironment' :: Text
environmentName = Text
a} :: BackendEnvironment)

-- | The creation date and time for a backend environment that is part of an
-- Amplify app.
backendEnvironment_createTime :: Lens.Lens' BackendEnvironment Prelude.UTCTime
backendEnvironment_createTime :: (UTCTime -> f UTCTime)
-> BackendEnvironment -> f BackendEnvironment
backendEnvironment_createTime = (BackendEnvironment -> POSIX)
-> (BackendEnvironment -> POSIX -> BackendEnvironment)
-> Lens BackendEnvironment BackendEnvironment POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendEnvironment' {POSIX
createTime :: POSIX
$sel:createTime:BackendEnvironment' :: BackendEnvironment -> POSIX
createTime} -> POSIX
createTime) (\s :: BackendEnvironment
s@BackendEnvironment' {} POSIX
a -> BackendEnvironment
s {$sel:createTime:BackendEnvironment' :: POSIX
createTime = POSIX
a} :: BackendEnvironment) ((POSIX -> f POSIX) -> BackendEnvironment -> f BackendEnvironment)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> BackendEnvironment
-> f BackendEnvironment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The last updated date and time for a backend environment that is part of
-- an Amplify app.
backendEnvironment_updateTime :: Lens.Lens' BackendEnvironment Prelude.UTCTime
backendEnvironment_updateTime :: (UTCTime -> f UTCTime)
-> BackendEnvironment -> f BackendEnvironment
backendEnvironment_updateTime = (BackendEnvironment -> POSIX)
-> (BackendEnvironment -> POSIX -> BackendEnvironment)
-> Lens BackendEnvironment BackendEnvironment POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendEnvironment' {POSIX
updateTime :: POSIX
$sel:updateTime:BackendEnvironment' :: BackendEnvironment -> POSIX
updateTime} -> POSIX
updateTime) (\s :: BackendEnvironment
s@BackendEnvironment' {} POSIX
a -> BackendEnvironment
s {$sel:updateTime:BackendEnvironment' :: POSIX
updateTime = POSIX
a} :: BackendEnvironment) ((POSIX -> f POSIX) -> BackendEnvironment -> f BackendEnvironment)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> BackendEnvironment
-> f BackendEnvironment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON BackendEnvironment where
  parseJSON :: Value -> Parser BackendEnvironment
parseJSON =
    String
-> (Object -> Parser BackendEnvironment)
-> Value
-> Parser BackendEnvironment
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BackendEnvironment"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Text
-> Text
-> POSIX
-> POSIX
-> BackendEnvironment
BackendEnvironment'
            (Maybe Text
 -> Maybe Text
 -> Text
 -> Text
 -> POSIX
 -> POSIX
 -> BackendEnvironment)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Text -> Text -> POSIX -> POSIX -> BackendEnvironment)
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
"deploymentArtifacts")
            Parser
  (Maybe Text
   -> Text -> Text -> POSIX -> POSIX -> BackendEnvironment)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> POSIX -> POSIX -> BackendEnvironment)
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
"stackName")
            Parser (Text -> Text -> POSIX -> POSIX -> BackendEnvironment)
-> Parser Text
-> Parser (Text -> POSIX -> POSIX -> BackendEnvironment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"backendEnvironmentArn")
            Parser (Text -> POSIX -> POSIX -> BackendEnvironment)
-> Parser Text -> Parser (POSIX -> POSIX -> BackendEnvironment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"environmentName")
            Parser (POSIX -> POSIX -> BackendEnvironment)
-> Parser POSIX -> Parser (POSIX -> BackendEnvironment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"createTime")
            Parser (POSIX -> BackendEnvironment)
-> Parser POSIX -> Parser BackendEnvironment
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"updateTime")
      )

instance Prelude.Hashable BackendEnvironment

instance Prelude.NFData BackendEnvironment