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

import Amazonka.APIGateway.Types.MethodSnapshot
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 a RestApi resource that can be called by
-- users using Stages. A deployment must be associated with a Stage for it
-- to be callable over the Internet.
--
-- /See:/ 'newDeployment' smart constructor.
data Deployment = Deployment'
  { -- | A summary of the RestApi at the date and time that the deployment
    -- resource was created.
    Deployment -> Maybe (HashMap Text (HashMap Text MethodSnapshot))
apiSummary :: Prelude.Maybe (Prelude.HashMap Prelude.Text (Prelude.HashMap Prelude.Text MethodSnapshot)),
    -- | The date and time that the deployment resource was created.
    Deployment -> Maybe POSIX
createdDate :: Prelude.Maybe Data.POSIX,
    -- | The description for the deployment resource.
    Deployment -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The identifier for the deployment resource.
    Deployment -> Maybe Text
id :: 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:
--
-- 'apiSummary', 'deployment_apiSummary' - A summary of the RestApi at the date and time that the deployment
-- resource was created.
--
-- 'createdDate', 'deployment_createdDate' - The date and time that the deployment resource was created.
--
-- 'description', 'deployment_description' - The description for the deployment resource.
--
-- 'id', 'deployment_id' - The identifier for the deployment resource.
newDeployment ::
  Deployment
newDeployment :: Deployment
newDeployment =
  Deployment'
    { $sel:apiSummary:Deployment' :: Maybe (HashMap Text (HashMap Text MethodSnapshot))
apiSummary = forall a. Maybe a
Prelude.Nothing,
      $sel:createdDate:Deployment' :: Maybe POSIX
createdDate = forall a. Maybe a
Prelude.Nothing,
      $sel:description:Deployment' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:id:Deployment' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing
    }

-- | A summary of the RestApi at the date and time that the deployment
-- resource was created.
deployment_apiSummary :: Lens.Lens' Deployment (Prelude.Maybe (Prelude.HashMap Prelude.Text (Prelude.HashMap Prelude.Text MethodSnapshot)))
deployment_apiSummary :: Lens'
  Deployment (Maybe (HashMap Text (HashMap Text MethodSnapshot)))
deployment_apiSummary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deployment' {Maybe (HashMap Text (HashMap Text MethodSnapshot))
apiSummary :: Maybe (HashMap Text (HashMap Text MethodSnapshot))
$sel:apiSummary:Deployment' :: Deployment -> Maybe (HashMap Text (HashMap Text MethodSnapshot))
apiSummary} -> Maybe (HashMap Text (HashMap Text MethodSnapshot))
apiSummary) (\s :: Deployment
s@Deployment' {} Maybe (HashMap Text (HashMap Text MethodSnapshot))
a -> Deployment
s {$sel:apiSummary:Deployment' :: Maybe (HashMap Text (HashMap Text MethodSnapshot))
apiSummary = Maybe (HashMap Text (HashMap Text MethodSnapshot))
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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The date and time that 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 POSIX
createdDate :: Maybe POSIX
$sel:createdDate:Deployment' :: Deployment -> Maybe POSIX
createdDate} -> Maybe POSIX
createdDate) (\s :: Deployment
s@Deployment' {} Maybe POSIX
a -> Deployment
s {$sel:createdDate:Deployment' :: Maybe POSIX
createdDate = Maybe POSIX
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 description for the deployment resource.
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)

-- | The identifier for the deployment resource.
deployment_id :: Lens.Lens' Deployment (Prelude.Maybe Prelude.Text)
deployment_id :: Lens' Deployment (Maybe Text)
deployment_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deployment' {Maybe Text
id :: Maybe Text
$sel:id:Deployment' :: Deployment -> Maybe Text
id} -> Maybe Text
id) (\s :: Deployment
s@Deployment' {} Maybe Text
a -> Deployment
s {$sel:id:Deployment' :: Maybe Text
id = 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 (HashMap Text (HashMap Text MethodSnapshot))
-> Maybe POSIX -> 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
"apiSummary" 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
"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
"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
"id")
      )

instance Prelude.Hashable Deployment where
  hashWithSalt :: Int -> Deployment -> Int
hashWithSalt Int
_salt Deployment' {Maybe Text
Maybe (HashMap Text (HashMap Text MethodSnapshot))
Maybe POSIX
id :: Maybe Text
description :: Maybe Text
createdDate :: Maybe POSIX
apiSummary :: Maybe (HashMap Text (HashMap Text MethodSnapshot))
$sel:id:Deployment' :: Deployment -> Maybe Text
$sel:description:Deployment' :: Deployment -> Maybe Text
$sel:createdDate:Deployment' :: Deployment -> Maybe POSIX
$sel:apiSummary:Deployment' :: Deployment -> Maybe (HashMap Text (HashMap Text MethodSnapshot))
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text (HashMap Text MethodSnapshot))
apiSummary
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id

instance Prelude.NFData Deployment where
  rnf :: Deployment -> ()
rnf Deployment' {Maybe Text
Maybe (HashMap Text (HashMap Text MethodSnapshot))
Maybe POSIX
id :: Maybe Text
description :: Maybe Text
createdDate :: Maybe POSIX
apiSummary :: Maybe (HashMap Text (HashMap Text MethodSnapshot))
$sel:id:Deployment' :: Deployment -> Maybe Text
$sel:description:Deployment' :: Deployment -> Maybe Text
$sel:createdDate:Deployment' :: Deployment -> Maybe POSIX
$sel:apiSummary:Deployment' :: Deployment -> Maybe (HashMap Text (HashMap Text MethodSnapshot))
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text (HashMap Text MethodSnapshot))
apiSummary
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdDate
      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 Text
id