{-# 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.MutualTlsAuthenticationInput
-- 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.MutualTlsAuthenticationInput where

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

-- | /See:/ 'newMutualTlsAuthenticationInput' smart constructor.
data MutualTlsAuthenticationInput = MutualTlsAuthenticationInput'
  { -- | An Amazon S3 URL that specifies the truststore for mutual TLS
    -- authentication, for example, s3:\/\/bucket-name\/key-name. The
    -- truststore can contain certificates from public or private certificate
    -- authorities. To update the truststore, upload a new version to S3, and
    -- then update your custom domain name to use the new version. To update
    -- the truststore, you must have permissions to access the S3 object.
    MutualTlsAuthenticationInput -> Maybe Text
truststoreUri :: Prelude.Maybe Prelude.Text,
    -- | The version of the S3 object that contains your truststore. To specify a
    -- version, you must have versioning enabled for the S3 bucket.
    MutualTlsAuthenticationInput -> Maybe Text
truststoreVersion :: Prelude.Maybe Prelude.Text
  }
  deriving (MutualTlsAuthenticationInput
-> MutualTlsAuthenticationInput -> Bool
(MutualTlsAuthenticationInput
 -> MutualTlsAuthenticationInput -> Bool)
-> (MutualTlsAuthenticationInput
    -> MutualTlsAuthenticationInput -> Bool)
-> Eq MutualTlsAuthenticationInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MutualTlsAuthenticationInput
-> MutualTlsAuthenticationInput -> Bool
$c/= :: MutualTlsAuthenticationInput
-> MutualTlsAuthenticationInput -> Bool
== :: MutualTlsAuthenticationInput
-> MutualTlsAuthenticationInput -> Bool
$c== :: MutualTlsAuthenticationInput
-> MutualTlsAuthenticationInput -> Bool
Prelude.Eq, ReadPrec [MutualTlsAuthenticationInput]
ReadPrec MutualTlsAuthenticationInput
Int -> ReadS MutualTlsAuthenticationInput
ReadS [MutualTlsAuthenticationInput]
(Int -> ReadS MutualTlsAuthenticationInput)
-> ReadS [MutualTlsAuthenticationInput]
-> ReadPrec MutualTlsAuthenticationInput
-> ReadPrec [MutualTlsAuthenticationInput]
-> Read MutualTlsAuthenticationInput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MutualTlsAuthenticationInput]
$creadListPrec :: ReadPrec [MutualTlsAuthenticationInput]
readPrec :: ReadPrec MutualTlsAuthenticationInput
$creadPrec :: ReadPrec MutualTlsAuthenticationInput
readList :: ReadS [MutualTlsAuthenticationInput]
$creadList :: ReadS [MutualTlsAuthenticationInput]
readsPrec :: Int -> ReadS MutualTlsAuthenticationInput
$creadsPrec :: Int -> ReadS MutualTlsAuthenticationInput
Prelude.Read, Int -> MutualTlsAuthenticationInput -> ShowS
[MutualTlsAuthenticationInput] -> ShowS
MutualTlsAuthenticationInput -> String
(Int -> MutualTlsAuthenticationInput -> ShowS)
-> (MutualTlsAuthenticationInput -> String)
-> ([MutualTlsAuthenticationInput] -> ShowS)
-> Show MutualTlsAuthenticationInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MutualTlsAuthenticationInput] -> ShowS
$cshowList :: [MutualTlsAuthenticationInput] -> ShowS
show :: MutualTlsAuthenticationInput -> String
$cshow :: MutualTlsAuthenticationInput -> String
showsPrec :: Int -> MutualTlsAuthenticationInput -> ShowS
$cshowsPrec :: Int -> MutualTlsAuthenticationInput -> ShowS
Prelude.Show, (forall x.
 MutualTlsAuthenticationInput -> Rep MutualTlsAuthenticationInput x)
-> (forall x.
    Rep MutualTlsAuthenticationInput x -> MutualTlsAuthenticationInput)
-> Generic MutualTlsAuthenticationInput
forall x.
Rep MutualTlsAuthenticationInput x -> MutualTlsAuthenticationInput
forall x.
MutualTlsAuthenticationInput -> Rep MutualTlsAuthenticationInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MutualTlsAuthenticationInput x -> MutualTlsAuthenticationInput
$cfrom :: forall x.
MutualTlsAuthenticationInput -> Rep MutualTlsAuthenticationInput x
Prelude.Generic)

-- |
-- Create a value of 'MutualTlsAuthenticationInput' 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:
--
-- 'truststoreUri', 'mutualTlsAuthenticationInput_truststoreUri' - An Amazon S3 URL that specifies the truststore for mutual TLS
-- authentication, for example, s3:\/\/bucket-name\/key-name. The
-- truststore can contain certificates from public or private certificate
-- authorities. To update the truststore, upload a new version to S3, and
-- then update your custom domain name to use the new version. To update
-- the truststore, you must have permissions to access the S3 object.
--
-- 'truststoreVersion', 'mutualTlsAuthenticationInput_truststoreVersion' - The version of the S3 object that contains your truststore. To specify a
-- version, you must have versioning enabled for the S3 bucket.
newMutualTlsAuthenticationInput ::
  MutualTlsAuthenticationInput
newMutualTlsAuthenticationInput :: MutualTlsAuthenticationInput
newMutualTlsAuthenticationInput =
  MutualTlsAuthenticationInput' :: Maybe Text -> Maybe Text -> MutualTlsAuthenticationInput
MutualTlsAuthenticationInput'
    { $sel:truststoreUri:MutualTlsAuthenticationInput' :: Maybe Text
truststoreUri =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:truststoreVersion:MutualTlsAuthenticationInput' :: Maybe Text
truststoreVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | An Amazon S3 URL that specifies the truststore for mutual TLS
-- authentication, for example, s3:\/\/bucket-name\/key-name. The
-- truststore can contain certificates from public or private certificate
-- authorities. To update the truststore, upload a new version to S3, and
-- then update your custom domain name to use the new version. To update
-- the truststore, you must have permissions to access the S3 object.
mutualTlsAuthenticationInput_truststoreUri :: Lens.Lens' MutualTlsAuthenticationInput (Prelude.Maybe Prelude.Text)
mutualTlsAuthenticationInput_truststoreUri :: (Maybe Text -> f (Maybe Text))
-> MutualTlsAuthenticationInput -> f MutualTlsAuthenticationInput
mutualTlsAuthenticationInput_truststoreUri = (MutualTlsAuthenticationInput -> Maybe Text)
-> (MutualTlsAuthenticationInput
    -> Maybe Text -> MutualTlsAuthenticationInput)
-> Lens
     MutualTlsAuthenticationInput
     MutualTlsAuthenticationInput
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MutualTlsAuthenticationInput' {Maybe Text
truststoreUri :: Maybe Text
$sel:truststoreUri:MutualTlsAuthenticationInput' :: MutualTlsAuthenticationInput -> Maybe Text
truststoreUri} -> Maybe Text
truststoreUri) (\s :: MutualTlsAuthenticationInput
s@MutualTlsAuthenticationInput' {} Maybe Text
a -> MutualTlsAuthenticationInput
s {$sel:truststoreUri:MutualTlsAuthenticationInput' :: Maybe Text
truststoreUri = Maybe Text
a} :: MutualTlsAuthenticationInput)

-- | The version of the S3 object that contains your truststore. To specify a
-- version, you must have versioning enabled for the S3 bucket.
mutualTlsAuthenticationInput_truststoreVersion :: Lens.Lens' MutualTlsAuthenticationInput (Prelude.Maybe Prelude.Text)
mutualTlsAuthenticationInput_truststoreVersion :: (Maybe Text -> f (Maybe Text))
-> MutualTlsAuthenticationInput -> f MutualTlsAuthenticationInput
mutualTlsAuthenticationInput_truststoreVersion = (MutualTlsAuthenticationInput -> Maybe Text)
-> (MutualTlsAuthenticationInput
    -> Maybe Text -> MutualTlsAuthenticationInput)
-> Lens
     MutualTlsAuthenticationInput
     MutualTlsAuthenticationInput
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MutualTlsAuthenticationInput' {Maybe Text
truststoreVersion :: Maybe Text
$sel:truststoreVersion:MutualTlsAuthenticationInput' :: MutualTlsAuthenticationInput -> Maybe Text
truststoreVersion} -> Maybe Text
truststoreVersion) (\s :: MutualTlsAuthenticationInput
s@MutualTlsAuthenticationInput' {} Maybe Text
a -> MutualTlsAuthenticationInput
s {$sel:truststoreVersion:MutualTlsAuthenticationInput' :: Maybe Text
truststoreVersion = Maybe Text
a} :: MutualTlsAuthenticationInput)

instance
  Prelude.Hashable
    MutualTlsAuthenticationInput

instance Prelude.NFData MutualTlsAuthenticationInput

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