{-# 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.ListGroupResources
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a list of ARNs of the resources that are members of a specified
-- resource group.
--
-- __Minimum permissions__
--
-- To run this command, you must have the following permissions:
--
-- -   @resource-groups:ListGroupResources@
--
-- -   @cloudformation:DescribeStacks@
--
-- -   @cloudformation:ListStackResources@
--
-- -   @tag:GetResources@
--
-- This operation returns paginated results.
module Amazonka.ResourceGroups.ListGroupResources
  ( -- * Creating a Request
    ListGroupResources (..),
    newListGroupResources,

    -- * Request Lenses
    listGroupResources_filters,
    listGroupResources_group,
    listGroupResources_groupName,
    listGroupResources_maxResults,
    listGroupResources_nextToken,

    -- * Destructuring the Response
    ListGroupResourcesResponse (..),
    newListGroupResourcesResponse,

    -- * Response Lenses
    listGroupResourcesResponse_nextToken,
    listGroupResourcesResponse_queryErrors,
    listGroupResourcesResponse_resourceIdentifiers,
    listGroupResourcesResponse_resources,
    listGroupResourcesResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListGroupResources' smart constructor.
data ListGroupResources = ListGroupResources'
  { -- | Filters, formatted as ResourceFilter objects, that you want to apply to
    -- a @ListGroupResources@ operation. Filters the results to include only
    -- those of the specified resource types.
    --
    -- -   @resource-type@ - Filter resources by their type. Specify up to five
    --     resource types in the format @AWS::ServiceCode::ResourceType@. For
    --     example, @AWS::EC2::Instance@, or @AWS::S3::Bucket@.
    --
    -- When you specify a @resource-type@ filter for @ListGroupResources@, AWS
    -- Resource Groups validates your filter resource types against the types
    -- that are defined in the query associated with the group. For example, if
    -- a group contains only S3 buckets because its query specifies only that
    -- resource type, but your @resource-type@ filter includes EC2 instances,
    -- AWS Resource Groups does not filter for EC2 instances. In this case, a
    -- @ListGroupResources@ request returns a @BadRequestException@ error with
    -- a message similar to the following:
    --
    -- @The resource types specified as filters in the request are not valid.@
    --
    -- The error includes a list of resource types that failed the validation
    -- because they are not part of the query associated with the group. This
    -- validation doesn\'t occur when the group query specifies
    -- @AWS::AllSupported@, because a group based on such a query can contain
    -- any of the allowed resource types for the query type (tag-based or AWS
    -- CloudFormation stack-based queries).
    ListGroupResources -> Maybe [ResourceFilter]
filters :: Prelude.Maybe [ResourceFilter],
    -- | The name or the ARN of the resource group
    ListGroupResources -> Maybe Text
group' :: Prelude.Maybe Prelude.Text,
    -- | /__Deprecated - don\'t use this parameter. Use the @Group@ request field
    -- instead.__/
    ListGroupResources -> Maybe Text
groupName :: 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.
    ListGroupResources -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | 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.
    ListGroupResources -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListGroupResources -> ListGroupResources -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListGroupResources -> ListGroupResources -> Bool
$c/= :: ListGroupResources -> ListGroupResources -> Bool
== :: ListGroupResources -> ListGroupResources -> Bool
$c== :: ListGroupResources -> ListGroupResources -> Bool
Prelude.Eq, ReadPrec [ListGroupResources]
ReadPrec ListGroupResources
Int -> ReadS ListGroupResources
ReadS [ListGroupResources]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListGroupResources]
$creadListPrec :: ReadPrec [ListGroupResources]
readPrec :: ReadPrec ListGroupResources
$creadPrec :: ReadPrec ListGroupResources
readList :: ReadS [ListGroupResources]
$creadList :: ReadS [ListGroupResources]
readsPrec :: Int -> ReadS ListGroupResources
$creadsPrec :: Int -> ReadS ListGroupResources
Prelude.Read, Int -> ListGroupResources -> ShowS
[ListGroupResources] -> ShowS
ListGroupResources -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListGroupResources] -> ShowS
$cshowList :: [ListGroupResources] -> ShowS
show :: ListGroupResources -> String
$cshow :: ListGroupResources -> String
showsPrec :: Int -> ListGroupResources -> ShowS
$cshowsPrec :: Int -> ListGroupResources -> ShowS
Prelude.Show, forall x. Rep ListGroupResources x -> ListGroupResources
forall x. ListGroupResources -> Rep ListGroupResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListGroupResources x -> ListGroupResources
$cfrom :: forall x. ListGroupResources -> Rep ListGroupResources x
Prelude.Generic)

-- |
-- Create a value of 'ListGroupResources' 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:
--
-- 'filters', 'listGroupResources_filters' - Filters, formatted as ResourceFilter objects, that you want to apply to
-- a @ListGroupResources@ operation. Filters the results to include only
-- those of the specified resource types.
--
-- -   @resource-type@ - Filter resources by their type. Specify up to five
--     resource types in the format @AWS::ServiceCode::ResourceType@. For
--     example, @AWS::EC2::Instance@, or @AWS::S3::Bucket@.
--
-- When you specify a @resource-type@ filter for @ListGroupResources@, AWS
-- Resource Groups validates your filter resource types against the types
-- that are defined in the query associated with the group. For example, if
-- a group contains only S3 buckets because its query specifies only that
-- resource type, but your @resource-type@ filter includes EC2 instances,
-- AWS Resource Groups does not filter for EC2 instances. In this case, a
-- @ListGroupResources@ request returns a @BadRequestException@ error with
-- a message similar to the following:
--
-- @The resource types specified as filters in the request are not valid.@
--
-- The error includes a list of resource types that failed the validation
-- because they are not part of the query associated with the group. This
-- validation doesn\'t occur when the group query specifies
-- @AWS::AllSupported@, because a group based on such a query can contain
-- any of the allowed resource types for the query type (tag-based or AWS
-- CloudFormation stack-based queries).
--
-- 'group'', 'listGroupResources_group' - The name or the ARN of the resource group
--
-- 'groupName', 'listGroupResources_groupName' - /__Deprecated - don\'t use this parameter. Use the @Group@ request field
-- instead.__/
--
-- 'maxResults', 'listGroupResources_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.
--
-- 'nextToken', 'listGroupResources_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.
newListGroupResources ::
  ListGroupResources
newListGroupResources :: ListGroupResources
newListGroupResources =
  ListGroupResources'
    { $sel:filters:ListGroupResources' :: Maybe [ResourceFilter]
filters = forall a. Maybe a
Prelude.Nothing,
      $sel:group':ListGroupResources' :: Maybe Text
group' = forall a. Maybe a
Prelude.Nothing,
      $sel:groupName:ListGroupResources' :: Maybe Text
groupName = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListGroupResources' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListGroupResources' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | Filters, formatted as ResourceFilter objects, that you want to apply to
-- a @ListGroupResources@ operation. Filters the results to include only
-- those of the specified resource types.
--
-- -   @resource-type@ - Filter resources by their type. Specify up to five
--     resource types in the format @AWS::ServiceCode::ResourceType@. For
--     example, @AWS::EC2::Instance@, or @AWS::S3::Bucket@.
--
-- When you specify a @resource-type@ filter for @ListGroupResources@, AWS
-- Resource Groups validates your filter resource types against the types
-- that are defined in the query associated with the group. For example, if
-- a group contains only S3 buckets because its query specifies only that
-- resource type, but your @resource-type@ filter includes EC2 instances,
-- AWS Resource Groups does not filter for EC2 instances. In this case, a
-- @ListGroupResources@ request returns a @BadRequestException@ error with
-- a message similar to the following:
--
-- @The resource types specified as filters in the request are not valid.@
--
-- The error includes a list of resource types that failed the validation
-- because they are not part of the query associated with the group. This
-- validation doesn\'t occur when the group query specifies
-- @AWS::AllSupported@, because a group based on such a query can contain
-- any of the allowed resource types for the query type (tag-based or AWS
-- CloudFormation stack-based queries).
listGroupResources_filters :: Lens.Lens' ListGroupResources (Prelude.Maybe [ResourceFilter])
listGroupResources_filters :: Lens' ListGroupResources (Maybe [ResourceFilter])
listGroupResources_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupResources' {Maybe [ResourceFilter]
filters :: Maybe [ResourceFilter]
$sel:filters:ListGroupResources' :: ListGroupResources -> Maybe [ResourceFilter]
filters} -> Maybe [ResourceFilter]
filters) (\s :: ListGroupResources
s@ListGroupResources' {} Maybe [ResourceFilter]
a -> ListGroupResources
s {$sel:filters:ListGroupResources' :: Maybe [ResourceFilter]
filters = Maybe [ResourceFilter]
a} :: ListGroupResources) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name or the ARN of the resource group
listGroupResources_group :: Lens.Lens' ListGroupResources (Prelude.Maybe Prelude.Text)
listGroupResources_group :: Lens' ListGroupResources (Maybe Text)
listGroupResources_group = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupResources' {Maybe Text
group' :: Maybe Text
$sel:group':ListGroupResources' :: ListGroupResources -> Maybe Text
group'} -> Maybe Text
group') (\s :: ListGroupResources
s@ListGroupResources' {} Maybe Text
a -> ListGroupResources
s {$sel:group':ListGroupResources' :: Maybe Text
group' = Maybe Text
a} :: ListGroupResources)

-- | /__Deprecated - don\'t use this parameter. Use the @Group@ request field
-- instead.__/
listGroupResources_groupName :: Lens.Lens' ListGroupResources (Prelude.Maybe Prelude.Text)
listGroupResources_groupName :: Lens' ListGroupResources (Maybe Text)
listGroupResources_groupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupResources' {Maybe Text
groupName :: Maybe Text
$sel:groupName:ListGroupResources' :: ListGroupResources -> Maybe Text
groupName} -> Maybe Text
groupName) (\s :: ListGroupResources
s@ListGroupResources' {} Maybe Text
a -> ListGroupResources
s {$sel:groupName:ListGroupResources' :: Maybe Text
groupName = Maybe Text
a} :: ListGroupResources)

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

-- | 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.
listGroupResources_nextToken :: Lens.Lens' ListGroupResources (Prelude.Maybe Prelude.Text)
listGroupResources_nextToken :: Lens' ListGroupResources (Maybe Text)
listGroupResources_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupResources' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListGroupResources' :: ListGroupResources -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListGroupResources
s@ListGroupResources' {} Maybe Text
a -> ListGroupResources
s {$sel:nextToken:ListGroupResources' :: Maybe Text
nextToken = Maybe Text
a} :: ListGroupResources)

instance Core.AWSPager ListGroupResources where
  page :: ListGroupResources
-> AWSResponse ListGroupResources -> Maybe ListGroupResources
page ListGroupResources
rq AWSResponse ListGroupResources
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListGroupResources
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListGroupResourcesResponse (Maybe Text)
listGroupResourcesResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListGroupResources
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListGroupResourcesResponse (Maybe [ResourceIdentifier])
listGroupResourcesResponse_resourceIdentifiers
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListGroupResources
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListGroupResourcesResponse (Maybe [ListGroupResourcesItem])
listGroupResourcesResponse_resources
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListGroupResources
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListGroupResources (Maybe Text)
listGroupResources_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListGroupResources
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListGroupResourcesResponse (Maybe Text)
listGroupResourcesResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListGroupResources where
  type
    AWSResponse ListGroupResources =
      ListGroupResourcesResponse
  request :: (Service -> Service)
-> ListGroupResources -> Request ListGroupResources
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListGroupResources
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListGroupResources)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [QueryError]
-> Maybe [ResourceIdentifier]
-> Maybe [ListGroupResourcesItem]
-> Int
-> ListGroupResourcesResponse
ListGroupResourcesResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"QueryErrors" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ResourceIdentifiers"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Resources" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListGroupResources where
  hashWithSalt :: Int -> ListGroupResources -> Int
hashWithSalt Int
_salt ListGroupResources' {Maybe Natural
Maybe [ResourceFilter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
groupName :: Maybe Text
group' :: Maybe Text
filters :: Maybe [ResourceFilter]
$sel:nextToken:ListGroupResources' :: ListGroupResources -> Maybe Text
$sel:maxResults:ListGroupResources' :: ListGroupResources -> Maybe Natural
$sel:groupName:ListGroupResources' :: ListGroupResources -> Maybe Text
$sel:group':ListGroupResources' :: ListGroupResources -> Maybe Text
$sel:filters:ListGroupResources' :: ListGroupResources -> Maybe [ResourceFilter]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ResourceFilter]
filters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
group'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
groupName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken

instance Prelude.NFData ListGroupResources where
  rnf :: ListGroupResources -> ()
rnf ListGroupResources' {Maybe Natural
Maybe [ResourceFilter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
groupName :: Maybe Text
group' :: Maybe Text
filters :: Maybe [ResourceFilter]
$sel:nextToken:ListGroupResources' :: ListGroupResources -> Maybe Text
$sel:maxResults:ListGroupResources' :: ListGroupResources -> Maybe Natural
$sel:groupName:ListGroupResources' :: ListGroupResources -> Maybe Text
$sel:group':ListGroupResources' :: ListGroupResources -> Maybe Text
$sel:filters:ListGroupResources' :: ListGroupResources -> Maybe [ResourceFilter]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ResourceFilter]
filters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
group'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
groupName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken

instance Data.ToHeaders ListGroupResources where
  toHeaders :: ListGroupResources -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToJSON ListGroupResources where
  toJSON :: ListGroupResources -> Value
toJSON ListGroupResources' {Maybe Natural
Maybe [ResourceFilter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
groupName :: Maybe Text
group' :: Maybe Text
filters :: Maybe [ResourceFilter]
$sel:nextToken:ListGroupResources' :: ListGroupResources -> Maybe Text
$sel:maxResults:ListGroupResources' :: ListGroupResources -> Maybe Natural
$sel:groupName:ListGroupResources' :: ListGroupResources -> Maybe Text
$sel:group':ListGroupResources' :: ListGroupResources -> Maybe Text
$sel:filters:ListGroupResources' :: ListGroupResources -> Maybe [ResourceFilter]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Filters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ResourceFilter]
filters,
            (Key
"Group" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
group',
            (Key
"GroupName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
groupName,
            (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken
          ]
      )

instance Data.ToPath ListGroupResources where
  toPath :: ListGroupResources -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/list-group-resources"

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

-- | /See:/ 'newListGroupResourcesResponse' smart constructor.
data ListGroupResourcesResponse = ListGroupResourcesResponse'
  { -- | 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@.
    ListGroupResourcesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | 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@.
    ListGroupResourcesResponse -> Maybe [QueryError]
queryErrors :: Prelude.Maybe [QueryError],
    -- | __/Deprecated - don\'t use this parameter. Use the @Resources@ response
    -- field instead./__
    ListGroupResourcesResponse -> Maybe [ResourceIdentifier]
resourceIdentifiers :: Prelude.Maybe [ResourceIdentifier],
    -- | An array of resources from which you can determine each resource\'s
    -- identity, type, and group membership status.
    ListGroupResourcesResponse -> Maybe [ListGroupResourcesItem]
resources :: Prelude.Maybe [ListGroupResourcesItem],
    -- | The response's http status code.
    ListGroupResourcesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListGroupResourcesResponse -> ListGroupResourcesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListGroupResourcesResponse -> ListGroupResourcesResponse -> Bool
$c/= :: ListGroupResourcesResponse -> ListGroupResourcesResponse -> Bool
== :: ListGroupResourcesResponse -> ListGroupResourcesResponse -> Bool
$c== :: ListGroupResourcesResponse -> ListGroupResourcesResponse -> Bool
Prelude.Eq, ReadPrec [ListGroupResourcesResponse]
ReadPrec ListGroupResourcesResponse
Int -> ReadS ListGroupResourcesResponse
ReadS [ListGroupResourcesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListGroupResourcesResponse]
$creadListPrec :: ReadPrec [ListGroupResourcesResponse]
readPrec :: ReadPrec ListGroupResourcesResponse
$creadPrec :: ReadPrec ListGroupResourcesResponse
readList :: ReadS [ListGroupResourcesResponse]
$creadList :: ReadS [ListGroupResourcesResponse]
readsPrec :: Int -> ReadS ListGroupResourcesResponse
$creadsPrec :: Int -> ReadS ListGroupResourcesResponse
Prelude.Read, Int -> ListGroupResourcesResponse -> ShowS
[ListGroupResourcesResponse] -> ShowS
ListGroupResourcesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListGroupResourcesResponse] -> ShowS
$cshowList :: [ListGroupResourcesResponse] -> ShowS
show :: ListGroupResourcesResponse -> String
$cshow :: ListGroupResourcesResponse -> String
showsPrec :: Int -> ListGroupResourcesResponse -> ShowS
$cshowsPrec :: Int -> ListGroupResourcesResponse -> ShowS
Prelude.Show, forall x.
Rep ListGroupResourcesResponse x -> ListGroupResourcesResponse
forall x.
ListGroupResourcesResponse -> Rep ListGroupResourcesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListGroupResourcesResponse x -> ListGroupResourcesResponse
$cfrom :: forall x.
ListGroupResourcesResponse -> Rep ListGroupResourcesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListGroupResourcesResponse' 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', 'listGroupResourcesResponse_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@.
--
-- 'queryErrors', 'listGroupResourcesResponse_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@.
--
-- 'resourceIdentifiers', 'listGroupResourcesResponse_resourceIdentifiers' - __/Deprecated - don\'t use this parameter. Use the @Resources@ response
-- field instead./__
--
-- 'resources', 'listGroupResourcesResponse_resources' - An array of resources from which you can determine each resource\'s
-- identity, type, and group membership status.
--
-- 'httpStatus', 'listGroupResourcesResponse_httpStatus' - The response's http status code.
newListGroupResourcesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListGroupResourcesResponse
newListGroupResourcesResponse :: Int -> ListGroupResourcesResponse
newListGroupResourcesResponse Int
pHttpStatus_ =
  ListGroupResourcesResponse'
    { $sel:nextToken:ListGroupResourcesResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:queryErrors:ListGroupResourcesResponse' :: Maybe [QueryError]
queryErrors = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceIdentifiers:ListGroupResourcesResponse' :: Maybe [ResourceIdentifier]
resourceIdentifiers = forall a. Maybe a
Prelude.Nothing,
      $sel:resources:ListGroupResourcesResponse' :: Maybe [ListGroupResourcesItem]
resources = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListGroupResourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | 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@.
listGroupResourcesResponse_nextToken :: Lens.Lens' ListGroupResourcesResponse (Prelude.Maybe Prelude.Text)
listGroupResourcesResponse_nextToken :: Lens' ListGroupResourcesResponse (Maybe Text)
listGroupResourcesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupResourcesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListGroupResourcesResponse' :: ListGroupResourcesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListGroupResourcesResponse
s@ListGroupResourcesResponse' {} Maybe Text
a -> ListGroupResourcesResponse
s {$sel:nextToken:ListGroupResourcesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListGroupResourcesResponse)

-- | 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@.
listGroupResourcesResponse_queryErrors :: Lens.Lens' ListGroupResourcesResponse (Prelude.Maybe [QueryError])
listGroupResourcesResponse_queryErrors :: Lens' ListGroupResourcesResponse (Maybe [QueryError])
listGroupResourcesResponse_queryErrors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupResourcesResponse' {Maybe [QueryError]
queryErrors :: Maybe [QueryError]
$sel:queryErrors:ListGroupResourcesResponse' :: ListGroupResourcesResponse -> Maybe [QueryError]
queryErrors} -> Maybe [QueryError]
queryErrors) (\s :: ListGroupResourcesResponse
s@ListGroupResourcesResponse' {} Maybe [QueryError]
a -> ListGroupResourcesResponse
s {$sel:queryErrors:ListGroupResourcesResponse' :: Maybe [QueryError]
queryErrors = Maybe [QueryError]
a} :: ListGroupResourcesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | __/Deprecated - don\'t use this parameter. Use the @Resources@ response
-- field instead./__
listGroupResourcesResponse_resourceIdentifiers :: Lens.Lens' ListGroupResourcesResponse (Prelude.Maybe [ResourceIdentifier])
listGroupResourcesResponse_resourceIdentifiers :: Lens' ListGroupResourcesResponse (Maybe [ResourceIdentifier])
listGroupResourcesResponse_resourceIdentifiers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupResourcesResponse' {Maybe [ResourceIdentifier]
resourceIdentifiers :: Maybe [ResourceIdentifier]
$sel:resourceIdentifiers:ListGroupResourcesResponse' :: ListGroupResourcesResponse -> Maybe [ResourceIdentifier]
resourceIdentifiers} -> Maybe [ResourceIdentifier]
resourceIdentifiers) (\s :: ListGroupResourcesResponse
s@ListGroupResourcesResponse' {} Maybe [ResourceIdentifier]
a -> ListGroupResourcesResponse
s {$sel:resourceIdentifiers:ListGroupResourcesResponse' :: Maybe [ResourceIdentifier]
resourceIdentifiers = Maybe [ResourceIdentifier]
a} :: ListGroupResourcesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An array of resources from which you can determine each resource\'s
-- identity, type, and group membership status.
listGroupResourcesResponse_resources :: Lens.Lens' ListGroupResourcesResponse (Prelude.Maybe [ListGroupResourcesItem])
listGroupResourcesResponse_resources :: Lens' ListGroupResourcesResponse (Maybe [ListGroupResourcesItem])
listGroupResourcesResponse_resources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupResourcesResponse' {Maybe [ListGroupResourcesItem]
resources :: Maybe [ListGroupResourcesItem]
$sel:resources:ListGroupResourcesResponse' :: ListGroupResourcesResponse -> Maybe [ListGroupResourcesItem]
resources} -> Maybe [ListGroupResourcesItem]
resources) (\s :: ListGroupResourcesResponse
s@ListGroupResourcesResponse' {} Maybe [ListGroupResourcesItem]
a -> ListGroupResourcesResponse
s {$sel:resources:ListGroupResourcesResponse' :: Maybe [ListGroupResourcesItem]
resources = Maybe [ListGroupResourcesItem]
a} :: ListGroupResourcesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListGroupResourcesResponse where
  rnf :: ListGroupResourcesResponse -> ()
rnf ListGroupResourcesResponse' {Int
Maybe [QueryError]
Maybe [ResourceIdentifier]
Maybe [ListGroupResourcesItem]
Maybe Text
httpStatus :: Int
resources :: Maybe [ListGroupResourcesItem]
resourceIdentifiers :: Maybe [ResourceIdentifier]
queryErrors :: Maybe [QueryError]
nextToken :: Maybe Text
$sel:httpStatus:ListGroupResourcesResponse' :: ListGroupResourcesResponse -> Int
$sel:resources:ListGroupResourcesResponse' :: ListGroupResourcesResponse -> Maybe [ListGroupResourcesItem]
$sel:resourceIdentifiers:ListGroupResourcesResponse' :: ListGroupResourcesResponse -> Maybe [ResourceIdentifier]
$sel:queryErrors:ListGroupResourcesResponse' :: ListGroupResourcesResponse -> Maybe [QueryError]
$sel:nextToken:ListGroupResourcesResponse' :: ListGroupResourcesResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [QueryError]
queryErrors
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ResourceIdentifier]
resourceIdentifiers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ListGroupResourcesItem]
resources
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus