{-# 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.DescribeCustomRoutingEndpointGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describe an endpoint group for a custom routing accelerator.
module Amazonka.GlobalAccelerator.DescribeCustomRoutingEndpointGroup
  ( -- * Creating a Request
    DescribeCustomRoutingEndpointGroup (..),
    newDescribeCustomRoutingEndpointGroup,

    -- * Request Lenses
    describeCustomRoutingEndpointGroup_endpointGroupArn,

    -- * Destructuring the Response
    DescribeCustomRoutingEndpointGroupResponse (..),
    newDescribeCustomRoutingEndpointGroupResponse,

    -- * Response Lenses
    describeCustomRoutingEndpointGroupResponse_endpointGroup,
    describeCustomRoutingEndpointGroupResponse_httpStatus,
  )
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
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeCustomRoutingEndpointGroup' smart constructor.
data DescribeCustomRoutingEndpointGroup = DescribeCustomRoutingEndpointGroup'
  { -- | The Amazon Resource Name (ARN) of the endpoint group to describe.
    DescribeCustomRoutingEndpointGroup -> Text
endpointGroupArn :: Prelude.Text
  }
  deriving (DescribeCustomRoutingEndpointGroup
-> DescribeCustomRoutingEndpointGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCustomRoutingEndpointGroup
-> DescribeCustomRoutingEndpointGroup -> Bool
$c/= :: DescribeCustomRoutingEndpointGroup
-> DescribeCustomRoutingEndpointGroup -> Bool
== :: DescribeCustomRoutingEndpointGroup
-> DescribeCustomRoutingEndpointGroup -> Bool
$c== :: DescribeCustomRoutingEndpointGroup
-> DescribeCustomRoutingEndpointGroup -> Bool
Prelude.Eq, ReadPrec [DescribeCustomRoutingEndpointGroup]
ReadPrec DescribeCustomRoutingEndpointGroup
Int -> ReadS DescribeCustomRoutingEndpointGroup
ReadS [DescribeCustomRoutingEndpointGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCustomRoutingEndpointGroup]
$creadListPrec :: ReadPrec [DescribeCustomRoutingEndpointGroup]
readPrec :: ReadPrec DescribeCustomRoutingEndpointGroup
$creadPrec :: ReadPrec DescribeCustomRoutingEndpointGroup
readList :: ReadS [DescribeCustomRoutingEndpointGroup]
$creadList :: ReadS [DescribeCustomRoutingEndpointGroup]
readsPrec :: Int -> ReadS DescribeCustomRoutingEndpointGroup
$creadsPrec :: Int -> ReadS DescribeCustomRoutingEndpointGroup
Prelude.Read, Int -> DescribeCustomRoutingEndpointGroup -> ShowS
[DescribeCustomRoutingEndpointGroup] -> ShowS
DescribeCustomRoutingEndpointGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCustomRoutingEndpointGroup] -> ShowS
$cshowList :: [DescribeCustomRoutingEndpointGroup] -> ShowS
show :: DescribeCustomRoutingEndpointGroup -> String
$cshow :: DescribeCustomRoutingEndpointGroup -> String
showsPrec :: Int -> DescribeCustomRoutingEndpointGroup -> ShowS
$cshowsPrec :: Int -> DescribeCustomRoutingEndpointGroup -> ShowS
Prelude.Show, forall x.
Rep DescribeCustomRoutingEndpointGroup x
-> DescribeCustomRoutingEndpointGroup
forall x.
DescribeCustomRoutingEndpointGroup
-> Rep DescribeCustomRoutingEndpointGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCustomRoutingEndpointGroup x
-> DescribeCustomRoutingEndpointGroup
$cfrom :: forall x.
DescribeCustomRoutingEndpointGroup
-> Rep DescribeCustomRoutingEndpointGroup x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCustomRoutingEndpointGroup' 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:
--
-- 'endpointGroupArn', 'describeCustomRoutingEndpointGroup_endpointGroupArn' - The Amazon Resource Name (ARN) of the endpoint group to describe.
newDescribeCustomRoutingEndpointGroup ::
  -- | 'endpointGroupArn'
  Prelude.Text ->
  DescribeCustomRoutingEndpointGroup
newDescribeCustomRoutingEndpointGroup :: Text -> DescribeCustomRoutingEndpointGroup
newDescribeCustomRoutingEndpointGroup
  Text
pEndpointGroupArn_ =
    DescribeCustomRoutingEndpointGroup'
      { $sel:endpointGroupArn:DescribeCustomRoutingEndpointGroup' :: Text
endpointGroupArn =
          Text
pEndpointGroupArn_
      }

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

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

instance
  Prelude.Hashable
    DescribeCustomRoutingEndpointGroup
  where
  hashWithSalt :: Int -> DescribeCustomRoutingEndpointGroup -> Int
hashWithSalt
    Int
_salt
    DescribeCustomRoutingEndpointGroup' {Text
endpointGroupArn :: Text
$sel:endpointGroupArn:DescribeCustomRoutingEndpointGroup' :: DescribeCustomRoutingEndpointGroup -> Text
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
endpointGroupArn

instance
  Prelude.NFData
    DescribeCustomRoutingEndpointGroup
  where
  rnf :: DescribeCustomRoutingEndpointGroup -> ()
rnf DescribeCustomRoutingEndpointGroup' {Text
endpointGroupArn :: Text
$sel:endpointGroupArn:DescribeCustomRoutingEndpointGroup' :: DescribeCustomRoutingEndpointGroup -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
endpointGroupArn

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

instance
  Data.ToJSON
    DescribeCustomRoutingEndpointGroup
  where
  toJSON :: DescribeCustomRoutingEndpointGroup -> Value
toJSON DescribeCustomRoutingEndpointGroup' {Text
endpointGroupArn :: Text
$sel:endpointGroupArn:DescribeCustomRoutingEndpointGroup' :: DescribeCustomRoutingEndpointGroup -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"EndpointGroupArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
endpointGroupArn)
          ]
      )

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

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

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

-- |
-- Create a value of 'DescribeCustomRoutingEndpointGroupResponse' 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', 'describeCustomRoutingEndpointGroupResponse_endpointGroup' - The description of an endpoint group for a custom routing accelerator.
--
-- 'httpStatus', 'describeCustomRoutingEndpointGroupResponse_httpStatus' - The response's http status code.
newDescribeCustomRoutingEndpointGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeCustomRoutingEndpointGroupResponse
newDescribeCustomRoutingEndpointGroupResponse :: Int -> DescribeCustomRoutingEndpointGroupResponse
newDescribeCustomRoutingEndpointGroupResponse
  Int
pHttpStatus_ =
    DescribeCustomRoutingEndpointGroupResponse'
      { $sel:endpointGroup:DescribeCustomRoutingEndpointGroupResponse' :: Maybe CustomRoutingEndpointGroup
endpointGroup =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeCustomRoutingEndpointGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The description of an endpoint group for a custom routing accelerator.
describeCustomRoutingEndpointGroupResponse_endpointGroup :: Lens.Lens' DescribeCustomRoutingEndpointGroupResponse (Prelude.Maybe CustomRoutingEndpointGroup)
describeCustomRoutingEndpointGroupResponse_endpointGroup :: Lens'
  DescribeCustomRoutingEndpointGroupResponse
  (Maybe CustomRoutingEndpointGroup)
describeCustomRoutingEndpointGroupResponse_endpointGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCustomRoutingEndpointGroupResponse' {Maybe CustomRoutingEndpointGroup
endpointGroup :: Maybe CustomRoutingEndpointGroup
$sel:endpointGroup:DescribeCustomRoutingEndpointGroupResponse' :: DescribeCustomRoutingEndpointGroupResponse
-> Maybe CustomRoutingEndpointGroup
endpointGroup} -> Maybe CustomRoutingEndpointGroup
endpointGroup) (\s :: DescribeCustomRoutingEndpointGroupResponse
s@DescribeCustomRoutingEndpointGroupResponse' {} Maybe CustomRoutingEndpointGroup
a -> DescribeCustomRoutingEndpointGroupResponse
s {$sel:endpointGroup:DescribeCustomRoutingEndpointGroupResponse' :: Maybe CustomRoutingEndpointGroup
endpointGroup = Maybe CustomRoutingEndpointGroup
a} :: DescribeCustomRoutingEndpointGroupResponse)

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

instance
  Prelude.NFData
    DescribeCustomRoutingEndpointGroupResponse
  where
  rnf :: DescribeCustomRoutingEndpointGroupResponse -> ()
rnf DescribeCustomRoutingEndpointGroupResponse' {Int
Maybe CustomRoutingEndpointGroup
httpStatus :: Int
endpointGroup :: Maybe CustomRoutingEndpointGroup
$sel:httpStatus:DescribeCustomRoutingEndpointGroupResponse' :: DescribeCustomRoutingEndpointGroupResponse -> Int
$sel:endpointGroup:DescribeCustomRoutingEndpointGroupResponse' :: DescribeCustomRoutingEndpointGroupResponse
-> Maybe CustomRoutingEndpointGroup
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CustomRoutingEndpointGroup
endpointGroup
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus