{-# 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-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 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.Lens as Lens
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
(UpdateEventIntegration -> UpdateEventIntegration -> Bool)
-> (UpdateEventIntegration -> UpdateEventIntegration -> Bool)
-> Eq UpdateEventIntegration
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]
(Int -> ReadS UpdateEventIntegration)
-> ReadS [UpdateEventIntegration]
-> ReadPrec UpdateEventIntegration
-> ReadPrec [UpdateEventIntegration]
-> Read 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
(Int -> UpdateEventIntegration -> ShowS)
-> (UpdateEventIntegration -> String)
-> ([UpdateEventIntegration] -> ShowS)
-> Show UpdateEventIntegration
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. UpdateEventIntegration -> Rep UpdateEventIntegration x)
-> (forall x.
    Rep UpdateEventIntegration x -> UpdateEventIntegration)
-> Generic UpdateEventIntegration
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' :: Maybe Text -> Text -> UpdateEventIntegration
UpdateEventIntegration'
    { $sel:description:UpdateEventIntegration' :: Maybe Text
description =
        Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> UpdateEventIntegration -> f UpdateEventIntegration
updateEventIntegration_description = (UpdateEventIntegration -> Maybe Text)
-> (UpdateEventIntegration -> Maybe Text -> UpdateEventIntegration)
-> Lens
     UpdateEventIntegration
     UpdateEventIntegration
     (Maybe Text)
     (Maybe Text)
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 :: (Text -> f Text)
-> UpdateEventIntegration -> f UpdateEventIntegration
updateEventIntegration_name = (UpdateEventIntegration -> Text)
-> (UpdateEventIntegration -> Text -> UpdateEventIntegration)
-> Lens UpdateEventIntegration UpdateEventIntegration Text Text
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 :: UpdateEventIntegration -> Request UpdateEventIntegration
request = Service -> UpdateEventIntegration -> Request UpdateEventIntegration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateEventIntegration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateEventIntegration)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse UpdateEventIntegration))
-> Logger
-> Service
-> Proxy UpdateEventIntegration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateEventIntegration)))
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 -> UpdateEventIntegrationResponse
UpdateEventIntegrationResponse'
            (Int -> UpdateEventIntegrationResponse)
-> Either String Int
-> Either String UpdateEventIntegrationResponse
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 UpdateEventIntegration

instance Prelude.NFData UpdateEventIntegration

instance Core.ToHeaders UpdateEventIntegration where
  toHeaders :: UpdateEventIntegration -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateEventIntegration -> 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 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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"Description" 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
description]
      )

instance Core.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
..} =
    [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 UpdateEventIntegration where
  toQuery :: UpdateEventIntegration -> QueryString
toQuery = QueryString -> UpdateEventIntegration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(UpdateEventIntegrationResponse
 -> UpdateEventIntegrationResponse -> Bool)
-> (UpdateEventIntegrationResponse
    -> UpdateEventIntegrationResponse -> Bool)
-> Eq UpdateEventIntegrationResponse
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]
(Int -> ReadS UpdateEventIntegrationResponse)
-> ReadS [UpdateEventIntegrationResponse]
-> ReadPrec UpdateEventIntegrationResponse
-> ReadPrec [UpdateEventIntegrationResponse]
-> Read 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
(Int -> UpdateEventIntegrationResponse -> ShowS)
-> (UpdateEventIntegrationResponse -> String)
-> ([UpdateEventIntegrationResponse] -> ShowS)
-> Show UpdateEventIntegrationResponse
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.
 UpdateEventIntegrationResponse
 -> Rep UpdateEventIntegrationResponse x)
-> (forall x.
    Rep UpdateEventIntegrationResponse x
    -> UpdateEventIntegrationResponse)
-> Generic UpdateEventIntegrationResponse
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' :: Int -> UpdateEventIntegrationResponse
UpdateEventIntegrationResponse'
    { $sel:httpStatus:UpdateEventIntegrationResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
updateEventIntegrationResponse_httpStatus :: Lens.Lens' UpdateEventIntegrationResponse Prelude.Int
updateEventIntegrationResponse_httpStatus :: (Int -> f Int)
-> UpdateEventIntegrationResponse
-> f UpdateEventIntegrationResponse
updateEventIntegrationResponse_httpStatus = (UpdateEventIntegrationResponse -> Int)
-> (UpdateEventIntegrationResponse
    -> Int -> UpdateEventIntegrationResponse)
-> Lens
     UpdateEventIntegrationResponse
     UpdateEventIntegrationResponse
     Int
     Int
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