{-# 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.CloudControl.ListResources
-- 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 information about the specified resources. For more information,
-- see
-- <cloudcontrolapi/latest/userguide/resource-operations-list.html Discovering resources>
-- in the /Amazon Web Services Cloud Control API User Guide/.
--
-- You can use this action to return information about existing resources
-- in your account and Amazon Web Services Region, whether or not those
-- resources were provisioned using Cloud Control API.
module Amazonka.CloudControl.ListResources
  ( -- * Creating a Request
    ListResources (..),
    newListResources,

    -- * Request Lenses
    listResources_resourceModel,
    listResources_nextToken,
    listResources_typeVersionId,
    listResources_maxResults,
    listResources_roleArn,
    listResources_typeName,

    -- * Destructuring the Response
    ListResourcesResponse (..),
    newListResourcesResponse,

    -- * Response Lenses
    listResourcesResponse_resourceDescriptions,
    listResourcesResponse_typeName,
    listResourcesResponse_nextToken,
    listResourcesResponse_httpStatus,
  )
where

import Amazonka.CloudControl.Types
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 qualified Amazonka.Response as Response

-- | /See:/ 'newListResources' smart constructor.
data ListResources = ListResources'
  { -- | The resource model to use to select the resources to return.
    ListResources -> Maybe (Sensitive Text)
resourceModel :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | If the previous paginated request didn\'t return all of the remaining
    -- results, the response object\'s @NextToken@ parameter value is set to a
    -- token. To retrieve the next set of results, call this action again and
    -- assign that token to the request object\'s @NextToken@ parameter. If
    -- there are no remaining results, the previous response object\'s
    -- @NextToken@ parameter is set to @null@.
    ListResources -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | For private resource types, the type version to use in this resource
    -- operation. If you do not specify a resource version, CloudFormation uses
    -- the default version.
    ListResources -> Maybe Text
typeVersionId :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to be returned with a single call. If the
    -- number of available results exceeds this maximum, the response includes
    -- a @NextToken@ value that you can assign to the @NextToken@ request
    -- parameter to get the next set of results.
    --
    -- The default is @20@.
    ListResources -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Name (ARN) of the Identity and Access Management
    -- (IAM) for Cloud Control API to use when performing this resource
    -- operation. The role specified must have the permissions required for
    -- this operation. The necessary permissions for each event handler are
    -- defined in the @ handlers @ section of the
    -- <https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-schema.html resource type definition schema>.
    --
    -- If you do not specify a role, Cloud Control API uses a temporary session
    -- created using your Amazon Web Services user credentials.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations.html#resource-operations-permissions Specifying credentials>
    -- in the /Amazon Web Services Cloud Control API User Guide/.
    ListResources -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the resource type.
    ListResources -> Text
typeName :: Prelude.Text
  }
  deriving (ListResources -> ListResources -> Bool
(ListResources -> ListResources -> Bool)
-> (ListResources -> ListResources -> Bool) -> Eq ListResources
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResources -> ListResources -> Bool
$c/= :: ListResources -> ListResources -> Bool
== :: ListResources -> ListResources -> Bool
$c== :: ListResources -> ListResources -> Bool
Prelude.Eq, Int -> ListResources -> ShowS
[ListResources] -> ShowS
ListResources -> String
(Int -> ListResources -> ShowS)
-> (ListResources -> String)
-> ([ListResources] -> ShowS)
-> Show ListResources
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResources] -> ShowS
$cshowList :: [ListResources] -> ShowS
show :: ListResources -> String
$cshow :: ListResources -> String
showsPrec :: Int -> ListResources -> ShowS
$cshowsPrec :: Int -> ListResources -> ShowS
Prelude.Show, (forall x. ListResources -> Rep ListResources x)
-> (forall x. Rep ListResources x -> ListResources)
-> Generic ListResources
forall x. Rep ListResources x -> ListResources
forall x. ListResources -> Rep ListResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListResources x -> ListResources
$cfrom :: forall x. ListResources -> Rep ListResources x
Prelude.Generic)

-- |
-- Create a value of 'ListResources' 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:
--
-- 'resourceModel', 'listResources_resourceModel' - The resource model to use to select the resources to return.
--
-- 'nextToken', 'listResources_nextToken' - If the previous paginated request didn\'t return all of the remaining
-- results, the response object\'s @NextToken@ parameter value is set to a
-- token. To retrieve the next set of results, call this action again and
-- assign that token to the request object\'s @NextToken@ parameter. If
-- there are no remaining results, the previous response object\'s
-- @NextToken@ parameter is set to @null@.
--
-- 'typeVersionId', 'listResources_typeVersionId' - For private resource types, the type version to use in this resource
-- operation. If you do not specify a resource version, CloudFormation uses
-- the default version.
--
-- 'maxResults', 'listResources_maxResults' - The maximum number of results to be returned with a single call. If the
-- number of available results exceeds this maximum, the response includes
-- a @NextToken@ value that you can assign to the @NextToken@ request
-- parameter to get the next set of results.
--
-- The default is @20@.
--
-- 'roleArn', 'listResources_roleArn' - The Amazon Resource Name (ARN) of the Identity and Access Management
-- (IAM) for Cloud Control API to use when performing this resource
-- operation. The role specified must have the permissions required for
-- this operation. The necessary permissions for each event handler are
-- defined in the @ handlers @ section of the
-- <https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-schema.html resource type definition schema>.
--
-- If you do not specify a role, Cloud Control API uses a temporary session
-- created using your Amazon Web Services user credentials.
--
-- For more information, see
-- <https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations.html#resource-operations-permissions Specifying credentials>
-- in the /Amazon Web Services Cloud Control API User Guide/.
--
-- 'typeName', 'listResources_typeName' - The name of the resource type.
newListResources ::
  -- | 'typeName'
  Prelude.Text ->
  ListResources
newListResources :: Text -> ListResources
newListResources Text
pTypeName_ =
  ListResources' :: Maybe (Sensitive Text)
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Text
-> ListResources
ListResources'
    { $sel:resourceModel:ListResources' :: Maybe (Sensitive Text)
resourceModel = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListResources' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:typeVersionId:ListResources' :: Maybe Text
typeVersionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListResources' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:ListResources' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:typeName:ListResources' :: Text
typeName = Text
pTypeName_
    }

-- | The resource model to use to select the resources to return.
listResources_resourceModel :: Lens.Lens' ListResources (Prelude.Maybe Prelude.Text)
listResources_resourceModel :: (Maybe Text -> f (Maybe Text)) -> ListResources -> f ListResources
listResources_resourceModel = (ListResources -> Maybe (Sensitive Text))
-> (ListResources -> Maybe (Sensitive Text) -> ListResources)
-> Lens
     ListResources
     ListResources
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResources' {Maybe (Sensitive Text)
resourceModel :: Maybe (Sensitive Text)
$sel:resourceModel:ListResources' :: ListResources -> Maybe (Sensitive Text)
resourceModel} -> Maybe (Sensitive Text)
resourceModel) (\s :: ListResources
s@ListResources' {} Maybe (Sensitive Text)
a -> ListResources
s {$sel:resourceModel:ListResources' :: Maybe (Sensitive Text)
resourceModel = Maybe (Sensitive Text)
a} :: ListResources) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> ListResources -> f ListResources)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ListResources
-> f ListResources
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | If the previous paginated request didn\'t return all of the remaining
-- results, the response object\'s @NextToken@ parameter value is set to a
-- token. To retrieve the next set of results, call this action again and
-- assign that token to the request object\'s @NextToken@ parameter. If
-- there are no remaining results, the previous response object\'s
-- @NextToken@ parameter is set to @null@.
listResources_nextToken :: Lens.Lens' ListResources (Prelude.Maybe Prelude.Text)
listResources_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListResources -> f ListResources
listResources_nextToken = (ListResources -> Maybe Text)
-> (ListResources -> Maybe Text -> ListResources)
-> Lens ListResources ListResources (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResources' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResources' :: ListResources -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResources
s@ListResources' {} Maybe Text
a -> ListResources
s {$sel:nextToken:ListResources' :: Maybe Text
nextToken = Maybe Text
a} :: ListResources)

-- | For private resource types, the type version to use in this resource
-- operation. If you do not specify a resource version, CloudFormation uses
-- the default version.
listResources_typeVersionId :: Lens.Lens' ListResources (Prelude.Maybe Prelude.Text)
listResources_typeVersionId :: (Maybe Text -> f (Maybe Text)) -> ListResources -> f ListResources
listResources_typeVersionId = (ListResources -> Maybe Text)
-> (ListResources -> Maybe Text -> ListResources)
-> Lens ListResources ListResources (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResources' {Maybe Text
typeVersionId :: Maybe Text
$sel:typeVersionId:ListResources' :: ListResources -> Maybe Text
typeVersionId} -> Maybe Text
typeVersionId) (\s :: ListResources
s@ListResources' {} Maybe Text
a -> ListResources
s {$sel:typeVersionId:ListResources' :: Maybe Text
typeVersionId = Maybe Text
a} :: ListResources)

-- | The maximum number of results to be returned with a single call. If the
-- number of available results exceeds this maximum, the response includes
-- a @NextToken@ value that you can assign to the @NextToken@ request
-- parameter to get the next set of results.
--
-- The default is @20@.
listResources_maxResults :: Lens.Lens' ListResources (Prelude.Maybe Prelude.Natural)
listResources_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListResources -> f ListResources
listResources_maxResults = (ListResources -> Maybe Natural)
-> (ListResources -> Maybe Natural -> ListResources)
-> Lens ListResources ListResources (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResources' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListResources' :: ListResources -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListResources
s@ListResources' {} Maybe Natural
a -> ListResources
s {$sel:maxResults:ListResources' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListResources)

-- | The Amazon Resource Name (ARN) of the Identity and Access Management
-- (IAM) for Cloud Control API to use when performing this resource
-- operation. The role specified must have the permissions required for
-- this operation. The necessary permissions for each event handler are
-- defined in the @ handlers @ section of the
-- <https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-schema.html resource type definition schema>.
--
-- If you do not specify a role, Cloud Control API uses a temporary session
-- created using your Amazon Web Services user credentials.
--
-- For more information, see
-- <https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations.html#resource-operations-permissions Specifying credentials>
-- in the /Amazon Web Services Cloud Control API User Guide/.
listResources_roleArn :: Lens.Lens' ListResources (Prelude.Maybe Prelude.Text)
listResources_roleArn :: (Maybe Text -> f (Maybe Text)) -> ListResources -> f ListResources
listResources_roleArn = (ListResources -> Maybe Text)
-> (ListResources -> Maybe Text -> ListResources)
-> Lens ListResources ListResources (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResources' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:ListResources' :: ListResources -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: ListResources
s@ListResources' {} Maybe Text
a -> ListResources
s {$sel:roleArn:ListResources' :: Maybe Text
roleArn = Maybe Text
a} :: ListResources)

-- | The name of the resource type.
listResources_typeName :: Lens.Lens' ListResources Prelude.Text
listResources_typeName :: (Text -> f Text) -> ListResources -> f ListResources
listResources_typeName = (ListResources -> Text)
-> (ListResources -> Text -> ListResources)
-> Lens ListResources ListResources Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResources' {Text
typeName :: Text
$sel:typeName:ListResources' :: ListResources -> Text
typeName} -> Text
typeName) (\s :: ListResources
s@ListResources' {} Text
a -> ListResources
s {$sel:typeName:ListResources' :: Text
typeName = Text
a} :: ListResources)

instance Core.AWSRequest ListResources where
  type
    AWSResponse ListResources =
      ListResourcesResponse
  request :: ListResources -> Request ListResources
request = Service -> ListResources -> Request ListResources
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListResources
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListResources)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListResources))
-> Logger
-> Service
-> Proxy ListResources
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListResources)))
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 [ResourceDescription]
-> Maybe Text -> Maybe Text -> Int -> ListResourcesResponse
ListResourcesResponse'
            (Maybe [ResourceDescription]
 -> Maybe Text -> Maybe Text -> Int -> ListResourcesResponse)
-> Either String (Maybe [ResourceDescription])
-> Either
     String (Maybe Text -> Maybe Text -> Int -> ListResourcesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [ResourceDescription]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResourceDescriptions"
                            Either String (Maybe (Maybe [ResourceDescription]))
-> Maybe [ResourceDescription]
-> Either String (Maybe [ResourceDescription])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ResourceDescription]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String (Maybe Text -> Maybe Text -> Int -> ListResourcesResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> ListResourcesResponse)
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
"TypeName")
            Either String (Maybe Text -> Int -> ListResourcesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListResourcesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either String (Int -> ListResourcesResponse)
-> Either String Int -> Either String ListResourcesResponse
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 ListResources

instance Prelude.NFData ListResources

instance Core.ToHeaders ListResources where
  toHeaders :: ListResources -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListResources -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"CloudApiService.ListResources" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ListResources where
  toJSON :: ListResources -> Value
toJSON ListResources' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Text
typeName :: Text
roleArn :: Maybe Text
maxResults :: Maybe Natural
typeVersionId :: Maybe Text
nextToken :: Maybe Text
resourceModel :: Maybe (Sensitive Text)
$sel:typeName:ListResources' :: ListResources -> Text
$sel:roleArn:ListResources' :: ListResources -> Maybe Text
$sel:maxResults:ListResources' :: ListResources -> Maybe Natural
$sel:typeVersionId:ListResources' :: ListResources -> Maybe Text
$sel:nextToken:ListResources' :: ListResources -> Maybe Text
$sel:resourceModel:ListResources' :: ListResources -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ResourceModel" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
resourceModel,
            (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
"TypeVersionId" 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
typeVersionId,
            (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,
            (Text
"RoleArn" 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
roleArn,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TypeName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
typeName)
          ]
      )

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

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

-- | /See:/ 'newListResourcesResponse' smart constructor.
data ListResourcesResponse = ListResourcesResponse'
  { -- | Information about the specified resources, including primary identifier
    -- and resource model.
    ListResourcesResponse -> Maybe [ResourceDescription]
resourceDescriptions :: Prelude.Maybe [ResourceDescription],
    -- | The name of the resource type.
    ListResourcesResponse -> Maybe Text
typeName :: Prelude.Maybe Prelude.Text,
    -- | If the request doesn\'t return all of the remaining results, @NextToken@
    -- is set to a token. To retrieve the next set of results, call
    -- @ListResources@ again and assign that token to the request object\'s
    -- @NextToken@ parameter. If the request returns all results, @NextToken@
    -- is set to null.
    ListResourcesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListResourcesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListResourcesResponse -> ListResourcesResponse -> Bool
(ListResourcesResponse -> ListResourcesResponse -> Bool)
-> (ListResourcesResponse -> ListResourcesResponse -> Bool)
-> Eq ListResourcesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourcesResponse -> ListResourcesResponse -> Bool
$c/= :: ListResourcesResponse -> ListResourcesResponse -> Bool
== :: ListResourcesResponse -> ListResourcesResponse -> Bool
$c== :: ListResourcesResponse -> ListResourcesResponse -> Bool
Prelude.Eq, Int -> ListResourcesResponse -> ShowS
[ListResourcesResponse] -> ShowS
ListResourcesResponse -> String
(Int -> ListResourcesResponse -> ShowS)
-> (ListResourcesResponse -> String)
-> ([ListResourcesResponse] -> ShowS)
-> Show ListResourcesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourcesResponse] -> ShowS
$cshowList :: [ListResourcesResponse] -> ShowS
show :: ListResourcesResponse -> String
$cshow :: ListResourcesResponse -> String
showsPrec :: Int -> ListResourcesResponse -> ShowS
$cshowsPrec :: Int -> ListResourcesResponse -> ShowS
Prelude.Show, (forall x. ListResourcesResponse -> Rep ListResourcesResponse x)
-> (forall x. Rep ListResourcesResponse x -> ListResourcesResponse)
-> Generic ListResourcesResponse
forall x. Rep ListResourcesResponse x -> ListResourcesResponse
forall x. ListResourcesResponse -> Rep ListResourcesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListResourcesResponse x -> ListResourcesResponse
$cfrom :: forall x. ListResourcesResponse -> Rep ListResourcesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListResourcesResponse' 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:
--
-- 'resourceDescriptions', 'listResourcesResponse_resourceDescriptions' - Information about the specified resources, including primary identifier
-- and resource model.
--
-- 'typeName', 'listResourcesResponse_typeName' - The name of the resource type.
--
-- 'nextToken', 'listResourcesResponse_nextToken' - If the request doesn\'t return all of the remaining results, @NextToken@
-- is set to a token. To retrieve the next set of results, call
-- @ListResources@ again and assign that token to the request object\'s
-- @NextToken@ parameter. If the request returns all results, @NextToken@
-- is set to null.
--
-- 'httpStatus', 'listResourcesResponse_httpStatus' - The response's http status code.
newListResourcesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListResourcesResponse
newListResourcesResponse :: Int -> ListResourcesResponse
newListResourcesResponse Int
pHttpStatus_ =
  ListResourcesResponse' :: Maybe [ResourceDescription]
-> Maybe Text -> Maybe Text -> Int -> ListResourcesResponse
ListResourcesResponse'
    { $sel:resourceDescriptions:ListResourcesResponse' :: Maybe [ResourceDescription]
resourceDescriptions =
        Maybe [ResourceDescription]
forall a. Maybe a
Prelude.Nothing,
      $sel:typeName:ListResourcesResponse' :: Maybe Text
typeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListResourcesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListResourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the specified resources, including primary identifier
-- and resource model.
listResourcesResponse_resourceDescriptions :: Lens.Lens' ListResourcesResponse (Prelude.Maybe [ResourceDescription])
listResourcesResponse_resourceDescriptions :: (Maybe [ResourceDescription] -> f (Maybe [ResourceDescription]))
-> ListResourcesResponse -> f ListResourcesResponse
listResourcesResponse_resourceDescriptions = (ListResourcesResponse -> Maybe [ResourceDescription])
-> (ListResourcesResponse
    -> Maybe [ResourceDescription] -> ListResourcesResponse)
-> Lens
     ListResourcesResponse
     ListResourcesResponse
     (Maybe [ResourceDescription])
     (Maybe [ResourceDescription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesResponse' {Maybe [ResourceDescription]
resourceDescriptions :: Maybe [ResourceDescription]
$sel:resourceDescriptions:ListResourcesResponse' :: ListResourcesResponse -> Maybe [ResourceDescription]
resourceDescriptions} -> Maybe [ResourceDescription]
resourceDescriptions) (\s :: ListResourcesResponse
s@ListResourcesResponse' {} Maybe [ResourceDescription]
a -> ListResourcesResponse
s {$sel:resourceDescriptions:ListResourcesResponse' :: Maybe [ResourceDescription]
resourceDescriptions = Maybe [ResourceDescription]
a} :: ListResourcesResponse) ((Maybe [ResourceDescription] -> f (Maybe [ResourceDescription]))
 -> ListResourcesResponse -> f ListResourcesResponse)
-> ((Maybe [ResourceDescription]
     -> f (Maybe [ResourceDescription]))
    -> Maybe [ResourceDescription] -> f (Maybe [ResourceDescription]))
-> (Maybe [ResourceDescription] -> f (Maybe [ResourceDescription]))
-> ListResourcesResponse
-> f ListResourcesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ResourceDescription]
  [ResourceDescription]
  [ResourceDescription]
  [ResourceDescription]
-> Iso
     (Maybe [ResourceDescription])
     (Maybe [ResourceDescription])
     (Maybe [ResourceDescription])
     (Maybe [ResourceDescription])
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
  [ResourceDescription]
  [ResourceDescription]
  [ResourceDescription]
  [ResourceDescription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the resource type.
listResourcesResponse_typeName :: Lens.Lens' ListResourcesResponse (Prelude.Maybe Prelude.Text)
listResourcesResponse_typeName :: (Maybe Text -> f (Maybe Text))
-> ListResourcesResponse -> f ListResourcesResponse
listResourcesResponse_typeName = (ListResourcesResponse -> Maybe Text)
-> (ListResourcesResponse -> Maybe Text -> ListResourcesResponse)
-> Lens
     ListResourcesResponse
     ListResourcesResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesResponse' {Maybe Text
typeName :: Maybe Text
$sel:typeName:ListResourcesResponse' :: ListResourcesResponse -> Maybe Text
typeName} -> Maybe Text
typeName) (\s :: ListResourcesResponse
s@ListResourcesResponse' {} Maybe Text
a -> ListResourcesResponse
s {$sel:typeName:ListResourcesResponse' :: Maybe Text
typeName = Maybe Text
a} :: ListResourcesResponse)

-- | If the request doesn\'t return all of the remaining results, @NextToken@
-- is set to a token. To retrieve the next set of results, call
-- @ListResources@ again and assign that token to the request object\'s
-- @NextToken@ parameter. If the request returns all results, @NextToken@
-- is set to null.
listResourcesResponse_nextToken :: Lens.Lens' ListResourcesResponse (Prelude.Maybe Prelude.Text)
listResourcesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListResourcesResponse -> f ListResourcesResponse
listResourcesResponse_nextToken = (ListResourcesResponse -> Maybe Text)
-> (ListResourcesResponse -> Maybe Text -> ListResourcesResponse)
-> Lens
     ListResourcesResponse
     ListResourcesResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResourcesResponse' :: ListResourcesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResourcesResponse
s@ListResourcesResponse' {} Maybe Text
a -> ListResourcesResponse
s {$sel:nextToken:ListResourcesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListResourcesResponse)

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

instance Prelude.NFData ListResourcesResponse