{-# 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-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 number of open reactive insights, the number of open
-- proactive insights, and the number of metrics analyzed in your AWS
-- account. Use these numbers to gauge the health of operations in your AWS
-- account.
module Amazonka.DevOpsGuru.DescribeAccountHealth
  ( -- * Creating a Request
    DescribeAccountHealth (..),
    newDescribeAccountHealth,

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

    -- * Response Lenses
    describeAccountHealthResponse_httpStatus,
    describeAccountHealthResponse_openReactiveInsights,
    describeAccountHealthResponse_openProactiveInsights,
    describeAccountHealthResponse_metricsAnalyzed,
    describeAccountHealthResponse_resourceHours,
  )
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:/ 'newDescribeAccountHealth' smart constructor.
data DescribeAccountHealth = DescribeAccountHealth'
  {
  }
  deriving (DescribeAccountHealth -> DescribeAccountHealth -> Bool
(DescribeAccountHealth -> DescribeAccountHealth -> Bool)
-> (DescribeAccountHealth -> DescribeAccountHealth -> Bool)
-> Eq DescribeAccountHealth
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]
(Int -> ReadS DescribeAccountHealth)
-> ReadS [DescribeAccountHealth]
-> ReadPrec DescribeAccountHealth
-> ReadPrec [DescribeAccountHealth]
-> Read 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
(Int -> DescribeAccountHealth -> ShowS)
-> (DescribeAccountHealth -> String)
-> ([DescribeAccountHealth] -> ShowS)
-> Show DescribeAccountHealth
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. DescribeAccountHealth -> Rep DescribeAccountHealth x)
-> (forall x. Rep DescribeAccountHealth x -> DescribeAccountHealth)
-> Generic DescribeAccountHealth
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 :: DescribeAccountHealth -> Request DescribeAccountHealth
request = Service -> DescribeAccountHealth -> Request DescribeAccountHealth
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeAccountHealth
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAccountHealth)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeAccountHealth))
-> Logger
-> Service
-> Proxy DescribeAccountHealth
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAccountHealth)))
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 ->
          Int
-> Int -> Int -> Int -> Integer -> DescribeAccountHealthResponse
DescribeAccountHealthResponse'
            (Int
 -> Int -> Int -> Int -> Integer -> DescribeAccountHealthResponse)
-> Either String Int
-> Either
     String
     (Int -> Int -> Int -> Integer -> DescribeAccountHealthResponse)
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))
            Either
  String
  (Int -> Int -> Int -> Integer -> DescribeAccountHealthResponse)
-> Either String Int
-> Either
     String (Int -> Int -> Integer -> DescribeAccountHealthResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Key -> Either String Int
forall a. FromJSON a => Object -> Key -> Either String a
Core..:> Key
"OpenReactiveInsights")
            Either
  String (Int -> Int -> Integer -> DescribeAccountHealthResponse)
-> Either String Int
-> Either String (Int -> Integer -> DescribeAccountHealthResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Key -> Either String Int
forall a. FromJSON a => Object -> Key -> Either String a
Core..:> Key
"OpenProactiveInsights")
            Either String (Int -> Integer -> DescribeAccountHealthResponse)
-> Either String Int
-> Either String (Integer -> DescribeAccountHealthResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Key -> Either String Int
forall a. FromJSON a => Object -> Key -> Either String a
Core..:> Key
"MetricsAnalyzed")
            Either String (Integer -> DescribeAccountHealthResponse)
-> Either String Integer
-> Either String DescribeAccountHealthResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Key -> Either String Integer
forall a. FromJSON a => Object -> Key -> Either String a
Core..:> Key
"ResourceHours")
      )

instance Prelude.Hashable DescribeAccountHealth

instance Prelude.NFData DescribeAccountHealth

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

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

-- | /See:/ 'newDescribeAccountHealthResponse' smart constructor.
data DescribeAccountHealthResponse = DescribeAccountHealthResponse'
  { -- | The response's http status code.
    DescribeAccountHealthResponse -> Int
httpStatus :: Prelude.Int,
    -- | An integer that specifies the number of open reactive insights in your
    -- AWS account.
    DescribeAccountHealthResponse -> Int
openReactiveInsights :: Prelude.Int,
    -- | An integer that specifies the number of open proactive insights in your
    -- AWS account.
    DescribeAccountHealthResponse -> Int
openProactiveInsights :: Prelude.Int,
    -- | An integer that specifies the number of metrics that have been analyzed
    -- in your AWS account.
    DescribeAccountHealthResponse -> Int
metricsAnalyzed :: Prelude.Int,
    -- | The number of Amazon DevOps Guru resource analysis hours billed to the
    -- current AWS account in the last hour.
    DescribeAccountHealthResponse -> Integer
resourceHours :: Prelude.Integer
  }
  deriving (DescribeAccountHealthResponse
-> DescribeAccountHealthResponse -> Bool
(DescribeAccountHealthResponse
 -> DescribeAccountHealthResponse -> Bool)
-> (DescribeAccountHealthResponse
    -> DescribeAccountHealthResponse -> Bool)
-> Eq DescribeAccountHealthResponse
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]
(Int -> ReadS DescribeAccountHealthResponse)
-> ReadS [DescribeAccountHealthResponse]
-> ReadPrec DescribeAccountHealthResponse
-> ReadPrec [DescribeAccountHealthResponse]
-> Read 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
(Int -> DescribeAccountHealthResponse -> ShowS)
-> (DescribeAccountHealthResponse -> String)
-> ([DescribeAccountHealthResponse] -> ShowS)
-> Show DescribeAccountHealthResponse
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.
 DescribeAccountHealthResponse
 -> Rep DescribeAccountHealthResponse x)
-> (forall x.
    Rep DescribeAccountHealthResponse x
    -> DescribeAccountHealthResponse)
-> Generic DescribeAccountHealthResponse
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:
--
-- 'httpStatus', 'describeAccountHealthResponse_httpStatus' - The response's http status code.
--
-- 'openReactiveInsights', 'describeAccountHealthResponse_openReactiveInsights' - An integer that specifies the number of open reactive insights in your
-- AWS account.
--
-- 'openProactiveInsights', 'describeAccountHealthResponse_openProactiveInsights' - An integer that specifies the number of open proactive insights in your
-- AWS account.
--
-- 'metricsAnalyzed', 'describeAccountHealthResponse_metricsAnalyzed' - An integer that specifies the number of metrics that have been analyzed
-- in your AWS account.
--
-- 'resourceHours', 'describeAccountHealthResponse_resourceHours' - The number of Amazon DevOps Guru resource analysis hours billed to the
-- current AWS 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' :: Int
-> Int -> Int -> Int -> Integer -> DescribeAccountHealthResponse
DescribeAccountHealthResponse'
      { $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_
      }

-- | The response's http status code.
describeAccountHealthResponse_httpStatus :: Lens.Lens' DescribeAccountHealthResponse Prelude.Int
describeAccountHealthResponse_httpStatus :: (Int -> f Int)
-> DescribeAccountHealthResponse -> f DescribeAccountHealthResponse
describeAccountHealthResponse_httpStatus = (DescribeAccountHealthResponse -> Int)
-> (DescribeAccountHealthResponse
    -> Int -> DescribeAccountHealthResponse)
-> Lens
     DescribeAccountHealthResponse DescribeAccountHealthResponse Int Int
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
-- AWS account.
describeAccountHealthResponse_openReactiveInsights :: Lens.Lens' DescribeAccountHealthResponse Prelude.Int
describeAccountHealthResponse_openReactiveInsights :: (Int -> f Int)
-> DescribeAccountHealthResponse -> f DescribeAccountHealthResponse
describeAccountHealthResponse_openReactiveInsights = (DescribeAccountHealthResponse -> Int)
-> (DescribeAccountHealthResponse
    -> Int -> DescribeAccountHealthResponse)
-> Lens
     DescribeAccountHealthResponse DescribeAccountHealthResponse Int Int
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
-- AWS account.
describeAccountHealthResponse_openProactiveInsights :: Lens.Lens' DescribeAccountHealthResponse Prelude.Int
describeAccountHealthResponse_openProactiveInsights :: (Int -> f Int)
-> DescribeAccountHealthResponse -> f DescribeAccountHealthResponse
describeAccountHealthResponse_openProactiveInsights = (DescribeAccountHealthResponse -> Int)
-> (DescribeAccountHealthResponse
    -> Int -> DescribeAccountHealthResponse)
-> Lens
     DescribeAccountHealthResponse DescribeAccountHealthResponse Int Int
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 AWS account.
describeAccountHealthResponse_metricsAnalyzed :: Lens.Lens' DescribeAccountHealthResponse Prelude.Int
describeAccountHealthResponse_metricsAnalyzed :: (Int -> f Int)
-> DescribeAccountHealthResponse -> f DescribeAccountHealthResponse
describeAccountHealthResponse_metricsAnalyzed = (DescribeAccountHealthResponse -> Int)
-> (DescribeAccountHealthResponse
    -> Int -> DescribeAccountHealthResponse)
-> Lens
     DescribeAccountHealthResponse DescribeAccountHealthResponse Int Int
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 AWS account in the last hour.
describeAccountHealthResponse_resourceHours :: Lens.Lens' DescribeAccountHealthResponse Prelude.Integer
describeAccountHealthResponse_resourceHours :: (Integer -> f Integer)
-> DescribeAccountHealthResponse -> f DescribeAccountHealthResponse
describeAccountHealthResponse_resourceHours = (DescribeAccountHealthResponse -> Integer)
-> (DescribeAccountHealthResponse
    -> Integer -> DescribeAccountHealthResponse)
-> Lens
     DescribeAccountHealthResponse
     DescribeAccountHealthResponse
     Integer
     Integer
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