{-# 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.CustomerProfiles.DeleteProfileObject
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Removes an object associated with a profile of a given
-- ProfileObjectType.
module Amazonka.CustomerProfiles.DeleteProfileObject
  ( -- * Creating a Request
    DeleteProfileObject (..),
    newDeleteProfileObject,

    -- * Request Lenses
    deleteProfileObject_profileId,
    deleteProfileObject_profileObjectUniqueKey,
    deleteProfileObject_objectTypeName,
    deleteProfileObject_domainName,

    -- * Destructuring the Response
    DeleteProfileObjectResponse (..),
    newDeleteProfileObjectResponse,

    -- * Response Lenses
    deleteProfileObjectResponse_message,
    deleteProfileObjectResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteProfileObject' smart constructor.
data DeleteProfileObject = DeleteProfileObject'
  { -- | The unique identifier of a customer profile.
    DeleteProfileObject -> Text
profileId :: Prelude.Text,
    -- | The unique identifier of the profile object generated by the service.
    DeleteProfileObject -> Text
profileObjectUniqueKey :: Prelude.Text,
    -- | The name of the profile object type.
    DeleteProfileObject -> Text
objectTypeName :: Prelude.Text,
    -- | The unique name of the domain.
    DeleteProfileObject -> Text
domainName :: Prelude.Text
  }
  deriving (DeleteProfileObject -> DeleteProfileObject -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteProfileObject -> DeleteProfileObject -> Bool
$c/= :: DeleteProfileObject -> DeleteProfileObject -> Bool
== :: DeleteProfileObject -> DeleteProfileObject -> Bool
$c== :: DeleteProfileObject -> DeleteProfileObject -> Bool
Prelude.Eq, ReadPrec [DeleteProfileObject]
ReadPrec DeleteProfileObject
Int -> ReadS DeleteProfileObject
ReadS [DeleteProfileObject]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteProfileObject]
$creadListPrec :: ReadPrec [DeleteProfileObject]
readPrec :: ReadPrec DeleteProfileObject
$creadPrec :: ReadPrec DeleteProfileObject
readList :: ReadS [DeleteProfileObject]
$creadList :: ReadS [DeleteProfileObject]
readsPrec :: Int -> ReadS DeleteProfileObject
$creadsPrec :: Int -> ReadS DeleteProfileObject
Prelude.Read, Int -> DeleteProfileObject -> ShowS
[DeleteProfileObject] -> ShowS
DeleteProfileObject -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteProfileObject] -> ShowS
$cshowList :: [DeleteProfileObject] -> ShowS
show :: DeleteProfileObject -> String
$cshow :: DeleteProfileObject -> String
showsPrec :: Int -> DeleteProfileObject -> ShowS
$cshowsPrec :: Int -> DeleteProfileObject -> ShowS
Prelude.Show, forall x. Rep DeleteProfileObject x -> DeleteProfileObject
forall x. DeleteProfileObject -> Rep DeleteProfileObject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteProfileObject x -> DeleteProfileObject
$cfrom :: forall x. DeleteProfileObject -> Rep DeleteProfileObject x
Prelude.Generic)

-- |
-- Create a value of 'DeleteProfileObject' 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:
--
-- 'profileId', 'deleteProfileObject_profileId' - The unique identifier of a customer profile.
--
-- 'profileObjectUniqueKey', 'deleteProfileObject_profileObjectUniqueKey' - The unique identifier of the profile object generated by the service.
--
-- 'objectTypeName', 'deleteProfileObject_objectTypeName' - The name of the profile object type.
--
-- 'domainName', 'deleteProfileObject_domainName' - The unique name of the domain.
newDeleteProfileObject ::
  -- | 'profileId'
  Prelude.Text ->
  -- | 'profileObjectUniqueKey'
  Prelude.Text ->
  -- | 'objectTypeName'
  Prelude.Text ->
  -- | 'domainName'
  Prelude.Text ->
  DeleteProfileObject
newDeleteProfileObject :: Text -> Text -> Text -> Text -> DeleteProfileObject
newDeleteProfileObject
  Text
pProfileId_
  Text
pProfileObjectUniqueKey_
  Text
pObjectTypeName_
  Text
pDomainName_ =
    DeleteProfileObject'
      { $sel:profileId:DeleteProfileObject' :: Text
profileId = Text
pProfileId_,
        $sel:profileObjectUniqueKey:DeleteProfileObject' :: Text
profileObjectUniqueKey = Text
pProfileObjectUniqueKey_,
        $sel:objectTypeName:DeleteProfileObject' :: Text
objectTypeName = Text
pObjectTypeName_,
        $sel:domainName:DeleteProfileObject' :: Text
domainName = Text
pDomainName_
      }

-- | The unique identifier of a customer profile.
deleteProfileObject_profileId :: Lens.Lens' DeleteProfileObject Prelude.Text
deleteProfileObject_profileId :: Lens' DeleteProfileObject Text
deleteProfileObject_profileId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProfileObject' {Text
profileId :: Text
$sel:profileId:DeleteProfileObject' :: DeleteProfileObject -> Text
profileId} -> Text
profileId) (\s :: DeleteProfileObject
s@DeleteProfileObject' {} Text
a -> DeleteProfileObject
s {$sel:profileId:DeleteProfileObject' :: Text
profileId = Text
a} :: DeleteProfileObject)

-- | The unique identifier of the profile object generated by the service.
deleteProfileObject_profileObjectUniqueKey :: Lens.Lens' DeleteProfileObject Prelude.Text
deleteProfileObject_profileObjectUniqueKey :: Lens' DeleteProfileObject Text
deleteProfileObject_profileObjectUniqueKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProfileObject' {Text
profileObjectUniqueKey :: Text
$sel:profileObjectUniqueKey:DeleteProfileObject' :: DeleteProfileObject -> Text
profileObjectUniqueKey} -> Text
profileObjectUniqueKey) (\s :: DeleteProfileObject
s@DeleteProfileObject' {} Text
a -> DeleteProfileObject
s {$sel:profileObjectUniqueKey:DeleteProfileObject' :: Text
profileObjectUniqueKey = Text
a} :: DeleteProfileObject)

-- | The name of the profile object type.
deleteProfileObject_objectTypeName :: Lens.Lens' DeleteProfileObject Prelude.Text
deleteProfileObject_objectTypeName :: Lens' DeleteProfileObject Text
deleteProfileObject_objectTypeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProfileObject' {Text
objectTypeName :: Text
$sel:objectTypeName:DeleteProfileObject' :: DeleteProfileObject -> Text
objectTypeName} -> Text
objectTypeName) (\s :: DeleteProfileObject
s@DeleteProfileObject' {} Text
a -> DeleteProfileObject
s {$sel:objectTypeName:DeleteProfileObject' :: Text
objectTypeName = Text
a} :: DeleteProfileObject)

-- | The unique name of the domain.
deleteProfileObject_domainName :: Lens.Lens' DeleteProfileObject Prelude.Text
deleteProfileObject_domainName :: Lens' DeleteProfileObject Text
deleteProfileObject_domainName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProfileObject' {Text
domainName :: Text
$sel:domainName:DeleteProfileObject' :: DeleteProfileObject -> Text
domainName} -> Text
domainName) (\s :: DeleteProfileObject
s@DeleteProfileObject' {} Text
a -> DeleteProfileObject
s {$sel:domainName:DeleteProfileObject' :: Text
domainName = Text
a} :: DeleteProfileObject)

instance Core.AWSRequest DeleteProfileObject where
  type
    AWSResponse DeleteProfileObject =
      DeleteProfileObjectResponse
  request :: (Service -> Service)
-> DeleteProfileObject -> Request DeleteProfileObject
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteProfileObject
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteProfileObject)))
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 ->
          Maybe Text -> Int -> DeleteProfileObjectResponse
DeleteProfileObjectResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Message")
            forall (f :: * -> *) a b. Applicative f => 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))
      )

instance Prelude.Hashable DeleteProfileObject where
  hashWithSalt :: Int -> DeleteProfileObject -> Int
hashWithSalt Int
_salt DeleteProfileObject' {Text
domainName :: Text
objectTypeName :: Text
profileObjectUniqueKey :: Text
profileId :: Text
$sel:domainName:DeleteProfileObject' :: DeleteProfileObject -> Text
$sel:objectTypeName:DeleteProfileObject' :: DeleteProfileObject -> Text
$sel:profileObjectUniqueKey:DeleteProfileObject' :: DeleteProfileObject -> Text
$sel:profileId:DeleteProfileObject' :: DeleteProfileObject -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
profileId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
profileObjectUniqueKey
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
objectTypeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domainName

instance Prelude.NFData DeleteProfileObject where
  rnf :: DeleteProfileObject -> ()
rnf DeleteProfileObject' {Text
domainName :: Text
objectTypeName :: Text
profileObjectUniqueKey :: Text
profileId :: Text
$sel:domainName:DeleteProfileObject' :: DeleteProfileObject -> Text
$sel:objectTypeName:DeleteProfileObject' :: DeleteProfileObject -> Text
$sel:profileObjectUniqueKey:DeleteProfileObject' :: DeleteProfileObject -> Text
$sel:profileId:DeleteProfileObject' :: DeleteProfileObject -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
profileId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
profileObjectUniqueKey
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
objectTypeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
domainName

instance Data.ToHeaders DeleteProfileObject where
  toHeaders :: DeleteProfileObject -> 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.ToJSON DeleteProfileObject where
  toJSON :: DeleteProfileObject -> Value
toJSON DeleteProfileObject' {Text
domainName :: Text
objectTypeName :: Text
profileObjectUniqueKey :: Text
profileId :: Text
$sel:domainName:DeleteProfileObject' :: DeleteProfileObject -> Text
$sel:objectTypeName:DeleteProfileObject' :: DeleteProfileObject -> Text
$sel:profileObjectUniqueKey:DeleteProfileObject' :: DeleteProfileObject -> Text
$sel:profileId:DeleteProfileObject' :: DeleteProfileObject -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"ProfileId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
profileId),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"ProfileObjectUniqueKey"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
profileObjectUniqueKey
              ),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"ObjectTypeName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
objectTypeName)
          ]
      )

instance Data.ToPath DeleteProfileObject where
  toPath :: DeleteProfileObject -> ByteString
toPath DeleteProfileObject' {Text
domainName :: Text
objectTypeName :: Text
profileObjectUniqueKey :: Text
profileId :: Text
$sel:domainName:DeleteProfileObject' :: DeleteProfileObject -> Text
$sel:objectTypeName:DeleteProfileObject' :: DeleteProfileObject -> Text
$sel:profileObjectUniqueKey:DeleteProfileObject' :: DeleteProfileObject -> Text
$sel:profileId:DeleteProfileObject' :: DeleteProfileObject -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/domains/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
domainName,
        ByteString
"/profiles/objects/delete"
      ]

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

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

-- |
-- Create a value of 'DeleteProfileObjectResponse' 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:
--
-- 'message', 'deleteProfileObjectResponse_message' - A message that indicates the delete request is done.
--
-- 'httpStatus', 'deleteProfileObjectResponse_httpStatus' - The response's http status code.
newDeleteProfileObjectResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteProfileObjectResponse
newDeleteProfileObjectResponse :: Int -> DeleteProfileObjectResponse
newDeleteProfileObjectResponse Int
pHttpStatus_ =
  DeleteProfileObjectResponse'
    { $sel:message:DeleteProfileObjectResponse' :: Maybe Text
message =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteProfileObjectResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A message that indicates the delete request is done.
deleteProfileObjectResponse_message :: Lens.Lens' DeleteProfileObjectResponse (Prelude.Maybe Prelude.Text)
deleteProfileObjectResponse_message :: Lens' DeleteProfileObjectResponse (Maybe Text)
deleteProfileObjectResponse_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProfileObjectResponse' {Maybe Text
message :: Maybe Text
$sel:message:DeleteProfileObjectResponse' :: DeleteProfileObjectResponse -> Maybe Text
message} -> Maybe Text
message) (\s :: DeleteProfileObjectResponse
s@DeleteProfileObjectResponse' {} Maybe Text
a -> DeleteProfileObjectResponse
s {$sel:message:DeleteProfileObjectResponse' :: Maybe Text
message = Maybe Text
a} :: DeleteProfileObjectResponse)

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

instance Prelude.NFData DeleteProfileObjectResponse where
  rnf :: DeleteProfileObjectResponse -> ()
rnf DeleteProfileObjectResponse' {Int
Maybe Text
httpStatus :: Int
message :: Maybe Text
$sel:httpStatus:DeleteProfileObjectResponse' :: DeleteProfileObjectResponse -> Int
$sel:message:DeleteProfileObjectResponse' :: DeleteProfileObjectResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus