{-# 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.ApiGatewayV2.Types.Deployment
-- 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.ApiGatewayV2.Types.Deployment where

import Amazonka.ApiGatewayV2.Types.DeploymentStatus
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

-- | An immutable representation of an API that can be called by users. A
-- Deployment must be associated with a Stage for it to be callable over
-- the internet.
--
-- /See:/ 'newDeployment' smart constructor.
data Deployment = Deployment'
  { -- | Specifies whether a deployment was automatically released.
    Deployment -> Maybe Bool
autoDeployed :: Prelude.Maybe Prelude.Bool,
    -- | The date and time when the Deployment resource was created.
    Deployment -> Maybe ISO8601
createdDate :: Prelude.Maybe Data.ISO8601,
    -- | The identifier for the deployment.
    Deployment -> Maybe Text
deploymentId :: Prelude.Maybe Prelude.Text,
    -- | The status of the deployment: PENDING, FAILED, or SUCCEEDED.
    Deployment -> Maybe DeploymentStatus
deploymentStatus :: Prelude.Maybe DeploymentStatus,
    -- | May contain additional feedback on the status of an API deployment.
    Deployment -> Maybe Text
deploymentStatusMessage :: Prelude.Maybe Prelude.Text,
    -- | The description for the deployment.
    Deployment -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (Deployment -> Deployment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Deployment -> Deployment -> Bool
$c/= :: Deployment -> Deployment -> Bool
== :: Deployment -> Deployment -> Bool
$c== :: Deployment -> Deployment -> Bool
Prelude.Eq, ReadPrec [Deployment]
ReadPrec Deployment
Int -> ReadS Deployment
ReadS [Deployment]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Deployment]
$creadListPrec :: ReadPrec [Deployment]
readPrec :: ReadPrec Deployment
$creadPrec :: ReadPrec Deployment
readList :: ReadS [Deployment]
$creadList :: ReadS [Deployment]
readsPrec :: Int -> ReadS Deployment
$creadsPrec :: Int -> ReadS Deployment
Prelude.Read, Int -> Deployment -> ShowS
[Deployment] -> ShowS
Deployment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Deployment] -> ShowS
$cshowList :: [Deployment] -> ShowS
show :: Deployment -> String
$cshow :: Deployment -> String
showsPrec :: Int -> Deployment -> ShowS
$cshowsPrec :: Int -> Deployment -> ShowS
Prelude.Show, forall x. Rep Deployment x -> Deployment
forall x. Deployment -> Rep Deployment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Deployment x -> Deployment
$cfrom :: forall x. Deployment -> Rep Deployment x
Prelude.Generic)

-- |
-- Create a value of 'Deployment' 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:
--
-- 'autoDeployed', 'deployment_autoDeployed' - Specifies whether a deployment was automatically released.
--
-- 'createdDate', 'deployment_createdDate' - The date and time when the Deployment resource was created.
--
-- 'deploymentId', 'deployment_deploymentId' - The identifier for the deployment.
--
-- 'deploymentStatus', 'deployment_deploymentStatus' - The status of the deployment: PENDING, FAILED, or SUCCEEDED.
--
-- 'deploymentStatusMessage', 'deployment_deploymentStatusMessage' - May contain additional feedback on the status of an API deployment.
--
-- 'description', 'deployment_description' - The description for the deployment.
newDeployment ::
  Deployment
newDeployment :: Deployment
newDeployment =
  Deployment'
    { $sel:autoDeployed:Deployment' :: Maybe Bool
autoDeployed = forall a. Maybe a
Prelude.Nothing,
      $sel:createdDate:Deployment' :: Maybe ISO8601
createdDate = forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentId:Deployment' :: Maybe Text
deploymentId = forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentStatus:Deployment' :: Maybe DeploymentStatus
deploymentStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentStatusMessage:Deployment' :: Maybe Text
deploymentStatusMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:description:Deployment' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies whether a deployment was automatically released.
deployment_autoDeployed :: Lens.Lens' Deployment (Prelude.Maybe Prelude.Bool)
deployment_autoDeployed :: Lens' Deployment (Maybe Bool)
deployment_autoDeployed = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deployment' {Maybe Bool
autoDeployed :: Maybe Bool
$sel:autoDeployed:Deployment' :: Deployment -> Maybe Bool
autoDeployed} -> Maybe Bool
autoDeployed) (\s :: Deployment
s@Deployment' {} Maybe Bool
a -> Deployment
s {$sel:autoDeployed:Deployment' :: Maybe Bool
autoDeployed = Maybe Bool
a} :: Deployment)

-- | The date and time when the Deployment resource was created.
deployment_createdDate :: Lens.Lens' Deployment (Prelude.Maybe Prelude.UTCTime)
deployment_createdDate :: Lens' Deployment (Maybe UTCTime)
deployment_createdDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deployment' {Maybe ISO8601
createdDate :: Maybe ISO8601
$sel:createdDate:Deployment' :: Deployment -> Maybe ISO8601
createdDate} -> Maybe ISO8601
createdDate) (\s :: Deployment
s@Deployment' {} Maybe ISO8601
a -> Deployment
s {$sel:createdDate:Deployment' :: Maybe ISO8601
createdDate = Maybe ISO8601
a} :: Deployment) 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

-- | The identifier for the deployment.
deployment_deploymentId :: Lens.Lens' Deployment (Prelude.Maybe Prelude.Text)
deployment_deploymentId :: Lens' Deployment (Maybe Text)
deployment_deploymentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deployment' {Maybe Text
deploymentId :: Maybe Text
$sel:deploymentId:Deployment' :: Deployment -> Maybe Text
deploymentId} -> Maybe Text
deploymentId) (\s :: Deployment
s@Deployment' {} Maybe Text
a -> Deployment
s {$sel:deploymentId:Deployment' :: Maybe Text
deploymentId = Maybe Text
a} :: Deployment)

-- | The status of the deployment: PENDING, FAILED, or SUCCEEDED.
deployment_deploymentStatus :: Lens.Lens' Deployment (Prelude.Maybe DeploymentStatus)
deployment_deploymentStatus :: Lens' Deployment (Maybe DeploymentStatus)
deployment_deploymentStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deployment' {Maybe DeploymentStatus
deploymentStatus :: Maybe DeploymentStatus
$sel:deploymentStatus:Deployment' :: Deployment -> Maybe DeploymentStatus
deploymentStatus} -> Maybe DeploymentStatus
deploymentStatus) (\s :: Deployment
s@Deployment' {} Maybe DeploymentStatus
a -> Deployment
s {$sel:deploymentStatus:Deployment' :: Maybe DeploymentStatus
deploymentStatus = Maybe DeploymentStatus
a} :: Deployment)

-- | May contain additional feedback on the status of an API deployment.
deployment_deploymentStatusMessage :: Lens.Lens' Deployment (Prelude.Maybe Prelude.Text)
deployment_deploymentStatusMessage :: Lens' Deployment (Maybe Text)
deployment_deploymentStatusMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deployment' {Maybe Text
deploymentStatusMessage :: Maybe Text
$sel:deploymentStatusMessage:Deployment' :: Deployment -> Maybe Text
deploymentStatusMessage} -> Maybe Text
deploymentStatusMessage) (\s :: Deployment
s@Deployment' {} Maybe Text
a -> Deployment
s {$sel:deploymentStatusMessage:Deployment' :: Maybe Text
deploymentStatusMessage = Maybe Text
a} :: Deployment)

-- | The description for the deployment.
deployment_description :: Lens.Lens' Deployment (Prelude.Maybe Prelude.Text)
deployment_description :: Lens' Deployment (Maybe Text)
deployment_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deployment' {Maybe Text
description :: Maybe Text
$sel:description:Deployment' :: Deployment -> Maybe Text
description} -> Maybe Text
description) (\s :: Deployment
s@Deployment' {} Maybe Text
a -> Deployment
s {$sel:description:Deployment' :: Maybe Text
description = Maybe Text
a} :: Deployment)

instance Data.FromJSON Deployment where
  parseJSON :: Value -> Parser Deployment
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Deployment"
      ( \Object
x ->
          Maybe Bool
-> Maybe ISO8601
-> Maybe Text
-> Maybe DeploymentStatus
-> Maybe Text
-> Maybe Text
-> Deployment
Deployment'
            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
"autoDeployed")
            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
"createdDate")
            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
"deploymentId")
            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
"deploymentStatus")
            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
"deploymentStatusMessage")
            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")
      )

instance Prelude.Hashable Deployment where
  hashWithSalt :: Int -> Deployment -> Int
hashWithSalt Int
_salt Deployment' {Maybe Bool
Maybe Text
Maybe ISO8601
Maybe DeploymentStatus
description :: Maybe Text
deploymentStatusMessage :: Maybe Text
deploymentStatus :: Maybe DeploymentStatus
deploymentId :: Maybe Text
createdDate :: Maybe ISO8601
autoDeployed :: Maybe Bool
$sel:description:Deployment' :: Deployment -> Maybe Text
$sel:deploymentStatusMessage:Deployment' :: Deployment -> Maybe Text
$sel:deploymentStatus:Deployment' :: Deployment -> Maybe DeploymentStatus
$sel:deploymentId:Deployment' :: Deployment -> Maybe Text
$sel:createdDate:Deployment' :: Deployment -> Maybe ISO8601
$sel:autoDeployed:Deployment' :: Deployment -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
autoDeployed
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
createdDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deploymentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DeploymentStatus
deploymentStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deploymentStatusMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description

instance Prelude.NFData Deployment where
  rnf :: Deployment -> ()
rnf Deployment' {Maybe Bool
Maybe Text
Maybe ISO8601
Maybe DeploymentStatus
description :: Maybe Text
deploymentStatusMessage :: Maybe Text
deploymentStatus :: Maybe DeploymentStatus
deploymentId :: Maybe Text
createdDate :: Maybe ISO8601
autoDeployed :: Maybe Bool
$sel:description:Deployment' :: Deployment -> Maybe Text
$sel:deploymentStatusMessage:Deployment' :: Deployment -> Maybe Text
$sel:deploymentStatus:Deployment' :: Deployment -> Maybe DeploymentStatus
$sel:deploymentId:Deployment' :: Deployment -> Maybe Text
$sel:createdDate:Deployment' :: Deployment -> Maybe ISO8601
$sel:autoDeployed:Deployment' :: Deployment -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
autoDeployed
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
createdDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deploymentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DeploymentStatus
deploymentStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deploymentStatusMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description