{-# 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.DeleteEndpointGroup
-- 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)
--
-- Delete an endpoint group from a listener.
module Amazonka.GlobalAccelerator.DeleteEndpointGroup
  ( -- * Creating a Request
    DeleteEndpointGroup (..),
    newDeleteEndpointGroup,

    -- * Request Lenses
    deleteEndpointGroup_endpointGroupArn,

    -- * Destructuring the Response
    DeleteEndpointGroupResponse (..),
    newDeleteEndpointGroupResponse,
  )
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:/ 'newDeleteEndpointGroup' smart constructor.
data DeleteEndpointGroup = DeleteEndpointGroup'
  { -- | The Amazon Resource Name (ARN) of the endpoint group to delete.
    DeleteEndpointGroup -> Text
endpointGroupArn :: Prelude.Text
  }
  deriving (DeleteEndpointGroup -> DeleteEndpointGroup -> Bool
(DeleteEndpointGroup -> DeleteEndpointGroup -> Bool)
-> (DeleteEndpointGroup -> DeleteEndpointGroup -> Bool)
-> Eq DeleteEndpointGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEndpointGroup -> DeleteEndpointGroup -> Bool
$c/= :: DeleteEndpointGroup -> DeleteEndpointGroup -> Bool
== :: DeleteEndpointGroup -> DeleteEndpointGroup -> Bool
$c== :: DeleteEndpointGroup -> DeleteEndpointGroup -> Bool
Prelude.Eq, ReadPrec [DeleteEndpointGroup]
ReadPrec DeleteEndpointGroup
Int -> ReadS DeleteEndpointGroup
ReadS [DeleteEndpointGroup]
(Int -> ReadS DeleteEndpointGroup)
-> ReadS [DeleteEndpointGroup]
-> ReadPrec DeleteEndpointGroup
-> ReadPrec [DeleteEndpointGroup]
-> Read DeleteEndpointGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEndpointGroup]
$creadListPrec :: ReadPrec [DeleteEndpointGroup]
readPrec :: ReadPrec DeleteEndpointGroup
$creadPrec :: ReadPrec DeleteEndpointGroup
readList :: ReadS [DeleteEndpointGroup]
$creadList :: ReadS [DeleteEndpointGroup]
readsPrec :: Int -> ReadS DeleteEndpointGroup
$creadsPrec :: Int -> ReadS DeleteEndpointGroup
Prelude.Read, Int -> DeleteEndpointGroup -> ShowS
[DeleteEndpointGroup] -> ShowS
DeleteEndpointGroup -> String
(Int -> DeleteEndpointGroup -> ShowS)
-> (DeleteEndpointGroup -> String)
-> ([DeleteEndpointGroup] -> ShowS)
-> Show DeleteEndpointGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEndpointGroup] -> ShowS
$cshowList :: [DeleteEndpointGroup] -> ShowS
show :: DeleteEndpointGroup -> String
$cshow :: DeleteEndpointGroup -> String
showsPrec :: Int -> DeleteEndpointGroup -> ShowS
$cshowsPrec :: Int -> DeleteEndpointGroup -> ShowS
Prelude.Show, (forall x. DeleteEndpointGroup -> Rep DeleteEndpointGroup x)
-> (forall x. Rep DeleteEndpointGroup x -> DeleteEndpointGroup)
-> Generic DeleteEndpointGroup
forall x. Rep DeleteEndpointGroup x -> DeleteEndpointGroup
forall x. DeleteEndpointGroup -> Rep DeleteEndpointGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteEndpointGroup x -> DeleteEndpointGroup
$cfrom :: forall x. DeleteEndpointGroup -> Rep DeleteEndpointGroup x
Prelude.Generic)

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

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

instance Core.AWSRequest DeleteEndpointGroup where
  type
    AWSResponse DeleteEndpointGroup =
      DeleteEndpointGroupResponse
  request :: DeleteEndpointGroup -> Request DeleteEndpointGroup
request = Service -> DeleteEndpointGroup -> Request DeleteEndpointGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteEndpointGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteEndpointGroup)))
response =
    AWSResponse DeleteEndpointGroup
-> Logger
-> Service
-> Proxy DeleteEndpointGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteEndpointGroup)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteEndpointGroup
DeleteEndpointGroupResponse
DeleteEndpointGroupResponse'

instance Prelude.Hashable DeleteEndpointGroup

instance Prelude.NFData DeleteEndpointGroup

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

instance Core.ToJSON DeleteEndpointGroup where
  toJSON :: DeleteEndpointGroup -> Value
toJSON DeleteEndpointGroup' {Text
endpointGroupArn :: Text
$sel:endpointGroupArn:DeleteEndpointGroup' :: DeleteEndpointGroup -> 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
"EndpointGroupArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
endpointGroupArn)
          ]
      )

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

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

-- | /See:/ 'newDeleteEndpointGroupResponse' smart constructor.
data DeleteEndpointGroupResponse = DeleteEndpointGroupResponse'
  {
  }
  deriving (DeleteEndpointGroupResponse -> DeleteEndpointGroupResponse -> Bool
(DeleteEndpointGroupResponse
 -> DeleteEndpointGroupResponse -> Bool)
-> (DeleteEndpointGroupResponse
    -> DeleteEndpointGroupResponse -> Bool)
-> Eq DeleteEndpointGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEndpointGroupResponse -> DeleteEndpointGroupResponse -> Bool
$c/= :: DeleteEndpointGroupResponse -> DeleteEndpointGroupResponse -> Bool
== :: DeleteEndpointGroupResponse -> DeleteEndpointGroupResponse -> Bool
$c== :: DeleteEndpointGroupResponse -> DeleteEndpointGroupResponse -> Bool
Prelude.Eq, ReadPrec [DeleteEndpointGroupResponse]
ReadPrec DeleteEndpointGroupResponse
Int -> ReadS DeleteEndpointGroupResponse
ReadS [DeleteEndpointGroupResponse]
(Int -> ReadS DeleteEndpointGroupResponse)
-> ReadS [DeleteEndpointGroupResponse]
-> ReadPrec DeleteEndpointGroupResponse
-> ReadPrec [DeleteEndpointGroupResponse]
-> Read DeleteEndpointGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEndpointGroupResponse]
$creadListPrec :: ReadPrec [DeleteEndpointGroupResponse]
readPrec :: ReadPrec DeleteEndpointGroupResponse
$creadPrec :: ReadPrec DeleteEndpointGroupResponse
readList :: ReadS [DeleteEndpointGroupResponse]
$creadList :: ReadS [DeleteEndpointGroupResponse]
readsPrec :: Int -> ReadS DeleteEndpointGroupResponse
$creadsPrec :: Int -> ReadS DeleteEndpointGroupResponse
Prelude.Read, Int -> DeleteEndpointGroupResponse -> ShowS
[DeleteEndpointGroupResponse] -> ShowS
DeleteEndpointGroupResponse -> String
(Int -> DeleteEndpointGroupResponse -> ShowS)
-> (DeleteEndpointGroupResponse -> String)
-> ([DeleteEndpointGroupResponse] -> ShowS)
-> Show DeleteEndpointGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEndpointGroupResponse] -> ShowS
$cshowList :: [DeleteEndpointGroupResponse] -> ShowS
show :: DeleteEndpointGroupResponse -> String
$cshow :: DeleteEndpointGroupResponse -> String
showsPrec :: Int -> DeleteEndpointGroupResponse -> ShowS
$cshowsPrec :: Int -> DeleteEndpointGroupResponse -> ShowS
Prelude.Show, (forall x.
 DeleteEndpointGroupResponse -> Rep DeleteEndpointGroupResponse x)
-> (forall x.
    Rep DeleteEndpointGroupResponse x -> DeleteEndpointGroupResponse)
-> Generic DeleteEndpointGroupResponse
forall x.
Rep DeleteEndpointGroupResponse x -> DeleteEndpointGroupResponse
forall x.
DeleteEndpointGroupResponse -> Rep DeleteEndpointGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteEndpointGroupResponse x -> DeleteEndpointGroupResponse
$cfrom :: forall x.
DeleteEndpointGroupResponse -> Rep DeleteEndpointGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteEndpointGroupResponse' 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.
newDeleteEndpointGroupResponse ::
  DeleteEndpointGroupResponse
newDeleteEndpointGroupResponse :: DeleteEndpointGroupResponse
newDeleteEndpointGroupResponse =
  DeleteEndpointGroupResponse
DeleteEndpointGroupResponse'

instance Prelude.NFData DeleteEndpointGroupResponse