{-# 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.Discovery.DescribeAgents
-- 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 agents or connectors as specified by ID or other filters. All
-- agents\/connectors associated with your user account can be listed if
-- you call @DescribeAgents@ as is without passing any parameters.
--
-- This operation returns paginated results.
module Amazonka.Discovery.DescribeAgents
  ( -- * Creating a Request
    DescribeAgents (..),
    newDescribeAgents,

    -- * Request Lenses
    describeAgents_agentIds,
    describeAgents_filters,
    describeAgents_nextToken,
    describeAgents_maxResults,

    -- * Destructuring the Response
    DescribeAgentsResponse (..),
    newDescribeAgentsResponse,

    -- * Response Lenses
    describeAgentsResponse_agentsInfo,
    describeAgentsResponse_nextToken,
    describeAgentsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Discovery.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:/ 'newDescribeAgents' smart constructor.
data DescribeAgents = DescribeAgents'
  { -- | The agent or the Connector IDs for which you want information. If you
    -- specify no IDs, the system returns information about all
    -- agents\/Connectors associated with your AWS user account.
    DescribeAgents -> Maybe [Text]
agentIds :: Prelude.Maybe [Prelude.Text],
    -- | You can filter the request using various logical operators and a
    -- /key/-/value/ format. For example:
    --
    -- @{\"key\": \"collectionStatus\", \"value\": \"STARTED\"}@
    DescribeAgents -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | Token to retrieve the next set of results. For example, if you
    -- previously specified 100 IDs for @DescribeAgentsRequest$agentIds@ but
    -- set @DescribeAgentsRequest$maxResults@ to 10, you received a set of 10
    -- results along with a token. Use that token in this query to get the next
    -- set of 10.
    DescribeAgents -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The total number of agents\/Connectors to return in a single page of
    -- output. The maximum value is 100.
    DescribeAgents -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeAgents -> DescribeAgents -> Bool
(DescribeAgents -> DescribeAgents -> Bool)
-> (DescribeAgents -> DescribeAgents -> Bool) -> Eq DescribeAgents
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAgents -> DescribeAgents -> Bool
$c/= :: DescribeAgents -> DescribeAgents -> Bool
== :: DescribeAgents -> DescribeAgents -> Bool
$c== :: DescribeAgents -> DescribeAgents -> Bool
Prelude.Eq, ReadPrec [DescribeAgents]
ReadPrec DescribeAgents
Int -> ReadS DescribeAgents
ReadS [DescribeAgents]
(Int -> ReadS DescribeAgents)
-> ReadS [DescribeAgents]
-> ReadPrec DescribeAgents
-> ReadPrec [DescribeAgents]
-> Read DescribeAgents
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAgents]
$creadListPrec :: ReadPrec [DescribeAgents]
readPrec :: ReadPrec DescribeAgents
$creadPrec :: ReadPrec DescribeAgents
readList :: ReadS [DescribeAgents]
$creadList :: ReadS [DescribeAgents]
readsPrec :: Int -> ReadS DescribeAgents
$creadsPrec :: Int -> ReadS DescribeAgents
Prelude.Read, Int -> DescribeAgents -> ShowS
[DescribeAgents] -> ShowS
DescribeAgents -> String
(Int -> DescribeAgents -> ShowS)
-> (DescribeAgents -> String)
-> ([DescribeAgents] -> ShowS)
-> Show DescribeAgents
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAgents] -> ShowS
$cshowList :: [DescribeAgents] -> ShowS
show :: DescribeAgents -> String
$cshow :: DescribeAgents -> String
showsPrec :: Int -> DescribeAgents -> ShowS
$cshowsPrec :: Int -> DescribeAgents -> ShowS
Prelude.Show, (forall x. DescribeAgents -> Rep DescribeAgents x)
-> (forall x. Rep DescribeAgents x -> DescribeAgents)
-> Generic DescribeAgents
forall x. Rep DescribeAgents x -> DescribeAgents
forall x. DescribeAgents -> Rep DescribeAgents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAgents x -> DescribeAgents
$cfrom :: forall x. DescribeAgents -> Rep DescribeAgents x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAgents' 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:
--
-- 'agentIds', 'describeAgents_agentIds' - The agent or the Connector IDs for which you want information. If you
-- specify no IDs, the system returns information about all
-- agents\/Connectors associated with your AWS user account.
--
-- 'filters', 'describeAgents_filters' - You can filter the request using various logical operators and a
-- /key/-/value/ format. For example:
--
-- @{\"key\": \"collectionStatus\", \"value\": \"STARTED\"}@
--
-- 'nextToken', 'describeAgents_nextToken' - Token to retrieve the next set of results. For example, if you
-- previously specified 100 IDs for @DescribeAgentsRequest$agentIds@ but
-- set @DescribeAgentsRequest$maxResults@ to 10, you received a set of 10
-- results along with a token. Use that token in this query to get the next
-- set of 10.
--
-- 'maxResults', 'describeAgents_maxResults' - The total number of agents\/Connectors to return in a single page of
-- output. The maximum value is 100.
newDescribeAgents ::
  DescribeAgents
newDescribeAgents :: DescribeAgents
newDescribeAgents =
  DescribeAgents' :: Maybe [Text]
-> Maybe [Filter] -> Maybe Text -> Maybe Int -> DescribeAgents
DescribeAgents'
    { $sel:agentIds:DescribeAgents' :: Maybe [Text]
agentIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:filters:DescribeAgents' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeAgents' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeAgents' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The agent or the Connector IDs for which you want information. If you
-- specify no IDs, the system returns information about all
-- agents\/Connectors associated with your AWS user account.
describeAgents_agentIds :: Lens.Lens' DescribeAgents (Prelude.Maybe [Prelude.Text])
describeAgents_agentIds :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeAgents -> f DescribeAgents
describeAgents_agentIds = (DescribeAgents -> Maybe [Text])
-> (DescribeAgents -> Maybe [Text] -> DescribeAgents)
-> Lens DescribeAgents DescribeAgents (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAgents' {Maybe [Text]
agentIds :: Maybe [Text]
$sel:agentIds:DescribeAgents' :: DescribeAgents -> Maybe [Text]
agentIds} -> Maybe [Text]
agentIds) (\s :: DescribeAgents
s@DescribeAgents' {} Maybe [Text]
a -> DescribeAgents
s {$sel:agentIds:DescribeAgents' :: Maybe [Text]
agentIds = Maybe [Text]
a} :: DescribeAgents) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeAgents -> f DescribeAgents)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeAgents
-> f DescribeAgents
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 filter the request using various logical operators and a
-- /key/-/value/ format. For example:
--
-- @{\"key\": \"collectionStatus\", \"value\": \"STARTED\"}@
describeAgents_filters :: Lens.Lens' DescribeAgents (Prelude.Maybe [Filter])
describeAgents_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeAgents -> f DescribeAgents
describeAgents_filters = (DescribeAgents -> Maybe [Filter])
-> (DescribeAgents -> Maybe [Filter] -> DescribeAgents)
-> Lens
     DescribeAgents DescribeAgents (Maybe [Filter]) (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAgents' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeAgents' :: DescribeAgents -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeAgents
s@DescribeAgents' {} Maybe [Filter]
a -> DescribeAgents
s {$sel:filters:DescribeAgents' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeAgents) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> DescribeAgents -> f DescribeAgents)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeAgents
-> f DescribeAgents
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
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 [Filter] [Filter] [Filter] [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Token to retrieve the next set of results. For example, if you
-- previously specified 100 IDs for @DescribeAgentsRequest$agentIds@ but
-- set @DescribeAgentsRequest$maxResults@ to 10, you received a set of 10
-- results along with a token. Use that token in this query to get the next
-- set of 10.
describeAgents_nextToken :: Lens.Lens' DescribeAgents (Prelude.Maybe Prelude.Text)
describeAgents_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeAgents -> f DescribeAgents
describeAgents_nextToken = (DescribeAgents -> Maybe Text)
-> (DescribeAgents -> Maybe Text -> DescribeAgents)
-> Lens DescribeAgents DescribeAgents (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAgents' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeAgents' :: DescribeAgents -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeAgents
s@DescribeAgents' {} Maybe Text
a -> DescribeAgents
s {$sel:nextToken:DescribeAgents' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeAgents)

-- | The total number of agents\/Connectors to return in a single page of
-- output. The maximum value is 100.
describeAgents_maxResults :: Lens.Lens' DescribeAgents (Prelude.Maybe Prelude.Int)
describeAgents_maxResults :: (Maybe Int -> f (Maybe Int)) -> DescribeAgents -> f DescribeAgents
describeAgents_maxResults = (DescribeAgents -> Maybe Int)
-> (DescribeAgents -> Maybe Int -> DescribeAgents)
-> Lens DescribeAgents DescribeAgents (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAgents' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:DescribeAgents' :: DescribeAgents -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: DescribeAgents
s@DescribeAgents' {} Maybe Int
a -> DescribeAgents
s {$sel:maxResults:DescribeAgents' :: Maybe Int
maxResults = Maybe Int
a} :: DescribeAgents)

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

instance Prelude.Hashable DescribeAgents

instance Prelude.NFData DescribeAgents

instance Core.ToHeaders DescribeAgents where
  toHeaders :: DescribeAgents -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeAgents -> 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
"AWSPoseidonService_V2015_11_01.DescribeAgents" ::
                          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 DescribeAgents where
  toJSON :: DescribeAgents -> Value
toJSON DescribeAgents' {Maybe Int
Maybe [Text]
Maybe [Filter]
Maybe Text
maxResults :: Maybe Int
nextToken :: Maybe Text
filters :: Maybe [Filter]
agentIds :: Maybe [Text]
$sel:maxResults:DescribeAgents' :: DescribeAgents -> Maybe Int
$sel:nextToken:DescribeAgents' :: DescribeAgents -> Maybe Text
$sel:filters:DescribeAgents' :: DescribeAgents -> Maybe [Filter]
$sel:agentIds:DescribeAgents' :: DescribeAgents -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"agentIds" 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]
agentIds,
            (Text
"filters" Text -> [Filter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Filter] -> Pair) -> Maybe [Filter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters,
            (Text
"nextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"maxResults" Text -> 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 DescribeAgents where
  toPath :: DescribeAgents -> ByteString
toPath = ByteString -> DescribeAgents -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newDescribeAgentsResponse' smart constructor.
data DescribeAgentsResponse = DescribeAgentsResponse'
  { -- | Lists agents or the Connector by ID or lists all agents\/Connectors
    -- associated with your user account if you did not specify an
    -- agent\/Connector ID. The output includes agent\/Connector IDs, IP
    -- addresses, media access control (MAC) addresses, agent\/Connector
    -- health, host name where the agent\/Connector resides, and the version
    -- number of each agent\/Connector.
    DescribeAgentsResponse -> Maybe [AgentInfo]
agentsInfo :: Prelude.Maybe [AgentInfo],
    -- | Token to retrieve the next set of results. For example, if you specified
    -- 100 IDs for @DescribeAgentsRequest$agentIds@ but set
    -- @DescribeAgentsRequest$maxResults@ to 10, you received a set of 10
    -- results along with this token. Use this token in the next query to
    -- retrieve the next set of 10.
    DescribeAgentsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeAgentsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeAgentsResponse -> DescribeAgentsResponse -> Bool
(DescribeAgentsResponse -> DescribeAgentsResponse -> Bool)
-> (DescribeAgentsResponse -> DescribeAgentsResponse -> Bool)
-> Eq DescribeAgentsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAgentsResponse -> DescribeAgentsResponse -> Bool
$c/= :: DescribeAgentsResponse -> DescribeAgentsResponse -> Bool
== :: DescribeAgentsResponse -> DescribeAgentsResponse -> Bool
$c== :: DescribeAgentsResponse -> DescribeAgentsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAgentsResponse]
ReadPrec DescribeAgentsResponse
Int -> ReadS DescribeAgentsResponse
ReadS [DescribeAgentsResponse]
(Int -> ReadS DescribeAgentsResponse)
-> ReadS [DescribeAgentsResponse]
-> ReadPrec DescribeAgentsResponse
-> ReadPrec [DescribeAgentsResponse]
-> Read DescribeAgentsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAgentsResponse]
$creadListPrec :: ReadPrec [DescribeAgentsResponse]
readPrec :: ReadPrec DescribeAgentsResponse
$creadPrec :: ReadPrec DescribeAgentsResponse
readList :: ReadS [DescribeAgentsResponse]
$creadList :: ReadS [DescribeAgentsResponse]
readsPrec :: Int -> ReadS DescribeAgentsResponse
$creadsPrec :: Int -> ReadS DescribeAgentsResponse
Prelude.Read, Int -> DescribeAgentsResponse -> ShowS
[DescribeAgentsResponse] -> ShowS
DescribeAgentsResponse -> String
(Int -> DescribeAgentsResponse -> ShowS)
-> (DescribeAgentsResponse -> String)
-> ([DescribeAgentsResponse] -> ShowS)
-> Show DescribeAgentsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAgentsResponse] -> ShowS
$cshowList :: [DescribeAgentsResponse] -> ShowS
show :: DescribeAgentsResponse -> String
$cshow :: DescribeAgentsResponse -> String
showsPrec :: Int -> DescribeAgentsResponse -> ShowS
$cshowsPrec :: Int -> DescribeAgentsResponse -> ShowS
Prelude.Show, (forall x. DescribeAgentsResponse -> Rep DescribeAgentsResponse x)
-> (forall x.
    Rep DescribeAgentsResponse x -> DescribeAgentsResponse)
-> Generic DescribeAgentsResponse
forall x. Rep DescribeAgentsResponse x -> DescribeAgentsResponse
forall x. DescribeAgentsResponse -> Rep DescribeAgentsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAgentsResponse x -> DescribeAgentsResponse
$cfrom :: forall x. DescribeAgentsResponse -> Rep DescribeAgentsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAgentsResponse' 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:
--
-- 'agentsInfo', 'describeAgentsResponse_agentsInfo' - Lists agents or the Connector by ID or lists all agents\/Connectors
-- associated with your user account if you did not specify an
-- agent\/Connector ID. The output includes agent\/Connector IDs, IP
-- addresses, media access control (MAC) addresses, agent\/Connector
-- health, host name where the agent\/Connector resides, and the version
-- number of each agent\/Connector.
--
-- 'nextToken', 'describeAgentsResponse_nextToken' - Token to retrieve the next set of results. For example, if you specified
-- 100 IDs for @DescribeAgentsRequest$agentIds@ but set
-- @DescribeAgentsRequest$maxResults@ to 10, you received a set of 10
-- results along with this token. Use this token in the next query to
-- retrieve the next set of 10.
--
-- 'httpStatus', 'describeAgentsResponse_httpStatus' - The response's http status code.
newDescribeAgentsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAgentsResponse
newDescribeAgentsResponse :: Int -> DescribeAgentsResponse
newDescribeAgentsResponse Int
pHttpStatus_ =
  DescribeAgentsResponse' :: Maybe [AgentInfo] -> Maybe Text -> Int -> DescribeAgentsResponse
DescribeAgentsResponse'
    { $sel:agentsInfo:DescribeAgentsResponse' :: Maybe [AgentInfo]
agentsInfo =
        Maybe [AgentInfo]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeAgentsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeAgentsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Lists agents or the Connector by ID or lists all agents\/Connectors
-- associated with your user account if you did not specify an
-- agent\/Connector ID. The output includes agent\/Connector IDs, IP
-- addresses, media access control (MAC) addresses, agent\/Connector
-- health, host name where the agent\/Connector resides, and the version
-- number of each agent\/Connector.
describeAgentsResponse_agentsInfo :: Lens.Lens' DescribeAgentsResponse (Prelude.Maybe [AgentInfo])
describeAgentsResponse_agentsInfo :: (Maybe [AgentInfo] -> f (Maybe [AgentInfo]))
-> DescribeAgentsResponse -> f DescribeAgentsResponse
describeAgentsResponse_agentsInfo = (DescribeAgentsResponse -> Maybe [AgentInfo])
-> (DescribeAgentsResponse
    -> Maybe [AgentInfo] -> DescribeAgentsResponse)
-> Lens' DescribeAgentsResponse (Maybe [AgentInfo])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAgentsResponse' {Maybe [AgentInfo]
agentsInfo :: Maybe [AgentInfo]
$sel:agentsInfo:DescribeAgentsResponse' :: DescribeAgentsResponse -> Maybe [AgentInfo]
agentsInfo} -> Maybe [AgentInfo]
agentsInfo) (\s :: DescribeAgentsResponse
s@DescribeAgentsResponse' {} Maybe [AgentInfo]
a -> DescribeAgentsResponse
s {$sel:agentsInfo:DescribeAgentsResponse' :: Maybe [AgentInfo]
agentsInfo = Maybe [AgentInfo]
a} :: DescribeAgentsResponse) ((Maybe [AgentInfo] -> f (Maybe [AgentInfo]))
 -> DescribeAgentsResponse -> f DescribeAgentsResponse)
-> ((Maybe [AgentInfo] -> f (Maybe [AgentInfo]))
    -> Maybe [AgentInfo] -> f (Maybe [AgentInfo]))
-> (Maybe [AgentInfo] -> f (Maybe [AgentInfo]))
-> DescribeAgentsResponse
-> f DescribeAgentsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [AgentInfo] [AgentInfo] [AgentInfo] [AgentInfo]
-> Iso
     (Maybe [AgentInfo])
     (Maybe [AgentInfo])
     (Maybe [AgentInfo])
     (Maybe [AgentInfo])
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 [AgentInfo] [AgentInfo] [AgentInfo] [AgentInfo]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Token to retrieve the next set of results. For example, if you specified
-- 100 IDs for @DescribeAgentsRequest$agentIds@ but set
-- @DescribeAgentsRequest$maxResults@ to 10, you received a set of 10
-- results along with this token. Use this token in the next query to
-- retrieve the next set of 10.
describeAgentsResponse_nextToken :: Lens.Lens' DescribeAgentsResponse (Prelude.Maybe Prelude.Text)
describeAgentsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeAgentsResponse -> f DescribeAgentsResponse
describeAgentsResponse_nextToken = (DescribeAgentsResponse -> Maybe Text)
-> (DescribeAgentsResponse -> Maybe Text -> DescribeAgentsResponse)
-> Lens' DescribeAgentsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAgentsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeAgentsResponse' :: DescribeAgentsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeAgentsResponse
s@DescribeAgentsResponse' {} Maybe Text
a -> DescribeAgentsResponse
s {$sel:nextToken:DescribeAgentsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeAgentsResponse)

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

instance Prelude.NFData DescribeAgentsResponse