{-# 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.CopyProduct
-- 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)
--
-- Copies the specified source product to the specified target product or a
-- new product.
--
-- You can copy a product to the same account or another account. You can
-- copy a product to the same region or another region.
--
-- This operation is performed asynchronously. To track the progress of the
-- operation, use DescribeCopyProductStatus.
module Amazonka.ServiceCatalog.CopyProduct
  ( -- * Creating a Request
    CopyProduct (..),
    newCopyProduct,

    -- * Request Lenses
    copyProduct_targetProductId,
    copyProduct_sourceProvisioningArtifactIdentifiers,
    copyProduct_targetProductName,
    copyProduct_copyOptions,
    copyProduct_acceptLanguage,
    copyProduct_sourceProductArn,
    copyProduct_idempotencyToken,

    -- * Destructuring the Response
    CopyProductResponse (..),
    newCopyProductResponse,

    -- * Response Lenses
    copyProductResponse_copyProductToken,
    copyProductResponse_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:/ 'newCopyProduct' smart constructor.
data CopyProduct = CopyProduct'
  { -- | The identifier of the target product. By default, a new product is
    -- created.
    CopyProduct -> Maybe Text
targetProductId :: Prelude.Maybe Prelude.Text,
    -- | The identifiers of the provisioning artifacts (also known as versions)
    -- of the product to copy. By default, all provisioning artifacts are
    -- copied.
    CopyProduct
-> Maybe [HashMap ProvisioningArtifactPropertyName Text]
sourceProvisioningArtifactIdentifiers :: Prelude.Maybe [Prelude.HashMap ProvisioningArtifactPropertyName Prelude.Text],
    -- | A name for the target product. The default is the name of the source
    -- product.
    CopyProduct -> Maybe Text
targetProductName :: Prelude.Maybe Prelude.Text,
    -- | The copy options. If the value is @CopyTags@, the tags from the source
    -- product are copied to the target product.
    CopyProduct -> Maybe [CopyOption]
copyOptions :: Prelude.Maybe [CopyOption],
    -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    CopyProduct -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the source product.
    CopyProduct -> Text
sourceProductArn :: Prelude.Text,
    -- | 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.
    CopyProduct -> Text
idempotencyToken :: Prelude.Text
  }
  deriving (CopyProduct -> CopyProduct -> Bool
(CopyProduct -> CopyProduct -> Bool)
-> (CopyProduct -> CopyProduct -> Bool) -> Eq CopyProduct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CopyProduct -> CopyProduct -> Bool
$c/= :: CopyProduct -> CopyProduct -> Bool
== :: CopyProduct -> CopyProduct -> Bool
$c== :: CopyProduct -> CopyProduct -> Bool
Prelude.Eq, ReadPrec [CopyProduct]
ReadPrec CopyProduct
Int -> ReadS CopyProduct
ReadS [CopyProduct]
(Int -> ReadS CopyProduct)
-> ReadS [CopyProduct]
-> ReadPrec CopyProduct
-> ReadPrec [CopyProduct]
-> Read CopyProduct
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CopyProduct]
$creadListPrec :: ReadPrec [CopyProduct]
readPrec :: ReadPrec CopyProduct
$creadPrec :: ReadPrec CopyProduct
readList :: ReadS [CopyProduct]
$creadList :: ReadS [CopyProduct]
readsPrec :: Int -> ReadS CopyProduct
$creadsPrec :: Int -> ReadS CopyProduct
Prelude.Read, Int -> CopyProduct -> ShowS
[CopyProduct] -> ShowS
CopyProduct -> String
(Int -> CopyProduct -> ShowS)
-> (CopyProduct -> String)
-> ([CopyProduct] -> ShowS)
-> Show CopyProduct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CopyProduct] -> ShowS
$cshowList :: [CopyProduct] -> ShowS
show :: CopyProduct -> String
$cshow :: CopyProduct -> String
showsPrec :: Int -> CopyProduct -> ShowS
$cshowsPrec :: Int -> CopyProduct -> ShowS
Prelude.Show, (forall x. CopyProduct -> Rep CopyProduct x)
-> (forall x. Rep CopyProduct x -> CopyProduct)
-> Generic CopyProduct
forall x. Rep CopyProduct x -> CopyProduct
forall x. CopyProduct -> Rep CopyProduct x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CopyProduct x -> CopyProduct
$cfrom :: forall x. CopyProduct -> Rep CopyProduct x
Prelude.Generic)

-- |
-- Create a value of 'CopyProduct' 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:
--
-- 'targetProductId', 'copyProduct_targetProductId' - The identifier of the target product. By default, a new product is
-- created.
--
-- 'sourceProvisioningArtifactIdentifiers', 'copyProduct_sourceProvisioningArtifactIdentifiers' - The identifiers of the provisioning artifacts (also known as versions)
-- of the product to copy. By default, all provisioning artifacts are
-- copied.
--
-- 'targetProductName', 'copyProduct_targetProductName' - A name for the target product. The default is the name of the source
-- product.
--
-- 'copyOptions', 'copyProduct_copyOptions' - The copy options. If the value is @CopyTags@, the tags from the source
-- product are copied to the target product.
--
-- 'acceptLanguage', 'copyProduct_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'sourceProductArn', 'copyProduct_sourceProductArn' - The Amazon Resource Name (ARN) of the source product.
--
-- 'idempotencyToken', 'copyProduct_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.
newCopyProduct ::
  -- | 'sourceProductArn'
  Prelude.Text ->
  -- | 'idempotencyToken'
  Prelude.Text ->
  CopyProduct
newCopyProduct :: Text -> Text -> CopyProduct
newCopyProduct Text
pSourceProductArn_ Text
pIdempotencyToken_ =
  CopyProduct' :: Maybe Text
-> Maybe [HashMap ProvisioningArtifactPropertyName Text]
-> Maybe Text
-> Maybe [CopyOption]
-> Maybe Text
-> Text
-> Text
-> CopyProduct
CopyProduct'
    { $sel:targetProductId:CopyProduct' :: Maybe Text
targetProductId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceProvisioningArtifactIdentifiers:CopyProduct' :: Maybe [HashMap ProvisioningArtifactPropertyName Text]
sourceProvisioningArtifactIdentifiers =
        Maybe [HashMap ProvisioningArtifactPropertyName Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:targetProductName:CopyProduct' :: Maybe Text
targetProductName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:copyOptions:CopyProduct' :: Maybe [CopyOption]
copyOptions = Maybe [CopyOption]
forall a. Maybe a
Prelude.Nothing,
      $sel:acceptLanguage:CopyProduct' :: Maybe Text
acceptLanguage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceProductArn:CopyProduct' :: Text
sourceProductArn = Text
pSourceProductArn_,
      $sel:idempotencyToken:CopyProduct' :: Text
idempotencyToken = Text
pIdempotencyToken_
    }

-- | The identifier of the target product. By default, a new product is
-- created.
copyProduct_targetProductId :: Lens.Lens' CopyProduct (Prelude.Maybe Prelude.Text)
copyProduct_targetProductId :: (Maybe Text -> f (Maybe Text)) -> CopyProduct -> f CopyProduct
copyProduct_targetProductId = (CopyProduct -> Maybe Text)
-> (CopyProduct -> Maybe Text -> CopyProduct)
-> Lens CopyProduct CopyProduct (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyProduct' {Maybe Text
targetProductId :: Maybe Text
$sel:targetProductId:CopyProduct' :: CopyProduct -> Maybe Text
targetProductId} -> Maybe Text
targetProductId) (\s :: CopyProduct
s@CopyProduct' {} Maybe Text
a -> CopyProduct
s {$sel:targetProductId:CopyProduct' :: Maybe Text
targetProductId = Maybe Text
a} :: CopyProduct)

-- | The identifiers of the provisioning artifacts (also known as versions)
-- of the product to copy. By default, all provisioning artifacts are
-- copied.
copyProduct_sourceProvisioningArtifactIdentifiers :: Lens.Lens' CopyProduct (Prelude.Maybe [Prelude.HashMap ProvisioningArtifactPropertyName Prelude.Text])
copyProduct_sourceProvisioningArtifactIdentifiers :: (Maybe [HashMap ProvisioningArtifactPropertyName Text]
 -> f (Maybe [HashMap ProvisioningArtifactPropertyName Text]))
-> CopyProduct -> f CopyProduct
copyProduct_sourceProvisioningArtifactIdentifiers = (CopyProduct
 -> Maybe [HashMap ProvisioningArtifactPropertyName Text])
-> (CopyProduct
    -> Maybe [HashMap ProvisioningArtifactPropertyName Text]
    -> CopyProduct)
-> Lens
     CopyProduct
     CopyProduct
     (Maybe [HashMap ProvisioningArtifactPropertyName Text])
     (Maybe [HashMap ProvisioningArtifactPropertyName Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyProduct' {Maybe [HashMap ProvisioningArtifactPropertyName Text]
sourceProvisioningArtifactIdentifiers :: Maybe [HashMap ProvisioningArtifactPropertyName Text]
$sel:sourceProvisioningArtifactIdentifiers:CopyProduct' :: CopyProduct
-> Maybe [HashMap ProvisioningArtifactPropertyName Text]
sourceProvisioningArtifactIdentifiers} -> Maybe [HashMap ProvisioningArtifactPropertyName Text]
sourceProvisioningArtifactIdentifiers) (\s :: CopyProduct
s@CopyProduct' {} Maybe [HashMap ProvisioningArtifactPropertyName Text]
a -> CopyProduct
s {$sel:sourceProvisioningArtifactIdentifiers:CopyProduct' :: Maybe [HashMap ProvisioningArtifactPropertyName Text]
sourceProvisioningArtifactIdentifiers = Maybe [HashMap ProvisioningArtifactPropertyName Text]
a} :: CopyProduct) ((Maybe [HashMap ProvisioningArtifactPropertyName Text]
  -> f (Maybe [HashMap ProvisioningArtifactPropertyName Text]))
 -> CopyProduct -> f CopyProduct)
-> ((Maybe [HashMap ProvisioningArtifactPropertyName Text]
     -> f (Maybe [HashMap ProvisioningArtifactPropertyName Text]))
    -> Maybe [HashMap ProvisioningArtifactPropertyName Text]
    -> f (Maybe [HashMap ProvisioningArtifactPropertyName Text]))
-> (Maybe [HashMap ProvisioningArtifactPropertyName Text]
    -> f (Maybe [HashMap ProvisioningArtifactPropertyName Text]))
-> CopyProduct
-> f CopyProduct
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [HashMap ProvisioningArtifactPropertyName Text]
  [HashMap ProvisioningArtifactPropertyName Text]
  [HashMap ProvisioningArtifactPropertyName Text]
  [HashMap ProvisioningArtifactPropertyName Text]
-> Iso
     (Maybe [HashMap ProvisioningArtifactPropertyName Text])
     (Maybe [HashMap ProvisioningArtifactPropertyName Text])
     (Maybe [HashMap ProvisioningArtifactPropertyName Text])
     (Maybe [HashMap ProvisioningArtifactPropertyName 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
  [HashMap ProvisioningArtifactPropertyName Text]
  [HashMap ProvisioningArtifactPropertyName Text]
  [HashMap ProvisioningArtifactPropertyName Text]
  [HashMap ProvisioningArtifactPropertyName Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A name for the target product. The default is the name of the source
-- product.
copyProduct_targetProductName :: Lens.Lens' CopyProduct (Prelude.Maybe Prelude.Text)
copyProduct_targetProductName :: (Maybe Text -> f (Maybe Text)) -> CopyProduct -> f CopyProduct
copyProduct_targetProductName = (CopyProduct -> Maybe Text)
-> (CopyProduct -> Maybe Text -> CopyProduct)
-> Lens CopyProduct CopyProduct (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyProduct' {Maybe Text
targetProductName :: Maybe Text
$sel:targetProductName:CopyProduct' :: CopyProduct -> Maybe Text
targetProductName} -> Maybe Text
targetProductName) (\s :: CopyProduct
s@CopyProduct' {} Maybe Text
a -> CopyProduct
s {$sel:targetProductName:CopyProduct' :: Maybe Text
targetProductName = Maybe Text
a} :: CopyProduct)

-- | The copy options. If the value is @CopyTags@, the tags from the source
-- product are copied to the target product.
copyProduct_copyOptions :: Lens.Lens' CopyProduct (Prelude.Maybe [CopyOption])
copyProduct_copyOptions :: (Maybe [CopyOption] -> f (Maybe [CopyOption]))
-> CopyProduct -> f CopyProduct
copyProduct_copyOptions = (CopyProduct -> Maybe [CopyOption])
-> (CopyProduct -> Maybe [CopyOption] -> CopyProduct)
-> Lens
     CopyProduct CopyProduct (Maybe [CopyOption]) (Maybe [CopyOption])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyProduct' {Maybe [CopyOption]
copyOptions :: Maybe [CopyOption]
$sel:copyOptions:CopyProduct' :: CopyProduct -> Maybe [CopyOption]
copyOptions} -> Maybe [CopyOption]
copyOptions) (\s :: CopyProduct
s@CopyProduct' {} Maybe [CopyOption]
a -> CopyProduct
s {$sel:copyOptions:CopyProduct' :: Maybe [CopyOption]
copyOptions = Maybe [CopyOption]
a} :: CopyProduct) ((Maybe [CopyOption] -> f (Maybe [CopyOption]))
 -> CopyProduct -> f CopyProduct)
-> ((Maybe [CopyOption] -> f (Maybe [CopyOption]))
    -> Maybe [CopyOption] -> f (Maybe [CopyOption]))
-> (Maybe [CopyOption] -> f (Maybe [CopyOption]))
-> CopyProduct
-> f CopyProduct
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [CopyOption] [CopyOption] [CopyOption] [CopyOption]
-> Iso
     (Maybe [CopyOption])
     (Maybe [CopyOption])
     (Maybe [CopyOption])
     (Maybe [CopyOption])
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 [CopyOption] [CopyOption] [CopyOption] [CopyOption]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The Amazon Resource Name (ARN) of the source product.
copyProduct_sourceProductArn :: Lens.Lens' CopyProduct Prelude.Text
copyProduct_sourceProductArn :: (Text -> f Text) -> CopyProduct -> f CopyProduct
copyProduct_sourceProductArn = (CopyProduct -> Text)
-> (CopyProduct -> Text -> CopyProduct)
-> Lens CopyProduct CopyProduct Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyProduct' {Text
sourceProductArn :: Text
$sel:sourceProductArn:CopyProduct' :: CopyProduct -> Text
sourceProductArn} -> Text
sourceProductArn) (\s :: CopyProduct
s@CopyProduct' {} Text
a -> CopyProduct
s {$sel:sourceProductArn:CopyProduct' :: Text
sourceProductArn = Text
a} :: CopyProduct)

-- | 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.
copyProduct_idempotencyToken :: Lens.Lens' CopyProduct Prelude.Text
copyProduct_idempotencyToken :: (Text -> f Text) -> CopyProduct -> f CopyProduct
copyProduct_idempotencyToken = (CopyProduct -> Text)
-> (CopyProduct -> Text -> CopyProduct)
-> Lens CopyProduct CopyProduct Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyProduct' {Text
idempotencyToken :: Text
$sel:idempotencyToken:CopyProduct' :: CopyProduct -> Text
idempotencyToken} -> Text
idempotencyToken) (\s :: CopyProduct
s@CopyProduct' {} Text
a -> CopyProduct
s {$sel:idempotencyToken:CopyProduct' :: Text
idempotencyToken = Text
a} :: CopyProduct)

instance Core.AWSRequest CopyProduct where
  type AWSResponse CopyProduct = CopyProductResponse
  request :: CopyProduct -> Request CopyProduct
request = Service -> CopyProduct -> Request CopyProduct
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CopyProduct
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CopyProduct)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CopyProduct))
-> Logger
-> Service
-> Proxy CopyProduct
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CopyProduct)))
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 -> Int -> CopyProductResponse
CopyProductResponse'
            (Maybe Text -> Int -> CopyProductResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CopyProductResponse)
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
"CopyProductToken")
            Either String (Int -> CopyProductResponse)
-> Either String Int -> Either String CopyProductResponse
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 CopyProduct

instance Prelude.NFData CopyProduct

instance Core.ToHeaders CopyProduct where
  toHeaders :: CopyProduct -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CopyProduct -> 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.CopyProduct" ::
                          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 CopyProduct where
  toJSON :: CopyProduct -> Value
toJSON CopyProduct' {Maybe [HashMap ProvisioningArtifactPropertyName Text]
Maybe [CopyOption]
Maybe Text
Text
idempotencyToken :: Text
sourceProductArn :: Text
acceptLanguage :: Maybe Text
copyOptions :: Maybe [CopyOption]
targetProductName :: Maybe Text
sourceProvisioningArtifactIdentifiers :: Maybe [HashMap ProvisioningArtifactPropertyName Text]
targetProductId :: Maybe Text
$sel:idempotencyToken:CopyProduct' :: CopyProduct -> Text
$sel:sourceProductArn:CopyProduct' :: CopyProduct -> Text
$sel:acceptLanguage:CopyProduct' :: CopyProduct -> Maybe Text
$sel:copyOptions:CopyProduct' :: CopyProduct -> Maybe [CopyOption]
$sel:targetProductName:CopyProduct' :: CopyProduct -> Maybe Text
$sel:sourceProvisioningArtifactIdentifiers:CopyProduct' :: CopyProduct
-> Maybe [HashMap ProvisioningArtifactPropertyName Text]
$sel:targetProductId:CopyProduct' :: CopyProduct -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TargetProductId" 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
targetProductId,
            (Text
"SourceProvisioningArtifactIdentifiers" Text -> [HashMap ProvisioningArtifactPropertyName Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([HashMap ProvisioningArtifactPropertyName Text] -> Pair)
-> Maybe [HashMap ProvisioningArtifactPropertyName Text]
-> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [HashMap ProvisioningArtifactPropertyName Text]
sourceProvisioningArtifactIdentifiers,
            (Text
"TargetProductName" 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
targetProductName,
            (Text
"CopyOptions" Text -> [CopyOption] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([CopyOption] -> Pair) -> Maybe [CopyOption] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CopyOption]
copyOptions,
            (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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"SourceProductArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sourceProductArn),
            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 CopyProduct where
  toPath :: CopyProduct -> ByteString
toPath = ByteString -> CopyProduct -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newCopyProductResponse' smart constructor.
data CopyProductResponse = CopyProductResponse'
  { -- | The token to use to track the progress of the operation.
    CopyProductResponse -> Maybe Text
copyProductToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CopyProductResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CopyProductResponse -> CopyProductResponse -> Bool
(CopyProductResponse -> CopyProductResponse -> Bool)
-> (CopyProductResponse -> CopyProductResponse -> Bool)
-> Eq CopyProductResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CopyProductResponse -> CopyProductResponse -> Bool
$c/= :: CopyProductResponse -> CopyProductResponse -> Bool
== :: CopyProductResponse -> CopyProductResponse -> Bool
$c== :: CopyProductResponse -> CopyProductResponse -> Bool
Prelude.Eq, ReadPrec [CopyProductResponse]
ReadPrec CopyProductResponse
Int -> ReadS CopyProductResponse
ReadS [CopyProductResponse]
(Int -> ReadS CopyProductResponse)
-> ReadS [CopyProductResponse]
-> ReadPrec CopyProductResponse
-> ReadPrec [CopyProductResponse]
-> Read CopyProductResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CopyProductResponse]
$creadListPrec :: ReadPrec [CopyProductResponse]
readPrec :: ReadPrec CopyProductResponse
$creadPrec :: ReadPrec CopyProductResponse
readList :: ReadS [CopyProductResponse]
$creadList :: ReadS [CopyProductResponse]
readsPrec :: Int -> ReadS CopyProductResponse
$creadsPrec :: Int -> ReadS CopyProductResponse
Prelude.Read, Int -> CopyProductResponse -> ShowS
[CopyProductResponse] -> ShowS
CopyProductResponse -> String
(Int -> CopyProductResponse -> ShowS)
-> (CopyProductResponse -> String)
-> ([CopyProductResponse] -> ShowS)
-> Show CopyProductResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CopyProductResponse] -> ShowS
$cshowList :: [CopyProductResponse] -> ShowS
show :: CopyProductResponse -> String
$cshow :: CopyProductResponse -> String
showsPrec :: Int -> CopyProductResponse -> ShowS
$cshowsPrec :: Int -> CopyProductResponse -> ShowS
Prelude.Show, (forall x. CopyProductResponse -> Rep CopyProductResponse x)
-> (forall x. Rep CopyProductResponse x -> CopyProductResponse)
-> Generic CopyProductResponse
forall x. Rep CopyProductResponse x -> CopyProductResponse
forall x. CopyProductResponse -> Rep CopyProductResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CopyProductResponse x -> CopyProductResponse
$cfrom :: forall x. CopyProductResponse -> Rep CopyProductResponse x
Prelude.Generic)

-- |
-- Create a value of 'CopyProductResponse' 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:
--
-- 'copyProductToken', 'copyProductResponse_copyProductToken' - The token to use to track the progress of the operation.
--
-- 'httpStatus', 'copyProductResponse_httpStatus' - The response's http status code.
newCopyProductResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CopyProductResponse
newCopyProductResponse :: Int -> CopyProductResponse
newCopyProductResponse Int
pHttpStatus_ =
  CopyProductResponse' :: Maybe Text -> Int -> CopyProductResponse
CopyProductResponse'
    { $sel:copyProductToken:CopyProductResponse' :: Maybe Text
copyProductToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CopyProductResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token to use to track the progress of the operation.
copyProductResponse_copyProductToken :: Lens.Lens' CopyProductResponse (Prelude.Maybe Prelude.Text)
copyProductResponse_copyProductToken :: (Maybe Text -> f (Maybe Text))
-> CopyProductResponse -> f CopyProductResponse
copyProductResponse_copyProductToken = (CopyProductResponse -> Maybe Text)
-> (CopyProductResponse -> Maybe Text -> CopyProductResponse)
-> Lens
     CopyProductResponse CopyProductResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyProductResponse' {Maybe Text
copyProductToken :: Maybe Text
$sel:copyProductToken:CopyProductResponse' :: CopyProductResponse -> Maybe Text
copyProductToken} -> Maybe Text
copyProductToken) (\s :: CopyProductResponse
s@CopyProductResponse' {} Maybe Text
a -> CopyProductResponse
s {$sel:copyProductToken:CopyProductResponse' :: Maybe Text
copyProductToken = Maybe Text
a} :: CopyProductResponse)

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

instance Prelude.NFData CopyProductResponse