{-# 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.CreateAccountAlias
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates an alias for your Amazon Web Services account. 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.CreateAccountAlias
  ( -- * Creating a Request
    CreateAccountAlias (..),
    newCreateAccountAlias,

    -- * Request Lenses
    createAccountAlias_accountAlias,

    -- * Destructuring the Response
    CreateAccountAliasResponse (..),
    newCreateAccountAliasResponse,
  )
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:/ 'newCreateAccountAlias' smart constructor.
data CreateAccountAlias = CreateAccountAlias'
  { -- | The account alias to create.
    --
    -- 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.
    CreateAccountAlias -> Text
accountAlias :: Prelude.Text
  }
  deriving (CreateAccountAlias -> CreateAccountAlias -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAccountAlias -> CreateAccountAlias -> Bool
$c/= :: CreateAccountAlias -> CreateAccountAlias -> Bool
== :: CreateAccountAlias -> CreateAccountAlias -> Bool
$c== :: CreateAccountAlias -> CreateAccountAlias -> Bool
Prelude.Eq, ReadPrec [CreateAccountAlias]
ReadPrec CreateAccountAlias
Int -> ReadS CreateAccountAlias
ReadS [CreateAccountAlias]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAccountAlias]
$creadListPrec :: ReadPrec [CreateAccountAlias]
readPrec :: ReadPrec CreateAccountAlias
$creadPrec :: ReadPrec CreateAccountAlias
readList :: ReadS [CreateAccountAlias]
$creadList :: ReadS [CreateAccountAlias]
readsPrec :: Int -> ReadS CreateAccountAlias
$creadsPrec :: Int -> ReadS CreateAccountAlias
Prelude.Read, Int -> CreateAccountAlias -> ShowS
[CreateAccountAlias] -> ShowS
CreateAccountAlias -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAccountAlias] -> ShowS
$cshowList :: [CreateAccountAlias] -> ShowS
show :: CreateAccountAlias -> String
$cshow :: CreateAccountAlias -> String
showsPrec :: Int -> CreateAccountAlias -> ShowS
$cshowsPrec :: Int -> CreateAccountAlias -> ShowS
Prelude.Show, forall x. Rep CreateAccountAlias x -> CreateAccountAlias
forall x. CreateAccountAlias -> Rep CreateAccountAlias x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAccountAlias x -> CreateAccountAlias
$cfrom :: forall x. CreateAccountAlias -> Rep CreateAccountAlias x
Prelude.Generic)

-- |
-- Create a value of 'CreateAccountAlias' 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', 'createAccountAlias_accountAlias' - The account alias to create.
--
-- 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.
newCreateAccountAlias ::
  -- | 'accountAlias'
  Prelude.Text ->
  CreateAccountAlias
newCreateAccountAlias :: Text -> CreateAccountAlias
newCreateAccountAlias Text
pAccountAlias_ =
  CreateAccountAlias' {$sel:accountAlias:CreateAccountAlias' :: Text
accountAlias = Text
pAccountAlias_}

-- | The account alias to create.
--
-- 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.
createAccountAlias_accountAlias :: Lens.Lens' CreateAccountAlias Prelude.Text
createAccountAlias_accountAlias :: Lens' CreateAccountAlias Text
createAccountAlias_accountAlias = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccountAlias' {Text
accountAlias :: Text
$sel:accountAlias:CreateAccountAlias' :: CreateAccountAlias -> Text
accountAlias} -> Text
accountAlias) (\s :: CreateAccountAlias
s@CreateAccountAlias' {} Text
a -> CreateAccountAlias
s {$sel:accountAlias:CreateAccountAlias' :: Text
accountAlias = Text
a} :: CreateAccountAlias)

instance Core.AWSRequest CreateAccountAlias where
  type
    AWSResponse CreateAccountAlias =
      CreateAccountAliasResponse
  request :: (Service -> Service)
-> CreateAccountAlias -> Request CreateAccountAlias
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 CreateAccountAlias
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateAccountAlias)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull CreateAccountAliasResponse
CreateAccountAliasResponse'

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

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

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

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

instance Data.ToQuery CreateAccountAlias where
  toQuery :: CreateAccountAlias -> QueryString
toQuery CreateAccountAlias' {Text
accountAlias :: Text
$sel:accountAlias:CreateAccountAlias' :: CreateAccountAlias -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"CreateAccountAlias" :: 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:/ 'newCreateAccountAliasResponse' smart constructor.
data CreateAccountAliasResponse = CreateAccountAliasResponse'
  {
  }
  deriving (CreateAccountAliasResponse -> CreateAccountAliasResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAccountAliasResponse -> CreateAccountAliasResponse -> Bool
$c/= :: CreateAccountAliasResponse -> CreateAccountAliasResponse -> Bool
== :: CreateAccountAliasResponse -> CreateAccountAliasResponse -> Bool
$c== :: CreateAccountAliasResponse -> CreateAccountAliasResponse -> Bool
Prelude.Eq, ReadPrec [CreateAccountAliasResponse]
ReadPrec CreateAccountAliasResponse
Int -> ReadS CreateAccountAliasResponse
ReadS [CreateAccountAliasResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAccountAliasResponse]
$creadListPrec :: ReadPrec [CreateAccountAliasResponse]
readPrec :: ReadPrec CreateAccountAliasResponse
$creadPrec :: ReadPrec CreateAccountAliasResponse
readList :: ReadS [CreateAccountAliasResponse]
$creadList :: ReadS [CreateAccountAliasResponse]
readsPrec :: Int -> ReadS CreateAccountAliasResponse
$creadsPrec :: Int -> ReadS CreateAccountAliasResponse
Prelude.Read, Int -> CreateAccountAliasResponse -> ShowS
[CreateAccountAliasResponse] -> ShowS
CreateAccountAliasResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAccountAliasResponse] -> ShowS
$cshowList :: [CreateAccountAliasResponse] -> ShowS
show :: CreateAccountAliasResponse -> String
$cshow :: CreateAccountAliasResponse -> String
showsPrec :: Int -> CreateAccountAliasResponse -> ShowS
$cshowsPrec :: Int -> CreateAccountAliasResponse -> ShowS
Prelude.Show, forall x.
Rep CreateAccountAliasResponse x -> CreateAccountAliasResponse
forall x.
CreateAccountAliasResponse -> Rep CreateAccountAliasResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateAccountAliasResponse x -> CreateAccountAliasResponse
$cfrom :: forall x.
CreateAccountAliasResponse -> Rep CreateAccountAliasResponse x
Prelude.Generic)

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

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