{-# 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-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)
--
-- 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.Lens as Lens
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
(DisassociateContactFromAddressBook
 -> DisassociateContactFromAddressBook -> Bool)
-> (DisassociateContactFromAddressBook
    -> DisassociateContactFromAddressBook -> Bool)
-> Eq DisassociateContactFromAddressBook
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]
(Int -> ReadS DisassociateContactFromAddressBook)
-> ReadS [DisassociateContactFromAddressBook]
-> ReadPrec DisassociateContactFromAddressBook
-> ReadPrec [DisassociateContactFromAddressBook]
-> Read 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
(Int -> DisassociateContactFromAddressBook -> ShowS)
-> (DisassociateContactFromAddressBook -> String)
-> ([DisassociateContactFromAddressBook] -> ShowS)
-> Show DisassociateContactFromAddressBook
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.
 DisassociateContactFromAddressBook
 -> Rep DisassociateContactFromAddressBook x)
-> (forall x.
    Rep DisassociateContactFromAddressBook x
    -> DisassociateContactFromAddressBook)
-> Generic DisassociateContactFromAddressBook
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' :: Text -> Text -> DisassociateContactFromAddressBook
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 :: (Text -> f Text)
-> DisassociateContactFromAddressBook
-> f DisassociateContactFromAddressBook
disassociateContactFromAddressBook_contactArn = (DisassociateContactFromAddressBook -> Text)
-> (DisassociateContactFromAddressBook
    -> Text -> DisassociateContactFromAddressBook)
-> Lens
     DisassociateContactFromAddressBook
     DisassociateContactFromAddressBook
     Text
     Text
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 :: (Text -> f Text)
-> DisassociateContactFromAddressBook
-> f DisassociateContactFromAddressBook
disassociateContactFromAddressBook_addressBookArn = (DisassociateContactFromAddressBook -> Text)
-> (DisassociateContactFromAddressBook
    -> Text -> DisassociateContactFromAddressBook)
-> Lens
     DisassociateContactFromAddressBook
     DisassociateContactFromAddressBook
     Text
     Text
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 :: DisassociateContactFromAddressBook
-> Request DisassociateContactFromAddressBook
request = Service
-> DisassociateContactFromAddressBook
-> Request DisassociateContactFromAddressBook
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DisassociateContactFromAddressBook
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DisassociateContactFromAddressBook)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DisassociateContactFromAddressBook))
-> Logger
-> Service
-> Proxy DisassociateContactFromAddressBook
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DisassociateContactFromAddressBook)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DisassociateContactFromAddressBookResponse
DisassociateContactFromAddressBookResponse'
            (Int -> DisassociateContactFromAddressBookResponse)
-> Either String Int
-> Either String DisassociateContactFromAddressBookResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    DisassociateContactFromAddressBook

instance
  Prelude.NFData
    DisassociateContactFromAddressBook

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

instance
  Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ContactArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
contactArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AddressBookArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
addressBookArn)
          ]
      )

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

instance
  Core.ToQuery
    DisassociateContactFromAddressBook
  where
  toQuery :: DisassociateContactFromAddressBook -> QueryString
toQuery = QueryString -> DisassociateContactFromAddressBook -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DisassociateContactFromAddressBookResponse
 -> DisassociateContactFromAddressBookResponse -> Bool)
-> (DisassociateContactFromAddressBookResponse
    -> DisassociateContactFromAddressBookResponse -> Bool)
-> Eq DisassociateContactFromAddressBookResponse
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]
(Int -> ReadS DisassociateContactFromAddressBookResponse)
-> ReadS [DisassociateContactFromAddressBookResponse]
-> ReadPrec DisassociateContactFromAddressBookResponse
-> ReadPrec [DisassociateContactFromAddressBookResponse]
-> Read 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
(Int -> DisassociateContactFromAddressBookResponse -> ShowS)
-> (DisassociateContactFromAddressBookResponse -> String)
-> ([DisassociateContactFromAddressBookResponse] -> ShowS)
-> Show DisassociateContactFromAddressBookResponse
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.
 DisassociateContactFromAddressBookResponse
 -> Rep DisassociateContactFromAddressBookResponse x)
-> (forall x.
    Rep DisassociateContactFromAddressBookResponse x
    -> DisassociateContactFromAddressBookResponse)
-> Generic DisassociateContactFromAddressBookResponse
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' :: Int -> DisassociateContactFromAddressBookResponse
DisassociateContactFromAddressBookResponse'
      { $sel:httpStatus:DisassociateContactFromAddressBookResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

-- | The response's http status code.
disassociateContactFromAddressBookResponse_httpStatus :: Lens.Lens' DisassociateContactFromAddressBookResponse Prelude.Int
disassociateContactFromAddressBookResponse_httpStatus :: (Int -> f Int)
-> DisassociateContactFromAddressBookResponse
-> f DisassociateContactFromAddressBookResponse
disassociateContactFromAddressBookResponse_httpStatus = (DisassociateContactFromAddressBookResponse -> Int)
-> (DisassociateContactFromAddressBookResponse
    -> Int -> DisassociateContactFromAddressBookResponse)
-> Lens
     DisassociateContactFromAddressBookResponse
     DisassociateContactFromAddressBookResponse
     Int
     Int
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