{-# 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.CreatePortfolio
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a portfolio.
--
-- A delegated admin is authorized to invoke this command.
module Amazonka.ServiceCatalog.CreatePortfolio
  ( -- * Creating a Request
    CreatePortfolio (..),
    newCreatePortfolio,

    -- * Request Lenses
    createPortfolio_acceptLanguage,
    createPortfolio_description,
    createPortfolio_tags,
    createPortfolio_displayName,
    createPortfolio_providerName,
    createPortfolio_idempotencyToken,

    -- * Destructuring the Response
    CreatePortfolioResponse (..),
    newCreatePortfolioResponse,

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

-- |
-- Create a value of 'CreatePortfolio' 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', 'createPortfolio_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'description', 'createPortfolio_description' - The description of the portfolio.
--
-- 'tags', 'createPortfolio_tags' - One or more tags.
--
-- 'displayName', 'createPortfolio_displayName' - The name to use for display purposes.
--
-- 'providerName', 'createPortfolio_providerName' - The name of the portfolio provider.
--
-- 'idempotencyToken', 'createPortfolio_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.
newCreatePortfolio ::
  -- | 'displayName'
  Prelude.Text ->
  -- | 'providerName'
  Prelude.Text ->
  -- | 'idempotencyToken'
  Prelude.Text ->
  CreatePortfolio
newCreatePortfolio :: Text -> Text -> Text -> CreatePortfolio
newCreatePortfolio
  Text
pDisplayName_
  Text
pProviderName_
  Text
pIdempotencyToken_ =
    CreatePortfolio' :: Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> CreatePortfolio
CreatePortfolio'
      { $sel:acceptLanguage:CreatePortfolio' :: Maybe Text
acceptLanguage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreatePortfolio' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreatePortfolio' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:displayName:CreatePortfolio' :: Text
displayName = Text
pDisplayName_,
        $sel:providerName:CreatePortfolio' :: Text
providerName = Text
pProviderName_,
        $sel:idempotencyToken:CreatePortfolio' :: Text
idempotencyToken = Text
pIdempotencyToken_
      }

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

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

-- | One or more tags.
createPortfolio_tags :: Lens.Lens' CreatePortfolio (Prelude.Maybe [Tag])
createPortfolio_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreatePortfolio -> f CreatePortfolio
createPortfolio_tags = (CreatePortfolio -> Maybe [Tag])
-> (CreatePortfolio -> Maybe [Tag] -> CreatePortfolio)
-> Lens CreatePortfolio CreatePortfolio (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePortfolio' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreatePortfolio' :: CreatePortfolio -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreatePortfolio
s@CreatePortfolio' {} Maybe [Tag]
a -> CreatePortfolio
s {$sel:tags:CreatePortfolio' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreatePortfolio) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreatePortfolio -> f CreatePortfolio)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreatePortfolio
-> f CreatePortfolio
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 name to use for display purposes.
createPortfolio_displayName :: Lens.Lens' CreatePortfolio Prelude.Text
createPortfolio_displayName :: (Text -> f Text) -> CreatePortfolio -> f CreatePortfolio
createPortfolio_displayName = (CreatePortfolio -> Text)
-> (CreatePortfolio -> Text -> CreatePortfolio)
-> Lens CreatePortfolio CreatePortfolio Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePortfolio' {Text
displayName :: Text
$sel:displayName:CreatePortfolio' :: CreatePortfolio -> Text
displayName} -> Text
displayName) (\s :: CreatePortfolio
s@CreatePortfolio' {} Text
a -> CreatePortfolio
s {$sel:displayName:CreatePortfolio' :: Text
displayName = Text
a} :: CreatePortfolio)

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

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

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

instance Prelude.NFData CreatePortfolio

instance Core.ToHeaders CreatePortfolio where
  toHeaders :: CreatePortfolio -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreatePortfolio -> 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.CreatePortfolio" ::
                          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 CreatePortfolio where
  toJSON :: CreatePortfolio -> Value
toJSON CreatePortfolio' {Maybe [Tag]
Maybe Text
Text
idempotencyToken :: Text
providerName :: Text
displayName :: Text
tags :: Maybe [Tag]
description :: Maybe Text
acceptLanguage :: Maybe Text
$sel:idempotencyToken:CreatePortfolio' :: CreatePortfolio -> Text
$sel:providerName:CreatePortfolio' :: CreatePortfolio -> Text
$sel:displayName:CreatePortfolio' :: CreatePortfolio -> Text
$sel:tags:CreatePortfolio' :: CreatePortfolio -> Maybe [Tag]
$sel:description:CreatePortfolio' :: CreatePortfolio -> Maybe Text
$sel:acceptLanguage:CreatePortfolio' :: CreatePortfolio -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DisplayName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
displayName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ProviderName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
providerName),
            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 CreatePortfolio where
  toPath :: CreatePortfolio -> ByteString
toPath = ByteString -> CreatePortfolio -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

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

instance Prelude.NFData CreatePortfolioResponse