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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GlobalAccelerator.Types.CustomRoutingDestinationDescription
import Amazonka.GlobalAccelerator.Types.CustomRoutingEndpointDescription
import qualified Amazonka.Prelude as Prelude

-- | A complex type for the endpoint group for a custom routing accelerator.
-- An Amazon Web Services Region can have only one endpoint group for a
-- specific listener.
--
-- /See:/ 'newCustomRoutingEndpointGroup' smart constructor.
data CustomRoutingEndpointGroup = CustomRoutingEndpointGroup'
  { -- | For a custom routing accelerator, describes the port range and protocol
    -- for all endpoints (virtual private cloud subnets) in an endpoint group
    -- to accept client traffic on.
    CustomRoutingEndpointGroup
-> Maybe [CustomRoutingDestinationDescription]
destinationDescriptions :: Prelude.Maybe [CustomRoutingDestinationDescription],
    -- | For a custom routing accelerator, describes the endpoints (virtual
    -- private cloud subnets) in an endpoint group to accept client traffic on.
    CustomRoutingEndpointGroup
-> Maybe [CustomRoutingEndpointDescription]
endpointDescriptions :: Prelude.Maybe [CustomRoutingEndpointDescription],
    -- | The Amazon Resource Name (ARN) of the endpoint group.
    CustomRoutingEndpointGroup -> Maybe Text
endpointGroupArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services Region where the endpoint group is located.
    CustomRoutingEndpointGroup -> Maybe Text
endpointGroupRegion :: Prelude.Maybe Prelude.Text
  }
  deriving (CustomRoutingEndpointGroup -> CustomRoutingEndpointGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomRoutingEndpointGroup -> CustomRoutingEndpointGroup -> Bool
$c/= :: CustomRoutingEndpointGroup -> CustomRoutingEndpointGroup -> Bool
== :: CustomRoutingEndpointGroup -> CustomRoutingEndpointGroup -> Bool
$c== :: CustomRoutingEndpointGroup -> CustomRoutingEndpointGroup -> Bool
Prelude.Eq, ReadPrec [CustomRoutingEndpointGroup]
ReadPrec CustomRoutingEndpointGroup
Int -> ReadS CustomRoutingEndpointGroup
ReadS [CustomRoutingEndpointGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomRoutingEndpointGroup]
$creadListPrec :: ReadPrec [CustomRoutingEndpointGroup]
readPrec :: ReadPrec CustomRoutingEndpointGroup
$creadPrec :: ReadPrec CustomRoutingEndpointGroup
readList :: ReadS [CustomRoutingEndpointGroup]
$creadList :: ReadS [CustomRoutingEndpointGroup]
readsPrec :: Int -> ReadS CustomRoutingEndpointGroup
$creadsPrec :: Int -> ReadS CustomRoutingEndpointGroup
Prelude.Read, Int -> CustomRoutingEndpointGroup -> ShowS
[CustomRoutingEndpointGroup] -> ShowS
CustomRoutingEndpointGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomRoutingEndpointGroup] -> ShowS
$cshowList :: [CustomRoutingEndpointGroup] -> ShowS
show :: CustomRoutingEndpointGroup -> String
$cshow :: CustomRoutingEndpointGroup -> String
showsPrec :: Int -> CustomRoutingEndpointGroup -> ShowS
$cshowsPrec :: Int -> CustomRoutingEndpointGroup -> ShowS
Prelude.Show, forall x.
Rep CustomRoutingEndpointGroup x -> CustomRoutingEndpointGroup
forall x.
CustomRoutingEndpointGroup -> Rep CustomRoutingEndpointGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CustomRoutingEndpointGroup x -> CustomRoutingEndpointGroup
$cfrom :: forall x.
CustomRoutingEndpointGroup -> Rep CustomRoutingEndpointGroup x
Prelude.Generic)

-- |
-- Create a value of 'CustomRoutingEndpointGroup' 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:
--
-- 'destinationDescriptions', 'customRoutingEndpointGroup_destinationDescriptions' - For a custom routing accelerator, describes the port range and protocol
-- for all endpoints (virtual private cloud subnets) in an endpoint group
-- to accept client traffic on.
--
-- 'endpointDescriptions', 'customRoutingEndpointGroup_endpointDescriptions' - For a custom routing accelerator, describes the endpoints (virtual
-- private cloud subnets) in an endpoint group to accept client traffic on.
--
-- 'endpointGroupArn', 'customRoutingEndpointGroup_endpointGroupArn' - The Amazon Resource Name (ARN) of the endpoint group.
--
-- 'endpointGroupRegion', 'customRoutingEndpointGroup_endpointGroupRegion' - The Amazon Web Services Region where the endpoint group is located.
newCustomRoutingEndpointGroup ::
  CustomRoutingEndpointGroup
newCustomRoutingEndpointGroup :: CustomRoutingEndpointGroup
newCustomRoutingEndpointGroup =
  CustomRoutingEndpointGroup'
    { $sel:destinationDescriptions:CustomRoutingEndpointGroup' :: Maybe [CustomRoutingDestinationDescription]
destinationDescriptions =
        forall a. Maybe a
Prelude.Nothing,
      $sel:endpointDescriptions:CustomRoutingEndpointGroup' :: Maybe [CustomRoutingEndpointDescription]
endpointDescriptions = forall a. Maybe a
Prelude.Nothing,
      $sel:endpointGroupArn:CustomRoutingEndpointGroup' :: Maybe Text
endpointGroupArn = forall a. Maybe a
Prelude.Nothing,
      $sel:endpointGroupRegion:CustomRoutingEndpointGroup' :: Maybe Text
endpointGroupRegion = forall a. Maybe a
Prelude.Nothing
    }

-- | For a custom routing accelerator, describes the port range and protocol
-- for all endpoints (virtual private cloud subnets) in an endpoint group
-- to accept client traffic on.
customRoutingEndpointGroup_destinationDescriptions :: Lens.Lens' CustomRoutingEndpointGroup (Prelude.Maybe [CustomRoutingDestinationDescription])
customRoutingEndpointGroup_destinationDescriptions :: Lens'
  CustomRoutingEndpointGroup
  (Maybe [CustomRoutingDestinationDescription])
customRoutingEndpointGroup_destinationDescriptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomRoutingEndpointGroup' {Maybe [CustomRoutingDestinationDescription]
destinationDescriptions :: Maybe [CustomRoutingDestinationDescription]
$sel:destinationDescriptions:CustomRoutingEndpointGroup' :: CustomRoutingEndpointGroup
-> Maybe [CustomRoutingDestinationDescription]
destinationDescriptions} -> Maybe [CustomRoutingDestinationDescription]
destinationDescriptions) (\s :: CustomRoutingEndpointGroup
s@CustomRoutingEndpointGroup' {} Maybe [CustomRoutingDestinationDescription]
a -> CustomRoutingEndpointGroup
s {$sel:destinationDescriptions:CustomRoutingEndpointGroup' :: Maybe [CustomRoutingDestinationDescription]
destinationDescriptions = Maybe [CustomRoutingDestinationDescription]
a} :: CustomRoutingEndpointGroup) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | For a custom routing accelerator, describes the endpoints (virtual
-- private cloud subnets) in an endpoint group to accept client traffic on.
customRoutingEndpointGroup_endpointDescriptions :: Lens.Lens' CustomRoutingEndpointGroup (Prelude.Maybe [CustomRoutingEndpointDescription])
customRoutingEndpointGroup_endpointDescriptions :: Lens'
  CustomRoutingEndpointGroup
  (Maybe [CustomRoutingEndpointDescription])
customRoutingEndpointGroup_endpointDescriptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomRoutingEndpointGroup' {Maybe [CustomRoutingEndpointDescription]
endpointDescriptions :: Maybe [CustomRoutingEndpointDescription]
$sel:endpointDescriptions:CustomRoutingEndpointGroup' :: CustomRoutingEndpointGroup
-> Maybe [CustomRoutingEndpointDescription]
endpointDescriptions} -> Maybe [CustomRoutingEndpointDescription]
endpointDescriptions) (\s :: CustomRoutingEndpointGroup
s@CustomRoutingEndpointGroup' {} Maybe [CustomRoutingEndpointDescription]
a -> CustomRoutingEndpointGroup
s {$sel:endpointDescriptions:CustomRoutingEndpointGroup' :: Maybe [CustomRoutingEndpointDescription]
endpointDescriptions = Maybe [CustomRoutingEndpointDescription]
a} :: CustomRoutingEndpointGroup) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) of the endpoint group.
customRoutingEndpointGroup_endpointGroupArn :: Lens.Lens' CustomRoutingEndpointGroup (Prelude.Maybe Prelude.Text)
customRoutingEndpointGroup_endpointGroupArn :: Lens' CustomRoutingEndpointGroup (Maybe Text)
customRoutingEndpointGroup_endpointGroupArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomRoutingEndpointGroup' {Maybe Text
endpointGroupArn :: Maybe Text
$sel:endpointGroupArn:CustomRoutingEndpointGroup' :: CustomRoutingEndpointGroup -> Maybe Text
endpointGroupArn} -> Maybe Text
endpointGroupArn) (\s :: CustomRoutingEndpointGroup
s@CustomRoutingEndpointGroup' {} Maybe Text
a -> CustomRoutingEndpointGroup
s {$sel:endpointGroupArn:CustomRoutingEndpointGroup' :: Maybe Text
endpointGroupArn = Maybe Text
a} :: CustomRoutingEndpointGroup)

-- | The Amazon Web Services Region where the endpoint group is located.
customRoutingEndpointGroup_endpointGroupRegion :: Lens.Lens' CustomRoutingEndpointGroup (Prelude.Maybe Prelude.Text)
customRoutingEndpointGroup_endpointGroupRegion :: Lens' CustomRoutingEndpointGroup (Maybe Text)
customRoutingEndpointGroup_endpointGroupRegion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomRoutingEndpointGroup' {Maybe Text
endpointGroupRegion :: Maybe Text
$sel:endpointGroupRegion:CustomRoutingEndpointGroup' :: CustomRoutingEndpointGroup -> Maybe Text
endpointGroupRegion} -> Maybe Text
endpointGroupRegion) (\s :: CustomRoutingEndpointGroup
s@CustomRoutingEndpointGroup' {} Maybe Text
a -> CustomRoutingEndpointGroup
s {$sel:endpointGroupRegion:CustomRoutingEndpointGroup' :: Maybe Text
endpointGroupRegion = Maybe Text
a} :: CustomRoutingEndpointGroup)

instance Data.FromJSON CustomRoutingEndpointGroup where
  parseJSON :: Value -> Parser CustomRoutingEndpointGroup
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CustomRoutingEndpointGroup"
      ( \Object
x ->
          Maybe [CustomRoutingDestinationDescription]
-> Maybe [CustomRoutingEndpointDescription]
-> Maybe Text
-> Maybe Text
-> CustomRoutingEndpointGroup
CustomRoutingEndpointGroup'
            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
"DestinationDescriptions"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"EndpointDescriptions"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"EndpointGroupArn")
            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
"EndpointGroupRegion")
      )

instance Prelude.Hashable CustomRoutingEndpointGroup where
  hashWithSalt :: Int -> CustomRoutingEndpointGroup -> Int
hashWithSalt Int
_salt CustomRoutingEndpointGroup' {Maybe [CustomRoutingEndpointDescription]
Maybe [CustomRoutingDestinationDescription]
Maybe Text
endpointGroupRegion :: Maybe Text
endpointGroupArn :: Maybe Text
endpointDescriptions :: Maybe [CustomRoutingEndpointDescription]
destinationDescriptions :: Maybe [CustomRoutingDestinationDescription]
$sel:endpointGroupRegion:CustomRoutingEndpointGroup' :: CustomRoutingEndpointGroup -> Maybe Text
$sel:endpointGroupArn:CustomRoutingEndpointGroup' :: CustomRoutingEndpointGroup -> Maybe Text
$sel:endpointDescriptions:CustomRoutingEndpointGroup' :: CustomRoutingEndpointGroup
-> Maybe [CustomRoutingEndpointDescription]
$sel:destinationDescriptions:CustomRoutingEndpointGroup' :: CustomRoutingEndpointGroup
-> Maybe [CustomRoutingDestinationDescription]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [CustomRoutingDestinationDescription]
destinationDescriptions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [CustomRoutingEndpointDescription]
endpointDescriptions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
endpointGroupArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
endpointGroupRegion

instance Prelude.NFData CustomRoutingEndpointGroup where
  rnf :: CustomRoutingEndpointGroup -> ()
rnf CustomRoutingEndpointGroup' {Maybe [CustomRoutingEndpointDescription]
Maybe [CustomRoutingDestinationDescription]
Maybe Text
endpointGroupRegion :: Maybe Text
endpointGroupArn :: Maybe Text
endpointDescriptions :: Maybe [CustomRoutingEndpointDescription]
destinationDescriptions :: Maybe [CustomRoutingDestinationDescription]
$sel:endpointGroupRegion:CustomRoutingEndpointGroup' :: CustomRoutingEndpointGroup -> Maybe Text
$sel:endpointGroupArn:CustomRoutingEndpointGroup' :: CustomRoutingEndpointGroup -> Maybe Text
$sel:endpointDescriptions:CustomRoutingEndpointGroup' :: CustomRoutingEndpointGroup
-> Maybe [CustomRoutingEndpointDescription]
$sel:destinationDescriptions:CustomRoutingEndpointGroup' :: CustomRoutingEndpointGroup
-> Maybe [CustomRoutingDestinationDescription]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [CustomRoutingDestinationDescription]
destinationDescriptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [CustomRoutingEndpointDescription]
endpointDescriptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
endpointGroupArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
endpointGroupRegion