{-# 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.SSM.ListResourceComplianceSummaries
-- 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 a resource-level summary count. The summary includes information
-- about compliant and non-compliant statuses and detailed compliance-item
-- severity counts, according to the filter criteria you specify.
--
-- This operation returns paginated results.
module Amazonka.SSM.ListResourceComplianceSummaries
  ( -- * Creating a Request
    ListResourceComplianceSummaries (..),
    newListResourceComplianceSummaries,

    -- * Request Lenses
    listResourceComplianceSummaries_filters,
    listResourceComplianceSummaries_nextToken,
    listResourceComplianceSummaries_maxResults,

    -- * Destructuring the Response
    ListResourceComplianceSummariesResponse (..),
    newListResourceComplianceSummariesResponse,

    -- * Response Lenses
    listResourceComplianceSummariesResponse_resourceComplianceSummaryItems,
    listResourceComplianceSummariesResponse_nextToken,
    listResourceComplianceSummariesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SSM.Types

-- | /See:/ 'newListResourceComplianceSummaries' smart constructor.
data ListResourceComplianceSummaries = ListResourceComplianceSummaries'
  { -- | One or more filters. Use a filter to return a more specific list of
    -- results.
    ListResourceComplianceSummaries -> Maybe [ComplianceStringFilter]
filters :: Prelude.Maybe [ComplianceStringFilter],
    -- | A token to start the list. Use this token to get the next set of
    -- results.
    ListResourceComplianceSummaries -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return for this call. The call also
    -- returns a token that you can specify in a subsequent call to get the
    -- next set of results.
    ListResourceComplianceSummaries -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListResourceComplianceSummaries
-> ListResourceComplianceSummaries -> Bool
(ListResourceComplianceSummaries
 -> ListResourceComplianceSummaries -> Bool)
-> (ListResourceComplianceSummaries
    -> ListResourceComplianceSummaries -> Bool)
-> Eq ListResourceComplianceSummaries
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourceComplianceSummaries
-> ListResourceComplianceSummaries -> Bool
$c/= :: ListResourceComplianceSummaries
-> ListResourceComplianceSummaries -> Bool
== :: ListResourceComplianceSummaries
-> ListResourceComplianceSummaries -> Bool
$c== :: ListResourceComplianceSummaries
-> ListResourceComplianceSummaries -> Bool
Prelude.Eq, ReadPrec [ListResourceComplianceSummaries]
ReadPrec ListResourceComplianceSummaries
Int -> ReadS ListResourceComplianceSummaries
ReadS [ListResourceComplianceSummaries]
(Int -> ReadS ListResourceComplianceSummaries)
-> ReadS [ListResourceComplianceSummaries]
-> ReadPrec ListResourceComplianceSummaries
-> ReadPrec [ListResourceComplianceSummaries]
-> Read ListResourceComplianceSummaries
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResourceComplianceSummaries]
$creadListPrec :: ReadPrec [ListResourceComplianceSummaries]
readPrec :: ReadPrec ListResourceComplianceSummaries
$creadPrec :: ReadPrec ListResourceComplianceSummaries
readList :: ReadS [ListResourceComplianceSummaries]
$creadList :: ReadS [ListResourceComplianceSummaries]
readsPrec :: Int -> ReadS ListResourceComplianceSummaries
$creadsPrec :: Int -> ReadS ListResourceComplianceSummaries
Prelude.Read, Int -> ListResourceComplianceSummaries -> ShowS
[ListResourceComplianceSummaries] -> ShowS
ListResourceComplianceSummaries -> String
(Int -> ListResourceComplianceSummaries -> ShowS)
-> (ListResourceComplianceSummaries -> String)
-> ([ListResourceComplianceSummaries] -> ShowS)
-> Show ListResourceComplianceSummaries
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourceComplianceSummaries] -> ShowS
$cshowList :: [ListResourceComplianceSummaries] -> ShowS
show :: ListResourceComplianceSummaries -> String
$cshow :: ListResourceComplianceSummaries -> String
showsPrec :: Int -> ListResourceComplianceSummaries -> ShowS
$cshowsPrec :: Int -> ListResourceComplianceSummaries -> ShowS
Prelude.Show, (forall x.
 ListResourceComplianceSummaries
 -> Rep ListResourceComplianceSummaries x)
-> (forall x.
    Rep ListResourceComplianceSummaries x
    -> ListResourceComplianceSummaries)
-> Generic ListResourceComplianceSummaries
forall x.
Rep ListResourceComplianceSummaries x
-> ListResourceComplianceSummaries
forall x.
ListResourceComplianceSummaries
-> Rep ListResourceComplianceSummaries x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListResourceComplianceSummaries x
-> ListResourceComplianceSummaries
$cfrom :: forall x.
ListResourceComplianceSummaries
-> Rep ListResourceComplianceSummaries x
Prelude.Generic)

-- |
-- Create a value of 'ListResourceComplianceSummaries' 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:
--
-- 'filters', 'listResourceComplianceSummaries_filters' - One or more filters. Use a filter to return a more specific list of
-- results.
--
-- 'nextToken', 'listResourceComplianceSummaries_nextToken' - A token to start the list. Use this token to get the next set of
-- results.
--
-- 'maxResults', 'listResourceComplianceSummaries_maxResults' - The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
newListResourceComplianceSummaries ::
  ListResourceComplianceSummaries
newListResourceComplianceSummaries :: ListResourceComplianceSummaries
newListResourceComplianceSummaries =
  ListResourceComplianceSummaries' :: Maybe [ComplianceStringFilter]
-> Maybe Text -> Maybe Natural -> ListResourceComplianceSummaries
ListResourceComplianceSummaries'
    { $sel:filters:ListResourceComplianceSummaries' :: Maybe [ComplianceStringFilter]
filters =
        Maybe [ComplianceStringFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListResourceComplianceSummaries' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListResourceComplianceSummaries' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | One or more filters. Use a filter to return a more specific list of
-- results.
listResourceComplianceSummaries_filters :: Lens.Lens' ListResourceComplianceSummaries (Prelude.Maybe [ComplianceStringFilter])
listResourceComplianceSummaries_filters :: (Maybe [ComplianceStringFilter]
 -> f (Maybe [ComplianceStringFilter]))
-> ListResourceComplianceSummaries
-> f ListResourceComplianceSummaries
listResourceComplianceSummaries_filters = (ListResourceComplianceSummaries -> Maybe [ComplianceStringFilter])
-> (ListResourceComplianceSummaries
    -> Maybe [ComplianceStringFilter]
    -> ListResourceComplianceSummaries)
-> Lens
     ListResourceComplianceSummaries
     ListResourceComplianceSummaries
     (Maybe [ComplianceStringFilter])
     (Maybe [ComplianceStringFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceComplianceSummaries' {Maybe [ComplianceStringFilter]
filters :: Maybe [ComplianceStringFilter]
$sel:filters:ListResourceComplianceSummaries' :: ListResourceComplianceSummaries -> Maybe [ComplianceStringFilter]
filters} -> Maybe [ComplianceStringFilter]
filters) (\s :: ListResourceComplianceSummaries
s@ListResourceComplianceSummaries' {} Maybe [ComplianceStringFilter]
a -> ListResourceComplianceSummaries
s {$sel:filters:ListResourceComplianceSummaries' :: Maybe [ComplianceStringFilter]
filters = Maybe [ComplianceStringFilter]
a} :: ListResourceComplianceSummaries) ((Maybe [ComplianceStringFilter]
  -> f (Maybe [ComplianceStringFilter]))
 -> ListResourceComplianceSummaries
 -> f ListResourceComplianceSummaries)
-> ((Maybe [ComplianceStringFilter]
     -> f (Maybe [ComplianceStringFilter]))
    -> Maybe [ComplianceStringFilter]
    -> f (Maybe [ComplianceStringFilter]))
-> (Maybe [ComplianceStringFilter]
    -> f (Maybe [ComplianceStringFilter]))
-> ListResourceComplianceSummaries
-> f ListResourceComplianceSummaries
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ComplianceStringFilter]
  [ComplianceStringFilter]
  [ComplianceStringFilter]
  [ComplianceStringFilter]
-> Iso
     (Maybe [ComplianceStringFilter])
     (Maybe [ComplianceStringFilter])
     (Maybe [ComplianceStringFilter])
     (Maybe [ComplianceStringFilter])
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
  [ComplianceStringFilter]
  [ComplianceStringFilter]
  [ComplianceStringFilter]
  [ComplianceStringFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A token to start the list. Use this token to get the next set of
-- results.
listResourceComplianceSummaries_nextToken :: Lens.Lens' ListResourceComplianceSummaries (Prelude.Maybe Prelude.Text)
listResourceComplianceSummaries_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListResourceComplianceSummaries
-> f ListResourceComplianceSummaries
listResourceComplianceSummaries_nextToken = (ListResourceComplianceSummaries -> Maybe Text)
-> (ListResourceComplianceSummaries
    -> Maybe Text -> ListResourceComplianceSummaries)
-> Lens
     ListResourceComplianceSummaries
     ListResourceComplianceSummaries
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceComplianceSummaries' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResourceComplianceSummaries' :: ListResourceComplianceSummaries -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResourceComplianceSummaries
s@ListResourceComplianceSummaries' {} Maybe Text
a -> ListResourceComplianceSummaries
s {$sel:nextToken:ListResourceComplianceSummaries' :: Maybe Text
nextToken = Maybe Text
a} :: ListResourceComplianceSummaries)

-- | The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
listResourceComplianceSummaries_maxResults :: Lens.Lens' ListResourceComplianceSummaries (Prelude.Maybe Prelude.Natural)
listResourceComplianceSummaries_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListResourceComplianceSummaries
-> f ListResourceComplianceSummaries
listResourceComplianceSummaries_maxResults = (ListResourceComplianceSummaries -> Maybe Natural)
-> (ListResourceComplianceSummaries
    -> Maybe Natural -> ListResourceComplianceSummaries)
-> Lens
     ListResourceComplianceSummaries
     ListResourceComplianceSummaries
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceComplianceSummaries' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListResourceComplianceSummaries' :: ListResourceComplianceSummaries -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListResourceComplianceSummaries
s@ListResourceComplianceSummaries' {} Maybe Natural
a -> ListResourceComplianceSummaries
s {$sel:maxResults:ListResourceComplianceSummaries' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListResourceComplianceSummaries)

instance
  Core.AWSPager
    ListResourceComplianceSummaries
  where
  page :: ListResourceComplianceSummaries
-> AWSResponse ListResourceComplianceSummaries
-> Maybe ListResourceComplianceSummaries
page ListResourceComplianceSummaries
rq AWSResponse ListResourceComplianceSummaries
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListResourceComplianceSummaries
ListResourceComplianceSummariesResponse
rs
            ListResourceComplianceSummariesResponse
-> Getting
     (First Text) ListResourceComplianceSummariesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListResourceComplianceSummariesResponse
-> Const (First Text) ListResourceComplianceSummariesResponse
Lens' ListResourceComplianceSummariesResponse (Maybe Text)
listResourceComplianceSummariesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListResourceComplianceSummariesResponse
 -> Const (First Text) ListResourceComplianceSummariesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListResourceComplianceSummariesResponse 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 ListResourceComplianceSummaries
forall a. Maybe a
Prelude.Nothing
    | Maybe [ResourceComplianceSummaryItem] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListResourceComplianceSummaries
ListResourceComplianceSummariesResponse
rs
            ListResourceComplianceSummariesResponse
-> Getting
     (First [ResourceComplianceSummaryItem])
     ListResourceComplianceSummariesResponse
     [ResourceComplianceSummaryItem]
-> Maybe [ResourceComplianceSummaryItem]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ResourceComplianceSummaryItem]
 -> Const
      (First [ResourceComplianceSummaryItem])
      (Maybe [ResourceComplianceSummaryItem]))
-> ListResourceComplianceSummariesResponse
-> Const
     (First [ResourceComplianceSummaryItem])
     ListResourceComplianceSummariesResponse
Lens'
  ListResourceComplianceSummariesResponse
  (Maybe [ResourceComplianceSummaryItem])
listResourceComplianceSummariesResponse_resourceComplianceSummaryItems
              ((Maybe [ResourceComplianceSummaryItem]
  -> Const
       (First [ResourceComplianceSummaryItem])
       (Maybe [ResourceComplianceSummaryItem]))
 -> ListResourceComplianceSummariesResponse
 -> Const
      (First [ResourceComplianceSummaryItem])
      ListResourceComplianceSummariesResponse)
-> (([ResourceComplianceSummaryItem]
     -> Const
          (First [ResourceComplianceSummaryItem])
          [ResourceComplianceSummaryItem])
    -> Maybe [ResourceComplianceSummaryItem]
    -> Const
         (First [ResourceComplianceSummaryItem])
         (Maybe [ResourceComplianceSummaryItem]))
-> Getting
     (First [ResourceComplianceSummaryItem])
     ListResourceComplianceSummariesResponse
     [ResourceComplianceSummaryItem]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ResourceComplianceSummaryItem]
 -> Const
      (First [ResourceComplianceSummaryItem])
      [ResourceComplianceSummaryItem])
-> Maybe [ResourceComplianceSummaryItem]
-> Const
     (First [ResourceComplianceSummaryItem])
     (Maybe [ResourceComplianceSummaryItem])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListResourceComplianceSummaries
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListResourceComplianceSummaries
-> Maybe ListResourceComplianceSummaries
forall a. a -> Maybe a
Prelude.Just (ListResourceComplianceSummaries
 -> Maybe ListResourceComplianceSummaries)
-> ListResourceComplianceSummaries
-> Maybe ListResourceComplianceSummaries
forall a b. (a -> b) -> a -> b
Prelude.$
        ListResourceComplianceSummaries
rq
          ListResourceComplianceSummaries
-> (ListResourceComplianceSummaries
    -> ListResourceComplianceSummaries)
-> ListResourceComplianceSummaries
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListResourceComplianceSummaries
-> Identity ListResourceComplianceSummaries
Lens
  ListResourceComplianceSummaries
  ListResourceComplianceSummaries
  (Maybe Text)
  (Maybe Text)
listResourceComplianceSummaries_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListResourceComplianceSummaries
 -> Identity ListResourceComplianceSummaries)
-> Maybe Text
-> ListResourceComplianceSummaries
-> ListResourceComplianceSummaries
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListResourceComplianceSummaries
ListResourceComplianceSummariesResponse
rs
          ListResourceComplianceSummariesResponse
-> Getting
     (First Text) ListResourceComplianceSummariesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListResourceComplianceSummariesResponse
-> Const (First Text) ListResourceComplianceSummariesResponse
Lens' ListResourceComplianceSummariesResponse (Maybe Text)
listResourceComplianceSummariesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListResourceComplianceSummariesResponse
 -> Const (First Text) ListResourceComplianceSummariesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListResourceComplianceSummariesResponse 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
    ListResourceComplianceSummaries
  where
  type
    AWSResponse ListResourceComplianceSummaries =
      ListResourceComplianceSummariesResponse
  request :: ListResourceComplianceSummaries
-> Request ListResourceComplianceSummaries
request = Service
-> ListResourceComplianceSummaries
-> Request ListResourceComplianceSummaries
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListResourceComplianceSummaries
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListResourceComplianceSummaries)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListResourceComplianceSummaries))
-> Logger
-> Service
-> Proxy ListResourceComplianceSummaries
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListResourceComplianceSummaries)))
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 [ResourceComplianceSummaryItem]
-> Maybe Text -> Int -> ListResourceComplianceSummariesResponse
ListResourceComplianceSummariesResponse'
            (Maybe [ResourceComplianceSummaryItem]
 -> Maybe Text -> Int -> ListResourceComplianceSummariesResponse)
-> Either String (Maybe [ResourceComplianceSummaryItem])
-> Either
     String
     (Maybe Text -> Int -> ListResourceComplianceSummariesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text
-> Either String (Maybe (Maybe [ResourceComplianceSummaryItem]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResourceComplianceSummaryItems"
                            Either String (Maybe (Maybe [ResourceComplianceSummaryItem]))
-> Maybe [ResourceComplianceSummaryItem]
-> Either String (Maybe [ResourceComplianceSummaryItem])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ResourceComplianceSummaryItem]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String
  (Maybe Text -> Int -> ListResourceComplianceSummariesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListResourceComplianceSummariesResponse)
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 -> ListResourceComplianceSummariesResponse)
-> Either String Int
-> Either String ListResourceComplianceSummariesResponse
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
    ListResourceComplianceSummaries

instance
  Prelude.NFData
    ListResourceComplianceSummaries

instance
  Core.ToHeaders
    ListResourceComplianceSummaries
  where
  toHeaders :: ListResourceComplianceSummaries -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> ListResourceComplianceSummaries -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonSSM.ListResourceComplianceSummaries" ::
                          Prelude.ByteString
                      ),
            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.ToJSON ListResourceComplianceSummaries where
  toJSON :: ListResourceComplianceSummaries -> Value
toJSON ListResourceComplianceSummaries' {Maybe Natural
Maybe [ComplianceStringFilter]
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
filters :: Maybe [ComplianceStringFilter]
$sel:maxResults:ListResourceComplianceSummaries' :: ListResourceComplianceSummaries -> Maybe Natural
$sel:nextToken:ListResourceComplianceSummaries' :: ListResourceComplianceSummaries -> Maybe Text
$sel:filters:ListResourceComplianceSummaries' :: ListResourceComplianceSummaries -> Maybe [ComplianceStringFilter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> [ComplianceStringFilter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([ComplianceStringFilter] -> Pair)
-> Maybe [ComplianceStringFilter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ComplianceStringFilter]
filters,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
          ]
      )

instance Core.ToPath ListResourceComplianceSummaries where
  toPath :: ListResourceComplianceSummaries -> ByteString
toPath = ByteString -> ListResourceComplianceSummaries -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newListResourceComplianceSummariesResponse' smart constructor.
data ListResourceComplianceSummariesResponse = ListResourceComplianceSummariesResponse'
  { -- | A summary count for specified or targeted managed instances. Summary
    -- count includes information about compliant and non-compliant State
    -- Manager associations, patch status, or custom items according to the
    -- filter criteria that you specify.
    ListResourceComplianceSummariesResponse
-> Maybe [ResourceComplianceSummaryItem]
resourceComplianceSummaryItems :: Prelude.Maybe [ResourceComplianceSummaryItem],
    -- | The token for the next set of items to return. Use this token to get the
    -- next set of results.
    ListResourceComplianceSummariesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListResourceComplianceSummariesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListResourceComplianceSummariesResponse
-> ListResourceComplianceSummariesResponse -> Bool
(ListResourceComplianceSummariesResponse
 -> ListResourceComplianceSummariesResponse -> Bool)
-> (ListResourceComplianceSummariesResponse
    -> ListResourceComplianceSummariesResponse -> Bool)
-> Eq ListResourceComplianceSummariesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourceComplianceSummariesResponse
-> ListResourceComplianceSummariesResponse -> Bool
$c/= :: ListResourceComplianceSummariesResponse
-> ListResourceComplianceSummariesResponse -> Bool
== :: ListResourceComplianceSummariesResponse
-> ListResourceComplianceSummariesResponse -> Bool
$c== :: ListResourceComplianceSummariesResponse
-> ListResourceComplianceSummariesResponse -> Bool
Prelude.Eq, ReadPrec [ListResourceComplianceSummariesResponse]
ReadPrec ListResourceComplianceSummariesResponse
Int -> ReadS ListResourceComplianceSummariesResponse
ReadS [ListResourceComplianceSummariesResponse]
(Int -> ReadS ListResourceComplianceSummariesResponse)
-> ReadS [ListResourceComplianceSummariesResponse]
-> ReadPrec ListResourceComplianceSummariesResponse
-> ReadPrec [ListResourceComplianceSummariesResponse]
-> Read ListResourceComplianceSummariesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResourceComplianceSummariesResponse]
$creadListPrec :: ReadPrec [ListResourceComplianceSummariesResponse]
readPrec :: ReadPrec ListResourceComplianceSummariesResponse
$creadPrec :: ReadPrec ListResourceComplianceSummariesResponse
readList :: ReadS [ListResourceComplianceSummariesResponse]
$creadList :: ReadS [ListResourceComplianceSummariesResponse]
readsPrec :: Int -> ReadS ListResourceComplianceSummariesResponse
$creadsPrec :: Int -> ReadS ListResourceComplianceSummariesResponse
Prelude.Read, Int -> ListResourceComplianceSummariesResponse -> ShowS
[ListResourceComplianceSummariesResponse] -> ShowS
ListResourceComplianceSummariesResponse -> String
(Int -> ListResourceComplianceSummariesResponse -> ShowS)
-> (ListResourceComplianceSummariesResponse -> String)
-> ([ListResourceComplianceSummariesResponse] -> ShowS)
-> Show ListResourceComplianceSummariesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourceComplianceSummariesResponse] -> ShowS
$cshowList :: [ListResourceComplianceSummariesResponse] -> ShowS
show :: ListResourceComplianceSummariesResponse -> String
$cshow :: ListResourceComplianceSummariesResponse -> String
showsPrec :: Int -> ListResourceComplianceSummariesResponse -> ShowS
$cshowsPrec :: Int -> ListResourceComplianceSummariesResponse -> ShowS
Prelude.Show, (forall x.
 ListResourceComplianceSummariesResponse
 -> Rep ListResourceComplianceSummariesResponse x)
-> (forall x.
    Rep ListResourceComplianceSummariesResponse x
    -> ListResourceComplianceSummariesResponse)
-> Generic ListResourceComplianceSummariesResponse
forall x.
Rep ListResourceComplianceSummariesResponse x
-> ListResourceComplianceSummariesResponse
forall x.
ListResourceComplianceSummariesResponse
-> Rep ListResourceComplianceSummariesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListResourceComplianceSummariesResponse x
-> ListResourceComplianceSummariesResponse
$cfrom :: forall x.
ListResourceComplianceSummariesResponse
-> Rep ListResourceComplianceSummariesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListResourceComplianceSummariesResponse' 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:
--
-- 'resourceComplianceSummaryItems', 'listResourceComplianceSummariesResponse_resourceComplianceSummaryItems' - A summary count for specified or targeted managed instances. Summary
-- count includes information about compliant and non-compliant State
-- Manager associations, patch status, or custom items according to the
-- filter criteria that you specify.
--
-- 'nextToken', 'listResourceComplianceSummariesResponse_nextToken' - The token for the next set of items to return. Use this token to get the
-- next set of results.
--
-- 'httpStatus', 'listResourceComplianceSummariesResponse_httpStatus' - The response's http status code.
newListResourceComplianceSummariesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListResourceComplianceSummariesResponse
newListResourceComplianceSummariesResponse :: Int -> ListResourceComplianceSummariesResponse
newListResourceComplianceSummariesResponse
  Int
pHttpStatus_ =
    ListResourceComplianceSummariesResponse' :: Maybe [ResourceComplianceSummaryItem]
-> Maybe Text -> Int -> ListResourceComplianceSummariesResponse
ListResourceComplianceSummariesResponse'
      { $sel:resourceComplianceSummaryItems:ListResourceComplianceSummariesResponse' :: Maybe [ResourceComplianceSummaryItem]
resourceComplianceSummaryItems =
          Maybe [ResourceComplianceSummaryItem]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListResourceComplianceSummariesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListResourceComplianceSummariesResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | A summary count for specified or targeted managed instances. Summary
-- count includes information about compliant and non-compliant State
-- Manager associations, patch status, or custom items according to the
-- filter criteria that you specify.
listResourceComplianceSummariesResponse_resourceComplianceSummaryItems :: Lens.Lens' ListResourceComplianceSummariesResponse (Prelude.Maybe [ResourceComplianceSummaryItem])
listResourceComplianceSummariesResponse_resourceComplianceSummaryItems :: (Maybe [ResourceComplianceSummaryItem]
 -> f (Maybe [ResourceComplianceSummaryItem]))
-> ListResourceComplianceSummariesResponse
-> f ListResourceComplianceSummariesResponse
listResourceComplianceSummariesResponse_resourceComplianceSummaryItems = (ListResourceComplianceSummariesResponse
 -> Maybe [ResourceComplianceSummaryItem])
-> (ListResourceComplianceSummariesResponse
    -> Maybe [ResourceComplianceSummaryItem]
    -> ListResourceComplianceSummariesResponse)
-> Lens'
     ListResourceComplianceSummariesResponse
     (Maybe [ResourceComplianceSummaryItem])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceComplianceSummariesResponse' {Maybe [ResourceComplianceSummaryItem]
resourceComplianceSummaryItems :: Maybe [ResourceComplianceSummaryItem]
$sel:resourceComplianceSummaryItems:ListResourceComplianceSummariesResponse' :: ListResourceComplianceSummariesResponse
-> Maybe [ResourceComplianceSummaryItem]
resourceComplianceSummaryItems} -> Maybe [ResourceComplianceSummaryItem]
resourceComplianceSummaryItems) (\s :: ListResourceComplianceSummariesResponse
s@ListResourceComplianceSummariesResponse' {} Maybe [ResourceComplianceSummaryItem]
a -> ListResourceComplianceSummariesResponse
s {$sel:resourceComplianceSummaryItems:ListResourceComplianceSummariesResponse' :: Maybe [ResourceComplianceSummaryItem]
resourceComplianceSummaryItems = Maybe [ResourceComplianceSummaryItem]
a} :: ListResourceComplianceSummariesResponse) ((Maybe [ResourceComplianceSummaryItem]
  -> f (Maybe [ResourceComplianceSummaryItem]))
 -> ListResourceComplianceSummariesResponse
 -> f ListResourceComplianceSummariesResponse)
-> ((Maybe [ResourceComplianceSummaryItem]
     -> f (Maybe [ResourceComplianceSummaryItem]))
    -> Maybe [ResourceComplianceSummaryItem]
    -> f (Maybe [ResourceComplianceSummaryItem]))
-> (Maybe [ResourceComplianceSummaryItem]
    -> f (Maybe [ResourceComplianceSummaryItem]))
-> ListResourceComplianceSummariesResponse
-> f ListResourceComplianceSummariesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ResourceComplianceSummaryItem]
  [ResourceComplianceSummaryItem]
  [ResourceComplianceSummaryItem]
  [ResourceComplianceSummaryItem]
-> Iso
     (Maybe [ResourceComplianceSummaryItem])
     (Maybe [ResourceComplianceSummaryItem])
     (Maybe [ResourceComplianceSummaryItem])
     (Maybe [ResourceComplianceSummaryItem])
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
  [ResourceComplianceSummaryItem]
  [ResourceComplianceSummaryItem]
  [ResourceComplianceSummaryItem]
  [ResourceComplianceSummaryItem]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token for the next set of items to return. Use this token to get the
-- next set of results.
listResourceComplianceSummariesResponse_nextToken :: Lens.Lens' ListResourceComplianceSummariesResponse (Prelude.Maybe Prelude.Text)
listResourceComplianceSummariesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListResourceComplianceSummariesResponse
-> f ListResourceComplianceSummariesResponse
listResourceComplianceSummariesResponse_nextToken = (ListResourceComplianceSummariesResponse -> Maybe Text)
-> (ListResourceComplianceSummariesResponse
    -> Maybe Text -> ListResourceComplianceSummariesResponse)
-> Lens' ListResourceComplianceSummariesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceComplianceSummariesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResourceComplianceSummariesResponse' :: ListResourceComplianceSummariesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResourceComplianceSummariesResponse
s@ListResourceComplianceSummariesResponse' {} Maybe Text
a -> ListResourceComplianceSummariesResponse
s {$sel:nextToken:ListResourceComplianceSummariesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListResourceComplianceSummariesResponse)

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

instance
  Prelude.NFData
    ListResourceComplianceSummariesResponse