{-# 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.CreateProduct
-- 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)
--
-- Creates a product.
--
-- A delegated admin is authorized to invoke this command.
--
-- The user or role that performs this operation must have the
-- @cloudformation:GetTemplate@ IAM policy permission. This policy
-- permission is required when using the @ImportFromPhysicalId@ template
-- source in the information data section.
module Amazonka.ServiceCatalog.CreateProduct
  ( -- * Creating a Request
    CreateProduct (..),
    newCreateProduct,

    -- * Request Lenses
    createProduct_supportUrl,
    createProduct_distributor,
    createProduct_acceptLanguage,
    createProduct_supportEmail,
    createProduct_description,
    createProduct_tags,
    createProduct_supportDescription,
    createProduct_name,
    createProduct_owner,
    createProduct_productType,
    createProduct_provisioningArtifactParameters,
    createProduct_idempotencyToken,

    -- * Destructuring the Response
    CreateProductResponse (..),
    newCreateProductResponse,

    -- * Response Lenses
    createProductResponse_productViewDetail,
    createProductResponse_provisioningArtifactDetail,
    createProductResponse_tags,
    createProductResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateProduct' smart constructor.
data CreateProduct = CreateProduct'
  { -- | The contact URL for product support.
    --
    -- @^https?:\\\/\\\/\/ @\/ is the pattern used to validate SupportUrl.
    CreateProduct -> Maybe Text
supportUrl :: Prelude.Maybe Prelude.Text,
    -- | The distributor of the product.
    CreateProduct -> Maybe Text
distributor :: Prelude.Maybe Prelude.Text,
    -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    CreateProduct -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The contact email for product support.
    CreateProduct -> Maybe Text
supportEmail :: Prelude.Maybe Prelude.Text,
    -- | The description of the product.
    CreateProduct -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | One or more tags.
    CreateProduct -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The support information about the product.
    CreateProduct -> Maybe Text
supportDescription :: Prelude.Maybe Prelude.Text,
    -- | The name of the product.
    CreateProduct -> Text
name :: Prelude.Text,
    -- | The owner of the product.
    CreateProduct -> Text
owner :: Prelude.Text,
    -- | The type of product.
    CreateProduct -> ProductType
productType :: ProductType,
    -- | The configuration of the provisioning artifact.
    CreateProduct -> ProvisioningArtifactProperties
provisioningArtifactParameters :: ProvisioningArtifactProperties,
    -- | A unique identifier that you provide to ensure idempotency. If multiple
    -- requests differ only by the idempotency token, the same response is
    -- returned for each repeated request.
    CreateProduct -> Text
idempotencyToken :: Prelude.Text
  }
  deriving (CreateProduct -> CreateProduct -> Bool
(CreateProduct -> CreateProduct -> Bool)
-> (CreateProduct -> CreateProduct -> Bool) -> Eq CreateProduct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateProduct -> CreateProduct -> Bool
$c/= :: CreateProduct -> CreateProduct -> Bool
== :: CreateProduct -> CreateProduct -> Bool
$c== :: CreateProduct -> CreateProduct -> Bool
Prelude.Eq, ReadPrec [CreateProduct]
ReadPrec CreateProduct
Int -> ReadS CreateProduct
ReadS [CreateProduct]
(Int -> ReadS CreateProduct)
-> ReadS [CreateProduct]
-> ReadPrec CreateProduct
-> ReadPrec [CreateProduct]
-> Read CreateProduct
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateProduct]
$creadListPrec :: ReadPrec [CreateProduct]
readPrec :: ReadPrec CreateProduct
$creadPrec :: ReadPrec CreateProduct
readList :: ReadS [CreateProduct]
$creadList :: ReadS [CreateProduct]
readsPrec :: Int -> ReadS CreateProduct
$creadsPrec :: Int -> ReadS CreateProduct
Prelude.Read, Int -> CreateProduct -> ShowS
[CreateProduct] -> ShowS
CreateProduct -> String
(Int -> CreateProduct -> ShowS)
-> (CreateProduct -> String)
-> ([CreateProduct] -> ShowS)
-> Show CreateProduct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateProduct] -> ShowS
$cshowList :: [CreateProduct] -> ShowS
show :: CreateProduct -> String
$cshow :: CreateProduct -> String
showsPrec :: Int -> CreateProduct -> ShowS
$cshowsPrec :: Int -> CreateProduct -> ShowS
Prelude.Show, (forall x. CreateProduct -> Rep CreateProduct x)
-> (forall x. Rep CreateProduct x -> CreateProduct)
-> Generic CreateProduct
forall x. Rep CreateProduct x -> CreateProduct
forall x. CreateProduct -> Rep CreateProduct x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateProduct x -> CreateProduct
$cfrom :: forall x. CreateProduct -> Rep CreateProduct x
Prelude.Generic)

-- |
-- Create a value of 'CreateProduct' 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:
--
-- 'supportUrl', 'createProduct_supportUrl' - The contact URL for product support.
--
-- @^https?:\\\/\\\/\/ @\/ is the pattern used to validate SupportUrl.
--
-- 'distributor', 'createProduct_distributor' - The distributor of the product.
--
-- 'acceptLanguage', 'createProduct_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'supportEmail', 'createProduct_supportEmail' - The contact email for product support.
--
-- 'description', 'createProduct_description' - The description of the product.
--
-- 'tags', 'createProduct_tags' - One or more tags.
--
-- 'supportDescription', 'createProduct_supportDescription' - The support information about the product.
--
-- 'name', 'createProduct_name' - The name of the product.
--
-- 'owner', 'createProduct_owner' - The owner of the product.
--
-- 'productType', 'createProduct_productType' - The type of product.
--
-- 'provisioningArtifactParameters', 'createProduct_provisioningArtifactParameters' - The configuration of the provisioning artifact.
--
-- 'idempotencyToken', 'createProduct_idempotencyToken' - A unique identifier that you provide to ensure idempotency. If multiple
-- requests differ only by the idempotency token, the same response is
-- returned for each repeated request.
newCreateProduct ::
  -- | 'name'
  Prelude.Text ->
  -- | 'owner'
  Prelude.Text ->
  -- | 'productType'
  ProductType ->
  -- | 'provisioningArtifactParameters'
  ProvisioningArtifactProperties ->
  -- | 'idempotencyToken'
  Prelude.Text ->
  CreateProduct
newCreateProduct :: Text
-> Text
-> ProductType
-> ProvisioningArtifactProperties
-> Text
-> CreateProduct
newCreateProduct
  Text
pName_
  Text
pOwner_
  ProductType
pProductType_
  ProvisioningArtifactProperties
pProvisioningArtifactParameters_
  Text
pIdempotencyToken_ =
    CreateProduct' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Maybe Text
-> Text
-> Text
-> ProductType
-> ProvisioningArtifactProperties
-> Text
-> CreateProduct
CreateProduct'
      { $sel:supportUrl:CreateProduct' :: Maybe Text
supportUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:distributor:CreateProduct' :: Maybe Text
distributor = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:acceptLanguage:CreateProduct' :: Maybe Text
acceptLanguage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:supportEmail:CreateProduct' :: Maybe Text
supportEmail = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateProduct' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateProduct' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:supportDescription:CreateProduct' :: Maybe Text
supportDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:name:CreateProduct' :: Text
name = Text
pName_,
        $sel:owner:CreateProduct' :: Text
owner = Text
pOwner_,
        $sel:productType:CreateProduct' :: ProductType
productType = ProductType
pProductType_,
        $sel:provisioningArtifactParameters:CreateProduct' :: ProvisioningArtifactProperties
provisioningArtifactParameters =
          ProvisioningArtifactProperties
pProvisioningArtifactParameters_,
        $sel:idempotencyToken:CreateProduct' :: Text
idempotencyToken = Text
pIdempotencyToken_
      }

-- | The contact URL for product support.
--
-- @^https?:\\\/\\\/\/ @\/ is the pattern used to validate SupportUrl.
createProduct_supportUrl :: Lens.Lens' CreateProduct (Prelude.Maybe Prelude.Text)
createProduct_supportUrl :: (Maybe Text -> f (Maybe Text)) -> CreateProduct -> f CreateProduct
createProduct_supportUrl = (CreateProduct -> Maybe Text)
-> (CreateProduct -> Maybe Text -> CreateProduct)
-> Lens CreateProduct CreateProduct (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProduct' {Maybe Text
supportUrl :: Maybe Text
$sel:supportUrl:CreateProduct' :: CreateProduct -> Maybe Text
supportUrl} -> Maybe Text
supportUrl) (\s :: CreateProduct
s@CreateProduct' {} Maybe Text
a -> CreateProduct
s {$sel:supportUrl:CreateProduct' :: Maybe Text
supportUrl = Maybe Text
a} :: CreateProduct)

-- | The distributor of the product.
createProduct_distributor :: Lens.Lens' CreateProduct (Prelude.Maybe Prelude.Text)
createProduct_distributor :: (Maybe Text -> f (Maybe Text)) -> CreateProduct -> f CreateProduct
createProduct_distributor = (CreateProduct -> Maybe Text)
-> (CreateProduct -> Maybe Text -> CreateProduct)
-> Lens CreateProduct CreateProduct (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProduct' {Maybe Text
distributor :: Maybe Text
$sel:distributor:CreateProduct' :: CreateProduct -> Maybe Text
distributor} -> Maybe Text
distributor) (\s :: CreateProduct
s@CreateProduct' {} Maybe Text
a -> CreateProduct
s {$sel:distributor:CreateProduct' :: Maybe Text
distributor = Maybe Text
a} :: CreateProduct)

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

-- | The contact email for product support.
createProduct_supportEmail :: Lens.Lens' CreateProduct (Prelude.Maybe Prelude.Text)
createProduct_supportEmail :: (Maybe Text -> f (Maybe Text)) -> CreateProduct -> f CreateProduct
createProduct_supportEmail = (CreateProduct -> Maybe Text)
-> (CreateProduct -> Maybe Text -> CreateProduct)
-> Lens CreateProduct CreateProduct (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProduct' {Maybe Text
supportEmail :: Maybe Text
$sel:supportEmail:CreateProduct' :: CreateProduct -> Maybe Text
supportEmail} -> Maybe Text
supportEmail) (\s :: CreateProduct
s@CreateProduct' {} Maybe Text
a -> CreateProduct
s {$sel:supportEmail:CreateProduct' :: Maybe Text
supportEmail = Maybe Text
a} :: CreateProduct)

-- | The description of the product.
createProduct_description :: Lens.Lens' CreateProduct (Prelude.Maybe Prelude.Text)
createProduct_description :: (Maybe Text -> f (Maybe Text)) -> CreateProduct -> f CreateProduct
createProduct_description = (CreateProduct -> Maybe Text)
-> (CreateProduct -> Maybe Text -> CreateProduct)
-> Lens CreateProduct CreateProduct (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProduct' {Maybe Text
description :: Maybe Text
$sel:description:CreateProduct' :: CreateProduct -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateProduct
s@CreateProduct' {} Maybe Text
a -> CreateProduct
s {$sel:description:CreateProduct' :: Maybe Text
description = Maybe Text
a} :: CreateProduct)

-- | One or more tags.
createProduct_tags :: Lens.Lens' CreateProduct (Prelude.Maybe [Tag])
createProduct_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateProduct -> f CreateProduct
createProduct_tags = (CreateProduct -> Maybe [Tag])
-> (CreateProduct -> Maybe [Tag] -> CreateProduct)
-> Lens CreateProduct CreateProduct (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProduct' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateProduct' :: CreateProduct -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateProduct
s@CreateProduct' {} Maybe [Tag]
a -> CreateProduct
s {$sel:tags:CreateProduct' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateProduct) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateProduct -> f CreateProduct)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateProduct
-> f CreateProduct
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The support information about the product.
createProduct_supportDescription :: Lens.Lens' CreateProduct (Prelude.Maybe Prelude.Text)
createProduct_supportDescription :: (Maybe Text -> f (Maybe Text)) -> CreateProduct -> f CreateProduct
createProduct_supportDescription = (CreateProduct -> Maybe Text)
-> (CreateProduct -> Maybe Text -> CreateProduct)
-> Lens CreateProduct CreateProduct (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProduct' {Maybe Text
supportDescription :: Maybe Text
$sel:supportDescription:CreateProduct' :: CreateProduct -> Maybe Text
supportDescription} -> Maybe Text
supportDescription) (\s :: CreateProduct
s@CreateProduct' {} Maybe Text
a -> CreateProduct
s {$sel:supportDescription:CreateProduct' :: Maybe Text
supportDescription = Maybe Text
a} :: CreateProduct)

-- | The name of the product.
createProduct_name :: Lens.Lens' CreateProduct Prelude.Text
createProduct_name :: (Text -> f Text) -> CreateProduct -> f CreateProduct
createProduct_name = (CreateProduct -> Text)
-> (CreateProduct -> Text -> CreateProduct)
-> Lens CreateProduct CreateProduct Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProduct' {Text
name :: Text
$sel:name:CreateProduct' :: CreateProduct -> Text
name} -> Text
name) (\s :: CreateProduct
s@CreateProduct' {} Text
a -> CreateProduct
s {$sel:name:CreateProduct' :: Text
name = Text
a} :: CreateProduct)

-- | The owner of the product.
createProduct_owner :: Lens.Lens' CreateProduct Prelude.Text
createProduct_owner :: (Text -> f Text) -> CreateProduct -> f CreateProduct
createProduct_owner = (CreateProduct -> Text)
-> (CreateProduct -> Text -> CreateProduct)
-> Lens CreateProduct CreateProduct Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProduct' {Text
owner :: Text
$sel:owner:CreateProduct' :: CreateProduct -> Text
owner} -> Text
owner) (\s :: CreateProduct
s@CreateProduct' {} Text
a -> CreateProduct
s {$sel:owner:CreateProduct' :: Text
owner = Text
a} :: CreateProduct)

-- | The type of product.
createProduct_productType :: Lens.Lens' CreateProduct ProductType
createProduct_productType :: (ProductType -> f ProductType) -> CreateProduct -> f CreateProduct
createProduct_productType = (CreateProduct -> ProductType)
-> (CreateProduct -> ProductType -> CreateProduct)
-> Lens CreateProduct CreateProduct ProductType ProductType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProduct' {ProductType
productType :: ProductType
$sel:productType:CreateProduct' :: CreateProduct -> ProductType
productType} -> ProductType
productType) (\s :: CreateProduct
s@CreateProduct' {} ProductType
a -> CreateProduct
s {$sel:productType:CreateProduct' :: ProductType
productType = ProductType
a} :: CreateProduct)

-- | The configuration of the provisioning artifact.
createProduct_provisioningArtifactParameters :: Lens.Lens' CreateProduct ProvisioningArtifactProperties
createProduct_provisioningArtifactParameters :: (ProvisioningArtifactProperties
 -> f ProvisioningArtifactProperties)
-> CreateProduct -> f CreateProduct
createProduct_provisioningArtifactParameters = (CreateProduct -> ProvisioningArtifactProperties)
-> (CreateProduct
    -> ProvisioningArtifactProperties -> CreateProduct)
-> Lens
     CreateProduct
     CreateProduct
     ProvisioningArtifactProperties
     ProvisioningArtifactProperties
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProduct' {ProvisioningArtifactProperties
provisioningArtifactParameters :: ProvisioningArtifactProperties
$sel:provisioningArtifactParameters:CreateProduct' :: CreateProduct -> ProvisioningArtifactProperties
provisioningArtifactParameters} -> ProvisioningArtifactProperties
provisioningArtifactParameters) (\s :: CreateProduct
s@CreateProduct' {} ProvisioningArtifactProperties
a -> CreateProduct
s {$sel:provisioningArtifactParameters:CreateProduct' :: ProvisioningArtifactProperties
provisioningArtifactParameters = ProvisioningArtifactProperties
a} :: CreateProduct)

-- | A unique identifier that you provide to ensure idempotency. If multiple
-- requests differ only by the idempotency token, the same response is
-- returned for each repeated request.
createProduct_idempotencyToken :: Lens.Lens' CreateProduct Prelude.Text
createProduct_idempotencyToken :: (Text -> f Text) -> CreateProduct -> f CreateProduct
createProduct_idempotencyToken = (CreateProduct -> Text)
-> (CreateProduct -> Text -> CreateProduct)
-> Lens CreateProduct CreateProduct Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProduct' {Text
idempotencyToken :: Text
$sel:idempotencyToken:CreateProduct' :: CreateProduct -> Text
idempotencyToken} -> Text
idempotencyToken) (\s :: CreateProduct
s@CreateProduct' {} Text
a -> CreateProduct
s {$sel:idempotencyToken:CreateProduct' :: Text
idempotencyToken = Text
a} :: CreateProduct)

instance Core.AWSRequest CreateProduct where
  type
    AWSResponse CreateProduct =
      CreateProductResponse
  request :: CreateProduct -> Request CreateProduct
request = Service -> CreateProduct -> Request CreateProduct
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateProduct
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateProduct)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateProduct))
-> Logger
-> Service
-> Proxy CreateProduct
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateProduct)))
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 ProductViewDetail
-> Maybe ProvisioningArtifactDetail
-> Maybe [Tag]
-> Int
-> CreateProductResponse
CreateProductResponse'
            (Maybe ProductViewDetail
 -> Maybe ProvisioningArtifactDetail
 -> Maybe [Tag]
 -> Int
 -> CreateProductResponse)
-> Either String (Maybe ProductViewDetail)
-> Either
     String
     (Maybe ProvisioningArtifactDetail
      -> Maybe [Tag] -> Int -> CreateProductResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ProductViewDetail)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProductViewDetail")
            Either
  String
  (Maybe ProvisioningArtifactDetail
   -> Maybe [Tag] -> Int -> CreateProductResponse)
-> Either String (Maybe ProvisioningArtifactDetail)
-> Either String (Maybe [Tag] -> Int -> CreateProductResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ProvisioningArtifactDetail)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProvisioningArtifactDetail")
            Either String (Maybe [Tag] -> Int -> CreateProductResponse)
-> Either String (Maybe [Tag])
-> Either String (Int -> CreateProductResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Tag]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Tags" Either String (Maybe (Maybe [Tag]))
-> Maybe [Tag] -> Either String (Maybe [Tag])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Tag]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> CreateProductResponse)
-> Either String Int -> Either String CreateProductResponse
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 CreateProduct

instance Prelude.NFData CreateProduct

instance Core.ToHeaders CreateProduct where
  toHeaders :: CreateProduct -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateProduct -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWS242ServiceCatalogService.CreateProduct" ::
                          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 CreateProduct where
  toJSON :: CreateProduct -> Value
toJSON CreateProduct' {Maybe [Tag]
Maybe Text
Text
ProductType
ProvisioningArtifactProperties
idempotencyToken :: Text
provisioningArtifactParameters :: ProvisioningArtifactProperties
productType :: ProductType
owner :: Text
name :: Text
supportDescription :: Maybe Text
tags :: Maybe [Tag]
description :: Maybe Text
supportEmail :: Maybe Text
acceptLanguage :: Maybe Text
distributor :: Maybe Text
supportUrl :: Maybe Text
$sel:idempotencyToken:CreateProduct' :: CreateProduct -> Text
$sel:provisioningArtifactParameters:CreateProduct' :: CreateProduct -> ProvisioningArtifactProperties
$sel:productType:CreateProduct' :: CreateProduct -> ProductType
$sel:owner:CreateProduct' :: CreateProduct -> Text
$sel:name:CreateProduct' :: CreateProduct -> Text
$sel:supportDescription:CreateProduct' :: CreateProduct -> Maybe Text
$sel:tags:CreateProduct' :: CreateProduct -> Maybe [Tag]
$sel:description:CreateProduct' :: CreateProduct -> Maybe Text
$sel:supportEmail:CreateProduct' :: CreateProduct -> Maybe Text
$sel:acceptLanguage:CreateProduct' :: CreateProduct -> Maybe Text
$sel:distributor:CreateProduct' :: CreateProduct -> Maybe Text
$sel:supportUrl:CreateProduct' :: CreateProduct -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SupportUrl" 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
supportUrl,
            (Text
"Distributor" 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
distributor,
            (Text
"AcceptLanguage" 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
acceptLanguage,
            (Text
"SupportEmail" 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
supportEmail,
            (Text
"Description" 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
description,
            (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            (Text
"SupportDescription" 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
supportDescription,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Owner" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
owner),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ProductType" Text -> ProductType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ProductType
productType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"ProvisioningArtifactParameters"
                  Text -> ProvisioningArtifactProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ProvisioningArtifactProperties
provisioningArtifactParameters
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"IdempotencyToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
idempotencyToken)
          ]
      )

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

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

-- | /See:/ 'newCreateProductResponse' smart constructor.
data CreateProductResponse = CreateProductResponse'
  { -- | Information about the product view.
    CreateProductResponse -> Maybe ProductViewDetail
productViewDetail :: Prelude.Maybe ProductViewDetail,
    -- | Information about the provisioning artifact.
    CreateProductResponse -> Maybe ProvisioningArtifactDetail
provisioningArtifactDetail :: Prelude.Maybe ProvisioningArtifactDetail,
    -- | Information about the tags associated with the product.
    CreateProductResponse -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The response's http status code.
    CreateProductResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateProductResponse -> CreateProductResponse -> Bool
(CreateProductResponse -> CreateProductResponse -> Bool)
-> (CreateProductResponse -> CreateProductResponse -> Bool)
-> Eq CreateProductResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateProductResponse -> CreateProductResponse -> Bool
$c/= :: CreateProductResponse -> CreateProductResponse -> Bool
== :: CreateProductResponse -> CreateProductResponse -> Bool
$c== :: CreateProductResponse -> CreateProductResponse -> Bool
Prelude.Eq, ReadPrec [CreateProductResponse]
ReadPrec CreateProductResponse
Int -> ReadS CreateProductResponse
ReadS [CreateProductResponse]
(Int -> ReadS CreateProductResponse)
-> ReadS [CreateProductResponse]
-> ReadPrec CreateProductResponse
-> ReadPrec [CreateProductResponse]
-> Read CreateProductResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateProductResponse]
$creadListPrec :: ReadPrec [CreateProductResponse]
readPrec :: ReadPrec CreateProductResponse
$creadPrec :: ReadPrec CreateProductResponse
readList :: ReadS [CreateProductResponse]
$creadList :: ReadS [CreateProductResponse]
readsPrec :: Int -> ReadS CreateProductResponse
$creadsPrec :: Int -> ReadS CreateProductResponse
Prelude.Read, Int -> CreateProductResponse -> ShowS
[CreateProductResponse] -> ShowS
CreateProductResponse -> String
(Int -> CreateProductResponse -> ShowS)
-> (CreateProductResponse -> String)
-> ([CreateProductResponse] -> ShowS)
-> Show CreateProductResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateProductResponse] -> ShowS
$cshowList :: [CreateProductResponse] -> ShowS
show :: CreateProductResponse -> String
$cshow :: CreateProductResponse -> String
showsPrec :: Int -> CreateProductResponse -> ShowS
$cshowsPrec :: Int -> CreateProductResponse -> ShowS
Prelude.Show, (forall x. CreateProductResponse -> Rep CreateProductResponse x)
-> (forall x. Rep CreateProductResponse x -> CreateProductResponse)
-> Generic CreateProductResponse
forall x. Rep CreateProductResponse x -> CreateProductResponse
forall x. CreateProductResponse -> Rep CreateProductResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateProductResponse x -> CreateProductResponse
$cfrom :: forall x. CreateProductResponse -> Rep CreateProductResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateProductResponse' 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:
--
-- 'productViewDetail', 'createProductResponse_productViewDetail' - Information about the product view.
--
-- 'provisioningArtifactDetail', 'createProductResponse_provisioningArtifactDetail' - Information about the provisioning artifact.
--
-- 'tags', 'createProductResponse_tags' - Information about the tags associated with the product.
--
-- 'httpStatus', 'createProductResponse_httpStatus' - The response's http status code.
newCreateProductResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateProductResponse
newCreateProductResponse :: Int -> CreateProductResponse
newCreateProductResponse Int
pHttpStatus_ =
  CreateProductResponse' :: Maybe ProductViewDetail
-> Maybe ProvisioningArtifactDetail
-> Maybe [Tag]
-> Int
-> CreateProductResponse
CreateProductResponse'
    { $sel:productViewDetail:CreateProductResponse' :: Maybe ProductViewDetail
productViewDetail =
        Maybe ProductViewDetail
forall a. Maybe a
Prelude.Nothing,
      $sel:provisioningArtifactDetail:CreateProductResponse' :: Maybe ProvisioningArtifactDetail
provisioningArtifactDetail = Maybe ProvisioningArtifactDetail
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateProductResponse' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateProductResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the product view.
createProductResponse_productViewDetail :: Lens.Lens' CreateProductResponse (Prelude.Maybe ProductViewDetail)
createProductResponse_productViewDetail :: (Maybe ProductViewDetail -> f (Maybe ProductViewDetail))
-> CreateProductResponse -> f CreateProductResponse
createProductResponse_productViewDetail = (CreateProductResponse -> Maybe ProductViewDetail)
-> (CreateProductResponse
    -> Maybe ProductViewDetail -> CreateProductResponse)
-> Lens
     CreateProductResponse
     CreateProductResponse
     (Maybe ProductViewDetail)
     (Maybe ProductViewDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProductResponse' {Maybe ProductViewDetail
productViewDetail :: Maybe ProductViewDetail
$sel:productViewDetail:CreateProductResponse' :: CreateProductResponse -> Maybe ProductViewDetail
productViewDetail} -> Maybe ProductViewDetail
productViewDetail) (\s :: CreateProductResponse
s@CreateProductResponse' {} Maybe ProductViewDetail
a -> CreateProductResponse
s {$sel:productViewDetail:CreateProductResponse' :: Maybe ProductViewDetail
productViewDetail = Maybe ProductViewDetail
a} :: CreateProductResponse)

-- | Information about the provisioning artifact.
createProductResponse_provisioningArtifactDetail :: Lens.Lens' CreateProductResponse (Prelude.Maybe ProvisioningArtifactDetail)
createProductResponse_provisioningArtifactDetail :: (Maybe ProvisioningArtifactDetail
 -> f (Maybe ProvisioningArtifactDetail))
-> CreateProductResponse -> f CreateProductResponse
createProductResponse_provisioningArtifactDetail = (CreateProductResponse -> Maybe ProvisioningArtifactDetail)
-> (CreateProductResponse
    -> Maybe ProvisioningArtifactDetail -> CreateProductResponse)
-> Lens
     CreateProductResponse
     CreateProductResponse
     (Maybe ProvisioningArtifactDetail)
     (Maybe ProvisioningArtifactDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProductResponse' {Maybe ProvisioningArtifactDetail
provisioningArtifactDetail :: Maybe ProvisioningArtifactDetail
$sel:provisioningArtifactDetail:CreateProductResponse' :: CreateProductResponse -> Maybe ProvisioningArtifactDetail
provisioningArtifactDetail} -> Maybe ProvisioningArtifactDetail
provisioningArtifactDetail) (\s :: CreateProductResponse
s@CreateProductResponse' {} Maybe ProvisioningArtifactDetail
a -> CreateProductResponse
s {$sel:provisioningArtifactDetail:CreateProductResponse' :: Maybe ProvisioningArtifactDetail
provisioningArtifactDetail = Maybe ProvisioningArtifactDetail
a} :: CreateProductResponse)

-- | Information about the tags associated with the product.
createProductResponse_tags :: Lens.Lens' CreateProductResponse (Prelude.Maybe [Tag])
createProductResponse_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateProductResponse -> f CreateProductResponse
createProductResponse_tags = (CreateProductResponse -> Maybe [Tag])
-> (CreateProductResponse -> Maybe [Tag] -> CreateProductResponse)
-> Lens
     CreateProductResponse
     CreateProductResponse
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProductResponse' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateProductResponse' :: CreateProductResponse -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateProductResponse
s@CreateProductResponse' {} Maybe [Tag]
a -> CreateProductResponse
s {$sel:tags:CreateProductResponse' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateProductResponse) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateProductResponse -> f CreateProductResponse)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateProductResponse
-> f CreateProductResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData CreateProductResponse