{-# 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.DescribeResourceCollectionHealth
-- 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 proactive insights, open reactive insights,
-- and the Mean Time to Recover (MTTR) for all closed insights in resource
-- collections in your account. You specify the type of AWS resources
-- collection. The one type of AWS resource collection supported is AWS
-- CloudFormation stacks. DevOps Guru can be configured to analyze only the
-- AWS resources that are defined in the stacks. You can specify up to 500
-- AWS CloudFormation stacks.
--
-- This operation returns paginated results.
module Amazonka.DevOpsGuru.DescribeResourceCollectionHealth
  ( -- * Creating a Request
    DescribeResourceCollectionHealth (..),
    newDescribeResourceCollectionHealth,

    -- * Request Lenses
    describeResourceCollectionHealth_nextToken,
    describeResourceCollectionHealth_resourceCollectionType,

    -- * Destructuring the Response
    DescribeResourceCollectionHealthResponse (..),
    newDescribeResourceCollectionHealthResponse,

    -- * Response Lenses
    describeResourceCollectionHealthResponse_service,
    describeResourceCollectionHealthResponse_nextToken,
    describeResourceCollectionHealthResponse_httpStatus,
    describeResourceCollectionHealthResponse_cloudFormation,
  )
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:/ 'newDescribeResourceCollectionHealth' smart constructor.
data DescribeResourceCollectionHealth = DescribeResourceCollectionHealth'
  { -- | The pagination token to use to retrieve the next page of results for
    -- this operation. If this value is null, it retrieves the first page.
    DescribeResourceCollectionHealth -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An AWS resource collection type. This type specifies how analyzed AWS
    -- resources are defined. The one type of AWS resource collection supported
    -- is AWS CloudFormation stacks. DevOps Guru can be configured to analyze
    -- only the AWS resources that are defined in the stacks. You can specify
    -- up to 500 AWS CloudFormation stacks.
    DescribeResourceCollectionHealth -> ResourceCollectionType
resourceCollectionType :: ResourceCollectionType
  }
  deriving (DescribeResourceCollectionHealth
-> DescribeResourceCollectionHealth -> Bool
(DescribeResourceCollectionHealth
 -> DescribeResourceCollectionHealth -> Bool)
-> (DescribeResourceCollectionHealth
    -> DescribeResourceCollectionHealth -> Bool)
-> Eq DescribeResourceCollectionHealth
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeResourceCollectionHealth
-> DescribeResourceCollectionHealth -> Bool
$c/= :: DescribeResourceCollectionHealth
-> DescribeResourceCollectionHealth -> Bool
== :: DescribeResourceCollectionHealth
-> DescribeResourceCollectionHealth -> Bool
$c== :: DescribeResourceCollectionHealth
-> DescribeResourceCollectionHealth -> Bool
Prelude.Eq, ReadPrec [DescribeResourceCollectionHealth]
ReadPrec DescribeResourceCollectionHealth
Int -> ReadS DescribeResourceCollectionHealth
ReadS [DescribeResourceCollectionHealth]
(Int -> ReadS DescribeResourceCollectionHealth)
-> ReadS [DescribeResourceCollectionHealth]
-> ReadPrec DescribeResourceCollectionHealth
-> ReadPrec [DescribeResourceCollectionHealth]
-> Read DescribeResourceCollectionHealth
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeResourceCollectionHealth]
$creadListPrec :: ReadPrec [DescribeResourceCollectionHealth]
readPrec :: ReadPrec DescribeResourceCollectionHealth
$creadPrec :: ReadPrec DescribeResourceCollectionHealth
readList :: ReadS [DescribeResourceCollectionHealth]
$creadList :: ReadS [DescribeResourceCollectionHealth]
readsPrec :: Int -> ReadS DescribeResourceCollectionHealth
$creadsPrec :: Int -> ReadS DescribeResourceCollectionHealth
Prelude.Read, Int -> DescribeResourceCollectionHealth -> ShowS
[DescribeResourceCollectionHealth] -> ShowS
DescribeResourceCollectionHealth -> String
(Int -> DescribeResourceCollectionHealth -> ShowS)
-> (DescribeResourceCollectionHealth -> String)
-> ([DescribeResourceCollectionHealth] -> ShowS)
-> Show DescribeResourceCollectionHealth
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeResourceCollectionHealth] -> ShowS
$cshowList :: [DescribeResourceCollectionHealth] -> ShowS
show :: DescribeResourceCollectionHealth -> String
$cshow :: DescribeResourceCollectionHealth -> String
showsPrec :: Int -> DescribeResourceCollectionHealth -> ShowS
$cshowsPrec :: Int -> DescribeResourceCollectionHealth -> ShowS
Prelude.Show, (forall x.
 DescribeResourceCollectionHealth
 -> Rep DescribeResourceCollectionHealth x)
-> (forall x.
    Rep DescribeResourceCollectionHealth x
    -> DescribeResourceCollectionHealth)
-> Generic DescribeResourceCollectionHealth
forall x.
Rep DescribeResourceCollectionHealth x
-> DescribeResourceCollectionHealth
forall x.
DescribeResourceCollectionHealth
-> Rep DescribeResourceCollectionHealth x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeResourceCollectionHealth x
-> DescribeResourceCollectionHealth
$cfrom :: forall x.
DescribeResourceCollectionHealth
-> Rep DescribeResourceCollectionHealth x
Prelude.Generic)

-- |
-- Create a value of 'DescribeResourceCollectionHealth' 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:
--
-- 'nextToken', 'describeResourceCollectionHealth_nextToken' - The pagination token to use to retrieve the next page of results for
-- this operation. If this value is null, it retrieves the first page.
--
-- 'resourceCollectionType', 'describeResourceCollectionHealth_resourceCollectionType' - An AWS resource collection type. This type specifies how analyzed AWS
-- resources are defined. The one type of AWS resource collection supported
-- is AWS CloudFormation stacks. DevOps Guru can be configured to analyze
-- only the AWS resources that are defined in the stacks. You can specify
-- up to 500 AWS CloudFormation stacks.
newDescribeResourceCollectionHealth ::
  -- | 'resourceCollectionType'
  ResourceCollectionType ->
  DescribeResourceCollectionHealth
newDescribeResourceCollectionHealth :: ResourceCollectionType -> DescribeResourceCollectionHealth
newDescribeResourceCollectionHealth
  ResourceCollectionType
pResourceCollectionType_ =
    DescribeResourceCollectionHealth' :: Maybe Text
-> ResourceCollectionType -> DescribeResourceCollectionHealth
DescribeResourceCollectionHealth'
      { $sel:nextToken:DescribeResourceCollectionHealth' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:resourceCollectionType:DescribeResourceCollectionHealth' :: ResourceCollectionType
resourceCollectionType =
          ResourceCollectionType
pResourceCollectionType_
      }

-- | The pagination token to use to retrieve the next page of results for
-- this operation. If this value is null, it retrieves the first page.
describeResourceCollectionHealth_nextToken :: Lens.Lens' DescribeResourceCollectionHealth (Prelude.Maybe Prelude.Text)
describeResourceCollectionHealth_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeResourceCollectionHealth
-> f DescribeResourceCollectionHealth
describeResourceCollectionHealth_nextToken = (DescribeResourceCollectionHealth -> Maybe Text)
-> (DescribeResourceCollectionHealth
    -> Maybe Text -> DescribeResourceCollectionHealth)
-> Lens
     DescribeResourceCollectionHealth
     DescribeResourceCollectionHealth
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourceCollectionHealth' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeResourceCollectionHealth' :: DescribeResourceCollectionHealth -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeResourceCollectionHealth
s@DescribeResourceCollectionHealth' {} Maybe Text
a -> DescribeResourceCollectionHealth
s {$sel:nextToken:DescribeResourceCollectionHealth' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeResourceCollectionHealth)

-- | An AWS resource collection type. This type specifies how analyzed AWS
-- resources are defined. The one type of AWS resource collection supported
-- is AWS CloudFormation stacks. DevOps Guru can be configured to analyze
-- only the AWS resources that are defined in the stacks. You can specify
-- up to 500 AWS CloudFormation stacks.
describeResourceCollectionHealth_resourceCollectionType :: Lens.Lens' DescribeResourceCollectionHealth ResourceCollectionType
describeResourceCollectionHealth_resourceCollectionType :: (ResourceCollectionType -> f ResourceCollectionType)
-> DescribeResourceCollectionHealth
-> f DescribeResourceCollectionHealth
describeResourceCollectionHealth_resourceCollectionType = (DescribeResourceCollectionHealth -> ResourceCollectionType)
-> (DescribeResourceCollectionHealth
    -> ResourceCollectionType -> DescribeResourceCollectionHealth)
-> Lens
     DescribeResourceCollectionHealth
     DescribeResourceCollectionHealth
     ResourceCollectionType
     ResourceCollectionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourceCollectionHealth' {ResourceCollectionType
resourceCollectionType :: ResourceCollectionType
$sel:resourceCollectionType:DescribeResourceCollectionHealth' :: DescribeResourceCollectionHealth -> ResourceCollectionType
resourceCollectionType} -> ResourceCollectionType
resourceCollectionType) (\s :: DescribeResourceCollectionHealth
s@DescribeResourceCollectionHealth' {} ResourceCollectionType
a -> DescribeResourceCollectionHealth
s {$sel:resourceCollectionType:DescribeResourceCollectionHealth' :: ResourceCollectionType
resourceCollectionType = ResourceCollectionType
a} :: DescribeResourceCollectionHealth)

instance
  Core.AWSPager
    DescribeResourceCollectionHealth
  where
  page :: DescribeResourceCollectionHealth
-> AWSResponse DescribeResourceCollectionHealth
-> Maybe DescribeResourceCollectionHealth
page DescribeResourceCollectionHealth
rq AWSResponse DescribeResourceCollectionHealth
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeResourceCollectionHealth
DescribeResourceCollectionHealthResponse
rs
            DescribeResourceCollectionHealthResponse
-> Getting
     (First Text) DescribeResourceCollectionHealthResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeResourceCollectionHealthResponse
-> Const (First Text) DescribeResourceCollectionHealthResponse
Lens' DescribeResourceCollectionHealthResponse (Maybe Text)
describeResourceCollectionHealthResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeResourceCollectionHealthResponse
 -> Const (First Text) DescribeResourceCollectionHealthResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) DescribeResourceCollectionHealthResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeResourceCollectionHealth
forall a. Maybe a
Prelude.Nothing
    | [CloudFormationHealth] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeResourceCollectionHealth
DescribeResourceCollectionHealthResponse
rs
            DescribeResourceCollectionHealthResponse
-> Getting
     [CloudFormationHealth]
     DescribeResourceCollectionHealthResponse
     [CloudFormationHealth]
-> [CloudFormationHealth]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
  [CloudFormationHealth]
  DescribeResourceCollectionHealthResponse
  [CloudFormationHealth]
Lens'
  DescribeResourceCollectionHealthResponse [CloudFormationHealth]
describeResourceCollectionHealthResponse_cloudFormation
        ) =
      Maybe DescribeResourceCollectionHealth
forall a. Maybe a
Prelude.Nothing
    | Maybe [ServiceHealth] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeResourceCollectionHealth
DescribeResourceCollectionHealthResponse
rs
            DescribeResourceCollectionHealthResponse
-> Getting
     (First [ServiceHealth])
     DescribeResourceCollectionHealthResponse
     [ServiceHealth]
-> Maybe [ServiceHealth]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ServiceHealth]
 -> Const (First [ServiceHealth]) (Maybe [ServiceHealth]))
-> DescribeResourceCollectionHealthResponse
-> Const
     (First [ServiceHealth]) DescribeResourceCollectionHealthResponse
Lens'
  DescribeResourceCollectionHealthResponse (Maybe [ServiceHealth])
describeResourceCollectionHealthResponse_service
              ((Maybe [ServiceHealth]
  -> Const (First [ServiceHealth]) (Maybe [ServiceHealth]))
 -> DescribeResourceCollectionHealthResponse
 -> Const
      (First [ServiceHealth]) DescribeResourceCollectionHealthResponse)
-> (([ServiceHealth]
     -> Const (First [ServiceHealth]) [ServiceHealth])
    -> Maybe [ServiceHealth]
    -> Const (First [ServiceHealth]) (Maybe [ServiceHealth]))
-> Getting
     (First [ServiceHealth])
     DescribeResourceCollectionHealthResponse
     [ServiceHealth]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ServiceHealth] -> Const (First [ServiceHealth]) [ServiceHealth])
-> Maybe [ServiceHealth]
-> Const (First [ServiceHealth]) (Maybe [ServiceHealth])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeResourceCollectionHealth
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeResourceCollectionHealth
-> Maybe DescribeResourceCollectionHealth
forall a. a -> Maybe a
Prelude.Just (DescribeResourceCollectionHealth
 -> Maybe DescribeResourceCollectionHealth)
-> DescribeResourceCollectionHealth
-> Maybe DescribeResourceCollectionHealth
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeResourceCollectionHealth
rq
          DescribeResourceCollectionHealth
-> (DescribeResourceCollectionHealth
    -> DescribeResourceCollectionHealth)
-> DescribeResourceCollectionHealth
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeResourceCollectionHealth
-> Identity DescribeResourceCollectionHealth
Lens
  DescribeResourceCollectionHealth
  DescribeResourceCollectionHealth
  (Maybe Text)
  (Maybe Text)
describeResourceCollectionHealth_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeResourceCollectionHealth
 -> Identity DescribeResourceCollectionHealth)
-> Maybe Text
-> DescribeResourceCollectionHealth
-> DescribeResourceCollectionHealth
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeResourceCollectionHealth
DescribeResourceCollectionHealthResponse
rs
          DescribeResourceCollectionHealthResponse
-> Getting
     (First Text) DescribeResourceCollectionHealthResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeResourceCollectionHealthResponse
-> Const (First Text) DescribeResourceCollectionHealthResponse
Lens' DescribeResourceCollectionHealthResponse (Maybe Text)
describeResourceCollectionHealthResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeResourceCollectionHealthResponse
 -> Const (First Text) DescribeResourceCollectionHealthResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) DescribeResourceCollectionHealthResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance
  Core.AWSRequest
    DescribeResourceCollectionHealth
  where
  type
    AWSResponse DescribeResourceCollectionHealth =
      DescribeResourceCollectionHealthResponse
  request :: DescribeResourceCollectionHealth
-> Request DescribeResourceCollectionHealth
request = Service
-> DescribeResourceCollectionHealth
-> Request DescribeResourceCollectionHealth
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeResourceCollectionHealth
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeResourceCollectionHealth)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeResourceCollectionHealth))
-> Logger
-> Service
-> Proxy DescribeResourceCollectionHealth
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeResourceCollectionHealth)))
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 [ServiceHealth]
-> Maybe Text
-> Int
-> [CloudFormationHealth]
-> DescribeResourceCollectionHealthResponse
DescribeResourceCollectionHealthResponse'
            (Maybe [ServiceHealth]
 -> Maybe Text
 -> Int
 -> [CloudFormationHealth]
 -> DescribeResourceCollectionHealthResponse)
-> Either String (Maybe [ServiceHealth])
-> Either
     String
     (Maybe Text
      -> Int
      -> [CloudFormationHealth]
      -> DescribeResourceCollectionHealthResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [ServiceHealth]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Service" Either String (Maybe (Maybe [ServiceHealth]))
-> Maybe [ServiceHealth] -> Either String (Maybe [ServiceHealth])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ServiceHealth]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe Text
   -> Int
   -> [CloudFormationHealth]
   -> DescribeResourceCollectionHealthResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Int
      -> [CloudFormationHealth]
      -> DescribeResourceCollectionHealthResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either
  String
  (Int
   -> [CloudFormationHealth]
   -> DescribeResourceCollectionHealthResponse)
-> Either String Int
-> Either
     String
     ([CloudFormationHealth]
      -> DescribeResourceCollectionHealthResponse)
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))
            Either
  String
  ([CloudFormationHealth]
   -> DescribeResourceCollectionHealthResponse)
-> Either String [CloudFormationHealth]
-> Either String DescribeResourceCollectionHealthResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [CloudFormationHealth])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CloudFormation"
                            Either String (Maybe [CloudFormationHealth])
-> [CloudFormationHealth] -> Either String [CloudFormationHealth]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [CloudFormationHealth]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance
  Prelude.Hashable
    DescribeResourceCollectionHealth

instance
  Prelude.NFData
    DescribeResourceCollectionHealth

instance
  Core.ToHeaders
    DescribeResourceCollectionHealth
  where
  toHeaders :: DescribeResourceCollectionHealth -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeResourceCollectionHealth -> 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 DescribeResourceCollectionHealth where
  toPath :: DescribeResourceCollectionHealth -> ByteString
toPath DescribeResourceCollectionHealth' {Maybe Text
ResourceCollectionType
resourceCollectionType :: ResourceCollectionType
nextToken :: Maybe Text
$sel:resourceCollectionType:DescribeResourceCollectionHealth' :: DescribeResourceCollectionHealth -> ResourceCollectionType
$sel:nextToken:DescribeResourceCollectionHealth' :: DescribeResourceCollectionHealth -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/accounts/health/resource-collection/",
        ResourceCollectionType -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS ResourceCollectionType
resourceCollectionType
      ]

instance
  Core.ToQuery
    DescribeResourceCollectionHealth
  where
  toQuery :: DescribeResourceCollectionHealth -> QueryString
toQuery DescribeResourceCollectionHealth' {Maybe Text
ResourceCollectionType
resourceCollectionType :: ResourceCollectionType
nextToken :: Maybe Text
$sel:resourceCollectionType:DescribeResourceCollectionHealth' :: DescribeResourceCollectionHealth -> ResourceCollectionType
$sel:nextToken:DescribeResourceCollectionHealth' :: DescribeResourceCollectionHealth -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken]

-- | /See:/ 'newDescribeResourceCollectionHealthResponse' smart constructor.
data DescribeResourceCollectionHealthResponse = DescribeResourceCollectionHealthResponse'
  { -- | An array of @ServiceHealth@ objects that describes the health of the AWS
    -- services associated with the resources in the collection.
    DescribeResourceCollectionHealthResponse -> Maybe [ServiceHealth]
service :: Prelude.Maybe [ServiceHealth],
    -- | The pagination token to use to retrieve the next page of results for
    -- this operation. If there are no more pages, this value is null.
    DescribeResourceCollectionHealthResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeResourceCollectionHealthResponse -> Int
httpStatus :: Prelude.Int,
    -- | The returned @CloudFormationHealthOverview@ object that contains an
    -- @InsightHealthOverview@ object with the requested system health
    -- information.
    DescribeResourceCollectionHealthResponse -> [CloudFormationHealth]
cloudFormation :: [CloudFormationHealth]
  }
  deriving (DescribeResourceCollectionHealthResponse
-> DescribeResourceCollectionHealthResponse -> Bool
(DescribeResourceCollectionHealthResponse
 -> DescribeResourceCollectionHealthResponse -> Bool)
-> (DescribeResourceCollectionHealthResponse
    -> DescribeResourceCollectionHealthResponse -> Bool)
-> Eq DescribeResourceCollectionHealthResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeResourceCollectionHealthResponse
-> DescribeResourceCollectionHealthResponse -> Bool
$c/= :: DescribeResourceCollectionHealthResponse
-> DescribeResourceCollectionHealthResponse -> Bool
== :: DescribeResourceCollectionHealthResponse
-> DescribeResourceCollectionHealthResponse -> Bool
$c== :: DescribeResourceCollectionHealthResponse
-> DescribeResourceCollectionHealthResponse -> Bool
Prelude.Eq, ReadPrec [DescribeResourceCollectionHealthResponse]
ReadPrec DescribeResourceCollectionHealthResponse
Int -> ReadS DescribeResourceCollectionHealthResponse
ReadS [DescribeResourceCollectionHealthResponse]
(Int -> ReadS DescribeResourceCollectionHealthResponse)
-> ReadS [DescribeResourceCollectionHealthResponse]
-> ReadPrec DescribeResourceCollectionHealthResponse
-> ReadPrec [DescribeResourceCollectionHealthResponse]
-> Read DescribeResourceCollectionHealthResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeResourceCollectionHealthResponse]
$creadListPrec :: ReadPrec [DescribeResourceCollectionHealthResponse]
readPrec :: ReadPrec DescribeResourceCollectionHealthResponse
$creadPrec :: ReadPrec DescribeResourceCollectionHealthResponse
readList :: ReadS [DescribeResourceCollectionHealthResponse]
$creadList :: ReadS [DescribeResourceCollectionHealthResponse]
readsPrec :: Int -> ReadS DescribeResourceCollectionHealthResponse
$creadsPrec :: Int -> ReadS DescribeResourceCollectionHealthResponse
Prelude.Read, Int -> DescribeResourceCollectionHealthResponse -> ShowS
[DescribeResourceCollectionHealthResponse] -> ShowS
DescribeResourceCollectionHealthResponse -> String
(Int -> DescribeResourceCollectionHealthResponse -> ShowS)
-> (DescribeResourceCollectionHealthResponse -> String)
-> ([DescribeResourceCollectionHealthResponse] -> ShowS)
-> Show DescribeResourceCollectionHealthResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeResourceCollectionHealthResponse] -> ShowS
$cshowList :: [DescribeResourceCollectionHealthResponse] -> ShowS
show :: DescribeResourceCollectionHealthResponse -> String
$cshow :: DescribeResourceCollectionHealthResponse -> String
showsPrec :: Int -> DescribeResourceCollectionHealthResponse -> ShowS
$cshowsPrec :: Int -> DescribeResourceCollectionHealthResponse -> ShowS
Prelude.Show, (forall x.
 DescribeResourceCollectionHealthResponse
 -> Rep DescribeResourceCollectionHealthResponse x)
-> (forall x.
    Rep DescribeResourceCollectionHealthResponse x
    -> DescribeResourceCollectionHealthResponse)
-> Generic DescribeResourceCollectionHealthResponse
forall x.
Rep DescribeResourceCollectionHealthResponse x
-> DescribeResourceCollectionHealthResponse
forall x.
DescribeResourceCollectionHealthResponse
-> Rep DescribeResourceCollectionHealthResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeResourceCollectionHealthResponse x
-> DescribeResourceCollectionHealthResponse
$cfrom :: forall x.
DescribeResourceCollectionHealthResponse
-> Rep DescribeResourceCollectionHealthResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeResourceCollectionHealthResponse' 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:
--
-- 'service', 'describeResourceCollectionHealthResponse_service' - An array of @ServiceHealth@ objects that describes the health of the AWS
-- services associated with the resources in the collection.
--
-- 'nextToken', 'describeResourceCollectionHealthResponse_nextToken' - The pagination token to use to retrieve the next page of results for
-- this operation. If there are no more pages, this value is null.
--
-- 'httpStatus', 'describeResourceCollectionHealthResponse_httpStatus' - The response's http status code.
--
-- 'cloudFormation', 'describeResourceCollectionHealthResponse_cloudFormation' - The returned @CloudFormationHealthOverview@ object that contains an
-- @InsightHealthOverview@ object with the requested system health
-- information.
newDescribeResourceCollectionHealthResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeResourceCollectionHealthResponse
newDescribeResourceCollectionHealthResponse :: Int -> DescribeResourceCollectionHealthResponse
newDescribeResourceCollectionHealthResponse
  Int
pHttpStatus_ =
    DescribeResourceCollectionHealthResponse' :: Maybe [ServiceHealth]
-> Maybe Text
-> Int
-> [CloudFormationHealth]
-> DescribeResourceCollectionHealthResponse
DescribeResourceCollectionHealthResponse'
      { $sel:service:DescribeResourceCollectionHealthResponse' :: Maybe [ServiceHealth]
service =
          Maybe [ServiceHealth]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:DescribeResourceCollectionHealthResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeResourceCollectionHealthResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:cloudFormation:DescribeResourceCollectionHealthResponse' :: [CloudFormationHealth]
cloudFormation = [CloudFormationHealth]
forall a. Monoid a => a
Prelude.mempty
      }

-- | An array of @ServiceHealth@ objects that describes the health of the AWS
-- services associated with the resources in the collection.
describeResourceCollectionHealthResponse_service :: Lens.Lens' DescribeResourceCollectionHealthResponse (Prelude.Maybe [ServiceHealth])
describeResourceCollectionHealthResponse_service :: (Maybe [ServiceHealth] -> f (Maybe [ServiceHealth]))
-> DescribeResourceCollectionHealthResponse
-> f DescribeResourceCollectionHealthResponse
describeResourceCollectionHealthResponse_service = (DescribeResourceCollectionHealthResponse -> Maybe [ServiceHealth])
-> (DescribeResourceCollectionHealthResponse
    -> Maybe [ServiceHealth]
    -> DescribeResourceCollectionHealthResponse)
-> Lens'
     DescribeResourceCollectionHealthResponse (Maybe [ServiceHealth])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourceCollectionHealthResponse' {Maybe [ServiceHealth]
service :: Maybe [ServiceHealth]
$sel:service:DescribeResourceCollectionHealthResponse' :: DescribeResourceCollectionHealthResponse -> Maybe [ServiceHealth]
service} -> Maybe [ServiceHealth]
service) (\s :: DescribeResourceCollectionHealthResponse
s@DescribeResourceCollectionHealthResponse' {} Maybe [ServiceHealth]
a -> DescribeResourceCollectionHealthResponse
s {$sel:service:DescribeResourceCollectionHealthResponse' :: Maybe [ServiceHealth]
service = Maybe [ServiceHealth]
a} :: DescribeResourceCollectionHealthResponse) ((Maybe [ServiceHealth] -> f (Maybe [ServiceHealth]))
 -> DescribeResourceCollectionHealthResponse
 -> f DescribeResourceCollectionHealthResponse)
-> ((Maybe [ServiceHealth] -> f (Maybe [ServiceHealth]))
    -> Maybe [ServiceHealth] -> f (Maybe [ServiceHealth]))
-> (Maybe [ServiceHealth] -> f (Maybe [ServiceHealth]))
-> DescribeResourceCollectionHealthResponse
-> f DescribeResourceCollectionHealthResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ServiceHealth] [ServiceHealth] [ServiceHealth] [ServiceHealth]
-> Iso
     (Maybe [ServiceHealth])
     (Maybe [ServiceHealth])
     (Maybe [ServiceHealth])
     (Maybe [ServiceHealth])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [ServiceHealth] [ServiceHealth] [ServiceHealth] [ServiceHealth]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The pagination token to use to retrieve the next page of results for
-- this operation. If there are no more pages, this value is null.
describeResourceCollectionHealthResponse_nextToken :: Lens.Lens' DescribeResourceCollectionHealthResponse (Prelude.Maybe Prelude.Text)
describeResourceCollectionHealthResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeResourceCollectionHealthResponse
-> f DescribeResourceCollectionHealthResponse
describeResourceCollectionHealthResponse_nextToken = (DescribeResourceCollectionHealthResponse -> Maybe Text)
-> (DescribeResourceCollectionHealthResponse
    -> Maybe Text -> DescribeResourceCollectionHealthResponse)
-> Lens' DescribeResourceCollectionHealthResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourceCollectionHealthResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeResourceCollectionHealthResponse' :: DescribeResourceCollectionHealthResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeResourceCollectionHealthResponse
s@DescribeResourceCollectionHealthResponse' {} Maybe Text
a -> DescribeResourceCollectionHealthResponse
s {$sel:nextToken:DescribeResourceCollectionHealthResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeResourceCollectionHealthResponse)

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

-- | The returned @CloudFormationHealthOverview@ object that contains an
-- @InsightHealthOverview@ object with the requested system health
-- information.
describeResourceCollectionHealthResponse_cloudFormation :: Lens.Lens' DescribeResourceCollectionHealthResponse [CloudFormationHealth]
describeResourceCollectionHealthResponse_cloudFormation :: ([CloudFormationHealth] -> f [CloudFormationHealth])
-> DescribeResourceCollectionHealthResponse
-> f DescribeResourceCollectionHealthResponse
describeResourceCollectionHealthResponse_cloudFormation = (DescribeResourceCollectionHealthResponse
 -> [CloudFormationHealth])
-> (DescribeResourceCollectionHealthResponse
    -> [CloudFormationHealth]
    -> DescribeResourceCollectionHealthResponse)
-> Lens'
     DescribeResourceCollectionHealthResponse [CloudFormationHealth]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeResourceCollectionHealthResponse' {[CloudFormationHealth]
cloudFormation :: [CloudFormationHealth]
$sel:cloudFormation:DescribeResourceCollectionHealthResponse' :: DescribeResourceCollectionHealthResponse -> [CloudFormationHealth]
cloudFormation} -> [CloudFormationHealth]
cloudFormation) (\s :: DescribeResourceCollectionHealthResponse
s@DescribeResourceCollectionHealthResponse' {} [CloudFormationHealth]
a -> DescribeResourceCollectionHealthResponse
s {$sel:cloudFormation:DescribeResourceCollectionHealthResponse' :: [CloudFormationHealth]
cloudFormation = [CloudFormationHealth]
a} :: DescribeResourceCollectionHealthResponse) (([CloudFormationHealth] -> f [CloudFormationHealth])
 -> DescribeResourceCollectionHealthResponse
 -> f DescribeResourceCollectionHealthResponse)
-> (([CloudFormationHealth] -> f [CloudFormationHealth])
    -> [CloudFormationHealth] -> f [CloudFormationHealth])
-> ([CloudFormationHealth] -> f [CloudFormationHealth])
-> DescribeResourceCollectionHealthResponse
-> f DescribeResourceCollectionHealthResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([CloudFormationHealth] -> f [CloudFormationHealth])
-> [CloudFormationHealth] -> f [CloudFormationHealth]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.NFData
    DescribeResourceCollectionHealthResponse