amazonka-servicecatalog-2.0: gen/Amazonka/ServiceCatalog/CreateProduct.hs
{-# 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-2023 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay
-- 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_acceptLanguage,
createProduct_description,
createProduct_distributor,
createProduct_provisioningArtifactParameters,
createProduct_sourceConnection,
createProduct_supportDescription,
createProduct_supportEmail,
createProduct_supportUrl,
createProduct_tags,
createProduct_name,
createProduct_owner,
createProduct_productType,
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.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:/ 'newCreateProduct' smart constructor.
data CreateProduct = CreateProduct'
{ -- | The language code.
--
-- - @en@ - English (default)
--
-- - @jp@ - Japanese
--
-- - @zh@ - Chinese
acceptLanguage :: Prelude.Maybe Prelude.Text,
-- | The description of the product.
description :: Prelude.Maybe Prelude.Text,
-- | The distributor of the product.
distributor :: Prelude.Maybe Prelude.Text,
-- | The configuration of the provisioning artifact.
provisioningArtifactParameters :: Prelude.Maybe ProvisioningArtifactProperties,
-- | Specifies connection details for the created product and syncs the
-- product to the connection source artifact. This automatically manages
-- the product\'s artifacts based on changes to the source. The
-- @SourceConnection@ parameter consists of the following sub-fields.
--
-- - @Type@
--
-- - @ConnectionParamters@
sourceConnection :: Prelude.Maybe SourceConnection,
-- | The support information about the product.
supportDescription :: Prelude.Maybe Prelude.Text,
-- | The contact email for product support.
supportEmail :: Prelude.Maybe Prelude.Text,
-- | The contact URL for product support.
--
-- @^https?:\\\/\\\/\/ @\/ is the pattern used to validate SupportUrl.
supportUrl :: Prelude.Maybe Prelude.Text,
-- | One or more tags.
tags :: Prelude.Maybe [Tag],
-- | The name of the product.
name :: Prelude.Text,
-- | The owner of the product.
owner :: Prelude.Text,
-- | The type of product.
productType :: ProductType,
-- | 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.
idempotencyToken :: Prelude.Text
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, 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:
--
-- 'acceptLanguage', 'createProduct_acceptLanguage' - The language code.
--
-- - @en@ - English (default)
--
-- - @jp@ - Japanese
--
-- - @zh@ - Chinese
--
-- 'description', 'createProduct_description' - The description of the product.
--
-- 'distributor', 'createProduct_distributor' - The distributor of the product.
--
-- 'provisioningArtifactParameters', 'createProduct_provisioningArtifactParameters' - The configuration of the provisioning artifact.
--
-- 'sourceConnection', 'createProduct_sourceConnection' - Specifies connection details for the created product and syncs the
-- product to the connection source artifact. This automatically manages
-- the product\'s artifacts based on changes to the source. The
-- @SourceConnection@ parameter consists of the following sub-fields.
--
-- - @Type@
--
-- - @ConnectionParamters@
--
-- 'supportDescription', 'createProduct_supportDescription' - The support information about the product.
--
-- 'supportEmail', 'createProduct_supportEmail' - The contact email for product support.
--
-- 'supportUrl', 'createProduct_supportUrl' - The contact URL for product support.
--
-- @^https?:\\\/\\\/\/ @\/ is the pattern used to validate SupportUrl.
--
-- 'tags', 'createProduct_tags' - One or more tags.
--
-- 'name', 'createProduct_name' - The name of the product.
--
-- 'owner', 'createProduct_owner' - The owner of the product.
--
-- 'productType', 'createProduct_productType' - The type of product.
--
-- '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 ->
-- | 'idempotencyToken'
Prelude.Text ->
CreateProduct
newCreateProduct
pName_
pOwner_
pProductType_
pIdempotencyToken_ =
CreateProduct'
{ acceptLanguage = Prelude.Nothing,
description = Prelude.Nothing,
distributor = Prelude.Nothing,
provisioningArtifactParameters = Prelude.Nothing,
sourceConnection = Prelude.Nothing,
supportDescription = Prelude.Nothing,
supportEmail = Prelude.Nothing,
supportUrl = Prelude.Nothing,
tags = Prelude.Nothing,
name = pName_,
owner = pOwner_,
productType = pProductType_,
idempotencyToken = pIdempotencyToken_
}
-- | The language code.
--
-- - @en@ - English (default)
--
-- - @jp@ - Japanese
--
-- - @zh@ - Chinese
createProduct_acceptLanguage :: Lens.Lens' CreateProduct (Prelude.Maybe Prelude.Text)
createProduct_acceptLanguage = Lens.lens (\CreateProduct' {acceptLanguage} -> acceptLanguage) (\s@CreateProduct' {} a -> s {acceptLanguage = a} :: CreateProduct)
-- | The description of the product.
createProduct_description :: Lens.Lens' CreateProduct (Prelude.Maybe Prelude.Text)
createProduct_description = Lens.lens (\CreateProduct' {description} -> description) (\s@CreateProduct' {} a -> s {description = a} :: CreateProduct)
-- | The distributor of the product.
createProduct_distributor :: Lens.Lens' CreateProduct (Prelude.Maybe Prelude.Text)
createProduct_distributor = Lens.lens (\CreateProduct' {distributor} -> distributor) (\s@CreateProduct' {} a -> s {distributor = a} :: CreateProduct)
-- | The configuration of the provisioning artifact.
createProduct_provisioningArtifactParameters :: Lens.Lens' CreateProduct (Prelude.Maybe ProvisioningArtifactProperties)
createProduct_provisioningArtifactParameters = Lens.lens (\CreateProduct' {provisioningArtifactParameters} -> provisioningArtifactParameters) (\s@CreateProduct' {} a -> s {provisioningArtifactParameters = a} :: CreateProduct)
-- | Specifies connection details for the created product and syncs the
-- product to the connection source artifact. This automatically manages
-- the product\'s artifacts based on changes to the source. The
-- @SourceConnection@ parameter consists of the following sub-fields.
--
-- - @Type@
--
-- - @ConnectionParamters@
createProduct_sourceConnection :: Lens.Lens' CreateProduct (Prelude.Maybe SourceConnection)
createProduct_sourceConnection = Lens.lens (\CreateProduct' {sourceConnection} -> sourceConnection) (\s@CreateProduct' {} a -> s {sourceConnection = a} :: CreateProduct)
-- | The support information about the product.
createProduct_supportDescription :: Lens.Lens' CreateProduct (Prelude.Maybe Prelude.Text)
createProduct_supportDescription = Lens.lens (\CreateProduct' {supportDescription} -> supportDescription) (\s@CreateProduct' {} a -> s {supportDescription = a} :: CreateProduct)
-- | The contact email for product support.
createProduct_supportEmail :: Lens.Lens' CreateProduct (Prelude.Maybe Prelude.Text)
createProduct_supportEmail = Lens.lens (\CreateProduct' {supportEmail} -> supportEmail) (\s@CreateProduct' {} a -> s {supportEmail = a} :: CreateProduct)
-- | 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 = Lens.lens (\CreateProduct' {supportUrl} -> supportUrl) (\s@CreateProduct' {} a -> s {supportUrl = a} :: CreateProduct)
-- | One or more tags.
createProduct_tags :: Lens.Lens' CreateProduct (Prelude.Maybe [Tag])
createProduct_tags = Lens.lens (\CreateProduct' {tags} -> tags) (\s@CreateProduct' {} a -> s {tags = a} :: CreateProduct) Prelude.. Lens.mapping Lens.coerced
-- | The name of the product.
createProduct_name :: Lens.Lens' CreateProduct Prelude.Text
createProduct_name = Lens.lens (\CreateProduct' {name} -> name) (\s@CreateProduct' {} a -> s {name = a} :: CreateProduct)
-- | The owner of the product.
createProduct_owner :: Lens.Lens' CreateProduct Prelude.Text
createProduct_owner = Lens.lens (\CreateProduct' {owner} -> owner) (\s@CreateProduct' {} a -> s {owner = a} :: CreateProduct)
-- | The type of product.
createProduct_productType :: Lens.Lens' CreateProduct ProductType
createProduct_productType = Lens.lens (\CreateProduct' {productType} -> productType) (\s@CreateProduct' {} a -> s {productType = 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 = Lens.lens (\CreateProduct' {idempotencyToken} -> idempotencyToken) (\s@CreateProduct' {} a -> s {idempotencyToken = a} :: CreateProduct)
instance Core.AWSRequest CreateProduct where
type
AWSResponse CreateProduct =
CreateProductResponse
request overrides =
Request.postJSON (overrides defaultService)
response =
Response.receiveJSON
( \s h x ->
CreateProductResponse'
Prelude.<$> (x Data..?> "ProductViewDetail")
Prelude.<*> (x Data..?> "ProvisioningArtifactDetail")
Prelude.<*> (x Data..?> "Tags" Core..!@ Prelude.mempty)
Prelude.<*> (Prelude.pure (Prelude.fromEnum s))
)
instance Prelude.Hashable CreateProduct where
hashWithSalt _salt CreateProduct' {..} =
_salt
`Prelude.hashWithSalt` acceptLanguage
`Prelude.hashWithSalt` description
`Prelude.hashWithSalt` distributor
`Prelude.hashWithSalt` provisioningArtifactParameters
`Prelude.hashWithSalt` sourceConnection
`Prelude.hashWithSalt` supportDescription
`Prelude.hashWithSalt` supportEmail
`Prelude.hashWithSalt` supportUrl
`Prelude.hashWithSalt` tags
`Prelude.hashWithSalt` name
`Prelude.hashWithSalt` owner
`Prelude.hashWithSalt` productType
`Prelude.hashWithSalt` idempotencyToken
instance Prelude.NFData CreateProduct where
rnf CreateProduct' {..} =
Prelude.rnf acceptLanguage
`Prelude.seq` Prelude.rnf description
`Prelude.seq` Prelude.rnf distributor
`Prelude.seq` Prelude.rnf provisioningArtifactParameters
`Prelude.seq` Prelude.rnf sourceConnection
`Prelude.seq` Prelude.rnf supportDescription
`Prelude.seq` Prelude.rnf supportEmail
`Prelude.seq` Prelude.rnf supportUrl
`Prelude.seq` Prelude.rnf tags
`Prelude.seq` Prelude.rnf name
`Prelude.seq` Prelude.rnf owner
`Prelude.seq` Prelude.rnf productType
`Prelude.seq` Prelude.rnf idempotencyToken
instance Data.ToHeaders CreateProduct where
toHeaders =
Prelude.const
( Prelude.mconcat
[ "X-Amz-Target"
Data.=# ( "AWS242ServiceCatalogService.CreateProduct" ::
Prelude.ByteString
),
"Content-Type"
Data.=# ( "application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateProduct where
toJSON CreateProduct' {..} =
Data.object
( Prelude.catMaybes
[ ("AcceptLanguage" Data..=)
Prelude.<$> acceptLanguage,
("Description" Data..=) Prelude.<$> description,
("Distributor" Data..=) Prelude.<$> distributor,
("ProvisioningArtifactParameters" Data..=)
Prelude.<$> provisioningArtifactParameters,
("SourceConnection" Data..=)
Prelude.<$> sourceConnection,
("SupportDescription" Data..=)
Prelude.<$> supportDescription,
("SupportEmail" Data..=) Prelude.<$> supportEmail,
("SupportUrl" Data..=) Prelude.<$> supportUrl,
("Tags" Data..=) Prelude.<$> tags,
Prelude.Just ("Name" Data..= name),
Prelude.Just ("Owner" Data..= owner),
Prelude.Just ("ProductType" Data..= productType),
Prelude.Just
("IdempotencyToken" Data..= idempotencyToken)
]
)
instance Data.ToPath CreateProduct where
toPath = Prelude.const "/"
instance Data.ToQuery CreateProduct where
toQuery = Prelude.const Prelude.mempty
-- | /See:/ 'newCreateProductResponse' smart constructor.
data CreateProductResponse = CreateProductResponse'
{ -- | Information about the product view.
productViewDetail :: Prelude.Maybe ProductViewDetail,
-- | Information about the provisioning artifact.
provisioningArtifactDetail :: Prelude.Maybe ProvisioningArtifactDetail,
-- | Information about the tags associated with the product.
tags :: Prelude.Maybe [Tag],
-- | The response's http status code.
httpStatus :: Prelude.Int
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, 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 pHttpStatus_ =
CreateProductResponse'
{ productViewDetail =
Prelude.Nothing,
provisioningArtifactDetail = Prelude.Nothing,
tags = Prelude.Nothing,
httpStatus = pHttpStatus_
}
-- | Information about the product view.
createProductResponse_productViewDetail :: Lens.Lens' CreateProductResponse (Prelude.Maybe ProductViewDetail)
createProductResponse_productViewDetail = Lens.lens (\CreateProductResponse' {productViewDetail} -> productViewDetail) (\s@CreateProductResponse' {} a -> s {productViewDetail = a} :: CreateProductResponse)
-- | Information about the provisioning artifact.
createProductResponse_provisioningArtifactDetail :: Lens.Lens' CreateProductResponse (Prelude.Maybe ProvisioningArtifactDetail)
createProductResponse_provisioningArtifactDetail = Lens.lens (\CreateProductResponse' {provisioningArtifactDetail} -> provisioningArtifactDetail) (\s@CreateProductResponse' {} a -> s {provisioningArtifactDetail = a} :: CreateProductResponse)
-- | Information about the tags associated with the product.
createProductResponse_tags :: Lens.Lens' CreateProductResponse (Prelude.Maybe [Tag])
createProductResponse_tags = Lens.lens (\CreateProductResponse' {tags} -> tags) (\s@CreateProductResponse' {} a -> s {tags = a} :: CreateProductResponse) Prelude.. Lens.mapping Lens.coerced
-- | The response's http status code.
createProductResponse_httpStatus :: Lens.Lens' CreateProductResponse Prelude.Int
createProductResponse_httpStatus = Lens.lens (\CreateProductResponse' {httpStatus} -> httpStatus) (\s@CreateProductResponse' {} a -> s {httpStatus = a} :: CreateProductResponse)
instance Prelude.NFData CreateProductResponse where
rnf CreateProductResponse' {..} =
Prelude.rnf productViewDetail
`Prelude.seq` Prelude.rnf provisioningArtifactDetail
`Prelude.seq` Prelude.rnf tags
`Prelude.seq` Prelude.rnf httpStatus