{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.CreateCustomRoutingEndpointGroup
-- 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)
--
-- Create an endpoint group for the specified listener for a custom routing
-- accelerator. An endpoint group is a collection of endpoints in one AWS
-- Region.
module Amazonka.GlobalAccelerator.CreateCustomRoutingEndpointGroup
  ( -- * Creating a Request
    CreateCustomRoutingEndpointGroup (..),
    newCreateCustomRoutingEndpointGroup,

    -- * Request Lenses
    createCustomRoutingEndpointGroup_listenerArn,
    createCustomRoutingEndpointGroup_endpointGroupRegion,
    createCustomRoutingEndpointGroup_destinationConfigurations,
    createCustomRoutingEndpointGroup_idempotencyToken,

    -- * Destructuring the Response
    CreateCustomRoutingEndpointGroupResponse (..),
    newCreateCustomRoutingEndpointGroupResponse,

    -- * Response Lenses
    createCustomRoutingEndpointGroupResponse_endpointGroup,
    createCustomRoutingEndpointGroupResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.GlobalAccelerator.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateCustomRoutingEndpointGroup' smart constructor.
data CreateCustomRoutingEndpointGroup = CreateCustomRoutingEndpointGroup'
  { -- | The Amazon Resource Name (ARN) of the listener for a custom routing
    -- endpoint.
    CreateCustomRoutingEndpointGroup -> Text
listenerArn :: Prelude.Text,
    -- | The AWS Region where the endpoint group is located. A listener can have
    -- only one endpoint group in a specific Region.
    CreateCustomRoutingEndpointGroup -> Text
endpointGroupRegion :: Prelude.Text,
    -- | Sets the port range and protocol for all endpoints (virtual private
    -- cloud subnets) in a custom routing endpoint group to accept client
    -- traffic on.
    CreateCustomRoutingEndpointGroup
-> NonEmpty CustomRoutingDestinationConfiguration
destinationConfigurations :: Prelude.NonEmpty CustomRoutingDestinationConfiguration,
    -- | A unique, case-sensitive identifier that you provide to ensure the
    -- idempotency—that is, the uniqueness—of the request.
    CreateCustomRoutingEndpointGroup -> Text
idempotencyToken :: Prelude.Text
  }
  deriving (CreateCustomRoutingEndpointGroup
-> CreateCustomRoutingEndpointGroup -> Bool
(CreateCustomRoutingEndpointGroup
 -> CreateCustomRoutingEndpointGroup -> Bool)
-> (CreateCustomRoutingEndpointGroup
    -> CreateCustomRoutingEndpointGroup -> Bool)
-> Eq CreateCustomRoutingEndpointGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCustomRoutingEndpointGroup
-> CreateCustomRoutingEndpointGroup -> Bool
$c/= :: CreateCustomRoutingEndpointGroup
-> CreateCustomRoutingEndpointGroup -> Bool
== :: CreateCustomRoutingEndpointGroup
-> CreateCustomRoutingEndpointGroup -> Bool
$c== :: CreateCustomRoutingEndpointGroup
-> CreateCustomRoutingEndpointGroup -> Bool
Prelude.Eq, ReadPrec [CreateCustomRoutingEndpointGroup]
ReadPrec CreateCustomRoutingEndpointGroup
Int -> ReadS CreateCustomRoutingEndpointGroup
ReadS [CreateCustomRoutingEndpointGroup]
(Int -> ReadS CreateCustomRoutingEndpointGroup)
-> ReadS [CreateCustomRoutingEndpointGroup]
-> ReadPrec CreateCustomRoutingEndpointGroup
-> ReadPrec [CreateCustomRoutingEndpointGroup]
-> Read CreateCustomRoutingEndpointGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCustomRoutingEndpointGroup]
$creadListPrec :: ReadPrec [CreateCustomRoutingEndpointGroup]
readPrec :: ReadPrec CreateCustomRoutingEndpointGroup
$creadPrec :: ReadPrec CreateCustomRoutingEndpointGroup
readList :: ReadS [CreateCustomRoutingEndpointGroup]
$creadList :: ReadS [CreateCustomRoutingEndpointGroup]
readsPrec :: Int -> ReadS CreateCustomRoutingEndpointGroup
$creadsPrec :: Int -> ReadS CreateCustomRoutingEndpointGroup
Prelude.Read, Int -> CreateCustomRoutingEndpointGroup -> ShowS
[CreateCustomRoutingEndpointGroup] -> ShowS
CreateCustomRoutingEndpointGroup -> String
(Int -> CreateCustomRoutingEndpointGroup -> ShowS)
-> (CreateCustomRoutingEndpointGroup -> String)
-> ([CreateCustomRoutingEndpointGroup] -> ShowS)
-> Show CreateCustomRoutingEndpointGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCustomRoutingEndpointGroup] -> ShowS
$cshowList :: [CreateCustomRoutingEndpointGroup] -> ShowS
show :: CreateCustomRoutingEndpointGroup -> String
$cshow :: CreateCustomRoutingEndpointGroup -> String
showsPrec :: Int -> CreateCustomRoutingEndpointGroup -> ShowS
$cshowsPrec :: Int -> CreateCustomRoutingEndpointGroup -> ShowS
Prelude.Show, (forall x.
 CreateCustomRoutingEndpointGroup
 -> Rep CreateCustomRoutingEndpointGroup x)
-> (forall x.
    Rep CreateCustomRoutingEndpointGroup x
    -> CreateCustomRoutingEndpointGroup)
-> Generic CreateCustomRoutingEndpointGroup
forall x.
Rep CreateCustomRoutingEndpointGroup x
-> CreateCustomRoutingEndpointGroup
forall x.
CreateCustomRoutingEndpointGroup
-> Rep CreateCustomRoutingEndpointGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCustomRoutingEndpointGroup x
-> CreateCustomRoutingEndpointGroup
$cfrom :: forall x.
CreateCustomRoutingEndpointGroup
-> Rep CreateCustomRoutingEndpointGroup x
Prelude.Generic)

-- |
-- Create a value of 'CreateCustomRoutingEndpointGroup' 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:
--
-- 'listenerArn', 'createCustomRoutingEndpointGroup_listenerArn' - The Amazon Resource Name (ARN) of the listener for a custom routing
-- endpoint.
--
-- 'endpointGroupRegion', 'createCustomRoutingEndpointGroup_endpointGroupRegion' - The AWS Region where the endpoint group is located. A listener can have
-- only one endpoint group in a specific Region.
--
-- 'destinationConfigurations', 'createCustomRoutingEndpointGroup_destinationConfigurations' - Sets the port range and protocol for all endpoints (virtual private
-- cloud subnets) in a custom routing endpoint group to accept client
-- traffic on.
--
-- 'idempotencyToken', 'createCustomRoutingEndpointGroup_idempotencyToken' - A unique, case-sensitive identifier that you provide to ensure the
-- idempotency—that is, the uniqueness—of the request.
newCreateCustomRoutingEndpointGroup ::
  -- | 'listenerArn'
  Prelude.Text ->
  -- | 'endpointGroupRegion'
  Prelude.Text ->
  -- | 'destinationConfigurations'
  Prelude.NonEmpty CustomRoutingDestinationConfiguration ->
  -- | 'idempotencyToken'
  Prelude.Text ->
  CreateCustomRoutingEndpointGroup
newCreateCustomRoutingEndpointGroup :: Text
-> Text
-> NonEmpty CustomRoutingDestinationConfiguration
-> Text
-> CreateCustomRoutingEndpointGroup
newCreateCustomRoutingEndpointGroup
  Text
pListenerArn_
  Text
pEndpointGroupRegion_
  NonEmpty CustomRoutingDestinationConfiguration
pDestinationConfigurations_
  Text
pIdempotencyToken_ =
    CreateCustomRoutingEndpointGroup' :: Text
-> Text
-> NonEmpty CustomRoutingDestinationConfiguration
-> Text
-> CreateCustomRoutingEndpointGroup
CreateCustomRoutingEndpointGroup'
      { $sel:listenerArn:CreateCustomRoutingEndpointGroup' :: Text
listenerArn =
          Text
pListenerArn_,
        $sel:endpointGroupRegion:CreateCustomRoutingEndpointGroup' :: Text
endpointGroupRegion =
          Text
pEndpointGroupRegion_,
        $sel:destinationConfigurations:CreateCustomRoutingEndpointGroup' :: NonEmpty CustomRoutingDestinationConfiguration
destinationConfigurations =
          Tagged
  (NonEmpty CustomRoutingDestinationConfiguration)
  (Identity (NonEmpty CustomRoutingDestinationConfiguration))
-> Tagged
     (NonEmpty CustomRoutingDestinationConfiguration)
     (Identity (NonEmpty CustomRoutingDestinationConfiguration))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
            (Tagged
   (NonEmpty CustomRoutingDestinationConfiguration)
   (Identity (NonEmpty CustomRoutingDestinationConfiguration))
 -> Tagged
      (NonEmpty CustomRoutingDestinationConfiguration)
      (Identity (NonEmpty CustomRoutingDestinationConfiguration)))
-> NonEmpty CustomRoutingDestinationConfiguration
-> NonEmpty CustomRoutingDestinationConfiguration
forall t b. AReview t b -> b -> t
Lens.# NonEmpty CustomRoutingDestinationConfiguration
pDestinationConfigurations_,
        $sel:idempotencyToken:CreateCustomRoutingEndpointGroup' :: Text
idempotencyToken = Text
pIdempotencyToken_
      }

-- | The Amazon Resource Name (ARN) of the listener for a custom routing
-- endpoint.
createCustomRoutingEndpointGroup_listenerArn :: Lens.Lens' CreateCustomRoutingEndpointGroup Prelude.Text
createCustomRoutingEndpointGroup_listenerArn :: (Text -> f Text)
-> CreateCustomRoutingEndpointGroup
-> f CreateCustomRoutingEndpointGroup
createCustomRoutingEndpointGroup_listenerArn = (CreateCustomRoutingEndpointGroup -> Text)
-> (CreateCustomRoutingEndpointGroup
    -> Text -> CreateCustomRoutingEndpointGroup)
-> Lens
     CreateCustomRoutingEndpointGroup
     CreateCustomRoutingEndpointGroup
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomRoutingEndpointGroup' {Text
listenerArn :: Text
$sel:listenerArn:CreateCustomRoutingEndpointGroup' :: CreateCustomRoutingEndpointGroup -> Text
listenerArn} -> Text
listenerArn) (\s :: CreateCustomRoutingEndpointGroup
s@CreateCustomRoutingEndpointGroup' {} Text
a -> CreateCustomRoutingEndpointGroup
s {$sel:listenerArn:CreateCustomRoutingEndpointGroup' :: Text
listenerArn = Text
a} :: CreateCustomRoutingEndpointGroup)

-- | The AWS Region where the endpoint group is located. A listener can have
-- only one endpoint group in a specific Region.
createCustomRoutingEndpointGroup_endpointGroupRegion :: Lens.Lens' CreateCustomRoutingEndpointGroup Prelude.Text
createCustomRoutingEndpointGroup_endpointGroupRegion :: (Text -> f Text)
-> CreateCustomRoutingEndpointGroup
-> f CreateCustomRoutingEndpointGroup
createCustomRoutingEndpointGroup_endpointGroupRegion = (CreateCustomRoutingEndpointGroup -> Text)
-> (CreateCustomRoutingEndpointGroup
    -> Text -> CreateCustomRoutingEndpointGroup)
-> Lens
     CreateCustomRoutingEndpointGroup
     CreateCustomRoutingEndpointGroup
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomRoutingEndpointGroup' {Text
endpointGroupRegion :: Text
$sel:endpointGroupRegion:CreateCustomRoutingEndpointGroup' :: CreateCustomRoutingEndpointGroup -> Text
endpointGroupRegion} -> Text
endpointGroupRegion) (\s :: CreateCustomRoutingEndpointGroup
s@CreateCustomRoutingEndpointGroup' {} Text
a -> CreateCustomRoutingEndpointGroup
s {$sel:endpointGroupRegion:CreateCustomRoutingEndpointGroup' :: Text
endpointGroupRegion = Text
a} :: CreateCustomRoutingEndpointGroup)

-- | Sets the port range and protocol for all endpoints (virtual private
-- cloud subnets) in a custom routing endpoint group to accept client
-- traffic on.
createCustomRoutingEndpointGroup_destinationConfigurations :: Lens.Lens' CreateCustomRoutingEndpointGroup (Prelude.NonEmpty CustomRoutingDestinationConfiguration)
createCustomRoutingEndpointGroup_destinationConfigurations :: (NonEmpty CustomRoutingDestinationConfiguration
 -> f (NonEmpty CustomRoutingDestinationConfiguration))
-> CreateCustomRoutingEndpointGroup
-> f CreateCustomRoutingEndpointGroup
createCustomRoutingEndpointGroup_destinationConfigurations = (CreateCustomRoutingEndpointGroup
 -> NonEmpty CustomRoutingDestinationConfiguration)
-> (CreateCustomRoutingEndpointGroup
    -> NonEmpty CustomRoutingDestinationConfiguration
    -> CreateCustomRoutingEndpointGroup)
-> Lens
     CreateCustomRoutingEndpointGroup
     CreateCustomRoutingEndpointGroup
     (NonEmpty CustomRoutingDestinationConfiguration)
     (NonEmpty CustomRoutingDestinationConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomRoutingEndpointGroup' {NonEmpty CustomRoutingDestinationConfiguration
destinationConfigurations :: NonEmpty CustomRoutingDestinationConfiguration
$sel:destinationConfigurations:CreateCustomRoutingEndpointGroup' :: CreateCustomRoutingEndpointGroup
-> NonEmpty CustomRoutingDestinationConfiguration
destinationConfigurations} -> NonEmpty CustomRoutingDestinationConfiguration
destinationConfigurations) (\s :: CreateCustomRoutingEndpointGroup
s@CreateCustomRoutingEndpointGroup' {} NonEmpty CustomRoutingDestinationConfiguration
a -> CreateCustomRoutingEndpointGroup
s {$sel:destinationConfigurations:CreateCustomRoutingEndpointGroup' :: NonEmpty CustomRoutingDestinationConfiguration
destinationConfigurations = NonEmpty CustomRoutingDestinationConfiguration
a} :: CreateCustomRoutingEndpointGroup) ((NonEmpty CustomRoutingDestinationConfiguration
  -> f (NonEmpty CustomRoutingDestinationConfiguration))
 -> CreateCustomRoutingEndpointGroup
 -> f CreateCustomRoutingEndpointGroup)
-> ((NonEmpty CustomRoutingDestinationConfiguration
     -> f (NonEmpty CustomRoutingDestinationConfiguration))
    -> NonEmpty CustomRoutingDestinationConfiguration
    -> f (NonEmpty CustomRoutingDestinationConfiguration))
-> (NonEmpty CustomRoutingDestinationConfiguration
    -> f (NonEmpty CustomRoutingDestinationConfiguration))
-> CreateCustomRoutingEndpointGroup
-> f CreateCustomRoutingEndpointGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty CustomRoutingDestinationConfiguration
 -> f (NonEmpty CustomRoutingDestinationConfiguration))
-> NonEmpty CustomRoutingDestinationConfiguration
-> f (NonEmpty CustomRoutingDestinationConfiguration)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A unique, case-sensitive identifier that you provide to ensure the
-- idempotency—that is, the uniqueness—of the request.
createCustomRoutingEndpointGroup_idempotencyToken :: Lens.Lens' CreateCustomRoutingEndpointGroup Prelude.Text
createCustomRoutingEndpointGroup_idempotencyToken :: (Text -> f Text)
-> CreateCustomRoutingEndpointGroup
-> f CreateCustomRoutingEndpointGroup
createCustomRoutingEndpointGroup_idempotencyToken = (CreateCustomRoutingEndpointGroup -> Text)
-> (CreateCustomRoutingEndpointGroup
    -> Text -> CreateCustomRoutingEndpointGroup)
-> Lens
     CreateCustomRoutingEndpointGroup
     CreateCustomRoutingEndpointGroup
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomRoutingEndpointGroup' {Text
idempotencyToken :: Text
$sel:idempotencyToken:CreateCustomRoutingEndpointGroup' :: CreateCustomRoutingEndpointGroup -> Text
idempotencyToken} -> Text
idempotencyToken) (\s :: CreateCustomRoutingEndpointGroup
s@CreateCustomRoutingEndpointGroup' {} Text
a -> CreateCustomRoutingEndpointGroup
s {$sel:idempotencyToken:CreateCustomRoutingEndpointGroup' :: Text
idempotencyToken = Text
a} :: CreateCustomRoutingEndpointGroup)

instance
  Core.AWSRequest
    CreateCustomRoutingEndpointGroup
  where
  type
    AWSResponse CreateCustomRoutingEndpointGroup =
      CreateCustomRoutingEndpointGroupResponse
  request :: CreateCustomRoutingEndpointGroup
-> Request CreateCustomRoutingEndpointGroup
request = Service
-> CreateCustomRoutingEndpointGroup
-> Request CreateCustomRoutingEndpointGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateCustomRoutingEndpointGroup
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse CreateCustomRoutingEndpointGroup)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateCustomRoutingEndpointGroup))
-> Logger
-> Service
-> Proxy CreateCustomRoutingEndpointGroup
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse CreateCustomRoutingEndpointGroup)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe CustomRoutingEndpointGroup
-> Int -> CreateCustomRoutingEndpointGroupResponse
CreateCustomRoutingEndpointGroupResponse'
            (Maybe CustomRoutingEndpointGroup
 -> Int -> CreateCustomRoutingEndpointGroupResponse)
-> Either String (Maybe CustomRoutingEndpointGroup)
-> Either String (Int -> CreateCustomRoutingEndpointGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe CustomRoutingEndpointGroup)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"EndpointGroup")
            Either String (Int -> CreateCustomRoutingEndpointGroupResponse)
-> Either String Int
-> Either String CreateCustomRoutingEndpointGroupResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    CreateCustomRoutingEndpointGroup

instance
  Prelude.NFData
    CreateCustomRoutingEndpointGroup

instance
  Core.ToHeaders
    CreateCustomRoutingEndpointGroup
  where
  toHeaders :: CreateCustomRoutingEndpointGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> CreateCustomRoutingEndpointGroup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"GlobalAccelerator_V20180706.CreateCustomRoutingEndpointGroup" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateCustomRoutingEndpointGroup where
  toJSON :: CreateCustomRoutingEndpointGroup -> Value
toJSON CreateCustomRoutingEndpointGroup' {NonEmpty CustomRoutingDestinationConfiguration
Text
idempotencyToken :: Text
destinationConfigurations :: NonEmpty CustomRoutingDestinationConfiguration
endpointGroupRegion :: Text
listenerArn :: Text
$sel:idempotencyToken:CreateCustomRoutingEndpointGroup' :: CreateCustomRoutingEndpointGroup -> Text
$sel:destinationConfigurations:CreateCustomRoutingEndpointGroup' :: CreateCustomRoutingEndpointGroup
-> NonEmpty CustomRoutingDestinationConfiguration
$sel:endpointGroupRegion:CreateCustomRoutingEndpointGroup' :: CreateCustomRoutingEndpointGroup -> Text
$sel:listenerArn:CreateCustomRoutingEndpointGroup' :: CreateCustomRoutingEndpointGroup -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ListenerArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
listenerArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"EndpointGroupRegion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
endpointGroupRegion),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"DestinationConfigurations"
                  Text -> NonEmpty CustomRoutingDestinationConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty CustomRoutingDestinationConfiguration
destinationConfigurations
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"IdempotencyToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
idempotencyToken)
          ]
      )

instance Core.ToPath CreateCustomRoutingEndpointGroup where
  toPath :: CreateCustomRoutingEndpointGroup -> ByteString
toPath = ByteString -> CreateCustomRoutingEndpointGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance
  Core.ToQuery
    CreateCustomRoutingEndpointGroup
  where
  toQuery :: CreateCustomRoutingEndpointGroup -> QueryString
toQuery = QueryString -> CreateCustomRoutingEndpointGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateCustomRoutingEndpointGroupResponse' smart constructor.
data CreateCustomRoutingEndpointGroupResponse = CreateCustomRoutingEndpointGroupResponse'
  { -- | The information about the endpoint group created for a custom routing
    -- accelerator.
    CreateCustomRoutingEndpointGroupResponse
-> Maybe CustomRoutingEndpointGroup
endpointGroup :: Prelude.Maybe CustomRoutingEndpointGroup,
    -- | The response's http status code.
    CreateCustomRoutingEndpointGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateCustomRoutingEndpointGroupResponse
-> CreateCustomRoutingEndpointGroupResponse -> Bool
(CreateCustomRoutingEndpointGroupResponse
 -> CreateCustomRoutingEndpointGroupResponse -> Bool)
-> (CreateCustomRoutingEndpointGroupResponse
    -> CreateCustomRoutingEndpointGroupResponse -> Bool)
-> Eq CreateCustomRoutingEndpointGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCustomRoutingEndpointGroupResponse
-> CreateCustomRoutingEndpointGroupResponse -> Bool
$c/= :: CreateCustomRoutingEndpointGroupResponse
-> CreateCustomRoutingEndpointGroupResponse -> Bool
== :: CreateCustomRoutingEndpointGroupResponse
-> CreateCustomRoutingEndpointGroupResponse -> Bool
$c== :: CreateCustomRoutingEndpointGroupResponse
-> CreateCustomRoutingEndpointGroupResponse -> Bool
Prelude.Eq, ReadPrec [CreateCustomRoutingEndpointGroupResponse]
ReadPrec CreateCustomRoutingEndpointGroupResponse
Int -> ReadS CreateCustomRoutingEndpointGroupResponse
ReadS [CreateCustomRoutingEndpointGroupResponse]
(Int -> ReadS CreateCustomRoutingEndpointGroupResponse)
-> ReadS [CreateCustomRoutingEndpointGroupResponse]
-> ReadPrec CreateCustomRoutingEndpointGroupResponse
-> ReadPrec [CreateCustomRoutingEndpointGroupResponse]
-> Read CreateCustomRoutingEndpointGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCustomRoutingEndpointGroupResponse]
$creadListPrec :: ReadPrec [CreateCustomRoutingEndpointGroupResponse]
readPrec :: ReadPrec CreateCustomRoutingEndpointGroupResponse
$creadPrec :: ReadPrec CreateCustomRoutingEndpointGroupResponse
readList :: ReadS [CreateCustomRoutingEndpointGroupResponse]
$creadList :: ReadS [CreateCustomRoutingEndpointGroupResponse]
readsPrec :: Int -> ReadS CreateCustomRoutingEndpointGroupResponse
$creadsPrec :: Int -> ReadS CreateCustomRoutingEndpointGroupResponse
Prelude.Read, Int -> CreateCustomRoutingEndpointGroupResponse -> ShowS
[CreateCustomRoutingEndpointGroupResponse] -> ShowS
CreateCustomRoutingEndpointGroupResponse -> String
(Int -> CreateCustomRoutingEndpointGroupResponse -> ShowS)
-> (CreateCustomRoutingEndpointGroupResponse -> String)
-> ([CreateCustomRoutingEndpointGroupResponse] -> ShowS)
-> Show CreateCustomRoutingEndpointGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCustomRoutingEndpointGroupResponse] -> ShowS
$cshowList :: [CreateCustomRoutingEndpointGroupResponse] -> ShowS
show :: CreateCustomRoutingEndpointGroupResponse -> String
$cshow :: CreateCustomRoutingEndpointGroupResponse -> String
showsPrec :: Int -> CreateCustomRoutingEndpointGroupResponse -> ShowS
$cshowsPrec :: Int -> CreateCustomRoutingEndpointGroupResponse -> ShowS
Prelude.Show, (forall x.
 CreateCustomRoutingEndpointGroupResponse
 -> Rep CreateCustomRoutingEndpointGroupResponse x)
-> (forall x.
    Rep CreateCustomRoutingEndpointGroupResponse x
    -> CreateCustomRoutingEndpointGroupResponse)
-> Generic CreateCustomRoutingEndpointGroupResponse
forall x.
Rep CreateCustomRoutingEndpointGroupResponse x
-> CreateCustomRoutingEndpointGroupResponse
forall x.
CreateCustomRoutingEndpointGroupResponse
-> Rep CreateCustomRoutingEndpointGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCustomRoutingEndpointGroupResponse x
-> CreateCustomRoutingEndpointGroupResponse
$cfrom :: forall x.
CreateCustomRoutingEndpointGroupResponse
-> Rep CreateCustomRoutingEndpointGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateCustomRoutingEndpointGroupResponse' 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:
--
-- 'endpointGroup', 'createCustomRoutingEndpointGroupResponse_endpointGroup' - The information about the endpoint group created for a custom routing
-- accelerator.
--
-- 'httpStatus', 'createCustomRoutingEndpointGroupResponse_httpStatus' - The response's http status code.
newCreateCustomRoutingEndpointGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateCustomRoutingEndpointGroupResponse
newCreateCustomRoutingEndpointGroupResponse :: Int -> CreateCustomRoutingEndpointGroupResponse
newCreateCustomRoutingEndpointGroupResponse
  Int
pHttpStatus_ =
    CreateCustomRoutingEndpointGroupResponse' :: Maybe CustomRoutingEndpointGroup
-> Int -> CreateCustomRoutingEndpointGroupResponse
CreateCustomRoutingEndpointGroupResponse'
      { $sel:endpointGroup:CreateCustomRoutingEndpointGroupResponse' :: Maybe CustomRoutingEndpointGroup
endpointGroup =
          Maybe CustomRoutingEndpointGroup
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:CreateCustomRoutingEndpointGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The information about the endpoint group created for a custom routing
-- accelerator.
createCustomRoutingEndpointGroupResponse_endpointGroup :: Lens.Lens' CreateCustomRoutingEndpointGroupResponse (Prelude.Maybe CustomRoutingEndpointGroup)
createCustomRoutingEndpointGroupResponse_endpointGroup :: (Maybe CustomRoutingEndpointGroup
 -> f (Maybe CustomRoutingEndpointGroup))
-> CreateCustomRoutingEndpointGroupResponse
-> f CreateCustomRoutingEndpointGroupResponse
createCustomRoutingEndpointGroupResponse_endpointGroup = (CreateCustomRoutingEndpointGroupResponse
 -> Maybe CustomRoutingEndpointGroup)
-> (CreateCustomRoutingEndpointGroupResponse
    -> Maybe CustomRoutingEndpointGroup
    -> CreateCustomRoutingEndpointGroupResponse)
-> Lens
     CreateCustomRoutingEndpointGroupResponse
     CreateCustomRoutingEndpointGroupResponse
     (Maybe CustomRoutingEndpointGroup)
     (Maybe CustomRoutingEndpointGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomRoutingEndpointGroupResponse' {Maybe CustomRoutingEndpointGroup
endpointGroup :: Maybe CustomRoutingEndpointGroup
$sel:endpointGroup:CreateCustomRoutingEndpointGroupResponse' :: CreateCustomRoutingEndpointGroupResponse
-> Maybe CustomRoutingEndpointGroup
endpointGroup} -> Maybe CustomRoutingEndpointGroup
endpointGroup) (\s :: CreateCustomRoutingEndpointGroupResponse
s@CreateCustomRoutingEndpointGroupResponse' {} Maybe CustomRoutingEndpointGroup
a -> CreateCustomRoutingEndpointGroupResponse
s {$sel:endpointGroup:CreateCustomRoutingEndpointGroupResponse' :: Maybe CustomRoutingEndpointGroup
endpointGroup = Maybe CustomRoutingEndpointGroup
a} :: CreateCustomRoutingEndpointGroupResponse)

-- | The response's http status code.
createCustomRoutingEndpointGroupResponse_httpStatus :: Lens.Lens' CreateCustomRoutingEndpointGroupResponse Prelude.Int
createCustomRoutingEndpointGroupResponse_httpStatus :: (Int -> f Int)
-> CreateCustomRoutingEndpointGroupResponse
-> f CreateCustomRoutingEndpointGroupResponse
createCustomRoutingEndpointGroupResponse_httpStatus = (CreateCustomRoutingEndpointGroupResponse -> Int)
-> (CreateCustomRoutingEndpointGroupResponse
    -> Int -> CreateCustomRoutingEndpointGroupResponse)
-> Lens
     CreateCustomRoutingEndpointGroupResponse
     CreateCustomRoutingEndpointGroupResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomRoutingEndpointGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateCustomRoutingEndpointGroupResponse' :: CreateCustomRoutingEndpointGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateCustomRoutingEndpointGroupResponse
s@CreateCustomRoutingEndpointGroupResponse' {} Int
a -> CreateCustomRoutingEndpointGroupResponse
s {$sel:httpStatus:CreateCustomRoutingEndpointGroupResponse' :: Int
httpStatus = Int
a} :: CreateCustomRoutingEndpointGroupResponse)

instance
  Prelude.NFData
    CreateCustomRoutingEndpointGroupResponse