{-# 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.UpdateWebhook
-- 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)
--
-- Updates the webhook associated with an CodeBuild build project.
--
-- If you use Bitbucket for your repository, @rotateSecret@ is ignored.
module Amazonka.CodeBuild.UpdateWebhook
  ( -- * Creating a Request
    UpdateWebhook (..),
    newUpdateWebhook,

    -- * Request Lenses
    updateWebhook_branchFilter,
    updateWebhook_rotateSecret,
    updateWebhook_filterGroups,
    updateWebhook_buildType,
    updateWebhook_projectName,

    -- * Destructuring the Response
    UpdateWebhookResponse (..),
    newUpdateWebhookResponse,

    -- * Response Lenses
    updateWebhookResponse_webhook,
    updateWebhookResponse_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:/ 'newUpdateWebhook' smart constructor.
data UpdateWebhook = UpdateWebhook'
  { -- | A regular expression used to determine which repository branches are
    -- built when a webhook is triggered. If the name of a branch matches the
    -- regular expression, then it is built. If @branchFilter@ is empty, then
    -- all branches are built.
    --
    -- It is recommended that you use @filterGroups@ instead of @branchFilter@.
    UpdateWebhook -> Maybe Text
branchFilter :: Prelude.Maybe Prelude.Text,
    -- | A boolean value that specifies whether the associated GitHub
    -- repository\'s secret token should be updated. If you use Bitbucket for
    -- your repository, @rotateSecret@ is ignored.
    UpdateWebhook -> Maybe Bool
rotateSecret :: Prelude.Maybe Prelude.Bool,
    -- | An array of arrays of @WebhookFilter@ objects used to determine if a
    -- webhook event can trigger a build. A filter group must contain at least
    -- one @EVENT@ @WebhookFilter@.
    UpdateWebhook -> Maybe [[WebhookFilter]]
filterGroups :: Prelude.Maybe [[WebhookFilter]],
    -- | Specifies the type of build this webhook will trigger.
    UpdateWebhook -> Maybe WebhookBuildType
buildType :: Prelude.Maybe WebhookBuildType,
    -- | The name of the CodeBuild project.
    UpdateWebhook -> Text
projectName :: Prelude.Text
  }
  deriving (UpdateWebhook -> UpdateWebhook -> Bool
(UpdateWebhook -> UpdateWebhook -> Bool)
-> (UpdateWebhook -> UpdateWebhook -> Bool) -> Eq UpdateWebhook
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateWebhook -> UpdateWebhook -> Bool
$c/= :: UpdateWebhook -> UpdateWebhook -> Bool
== :: UpdateWebhook -> UpdateWebhook -> Bool
$c== :: UpdateWebhook -> UpdateWebhook -> Bool
Prelude.Eq, ReadPrec [UpdateWebhook]
ReadPrec UpdateWebhook
Int -> ReadS UpdateWebhook
ReadS [UpdateWebhook]
(Int -> ReadS UpdateWebhook)
-> ReadS [UpdateWebhook]
-> ReadPrec UpdateWebhook
-> ReadPrec [UpdateWebhook]
-> Read UpdateWebhook
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateWebhook]
$creadListPrec :: ReadPrec [UpdateWebhook]
readPrec :: ReadPrec UpdateWebhook
$creadPrec :: ReadPrec UpdateWebhook
readList :: ReadS [UpdateWebhook]
$creadList :: ReadS [UpdateWebhook]
readsPrec :: Int -> ReadS UpdateWebhook
$creadsPrec :: Int -> ReadS UpdateWebhook
Prelude.Read, Int -> UpdateWebhook -> ShowS
[UpdateWebhook] -> ShowS
UpdateWebhook -> String
(Int -> UpdateWebhook -> ShowS)
-> (UpdateWebhook -> String)
-> ([UpdateWebhook] -> ShowS)
-> Show UpdateWebhook
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateWebhook] -> ShowS
$cshowList :: [UpdateWebhook] -> ShowS
show :: UpdateWebhook -> String
$cshow :: UpdateWebhook -> String
showsPrec :: Int -> UpdateWebhook -> ShowS
$cshowsPrec :: Int -> UpdateWebhook -> ShowS
Prelude.Show, (forall x. UpdateWebhook -> Rep UpdateWebhook x)
-> (forall x. Rep UpdateWebhook x -> UpdateWebhook)
-> Generic UpdateWebhook
forall x. Rep UpdateWebhook x -> UpdateWebhook
forall x. UpdateWebhook -> Rep UpdateWebhook x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateWebhook x -> UpdateWebhook
$cfrom :: forall x. UpdateWebhook -> Rep UpdateWebhook x
Prelude.Generic)

-- |
-- Create a value of 'UpdateWebhook' 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:
--
-- 'branchFilter', 'updateWebhook_branchFilter' - A regular expression used to determine which repository branches are
-- built when a webhook is triggered. If the name of a branch matches the
-- regular expression, then it is built. If @branchFilter@ is empty, then
-- all branches are built.
--
-- It is recommended that you use @filterGroups@ instead of @branchFilter@.
--
-- 'rotateSecret', 'updateWebhook_rotateSecret' - A boolean value that specifies whether the associated GitHub
-- repository\'s secret token should be updated. If you use Bitbucket for
-- your repository, @rotateSecret@ is ignored.
--
-- 'filterGroups', 'updateWebhook_filterGroups' - An array of arrays of @WebhookFilter@ objects used to determine if a
-- webhook event can trigger a build. A filter group must contain at least
-- one @EVENT@ @WebhookFilter@.
--
-- 'buildType', 'updateWebhook_buildType' - Specifies the type of build this webhook will trigger.
--
-- 'projectName', 'updateWebhook_projectName' - The name of the CodeBuild project.
newUpdateWebhook ::
  -- | 'projectName'
  Prelude.Text ->
  UpdateWebhook
newUpdateWebhook :: Text -> UpdateWebhook
newUpdateWebhook Text
pProjectName_ =
  UpdateWebhook' :: Maybe Text
-> Maybe Bool
-> Maybe [[WebhookFilter]]
-> Maybe WebhookBuildType
-> Text
-> UpdateWebhook
UpdateWebhook'
    { $sel:branchFilter:UpdateWebhook' :: Maybe Text
branchFilter = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:rotateSecret:UpdateWebhook' :: Maybe Bool
rotateSecret = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:filterGroups:UpdateWebhook' :: Maybe [[WebhookFilter]]
filterGroups = Maybe [[WebhookFilter]]
forall a. Maybe a
Prelude.Nothing,
      $sel:buildType:UpdateWebhook' :: Maybe WebhookBuildType
buildType = Maybe WebhookBuildType
forall a. Maybe a
Prelude.Nothing,
      $sel:projectName:UpdateWebhook' :: Text
projectName = Text
pProjectName_
    }

-- | A regular expression used to determine which repository branches are
-- built when a webhook is triggered. If the name of a branch matches the
-- regular expression, then it is built. If @branchFilter@ is empty, then
-- all branches are built.
--
-- It is recommended that you use @filterGroups@ instead of @branchFilter@.
updateWebhook_branchFilter :: Lens.Lens' UpdateWebhook (Prelude.Maybe Prelude.Text)
updateWebhook_branchFilter :: (Maybe Text -> f (Maybe Text)) -> UpdateWebhook -> f UpdateWebhook
updateWebhook_branchFilter = (UpdateWebhook -> Maybe Text)
-> (UpdateWebhook -> Maybe Text -> UpdateWebhook)
-> Lens UpdateWebhook UpdateWebhook (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWebhook' {Maybe Text
branchFilter :: Maybe Text
$sel:branchFilter:UpdateWebhook' :: UpdateWebhook -> Maybe Text
branchFilter} -> Maybe Text
branchFilter) (\s :: UpdateWebhook
s@UpdateWebhook' {} Maybe Text
a -> UpdateWebhook
s {$sel:branchFilter:UpdateWebhook' :: Maybe Text
branchFilter = Maybe Text
a} :: UpdateWebhook)

-- | A boolean value that specifies whether the associated GitHub
-- repository\'s secret token should be updated. If you use Bitbucket for
-- your repository, @rotateSecret@ is ignored.
updateWebhook_rotateSecret :: Lens.Lens' UpdateWebhook (Prelude.Maybe Prelude.Bool)
updateWebhook_rotateSecret :: (Maybe Bool -> f (Maybe Bool)) -> UpdateWebhook -> f UpdateWebhook
updateWebhook_rotateSecret = (UpdateWebhook -> Maybe Bool)
-> (UpdateWebhook -> Maybe Bool -> UpdateWebhook)
-> Lens UpdateWebhook UpdateWebhook (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWebhook' {Maybe Bool
rotateSecret :: Maybe Bool
$sel:rotateSecret:UpdateWebhook' :: UpdateWebhook -> Maybe Bool
rotateSecret} -> Maybe Bool
rotateSecret) (\s :: UpdateWebhook
s@UpdateWebhook' {} Maybe Bool
a -> UpdateWebhook
s {$sel:rotateSecret:UpdateWebhook' :: Maybe Bool
rotateSecret = Maybe Bool
a} :: UpdateWebhook)

-- | An array of arrays of @WebhookFilter@ objects used to determine if a
-- webhook event can trigger a build. A filter group must contain at least
-- one @EVENT@ @WebhookFilter@.
updateWebhook_filterGroups :: Lens.Lens' UpdateWebhook (Prelude.Maybe [[WebhookFilter]])
updateWebhook_filterGroups :: (Maybe [[WebhookFilter]] -> f (Maybe [[WebhookFilter]]))
-> UpdateWebhook -> f UpdateWebhook
updateWebhook_filterGroups = (UpdateWebhook -> Maybe [[WebhookFilter]])
-> (UpdateWebhook -> Maybe [[WebhookFilter]] -> UpdateWebhook)
-> Lens
     UpdateWebhook
     UpdateWebhook
     (Maybe [[WebhookFilter]])
     (Maybe [[WebhookFilter]])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWebhook' {Maybe [[WebhookFilter]]
filterGroups :: Maybe [[WebhookFilter]]
$sel:filterGroups:UpdateWebhook' :: UpdateWebhook -> Maybe [[WebhookFilter]]
filterGroups} -> Maybe [[WebhookFilter]]
filterGroups) (\s :: UpdateWebhook
s@UpdateWebhook' {} Maybe [[WebhookFilter]]
a -> UpdateWebhook
s {$sel:filterGroups:UpdateWebhook' :: Maybe [[WebhookFilter]]
filterGroups = Maybe [[WebhookFilter]]
a} :: UpdateWebhook) ((Maybe [[WebhookFilter]] -> f (Maybe [[WebhookFilter]]))
 -> UpdateWebhook -> f UpdateWebhook)
-> ((Maybe [[WebhookFilter]] -> f (Maybe [[WebhookFilter]]))
    -> Maybe [[WebhookFilter]] -> f (Maybe [[WebhookFilter]]))
-> (Maybe [[WebhookFilter]] -> f (Maybe [[WebhookFilter]]))
-> UpdateWebhook
-> f UpdateWebhook
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [[WebhookFilter]]
  [[WebhookFilter]]
  [[WebhookFilter]]
  [[WebhookFilter]]
-> Iso
     (Maybe [[WebhookFilter]])
     (Maybe [[WebhookFilter]])
     (Maybe [[WebhookFilter]])
     (Maybe [[WebhookFilter]])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [[WebhookFilter]]
  [[WebhookFilter]]
  [[WebhookFilter]]
  [[WebhookFilter]]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies the type of build this webhook will trigger.
updateWebhook_buildType :: Lens.Lens' UpdateWebhook (Prelude.Maybe WebhookBuildType)
updateWebhook_buildType :: (Maybe WebhookBuildType -> f (Maybe WebhookBuildType))
-> UpdateWebhook -> f UpdateWebhook
updateWebhook_buildType = (UpdateWebhook -> Maybe WebhookBuildType)
-> (UpdateWebhook -> Maybe WebhookBuildType -> UpdateWebhook)
-> Lens
     UpdateWebhook
     UpdateWebhook
     (Maybe WebhookBuildType)
     (Maybe WebhookBuildType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWebhook' {Maybe WebhookBuildType
buildType :: Maybe WebhookBuildType
$sel:buildType:UpdateWebhook' :: UpdateWebhook -> Maybe WebhookBuildType
buildType} -> Maybe WebhookBuildType
buildType) (\s :: UpdateWebhook
s@UpdateWebhook' {} Maybe WebhookBuildType
a -> UpdateWebhook
s {$sel:buildType:UpdateWebhook' :: Maybe WebhookBuildType
buildType = Maybe WebhookBuildType
a} :: UpdateWebhook)

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

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

instance Prelude.NFData UpdateWebhook

instance Core.ToHeaders UpdateWebhook where
  toHeaders :: UpdateWebhook -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateWebhook -> 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.UpdateWebhook" ::
                          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 UpdateWebhook where
  toJSON :: UpdateWebhook -> Value
toJSON UpdateWebhook' {Maybe Bool
Maybe [[WebhookFilter]]
Maybe Text
Maybe WebhookBuildType
Text
projectName :: Text
buildType :: Maybe WebhookBuildType
filterGroups :: Maybe [[WebhookFilter]]
rotateSecret :: Maybe Bool
branchFilter :: Maybe Text
$sel:projectName:UpdateWebhook' :: UpdateWebhook -> Text
$sel:buildType:UpdateWebhook' :: UpdateWebhook -> Maybe WebhookBuildType
$sel:filterGroups:UpdateWebhook' :: UpdateWebhook -> Maybe [[WebhookFilter]]
$sel:rotateSecret:UpdateWebhook' :: UpdateWebhook -> Maybe Bool
$sel:branchFilter:UpdateWebhook' :: UpdateWebhook -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"branchFilter" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
branchFilter,
            (Text
"rotateSecret" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
rotateSecret,
            (Text
"filterGroups" Text -> [[WebhookFilter]] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([[WebhookFilter]] -> Pair)
-> Maybe [[WebhookFilter]] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [[WebhookFilter]]
filterGroups,
            (Text
"buildType" Text -> WebhookBuildType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (WebhookBuildType -> Pair) -> Maybe WebhookBuildType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe WebhookBuildType
buildType,
            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 UpdateWebhook where
  toPath :: UpdateWebhook -> ByteString
toPath = ByteString -> UpdateWebhook -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newUpdateWebhookResponse' smart constructor.
data UpdateWebhookResponse = UpdateWebhookResponse'
  { -- | Information about a repository\'s webhook that is associated with a
    -- project in CodeBuild.
    UpdateWebhookResponse -> Maybe Webhook
webhook :: Prelude.Maybe Webhook,
    -- | The response's http status code.
    UpdateWebhookResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateWebhookResponse -> UpdateWebhookResponse -> Bool
(UpdateWebhookResponse -> UpdateWebhookResponse -> Bool)
-> (UpdateWebhookResponse -> UpdateWebhookResponse -> Bool)
-> Eq UpdateWebhookResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateWebhookResponse -> UpdateWebhookResponse -> Bool
$c/= :: UpdateWebhookResponse -> UpdateWebhookResponse -> Bool
== :: UpdateWebhookResponse -> UpdateWebhookResponse -> Bool
$c== :: UpdateWebhookResponse -> UpdateWebhookResponse -> Bool
Prelude.Eq, ReadPrec [UpdateWebhookResponse]
ReadPrec UpdateWebhookResponse
Int -> ReadS UpdateWebhookResponse
ReadS [UpdateWebhookResponse]
(Int -> ReadS UpdateWebhookResponse)
-> ReadS [UpdateWebhookResponse]
-> ReadPrec UpdateWebhookResponse
-> ReadPrec [UpdateWebhookResponse]
-> Read UpdateWebhookResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateWebhookResponse]
$creadListPrec :: ReadPrec [UpdateWebhookResponse]
readPrec :: ReadPrec UpdateWebhookResponse
$creadPrec :: ReadPrec UpdateWebhookResponse
readList :: ReadS [UpdateWebhookResponse]
$creadList :: ReadS [UpdateWebhookResponse]
readsPrec :: Int -> ReadS UpdateWebhookResponse
$creadsPrec :: Int -> ReadS UpdateWebhookResponse
Prelude.Read, Int -> UpdateWebhookResponse -> ShowS
[UpdateWebhookResponse] -> ShowS
UpdateWebhookResponse -> String
(Int -> UpdateWebhookResponse -> ShowS)
-> (UpdateWebhookResponse -> String)
-> ([UpdateWebhookResponse] -> ShowS)
-> Show UpdateWebhookResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateWebhookResponse] -> ShowS
$cshowList :: [UpdateWebhookResponse] -> ShowS
show :: UpdateWebhookResponse -> String
$cshow :: UpdateWebhookResponse -> String
showsPrec :: Int -> UpdateWebhookResponse -> ShowS
$cshowsPrec :: Int -> UpdateWebhookResponse -> ShowS
Prelude.Show, (forall x. UpdateWebhookResponse -> Rep UpdateWebhookResponse x)
-> (forall x. Rep UpdateWebhookResponse x -> UpdateWebhookResponse)
-> Generic UpdateWebhookResponse
forall x. Rep UpdateWebhookResponse x -> UpdateWebhookResponse
forall x. UpdateWebhookResponse -> Rep UpdateWebhookResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateWebhookResponse x -> UpdateWebhookResponse
$cfrom :: forall x. UpdateWebhookResponse -> Rep UpdateWebhookResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateWebhookResponse' 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:
--
-- 'webhook', 'updateWebhookResponse_webhook' - Information about a repository\'s webhook that is associated with a
-- project in CodeBuild.
--
-- 'httpStatus', 'updateWebhookResponse_httpStatus' - The response's http status code.
newUpdateWebhookResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateWebhookResponse
newUpdateWebhookResponse :: Int -> UpdateWebhookResponse
newUpdateWebhookResponse Int
pHttpStatus_ =
  UpdateWebhookResponse' :: Maybe Webhook -> Int -> UpdateWebhookResponse
UpdateWebhookResponse'
    { $sel:webhook:UpdateWebhookResponse' :: Maybe Webhook
webhook = Maybe Webhook
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateWebhookResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about a repository\'s webhook that is associated with a
-- project in CodeBuild.
updateWebhookResponse_webhook :: Lens.Lens' UpdateWebhookResponse (Prelude.Maybe Webhook)
updateWebhookResponse_webhook :: (Maybe Webhook -> f (Maybe Webhook))
-> UpdateWebhookResponse -> f UpdateWebhookResponse
updateWebhookResponse_webhook = (UpdateWebhookResponse -> Maybe Webhook)
-> (UpdateWebhookResponse
    -> Maybe Webhook -> UpdateWebhookResponse)
-> Lens
     UpdateWebhookResponse
     UpdateWebhookResponse
     (Maybe Webhook)
     (Maybe Webhook)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWebhookResponse' {Maybe Webhook
webhook :: Maybe Webhook
$sel:webhook:UpdateWebhookResponse' :: UpdateWebhookResponse -> Maybe Webhook
webhook} -> Maybe Webhook
webhook) (\s :: UpdateWebhookResponse
s@UpdateWebhookResponse' {} Maybe Webhook
a -> UpdateWebhookResponse
s {$sel:webhook:UpdateWebhookResponse' :: Maybe Webhook
webhook = Maybe Webhook
a} :: UpdateWebhookResponse)

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

instance Prelude.NFData UpdateWebhookResponse