{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.CreateDeployment
-- 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)
--
-- Creates a Deployment resource, which makes a specified RestApi callable
-- over the internet.
module Amazonka.APIGateway.CreateDeployment
  ( -- * Creating a Request
    CreateDeployment (..),
    newCreateDeployment,

    -- * Request Lenses
    createDeployment_stageDescription,
    createDeployment_variables,
    createDeployment_tracingEnabled,
    createDeployment_cacheClusterSize,
    createDeployment_canarySettings,
    createDeployment_cacheClusterEnabled,
    createDeployment_stageName,
    createDeployment_description,
    createDeployment_restApiId,

    -- * Destructuring the Response
    Deployment (..),
    newDeployment,

    -- * Response Lenses
    deployment_apiSummary,
    deployment_createdDate,
    deployment_id,
    deployment_description,
  )
where

import Amazonka.APIGateway.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Requests API Gateway to create a Deployment resource.
--
-- /See:/ 'newCreateDeployment' smart constructor.
data CreateDeployment = CreateDeployment'
  { -- | The description of the Stage resource for the Deployment resource to
    -- create.
    CreateDeployment -> Maybe Text
stageDescription :: Prelude.Maybe Prelude.Text,
    -- | A map that defines the stage variables for the Stage resource that is
    -- associated with the new deployment. Variable names can have alphanumeric
    -- and underscore characters, and the values must match
    -- @[A-Za-z0-9-._~:\/?#&=,]+@.
    CreateDeployment -> Maybe (HashMap Text Text)
variables :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Specifies whether active tracing with X-ray is enabled for the Stage.
    CreateDeployment -> Maybe Bool
tracingEnabled :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the cache cluster size for the Stage resource specified in the
    -- input, if a cache cluster is enabled.
    CreateDeployment -> Maybe CacheClusterSize
cacheClusterSize :: Prelude.Maybe CacheClusterSize,
    -- | The input configuration for the canary deployment when the deployment is
    -- a canary release deployment.
    CreateDeployment -> Maybe DeploymentCanarySettings
canarySettings :: Prelude.Maybe DeploymentCanarySettings,
    -- | Enables a cache cluster for the Stage resource specified in the input.
    CreateDeployment -> Maybe Bool
cacheClusterEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The name of the Stage resource for the Deployment resource to create.
    CreateDeployment -> Maybe Text
stageName :: Prelude.Maybe Prelude.Text,
    -- | The description for the Deployment resource to create.
    CreateDeployment -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | [Required] The string identifier of the associated RestApi.
    CreateDeployment -> Text
restApiId :: Prelude.Text
  }
  deriving (CreateDeployment -> CreateDeployment -> Bool
(CreateDeployment -> CreateDeployment -> Bool)
-> (CreateDeployment -> CreateDeployment -> Bool)
-> Eq CreateDeployment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDeployment -> CreateDeployment -> Bool
$c/= :: CreateDeployment -> CreateDeployment -> Bool
== :: CreateDeployment -> CreateDeployment -> Bool
$c== :: CreateDeployment -> CreateDeployment -> Bool
Prelude.Eq, ReadPrec [CreateDeployment]
ReadPrec CreateDeployment
Int -> ReadS CreateDeployment
ReadS [CreateDeployment]
(Int -> ReadS CreateDeployment)
-> ReadS [CreateDeployment]
-> ReadPrec CreateDeployment
-> ReadPrec [CreateDeployment]
-> Read CreateDeployment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDeployment]
$creadListPrec :: ReadPrec [CreateDeployment]
readPrec :: ReadPrec CreateDeployment
$creadPrec :: ReadPrec CreateDeployment
readList :: ReadS [CreateDeployment]
$creadList :: ReadS [CreateDeployment]
readsPrec :: Int -> ReadS CreateDeployment
$creadsPrec :: Int -> ReadS CreateDeployment
Prelude.Read, Int -> CreateDeployment -> ShowS
[CreateDeployment] -> ShowS
CreateDeployment -> String
(Int -> CreateDeployment -> ShowS)
-> (CreateDeployment -> String)
-> ([CreateDeployment] -> ShowS)
-> Show CreateDeployment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDeployment] -> ShowS
$cshowList :: [CreateDeployment] -> ShowS
show :: CreateDeployment -> String
$cshow :: CreateDeployment -> String
showsPrec :: Int -> CreateDeployment -> ShowS
$cshowsPrec :: Int -> CreateDeployment -> ShowS
Prelude.Show, (forall x. CreateDeployment -> Rep CreateDeployment x)
-> (forall x. Rep CreateDeployment x -> CreateDeployment)
-> Generic CreateDeployment
forall x. Rep CreateDeployment x -> CreateDeployment
forall x. CreateDeployment -> Rep CreateDeployment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDeployment x -> CreateDeployment
$cfrom :: forall x. CreateDeployment -> Rep CreateDeployment x
Prelude.Generic)

-- |
-- Create a value of 'CreateDeployment' 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:
--
-- 'stageDescription', 'createDeployment_stageDescription' - The description of the Stage resource for the Deployment resource to
-- create.
--
-- 'variables', 'createDeployment_variables' - A map that defines the stage variables for the Stage resource that is
-- associated with the new deployment. Variable names can have alphanumeric
-- and underscore characters, and the values must match
-- @[A-Za-z0-9-._~:\/?#&=,]+@.
--
-- 'tracingEnabled', 'createDeployment_tracingEnabled' - Specifies whether active tracing with X-ray is enabled for the Stage.
--
-- 'cacheClusterSize', 'createDeployment_cacheClusterSize' - Specifies the cache cluster size for the Stage resource specified in the
-- input, if a cache cluster is enabled.
--
-- 'canarySettings', 'createDeployment_canarySettings' - The input configuration for the canary deployment when the deployment is
-- a canary release deployment.
--
-- 'cacheClusterEnabled', 'createDeployment_cacheClusterEnabled' - Enables a cache cluster for the Stage resource specified in the input.
--
-- 'stageName', 'createDeployment_stageName' - The name of the Stage resource for the Deployment resource to create.
--
-- 'description', 'createDeployment_description' - The description for the Deployment resource to create.
--
-- 'restApiId', 'createDeployment_restApiId' - [Required] The string identifier of the associated RestApi.
newCreateDeployment ::
  -- | 'restApiId'
  Prelude.Text ->
  CreateDeployment
newCreateDeployment :: Text -> CreateDeployment
newCreateDeployment Text
pRestApiId_ =
  CreateDeployment' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Bool
-> Maybe CacheClusterSize
-> Maybe DeploymentCanarySettings
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Text
-> CreateDeployment
CreateDeployment'
    { $sel:stageDescription:CreateDeployment' :: Maybe Text
stageDescription =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:variables:CreateDeployment' :: Maybe (HashMap Text Text)
variables = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:tracingEnabled:CreateDeployment' :: Maybe Bool
tracingEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:cacheClusterSize:CreateDeployment' :: Maybe CacheClusterSize
cacheClusterSize = Maybe CacheClusterSize
forall a. Maybe a
Prelude.Nothing,
      $sel:canarySettings:CreateDeployment' :: Maybe DeploymentCanarySettings
canarySettings = Maybe DeploymentCanarySettings
forall a. Maybe a
Prelude.Nothing,
      $sel:cacheClusterEnabled:CreateDeployment' :: Maybe Bool
cacheClusterEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:stageName:CreateDeployment' :: Maybe Text
stageName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateDeployment' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:restApiId:CreateDeployment' :: Text
restApiId = Text
pRestApiId_
    }

-- | The description of the Stage resource for the Deployment resource to
-- create.
createDeployment_stageDescription :: Lens.Lens' CreateDeployment (Prelude.Maybe Prelude.Text)
createDeployment_stageDescription :: (Maybe Text -> f (Maybe Text))
-> CreateDeployment -> f CreateDeployment
createDeployment_stageDescription = (CreateDeployment -> Maybe Text)
-> (CreateDeployment -> Maybe Text -> CreateDeployment)
-> Lens CreateDeployment CreateDeployment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeployment' {Maybe Text
stageDescription :: Maybe Text
$sel:stageDescription:CreateDeployment' :: CreateDeployment -> Maybe Text
stageDescription} -> Maybe Text
stageDescription) (\s :: CreateDeployment
s@CreateDeployment' {} Maybe Text
a -> CreateDeployment
s {$sel:stageDescription:CreateDeployment' :: Maybe Text
stageDescription = Maybe Text
a} :: CreateDeployment)

-- | A map that defines the stage variables for the Stage resource that is
-- associated with the new deployment. Variable names can have alphanumeric
-- and underscore characters, and the values must match
-- @[A-Za-z0-9-._~:\/?#&=,]+@.
createDeployment_variables :: Lens.Lens' CreateDeployment (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createDeployment_variables :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDeployment -> f CreateDeployment
createDeployment_variables = (CreateDeployment -> Maybe (HashMap Text Text))
-> (CreateDeployment
    -> Maybe (HashMap Text Text) -> CreateDeployment)
-> Lens
     CreateDeployment
     CreateDeployment
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeployment' {Maybe (HashMap Text Text)
variables :: Maybe (HashMap Text Text)
$sel:variables:CreateDeployment' :: CreateDeployment -> Maybe (HashMap Text Text)
variables} -> Maybe (HashMap Text Text)
variables) (\s :: CreateDeployment
s@CreateDeployment' {} Maybe (HashMap Text Text)
a -> CreateDeployment
s {$sel:variables:CreateDeployment' :: Maybe (HashMap Text Text)
variables = Maybe (HashMap Text Text)
a} :: CreateDeployment) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateDeployment -> f CreateDeployment)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDeployment
-> f CreateDeployment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies whether active tracing with X-ray is enabled for the Stage.
createDeployment_tracingEnabled :: Lens.Lens' CreateDeployment (Prelude.Maybe Prelude.Bool)
createDeployment_tracingEnabled :: (Maybe Bool -> f (Maybe Bool))
-> CreateDeployment -> f CreateDeployment
createDeployment_tracingEnabled = (CreateDeployment -> Maybe Bool)
-> (CreateDeployment -> Maybe Bool -> CreateDeployment)
-> Lens CreateDeployment CreateDeployment (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeployment' {Maybe Bool
tracingEnabled :: Maybe Bool
$sel:tracingEnabled:CreateDeployment' :: CreateDeployment -> Maybe Bool
tracingEnabled} -> Maybe Bool
tracingEnabled) (\s :: CreateDeployment
s@CreateDeployment' {} Maybe Bool
a -> CreateDeployment
s {$sel:tracingEnabled:CreateDeployment' :: Maybe Bool
tracingEnabled = Maybe Bool
a} :: CreateDeployment)

-- | Specifies the cache cluster size for the Stage resource specified in the
-- input, if a cache cluster is enabled.
createDeployment_cacheClusterSize :: Lens.Lens' CreateDeployment (Prelude.Maybe CacheClusterSize)
createDeployment_cacheClusterSize :: (Maybe CacheClusterSize -> f (Maybe CacheClusterSize))
-> CreateDeployment -> f CreateDeployment
createDeployment_cacheClusterSize = (CreateDeployment -> Maybe CacheClusterSize)
-> (CreateDeployment -> Maybe CacheClusterSize -> CreateDeployment)
-> Lens
     CreateDeployment
     CreateDeployment
     (Maybe CacheClusterSize)
     (Maybe CacheClusterSize)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeployment' {Maybe CacheClusterSize
cacheClusterSize :: Maybe CacheClusterSize
$sel:cacheClusterSize:CreateDeployment' :: CreateDeployment -> Maybe CacheClusterSize
cacheClusterSize} -> Maybe CacheClusterSize
cacheClusterSize) (\s :: CreateDeployment
s@CreateDeployment' {} Maybe CacheClusterSize
a -> CreateDeployment
s {$sel:cacheClusterSize:CreateDeployment' :: Maybe CacheClusterSize
cacheClusterSize = Maybe CacheClusterSize
a} :: CreateDeployment)

-- | The input configuration for the canary deployment when the deployment is
-- a canary release deployment.
createDeployment_canarySettings :: Lens.Lens' CreateDeployment (Prelude.Maybe DeploymentCanarySettings)
createDeployment_canarySettings :: (Maybe DeploymentCanarySettings
 -> f (Maybe DeploymentCanarySettings))
-> CreateDeployment -> f CreateDeployment
createDeployment_canarySettings = (CreateDeployment -> Maybe DeploymentCanarySettings)
-> (CreateDeployment
    -> Maybe DeploymentCanarySettings -> CreateDeployment)
-> Lens
     CreateDeployment
     CreateDeployment
     (Maybe DeploymentCanarySettings)
     (Maybe DeploymentCanarySettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeployment' {Maybe DeploymentCanarySettings
canarySettings :: Maybe DeploymentCanarySettings
$sel:canarySettings:CreateDeployment' :: CreateDeployment -> Maybe DeploymentCanarySettings
canarySettings} -> Maybe DeploymentCanarySettings
canarySettings) (\s :: CreateDeployment
s@CreateDeployment' {} Maybe DeploymentCanarySettings
a -> CreateDeployment
s {$sel:canarySettings:CreateDeployment' :: Maybe DeploymentCanarySettings
canarySettings = Maybe DeploymentCanarySettings
a} :: CreateDeployment)

-- | Enables a cache cluster for the Stage resource specified in the input.
createDeployment_cacheClusterEnabled :: Lens.Lens' CreateDeployment (Prelude.Maybe Prelude.Bool)
createDeployment_cacheClusterEnabled :: (Maybe Bool -> f (Maybe Bool))
-> CreateDeployment -> f CreateDeployment
createDeployment_cacheClusterEnabled = (CreateDeployment -> Maybe Bool)
-> (CreateDeployment -> Maybe Bool -> CreateDeployment)
-> Lens CreateDeployment CreateDeployment (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeployment' {Maybe Bool
cacheClusterEnabled :: Maybe Bool
$sel:cacheClusterEnabled:CreateDeployment' :: CreateDeployment -> Maybe Bool
cacheClusterEnabled} -> Maybe Bool
cacheClusterEnabled) (\s :: CreateDeployment
s@CreateDeployment' {} Maybe Bool
a -> CreateDeployment
s {$sel:cacheClusterEnabled:CreateDeployment' :: Maybe Bool
cacheClusterEnabled = Maybe Bool
a} :: CreateDeployment)

-- | The name of the Stage resource for the Deployment resource to create.
createDeployment_stageName :: Lens.Lens' CreateDeployment (Prelude.Maybe Prelude.Text)
createDeployment_stageName :: (Maybe Text -> f (Maybe Text))
-> CreateDeployment -> f CreateDeployment
createDeployment_stageName = (CreateDeployment -> Maybe Text)
-> (CreateDeployment -> Maybe Text -> CreateDeployment)
-> Lens CreateDeployment CreateDeployment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeployment' {Maybe Text
stageName :: Maybe Text
$sel:stageName:CreateDeployment' :: CreateDeployment -> Maybe Text
stageName} -> Maybe Text
stageName) (\s :: CreateDeployment
s@CreateDeployment' {} Maybe Text
a -> CreateDeployment
s {$sel:stageName:CreateDeployment' :: Maybe Text
stageName = Maybe Text
a} :: CreateDeployment)

-- | The description for the Deployment resource to create.
createDeployment_description :: Lens.Lens' CreateDeployment (Prelude.Maybe Prelude.Text)
createDeployment_description :: (Maybe Text -> f (Maybe Text))
-> CreateDeployment -> f CreateDeployment
createDeployment_description = (CreateDeployment -> Maybe Text)
-> (CreateDeployment -> Maybe Text -> CreateDeployment)
-> Lens CreateDeployment CreateDeployment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeployment' {Maybe Text
description :: Maybe Text
$sel:description:CreateDeployment' :: CreateDeployment -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateDeployment
s@CreateDeployment' {} Maybe Text
a -> CreateDeployment
s {$sel:description:CreateDeployment' :: Maybe Text
description = Maybe Text
a} :: CreateDeployment)

-- | [Required] The string identifier of the associated RestApi.
createDeployment_restApiId :: Lens.Lens' CreateDeployment Prelude.Text
createDeployment_restApiId :: (Text -> f Text) -> CreateDeployment -> f CreateDeployment
createDeployment_restApiId = (CreateDeployment -> Text)
-> (CreateDeployment -> Text -> CreateDeployment)
-> Lens CreateDeployment CreateDeployment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeployment' {Text
restApiId :: Text
$sel:restApiId:CreateDeployment' :: CreateDeployment -> Text
restApiId} -> Text
restApiId) (\s :: CreateDeployment
s@CreateDeployment' {} Text
a -> CreateDeployment
s {$sel:restApiId:CreateDeployment' :: Text
restApiId = Text
a} :: CreateDeployment)

instance Core.AWSRequest CreateDeployment where
  type AWSResponse CreateDeployment = Deployment
  request :: CreateDeployment -> Request CreateDeployment
request = Service -> CreateDeployment -> Request CreateDeployment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateDeployment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDeployment)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateDeployment))
-> Logger
-> Service
-> Proxy CreateDeployment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDeployment)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      (\Int
s ResponseHeaders
h Object
x -> Object -> Either String Deployment
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)

instance Prelude.Hashable CreateDeployment

instance Prelude.NFData CreateDeployment

instance Core.ToHeaders CreateDeployment where
  toHeaders :: CreateDeployment -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateDeployment -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Accept"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"application/json" :: Prelude.ByteString)
          ]
      )

instance Core.ToJSON CreateDeployment where
  toJSON :: CreateDeployment -> Value
toJSON CreateDeployment' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Maybe CacheClusterSize
Maybe DeploymentCanarySettings
Text
restApiId :: Text
description :: Maybe Text
stageName :: Maybe Text
cacheClusterEnabled :: Maybe Bool
canarySettings :: Maybe DeploymentCanarySettings
cacheClusterSize :: Maybe CacheClusterSize
tracingEnabled :: Maybe Bool
variables :: Maybe (HashMap Text Text)
stageDescription :: Maybe Text
$sel:restApiId:CreateDeployment' :: CreateDeployment -> Text
$sel:description:CreateDeployment' :: CreateDeployment -> Maybe Text
$sel:stageName:CreateDeployment' :: CreateDeployment -> Maybe Text
$sel:cacheClusterEnabled:CreateDeployment' :: CreateDeployment -> Maybe Bool
$sel:canarySettings:CreateDeployment' :: CreateDeployment -> Maybe DeploymentCanarySettings
$sel:cacheClusterSize:CreateDeployment' :: CreateDeployment -> Maybe CacheClusterSize
$sel:tracingEnabled:CreateDeployment' :: CreateDeployment -> Maybe Bool
$sel:variables:CreateDeployment' :: CreateDeployment -> Maybe (HashMap Text Text)
$sel:stageDescription:CreateDeployment' :: CreateDeployment -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"stageDescription" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
stageDescription,
            (Text
"variables" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
variables,
            (Text
"tracingEnabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
tracingEnabled,
            (Text
"cacheClusterSize" Text -> CacheClusterSize -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CacheClusterSize -> Pair) -> Maybe CacheClusterSize -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CacheClusterSize
cacheClusterSize,
            (Text
"canarySettings" Text -> DeploymentCanarySettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DeploymentCanarySettings -> Pair)
-> Maybe DeploymentCanarySettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DeploymentCanarySettings
canarySettings,
            (Text
"cacheClusterEnabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
cacheClusterEnabled,
            (Text
"stageName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
stageName,
            (Text
"description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description
          ]
      )

instance Core.ToPath CreateDeployment where
  toPath :: CreateDeployment -> ByteString
toPath CreateDeployment' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Maybe CacheClusterSize
Maybe DeploymentCanarySettings
Text
restApiId :: Text
description :: Maybe Text
stageName :: Maybe Text
cacheClusterEnabled :: Maybe Bool
canarySettings :: Maybe DeploymentCanarySettings
cacheClusterSize :: Maybe CacheClusterSize
tracingEnabled :: Maybe Bool
variables :: Maybe (HashMap Text Text)
stageDescription :: Maybe Text
$sel:restApiId:CreateDeployment' :: CreateDeployment -> Text
$sel:description:CreateDeployment' :: CreateDeployment -> Maybe Text
$sel:stageName:CreateDeployment' :: CreateDeployment -> Maybe Text
$sel:cacheClusterEnabled:CreateDeployment' :: CreateDeployment -> Maybe Bool
$sel:canarySettings:CreateDeployment' :: CreateDeployment -> Maybe DeploymentCanarySettings
$sel:cacheClusterSize:CreateDeployment' :: CreateDeployment -> Maybe CacheClusterSize
$sel:tracingEnabled:CreateDeployment' :: CreateDeployment -> Maybe Bool
$sel:variables:CreateDeployment' :: CreateDeployment -> Maybe (HashMap Text Text)
$sel:stageDescription:CreateDeployment' :: CreateDeployment -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/restapis/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
restApiId, ByteString
"/deployments"]

instance Core.ToQuery CreateDeployment where
  toQuery :: CreateDeployment -> QueryString
toQuery = QueryString -> CreateDeployment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty