{-# 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.SecurityHub.Types.AwsApiGatewayEndpointConfiguration
-- 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.SecurityHub.Types.AwsApiGatewayEndpointConfiguration where

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

-- | Contains information about the endpoints for the API.
--
-- /See:/ 'newAwsApiGatewayEndpointConfiguration' smart constructor.
data AwsApiGatewayEndpointConfiguration = AwsApiGatewayEndpointConfiguration'
  { -- | A list of endpoint types for the REST API.
    --
    -- For an edge-optimized API, the endpoint type is @EDGE@. For a Regional
    -- API, the endpoint type is @REGIONAL@. For a private API, the endpoint
    -- type is @PRIVATE@.
    AwsApiGatewayEndpointConfiguration -> Maybe [Text]
types :: Prelude.Maybe [Prelude.Text]
  }
  deriving (AwsApiGatewayEndpointConfiguration
-> AwsApiGatewayEndpointConfiguration -> Bool
(AwsApiGatewayEndpointConfiguration
 -> AwsApiGatewayEndpointConfiguration -> Bool)
-> (AwsApiGatewayEndpointConfiguration
    -> AwsApiGatewayEndpointConfiguration -> Bool)
-> Eq AwsApiGatewayEndpointConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsApiGatewayEndpointConfiguration
-> AwsApiGatewayEndpointConfiguration -> Bool
$c/= :: AwsApiGatewayEndpointConfiguration
-> AwsApiGatewayEndpointConfiguration -> Bool
== :: AwsApiGatewayEndpointConfiguration
-> AwsApiGatewayEndpointConfiguration -> Bool
$c== :: AwsApiGatewayEndpointConfiguration
-> AwsApiGatewayEndpointConfiguration -> Bool
Prelude.Eq, ReadPrec [AwsApiGatewayEndpointConfiguration]
ReadPrec AwsApiGatewayEndpointConfiguration
Int -> ReadS AwsApiGatewayEndpointConfiguration
ReadS [AwsApiGatewayEndpointConfiguration]
(Int -> ReadS AwsApiGatewayEndpointConfiguration)
-> ReadS [AwsApiGatewayEndpointConfiguration]
-> ReadPrec AwsApiGatewayEndpointConfiguration
-> ReadPrec [AwsApiGatewayEndpointConfiguration]
-> Read AwsApiGatewayEndpointConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsApiGatewayEndpointConfiguration]
$creadListPrec :: ReadPrec [AwsApiGatewayEndpointConfiguration]
readPrec :: ReadPrec AwsApiGatewayEndpointConfiguration
$creadPrec :: ReadPrec AwsApiGatewayEndpointConfiguration
readList :: ReadS [AwsApiGatewayEndpointConfiguration]
$creadList :: ReadS [AwsApiGatewayEndpointConfiguration]
readsPrec :: Int -> ReadS AwsApiGatewayEndpointConfiguration
$creadsPrec :: Int -> ReadS AwsApiGatewayEndpointConfiguration
Prelude.Read, Int -> AwsApiGatewayEndpointConfiguration -> ShowS
[AwsApiGatewayEndpointConfiguration] -> ShowS
AwsApiGatewayEndpointConfiguration -> String
(Int -> AwsApiGatewayEndpointConfiguration -> ShowS)
-> (AwsApiGatewayEndpointConfiguration -> String)
-> ([AwsApiGatewayEndpointConfiguration] -> ShowS)
-> Show AwsApiGatewayEndpointConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsApiGatewayEndpointConfiguration] -> ShowS
$cshowList :: [AwsApiGatewayEndpointConfiguration] -> ShowS
show :: AwsApiGatewayEndpointConfiguration -> String
$cshow :: AwsApiGatewayEndpointConfiguration -> String
showsPrec :: Int -> AwsApiGatewayEndpointConfiguration -> ShowS
$cshowsPrec :: Int -> AwsApiGatewayEndpointConfiguration -> ShowS
Prelude.Show, (forall x.
 AwsApiGatewayEndpointConfiguration
 -> Rep AwsApiGatewayEndpointConfiguration x)
-> (forall x.
    Rep AwsApiGatewayEndpointConfiguration x
    -> AwsApiGatewayEndpointConfiguration)
-> Generic AwsApiGatewayEndpointConfiguration
forall x.
Rep AwsApiGatewayEndpointConfiguration x
-> AwsApiGatewayEndpointConfiguration
forall x.
AwsApiGatewayEndpointConfiguration
-> Rep AwsApiGatewayEndpointConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsApiGatewayEndpointConfiguration x
-> AwsApiGatewayEndpointConfiguration
$cfrom :: forall x.
AwsApiGatewayEndpointConfiguration
-> Rep AwsApiGatewayEndpointConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'AwsApiGatewayEndpointConfiguration' 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:
--
-- 'types', 'awsApiGatewayEndpointConfiguration_types' - A list of endpoint types for the REST API.
--
-- For an edge-optimized API, the endpoint type is @EDGE@. For a Regional
-- API, the endpoint type is @REGIONAL@. For a private API, the endpoint
-- type is @PRIVATE@.
newAwsApiGatewayEndpointConfiguration ::
  AwsApiGatewayEndpointConfiguration
newAwsApiGatewayEndpointConfiguration :: AwsApiGatewayEndpointConfiguration
newAwsApiGatewayEndpointConfiguration =
  AwsApiGatewayEndpointConfiguration' :: Maybe [Text] -> AwsApiGatewayEndpointConfiguration
AwsApiGatewayEndpointConfiguration'
    { $sel:types:AwsApiGatewayEndpointConfiguration' :: Maybe [Text]
types =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | A list of endpoint types for the REST API.
--
-- For an edge-optimized API, the endpoint type is @EDGE@. For a Regional
-- API, the endpoint type is @REGIONAL@. For a private API, the endpoint
-- type is @PRIVATE@.
awsApiGatewayEndpointConfiguration_types :: Lens.Lens' AwsApiGatewayEndpointConfiguration (Prelude.Maybe [Prelude.Text])
awsApiGatewayEndpointConfiguration_types :: (Maybe [Text] -> f (Maybe [Text]))
-> AwsApiGatewayEndpointConfiguration
-> f AwsApiGatewayEndpointConfiguration
awsApiGatewayEndpointConfiguration_types = (AwsApiGatewayEndpointConfiguration -> Maybe [Text])
-> (AwsApiGatewayEndpointConfiguration
    -> Maybe [Text] -> AwsApiGatewayEndpointConfiguration)
-> Lens
     AwsApiGatewayEndpointConfiguration
     AwsApiGatewayEndpointConfiguration
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsApiGatewayEndpointConfiguration' {Maybe [Text]
types :: Maybe [Text]
$sel:types:AwsApiGatewayEndpointConfiguration' :: AwsApiGatewayEndpointConfiguration -> Maybe [Text]
types} -> Maybe [Text]
types) (\s :: AwsApiGatewayEndpointConfiguration
s@AwsApiGatewayEndpointConfiguration' {} Maybe [Text]
a -> AwsApiGatewayEndpointConfiguration
s {$sel:types:AwsApiGatewayEndpointConfiguration' :: Maybe [Text]
types = Maybe [Text]
a} :: AwsApiGatewayEndpointConfiguration) ((Maybe [Text] -> f (Maybe [Text]))
 -> AwsApiGatewayEndpointConfiguration
 -> f AwsApiGatewayEndpointConfiguration)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AwsApiGatewayEndpointConfiguration
-> f AwsApiGatewayEndpointConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.FromJSON
    AwsApiGatewayEndpointConfiguration
  where
  parseJSON :: Value -> Parser AwsApiGatewayEndpointConfiguration
parseJSON =
    String
-> (Object -> Parser AwsApiGatewayEndpointConfiguration)
-> Value
-> Parser AwsApiGatewayEndpointConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsApiGatewayEndpointConfiguration"
      ( \Object
x ->
          Maybe [Text] -> AwsApiGatewayEndpointConfiguration
AwsApiGatewayEndpointConfiguration'
            (Maybe [Text] -> AwsApiGatewayEndpointConfiguration)
-> Parser (Maybe [Text])
-> Parser AwsApiGatewayEndpointConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Types" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    AwsApiGatewayEndpointConfiguration

instance
  Prelude.NFData
    AwsApiGatewayEndpointConfiguration

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