{-# 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.DescribeAccountHealth
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns the number of open reactive insights, the number of open
-- proactive insights, and the number of metrics analyzed in your Amazon
-- Web Services account. Use these numbers to gauge the health of
-- operations in your Amazon Web Services account.
module Amazonka.DevOpsGuru.DescribeAccountHealth
  ( -- * Creating a Request
    DescribeAccountHealth (..),
    newDescribeAccountHealth,

    -- * Destructuring the Response
    DescribeAccountHealthResponse (..),
    newDescribeAccountHealthResponse,

    -- * Response Lenses
    describeAccountHealthResponse_analyzedResourceCount,
    describeAccountHealthResponse_httpStatus,
    describeAccountHealthResponse_openReactiveInsights,
    describeAccountHealthResponse_openProactiveInsights,
    describeAccountHealthResponse_metricsAnalyzed,
    describeAccountHealthResponse_resourceHours,
  )
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:/ 'newDescribeAccountHealth' smart constructor.
data DescribeAccountHealth = DescribeAccountHealth'
  {
  }
  deriving (DescribeAccountHealth -> DescribeAccountHealth -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAccountHealth -> DescribeAccountHealth -> Bool
$c/= :: DescribeAccountHealth -> DescribeAccountHealth -> Bool
== :: DescribeAccountHealth -> DescribeAccountHealth -> Bool
$c== :: DescribeAccountHealth -> DescribeAccountHealth -> Bool
Prelude.Eq, ReadPrec [DescribeAccountHealth]
ReadPrec DescribeAccountHealth
Int -> ReadS DescribeAccountHealth
ReadS [DescribeAccountHealth]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAccountHealth]
$creadListPrec :: ReadPrec [DescribeAccountHealth]
readPrec :: ReadPrec DescribeAccountHealth
$creadPrec :: ReadPrec DescribeAccountHealth
readList :: ReadS [DescribeAccountHealth]
$creadList :: ReadS [DescribeAccountHealth]
readsPrec :: Int -> ReadS DescribeAccountHealth
$creadsPrec :: Int -> ReadS DescribeAccountHealth
Prelude.Read, Int -> DescribeAccountHealth -> ShowS
[DescribeAccountHealth] -> ShowS
DescribeAccountHealth -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAccountHealth] -> ShowS
$cshowList :: [DescribeAccountHealth] -> ShowS
show :: DescribeAccountHealth -> String
$cshow :: DescribeAccountHealth -> String
showsPrec :: Int -> DescribeAccountHealth -> ShowS
$cshowsPrec :: Int -> DescribeAccountHealth -> ShowS
Prelude.Show, forall x. Rep DescribeAccountHealth x -> DescribeAccountHealth
forall x. DescribeAccountHealth -> Rep DescribeAccountHealth x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAccountHealth x -> DescribeAccountHealth
$cfrom :: forall x. DescribeAccountHealth -> Rep DescribeAccountHealth x
Prelude.Generic)

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

instance Core.AWSRequest DescribeAccountHealth where
  type
    AWSResponse DescribeAccountHealth =
      DescribeAccountHealthResponse
  request :: (Service -> Service)
-> DescribeAccountHealth -> Request DescribeAccountHealth
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeAccountHealth
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAccountHealth)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Integer
-> Int
-> Int
-> Int
-> Int
-> Integer
-> DescribeAccountHealthResponse
DescribeAccountHealthResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"AnalyzedResourceCount")
            forall (f :: * -> *) a b. Applicative f => 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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"OpenReactiveInsights")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"OpenProactiveInsights")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"MetricsAnalyzed")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"ResourceHours")
      )

instance Prelude.Hashable DescribeAccountHealth where
  hashWithSalt :: Int -> DescribeAccountHealth -> Int
hashWithSalt Int
_salt DescribeAccountHealth
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

instance Prelude.NFData DescribeAccountHealth where
  rnf :: DescribeAccountHealth -> ()
rnf DescribeAccountHealth
_ = ()

instance Data.ToHeaders DescribeAccountHealth where
  toHeaders :: DescribeAccountHealth -> 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.ToPath DescribeAccountHealth where
  toPath :: DescribeAccountHealth -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/accounts/health"

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

-- | /See:/ 'newDescribeAccountHealthResponse' smart constructor.
data DescribeAccountHealthResponse = DescribeAccountHealthResponse'
  { -- | Number of resources that DevOps Guru is monitoring in your Amazon Web
    -- Services account.
    DescribeAccountHealthResponse -> Maybe Integer
analyzedResourceCount :: Prelude.Maybe Prelude.Integer,
    -- | The response's http status code.
    DescribeAccountHealthResponse -> Int
httpStatus :: Prelude.Int,
    -- | An integer that specifies the number of open reactive insights in your
    -- Amazon Web Services account.
    DescribeAccountHealthResponse -> Int
openReactiveInsights :: Prelude.Int,
    -- | An integer that specifies the number of open proactive insights in your
    -- Amazon Web Services account.
    DescribeAccountHealthResponse -> Int
openProactiveInsights :: Prelude.Int,
    -- | An integer that specifies the number of metrics that have been analyzed
    -- in your Amazon Web Services account.
    DescribeAccountHealthResponse -> Int
metricsAnalyzed :: Prelude.Int,
    -- | The number of Amazon DevOps Guru resource analysis hours billed to the
    -- current Amazon Web Services account in the last hour.
    DescribeAccountHealthResponse -> Integer
resourceHours :: Prelude.Integer
  }
  deriving (DescribeAccountHealthResponse
-> DescribeAccountHealthResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAccountHealthResponse
-> DescribeAccountHealthResponse -> Bool
$c/= :: DescribeAccountHealthResponse
-> DescribeAccountHealthResponse -> Bool
== :: DescribeAccountHealthResponse
-> DescribeAccountHealthResponse -> Bool
$c== :: DescribeAccountHealthResponse
-> DescribeAccountHealthResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAccountHealthResponse]
ReadPrec DescribeAccountHealthResponse
Int -> ReadS DescribeAccountHealthResponse
ReadS [DescribeAccountHealthResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAccountHealthResponse]
$creadListPrec :: ReadPrec [DescribeAccountHealthResponse]
readPrec :: ReadPrec DescribeAccountHealthResponse
$creadPrec :: ReadPrec DescribeAccountHealthResponse
readList :: ReadS [DescribeAccountHealthResponse]
$creadList :: ReadS [DescribeAccountHealthResponse]
readsPrec :: Int -> ReadS DescribeAccountHealthResponse
$creadsPrec :: Int -> ReadS DescribeAccountHealthResponse
Prelude.Read, Int -> DescribeAccountHealthResponse -> ShowS
[DescribeAccountHealthResponse] -> ShowS
DescribeAccountHealthResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAccountHealthResponse] -> ShowS
$cshowList :: [DescribeAccountHealthResponse] -> ShowS
show :: DescribeAccountHealthResponse -> String
$cshow :: DescribeAccountHealthResponse -> String
showsPrec :: Int -> DescribeAccountHealthResponse -> ShowS
$cshowsPrec :: Int -> DescribeAccountHealthResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeAccountHealthResponse x
-> DescribeAccountHealthResponse
forall x.
DescribeAccountHealthResponse
-> Rep DescribeAccountHealthResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAccountHealthResponse x
-> DescribeAccountHealthResponse
$cfrom :: forall x.
DescribeAccountHealthResponse
-> Rep DescribeAccountHealthResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAccountHealthResponse' 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:
--
-- 'analyzedResourceCount', 'describeAccountHealthResponse_analyzedResourceCount' - Number of resources that DevOps Guru is monitoring in your Amazon Web
-- Services account.
--
-- 'httpStatus', 'describeAccountHealthResponse_httpStatus' - The response's http status code.
--
-- 'openReactiveInsights', 'describeAccountHealthResponse_openReactiveInsights' - An integer that specifies the number of open reactive insights in your
-- Amazon Web Services account.
--
-- 'openProactiveInsights', 'describeAccountHealthResponse_openProactiveInsights' - An integer that specifies the number of open proactive insights in your
-- Amazon Web Services account.
--
-- 'metricsAnalyzed', 'describeAccountHealthResponse_metricsAnalyzed' - An integer that specifies the number of metrics that have been analyzed
-- in your Amazon Web Services account.
--
-- 'resourceHours', 'describeAccountHealthResponse_resourceHours' - The number of Amazon DevOps Guru resource analysis hours billed to the
-- current Amazon Web Services account in the last hour.
newDescribeAccountHealthResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'openReactiveInsights'
  Prelude.Int ->
  -- | 'openProactiveInsights'
  Prelude.Int ->
  -- | 'metricsAnalyzed'
  Prelude.Int ->
  -- | 'resourceHours'
  Prelude.Integer ->
  DescribeAccountHealthResponse
newDescribeAccountHealthResponse :: Int
-> Int -> Int -> Int -> Integer -> DescribeAccountHealthResponse
newDescribeAccountHealthResponse
  Int
pHttpStatus_
  Int
pOpenReactiveInsights_
  Int
pOpenProactiveInsights_
  Int
pMetricsAnalyzed_
  Integer
pResourceHours_ =
    DescribeAccountHealthResponse'
      { $sel:analyzedResourceCount:DescribeAccountHealthResponse' :: Maybe Integer
analyzedResourceCount =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeAccountHealthResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:openReactiveInsights:DescribeAccountHealthResponse' :: Int
openReactiveInsights =
          Int
pOpenReactiveInsights_,
        $sel:openProactiveInsights:DescribeAccountHealthResponse' :: Int
openProactiveInsights =
          Int
pOpenProactiveInsights_,
        $sel:metricsAnalyzed:DescribeAccountHealthResponse' :: Int
metricsAnalyzed = Int
pMetricsAnalyzed_,
        $sel:resourceHours:DescribeAccountHealthResponse' :: Integer
resourceHours = Integer
pResourceHours_
      }

-- | Number of resources that DevOps Guru is monitoring in your Amazon Web
-- Services account.
describeAccountHealthResponse_analyzedResourceCount :: Lens.Lens' DescribeAccountHealthResponse (Prelude.Maybe Prelude.Integer)
describeAccountHealthResponse_analyzedResourceCount :: Lens' DescribeAccountHealthResponse (Maybe Integer)
describeAccountHealthResponse_analyzedResourceCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccountHealthResponse' {Maybe Integer
analyzedResourceCount :: Maybe Integer
$sel:analyzedResourceCount:DescribeAccountHealthResponse' :: DescribeAccountHealthResponse -> Maybe Integer
analyzedResourceCount} -> Maybe Integer
analyzedResourceCount) (\s :: DescribeAccountHealthResponse
s@DescribeAccountHealthResponse' {} Maybe Integer
a -> DescribeAccountHealthResponse
s {$sel:analyzedResourceCount:DescribeAccountHealthResponse' :: Maybe Integer
analyzedResourceCount = Maybe Integer
a} :: DescribeAccountHealthResponse)

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

-- | An integer that specifies the number of open reactive insights in your
-- Amazon Web Services account.
describeAccountHealthResponse_openReactiveInsights :: Lens.Lens' DescribeAccountHealthResponse Prelude.Int
describeAccountHealthResponse_openReactiveInsights :: Lens' DescribeAccountHealthResponse Int
describeAccountHealthResponse_openReactiveInsights = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccountHealthResponse' {Int
openReactiveInsights :: Int
$sel:openReactiveInsights:DescribeAccountHealthResponse' :: DescribeAccountHealthResponse -> Int
openReactiveInsights} -> Int
openReactiveInsights) (\s :: DescribeAccountHealthResponse
s@DescribeAccountHealthResponse' {} Int
a -> DescribeAccountHealthResponse
s {$sel:openReactiveInsights:DescribeAccountHealthResponse' :: Int
openReactiveInsights = Int
a} :: DescribeAccountHealthResponse)

-- | An integer that specifies the number of open proactive insights in your
-- Amazon Web Services account.
describeAccountHealthResponse_openProactiveInsights :: Lens.Lens' DescribeAccountHealthResponse Prelude.Int
describeAccountHealthResponse_openProactiveInsights :: Lens' DescribeAccountHealthResponse Int
describeAccountHealthResponse_openProactiveInsights = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccountHealthResponse' {Int
openProactiveInsights :: Int
$sel:openProactiveInsights:DescribeAccountHealthResponse' :: DescribeAccountHealthResponse -> Int
openProactiveInsights} -> Int
openProactiveInsights) (\s :: DescribeAccountHealthResponse
s@DescribeAccountHealthResponse' {} Int
a -> DescribeAccountHealthResponse
s {$sel:openProactiveInsights:DescribeAccountHealthResponse' :: Int
openProactiveInsights = Int
a} :: DescribeAccountHealthResponse)

-- | An integer that specifies the number of metrics that have been analyzed
-- in your Amazon Web Services account.
describeAccountHealthResponse_metricsAnalyzed :: Lens.Lens' DescribeAccountHealthResponse Prelude.Int
describeAccountHealthResponse_metricsAnalyzed :: Lens' DescribeAccountHealthResponse Int
describeAccountHealthResponse_metricsAnalyzed = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccountHealthResponse' {Int
metricsAnalyzed :: Int
$sel:metricsAnalyzed:DescribeAccountHealthResponse' :: DescribeAccountHealthResponse -> Int
metricsAnalyzed} -> Int
metricsAnalyzed) (\s :: DescribeAccountHealthResponse
s@DescribeAccountHealthResponse' {} Int
a -> DescribeAccountHealthResponse
s {$sel:metricsAnalyzed:DescribeAccountHealthResponse' :: Int
metricsAnalyzed = Int
a} :: DescribeAccountHealthResponse)

-- | The number of Amazon DevOps Guru resource analysis hours billed to the
-- current Amazon Web Services account in the last hour.
describeAccountHealthResponse_resourceHours :: Lens.Lens' DescribeAccountHealthResponse Prelude.Integer
describeAccountHealthResponse_resourceHours :: Lens' DescribeAccountHealthResponse Integer
describeAccountHealthResponse_resourceHours = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccountHealthResponse' {Integer
resourceHours :: Integer
$sel:resourceHours:DescribeAccountHealthResponse' :: DescribeAccountHealthResponse -> Integer
resourceHours} -> Integer
resourceHours) (\s :: DescribeAccountHealthResponse
s@DescribeAccountHealthResponse' {} Integer
a -> DescribeAccountHealthResponse
s {$sel:resourceHours:DescribeAccountHealthResponse' :: Integer
resourceHours = Integer
a} :: DescribeAccountHealthResponse)

instance Prelude.NFData DescribeAccountHealthResponse where
  rnf :: DescribeAccountHealthResponse -> ()
rnf DescribeAccountHealthResponse' {Int
Integer
Maybe Integer
resourceHours :: Integer
metricsAnalyzed :: Int
openProactiveInsights :: Int
openReactiveInsights :: Int
httpStatus :: Int
analyzedResourceCount :: Maybe Integer
$sel:resourceHours:DescribeAccountHealthResponse' :: DescribeAccountHealthResponse -> Integer
$sel:metricsAnalyzed:DescribeAccountHealthResponse' :: DescribeAccountHealthResponse -> Int
$sel:openProactiveInsights:DescribeAccountHealthResponse' :: DescribeAccountHealthResponse -> Int
$sel:openReactiveInsights:DescribeAccountHealthResponse' :: DescribeAccountHealthResponse -> Int
$sel:httpStatus:DescribeAccountHealthResponse' :: DescribeAccountHealthResponse -> Int
$sel:analyzedResourceCount:DescribeAccountHealthResponse' :: DescribeAccountHealthResponse -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
analyzedResourceCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
openReactiveInsights
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
openProactiveInsights
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
metricsAnalyzed
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
resourceHours