{-# 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.Pricing.GetProducts
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a list of all products that match the filter criteria.
--
-- This operation returns paginated results.
module Amazonka.Pricing.GetProducts
  ( -- * Creating a Request
    GetProducts (..),
    newGetProducts,

    -- * Request Lenses
    getProducts_filters,
    getProducts_formatVersion,
    getProducts_nextToken,
    getProducts_serviceCode,
    getProducts_maxResults,

    -- * Destructuring the Response
    GetProductsResponse (..),
    newGetProductsResponse,

    -- * Response Lenses
    getProductsResponse_formatVersion,
    getProductsResponse_nextToken,
    getProductsResponse_priceList,
    getProductsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetProducts' smart constructor.
data GetProducts = GetProducts'
  { -- | The list of filters that limit the returned products. only products that
    -- match all filters are returned.
    GetProducts -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | The format version that you want the response to be in.
    --
    -- Valid values are: @aws_v1@
    GetProducts -> Maybe Text
formatVersion :: Prelude.Maybe Prelude.Text,
    -- | The pagination token that indicates the next set of results that you
    -- want to retrieve.
    GetProducts -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The code for the service whose products you want to retrieve.
    GetProducts -> Maybe Text
serviceCode :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return in the response.
    GetProducts -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (GetProducts -> GetProducts -> Bool
(GetProducts -> GetProducts -> Bool)
-> (GetProducts -> GetProducts -> Bool) -> Eq GetProducts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetProducts -> GetProducts -> Bool
$c/= :: GetProducts -> GetProducts -> Bool
== :: GetProducts -> GetProducts -> Bool
$c== :: GetProducts -> GetProducts -> Bool
Prelude.Eq, ReadPrec [GetProducts]
ReadPrec GetProducts
Int -> ReadS GetProducts
ReadS [GetProducts]
(Int -> ReadS GetProducts)
-> ReadS [GetProducts]
-> ReadPrec GetProducts
-> ReadPrec [GetProducts]
-> Read GetProducts
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetProducts]
$creadListPrec :: ReadPrec [GetProducts]
readPrec :: ReadPrec GetProducts
$creadPrec :: ReadPrec GetProducts
readList :: ReadS [GetProducts]
$creadList :: ReadS [GetProducts]
readsPrec :: Int -> ReadS GetProducts
$creadsPrec :: Int -> ReadS GetProducts
Prelude.Read, Int -> GetProducts -> ShowS
[GetProducts] -> ShowS
GetProducts -> String
(Int -> GetProducts -> ShowS)
-> (GetProducts -> String)
-> ([GetProducts] -> ShowS)
-> Show GetProducts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetProducts] -> ShowS
$cshowList :: [GetProducts] -> ShowS
show :: GetProducts -> String
$cshow :: GetProducts -> String
showsPrec :: Int -> GetProducts -> ShowS
$cshowsPrec :: Int -> GetProducts -> ShowS
Prelude.Show, (forall x. GetProducts -> Rep GetProducts x)
-> (forall x. Rep GetProducts x -> GetProducts)
-> Generic GetProducts
forall x. Rep GetProducts x -> GetProducts
forall x. GetProducts -> Rep GetProducts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetProducts x -> GetProducts
$cfrom :: forall x. GetProducts -> Rep GetProducts x
Prelude.Generic)

-- |
-- Create a value of 'GetProducts' 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', 'getProducts_filters' - The list of filters that limit the returned products. only products that
-- match all filters are returned.
--
-- 'formatVersion', 'getProducts_formatVersion' - The format version that you want the response to be in.
--
-- Valid values are: @aws_v1@
--
-- 'nextToken', 'getProducts_nextToken' - The pagination token that indicates the next set of results that you
-- want to retrieve.
--
-- 'serviceCode', 'getProducts_serviceCode' - The code for the service whose products you want to retrieve.
--
-- 'maxResults', 'getProducts_maxResults' - The maximum number of results to return in the response.
newGetProducts ::
  GetProducts
newGetProducts :: GetProducts
newGetProducts =
  GetProducts' :: Maybe [Filter]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> GetProducts
GetProducts'
    { $sel:filters:GetProducts' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:formatVersion:GetProducts' :: Maybe Text
formatVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetProducts' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceCode:GetProducts' :: Maybe Text
serviceCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetProducts' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The list of filters that limit the returned products. only products that
-- match all filters are returned.
getProducts_filters :: Lens.Lens' GetProducts (Prelude.Maybe [Filter])
getProducts_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> GetProducts -> f GetProducts
getProducts_filters = (GetProducts -> Maybe [Filter])
-> (GetProducts -> Maybe [Filter] -> GetProducts)
-> Lens GetProducts GetProducts (Maybe [Filter]) (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProducts' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:GetProducts' :: GetProducts -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: GetProducts
s@GetProducts' {} Maybe [Filter]
a -> GetProducts
s {$sel:filters:GetProducts' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: GetProducts) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> GetProducts -> f GetProducts)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> GetProducts
-> f GetProducts
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
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 [Filter] [Filter] [Filter] [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The format version that you want the response to be in.
--
-- Valid values are: @aws_v1@
getProducts_formatVersion :: Lens.Lens' GetProducts (Prelude.Maybe Prelude.Text)
getProducts_formatVersion :: (Maybe Text -> f (Maybe Text)) -> GetProducts -> f GetProducts
getProducts_formatVersion = (GetProducts -> Maybe Text)
-> (GetProducts -> Maybe Text -> GetProducts)
-> Lens GetProducts GetProducts (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProducts' {Maybe Text
formatVersion :: Maybe Text
$sel:formatVersion:GetProducts' :: GetProducts -> Maybe Text
formatVersion} -> Maybe Text
formatVersion) (\s :: GetProducts
s@GetProducts' {} Maybe Text
a -> GetProducts
s {$sel:formatVersion:GetProducts' :: Maybe Text
formatVersion = Maybe Text
a} :: GetProducts)

-- | The pagination token that indicates the next set of results that you
-- want to retrieve.
getProducts_nextToken :: Lens.Lens' GetProducts (Prelude.Maybe Prelude.Text)
getProducts_nextToken :: (Maybe Text -> f (Maybe Text)) -> GetProducts -> f GetProducts
getProducts_nextToken = (GetProducts -> Maybe Text)
-> (GetProducts -> Maybe Text -> GetProducts)
-> Lens GetProducts GetProducts (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProducts' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetProducts' :: GetProducts -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetProducts
s@GetProducts' {} Maybe Text
a -> GetProducts
s {$sel:nextToken:GetProducts' :: Maybe Text
nextToken = Maybe Text
a} :: GetProducts)

-- | The code for the service whose products you want to retrieve.
getProducts_serviceCode :: Lens.Lens' GetProducts (Prelude.Maybe Prelude.Text)
getProducts_serviceCode :: (Maybe Text -> f (Maybe Text)) -> GetProducts -> f GetProducts
getProducts_serviceCode = (GetProducts -> Maybe Text)
-> (GetProducts -> Maybe Text -> GetProducts)
-> Lens GetProducts GetProducts (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProducts' {Maybe Text
serviceCode :: Maybe Text
$sel:serviceCode:GetProducts' :: GetProducts -> Maybe Text
serviceCode} -> Maybe Text
serviceCode) (\s :: GetProducts
s@GetProducts' {} Maybe Text
a -> GetProducts
s {$sel:serviceCode:GetProducts' :: Maybe Text
serviceCode = Maybe Text
a} :: GetProducts)

-- | The maximum number of results to return in the response.
getProducts_maxResults :: Lens.Lens' GetProducts (Prelude.Maybe Prelude.Natural)
getProducts_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetProducts -> f GetProducts
getProducts_maxResults = (GetProducts -> Maybe Natural)
-> (GetProducts -> Maybe Natural -> GetProducts)
-> Lens GetProducts GetProducts (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProducts' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetProducts' :: GetProducts -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetProducts
s@GetProducts' {} Maybe Natural
a -> GetProducts
s {$sel:maxResults:GetProducts' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetProducts)

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

instance Prelude.NFData GetProducts

instance Core.ToHeaders GetProducts where
  toHeaders :: GetProducts -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetProducts -> 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
"AWSPriceListService.GetProducts" ::
                          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 GetProducts where
  toJSON :: GetProducts -> Value
toJSON GetProducts' {Maybe Natural
Maybe [Filter]
Maybe Text
maxResults :: Maybe Natural
serviceCode :: Maybe Text
nextToken :: Maybe Text
formatVersion :: Maybe Text
filters :: Maybe [Filter]
$sel:maxResults:GetProducts' :: GetProducts -> Maybe Natural
$sel:serviceCode:GetProducts' :: GetProducts -> Maybe Text
$sel:nextToken:GetProducts' :: GetProducts -> Maybe Text
$sel:formatVersion:GetProducts' :: GetProducts -> Maybe Text
$sel:filters:GetProducts' :: GetProducts -> Maybe [Filter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> [Filter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Filter] -> Pair) -> Maybe [Filter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters,
            (Text
"FormatVersion" 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
formatVersion,
            (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
"ServiceCode" 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
serviceCode,
            (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 GetProducts where
  toPath :: GetProducts -> ByteString
toPath = ByteString -> GetProducts -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newGetProductsResponse' smart constructor.
data GetProductsResponse = GetProductsResponse'
  { -- | The format version of the response. For example, aws_v1.
    GetProductsResponse -> Maybe Text
formatVersion :: Prelude.Maybe Prelude.Text,
    -- | The pagination token that indicates the next set of results to retrieve.
    GetProductsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list of products that match your filters. The list contains both the
    -- product metadata and the price information.
    GetProductsResponse -> Maybe [Text]
priceList :: Prelude.Maybe [Prelude.Text],
    -- | The response's http status code.
    GetProductsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetProductsResponse -> GetProductsResponse -> Bool
(GetProductsResponse -> GetProductsResponse -> Bool)
-> (GetProductsResponse -> GetProductsResponse -> Bool)
-> Eq GetProductsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetProductsResponse -> GetProductsResponse -> Bool
$c/= :: GetProductsResponse -> GetProductsResponse -> Bool
== :: GetProductsResponse -> GetProductsResponse -> Bool
$c== :: GetProductsResponse -> GetProductsResponse -> Bool
Prelude.Eq, ReadPrec [GetProductsResponse]
ReadPrec GetProductsResponse
Int -> ReadS GetProductsResponse
ReadS [GetProductsResponse]
(Int -> ReadS GetProductsResponse)
-> ReadS [GetProductsResponse]
-> ReadPrec GetProductsResponse
-> ReadPrec [GetProductsResponse]
-> Read GetProductsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetProductsResponse]
$creadListPrec :: ReadPrec [GetProductsResponse]
readPrec :: ReadPrec GetProductsResponse
$creadPrec :: ReadPrec GetProductsResponse
readList :: ReadS [GetProductsResponse]
$creadList :: ReadS [GetProductsResponse]
readsPrec :: Int -> ReadS GetProductsResponse
$creadsPrec :: Int -> ReadS GetProductsResponse
Prelude.Read, Int -> GetProductsResponse -> ShowS
[GetProductsResponse] -> ShowS
GetProductsResponse -> String
(Int -> GetProductsResponse -> ShowS)
-> (GetProductsResponse -> String)
-> ([GetProductsResponse] -> ShowS)
-> Show GetProductsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetProductsResponse] -> ShowS
$cshowList :: [GetProductsResponse] -> ShowS
show :: GetProductsResponse -> String
$cshow :: GetProductsResponse -> String
showsPrec :: Int -> GetProductsResponse -> ShowS
$cshowsPrec :: Int -> GetProductsResponse -> ShowS
Prelude.Show, (forall x. GetProductsResponse -> Rep GetProductsResponse x)
-> (forall x. Rep GetProductsResponse x -> GetProductsResponse)
-> Generic GetProductsResponse
forall x. Rep GetProductsResponse x -> GetProductsResponse
forall x. GetProductsResponse -> Rep GetProductsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetProductsResponse x -> GetProductsResponse
$cfrom :: forall x. GetProductsResponse -> Rep GetProductsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetProductsResponse' 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:
--
-- 'formatVersion', 'getProductsResponse_formatVersion' - The format version of the response. For example, aws_v1.
--
-- 'nextToken', 'getProductsResponse_nextToken' - The pagination token that indicates the next set of results to retrieve.
--
-- 'priceList', 'getProductsResponse_priceList' - The list of products that match your filters. The list contains both the
-- product metadata and the price information.
--
-- 'httpStatus', 'getProductsResponse_httpStatus' - The response's http status code.
newGetProductsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetProductsResponse
newGetProductsResponse :: Int -> GetProductsResponse
newGetProductsResponse Int
pHttpStatus_ =
  GetProductsResponse' :: Maybe Text
-> Maybe Text -> Maybe [Text] -> Int -> GetProductsResponse
GetProductsResponse'
    { $sel:formatVersion:GetProductsResponse' :: Maybe Text
formatVersion =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetProductsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:priceList:GetProductsResponse' :: Maybe [Text]
priceList = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetProductsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The format version of the response. For example, aws_v1.
getProductsResponse_formatVersion :: Lens.Lens' GetProductsResponse (Prelude.Maybe Prelude.Text)
getProductsResponse_formatVersion :: (Maybe Text -> f (Maybe Text))
-> GetProductsResponse -> f GetProductsResponse
getProductsResponse_formatVersion = (GetProductsResponse -> Maybe Text)
-> (GetProductsResponse -> Maybe Text -> GetProductsResponse)
-> Lens' GetProductsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProductsResponse' {Maybe Text
formatVersion :: Maybe Text
$sel:formatVersion:GetProductsResponse' :: GetProductsResponse -> Maybe Text
formatVersion} -> Maybe Text
formatVersion) (\s :: GetProductsResponse
s@GetProductsResponse' {} Maybe Text
a -> GetProductsResponse
s {$sel:formatVersion:GetProductsResponse' :: Maybe Text
formatVersion = Maybe Text
a} :: GetProductsResponse)

-- | The pagination token that indicates the next set of results to retrieve.
getProductsResponse_nextToken :: Lens.Lens' GetProductsResponse (Prelude.Maybe Prelude.Text)
getProductsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetProductsResponse -> f GetProductsResponse
getProductsResponse_nextToken = (GetProductsResponse -> Maybe Text)
-> (GetProductsResponse -> Maybe Text -> GetProductsResponse)
-> Lens' GetProductsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProductsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetProductsResponse' :: GetProductsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetProductsResponse
s@GetProductsResponse' {} Maybe Text
a -> GetProductsResponse
s {$sel:nextToken:GetProductsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetProductsResponse)

-- | The list of products that match your filters. The list contains both the
-- product metadata and the price information.
getProductsResponse_priceList :: Lens.Lens' GetProductsResponse (Prelude.Maybe [Prelude.Text])
getProductsResponse_priceList :: (Maybe [Text] -> f (Maybe [Text]))
-> GetProductsResponse -> f GetProductsResponse
getProductsResponse_priceList = (GetProductsResponse -> Maybe [Text])
-> (GetProductsResponse -> Maybe [Text] -> GetProductsResponse)
-> Lens' GetProductsResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProductsResponse' {Maybe [Text]
priceList :: Maybe [Text]
$sel:priceList:GetProductsResponse' :: GetProductsResponse -> Maybe [Text]
priceList} -> Maybe [Text]
priceList) (\s :: GetProductsResponse
s@GetProductsResponse' {} Maybe [Text]
a -> GetProductsResponse
s {$sel:priceList:GetProductsResponse' :: Maybe [Text]
priceList = Maybe [Text]
a} :: GetProductsResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> GetProductsResponse -> f GetProductsResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetProductsResponse
-> f GetProductsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData GetProductsResponse