{-# 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.UpdatePortfolio
-- 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 portfolio.
--
-- You cannot update a product that was shared with you.
module Amazonka.ServiceCatalog.UpdatePortfolio
  ( -- * Creating a Request
    UpdatePortfolio (..),
    newUpdatePortfolio,

    -- * Request Lenses
    updatePortfolio_removeTags,
    updatePortfolio_acceptLanguage,
    updatePortfolio_displayName,
    updatePortfolio_addTags,
    updatePortfolio_description,
    updatePortfolio_providerName,
    updatePortfolio_id,

    -- * Destructuring the Response
    UpdatePortfolioResponse (..),
    newUpdatePortfolioResponse,

    -- * Response Lenses
    updatePortfolioResponse_portfolioDetail,
    updatePortfolioResponse_tags,
    updatePortfolioResponse_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:/ 'newUpdatePortfolio' smart constructor.
data UpdatePortfolio = UpdatePortfolio'
  { -- | The tags to remove.
    UpdatePortfolio -> Maybe [Text]
removeTags :: Prelude.Maybe [Prelude.Text],
    -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    UpdatePortfolio -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The name to use for display purposes.
    UpdatePortfolio -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
    -- | The tags to add.
    UpdatePortfolio -> Maybe [Tag]
addTags :: Prelude.Maybe [Tag],
    -- | The updated description of the portfolio.
    UpdatePortfolio -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The updated name of the portfolio provider.
    UpdatePortfolio -> Maybe Text
providerName :: Prelude.Maybe Prelude.Text,
    -- | The portfolio identifier.
    UpdatePortfolio -> Text
id :: Prelude.Text
  }
  deriving (UpdatePortfolio -> UpdatePortfolio -> Bool
(UpdatePortfolio -> UpdatePortfolio -> Bool)
-> (UpdatePortfolio -> UpdatePortfolio -> Bool)
-> Eq UpdatePortfolio
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePortfolio -> UpdatePortfolio -> Bool
$c/= :: UpdatePortfolio -> UpdatePortfolio -> Bool
== :: UpdatePortfolio -> UpdatePortfolio -> Bool
$c== :: UpdatePortfolio -> UpdatePortfolio -> Bool
Prelude.Eq, ReadPrec [UpdatePortfolio]
ReadPrec UpdatePortfolio
Int -> ReadS UpdatePortfolio
ReadS [UpdatePortfolio]
(Int -> ReadS UpdatePortfolio)
-> ReadS [UpdatePortfolio]
-> ReadPrec UpdatePortfolio
-> ReadPrec [UpdatePortfolio]
-> Read UpdatePortfolio
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdatePortfolio]
$creadListPrec :: ReadPrec [UpdatePortfolio]
readPrec :: ReadPrec UpdatePortfolio
$creadPrec :: ReadPrec UpdatePortfolio
readList :: ReadS [UpdatePortfolio]
$creadList :: ReadS [UpdatePortfolio]
readsPrec :: Int -> ReadS UpdatePortfolio
$creadsPrec :: Int -> ReadS UpdatePortfolio
Prelude.Read, Int -> UpdatePortfolio -> ShowS
[UpdatePortfolio] -> ShowS
UpdatePortfolio -> String
(Int -> UpdatePortfolio -> ShowS)
-> (UpdatePortfolio -> String)
-> ([UpdatePortfolio] -> ShowS)
-> Show UpdatePortfolio
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePortfolio] -> ShowS
$cshowList :: [UpdatePortfolio] -> ShowS
show :: UpdatePortfolio -> String
$cshow :: UpdatePortfolio -> String
showsPrec :: Int -> UpdatePortfolio -> ShowS
$cshowsPrec :: Int -> UpdatePortfolio -> ShowS
Prelude.Show, (forall x. UpdatePortfolio -> Rep UpdatePortfolio x)
-> (forall x. Rep UpdatePortfolio x -> UpdatePortfolio)
-> Generic UpdatePortfolio
forall x. Rep UpdatePortfolio x -> UpdatePortfolio
forall x. UpdatePortfolio -> Rep UpdatePortfolio x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdatePortfolio x -> UpdatePortfolio
$cfrom :: forall x. UpdatePortfolio -> Rep UpdatePortfolio x
Prelude.Generic)

-- |
-- Create a value of 'UpdatePortfolio' 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', 'updatePortfolio_removeTags' - The tags to remove.
--
-- 'acceptLanguage', 'updatePortfolio_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'displayName', 'updatePortfolio_displayName' - The name to use for display purposes.
--
-- 'addTags', 'updatePortfolio_addTags' - The tags to add.
--
-- 'description', 'updatePortfolio_description' - The updated description of the portfolio.
--
-- 'providerName', 'updatePortfolio_providerName' - The updated name of the portfolio provider.
--
-- 'id', 'updatePortfolio_id' - The portfolio identifier.
newUpdatePortfolio ::
  -- | 'id'
  Prelude.Text ->
  UpdatePortfolio
newUpdatePortfolio :: Text -> UpdatePortfolio
newUpdatePortfolio Text
pId_ =
  UpdatePortfolio' :: Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Maybe Text
-> Maybe Text
-> Text
-> UpdatePortfolio
UpdatePortfolio'
    { $sel:removeTags:UpdatePortfolio' :: Maybe [Text]
removeTags = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:acceptLanguage:UpdatePortfolio' :: Maybe Text
acceptLanguage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:displayName:UpdatePortfolio' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:addTags:UpdatePortfolio' :: Maybe [Tag]
addTags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:description:UpdatePortfolio' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:providerName:UpdatePortfolio' :: Maybe Text
providerName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:UpdatePortfolio' :: Text
id = Text
pId_
    }

-- | The tags to remove.
updatePortfolio_removeTags :: Lens.Lens' UpdatePortfolio (Prelude.Maybe [Prelude.Text])
updatePortfolio_removeTags :: (Maybe [Text] -> f (Maybe [Text]))
-> UpdatePortfolio -> f UpdatePortfolio
updatePortfolio_removeTags = (UpdatePortfolio -> Maybe [Text])
-> (UpdatePortfolio -> Maybe [Text] -> UpdatePortfolio)
-> Lens
     UpdatePortfolio UpdatePortfolio (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePortfolio' {Maybe [Text]
removeTags :: Maybe [Text]
$sel:removeTags:UpdatePortfolio' :: UpdatePortfolio -> Maybe [Text]
removeTags} -> Maybe [Text]
removeTags) (\s :: UpdatePortfolio
s@UpdatePortfolio' {} Maybe [Text]
a -> UpdatePortfolio
s {$sel:removeTags:UpdatePortfolio' :: Maybe [Text]
removeTags = Maybe [Text]
a} :: UpdatePortfolio) ((Maybe [Text] -> f (Maybe [Text]))
 -> UpdatePortfolio -> f UpdatePortfolio)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> UpdatePortfolio
-> f UpdatePortfolio
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 language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
updatePortfolio_acceptLanguage :: Lens.Lens' UpdatePortfolio (Prelude.Maybe Prelude.Text)
updatePortfolio_acceptLanguage :: (Maybe Text -> f (Maybe Text))
-> UpdatePortfolio -> f UpdatePortfolio
updatePortfolio_acceptLanguage = (UpdatePortfolio -> Maybe Text)
-> (UpdatePortfolio -> Maybe Text -> UpdatePortfolio)
-> Lens UpdatePortfolio UpdatePortfolio (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePortfolio' {Maybe Text
acceptLanguage :: Maybe Text
$sel:acceptLanguage:UpdatePortfolio' :: UpdatePortfolio -> Maybe Text
acceptLanguage} -> Maybe Text
acceptLanguage) (\s :: UpdatePortfolio
s@UpdatePortfolio' {} Maybe Text
a -> UpdatePortfolio
s {$sel:acceptLanguage:UpdatePortfolio' :: Maybe Text
acceptLanguage = Maybe Text
a} :: UpdatePortfolio)

-- | The name to use for display purposes.
updatePortfolio_displayName :: Lens.Lens' UpdatePortfolio (Prelude.Maybe Prelude.Text)
updatePortfolio_displayName :: (Maybe Text -> f (Maybe Text))
-> UpdatePortfolio -> f UpdatePortfolio
updatePortfolio_displayName = (UpdatePortfolio -> Maybe Text)
-> (UpdatePortfolio -> Maybe Text -> UpdatePortfolio)
-> Lens UpdatePortfolio UpdatePortfolio (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePortfolio' {Maybe Text
displayName :: Maybe Text
$sel:displayName:UpdatePortfolio' :: UpdatePortfolio -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: UpdatePortfolio
s@UpdatePortfolio' {} Maybe Text
a -> UpdatePortfolio
s {$sel:displayName:UpdatePortfolio' :: Maybe Text
displayName = Maybe Text
a} :: UpdatePortfolio)

-- | The tags to add.
updatePortfolio_addTags :: Lens.Lens' UpdatePortfolio (Prelude.Maybe [Tag])
updatePortfolio_addTags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> UpdatePortfolio -> f UpdatePortfolio
updatePortfolio_addTags = (UpdatePortfolio -> Maybe [Tag])
-> (UpdatePortfolio -> Maybe [Tag] -> UpdatePortfolio)
-> Lens UpdatePortfolio UpdatePortfolio (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePortfolio' {Maybe [Tag]
addTags :: Maybe [Tag]
$sel:addTags:UpdatePortfolio' :: UpdatePortfolio -> Maybe [Tag]
addTags} -> Maybe [Tag]
addTags) (\s :: UpdatePortfolio
s@UpdatePortfolio' {} Maybe [Tag]
a -> UpdatePortfolio
s {$sel:addTags:UpdatePortfolio' :: Maybe [Tag]
addTags = Maybe [Tag]
a} :: UpdatePortfolio) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> UpdatePortfolio -> f UpdatePortfolio)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> UpdatePortfolio
-> f UpdatePortfolio
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 description of the portfolio.
updatePortfolio_description :: Lens.Lens' UpdatePortfolio (Prelude.Maybe Prelude.Text)
updatePortfolio_description :: (Maybe Text -> f (Maybe Text))
-> UpdatePortfolio -> f UpdatePortfolio
updatePortfolio_description = (UpdatePortfolio -> Maybe Text)
-> (UpdatePortfolio -> Maybe Text -> UpdatePortfolio)
-> Lens UpdatePortfolio UpdatePortfolio (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePortfolio' {Maybe Text
description :: Maybe Text
$sel:description:UpdatePortfolio' :: UpdatePortfolio -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdatePortfolio
s@UpdatePortfolio' {} Maybe Text
a -> UpdatePortfolio
s {$sel:description:UpdatePortfolio' :: Maybe Text
description = Maybe Text
a} :: UpdatePortfolio)

-- | The updated name of the portfolio provider.
updatePortfolio_providerName :: Lens.Lens' UpdatePortfolio (Prelude.Maybe Prelude.Text)
updatePortfolio_providerName :: (Maybe Text -> f (Maybe Text))
-> UpdatePortfolio -> f UpdatePortfolio
updatePortfolio_providerName = (UpdatePortfolio -> Maybe Text)
-> (UpdatePortfolio -> Maybe Text -> UpdatePortfolio)
-> Lens UpdatePortfolio UpdatePortfolio (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePortfolio' {Maybe Text
providerName :: Maybe Text
$sel:providerName:UpdatePortfolio' :: UpdatePortfolio -> Maybe Text
providerName} -> Maybe Text
providerName) (\s :: UpdatePortfolio
s@UpdatePortfolio' {} Maybe Text
a -> UpdatePortfolio
s {$sel:providerName:UpdatePortfolio' :: Maybe Text
providerName = Maybe Text
a} :: UpdatePortfolio)

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

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

instance Prelude.NFData UpdatePortfolio

instance Core.ToHeaders UpdatePortfolio where
  toHeaders :: UpdatePortfolio -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdatePortfolio -> 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.UpdatePortfolio" ::
                          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 UpdatePortfolio where
  toJSON :: UpdatePortfolio -> Value
toJSON UpdatePortfolio' {Maybe [Text]
Maybe [Tag]
Maybe Text
Text
id :: Text
providerName :: Maybe Text
description :: Maybe Text
addTags :: Maybe [Tag]
displayName :: Maybe Text
acceptLanguage :: Maybe Text
removeTags :: Maybe [Text]
$sel:id:UpdatePortfolio' :: UpdatePortfolio -> Text
$sel:providerName:UpdatePortfolio' :: UpdatePortfolio -> Maybe Text
$sel:description:UpdatePortfolio' :: UpdatePortfolio -> Maybe Text
$sel:addTags:UpdatePortfolio' :: UpdatePortfolio -> Maybe [Tag]
$sel:displayName:UpdatePortfolio' :: UpdatePortfolio -> Maybe Text
$sel:acceptLanguage:UpdatePortfolio' :: UpdatePortfolio -> Maybe Text
$sel:removeTags:UpdatePortfolio' :: UpdatePortfolio -> 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
"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
"DisplayName" 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
displayName,
            (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
"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
"ProviderName" 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
providerName,
            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 UpdatePortfolio where
  toPath :: UpdatePortfolio -> ByteString
toPath = ByteString -> UpdatePortfolio -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'UpdatePortfolioResponse' 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:
--
-- 'portfolioDetail', 'updatePortfolioResponse_portfolioDetail' - Information about the portfolio.
--
-- 'tags', 'updatePortfolioResponse_tags' - Information about the tags associated with the portfolio.
--
-- 'httpStatus', 'updatePortfolioResponse_httpStatus' - The response's http status code.
newUpdatePortfolioResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdatePortfolioResponse
newUpdatePortfolioResponse :: Int -> UpdatePortfolioResponse
newUpdatePortfolioResponse Int
pHttpStatus_ =
  UpdatePortfolioResponse' :: Maybe PortfolioDetail
-> Maybe [Tag] -> Int -> UpdatePortfolioResponse
UpdatePortfolioResponse'
    { $sel:portfolioDetail:UpdatePortfolioResponse' :: Maybe PortfolioDetail
portfolioDetail =
        Maybe PortfolioDetail
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:UpdatePortfolioResponse' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdatePortfolioResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the portfolio.
updatePortfolioResponse_portfolioDetail :: Lens.Lens' UpdatePortfolioResponse (Prelude.Maybe PortfolioDetail)
updatePortfolioResponse_portfolioDetail :: (Maybe PortfolioDetail -> f (Maybe PortfolioDetail))
-> UpdatePortfolioResponse -> f UpdatePortfolioResponse
updatePortfolioResponse_portfolioDetail = (UpdatePortfolioResponse -> Maybe PortfolioDetail)
-> (UpdatePortfolioResponse
    -> Maybe PortfolioDetail -> UpdatePortfolioResponse)
-> Lens
     UpdatePortfolioResponse
     UpdatePortfolioResponse
     (Maybe PortfolioDetail)
     (Maybe PortfolioDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePortfolioResponse' {Maybe PortfolioDetail
portfolioDetail :: Maybe PortfolioDetail
$sel:portfolioDetail:UpdatePortfolioResponse' :: UpdatePortfolioResponse -> Maybe PortfolioDetail
portfolioDetail} -> Maybe PortfolioDetail
portfolioDetail) (\s :: UpdatePortfolioResponse
s@UpdatePortfolioResponse' {} Maybe PortfolioDetail
a -> UpdatePortfolioResponse
s {$sel:portfolioDetail:UpdatePortfolioResponse' :: Maybe PortfolioDetail
portfolioDetail = Maybe PortfolioDetail
a} :: UpdatePortfolioResponse)

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

instance Prelude.NFData UpdatePortfolioResponse