{-# 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.UpdateEventIntegration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates the description of an event integration.
module Amazonka.AppIntegrationS.UpdateEventIntegration
  ( -- * Creating a Request
    UpdateEventIntegration (..),
    newUpdateEventIntegration,

    -- * Request Lenses
    updateEventIntegration_description,
    updateEventIntegration_name,

    -- * Destructuring the Response
    UpdateEventIntegrationResponse (..),
    newUpdateEventIntegrationResponse,

    -- * Response Lenses
    updateEventIntegrationResponse_httpStatus,
  )
where

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

-- |
-- Create a value of 'UpdateEventIntegration' 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:
--
-- 'description', 'updateEventIntegration_description' - The description of the event inegration.
--
-- 'name', 'updateEventIntegration_name' - The name of the event integration.
newUpdateEventIntegration ::
  -- | 'name'
  Prelude.Text ->
  UpdateEventIntegration
newUpdateEventIntegration :: Text -> UpdateEventIntegration
newUpdateEventIntegration Text
pName_ =
  UpdateEventIntegration'
    { $sel:description:UpdateEventIntegration' :: Maybe Text
description =
        forall a. Maybe a
Prelude.Nothing,
      $sel:name:UpdateEventIntegration' :: Text
name = Text
pName_
    }

-- | The description of the event inegration.
updateEventIntegration_description :: Lens.Lens' UpdateEventIntegration (Prelude.Maybe Prelude.Text)
updateEventIntegration_description :: Lens' UpdateEventIntegration (Maybe Text)
updateEventIntegration_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEventIntegration' {Maybe Text
description :: Maybe Text
$sel:description:UpdateEventIntegration' :: UpdateEventIntegration -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateEventIntegration
s@UpdateEventIntegration' {} Maybe Text
a -> UpdateEventIntegration
s {$sel:description:UpdateEventIntegration' :: Maybe Text
description = Maybe Text
a} :: UpdateEventIntegration)

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

instance Core.AWSRequest UpdateEventIntegration where
  type
    AWSResponse UpdateEventIntegration =
      UpdateEventIntegrationResponse
  request :: (Service -> Service)
-> UpdateEventIntegration -> Request UpdateEventIntegration
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateEventIntegration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateEventIntegration)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> UpdateEventIntegrationResponse
UpdateEventIntegrationResponse'
            forall (f :: * -> *) a b. Functor 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 UpdateEventIntegration where
  hashWithSalt :: Int -> UpdateEventIntegration -> Int
hashWithSalt Int
_salt UpdateEventIntegration' {Maybe Text
Text
name :: Text
description :: Maybe Text
$sel:name:UpdateEventIntegration' :: UpdateEventIntegration -> Text
$sel:description:UpdateEventIntegration' :: UpdateEventIntegration -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData UpdateEventIntegration where
  rnf :: UpdateEventIntegration -> ()
rnf UpdateEventIntegration' {Maybe Text
Text
name :: Text
description :: Maybe Text
$sel:name:UpdateEventIntegration' :: UpdateEventIntegration -> Text
$sel:description:UpdateEventIntegration' :: UpdateEventIntegration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name

instance Data.ToHeaders UpdateEventIntegration where
  toHeaders :: UpdateEventIntegration -> 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 UpdateEventIntegration where
  toJSON :: UpdateEventIntegration -> Value
toJSON UpdateEventIntegration' {Maybe Text
Text
name :: Text
description :: Maybe Text
$sel:name:UpdateEventIntegration' :: UpdateEventIntegration -> Text
$sel:description:UpdateEventIntegration' :: UpdateEventIntegration -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description]
      )

instance Data.ToPath UpdateEventIntegration where
  toPath :: UpdateEventIntegration -> ByteString
toPath UpdateEventIntegration' {Maybe Text
Text
name :: Text
description :: Maybe Text
$sel:name:UpdateEventIntegration' :: UpdateEventIntegration -> Text
$sel:description:UpdateEventIntegration' :: UpdateEventIntegration -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/eventIntegrations/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
name]

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

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

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

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

instance
  Prelude.NFData
    UpdateEventIntegrationResponse
  where
  rnf :: UpdateEventIntegrationResponse -> ()
rnf UpdateEventIntegrationResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateEventIntegrationResponse' :: UpdateEventIntegrationResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus