{-# 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.DeleteAddressBook
-- 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 an address book by the address book ARN.
module Amazonka.AlexaBusiness.DeleteAddressBook
  ( -- * Creating a Request
    DeleteAddressBook (..),
    newDeleteAddressBook,

    -- * Request Lenses
    deleteAddressBook_addressBookArn,

    -- * Destructuring the Response
    DeleteAddressBookResponse (..),
    newDeleteAddressBookResponse,

    -- * Response Lenses
    deleteAddressBookResponse_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:/ 'newDeleteAddressBook' smart constructor.
data DeleteAddressBook = DeleteAddressBook'
  { -- | The ARN of the address book to delete.
    DeleteAddressBook -> Text
addressBookArn :: Prelude.Text
  }
  deriving (DeleteAddressBook -> DeleteAddressBook -> Bool
(DeleteAddressBook -> DeleteAddressBook -> Bool)
-> (DeleteAddressBook -> DeleteAddressBook -> Bool)
-> Eq DeleteAddressBook
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAddressBook -> DeleteAddressBook -> Bool
$c/= :: DeleteAddressBook -> DeleteAddressBook -> Bool
== :: DeleteAddressBook -> DeleteAddressBook -> Bool
$c== :: DeleteAddressBook -> DeleteAddressBook -> Bool
Prelude.Eq, ReadPrec [DeleteAddressBook]
ReadPrec DeleteAddressBook
Int -> ReadS DeleteAddressBook
ReadS [DeleteAddressBook]
(Int -> ReadS DeleteAddressBook)
-> ReadS [DeleteAddressBook]
-> ReadPrec DeleteAddressBook
-> ReadPrec [DeleteAddressBook]
-> Read DeleteAddressBook
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAddressBook]
$creadListPrec :: ReadPrec [DeleteAddressBook]
readPrec :: ReadPrec DeleteAddressBook
$creadPrec :: ReadPrec DeleteAddressBook
readList :: ReadS [DeleteAddressBook]
$creadList :: ReadS [DeleteAddressBook]
readsPrec :: Int -> ReadS DeleteAddressBook
$creadsPrec :: Int -> ReadS DeleteAddressBook
Prelude.Read, Int -> DeleteAddressBook -> ShowS
[DeleteAddressBook] -> ShowS
DeleteAddressBook -> String
(Int -> DeleteAddressBook -> ShowS)
-> (DeleteAddressBook -> String)
-> ([DeleteAddressBook] -> ShowS)
-> Show DeleteAddressBook
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAddressBook] -> ShowS
$cshowList :: [DeleteAddressBook] -> ShowS
show :: DeleteAddressBook -> String
$cshow :: DeleteAddressBook -> String
showsPrec :: Int -> DeleteAddressBook -> ShowS
$cshowsPrec :: Int -> DeleteAddressBook -> ShowS
Prelude.Show, (forall x. DeleteAddressBook -> Rep DeleteAddressBook x)
-> (forall x. Rep DeleteAddressBook x -> DeleteAddressBook)
-> Generic DeleteAddressBook
forall x. Rep DeleteAddressBook x -> DeleteAddressBook
forall x. DeleteAddressBook -> Rep DeleteAddressBook x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteAddressBook x -> DeleteAddressBook
$cfrom :: forall x. DeleteAddressBook -> Rep DeleteAddressBook x
Prelude.Generic)

-- |
-- Create a value of 'DeleteAddressBook' 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:
--
-- 'addressBookArn', 'deleteAddressBook_addressBookArn' - The ARN of the address book to delete.
newDeleteAddressBook ::
  -- | 'addressBookArn'
  Prelude.Text ->
  DeleteAddressBook
newDeleteAddressBook :: Text -> DeleteAddressBook
newDeleteAddressBook Text
pAddressBookArn_ =
  DeleteAddressBook' :: Text -> DeleteAddressBook
DeleteAddressBook'
    { $sel:addressBookArn:DeleteAddressBook' :: Text
addressBookArn =
        Text
pAddressBookArn_
    }

-- | The ARN of the address book to delete.
deleteAddressBook_addressBookArn :: Lens.Lens' DeleteAddressBook Prelude.Text
deleteAddressBook_addressBookArn :: (Text -> f Text) -> DeleteAddressBook -> f DeleteAddressBook
deleteAddressBook_addressBookArn = (DeleteAddressBook -> Text)
-> (DeleteAddressBook -> Text -> DeleteAddressBook)
-> Lens DeleteAddressBook DeleteAddressBook Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAddressBook' {Text
addressBookArn :: Text
$sel:addressBookArn:DeleteAddressBook' :: DeleteAddressBook -> Text
addressBookArn} -> Text
addressBookArn) (\s :: DeleteAddressBook
s@DeleteAddressBook' {} Text
a -> DeleteAddressBook
s {$sel:addressBookArn:DeleteAddressBook' :: Text
addressBookArn = Text
a} :: DeleteAddressBook)

instance Core.AWSRequest DeleteAddressBook where
  type
    AWSResponse DeleteAddressBook =
      DeleteAddressBookResponse
  request :: DeleteAddressBook -> Request DeleteAddressBook
request = Service -> DeleteAddressBook -> Request DeleteAddressBook
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteAddressBook
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteAddressBook)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteAddressBook))
-> Logger
-> Service
-> Proxy DeleteAddressBook
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteAddressBook)))
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 -> DeleteAddressBookResponse
DeleteAddressBookResponse'
            (Int -> DeleteAddressBookResponse)
-> Either String Int -> Either String DeleteAddressBookResponse
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 DeleteAddressBook

instance Prelude.NFData DeleteAddressBook

instance Core.ToHeaders DeleteAddressBook where
  toHeaders :: DeleteAddressBook -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteAddressBook -> 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.DeleteAddressBook" ::
                          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 DeleteAddressBook where
  toJSON :: DeleteAddressBook -> Value
toJSON DeleteAddressBook' {Text
addressBookArn :: Text
$sel:addressBookArn:DeleteAddressBook' :: DeleteAddressBook -> 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
"AddressBookArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
addressBookArn)
          ]
      )

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

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

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

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

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

instance Prelude.NFData DeleteAddressBookResponse