{-# 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.AlexaBusiness.DisassociateContactFromAddressBook
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Disassociates a contact from a given address book.
module Amazonka.AlexaBusiness.DisassociateContactFromAddressBook
  ( -- * Creating a Request
    DisassociateContactFromAddressBook (..),
    newDisassociateContactFromAddressBook,

    -- * Request Lenses
    disassociateContactFromAddressBook_contactArn,
    disassociateContactFromAddressBook_addressBookArn,

    -- * Destructuring the Response
    DisassociateContactFromAddressBookResponse (..),
    newDisassociateContactFromAddressBookResponse,

    -- * Response Lenses
    disassociateContactFromAddressBookResponse_httpStatus,
  )
where

import Amazonka.AlexaBusiness.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:/ 'newDisassociateContactFromAddressBook' smart constructor.
data DisassociateContactFromAddressBook = DisassociateContactFromAddressBook'
  { -- | The ARN of the contact to disassociate from an address book.
    DisassociateContactFromAddressBook -> Text
contactArn :: Prelude.Text,
    -- | The ARN of the address from which to disassociate the contact.
    DisassociateContactFromAddressBook -> Text
addressBookArn :: Prelude.Text
  }
  deriving (DisassociateContactFromAddressBook
-> DisassociateContactFromAddressBook -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateContactFromAddressBook
-> DisassociateContactFromAddressBook -> Bool
$c/= :: DisassociateContactFromAddressBook
-> DisassociateContactFromAddressBook -> Bool
== :: DisassociateContactFromAddressBook
-> DisassociateContactFromAddressBook -> Bool
$c== :: DisassociateContactFromAddressBook
-> DisassociateContactFromAddressBook -> Bool
Prelude.Eq, ReadPrec [DisassociateContactFromAddressBook]
ReadPrec DisassociateContactFromAddressBook
Int -> ReadS DisassociateContactFromAddressBook
ReadS [DisassociateContactFromAddressBook]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateContactFromAddressBook]
$creadListPrec :: ReadPrec [DisassociateContactFromAddressBook]
readPrec :: ReadPrec DisassociateContactFromAddressBook
$creadPrec :: ReadPrec DisassociateContactFromAddressBook
readList :: ReadS [DisassociateContactFromAddressBook]
$creadList :: ReadS [DisassociateContactFromAddressBook]
readsPrec :: Int -> ReadS DisassociateContactFromAddressBook
$creadsPrec :: Int -> ReadS DisassociateContactFromAddressBook
Prelude.Read, Int -> DisassociateContactFromAddressBook -> ShowS
[DisassociateContactFromAddressBook] -> ShowS
DisassociateContactFromAddressBook -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateContactFromAddressBook] -> ShowS
$cshowList :: [DisassociateContactFromAddressBook] -> ShowS
show :: DisassociateContactFromAddressBook -> String
$cshow :: DisassociateContactFromAddressBook -> String
showsPrec :: Int -> DisassociateContactFromAddressBook -> ShowS
$cshowsPrec :: Int -> DisassociateContactFromAddressBook -> ShowS
Prelude.Show, forall x.
Rep DisassociateContactFromAddressBook x
-> DisassociateContactFromAddressBook
forall x.
DisassociateContactFromAddressBook
-> Rep DisassociateContactFromAddressBook x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateContactFromAddressBook x
-> DisassociateContactFromAddressBook
$cfrom :: forall x.
DisassociateContactFromAddressBook
-> Rep DisassociateContactFromAddressBook x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateContactFromAddressBook' 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:
--
-- 'contactArn', 'disassociateContactFromAddressBook_contactArn' - The ARN of the contact to disassociate from an address book.
--
-- 'addressBookArn', 'disassociateContactFromAddressBook_addressBookArn' - The ARN of the address from which to disassociate the contact.
newDisassociateContactFromAddressBook ::
  -- | 'contactArn'
  Prelude.Text ->
  -- | 'addressBookArn'
  Prelude.Text ->
  DisassociateContactFromAddressBook
newDisassociateContactFromAddressBook :: Text -> Text -> DisassociateContactFromAddressBook
newDisassociateContactFromAddressBook
  Text
pContactArn_
  Text
pAddressBookArn_ =
    DisassociateContactFromAddressBook'
      { $sel:contactArn:DisassociateContactFromAddressBook' :: Text
contactArn =
          Text
pContactArn_,
        $sel:addressBookArn:DisassociateContactFromAddressBook' :: Text
addressBookArn = Text
pAddressBookArn_
      }

-- | The ARN of the contact to disassociate from an address book.
disassociateContactFromAddressBook_contactArn :: Lens.Lens' DisassociateContactFromAddressBook Prelude.Text
disassociateContactFromAddressBook_contactArn :: Lens' DisassociateContactFromAddressBook Text
disassociateContactFromAddressBook_contactArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateContactFromAddressBook' {Text
contactArn :: Text
$sel:contactArn:DisassociateContactFromAddressBook' :: DisassociateContactFromAddressBook -> Text
contactArn} -> Text
contactArn) (\s :: DisassociateContactFromAddressBook
s@DisassociateContactFromAddressBook' {} Text
a -> DisassociateContactFromAddressBook
s {$sel:contactArn:DisassociateContactFromAddressBook' :: Text
contactArn = Text
a} :: DisassociateContactFromAddressBook)

-- | The ARN of the address from which to disassociate the contact.
disassociateContactFromAddressBook_addressBookArn :: Lens.Lens' DisassociateContactFromAddressBook Prelude.Text
disassociateContactFromAddressBook_addressBookArn :: Lens' DisassociateContactFromAddressBook Text
disassociateContactFromAddressBook_addressBookArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateContactFromAddressBook' {Text
addressBookArn :: Text
$sel:addressBookArn:DisassociateContactFromAddressBook' :: DisassociateContactFromAddressBook -> Text
addressBookArn} -> Text
addressBookArn) (\s :: DisassociateContactFromAddressBook
s@DisassociateContactFromAddressBook' {} Text
a -> DisassociateContactFromAddressBook
s {$sel:addressBookArn:DisassociateContactFromAddressBook' :: Text
addressBookArn = Text
a} :: DisassociateContactFromAddressBook)

instance
  Core.AWSRequest
    DisassociateContactFromAddressBook
  where
  type
    AWSResponse DisassociateContactFromAddressBook =
      DisassociateContactFromAddressBookResponse
  request :: (Service -> Service)
-> DisassociateContactFromAddressBook
-> Request DisassociateContactFromAddressBook
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 DisassociateContactFromAddressBook
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DisassociateContactFromAddressBook)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DisassociateContactFromAddressBookResponse
DisassociateContactFromAddressBookResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

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

instance
  Prelude.NFData
    DisassociateContactFromAddressBook
  where
  rnf :: DisassociateContactFromAddressBook -> ()
rnf DisassociateContactFromAddressBook' {Text
addressBookArn :: Text
contactArn :: Text
$sel:addressBookArn:DisassociateContactFromAddressBook' :: DisassociateContactFromAddressBook -> Text
$sel:contactArn:DisassociateContactFromAddressBook' :: DisassociateContactFromAddressBook -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
contactArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
addressBookArn

instance
  Data.ToHeaders
    DisassociateContactFromAddressBook
  where
  toHeaders :: DisassociateContactFromAddressBook -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AlexaForBusiness.DisassociateContactFromAddressBook" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance
  Data.ToJSON
    DisassociateContactFromAddressBook
  where
  toJSON :: DisassociateContactFromAddressBook -> Value
toJSON DisassociateContactFromAddressBook' {Text
addressBookArn :: Text
contactArn :: Text
$sel:addressBookArn:DisassociateContactFromAddressBook' :: DisassociateContactFromAddressBook -> Text
$sel:contactArn:DisassociateContactFromAddressBook' :: DisassociateContactFromAddressBook -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"ContactArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
contactArn),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"AddressBookArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
addressBookArn)
          ]
      )

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

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

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

-- |
-- Create a value of 'DisassociateContactFromAddressBookResponse' 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:
--
-- 'httpStatus', 'disassociateContactFromAddressBookResponse_httpStatus' - The response's http status code.
newDisassociateContactFromAddressBookResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DisassociateContactFromAddressBookResponse
newDisassociateContactFromAddressBookResponse :: Int -> DisassociateContactFromAddressBookResponse
newDisassociateContactFromAddressBookResponse
  Int
pHttpStatus_ =
    DisassociateContactFromAddressBookResponse'
      { $sel:httpStatus:DisassociateContactFromAddressBookResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

-- | The response's http status code.
disassociateContactFromAddressBookResponse_httpStatus :: Lens.Lens' DisassociateContactFromAddressBookResponse Prelude.Int
disassociateContactFromAddressBookResponse_httpStatus :: Lens' DisassociateContactFromAddressBookResponse Int
disassociateContactFromAddressBookResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateContactFromAddressBookResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisassociateContactFromAddressBookResponse' :: DisassociateContactFromAddressBookResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DisassociateContactFromAddressBookResponse
s@DisassociateContactFromAddressBookResponse' {} Int
a -> DisassociateContactFromAddressBookResponse
s {$sel:httpStatus:DisassociateContactFromAddressBookResponse' :: Int
httpStatus = Int
a} :: DisassociateContactFromAddressBookResponse)

instance
  Prelude.NFData
    DisassociateContactFromAddressBookResponse
  where
  rnf :: DisassociateContactFromAddressBookResponse -> ()
rnf DisassociateContactFromAddressBookResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisassociateContactFromAddressBookResponse' :: DisassociateContactFromAddressBookResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus