{-# 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.DataPipeline.QueryObjects
-- 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)
--
-- Queries the specified pipeline for the names of objects that match the
-- specified set of conditions.
--
-- This operation returns paginated results.
module Amazonka.DataPipeline.QueryObjects
  ( -- * Creating a Request
    QueryObjects (..),
    newQueryObjects,

    -- * Request Lenses
    queryObjects_query,
    queryObjects_marker,
    queryObjects_limit,
    queryObjects_pipelineId,
    queryObjects_sphere,

    -- * Destructuring the Response
    QueryObjectsResponse (..),
    newQueryObjectsResponse,

    -- * Response Lenses
    queryObjectsResponse_hasMoreResults,
    queryObjectsResponse_ids,
    queryObjectsResponse_marker,
    queryObjectsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DataPipeline.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

-- | Contains the parameters for QueryObjects.
--
-- /See:/ 'newQueryObjects' smart constructor.
data QueryObjects = QueryObjects'
  { -- | The query that defines the objects to be returned. The @Query@ object
    -- can contain a maximum of ten selectors. The conditions in the query are
    -- limited to top-level String fields in the object. These filters can be
    -- applied to components, instances, and attempts.
    QueryObjects -> Maybe Query
query :: Prelude.Maybe Query,
    -- | The starting point for the results to be returned. For the first call,
    -- this value should be empty. As long as there are more results, continue
    -- to call @QueryObjects@ with the marker value from the previous call to
    -- retrieve the next set of results.
    QueryObjects -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of object names that @QueryObjects@ will return in a
    -- single call. The default value is 100.
    QueryObjects -> Maybe Int
limit :: Prelude.Maybe Prelude.Int,
    -- | The ID of the pipeline.
    QueryObjects -> Text
pipelineId :: Prelude.Text,
    -- | Indicates whether the query applies to components or instances. The
    -- possible values are: @COMPONENT@, @INSTANCE@, and @ATTEMPT@.
    QueryObjects -> Text
sphere :: Prelude.Text
  }
  deriving (QueryObjects -> QueryObjects -> Bool
(QueryObjects -> QueryObjects -> Bool)
-> (QueryObjects -> QueryObjects -> Bool) -> Eq QueryObjects
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueryObjects -> QueryObjects -> Bool
$c/= :: QueryObjects -> QueryObjects -> Bool
== :: QueryObjects -> QueryObjects -> Bool
$c== :: QueryObjects -> QueryObjects -> Bool
Prelude.Eq, ReadPrec [QueryObjects]
ReadPrec QueryObjects
Int -> ReadS QueryObjects
ReadS [QueryObjects]
(Int -> ReadS QueryObjects)
-> ReadS [QueryObjects]
-> ReadPrec QueryObjects
-> ReadPrec [QueryObjects]
-> Read QueryObjects
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QueryObjects]
$creadListPrec :: ReadPrec [QueryObjects]
readPrec :: ReadPrec QueryObjects
$creadPrec :: ReadPrec QueryObjects
readList :: ReadS [QueryObjects]
$creadList :: ReadS [QueryObjects]
readsPrec :: Int -> ReadS QueryObjects
$creadsPrec :: Int -> ReadS QueryObjects
Prelude.Read, Int -> QueryObjects -> ShowS
[QueryObjects] -> ShowS
QueryObjects -> String
(Int -> QueryObjects -> ShowS)
-> (QueryObjects -> String)
-> ([QueryObjects] -> ShowS)
-> Show QueryObjects
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueryObjects] -> ShowS
$cshowList :: [QueryObjects] -> ShowS
show :: QueryObjects -> String
$cshow :: QueryObjects -> String
showsPrec :: Int -> QueryObjects -> ShowS
$cshowsPrec :: Int -> QueryObjects -> ShowS
Prelude.Show, (forall x. QueryObjects -> Rep QueryObjects x)
-> (forall x. Rep QueryObjects x -> QueryObjects)
-> Generic QueryObjects
forall x. Rep QueryObjects x -> QueryObjects
forall x. QueryObjects -> Rep QueryObjects x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QueryObjects x -> QueryObjects
$cfrom :: forall x. QueryObjects -> Rep QueryObjects x
Prelude.Generic)

-- |
-- Create a value of 'QueryObjects' 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:
--
-- 'query', 'queryObjects_query' - The query that defines the objects to be returned. The @Query@ object
-- can contain a maximum of ten selectors. The conditions in the query are
-- limited to top-level String fields in the object. These filters can be
-- applied to components, instances, and attempts.
--
-- 'marker', 'queryObjects_marker' - The starting point for the results to be returned. For the first call,
-- this value should be empty. As long as there are more results, continue
-- to call @QueryObjects@ with the marker value from the previous call to
-- retrieve the next set of results.
--
-- 'limit', 'queryObjects_limit' - The maximum number of object names that @QueryObjects@ will return in a
-- single call. The default value is 100.
--
-- 'pipelineId', 'queryObjects_pipelineId' - The ID of the pipeline.
--
-- 'sphere', 'queryObjects_sphere' - Indicates whether the query applies to components or instances. The
-- possible values are: @COMPONENT@, @INSTANCE@, and @ATTEMPT@.
newQueryObjects ::
  -- | 'pipelineId'
  Prelude.Text ->
  -- | 'sphere'
  Prelude.Text ->
  QueryObjects
newQueryObjects :: Text -> Text -> QueryObjects
newQueryObjects Text
pPipelineId_ Text
pSphere_ =
  QueryObjects' :: Maybe Query
-> Maybe Text -> Maybe Int -> Text -> Text -> QueryObjects
QueryObjects'
    { $sel:query:QueryObjects' :: Maybe Query
query = Maybe Query
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:QueryObjects' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:QueryObjects' :: Maybe Int
limit = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:pipelineId:QueryObjects' :: Text
pipelineId = Text
pPipelineId_,
      $sel:sphere:QueryObjects' :: Text
sphere = Text
pSphere_
    }

-- | The query that defines the objects to be returned. The @Query@ object
-- can contain a maximum of ten selectors. The conditions in the query are
-- limited to top-level String fields in the object. These filters can be
-- applied to components, instances, and attempts.
queryObjects_query :: Lens.Lens' QueryObjects (Prelude.Maybe Query)
queryObjects_query :: (Maybe Query -> f (Maybe Query)) -> QueryObjects -> f QueryObjects
queryObjects_query = (QueryObjects -> Maybe Query)
-> (QueryObjects -> Maybe Query -> QueryObjects)
-> Lens QueryObjects QueryObjects (Maybe Query) (Maybe Query)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryObjects' {Maybe Query
query :: Maybe Query
$sel:query:QueryObjects' :: QueryObjects -> Maybe Query
query} -> Maybe Query
query) (\s :: QueryObjects
s@QueryObjects' {} Maybe Query
a -> QueryObjects
s {$sel:query:QueryObjects' :: Maybe Query
query = Maybe Query
a} :: QueryObjects)

-- | The starting point for the results to be returned. For the first call,
-- this value should be empty. As long as there are more results, continue
-- to call @QueryObjects@ with the marker value from the previous call to
-- retrieve the next set of results.
queryObjects_marker :: Lens.Lens' QueryObjects (Prelude.Maybe Prelude.Text)
queryObjects_marker :: (Maybe Text -> f (Maybe Text)) -> QueryObjects -> f QueryObjects
queryObjects_marker = (QueryObjects -> Maybe Text)
-> (QueryObjects -> Maybe Text -> QueryObjects)
-> Lens QueryObjects QueryObjects (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryObjects' {Maybe Text
marker :: Maybe Text
$sel:marker:QueryObjects' :: QueryObjects -> Maybe Text
marker} -> Maybe Text
marker) (\s :: QueryObjects
s@QueryObjects' {} Maybe Text
a -> QueryObjects
s {$sel:marker:QueryObjects' :: Maybe Text
marker = Maybe Text
a} :: QueryObjects)

-- | The maximum number of object names that @QueryObjects@ will return in a
-- single call. The default value is 100.
queryObjects_limit :: Lens.Lens' QueryObjects (Prelude.Maybe Prelude.Int)
queryObjects_limit :: (Maybe Int -> f (Maybe Int)) -> QueryObjects -> f QueryObjects
queryObjects_limit = (QueryObjects -> Maybe Int)
-> (QueryObjects -> Maybe Int -> QueryObjects)
-> Lens QueryObjects QueryObjects (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryObjects' {Maybe Int
limit :: Maybe Int
$sel:limit:QueryObjects' :: QueryObjects -> Maybe Int
limit} -> Maybe Int
limit) (\s :: QueryObjects
s@QueryObjects' {} Maybe Int
a -> QueryObjects
s {$sel:limit:QueryObjects' :: Maybe Int
limit = Maybe Int
a} :: QueryObjects)

-- | The ID of the pipeline.
queryObjects_pipelineId :: Lens.Lens' QueryObjects Prelude.Text
queryObjects_pipelineId :: (Text -> f Text) -> QueryObjects -> f QueryObjects
queryObjects_pipelineId = (QueryObjects -> Text)
-> (QueryObjects -> Text -> QueryObjects)
-> Lens QueryObjects QueryObjects Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryObjects' {Text
pipelineId :: Text
$sel:pipelineId:QueryObjects' :: QueryObjects -> Text
pipelineId} -> Text
pipelineId) (\s :: QueryObjects
s@QueryObjects' {} Text
a -> QueryObjects
s {$sel:pipelineId:QueryObjects' :: Text
pipelineId = Text
a} :: QueryObjects)

-- | Indicates whether the query applies to components or instances. The
-- possible values are: @COMPONENT@, @INSTANCE@, and @ATTEMPT@.
queryObjects_sphere :: Lens.Lens' QueryObjects Prelude.Text
queryObjects_sphere :: (Text -> f Text) -> QueryObjects -> f QueryObjects
queryObjects_sphere = (QueryObjects -> Text)
-> (QueryObjects -> Text -> QueryObjects)
-> Lens QueryObjects QueryObjects Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryObjects' {Text
sphere :: Text
$sel:sphere:QueryObjects' :: QueryObjects -> Text
sphere} -> Text
sphere) (\s :: QueryObjects
s@QueryObjects' {} Text
a -> QueryObjects
s {$sel:sphere:QueryObjects' :: Text
sphere = Text
a} :: QueryObjects)

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

instance Prelude.NFData QueryObjects

instance Core.ToHeaders QueryObjects where
  toHeaders :: QueryObjects -> ResponseHeaders
toHeaders =
    ResponseHeaders -> QueryObjects -> 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
"DataPipeline.QueryObjects" :: 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 QueryObjects where
  toJSON :: QueryObjects -> Value
toJSON QueryObjects' {Maybe Int
Maybe Text
Maybe Query
Text
sphere :: Text
pipelineId :: Text
limit :: Maybe Int
marker :: Maybe Text
query :: Maybe Query
$sel:sphere:QueryObjects' :: QueryObjects -> Text
$sel:pipelineId:QueryObjects' :: QueryObjects -> Text
$sel:limit:QueryObjects' :: QueryObjects -> Maybe Int
$sel:marker:QueryObjects' :: QueryObjects -> Maybe Text
$sel:query:QueryObjects' :: QueryObjects -> Maybe Query
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"query" Text -> Query -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Query -> Pair) -> Maybe Query -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Query
query,
            (Text
"marker" 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
marker,
            (Text
"limit" 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
limit,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"pipelineId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
pipelineId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"sphere" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sphere)
          ]
      )

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

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

-- | Contains the output of QueryObjects.
--
-- /See:/ 'newQueryObjectsResponse' smart constructor.
data QueryObjectsResponse = QueryObjectsResponse'
  { -- | Indicates whether there are more results that can be obtained by a
    -- subsequent call.
    QueryObjectsResponse -> Maybe Bool
hasMoreResults :: Prelude.Maybe Prelude.Bool,
    -- | The identifiers that match the query selectors.
    QueryObjectsResponse -> Maybe [Text]
ids :: Prelude.Maybe [Prelude.Text],
    -- | The starting point for the next page of results. To view the next page
    -- of results, call @QueryObjects@ again with this marker value. If the
    -- value is null, there are no more results.
    QueryObjectsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    QueryObjectsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (QueryObjectsResponse -> QueryObjectsResponse -> Bool
(QueryObjectsResponse -> QueryObjectsResponse -> Bool)
-> (QueryObjectsResponse -> QueryObjectsResponse -> Bool)
-> Eq QueryObjectsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueryObjectsResponse -> QueryObjectsResponse -> Bool
$c/= :: QueryObjectsResponse -> QueryObjectsResponse -> Bool
== :: QueryObjectsResponse -> QueryObjectsResponse -> Bool
$c== :: QueryObjectsResponse -> QueryObjectsResponse -> Bool
Prelude.Eq, ReadPrec [QueryObjectsResponse]
ReadPrec QueryObjectsResponse
Int -> ReadS QueryObjectsResponse
ReadS [QueryObjectsResponse]
(Int -> ReadS QueryObjectsResponse)
-> ReadS [QueryObjectsResponse]
-> ReadPrec QueryObjectsResponse
-> ReadPrec [QueryObjectsResponse]
-> Read QueryObjectsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QueryObjectsResponse]
$creadListPrec :: ReadPrec [QueryObjectsResponse]
readPrec :: ReadPrec QueryObjectsResponse
$creadPrec :: ReadPrec QueryObjectsResponse
readList :: ReadS [QueryObjectsResponse]
$creadList :: ReadS [QueryObjectsResponse]
readsPrec :: Int -> ReadS QueryObjectsResponse
$creadsPrec :: Int -> ReadS QueryObjectsResponse
Prelude.Read, Int -> QueryObjectsResponse -> ShowS
[QueryObjectsResponse] -> ShowS
QueryObjectsResponse -> String
(Int -> QueryObjectsResponse -> ShowS)
-> (QueryObjectsResponse -> String)
-> ([QueryObjectsResponse] -> ShowS)
-> Show QueryObjectsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueryObjectsResponse] -> ShowS
$cshowList :: [QueryObjectsResponse] -> ShowS
show :: QueryObjectsResponse -> String
$cshow :: QueryObjectsResponse -> String
showsPrec :: Int -> QueryObjectsResponse -> ShowS
$cshowsPrec :: Int -> QueryObjectsResponse -> ShowS
Prelude.Show, (forall x. QueryObjectsResponse -> Rep QueryObjectsResponse x)
-> (forall x. Rep QueryObjectsResponse x -> QueryObjectsResponse)
-> Generic QueryObjectsResponse
forall x. Rep QueryObjectsResponse x -> QueryObjectsResponse
forall x. QueryObjectsResponse -> Rep QueryObjectsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QueryObjectsResponse x -> QueryObjectsResponse
$cfrom :: forall x. QueryObjectsResponse -> Rep QueryObjectsResponse x
Prelude.Generic)

-- |
-- Create a value of 'QueryObjectsResponse' 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:
--
-- 'hasMoreResults', 'queryObjectsResponse_hasMoreResults' - Indicates whether there are more results that can be obtained by a
-- subsequent call.
--
-- 'ids', 'queryObjectsResponse_ids' - The identifiers that match the query selectors.
--
-- 'marker', 'queryObjectsResponse_marker' - The starting point for the next page of results. To view the next page
-- of results, call @QueryObjects@ again with this marker value. If the
-- value is null, there are no more results.
--
-- 'httpStatus', 'queryObjectsResponse_httpStatus' - The response's http status code.
newQueryObjectsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  QueryObjectsResponse
newQueryObjectsResponse :: Int -> QueryObjectsResponse
newQueryObjectsResponse Int
pHttpStatus_ =
  QueryObjectsResponse' :: Maybe Bool
-> Maybe [Text] -> Maybe Text -> Int -> QueryObjectsResponse
QueryObjectsResponse'
    { $sel:hasMoreResults:QueryObjectsResponse' :: Maybe Bool
hasMoreResults =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:ids:QueryObjectsResponse' :: Maybe [Text]
ids = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:QueryObjectsResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:QueryObjectsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Indicates whether there are more results that can be obtained by a
-- subsequent call.
queryObjectsResponse_hasMoreResults :: Lens.Lens' QueryObjectsResponse (Prelude.Maybe Prelude.Bool)
queryObjectsResponse_hasMoreResults :: (Maybe Bool -> f (Maybe Bool))
-> QueryObjectsResponse -> f QueryObjectsResponse
queryObjectsResponse_hasMoreResults = (QueryObjectsResponse -> Maybe Bool)
-> (QueryObjectsResponse -> Maybe Bool -> QueryObjectsResponse)
-> Lens' QueryObjectsResponse (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryObjectsResponse' {Maybe Bool
hasMoreResults :: Maybe Bool
$sel:hasMoreResults:QueryObjectsResponse' :: QueryObjectsResponse -> Maybe Bool
hasMoreResults} -> Maybe Bool
hasMoreResults) (\s :: QueryObjectsResponse
s@QueryObjectsResponse' {} Maybe Bool
a -> QueryObjectsResponse
s {$sel:hasMoreResults:QueryObjectsResponse' :: Maybe Bool
hasMoreResults = Maybe Bool
a} :: QueryObjectsResponse)

-- | The identifiers that match the query selectors.
queryObjectsResponse_ids :: Lens.Lens' QueryObjectsResponse (Prelude.Maybe [Prelude.Text])
queryObjectsResponse_ids :: (Maybe [Text] -> f (Maybe [Text]))
-> QueryObjectsResponse -> f QueryObjectsResponse
queryObjectsResponse_ids = (QueryObjectsResponse -> Maybe [Text])
-> (QueryObjectsResponse -> Maybe [Text] -> QueryObjectsResponse)
-> Lens
     QueryObjectsResponse
     QueryObjectsResponse
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryObjectsResponse' {Maybe [Text]
ids :: Maybe [Text]
$sel:ids:QueryObjectsResponse' :: QueryObjectsResponse -> Maybe [Text]
ids} -> Maybe [Text]
ids) (\s :: QueryObjectsResponse
s@QueryObjectsResponse' {} Maybe [Text]
a -> QueryObjectsResponse
s {$sel:ids:QueryObjectsResponse' :: Maybe [Text]
ids = Maybe [Text]
a} :: QueryObjectsResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> QueryObjectsResponse -> f QueryObjectsResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> QueryObjectsResponse
-> f QueryObjectsResponse
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

-- | The starting point for the next page of results. To view the next page
-- of results, call @QueryObjects@ again with this marker value. If the
-- value is null, there are no more results.
queryObjectsResponse_marker :: Lens.Lens' QueryObjectsResponse (Prelude.Maybe Prelude.Text)
queryObjectsResponse_marker :: (Maybe Text -> f (Maybe Text))
-> QueryObjectsResponse -> f QueryObjectsResponse
queryObjectsResponse_marker = (QueryObjectsResponse -> Maybe Text)
-> (QueryObjectsResponse -> Maybe Text -> QueryObjectsResponse)
-> Lens' QueryObjectsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryObjectsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:QueryObjectsResponse' :: QueryObjectsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: QueryObjectsResponse
s@QueryObjectsResponse' {} Maybe Text
a -> QueryObjectsResponse
s {$sel:marker:QueryObjectsResponse' :: Maybe Text
marker = Maybe Text
a} :: QueryObjectsResponse)

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

instance Prelude.NFData QueryObjectsResponse