{-# 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.DescribeServiceIntegration
-- 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)
--
-- Returns the integration status of services that are integrated with
-- DevOps Guru. The one service that can be integrated with DevOps Guru is
-- AWS Systems Manager, which can be used to create an OpsItem for each
-- generated insight.
module Amazonka.DevOpsGuru.DescribeServiceIntegration
  ( -- * Creating a Request
    DescribeServiceIntegration (..),
    newDescribeServiceIntegration,

    -- * Destructuring the Response
    DescribeServiceIntegrationResponse (..),
    newDescribeServiceIntegrationResponse,

    -- * Response Lenses
    describeServiceIntegrationResponse_serviceIntegration,
    describeServiceIntegrationResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DevOpsGuru.Types
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:/ 'newDescribeServiceIntegration' smart constructor.
data DescribeServiceIntegration = DescribeServiceIntegration'
  {
  }
  deriving (DescribeServiceIntegration -> DescribeServiceIntegration -> Bool
(DescribeServiceIntegration -> DescribeServiceIntegration -> Bool)
-> (DescribeServiceIntegration
    -> DescribeServiceIntegration -> Bool)
-> Eq DescribeServiceIntegration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeServiceIntegration -> DescribeServiceIntegration -> Bool
$c/= :: DescribeServiceIntegration -> DescribeServiceIntegration -> Bool
== :: DescribeServiceIntegration -> DescribeServiceIntegration -> Bool
$c== :: DescribeServiceIntegration -> DescribeServiceIntegration -> Bool
Prelude.Eq, ReadPrec [DescribeServiceIntegration]
ReadPrec DescribeServiceIntegration
Int -> ReadS DescribeServiceIntegration
ReadS [DescribeServiceIntegration]
(Int -> ReadS DescribeServiceIntegration)
-> ReadS [DescribeServiceIntegration]
-> ReadPrec DescribeServiceIntegration
-> ReadPrec [DescribeServiceIntegration]
-> Read DescribeServiceIntegration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeServiceIntegration]
$creadListPrec :: ReadPrec [DescribeServiceIntegration]
readPrec :: ReadPrec DescribeServiceIntegration
$creadPrec :: ReadPrec DescribeServiceIntegration
readList :: ReadS [DescribeServiceIntegration]
$creadList :: ReadS [DescribeServiceIntegration]
readsPrec :: Int -> ReadS DescribeServiceIntegration
$creadsPrec :: Int -> ReadS DescribeServiceIntegration
Prelude.Read, Int -> DescribeServiceIntegration -> ShowS
[DescribeServiceIntegration] -> ShowS
DescribeServiceIntegration -> String
(Int -> DescribeServiceIntegration -> ShowS)
-> (DescribeServiceIntegration -> String)
-> ([DescribeServiceIntegration] -> ShowS)
-> Show DescribeServiceIntegration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeServiceIntegration] -> ShowS
$cshowList :: [DescribeServiceIntegration] -> ShowS
show :: DescribeServiceIntegration -> String
$cshow :: DescribeServiceIntegration -> String
showsPrec :: Int -> DescribeServiceIntegration -> ShowS
$cshowsPrec :: Int -> DescribeServiceIntegration -> ShowS
Prelude.Show, (forall x.
 DescribeServiceIntegration -> Rep DescribeServiceIntegration x)
-> (forall x.
    Rep DescribeServiceIntegration x -> DescribeServiceIntegration)
-> Generic DescribeServiceIntegration
forall x.
Rep DescribeServiceIntegration x -> DescribeServiceIntegration
forall x.
DescribeServiceIntegration -> Rep DescribeServiceIntegration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeServiceIntegration x -> DescribeServiceIntegration
$cfrom :: forall x.
DescribeServiceIntegration -> Rep DescribeServiceIntegration x
Prelude.Generic)

-- |
-- Create a value of 'DescribeServiceIntegration' 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.
newDescribeServiceIntegration ::
  DescribeServiceIntegration
newDescribeServiceIntegration :: DescribeServiceIntegration
newDescribeServiceIntegration =
  DescribeServiceIntegration
DescribeServiceIntegration'

instance Core.AWSRequest DescribeServiceIntegration where
  type
    AWSResponse DescribeServiceIntegration =
      DescribeServiceIntegrationResponse
  request :: DescribeServiceIntegration -> Request DescribeServiceIntegration
request = Service
-> DescribeServiceIntegration -> Request DescribeServiceIntegration
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeServiceIntegration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeServiceIntegration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeServiceIntegration))
-> Logger
-> Service
-> Proxy DescribeServiceIntegration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeServiceIntegration)))
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 ServiceIntegrationConfig
-> Int -> DescribeServiceIntegrationResponse
DescribeServiceIntegrationResponse'
            (Maybe ServiceIntegrationConfig
 -> Int -> DescribeServiceIntegrationResponse)
-> Either String (Maybe ServiceIntegrationConfig)
-> Either String (Int -> DescribeServiceIntegrationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe ServiceIntegrationConfig)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"ServiceIntegration")
            Either String (Int -> DescribeServiceIntegrationResponse)
-> Either String Int
-> Either String DescribeServiceIntegrationResponse
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 DescribeServiceIntegration

instance Prelude.NFData DescribeServiceIntegration

instance Core.ToHeaders DescribeServiceIntegration where
  toHeaders :: DescribeServiceIntegration -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeServiceIntegration -> 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.ToPath DescribeServiceIntegration where
  toPath :: DescribeServiceIntegration -> ByteString
toPath = ByteString -> DescribeServiceIntegration -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/service-integrations"

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

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

-- |
-- Create a value of 'DescribeServiceIntegrationResponse' 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:
--
-- 'serviceIntegration', 'describeServiceIntegrationResponse_serviceIntegration' - Undocumented member.
--
-- 'httpStatus', 'describeServiceIntegrationResponse_httpStatus' - The response's http status code.
newDescribeServiceIntegrationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeServiceIntegrationResponse
newDescribeServiceIntegrationResponse :: Int -> DescribeServiceIntegrationResponse
newDescribeServiceIntegrationResponse Int
pHttpStatus_ =
  DescribeServiceIntegrationResponse' :: Maybe ServiceIntegrationConfig
-> Int -> DescribeServiceIntegrationResponse
DescribeServiceIntegrationResponse'
    { $sel:serviceIntegration:DescribeServiceIntegrationResponse' :: Maybe ServiceIntegrationConfig
serviceIntegration =
        Maybe ServiceIntegrationConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeServiceIntegrationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
describeServiceIntegrationResponse_serviceIntegration :: Lens.Lens' DescribeServiceIntegrationResponse (Prelude.Maybe ServiceIntegrationConfig)
describeServiceIntegrationResponse_serviceIntegration :: (Maybe ServiceIntegrationConfig
 -> f (Maybe ServiceIntegrationConfig))
-> DescribeServiceIntegrationResponse
-> f DescribeServiceIntegrationResponse
describeServiceIntegrationResponse_serviceIntegration = (DescribeServiceIntegrationResponse
 -> Maybe ServiceIntegrationConfig)
-> (DescribeServiceIntegrationResponse
    -> Maybe ServiceIntegrationConfig
    -> DescribeServiceIntegrationResponse)
-> Lens
     DescribeServiceIntegrationResponse
     DescribeServiceIntegrationResponse
     (Maybe ServiceIntegrationConfig)
     (Maybe ServiceIntegrationConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeServiceIntegrationResponse' {Maybe ServiceIntegrationConfig
serviceIntegration :: Maybe ServiceIntegrationConfig
$sel:serviceIntegration:DescribeServiceIntegrationResponse' :: DescribeServiceIntegrationResponse
-> Maybe ServiceIntegrationConfig
serviceIntegration} -> Maybe ServiceIntegrationConfig
serviceIntegration) (\s :: DescribeServiceIntegrationResponse
s@DescribeServiceIntegrationResponse' {} Maybe ServiceIntegrationConfig
a -> DescribeServiceIntegrationResponse
s {$sel:serviceIntegration:DescribeServiceIntegrationResponse' :: Maybe ServiceIntegrationConfig
serviceIntegration = Maybe ServiceIntegrationConfig
a} :: DescribeServiceIntegrationResponse)

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

instance
  Prelude.NFData
    DescribeServiceIntegrationResponse