{-# 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.SSM.GetInventorySchema
-- 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)
--
-- Return a list of inventory type names for the account, or return a list
-- of attribute names for a specific Inventory item type.
--
-- This operation returns paginated results.
module Amazonka.SSM.GetInventorySchema
  ( -- * Creating a Request
    GetInventorySchema (..),
    newGetInventorySchema,

    -- * Request Lenses
    getInventorySchema_typeName,
    getInventorySchema_aggregator,
    getInventorySchema_nextToken,
    getInventorySchema_subType,
    getInventorySchema_maxResults,

    -- * Destructuring the Response
    GetInventorySchemaResponse (..),
    newGetInventorySchemaResponse,

    -- * Response Lenses
    getInventorySchemaResponse_schemas,
    getInventorySchemaResponse_nextToken,
    getInventorySchemaResponse_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.SSM.Types

-- | /See:/ 'newGetInventorySchema' smart constructor.
data GetInventorySchema = GetInventorySchema'
  { -- | The type of inventory item to return.
    GetInventorySchema -> Maybe Text
typeName :: Prelude.Maybe Prelude.Text,
    -- | Returns inventory schemas that support aggregation. For example, this
    -- call returns the @AWS:InstanceInformation@ type, because it supports
    -- aggregation based on the @PlatformName@, @PlatformType@, and
    -- @PlatformVersion@ attributes.
    GetInventorySchema -> Maybe Bool
aggregator :: Prelude.Maybe Prelude.Bool,
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    GetInventorySchema -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Returns the sub-type schema for a specified inventory type.
    GetInventorySchema -> Maybe Bool
subType :: Prelude.Maybe Prelude.Bool,
    -- | The maximum number of items to return for this call. The call also
    -- returns a token that you can specify in a subsequent call to get the
    -- next set of results.
    GetInventorySchema -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (GetInventorySchema -> GetInventorySchema -> Bool
(GetInventorySchema -> GetInventorySchema -> Bool)
-> (GetInventorySchema -> GetInventorySchema -> Bool)
-> Eq GetInventorySchema
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInventorySchema -> GetInventorySchema -> Bool
$c/= :: GetInventorySchema -> GetInventorySchema -> Bool
== :: GetInventorySchema -> GetInventorySchema -> Bool
$c== :: GetInventorySchema -> GetInventorySchema -> Bool
Prelude.Eq, ReadPrec [GetInventorySchema]
ReadPrec GetInventorySchema
Int -> ReadS GetInventorySchema
ReadS [GetInventorySchema]
(Int -> ReadS GetInventorySchema)
-> ReadS [GetInventorySchema]
-> ReadPrec GetInventorySchema
-> ReadPrec [GetInventorySchema]
-> Read GetInventorySchema
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInventorySchema]
$creadListPrec :: ReadPrec [GetInventorySchema]
readPrec :: ReadPrec GetInventorySchema
$creadPrec :: ReadPrec GetInventorySchema
readList :: ReadS [GetInventorySchema]
$creadList :: ReadS [GetInventorySchema]
readsPrec :: Int -> ReadS GetInventorySchema
$creadsPrec :: Int -> ReadS GetInventorySchema
Prelude.Read, Int -> GetInventorySchema -> ShowS
[GetInventorySchema] -> ShowS
GetInventorySchema -> String
(Int -> GetInventorySchema -> ShowS)
-> (GetInventorySchema -> String)
-> ([GetInventorySchema] -> ShowS)
-> Show GetInventorySchema
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInventorySchema] -> ShowS
$cshowList :: [GetInventorySchema] -> ShowS
show :: GetInventorySchema -> String
$cshow :: GetInventorySchema -> String
showsPrec :: Int -> GetInventorySchema -> ShowS
$cshowsPrec :: Int -> GetInventorySchema -> ShowS
Prelude.Show, (forall x. GetInventorySchema -> Rep GetInventorySchema x)
-> (forall x. Rep GetInventorySchema x -> GetInventorySchema)
-> Generic GetInventorySchema
forall x. Rep GetInventorySchema x -> GetInventorySchema
forall x. GetInventorySchema -> Rep GetInventorySchema x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetInventorySchema x -> GetInventorySchema
$cfrom :: forall x. GetInventorySchema -> Rep GetInventorySchema x
Prelude.Generic)

-- |
-- Create a value of 'GetInventorySchema' 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:
--
-- 'typeName', 'getInventorySchema_typeName' - The type of inventory item to return.
--
-- 'aggregator', 'getInventorySchema_aggregator' - Returns inventory schemas that support aggregation. For example, this
-- call returns the @AWS:InstanceInformation@ type, because it supports
-- aggregation based on the @PlatformName@, @PlatformType@, and
-- @PlatformVersion@ attributes.
--
-- 'nextToken', 'getInventorySchema_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'subType', 'getInventorySchema_subType' - Returns the sub-type schema for a specified inventory type.
--
-- 'maxResults', 'getInventorySchema_maxResults' - The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
newGetInventorySchema ::
  GetInventorySchema
newGetInventorySchema :: GetInventorySchema
newGetInventorySchema =
  GetInventorySchema' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe Natural
-> GetInventorySchema
GetInventorySchema'
    { $sel:typeName:GetInventorySchema' :: Maybe Text
typeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:aggregator:GetInventorySchema' :: Maybe Bool
aggregator = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetInventorySchema' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:subType:GetInventorySchema' :: Maybe Bool
subType = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetInventorySchema' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The type of inventory item to return.
getInventorySchema_typeName :: Lens.Lens' GetInventorySchema (Prelude.Maybe Prelude.Text)
getInventorySchema_typeName :: (Maybe Text -> f (Maybe Text))
-> GetInventorySchema -> f GetInventorySchema
getInventorySchema_typeName = (GetInventorySchema -> Maybe Text)
-> (GetInventorySchema -> Maybe Text -> GetInventorySchema)
-> Lens
     GetInventorySchema GetInventorySchema (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInventorySchema' {Maybe Text
typeName :: Maybe Text
$sel:typeName:GetInventorySchema' :: GetInventorySchema -> Maybe Text
typeName} -> Maybe Text
typeName) (\s :: GetInventorySchema
s@GetInventorySchema' {} Maybe Text
a -> GetInventorySchema
s {$sel:typeName:GetInventorySchema' :: Maybe Text
typeName = Maybe Text
a} :: GetInventorySchema)

-- | Returns inventory schemas that support aggregation. For example, this
-- call returns the @AWS:InstanceInformation@ type, because it supports
-- aggregation based on the @PlatformName@, @PlatformType@, and
-- @PlatformVersion@ attributes.
getInventorySchema_aggregator :: Lens.Lens' GetInventorySchema (Prelude.Maybe Prelude.Bool)
getInventorySchema_aggregator :: (Maybe Bool -> f (Maybe Bool))
-> GetInventorySchema -> f GetInventorySchema
getInventorySchema_aggregator = (GetInventorySchema -> Maybe Bool)
-> (GetInventorySchema -> Maybe Bool -> GetInventorySchema)
-> Lens
     GetInventorySchema GetInventorySchema (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInventorySchema' {Maybe Bool
aggregator :: Maybe Bool
$sel:aggregator:GetInventorySchema' :: GetInventorySchema -> Maybe Bool
aggregator} -> Maybe Bool
aggregator) (\s :: GetInventorySchema
s@GetInventorySchema' {} Maybe Bool
a -> GetInventorySchema
s {$sel:aggregator:GetInventorySchema' :: Maybe Bool
aggregator = Maybe Bool
a} :: GetInventorySchema)

-- | The token for the next set of items to return. (You received this token
-- from a previous call.)
getInventorySchema_nextToken :: Lens.Lens' GetInventorySchema (Prelude.Maybe Prelude.Text)
getInventorySchema_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetInventorySchema -> f GetInventorySchema
getInventorySchema_nextToken = (GetInventorySchema -> Maybe Text)
-> (GetInventorySchema -> Maybe Text -> GetInventorySchema)
-> Lens
     GetInventorySchema GetInventorySchema (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInventorySchema' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetInventorySchema' :: GetInventorySchema -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetInventorySchema
s@GetInventorySchema' {} Maybe Text
a -> GetInventorySchema
s {$sel:nextToken:GetInventorySchema' :: Maybe Text
nextToken = Maybe Text
a} :: GetInventorySchema)

-- | Returns the sub-type schema for a specified inventory type.
getInventorySchema_subType :: Lens.Lens' GetInventorySchema (Prelude.Maybe Prelude.Bool)
getInventorySchema_subType :: (Maybe Bool -> f (Maybe Bool))
-> GetInventorySchema -> f GetInventorySchema
getInventorySchema_subType = (GetInventorySchema -> Maybe Bool)
-> (GetInventorySchema -> Maybe Bool -> GetInventorySchema)
-> Lens
     GetInventorySchema GetInventorySchema (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInventorySchema' {Maybe Bool
subType :: Maybe Bool
$sel:subType:GetInventorySchema' :: GetInventorySchema -> Maybe Bool
subType} -> Maybe Bool
subType) (\s :: GetInventorySchema
s@GetInventorySchema' {} Maybe Bool
a -> GetInventorySchema
s {$sel:subType:GetInventorySchema' :: Maybe Bool
subType = Maybe Bool
a} :: GetInventorySchema)

-- | The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
getInventorySchema_maxResults :: Lens.Lens' GetInventorySchema (Prelude.Maybe Prelude.Natural)
getInventorySchema_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetInventorySchema -> f GetInventorySchema
getInventorySchema_maxResults = (GetInventorySchema -> Maybe Natural)
-> (GetInventorySchema -> Maybe Natural -> GetInventorySchema)
-> Lens
     GetInventorySchema
     GetInventorySchema
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInventorySchema' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetInventorySchema' :: GetInventorySchema -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetInventorySchema
s@GetInventorySchema' {} Maybe Natural
a -> GetInventorySchema
s {$sel:maxResults:GetInventorySchema' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetInventorySchema)

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

instance Prelude.NFData GetInventorySchema

instance Core.ToHeaders GetInventorySchema where
  toHeaders :: GetInventorySchema -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetInventorySchema -> 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
"AmazonSSM.GetInventorySchema" ::
                          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 GetInventorySchema where
  toJSON :: GetInventorySchema -> Value
toJSON GetInventorySchema' {Maybe Bool
Maybe Natural
Maybe Text
maxResults :: Maybe Natural
subType :: Maybe Bool
nextToken :: Maybe Text
aggregator :: Maybe Bool
typeName :: Maybe Text
$sel:maxResults:GetInventorySchema' :: GetInventorySchema -> Maybe Natural
$sel:subType:GetInventorySchema' :: GetInventorySchema -> Maybe Bool
$sel:nextToken:GetInventorySchema' :: GetInventorySchema -> Maybe Text
$sel:aggregator:GetInventorySchema' :: GetInventorySchema -> Maybe Bool
$sel:typeName:GetInventorySchema' :: GetInventorySchema -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TypeName" 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
typeName,
            (Text
"Aggregator" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
aggregator,
            (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
"SubType" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
subType,
            (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
          ]
      )

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

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

-- | /See:/ 'newGetInventorySchemaResponse' smart constructor.
data GetInventorySchemaResponse = GetInventorySchemaResponse'
  { -- | Inventory schemas returned by the request.
    GetInventorySchemaResponse -> Maybe [InventoryItemSchema]
schemas :: Prelude.Maybe [InventoryItemSchema],
    -- | The token to use when requesting the next set of items. If there are no
    -- additional items to return, the string is empty.
    GetInventorySchemaResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetInventorySchemaResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetInventorySchemaResponse -> GetInventorySchemaResponse -> Bool
(GetInventorySchemaResponse -> GetInventorySchemaResponse -> Bool)
-> (GetInventorySchemaResponse
    -> GetInventorySchemaResponse -> Bool)
-> Eq GetInventorySchemaResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInventorySchemaResponse -> GetInventorySchemaResponse -> Bool
$c/= :: GetInventorySchemaResponse -> GetInventorySchemaResponse -> Bool
== :: GetInventorySchemaResponse -> GetInventorySchemaResponse -> Bool
$c== :: GetInventorySchemaResponse -> GetInventorySchemaResponse -> Bool
Prelude.Eq, ReadPrec [GetInventorySchemaResponse]
ReadPrec GetInventorySchemaResponse
Int -> ReadS GetInventorySchemaResponse
ReadS [GetInventorySchemaResponse]
(Int -> ReadS GetInventorySchemaResponse)
-> ReadS [GetInventorySchemaResponse]
-> ReadPrec GetInventorySchemaResponse
-> ReadPrec [GetInventorySchemaResponse]
-> Read GetInventorySchemaResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInventorySchemaResponse]
$creadListPrec :: ReadPrec [GetInventorySchemaResponse]
readPrec :: ReadPrec GetInventorySchemaResponse
$creadPrec :: ReadPrec GetInventorySchemaResponse
readList :: ReadS [GetInventorySchemaResponse]
$creadList :: ReadS [GetInventorySchemaResponse]
readsPrec :: Int -> ReadS GetInventorySchemaResponse
$creadsPrec :: Int -> ReadS GetInventorySchemaResponse
Prelude.Read, Int -> GetInventorySchemaResponse -> ShowS
[GetInventorySchemaResponse] -> ShowS
GetInventorySchemaResponse -> String
(Int -> GetInventorySchemaResponse -> ShowS)
-> (GetInventorySchemaResponse -> String)
-> ([GetInventorySchemaResponse] -> ShowS)
-> Show GetInventorySchemaResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInventorySchemaResponse] -> ShowS
$cshowList :: [GetInventorySchemaResponse] -> ShowS
show :: GetInventorySchemaResponse -> String
$cshow :: GetInventorySchemaResponse -> String
showsPrec :: Int -> GetInventorySchemaResponse -> ShowS
$cshowsPrec :: Int -> GetInventorySchemaResponse -> ShowS
Prelude.Show, (forall x.
 GetInventorySchemaResponse -> Rep GetInventorySchemaResponse x)
-> (forall x.
    Rep GetInventorySchemaResponse x -> GetInventorySchemaResponse)
-> Generic GetInventorySchemaResponse
forall x.
Rep GetInventorySchemaResponse x -> GetInventorySchemaResponse
forall x.
GetInventorySchemaResponse -> Rep GetInventorySchemaResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetInventorySchemaResponse x -> GetInventorySchemaResponse
$cfrom :: forall x.
GetInventorySchemaResponse -> Rep GetInventorySchemaResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetInventorySchemaResponse' 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:
--
-- 'schemas', 'getInventorySchemaResponse_schemas' - Inventory schemas returned by the request.
--
-- 'nextToken', 'getInventorySchemaResponse_nextToken' - The token to use when requesting the next set of items. If there are no
-- additional items to return, the string is empty.
--
-- 'httpStatus', 'getInventorySchemaResponse_httpStatus' - The response's http status code.
newGetInventorySchemaResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetInventorySchemaResponse
newGetInventorySchemaResponse :: Int -> GetInventorySchemaResponse
newGetInventorySchemaResponse Int
pHttpStatus_ =
  GetInventorySchemaResponse' :: Maybe [InventoryItemSchema]
-> Maybe Text -> Int -> GetInventorySchemaResponse
GetInventorySchemaResponse'
    { $sel:schemas:GetInventorySchemaResponse' :: Maybe [InventoryItemSchema]
schemas =
        Maybe [InventoryItemSchema]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetInventorySchemaResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetInventorySchemaResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Inventory schemas returned by the request.
getInventorySchemaResponse_schemas :: Lens.Lens' GetInventorySchemaResponse (Prelude.Maybe [InventoryItemSchema])
getInventorySchemaResponse_schemas :: (Maybe [InventoryItemSchema] -> f (Maybe [InventoryItemSchema]))
-> GetInventorySchemaResponse -> f GetInventorySchemaResponse
getInventorySchemaResponse_schemas = (GetInventorySchemaResponse -> Maybe [InventoryItemSchema])
-> (GetInventorySchemaResponse
    -> Maybe [InventoryItemSchema] -> GetInventorySchemaResponse)
-> Lens' GetInventorySchemaResponse (Maybe [InventoryItemSchema])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInventorySchemaResponse' {Maybe [InventoryItemSchema]
schemas :: Maybe [InventoryItemSchema]
$sel:schemas:GetInventorySchemaResponse' :: GetInventorySchemaResponse -> Maybe [InventoryItemSchema]
schemas} -> Maybe [InventoryItemSchema]
schemas) (\s :: GetInventorySchemaResponse
s@GetInventorySchemaResponse' {} Maybe [InventoryItemSchema]
a -> GetInventorySchemaResponse
s {$sel:schemas:GetInventorySchemaResponse' :: Maybe [InventoryItemSchema]
schemas = Maybe [InventoryItemSchema]
a} :: GetInventorySchemaResponse) ((Maybe [InventoryItemSchema] -> f (Maybe [InventoryItemSchema]))
 -> GetInventorySchemaResponse -> f GetInventorySchemaResponse)
-> ((Maybe [InventoryItemSchema]
     -> f (Maybe [InventoryItemSchema]))
    -> Maybe [InventoryItemSchema] -> f (Maybe [InventoryItemSchema]))
-> (Maybe [InventoryItemSchema] -> f (Maybe [InventoryItemSchema]))
-> GetInventorySchemaResponse
-> f GetInventorySchemaResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InventoryItemSchema]
  [InventoryItemSchema]
  [InventoryItemSchema]
  [InventoryItemSchema]
-> Iso
     (Maybe [InventoryItemSchema])
     (Maybe [InventoryItemSchema])
     (Maybe [InventoryItemSchema])
     (Maybe [InventoryItemSchema])
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
  [InventoryItemSchema]
  [InventoryItemSchema]
  [InventoryItemSchema]
  [InventoryItemSchema]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token to use when requesting the next set of items. If there are no
-- additional items to return, the string is empty.
getInventorySchemaResponse_nextToken :: Lens.Lens' GetInventorySchemaResponse (Prelude.Maybe Prelude.Text)
getInventorySchemaResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetInventorySchemaResponse -> f GetInventorySchemaResponse
getInventorySchemaResponse_nextToken = (GetInventorySchemaResponse -> Maybe Text)
-> (GetInventorySchemaResponse
    -> Maybe Text -> GetInventorySchemaResponse)
-> Lens' GetInventorySchemaResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInventorySchemaResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetInventorySchemaResponse' :: GetInventorySchemaResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetInventorySchemaResponse
s@GetInventorySchemaResponse' {} Maybe Text
a -> GetInventorySchemaResponse
s {$sel:nextToken:GetInventorySchemaResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetInventorySchemaResponse)

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

instance Prelude.NFData GetInventorySchemaResponse