{-# 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.Chime.DisassociatePhoneNumberFromUser
-- 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 the primary provisioned phone number from the specified
-- Amazon Chime user.
module Amazonka.Chime.DisassociatePhoneNumberFromUser
  ( -- * Creating a Request
    DisassociatePhoneNumberFromUser (..),
    newDisassociatePhoneNumberFromUser,

    -- * Request Lenses
    disassociatePhoneNumberFromUser_accountId,
    disassociatePhoneNumberFromUser_userId,

    -- * Destructuring the Response
    DisassociatePhoneNumberFromUserResponse (..),
    newDisassociatePhoneNumberFromUserResponse,

    -- * Response Lenses
    disassociatePhoneNumberFromUserResponse_httpStatus,
  )
where

import Amazonka.Chime.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:/ 'newDisassociatePhoneNumberFromUser' smart constructor.
data DisassociatePhoneNumberFromUser = DisassociatePhoneNumberFromUser'
  { -- | The Amazon Chime account ID.
    DisassociatePhoneNumberFromUser -> Text
accountId :: Prelude.Text,
    -- | The user ID.
    DisassociatePhoneNumberFromUser -> Text
userId :: Prelude.Text
  }
  deriving (DisassociatePhoneNumberFromUser
-> DisassociatePhoneNumberFromUser -> Bool
(DisassociatePhoneNumberFromUser
 -> DisassociatePhoneNumberFromUser -> Bool)
-> (DisassociatePhoneNumberFromUser
    -> DisassociatePhoneNumberFromUser -> Bool)
-> Eq DisassociatePhoneNumberFromUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociatePhoneNumberFromUser
-> DisassociatePhoneNumberFromUser -> Bool
$c/= :: DisassociatePhoneNumberFromUser
-> DisassociatePhoneNumberFromUser -> Bool
== :: DisassociatePhoneNumberFromUser
-> DisassociatePhoneNumberFromUser -> Bool
$c== :: DisassociatePhoneNumberFromUser
-> DisassociatePhoneNumberFromUser -> Bool
Prelude.Eq, ReadPrec [DisassociatePhoneNumberFromUser]
ReadPrec DisassociatePhoneNumberFromUser
Int -> ReadS DisassociatePhoneNumberFromUser
ReadS [DisassociatePhoneNumberFromUser]
(Int -> ReadS DisassociatePhoneNumberFromUser)
-> ReadS [DisassociatePhoneNumberFromUser]
-> ReadPrec DisassociatePhoneNumberFromUser
-> ReadPrec [DisassociatePhoneNumberFromUser]
-> Read DisassociatePhoneNumberFromUser
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociatePhoneNumberFromUser]
$creadListPrec :: ReadPrec [DisassociatePhoneNumberFromUser]
readPrec :: ReadPrec DisassociatePhoneNumberFromUser
$creadPrec :: ReadPrec DisassociatePhoneNumberFromUser
readList :: ReadS [DisassociatePhoneNumberFromUser]
$creadList :: ReadS [DisassociatePhoneNumberFromUser]
readsPrec :: Int -> ReadS DisassociatePhoneNumberFromUser
$creadsPrec :: Int -> ReadS DisassociatePhoneNumberFromUser
Prelude.Read, Int -> DisassociatePhoneNumberFromUser -> ShowS
[DisassociatePhoneNumberFromUser] -> ShowS
DisassociatePhoneNumberFromUser -> String
(Int -> DisassociatePhoneNumberFromUser -> ShowS)
-> (DisassociatePhoneNumberFromUser -> String)
-> ([DisassociatePhoneNumberFromUser] -> ShowS)
-> Show DisassociatePhoneNumberFromUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociatePhoneNumberFromUser] -> ShowS
$cshowList :: [DisassociatePhoneNumberFromUser] -> ShowS
show :: DisassociatePhoneNumberFromUser -> String
$cshow :: DisassociatePhoneNumberFromUser -> String
showsPrec :: Int -> DisassociatePhoneNumberFromUser -> ShowS
$cshowsPrec :: Int -> DisassociatePhoneNumberFromUser -> ShowS
Prelude.Show, (forall x.
 DisassociatePhoneNumberFromUser
 -> Rep DisassociatePhoneNumberFromUser x)
-> (forall x.
    Rep DisassociatePhoneNumberFromUser x
    -> DisassociatePhoneNumberFromUser)
-> Generic DisassociatePhoneNumberFromUser
forall x.
Rep DisassociatePhoneNumberFromUser x
-> DisassociatePhoneNumberFromUser
forall x.
DisassociatePhoneNumberFromUser
-> Rep DisassociatePhoneNumberFromUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociatePhoneNumberFromUser x
-> DisassociatePhoneNumberFromUser
$cfrom :: forall x.
DisassociatePhoneNumberFromUser
-> Rep DisassociatePhoneNumberFromUser x
Prelude.Generic)

-- |
-- Create a value of 'DisassociatePhoneNumberFromUser' 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', 'disassociatePhoneNumberFromUser_accountId' - The Amazon Chime account ID.
--
-- 'userId', 'disassociatePhoneNumberFromUser_userId' - The user ID.
newDisassociatePhoneNumberFromUser ::
  -- | 'accountId'
  Prelude.Text ->
  -- | 'userId'
  Prelude.Text ->
  DisassociatePhoneNumberFromUser
newDisassociatePhoneNumberFromUser :: Text -> Text -> DisassociatePhoneNumberFromUser
newDisassociatePhoneNumberFromUser
  Text
pAccountId_
  Text
pUserId_ =
    DisassociatePhoneNumberFromUser' :: Text -> Text -> DisassociatePhoneNumberFromUser
DisassociatePhoneNumberFromUser'
      { $sel:accountId:DisassociatePhoneNumberFromUser' :: Text
accountId =
          Text
pAccountId_,
        $sel:userId:DisassociatePhoneNumberFromUser' :: Text
userId = Text
pUserId_
      }

-- | The Amazon Chime account ID.
disassociatePhoneNumberFromUser_accountId :: Lens.Lens' DisassociatePhoneNumberFromUser Prelude.Text
disassociatePhoneNumberFromUser_accountId :: (Text -> f Text)
-> DisassociatePhoneNumberFromUser
-> f DisassociatePhoneNumberFromUser
disassociatePhoneNumberFromUser_accountId = (DisassociatePhoneNumberFromUser -> Text)
-> (DisassociatePhoneNumberFromUser
    -> Text -> DisassociatePhoneNumberFromUser)
-> Lens
     DisassociatePhoneNumberFromUser
     DisassociatePhoneNumberFromUser
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociatePhoneNumberFromUser' {Text
accountId :: Text
$sel:accountId:DisassociatePhoneNumberFromUser' :: DisassociatePhoneNumberFromUser -> Text
accountId} -> Text
accountId) (\s :: DisassociatePhoneNumberFromUser
s@DisassociatePhoneNumberFromUser' {} Text
a -> DisassociatePhoneNumberFromUser
s {$sel:accountId:DisassociatePhoneNumberFromUser' :: Text
accountId = Text
a} :: DisassociatePhoneNumberFromUser)

-- | The user ID.
disassociatePhoneNumberFromUser_userId :: Lens.Lens' DisassociatePhoneNumberFromUser Prelude.Text
disassociatePhoneNumberFromUser_userId :: (Text -> f Text)
-> DisassociatePhoneNumberFromUser
-> f DisassociatePhoneNumberFromUser
disassociatePhoneNumberFromUser_userId = (DisassociatePhoneNumberFromUser -> Text)
-> (DisassociatePhoneNumberFromUser
    -> Text -> DisassociatePhoneNumberFromUser)
-> Lens
     DisassociatePhoneNumberFromUser
     DisassociatePhoneNumberFromUser
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociatePhoneNumberFromUser' {Text
userId :: Text
$sel:userId:DisassociatePhoneNumberFromUser' :: DisassociatePhoneNumberFromUser -> Text
userId} -> Text
userId) (\s :: DisassociatePhoneNumberFromUser
s@DisassociatePhoneNumberFromUser' {} Text
a -> DisassociatePhoneNumberFromUser
s {$sel:userId:DisassociatePhoneNumberFromUser' :: Text
userId = Text
a} :: DisassociatePhoneNumberFromUser)

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

instance
  Prelude.NFData
    DisassociatePhoneNumberFromUser

instance
  Core.ToHeaders
    DisassociatePhoneNumberFromUser
  where
  toHeaders :: DisassociatePhoneNumberFromUser -> ResponseHeaders
toHeaders = ResponseHeaders
-> DisassociatePhoneNumberFromUser -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON DisassociatePhoneNumberFromUser where
  toJSON :: DisassociatePhoneNumberFromUser -> Value
toJSON = Value -> DisassociatePhoneNumberFromUser -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

instance Core.ToPath DisassociatePhoneNumberFromUser where
  toPath :: DisassociatePhoneNumberFromUser -> ByteString
toPath DisassociatePhoneNumberFromUser' {Text
userId :: Text
accountId :: Text
$sel:userId:DisassociatePhoneNumberFromUser' :: DisassociatePhoneNumberFromUser -> Text
$sel:accountId:DisassociatePhoneNumberFromUser' :: DisassociatePhoneNumberFromUser -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/accounts/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
accountId,
        ByteString
"/users/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
userId
      ]

instance Core.ToQuery DisassociatePhoneNumberFromUser where
  toQuery :: DisassociatePhoneNumberFromUser -> QueryString
toQuery =
    QueryString -> DisassociatePhoneNumberFromUser -> QueryString
forall a b. a -> b -> a
Prelude.const
      ( [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [QueryString
"operation=disassociate-phone-number"]
      )

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

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

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

instance
  Prelude.NFData
    DisassociatePhoneNumberFromUserResponse