{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.ServiceIntegrationConfig
-- 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)
module Amazonka.DevOpsGuru.Types.ServiceIntegrationConfig where

import qualified Amazonka.Core as Core
import Amazonka.DevOpsGuru.Types.OpsCenterIntegration
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the integration of DevOps Guru with another AWS
-- service, such as AWS Systems Manager.
--
-- /See:/ 'newServiceIntegrationConfig' smart constructor.
data ServiceIntegrationConfig = ServiceIntegrationConfig'
  { -- | Information about whether DevOps Guru is configured to create an OpsItem
    -- in AWS Systems Manager OpsCenter for each created insight.
    ServiceIntegrationConfig -> Maybe OpsCenterIntegration
opsCenter :: Prelude.Maybe OpsCenterIntegration
  }
  deriving (ServiceIntegrationConfig -> ServiceIntegrationConfig -> Bool
(ServiceIntegrationConfig -> ServiceIntegrationConfig -> Bool)
-> (ServiceIntegrationConfig -> ServiceIntegrationConfig -> Bool)
-> Eq ServiceIntegrationConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServiceIntegrationConfig -> ServiceIntegrationConfig -> Bool
$c/= :: ServiceIntegrationConfig -> ServiceIntegrationConfig -> Bool
== :: ServiceIntegrationConfig -> ServiceIntegrationConfig -> Bool
$c== :: ServiceIntegrationConfig -> ServiceIntegrationConfig -> Bool
Prelude.Eq, ReadPrec [ServiceIntegrationConfig]
ReadPrec ServiceIntegrationConfig
Int -> ReadS ServiceIntegrationConfig
ReadS [ServiceIntegrationConfig]
(Int -> ReadS ServiceIntegrationConfig)
-> ReadS [ServiceIntegrationConfig]
-> ReadPrec ServiceIntegrationConfig
-> ReadPrec [ServiceIntegrationConfig]
-> Read ServiceIntegrationConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServiceIntegrationConfig]
$creadListPrec :: ReadPrec [ServiceIntegrationConfig]
readPrec :: ReadPrec ServiceIntegrationConfig
$creadPrec :: ReadPrec ServiceIntegrationConfig
readList :: ReadS [ServiceIntegrationConfig]
$creadList :: ReadS [ServiceIntegrationConfig]
readsPrec :: Int -> ReadS ServiceIntegrationConfig
$creadsPrec :: Int -> ReadS ServiceIntegrationConfig
Prelude.Read, Int -> ServiceIntegrationConfig -> ShowS
[ServiceIntegrationConfig] -> ShowS
ServiceIntegrationConfig -> String
(Int -> ServiceIntegrationConfig -> ShowS)
-> (ServiceIntegrationConfig -> String)
-> ([ServiceIntegrationConfig] -> ShowS)
-> Show ServiceIntegrationConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServiceIntegrationConfig] -> ShowS
$cshowList :: [ServiceIntegrationConfig] -> ShowS
show :: ServiceIntegrationConfig -> String
$cshow :: ServiceIntegrationConfig -> String
showsPrec :: Int -> ServiceIntegrationConfig -> ShowS
$cshowsPrec :: Int -> ServiceIntegrationConfig -> ShowS
Prelude.Show, (forall x.
 ServiceIntegrationConfig -> Rep ServiceIntegrationConfig x)
-> (forall x.
    Rep ServiceIntegrationConfig x -> ServiceIntegrationConfig)
-> Generic ServiceIntegrationConfig
forall x.
Rep ServiceIntegrationConfig x -> ServiceIntegrationConfig
forall x.
ServiceIntegrationConfig -> Rep ServiceIntegrationConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ServiceIntegrationConfig x -> ServiceIntegrationConfig
$cfrom :: forall x.
ServiceIntegrationConfig -> Rep ServiceIntegrationConfig x
Prelude.Generic)

-- |
-- Create a value of 'ServiceIntegrationConfig' 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:
--
-- 'opsCenter', 'serviceIntegrationConfig_opsCenter' - Information about whether DevOps Guru is configured to create an OpsItem
-- in AWS Systems Manager OpsCenter for each created insight.
newServiceIntegrationConfig ::
  ServiceIntegrationConfig
newServiceIntegrationConfig :: ServiceIntegrationConfig
newServiceIntegrationConfig =
  ServiceIntegrationConfig' :: Maybe OpsCenterIntegration -> ServiceIntegrationConfig
ServiceIntegrationConfig'
    { $sel:opsCenter:ServiceIntegrationConfig' :: Maybe OpsCenterIntegration
opsCenter =
        Maybe OpsCenterIntegration
forall a. Maybe a
Prelude.Nothing
    }

-- | Information about whether DevOps Guru is configured to create an OpsItem
-- in AWS Systems Manager OpsCenter for each created insight.
serviceIntegrationConfig_opsCenter :: Lens.Lens' ServiceIntegrationConfig (Prelude.Maybe OpsCenterIntegration)
serviceIntegrationConfig_opsCenter :: (Maybe OpsCenterIntegration -> f (Maybe OpsCenterIntegration))
-> ServiceIntegrationConfig -> f ServiceIntegrationConfig
serviceIntegrationConfig_opsCenter = (ServiceIntegrationConfig -> Maybe OpsCenterIntegration)
-> (ServiceIntegrationConfig
    -> Maybe OpsCenterIntegration -> ServiceIntegrationConfig)
-> Lens
     ServiceIntegrationConfig
     ServiceIntegrationConfig
     (Maybe OpsCenterIntegration)
     (Maybe OpsCenterIntegration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceIntegrationConfig' {Maybe OpsCenterIntegration
opsCenter :: Maybe OpsCenterIntegration
$sel:opsCenter:ServiceIntegrationConfig' :: ServiceIntegrationConfig -> Maybe OpsCenterIntegration
opsCenter} -> Maybe OpsCenterIntegration
opsCenter) (\s :: ServiceIntegrationConfig
s@ServiceIntegrationConfig' {} Maybe OpsCenterIntegration
a -> ServiceIntegrationConfig
s {$sel:opsCenter:ServiceIntegrationConfig' :: Maybe OpsCenterIntegration
opsCenter = Maybe OpsCenterIntegration
a} :: ServiceIntegrationConfig)

instance Core.FromJSON ServiceIntegrationConfig where
  parseJSON :: Value -> Parser ServiceIntegrationConfig
parseJSON =
    String
-> (Object -> Parser ServiceIntegrationConfig)
-> Value
-> Parser ServiceIntegrationConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ServiceIntegrationConfig"
      ( \Object
x ->
          Maybe OpsCenterIntegration -> ServiceIntegrationConfig
ServiceIntegrationConfig'
            (Maybe OpsCenterIntegration -> ServiceIntegrationConfig)
-> Parser (Maybe OpsCenterIntegration)
-> Parser ServiceIntegrationConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe OpsCenterIntegration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OpsCenter")
      )

instance Prelude.Hashable ServiceIntegrationConfig

instance Prelude.NFData ServiceIntegrationConfig