{-# 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.Pinpoint.DeleteUserEndpoints
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes all the endpoints that are associated with a specific user ID.
module Amazonka.Pinpoint.DeleteUserEndpoints
  ( -- * Creating a Request
    DeleteUserEndpoints (..),
    newDeleteUserEndpoints,

    -- * Request Lenses
    deleteUserEndpoints_applicationId,
    deleteUserEndpoints_userId,

    -- * Destructuring the Response
    DeleteUserEndpointsResponse (..),
    newDeleteUserEndpointsResponse,

    -- * Response Lenses
    deleteUserEndpointsResponse_httpStatus,
    deleteUserEndpointsResponse_endpointsResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pinpoint.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteUserEndpoints' smart constructor.
data DeleteUserEndpoints = DeleteUserEndpoints'
  { -- | The unique identifier for the application. This identifier is displayed
    -- as the __Project ID__ on the Amazon Pinpoint console.
    DeleteUserEndpoints -> Text
applicationId :: Prelude.Text,
    -- | The unique identifier for the user.
    DeleteUserEndpoints -> Text
userId :: Prelude.Text
  }
  deriving (DeleteUserEndpoints -> DeleteUserEndpoints -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteUserEndpoints -> DeleteUserEndpoints -> Bool
$c/= :: DeleteUserEndpoints -> DeleteUserEndpoints -> Bool
== :: DeleteUserEndpoints -> DeleteUserEndpoints -> Bool
$c== :: DeleteUserEndpoints -> DeleteUserEndpoints -> Bool
Prelude.Eq, ReadPrec [DeleteUserEndpoints]
ReadPrec DeleteUserEndpoints
Int -> ReadS DeleteUserEndpoints
ReadS [DeleteUserEndpoints]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteUserEndpoints]
$creadListPrec :: ReadPrec [DeleteUserEndpoints]
readPrec :: ReadPrec DeleteUserEndpoints
$creadPrec :: ReadPrec DeleteUserEndpoints
readList :: ReadS [DeleteUserEndpoints]
$creadList :: ReadS [DeleteUserEndpoints]
readsPrec :: Int -> ReadS DeleteUserEndpoints
$creadsPrec :: Int -> ReadS DeleteUserEndpoints
Prelude.Read, Int -> DeleteUserEndpoints -> ShowS
[DeleteUserEndpoints] -> ShowS
DeleteUserEndpoints -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteUserEndpoints] -> ShowS
$cshowList :: [DeleteUserEndpoints] -> ShowS
show :: DeleteUserEndpoints -> String
$cshow :: DeleteUserEndpoints -> String
showsPrec :: Int -> DeleteUserEndpoints -> ShowS
$cshowsPrec :: Int -> DeleteUserEndpoints -> ShowS
Prelude.Show, forall x. Rep DeleteUserEndpoints x -> DeleteUserEndpoints
forall x. DeleteUserEndpoints -> Rep DeleteUserEndpoints x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteUserEndpoints x -> DeleteUserEndpoints
$cfrom :: forall x. DeleteUserEndpoints -> Rep DeleteUserEndpoints x
Prelude.Generic)

-- |
-- Create a value of 'DeleteUserEndpoints' 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:
--
-- 'applicationId', 'deleteUserEndpoints_applicationId' - The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
--
-- 'userId', 'deleteUserEndpoints_userId' - The unique identifier for the user.
newDeleteUserEndpoints ::
  -- | 'applicationId'
  Prelude.Text ->
  -- | 'userId'
  Prelude.Text ->
  DeleteUserEndpoints
newDeleteUserEndpoints :: Text -> Text -> DeleteUserEndpoints
newDeleteUserEndpoints Text
pApplicationId_ Text
pUserId_ =
  DeleteUserEndpoints'
    { $sel:applicationId:DeleteUserEndpoints' :: Text
applicationId =
        Text
pApplicationId_,
      $sel:userId:DeleteUserEndpoints' :: Text
userId = Text
pUserId_
    }

-- | The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
deleteUserEndpoints_applicationId :: Lens.Lens' DeleteUserEndpoints Prelude.Text
deleteUserEndpoints_applicationId :: Lens' DeleteUserEndpoints Text
deleteUserEndpoints_applicationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteUserEndpoints' {Text
applicationId :: Text
$sel:applicationId:DeleteUserEndpoints' :: DeleteUserEndpoints -> Text
applicationId} -> Text
applicationId) (\s :: DeleteUserEndpoints
s@DeleteUserEndpoints' {} Text
a -> DeleteUserEndpoints
s {$sel:applicationId:DeleteUserEndpoints' :: Text
applicationId = Text
a} :: DeleteUserEndpoints)

-- | The unique identifier for the user.
deleteUserEndpoints_userId :: Lens.Lens' DeleteUserEndpoints Prelude.Text
deleteUserEndpoints_userId :: Lens' DeleteUserEndpoints Text
deleteUserEndpoints_userId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteUserEndpoints' {Text
userId :: Text
$sel:userId:DeleteUserEndpoints' :: DeleteUserEndpoints -> Text
userId} -> Text
userId) (\s :: DeleteUserEndpoints
s@DeleteUserEndpoints' {} Text
a -> DeleteUserEndpoints
s {$sel:userId:DeleteUserEndpoints' :: Text
userId = Text
a} :: DeleteUserEndpoints)

instance Core.AWSRequest DeleteUserEndpoints where
  type
    AWSResponse DeleteUserEndpoints =
      DeleteUserEndpointsResponse
  request :: (Service -> Service)
-> DeleteUserEndpoints -> Request DeleteUserEndpoints
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteUserEndpoints
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteUserEndpoints)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> EndpointsResponse -> DeleteUserEndpointsResponse
DeleteUserEndpointsResponse'
            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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
      )

instance Prelude.Hashable DeleteUserEndpoints where
  hashWithSalt :: Int -> DeleteUserEndpoints -> Int
hashWithSalt Int
_salt DeleteUserEndpoints' {Text
userId :: Text
applicationId :: Text
$sel:userId:DeleteUserEndpoints' :: DeleteUserEndpoints -> Text
$sel:applicationId:DeleteUserEndpoints' :: DeleteUserEndpoints -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
userId

instance Prelude.NFData DeleteUserEndpoints where
  rnf :: DeleteUserEndpoints -> ()
rnf DeleteUserEndpoints' {Text
userId :: Text
applicationId :: Text
$sel:userId:DeleteUserEndpoints' :: DeleteUserEndpoints -> Text
$sel:applicationId:DeleteUserEndpoints' :: DeleteUserEndpoints -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
applicationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
userId

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

instance Data.ToPath DeleteUserEndpoints where
  toPath :: DeleteUserEndpoints -> ByteString
toPath DeleteUserEndpoints' {Text
userId :: Text
applicationId :: Text
$sel:userId:DeleteUserEndpoints' :: DeleteUserEndpoints -> Text
$sel:applicationId:DeleteUserEndpoints' :: DeleteUserEndpoints -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/apps/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
applicationId,
        ByteString
"/users/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
userId
      ]

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

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

-- |
-- Create a value of 'DeleteUserEndpointsResponse' 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', 'deleteUserEndpointsResponse_httpStatus' - The response's http status code.
--
-- 'endpointsResponse', 'deleteUserEndpointsResponse_endpointsResponse' - Undocumented member.
newDeleteUserEndpointsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'endpointsResponse'
  EndpointsResponse ->
  DeleteUserEndpointsResponse
newDeleteUserEndpointsResponse :: Int -> EndpointsResponse -> DeleteUserEndpointsResponse
newDeleteUserEndpointsResponse
  Int
pHttpStatus_
  EndpointsResponse
pEndpointsResponse_ =
    DeleteUserEndpointsResponse'
      { $sel:httpStatus:DeleteUserEndpointsResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:endpointsResponse:DeleteUserEndpointsResponse' :: EndpointsResponse
endpointsResponse = EndpointsResponse
pEndpointsResponse_
      }

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

-- | Undocumented member.
deleteUserEndpointsResponse_endpointsResponse :: Lens.Lens' DeleteUserEndpointsResponse EndpointsResponse
deleteUserEndpointsResponse_endpointsResponse :: Lens' DeleteUserEndpointsResponse EndpointsResponse
deleteUserEndpointsResponse_endpointsResponse = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteUserEndpointsResponse' {EndpointsResponse
endpointsResponse :: EndpointsResponse
$sel:endpointsResponse:DeleteUserEndpointsResponse' :: DeleteUserEndpointsResponse -> EndpointsResponse
endpointsResponse} -> EndpointsResponse
endpointsResponse) (\s :: DeleteUserEndpointsResponse
s@DeleteUserEndpointsResponse' {} EndpointsResponse
a -> DeleteUserEndpointsResponse
s {$sel:endpointsResponse:DeleteUserEndpointsResponse' :: EndpointsResponse
endpointsResponse = EndpointsResponse
a} :: DeleteUserEndpointsResponse)

instance Prelude.NFData DeleteUserEndpointsResponse where
  rnf :: DeleteUserEndpointsResponse -> ()
rnf DeleteUserEndpointsResponse' {Int
EndpointsResponse
endpointsResponse :: EndpointsResponse
httpStatus :: Int
$sel:endpointsResponse:DeleteUserEndpointsResponse' :: DeleteUserEndpointsResponse -> EndpointsResponse
$sel:httpStatus:DeleteUserEndpointsResponse' :: DeleteUserEndpointsResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf EndpointsResponse
endpointsResponse