{-# 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-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 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>.
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.Lens as Lens
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
(DeleteAlternateContact -> DeleteAlternateContact -> Bool)
-> (DeleteAlternateContact -> DeleteAlternateContact -> Bool)
-> Eq DeleteAlternateContact
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]
(Int -> ReadS DeleteAlternateContact)
-> ReadS [DeleteAlternateContact]
-> ReadPrec DeleteAlternateContact
-> ReadPrec [DeleteAlternateContact]
-> Read 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
(Int -> DeleteAlternateContact -> ShowS)
-> (DeleteAlternateContact -> String)
-> ([DeleteAlternateContact] -> ShowS)
-> Show DeleteAlternateContact
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. DeleteAlternateContact -> Rep DeleteAlternateContact x)
-> (forall x.
    Rep DeleteAlternateContact x -> DeleteAlternateContact)
-> Generic DeleteAlternateContact
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' :: Maybe Text -> AlternateContactType -> DeleteAlternateContact
DeleteAlternateContact'
    { $sel:accountId:DeleteAlternateContact' :: Maybe Text
accountId =
        Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> DeleteAlternateContact -> f DeleteAlternateContact
deleteAlternateContact_accountId = (DeleteAlternateContact -> Maybe Text)
-> (DeleteAlternateContact -> Maybe Text -> DeleteAlternateContact)
-> Lens
     DeleteAlternateContact
     DeleteAlternateContact
     (Maybe Text)
     (Maybe Text)
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 :: (AlternateContactType -> f AlternateContactType)
-> DeleteAlternateContact -> f DeleteAlternateContact
deleteAlternateContact_alternateContactType = (DeleteAlternateContact -> AlternateContactType)
-> (DeleteAlternateContact
    -> AlternateContactType -> DeleteAlternateContact)
-> Lens
     DeleteAlternateContact
     DeleteAlternateContact
     AlternateContactType
     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 :: DeleteAlternateContact -> Request DeleteAlternateContact
request = Service -> DeleteAlternateContact -> Request DeleteAlternateContact
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteAlternateContact
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteAlternateContact)))
response =
    AWSResponse DeleteAlternateContact
-> Logger
-> Service
-> Proxy DeleteAlternateContact
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteAlternateContact)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse DeleteAlternateContact
DeleteAlternateContactResponse
DeleteAlternateContactResponse'

instance Prelude.Hashable DeleteAlternateContact

instance Prelude.NFData DeleteAlternateContact

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

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AccountId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
accountId,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"AlternateContactType"
                  Text -> AlternateContactType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AlternateContactType
alternateContactType
              )
          ]
      )

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

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

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