{-# 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.CodeBuild.DeleteWebhook
-- 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)
--
-- For an existing CodeBuild build project that has its source code stored
-- in a GitHub or Bitbucket repository, stops CodeBuild from rebuilding the
-- source code every time a code change is pushed to the repository.
module Amazonka.CodeBuild.DeleteWebhook
  ( -- * Creating a Request
    DeleteWebhook (..),
    newDeleteWebhook,

    -- * Request Lenses
    deleteWebhook_projectName,

    -- * Destructuring the Response
    DeleteWebhookResponse (..),
    newDeleteWebhookResponse,

    -- * Response Lenses
    deleteWebhookResponse_httpStatus,
  )
where

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

-- |
-- Create a value of 'DeleteWebhook' 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:
--
-- 'projectName', 'deleteWebhook_projectName' - The name of the CodeBuild project.
newDeleteWebhook ::
  -- | 'projectName'
  Prelude.Text ->
  DeleteWebhook
newDeleteWebhook :: Text -> DeleteWebhook
newDeleteWebhook Text
pProjectName_ =
  DeleteWebhook' :: Text -> DeleteWebhook
DeleteWebhook' {$sel:projectName:DeleteWebhook' :: Text
projectName = Text
pProjectName_}

-- | The name of the CodeBuild project.
deleteWebhook_projectName :: Lens.Lens' DeleteWebhook Prelude.Text
deleteWebhook_projectName :: (Text -> f Text) -> DeleteWebhook -> f DeleteWebhook
deleteWebhook_projectName = (DeleteWebhook -> Text)
-> (DeleteWebhook -> Text -> DeleteWebhook)
-> Lens DeleteWebhook DeleteWebhook Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteWebhook' {Text
projectName :: Text
$sel:projectName:DeleteWebhook' :: DeleteWebhook -> Text
projectName} -> Text
projectName) (\s :: DeleteWebhook
s@DeleteWebhook' {} Text
a -> DeleteWebhook
s {$sel:projectName:DeleteWebhook' :: Text
projectName = Text
a} :: DeleteWebhook)

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

instance Prelude.NFData DeleteWebhook

instance Core.ToHeaders DeleteWebhook where
  toHeaders :: DeleteWebhook -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteWebhook -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"CodeBuild_20161006.DeleteWebhook" ::
                          Prelude.ByteString
                      ),
            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 DeleteWebhook where
  toJSON :: DeleteWebhook -> Value
toJSON DeleteWebhook' {Text
projectName :: Text
$sel:projectName:DeleteWebhook' :: DeleteWebhook -> 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
"projectName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
projectName)]
      )

instance Core.ToPath DeleteWebhook where
  toPath :: DeleteWebhook -> ByteString
toPath = ByteString -> DeleteWebhook -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

instance Prelude.NFData DeleteWebhookResponse