{-# 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.LicenseManager.ListResourceInventory
-- 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 resources managed using Systems Manager inventory.
--
-- This operation returns paginated results.
module Amazonka.LicenseManager.ListResourceInventory
  ( -- * Creating a Request
    ListResourceInventory (..),
    newListResourceInventory,

    -- * Request Lenses
    listResourceInventory_filters,
    listResourceInventory_nextToken,
    listResourceInventory_maxResults,

    -- * Destructuring the Response
    ListResourceInventoryResponse (..),
    newListResourceInventoryResponse,

    -- * Response Lenses
    listResourceInventoryResponse_resourceInventoryList,
    listResourceInventoryResponse_nextToken,
    listResourceInventoryResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListResourceInventory' smart constructor.
data ListResourceInventory = ListResourceInventory'
  { -- | Filters to scope the results. The following filters and logical
    -- operators are supported:
    --
    -- -   @account_id@ - The ID of the Amazon Web Services account that owns
    --     the resource. Logical operators are @EQUALS@ | @NOT_EQUALS@.
    --
    -- -   @application_name@ - The name of the application. Logical operators
    --     are @EQUALS@ | @BEGINS_WITH@.
    --
    -- -   @license_included@ - The type of license included. Logical operators
    --     are @EQUALS@ | @NOT_EQUALS@. Possible values are
    --     @sql-server-enterprise@ | @sql-server-standard@ | @sql-server-web@ |
    --     @windows-server-datacenter@.
    --
    -- -   @platform@ - The platform of the resource. Logical operators are
    --     @EQUALS@ | @BEGINS_WITH@.
    --
    -- -   @resource_id@ - The ID of the resource. Logical operators are
    --     @EQUALS@ | @NOT_EQUALS@.
    --
    -- -   @tag:\<key>@ - The key\/value combination of a tag assigned to the
    --     resource. Logical operators are @EQUALS@ (single account) or
    --     @EQUALS@ | @NOT_EQUALS@ (cross account).
    ListResourceInventory -> Maybe [InventoryFilter]
filters :: Prelude.Maybe [InventoryFilter],
    -- | Token for the next set of results.
    ListResourceInventory -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Maximum number of results to return in a single call.
    ListResourceInventory -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (ListResourceInventory -> ListResourceInventory -> Bool
(ListResourceInventory -> ListResourceInventory -> Bool)
-> (ListResourceInventory -> ListResourceInventory -> Bool)
-> Eq ListResourceInventory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourceInventory -> ListResourceInventory -> Bool
$c/= :: ListResourceInventory -> ListResourceInventory -> Bool
== :: ListResourceInventory -> ListResourceInventory -> Bool
$c== :: ListResourceInventory -> ListResourceInventory -> Bool
Prelude.Eq, ReadPrec [ListResourceInventory]
ReadPrec ListResourceInventory
Int -> ReadS ListResourceInventory
ReadS [ListResourceInventory]
(Int -> ReadS ListResourceInventory)
-> ReadS [ListResourceInventory]
-> ReadPrec ListResourceInventory
-> ReadPrec [ListResourceInventory]
-> Read ListResourceInventory
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResourceInventory]
$creadListPrec :: ReadPrec [ListResourceInventory]
readPrec :: ReadPrec ListResourceInventory
$creadPrec :: ReadPrec ListResourceInventory
readList :: ReadS [ListResourceInventory]
$creadList :: ReadS [ListResourceInventory]
readsPrec :: Int -> ReadS ListResourceInventory
$creadsPrec :: Int -> ReadS ListResourceInventory
Prelude.Read, Int -> ListResourceInventory -> ShowS
[ListResourceInventory] -> ShowS
ListResourceInventory -> String
(Int -> ListResourceInventory -> ShowS)
-> (ListResourceInventory -> String)
-> ([ListResourceInventory] -> ShowS)
-> Show ListResourceInventory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourceInventory] -> ShowS
$cshowList :: [ListResourceInventory] -> ShowS
show :: ListResourceInventory -> String
$cshow :: ListResourceInventory -> String
showsPrec :: Int -> ListResourceInventory -> ShowS
$cshowsPrec :: Int -> ListResourceInventory -> ShowS
Prelude.Show, (forall x. ListResourceInventory -> Rep ListResourceInventory x)
-> (forall x. Rep ListResourceInventory x -> ListResourceInventory)
-> Generic ListResourceInventory
forall x. Rep ListResourceInventory x -> ListResourceInventory
forall x. ListResourceInventory -> Rep ListResourceInventory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListResourceInventory x -> ListResourceInventory
$cfrom :: forall x. ListResourceInventory -> Rep ListResourceInventory x
Prelude.Generic)

-- |
-- Create a value of 'ListResourceInventory' 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', 'listResourceInventory_filters' - Filters to scope the results. The following filters and logical
-- operators are supported:
--
-- -   @account_id@ - The ID of the Amazon Web Services account that owns
--     the resource. Logical operators are @EQUALS@ | @NOT_EQUALS@.
--
-- -   @application_name@ - The name of the application. Logical operators
--     are @EQUALS@ | @BEGINS_WITH@.
--
-- -   @license_included@ - The type of license included. Logical operators
--     are @EQUALS@ | @NOT_EQUALS@. Possible values are
--     @sql-server-enterprise@ | @sql-server-standard@ | @sql-server-web@ |
--     @windows-server-datacenter@.
--
-- -   @platform@ - The platform of the resource. Logical operators are
--     @EQUALS@ | @BEGINS_WITH@.
--
-- -   @resource_id@ - The ID of the resource. Logical operators are
--     @EQUALS@ | @NOT_EQUALS@.
--
-- -   @tag:\<key>@ - The key\/value combination of a tag assigned to the
--     resource. Logical operators are @EQUALS@ (single account) or
--     @EQUALS@ | @NOT_EQUALS@ (cross account).
--
-- 'nextToken', 'listResourceInventory_nextToken' - Token for the next set of results.
--
-- 'maxResults', 'listResourceInventory_maxResults' - Maximum number of results to return in a single call.
newListResourceInventory ::
  ListResourceInventory
newListResourceInventory :: ListResourceInventory
newListResourceInventory =
  ListResourceInventory' :: Maybe [InventoryFilter]
-> Maybe Text -> Maybe Int -> ListResourceInventory
ListResourceInventory'
    { $sel:filters:ListResourceInventory' :: Maybe [InventoryFilter]
filters = Maybe [InventoryFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListResourceInventory' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListResourceInventory' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | Filters to scope the results. The following filters and logical
-- operators are supported:
--
-- -   @account_id@ - The ID of the Amazon Web Services account that owns
--     the resource. Logical operators are @EQUALS@ | @NOT_EQUALS@.
--
-- -   @application_name@ - The name of the application. Logical operators
--     are @EQUALS@ | @BEGINS_WITH@.
--
-- -   @license_included@ - The type of license included. Logical operators
--     are @EQUALS@ | @NOT_EQUALS@. Possible values are
--     @sql-server-enterprise@ | @sql-server-standard@ | @sql-server-web@ |
--     @windows-server-datacenter@.
--
-- -   @platform@ - The platform of the resource. Logical operators are
--     @EQUALS@ | @BEGINS_WITH@.
--
-- -   @resource_id@ - The ID of the resource. Logical operators are
--     @EQUALS@ | @NOT_EQUALS@.
--
-- -   @tag:\<key>@ - The key\/value combination of a tag assigned to the
--     resource. Logical operators are @EQUALS@ (single account) or
--     @EQUALS@ | @NOT_EQUALS@ (cross account).
listResourceInventory_filters :: Lens.Lens' ListResourceInventory (Prelude.Maybe [InventoryFilter])
listResourceInventory_filters :: (Maybe [InventoryFilter] -> f (Maybe [InventoryFilter]))
-> ListResourceInventory -> f ListResourceInventory
listResourceInventory_filters = (ListResourceInventory -> Maybe [InventoryFilter])
-> (ListResourceInventory
    -> Maybe [InventoryFilter] -> ListResourceInventory)
-> Lens
     ListResourceInventory
     ListResourceInventory
     (Maybe [InventoryFilter])
     (Maybe [InventoryFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceInventory' {Maybe [InventoryFilter]
filters :: Maybe [InventoryFilter]
$sel:filters:ListResourceInventory' :: ListResourceInventory -> Maybe [InventoryFilter]
filters} -> Maybe [InventoryFilter]
filters) (\s :: ListResourceInventory
s@ListResourceInventory' {} Maybe [InventoryFilter]
a -> ListResourceInventory
s {$sel:filters:ListResourceInventory' :: Maybe [InventoryFilter]
filters = Maybe [InventoryFilter]
a} :: ListResourceInventory) ((Maybe [InventoryFilter] -> f (Maybe [InventoryFilter]))
 -> ListResourceInventory -> f ListResourceInventory)
-> ((Maybe [InventoryFilter] -> f (Maybe [InventoryFilter]))
    -> Maybe [InventoryFilter] -> f (Maybe [InventoryFilter]))
-> (Maybe [InventoryFilter] -> f (Maybe [InventoryFilter]))
-> ListResourceInventory
-> f ListResourceInventory
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InventoryFilter]
  [InventoryFilter]
  [InventoryFilter]
  [InventoryFilter]
-> Iso
     (Maybe [InventoryFilter])
     (Maybe [InventoryFilter])
     (Maybe [InventoryFilter])
     (Maybe [InventoryFilter])
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
  [InventoryFilter]
  [InventoryFilter]
  [InventoryFilter]
  [InventoryFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Token for the next set of results.
listResourceInventory_nextToken :: Lens.Lens' ListResourceInventory (Prelude.Maybe Prelude.Text)
listResourceInventory_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListResourceInventory -> f ListResourceInventory
listResourceInventory_nextToken = (ListResourceInventory -> Maybe Text)
-> (ListResourceInventory -> Maybe Text -> ListResourceInventory)
-> Lens
     ListResourceInventory
     ListResourceInventory
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceInventory' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResourceInventory' :: ListResourceInventory -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResourceInventory
s@ListResourceInventory' {} Maybe Text
a -> ListResourceInventory
s {$sel:nextToken:ListResourceInventory' :: Maybe Text
nextToken = Maybe Text
a} :: ListResourceInventory)

-- | Maximum number of results to return in a single call.
listResourceInventory_maxResults :: Lens.Lens' ListResourceInventory (Prelude.Maybe Prelude.Int)
listResourceInventory_maxResults :: (Maybe Int -> f (Maybe Int))
-> ListResourceInventory -> f ListResourceInventory
listResourceInventory_maxResults = (ListResourceInventory -> Maybe Int)
-> (ListResourceInventory -> Maybe Int -> ListResourceInventory)
-> Lens
     ListResourceInventory ListResourceInventory (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceInventory' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListResourceInventory' :: ListResourceInventory -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListResourceInventory
s@ListResourceInventory' {} Maybe Int
a -> ListResourceInventory
s {$sel:maxResults:ListResourceInventory' :: Maybe Int
maxResults = Maybe Int
a} :: ListResourceInventory)

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

instance Prelude.NFData ListResourceInventory

instance Core.ToHeaders ListResourceInventory where
  toHeaders :: ListResourceInventory -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListResourceInventory -> 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
"AWSLicenseManager.ListResourceInventory" ::
                          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 ListResourceInventory where
  toJSON :: ListResourceInventory -> Value
toJSON ListResourceInventory' {Maybe Int
Maybe [InventoryFilter]
Maybe Text
maxResults :: Maybe Int
nextToken :: Maybe Text
filters :: Maybe [InventoryFilter]
$sel:maxResults:ListResourceInventory' :: ListResourceInventory -> Maybe Int
$sel:nextToken:ListResourceInventory' :: ListResourceInventory -> Maybe Text
$sel:filters:ListResourceInventory' :: ListResourceInventory -> Maybe [InventoryFilter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> [InventoryFilter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([InventoryFilter] -> Pair)
-> Maybe [InventoryFilter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [InventoryFilter]
filters,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"MaxResults" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults
          ]
      )

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

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

-- | /See:/ 'newListResourceInventoryResponse' smart constructor.
data ListResourceInventoryResponse = ListResourceInventoryResponse'
  { -- | Information about the resources.
    ListResourceInventoryResponse -> Maybe [ResourceInventory]
resourceInventoryList :: Prelude.Maybe [ResourceInventory],
    -- | Token for the next set of results.
    ListResourceInventoryResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListResourceInventoryResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListResourceInventoryResponse
-> ListResourceInventoryResponse -> Bool
(ListResourceInventoryResponse
 -> ListResourceInventoryResponse -> Bool)
-> (ListResourceInventoryResponse
    -> ListResourceInventoryResponse -> Bool)
-> Eq ListResourceInventoryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourceInventoryResponse
-> ListResourceInventoryResponse -> Bool
$c/= :: ListResourceInventoryResponse
-> ListResourceInventoryResponse -> Bool
== :: ListResourceInventoryResponse
-> ListResourceInventoryResponse -> Bool
$c== :: ListResourceInventoryResponse
-> ListResourceInventoryResponse -> Bool
Prelude.Eq, ReadPrec [ListResourceInventoryResponse]
ReadPrec ListResourceInventoryResponse
Int -> ReadS ListResourceInventoryResponse
ReadS [ListResourceInventoryResponse]
(Int -> ReadS ListResourceInventoryResponse)
-> ReadS [ListResourceInventoryResponse]
-> ReadPrec ListResourceInventoryResponse
-> ReadPrec [ListResourceInventoryResponse]
-> Read ListResourceInventoryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResourceInventoryResponse]
$creadListPrec :: ReadPrec [ListResourceInventoryResponse]
readPrec :: ReadPrec ListResourceInventoryResponse
$creadPrec :: ReadPrec ListResourceInventoryResponse
readList :: ReadS [ListResourceInventoryResponse]
$creadList :: ReadS [ListResourceInventoryResponse]
readsPrec :: Int -> ReadS ListResourceInventoryResponse
$creadsPrec :: Int -> ReadS ListResourceInventoryResponse
Prelude.Read, Int -> ListResourceInventoryResponse -> ShowS
[ListResourceInventoryResponse] -> ShowS
ListResourceInventoryResponse -> String
(Int -> ListResourceInventoryResponse -> ShowS)
-> (ListResourceInventoryResponse -> String)
-> ([ListResourceInventoryResponse] -> ShowS)
-> Show ListResourceInventoryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourceInventoryResponse] -> ShowS
$cshowList :: [ListResourceInventoryResponse] -> ShowS
show :: ListResourceInventoryResponse -> String
$cshow :: ListResourceInventoryResponse -> String
showsPrec :: Int -> ListResourceInventoryResponse -> ShowS
$cshowsPrec :: Int -> ListResourceInventoryResponse -> ShowS
Prelude.Show, (forall x.
 ListResourceInventoryResponse
 -> Rep ListResourceInventoryResponse x)
-> (forall x.
    Rep ListResourceInventoryResponse x
    -> ListResourceInventoryResponse)
-> Generic ListResourceInventoryResponse
forall x.
Rep ListResourceInventoryResponse x
-> ListResourceInventoryResponse
forall x.
ListResourceInventoryResponse
-> Rep ListResourceInventoryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListResourceInventoryResponse x
-> ListResourceInventoryResponse
$cfrom :: forall x.
ListResourceInventoryResponse
-> Rep ListResourceInventoryResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListResourceInventoryResponse' 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:
--
-- 'resourceInventoryList', 'listResourceInventoryResponse_resourceInventoryList' - Information about the resources.
--
-- 'nextToken', 'listResourceInventoryResponse_nextToken' - Token for the next set of results.
--
-- 'httpStatus', 'listResourceInventoryResponse_httpStatus' - The response's http status code.
newListResourceInventoryResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListResourceInventoryResponse
newListResourceInventoryResponse :: Int -> ListResourceInventoryResponse
newListResourceInventoryResponse Int
pHttpStatus_ =
  ListResourceInventoryResponse' :: Maybe [ResourceInventory]
-> Maybe Text -> Int -> ListResourceInventoryResponse
ListResourceInventoryResponse'
    { $sel:resourceInventoryList:ListResourceInventoryResponse' :: Maybe [ResourceInventory]
resourceInventoryList =
        Maybe [ResourceInventory]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListResourceInventoryResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListResourceInventoryResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | Token for the next set of results.
listResourceInventoryResponse_nextToken :: Lens.Lens' ListResourceInventoryResponse (Prelude.Maybe Prelude.Text)
listResourceInventoryResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListResourceInventoryResponse -> f ListResourceInventoryResponse
listResourceInventoryResponse_nextToken = (ListResourceInventoryResponse -> Maybe Text)
-> (ListResourceInventoryResponse
    -> Maybe Text -> ListResourceInventoryResponse)
-> Lens' ListResourceInventoryResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourceInventoryResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResourceInventoryResponse' :: ListResourceInventoryResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResourceInventoryResponse
s@ListResourceInventoryResponse' {} Maybe Text
a -> ListResourceInventoryResponse
s {$sel:nextToken:ListResourceInventoryResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListResourceInventoryResponse)

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

instance Prelude.NFData ListResourceInventoryResponse