{-# 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.CreatePortfolioShare
-- 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)
--
-- Shares the specified portfolio with the specified account or
-- organization node. Shares to an organization node can only be created by
-- the management account of an organization or by a delegated
-- administrator. You can share portfolios to an organization, an
-- organizational unit, or a specific account.
--
-- Note that if a delegated admin is de-registered, they can no longer
-- create portfolio shares.
--
-- @AWSOrganizationsAccess@ must be enabled in order to create a portfolio
-- share to an organization node.
--
-- You can\'t share a shared resource, including portfolios that contain a
-- shared product.
--
-- If the portfolio share with the specified account or organization node
-- already exists, this action will have no effect and will not return an
-- error. To update an existing share, you must use the
-- @ UpdatePortfolioShare@ API instead.
module Amazonka.ServiceCatalog.CreatePortfolioShare
  ( -- * Creating a Request
    CreatePortfolioShare (..),
    newCreatePortfolioShare,

    -- * Request Lenses
    createPortfolioShare_accountId,
    createPortfolioShare_shareTagOptions,
    createPortfolioShare_acceptLanguage,
    createPortfolioShare_organizationNode,
    createPortfolioShare_portfolioId,

    -- * Destructuring the Response
    CreatePortfolioShareResponse (..),
    newCreatePortfolioShareResponse,

    -- * Response Lenses
    createPortfolioShareResponse_portfolioShareToken,
    createPortfolioShareResponse_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:/ 'newCreatePortfolioShare' smart constructor.
data CreatePortfolioShare = CreatePortfolioShare'
  { -- | The AWS account ID. For example, @123456789012@.
    CreatePortfolioShare -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | Enables or disables @TagOptions @ sharing when creating the portfolio
    -- share. If this flag is not provided, TagOptions sharing is disabled.
    CreatePortfolioShare -> Maybe Bool
shareTagOptions :: Prelude.Maybe Prelude.Bool,
    -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    CreatePortfolioShare -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The organization node to whom you are going to share. If
    -- @OrganizationNode@ is passed in, @PortfolioShare@ will be created for
    -- the node an ListOrganizationPortfolioAccessd its children (when
    -- applies), and a @PortfolioShareToken@ will be returned in the output in
    -- order for the administrator to monitor the status of the
    -- @PortfolioShare@ creation process.
    CreatePortfolioShare -> Maybe OrganizationNode
organizationNode :: Prelude.Maybe OrganizationNode,
    -- | The portfolio identifier.
    CreatePortfolioShare -> Text
portfolioId :: Prelude.Text
  }
  deriving (CreatePortfolioShare -> CreatePortfolioShare -> Bool
(CreatePortfolioShare -> CreatePortfolioShare -> Bool)
-> (CreatePortfolioShare -> CreatePortfolioShare -> Bool)
-> Eq CreatePortfolioShare
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePortfolioShare -> CreatePortfolioShare -> Bool
$c/= :: CreatePortfolioShare -> CreatePortfolioShare -> Bool
== :: CreatePortfolioShare -> CreatePortfolioShare -> Bool
$c== :: CreatePortfolioShare -> CreatePortfolioShare -> Bool
Prelude.Eq, ReadPrec [CreatePortfolioShare]
ReadPrec CreatePortfolioShare
Int -> ReadS CreatePortfolioShare
ReadS [CreatePortfolioShare]
(Int -> ReadS CreatePortfolioShare)
-> ReadS [CreatePortfolioShare]
-> ReadPrec CreatePortfolioShare
-> ReadPrec [CreatePortfolioShare]
-> Read CreatePortfolioShare
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePortfolioShare]
$creadListPrec :: ReadPrec [CreatePortfolioShare]
readPrec :: ReadPrec CreatePortfolioShare
$creadPrec :: ReadPrec CreatePortfolioShare
readList :: ReadS [CreatePortfolioShare]
$creadList :: ReadS [CreatePortfolioShare]
readsPrec :: Int -> ReadS CreatePortfolioShare
$creadsPrec :: Int -> ReadS CreatePortfolioShare
Prelude.Read, Int -> CreatePortfolioShare -> ShowS
[CreatePortfolioShare] -> ShowS
CreatePortfolioShare -> String
(Int -> CreatePortfolioShare -> ShowS)
-> (CreatePortfolioShare -> String)
-> ([CreatePortfolioShare] -> ShowS)
-> Show CreatePortfolioShare
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePortfolioShare] -> ShowS
$cshowList :: [CreatePortfolioShare] -> ShowS
show :: CreatePortfolioShare -> String
$cshow :: CreatePortfolioShare -> String
showsPrec :: Int -> CreatePortfolioShare -> ShowS
$cshowsPrec :: Int -> CreatePortfolioShare -> ShowS
Prelude.Show, (forall x. CreatePortfolioShare -> Rep CreatePortfolioShare x)
-> (forall x. Rep CreatePortfolioShare x -> CreatePortfolioShare)
-> Generic CreatePortfolioShare
forall x. Rep CreatePortfolioShare x -> CreatePortfolioShare
forall x. CreatePortfolioShare -> Rep CreatePortfolioShare x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePortfolioShare x -> CreatePortfolioShare
$cfrom :: forall x. CreatePortfolioShare -> Rep CreatePortfolioShare x
Prelude.Generic)

-- |
-- Create a value of 'CreatePortfolioShare' 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:
--
-- 'accountId', 'createPortfolioShare_accountId' - The AWS account ID. For example, @123456789012@.
--
-- 'shareTagOptions', 'createPortfolioShare_shareTagOptions' - Enables or disables @TagOptions @ sharing when creating the portfolio
-- share. If this flag is not provided, TagOptions sharing is disabled.
--
-- 'acceptLanguage', 'createPortfolioShare_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'organizationNode', 'createPortfolioShare_organizationNode' - The organization node to whom you are going to share. If
-- @OrganizationNode@ is passed in, @PortfolioShare@ will be created for
-- the node an ListOrganizationPortfolioAccessd its children (when
-- applies), and a @PortfolioShareToken@ will be returned in the output in
-- order for the administrator to monitor the status of the
-- @PortfolioShare@ creation process.
--
-- 'portfolioId', 'createPortfolioShare_portfolioId' - The portfolio identifier.
newCreatePortfolioShare ::
  -- | 'portfolioId'
  Prelude.Text ->
  CreatePortfolioShare
newCreatePortfolioShare :: Text -> CreatePortfolioShare
newCreatePortfolioShare Text
pPortfolioId_ =
  CreatePortfolioShare' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe OrganizationNode
-> Text
-> CreatePortfolioShare
CreatePortfolioShare'
    { $sel:accountId:CreatePortfolioShare' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:shareTagOptions:CreatePortfolioShare' :: Maybe Bool
shareTagOptions = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:acceptLanguage:CreatePortfolioShare' :: Maybe Text
acceptLanguage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:organizationNode:CreatePortfolioShare' :: Maybe OrganizationNode
organizationNode = Maybe OrganizationNode
forall a. Maybe a
Prelude.Nothing,
      $sel:portfolioId:CreatePortfolioShare' :: Text
portfolioId = Text
pPortfolioId_
    }

-- | The AWS account ID. For example, @123456789012@.
createPortfolioShare_accountId :: Lens.Lens' CreatePortfolioShare (Prelude.Maybe Prelude.Text)
createPortfolioShare_accountId :: (Maybe Text -> f (Maybe Text))
-> CreatePortfolioShare -> f CreatePortfolioShare
createPortfolioShare_accountId = (CreatePortfolioShare -> Maybe Text)
-> (CreatePortfolioShare -> Maybe Text -> CreatePortfolioShare)
-> Lens
     CreatePortfolioShare CreatePortfolioShare (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePortfolioShare' {Maybe Text
accountId :: Maybe Text
$sel:accountId:CreatePortfolioShare' :: CreatePortfolioShare -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: CreatePortfolioShare
s@CreatePortfolioShare' {} Maybe Text
a -> CreatePortfolioShare
s {$sel:accountId:CreatePortfolioShare' :: Maybe Text
accountId = Maybe Text
a} :: CreatePortfolioShare)

-- | Enables or disables @TagOptions @ sharing when creating the portfolio
-- share. If this flag is not provided, TagOptions sharing is disabled.
createPortfolioShare_shareTagOptions :: Lens.Lens' CreatePortfolioShare (Prelude.Maybe Prelude.Bool)
createPortfolioShare_shareTagOptions :: (Maybe Bool -> f (Maybe Bool))
-> CreatePortfolioShare -> f CreatePortfolioShare
createPortfolioShare_shareTagOptions = (CreatePortfolioShare -> Maybe Bool)
-> (CreatePortfolioShare -> Maybe Bool -> CreatePortfolioShare)
-> Lens
     CreatePortfolioShare CreatePortfolioShare (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePortfolioShare' {Maybe Bool
shareTagOptions :: Maybe Bool
$sel:shareTagOptions:CreatePortfolioShare' :: CreatePortfolioShare -> Maybe Bool
shareTagOptions} -> Maybe Bool
shareTagOptions) (\s :: CreatePortfolioShare
s@CreatePortfolioShare' {} Maybe Bool
a -> CreatePortfolioShare
s {$sel:shareTagOptions:CreatePortfolioShare' :: Maybe Bool
shareTagOptions = Maybe Bool
a} :: CreatePortfolioShare)

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

-- | The organization node to whom you are going to share. If
-- @OrganizationNode@ is passed in, @PortfolioShare@ will be created for
-- the node an ListOrganizationPortfolioAccessd its children (when
-- applies), and a @PortfolioShareToken@ will be returned in the output in
-- order for the administrator to monitor the status of the
-- @PortfolioShare@ creation process.
createPortfolioShare_organizationNode :: Lens.Lens' CreatePortfolioShare (Prelude.Maybe OrganizationNode)
createPortfolioShare_organizationNode :: (Maybe OrganizationNode -> f (Maybe OrganizationNode))
-> CreatePortfolioShare -> f CreatePortfolioShare
createPortfolioShare_organizationNode = (CreatePortfolioShare -> Maybe OrganizationNode)
-> (CreatePortfolioShare
    -> Maybe OrganizationNode -> CreatePortfolioShare)
-> Lens
     CreatePortfolioShare
     CreatePortfolioShare
     (Maybe OrganizationNode)
     (Maybe OrganizationNode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePortfolioShare' {Maybe OrganizationNode
organizationNode :: Maybe OrganizationNode
$sel:organizationNode:CreatePortfolioShare' :: CreatePortfolioShare -> Maybe OrganizationNode
organizationNode} -> Maybe OrganizationNode
organizationNode) (\s :: CreatePortfolioShare
s@CreatePortfolioShare' {} Maybe OrganizationNode
a -> CreatePortfolioShare
s {$sel:organizationNode:CreatePortfolioShare' :: Maybe OrganizationNode
organizationNode = Maybe OrganizationNode
a} :: CreatePortfolioShare)

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

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

instance Prelude.NFData CreatePortfolioShare

instance Core.ToHeaders CreatePortfolioShare where
  toHeaders :: CreatePortfolioShare -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreatePortfolioShare -> 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.CreatePortfolioShare" ::
                          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 CreatePortfolioShare where
  toJSON :: CreatePortfolioShare -> Value
toJSON CreatePortfolioShare' {Maybe Bool
Maybe Text
Maybe OrganizationNode
Text
portfolioId :: Text
organizationNode :: Maybe OrganizationNode
acceptLanguage :: Maybe Text
shareTagOptions :: Maybe Bool
accountId :: Maybe Text
$sel:portfolioId:CreatePortfolioShare' :: CreatePortfolioShare -> Text
$sel:organizationNode:CreatePortfolioShare' :: CreatePortfolioShare -> Maybe OrganizationNode
$sel:acceptLanguage:CreatePortfolioShare' :: CreatePortfolioShare -> Maybe Text
$sel:shareTagOptions:CreatePortfolioShare' :: CreatePortfolioShare -> Maybe Bool
$sel:accountId:CreatePortfolioShare' :: CreatePortfolioShare -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AccountId" 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
accountId,
            (Text
"ShareTagOptions" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
shareTagOptions,
            (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
"OrganizationNode" Text -> OrganizationNode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (OrganizationNode -> Pair) -> Maybe OrganizationNode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OrganizationNode
organizationNode,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PortfolioId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
portfolioId)
          ]
      )

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

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

-- | /See:/ 'newCreatePortfolioShareResponse' smart constructor.
data CreatePortfolioShareResponse = CreatePortfolioShareResponse'
  { -- | The portfolio shares a unique identifier that only returns if the
    -- portfolio is shared to an organization node.
    CreatePortfolioShareResponse -> Maybe Text
portfolioShareToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreatePortfolioShareResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreatePortfolioShareResponse
-> CreatePortfolioShareResponse -> Bool
(CreatePortfolioShareResponse
 -> CreatePortfolioShareResponse -> Bool)
-> (CreatePortfolioShareResponse
    -> CreatePortfolioShareResponse -> Bool)
-> Eq CreatePortfolioShareResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePortfolioShareResponse
-> CreatePortfolioShareResponse -> Bool
$c/= :: CreatePortfolioShareResponse
-> CreatePortfolioShareResponse -> Bool
== :: CreatePortfolioShareResponse
-> CreatePortfolioShareResponse -> Bool
$c== :: CreatePortfolioShareResponse
-> CreatePortfolioShareResponse -> Bool
Prelude.Eq, ReadPrec [CreatePortfolioShareResponse]
ReadPrec CreatePortfolioShareResponse
Int -> ReadS CreatePortfolioShareResponse
ReadS [CreatePortfolioShareResponse]
(Int -> ReadS CreatePortfolioShareResponse)
-> ReadS [CreatePortfolioShareResponse]
-> ReadPrec CreatePortfolioShareResponse
-> ReadPrec [CreatePortfolioShareResponse]
-> Read CreatePortfolioShareResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePortfolioShareResponse]
$creadListPrec :: ReadPrec [CreatePortfolioShareResponse]
readPrec :: ReadPrec CreatePortfolioShareResponse
$creadPrec :: ReadPrec CreatePortfolioShareResponse
readList :: ReadS [CreatePortfolioShareResponse]
$creadList :: ReadS [CreatePortfolioShareResponse]
readsPrec :: Int -> ReadS CreatePortfolioShareResponse
$creadsPrec :: Int -> ReadS CreatePortfolioShareResponse
Prelude.Read, Int -> CreatePortfolioShareResponse -> ShowS
[CreatePortfolioShareResponse] -> ShowS
CreatePortfolioShareResponse -> String
(Int -> CreatePortfolioShareResponse -> ShowS)
-> (CreatePortfolioShareResponse -> String)
-> ([CreatePortfolioShareResponse] -> ShowS)
-> Show CreatePortfolioShareResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePortfolioShareResponse] -> ShowS
$cshowList :: [CreatePortfolioShareResponse] -> ShowS
show :: CreatePortfolioShareResponse -> String
$cshow :: CreatePortfolioShareResponse -> String
showsPrec :: Int -> CreatePortfolioShareResponse -> ShowS
$cshowsPrec :: Int -> CreatePortfolioShareResponse -> ShowS
Prelude.Show, (forall x.
 CreatePortfolioShareResponse -> Rep CreatePortfolioShareResponse x)
-> (forall x.
    Rep CreatePortfolioShareResponse x -> CreatePortfolioShareResponse)
-> Generic CreatePortfolioShareResponse
forall x.
Rep CreatePortfolioShareResponse x -> CreatePortfolioShareResponse
forall x.
CreatePortfolioShareResponse -> Rep CreatePortfolioShareResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePortfolioShareResponse x -> CreatePortfolioShareResponse
$cfrom :: forall x.
CreatePortfolioShareResponse -> Rep CreatePortfolioShareResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreatePortfolioShareResponse' 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:
--
-- 'portfolioShareToken', 'createPortfolioShareResponse_portfolioShareToken' - The portfolio shares a unique identifier that only returns if the
-- portfolio is shared to an organization node.
--
-- 'httpStatus', 'createPortfolioShareResponse_httpStatus' - The response's http status code.
newCreatePortfolioShareResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreatePortfolioShareResponse
newCreatePortfolioShareResponse :: Int -> CreatePortfolioShareResponse
newCreatePortfolioShareResponse Int
pHttpStatus_ =
  CreatePortfolioShareResponse' :: Maybe Text -> Int -> CreatePortfolioShareResponse
CreatePortfolioShareResponse'
    { $sel:portfolioShareToken:CreatePortfolioShareResponse' :: Maybe Text
portfolioShareToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreatePortfolioShareResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The portfolio shares a unique identifier that only returns if the
-- portfolio is shared to an organization node.
createPortfolioShareResponse_portfolioShareToken :: Lens.Lens' CreatePortfolioShareResponse (Prelude.Maybe Prelude.Text)
createPortfolioShareResponse_portfolioShareToken :: (Maybe Text -> f (Maybe Text))
-> CreatePortfolioShareResponse -> f CreatePortfolioShareResponse
createPortfolioShareResponse_portfolioShareToken = (CreatePortfolioShareResponse -> Maybe Text)
-> (CreatePortfolioShareResponse
    -> Maybe Text -> CreatePortfolioShareResponse)
-> Lens
     CreatePortfolioShareResponse
     CreatePortfolioShareResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePortfolioShareResponse' {Maybe Text
portfolioShareToken :: Maybe Text
$sel:portfolioShareToken:CreatePortfolioShareResponse' :: CreatePortfolioShareResponse -> Maybe Text
portfolioShareToken} -> Maybe Text
portfolioShareToken) (\s :: CreatePortfolioShareResponse
s@CreatePortfolioShareResponse' {} Maybe Text
a -> CreatePortfolioShareResponse
s {$sel:portfolioShareToken:CreatePortfolioShareResponse' :: Maybe Text
portfolioShareToken = Maybe Text
a} :: CreatePortfolioShareResponse)

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

instance Prelude.NFData CreatePortfolioShareResponse