{-# 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.DeleteCustomRoutingAccelerator
-- 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 a custom routing accelerator. Before you can delete an
-- accelerator, you must disable it and remove all dependent resources
-- (listeners and endpoint groups). To disable the accelerator, update the
-- accelerator to set @Enabled@ to false.
--
-- When you create a custom routing accelerator, by default, Global
-- Accelerator provides you with a set of two static IP addresses.
--
-- The IP addresses are assigned to your accelerator for as long as it
-- exists, even if you disable the accelerator and it no longer accepts or
-- routes traffic. However, when you /delete/ an accelerator, you lose the
-- static IP addresses that are assigned to the accelerator, so you can no
-- longer route traffic by using them. As a best practice, ensure that you
-- have permissions in place to avoid inadvertently deleting accelerators.
-- You can use IAM policies with Global Accelerator to limit the users who
-- have permissions to delete an accelerator. For more information, see
-- <https://docs.aws.amazon.com/global-accelerator/latest/dg/auth-and-access-control.html Authentication and Access Control>
-- in the /AWS Global Accelerator Developer Guide/.
module Amazonka.GlobalAccelerator.DeleteCustomRoutingAccelerator
  ( -- * Creating a Request
    DeleteCustomRoutingAccelerator (..),
    newDeleteCustomRoutingAccelerator,

    -- * Request Lenses
    deleteCustomRoutingAccelerator_acceleratorArn,

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

-- |
-- Create a value of 'DeleteCustomRoutingAccelerator' 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:
--
-- 'acceleratorArn', 'deleteCustomRoutingAccelerator_acceleratorArn' - The Amazon Resource Name (ARN) of the custom routing accelerator to
-- delete.
newDeleteCustomRoutingAccelerator ::
  -- | 'acceleratorArn'
  Prelude.Text ->
  DeleteCustomRoutingAccelerator
newDeleteCustomRoutingAccelerator :: Text -> DeleteCustomRoutingAccelerator
newDeleteCustomRoutingAccelerator Text
pAcceleratorArn_ =
  DeleteCustomRoutingAccelerator' :: Text -> DeleteCustomRoutingAccelerator
DeleteCustomRoutingAccelerator'
    { $sel:acceleratorArn:DeleteCustomRoutingAccelerator' :: Text
acceleratorArn =
        Text
pAcceleratorArn_
    }

-- | The Amazon Resource Name (ARN) of the custom routing accelerator to
-- delete.
deleteCustomRoutingAccelerator_acceleratorArn :: Lens.Lens' DeleteCustomRoutingAccelerator Prelude.Text
deleteCustomRoutingAccelerator_acceleratorArn :: (Text -> f Text)
-> DeleteCustomRoutingAccelerator
-> f DeleteCustomRoutingAccelerator
deleteCustomRoutingAccelerator_acceleratorArn = (DeleteCustomRoutingAccelerator -> Text)
-> (DeleteCustomRoutingAccelerator
    -> Text -> DeleteCustomRoutingAccelerator)
-> Lens
     DeleteCustomRoutingAccelerator
     DeleteCustomRoutingAccelerator
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCustomRoutingAccelerator' {Text
acceleratorArn :: Text
$sel:acceleratorArn:DeleteCustomRoutingAccelerator' :: DeleteCustomRoutingAccelerator -> Text
acceleratorArn} -> Text
acceleratorArn) (\s :: DeleteCustomRoutingAccelerator
s@DeleteCustomRoutingAccelerator' {} Text
a -> DeleteCustomRoutingAccelerator
s {$sel:acceleratorArn:DeleteCustomRoutingAccelerator' :: Text
acceleratorArn = Text
a} :: DeleteCustomRoutingAccelerator)

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

instance
  Prelude.Hashable
    DeleteCustomRoutingAccelerator

instance
  Prelude.NFData
    DeleteCustomRoutingAccelerator

instance
  Core.ToHeaders
    DeleteCustomRoutingAccelerator
  where
  toHeaders :: DeleteCustomRoutingAccelerator -> [Header]
toHeaders =
    [Header] -> DeleteCustomRoutingAccelerator -> [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.DeleteCustomRoutingAccelerator" ::
                          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 DeleteCustomRoutingAccelerator where
  toJSON :: DeleteCustomRoutingAccelerator -> Value
toJSON DeleteCustomRoutingAccelerator' {Text
acceleratorArn :: Text
$sel:acceleratorArn:DeleteCustomRoutingAccelerator' :: DeleteCustomRoutingAccelerator -> 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
"AcceleratorArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
acceleratorArn)
          ]
      )

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

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

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

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

instance
  Prelude.NFData
    DeleteCustomRoutingAcceleratorResponse