{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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 Identity and access management>
-- in the /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 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:/ '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
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]
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
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.
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'
    { $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 :: Lens' DeleteCustomRoutingAccelerator Text
deleteCustomRoutingAccelerator_acceleratorArn = 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 :: (Service -> Service)
-> DeleteCustomRoutingAccelerator
-> Request DeleteCustomRoutingAccelerator
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 DeleteCustomRoutingAccelerator
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DeleteCustomRoutingAccelerator)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      DeleteCustomRoutingAcceleratorResponse
DeleteCustomRoutingAcceleratorResponse'

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

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

instance
  Data.ToHeaders
    DeleteCustomRoutingAccelerator
  where
  toHeaders :: DeleteCustomRoutingAccelerator -> [Header]
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 -> [Header]
Data.=# ( ByteString
"GlobalAccelerator_V20180706.DeleteCustomRoutingAccelerator" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

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

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

-- | /See:/ 'newDeleteCustomRoutingAcceleratorResponse' smart constructor.
data DeleteCustomRoutingAcceleratorResponse = DeleteCustomRoutingAcceleratorResponse'
  {
  }
  deriving (DeleteCustomRoutingAcceleratorResponse
-> DeleteCustomRoutingAcceleratorResponse -> Bool
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]
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
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.
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
  where
  rnf :: DeleteCustomRoutingAcceleratorResponse -> ()
rnf DeleteCustomRoutingAcceleratorResponse
_ = ()