{-# 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.TlsConfigInput
-- 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)
module Amazonka.ApiGatewayV2.Types.TlsConfigInput where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The TLS configuration for a private integration. If you specify a TLS
-- configuration, private integration traffic uses the HTTPS protocol.
-- Supported only for HTTP APIs.
--
-- /See:/ 'newTlsConfigInput' smart constructor.
data TlsConfigInput = TlsConfigInput'
  { -- | If you specify a server name, API Gateway uses it to verify the hostname
    -- on the integration\'s certificate. The server name is also included in
    -- the TLS handshake to support Server Name Indication (SNI) or virtual
    -- hosting.
    TlsConfigInput -> Maybe Text
serverNameToVerify :: Prelude.Maybe Prelude.Text
  }
  deriving (TlsConfigInput -> TlsConfigInput -> Bool
(TlsConfigInput -> TlsConfigInput -> Bool)
-> (TlsConfigInput -> TlsConfigInput -> Bool) -> Eq TlsConfigInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TlsConfigInput -> TlsConfigInput -> Bool
$c/= :: TlsConfigInput -> TlsConfigInput -> Bool
== :: TlsConfigInput -> TlsConfigInput -> Bool
$c== :: TlsConfigInput -> TlsConfigInput -> Bool
Prelude.Eq, ReadPrec [TlsConfigInput]
ReadPrec TlsConfigInput
Int -> ReadS TlsConfigInput
ReadS [TlsConfigInput]
(Int -> ReadS TlsConfigInput)
-> ReadS [TlsConfigInput]
-> ReadPrec TlsConfigInput
-> ReadPrec [TlsConfigInput]
-> Read TlsConfigInput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TlsConfigInput]
$creadListPrec :: ReadPrec [TlsConfigInput]
readPrec :: ReadPrec TlsConfigInput
$creadPrec :: ReadPrec TlsConfigInput
readList :: ReadS [TlsConfigInput]
$creadList :: ReadS [TlsConfigInput]
readsPrec :: Int -> ReadS TlsConfigInput
$creadsPrec :: Int -> ReadS TlsConfigInput
Prelude.Read, Int -> TlsConfigInput -> ShowS
[TlsConfigInput] -> ShowS
TlsConfigInput -> String
(Int -> TlsConfigInput -> ShowS)
-> (TlsConfigInput -> String)
-> ([TlsConfigInput] -> ShowS)
-> Show TlsConfigInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TlsConfigInput] -> ShowS
$cshowList :: [TlsConfigInput] -> ShowS
show :: TlsConfigInput -> String
$cshow :: TlsConfigInput -> String
showsPrec :: Int -> TlsConfigInput -> ShowS
$cshowsPrec :: Int -> TlsConfigInput -> ShowS
Prelude.Show, (forall x. TlsConfigInput -> Rep TlsConfigInput x)
-> (forall x. Rep TlsConfigInput x -> TlsConfigInput)
-> Generic TlsConfigInput
forall x. Rep TlsConfigInput x -> TlsConfigInput
forall x. TlsConfigInput -> Rep TlsConfigInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TlsConfigInput x -> TlsConfigInput
$cfrom :: forall x. TlsConfigInput -> Rep TlsConfigInput x
Prelude.Generic)

-- |
-- Create a value of 'TlsConfigInput' 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:
--
-- 'serverNameToVerify', 'tlsConfigInput_serverNameToVerify' - If you specify a server name, API Gateway uses it to verify the hostname
-- on the integration\'s certificate. The server name is also included in
-- the TLS handshake to support Server Name Indication (SNI) or virtual
-- hosting.
newTlsConfigInput ::
  TlsConfigInput
newTlsConfigInput :: TlsConfigInput
newTlsConfigInput =
  TlsConfigInput' :: Maybe Text -> TlsConfigInput
TlsConfigInput'
    { $sel:serverNameToVerify:TlsConfigInput' :: Maybe Text
serverNameToVerify =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | If you specify a server name, API Gateway uses it to verify the hostname
-- on the integration\'s certificate. The server name is also included in
-- the TLS handshake to support Server Name Indication (SNI) or virtual
-- hosting.
tlsConfigInput_serverNameToVerify :: Lens.Lens' TlsConfigInput (Prelude.Maybe Prelude.Text)
tlsConfigInput_serverNameToVerify :: (Maybe Text -> f (Maybe Text))
-> TlsConfigInput -> f TlsConfigInput
tlsConfigInput_serverNameToVerify = (TlsConfigInput -> Maybe Text)
-> (TlsConfigInput -> Maybe Text -> TlsConfigInput)
-> Lens TlsConfigInput TlsConfigInput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TlsConfigInput' {Maybe Text
serverNameToVerify :: Maybe Text
$sel:serverNameToVerify:TlsConfigInput' :: TlsConfigInput -> Maybe Text
serverNameToVerify} -> Maybe Text
serverNameToVerify) (\s :: TlsConfigInput
s@TlsConfigInput' {} Maybe Text
a -> TlsConfigInput
s {$sel:serverNameToVerify:TlsConfigInput' :: Maybe Text
serverNameToVerify = Maybe Text
a} :: TlsConfigInput)

instance Prelude.Hashable TlsConfigInput

instance Prelude.NFData TlsConfigInput

instance Core.ToJSON TlsConfigInput where
  toJSON :: TlsConfigInput -> Value
toJSON TlsConfigInput' {Maybe Text
serverNameToVerify :: Maybe Text
$sel:serverNameToVerify:TlsConfigInput' :: TlsConfigInput -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"serverNameToVerify" 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
serverNameToVerify
          ]
      )