{-# 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.ResourceGroups.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)
--
-- Returns a list of AWS resource identifiers that matches the specified
-- query. The query uses the same format as a resource query in a
-- CreateGroup or UpdateGroupQuery operation.
--
-- __Minimum permissions__
--
-- To run this command, you must have the following permissions:
--
-- -   @resource-groups:SearchResources@
--
-- -   @cloudformation:DescribeStacks@
--
-- -   @cloudformation:ListStackResources@
--
-- -   @tag:GetResources@
--
-- This operation returns paginated results.
module Amazonka.ResourceGroups.SearchResources
  ( -- * Creating a Request
    SearchResources (..),
    newSearchResources,

    -- * Request Lenses
    searchResources_nextToken,
    searchResources_maxResults,
    searchResources_resourceQuery,

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

    -- * Response Lenses
    searchResourcesResponse_queryErrors,
    searchResourcesResponse_nextToken,
    searchResourcesResponse_resourceIdentifiers,
    searchResourcesResponse_httpStatus,
  )
where

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

-- | /See:/ 'newSearchResources' smart constructor.
data SearchResources = SearchResources'
  { -- | The parameter for receiving additional results if you receive a
    -- @NextToken@ response in a previous request. A @NextToken@ response
    -- indicates that more output is available. Set this parameter to the value
    -- provided by a previous call\'s @NextToken@ response to indicate where
    -- the output should continue from.
    SearchResources -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The total number of results that you want included on each page of the
    -- response. If you do not include this parameter, it defaults to a value
    -- that is specific to the operation. If additional items exist beyond the
    -- maximum you specify, the @NextToken@ response element is present and has
    -- a value (is not null). Include that value as the @NextToken@ request
    -- parameter in the next call to the operation to get the next part of the
    -- results. Note that the service might return fewer results than the
    -- maximum even when there are more results available. You should check
    -- @NextToken@ after every operation to ensure that you receive all of the
    -- results.
    SearchResources -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The search query, using the same formats that are supported for resource
    -- group definition. For more information, see CreateGroup.
    SearchResources -> ResourceQuery
resourceQuery :: ResourceQuery
  }
  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:
--
-- 'nextToken', 'searchResources_nextToken' - The parameter for receiving additional results if you receive a
-- @NextToken@ response in a previous request. A @NextToken@ response
-- indicates that more output is available. Set this parameter to the value
-- provided by a previous call\'s @NextToken@ response to indicate where
-- the output should continue from.
--
-- 'maxResults', 'searchResources_maxResults' - The total number of results that you want included on each page of the
-- response. If you do not include this parameter, it defaults to a value
-- that is specific to the operation. If additional items exist beyond the
-- maximum you specify, the @NextToken@ response element is present and has
-- a value (is not null). Include that value as the @NextToken@ request
-- parameter in the next call to the operation to get the next part of the
-- results. Note that the service might return fewer results than the
-- maximum even when there are more results available. You should check
-- @NextToken@ after every operation to ensure that you receive all of the
-- results.
--
-- 'resourceQuery', 'searchResources_resourceQuery' - The search query, using the same formats that are supported for resource
-- group definition. For more information, see CreateGroup.
newSearchResources ::
  -- | 'resourceQuery'
  ResourceQuery ->
  SearchResources
newSearchResources :: ResourceQuery -> SearchResources
newSearchResources ResourceQuery
pResourceQuery_ =
  SearchResources' :: Maybe Text -> Maybe Natural -> ResourceQuery -> SearchResources
SearchResources'
    { $sel:nextToken:SearchResources' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:SearchResources' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceQuery:SearchResources' :: ResourceQuery
resourceQuery = ResourceQuery
pResourceQuery_
    }

-- | The parameter for receiving additional results if you receive a
-- @NextToken@ response in a previous request. A @NextToken@ response
-- indicates that more output is available. Set this parameter to the value
-- provided by a previous call\'s @NextToken@ response to indicate where
-- the output should continue from.
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 total number of results that you want included on each page of the
-- response. If you do not include this parameter, it defaults to a value
-- that is specific to the operation. If additional items exist beyond the
-- maximum you specify, the @NextToken@ response element is present and has
-- a value (is not null). Include that value as the @NextToken@ request
-- parameter in the next call to the operation to get the next part of the
-- results. Note that the service might return fewer results than the
-- maximum even when there are more results available. You should check
-- @NextToken@ after every operation to ensure that you receive all of the
-- results.
searchResources_maxResults :: Lens.Lens' SearchResources (Prelude.Maybe Prelude.Natural)
searchResources_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> SearchResources -> f SearchResources
searchResources_maxResults = (SearchResources -> Maybe Natural)
-> (SearchResources -> Maybe Natural -> SearchResources)
-> Lens
     SearchResources SearchResources (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchResources' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:SearchResources' :: SearchResources -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: SearchResources
s@SearchResources' {} Maybe Natural
a -> SearchResources
s {$sel:maxResults:SearchResources' :: Maybe Natural
maxResults = Maybe Natural
a} :: SearchResources)

-- | The search query, using the same formats that are supported for resource
-- group definition. For more information, see CreateGroup.
searchResources_resourceQuery :: Lens.Lens' SearchResources ResourceQuery
searchResources_resourceQuery :: (ResourceQuery -> f ResourceQuery)
-> SearchResources -> f SearchResources
searchResources_resourceQuery = (SearchResources -> ResourceQuery)
-> (SearchResources -> ResourceQuery -> SearchResources)
-> Lens SearchResources SearchResources ResourceQuery ResourceQuery
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchResources' {ResourceQuery
resourceQuery :: ResourceQuery
$sel:resourceQuery:SearchResources' :: SearchResources -> ResourceQuery
resourceQuery} -> ResourceQuery
resourceQuery) (\s :: SearchResources
s@SearchResources' {} ResourceQuery
a -> SearchResources
s {$sel:resourceQuery:SearchResources' :: ResourceQuery
resourceQuery = ResourceQuery
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 [ResourceIdentifier] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse SearchResources
SearchResourcesResponse
rs
            SearchResourcesResponse
-> Getting
     (First [ResourceIdentifier])
     SearchResourcesResponse
     [ResourceIdentifier]
-> Maybe [ResourceIdentifier]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ResourceIdentifier]
 -> Const (First [ResourceIdentifier]) (Maybe [ResourceIdentifier]))
-> SearchResourcesResponse
-> Const (First [ResourceIdentifier]) SearchResourcesResponse
Lens' SearchResourcesResponse (Maybe [ResourceIdentifier])
searchResourcesResponse_resourceIdentifiers
              ((Maybe [ResourceIdentifier]
  -> Const (First [ResourceIdentifier]) (Maybe [ResourceIdentifier]))
 -> SearchResourcesResponse
 -> Const (First [ResourceIdentifier]) SearchResourcesResponse)
-> (([ResourceIdentifier]
     -> Const (First [ResourceIdentifier]) [ResourceIdentifier])
    -> Maybe [ResourceIdentifier]
    -> Const (First [ResourceIdentifier]) (Maybe [ResourceIdentifier]))
-> Getting
     (First [ResourceIdentifier])
     SearchResourcesResponse
     [ResourceIdentifier]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ResourceIdentifier]
 -> Const (First [ResourceIdentifier]) [ResourceIdentifier])
-> Maybe [ResourceIdentifier]
-> Const (First [ResourceIdentifier]) (Maybe [ResourceIdentifier])
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 [QueryError]
-> Maybe Text
-> Maybe [ResourceIdentifier]
-> Int
-> SearchResourcesResponse
SearchResourcesResponse'
            (Maybe [QueryError]
 -> Maybe Text
 -> Maybe [ResourceIdentifier]
 -> Int
 -> SearchResourcesResponse)
-> Either String (Maybe [QueryError])
-> Either
     String
     (Maybe Text
      -> Maybe [ResourceIdentifier] -> Int -> SearchResourcesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [QueryError]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"QueryErrors" Either String (Maybe (Maybe [QueryError]))
-> Maybe [QueryError] -> Either String (Maybe [QueryError])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [QueryError]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe Text
   -> Maybe [ResourceIdentifier] -> Int -> SearchResourcesResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [ResourceIdentifier] -> Int -> SearchResourcesResponse)
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
  (Maybe [ResourceIdentifier] -> Int -> SearchResourcesResponse)
-> Either String (Maybe [ResourceIdentifier])
-> 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 [ResourceIdentifier]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResourceIdentifiers"
                            Either String (Maybe (Maybe [ResourceIdentifier]))
-> Maybe [ResourceIdentifier]
-> Either String (Maybe [ResourceIdentifier])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ResourceIdentifier]
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
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON SearchResources where
  toJSON :: SearchResources -> Value
toJSON SearchResources' {Maybe Natural
Maybe Text
ResourceQuery
resourceQuery :: ResourceQuery
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:resourceQuery:SearchResources' :: SearchResources -> ResourceQuery
$sel:maxResults:SearchResources' :: SearchResources -> Maybe Natural
$sel:nextToken:SearchResources' :: SearchResources -> 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
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ResourceQuery" Text -> ResourceQuery -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ResourceQuery
resourceQuery)
          ]
      )

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

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'
  { -- | A list of @QueryError@ objects. Each error is an object that contains
    -- @ErrorCode@ and @Message@ structures. Possible values for @ErrorCode@
    -- are @CLOUDFORMATION_STACK_INACTIVE@ and
    -- @CLOUDFORMATION_STACK_NOT_EXISTING@.
    SearchResourcesResponse -> Maybe [QueryError]
queryErrors :: Prelude.Maybe [QueryError],
    -- | If present, indicates that more output is available than is included in
    -- the current response. Use this value in the @NextToken@ request
    -- parameter in a subsequent call to the operation to get the next part of
    -- the output. You should repeat this until the @NextToken@ response
    -- element comes back as @null@.
    SearchResourcesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ARNs and resource types of resources that are members of the group
    -- that you specified.
    SearchResourcesResponse -> Maybe [ResourceIdentifier]
resourceIdentifiers :: Prelude.Maybe [ResourceIdentifier],
    -- | 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:
--
-- 'queryErrors', 'searchResourcesResponse_queryErrors' - A list of @QueryError@ objects. Each error is an object that contains
-- @ErrorCode@ and @Message@ structures. Possible values for @ErrorCode@
-- are @CLOUDFORMATION_STACK_INACTIVE@ and
-- @CLOUDFORMATION_STACK_NOT_EXISTING@.
--
-- 'nextToken', 'searchResourcesResponse_nextToken' - If present, indicates that more output is available than is included in
-- the current response. Use this value in the @NextToken@ request
-- parameter in a subsequent call to the operation to get the next part of
-- the output. You should repeat this until the @NextToken@ response
-- element comes back as @null@.
--
-- 'resourceIdentifiers', 'searchResourcesResponse_resourceIdentifiers' - The ARNs and resource types of resources that are members of the group
-- that you specified.
--
-- 'httpStatus', 'searchResourcesResponse_httpStatus' - The response's http status code.
newSearchResourcesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SearchResourcesResponse
newSearchResourcesResponse :: Int -> SearchResourcesResponse
newSearchResourcesResponse Int
pHttpStatus_ =
  SearchResourcesResponse' :: Maybe [QueryError]
-> Maybe Text
-> Maybe [ResourceIdentifier]
-> Int
-> SearchResourcesResponse
SearchResourcesResponse'
    { $sel:queryErrors:SearchResourcesResponse' :: Maybe [QueryError]
queryErrors =
        Maybe [QueryError]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:SearchResourcesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceIdentifiers:SearchResourcesResponse' :: Maybe [ResourceIdentifier]
resourceIdentifiers = Maybe [ResourceIdentifier]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SearchResourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of @QueryError@ objects. Each error is an object that contains
-- @ErrorCode@ and @Message@ structures. Possible values for @ErrorCode@
-- are @CLOUDFORMATION_STACK_INACTIVE@ and
-- @CLOUDFORMATION_STACK_NOT_EXISTING@.
searchResourcesResponse_queryErrors :: Lens.Lens' SearchResourcesResponse (Prelude.Maybe [QueryError])
searchResourcesResponse_queryErrors :: (Maybe [QueryError] -> f (Maybe [QueryError]))
-> SearchResourcesResponse -> f SearchResourcesResponse
searchResourcesResponse_queryErrors = (SearchResourcesResponse -> Maybe [QueryError])
-> (SearchResourcesResponse
    -> Maybe [QueryError] -> SearchResourcesResponse)
-> Lens
     SearchResourcesResponse
     SearchResourcesResponse
     (Maybe [QueryError])
     (Maybe [QueryError])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchResourcesResponse' {Maybe [QueryError]
queryErrors :: Maybe [QueryError]
$sel:queryErrors:SearchResourcesResponse' :: SearchResourcesResponse -> Maybe [QueryError]
queryErrors} -> Maybe [QueryError]
queryErrors) (\s :: SearchResourcesResponse
s@SearchResourcesResponse' {} Maybe [QueryError]
a -> SearchResourcesResponse
s {$sel:queryErrors:SearchResourcesResponse' :: Maybe [QueryError]
queryErrors = Maybe [QueryError]
a} :: SearchResourcesResponse) ((Maybe [QueryError] -> f (Maybe [QueryError]))
 -> SearchResourcesResponse -> f SearchResourcesResponse)
-> ((Maybe [QueryError] -> f (Maybe [QueryError]))
    -> Maybe [QueryError] -> f (Maybe [QueryError]))
-> (Maybe [QueryError] -> f (Maybe [QueryError]))
-> SearchResourcesResponse
-> f SearchResourcesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [QueryError] [QueryError] [QueryError] [QueryError]
-> Iso
     (Maybe [QueryError])
     (Maybe [QueryError])
     (Maybe [QueryError])
     (Maybe [QueryError])
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 [QueryError] [QueryError] [QueryError] [QueryError]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If present, indicates that more output is available than is included in
-- the current response. Use this value in the @NextToken@ request
-- parameter in a subsequent call to the operation to get the next part of
-- the output. You should repeat this until the @NextToken@ response
-- element comes back as @null@.
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)

-- | The ARNs and resource types of resources that are members of the group
-- that you specified.
searchResourcesResponse_resourceIdentifiers :: Lens.Lens' SearchResourcesResponse (Prelude.Maybe [ResourceIdentifier])
searchResourcesResponse_resourceIdentifiers :: (Maybe [ResourceIdentifier] -> f (Maybe [ResourceIdentifier]))
-> SearchResourcesResponse -> f SearchResourcesResponse
searchResourcesResponse_resourceIdentifiers = (SearchResourcesResponse -> Maybe [ResourceIdentifier])
-> (SearchResourcesResponse
    -> Maybe [ResourceIdentifier] -> SearchResourcesResponse)
-> Lens' SearchResourcesResponse (Maybe [ResourceIdentifier])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchResourcesResponse' {Maybe [ResourceIdentifier]
resourceIdentifiers :: Maybe [ResourceIdentifier]
$sel:resourceIdentifiers:SearchResourcesResponse' :: SearchResourcesResponse -> Maybe [ResourceIdentifier]
resourceIdentifiers} -> Maybe [ResourceIdentifier]
resourceIdentifiers) (\s :: SearchResourcesResponse
s@SearchResourcesResponse' {} Maybe [ResourceIdentifier]
a -> SearchResourcesResponse
s {$sel:resourceIdentifiers:SearchResourcesResponse' :: Maybe [ResourceIdentifier]
resourceIdentifiers = Maybe [ResourceIdentifier]
a} :: SearchResourcesResponse) ((Maybe [ResourceIdentifier] -> f (Maybe [ResourceIdentifier]))
 -> SearchResourcesResponse -> f SearchResourcesResponse)
-> ((Maybe [ResourceIdentifier] -> f (Maybe [ResourceIdentifier]))
    -> Maybe [ResourceIdentifier] -> f (Maybe [ResourceIdentifier]))
-> (Maybe [ResourceIdentifier] -> f (Maybe [ResourceIdentifier]))
-> SearchResourcesResponse
-> f SearchResourcesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ResourceIdentifier]
  [ResourceIdentifier]
  [ResourceIdentifier]
  [ResourceIdentifier]
-> Iso
     (Maybe [ResourceIdentifier])
     (Maybe [ResourceIdentifier])
     (Maybe [ResourceIdentifier])
     (Maybe [ResourceIdentifier])
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
  [ResourceIdentifier]
  [ResourceIdentifier]
  [ResourceIdentifier]
  [ResourceIdentifier]
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