{-# 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-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)
--
-- 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 Amazonka.IAM.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:/ '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
(DeleteAccountAlias -> DeleteAccountAlias -> Bool)
-> (DeleteAccountAlias -> DeleteAccountAlias -> Bool)
-> Eq DeleteAccountAlias
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]
(Int -> ReadS DeleteAccountAlias)
-> ReadS [DeleteAccountAlias]
-> ReadPrec DeleteAccountAlias
-> ReadPrec [DeleteAccountAlias]
-> Read 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
(Int -> DeleteAccountAlias -> ShowS)
-> (DeleteAccountAlias -> String)
-> ([DeleteAccountAlias] -> ShowS)
-> Show DeleteAccountAlias
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. DeleteAccountAlias -> Rep DeleteAccountAlias x)
-> (forall x. Rep DeleteAccountAlias x -> DeleteAccountAlias)
-> Generic DeleteAccountAlias
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' :: Text -> DeleteAccountAlias
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 :: (Text -> f Text) -> DeleteAccountAlias -> f DeleteAccountAlias
deleteAccountAlias_accountAlias = (DeleteAccountAlias -> Text)
-> (DeleteAccountAlias -> Text -> DeleteAccountAlias)
-> Lens DeleteAccountAlias DeleteAccountAlias Text Text
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 :: DeleteAccountAlias -> Request DeleteAccountAlias
request = Service -> DeleteAccountAlias -> Request DeleteAccountAlias
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteAccountAlias
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteAccountAlias)))
response =
    AWSResponse DeleteAccountAlias
-> Logger
-> Service
-> Proxy DeleteAccountAlias
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteAccountAlias)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteAccountAlias
DeleteAccountAliasResponse
DeleteAccountAliasResponse'

instance Prelude.Hashable DeleteAccountAlias

instance Prelude.NFData DeleteAccountAlias

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

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

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

-- | /See:/ 'newDeleteAccountAliasResponse' smart constructor.
data DeleteAccountAliasResponse = DeleteAccountAliasResponse'
  {
  }
  deriving (DeleteAccountAliasResponse -> DeleteAccountAliasResponse -> Bool
(DeleteAccountAliasResponse -> DeleteAccountAliasResponse -> Bool)
-> (DeleteAccountAliasResponse
    -> DeleteAccountAliasResponse -> Bool)
-> Eq DeleteAccountAliasResponse
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]
(Int -> ReadS DeleteAccountAliasResponse)
-> ReadS [DeleteAccountAliasResponse]
-> ReadPrec DeleteAccountAliasResponse
-> ReadPrec [DeleteAccountAliasResponse]
-> Read 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
(Int -> DeleteAccountAliasResponse -> ShowS)
-> (DeleteAccountAliasResponse -> String)
-> ([DeleteAccountAliasResponse] -> ShowS)
-> Show DeleteAccountAliasResponse
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.
 DeleteAccountAliasResponse -> Rep DeleteAccountAliasResponse x)
-> (forall x.
    Rep DeleteAccountAliasResponse x -> DeleteAccountAliasResponse)
-> Generic DeleteAccountAliasResponse
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