{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.ServiceCatalog.ListProvisioningArtifacts
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists all provisioning artifacts (also known as versions) for the
-- specified product.
module Amazonka.ServiceCatalog.ListProvisioningArtifacts
  ( -- * Creating a Request
    ListProvisioningArtifacts (..),
    newListProvisioningArtifacts,

    -- * Request Lenses
    listProvisioningArtifacts_acceptLanguage,
    listProvisioningArtifacts_productId,

    -- * Destructuring the Response
    ListProvisioningArtifactsResponse (..),
    newListProvisioningArtifactsResponse,

    -- * Response Lenses
    listProvisioningArtifactsResponse_nextPageToken,
    listProvisioningArtifactsResponse_provisioningArtifactDetails,
    listProvisioningArtifactsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.ServiceCatalog.Types

-- | /See:/ 'newListProvisioningArtifacts' smart constructor.
data ListProvisioningArtifacts = ListProvisioningArtifacts'
  { -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    ListProvisioningArtifacts -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The product identifier.
    ListProvisioningArtifacts -> Text
productId :: Prelude.Text
  }
  deriving (ListProvisioningArtifacts -> ListProvisioningArtifacts -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProvisioningArtifacts -> ListProvisioningArtifacts -> Bool
$c/= :: ListProvisioningArtifacts -> ListProvisioningArtifacts -> Bool
== :: ListProvisioningArtifacts -> ListProvisioningArtifacts -> Bool
$c== :: ListProvisioningArtifacts -> ListProvisioningArtifacts -> Bool
Prelude.Eq, ReadPrec [ListProvisioningArtifacts]
ReadPrec ListProvisioningArtifacts
Int -> ReadS ListProvisioningArtifacts
ReadS [ListProvisioningArtifacts]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProvisioningArtifacts]
$creadListPrec :: ReadPrec [ListProvisioningArtifacts]
readPrec :: ReadPrec ListProvisioningArtifacts
$creadPrec :: ReadPrec ListProvisioningArtifacts
readList :: ReadS [ListProvisioningArtifacts]
$creadList :: ReadS [ListProvisioningArtifacts]
readsPrec :: Int -> ReadS ListProvisioningArtifacts
$creadsPrec :: Int -> ReadS ListProvisioningArtifacts
Prelude.Read, Int -> ListProvisioningArtifacts -> ShowS
[ListProvisioningArtifacts] -> ShowS
ListProvisioningArtifacts -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProvisioningArtifacts] -> ShowS
$cshowList :: [ListProvisioningArtifacts] -> ShowS
show :: ListProvisioningArtifacts -> String
$cshow :: ListProvisioningArtifacts -> String
showsPrec :: Int -> ListProvisioningArtifacts -> ShowS
$cshowsPrec :: Int -> ListProvisioningArtifacts -> ShowS
Prelude.Show, forall x.
Rep ListProvisioningArtifacts x -> ListProvisioningArtifacts
forall x.
ListProvisioningArtifacts -> Rep ListProvisioningArtifacts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListProvisioningArtifacts x -> ListProvisioningArtifacts
$cfrom :: forall x.
ListProvisioningArtifacts -> Rep ListProvisioningArtifacts x
Prelude.Generic)

-- |
-- Create a value of 'ListProvisioningArtifacts' 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:
--
-- 'acceptLanguage', 'listProvisioningArtifacts_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'productId', 'listProvisioningArtifacts_productId' - The product identifier.
newListProvisioningArtifacts ::
  -- | 'productId'
  Prelude.Text ->
  ListProvisioningArtifacts
newListProvisioningArtifacts :: Text -> ListProvisioningArtifacts
newListProvisioningArtifacts Text
pProductId_ =
  ListProvisioningArtifacts'
    { $sel:acceptLanguage:ListProvisioningArtifacts' :: Maybe Text
acceptLanguage =
        forall a. Maybe a
Prelude.Nothing,
      $sel:productId:ListProvisioningArtifacts' :: Text
productId = Text
pProductId_
    }

-- | The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
listProvisioningArtifacts_acceptLanguage :: Lens.Lens' ListProvisioningArtifacts (Prelude.Maybe Prelude.Text)
listProvisioningArtifacts_acceptLanguage :: Lens' ListProvisioningArtifacts (Maybe Text)
listProvisioningArtifacts_acceptLanguage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisioningArtifacts' {Maybe Text
acceptLanguage :: Maybe Text
$sel:acceptLanguage:ListProvisioningArtifacts' :: ListProvisioningArtifacts -> Maybe Text
acceptLanguage} -> Maybe Text
acceptLanguage) (\s :: ListProvisioningArtifacts
s@ListProvisioningArtifacts' {} Maybe Text
a -> ListProvisioningArtifacts
s {$sel:acceptLanguage:ListProvisioningArtifacts' :: Maybe Text
acceptLanguage = Maybe Text
a} :: ListProvisioningArtifacts)

-- | The product identifier.
listProvisioningArtifacts_productId :: Lens.Lens' ListProvisioningArtifacts Prelude.Text
listProvisioningArtifacts_productId :: Lens' ListProvisioningArtifacts Text
listProvisioningArtifacts_productId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisioningArtifacts' {Text
productId :: Text
$sel:productId:ListProvisioningArtifacts' :: ListProvisioningArtifacts -> Text
productId} -> Text
productId) (\s :: ListProvisioningArtifacts
s@ListProvisioningArtifacts' {} Text
a -> ListProvisioningArtifacts
s {$sel:productId:ListProvisioningArtifacts' :: Text
productId = Text
a} :: ListProvisioningArtifacts)

instance Core.AWSRequest ListProvisioningArtifacts where
  type
    AWSResponse ListProvisioningArtifacts =
      ListProvisioningArtifactsResponse
  request :: (Service -> Service)
-> ListProvisioningArtifacts -> Request ListProvisioningArtifacts
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListProvisioningArtifacts
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListProvisioningArtifacts)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [ProvisioningArtifactDetail]
-> Int
-> ListProvisioningArtifactsResponse
ListProvisioningArtifactsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextPageToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ProvisioningArtifactDetails"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListProvisioningArtifacts where
  hashWithSalt :: Int -> ListProvisioningArtifacts -> Int
hashWithSalt Int
_salt ListProvisioningArtifacts' {Maybe Text
Text
productId :: Text
acceptLanguage :: Maybe Text
$sel:productId:ListProvisioningArtifacts' :: ListProvisioningArtifacts -> Text
$sel:acceptLanguage:ListProvisioningArtifacts' :: ListProvisioningArtifacts -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
acceptLanguage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
productId

instance Prelude.NFData ListProvisioningArtifacts where
  rnf :: ListProvisioningArtifacts -> ()
rnf ListProvisioningArtifacts' {Maybe Text
Text
productId :: Text
acceptLanguage :: Maybe Text
$sel:productId:ListProvisioningArtifacts' :: ListProvisioningArtifacts -> Text
$sel:acceptLanguage:ListProvisioningArtifacts' :: ListProvisioningArtifacts -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
acceptLanguage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
productId

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

instance Data.ToJSON ListProvisioningArtifacts where
  toJSON :: ListProvisioningArtifacts -> Value
toJSON ListProvisioningArtifacts' {Maybe Text
Text
productId :: Text
acceptLanguage :: Maybe Text
$sel:productId:ListProvisioningArtifacts' :: ListProvisioningArtifacts -> Text
$sel:acceptLanguage:ListProvisioningArtifacts' :: ListProvisioningArtifacts -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AcceptLanguage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
acceptLanguage,
            forall a. a -> Maybe a
Prelude.Just (Key
"ProductId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
productId)
          ]
      )

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

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

-- | /See:/ 'newListProvisioningArtifactsResponse' smart constructor.
data ListProvisioningArtifactsResponse = ListProvisioningArtifactsResponse'
  { -- | The page token to use to retrieve the next set of results. If there are
    -- no additional results, this value is null.
    ListProvisioningArtifactsResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | Information about the provisioning artifacts.
    ListProvisioningArtifactsResponse
-> Maybe [ProvisioningArtifactDetail]
provisioningArtifactDetails :: Prelude.Maybe [ProvisioningArtifactDetail],
    -- | The response's http status code.
    ListProvisioningArtifactsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListProvisioningArtifactsResponse
-> ListProvisioningArtifactsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProvisioningArtifactsResponse
-> ListProvisioningArtifactsResponse -> Bool
$c/= :: ListProvisioningArtifactsResponse
-> ListProvisioningArtifactsResponse -> Bool
== :: ListProvisioningArtifactsResponse
-> ListProvisioningArtifactsResponse -> Bool
$c== :: ListProvisioningArtifactsResponse
-> ListProvisioningArtifactsResponse -> Bool
Prelude.Eq, ReadPrec [ListProvisioningArtifactsResponse]
ReadPrec ListProvisioningArtifactsResponse
Int -> ReadS ListProvisioningArtifactsResponse
ReadS [ListProvisioningArtifactsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProvisioningArtifactsResponse]
$creadListPrec :: ReadPrec [ListProvisioningArtifactsResponse]
readPrec :: ReadPrec ListProvisioningArtifactsResponse
$creadPrec :: ReadPrec ListProvisioningArtifactsResponse
readList :: ReadS [ListProvisioningArtifactsResponse]
$creadList :: ReadS [ListProvisioningArtifactsResponse]
readsPrec :: Int -> ReadS ListProvisioningArtifactsResponse
$creadsPrec :: Int -> ReadS ListProvisioningArtifactsResponse
Prelude.Read, Int -> ListProvisioningArtifactsResponse -> ShowS
[ListProvisioningArtifactsResponse] -> ShowS
ListProvisioningArtifactsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProvisioningArtifactsResponse] -> ShowS
$cshowList :: [ListProvisioningArtifactsResponse] -> ShowS
show :: ListProvisioningArtifactsResponse -> String
$cshow :: ListProvisioningArtifactsResponse -> String
showsPrec :: Int -> ListProvisioningArtifactsResponse -> ShowS
$cshowsPrec :: Int -> ListProvisioningArtifactsResponse -> ShowS
Prelude.Show, forall x.
Rep ListProvisioningArtifactsResponse x
-> ListProvisioningArtifactsResponse
forall x.
ListProvisioningArtifactsResponse
-> Rep ListProvisioningArtifactsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListProvisioningArtifactsResponse x
-> ListProvisioningArtifactsResponse
$cfrom :: forall x.
ListProvisioningArtifactsResponse
-> Rep ListProvisioningArtifactsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListProvisioningArtifactsResponse' 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:
--
-- 'nextPageToken', 'listProvisioningArtifactsResponse_nextPageToken' - The page token to use to retrieve the next set of results. If there are
-- no additional results, this value is null.
--
-- 'provisioningArtifactDetails', 'listProvisioningArtifactsResponse_provisioningArtifactDetails' - Information about the provisioning artifacts.
--
-- 'httpStatus', 'listProvisioningArtifactsResponse_httpStatus' - The response's http status code.
newListProvisioningArtifactsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListProvisioningArtifactsResponse
newListProvisioningArtifactsResponse :: Int -> ListProvisioningArtifactsResponse
newListProvisioningArtifactsResponse Int
pHttpStatus_ =
  ListProvisioningArtifactsResponse'
    { $sel:nextPageToken:ListProvisioningArtifactsResponse' :: Maybe Text
nextPageToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:provisioningArtifactDetails:ListProvisioningArtifactsResponse' :: Maybe [ProvisioningArtifactDetail]
provisioningArtifactDetails =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListProvisioningArtifactsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The page token to use to retrieve the next set of results. If there are
-- no additional results, this value is null.
listProvisioningArtifactsResponse_nextPageToken :: Lens.Lens' ListProvisioningArtifactsResponse (Prelude.Maybe Prelude.Text)
listProvisioningArtifactsResponse_nextPageToken :: Lens' ListProvisioningArtifactsResponse (Maybe Text)
listProvisioningArtifactsResponse_nextPageToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisioningArtifactsResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:ListProvisioningArtifactsResponse' :: ListProvisioningArtifactsResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: ListProvisioningArtifactsResponse
s@ListProvisioningArtifactsResponse' {} Maybe Text
a -> ListProvisioningArtifactsResponse
s {$sel:nextPageToken:ListProvisioningArtifactsResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: ListProvisioningArtifactsResponse)

-- | Information about the provisioning artifacts.
listProvisioningArtifactsResponse_provisioningArtifactDetails :: Lens.Lens' ListProvisioningArtifactsResponse (Prelude.Maybe [ProvisioningArtifactDetail])
listProvisioningArtifactsResponse_provisioningArtifactDetails :: Lens'
  ListProvisioningArtifactsResponse
  (Maybe [ProvisioningArtifactDetail])
listProvisioningArtifactsResponse_provisioningArtifactDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProvisioningArtifactsResponse' {Maybe [ProvisioningArtifactDetail]
provisioningArtifactDetails :: Maybe [ProvisioningArtifactDetail]
$sel:provisioningArtifactDetails:ListProvisioningArtifactsResponse' :: ListProvisioningArtifactsResponse
-> Maybe [ProvisioningArtifactDetail]
provisioningArtifactDetails} -> Maybe [ProvisioningArtifactDetail]
provisioningArtifactDetails) (\s :: ListProvisioningArtifactsResponse
s@ListProvisioningArtifactsResponse' {} Maybe [ProvisioningArtifactDetail]
a -> ListProvisioningArtifactsResponse
s {$sel:provisioningArtifactDetails:ListProvisioningArtifactsResponse' :: Maybe [ProvisioningArtifactDetail]
provisioningArtifactDetails = Maybe [ProvisioningArtifactDetail]
a} :: ListProvisioningArtifactsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListProvisioningArtifactsResponse
  where
  rnf :: ListProvisioningArtifactsResponse -> ()
rnf ListProvisioningArtifactsResponse' {Int
Maybe [ProvisioningArtifactDetail]
Maybe Text
httpStatus :: Int
provisioningArtifactDetails :: Maybe [ProvisioningArtifactDetail]
nextPageToken :: Maybe Text
$sel:httpStatus:ListProvisioningArtifactsResponse' :: ListProvisioningArtifactsResponse -> Int
$sel:provisioningArtifactDetails:ListProvisioningArtifactsResponse' :: ListProvisioningArtifactsResponse
-> Maybe [ProvisioningArtifactDetail]
$sel:nextPageToken:ListProvisioningArtifactsResponse' :: ListProvisioningArtifactsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextPageToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ProvisioningArtifactDetail]
provisioningArtifactDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus