{-# 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.Inspector.ListAssessmentTemplates
-- 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)
--
-- Lists the assessment templates that correspond to the assessment targets
-- that are specified by the ARNs of the assessment targets.
--
-- This operation returns paginated results.
module Amazonka.Inspector.ListAssessmentTemplates
  ( -- * Creating a Request
    ListAssessmentTemplates (..),
    newListAssessmentTemplates,

    -- * Request Lenses
    listAssessmentTemplates_nextToken,
    listAssessmentTemplates_filter,
    listAssessmentTemplates_maxResults,
    listAssessmentTemplates_assessmentTargetArns,

    -- * Destructuring the Response
    ListAssessmentTemplatesResponse (..),
    newListAssessmentTemplatesResponse,

    -- * Response Lenses
    listAssessmentTemplatesResponse_nextToken,
    listAssessmentTemplatesResponse_httpStatus,
    listAssessmentTemplatesResponse_assessmentTemplateArns,
  )
where

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

-- | /See:/ 'newListAssessmentTemplates' smart constructor.
data ListAssessmentTemplates = ListAssessmentTemplates'
  { -- | You can use this parameter when paginating results. Set the value of
    -- this parameter to null on your first call to the
    -- __ListAssessmentTemplates__ action. Subsequent calls to the action fill
    -- __nextToken__ in the request with the value of __NextToken__ from the
    -- previous response to continue listing data.
    ListAssessmentTemplates -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | You can use this parameter to specify a subset of data to be included in
    -- the action\'s response.
    --
    -- For a record to match a filter, all specified filter attributes must
    -- match. When multiple values are specified for a filter attribute, any of
    -- the values can match.
    ListAssessmentTemplates -> Maybe AssessmentTemplateFilter
filter' :: Prelude.Maybe AssessmentTemplateFilter,
    -- | You can use this parameter to indicate the maximum number of items you
    -- want in the response. The default value is 10. The maximum value is 500.
    ListAssessmentTemplates -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | A list of ARNs that specifies the assessment targets whose assessment
    -- templates you want to list.
    ListAssessmentTemplates -> Maybe [Text]
assessmentTargetArns :: Prelude.Maybe [Prelude.Text]
  }
  deriving (ListAssessmentTemplates -> ListAssessmentTemplates -> Bool
(ListAssessmentTemplates -> ListAssessmentTemplates -> Bool)
-> (ListAssessmentTemplates -> ListAssessmentTemplates -> Bool)
-> Eq ListAssessmentTemplates
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAssessmentTemplates -> ListAssessmentTemplates -> Bool
$c/= :: ListAssessmentTemplates -> ListAssessmentTemplates -> Bool
== :: ListAssessmentTemplates -> ListAssessmentTemplates -> Bool
$c== :: ListAssessmentTemplates -> ListAssessmentTemplates -> Bool
Prelude.Eq, ReadPrec [ListAssessmentTemplates]
ReadPrec ListAssessmentTemplates
Int -> ReadS ListAssessmentTemplates
ReadS [ListAssessmentTemplates]
(Int -> ReadS ListAssessmentTemplates)
-> ReadS [ListAssessmentTemplates]
-> ReadPrec ListAssessmentTemplates
-> ReadPrec [ListAssessmentTemplates]
-> Read ListAssessmentTemplates
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAssessmentTemplates]
$creadListPrec :: ReadPrec [ListAssessmentTemplates]
readPrec :: ReadPrec ListAssessmentTemplates
$creadPrec :: ReadPrec ListAssessmentTemplates
readList :: ReadS [ListAssessmentTemplates]
$creadList :: ReadS [ListAssessmentTemplates]
readsPrec :: Int -> ReadS ListAssessmentTemplates
$creadsPrec :: Int -> ReadS ListAssessmentTemplates
Prelude.Read, Int -> ListAssessmentTemplates -> ShowS
[ListAssessmentTemplates] -> ShowS
ListAssessmentTemplates -> String
(Int -> ListAssessmentTemplates -> ShowS)
-> (ListAssessmentTemplates -> String)
-> ([ListAssessmentTemplates] -> ShowS)
-> Show ListAssessmentTemplates
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAssessmentTemplates] -> ShowS
$cshowList :: [ListAssessmentTemplates] -> ShowS
show :: ListAssessmentTemplates -> String
$cshow :: ListAssessmentTemplates -> String
showsPrec :: Int -> ListAssessmentTemplates -> ShowS
$cshowsPrec :: Int -> ListAssessmentTemplates -> ShowS
Prelude.Show, (forall x.
 ListAssessmentTemplates -> Rep ListAssessmentTemplates x)
-> (forall x.
    Rep ListAssessmentTemplates x -> ListAssessmentTemplates)
-> Generic ListAssessmentTemplates
forall x. Rep ListAssessmentTemplates x -> ListAssessmentTemplates
forall x. ListAssessmentTemplates -> Rep ListAssessmentTemplates x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAssessmentTemplates x -> ListAssessmentTemplates
$cfrom :: forall x. ListAssessmentTemplates -> Rep ListAssessmentTemplates x
Prelude.Generic)

-- |
-- Create a value of 'ListAssessmentTemplates' 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', 'listAssessmentTemplates_nextToken' - You can use this parameter when paginating results. Set the value of
-- this parameter to null on your first call to the
-- __ListAssessmentTemplates__ action. Subsequent calls to the action fill
-- __nextToken__ in the request with the value of __NextToken__ from the
-- previous response to continue listing data.
--
-- 'filter'', 'listAssessmentTemplates_filter' - You can use this parameter to specify a subset of data to be included in
-- the action\'s response.
--
-- For a record to match a filter, all specified filter attributes must
-- match. When multiple values are specified for a filter attribute, any of
-- the values can match.
--
-- 'maxResults', 'listAssessmentTemplates_maxResults' - You can use this parameter to indicate the maximum number of items you
-- want in the response. The default value is 10. The maximum value is 500.
--
-- 'assessmentTargetArns', 'listAssessmentTemplates_assessmentTargetArns' - A list of ARNs that specifies the assessment targets whose assessment
-- templates you want to list.
newListAssessmentTemplates ::
  ListAssessmentTemplates
newListAssessmentTemplates :: ListAssessmentTemplates
newListAssessmentTemplates =
  ListAssessmentTemplates' :: Maybe Text
-> Maybe AssessmentTemplateFilter
-> Maybe Int
-> Maybe [Text]
-> ListAssessmentTemplates
ListAssessmentTemplates'
    { $sel:nextToken:ListAssessmentTemplates' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':ListAssessmentTemplates' :: Maybe AssessmentTemplateFilter
filter' = Maybe AssessmentTemplateFilter
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAssessmentTemplates' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:assessmentTargetArns:ListAssessmentTemplates' :: Maybe [Text]
assessmentTargetArns = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | You can use this parameter when paginating results. Set the value of
-- this parameter to null on your first call to the
-- __ListAssessmentTemplates__ action. Subsequent calls to the action fill
-- __nextToken__ in the request with the value of __NextToken__ from the
-- previous response to continue listing data.
listAssessmentTemplates_nextToken :: Lens.Lens' ListAssessmentTemplates (Prelude.Maybe Prelude.Text)
listAssessmentTemplates_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAssessmentTemplates -> f ListAssessmentTemplates
listAssessmentTemplates_nextToken = (ListAssessmentTemplates -> Maybe Text)
-> (ListAssessmentTemplates
    -> Maybe Text -> ListAssessmentTemplates)
-> Lens
     ListAssessmentTemplates
     ListAssessmentTemplates
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssessmentTemplates' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAssessmentTemplates' :: ListAssessmentTemplates -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAssessmentTemplates
s@ListAssessmentTemplates' {} Maybe Text
a -> ListAssessmentTemplates
s {$sel:nextToken:ListAssessmentTemplates' :: Maybe Text
nextToken = Maybe Text
a} :: ListAssessmentTemplates)

-- | You can use this parameter to specify a subset of data to be included in
-- the action\'s response.
--
-- For a record to match a filter, all specified filter attributes must
-- match. When multiple values are specified for a filter attribute, any of
-- the values can match.
listAssessmentTemplates_filter :: Lens.Lens' ListAssessmentTemplates (Prelude.Maybe AssessmentTemplateFilter)
listAssessmentTemplates_filter :: (Maybe AssessmentTemplateFilter
 -> f (Maybe AssessmentTemplateFilter))
-> ListAssessmentTemplates -> f ListAssessmentTemplates
listAssessmentTemplates_filter = (ListAssessmentTemplates -> Maybe AssessmentTemplateFilter)
-> (ListAssessmentTemplates
    -> Maybe AssessmentTemplateFilter -> ListAssessmentTemplates)
-> Lens
     ListAssessmentTemplates
     ListAssessmentTemplates
     (Maybe AssessmentTemplateFilter)
     (Maybe AssessmentTemplateFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssessmentTemplates' {Maybe AssessmentTemplateFilter
filter' :: Maybe AssessmentTemplateFilter
$sel:filter':ListAssessmentTemplates' :: ListAssessmentTemplates -> Maybe AssessmentTemplateFilter
filter'} -> Maybe AssessmentTemplateFilter
filter') (\s :: ListAssessmentTemplates
s@ListAssessmentTemplates' {} Maybe AssessmentTemplateFilter
a -> ListAssessmentTemplates
s {$sel:filter':ListAssessmentTemplates' :: Maybe AssessmentTemplateFilter
filter' = Maybe AssessmentTemplateFilter
a} :: ListAssessmentTemplates)

-- | You can use this parameter to indicate the maximum number of items you
-- want in the response. The default value is 10. The maximum value is 500.
listAssessmentTemplates_maxResults :: Lens.Lens' ListAssessmentTemplates (Prelude.Maybe Prelude.Int)
listAssessmentTemplates_maxResults :: (Maybe Int -> f (Maybe Int))
-> ListAssessmentTemplates -> f ListAssessmentTemplates
listAssessmentTemplates_maxResults = (ListAssessmentTemplates -> Maybe Int)
-> (ListAssessmentTemplates
    -> Maybe Int -> ListAssessmentTemplates)
-> Lens
     ListAssessmentTemplates
     ListAssessmentTemplates
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssessmentTemplates' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListAssessmentTemplates' :: ListAssessmentTemplates -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListAssessmentTemplates
s@ListAssessmentTemplates' {} Maybe Int
a -> ListAssessmentTemplates
s {$sel:maxResults:ListAssessmentTemplates' :: Maybe Int
maxResults = Maybe Int
a} :: ListAssessmentTemplates)

-- | A list of ARNs that specifies the assessment targets whose assessment
-- templates you want to list.
listAssessmentTemplates_assessmentTargetArns :: Lens.Lens' ListAssessmentTemplates (Prelude.Maybe [Prelude.Text])
listAssessmentTemplates_assessmentTargetArns :: (Maybe [Text] -> f (Maybe [Text]))
-> ListAssessmentTemplates -> f ListAssessmentTemplates
listAssessmentTemplates_assessmentTargetArns = (ListAssessmentTemplates -> Maybe [Text])
-> (ListAssessmentTemplates
    -> Maybe [Text] -> ListAssessmentTemplates)
-> Lens
     ListAssessmentTemplates
     ListAssessmentTemplates
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssessmentTemplates' {Maybe [Text]
assessmentTargetArns :: Maybe [Text]
$sel:assessmentTargetArns:ListAssessmentTemplates' :: ListAssessmentTemplates -> Maybe [Text]
assessmentTargetArns} -> Maybe [Text]
assessmentTargetArns) (\s :: ListAssessmentTemplates
s@ListAssessmentTemplates' {} Maybe [Text]
a -> ListAssessmentTemplates
s {$sel:assessmentTargetArns:ListAssessmentTemplates' :: Maybe [Text]
assessmentTargetArns = Maybe [Text]
a} :: ListAssessmentTemplates) ((Maybe [Text] -> f (Maybe [Text]))
 -> ListAssessmentTemplates -> f ListAssessmentTemplates)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListAssessmentTemplates
-> f ListAssessmentTemplates
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSPager ListAssessmentTemplates where
  page :: ListAssessmentTemplates
-> AWSResponse ListAssessmentTemplates
-> Maybe ListAssessmentTemplates
page ListAssessmentTemplates
rq AWSResponse ListAssessmentTemplates
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAssessmentTemplates
ListAssessmentTemplatesResponse
rs
            ListAssessmentTemplatesResponse
-> Getting (First Text) ListAssessmentTemplatesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAssessmentTemplatesResponse
-> Const (First Text) ListAssessmentTemplatesResponse
Lens' ListAssessmentTemplatesResponse (Maybe Text)
listAssessmentTemplatesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListAssessmentTemplatesResponse
 -> Const (First Text) ListAssessmentTemplatesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListAssessmentTemplatesResponse 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 ListAssessmentTemplates
forall a. Maybe a
Prelude.Nothing
    | [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAssessmentTemplates
ListAssessmentTemplatesResponse
rs
            ListAssessmentTemplatesResponse
-> Getting [Text] ListAssessmentTemplatesResponse [Text] -> [Text]
forall s a. s -> Getting a s a -> a
Lens.^. Getting [Text] ListAssessmentTemplatesResponse [Text]
Lens' ListAssessmentTemplatesResponse [Text]
listAssessmentTemplatesResponse_assessmentTemplateArns
        ) =
      Maybe ListAssessmentTemplates
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListAssessmentTemplates -> Maybe ListAssessmentTemplates
forall a. a -> Maybe a
Prelude.Just (ListAssessmentTemplates -> Maybe ListAssessmentTemplates)
-> ListAssessmentTemplates -> Maybe ListAssessmentTemplates
forall a b. (a -> b) -> a -> b
Prelude.$
        ListAssessmentTemplates
rq
          ListAssessmentTemplates
-> (ListAssessmentTemplates -> ListAssessmentTemplates)
-> ListAssessmentTemplates
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListAssessmentTemplates -> Identity ListAssessmentTemplates
Lens
  ListAssessmentTemplates
  ListAssessmentTemplates
  (Maybe Text)
  (Maybe Text)
listAssessmentTemplates_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListAssessmentTemplates -> Identity ListAssessmentTemplates)
-> Maybe Text -> ListAssessmentTemplates -> ListAssessmentTemplates
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAssessmentTemplates
ListAssessmentTemplatesResponse
rs
          ListAssessmentTemplatesResponse
-> Getting (First Text) ListAssessmentTemplatesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAssessmentTemplatesResponse
-> Const (First Text) ListAssessmentTemplatesResponse
Lens' ListAssessmentTemplatesResponse (Maybe Text)
listAssessmentTemplatesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListAssessmentTemplatesResponse
 -> Const (First Text) ListAssessmentTemplatesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListAssessmentTemplatesResponse 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 ListAssessmentTemplates where
  type
    AWSResponse ListAssessmentTemplates =
      ListAssessmentTemplatesResponse
  request :: ListAssessmentTemplates -> Request ListAssessmentTemplates
request = Service
-> ListAssessmentTemplates -> Request ListAssessmentTemplates
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListAssessmentTemplates
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListAssessmentTemplates)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListAssessmentTemplates))
-> Logger
-> Service
-> Proxy ListAssessmentTemplates
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListAssessmentTemplates)))
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 Text -> Int -> [Text] -> ListAssessmentTemplatesResponse
ListAssessmentTemplatesResponse'
            (Maybe Text -> Int -> [Text] -> ListAssessmentTemplatesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [Text] -> ListAssessmentTemplatesResponse)
forall (f :: * -> *) a b. Functor 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 -> [Text] -> ListAssessmentTemplatesResponse)
-> Either String Int
-> Either String ([Text] -> ListAssessmentTemplatesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either String ([Text] -> ListAssessmentTemplatesResponse)
-> Either String [Text]
-> Either String ListAssessmentTemplatesResponse
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
"assessmentTemplateArns"
                            Either String (Maybe [Text]) -> [Text] -> Either String [Text]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ListAssessmentTemplates

instance Prelude.NFData ListAssessmentTemplates

instance Core.ToHeaders ListAssessmentTemplates where
  toHeaders :: ListAssessmentTemplates -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListAssessmentTemplates -> 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
"InspectorService.ListAssessmentTemplates" ::
                          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 ListAssessmentTemplates where
  toJSON :: ListAssessmentTemplates -> Value
toJSON ListAssessmentTemplates' {Maybe Int
Maybe [Text]
Maybe Text
Maybe AssessmentTemplateFilter
assessmentTargetArns :: Maybe [Text]
maxResults :: Maybe Int
filter' :: Maybe AssessmentTemplateFilter
nextToken :: Maybe Text
$sel:assessmentTargetArns:ListAssessmentTemplates' :: ListAssessmentTemplates -> Maybe [Text]
$sel:maxResults:ListAssessmentTemplates' :: ListAssessmentTemplates -> Maybe Int
$sel:filter':ListAssessmentTemplates' :: ListAssessmentTemplates -> Maybe AssessmentTemplateFilter
$sel:nextToken:ListAssessmentTemplates' :: ListAssessmentTemplates -> 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
"filter" Text -> AssessmentTemplateFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AssessmentTemplateFilter -> Pair)
-> Maybe AssessmentTemplateFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AssessmentTemplateFilter
filter',
            (Text
"maxResults" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults,
            (Text
"assessmentTargetArns" 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]
assessmentTargetArns
          ]
      )

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

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

-- | /See:/ 'newListAssessmentTemplatesResponse' smart constructor.
data ListAssessmentTemplatesResponse = ListAssessmentTemplatesResponse'
  { -- | When a response is generated, if there is more data to be listed, this
    -- parameter is present in the response and contains the value to use for
    -- the __nextToken__ parameter in a subsequent pagination request. If there
    -- is no more data to be listed, this parameter is set to null.
    ListAssessmentTemplatesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAssessmentTemplatesResponse -> Int
httpStatus :: Prelude.Int,
    -- | A list of ARNs that specifies the assessment templates returned by the
    -- action.
    ListAssessmentTemplatesResponse -> [Text]
assessmentTemplateArns :: [Prelude.Text]
  }
  deriving (ListAssessmentTemplatesResponse
-> ListAssessmentTemplatesResponse -> Bool
(ListAssessmentTemplatesResponse
 -> ListAssessmentTemplatesResponse -> Bool)
-> (ListAssessmentTemplatesResponse
    -> ListAssessmentTemplatesResponse -> Bool)
-> Eq ListAssessmentTemplatesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAssessmentTemplatesResponse
-> ListAssessmentTemplatesResponse -> Bool
$c/= :: ListAssessmentTemplatesResponse
-> ListAssessmentTemplatesResponse -> Bool
== :: ListAssessmentTemplatesResponse
-> ListAssessmentTemplatesResponse -> Bool
$c== :: ListAssessmentTemplatesResponse
-> ListAssessmentTemplatesResponse -> Bool
Prelude.Eq, ReadPrec [ListAssessmentTemplatesResponse]
ReadPrec ListAssessmentTemplatesResponse
Int -> ReadS ListAssessmentTemplatesResponse
ReadS [ListAssessmentTemplatesResponse]
(Int -> ReadS ListAssessmentTemplatesResponse)
-> ReadS [ListAssessmentTemplatesResponse]
-> ReadPrec ListAssessmentTemplatesResponse
-> ReadPrec [ListAssessmentTemplatesResponse]
-> Read ListAssessmentTemplatesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAssessmentTemplatesResponse]
$creadListPrec :: ReadPrec [ListAssessmentTemplatesResponse]
readPrec :: ReadPrec ListAssessmentTemplatesResponse
$creadPrec :: ReadPrec ListAssessmentTemplatesResponse
readList :: ReadS [ListAssessmentTemplatesResponse]
$creadList :: ReadS [ListAssessmentTemplatesResponse]
readsPrec :: Int -> ReadS ListAssessmentTemplatesResponse
$creadsPrec :: Int -> ReadS ListAssessmentTemplatesResponse
Prelude.Read, Int -> ListAssessmentTemplatesResponse -> ShowS
[ListAssessmentTemplatesResponse] -> ShowS
ListAssessmentTemplatesResponse -> String
(Int -> ListAssessmentTemplatesResponse -> ShowS)
-> (ListAssessmentTemplatesResponse -> String)
-> ([ListAssessmentTemplatesResponse] -> ShowS)
-> Show ListAssessmentTemplatesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAssessmentTemplatesResponse] -> ShowS
$cshowList :: [ListAssessmentTemplatesResponse] -> ShowS
show :: ListAssessmentTemplatesResponse -> String
$cshow :: ListAssessmentTemplatesResponse -> String
showsPrec :: Int -> ListAssessmentTemplatesResponse -> ShowS
$cshowsPrec :: Int -> ListAssessmentTemplatesResponse -> ShowS
Prelude.Show, (forall x.
 ListAssessmentTemplatesResponse
 -> Rep ListAssessmentTemplatesResponse x)
-> (forall x.
    Rep ListAssessmentTemplatesResponse x
    -> ListAssessmentTemplatesResponse)
-> Generic ListAssessmentTemplatesResponse
forall x.
Rep ListAssessmentTemplatesResponse x
-> ListAssessmentTemplatesResponse
forall x.
ListAssessmentTemplatesResponse
-> Rep ListAssessmentTemplatesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAssessmentTemplatesResponse x
-> ListAssessmentTemplatesResponse
$cfrom :: forall x.
ListAssessmentTemplatesResponse
-> Rep ListAssessmentTemplatesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAssessmentTemplatesResponse' 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', 'listAssessmentTemplatesResponse_nextToken' - When a response is generated, if there is more data to be listed, this
-- parameter is present in the response and contains the value to use for
-- the __nextToken__ parameter in a subsequent pagination request. If there
-- is no more data to be listed, this parameter is set to null.
--
-- 'httpStatus', 'listAssessmentTemplatesResponse_httpStatus' - The response's http status code.
--
-- 'assessmentTemplateArns', 'listAssessmentTemplatesResponse_assessmentTemplateArns' - A list of ARNs that specifies the assessment templates returned by the
-- action.
newListAssessmentTemplatesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAssessmentTemplatesResponse
newListAssessmentTemplatesResponse :: Int -> ListAssessmentTemplatesResponse
newListAssessmentTemplatesResponse Int
pHttpStatus_ =
  ListAssessmentTemplatesResponse' :: Maybe Text -> Int -> [Text] -> ListAssessmentTemplatesResponse
ListAssessmentTemplatesResponse'
    { $sel:nextToken:ListAssessmentTemplatesResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAssessmentTemplatesResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:assessmentTemplateArns:ListAssessmentTemplatesResponse' :: [Text]
assessmentTemplateArns = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | When a response is generated, if there is more data to be listed, this
-- parameter is present in the response and contains the value to use for
-- the __nextToken__ parameter in a subsequent pagination request. If there
-- is no more data to be listed, this parameter is set to null.
listAssessmentTemplatesResponse_nextToken :: Lens.Lens' ListAssessmentTemplatesResponse (Prelude.Maybe Prelude.Text)
listAssessmentTemplatesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAssessmentTemplatesResponse
-> f ListAssessmentTemplatesResponse
listAssessmentTemplatesResponse_nextToken = (ListAssessmentTemplatesResponse -> Maybe Text)
-> (ListAssessmentTemplatesResponse
    -> Maybe Text -> ListAssessmentTemplatesResponse)
-> Lens' ListAssessmentTemplatesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssessmentTemplatesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAssessmentTemplatesResponse' :: ListAssessmentTemplatesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAssessmentTemplatesResponse
s@ListAssessmentTemplatesResponse' {} Maybe Text
a -> ListAssessmentTemplatesResponse
s {$sel:nextToken:ListAssessmentTemplatesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAssessmentTemplatesResponse)

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

-- | A list of ARNs that specifies the assessment templates returned by the
-- action.
listAssessmentTemplatesResponse_assessmentTemplateArns :: Lens.Lens' ListAssessmentTemplatesResponse [Prelude.Text]
listAssessmentTemplatesResponse_assessmentTemplateArns :: ([Text] -> f [Text])
-> ListAssessmentTemplatesResponse
-> f ListAssessmentTemplatesResponse
listAssessmentTemplatesResponse_assessmentTemplateArns = (ListAssessmentTemplatesResponse -> [Text])
-> (ListAssessmentTemplatesResponse
    -> [Text] -> ListAssessmentTemplatesResponse)
-> Lens' ListAssessmentTemplatesResponse [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssessmentTemplatesResponse' {[Text]
assessmentTemplateArns :: [Text]
$sel:assessmentTemplateArns:ListAssessmentTemplatesResponse' :: ListAssessmentTemplatesResponse -> [Text]
assessmentTemplateArns} -> [Text]
assessmentTemplateArns) (\s :: ListAssessmentTemplatesResponse
s@ListAssessmentTemplatesResponse' {} [Text]
a -> ListAssessmentTemplatesResponse
s {$sel:assessmentTemplateArns:ListAssessmentTemplatesResponse' :: [Text]
assessmentTemplateArns = [Text]
a} :: ListAssessmentTemplatesResponse) (([Text] -> f [Text])
 -> ListAssessmentTemplatesResponse
 -> f ListAssessmentTemplatesResponse)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> ListAssessmentTemplatesResponse
-> f ListAssessmentTemplatesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.NFData
    ListAssessmentTemplatesResponse