{-# 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.RAM.AcceptResourceShareInvitation
(
AcceptResourceShareInvitation (..),
newAcceptResourceShareInvitation,
acceptResourceShareInvitation_clientToken,
acceptResourceShareInvitation_resourceShareInvitationArn,
AcceptResourceShareInvitationResponse (..),
newAcceptResourceShareInvitationResponse,
acceptResourceShareInvitationResponse_clientToken,
acceptResourceShareInvitationResponse_resourceShareInvitation,
acceptResourceShareInvitationResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RAM.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AcceptResourceShareInvitation = AcceptResourceShareInvitation'
{
AcceptResourceShareInvitation -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
AcceptResourceShareInvitation -> Text
resourceShareInvitationArn :: Prelude.Text
}
deriving (AcceptResourceShareInvitation
-> AcceptResourceShareInvitation -> Bool
(AcceptResourceShareInvitation
-> AcceptResourceShareInvitation -> Bool)
-> (AcceptResourceShareInvitation
-> AcceptResourceShareInvitation -> Bool)
-> Eq AcceptResourceShareInvitation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptResourceShareInvitation
-> AcceptResourceShareInvitation -> Bool
$c/= :: AcceptResourceShareInvitation
-> AcceptResourceShareInvitation -> Bool
== :: AcceptResourceShareInvitation
-> AcceptResourceShareInvitation -> Bool
$c== :: AcceptResourceShareInvitation
-> AcceptResourceShareInvitation -> Bool
Prelude.Eq, ReadPrec [AcceptResourceShareInvitation]
ReadPrec AcceptResourceShareInvitation
Int -> ReadS AcceptResourceShareInvitation
ReadS [AcceptResourceShareInvitation]
(Int -> ReadS AcceptResourceShareInvitation)
-> ReadS [AcceptResourceShareInvitation]
-> ReadPrec AcceptResourceShareInvitation
-> ReadPrec [AcceptResourceShareInvitation]
-> Read AcceptResourceShareInvitation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptResourceShareInvitation]
$creadListPrec :: ReadPrec [AcceptResourceShareInvitation]
readPrec :: ReadPrec AcceptResourceShareInvitation
$creadPrec :: ReadPrec AcceptResourceShareInvitation
readList :: ReadS [AcceptResourceShareInvitation]
$creadList :: ReadS [AcceptResourceShareInvitation]
readsPrec :: Int -> ReadS AcceptResourceShareInvitation
$creadsPrec :: Int -> ReadS AcceptResourceShareInvitation
Prelude.Read, Int -> AcceptResourceShareInvitation -> ShowS
[AcceptResourceShareInvitation] -> ShowS
AcceptResourceShareInvitation -> String
(Int -> AcceptResourceShareInvitation -> ShowS)
-> (AcceptResourceShareInvitation -> String)
-> ([AcceptResourceShareInvitation] -> ShowS)
-> Show AcceptResourceShareInvitation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptResourceShareInvitation] -> ShowS
$cshowList :: [AcceptResourceShareInvitation] -> ShowS
show :: AcceptResourceShareInvitation -> String
$cshow :: AcceptResourceShareInvitation -> String
showsPrec :: Int -> AcceptResourceShareInvitation -> ShowS
$cshowsPrec :: Int -> AcceptResourceShareInvitation -> ShowS
Prelude.Show, (forall x.
AcceptResourceShareInvitation
-> Rep AcceptResourceShareInvitation x)
-> (forall x.
Rep AcceptResourceShareInvitation x
-> AcceptResourceShareInvitation)
-> Generic AcceptResourceShareInvitation
forall x.
Rep AcceptResourceShareInvitation x
-> AcceptResourceShareInvitation
forall x.
AcceptResourceShareInvitation
-> Rep AcceptResourceShareInvitation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AcceptResourceShareInvitation x
-> AcceptResourceShareInvitation
$cfrom :: forall x.
AcceptResourceShareInvitation
-> Rep AcceptResourceShareInvitation x
Prelude.Generic)
newAcceptResourceShareInvitation ::
Prelude.Text ->
AcceptResourceShareInvitation
newAcceptResourceShareInvitation :: Text -> AcceptResourceShareInvitation
newAcceptResourceShareInvitation
Text
pResourceShareInvitationArn_ =
AcceptResourceShareInvitation' :: Maybe Text -> Text -> AcceptResourceShareInvitation
AcceptResourceShareInvitation'
{ $sel:clientToken:AcceptResourceShareInvitation' :: Maybe Text
clientToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:resourceShareInvitationArn:AcceptResourceShareInvitation' :: Text
resourceShareInvitationArn =
Text
pResourceShareInvitationArn_
}
acceptResourceShareInvitation_clientToken :: Lens.Lens' AcceptResourceShareInvitation (Prelude.Maybe Prelude.Text)
acceptResourceShareInvitation_clientToken :: (Maybe Text -> f (Maybe Text))
-> AcceptResourceShareInvitation -> f AcceptResourceShareInvitation
acceptResourceShareInvitation_clientToken = (AcceptResourceShareInvitation -> Maybe Text)
-> (AcceptResourceShareInvitation
-> Maybe Text -> AcceptResourceShareInvitation)
-> Lens
AcceptResourceShareInvitation
AcceptResourceShareInvitation
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptResourceShareInvitation' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:AcceptResourceShareInvitation' :: AcceptResourceShareInvitation -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: AcceptResourceShareInvitation
s@AcceptResourceShareInvitation' {} Maybe Text
a -> AcceptResourceShareInvitation
s {$sel:clientToken:AcceptResourceShareInvitation' :: Maybe Text
clientToken = Maybe Text
a} :: AcceptResourceShareInvitation)
acceptResourceShareInvitation_resourceShareInvitationArn :: Lens.Lens' AcceptResourceShareInvitation Prelude.Text
acceptResourceShareInvitation_resourceShareInvitationArn :: (Text -> f Text)
-> AcceptResourceShareInvitation -> f AcceptResourceShareInvitation
acceptResourceShareInvitation_resourceShareInvitationArn = (AcceptResourceShareInvitation -> Text)
-> (AcceptResourceShareInvitation
-> Text -> AcceptResourceShareInvitation)
-> Lens
AcceptResourceShareInvitation
AcceptResourceShareInvitation
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptResourceShareInvitation' {Text
resourceShareInvitationArn :: Text
$sel:resourceShareInvitationArn:AcceptResourceShareInvitation' :: AcceptResourceShareInvitation -> Text
resourceShareInvitationArn} -> Text
resourceShareInvitationArn) (\s :: AcceptResourceShareInvitation
s@AcceptResourceShareInvitation' {} Text
a -> AcceptResourceShareInvitation
s {$sel:resourceShareInvitationArn:AcceptResourceShareInvitation' :: Text
resourceShareInvitationArn = Text
a} :: AcceptResourceShareInvitation)
instance
Core.AWSRequest
AcceptResourceShareInvitation
where
type
AWSResponse AcceptResourceShareInvitation =
AcceptResourceShareInvitationResponse
request :: AcceptResourceShareInvitation
-> Request AcceptResourceShareInvitation
request = Service
-> AcceptResourceShareInvitation
-> Request AcceptResourceShareInvitation
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AcceptResourceShareInvitation
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AcceptResourceShareInvitation)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AcceptResourceShareInvitation))
-> Logger
-> Service
-> Proxy AcceptResourceShareInvitation
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AcceptResourceShareInvitation)))
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
-> Maybe ResourceShareInvitation
-> Int
-> AcceptResourceShareInvitationResponse
AcceptResourceShareInvitationResponse'
(Maybe Text
-> Maybe ResourceShareInvitation
-> Int
-> AcceptResourceShareInvitationResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe ResourceShareInvitation
-> Int -> AcceptResourceShareInvitationResponse)
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
"clientToken")
Either
String
(Maybe ResourceShareInvitation
-> Int -> AcceptResourceShareInvitationResponse)
-> Either String (Maybe ResourceShareInvitation)
-> Either String (Int -> AcceptResourceShareInvitationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ResourceShareInvitation)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"resourceShareInvitation")
Either String (Int -> AcceptResourceShareInvitationResponse)
-> Either String Int
-> Either String AcceptResourceShareInvitationResponse
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
AcceptResourceShareInvitation
instance Prelude.NFData AcceptResourceShareInvitation
instance Core.ToHeaders AcceptResourceShareInvitation where
toHeaders :: AcceptResourceShareInvitation -> ResponseHeaders
toHeaders =
ResponseHeaders -> AcceptResourceShareInvitation -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 AcceptResourceShareInvitation where
toJSON :: AcceptResourceShareInvitation -> Value
toJSON AcceptResourceShareInvitation' {Maybe Text
Text
resourceShareInvitationArn :: Text
clientToken :: Maybe Text
$sel:resourceShareInvitationArn:AcceptResourceShareInvitation' :: AcceptResourceShareInvitation -> Text
$sel:clientToken:AcceptResourceShareInvitation' :: AcceptResourceShareInvitation -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"clientToken" 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
clientToken,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"resourceShareInvitationArn"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceShareInvitationArn
)
]
)
instance Core.ToPath AcceptResourceShareInvitation where
toPath :: AcceptResourceShareInvitation -> ByteString
toPath =
ByteString -> AcceptResourceShareInvitation -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/acceptresourceshareinvitation"
instance Core.ToQuery AcceptResourceShareInvitation where
toQuery :: AcceptResourceShareInvitation -> QueryString
toQuery = QueryString -> AcceptResourceShareInvitation -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AcceptResourceShareInvitationResponse = AcceptResourceShareInvitationResponse'
{
AcceptResourceShareInvitationResponse -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
AcceptResourceShareInvitationResponse
-> Maybe ResourceShareInvitation
resourceShareInvitation :: Prelude.Maybe ResourceShareInvitation,
AcceptResourceShareInvitationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AcceptResourceShareInvitationResponse
-> AcceptResourceShareInvitationResponse -> Bool
(AcceptResourceShareInvitationResponse
-> AcceptResourceShareInvitationResponse -> Bool)
-> (AcceptResourceShareInvitationResponse
-> AcceptResourceShareInvitationResponse -> Bool)
-> Eq AcceptResourceShareInvitationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptResourceShareInvitationResponse
-> AcceptResourceShareInvitationResponse -> Bool
$c/= :: AcceptResourceShareInvitationResponse
-> AcceptResourceShareInvitationResponse -> Bool
== :: AcceptResourceShareInvitationResponse
-> AcceptResourceShareInvitationResponse -> Bool
$c== :: AcceptResourceShareInvitationResponse
-> AcceptResourceShareInvitationResponse -> Bool
Prelude.Eq, ReadPrec [AcceptResourceShareInvitationResponse]
ReadPrec AcceptResourceShareInvitationResponse
Int -> ReadS AcceptResourceShareInvitationResponse
ReadS [AcceptResourceShareInvitationResponse]
(Int -> ReadS AcceptResourceShareInvitationResponse)
-> ReadS [AcceptResourceShareInvitationResponse]
-> ReadPrec AcceptResourceShareInvitationResponse
-> ReadPrec [AcceptResourceShareInvitationResponse]
-> Read AcceptResourceShareInvitationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptResourceShareInvitationResponse]
$creadListPrec :: ReadPrec [AcceptResourceShareInvitationResponse]
readPrec :: ReadPrec AcceptResourceShareInvitationResponse
$creadPrec :: ReadPrec AcceptResourceShareInvitationResponse
readList :: ReadS [AcceptResourceShareInvitationResponse]
$creadList :: ReadS [AcceptResourceShareInvitationResponse]
readsPrec :: Int -> ReadS AcceptResourceShareInvitationResponse
$creadsPrec :: Int -> ReadS AcceptResourceShareInvitationResponse
Prelude.Read, Int -> AcceptResourceShareInvitationResponse -> ShowS
[AcceptResourceShareInvitationResponse] -> ShowS
AcceptResourceShareInvitationResponse -> String
(Int -> AcceptResourceShareInvitationResponse -> ShowS)
-> (AcceptResourceShareInvitationResponse -> String)
-> ([AcceptResourceShareInvitationResponse] -> ShowS)
-> Show AcceptResourceShareInvitationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptResourceShareInvitationResponse] -> ShowS
$cshowList :: [AcceptResourceShareInvitationResponse] -> ShowS
show :: AcceptResourceShareInvitationResponse -> String
$cshow :: AcceptResourceShareInvitationResponse -> String
showsPrec :: Int -> AcceptResourceShareInvitationResponse -> ShowS
$cshowsPrec :: Int -> AcceptResourceShareInvitationResponse -> ShowS
Prelude.Show, (forall x.
AcceptResourceShareInvitationResponse
-> Rep AcceptResourceShareInvitationResponse x)
-> (forall x.
Rep AcceptResourceShareInvitationResponse x
-> AcceptResourceShareInvitationResponse)
-> Generic AcceptResourceShareInvitationResponse
forall x.
Rep AcceptResourceShareInvitationResponse x
-> AcceptResourceShareInvitationResponse
forall x.
AcceptResourceShareInvitationResponse
-> Rep AcceptResourceShareInvitationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AcceptResourceShareInvitationResponse x
-> AcceptResourceShareInvitationResponse
$cfrom :: forall x.
AcceptResourceShareInvitationResponse
-> Rep AcceptResourceShareInvitationResponse x
Prelude.Generic)
newAcceptResourceShareInvitationResponse ::
Prelude.Int ->
AcceptResourceShareInvitationResponse
newAcceptResourceShareInvitationResponse :: Int -> AcceptResourceShareInvitationResponse
newAcceptResourceShareInvitationResponse Int
pHttpStatus_ =
AcceptResourceShareInvitationResponse' :: Maybe Text
-> Maybe ResourceShareInvitation
-> Int
-> AcceptResourceShareInvitationResponse
AcceptResourceShareInvitationResponse'
{ $sel:clientToken:AcceptResourceShareInvitationResponse' :: Maybe Text
clientToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:resourceShareInvitation:AcceptResourceShareInvitationResponse' :: Maybe ResourceShareInvitation
resourceShareInvitation =
Maybe ResourceShareInvitation
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AcceptResourceShareInvitationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
acceptResourceShareInvitationResponse_clientToken :: Lens.Lens' AcceptResourceShareInvitationResponse (Prelude.Maybe Prelude.Text)
acceptResourceShareInvitationResponse_clientToken :: (Maybe Text -> f (Maybe Text))
-> AcceptResourceShareInvitationResponse
-> f AcceptResourceShareInvitationResponse
acceptResourceShareInvitationResponse_clientToken = (AcceptResourceShareInvitationResponse -> Maybe Text)
-> (AcceptResourceShareInvitationResponse
-> Maybe Text -> AcceptResourceShareInvitationResponse)
-> Lens
AcceptResourceShareInvitationResponse
AcceptResourceShareInvitationResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptResourceShareInvitationResponse' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:AcceptResourceShareInvitationResponse' :: AcceptResourceShareInvitationResponse -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: AcceptResourceShareInvitationResponse
s@AcceptResourceShareInvitationResponse' {} Maybe Text
a -> AcceptResourceShareInvitationResponse
s {$sel:clientToken:AcceptResourceShareInvitationResponse' :: Maybe Text
clientToken = Maybe Text
a} :: AcceptResourceShareInvitationResponse)
acceptResourceShareInvitationResponse_resourceShareInvitation :: Lens.Lens' AcceptResourceShareInvitationResponse (Prelude.Maybe ResourceShareInvitation)
acceptResourceShareInvitationResponse_resourceShareInvitation :: (Maybe ResourceShareInvitation
-> f (Maybe ResourceShareInvitation))
-> AcceptResourceShareInvitationResponse
-> f AcceptResourceShareInvitationResponse
acceptResourceShareInvitationResponse_resourceShareInvitation = (AcceptResourceShareInvitationResponse
-> Maybe ResourceShareInvitation)
-> (AcceptResourceShareInvitationResponse
-> Maybe ResourceShareInvitation
-> AcceptResourceShareInvitationResponse)
-> Lens
AcceptResourceShareInvitationResponse
AcceptResourceShareInvitationResponse
(Maybe ResourceShareInvitation)
(Maybe ResourceShareInvitation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptResourceShareInvitationResponse' {Maybe ResourceShareInvitation
resourceShareInvitation :: Maybe ResourceShareInvitation
$sel:resourceShareInvitation:AcceptResourceShareInvitationResponse' :: AcceptResourceShareInvitationResponse
-> Maybe ResourceShareInvitation
resourceShareInvitation} -> Maybe ResourceShareInvitation
resourceShareInvitation) (\s :: AcceptResourceShareInvitationResponse
s@AcceptResourceShareInvitationResponse' {} Maybe ResourceShareInvitation
a -> AcceptResourceShareInvitationResponse
s {$sel:resourceShareInvitation:AcceptResourceShareInvitationResponse' :: Maybe ResourceShareInvitation
resourceShareInvitation = Maybe ResourceShareInvitation
a} :: AcceptResourceShareInvitationResponse)
acceptResourceShareInvitationResponse_httpStatus :: Lens.Lens' AcceptResourceShareInvitationResponse Prelude.Int
acceptResourceShareInvitationResponse_httpStatus :: (Int -> f Int)
-> AcceptResourceShareInvitationResponse
-> f AcceptResourceShareInvitationResponse
acceptResourceShareInvitationResponse_httpStatus = (AcceptResourceShareInvitationResponse -> Int)
-> (AcceptResourceShareInvitationResponse
-> Int -> AcceptResourceShareInvitationResponse)
-> Lens
AcceptResourceShareInvitationResponse
AcceptResourceShareInvitationResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptResourceShareInvitationResponse' {Int
httpStatus :: Int
$sel:httpStatus:AcceptResourceShareInvitationResponse' :: AcceptResourceShareInvitationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AcceptResourceShareInvitationResponse
s@AcceptResourceShareInvitationResponse' {} Int
a -> AcceptResourceShareInvitationResponse
s {$sel:httpStatus:AcceptResourceShareInvitationResponse' :: Int
httpStatus = Int
a} :: AcceptResourceShareInvitationResponse)
instance
Prelude.NFData
AcceptResourceShareInvitationResponse