{-# 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.IAM.DeleteAccountAlias
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes the specified Amazon Web Services account alias. For information
-- about using an Amazon Web Services account alias, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/AccountAlias.html Using an alias for your Amazon Web Services account ID>
-- in the /IAM User Guide/.
module Amazonka.IAM.DeleteAccountAlias
  ( -- * Creating a Request
    DeleteAccountAlias (..),
    newDeleteAccountAlias,

    -- * Request Lenses
    deleteAccountAlias_accountAlias,

    -- * Destructuring the Response
    DeleteAccountAliasResponse (..),
    newDeleteAccountAliasResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IAM.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteAccountAlias' smart constructor.
data DeleteAccountAlias = DeleteAccountAlias'
  { -- | The name of the account alias to delete.
    --
    -- This parameter allows (through its
    -- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
    -- consisting of lowercase letters, digits, and dashes. You cannot start or
    -- finish with a dash, nor can you have two dashes in a row.
    DeleteAccountAlias -> Text
accountAlias :: Prelude.Text
  }
  deriving (DeleteAccountAlias -> DeleteAccountAlias -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAccountAlias -> DeleteAccountAlias -> Bool
$c/= :: DeleteAccountAlias -> DeleteAccountAlias -> Bool
== :: DeleteAccountAlias -> DeleteAccountAlias -> Bool
$c== :: DeleteAccountAlias -> DeleteAccountAlias -> Bool
Prelude.Eq, ReadPrec [DeleteAccountAlias]
ReadPrec DeleteAccountAlias
Int -> ReadS DeleteAccountAlias
ReadS [DeleteAccountAlias]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAccountAlias]
$creadListPrec :: ReadPrec [DeleteAccountAlias]
readPrec :: ReadPrec DeleteAccountAlias
$creadPrec :: ReadPrec DeleteAccountAlias
readList :: ReadS [DeleteAccountAlias]
$creadList :: ReadS [DeleteAccountAlias]
readsPrec :: Int -> ReadS DeleteAccountAlias
$creadsPrec :: Int -> ReadS DeleteAccountAlias
Prelude.Read, Int -> DeleteAccountAlias -> ShowS
[DeleteAccountAlias] -> ShowS
DeleteAccountAlias -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAccountAlias] -> ShowS
$cshowList :: [DeleteAccountAlias] -> ShowS
show :: DeleteAccountAlias -> String
$cshow :: DeleteAccountAlias -> String
showsPrec :: Int -> DeleteAccountAlias -> ShowS
$cshowsPrec :: Int -> DeleteAccountAlias -> ShowS
Prelude.Show, forall x. Rep DeleteAccountAlias x -> DeleteAccountAlias
forall x. DeleteAccountAlias -> Rep DeleteAccountAlias x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteAccountAlias x -> DeleteAccountAlias
$cfrom :: forall x. DeleteAccountAlias -> Rep DeleteAccountAlias x
Prelude.Generic)

-- |
-- Create a value of 'DeleteAccountAlias' 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:
--
-- 'accountAlias', 'deleteAccountAlias_accountAlias' - The name of the account alias to delete.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of lowercase letters, digits, and dashes. You cannot start or
-- finish with a dash, nor can you have two dashes in a row.
newDeleteAccountAlias ::
  -- | 'accountAlias'
  Prelude.Text ->
  DeleteAccountAlias
newDeleteAccountAlias :: Text -> DeleteAccountAlias
newDeleteAccountAlias Text
pAccountAlias_ =
  DeleteAccountAlias' {$sel:accountAlias:DeleteAccountAlias' :: Text
accountAlias = Text
pAccountAlias_}

-- | The name of the account alias to delete.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of lowercase letters, digits, and dashes. You cannot start or
-- finish with a dash, nor can you have two dashes in a row.
deleteAccountAlias_accountAlias :: Lens.Lens' DeleteAccountAlias Prelude.Text
deleteAccountAlias_accountAlias :: Lens' DeleteAccountAlias Text
deleteAccountAlias_accountAlias = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAccountAlias' {Text
accountAlias :: Text
$sel:accountAlias:DeleteAccountAlias' :: DeleteAccountAlias -> Text
accountAlias} -> Text
accountAlias) (\s :: DeleteAccountAlias
s@DeleteAccountAlias' {} Text
a -> DeleteAccountAlias
s {$sel:accountAlias:DeleteAccountAlias' :: Text
accountAlias = Text
a} :: DeleteAccountAlias)

instance Core.AWSRequest DeleteAccountAlias where
  type
    AWSResponse DeleteAccountAlias =
      DeleteAccountAliasResponse
  request :: (Service -> Service)
-> DeleteAccountAlias -> Request DeleteAccountAlias
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteAccountAlias
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteAccountAlias)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DeleteAccountAliasResponse
DeleteAccountAliasResponse'

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

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

instance Data.ToHeaders DeleteAccountAlias where
  toHeaders :: DeleteAccountAlias -> [Header]
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery DeleteAccountAlias where
  toQuery :: DeleteAccountAlias -> QueryString
toQuery DeleteAccountAlias' {Text
accountAlias :: Text
$sel:accountAlias:DeleteAccountAlias' :: DeleteAccountAlias -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DeleteAccountAlias" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
        ByteString
"AccountAlias" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
accountAlias
      ]

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

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

instance Prelude.NFData DeleteAccountAliasResponse where
  rnf :: DeleteAccountAliasResponse -> ()
rnf DeleteAccountAliasResponse
_ = ()