{-# 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 #-}
module Amazonka.ServiceCatalog.AssociateProductWithPortfolio
(
AssociateProductWithPortfolio (..),
newAssociateProductWithPortfolio,
associateProductWithPortfolio_sourcePortfolioId,
associateProductWithPortfolio_acceptLanguage,
associateProductWithPortfolio_productId,
associateProductWithPortfolio_portfolioId,
AssociateProductWithPortfolioResponse (..),
newAssociateProductWithPortfolioResponse,
associateProductWithPortfolioResponse_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
data AssociateProductWithPortfolio = AssociateProductWithPortfolio'
{
AssociateProductWithPortfolio -> Maybe Text
sourcePortfolioId :: Prelude.Maybe Prelude.Text,
AssociateProductWithPortfolio -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
AssociateProductWithPortfolio -> Text
productId :: Prelude.Text,
AssociateProductWithPortfolio -> Text
portfolioId :: Prelude.Text
}
deriving (AssociateProductWithPortfolio
-> AssociateProductWithPortfolio -> Bool
(AssociateProductWithPortfolio
-> AssociateProductWithPortfolio -> Bool)
-> (AssociateProductWithPortfolio
-> AssociateProductWithPortfolio -> Bool)
-> Eq AssociateProductWithPortfolio
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateProductWithPortfolio
-> AssociateProductWithPortfolio -> Bool
$c/= :: AssociateProductWithPortfolio
-> AssociateProductWithPortfolio -> Bool
== :: AssociateProductWithPortfolio
-> AssociateProductWithPortfolio -> Bool
$c== :: AssociateProductWithPortfolio
-> AssociateProductWithPortfolio -> Bool
Prelude.Eq, ReadPrec [AssociateProductWithPortfolio]
ReadPrec AssociateProductWithPortfolio
Int -> ReadS AssociateProductWithPortfolio
ReadS [AssociateProductWithPortfolio]
(Int -> ReadS AssociateProductWithPortfolio)
-> ReadS [AssociateProductWithPortfolio]
-> ReadPrec AssociateProductWithPortfolio
-> ReadPrec [AssociateProductWithPortfolio]
-> Read AssociateProductWithPortfolio
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateProductWithPortfolio]
$creadListPrec :: ReadPrec [AssociateProductWithPortfolio]
readPrec :: ReadPrec AssociateProductWithPortfolio
$creadPrec :: ReadPrec AssociateProductWithPortfolio
readList :: ReadS [AssociateProductWithPortfolio]
$creadList :: ReadS [AssociateProductWithPortfolio]
readsPrec :: Int -> ReadS AssociateProductWithPortfolio
$creadsPrec :: Int -> ReadS AssociateProductWithPortfolio
Prelude.Read, Int -> AssociateProductWithPortfolio -> ShowS
[AssociateProductWithPortfolio] -> ShowS
AssociateProductWithPortfolio -> String
(Int -> AssociateProductWithPortfolio -> ShowS)
-> (AssociateProductWithPortfolio -> String)
-> ([AssociateProductWithPortfolio] -> ShowS)
-> Show AssociateProductWithPortfolio
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateProductWithPortfolio] -> ShowS
$cshowList :: [AssociateProductWithPortfolio] -> ShowS
show :: AssociateProductWithPortfolio -> String
$cshow :: AssociateProductWithPortfolio -> String
showsPrec :: Int -> AssociateProductWithPortfolio -> ShowS
$cshowsPrec :: Int -> AssociateProductWithPortfolio -> ShowS
Prelude.Show, (forall x.
AssociateProductWithPortfolio
-> Rep AssociateProductWithPortfolio x)
-> (forall x.
Rep AssociateProductWithPortfolio x
-> AssociateProductWithPortfolio)
-> Generic AssociateProductWithPortfolio
forall x.
Rep AssociateProductWithPortfolio x
-> AssociateProductWithPortfolio
forall x.
AssociateProductWithPortfolio
-> Rep AssociateProductWithPortfolio x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateProductWithPortfolio x
-> AssociateProductWithPortfolio
$cfrom :: forall x.
AssociateProductWithPortfolio
-> Rep AssociateProductWithPortfolio x
Prelude.Generic)
newAssociateProductWithPortfolio ::
Prelude.Text ->
Prelude.Text ->
AssociateProductWithPortfolio
newAssociateProductWithPortfolio :: Text -> Text -> AssociateProductWithPortfolio
newAssociateProductWithPortfolio
Text
pProductId_
Text
pPortfolioId_ =
AssociateProductWithPortfolio' :: Maybe Text
-> Maybe Text -> Text -> Text -> AssociateProductWithPortfolio
AssociateProductWithPortfolio'
{ $sel:sourcePortfolioId:AssociateProductWithPortfolio' :: Maybe Text
sourcePortfolioId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:acceptLanguage:AssociateProductWithPortfolio' :: Maybe Text
acceptLanguage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:productId:AssociateProductWithPortfolio' :: Text
productId = Text
pProductId_,
$sel:portfolioId:AssociateProductWithPortfolio' :: Text
portfolioId = Text
pPortfolioId_
}
associateProductWithPortfolio_sourcePortfolioId :: Lens.Lens' AssociateProductWithPortfolio (Prelude.Maybe Prelude.Text)
associateProductWithPortfolio_sourcePortfolioId :: (Maybe Text -> f (Maybe Text))
-> AssociateProductWithPortfolio -> f AssociateProductWithPortfolio
associateProductWithPortfolio_sourcePortfolioId = (AssociateProductWithPortfolio -> Maybe Text)
-> (AssociateProductWithPortfolio
-> Maybe Text -> AssociateProductWithPortfolio)
-> Lens
AssociateProductWithPortfolio
AssociateProductWithPortfolio
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateProductWithPortfolio' {Maybe Text
sourcePortfolioId :: Maybe Text
$sel:sourcePortfolioId:AssociateProductWithPortfolio' :: AssociateProductWithPortfolio -> Maybe Text
sourcePortfolioId} -> Maybe Text
sourcePortfolioId) (\s :: AssociateProductWithPortfolio
s@AssociateProductWithPortfolio' {} Maybe Text
a -> AssociateProductWithPortfolio
s {$sel:sourcePortfolioId:AssociateProductWithPortfolio' :: Maybe Text
sourcePortfolioId = Maybe Text
a} :: AssociateProductWithPortfolio)
associateProductWithPortfolio_acceptLanguage :: Lens.Lens' AssociateProductWithPortfolio (Prelude.Maybe Prelude.Text)
associateProductWithPortfolio_acceptLanguage :: (Maybe Text -> f (Maybe Text))
-> AssociateProductWithPortfolio -> f AssociateProductWithPortfolio
associateProductWithPortfolio_acceptLanguage = (AssociateProductWithPortfolio -> Maybe Text)
-> (AssociateProductWithPortfolio
-> Maybe Text -> AssociateProductWithPortfolio)
-> Lens
AssociateProductWithPortfolio
AssociateProductWithPortfolio
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateProductWithPortfolio' {Maybe Text
acceptLanguage :: Maybe Text
$sel:acceptLanguage:AssociateProductWithPortfolio' :: AssociateProductWithPortfolio -> Maybe Text
acceptLanguage} -> Maybe Text
acceptLanguage) (\s :: AssociateProductWithPortfolio
s@AssociateProductWithPortfolio' {} Maybe Text
a -> AssociateProductWithPortfolio
s {$sel:acceptLanguage:AssociateProductWithPortfolio' :: Maybe Text
acceptLanguage = Maybe Text
a} :: AssociateProductWithPortfolio)
associateProductWithPortfolio_productId :: Lens.Lens' AssociateProductWithPortfolio Prelude.Text
associateProductWithPortfolio_productId :: (Text -> f Text)
-> AssociateProductWithPortfolio -> f AssociateProductWithPortfolio
associateProductWithPortfolio_productId = (AssociateProductWithPortfolio -> Text)
-> (AssociateProductWithPortfolio
-> Text -> AssociateProductWithPortfolio)
-> Lens
AssociateProductWithPortfolio
AssociateProductWithPortfolio
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateProductWithPortfolio' {Text
productId :: Text
$sel:productId:AssociateProductWithPortfolio' :: AssociateProductWithPortfolio -> Text
productId} -> Text
productId) (\s :: AssociateProductWithPortfolio
s@AssociateProductWithPortfolio' {} Text
a -> AssociateProductWithPortfolio
s {$sel:productId:AssociateProductWithPortfolio' :: Text
productId = Text
a} :: AssociateProductWithPortfolio)
associateProductWithPortfolio_portfolioId :: Lens.Lens' AssociateProductWithPortfolio Prelude.Text
associateProductWithPortfolio_portfolioId :: (Text -> f Text)
-> AssociateProductWithPortfolio -> f AssociateProductWithPortfolio
associateProductWithPortfolio_portfolioId = (AssociateProductWithPortfolio -> Text)
-> (AssociateProductWithPortfolio
-> Text -> AssociateProductWithPortfolio)
-> Lens
AssociateProductWithPortfolio
AssociateProductWithPortfolio
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateProductWithPortfolio' {Text
portfolioId :: Text
$sel:portfolioId:AssociateProductWithPortfolio' :: AssociateProductWithPortfolio -> Text
portfolioId} -> Text
portfolioId) (\s :: AssociateProductWithPortfolio
s@AssociateProductWithPortfolio' {} Text
a -> AssociateProductWithPortfolio
s {$sel:portfolioId:AssociateProductWithPortfolio' :: Text
portfolioId = Text
a} :: AssociateProductWithPortfolio)
instance
Core.AWSRequest
AssociateProductWithPortfolio
where
type
AWSResponse AssociateProductWithPortfolio =
AssociateProductWithPortfolioResponse
request :: AssociateProductWithPortfolio
-> Request AssociateProductWithPortfolio
request = Service
-> AssociateProductWithPortfolio
-> Request AssociateProductWithPortfolio
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateProductWithPortfolio
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateProductWithPortfolio)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AssociateProductWithPortfolio))
-> Logger
-> Service
-> Proxy AssociateProductWithPortfolio
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateProductWithPortfolio)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> AssociateProductWithPortfolioResponse
AssociateProductWithPortfolioResponse'
(Int -> AssociateProductWithPortfolioResponse)
-> Either String Int
-> Either String AssociateProductWithPortfolioResponse
forall (f :: * -> *) a b. Functor 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
AssociateProductWithPortfolio
instance Prelude.NFData AssociateProductWithPortfolio
instance Core.ToHeaders AssociateProductWithPortfolio where
toHeaders :: AssociateProductWithPortfolio -> ResponseHeaders
toHeaders =
ResponseHeaders -> AssociateProductWithPortfolio -> 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.AssociateProductWithPortfolio" ::
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 AssociateProductWithPortfolio where
toJSON :: AssociateProductWithPortfolio -> Value
toJSON AssociateProductWithPortfolio' {Maybe Text
Text
portfolioId :: Text
productId :: Text
acceptLanguage :: Maybe Text
sourcePortfolioId :: Maybe Text
$sel:portfolioId:AssociateProductWithPortfolio' :: AssociateProductWithPortfolio -> Text
$sel:productId:AssociateProductWithPortfolio' :: AssociateProductWithPortfolio -> Text
$sel:acceptLanguage:AssociateProductWithPortfolio' :: AssociateProductWithPortfolio -> Maybe Text
$sel:sourcePortfolioId:AssociateProductWithPortfolio' :: AssociateProductWithPortfolio -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SourcePortfolioId" 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
sourcePortfolioId,
(Text
"AcceptLanguage" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
acceptLanguage,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ProductId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
productId),
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 AssociateProductWithPortfolio where
toPath :: AssociateProductWithPortfolio -> ByteString
toPath = ByteString -> AssociateProductWithPortfolio -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AssociateProductWithPortfolio where
toQuery :: AssociateProductWithPortfolio -> QueryString
toQuery = QueryString -> AssociateProductWithPortfolio -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AssociateProductWithPortfolioResponse = AssociateProductWithPortfolioResponse'
{
AssociateProductWithPortfolioResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateProductWithPortfolioResponse
-> AssociateProductWithPortfolioResponse -> Bool
(AssociateProductWithPortfolioResponse
-> AssociateProductWithPortfolioResponse -> Bool)
-> (AssociateProductWithPortfolioResponse
-> AssociateProductWithPortfolioResponse -> Bool)
-> Eq AssociateProductWithPortfolioResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateProductWithPortfolioResponse
-> AssociateProductWithPortfolioResponse -> Bool
$c/= :: AssociateProductWithPortfolioResponse
-> AssociateProductWithPortfolioResponse -> Bool
== :: AssociateProductWithPortfolioResponse
-> AssociateProductWithPortfolioResponse -> Bool
$c== :: AssociateProductWithPortfolioResponse
-> AssociateProductWithPortfolioResponse -> Bool
Prelude.Eq, ReadPrec [AssociateProductWithPortfolioResponse]
ReadPrec AssociateProductWithPortfolioResponse
Int -> ReadS AssociateProductWithPortfolioResponse
ReadS [AssociateProductWithPortfolioResponse]
(Int -> ReadS AssociateProductWithPortfolioResponse)
-> ReadS [AssociateProductWithPortfolioResponse]
-> ReadPrec AssociateProductWithPortfolioResponse
-> ReadPrec [AssociateProductWithPortfolioResponse]
-> Read AssociateProductWithPortfolioResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateProductWithPortfolioResponse]
$creadListPrec :: ReadPrec [AssociateProductWithPortfolioResponse]
readPrec :: ReadPrec AssociateProductWithPortfolioResponse
$creadPrec :: ReadPrec AssociateProductWithPortfolioResponse
readList :: ReadS [AssociateProductWithPortfolioResponse]
$creadList :: ReadS [AssociateProductWithPortfolioResponse]
readsPrec :: Int -> ReadS AssociateProductWithPortfolioResponse
$creadsPrec :: Int -> ReadS AssociateProductWithPortfolioResponse
Prelude.Read, Int -> AssociateProductWithPortfolioResponse -> ShowS
[AssociateProductWithPortfolioResponse] -> ShowS
AssociateProductWithPortfolioResponse -> String
(Int -> AssociateProductWithPortfolioResponse -> ShowS)
-> (AssociateProductWithPortfolioResponse -> String)
-> ([AssociateProductWithPortfolioResponse] -> ShowS)
-> Show AssociateProductWithPortfolioResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateProductWithPortfolioResponse] -> ShowS
$cshowList :: [AssociateProductWithPortfolioResponse] -> ShowS
show :: AssociateProductWithPortfolioResponse -> String
$cshow :: AssociateProductWithPortfolioResponse -> String
showsPrec :: Int -> AssociateProductWithPortfolioResponse -> ShowS
$cshowsPrec :: Int -> AssociateProductWithPortfolioResponse -> ShowS
Prelude.Show, (forall x.
AssociateProductWithPortfolioResponse
-> Rep AssociateProductWithPortfolioResponse x)
-> (forall x.
Rep AssociateProductWithPortfolioResponse x
-> AssociateProductWithPortfolioResponse)
-> Generic AssociateProductWithPortfolioResponse
forall x.
Rep AssociateProductWithPortfolioResponse x
-> AssociateProductWithPortfolioResponse
forall x.
AssociateProductWithPortfolioResponse
-> Rep AssociateProductWithPortfolioResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateProductWithPortfolioResponse x
-> AssociateProductWithPortfolioResponse
$cfrom :: forall x.
AssociateProductWithPortfolioResponse
-> Rep AssociateProductWithPortfolioResponse x
Prelude.Generic)
newAssociateProductWithPortfolioResponse ::
Prelude.Int ->
AssociateProductWithPortfolioResponse
newAssociateProductWithPortfolioResponse :: Int -> AssociateProductWithPortfolioResponse
newAssociateProductWithPortfolioResponse Int
pHttpStatus_ =
AssociateProductWithPortfolioResponse' :: Int -> AssociateProductWithPortfolioResponse
AssociateProductWithPortfolioResponse'
{ $sel:httpStatus:AssociateProductWithPortfolioResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
associateProductWithPortfolioResponse_httpStatus :: Lens.Lens' AssociateProductWithPortfolioResponse Prelude.Int
associateProductWithPortfolioResponse_httpStatus :: (Int -> f Int)
-> AssociateProductWithPortfolioResponse
-> f AssociateProductWithPortfolioResponse
associateProductWithPortfolioResponse_httpStatus = (AssociateProductWithPortfolioResponse -> Int)
-> (AssociateProductWithPortfolioResponse
-> Int -> AssociateProductWithPortfolioResponse)
-> Lens
AssociateProductWithPortfolioResponse
AssociateProductWithPortfolioResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateProductWithPortfolioResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateProductWithPortfolioResponse' :: AssociateProductWithPortfolioResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateProductWithPortfolioResponse
s@AssociateProductWithPortfolioResponse' {} Int
a -> AssociateProductWithPortfolioResponse
s {$sel:httpStatus:AssociateProductWithPortfolioResponse' :: Int
httpStatus = Int
a} :: AssociateProductWithPortfolioResponse)
instance
Prelude.NFData
AssociateProductWithPortfolioResponse