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

    -- * Request Lenses
    listAssessmentRunAgents_nextToken,
    listAssessmentRunAgents_filter,
    listAssessmentRunAgents_maxResults,
    listAssessmentRunAgents_assessmentRunArn,

    -- * Destructuring the Response
    ListAssessmentRunAgentsResponse (..),
    newListAssessmentRunAgentsResponse,

    -- * Response Lenses
    listAssessmentRunAgentsResponse_nextToken,
    listAssessmentRunAgentsResponse_httpStatus,
    listAssessmentRunAgentsResponse_assessmentRunAgents,
  )
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:/ 'newListAssessmentRunAgents' smart constructor.
data ListAssessmentRunAgents = ListAssessmentRunAgents'
  { -- | You can use this parameter when paginating results. Set the value of
    -- this parameter to null on your first call to the
    -- __ListAssessmentRunAgents__ action. Subsequent calls to the action fill
    -- __nextToken__ in the request with the value of __NextToken__ from the
    -- previous response to continue listing data.
    ListAssessmentRunAgents -> 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.
    ListAssessmentRunAgents -> Maybe AgentFilter
filter' :: Prelude.Maybe AgentFilter,
    -- | 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.
    ListAssessmentRunAgents -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | The ARN that specifies the assessment run whose agents you want to list.
    ListAssessmentRunAgents -> Text
assessmentRunArn :: Prelude.Text
  }
  deriving (ListAssessmentRunAgents -> ListAssessmentRunAgents -> Bool
(ListAssessmentRunAgents -> ListAssessmentRunAgents -> Bool)
-> (ListAssessmentRunAgents -> ListAssessmentRunAgents -> Bool)
-> Eq ListAssessmentRunAgents
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAssessmentRunAgents -> ListAssessmentRunAgents -> Bool
$c/= :: ListAssessmentRunAgents -> ListAssessmentRunAgents -> Bool
== :: ListAssessmentRunAgents -> ListAssessmentRunAgents -> Bool
$c== :: ListAssessmentRunAgents -> ListAssessmentRunAgents -> Bool
Prelude.Eq, ReadPrec [ListAssessmentRunAgents]
ReadPrec ListAssessmentRunAgents
Int -> ReadS ListAssessmentRunAgents
ReadS [ListAssessmentRunAgents]
(Int -> ReadS ListAssessmentRunAgents)
-> ReadS [ListAssessmentRunAgents]
-> ReadPrec ListAssessmentRunAgents
-> ReadPrec [ListAssessmentRunAgents]
-> Read ListAssessmentRunAgents
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAssessmentRunAgents]
$creadListPrec :: ReadPrec [ListAssessmentRunAgents]
readPrec :: ReadPrec ListAssessmentRunAgents
$creadPrec :: ReadPrec ListAssessmentRunAgents
readList :: ReadS [ListAssessmentRunAgents]
$creadList :: ReadS [ListAssessmentRunAgents]
readsPrec :: Int -> ReadS ListAssessmentRunAgents
$creadsPrec :: Int -> ReadS ListAssessmentRunAgents
Prelude.Read, Int -> ListAssessmentRunAgents -> ShowS
[ListAssessmentRunAgents] -> ShowS
ListAssessmentRunAgents -> String
(Int -> ListAssessmentRunAgents -> ShowS)
-> (ListAssessmentRunAgents -> String)
-> ([ListAssessmentRunAgents] -> ShowS)
-> Show ListAssessmentRunAgents
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAssessmentRunAgents] -> ShowS
$cshowList :: [ListAssessmentRunAgents] -> ShowS
show :: ListAssessmentRunAgents -> String
$cshow :: ListAssessmentRunAgents -> String
showsPrec :: Int -> ListAssessmentRunAgents -> ShowS
$cshowsPrec :: Int -> ListAssessmentRunAgents -> ShowS
Prelude.Show, (forall x.
 ListAssessmentRunAgents -> Rep ListAssessmentRunAgents x)
-> (forall x.
    Rep ListAssessmentRunAgents x -> ListAssessmentRunAgents)
-> Generic ListAssessmentRunAgents
forall x. Rep ListAssessmentRunAgents x -> ListAssessmentRunAgents
forall x. ListAssessmentRunAgents -> Rep ListAssessmentRunAgents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAssessmentRunAgents x -> ListAssessmentRunAgents
$cfrom :: forall x. ListAssessmentRunAgents -> Rep ListAssessmentRunAgents x
Prelude.Generic)

-- |
-- Create a value of 'ListAssessmentRunAgents' 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', 'listAssessmentRunAgents_nextToken' - You can use this parameter when paginating results. Set the value of
-- this parameter to null on your first call to the
-- __ListAssessmentRunAgents__ 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'', 'listAssessmentRunAgents_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', 'listAssessmentRunAgents_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.
--
-- 'assessmentRunArn', 'listAssessmentRunAgents_assessmentRunArn' - The ARN that specifies the assessment run whose agents you want to list.
newListAssessmentRunAgents ::
  -- | 'assessmentRunArn'
  Prelude.Text ->
  ListAssessmentRunAgents
newListAssessmentRunAgents :: Text -> ListAssessmentRunAgents
newListAssessmentRunAgents Text
pAssessmentRunArn_ =
  ListAssessmentRunAgents' :: Maybe Text
-> Maybe AgentFilter
-> Maybe Int
-> Text
-> ListAssessmentRunAgents
ListAssessmentRunAgents'
    { $sel:nextToken:ListAssessmentRunAgents' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':ListAssessmentRunAgents' :: Maybe AgentFilter
filter' = Maybe AgentFilter
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAssessmentRunAgents' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:assessmentRunArn:ListAssessmentRunAgents' :: Text
assessmentRunArn = Text
pAssessmentRunArn_
    }

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

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

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

-- | The ARN that specifies the assessment run whose agents you want to list.
listAssessmentRunAgents_assessmentRunArn :: Lens.Lens' ListAssessmentRunAgents Prelude.Text
listAssessmentRunAgents_assessmentRunArn :: (Text -> f Text)
-> ListAssessmentRunAgents -> f ListAssessmentRunAgents
listAssessmentRunAgents_assessmentRunArn = (ListAssessmentRunAgents -> Text)
-> (ListAssessmentRunAgents -> Text -> ListAssessmentRunAgents)
-> Lens ListAssessmentRunAgents ListAssessmentRunAgents Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssessmentRunAgents' {Text
assessmentRunArn :: Text
$sel:assessmentRunArn:ListAssessmentRunAgents' :: ListAssessmentRunAgents -> Text
assessmentRunArn} -> Text
assessmentRunArn) (\s :: ListAssessmentRunAgents
s@ListAssessmentRunAgents' {} Text
a -> ListAssessmentRunAgents
s {$sel:assessmentRunArn:ListAssessmentRunAgents' :: Text
assessmentRunArn = Text
a} :: ListAssessmentRunAgents)

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

instance Prelude.Hashable ListAssessmentRunAgents

instance Prelude.NFData ListAssessmentRunAgents

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

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

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

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

-- |
-- Create a value of 'ListAssessmentRunAgentsResponse' 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', 'listAssessmentRunAgentsResponse_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', 'listAssessmentRunAgentsResponse_httpStatus' - The response's http status code.
--
-- 'assessmentRunAgents', 'listAssessmentRunAgentsResponse_assessmentRunAgents' - A list of ARNs that specifies the agents returned by the action.
newListAssessmentRunAgentsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAssessmentRunAgentsResponse
newListAssessmentRunAgentsResponse :: Int -> ListAssessmentRunAgentsResponse
newListAssessmentRunAgentsResponse Int
pHttpStatus_ =
  ListAssessmentRunAgentsResponse' :: Maybe Text
-> Int -> [AssessmentRunAgent] -> ListAssessmentRunAgentsResponse
ListAssessmentRunAgentsResponse'
    { $sel:nextToken:ListAssessmentRunAgentsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAssessmentRunAgentsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:assessmentRunAgents:ListAssessmentRunAgentsResponse' :: [AssessmentRunAgent]
assessmentRunAgents = [AssessmentRunAgent]
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.
listAssessmentRunAgentsResponse_nextToken :: Lens.Lens' ListAssessmentRunAgentsResponse (Prelude.Maybe Prelude.Text)
listAssessmentRunAgentsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAssessmentRunAgentsResponse
-> f ListAssessmentRunAgentsResponse
listAssessmentRunAgentsResponse_nextToken = (ListAssessmentRunAgentsResponse -> Maybe Text)
-> (ListAssessmentRunAgentsResponse
    -> Maybe Text -> ListAssessmentRunAgentsResponse)
-> Lens' ListAssessmentRunAgentsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssessmentRunAgentsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAssessmentRunAgentsResponse' :: ListAssessmentRunAgentsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAssessmentRunAgentsResponse
s@ListAssessmentRunAgentsResponse' {} Maybe Text
a -> ListAssessmentRunAgentsResponse
s {$sel:nextToken:ListAssessmentRunAgentsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAssessmentRunAgentsResponse)

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

-- | A list of ARNs that specifies the agents returned by the action.
listAssessmentRunAgentsResponse_assessmentRunAgents :: Lens.Lens' ListAssessmentRunAgentsResponse [AssessmentRunAgent]
listAssessmentRunAgentsResponse_assessmentRunAgents :: ([AssessmentRunAgent] -> f [AssessmentRunAgent])
-> ListAssessmentRunAgentsResponse
-> f ListAssessmentRunAgentsResponse
listAssessmentRunAgentsResponse_assessmentRunAgents = (ListAssessmentRunAgentsResponse -> [AssessmentRunAgent])
-> (ListAssessmentRunAgentsResponse
    -> [AssessmentRunAgent] -> ListAssessmentRunAgentsResponse)
-> Lens' ListAssessmentRunAgentsResponse [AssessmentRunAgent]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssessmentRunAgentsResponse' {[AssessmentRunAgent]
assessmentRunAgents :: [AssessmentRunAgent]
$sel:assessmentRunAgents:ListAssessmentRunAgentsResponse' :: ListAssessmentRunAgentsResponse -> [AssessmentRunAgent]
assessmentRunAgents} -> [AssessmentRunAgent]
assessmentRunAgents) (\s :: ListAssessmentRunAgentsResponse
s@ListAssessmentRunAgentsResponse' {} [AssessmentRunAgent]
a -> ListAssessmentRunAgentsResponse
s {$sel:assessmentRunAgents:ListAssessmentRunAgentsResponse' :: [AssessmentRunAgent]
assessmentRunAgents = [AssessmentRunAgent]
a} :: ListAssessmentRunAgentsResponse) (([AssessmentRunAgent] -> f [AssessmentRunAgent])
 -> ListAssessmentRunAgentsResponse
 -> f ListAssessmentRunAgentsResponse)
-> (([AssessmentRunAgent] -> f [AssessmentRunAgent])
    -> [AssessmentRunAgent] -> f [AssessmentRunAgent])
-> ([AssessmentRunAgent] -> f [AssessmentRunAgent])
-> ListAssessmentRunAgentsResponse
-> f ListAssessmentRunAgentsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AssessmentRunAgent] -> f [AssessmentRunAgent])
-> [AssessmentRunAgent] -> f [AssessmentRunAgent]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.NFData
    ListAssessmentRunAgentsResponse