{-# 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-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 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.Lens as Lens
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
(DeleteUserEndpoints -> DeleteUserEndpoints -> Bool)
-> (DeleteUserEndpoints -> DeleteUserEndpoints -> Bool)
-> Eq DeleteUserEndpoints
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]
(Int -> ReadS DeleteUserEndpoints)
-> ReadS [DeleteUserEndpoints]
-> ReadPrec DeleteUserEndpoints
-> ReadPrec [DeleteUserEndpoints]
-> Read 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
(Int -> DeleteUserEndpoints -> ShowS)
-> (DeleteUserEndpoints -> String)
-> ([DeleteUserEndpoints] -> ShowS)
-> Show DeleteUserEndpoints
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. DeleteUserEndpoints -> Rep DeleteUserEndpoints x)
-> (forall x. Rep DeleteUserEndpoints x -> DeleteUserEndpoints)
-> Generic DeleteUserEndpoints
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' :: Text -> Text -> DeleteUserEndpoints
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 :: (Text -> f Text) -> DeleteUserEndpoints -> f DeleteUserEndpoints
deleteUserEndpoints_applicationId = (DeleteUserEndpoints -> Text)
-> (DeleteUserEndpoints -> Text -> DeleteUserEndpoints)
-> Lens DeleteUserEndpoints DeleteUserEndpoints Text Text
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 :: (Text -> f Text) -> DeleteUserEndpoints -> f DeleteUserEndpoints
deleteUserEndpoints_userId = (DeleteUserEndpoints -> Text)
-> (DeleteUserEndpoints -> Text -> DeleteUserEndpoints)
-> Lens DeleteUserEndpoints DeleteUserEndpoints Text Text
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 :: DeleteUserEndpoints -> Request DeleteUserEndpoints
request = Service -> DeleteUserEndpoints -> Request DeleteUserEndpoints
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteUserEndpoints
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteUserEndpoints)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteUserEndpoints))
-> Logger
-> Service
-> Proxy DeleteUserEndpoints
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteUserEndpoints)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> EndpointsResponse -> DeleteUserEndpointsResponse
DeleteUserEndpointsResponse'
            (Int -> EndpointsResponse -> DeleteUserEndpointsResponse)
-> Either String Int
-> Either String (EndpointsResponse -> DeleteUserEndpointsResponse)
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))
            Either String (EndpointsResponse -> DeleteUserEndpointsResponse)
-> Either String EndpointsResponse
-> Either String DeleteUserEndpointsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String EndpointsResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
      )

instance Prelude.Hashable DeleteUserEndpoints

instance Prelude.NFData DeleteUserEndpoints

instance Core.ToHeaders DeleteUserEndpoints where
  toHeaders :: DeleteUserEndpoints -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteUserEndpoints -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath DeleteUserEndpoints where
  toPath :: DeleteUserEndpoints -> ByteString
toPath DeleteUserEndpoints' {Text
userId :: Text
applicationId :: Text
$sel:userId:DeleteUserEndpoints' :: DeleteUserEndpoints -> Text
$sel:applicationId:DeleteUserEndpoints' :: DeleteUserEndpoints -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/apps/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
applicationId,
        ByteString
"/users/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
userId
      ]

instance Core.ToQuery DeleteUserEndpoints where
  toQuery :: DeleteUserEndpoints -> QueryString
toQuery = QueryString -> DeleteUserEndpoints -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteUserEndpointsResponse
 -> DeleteUserEndpointsResponse -> Bool)
-> (DeleteUserEndpointsResponse
    -> DeleteUserEndpointsResponse -> Bool)
-> Eq DeleteUserEndpointsResponse
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]
(Int -> ReadS DeleteUserEndpointsResponse)
-> ReadS [DeleteUserEndpointsResponse]
-> ReadPrec DeleteUserEndpointsResponse
-> ReadPrec [DeleteUserEndpointsResponse]
-> Read 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
(Int -> DeleteUserEndpointsResponse -> ShowS)
-> (DeleteUserEndpointsResponse -> String)
-> ([DeleteUserEndpointsResponse] -> ShowS)
-> Show DeleteUserEndpointsResponse
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.
 DeleteUserEndpointsResponse -> Rep DeleteUserEndpointsResponse x)
-> (forall x.
    Rep DeleteUserEndpointsResponse x -> DeleteUserEndpointsResponse)
-> Generic DeleteUserEndpointsResponse
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' :: Int -> EndpointsResponse -> DeleteUserEndpointsResponse
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 :: (Int -> f Int)
-> DeleteUserEndpointsResponse -> f DeleteUserEndpointsResponse
deleteUserEndpointsResponse_httpStatus = (DeleteUserEndpointsResponse -> Int)
-> (DeleteUserEndpointsResponse
    -> Int -> DeleteUserEndpointsResponse)
-> Lens
     DeleteUserEndpointsResponse DeleteUserEndpointsResponse Int Int
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 :: (EndpointsResponse -> f EndpointsResponse)
-> DeleteUserEndpointsResponse -> f DeleteUserEndpointsResponse
deleteUserEndpointsResponse_endpointsResponse = (DeleteUserEndpointsResponse -> EndpointsResponse)
-> (DeleteUserEndpointsResponse
    -> EndpointsResponse -> DeleteUserEndpointsResponse)
-> Lens
     DeleteUserEndpointsResponse
     DeleteUserEndpointsResponse
     EndpointsResponse
     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