{-# 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.Config.GetConformancePackComplianceSummary
-- 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 compliance details for the conformance pack based on the
-- cumulative compliance results of all the rules in that conformance pack.
--
-- This operation returns paginated results.
module Amazonka.Config.GetConformancePackComplianceSummary
  ( -- * Creating a Request
    GetConformancePackComplianceSummary (..),
    newGetConformancePackComplianceSummary,

    -- * Request Lenses
    getConformancePackComplianceSummary_nextToken,
    getConformancePackComplianceSummary_limit,
    getConformancePackComplianceSummary_conformancePackNames,

    -- * Destructuring the Response
    GetConformancePackComplianceSummaryResponse (..),
    newGetConformancePackComplianceSummaryResponse,

    -- * Response Lenses
    getConformancePackComplianceSummaryResponse_conformancePackComplianceSummaryList,
    getConformancePackComplianceSummaryResponse_nextToken,
    getConformancePackComplianceSummaryResponse_httpStatus,
  )
where

import Amazonka.Config.Types
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

-- | /See:/ 'newGetConformancePackComplianceSummary' smart constructor.
data GetConformancePackComplianceSummary = GetConformancePackComplianceSummary'
  { -- | The nextToken string returned on a previous page that you use to get the
    -- next page of results in a paginated response.
    GetConformancePackComplianceSummary -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of conformance packs returned on each page.
    GetConformancePackComplianceSummary -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | Names of conformance packs.
    GetConformancePackComplianceSummary -> NonEmpty Text
conformancePackNames :: Prelude.NonEmpty Prelude.Text
  }
  deriving (GetConformancePackComplianceSummary
-> GetConformancePackComplianceSummary -> Bool
(GetConformancePackComplianceSummary
 -> GetConformancePackComplianceSummary -> Bool)
-> (GetConformancePackComplianceSummary
    -> GetConformancePackComplianceSummary -> Bool)
-> Eq GetConformancePackComplianceSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConformancePackComplianceSummary
-> GetConformancePackComplianceSummary -> Bool
$c/= :: GetConformancePackComplianceSummary
-> GetConformancePackComplianceSummary -> Bool
== :: GetConformancePackComplianceSummary
-> GetConformancePackComplianceSummary -> Bool
$c== :: GetConformancePackComplianceSummary
-> GetConformancePackComplianceSummary -> Bool
Prelude.Eq, ReadPrec [GetConformancePackComplianceSummary]
ReadPrec GetConformancePackComplianceSummary
Int -> ReadS GetConformancePackComplianceSummary
ReadS [GetConformancePackComplianceSummary]
(Int -> ReadS GetConformancePackComplianceSummary)
-> ReadS [GetConformancePackComplianceSummary]
-> ReadPrec GetConformancePackComplianceSummary
-> ReadPrec [GetConformancePackComplianceSummary]
-> Read GetConformancePackComplianceSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConformancePackComplianceSummary]
$creadListPrec :: ReadPrec [GetConformancePackComplianceSummary]
readPrec :: ReadPrec GetConformancePackComplianceSummary
$creadPrec :: ReadPrec GetConformancePackComplianceSummary
readList :: ReadS [GetConformancePackComplianceSummary]
$creadList :: ReadS [GetConformancePackComplianceSummary]
readsPrec :: Int -> ReadS GetConformancePackComplianceSummary
$creadsPrec :: Int -> ReadS GetConformancePackComplianceSummary
Prelude.Read, Int -> GetConformancePackComplianceSummary -> ShowS
[GetConformancePackComplianceSummary] -> ShowS
GetConformancePackComplianceSummary -> String
(Int -> GetConformancePackComplianceSummary -> ShowS)
-> (GetConformancePackComplianceSummary -> String)
-> ([GetConformancePackComplianceSummary] -> ShowS)
-> Show GetConformancePackComplianceSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConformancePackComplianceSummary] -> ShowS
$cshowList :: [GetConformancePackComplianceSummary] -> ShowS
show :: GetConformancePackComplianceSummary -> String
$cshow :: GetConformancePackComplianceSummary -> String
showsPrec :: Int -> GetConformancePackComplianceSummary -> ShowS
$cshowsPrec :: Int -> GetConformancePackComplianceSummary -> ShowS
Prelude.Show, (forall x.
 GetConformancePackComplianceSummary
 -> Rep GetConformancePackComplianceSummary x)
-> (forall x.
    Rep GetConformancePackComplianceSummary x
    -> GetConformancePackComplianceSummary)
-> Generic GetConformancePackComplianceSummary
forall x.
Rep GetConformancePackComplianceSummary x
-> GetConformancePackComplianceSummary
forall x.
GetConformancePackComplianceSummary
-> Rep GetConformancePackComplianceSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetConformancePackComplianceSummary x
-> GetConformancePackComplianceSummary
$cfrom :: forall x.
GetConformancePackComplianceSummary
-> Rep GetConformancePackComplianceSummary x
Prelude.Generic)

-- |
-- Create a value of 'GetConformancePackComplianceSummary' 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', 'getConformancePackComplianceSummary_nextToken' - The nextToken string returned on a previous page that you use to get the
-- next page of results in a paginated response.
--
-- 'limit', 'getConformancePackComplianceSummary_limit' - The maximum number of conformance packs returned on each page.
--
-- 'conformancePackNames', 'getConformancePackComplianceSummary_conformancePackNames' - Names of conformance packs.
newGetConformancePackComplianceSummary ::
  -- | 'conformancePackNames'
  Prelude.NonEmpty Prelude.Text ->
  GetConformancePackComplianceSummary
newGetConformancePackComplianceSummary :: NonEmpty Text -> GetConformancePackComplianceSummary
newGetConformancePackComplianceSummary
  NonEmpty Text
pConformancePackNames_ =
    GetConformancePackComplianceSummary' :: Maybe Text
-> Maybe Natural
-> NonEmpty Text
-> GetConformancePackComplianceSummary
GetConformancePackComplianceSummary'
      { $sel:nextToken:GetConformancePackComplianceSummary' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:limit:GetConformancePackComplianceSummary' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:conformancePackNames:GetConformancePackComplianceSummary' :: NonEmpty Text
conformancePackNames =
          Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
            (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pConformancePackNames_
      }

-- | The nextToken string returned on a previous page that you use to get the
-- next page of results in a paginated response.
getConformancePackComplianceSummary_nextToken :: Lens.Lens' GetConformancePackComplianceSummary (Prelude.Maybe Prelude.Text)
getConformancePackComplianceSummary_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetConformancePackComplianceSummary
-> f GetConformancePackComplianceSummary
getConformancePackComplianceSummary_nextToken = (GetConformancePackComplianceSummary -> Maybe Text)
-> (GetConformancePackComplianceSummary
    -> Maybe Text -> GetConformancePackComplianceSummary)
-> Lens
     GetConformancePackComplianceSummary
     GetConformancePackComplianceSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConformancePackComplianceSummary' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetConformancePackComplianceSummary' :: GetConformancePackComplianceSummary -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetConformancePackComplianceSummary
s@GetConformancePackComplianceSummary' {} Maybe Text
a -> GetConformancePackComplianceSummary
s {$sel:nextToken:GetConformancePackComplianceSummary' :: Maybe Text
nextToken = Maybe Text
a} :: GetConformancePackComplianceSummary)

-- | The maximum number of conformance packs returned on each page.
getConformancePackComplianceSummary_limit :: Lens.Lens' GetConformancePackComplianceSummary (Prelude.Maybe Prelude.Natural)
getConformancePackComplianceSummary_limit :: (Maybe Natural -> f (Maybe Natural))
-> GetConformancePackComplianceSummary
-> f GetConformancePackComplianceSummary
getConformancePackComplianceSummary_limit = (GetConformancePackComplianceSummary -> Maybe Natural)
-> (GetConformancePackComplianceSummary
    -> Maybe Natural -> GetConformancePackComplianceSummary)
-> Lens
     GetConformancePackComplianceSummary
     GetConformancePackComplianceSummary
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConformancePackComplianceSummary' {Maybe Natural
limit :: Maybe Natural
$sel:limit:GetConformancePackComplianceSummary' :: GetConformancePackComplianceSummary -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: GetConformancePackComplianceSummary
s@GetConformancePackComplianceSummary' {} Maybe Natural
a -> GetConformancePackComplianceSummary
s {$sel:limit:GetConformancePackComplianceSummary' :: Maybe Natural
limit = Maybe Natural
a} :: GetConformancePackComplianceSummary)

-- | Names of conformance packs.
getConformancePackComplianceSummary_conformancePackNames :: Lens.Lens' GetConformancePackComplianceSummary (Prelude.NonEmpty Prelude.Text)
getConformancePackComplianceSummary_conformancePackNames :: (NonEmpty Text -> f (NonEmpty Text))
-> GetConformancePackComplianceSummary
-> f GetConformancePackComplianceSummary
getConformancePackComplianceSummary_conformancePackNames = (GetConformancePackComplianceSummary -> NonEmpty Text)
-> (GetConformancePackComplianceSummary
    -> NonEmpty Text -> GetConformancePackComplianceSummary)
-> Lens
     GetConformancePackComplianceSummary
     GetConformancePackComplianceSummary
     (NonEmpty Text)
     (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConformancePackComplianceSummary' {NonEmpty Text
conformancePackNames :: NonEmpty Text
$sel:conformancePackNames:GetConformancePackComplianceSummary' :: GetConformancePackComplianceSummary -> NonEmpty Text
conformancePackNames} -> NonEmpty Text
conformancePackNames) (\s :: GetConformancePackComplianceSummary
s@GetConformancePackComplianceSummary' {} NonEmpty Text
a -> GetConformancePackComplianceSummary
s {$sel:conformancePackNames:GetConformancePackComplianceSummary' :: NonEmpty Text
conformancePackNames = NonEmpty Text
a} :: GetConformancePackComplianceSummary) ((NonEmpty Text -> f (NonEmpty Text))
 -> GetConformancePackComplianceSummary
 -> f GetConformancePackComplianceSummary)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> GetConformancePackComplianceSummary
-> f GetConformancePackComplianceSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.AWSPager
    GetConformancePackComplianceSummary
  where
  page :: GetConformancePackComplianceSummary
-> AWSResponse GetConformancePackComplianceSummary
-> Maybe GetConformancePackComplianceSummary
page GetConformancePackComplianceSummary
rq AWSResponse GetConformancePackComplianceSummary
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetConformancePackComplianceSummary
GetConformancePackComplianceSummaryResponse
rs
            GetConformancePackComplianceSummaryResponse
-> Getting
     (First Text) GetConformancePackComplianceSummaryResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetConformancePackComplianceSummaryResponse
-> Const (First Text) GetConformancePackComplianceSummaryResponse
Lens' GetConformancePackComplianceSummaryResponse (Maybe Text)
getConformancePackComplianceSummaryResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetConformancePackComplianceSummaryResponse
 -> Const (First Text) GetConformancePackComplianceSummaryResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) GetConformancePackComplianceSummaryResponse 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 GetConformancePackComplianceSummary
forall a. Maybe a
Prelude.Nothing
    | Maybe [ConformancePackComplianceSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetConformancePackComplianceSummary
GetConformancePackComplianceSummaryResponse
rs
            GetConformancePackComplianceSummaryResponse
-> Getting
     (First [ConformancePackComplianceSummary])
     GetConformancePackComplianceSummaryResponse
     [ConformancePackComplianceSummary]
-> Maybe [ConformancePackComplianceSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe (NonEmpty ConformancePackComplianceSummary)
 -> Const
      (First [ConformancePackComplianceSummary])
      (Maybe (NonEmpty ConformancePackComplianceSummary)))
-> GetConformancePackComplianceSummaryResponse
-> Const
     (First [ConformancePackComplianceSummary])
     GetConformancePackComplianceSummaryResponse
Lens'
  GetConformancePackComplianceSummaryResponse
  (Maybe (NonEmpty ConformancePackComplianceSummary))
getConformancePackComplianceSummaryResponse_conformancePackComplianceSummaryList
              ((Maybe (NonEmpty ConformancePackComplianceSummary)
  -> Const
       (First [ConformancePackComplianceSummary])
       (Maybe (NonEmpty ConformancePackComplianceSummary)))
 -> GetConformancePackComplianceSummaryResponse
 -> Const
      (First [ConformancePackComplianceSummary])
      GetConformancePackComplianceSummaryResponse)
-> (([ConformancePackComplianceSummary]
     -> Const
          (First [ConformancePackComplianceSummary])
          [ConformancePackComplianceSummary])
    -> Maybe (NonEmpty ConformancePackComplianceSummary)
    -> Const
         (First [ConformancePackComplianceSummary])
         (Maybe (NonEmpty ConformancePackComplianceSummary)))
-> Getting
     (First [ConformancePackComplianceSummary])
     GetConformancePackComplianceSummaryResponse
     [ConformancePackComplianceSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty ConformancePackComplianceSummary
 -> Const
      (First [ConformancePackComplianceSummary])
      (NonEmpty ConformancePackComplianceSummary))
-> Maybe (NonEmpty ConformancePackComplianceSummary)
-> Const
     (First [ConformancePackComplianceSummary])
     (Maybe (NonEmpty ConformancePackComplianceSummary))
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
              ((NonEmpty ConformancePackComplianceSummary
  -> Const
       (First [ConformancePackComplianceSummary])
       (NonEmpty ConformancePackComplianceSummary))
 -> Maybe (NonEmpty ConformancePackComplianceSummary)
 -> Const
      (First [ConformancePackComplianceSummary])
      (Maybe (NonEmpty ConformancePackComplianceSummary)))
-> (([ConformancePackComplianceSummary]
     -> Const
          (First [ConformancePackComplianceSummary])
          [ConformancePackComplianceSummary])
    -> NonEmpty ConformancePackComplianceSummary
    -> Const
         (First [ConformancePackComplianceSummary])
         (NonEmpty ConformancePackComplianceSummary))
-> ([ConformancePackComplianceSummary]
    -> Const
         (First [ConformancePackComplianceSummary])
         [ConformancePackComplianceSummary])
-> Maybe (NonEmpty ConformancePackComplianceSummary)
-> Const
     (First [ConformancePackComplianceSummary])
     (Maybe (NonEmpty ConformancePackComplianceSummary))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty ConformancePackComplianceSummary
 -> [ConformancePackComplianceSummary])
-> ([ConformancePackComplianceSummary]
    -> Const
         (First [ConformancePackComplianceSummary])
         [ConformancePackComplianceSummary])
-> NonEmpty ConformancePackComplianceSummary
-> Const
     (First [ConformancePackComplianceSummary])
     (NonEmpty ConformancePackComplianceSummary)
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to NonEmpty ConformancePackComplianceSummary
-> [ConformancePackComplianceSummary]
forall l. IsList l => l -> [Item l]
Prelude.toList
        ) =
      Maybe GetConformancePackComplianceSummary
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      GetConformancePackComplianceSummary
-> Maybe GetConformancePackComplianceSummary
forall a. a -> Maybe a
Prelude.Just (GetConformancePackComplianceSummary
 -> Maybe GetConformancePackComplianceSummary)
-> GetConformancePackComplianceSummary
-> Maybe GetConformancePackComplianceSummary
forall a b. (a -> b) -> a -> b
Prelude.$
        GetConformancePackComplianceSummary
rq
          GetConformancePackComplianceSummary
-> (GetConformancePackComplianceSummary
    -> GetConformancePackComplianceSummary)
-> GetConformancePackComplianceSummary
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetConformancePackComplianceSummary
-> Identity GetConformancePackComplianceSummary
Lens
  GetConformancePackComplianceSummary
  GetConformancePackComplianceSummary
  (Maybe Text)
  (Maybe Text)
getConformancePackComplianceSummary_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> GetConformancePackComplianceSummary
 -> Identity GetConformancePackComplianceSummary)
-> Maybe Text
-> GetConformancePackComplianceSummary
-> GetConformancePackComplianceSummary
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetConformancePackComplianceSummary
GetConformancePackComplianceSummaryResponse
rs
          GetConformancePackComplianceSummaryResponse
-> Getting
     (First Text) GetConformancePackComplianceSummaryResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetConformancePackComplianceSummaryResponse
-> Const (First Text) GetConformancePackComplianceSummaryResponse
Lens' GetConformancePackComplianceSummaryResponse (Maybe Text)
getConformancePackComplianceSummaryResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetConformancePackComplianceSummaryResponse
 -> Const (First Text) GetConformancePackComplianceSummaryResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) GetConformancePackComplianceSummaryResponse 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
    GetConformancePackComplianceSummary
  where
  type
    AWSResponse GetConformancePackComplianceSummary =
      GetConformancePackComplianceSummaryResponse
  request :: GetConformancePackComplianceSummary
-> Request GetConformancePackComplianceSummary
request = Service
-> GetConformancePackComplianceSummary
-> Request GetConformancePackComplianceSummary
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetConformancePackComplianceSummary
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetConformancePackComplianceSummary)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetConformancePackComplianceSummary))
-> Logger
-> Service
-> Proxy GetConformancePackComplianceSummary
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetConformancePackComplianceSummary)))
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 (NonEmpty ConformancePackComplianceSummary)
-> Maybe Text -> Int -> GetConformancePackComplianceSummaryResponse
GetConformancePackComplianceSummaryResponse'
            (Maybe (NonEmpty ConformancePackComplianceSummary)
 -> Maybe Text
 -> Int
 -> GetConformancePackComplianceSummaryResponse)
-> Either
     String (Maybe (NonEmpty ConformancePackComplianceSummary))
-> Either
     String
     (Maybe Text -> Int -> GetConformancePackComplianceSummaryResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Either
     String (Maybe (NonEmpty ConformancePackComplianceSummary))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ConformancePackComplianceSummaryList")
              Either
  String
  (Maybe Text -> Int -> GetConformancePackComplianceSummaryResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> GetConformancePackComplianceSummaryResponse)
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 -> GetConformancePackComplianceSummaryResponse)
-> Either String Int
-> Either String GetConformancePackComplianceSummaryResponse
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
    GetConformancePackComplianceSummary

instance
  Prelude.NFData
    GetConformancePackComplianceSummary

instance
  Core.ToHeaders
    GetConformancePackComplianceSummary
  where
  toHeaders :: GetConformancePackComplianceSummary -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> GetConformancePackComplianceSummary -> 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
"StarlingDoveService.GetConformancePackComplianceSummary" ::
                          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
    GetConformancePackComplianceSummary
  where
  toJSON :: GetConformancePackComplianceSummary -> Value
toJSON GetConformancePackComplianceSummary' {Maybe Natural
Maybe Text
NonEmpty Text
conformancePackNames :: NonEmpty Text
limit :: Maybe Natural
nextToken :: Maybe Text
$sel:conformancePackNames:GetConformancePackComplianceSummary' :: GetConformancePackComplianceSummary -> NonEmpty Text
$sel:limit:GetConformancePackComplianceSummary' :: GetConformancePackComplianceSummary -> Maybe Natural
$sel:nextToken:GetConformancePackComplianceSummary' :: GetConformancePackComplianceSummary -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
"Limit" 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
limit,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"ConformancePackNames"
                  Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
conformancePackNames
              )
          ]
      )

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

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

-- | /See:/ 'newGetConformancePackComplianceSummaryResponse' smart constructor.
data GetConformancePackComplianceSummaryResponse = GetConformancePackComplianceSummaryResponse'
  { -- | A list of @ConformancePackComplianceSummary@ objects.
    GetConformancePackComplianceSummaryResponse
-> Maybe (NonEmpty ConformancePackComplianceSummary)
conformancePackComplianceSummaryList :: Prelude.Maybe (Prelude.NonEmpty ConformancePackComplianceSummary),
    -- | The nextToken string returned on a previous page that you use to get the
    -- next page of results in a paginated response.
    GetConformancePackComplianceSummaryResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetConformancePackComplianceSummaryResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetConformancePackComplianceSummaryResponse
-> GetConformancePackComplianceSummaryResponse -> Bool
(GetConformancePackComplianceSummaryResponse
 -> GetConformancePackComplianceSummaryResponse -> Bool)
-> (GetConformancePackComplianceSummaryResponse
    -> GetConformancePackComplianceSummaryResponse -> Bool)
-> Eq GetConformancePackComplianceSummaryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConformancePackComplianceSummaryResponse
-> GetConformancePackComplianceSummaryResponse -> Bool
$c/= :: GetConformancePackComplianceSummaryResponse
-> GetConformancePackComplianceSummaryResponse -> Bool
== :: GetConformancePackComplianceSummaryResponse
-> GetConformancePackComplianceSummaryResponse -> Bool
$c== :: GetConformancePackComplianceSummaryResponse
-> GetConformancePackComplianceSummaryResponse -> Bool
Prelude.Eq, ReadPrec [GetConformancePackComplianceSummaryResponse]
ReadPrec GetConformancePackComplianceSummaryResponse
Int -> ReadS GetConformancePackComplianceSummaryResponse
ReadS [GetConformancePackComplianceSummaryResponse]
(Int -> ReadS GetConformancePackComplianceSummaryResponse)
-> ReadS [GetConformancePackComplianceSummaryResponse]
-> ReadPrec GetConformancePackComplianceSummaryResponse
-> ReadPrec [GetConformancePackComplianceSummaryResponse]
-> Read GetConformancePackComplianceSummaryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConformancePackComplianceSummaryResponse]
$creadListPrec :: ReadPrec [GetConformancePackComplianceSummaryResponse]
readPrec :: ReadPrec GetConformancePackComplianceSummaryResponse
$creadPrec :: ReadPrec GetConformancePackComplianceSummaryResponse
readList :: ReadS [GetConformancePackComplianceSummaryResponse]
$creadList :: ReadS [GetConformancePackComplianceSummaryResponse]
readsPrec :: Int -> ReadS GetConformancePackComplianceSummaryResponse
$creadsPrec :: Int -> ReadS GetConformancePackComplianceSummaryResponse
Prelude.Read, Int -> GetConformancePackComplianceSummaryResponse -> ShowS
[GetConformancePackComplianceSummaryResponse] -> ShowS
GetConformancePackComplianceSummaryResponse -> String
(Int -> GetConformancePackComplianceSummaryResponse -> ShowS)
-> (GetConformancePackComplianceSummaryResponse -> String)
-> ([GetConformancePackComplianceSummaryResponse] -> ShowS)
-> Show GetConformancePackComplianceSummaryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConformancePackComplianceSummaryResponse] -> ShowS
$cshowList :: [GetConformancePackComplianceSummaryResponse] -> ShowS
show :: GetConformancePackComplianceSummaryResponse -> String
$cshow :: GetConformancePackComplianceSummaryResponse -> String
showsPrec :: Int -> GetConformancePackComplianceSummaryResponse -> ShowS
$cshowsPrec :: Int -> GetConformancePackComplianceSummaryResponse -> ShowS
Prelude.Show, (forall x.
 GetConformancePackComplianceSummaryResponse
 -> Rep GetConformancePackComplianceSummaryResponse x)
-> (forall x.
    Rep GetConformancePackComplianceSummaryResponse x
    -> GetConformancePackComplianceSummaryResponse)
-> Generic GetConformancePackComplianceSummaryResponse
forall x.
Rep GetConformancePackComplianceSummaryResponse x
-> GetConformancePackComplianceSummaryResponse
forall x.
GetConformancePackComplianceSummaryResponse
-> Rep GetConformancePackComplianceSummaryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetConformancePackComplianceSummaryResponse x
-> GetConformancePackComplianceSummaryResponse
$cfrom :: forall x.
GetConformancePackComplianceSummaryResponse
-> Rep GetConformancePackComplianceSummaryResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetConformancePackComplianceSummaryResponse' 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:
--
-- 'conformancePackComplianceSummaryList', 'getConformancePackComplianceSummaryResponse_conformancePackComplianceSummaryList' - A list of @ConformancePackComplianceSummary@ objects.
--
-- 'nextToken', 'getConformancePackComplianceSummaryResponse_nextToken' - The nextToken string returned on a previous page that you use to get the
-- next page of results in a paginated response.
--
-- 'httpStatus', 'getConformancePackComplianceSummaryResponse_httpStatus' - The response's http status code.
newGetConformancePackComplianceSummaryResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetConformancePackComplianceSummaryResponse
newGetConformancePackComplianceSummaryResponse :: Int -> GetConformancePackComplianceSummaryResponse
newGetConformancePackComplianceSummaryResponse
  Int
pHttpStatus_ =
    GetConformancePackComplianceSummaryResponse' :: Maybe (NonEmpty ConformancePackComplianceSummary)
-> Maybe Text -> Int -> GetConformancePackComplianceSummaryResponse
GetConformancePackComplianceSummaryResponse'
      { $sel:conformancePackComplianceSummaryList:GetConformancePackComplianceSummaryResponse' :: Maybe (NonEmpty ConformancePackComplianceSummary)
conformancePackComplianceSummaryList =
          Maybe (NonEmpty ConformancePackComplianceSummary)
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:GetConformancePackComplianceSummaryResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetConformancePackComplianceSummaryResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | A list of @ConformancePackComplianceSummary@ objects.
getConformancePackComplianceSummaryResponse_conformancePackComplianceSummaryList :: Lens.Lens' GetConformancePackComplianceSummaryResponse (Prelude.Maybe (Prelude.NonEmpty ConformancePackComplianceSummary))
getConformancePackComplianceSummaryResponse_conformancePackComplianceSummaryList :: (Maybe (NonEmpty ConformancePackComplianceSummary)
 -> f (Maybe (NonEmpty ConformancePackComplianceSummary)))
-> GetConformancePackComplianceSummaryResponse
-> f GetConformancePackComplianceSummaryResponse
getConformancePackComplianceSummaryResponse_conformancePackComplianceSummaryList = (GetConformancePackComplianceSummaryResponse
 -> Maybe (NonEmpty ConformancePackComplianceSummary))
-> (GetConformancePackComplianceSummaryResponse
    -> Maybe (NonEmpty ConformancePackComplianceSummary)
    -> GetConformancePackComplianceSummaryResponse)
-> Lens'
     GetConformancePackComplianceSummaryResponse
     (Maybe (NonEmpty ConformancePackComplianceSummary))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConformancePackComplianceSummaryResponse' {Maybe (NonEmpty ConformancePackComplianceSummary)
conformancePackComplianceSummaryList :: Maybe (NonEmpty ConformancePackComplianceSummary)
$sel:conformancePackComplianceSummaryList:GetConformancePackComplianceSummaryResponse' :: GetConformancePackComplianceSummaryResponse
-> Maybe (NonEmpty ConformancePackComplianceSummary)
conformancePackComplianceSummaryList} -> Maybe (NonEmpty ConformancePackComplianceSummary)
conformancePackComplianceSummaryList) (\s :: GetConformancePackComplianceSummaryResponse
s@GetConformancePackComplianceSummaryResponse' {} Maybe (NonEmpty ConformancePackComplianceSummary)
a -> GetConformancePackComplianceSummaryResponse
s {$sel:conformancePackComplianceSummaryList:GetConformancePackComplianceSummaryResponse' :: Maybe (NonEmpty ConformancePackComplianceSummary)
conformancePackComplianceSummaryList = Maybe (NonEmpty ConformancePackComplianceSummary)
a} :: GetConformancePackComplianceSummaryResponse) ((Maybe (NonEmpty ConformancePackComplianceSummary)
  -> f (Maybe (NonEmpty ConformancePackComplianceSummary)))
 -> GetConformancePackComplianceSummaryResponse
 -> f GetConformancePackComplianceSummaryResponse)
-> ((Maybe (NonEmpty ConformancePackComplianceSummary)
     -> f (Maybe (NonEmpty ConformancePackComplianceSummary)))
    -> Maybe (NonEmpty ConformancePackComplianceSummary)
    -> f (Maybe (NonEmpty ConformancePackComplianceSummary)))
-> (Maybe (NonEmpty ConformancePackComplianceSummary)
    -> f (Maybe (NonEmpty ConformancePackComplianceSummary)))
-> GetConformancePackComplianceSummaryResponse
-> f GetConformancePackComplianceSummaryResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty ConformancePackComplianceSummary)
  (NonEmpty ConformancePackComplianceSummary)
  (NonEmpty ConformancePackComplianceSummary)
  (NonEmpty ConformancePackComplianceSummary)
-> Iso
     (Maybe (NonEmpty ConformancePackComplianceSummary))
     (Maybe (NonEmpty ConformancePackComplianceSummary))
     (Maybe (NonEmpty ConformancePackComplianceSummary))
     (Maybe (NonEmpty ConformancePackComplianceSummary))
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 ConformancePackComplianceSummary)
  (NonEmpty ConformancePackComplianceSummary)
  (NonEmpty ConformancePackComplianceSummary)
  (NonEmpty ConformancePackComplianceSummary)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The nextToken string returned on a previous page that you use to get the
-- next page of results in a paginated response.
getConformancePackComplianceSummaryResponse_nextToken :: Lens.Lens' GetConformancePackComplianceSummaryResponse (Prelude.Maybe Prelude.Text)
getConformancePackComplianceSummaryResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetConformancePackComplianceSummaryResponse
-> f GetConformancePackComplianceSummaryResponse
getConformancePackComplianceSummaryResponse_nextToken = (GetConformancePackComplianceSummaryResponse -> Maybe Text)
-> (GetConformancePackComplianceSummaryResponse
    -> Maybe Text -> GetConformancePackComplianceSummaryResponse)
-> Lens' GetConformancePackComplianceSummaryResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConformancePackComplianceSummaryResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetConformancePackComplianceSummaryResponse' :: GetConformancePackComplianceSummaryResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetConformancePackComplianceSummaryResponse
s@GetConformancePackComplianceSummaryResponse' {} Maybe Text
a -> GetConformancePackComplianceSummaryResponse
s {$sel:nextToken:GetConformancePackComplianceSummaryResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetConformancePackComplianceSummaryResponse)

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

instance
  Prelude.NFData
    GetConformancePackComplianceSummaryResponse