{-# 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.Account.DeleteAlternateContact
-- 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 alternate contact from an Amazon Web Services
-- account.
--
-- For complete details about how to use the alternate contact operations,
-- see
-- <https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-update-contact.html Access or updating the alternate contacts>.
--
-- Before you can update the alternate contact information for an Amazon
-- Web Services account that is managed by Organizations, you must first
-- enable integration between Amazon Web Services Account Management and
-- Organizations. For more information, see
-- <https://docs.aws.amazon.com/accounts/latest/reference/using-orgs-trusted-access.html Enabling trusted access for Amazon Web Services Account Management>.
module Amazonka.Account.DeleteAlternateContact
  ( -- * Creating a Request
    DeleteAlternateContact (..),
    newDeleteAlternateContact,

    -- * Request Lenses
    deleteAlternateContact_accountId,
    deleteAlternateContact_alternateContactType,

    -- * Destructuring the Response
    DeleteAlternateContactResponse (..),
    newDeleteAlternateContactResponse,
  )
where

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

-- | /See:/ 'newDeleteAlternateContact' smart constructor.
data DeleteAlternateContact = DeleteAlternateContact'
  { -- | Specifies the 12 digit account ID number of the Amazon Web Services
    -- account that you want to access or modify with this operation.
    --
    -- If you do not specify this parameter, it defaults to the Amazon Web
    -- Services account of the identity used to call the operation.
    --
    -- To use this parameter, the caller must be an identity in the
    -- <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html#account organization\'s management account>
    -- or a delegated administrator account, and the specified account ID must
    -- be a member account in the same organization. The organization must have
    -- <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_org_support-all-features.html all features enabled>,
    -- and the organization must have
    -- <https://docs.aws.amazon.com/organizations/latest/userguide/using-orgs-trusted-access.html trusted access>
    -- enabled for the Account Management service, and optionally a
    -- <https://docs.aws.amazon.com/organizations/latest/userguide/using-orgs-delegated-admin.html delegated admin>
    -- account assigned.
    --
    -- The management account can\'t specify its own @AccountId@; it must call
    -- the operation in standalone context by not including the @AccountId@
    -- parameter.
    --
    -- To call this operation on an account that is not a member of an
    -- organization, then don\'t specify this parameter, and call the operation
    -- using an identity belonging to the account whose contacts you wish to
    -- retrieve or modify.
    DeleteAlternateContact -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | Specifies which of the alternate contacts to delete.
    DeleteAlternateContact -> AlternateContactType
alternateContactType :: AlternateContactType
  }
  deriving (DeleteAlternateContact -> DeleteAlternateContact -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAlternateContact -> DeleteAlternateContact -> Bool
$c/= :: DeleteAlternateContact -> DeleteAlternateContact -> Bool
== :: DeleteAlternateContact -> DeleteAlternateContact -> Bool
$c== :: DeleteAlternateContact -> DeleteAlternateContact -> Bool
Prelude.Eq, ReadPrec [DeleteAlternateContact]
ReadPrec DeleteAlternateContact
Int -> ReadS DeleteAlternateContact
ReadS [DeleteAlternateContact]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAlternateContact]
$creadListPrec :: ReadPrec [DeleteAlternateContact]
readPrec :: ReadPrec DeleteAlternateContact
$creadPrec :: ReadPrec DeleteAlternateContact
readList :: ReadS [DeleteAlternateContact]
$creadList :: ReadS [DeleteAlternateContact]
readsPrec :: Int -> ReadS DeleteAlternateContact
$creadsPrec :: Int -> ReadS DeleteAlternateContact
Prelude.Read, Int -> DeleteAlternateContact -> ShowS
[DeleteAlternateContact] -> ShowS
DeleteAlternateContact -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAlternateContact] -> ShowS
$cshowList :: [DeleteAlternateContact] -> ShowS
show :: DeleteAlternateContact -> String
$cshow :: DeleteAlternateContact -> String
showsPrec :: Int -> DeleteAlternateContact -> ShowS
$cshowsPrec :: Int -> DeleteAlternateContact -> ShowS
Prelude.Show, forall x. Rep DeleteAlternateContact x -> DeleteAlternateContact
forall x. DeleteAlternateContact -> Rep DeleteAlternateContact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteAlternateContact x -> DeleteAlternateContact
$cfrom :: forall x. DeleteAlternateContact -> Rep DeleteAlternateContact x
Prelude.Generic)

-- |
-- Create a value of 'DeleteAlternateContact' 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:
--
-- 'accountId', 'deleteAlternateContact_accountId' - Specifies the 12 digit account ID number of the Amazon Web Services
-- account that you want to access or modify with this operation.
--
-- If you do not specify this parameter, it defaults to the Amazon Web
-- Services account of the identity used to call the operation.
--
-- To use this parameter, the caller must be an identity in the
-- <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html#account organization\'s management account>
-- or a delegated administrator account, and the specified account ID must
-- be a member account in the same organization. The organization must have
-- <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_org_support-all-features.html all features enabled>,
-- and the organization must have
-- <https://docs.aws.amazon.com/organizations/latest/userguide/using-orgs-trusted-access.html trusted access>
-- enabled for the Account Management service, and optionally a
-- <https://docs.aws.amazon.com/organizations/latest/userguide/using-orgs-delegated-admin.html delegated admin>
-- account assigned.
--
-- The management account can\'t specify its own @AccountId@; it must call
-- the operation in standalone context by not including the @AccountId@
-- parameter.
--
-- To call this operation on an account that is not a member of an
-- organization, then don\'t specify this parameter, and call the operation
-- using an identity belonging to the account whose contacts you wish to
-- retrieve or modify.
--
-- 'alternateContactType', 'deleteAlternateContact_alternateContactType' - Specifies which of the alternate contacts to delete.
newDeleteAlternateContact ::
  -- | 'alternateContactType'
  AlternateContactType ->
  DeleteAlternateContact
newDeleteAlternateContact :: AlternateContactType -> DeleteAlternateContact
newDeleteAlternateContact AlternateContactType
pAlternateContactType_ =
  DeleteAlternateContact'
    { $sel:accountId:DeleteAlternateContact' :: Maybe Text
accountId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:alternateContactType:DeleteAlternateContact' :: AlternateContactType
alternateContactType = AlternateContactType
pAlternateContactType_
    }

-- | Specifies the 12 digit account ID number of the Amazon Web Services
-- account that you want to access or modify with this operation.
--
-- If you do not specify this parameter, it defaults to the Amazon Web
-- Services account of the identity used to call the operation.
--
-- To use this parameter, the caller must be an identity in the
-- <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html#account organization\'s management account>
-- or a delegated administrator account, and the specified account ID must
-- be a member account in the same organization. The organization must have
-- <https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_org_support-all-features.html all features enabled>,
-- and the organization must have
-- <https://docs.aws.amazon.com/organizations/latest/userguide/using-orgs-trusted-access.html trusted access>
-- enabled for the Account Management service, and optionally a
-- <https://docs.aws.amazon.com/organizations/latest/userguide/using-orgs-delegated-admin.html delegated admin>
-- account assigned.
--
-- The management account can\'t specify its own @AccountId@; it must call
-- the operation in standalone context by not including the @AccountId@
-- parameter.
--
-- To call this operation on an account that is not a member of an
-- organization, then don\'t specify this parameter, and call the operation
-- using an identity belonging to the account whose contacts you wish to
-- retrieve or modify.
deleteAlternateContact_accountId :: Lens.Lens' DeleteAlternateContact (Prelude.Maybe Prelude.Text)
deleteAlternateContact_accountId :: Lens' DeleteAlternateContact (Maybe Text)
deleteAlternateContact_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAlternateContact' {Maybe Text
accountId :: Maybe Text
$sel:accountId:DeleteAlternateContact' :: DeleteAlternateContact -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: DeleteAlternateContact
s@DeleteAlternateContact' {} Maybe Text
a -> DeleteAlternateContact
s {$sel:accountId:DeleteAlternateContact' :: Maybe Text
accountId = Maybe Text
a} :: DeleteAlternateContact)

-- | Specifies which of the alternate contacts to delete.
deleteAlternateContact_alternateContactType :: Lens.Lens' DeleteAlternateContact AlternateContactType
deleteAlternateContact_alternateContactType :: Lens' DeleteAlternateContact AlternateContactType
deleteAlternateContact_alternateContactType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAlternateContact' {AlternateContactType
alternateContactType :: AlternateContactType
$sel:alternateContactType:DeleteAlternateContact' :: DeleteAlternateContact -> AlternateContactType
alternateContactType} -> AlternateContactType
alternateContactType) (\s :: DeleteAlternateContact
s@DeleteAlternateContact' {} AlternateContactType
a -> DeleteAlternateContact
s {$sel:alternateContactType:DeleteAlternateContact' :: AlternateContactType
alternateContactType = AlternateContactType
a} :: DeleteAlternateContact)

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

instance Prelude.Hashable DeleteAlternateContact where
  hashWithSalt :: Int -> DeleteAlternateContact -> Int
hashWithSalt Int
_salt DeleteAlternateContact' {Maybe Text
AlternateContactType
alternateContactType :: AlternateContactType
accountId :: Maybe Text
$sel:alternateContactType:DeleteAlternateContact' :: DeleteAlternateContact -> AlternateContactType
$sel:accountId:DeleteAlternateContact' :: DeleteAlternateContact -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AlternateContactType
alternateContactType

instance Prelude.NFData DeleteAlternateContact where
  rnf :: DeleteAlternateContact -> ()
rnf DeleteAlternateContact' {Maybe Text
AlternateContactType
alternateContactType :: AlternateContactType
accountId :: Maybe Text
$sel:alternateContactType:DeleteAlternateContact' :: DeleteAlternateContact -> AlternateContactType
$sel:accountId:DeleteAlternateContact' :: DeleteAlternateContact -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf AlternateContactType
alternateContactType

instance Data.ToHeaders DeleteAlternateContact where
  toHeaders :: DeleteAlternateContact -> [Header]
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteAlternateContact where
  toJSON :: DeleteAlternateContact -> Value
toJSON DeleteAlternateContact' {Maybe Text
AlternateContactType
alternateContactType :: AlternateContactType
accountId :: Maybe Text
$sel:alternateContactType:DeleteAlternateContact' :: DeleteAlternateContact -> AlternateContactType
$sel:accountId:DeleteAlternateContact' :: DeleteAlternateContact -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AccountId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
accountId,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"AlternateContactType"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= AlternateContactType
alternateContactType
              )
          ]
      )

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

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

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

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

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