{-# 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.AcceptPortfolioShare
(
AcceptPortfolioShare (..),
newAcceptPortfolioShare,
acceptPortfolioShare_portfolioShareType,
acceptPortfolioShare_acceptLanguage,
acceptPortfolioShare_portfolioId,
AcceptPortfolioShareResponse (..),
newAcceptPortfolioShareResponse,
acceptPortfolioShareResponse_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 AcceptPortfolioShare = AcceptPortfolioShare'
{
AcceptPortfolioShare -> Maybe PortfolioShareType
portfolioShareType :: Prelude.Maybe PortfolioShareType,
AcceptPortfolioShare -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
AcceptPortfolioShare -> Text
portfolioId :: Prelude.Text
}
deriving (AcceptPortfolioShare -> AcceptPortfolioShare -> Bool
(AcceptPortfolioShare -> AcceptPortfolioShare -> Bool)
-> (AcceptPortfolioShare -> AcceptPortfolioShare -> Bool)
-> Eq AcceptPortfolioShare
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptPortfolioShare -> AcceptPortfolioShare -> Bool
$c/= :: AcceptPortfolioShare -> AcceptPortfolioShare -> Bool
== :: AcceptPortfolioShare -> AcceptPortfolioShare -> Bool
$c== :: AcceptPortfolioShare -> AcceptPortfolioShare -> Bool
Prelude.Eq, ReadPrec [AcceptPortfolioShare]
ReadPrec AcceptPortfolioShare
Int -> ReadS AcceptPortfolioShare
ReadS [AcceptPortfolioShare]
(Int -> ReadS AcceptPortfolioShare)
-> ReadS [AcceptPortfolioShare]
-> ReadPrec AcceptPortfolioShare
-> ReadPrec [AcceptPortfolioShare]
-> Read AcceptPortfolioShare
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptPortfolioShare]
$creadListPrec :: ReadPrec [AcceptPortfolioShare]
readPrec :: ReadPrec AcceptPortfolioShare
$creadPrec :: ReadPrec AcceptPortfolioShare
readList :: ReadS [AcceptPortfolioShare]
$creadList :: ReadS [AcceptPortfolioShare]
readsPrec :: Int -> ReadS AcceptPortfolioShare
$creadsPrec :: Int -> ReadS AcceptPortfolioShare
Prelude.Read, Int -> AcceptPortfolioShare -> ShowS
[AcceptPortfolioShare] -> ShowS
AcceptPortfolioShare -> String
(Int -> AcceptPortfolioShare -> ShowS)
-> (AcceptPortfolioShare -> String)
-> ([AcceptPortfolioShare] -> ShowS)
-> Show AcceptPortfolioShare
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptPortfolioShare] -> ShowS
$cshowList :: [AcceptPortfolioShare] -> ShowS
show :: AcceptPortfolioShare -> String
$cshow :: AcceptPortfolioShare -> String
showsPrec :: Int -> AcceptPortfolioShare -> ShowS
$cshowsPrec :: Int -> AcceptPortfolioShare -> ShowS
Prelude.Show, (forall x. AcceptPortfolioShare -> Rep AcceptPortfolioShare x)
-> (forall x. Rep AcceptPortfolioShare x -> AcceptPortfolioShare)
-> Generic AcceptPortfolioShare
forall x. Rep AcceptPortfolioShare x -> AcceptPortfolioShare
forall x. AcceptPortfolioShare -> Rep AcceptPortfolioShare x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AcceptPortfolioShare x -> AcceptPortfolioShare
$cfrom :: forall x. AcceptPortfolioShare -> Rep AcceptPortfolioShare x
Prelude.Generic)
newAcceptPortfolioShare ::
Prelude.Text ->
AcceptPortfolioShare
newAcceptPortfolioShare :: Text -> AcceptPortfolioShare
newAcceptPortfolioShare Text
pPortfolioId_ =
AcceptPortfolioShare' :: Maybe PortfolioShareType
-> Maybe Text -> Text -> AcceptPortfolioShare
AcceptPortfolioShare'
{ $sel:portfolioShareType:AcceptPortfolioShare' :: Maybe PortfolioShareType
portfolioShareType =
Maybe PortfolioShareType
forall a. Maybe a
Prelude.Nothing,
$sel:acceptLanguage:AcceptPortfolioShare' :: Maybe Text
acceptLanguage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:portfolioId:AcceptPortfolioShare' :: Text
portfolioId = Text
pPortfolioId_
}
acceptPortfolioShare_portfolioShareType :: Lens.Lens' AcceptPortfolioShare (Prelude.Maybe PortfolioShareType)
acceptPortfolioShare_portfolioShareType :: (Maybe PortfolioShareType -> f (Maybe PortfolioShareType))
-> AcceptPortfolioShare -> f AcceptPortfolioShare
acceptPortfolioShare_portfolioShareType = (AcceptPortfolioShare -> Maybe PortfolioShareType)
-> (AcceptPortfolioShare
-> Maybe PortfolioShareType -> AcceptPortfolioShare)
-> Lens
AcceptPortfolioShare
AcceptPortfolioShare
(Maybe PortfolioShareType)
(Maybe PortfolioShareType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptPortfolioShare' {Maybe PortfolioShareType
portfolioShareType :: Maybe PortfolioShareType
$sel:portfolioShareType:AcceptPortfolioShare' :: AcceptPortfolioShare -> Maybe PortfolioShareType
portfolioShareType} -> Maybe PortfolioShareType
portfolioShareType) (\s :: AcceptPortfolioShare
s@AcceptPortfolioShare' {} Maybe PortfolioShareType
a -> AcceptPortfolioShare
s {$sel:portfolioShareType:AcceptPortfolioShare' :: Maybe PortfolioShareType
portfolioShareType = Maybe PortfolioShareType
a} :: AcceptPortfolioShare)
acceptPortfolioShare_acceptLanguage :: Lens.Lens' AcceptPortfolioShare (Prelude.Maybe Prelude.Text)
acceptPortfolioShare_acceptLanguage :: (Maybe Text -> f (Maybe Text))
-> AcceptPortfolioShare -> f AcceptPortfolioShare
acceptPortfolioShare_acceptLanguage = (AcceptPortfolioShare -> Maybe Text)
-> (AcceptPortfolioShare -> Maybe Text -> AcceptPortfolioShare)
-> Lens
AcceptPortfolioShare AcceptPortfolioShare (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptPortfolioShare' {Maybe Text
acceptLanguage :: Maybe Text
$sel:acceptLanguage:AcceptPortfolioShare' :: AcceptPortfolioShare -> Maybe Text
acceptLanguage} -> Maybe Text
acceptLanguage) (\s :: AcceptPortfolioShare
s@AcceptPortfolioShare' {} Maybe Text
a -> AcceptPortfolioShare
s {$sel:acceptLanguage:AcceptPortfolioShare' :: Maybe Text
acceptLanguage = Maybe Text
a} :: AcceptPortfolioShare)
acceptPortfolioShare_portfolioId :: Lens.Lens' AcceptPortfolioShare Prelude.Text
acceptPortfolioShare_portfolioId :: (Text -> f Text) -> AcceptPortfolioShare -> f AcceptPortfolioShare
acceptPortfolioShare_portfolioId = (AcceptPortfolioShare -> Text)
-> (AcceptPortfolioShare -> Text -> AcceptPortfolioShare)
-> Lens AcceptPortfolioShare AcceptPortfolioShare Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptPortfolioShare' {Text
portfolioId :: Text
$sel:portfolioId:AcceptPortfolioShare' :: AcceptPortfolioShare -> Text
portfolioId} -> Text
portfolioId) (\s :: AcceptPortfolioShare
s@AcceptPortfolioShare' {} Text
a -> AcceptPortfolioShare
s {$sel:portfolioId:AcceptPortfolioShare' :: Text
portfolioId = Text
a} :: AcceptPortfolioShare)
instance Core.AWSRequest AcceptPortfolioShare where
type
AWSResponse AcceptPortfolioShare =
AcceptPortfolioShareResponse
request :: AcceptPortfolioShare -> Request AcceptPortfolioShare
request = Service -> AcceptPortfolioShare -> Request AcceptPortfolioShare
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AcceptPortfolioShare
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AcceptPortfolioShare)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AcceptPortfolioShare))
-> Logger
-> Service
-> Proxy AcceptPortfolioShare
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AcceptPortfolioShare)))
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 -> AcceptPortfolioShareResponse
AcceptPortfolioShareResponse'
(Int -> AcceptPortfolioShareResponse)
-> Either String Int -> Either String AcceptPortfolioShareResponse
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 AcceptPortfolioShare
instance Prelude.NFData AcceptPortfolioShare
instance Core.ToHeaders AcceptPortfolioShare where
toHeaders :: AcceptPortfolioShare -> ResponseHeaders
toHeaders =
ResponseHeaders -> AcceptPortfolioShare -> 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.AcceptPortfolioShare" ::
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 AcceptPortfolioShare where
toJSON :: AcceptPortfolioShare -> Value
toJSON AcceptPortfolioShare' {Maybe Text
Maybe PortfolioShareType
Text
portfolioId :: Text
acceptLanguage :: Maybe Text
portfolioShareType :: Maybe PortfolioShareType
$sel:portfolioId:AcceptPortfolioShare' :: AcceptPortfolioShare -> Text
$sel:acceptLanguage:AcceptPortfolioShare' :: AcceptPortfolioShare -> Maybe Text
$sel:portfolioShareType:AcceptPortfolioShare' :: AcceptPortfolioShare -> Maybe PortfolioShareType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PortfolioShareType" Text -> PortfolioShareType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(PortfolioShareType -> Pair)
-> Maybe PortfolioShareType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PortfolioShareType
portfolioShareType,
(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
"PortfolioId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
portfolioId)
]
)
instance Core.ToPath AcceptPortfolioShare where
toPath :: AcceptPortfolioShare -> ByteString
toPath = ByteString -> AcceptPortfolioShare -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AcceptPortfolioShare where
toQuery :: AcceptPortfolioShare -> QueryString
toQuery = QueryString -> AcceptPortfolioShare -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AcceptPortfolioShareResponse = AcceptPortfolioShareResponse'
{
AcceptPortfolioShareResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AcceptPortfolioShareResponse
-> AcceptPortfolioShareResponse -> Bool
(AcceptPortfolioShareResponse
-> AcceptPortfolioShareResponse -> Bool)
-> (AcceptPortfolioShareResponse
-> AcceptPortfolioShareResponse -> Bool)
-> Eq AcceptPortfolioShareResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptPortfolioShareResponse
-> AcceptPortfolioShareResponse -> Bool
$c/= :: AcceptPortfolioShareResponse
-> AcceptPortfolioShareResponse -> Bool
== :: AcceptPortfolioShareResponse
-> AcceptPortfolioShareResponse -> Bool
$c== :: AcceptPortfolioShareResponse
-> AcceptPortfolioShareResponse -> Bool
Prelude.Eq, ReadPrec [AcceptPortfolioShareResponse]
ReadPrec AcceptPortfolioShareResponse
Int -> ReadS AcceptPortfolioShareResponse
ReadS [AcceptPortfolioShareResponse]
(Int -> ReadS AcceptPortfolioShareResponse)
-> ReadS [AcceptPortfolioShareResponse]
-> ReadPrec AcceptPortfolioShareResponse
-> ReadPrec [AcceptPortfolioShareResponse]
-> Read AcceptPortfolioShareResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptPortfolioShareResponse]
$creadListPrec :: ReadPrec [AcceptPortfolioShareResponse]
readPrec :: ReadPrec AcceptPortfolioShareResponse
$creadPrec :: ReadPrec AcceptPortfolioShareResponse
readList :: ReadS [AcceptPortfolioShareResponse]
$creadList :: ReadS [AcceptPortfolioShareResponse]
readsPrec :: Int -> ReadS AcceptPortfolioShareResponse
$creadsPrec :: Int -> ReadS AcceptPortfolioShareResponse
Prelude.Read, Int -> AcceptPortfolioShareResponse -> ShowS
[AcceptPortfolioShareResponse] -> ShowS
AcceptPortfolioShareResponse -> String
(Int -> AcceptPortfolioShareResponse -> ShowS)
-> (AcceptPortfolioShareResponse -> String)
-> ([AcceptPortfolioShareResponse] -> ShowS)
-> Show AcceptPortfolioShareResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptPortfolioShareResponse] -> ShowS
$cshowList :: [AcceptPortfolioShareResponse] -> ShowS
show :: AcceptPortfolioShareResponse -> String
$cshow :: AcceptPortfolioShareResponse -> String
showsPrec :: Int -> AcceptPortfolioShareResponse -> ShowS
$cshowsPrec :: Int -> AcceptPortfolioShareResponse -> ShowS
Prelude.Show, (forall x.
AcceptPortfolioShareResponse -> Rep AcceptPortfolioShareResponse x)
-> (forall x.
Rep AcceptPortfolioShareResponse x -> AcceptPortfolioShareResponse)
-> Generic AcceptPortfolioShareResponse
forall x.
Rep AcceptPortfolioShareResponse x -> AcceptPortfolioShareResponse
forall x.
AcceptPortfolioShareResponse -> Rep AcceptPortfolioShareResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AcceptPortfolioShareResponse x -> AcceptPortfolioShareResponse
$cfrom :: forall x.
AcceptPortfolioShareResponse -> Rep AcceptPortfolioShareResponse x
Prelude.Generic)
newAcceptPortfolioShareResponse ::
Prelude.Int ->
AcceptPortfolioShareResponse
newAcceptPortfolioShareResponse :: Int -> AcceptPortfolioShareResponse
newAcceptPortfolioShareResponse Int
pHttpStatus_ =
AcceptPortfolioShareResponse' :: Int -> AcceptPortfolioShareResponse
AcceptPortfolioShareResponse'
{ $sel:httpStatus:AcceptPortfolioShareResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
acceptPortfolioShareResponse_httpStatus :: Lens.Lens' AcceptPortfolioShareResponse Prelude.Int
acceptPortfolioShareResponse_httpStatus :: (Int -> f Int)
-> AcceptPortfolioShareResponse -> f AcceptPortfolioShareResponse
acceptPortfolioShareResponse_httpStatus = (AcceptPortfolioShareResponse -> Int)
-> (AcceptPortfolioShareResponse
-> Int -> AcceptPortfolioShareResponse)
-> Lens
AcceptPortfolioShareResponse AcceptPortfolioShareResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptPortfolioShareResponse' {Int
httpStatus :: Int
$sel:httpStatus:AcceptPortfolioShareResponse' :: AcceptPortfolioShareResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AcceptPortfolioShareResponse
s@AcceptPortfolioShareResponse' {} Int
a -> AcceptPortfolioShareResponse
s {$sel:httpStatus:AcceptPortfolioShareResponse' :: Int
httpStatus = Int
a} :: AcceptPortfolioShareResponse)
instance Prelude.NFData AcceptPortfolioShareResponse