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

    -- * Request Lenses
    listAssessmentRuns_nextToken,
    listAssessmentRuns_filter,
    listAssessmentRuns_assessmentTemplateArns,
    listAssessmentRuns_maxResults,

    -- * Destructuring the Response
    ListAssessmentRunsResponse (..),
    newListAssessmentRunsResponse,

    -- * Response Lenses
    listAssessmentRunsResponse_nextToken,
    listAssessmentRunsResponse_httpStatus,
    listAssessmentRunsResponse_assessmentRunArns,
  )
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:/ 'newListAssessmentRuns' smart constructor.
data ListAssessmentRuns = ListAssessmentRuns'
  { -- | You can use this parameter when paginating results. Set the value of
    -- this parameter to null on your first call to the __ListAssessmentRuns__
    -- action. Subsequent calls to the action fill __nextToken__ in the request
    -- with the value of __NextToken__ from the previous response to continue
    -- listing data.
    ListAssessmentRuns -> 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.
    ListAssessmentRuns -> Maybe AssessmentRunFilter
filter' :: Prelude.Maybe AssessmentRunFilter,
    -- | The ARNs that specify the assessment templates whose assessment runs you
    -- want to list.
    ListAssessmentRuns -> Maybe [Text]
assessmentTemplateArns :: Prelude.Maybe [Prelude.Text],
    -- | You can use this parameter to indicate the maximum number of items that
    -- you want in the response. The default value is 10. The maximum value is
    -- 500.
    ListAssessmentRuns -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (ListAssessmentRuns -> ListAssessmentRuns -> Bool
(ListAssessmentRuns -> ListAssessmentRuns -> Bool)
-> (ListAssessmentRuns -> ListAssessmentRuns -> Bool)
-> Eq ListAssessmentRuns
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAssessmentRuns -> ListAssessmentRuns -> Bool
$c/= :: ListAssessmentRuns -> ListAssessmentRuns -> Bool
== :: ListAssessmentRuns -> ListAssessmentRuns -> Bool
$c== :: ListAssessmentRuns -> ListAssessmentRuns -> Bool
Prelude.Eq, ReadPrec [ListAssessmentRuns]
ReadPrec ListAssessmentRuns
Int -> ReadS ListAssessmentRuns
ReadS [ListAssessmentRuns]
(Int -> ReadS ListAssessmentRuns)
-> ReadS [ListAssessmentRuns]
-> ReadPrec ListAssessmentRuns
-> ReadPrec [ListAssessmentRuns]
-> Read ListAssessmentRuns
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAssessmentRuns]
$creadListPrec :: ReadPrec [ListAssessmentRuns]
readPrec :: ReadPrec ListAssessmentRuns
$creadPrec :: ReadPrec ListAssessmentRuns
readList :: ReadS [ListAssessmentRuns]
$creadList :: ReadS [ListAssessmentRuns]
readsPrec :: Int -> ReadS ListAssessmentRuns
$creadsPrec :: Int -> ReadS ListAssessmentRuns
Prelude.Read, Int -> ListAssessmentRuns -> ShowS
[ListAssessmentRuns] -> ShowS
ListAssessmentRuns -> String
(Int -> ListAssessmentRuns -> ShowS)
-> (ListAssessmentRuns -> String)
-> ([ListAssessmentRuns] -> ShowS)
-> Show ListAssessmentRuns
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAssessmentRuns] -> ShowS
$cshowList :: [ListAssessmentRuns] -> ShowS
show :: ListAssessmentRuns -> String
$cshow :: ListAssessmentRuns -> String
showsPrec :: Int -> ListAssessmentRuns -> ShowS
$cshowsPrec :: Int -> ListAssessmentRuns -> ShowS
Prelude.Show, (forall x. ListAssessmentRuns -> Rep ListAssessmentRuns x)
-> (forall x. Rep ListAssessmentRuns x -> ListAssessmentRuns)
-> Generic ListAssessmentRuns
forall x. Rep ListAssessmentRuns x -> ListAssessmentRuns
forall x. ListAssessmentRuns -> Rep ListAssessmentRuns x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAssessmentRuns x -> ListAssessmentRuns
$cfrom :: forall x. ListAssessmentRuns -> Rep ListAssessmentRuns x
Prelude.Generic)

-- |
-- Create a value of 'ListAssessmentRuns' 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', 'listAssessmentRuns_nextToken' - You can use this parameter when paginating results. Set the value of
-- this parameter to null on your first call to the __ListAssessmentRuns__
-- 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'', 'listAssessmentRuns_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.
--
-- 'assessmentTemplateArns', 'listAssessmentRuns_assessmentTemplateArns' - The ARNs that specify the assessment templates whose assessment runs you
-- want to list.
--
-- 'maxResults', 'listAssessmentRuns_maxResults' - You can use this parameter to indicate the maximum number of items that
-- you want in the response. The default value is 10. The maximum value is
-- 500.
newListAssessmentRuns ::
  ListAssessmentRuns
newListAssessmentRuns :: ListAssessmentRuns
newListAssessmentRuns =
  ListAssessmentRuns' :: Maybe Text
-> Maybe AssessmentRunFilter
-> Maybe [Text]
-> Maybe Int
-> ListAssessmentRuns
ListAssessmentRuns'
    { $sel:nextToken:ListAssessmentRuns' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':ListAssessmentRuns' :: Maybe AssessmentRunFilter
filter' = Maybe AssessmentRunFilter
forall a. Maybe a
Prelude.Nothing,
      $sel:assessmentTemplateArns:ListAssessmentRuns' :: Maybe [Text]
assessmentTemplateArns = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAssessmentRuns' :: Maybe Int
maxResults = Maybe Int
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 __ListAssessmentRuns__
-- action. Subsequent calls to the action fill __nextToken__ in the request
-- with the value of __NextToken__ from the previous response to continue
-- listing data.
listAssessmentRuns_nextToken :: Lens.Lens' ListAssessmentRuns (Prelude.Maybe Prelude.Text)
listAssessmentRuns_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAssessmentRuns -> f ListAssessmentRuns
listAssessmentRuns_nextToken = (ListAssessmentRuns -> Maybe Text)
-> (ListAssessmentRuns -> Maybe Text -> ListAssessmentRuns)
-> Lens
     ListAssessmentRuns ListAssessmentRuns (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssessmentRuns' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAssessmentRuns' :: ListAssessmentRuns -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAssessmentRuns
s@ListAssessmentRuns' {} Maybe Text
a -> ListAssessmentRuns
s {$sel:nextToken:ListAssessmentRuns' :: Maybe Text
nextToken = Maybe Text
a} :: ListAssessmentRuns)

-- | 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.
listAssessmentRuns_filter :: Lens.Lens' ListAssessmentRuns (Prelude.Maybe AssessmentRunFilter)
listAssessmentRuns_filter :: (Maybe AssessmentRunFilter -> f (Maybe AssessmentRunFilter))
-> ListAssessmentRuns -> f ListAssessmentRuns
listAssessmentRuns_filter = (ListAssessmentRuns -> Maybe AssessmentRunFilter)
-> (ListAssessmentRuns
    -> Maybe AssessmentRunFilter -> ListAssessmentRuns)
-> Lens
     ListAssessmentRuns
     ListAssessmentRuns
     (Maybe AssessmentRunFilter)
     (Maybe AssessmentRunFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssessmentRuns' {Maybe AssessmentRunFilter
filter' :: Maybe AssessmentRunFilter
$sel:filter':ListAssessmentRuns' :: ListAssessmentRuns -> Maybe AssessmentRunFilter
filter'} -> Maybe AssessmentRunFilter
filter') (\s :: ListAssessmentRuns
s@ListAssessmentRuns' {} Maybe AssessmentRunFilter
a -> ListAssessmentRuns
s {$sel:filter':ListAssessmentRuns' :: Maybe AssessmentRunFilter
filter' = Maybe AssessmentRunFilter
a} :: ListAssessmentRuns)

-- | The ARNs that specify the assessment templates whose assessment runs you
-- want to list.
listAssessmentRuns_assessmentTemplateArns :: Lens.Lens' ListAssessmentRuns (Prelude.Maybe [Prelude.Text])
listAssessmentRuns_assessmentTemplateArns :: (Maybe [Text] -> f (Maybe [Text]))
-> ListAssessmentRuns -> f ListAssessmentRuns
listAssessmentRuns_assessmentTemplateArns = (ListAssessmentRuns -> Maybe [Text])
-> (ListAssessmentRuns -> Maybe [Text] -> ListAssessmentRuns)
-> Lens
     ListAssessmentRuns ListAssessmentRuns (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssessmentRuns' {Maybe [Text]
assessmentTemplateArns :: Maybe [Text]
$sel:assessmentTemplateArns:ListAssessmentRuns' :: ListAssessmentRuns -> Maybe [Text]
assessmentTemplateArns} -> Maybe [Text]
assessmentTemplateArns) (\s :: ListAssessmentRuns
s@ListAssessmentRuns' {} Maybe [Text]
a -> ListAssessmentRuns
s {$sel:assessmentTemplateArns:ListAssessmentRuns' :: Maybe [Text]
assessmentTemplateArns = Maybe [Text]
a} :: ListAssessmentRuns) ((Maybe [Text] -> f (Maybe [Text]))
 -> ListAssessmentRuns -> f ListAssessmentRuns)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListAssessmentRuns
-> f ListAssessmentRuns
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

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

instance Core.AWSPager ListAssessmentRuns where
  page :: ListAssessmentRuns
-> AWSResponse ListAssessmentRuns -> Maybe ListAssessmentRuns
page ListAssessmentRuns
rq AWSResponse ListAssessmentRuns
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAssessmentRuns
ListAssessmentRunsResponse
rs
            ListAssessmentRunsResponse
-> Getting (First Text) ListAssessmentRunsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAssessmentRunsResponse
-> Const (First Text) ListAssessmentRunsResponse
Lens' ListAssessmentRunsResponse (Maybe Text)
listAssessmentRunsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListAssessmentRunsResponse
 -> Const (First Text) ListAssessmentRunsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListAssessmentRunsResponse 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 ListAssessmentRuns
forall a. Maybe a
Prelude.Nothing
    | [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAssessmentRuns
ListAssessmentRunsResponse
rs
            ListAssessmentRunsResponse
-> Getting [Text] ListAssessmentRunsResponse [Text] -> [Text]
forall s a. s -> Getting a s a -> a
Lens.^. Getting [Text] ListAssessmentRunsResponse [Text]
Lens' ListAssessmentRunsResponse [Text]
listAssessmentRunsResponse_assessmentRunArns
        ) =
      Maybe ListAssessmentRuns
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListAssessmentRuns -> Maybe ListAssessmentRuns
forall a. a -> Maybe a
Prelude.Just (ListAssessmentRuns -> Maybe ListAssessmentRuns)
-> ListAssessmentRuns -> Maybe ListAssessmentRuns
forall a b. (a -> b) -> a -> b
Prelude.$
        ListAssessmentRuns
rq
          ListAssessmentRuns
-> (ListAssessmentRuns -> ListAssessmentRuns) -> ListAssessmentRuns
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListAssessmentRuns -> Identity ListAssessmentRuns
Lens
  ListAssessmentRuns ListAssessmentRuns (Maybe Text) (Maybe Text)
listAssessmentRuns_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListAssessmentRuns -> Identity ListAssessmentRuns)
-> Maybe Text -> ListAssessmentRuns -> ListAssessmentRuns
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAssessmentRuns
ListAssessmentRunsResponse
rs
          ListAssessmentRunsResponse
-> Getting (First Text) ListAssessmentRunsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAssessmentRunsResponse
-> Const (First Text) ListAssessmentRunsResponse
Lens' ListAssessmentRunsResponse (Maybe Text)
listAssessmentRunsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListAssessmentRunsResponse
 -> Const (First Text) ListAssessmentRunsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListAssessmentRunsResponse 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 ListAssessmentRuns where
  type
    AWSResponse ListAssessmentRuns =
      ListAssessmentRunsResponse
  request :: ListAssessmentRuns -> Request ListAssessmentRuns
request = Service -> ListAssessmentRuns -> Request ListAssessmentRuns
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListAssessmentRuns
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListAssessmentRuns)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListAssessmentRuns))
-> Logger
-> Service
-> Proxy ListAssessmentRuns
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListAssessmentRuns)))
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] -> ListAssessmentRunsResponse
ListAssessmentRunsResponse'
            (Maybe Text -> Int -> [Text] -> ListAssessmentRunsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [Text] -> ListAssessmentRunsResponse)
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] -> ListAssessmentRunsResponse)
-> Either String Int
-> Either String ([Text] -> ListAssessmentRunsResponse)
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] -> ListAssessmentRunsResponse)
-> Either String [Text] -> Either String ListAssessmentRunsResponse
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
"assessmentRunArns"
                            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 ListAssessmentRuns

instance Prelude.NFData ListAssessmentRuns

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

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

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

-- | /See:/ 'newListAssessmentRunsResponse' smart constructor.
data ListAssessmentRunsResponse = ListAssessmentRunsResponse'
  { -- | 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.
    ListAssessmentRunsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAssessmentRunsResponse -> Int
httpStatus :: Prelude.Int,
    -- | A list of ARNs that specifies the assessment runs that are returned by
    -- the action.
    ListAssessmentRunsResponse -> [Text]
assessmentRunArns :: [Prelude.Text]
  }
  deriving (ListAssessmentRunsResponse -> ListAssessmentRunsResponse -> Bool
(ListAssessmentRunsResponse -> ListAssessmentRunsResponse -> Bool)
-> (ListAssessmentRunsResponse
    -> ListAssessmentRunsResponse -> Bool)
-> Eq ListAssessmentRunsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAssessmentRunsResponse -> ListAssessmentRunsResponse -> Bool
$c/= :: ListAssessmentRunsResponse -> ListAssessmentRunsResponse -> Bool
== :: ListAssessmentRunsResponse -> ListAssessmentRunsResponse -> Bool
$c== :: ListAssessmentRunsResponse -> ListAssessmentRunsResponse -> Bool
Prelude.Eq, ReadPrec [ListAssessmentRunsResponse]
ReadPrec ListAssessmentRunsResponse
Int -> ReadS ListAssessmentRunsResponse
ReadS [ListAssessmentRunsResponse]
(Int -> ReadS ListAssessmentRunsResponse)
-> ReadS [ListAssessmentRunsResponse]
-> ReadPrec ListAssessmentRunsResponse
-> ReadPrec [ListAssessmentRunsResponse]
-> Read ListAssessmentRunsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAssessmentRunsResponse]
$creadListPrec :: ReadPrec [ListAssessmentRunsResponse]
readPrec :: ReadPrec ListAssessmentRunsResponse
$creadPrec :: ReadPrec ListAssessmentRunsResponse
readList :: ReadS [ListAssessmentRunsResponse]
$creadList :: ReadS [ListAssessmentRunsResponse]
readsPrec :: Int -> ReadS ListAssessmentRunsResponse
$creadsPrec :: Int -> ReadS ListAssessmentRunsResponse
Prelude.Read, Int -> ListAssessmentRunsResponse -> ShowS
[ListAssessmentRunsResponse] -> ShowS
ListAssessmentRunsResponse -> String
(Int -> ListAssessmentRunsResponse -> ShowS)
-> (ListAssessmentRunsResponse -> String)
-> ([ListAssessmentRunsResponse] -> ShowS)
-> Show ListAssessmentRunsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAssessmentRunsResponse] -> ShowS
$cshowList :: [ListAssessmentRunsResponse] -> ShowS
show :: ListAssessmentRunsResponse -> String
$cshow :: ListAssessmentRunsResponse -> String
showsPrec :: Int -> ListAssessmentRunsResponse -> ShowS
$cshowsPrec :: Int -> ListAssessmentRunsResponse -> ShowS
Prelude.Show, (forall x.
 ListAssessmentRunsResponse -> Rep ListAssessmentRunsResponse x)
-> (forall x.
    Rep ListAssessmentRunsResponse x -> ListAssessmentRunsResponse)
-> Generic ListAssessmentRunsResponse
forall x.
Rep ListAssessmentRunsResponse x -> ListAssessmentRunsResponse
forall x.
ListAssessmentRunsResponse -> Rep ListAssessmentRunsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAssessmentRunsResponse x -> ListAssessmentRunsResponse
$cfrom :: forall x.
ListAssessmentRunsResponse -> Rep ListAssessmentRunsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAssessmentRunsResponse' 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', 'listAssessmentRunsResponse_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', 'listAssessmentRunsResponse_httpStatus' - The response's http status code.
--
-- 'assessmentRunArns', 'listAssessmentRunsResponse_assessmentRunArns' - A list of ARNs that specifies the assessment runs that are returned by
-- the action.
newListAssessmentRunsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAssessmentRunsResponse
newListAssessmentRunsResponse :: Int -> ListAssessmentRunsResponse
newListAssessmentRunsResponse Int
pHttpStatus_ =
  ListAssessmentRunsResponse' :: Maybe Text -> Int -> [Text] -> ListAssessmentRunsResponse
ListAssessmentRunsResponse'
    { $sel:nextToken:ListAssessmentRunsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAssessmentRunsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:assessmentRunArns:ListAssessmentRunsResponse' :: [Text]
assessmentRunArns = [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.
listAssessmentRunsResponse_nextToken :: Lens.Lens' ListAssessmentRunsResponse (Prelude.Maybe Prelude.Text)
listAssessmentRunsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAssessmentRunsResponse -> f ListAssessmentRunsResponse
listAssessmentRunsResponse_nextToken = (ListAssessmentRunsResponse -> Maybe Text)
-> (ListAssessmentRunsResponse
    -> Maybe Text -> ListAssessmentRunsResponse)
-> Lens' ListAssessmentRunsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssessmentRunsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAssessmentRunsResponse' :: ListAssessmentRunsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAssessmentRunsResponse
s@ListAssessmentRunsResponse' {} Maybe Text
a -> ListAssessmentRunsResponse
s {$sel:nextToken:ListAssessmentRunsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAssessmentRunsResponse)

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

-- | A list of ARNs that specifies the assessment runs that are returned by
-- the action.
listAssessmentRunsResponse_assessmentRunArns :: Lens.Lens' ListAssessmentRunsResponse [Prelude.Text]
listAssessmentRunsResponse_assessmentRunArns :: ([Text] -> f [Text])
-> ListAssessmentRunsResponse -> f ListAssessmentRunsResponse
listAssessmentRunsResponse_assessmentRunArns = (ListAssessmentRunsResponse -> [Text])
-> (ListAssessmentRunsResponse
    -> [Text] -> ListAssessmentRunsResponse)
-> Lens' ListAssessmentRunsResponse [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssessmentRunsResponse' {[Text]
assessmentRunArns :: [Text]
$sel:assessmentRunArns:ListAssessmentRunsResponse' :: ListAssessmentRunsResponse -> [Text]
assessmentRunArns} -> [Text]
assessmentRunArns) (\s :: ListAssessmentRunsResponse
s@ListAssessmentRunsResponse' {} [Text]
a -> ListAssessmentRunsResponse
s {$sel:assessmentRunArns:ListAssessmentRunsResponse' :: [Text]
assessmentRunArns = [Text]
a} :: ListAssessmentRunsResponse) (([Text] -> f [Text])
 -> ListAssessmentRunsResponse -> f ListAssessmentRunsResponse)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> ListAssessmentRunsResponse
-> f ListAssessmentRunsResponse
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 ListAssessmentRunsResponse