{-# 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.GlobalAccelerator.Types.CustomRoutingEndpointConfiguration
-- 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.GlobalAccelerator.Types.CustomRoutingEndpointConfiguration where

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

-- | The list of endpoint objects. For custom routing, this is a list of
-- virtual private cloud (VPC) subnet IDs.
--
-- /See:/ 'newCustomRoutingEndpointConfiguration' smart constructor.
data CustomRoutingEndpointConfiguration = CustomRoutingEndpointConfiguration'
  { -- | An ID for the endpoint. For custom routing accelerators, this is the
    -- virtual private cloud (VPC) subnet ID.
    CustomRoutingEndpointConfiguration -> Maybe Text
endpointId :: Prelude.Maybe Prelude.Text
  }
  deriving (CustomRoutingEndpointConfiguration
-> CustomRoutingEndpointConfiguration -> Bool
(CustomRoutingEndpointConfiguration
 -> CustomRoutingEndpointConfiguration -> Bool)
-> (CustomRoutingEndpointConfiguration
    -> CustomRoutingEndpointConfiguration -> Bool)
-> Eq CustomRoutingEndpointConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomRoutingEndpointConfiguration
-> CustomRoutingEndpointConfiguration -> Bool
$c/= :: CustomRoutingEndpointConfiguration
-> CustomRoutingEndpointConfiguration -> Bool
== :: CustomRoutingEndpointConfiguration
-> CustomRoutingEndpointConfiguration -> Bool
$c== :: CustomRoutingEndpointConfiguration
-> CustomRoutingEndpointConfiguration -> Bool
Prelude.Eq, ReadPrec [CustomRoutingEndpointConfiguration]
ReadPrec CustomRoutingEndpointConfiguration
Int -> ReadS CustomRoutingEndpointConfiguration
ReadS [CustomRoutingEndpointConfiguration]
(Int -> ReadS CustomRoutingEndpointConfiguration)
-> ReadS [CustomRoutingEndpointConfiguration]
-> ReadPrec CustomRoutingEndpointConfiguration
-> ReadPrec [CustomRoutingEndpointConfiguration]
-> Read CustomRoutingEndpointConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomRoutingEndpointConfiguration]
$creadListPrec :: ReadPrec [CustomRoutingEndpointConfiguration]
readPrec :: ReadPrec CustomRoutingEndpointConfiguration
$creadPrec :: ReadPrec CustomRoutingEndpointConfiguration
readList :: ReadS [CustomRoutingEndpointConfiguration]
$creadList :: ReadS [CustomRoutingEndpointConfiguration]
readsPrec :: Int -> ReadS CustomRoutingEndpointConfiguration
$creadsPrec :: Int -> ReadS CustomRoutingEndpointConfiguration
Prelude.Read, Int -> CustomRoutingEndpointConfiguration -> ShowS
[CustomRoutingEndpointConfiguration] -> ShowS
CustomRoutingEndpointConfiguration -> String
(Int -> CustomRoutingEndpointConfiguration -> ShowS)
-> (CustomRoutingEndpointConfiguration -> String)
-> ([CustomRoutingEndpointConfiguration] -> ShowS)
-> Show CustomRoutingEndpointConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomRoutingEndpointConfiguration] -> ShowS
$cshowList :: [CustomRoutingEndpointConfiguration] -> ShowS
show :: CustomRoutingEndpointConfiguration -> String
$cshow :: CustomRoutingEndpointConfiguration -> String
showsPrec :: Int -> CustomRoutingEndpointConfiguration -> ShowS
$cshowsPrec :: Int -> CustomRoutingEndpointConfiguration -> ShowS
Prelude.Show, (forall x.
 CustomRoutingEndpointConfiguration
 -> Rep CustomRoutingEndpointConfiguration x)
-> (forall x.
    Rep CustomRoutingEndpointConfiguration x
    -> CustomRoutingEndpointConfiguration)
-> Generic CustomRoutingEndpointConfiguration
forall x.
Rep CustomRoutingEndpointConfiguration x
-> CustomRoutingEndpointConfiguration
forall x.
CustomRoutingEndpointConfiguration
-> Rep CustomRoutingEndpointConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CustomRoutingEndpointConfiguration x
-> CustomRoutingEndpointConfiguration
$cfrom :: forall x.
CustomRoutingEndpointConfiguration
-> Rep CustomRoutingEndpointConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'CustomRoutingEndpointConfiguration' 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:
--
-- 'endpointId', 'customRoutingEndpointConfiguration_endpointId' - An ID for the endpoint. For custom routing accelerators, this is the
-- virtual private cloud (VPC) subnet ID.
newCustomRoutingEndpointConfiguration ::
  CustomRoutingEndpointConfiguration
newCustomRoutingEndpointConfiguration :: CustomRoutingEndpointConfiguration
newCustomRoutingEndpointConfiguration =
  CustomRoutingEndpointConfiguration' :: Maybe Text -> CustomRoutingEndpointConfiguration
CustomRoutingEndpointConfiguration'
    { $sel:endpointId:CustomRoutingEndpointConfiguration' :: Maybe Text
endpointId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | An ID for the endpoint. For custom routing accelerators, this is the
-- virtual private cloud (VPC) subnet ID.
customRoutingEndpointConfiguration_endpointId :: Lens.Lens' CustomRoutingEndpointConfiguration (Prelude.Maybe Prelude.Text)
customRoutingEndpointConfiguration_endpointId :: (Maybe Text -> f (Maybe Text))
-> CustomRoutingEndpointConfiguration
-> f CustomRoutingEndpointConfiguration
customRoutingEndpointConfiguration_endpointId = (CustomRoutingEndpointConfiguration -> Maybe Text)
-> (CustomRoutingEndpointConfiguration
    -> Maybe Text -> CustomRoutingEndpointConfiguration)
-> Lens
     CustomRoutingEndpointConfiguration
     CustomRoutingEndpointConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomRoutingEndpointConfiguration' {Maybe Text
endpointId :: Maybe Text
$sel:endpointId:CustomRoutingEndpointConfiguration' :: CustomRoutingEndpointConfiguration -> Maybe Text
endpointId} -> Maybe Text
endpointId) (\s :: CustomRoutingEndpointConfiguration
s@CustomRoutingEndpointConfiguration' {} Maybe Text
a -> CustomRoutingEndpointConfiguration
s {$sel:endpointId:CustomRoutingEndpointConfiguration' :: Maybe Text
endpointId = Maybe Text
a} :: CustomRoutingEndpointConfiguration)

instance
  Prelude.Hashable
    CustomRoutingEndpointConfiguration

instance
  Prelude.NFData
    CustomRoutingEndpointConfiguration

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