{-# 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.CreateStage
-- 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 new Stage resource that references a pre-existing Deployment
-- for the API.
module Amazonka.APIGateway.CreateStage
  ( -- * Creating a Request
    CreateStage (..),
    newCreateStage,

    -- * Request Lenses
    createStage_variables,
    createStage_documentationVersion,
    createStage_tracingEnabled,
    createStage_cacheClusterSize,
    createStage_canarySettings,
    createStage_cacheClusterEnabled,
    createStage_description,
    createStage_tags,
    createStage_restApiId,
    createStage_stageName,
    createStage_deploymentId,

    -- * Destructuring the Response
    Stage (..),
    newStage,

    -- * Response Lenses
    stage_deploymentId,
    stage_variables,
    stage_accessLogSettings,
    stage_documentationVersion,
    stage_clientCertificateId,
    stage_tracingEnabled,
    stage_createdDate,
    stage_cacheClusterStatus,
    stage_methodSettings,
    stage_lastUpdatedDate,
    stage_cacheClusterSize,
    stage_webAclArn,
    stage_canarySettings,
    stage_cacheClusterEnabled,
    stage_stageName,
    stage_description,
    stage_tags,
  )
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 Stage resource.
--
-- /See:/ 'newCreateStage' smart constructor.
data CreateStage = CreateStage'
  { -- | A map that defines the stage variables for the new Stage resource.
    -- Variable names can have alphanumeric and underscore characters, and the
    -- values must match @[A-Za-z0-9-._~:\/?#&=,]+@.
    CreateStage -> Maybe (HashMap Text Text)
variables :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The version of the associated API documentation.
    CreateStage -> Maybe Text
documentationVersion :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether active tracing with X-ray is enabled for the Stage.
    CreateStage -> Maybe Bool
tracingEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The stage\'s cache cluster size.
    CreateStage -> Maybe CacheClusterSize
cacheClusterSize :: Prelude.Maybe CacheClusterSize,
    -- | The canary deployment settings of this stage.
    CreateStage -> Maybe CanarySettings
canarySettings :: Prelude.Maybe CanarySettings,
    -- | Whether cache clustering is enabled for the stage.
    CreateStage -> Maybe Bool
cacheClusterEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The description of the Stage resource.
    CreateStage -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The key-value map of strings. The valid character set is
    -- [a-zA-Z+-=._:\/]. The tag key can be up to 128 characters and must not
    -- start with @aws:@. The tag value can be up to 256 characters.
    CreateStage -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | [Required] The string identifier of the associated RestApi.
    CreateStage -> Text
restApiId :: Prelude.Text,
    -- | [Required] The name for the Stage resource. Stage names can only contain
    -- alphanumeric characters, hyphens, and underscores. Maximum length is 128
    -- characters.
    CreateStage -> Text
stageName :: Prelude.Text,
    -- | [Required] The identifier of the Deployment resource for the Stage
    -- resource.
    CreateStage -> Text
deploymentId :: Prelude.Text
  }
  deriving (CreateStage -> CreateStage -> Bool
(CreateStage -> CreateStage -> Bool)
-> (CreateStage -> CreateStage -> Bool) -> Eq CreateStage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStage -> CreateStage -> Bool
$c/= :: CreateStage -> CreateStage -> Bool
== :: CreateStage -> CreateStage -> Bool
$c== :: CreateStage -> CreateStage -> Bool
Prelude.Eq, ReadPrec [CreateStage]
ReadPrec CreateStage
Int -> ReadS CreateStage
ReadS [CreateStage]
(Int -> ReadS CreateStage)
-> ReadS [CreateStage]
-> ReadPrec CreateStage
-> ReadPrec [CreateStage]
-> Read CreateStage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStage]
$creadListPrec :: ReadPrec [CreateStage]
readPrec :: ReadPrec CreateStage
$creadPrec :: ReadPrec CreateStage
readList :: ReadS [CreateStage]
$creadList :: ReadS [CreateStage]
readsPrec :: Int -> ReadS CreateStage
$creadsPrec :: Int -> ReadS CreateStage
Prelude.Read, Int -> CreateStage -> ShowS
[CreateStage] -> ShowS
CreateStage -> String
(Int -> CreateStage -> ShowS)
-> (CreateStage -> String)
-> ([CreateStage] -> ShowS)
-> Show CreateStage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStage] -> ShowS
$cshowList :: [CreateStage] -> ShowS
show :: CreateStage -> String
$cshow :: CreateStage -> String
showsPrec :: Int -> CreateStage -> ShowS
$cshowsPrec :: Int -> CreateStage -> ShowS
Prelude.Show, (forall x. CreateStage -> Rep CreateStage x)
-> (forall x. Rep CreateStage x -> CreateStage)
-> Generic CreateStage
forall x. Rep CreateStage x -> CreateStage
forall x. CreateStage -> Rep CreateStage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateStage x -> CreateStage
$cfrom :: forall x. CreateStage -> Rep CreateStage x
Prelude.Generic)

-- |
-- Create a value of 'CreateStage' 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:
--
-- 'variables', 'createStage_variables' - A map that defines the stage variables for the new Stage resource.
-- Variable names can have alphanumeric and underscore characters, and the
-- values must match @[A-Za-z0-9-._~:\/?#&=,]+@.
--
-- 'documentationVersion', 'createStage_documentationVersion' - The version of the associated API documentation.
--
-- 'tracingEnabled', 'createStage_tracingEnabled' - Specifies whether active tracing with X-ray is enabled for the Stage.
--
-- 'cacheClusterSize', 'createStage_cacheClusterSize' - The stage\'s cache cluster size.
--
-- 'canarySettings', 'createStage_canarySettings' - The canary deployment settings of this stage.
--
-- 'cacheClusterEnabled', 'createStage_cacheClusterEnabled' - Whether cache clustering is enabled for the stage.
--
-- 'description', 'createStage_description' - The description of the Stage resource.
--
-- 'tags', 'createStage_tags' - The key-value map of strings. The valid character set is
-- [a-zA-Z+-=._:\/]. The tag key can be up to 128 characters and must not
-- start with @aws:@. The tag value can be up to 256 characters.
--
-- 'restApiId', 'createStage_restApiId' - [Required] The string identifier of the associated RestApi.
--
-- 'stageName', 'createStage_stageName' - [Required] The name for the Stage resource. Stage names can only contain
-- alphanumeric characters, hyphens, and underscores. Maximum length is 128
-- characters.
--
-- 'deploymentId', 'createStage_deploymentId' - [Required] The identifier of the Deployment resource for the Stage
-- resource.
newCreateStage ::
  -- | 'restApiId'
  Prelude.Text ->
  -- | 'stageName'
  Prelude.Text ->
  -- | 'deploymentId'
  Prelude.Text ->
  CreateStage
newCreateStage :: Text -> Text -> Text -> CreateStage
newCreateStage Text
pRestApiId_ Text
pStageName_ Text
pDeploymentId_ =
  CreateStage' :: Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Bool
-> Maybe CacheClusterSize
-> Maybe CanarySettings
-> Maybe Bool
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> Text
-> CreateStage
CreateStage'
    { $sel:variables:CreateStage' :: Maybe (HashMap Text Text)
variables = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:documentationVersion:CreateStage' :: Maybe Text
documentationVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tracingEnabled:CreateStage' :: Maybe Bool
tracingEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:cacheClusterSize:CreateStage' :: Maybe CacheClusterSize
cacheClusterSize = Maybe CacheClusterSize
forall a. Maybe a
Prelude.Nothing,
      $sel:canarySettings:CreateStage' :: Maybe CanarySettings
canarySettings = Maybe CanarySettings
forall a. Maybe a
Prelude.Nothing,
      $sel:cacheClusterEnabled:CreateStage' :: Maybe Bool
cacheClusterEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateStage' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateStage' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:restApiId:CreateStage' :: Text
restApiId = Text
pRestApiId_,
      $sel:stageName:CreateStage' :: Text
stageName = Text
pStageName_,
      $sel:deploymentId:CreateStage' :: Text
deploymentId = Text
pDeploymentId_
    }

-- | A map that defines the stage variables for the new Stage resource.
-- Variable names can have alphanumeric and underscore characters, and the
-- values must match @[A-Za-z0-9-._~:\/?#&=,]+@.
createStage_variables :: Lens.Lens' CreateStage (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createStage_variables :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateStage -> f CreateStage
createStage_variables = (CreateStage -> Maybe (HashMap Text Text))
-> (CreateStage -> Maybe (HashMap Text Text) -> CreateStage)
-> Lens
     CreateStage
     CreateStage
     (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 (\CreateStage' {Maybe (HashMap Text Text)
variables :: Maybe (HashMap Text Text)
$sel:variables:CreateStage' :: CreateStage -> Maybe (HashMap Text Text)
variables} -> Maybe (HashMap Text Text)
variables) (\s :: CreateStage
s@CreateStage' {} Maybe (HashMap Text Text)
a -> CreateStage
s {$sel:variables:CreateStage' :: Maybe (HashMap Text Text)
variables = Maybe (HashMap Text Text)
a} :: CreateStage) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateStage -> f CreateStage)
-> ((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)))
-> CreateStage
-> f CreateStage
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

-- | The version of the associated API documentation.
createStage_documentationVersion :: Lens.Lens' CreateStage (Prelude.Maybe Prelude.Text)
createStage_documentationVersion :: (Maybe Text -> f (Maybe Text)) -> CreateStage -> f CreateStage
createStage_documentationVersion = (CreateStage -> Maybe Text)
-> (CreateStage -> Maybe Text -> CreateStage)
-> Lens CreateStage CreateStage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStage' {Maybe Text
documentationVersion :: Maybe Text
$sel:documentationVersion:CreateStage' :: CreateStage -> Maybe Text
documentationVersion} -> Maybe Text
documentationVersion) (\s :: CreateStage
s@CreateStage' {} Maybe Text
a -> CreateStage
s {$sel:documentationVersion:CreateStage' :: Maybe Text
documentationVersion = Maybe Text
a} :: CreateStage)

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

-- | The stage\'s cache cluster size.
createStage_cacheClusterSize :: Lens.Lens' CreateStage (Prelude.Maybe CacheClusterSize)
createStage_cacheClusterSize :: (Maybe CacheClusterSize -> f (Maybe CacheClusterSize))
-> CreateStage -> f CreateStage
createStage_cacheClusterSize = (CreateStage -> Maybe CacheClusterSize)
-> (CreateStage -> Maybe CacheClusterSize -> CreateStage)
-> Lens
     CreateStage
     CreateStage
     (Maybe CacheClusterSize)
     (Maybe CacheClusterSize)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStage' {Maybe CacheClusterSize
cacheClusterSize :: Maybe CacheClusterSize
$sel:cacheClusterSize:CreateStage' :: CreateStage -> Maybe CacheClusterSize
cacheClusterSize} -> Maybe CacheClusterSize
cacheClusterSize) (\s :: CreateStage
s@CreateStage' {} Maybe CacheClusterSize
a -> CreateStage
s {$sel:cacheClusterSize:CreateStage' :: Maybe CacheClusterSize
cacheClusterSize = Maybe CacheClusterSize
a} :: CreateStage)

-- | The canary deployment settings of this stage.
createStage_canarySettings :: Lens.Lens' CreateStage (Prelude.Maybe CanarySettings)
createStage_canarySettings :: (Maybe CanarySettings -> f (Maybe CanarySettings))
-> CreateStage -> f CreateStage
createStage_canarySettings = (CreateStage -> Maybe CanarySettings)
-> (CreateStage -> Maybe CanarySettings -> CreateStage)
-> Lens
     CreateStage
     CreateStage
     (Maybe CanarySettings)
     (Maybe CanarySettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStage' {Maybe CanarySettings
canarySettings :: Maybe CanarySettings
$sel:canarySettings:CreateStage' :: CreateStage -> Maybe CanarySettings
canarySettings} -> Maybe CanarySettings
canarySettings) (\s :: CreateStage
s@CreateStage' {} Maybe CanarySettings
a -> CreateStage
s {$sel:canarySettings:CreateStage' :: Maybe CanarySettings
canarySettings = Maybe CanarySettings
a} :: CreateStage)

-- | Whether cache clustering is enabled for the stage.
createStage_cacheClusterEnabled :: Lens.Lens' CreateStage (Prelude.Maybe Prelude.Bool)
createStage_cacheClusterEnabled :: (Maybe Bool -> f (Maybe Bool)) -> CreateStage -> f CreateStage
createStage_cacheClusterEnabled = (CreateStage -> Maybe Bool)
-> (CreateStage -> Maybe Bool -> CreateStage)
-> Lens CreateStage CreateStage (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStage' {Maybe Bool
cacheClusterEnabled :: Maybe Bool
$sel:cacheClusterEnabled:CreateStage' :: CreateStage -> Maybe Bool
cacheClusterEnabled} -> Maybe Bool
cacheClusterEnabled) (\s :: CreateStage
s@CreateStage' {} Maybe Bool
a -> CreateStage
s {$sel:cacheClusterEnabled:CreateStage' :: Maybe Bool
cacheClusterEnabled = Maybe Bool
a} :: CreateStage)

-- | The description of the Stage resource.
createStage_description :: Lens.Lens' CreateStage (Prelude.Maybe Prelude.Text)
createStage_description :: (Maybe Text -> f (Maybe Text)) -> CreateStage -> f CreateStage
createStage_description = (CreateStage -> Maybe Text)
-> (CreateStage -> Maybe Text -> CreateStage)
-> Lens CreateStage CreateStage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStage' {Maybe Text
description :: Maybe Text
$sel:description:CreateStage' :: CreateStage -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateStage
s@CreateStage' {} Maybe Text
a -> CreateStage
s {$sel:description:CreateStage' :: Maybe Text
description = Maybe Text
a} :: CreateStage)

-- | The key-value map of strings. The valid character set is
-- [a-zA-Z+-=._:\/]. The tag key can be up to 128 characters and must not
-- start with @aws:@. The tag value can be up to 256 characters.
createStage_tags :: Lens.Lens' CreateStage (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createStage_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateStage -> f CreateStage
createStage_tags = (CreateStage -> Maybe (HashMap Text Text))
-> (CreateStage -> Maybe (HashMap Text Text) -> CreateStage)
-> Lens
     CreateStage
     CreateStage
     (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 (\CreateStage' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateStage' :: CreateStage -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateStage
s@CreateStage' {} Maybe (HashMap Text Text)
a -> CreateStage
s {$sel:tags:CreateStage' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateStage) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateStage -> f CreateStage)
-> ((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)))
-> CreateStage
-> f CreateStage
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

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

-- | [Required] The name for the Stage resource. Stage names can only contain
-- alphanumeric characters, hyphens, and underscores. Maximum length is 128
-- characters.
createStage_stageName :: Lens.Lens' CreateStage Prelude.Text
createStage_stageName :: (Text -> f Text) -> CreateStage -> f CreateStage
createStage_stageName = (CreateStage -> Text)
-> (CreateStage -> Text -> CreateStage)
-> Lens CreateStage CreateStage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStage' {Text
stageName :: Text
$sel:stageName:CreateStage' :: CreateStage -> Text
stageName} -> Text
stageName) (\s :: CreateStage
s@CreateStage' {} Text
a -> CreateStage
s {$sel:stageName:CreateStage' :: Text
stageName = Text
a} :: CreateStage)

-- | [Required] The identifier of the Deployment resource for the Stage
-- resource.
createStage_deploymentId :: Lens.Lens' CreateStage Prelude.Text
createStage_deploymentId :: (Text -> f Text) -> CreateStage -> f CreateStage
createStage_deploymentId = (CreateStage -> Text)
-> (CreateStage -> Text -> CreateStage)
-> Lens CreateStage CreateStage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStage' {Text
deploymentId :: Text
$sel:deploymentId:CreateStage' :: CreateStage -> Text
deploymentId} -> Text
deploymentId) (\s :: CreateStage
s@CreateStage' {} Text
a -> CreateStage
s {$sel:deploymentId:CreateStage' :: Text
deploymentId = Text
a} :: CreateStage)

instance Core.AWSRequest CreateStage where
  type AWSResponse CreateStage = Stage
  request :: CreateStage -> Request CreateStage
request = Service -> CreateStage -> Request CreateStage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateStage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateStage)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateStage))
-> Logger
-> Service
-> Proxy CreateStage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateStage)))
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 Stage
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)

instance Prelude.Hashable CreateStage

instance Prelude.NFData CreateStage

instance Core.ToHeaders CreateStage where
  toHeaders :: CreateStage -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateStage -> 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 CreateStage where
  toJSON :: CreateStage -> Value
toJSON CreateStage' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Maybe CacheClusterSize
Maybe CanarySettings
Text
deploymentId :: Text
stageName :: Text
restApiId :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
cacheClusterEnabled :: Maybe Bool
canarySettings :: Maybe CanarySettings
cacheClusterSize :: Maybe CacheClusterSize
tracingEnabled :: Maybe Bool
documentationVersion :: Maybe Text
variables :: Maybe (HashMap Text Text)
$sel:deploymentId:CreateStage' :: CreateStage -> Text
$sel:stageName:CreateStage' :: CreateStage -> Text
$sel:restApiId:CreateStage' :: CreateStage -> Text
$sel:tags:CreateStage' :: CreateStage -> Maybe (HashMap Text Text)
$sel:description:CreateStage' :: CreateStage -> Maybe Text
$sel:cacheClusterEnabled:CreateStage' :: CreateStage -> Maybe Bool
$sel:canarySettings:CreateStage' :: CreateStage -> Maybe CanarySettings
$sel:cacheClusterSize:CreateStage' :: CreateStage -> Maybe CacheClusterSize
$sel:tracingEnabled:CreateStage' :: CreateStage -> Maybe Bool
$sel:documentationVersion:CreateStage' :: CreateStage -> Maybe Text
$sel:variables:CreateStage' :: CreateStage -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
"documentationVersion" 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
documentationVersion,
            (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 -> CanarySettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CanarySettings -> Pair) -> Maybe CanarySettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CanarySettings
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
"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,
            (Text
"tags" 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)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"stageName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
stageName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"deploymentId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
deploymentId)
          ]
      )

instance Core.ToPath CreateStage where
  toPath :: CreateStage -> ByteString
toPath CreateStage' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Maybe CacheClusterSize
Maybe CanarySettings
Text
deploymentId :: Text
stageName :: Text
restApiId :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
cacheClusterEnabled :: Maybe Bool
canarySettings :: Maybe CanarySettings
cacheClusterSize :: Maybe CacheClusterSize
tracingEnabled :: Maybe Bool
documentationVersion :: Maybe Text
variables :: Maybe (HashMap Text Text)
$sel:deploymentId:CreateStage' :: CreateStage -> Text
$sel:stageName:CreateStage' :: CreateStage -> Text
$sel:restApiId:CreateStage' :: CreateStage -> Text
$sel:tags:CreateStage' :: CreateStage -> Maybe (HashMap Text Text)
$sel:description:CreateStage' :: CreateStage -> Maybe Text
$sel:cacheClusterEnabled:CreateStage' :: CreateStage -> Maybe Bool
$sel:canarySettings:CreateStage' :: CreateStage -> Maybe CanarySettings
$sel:cacheClusterSize:CreateStage' :: CreateStage -> Maybe CacheClusterSize
$sel:tracingEnabled:CreateStage' :: CreateStage -> Maybe Bool
$sel:documentationVersion:CreateStage' :: CreateStage -> Maybe Text
$sel:variables:CreateStage' :: CreateStage -> Maybe (HashMap Text 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
"/stages"]

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