{-# 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.ServiceCatalog.ListResourcesForTagOption
-- 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)
--
-- Lists the resources associated with the specified TagOption.
--
-- This operation returns paginated results.
module Amazonka.ServiceCatalog.ListResourcesForTagOption
  ( -- * Creating a Request
    ListResourcesForTagOption (..),
    newListResourcesForTagOption,

    -- * Request Lenses
    listResourcesForTagOption_resourceType,
    listResourcesForTagOption_pageToken,
    listResourcesForTagOption_pageSize,
    listResourcesForTagOption_tagOptionId,

    -- * Destructuring the Response
    ListResourcesForTagOptionResponse (..),
    newListResourcesForTagOptionResponse,

    -- * Response Lenses
    listResourcesForTagOptionResponse_resourceDetails,
    listResourcesForTagOptionResponse_pageToken,
    listResourcesForTagOptionResponse_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 qualified Amazonka.Response as Response
import Amazonka.ServiceCatalog.Types

-- | /See:/ 'newListResourcesForTagOption' smart constructor.
data ListResourcesForTagOption = ListResourcesForTagOption'
  { -- | The resource type.
    --
    -- -   @Portfolio@
    --
    -- -   @Product@
    ListResourcesForTagOption -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
    -- | The page token for the next set of results. To retrieve the first set of
    -- results, use null.
    ListResourcesForTagOption -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return with this call.
    ListResourcesForTagOption -> Maybe Natural
pageSize :: Prelude.Maybe Prelude.Natural,
    -- | The TagOption identifier.
    ListResourcesForTagOption -> Text
tagOptionId :: Prelude.Text
  }
  deriving (ListResourcesForTagOption -> ListResourcesForTagOption -> Bool
(ListResourcesForTagOption -> ListResourcesForTagOption -> Bool)
-> (ListResourcesForTagOption -> ListResourcesForTagOption -> Bool)
-> Eq ListResourcesForTagOption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourcesForTagOption -> ListResourcesForTagOption -> Bool
$c/= :: ListResourcesForTagOption -> ListResourcesForTagOption -> Bool
== :: ListResourcesForTagOption -> ListResourcesForTagOption -> Bool
$c== :: ListResourcesForTagOption -> ListResourcesForTagOption -> Bool
Prelude.Eq, ReadPrec [ListResourcesForTagOption]
ReadPrec ListResourcesForTagOption
Int -> ReadS ListResourcesForTagOption
ReadS [ListResourcesForTagOption]
(Int -> ReadS ListResourcesForTagOption)
-> ReadS [ListResourcesForTagOption]
-> ReadPrec ListResourcesForTagOption
-> ReadPrec [ListResourcesForTagOption]
-> Read ListResourcesForTagOption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResourcesForTagOption]
$creadListPrec :: ReadPrec [ListResourcesForTagOption]
readPrec :: ReadPrec ListResourcesForTagOption
$creadPrec :: ReadPrec ListResourcesForTagOption
readList :: ReadS [ListResourcesForTagOption]
$creadList :: ReadS [ListResourcesForTagOption]
readsPrec :: Int -> ReadS ListResourcesForTagOption
$creadsPrec :: Int -> ReadS ListResourcesForTagOption
Prelude.Read, Int -> ListResourcesForTagOption -> ShowS
[ListResourcesForTagOption] -> ShowS
ListResourcesForTagOption -> String
(Int -> ListResourcesForTagOption -> ShowS)
-> (ListResourcesForTagOption -> String)
-> ([ListResourcesForTagOption] -> ShowS)
-> Show ListResourcesForTagOption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourcesForTagOption] -> ShowS
$cshowList :: [ListResourcesForTagOption] -> ShowS
show :: ListResourcesForTagOption -> String
$cshow :: ListResourcesForTagOption -> String
showsPrec :: Int -> ListResourcesForTagOption -> ShowS
$cshowsPrec :: Int -> ListResourcesForTagOption -> ShowS
Prelude.Show, (forall x.
 ListResourcesForTagOption -> Rep ListResourcesForTagOption x)
-> (forall x.
    Rep ListResourcesForTagOption x -> ListResourcesForTagOption)
-> Generic ListResourcesForTagOption
forall x.
Rep ListResourcesForTagOption x -> ListResourcesForTagOption
forall x.
ListResourcesForTagOption -> Rep ListResourcesForTagOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListResourcesForTagOption x -> ListResourcesForTagOption
$cfrom :: forall x.
ListResourcesForTagOption -> Rep ListResourcesForTagOption x
Prelude.Generic)

-- |
-- Create a value of 'ListResourcesForTagOption' 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:
--
-- 'resourceType', 'listResourcesForTagOption_resourceType' - The resource type.
--
-- -   @Portfolio@
--
-- -   @Product@
--
-- 'pageToken', 'listResourcesForTagOption_pageToken' - The page token for the next set of results. To retrieve the first set of
-- results, use null.
--
-- 'pageSize', 'listResourcesForTagOption_pageSize' - The maximum number of items to return with this call.
--
-- 'tagOptionId', 'listResourcesForTagOption_tagOptionId' - The TagOption identifier.
newListResourcesForTagOption ::
  -- | 'tagOptionId'
  Prelude.Text ->
  ListResourcesForTagOption
newListResourcesForTagOption :: Text -> ListResourcesForTagOption
newListResourcesForTagOption Text
pTagOptionId_ =
  ListResourcesForTagOption' :: Maybe Text
-> Maybe Text -> Maybe Natural -> Text -> ListResourcesForTagOption
ListResourcesForTagOption'
    { $sel:resourceType:ListResourcesForTagOption' :: Maybe Text
resourceType =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pageToken:ListResourcesForTagOption' :: Maybe Text
pageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pageSize:ListResourcesForTagOption' :: Maybe Natural
pageSize = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:tagOptionId:ListResourcesForTagOption' :: Text
tagOptionId = Text
pTagOptionId_
    }

-- | The resource type.
--
-- -   @Portfolio@
--
-- -   @Product@
listResourcesForTagOption_resourceType :: Lens.Lens' ListResourcesForTagOption (Prelude.Maybe Prelude.Text)
listResourcesForTagOption_resourceType :: (Maybe Text -> f (Maybe Text))
-> ListResourcesForTagOption -> f ListResourcesForTagOption
listResourcesForTagOption_resourceType = (ListResourcesForTagOption -> Maybe Text)
-> (ListResourcesForTagOption
    -> Maybe Text -> ListResourcesForTagOption)
-> Lens
     ListResourcesForTagOption
     ListResourcesForTagOption
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesForTagOption' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:ListResourcesForTagOption' :: ListResourcesForTagOption -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: ListResourcesForTagOption
s@ListResourcesForTagOption' {} Maybe Text
a -> ListResourcesForTagOption
s {$sel:resourceType:ListResourcesForTagOption' :: Maybe Text
resourceType = Maybe Text
a} :: ListResourcesForTagOption)

-- | The page token for the next set of results. To retrieve the first set of
-- results, use null.
listResourcesForTagOption_pageToken :: Lens.Lens' ListResourcesForTagOption (Prelude.Maybe Prelude.Text)
listResourcesForTagOption_pageToken :: (Maybe Text -> f (Maybe Text))
-> ListResourcesForTagOption -> f ListResourcesForTagOption
listResourcesForTagOption_pageToken = (ListResourcesForTagOption -> Maybe Text)
-> (ListResourcesForTagOption
    -> Maybe Text -> ListResourcesForTagOption)
-> Lens
     ListResourcesForTagOption
     ListResourcesForTagOption
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesForTagOption' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:ListResourcesForTagOption' :: ListResourcesForTagOption -> Maybe Text
pageToken} -> Maybe Text
pageToken) (\s :: ListResourcesForTagOption
s@ListResourcesForTagOption' {} Maybe Text
a -> ListResourcesForTagOption
s {$sel:pageToken:ListResourcesForTagOption' :: Maybe Text
pageToken = Maybe Text
a} :: ListResourcesForTagOption)

-- | The maximum number of items to return with this call.
listResourcesForTagOption_pageSize :: Lens.Lens' ListResourcesForTagOption (Prelude.Maybe Prelude.Natural)
listResourcesForTagOption_pageSize :: (Maybe Natural -> f (Maybe Natural))
-> ListResourcesForTagOption -> f ListResourcesForTagOption
listResourcesForTagOption_pageSize = (ListResourcesForTagOption -> Maybe Natural)
-> (ListResourcesForTagOption
    -> Maybe Natural -> ListResourcesForTagOption)
-> Lens
     ListResourcesForTagOption
     ListResourcesForTagOption
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesForTagOption' {Maybe Natural
pageSize :: Maybe Natural
$sel:pageSize:ListResourcesForTagOption' :: ListResourcesForTagOption -> Maybe Natural
pageSize} -> Maybe Natural
pageSize) (\s :: ListResourcesForTagOption
s@ListResourcesForTagOption' {} Maybe Natural
a -> ListResourcesForTagOption
s {$sel:pageSize:ListResourcesForTagOption' :: Maybe Natural
pageSize = Maybe Natural
a} :: ListResourcesForTagOption)

-- | The TagOption identifier.
listResourcesForTagOption_tagOptionId :: Lens.Lens' ListResourcesForTagOption Prelude.Text
listResourcesForTagOption_tagOptionId :: (Text -> f Text)
-> ListResourcesForTagOption -> f ListResourcesForTagOption
listResourcesForTagOption_tagOptionId = (ListResourcesForTagOption -> Text)
-> (ListResourcesForTagOption -> Text -> ListResourcesForTagOption)
-> Lens
     ListResourcesForTagOption ListResourcesForTagOption Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesForTagOption' {Text
tagOptionId :: Text
$sel:tagOptionId:ListResourcesForTagOption' :: ListResourcesForTagOption -> Text
tagOptionId} -> Text
tagOptionId) (\s :: ListResourcesForTagOption
s@ListResourcesForTagOption' {} Text
a -> ListResourcesForTagOption
s {$sel:tagOptionId:ListResourcesForTagOption' :: Text
tagOptionId = Text
a} :: ListResourcesForTagOption)

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

instance Prelude.NFData ListResourcesForTagOption

instance Core.ToHeaders ListResourcesForTagOption where
  toHeaders :: ListResourcesForTagOption -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListResourcesForTagOption -> 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
"AWS242ServiceCatalogService.ListResourcesForTagOption" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ListResourcesForTagOption where
  toJSON :: ListResourcesForTagOption -> Value
toJSON ListResourcesForTagOption' {Maybe Natural
Maybe Text
Text
tagOptionId :: Text
pageSize :: Maybe Natural
pageToken :: Maybe Text
resourceType :: Maybe Text
$sel:tagOptionId:ListResourcesForTagOption' :: ListResourcesForTagOption -> Text
$sel:pageSize:ListResourcesForTagOption' :: ListResourcesForTagOption -> Maybe Natural
$sel:pageToken:ListResourcesForTagOption' :: ListResourcesForTagOption -> Maybe Text
$sel:resourceType:ListResourcesForTagOption' :: ListResourcesForTagOption -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ResourceType" 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
resourceType,
            (Text
"PageToken" 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
pageToken,
            (Text
"PageSize" 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
pageSize,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TagOptionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tagOptionId)
          ]
      )

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

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

-- | /See:/ 'newListResourcesForTagOptionResponse' smart constructor.
data ListResourcesForTagOptionResponse = ListResourcesForTagOptionResponse'
  { -- | Information about the resources.
    ListResourcesForTagOptionResponse -> Maybe [ResourceDetail]
resourceDetails :: Prelude.Maybe [ResourceDetail],
    -- | The page token for the next set of results. To retrieve the first set of
    -- results, use null.
    ListResourcesForTagOptionResponse -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListResourcesForTagOptionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListResourcesForTagOptionResponse
-> ListResourcesForTagOptionResponse -> Bool
(ListResourcesForTagOptionResponse
 -> ListResourcesForTagOptionResponse -> Bool)
-> (ListResourcesForTagOptionResponse
    -> ListResourcesForTagOptionResponse -> Bool)
-> Eq ListResourcesForTagOptionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourcesForTagOptionResponse
-> ListResourcesForTagOptionResponse -> Bool
$c/= :: ListResourcesForTagOptionResponse
-> ListResourcesForTagOptionResponse -> Bool
== :: ListResourcesForTagOptionResponse
-> ListResourcesForTagOptionResponse -> Bool
$c== :: ListResourcesForTagOptionResponse
-> ListResourcesForTagOptionResponse -> Bool
Prelude.Eq, ReadPrec [ListResourcesForTagOptionResponse]
ReadPrec ListResourcesForTagOptionResponse
Int -> ReadS ListResourcesForTagOptionResponse
ReadS [ListResourcesForTagOptionResponse]
(Int -> ReadS ListResourcesForTagOptionResponse)
-> ReadS [ListResourcesForTagOptionResponse]
-> ReadPrec ListResourcesForTagOptionResponse
-> ReadPrec [ListResourcesForTagOptionResponse]
-> Read ListResourcesForTagOptionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResourcesForTagOptionResponse]
$creadListPrec :: ReadPrec [ListResourcesForTagOptionResponse]
readPrec :: ReadPrec ListResourcesForTagOptionResponse
$creadPrec :: ReadPrec ListResourcesForTagOptionResponse
readList :: ReadS [ListResourcesForTagOptionResponse]
$creadList :: ReadS [ListResourcesForTagOptionResponse]
readsPrec :: Int -> ReadS ListResourcesForTagOptionResponse
$creadsPrec :: Int -> ReadS ListResourcesForTagOptionResponse
Prelude.Read, Int -> ListResourcesForTagOptionResponse -> ShowS
[ListResourcesForTagOptionResponse] -> ShowS
ListResourcesForTagOptionResponse -> String
(Int -> ListResourcesForTagOptionResponse -> ShowS)
-> (ListResourcesForTagOptionResponse -> String)
-> ([ListResourcesForTagOptionResponse] -> ShowS)
-> Show ListResourcesForTagOptionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourcesForTagOptionResponse] -> ShowS
$cshowList :: [ListResourcesForTagOptionResponse] -> ShowS
show :: ListResourcesForTagOptionResponse -> String
$cshow :: ListResourcesForTagOptionResponse -> String
showsPrec :: Int -> ListResourcesForTagOptionResponse -> ShowS
$cshowsPrec :: Int -> ListResourcesForTagOptionResponse -> ShowS
Prelude.Show, (forall x.
 ListResourcesForTagOptionResponse
 -> Rep ListResourcesForTagOptionResponse x)
-> (forall x.
    Rep ListResourcesForTagOptionResponse x
    -> ListResourcesForTagOptionResponse)
-> Generic ListResourcesForTagOptionResponse
forall x.
Rep ListResourcesForTagOptionResponse x
-> ListResourcesForTagOptionResponse
forall x.
ListResourcesForTagOptionResponse
-> Rep ListResourcesForTagOptionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListResourcesForTagOptionResponse x
-> ListResourcesForTagOptionResponse
$cfrom :: forall x.
ListResourcesForTagOptionResponse
-> Rep ListResourcesForTagOptionResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListResourcesForTagOptionResponse' 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:
--
-- 'resourceDetails', 'listResourcesForTagOptionResponse_resourceDetails' - Information about the resources.
--
-- 'pageToken', 'listResourcesForTagOptionResponse_pageToken' - The page token for the next set of results. To retrieve the first set of
-- results, use null.
--
-- 'httpStatus', 'listResourcesForTagOptionResponse_httpStatus' - The response's http status code.
newListResourcesForTagOptionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListResourcesForTagOptionResponse
newListResourcesForTagOptionResponse :: Int -> ListResourcesForTagOptionResponse
newListResourcesForTagOptionResponse Int
pHttpStatus_ =
  ListResourcesForTagOptionResponse' :: Maybe [ResourceDetail]
-> Maybe Text -> Int -> ListResourcesForTagOptionResponse
ListResourcesForTagOptionResponse'
    { $sel:resourceDetails:ListResourcesForTagOptionResponse' :: Maybe [ResourceDetail]
resourceDetails =
        Maybe [ResourceDetail]
forall a. Maybe a
Prelude.Nothing,
      $sel:pageToken:ListResourcesForTagOptionResponse' :: Maybe Text
pageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListResourcesForTagOptionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the resources.
listResourcesForTagOptionResponse_resourceDetails :: Lens.Lens' ListResourcesForTagOptionResponse (Prelude.Maybe [ResourceDetail])
listResourcesForTagOptionResponse_resourceDetails :: (Maybe [ResourceDetail] -> f (Maybe [ResourceDetail]))
-> ListResourcesForTagOptionResponse
-> f ListResourcesForTagOptionResponse
listResourcesForTagOptionResponse_resourceDetails = (ListResourcesForTagOptionResponse -> Maybe [ResourceDetail])
-> (ListResourcesForTagOptionResponse
    -> Maybe [ResourceDetail] -> ListResourcesForTagOptionResponse)
-> Lens' ListResourcesForTagOptionResponse (Maybe [ResourceDetail])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesForTagOptionResponse' {Maybe [ResourceDetail]
resourceDetails :: Maybe [ResourceDetail]
$sel:resourceDetails:ListResourcesForTagOptionResponse' :: ListResourcesForTagOptionResponse -> Maybe [ResourceDetail]
resourceDetails} -> Maybe [ResourceDetail]
resourceDetails) (\s :: ListResourcesForTagOptionResponse
s@ListResourcesForTagOptionResponse' {} Maybe [ResourceDetail]
a -> ListResourcesForTagOptionResponse
s {$sel:resourceDetails:ListResourcesForTagOptionResponse' :: Maybe [ResourceDetail]
resourceDetails = Maybe [ResourceDetail]
a} :: ListResourcesForTagOptionResponse) ((Maybe [ResourceDetail] -> f (Maybe [ResourceDetail]))
 -> ListResourcesForTagOptionResponse
 -> f ListResourcesForTagOptionResponse)
-> ((Maybe [ResourceDetail] -> f (Maybe [ResourceDetail]))
    -> Maybe [ResourceDetail] -> f (Maybe [ResourceDetail]))
-> (Maybe [ResourceDetail] -> f (Maybe [ResourceDetail]))
-> ListResourcesForTagOptionResponse
-> f ListResourcesForTagOptionResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ResourceDetail] [ResourceDetail] [ResourceDetail] [ResourceDetail]
-> Iso
     (Maybe [ResourceDetail])
     (Maybe [ResourceDetail])
     (Maybe [ResourceDetail])
     (Maybe [ResourceDetail])
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
  [ResourceDetail] [ResourceDetail] [ResourceDetail] [ResourceDetail]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The page token for the next set of results. To retrieve the first set of
-- results, use null.
listResourcesForTagOptionResponse_pageToken :: Lens.Lens' ListResourcesForTagOptionResponse (Prelude.Maybe Prelude.Text)
listResourcesForTagOptionResponse_pageToken :: (Maybe Text -> f (Maybe Text))
-> ListResourcesForTagOptionResponse
-> f ListResourcesForTagOptionResponse
listResourcesForTagOptionResponse_pageToken = (ListResourcesForTagOptionResponse -> Maybe Text)
-> (ListResourcesForTagOptionResponse
    -> Maybe Text -> ListResourcesForTagOptionResponse)
-> Lens' ListResourcesForTagOptionResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesForTagOptionResponse' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:ListResourcesForTagOptionResponse' :: ListResourcesForTagOptionResponse -> Maybe Text
pageToken} -> Maybe Text
pageToken) (\s :: ListResourcesForTagOptionResponse
s@ListResourcesForTagOptionResponse' {} Maybe Text
a -> ListResourcesForTagOptionResponse
s {$sel:pageToken:ListResourcesForTagOptionResponse' :: Maybe Text
pageToken = Maybe Text
a} :: ListResourcesForTagOptionResponse)

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

instance
  Prelude.NFData
    ListResourcesForTagOptionResponse