{-# 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.MigrationHubReFactorSpaces.Types.ApiGatewayProxyInput
-- 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.MigrationHubReFactorSpaces.Types.ApiGatewayProxyInput where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MigrationHubReFactorSpaces.Types.ApiGatewayEndpointType
import qualified Amazonka.Prelude as Prelude

-- | A wrapper object holding the Amazon API Gateway endpoint input.
--
-- /See:/ 'newApiGatewayProxyInput' smart constructor.
data ApiGatewayProxyInput = ApiGatewayProxyInput'
  { -- | The type of endpoint to use for the API Gateway proxy. If no value is
    -- specified in the request, the value is set to @REGIONAL@ by default.
    --
    -- If the value is set to @PRIVATE@ in the request, this creates a private
    -- API endpoint that is isolated from the public internet. The private
    -- endpoint can only be accessed by using Amazon Virtual Private Cloud
    -- (Amazon VPC) endpoints for Amazon API Gateway that have been granted
    -- access.
    ApiGatewayProxyInput -> Maybe ApiGatewayEndpointType
endpointType :: Prelude.Maybe ApiGatewayEndpointType,
    -- | The name of the API Gateway stage. The name defaults to @prod@.
    ApiGatewayProxyInput -> Maybe Text
stageName :: Prelude.Maybe Prelude.Text
  }
  deriving (ApiGatewayProxyInput -> ApiGatewayProxyInput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApiGatewayProxyInput -> ApiGatewayProxyInput -> Bool
$c/= :: ApiGatewayProxyInput -> ApiGatewayProxyInput -> Bool
== :: ApiGatewayProxyInput -> ApiGatewayProxyInput -> Bool
$c== :: ApiGatewayProxyInput -> ApiGatewayProxyInput -> Bool
Prelude.Eq, ReadPrec [ApiGatewayProxyInput]
ReadPrec ApiGatewayProxyInput
Int -> ReadS ApiGatewayProxyInput
ReadS [ApiGatewayProxyInput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApiGatewayProxyInput]
$creadListPrec :: ReadPrec [ApiGatewayProxyInput]
readPrec :: ReadPrec ApiGatewayProxyInput
$creadPrec :: ReadPrec ApiGatewayProxyInput
readList :: ReadS [ApiGatewayProxyInput]
$creadList :: ReadS [ApiGatewayProxyInput]
readsPrec :: Int -> ReadS ApiGatewayProxyInput
$creadsPrec :: Int -> ReadS ApiGatewayProxyInput
Prelude.Read, Int -> ApiGatewayProxyInput -> ShowS
[ApiGatewayProxyInput] -> ShowS
ApiGatewayProxyInput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApiGatewayProxyInput] -> ShowS
$cshowList :: [ApiGatewayProxyInput] -> ShowS
show :: ApiGatewayProxyInput -> String
$cshow :: ApiGatewayProxyInput -> String
showsPrec :: Int -> ApiGatewayProxyInput -> ShowS
$cshowsPrec :: Int -> ApiGatewayProxyInput -> ShowS
Prelude.Show, forall x. Rep ApiGatewayProxyInput x -> ApiGatewayProxyInput
forall x. ApiGatewayProxyInput -> Rep ApiGatewayProxyInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApiGatewayProxyInput x -> ApiGatewayProxyInput
$cfrom :: forall x. ApiGatewayProxyInput -> Rep ApiGatewayProxyInput x
Prelude.Generic)

-- |
-- Create a value of 'ApiGatewayProxyInput' 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:
--
-- 'endpointType', 'apiGatewayProxyInput_endpointType' - The type of endpoint to use for the API Gateway proxy. If no value is
-- specified in the request, the value is set to @REGIONAL@ by default.
--
-- If the value is set to @PRIVATE@ in the request, this creates a private
-- API endpoint that is isolated from the public internet. The private
-- endpoint can only be accessed by using Amazon Virtual Private Cloud
-- (Amazon VPC) endpoints for Amazon API Gateway that have been granted
-- access.
--
-- 'stageName', 'apiGatewayProxyInput_stageName' - The name of the API Gateway stage. The name defaults to @prod@.
newApiGatewayProxyInput ::
  ApiGatewayProxyInput
newApiGatewayProxyInput :: ApiGatewayProxyInput
newApiGatewayProxyInput =
  ApiGatewayProxyInput'
    { $sel:endpointType:ApiGatewayProxyInput' :: Maybe ApiGatewayEndpointType
endpointType =
        forall a. Maybe a
Prelude.Nothing,
      $sel:stageName:ApiGatewayProxyInput' :: Maybe Text
stageName = forall a. Maybe a
Prelude.Nothing
    }

-- | The type of endpoint to use for the API Gateway proxy. If no value is
-- specified in the request, the value is set to @REGIONAL@ by default.
--
-- If the value is set to @PRIVATE@ in the request, this creates a private
-- API endpoint that is isolated from the public internet. The private
-- endpoint can only be accessed by using Amazon Virtual Private Cloud
-- (Amazon VPC) endpoints for Amazon API Gateway that have been granted
-- access.
apiGatewayProxyInput_endpointType :: Lens.Lens' ApiGatewayProxyInput (Prelude.Maybe ApiGatewayEndpointType)
apiGatewayProxyInput_endpointType :: Lens' ApiGatewayProxyInput (Maybe ApiGatewayEndpointType)
apiGatewayProxyInput_endpointType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApiGatewayProxyInput' {Maybe ApiGatewayEndpointType
endpointType :: Maybe ApiGatewayEndpointType
$sel:endpointType:ApiGatewayProxyInput' :: ApiGatewayProxyInput -> Maybe ApiGatewayEndpointType
endpointType} -> Maybe ApiGatewayEndpointType
endpointType) (\s :: ApiGatewayProxyInput
s@ApiGatewayProxyInput' {} Maybe ApiGatewayEndpointType
a -> ApiGatewayProxyInput
s {$sel:endpointType:ApiGatewayProxyInput' :: Maybe ApiGatewayEndpointType
endpointType = Maybe ApiGatewayEndpointType
a} :: ApiGatewayProxyInput)

-- | The name of the API Gateway stage. The name defaults to @prod@.
apiGatewayProxyInput_stageName :: Lens.Lens' ApiGatewayProxyInput (Prelude.Maybe Prelude.Text)
apiGatewayProxyInput_stageName :: Lens' ApiGatewayProxyInput (Maybe Text)
apiGatewayProxyInput_stageName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApiGatewayProxyInput' {Maybe Text
stageName :: Maybe Text
$sel:stageName:ApiGatewayProxyInput' :: ApiGatewayProxyInput -> Maybe Text
stageName} -> Maybe Text
stageName) (\s :: ApiGatewayProxyInput
s@ApiGatewayProxyInput' {} Maybe Text
a -> ApiGatewayProxyInput
s {$sel:stageName:ApiGatewayProxyInput' :: Maybe Text
stageName = Maybe Text
a} :: ApiGatewayProxyInput)

instance Data.FromJSON ApiGatewayProxyInput where
  parseJSON :: Value -> Parser ApiGatewayProxyInput
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ApiGatewayProxyInput"
      ( \Object
x ->
          Maybe ApiGatewayEndpointType -> Maybe Text -> ApiGatewayProxyInput
ApiGatewayProxyInput'
            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
"EndpointType")
            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
"StageName")
      )

instance Prelude.Hashable ApiGatewayProxyInput where
  hashWithSalt :: Int -> ApiGatewayProxyInput -> Int
hashWithSalt Int
_salt ApiGatewayProxyInput' {Maybe Text
Maybe ApiGatewayEndpointType
stageName :: Maybe Text
endpointType :: Maybe ApiGatewayEndpointType
$sel:stageName:ApiGatewayProxyInput' :: ApiGatewayProxyInput -> Maybe Text
$sel:endpointType:ApiGatewayProxyInput' :: ApiGatewayProxyInput -> Maybe ApiGatewayEndpointType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ApiGatewayEndpointType
endpointType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stageName

instance Prelude.NFData ApiGatewayProxyInput where
  rnf :: ApiGatewayProxyInput -> ()
rnf ApiGatewayProxyInput' {Maybe Text
Maybe ApiGatewayEndpointType
stageName :: Maybe Text
endpointType :: Maybe ApiGatewayEndpointType
$sel:stageName:ApiGatewayProxyInput' :: ApiGatewayProxyInput -> Maybe Text
$sel:endpointType:ApiGatewayProxyInput' :: ApiGatewayProxyInput -> Maybe ApiGatewayEndpointType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ApiGatewayEndpointType
endpointType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stageName

instance Data.ToJSON ApiGatewayProxyInput where
  toJSON :: ApiGatewayProxyInput -> Value
toJSON ApiGatewayProxyInput' {Maybe Text
Maybe ApiGatewayEndpointType
stageName :: Maybe Text
endpointType :: Maybe ApiGatewayEndpointType
$sel:stageName:ApiGatewayProxyInput' :: ApiGatewayProxyInput -> Maybe Text
$sel:endpointType:ApiGatewayProxyInput' :: ApiGatewayProxyInput -> Maybe ApiGatewayEndpointType
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"EndpointType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ApiGatewayEndpointType
endpointType,
            (Key
"StageName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
stageName
          ]
      )