{-# 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.DevOpsGuru.UpdateEventSourcesConfig
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Enables or disables integration with a service that can be integrated
-- with DevOps Guru. The one service that can be integrated with DevOps
-- Guru is Amazon CodeGuru Profiler, which can produce proactive
-- recommendations which can be stored and viewed in DevOps Guru.
module Amazonka.DevOpsGuru.UpdateEventSourcesConfig
  ( -- * Creating a Request
    UpdateEventSourcesConfig (..),
    newUpdateEventSourcesConfig,

    -- * Request Lenses
    updateEventSourcesConfig_eventSources,

    -- * Destructuring the Response
    UpdateEventSourcesConfigResponse (..),
    newUpdateEventSourcesConfigResponse,

    -- * Response Lenses
    updateEventSourcesConfigResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DevOpsGuru.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newUpdateEventSourcesConfig' smart constructor.
data UpdateEventSourcesConfig = UpdateEventSourcesConfig'
  { -- | Configuration information about the integration of DevOps Guru as the
    -- Consumer via EventBridge with another AWS Service.
    UpdateEventSourcesConfig -> Maybe EventSourcesConfig
eventSources :: Prelude.Maybe EventSourcesConfig
  }
  deriving (UpdateEventSourcesConfig -> UpdateEventSourcesConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateEventSourcesConfig -> UpdateEventSourcesConfig -> Bool
$c/= :: UpdateEventSourcesConfig -> UpdateEventSourcesConfig -> Bool
== :: UpdateEventSourcesConfig -> UpdateEventSourcesConfig -> Bool
$c== :: UpdateEventSourcesConfig -> UpdateEventSourcesConfig -> Bool
Prelude.Eq, ReadPrec [UpdateEventSourcesConfig]
ReadPrec UpdateEventSourcesConfig
Int -> ReadS UpdateEventSourcesConfig
ReadS [UpdateEventSourcesConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateEventSourcesConfig]
$creadListPrec :: ReadPrec [UpdateEventSourcesConfig]
readPrec :: ReadPrec UpdateEventSourcesConfig
$creadPrec :: ReadPrec UpdateEventSourcesConfig
readList :: ReadS [UpdateEventSourcesConfig]
$creadList :: ReadS [UpdateEventSourcesConfig]
readsPrec :: Int -> ReadS UpdateEventSourcesConfig
$creadsPrec :: Int -> ReadS UpdateEventSourcesConfig
Prelude.Read, Int -> UpdateEventSourcesConfig -> ShowS
[UpdateEventSourcesConfig] -> ShowS
UpdateEventSourcesConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateEventSourcesConfig] -> ShowS
$cshowList :: [UpdateEventSourcesConfig] -> ShowS
show :: UpdateEventSourcesConfig -> String
$cshow :: UpdateEventSourcesConfig -> String
showsPrec :: Int -> UpdateEventSourcesConfig -> ShowS
$cshowsPrec :: Int -> UpdateEventSourcesConfig -> ShowS
Prelude.Show, forall x.
Rep UpdateEventSourcesConfig x -> UpdateEventSourcesConfig
forall x.
UpdateEventSourcesConfig -> Rep UpdateEventSourcesConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateEventSourcesConfig x -> UpdateEventSourcesConfig
$cfrom :: forall x.
UpdateEventSourcesConfig -> Rep UpdateEventSourcesConfig x
Prelude.Generic)

-- |
-- Create a value of 'UpdateEventSourcesConfig' 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:
--
-- 'eventSources', 'updateEventSourcesConfig_eventSources' - Configuration information about the integration of DevOps Guru as the
-- Consumer via EventBridge with another AWS Service.
newUpdateEventSourcesConfig ::
  UpdateEventSourcesConfig
newUpdateEventSourcesConfig :: UpdateEventSourcesConfig
newUpdateEventSourcesConfig =
  UpdateEventSourcesConfig'
    { $sel:eventSources:UpdateEventSourcesConfig' :: Maybe EventSourcesConfig
eventSources =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Configuration information about the integration of DevOps Guru as the
-- Consumer via EventBridge with another AWS Service.
updateEventSourcesConfig_eventSources :: Lens.Lens' UpdateEventSourcesConfig (Prelude.Maybe EventSourcesConfig)
updateEventSourcesConfig_eventSources :: Lens' UpdateEventSourcesConfig (Maybe EventSourcesConfig)
updateEventSourcesConfig_eventSources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEventSourcesConfig' {Maybe EventSourcesConfig
eventSources :: Maybe EventSourcesConfig
$sel:eventSources:UpdateEventSourcesConfig' :: UpdateEventSourcesConfig -> Maybe EventSourcesConfig
eventSources} -> Maybe EventSourcesConfig
eventSources) (\s :: UpdateEventSourcesConfig
s@UpdateEventSourcesConfig' {} Maybe EventSourcesConfig
a -> UpdateEventSourcesConfig
s {$sel:eventSources:UpdateEventSourcesConfig' :: Maybe EventSourcesConfig
eventSources = Maybe EventSourcesConfig
a} :: UpdateEventSourcesConfig)

instance Core.AWSRequest UpdateEventSourcesConfig where
  type
    AWSResponse UpdateEventSourcesConfig =
      UpdateEventSourcesConfigResponse
  request :: (Service -> Service)
-> UpdateEventSourcesConfig -> Request UpdateEventSourcesConfig
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateEventSourcesConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateEventSourcesConfig)))
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 -> UpdateEventSourcesConfigResponse
UpdateEventSourcesConfigResponse'
            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 UpdateEventSourcesConfig where
  hashWithSalt :: Int -> UpdateEventSourcesConfig -> Int
hashWithSalt Int
_salt UpdateEventSourcesConfig' {Maybe EventSourcesConfig
eventSources :: Maybe EventSourcesConfig
$sel:eventSources:UpdateEventSourcesConfig' :: UpdateEventSourcesConfig -> Maybe EventSourcesConfig
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EventSourcesConfig
eventSources

instance Prelude.NFData UpdateEventSourcesConfig where
  rnf :: UpdateEventSourcesConfig -> ()
rnf UpdateEventSourcesConfig' {Maybe EventSourcesConfig
eventSources :: Maybe EventSourcesConfig
$sel:eventSources:UpdateEventSourcesConfig' :: UpdateEventSourcesConfig -> Maybe EventSourcesConfig
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe EventSourcesConfig
eventSources

instance Data.ToHeaders UpdateEventSourcesConfig where
  toHeaders :: UpdateEventSourcesConfig -> 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 UpdateEventSourcesConfig where
  toJSON :: UpdateEventSourcesConfig -> Value
toJSON UpdateEventSourcesConfig' {Maybe EventSourcesConfig
eventSources :: Maybe EventSourcesConfig
$sel:eventSources:UpdateEventSourcesConfig' :: UpdateEventSourcesConfig -> Maybe EventSourcesConfig
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"EventSources" 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 EventSourcesConfig
eventSources]
      )

instance Data.ToPath UpdateEventSourcesConfig where
  toPath :: UpdateEventSourcesConfig -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/event-sources"

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

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

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

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

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