{-# 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.UpdateProduct
-- 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)
--
-- Updates the specified product.
module Amazonka.ServiceCatalog.UpdateProduct
  ( -- * Creating a Request
    UpdateProduct (..),
    newUpdateProduct,

    -- * Request Lenses
    updateProduct_removeTags,
    updateProduct_owner,
    updateProduct_supportUrl,
    updateProduct_distributor,
    updateProduct_name,
    updateProduct_acceptLanguage,
    updateProduct_addTags,
    updateProduct_supportEmail,
    updateProduct_description,
    updateProduct_supportDescription,
    updateProduct_id,

    -- * Destructuring the Response
    UpdateProductResponse (..),
    newUpdateProductResponse,

    -- * Response Lenses
    updateProductResponse_productViewDetail,
    updateProductResponse_tags,
    updateProductResponse_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:/ 'newUpdateProduct' smart constructor.
data UpdateProduct = UpdateProduct'
  { -- | The tags to remove from the product.
    UpdateProduct -> Maybe [Text]
removeTags :: Prelude.Maybe [Prelude.Text],
    -- | The updated owner of the product.
    UpdateProduct -> Maybe Text
owner :: Prelude.Maybe Prelude.Text,
    -- | The updated support URL for the product.
    UpdateProduct -> Maybe Text
supportUrl :: Prelude.Maybe Prelude.Text,
    -- | The updated distributor of the product.
    UpdateProduct -> Maybe Text
distributor :: Prelude.Maybe Prelude.Text,
    -- | The updated product name.
    UpdateProduct -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    UpdateProduct -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The tags to add to the product.
    UpdateProduct -> Maybe [Tag]
addTags :: Prelude.Maybe [Tag],
    -- | The updated support email for the product.
    UpdateProduct -> Maybe Text
supportEmail :: Prelude.Maybe Prelude.Text,
    -- | The updated description of the product.
    UpdateProduct -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The updated support description for the product.
    UpdateProduct -> Maybe Text
supportDescription :: Prelude.Maybe Prelude.Text,
    -- | The product identifier.
    UpdateProduct -> Text
id :: Prelude.Text
  }
  deriving (UpdateProduct -> UpdateProduct -> Bool
(UpdateProduct -> UpdateProduct -> Bool)
-> (UpdateProduct -> UpdateProduct -> Bool) -> Eq UpdateProduct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateProduct -> UpdateProduct -> Bool
$c/= :: UpdateProduct -> UpdateProduct -> Bool
== :: UpdateProduct -> UpdateProduct -> Bool
$c== :: UpdateProduct -> UpdateProduct -> Bool
Prelude.Eq, ReadPrec [UpdateProduct]
ReadPrec UpdateProduct
Int -> ReadS UpdateProduct
ReadS [UpdateProduct]
(Int -> ReadS UpdateProduct)
-> ReadS [UpdateProduct]
-> ReadPrec UpdateProduct
-> ReadPrec [UpdateProduct]
-> Read UpdateProduct
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateProduct]
$creadListPrec :: ReadPrec [UpdateProduct]
readPrec :: ReadPrec UpdateProduct
$creadPrec :: ReadPrec UpdateProduct
readList :: ReadS [UpdateProduct]
$creadList :: ReadS [UpdateProduct]
readsPrec :: Int -> ReadS UpdateProduct
$creadsPrec :: Int -> ReadS UpdateProduct
Prelude.Read, Int -> UpdateProduct -> ShowS
[UpdateProduct] -> ShowS
UpdateProduct -> String
(Int -> UpdateProduct -> ShowS)
-> (UpdateProduct -> String)
-> ([UpdateProduct] -> ShowS)
-> Show UpdateProduct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateProduct] -> ShowS
$cshowList :: [UpdateProduct] -> ShowS
show :: UpdateProduct -> String
$cshow :: UpdateProduct -> String
showsPrec :: Int -> UpdateProduct -> ShowS
$cshowsPrec :: Int -> UpdateProduct -> ShowS
Prelude.Show, (forall x. UpdateProduct -> Rep UpdateProduct x)
-> (forall x. Rep UpdateProduct x -> UpdateProduct)
-> Generic UpdateProduct
forall x. Rep UpdateProduct x -> UpdateProduct
forall x. UpdateProduct -> Rep UpdateProduct x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateProduct x -> UpdateProduct
$cfrom :: forall x. UpdateProduct -> Rep UpdateProduct x
Prelude.Generic)

-- |
-- Create a value of 'UpdateProduct' 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:
--
-- 'removeTags', 'updateProduct_removeTags' - The tags to remove from the product.
--
-- 'owner', 'updateProduct_owner' - The updated owner of the product.
--
-- 'supportUrl', 'updateProduct_supportUrl' - The updated support URL for the product.
--
-- 'distributor', 'updateProduct_distributor' - The updated distributor of the product.
--
-- 'name', 'updateProduct_name' - The updated product name.
--
-- 'acceptLanguage', 'updateProduct_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'addTags', 'updateProduct_addTags' - The tags to add to the product.
--
-- 'supportEmail', 'updateProduct_supportEmail' - The updated support email for the product.
--
-- 'description', 'updateProduct_description' - The updated description of the product.
--
-- 'supportDescription', 'updateProduct_supportDescription' - The updated support description for the product.
--
-- 'id', 'updateProduct_id' - The product identifier.
newUpdateProduct ::
  -- | 'id'
  Prelude.Text ->
  UpdateProduct
newUpdateProduct :: Text -> UpdateProduct
newUpdateProduct Text
pId_ =
  UpdateProduct' :: Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> UpdateProduct
UpdateProduct'
    { $sel:removeTags:UpdateProduct' :: Maybe [Text]
removeTags = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:owner:UpdateProduct' :: Maybe Text
owner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:supportUrl:UpdateProduct' :: Maybe Text
supportUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:distributor:UpdateProduct' :: Maybe Text
distributor = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:UpdateProduct' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:acceptLanguage:UpdateProduct' :: Maybe Text
acceptLanguage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:addTags:UpdateProduct' :: Maybe [Tag]
addTags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:supportEmail:UpdateProduct' :: Maybe Text
supportEmail = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:UpdateProduct' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:supportDescription:UpdateProduct' :: Maybe Text
supportDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:UpdateProduct' :: Text
id = Text
pId_
    }

-- | The tags to remove from the product.
updateProduct_removeTags :: Lens.Lens' UpdateProduct (Prelude.Maybe [Prelude.Text])
updateProduct_removeTags :: (Maybe [Text] -> f (Maybe [Text]))
-> UpdateProduct -> f UpdateProduct
updateProduct_removeTags = (UpdateProduct -> Maybe [Text])
-> (UpdateProduct -> Maybe [Text] -> UpdateProduct)
-> Lens UpdateProduct UpdateProduct (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProduct' {Maybe [Text]
removeTags :: Maybe [Text]
$sel:removeTags:UpdateProduct' :: UpdateProduct -> Maybe [Text]
removeTags} -> Maybe [Text]
removeTags) (\s :: UpdateProduct
s@UpdateProduct' {} Maybe [Text]
a -> UpdateProduct
s {$sel:removeTags:UpdateProduct' :: Maybe [Text]
removeTags = Maybe [Text]
a} :: UpdateProduct) ((Maybe [Text] -> f (Maybe [Text]))
 -> UpdateProduct -> f UpdateProduct)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> UpdateProduct
-> f UpdateProduct
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The updated support URL for the product.
updateProduct_supportUrl :: Lens.Lens' UpdateProduct (Prelude.Maybe Prelude.Text)
updateProduct_supportUrl :: (Maybe Text -> f (Maybe Text)) -> UpdateProduct -> f UpdateProduct
updateProduct_supportUrl = (UpdateProduct -> Maybe Text)
-> (UpdateProduct -> Maybe Text -> UpdateProduct)
-> Lens UpdateProduct UpdateProduct (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProduct' {Maybe Text
supportUrl :: Maybe Text
$sel:supportUrl:UpdateProduct' :: UpdateProduct -> Maybe Text
supportUrl} -> Maybe Text
supportUrl) (\s :: UpdateProduct
s@UpdateProduct' {} Maybe Text
a -> UpdateProduct
s {$sel:supportUrl:UpdateProduct' :: Maybe Text
supportUrl = Maybe Text
a} :: UpdateProduct)

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

-- | The updated product name.
updateProduct_name :: Lens.Lens' UpdateProduct (Prelude.Maybe Prelude.Text)
updateProduct_name :: (Maybe Text -> f (Maybe Text)) -> UpdateProduct -> f UpdateProduct
updateProduct_name = (UpdateProduct -> Maybe Text)
-> (UpdateProduct -> Maybe Text -> UpdateProduct)
-> Lens UpdateProduct UpdateProduct (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProduct' {Maybe Text
name :: Maybe Text
$sel:name:UpdateProduct' :: UpdateProduct -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateProduct
s@UpdateProduct' {} Maybe Text
a -> UpdateProduct
s {$sel:name:UpdateProduct' :: Maybe Text
name = Maybe Text
a} :: UpdateProduct)

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

-- | The tags to add to the product.
updateProduct_addTags :: Lens.Lens' UpdateProduct (Prelude.Maybe [Tag])
updateProduct_addTags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> UpdateProduct -> f UpdateProduct
updateProduct_addTags = (UpdateProduct -> Maybe [Tag])
-> (UpdateProduct -> Maybe [Tag] -> UpdateProduct)
-> Lens UpdateProduct UpdateProduct (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProduct' {Maybe [Tag]
addTags :: Maybe [Tag]
$sel:addTags:UpdateProduct' :: UpdateProduct -> Maybe [Tag]
addTags} -> Maybe [Tag]
addTags) (\s :: UpdateProduct
s@UpdateProduct' {} Maybe [Tag]
a -> UpdateProduct
s {$sel:addTags:UpdateProduct' :: Maybe [Tag]
addTags = Maybe [Tag]
a} :: UpdateProduct) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> UpdateProduct -> f UpdateProduct)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> UpdateProduct
-> f UpdateProduct
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 updated support email for the product.
updateProduct_supportEmail :: Lens.Lens' UpdateProduct (Prelude.Maybe Prelude.Text)
updateProduct_supportEmail :: (Maybe Text -> f (Maybe Text)) -> UpdateProduct -> f UpdateProduct
updateProduct_supportEmail = (UpdateProduct -> Maybe Text)
-> (UpdateProduct -> Maybe Text -> UpdateProduct)
-> Lens UpdateProduct UpdateProduct (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProduct' {Maybe Text
supportEmail :: Maybe Text
$sel:supportEmail:UpdateProduct' :: UpdateProduct -> Maybe Text
supportEmail} -> Maybe Text
supportEmail) (\s :: UpdateProduct
s@UpdateProduct' {} Maybe Text
a -> UpdateProduct
s {$sel:supportEmail:UpdateProduct' :: Maybe Text
supportEmail = Maybe Text
a} :: UpdateProduct)

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

-- | The updated support description for the product.
updateProduct_supportDescription :: Lens.Lens' UpdateProduct (Prelude.Maybe Prelude.Text)
updateProduct_supportDescription :: (Maybe Text -> f (Maybe Text)) -> UpdateProduct -> f UpdateProduct
updateProduct_supportDescription = (UpdateProduct -> Maybe Text)
-> (UpdateProduct -> Maybe Text -> UpdateProduct)
-> Lens UpdateProduct UpdateProduct (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProduct' {Maybe Text
supportDescription :: Maybe Text
$sel:supportDescription:UpdateProduct' :: UpdateProduct -> Maybe Text
supportDescription} -> Maybe Text
supportDescription) (\s :: UpdateProduct
s@UpdateProduct' {} Maybe Text
a -> UpdateProduct
s {$sel:supportDescription:UpdateProduct' :: Maybe Text
supportDescription = Maybe Text
a} :: UpdateProduct)

-- | The product identifier.
updateProduct_id :: Lens.Lens' UpdateProduct Prelude.Text
updateProduct_id :: (Text -> f Text) -> UpdateProduct -> f UpdateProduct
updateProduct_id = (UpdateProduct -> Text)
-> (UpdateProduct -> Text -> UpdateProduct)
-> Lens UpdateProduct UpdateProduct Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProduct' {Text
id :: Text
$sel:id:UpdateProduct' :: UpdateProduct -> Text
id} -> Text
id) (\s :: UpdateProduct
s@UpdateProduct' {} Text
a -> UpdateProduct
s {$sel:id:UpdateProduct' :: Text
id = Text
a} :: UpdateProduct)

instance Core.AWSRequest UpdateProduct where
  type
    AWSResponse UpdateProduct =
      UpdateProductResponse
  request :: UpdateProduct -> Request UpdateProduct
request = Service -> UpdateProduct -> Request UpdateProduct
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateProduct
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateProduct)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateProduct))
-> Logger
-> Service
-> Proxy UpdateProduct
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateProduct)))
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 [Tag] -> Int -> UpdateProductResponse
UpdateProductResponse'
            (Maybe ProductViewDetail
 -> Maybe [Tag] -> Int -> UpdateProductResponse)
-> Either String (Maybe ProductViewDetail)
-> Either String (Maybe [Tag] -> Int -> UpdateProductResponse)
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 [Tag] -> Int -> UpdateProductResponse)
-> Either String (Maybe [Tag])
-> Either String (Int -> UpdateProductResponse)
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 -> UpdateProductResponse)
-> Either String Int -> Either String UpdateProductResponse
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 UpdateProduct

instance Prelude.NFData UpdateProduct

instance Core.ToHeaders UpdateProduct where
  toHeaders :: UpdateProduct -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateProduct -> 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.UpdateProduct" ::
                          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 UpdateProduct where
  toJSON :: UpdateProduct -> Value
toJSON UpdateProduct' {Maybe [Text]
Maybe [Tag]
Maybe Text
Text
id :: Text
supportDescription :: Maybe Text
description :: Maybe Text
supportEmail :: Maybe Text
addTags :: Maybe [Tag]
acceptLanguage :: Maybe Text
name :: Maybe Text
distributor :: Maybe Text
supportUrl :: Maybe Text
owner :: Maybe Text
removeTags :: Maybe [Text]
$sel:id:UpdateProduct' :: UpdateProduct -> Text
$sel:supportDescription:UpdateProduct' :: UpdateProduct -> Maybe Text
$sel:description:UpdateProduct' :: UpdateProduct -> Maybe Text
$sel:supportEmail:UpdateProduct' :: UpdateProduct -> Maybe Text
$sel:addTags:UpdateProduct' :: UpdateProduct -> Maybe [Tag]
$sel:acceptLanguage:UpdateProduct' :: UpdateProduct -> Maybe Text
$sel:name:UpdateProduct' :: UpdateProduct -> Maybe Text
$sel:distributor:UpdateProduct' :: UpdateProduct -> Maybe Text
$sel:supportUrl:UpdateProduct' :: UpdateProduct -> Maybe Text
$sel:owner:UpdateProduct' :: UpdateProduct -> Maybe Text
$sel:removeTags:UpdateProduct' :: UpdateProduct -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RemoveTags" 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]
removeTags,
            (Text
"Owner" 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
owner,
            (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
"Name" 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
name,
            (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
"AddTags" 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]
addTags,
            (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
"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
"Id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id)
          ]
      )

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

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

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

-- |
-- Create a value of 'UpdateProductResponse' 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', 'updateProductResponse_productViewDetail' - Information about the product view.
--
-- 'tags', 'updateProductResponse_tags' - Information about the tags associated with the product.
--
-- 'httpStatus', 'updateProductResponse_httpStatus' - The response's http status code.
newUpdateProductResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateProductResponse
newUpdateProductResponse :: Int -> UpdateProductResponse
newUpdateProductResponse Int
pHttpStatus_ =
  UpdateProductResponse' :: Maybe ProductViewDetail
-> Maybe [Tag] -> Int -> UpdateProductResponse
UpdateProductResponse'
    { $sel:productViewDetail:UpdateProductResponse' :: Maybe ProductViewDetail
productViewDetail =
        Maybe ProductViewDetail
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:UpdateProductResponse' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateProductResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | Information about the tags associated with the product.
updateProductResponse_tags :: Lens.Lens' UpdateProductResponse (Prelude.Maybe [Tag])
updateProductResponse_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> UpdateProductResponse -> f UpdateProductResponse
updateProductResponse_tags = (UpdateProductResponse -> Maybe [Tag])
-> (UpdateProductResponse -> Maybe [Tag] -> UpdateProductResponse)
-> Lens
     UpdateProductResponse
     UpdateProductResponse
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProductResponse' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:UpdateProductResponse' :: UpdateProductResponse -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: UpdateProductResponse
s@UpdateProductResponse' {} Maybe [Tag]
a -> UpdateProductResponse
s {$sel:tags:UpdateProductResponse' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: UpdateProductResponse) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> UpdateProductResponse -> f UpdateProductResponse)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> UpdateProductResponse
-> f UpdateProductResponse
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.
updateProductResponse_httpStatus :: Lens.Lens' UpdateProductResponse Prelude.Int
updateProductResponse_httpStatus :: (Int -> f Int) -> UpdateProductResponse -> f UpdateProductResponse
updateProductResponse_httpStatus = (UpdateProductResponse -> Int)
-> (UpdateProductResponse -> Int -> UpdateProductResponse)
-> Lens UpdateProductResponse UpdateProductResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProductResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateProductResponse' :: UpdateProductResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateProductResponse
s@UpdateProductResponse' {} Int
a -> UpdateProductResponse
s {$sel:httpStatus:UpdateProductResponse' :: Int
httpStatus = Int
a} :: UpdateProductResponse)

instance Prelude.NFData UpdateProductResponse