{-# 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.MacieV2.SearchResources
-- 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)
--
-- Retrieves (queries) statistical data and other information about Amazon
-- Web Services resources that Amazon Macie monitors and analyzes.
--
-- This operation returns paginated results.
module Amazonka.MacieV2.SearchResources
  ( -- * Creating a Request
    SearchResources (..),
    newSearchResources,

    -- * Request Lenses
    searchResources_bucketCriteria,
    searchResources_sortCriteria,
    searchResources_nextToken,
    searchResources_maxResults,

    -- * Destructuring the Response
    SearchResourcesResponse (..),
    newSearchResourcesResponse,

    -- * Response Lenses
    searchResourcesResponse_nextToken,
    searchResourcesResponse_matchingResources,
    searchResourcesResponse_httpStatus,
  )
where

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

-- | /See:/ 'newSearchResources' smart constructor.
data SearchResources = SearchResources'
  { -- | The filter conditions that determine which S3 buckets to include or
    -- exclude from the query results.
    SearchResources -> Maybe SearchResourcesBucketCriteria
bucketCriteria :: Prelude.Maybe SearchResourcesBucketCriteria,
    -- | The criteria to use to sort the results.
    SearchResources -> Maybe SearchResourcesSortCriteria
sortCriteria :: Prelude.Maybe SearchResourcesSortCriteria,
    -- | The nextToken string that specifies which page of results to return in a
    -- paginated response.
    SearchResources -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to include in each page of the response. The
    -- default value is 50.
    SearchResources -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (SearchResources -> SearchResources -> Bool
(SearchResources -> SearchResources -> Bool)
-> (SearchResources -> SearchResources -> Bool)
-> Eq SearchResources
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchResources -> SearchResources -> Bool
$c/= :: SearchResources -> SearchResources -> Bool
== :: SearchResources -> SearchResources -> Bool
$c== :: SearchResources -> SearchResources -> Bool
Prelude.Eq, ReadPrec [SearchResources]
ReadPrec SearchResources
Int -> ReadS SearchResources
ReadS [SearchResources]
(Int -> ReadS SearchResources)
-> ReadS [SearchResources]
-> ReadPrec SearchResources
-> ReadPrec [SearchResources]
-> Read SearchResources
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchResources]
$creadListPrec :: ReadPrec [SearchResources]
readPrec :: ReadPrec SearchResources
$creadPrec :: ReadPrec SearchResources
readList :: ReadS [SearchResources]
$creadList :: ReadS [SearchResources]
readsPrec :: Int -> ReadS SearchResources
$creadsPrec :: Int -> ReadS SearchResources
Prelude.Read, Int -> SearchResources -> ShowS
[SearchResources] -> ShowS
SearchResources -> String
(Int -> SearchResources -> ShowS)
-> (SearchResources -> String)
-> ([SearchResources] -> ShowS)
-> Show SearchResources
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchResources] -> ShowS
$cshowList :: [SearchResources] -> ShowS
show :: SearchResources -> String
$cshow :: SearchResources -> String
showsPrec :: Int -> SearchResources -> ShowS
$cshowsPrec :: Int -> SearchResources -> ShowS
Prelude.Show, (forall x. SearchResources -> Rep SearchResources x)
-> (forall x. Rep SearchResources x -> SearchResources)
-> Generic SearchResources
forall x. Rep SearchResources x -> SearchResources
forall x. SearchResources -> Rep SearchResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchResources x -> SearchResources
$cfrom :: forall x. SearchResources -> Rep SearchResources x
Prelude.Generic)

-- |
-- Create a value of 'SearchResources' 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:
--
-- 'bucketCriteria', 'searchResources_bucketCriteria' - The filter conditions that determine which S3 buckets to include or
-- exclude from the query results.
--
-- 'sortCriteria', 'searchResources_sortCriteria' - The criteria to use to sort the results.
--
-- 'nextToken', 'searchResources_nextToken' - The nextToken string that specifies which page of results to return in a
-- paginated response.
--
-- 'maxResults', 'searchResources_maxResults' - The maximum number of items to include in each page of the response. The
-- default value is 50.
newSearchResources ::
  SearchResources
newSearchResources :: SearchResources
newSearchResources =
  SearchResources' :: Maybe SearchResourcesBucketCriteria
-> Maybe SearchResourcesSortCriteria
-> Maybe Text
-> Maybe Int
-> SearchResources
SearchResources'
    { $sel:bucketCriteria:SearchResources' :: Maybe SearchResourcesBucketCriteria
bucketCriteria = Maybe SearchResourcesBucketCriteria
forall a. Maybe a
Prelude.Nothing,
      $sel:sortCriteria:SearchResources' :: Maybe SearchResourcesSortCriteria
sortCriteria = Maybe SearchResourcesSortCriteria
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:SearchResources' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:SearchResources' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The filter conditions that determine which S3 buckets to include or
-- exclude from the query results.
searchResources_bucketCriteria :: Lens.Lens' SearchResources (Prelude.Maybe SearchResourcesBucketCriteria)
searchResources_bucketCriteria :: (Maybe SearchResourcesBucketCriteria
 -> f (Maybe SearchResourcesBucketCriteria))
-> SearchResources -> f SearchResources
searchResources_bucketCriteria = (SearchResources -> Maybe SearchResourcesBucketCriteria)
-> (SearchResources
    -> Maybe SearchResourcesBucketCriteria -> SearchResources)
-> Lens
     SearchResources
     SearchResources
     (Maybe SearchResourcesBucketCriteria)
     (Maybe SearchResourcesBucketCriteria)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchResources' {Maybe SearchResourcesBucketCriteria
bucketCriteria :: Maybe SearchResourcesBucketCriteria
$sel:bucketCriteria:SearchResources' :: SearchResources -> Maybe SearchResourcesBucketCriteria
bucketCriteria} -> Maybe SearchResourcesBucketCriteria
bucketCriteria) (\s :: SearchResources
s@SearchResources' {} Maybe SearchResourcesBucketCriteria
a -> SearchResources
s {$sel:bucketCriteria:SearchResources' :: Maybe SearchResourcesBucketCriteria
bucketCriteria = Maybe SearchResourcesBucketCriteria
a} :: SearchResources)

-- | The criteria to use to sort the results.
searchResources_sortCriteria :: Lens.Lens' SearchResources (Prelude.Maybe SearchResourcesSortCriteria)
searchResources_sortCriteria :: (Maybe SearchResourcesSortCriteria
 -> f (Maybe SearchResourcesSortCriteria))
-> SearchResources -> f SearchResources
searchResources_sortCriteria = (SearchResources -> Maybe SearchResourcesSortCriteria)
-> (SearchResources
    -> Maybe SearchResourcesSortCriteria -> SearchResources)
-> Lens
     SearchResources
     SearchResources
     (Maybe SearchResourcesSortCriteria)
     (Maybe SearchResourcesSortCriteria)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchResources' {Maybe SearchResourcesSortCriteria
sortCriteria :: Maybe SearchResourcesSortCriteria
$sel:sortCriteria:SearchResources' :: SearchResources -> Maybe SearchResourcesSortCriteria
sortCriteria} -> Maybe SearchResourcesSortCriteria
sortCriteria) (\s :: SearchResources
s@SearchResources' {} Maybe SearchResourcesSortCriteria
a -> SearchResources
s {$sel:sortCriteria:SearchResources' :: Maybe SearchResourcesSortCriteria
sortCriteria = Maybe SearchResourcesSortCriteria
a} :: SearchResources)

-- | The nextToken string that specifies which page of results to return in a
-- paginated response.
searchResources_nextToken :: Lens.Lens' SearchResources (Prelude.Maybe Prelude.Text)
searchResources_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchResources -> f SearchResources
searchResources_nextToken = (SearchResources -> Maybe Text)
-> (SearchResources -> Maybe Text -> SearchResources)
-> Lens SearchResources SearchResources (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchResources' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchResources' :: SearchResources -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchResources
s@SearchResources' {} Maybe Text
a -> SearchResources
s {$sel:nextToken:SearchResources' :: Maybe Text
nextToken = Maybe Text
a} :: SearchResources)

-- | The maximum number of items to include in each page of the response. The
-- default value is 50.
searchResources_maxResults :: Lens.Lens' SearchResources (Prelude.Maybe Prelude.Int)
searchResources_maxResults :: (Maybe Int -> f (Maybe Int))
-> SearchResources -> f SearchResources
searchResources_maxResults = (SearchResources -> Maybe Int)
-> (SearchResources -> Maybe Int -> SearchResources)
-> Lens SearchResources SearchResources (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchResources' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:SearchResources' :: SearchResources -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: SearchResources
s@SearchResources' {} Maybe Int
a -> SearchResources
s {$sel:maxResults:SearchResources' :: Maybe Int
maxResults = Maybe Int
a} :: SearchResources)

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

instance Prelude.NFData SearchResources

instance Core.ToHeaders SearchResources where
  toHeaders :: SearchResources -> ResponseHeaders
toHeaders =
    ResponseHeaders -> SearchResources -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 SearchResources where
  toJSON :: SearchResources -> Value
toJSON SearchResources' {Maybe Int
Maybe Text
Maybe SearchResourcesSortCriteria
Maybe SearchResourcesBucketCriteria
maxResults :: Maybe Int
nextToken :: Maybe Text
sortCriteria :: Maybe SearchResourcesSortCriteria
bucketCriteria :: Maybe SearchResourcesBucketCriteria
$sel:maxResults:SearchResources' :: SearchResources -> Maybe Int
$sel:nextToken:SearchResources' :: SearchResources -> Maybe Text
$sel:sortCriteria:SearchResources' :: SearchResources -> Maybe SearchResourcesSortCriteria
$sel:bucketCriteria:SearchResources' :: SearchResources -> Maybe SearchResourcesBucketCriteria
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"bucketCriteria" Text -> SearchResourcesBucketCriteria -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SearchResourcesBucketCriteria -> Pair)
-> Maybe SearchResourcesBucketCriteria -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SearchResourcesBucketCriteria
bucketCriteria,
            (Text
"sortCriteria" Text -> SearchResourcesSortCriteria -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SearchResourcesSortCriteria -> Pair)
-> Maybe SearchResourcesSortCriteria -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SearchResourcesSortCriteria
sortCriteria,
            (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 SearchResources where
  toPath :: SearchResources -> ByteString
toPath =
    ByteString -> SearchResources -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/datasources/search-resources"

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

-- | /See:/ 'newSearchResourcesResponse' smart constructor.
data SearchResourcesResponse = SearchResourcesResponse'
  { -- | The string to use in a subsequent request to get the next page of
    -- results in a paginated response. This value is null if there are no
    -- additional pages.
    SearchResourcesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An array of objects, one for each resource that meets the filter
    -- criteria specified in the request.
    SearchResourcesResponse -> Maybe [MatchingResource]
matchingResources :: Prelude.Maybe [MatchingResource],
    -- | The response's http status code.
    SearchResourcesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SearchResourcesResponse -> SearchResourcesResponse -> Bool
(SearchResourcesResponse -> SearchResourcesResponse -> Bool)
-> (SearchResourcesResponse -> SearchResourcesResponse -> Bool)
-> Eq SearchResourcesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchResourcesResponse -> SearchResourcesResponse -> Bool
$c/= :: SearchResourcesResponse -> SearchResourcesResponse -> Bool
== :: SearchResourcesResponse -> SearchResourcesResponse -> Bool
$c== :: SearchResourcesResponse -> SearchResourcesResponse -> Bool
Prelude.Eq, ReadPrec [SearchResourcesResponse]
ReadPrec SearchResourcesResponse
Int -> ReadS SearchResourcesResponse
ReadS [SearchResourcesResponse]
(Int -> ReadS SearchResourcesResponse)
-> ReadS [SearchResourcesResponse]
-> ReadPrec SearchResourcesResponse
-> ReadPrec [SearchResourcesResponse]
-> Read SearchResourcesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchResourcesResponse]
$creadListPrec :: ReadPrec [SearchResourcesResponse]
readPrec :: ReadPrec SearchResourcesResponse
$creadPrec :: ReadPrec SearchResourcesResponse
readList :: ReadS [SearchResourcesResponse]
$creadList :: ReadS [SearchResourcesResponse]
readsPrec :: Int -> ReadS SearchResourcesResponse
$creadsPrec :: Int -> ReadS SearchResourcesResponse
Prelude.Read, Int -> SearchResourcesResponse -> ShowS
[SearchResourcesResponse] -> ShowS
SearchResourcesResponse -> String
(Int -> SearchResourcesResponse -> ShowS)
-> (SearchResourcesResponse -> String)
-> ([SearchResourcesResponse] -> ShowS)
-> Show SearchResourcesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchResourcesResponse] -> ShowS
$cshowList :: [SearchResourcesResponse] -> ShowS
show :: SearchResourcesResponse -> String
$cshow :: SearchResourcesResponse -> String
showsPrec :: Int -> SearchResourcesResponse -> ShowS
$cshowsPrec :: Int -> SearchResourcesResponse -> ShowS
Prelude.Show, (forall x.
 SearchResourcesResponse -> Rep SearchResourcesResponse x)
-> (forall x.
    Rep SearchResourcesResponse x -> SearchResourcesResponse)
-> Generic SearchResourcesResponse
forall x. Rep SearchResourcesResponse x -> SearchResourcesResponse
forall x. SearchResourcesResponse -> Rep SearchResourcesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchResourcesResponse x -> SearchResourcesResponse
$cfrom :: forall x. SearchResourcesResponse -> Rep SearchResourcesResponse x
Prelude.Generic)

-- |
-- Create a value of 'SearchResourcesResponse' 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', 'searchResourcesResponse_nextToken' - The string to use in a subsequent request to get the next page of
-- results in a paginated response. This value is null if there are no
-- additional pages.
--
-- 'matchingResources', 'searchResourcesResponse_matchingResources' - An array of objects, one for each resource that meets the filter
-- criteria specified in the request.
--
-- 'httpStatus', 'searchResourcesResponse_httpStatus' - The response's http status code.
newSearchResourcesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SearchResourcesResponse
newSearchResourcesResponse :: Int -> SearchResourcesResponse
newSearchResourcesResponse Int
pHttpStatus_ =
  SearchResourcesResponse' :: Maybe Text
-> Maybe [MatchingResource] -> Int -> SearchResourcesResponse
SearchResourcesResponse'
    { $sel:nextToken:SearchResourcesResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:matchingResources:SearchResourcesResponse' :: Maybe [MatchingResource]
matchingResources = Maybe [MatchingResource]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SearchResourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The string to use in a subsequent request to get the next page of
-- results in a paginated response. This value is null if there are no
-- additional pages.
searchResourcesResponse_nextToken :: Lens.Lens' SearchResourcesResponse (Prelude.Maybe Prelude.Text)
searchResourcesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchResourcesResponse -> f SearchResourcesResponse
searchResourcesResponse_nextToken = (SearchResourcesResponse -> Maybe Text)
-> (SearchResourcesResponse
    -> Maybe Text -> SearchResourcesResponse)
-> Lens' SearchResourcesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchResourcesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchResourcesResponse' :: SearchResourcesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchResourcesResponse
s@SearchResourcesResponse' {} Maybe Text
a -> SearchResourcesResponse
s {$sel:nextToken:SearchResourcesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: SearchResourcesResponse)

-- | An array of objects, one for each resource that meets the filter
-- criteria specified in the request.
searchResourcesResponse_matchingResources :: Lens.Lens' SearchResourcesResponse (Prelude.Maybe [MatchingResource])
searchResourcesResponse_matchingResources :: (Maybe [MatchingResource] -> f (Maybe [MatchingResource]))
-> SearchResourcesResponse -> f SearchResourcesResponse
searchResourcesResponse_matchingResources = (SearchResourcesResponse -> Maybe [MatchingResource])
-> (SearchResourcesResponse
    -> Maybe [MatchingResource] -> SearchResourcesResponse)
-> Lens' SearchResourcesResponse (Maybe [MatchingResource])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchResourcesResponse' {Maybe [MatchingResource]
matchingResources :: Maybe [MatchingResource]
$sel:matchingResources:SearchResourcesResponse' :: SearchResourcesResponse -> Maybe [MatchingResource]
matchingResources} -> Maybe [MatchingResource]
matchingResources) (\s :: SearchResourcesResponse
s@SearchResourcesResponse' {} Maybe [MatchingResource]
a -> SearchResourcesResponse
s {$sel:matchingResources:SearchResourcesResponse' :: Maybe [MatchingResource]
matchingResources = Maybe [MatchingResource]
a} :: SearchResourcesResponse) ((Maybe [MatchingResource] -> f (Maybe [MatchingResource]))
 -> SearchResourcesResponse -> f SearchResourcesResponse)
-> ((Maybe [MatchingResource] -> f (Maybe [MatchingResource]))
    -> Maybe [MatchingResource] -> f (Maybe [MatchingResource]))
-> (Maybe [MatchingResource] -> f (Maybe [MatchingResource]))
-> SearchResourcesResponse
-> f SearchResourcesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [MatchingResource]
  [MatchingResource]
  [MatchingResource]
  [MatchingResource]
-> Iso
     (Maybe [MatchingResource])
     (Maybe [MatchingResource])
     (Maybe [MatchingResource])
     (Maybe [MatchingResource])
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
  [MatchingResource]
  [MatchingResource]
  [MatchingResource]
  [MatchingResource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData SearchResourcesResponse