{-# 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.ListComplianceItems
-- 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)
--
-- For a specified resource ID, this API operation returns a list of
-- compliance statuses for different resource types. Currently, you can
-- only specify one resource ID per call. List results depend on the
-- criteria specified in the filter.
--
-- This operation returns paginated results.
module Amazonka.SSM.ListComplianceItems
  ( -- * Creating a Request
    ListComplianceItems (..),
    newListComplianceItems,

    -- * Request Lenses
    listComplianceItems_resourceIds,
    listComplianceItems_filters,
    listComplianceItems_nextToken,
    listComplianceItems_maxResults,
    listComplianceItems_resourceTypes,

    -- * Destructuring the Response
    ListComplianceItemsResponse (..),
    newListComplianceItemsResponse,

    -- * Response Lenses
    listComplianceItemsResponse_complianceItems,
    listComplianceItemsResponse_nextToken,
    listComplianceItemsResponse_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:/ 'newListComplianceItems' smart constructor.
data ListComplianceItems = ListComplianceItems'
  { -- | The ID for the resources from which to get compliance information.
    -- Currently, you can only specify one resource ID.
    ListComplianceItems -> Maybe (NonEmpty Text)
resourceIds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | One or more compliance filters. Use a filter to return a more specific
    -- list of results.
    ListComplianceItems -> Maybe [ComplianceStringFilter]
filters :: Prelude.Maybe [ComplianceStringFilter],
    -- | A token to start the list. Use this token to get the next set of
    -- results.
    ListComplianceItems -> 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.
    ListComplianceItems -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The type of resource from which to get compliance information.
    -- Currently, the only supported resource type is @ManagedInstance@.
    ListComplianceItems -> Maybe (NonEmpty Text)
resourceTypes :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text)
  }
  deriving (ListComplianceItems -> ListComplianceItems -> Bool
(ListComplianceItems -> ListComplianceItems -> Bool)
-> (ListComplianceItems -> ListComplianceItems -> Bool)
-> Eq ListComplianceItems
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListComplianceItems -> ListComplianceItems -> Bool
$c/= :: ListComplianceItems -> ListComplianceItems -> Bool
== :: ListComplianceItems -> ListComplianceItems -> Bool
$c== :: ListComplianceItems -> ListComplianceItems -> Bool
Prelude.Eq, ReadPrec [ListComplianceItems]
ReadPrec ListComplianceItems
Int -> ReadS ListComplianceItems
ReadS [ListComplianceItems]
(Int -> ReadS ListComplianceItems)
-> ReadS [ListComplianceItems]
-> ReadPrec ListComplianceItems
-> ReadPrec [ListComplianceItems]
-> Read ListComplianceItems
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListComplianceItems]
$creadListPrec :: ReadPrec [ListComplianceItems]
readPrec :: ReadPrec ListComplianceItems
$creadPrec :: ReadPrec ListComplianceItems
readList :: ReadS [ListComplianceItems]
$creadList :: ReadS [ListComplianceItems]
readsPrec :: Int -> ReadS ListComplianceItems
$creadsPrec :: Int -> ReadS ListComplianceItems
Prelude.Read, Int -> ListComplianceItems -> ShowS
[ListComplianceItems] -> ShowS
ListComplianceItems -> String
(Int -> ListComplianceItems -> ShowS)
-> (ListComplianceItems -> String)
-> ([ListComplianceItems] -> ShowS)
-> Show ListComplianceItems
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListComplianceItems] -> ShowS
$cshowList :: [ListComplianceItems] -> ShowS
show :: ListComplianceItems -> String
$cshow :: ListComplianceItems -> String
showsPrec :: Int -> ListComplianceItems -> ShowS
$cshowsPrec :: Int -> ListComplianceItems -> ShowS
Prelude.Show, (forall x. ListComplianceItems -> Rep ListComplianceItems x)
-> (forall x. Rep ListComplianceItems x -> ListComplianceItems)
-> Generic ListComplianceItems
forall x. Rep ListComplianceItems x -> ListComplianceItems
forall x. ListComplianceItems -> Rep ListComplianceItems x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListComplianceItems x -> ListComplianceItems
$cfrom :: forall x. ListComplianceItems -> Rep ListComplianceItems x
Prelude.Generic)

-- |
-- Create a value of 'ListComplianceItems' 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:
--
-- 'resourceIds', 'listComplianceItems_resourceIds' - The ID for the resources from which to get compliance information.
-- Currently, you can only specify one resource ID.
--
-- 'filters', 'listComplianceItems_filters' - One or more compliance filters. Use a filter to return a more specific
-- list of results.
--
-- 'nextToken', 'listComplianceItems_nextToken' - A token to start the list. Use this token to get the next set of
-- results.
--
-- 'maxResults', 'listComplianceItems_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.
--
-- 'resourceTypes', 'listComplianceItems_resourceTypes' - The type of resource from which to get compliance information.
-- Currently, the only supported resource type is @ManagedInstance@.
newListComplianceItems ::
  ListComplianceItems
newListComplianceItems :: ListComplianceItems
newListComplianceItems =
  ListComplianceItems' :: Maybe (NonEmpty Text)
-> Maybe [ComplianceStringFilter]
-> Maybe Text
-> Maybe Natural
-> Maybe (NonEmpty Text)
-> ListComplianceItems
ListComplianceItems'
    { $sel:resourceIds:ListComplianceItems' :: Maybe (NonEmpty Text)
resourceIds = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:filters:ListComplianceItems' :: Maybe [ComplianceStringFilter]
filters = Maybe [ComplianceStringFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListComplianceItems' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListComplianceItems' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceTypes:ListComplianceItems' :: Maybe (NonEmpty Text)
resourceTypes = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID for the resources from which to get compliance information.
-- Currently, you can only specify one resource ID.
listComplianceItems_resourceIds :: Lens.Lens' ListComplianceItems (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
listComplianceItems_resourceIds :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListComplianceItems -> f ListComplianceItems
listComplianceItems_resourceIds = (ListComplianceItems -> Maybe (NonEmpty Text))
-> (ListComplianceItems
    -> Maybe (NonEmpty Text) -> ListComplianceItems)
-> Lens
     ListComplianceItems
     ListComplianceItems
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListComplianceItems' {Maybe (NonEmpty Text)
resourceIds :: Maybe (NonEmpty Text)
$sel:resourceIds:ListComplianceItems' :: ListComplianceItems -> Maybe (NonEmpty Text)
resourceIds} -> Maybe (NonEmpty Text)
resourceIds) (\s :: ListComplianceItems
s@ListComplianceItems' {} Maybe (NonEmpty Text)
a -> ListComplianceItems
s {$sel:resourceIds:ListComplianceItems' :: Maybe (NonEmpty Text)
resourceIds = Maybe (NonEmpty Text)
a} :: ListComplianceItems) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> ListComplianceItems -> f ListComplianceItems)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListComplianceItems
-> f ListComplianceItems
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | One or more compliance filters. Use a filter to return a more specific
-- list of results.
listComplianceItems_filters :: Lens.Lens' ListComplianceItems (Prelude.Maybe [ComplianceStringFilter])
listComplianceItems_filters :: (Maybe [ComplianceStringFilter]
 -> f (Maybe [ComplianceStringFilter]))
-> ListComplianceItems -> f ListComplianceItems
listComplianceItems_filters = (ListComplianceItems -> Maybe [ComplianceStringFilter])
-> (ListComplianceItems
    -> Maybe [ComplianceStringFilter] -> ListComplianceItems)
-> Lens
     ListComplianceItems
     ListComplianceItems
     (Maybe [ComplianceStringFilter])
     (Maybe [ComplianceStringFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListComplianceItems' {Maybe [ComplianceStringFilter]
filters :: Maybe [ComplianceStringFilter]
$sel:filters:ListComplianceItems' :: ListComplianceItems -> Maybe [ComplianceStringFilter]
filters} -> Maybe [ComplianceStringFilter]
filters) (\s :: ListComplianceItems
s@ListComplianceItems' {} Maybe [ComplianceStringFilter]
a -> ListComplianceItems
s {$sel:filters:ListComplianceItems' :: Maybe [ComplianceStringFilter]
filters = Maybe [ComplianceStringFilter]
a} :: ListComplianceItems) ((Maybe [ComplianceStringFilter]
  -> f (Maybe [ComplianceStringFilter]))
 -> ListComplianceItems -> f ListComplianceItems)
-> ((Maybe [ComplianceStringFilter]
     -> f (Maybe [ComplianceStringFilter]))
    -> Maybe [ComplianceStringFilter]
    -> f (Maybe [ComplianceStringFilter]))
-> (Maybe [ComplianceStringFilter]
    -> f (Maybe [ComplianceStringFilter]))
-> ListComplianceItems
-> f ListComplianceItems
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.
listComplianceItems_nextToken :: Lens.Lens' ListComplianceItems (Prelude.Maybe Prelude.Text)
listComplianceItems_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListComplianceItems -> f ListComplianceItems
listComplianceItems_nextToken = (ListComplianceItems -> Maybe Text)
-> (ListComplianceItems -> Maybe Text -> ListComplianceItems)
-> Lens
     ListComplianceItems ListComplianceItems (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListComplianceItems' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListComplianceItems' :: ListComplianceItems -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListComplianceItems
s@ListComplianceItems' {} Maybe Text
a -> ListComplianceItems
s {$sel:nextToken:ListComplianceItems' :: Maybe Text
nextToken = Maybe Text
a} :: ListComplianceItems)

-- | 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.
listComplianceItems_maxResults :: Lens.Lens' ListComplianceItems (Prelude.Maybe Prelude.Natural)
listComplianceItems_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListComplianceItems -> f ListComplianceItems
listComplianceItems_maxResults = (ListComplianceItems -> Maybe Natural)
-> (ListComplianceItems -> Maybe Natural -> ListComplianceItems)
-> Lens
     ListComplianceItems
     ListComplianceItems
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListComplianceItems' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListComplianceItems' :: ListComplianceItems -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListComplianceItems
s@ListComplianceItems' {} Maybe Natural
a -> ListComplianceItems
s {$sel:maxResults:ListComplianceItems' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListComplianceItems)

-- | The type of resource from which to get compliance information.
-- Currently, the only supported resource type is @ManagedInstance@.
listComplianceItems_resourceTypes :: Lens.Lens' ListComplianceItems (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
listComplianceItems_resourceTypes :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListComplianceItems -> f ListComplianceItems
listComplianceItems_resourceTypes = (ListComplianceItems -> Maybe (NonEmpty Text))
-> (ListComplianceItems
    -> Maybe (NonEmpty Text) -> ListComplianceItems)
-> Lens
     ListComplianceItems
     ListComplianceItems
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListComplianceItems' {Maybe (NonEmpty Text)
resourceTypes :: Maybe (NonEmpty Text)
$sel:resourceTypes:ListComplianceItems' :: ListComplianceItems -> Maybe (NonEmpty Text)
resourceTypes} -> Maybe (NonEmpty Text)
resourceTypes) (\s :: ListComplianceItems
s@ListComplianceItems' {} Maybe (NonEmpty Text)
a -> ListComplianceItems
s {$sel:resourceTypes:ListComplianceItems' :: Maybe (NonEmpty Text)
resourceTypes = Maybe (NonEmpty Text)
a} :: ListComplianceItems) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> ListComplianceItems -> f ListComplianceItems)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListComplianceItems
-> f ListComplianceItems
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListComplianceItems

instance Core.ToHeaders ListComplianceItems where
  toHeaders :: ListComplianceItems -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListComplianceItems -> 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.ListComplianceItems" ::
                          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 ListComplianceItems where
  toJSON :: ListComplianceItems -> Value
toJSON ListComplianceItems' {Maybe Natural
Maybe [ComplianceStringFilter]
Maybe (NonEmpty Text)
Maybe Text
resourceTypes :: Maybe (NonEmpty Text)
maxResults :: Maybe Natural
nextToken :: Maybe Text
filters :: Maybe [ComplianceStringFilter]
resourceIds :: Maybe (NonEmpty Text)
$sel:resourceTypes:ListComplianceItems' :: ListComplianceItems -> Maybe (NonEmpty Text)
$sel:maxResults:ListComplianceItems' :: ListComplianceItems -> Maybe Natural
$sel:nextToken:ListComplianceItems' :: ListComplianceItems -> Maybe Text
$sel:filters:ListComplianceItems' :: ListComplianceItems -> Maybe [ComplianceStringFilter]
$sel:resourceIds:ListComplianceItems' :: ListComplianceItems -> Maybe (NonEmpty Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ResourceIds" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
resourceIds,
            (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,
            (Text
"ResourceTypes" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
resourceTypes
          ]
      )

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

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

-- | /See:/ 'newListComplianceItemsResponse' smart constructor.
data ListComplianceItemsResponse = ListComplianceItemsResponse'
  { -- | A list of compliance information for the specified resource ID.
    ListComplianceItemsResponse -> Maybe [ComplianceItem]
complianceItems :: Prelude.Maybe [ComplianceItem],
    -- | The token for the next set of items to return. Use this token to get the
    -- next set of results.
    ListComplianceItemsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListComplianceItemsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListComplianceItemsResponse -> ListComplianceItemsResponse -> Bool
(ListComplianceItemsResponse
 -> ListComplianceItemsResponse -> Bool)
-> (ListComplianceItemsResponse
    -> ListComplianceItemsResponse -> Bool)
-> Eq ListComplianceItemsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListComplianceItemsResponse -> ListComplianceItemsResponse -> Bool
$c/= :: ListComplianceItemsResponse -> ListComplianceItemsResponse -> Bool
== :: ListComplianceItemsResponse -> ListComplianceItemsResponse -> Bool
$c== :: ListComplianceItemsResponse -> ListComplianceItemsResponse -> Bool
Prelude.Eq, ReadPrec [ListComplianceItemsResponse]
ReadPrec ListComplianceItemsResponse
Int -> ReadS ListComplianceItemsResponse
ReadS [ListComplianceItemsResponse]
(Int -> ReadS ListComplianceItemsResponse)
-> ReadS [ListComplianceItemsResponse]
-> ReadPrec ListComplianceItemsResponse
-> ReadPrec [ListComplianceItemsResponse]
-> Read ListComplianceItemsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListComplianceItemsResponse]
$creadListPrec :: ReadPrec [ListComplianceItemsResponse]
readPrec :: ReadPrec ListComplianceItemsResponse
$creadPrec :: ReadPrec ListComplianceItemsResponse
readList :: ReadS [ListComplianceItemsResponse]
$creadList :: ReadS [ListComplianceItemsResponse]
readsPrec :: Int -> ReadS ListComplianceItemsResponse
$creadsPrec :: Int -> ReadS ListComplianceItemsResponse
Prelude.Read, Int -> ListComplianceItemsResponse -> ShowS
[ListComplianceItemsResponse] -> ShowS
ListComplianceItemsResponse -> String
(Int -> ListComplianceItemsResponse -> ShowS)
-> (ListComplianceItemsResponse -> String)
-> ([ListComplianceItemsResponse] -> ShowS)
-> Show ListComplianceItemsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListComplianceItemsResponse] -> ShowS
$cshowList :: [ListComplianceItemsResponse] -> ShowS
show :: ListComplianceItemsResponse -> String
$cshow :: ListComplianceItemsResponse -> String
showsPrec :: Int -> ListComplianceItemsResponse -> ShowS
$cshowsPrec :: Int -> ListComplianceItemsResponse -> ShowS
Prelude.Show, (forall x.
 ListComplianceItemsResponse -> Rep ListComplianceItemsResponse x)
-> (forall x.
    Rep ListComplianceItemsResponse x -> ListComplianceItemsResponse)
-> Generic ListComplianceItemsResponse
forall x.
Rep ListComplianceItemsResponse x -> ListComplianceItemsResponse
forall x.
ListComplianceItemsResponse -> Rep ListComplianceItemsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListComplianceItemsResponse x -> ListComplianceItemsResponse
$cfrom :: forall x.
ListComplianceItemsResponse -> Rep ListComplianceItemsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListComplianceItemsResponse' 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:
--
-- 'complianceItems', 'listComplianceItemsResponse_complianceItems' - A list of compliance information for the specified resource ID.
--
-- 'nextToken', 'listComplianceItemsResponse_nextToken' - The token for the next set of items to return. Use this token to get the
-- next set of results.
--
-- 'httpStatus', 'listComplianceItemsResponse_httpStatus' - The response's http status code.
newListComplianceItemsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListComplianceItemsResponse
newListComplianceItemsResponse :: Int -> ListComplianceItemsResponse
newListComplianceItemsResponse Int
pHttpStatus_ =
  ListComplianceItemsResponse' :: Maybe [ComplianceItem]
-> Maybe Text -> Int -> ListComplianceItemsResponse
ListComplianceItemsResponse'
    { $sel:complianceItems:ListComplianceItemsResponse' :: Maybe [ComplianceItem]
complianceItems =
        Maybe [ComplianceItem]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListComplianceItemsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListComplianceItemsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of compliance information for the specified resource ID.
listComplianceItemsResponse_complianceItems :: Lens.Lens' ListComplianceItemsResponse (Prelude.Maybe [ComplianceItem])
listComplianceItemsResponse_complianceItems :: (Maybe [ComplianceItem] -> f (Maybe [ComplianceItem]))
-> ListComplianceItemsResponse -> f ListComplianceItemsResponse
listComplianceItemsResponse_complianceItems = (ListComplianceItemsResponse -> Maybe [ComplianceItem])
-> (ListComplianceItemsResponse
    -> Maybe [ComplianceItem] -> ListComplianceItemsResponse)
-> Lens' ListComplianceItemsResponse (Maybe [ComplianceItem])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListComplianceItemsResponse' {Maybe [ComplianceItem]
complianceItems :: Maybe [ComplianceItem]
$sel:complianceItems:ListComplianceItemsResponse' :: ListComplianceItemsResponse -> Maybe [ComplianceItem]
complianceItems} -> Maybe [ComplianceItem]
complianceItems) (\s :: ListComplianceItemsResponse
s@ListComplianceItemsResponse' {} Maybe [ComplianceItem]
a -> ListComplianceItemsResponse
s {$sel:complianceItems:ListComplianceItemsResponse' :: Maybe [ComplianceItem]
complianceItems = Maybe [ComplianceItem]
a} :: ListComplianceItemsResponse) ((Maybe [ComplianceItem] -> f (Maybe [ComplianceItem]))
 -> ListComplianceItemsResponse -> f ListComplianceItemsResponse)
-> ((Maybe [ComplianceItem] -> f (Maybe [ComplianceItem]))
    -> Maybe [ComplianceItem] -> f (Maybe [ComplianceItem]))
-> (Maybe [ComplianceItem] -> f (Maybe [ComplianceItem]))
-> ListComplianceItemsResponse
-> f ListComplianceItemsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ComplianceItem] [ComplianceItem] [ComplianceItem] [ComplianceItem]
-> Iso
     (Maybe [ComplianceItem])
     (Maybe [ComplianceItem])
     (Maybe [ComplianceItem])
     (Maybe [ComplianceItem])
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
  [ComplianceItem] [ComplianceItem] [ComplianceItem] [ComplianceItem]
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.
listComplianceItemsResponse_nextToken :: Lens.Lens' ListComplianceItemsResponse (Prelude.Maybe Prelude.Text)
listComplianceItemsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListComplianceItemsResponse -> f ListComplianceItemsResponse
listComplianceItemsResponse_nextToken = (ListComplianceItemsResponse -> Maybe Text)
-> (ListComplianceItemsResponse
    -> Maybe Text -> ListComplianceItemsResponse)
-> Lens' ListComplianceItemsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListComplianceItemsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListComplianceItemsResponse' :: ListComplianceItemsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListComplianceItemsResponse
s@ListComplianceItemsResponse' {} Maybe Text
a -> ListComplianceItemsResponse
s {$sel:nextToken:ListComplianceItemsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListComplianceItemsResponse)

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

instance Prelude.NFData ListComplianceItemsResponse