{-# 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.AppIntegrationS.DeleteEventIntegration
-- 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 the specified existing event integration. If the event
-- integration is associated with clients, the request is rejected.
module Amazonka.AppIntegrationS.DeleteEventIntegration
  ( -- * Creating a Request
    DeleteEventIntegration (..),
    newDeleteEventIntegration,

    -- * Request Lenses
    deleteEventIntegration_name,

    -- * Destructuring the Response
    DeleteEventIntegrationResponse (..),
    newDeleteEventIntegrationResponse,

    -- * Response Lenses
    deleteEventIntegrationResponse_httpStatus,
  )
where

import Amazonka.AppIntegrationS.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:/ 'newDeleteEventIntegration' smart constructor.
data DeleteEventIntegration = DeleteEventIntegration'
  { -- | The name of the event integration.
    DeleteEventIntegration -> Text
name :: Prelude.Text
  }
  deriving (DeleteEventIntegration -> DeleteEventIntegration -> Bool
(DeleteEventIntegration -> DeleteEventIntegration -> Bool)
-> (DeleteEventIntegration -> DeleteEventIntegration -> Bool)
-> Eq DeleteEventIntegration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEventIntegration -> DeleteEventIntegration -> Bool
$c/= :: DeleteEventIntegration -> DeleteEventIntegration -> Bool
== :: DeleteEventIntegration -> DeleteEventIntegration -> Bool
$c== :: DeleteEventIntegration -> DeleteEventIntegration -> Bool
Prelude.Eq, ReadPrec [DeleteEventIntegration]
ReadPrec DeleteEventIntegration
Int -> ReadS DeleteEventIntegration
ReadS [DeleteEventIntegration]
(Int -> ReadS DeleteEventIntegration)
-> ReadS [DeleteEventIntegration]
-> ReadPrec DeleteEventIntegration
-> ReadPrec [DeleteEventIntegration]
-> Read DeleteEventIntegration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEventIntegration]
$creadListPrec :: ReadPrec [DeleteEventIntegration]
readPrec :: ReadPrec DeleteEventIntegration
$creadPrec :: ReadPrec DeleteEventIntegration
readList :: ReadS [DeleteEventIntegration]
$creadList :: ReadS [DeleteEventIntegration]
readsPrec :: Int -> ReadS DeleteEventIntegration
$creadsPrec :: Int -> ReadS DeleteEventIntegration
Prelude.Read, Int -> DeleteEventIntegration -> ShowS
[DeleteEventIntegration] -> ShowS
DeleteEventIntegration -> String
(Int -> DeleteEventIntegration -> ShowS)
-> (DeleteEventIntegration -> String)
-> ([DeleteEventIntegration] -> ShowS)
-> Show DeleteEventIntegration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEventIntegration] -> ShowS
$cshowList :: [DeleteEventIntegration] -> ShowS
show :: DeleteEventIntegration -> String
$cshow :: DeleteEventIntegration -> String
showsPrec :: Int -> DeleteEventIntegration -> ShowS
$cshowsPrec :: Int -> DeleteEventIntegration -> ShowS
Prelude.Show, (forall x. DeleteEventIntegration -> Rep DeleteEventIntegration x)
-> (forall x.
    Rep DeleteEventIntegration x -> DeleteEventIntegration)
-> Generic DeleteEventIntegration
forall x. Rep DeleteEventIntegration x -> DeleteEventIntegration
forall x. DeleteEventIntegration -> Rep DeleteEventIntegration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteEventIntegration x -> DeleteEventIntegration
$cfrom :: forall x. DeleteEventIntegration -> Rep DeleteEventIntegration x
Prelude.Generic)

-- |
-- Create a value of 'DeleteEventIntegration' 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:
--
-- 'name', 'deleteEventIntegration_name' - The name of the event integration.
newDeleteEventIntegration ::
  -- | 'name'
  Prelude.Text ->
  DeleteEventIntegration
newDeleteEventIntegration :: Text -> DeleteEventIntegration
newDeleteEventIntegration Text
pName_ =
  DeleteEventIntegration' :: Text -> DeleteEventIntegration
DeleteEventIntegration' {$sel:name:DeleteEventIntegration' :: Text
name = Text
pName_}

-- | The name of the event integration.
deleteEventIntegration_name :: Lens.Lens' DeleteEventIntegration Prelude.Text
deleteEventIntegration_name :: (Text -> f Text)
-> DeleteEventIntegration -> f DeleteEventIntegration
deleteEventIntegration_name = (DeleteEventIntegration -> Text)
-> (DeleteEventIntegration -> Text -> DeleteEventIntegration)
-> Lens DeleteEventIntegration DeleteEventIntegration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEventIntegration' {Text
name :: Text
$sel:name:DeleteEventIntegration' :: DeleteEventIntegration -> Text
name} -> Text
name) (\s :: DeleteEventIntegration
s@DeleteEventIntegration' {} Text
a -> DeleteEventIntegration
s {$sel:name:DeleteEventIntegration' :: Text
name = Text
a} :: DeleteEventIntegration)

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

instance Prelude.NFData DeleteEventIntegration

instance Core.ToHeaders DeleteEventIntegration where
  toHeaders :: DeleteEventIntegration -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteEventIntegration -> 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 DeleteEventIntegration where
  toPath :: DeleteEventIntegration -> ByteString
toPath DeleteEventIntegration' {Text
name :: Text
$sel:name:DeleteEventIntegration' :: DeleteEventIntegration -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/eventIntegrations/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name]

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

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

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

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

instance
  Prelude.NFData
    DeleteEventIntegrationResponse