{-# 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.DeleteIntegration
-- 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)
--
-- Removes an integration from a specific domain.
module Amazonka.CustomerProfiles.DeleteIntegration
  ( -- * Creating a Request
    DeleteIntegration (..),
    newDeleteIntegration,

    -- * Request Lenses
    deleteIntegration_domainName,
    deleteIntegration_uri,

    -- * Destructuring the Response
    DeleteIntegrationResponse (..),
    newDeleteIntegrationResponse,

    -- * Response Lenses
    deleteIntegrationResponse_httpStatus,
    deleteIntegrationResponse_message,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.CustomerProfiles.Types
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:/ 'newDeleteIntegration' smart constructor.
data DeleteIntegration = DeleteIntegration'
  { -- | The unique name of the domain.
    DeleteIntegration -> Text
domainName :: Prelude.Text,
    -- | The URI of the S3 bucket or any other type of data source.
    DeleteIntegration -> Text
uri :: Prelude.Text
  }
  deriving (DeleteIntegration -> DeleteIntegration -> Bool
(DeleteIntegration -> DeleteIntegration -> Bool)
-> (DeleteIntegration -> DeleteIntegration -> Bool)
-> Eq DeleteIntegration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteIntegration -> DeleteIntegration -> Bool
$c/= :: DeleteIntegration -> DeleteIntegration -> Bool
== :: DeleteIntegration -> DeleteIntegration -> Bool
$c== :: DeleteIntegration -> DeleteIntegration -> Bool
Prelude.Eq, ReadPrec [DeleteIntegration]
ReadPrec DeleteIntegration
Int -> ReadS DeleteIntegration
ReadS [DeleteIntegration]
(Int -> ReadS DeleteIntegration)
-> ReadS [DeleteIntegration]
-> ReadPrec DeleteIntegration
-> ReadPrec [DeleteIntegration]
-> Read DeleteIntegration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteIntegration]
$creadListPrec :: ReadPrec [DeleteIntegration]
readPrec :: ReadPrec DeleteIntegration
$creadPrec :: ReadPrec DeleteIntegration
readList :: ReadS [DeleteIntegration]
$creadList :: ReadS [DeleteIntegration]
readsPrec :: Int -> ReadS DeleteIntegration
$creadsPrec :: Int -> ReadS DeleteIntegration
Prelude.Read, Int -> DeleteIntegration -> ShowS
[DeleteIntegration] -> ShowS
DeleteIntegration -> String
(Int -> DeleteIntegration -> ShowS)
-> (DeleteIntegration -> String)
-> ([DeleteIntegration] -> ShowS)
-> Show DeleteIntegration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteIntegration] -> ShowS
$cshowList :: [DeleteIntegration] -> ShowS
show :: DeleteIntegration -> String
$cshow :: DeleteIntegration -> String
showsPrec :: Int -> DeleteIntegration -> ShowS
$cshowsPrec :: Int -> DeleteIntegration -> ShowS
Prelude.Show, (forall x. DeleteIntegration -> Rep DeleteIntegration x)
-> (forall x. Rep DeleteIntegration x -> DeleteIntegration)
-> Generic DeleteIntegration
forall x. Rep DeleteIntegration x -> DeleteIntegration
forall x. DeleteIntegration -> Rep DeleteIntegration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteIntegration x -> DeleteIntegration
$cfrom :: forall x. DeleteIntegration -> Rep DeleteIntegration x
Prelude.Generic)

-- |
-- Create a value of 'DeleteIntegration' 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:
--
-- 'domainName', 'deleteIntegration_domainName' - The unique name of the domain.
--
-- 'uri', 'deleteIntegration_uri' - The URI of the S3 bucket or any other type of data source.
newDeleteIntegration ::
  -- | 'domainName'
  Prelude.Text ->
  -- | 'uri'
  Prelude.Text ->
  DeleteIntegration
newDeleteIntegration :: Text -> Text -> DeleteIntegration
newDeleteIntegration Text
pDomainName_ Text
pUri_ =
  DeleteIntegration' :: Text -> Text -> DeleteIntegration
DeleteIntegration'
    { $sel:domainName:DeleteIntegration' :: Text
domainName = Text
pDomainName_,
      $sel:uri:DeleteIntegration' :: Text
uri = Text
pUri_
    }

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

-- | The URI of the S3 bucket or any other type of data source.
deleteIntegration_uri :: Lens.Lens' DeleteIntegration Prelude.Text
deleteIntegration_uri :: (Text -> f Text) -> DeleteIntegration -> f DeleteIntegration
deleteIntegration_uri = (DeleteIntegration -> Text)
-> (DeleteIntegration -> Text -> DeleteIntegration)
-> Lens DeleteIntegration DeleteIntegration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteIntegration' {Text
uri :: Text
$sel:uri:DeleteIntegration' :: DeleteIntegration -> Text
uri} -> Text
uri) (\s :: DeleteIntegration
s@DeleteIntegration' {} Text
a -> DeleteIntegration
s {$sel:uri:DeleteIntegration' :: Text
uri = Text
a} :: DeleteIntegration)

instance Core.AWSRequest DeleteIntegration where
  type
    AWSResponse DeleteIntegration =
      DeleteIntegrationResponse
  request :: DeleteIntegration -> Request DeleteIntegration
request = Service -> DeleteIntegration -> Request DeleteIntegration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteIntegration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteIntegration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteIntegration))
-> Logger
-> Service
-> Proxy DeleteIntegration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteIntegration)))
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 -> Text -> DeleteIntegrationResponse
DeleteIntegrationResponse'
            (Int -> Text -> DeleteIntegrationResponse)
-> Either String Int
-> Either String (Text -> DeleteIntegrationResponse)
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 (Text -> DeleteIntegrationResponse)
-> Either String Text -> Either String DeleteIntegrationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Message")
      )

instance Prelude.Hashable DeleteIntegration

instance Prelude.NFData DeleteIntegration

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

instance Core.ToPath DeleteIntegration where
  toPath :: DeleteIntegration -> ByteString
toPath DeleteIntegration' {Text
uri :: Text
domainName :: Text
$sel:uri:DeleteIntegration' :: DeleteIntegration -> Text
$sel:domainName:DeleteIntegration' :: DeleteIntegration -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/domains/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
domainName,
        ByteString
"/integrations/delete"
      ]

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

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

-- |
-- Create a value of 'DeleteIntegrationResponse' 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', 'deleteIntegrationResponse_httpStatus' - The response's http status code.
--
-- 'message', 'deleteIntegrationResponse_message' - A message that indicates the delete request is done.
newDeleteIntegrationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'message'
  Prelude.Text ->
  DeleteIntegrationResponse
newDeleteIntegrationResponse :: Int -> Text -> DeleteIntegrationResponse
newDeleteIntegrationResponse Int
pHttpStatus_ Text
pMessage_ =
  DeleteIntegrationResponse' :: Int -> Text -> DeleteIntegrationResponse
DeleteIntegrationResponse'
    { $sel:httpStatus:DeleteIntegrationResponse' :: Int
httpStatus =
        Int
pHttpStatus_,
      $sel:message:DeleteIntegrationResponse' :: Text
message = Text
pMessage_
    }

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

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

instance Prelude.NFData DeleteIntegrationResponse