{-# 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.OpenSearch.AcceptInboundConnection
(
AcceptInboundConnection (..),
newAcceptInboundConnection,
acceptInboundConnection_connectionId,
AcceptInboundConnectionResponse (..),
newAcceptInboundConnectionResponse,
acceptInboundConnectionResponse_connection,
acceptInboundConnectionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpenSearch.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AcceptInboundConnection = AcceptInboundConnection'
{
AcceptInboundConnection -> Text
connectionId :: Prelude.Text
}
deriving (AcceptInboundConnection -> AcceptInboundConnection -> Bool
(AcceptInboundConnection -> AcceptInboundConnection -> Bool)
-> (AcceptInboundConnection -> AcceptInboundConnection -> Bool)
-> Eq AcceptInboundConnection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptInboundConnection -> AcceptInboundConnection -> Bool
$c/= :: AcceptInboundConnection -> AcceptInboundConnection -> Bool
== :: AcceptInboundConnection -> AcceptInboundConnection -> Bool
$c== :: AcceptInboundConnection -> AcceptInboundConnection -> Bool
Prelude.Eq, ReadPrec [AcceptInboundConnection]
ReadPrec AcceptInboundConnection
Int -> ReadS AcceptInboundConnection
ReadS [AcceptInboundConnection]
(Int -> ReadS AcceptInboundConnection)
-> ReadS [AcceptInboundConnection]
-> ReadPrec AcceptInboundConnection
-> ReadPrec [AcceptInboundConnection]
-> Read AcceptInboundConnection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptInboundConnection]
$creadListPrec :: ReadPrec [AcceptInboundConnection]
readPrec :: ReadPrec AcceptInboundConnection
$creadPrec :: ReadPrec AcceptInboundConnection
readList :: ReadS [AcceptInboundConnection]
$creadList :: ReadS [AcceptInboundConnection]
readsPrec :: Int -> ReadS AcceptInboundConnection
$creadsPrec :: Int -> ReadS AcceptInboundConnection
Prelude.Read, Int -> AcceptInboundConnection -> ShowS
[AcceptInboundConnection] -> ShowS
AcceptInboundConnection -> String
(Int -> AcceptInboundConnection -> ShowS)
-> (AcceptInboundConnection -> String)
-> ([AcceptInboundConnection] -> ShowS)
-> Show AcceptInboundConnection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptInboundConnection] -> ShowS
$cshowList :: [AcceptInboundConnection] -> ShowS
show :: AcceptInboundConnection -> String
$cshow :: AcceptInboundConnection -> String
showsPrec :: Int -> AcceptInboundConnection -> ShowS
$cshowsPrec :: Int -> AcceptInboundConnection -> ShowS
Prelude.Show, (forall x.
AcceptInboundConnection -> Rep AcceptInboundConnection x)
-> (forall x.
Rep AcceptInboundConnection x -> AcceptInboundConnection)
-> Generic AcceptInboundConnection
forall x. Rep AcceptInboundConnection x -> AcceptInboundConnection
forall x. AcceptInboundConnection -> Rep AcceptInboundConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AcceptInboundConnection x -> AcceptInboundConnection
$cfrom :: forall x. AcceptInboundConnection -> Rep AcceptInboundConnection x
Prelude.Generic)
newAcceptInboundConnection ::
Prelude.Text ->
AcceptInboundConnection
newAcceptInboundConnection :: Text -> AcceptInboundConnection
newAcceptInboundConnection Text
pConnectionId_ =
AcceptInboundConnection' :: Text -> AcceptInboundConnection
AcceptInboundConnection'
{ $sel:connectionId:AcceptInboundConnection' :: Text
connectionId =
Text
pConnectionId_
}
acceptInboundConnection_connectionId :: Lens.Lens' AcceptInboundConnection Prelude.Text
acceptInboundConnection_connectionId :: (Text -> f Text)
-> AcceptInboundConnection -> f AcceptInboundConnection
acceptInboundConnection_connectionId = (AcceptInboundConnection -> Text)
-> (AcceptInboundConnection -> Text -> AcceptInboundConnection)
-> Lens AcceptInboundConnection AcceptInboundConnection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptInboundConnection' {Text
connectionId :: Text
$sel:connectionId:AcceptInboundConnection' :: AcceptInboundConnection -> Text
connectionId} -> Text
connectionId) (\s :: AcceptInboundConnection
s@AcceptInboundConnection' {} Text
a -> AcceptInboundConnection
s {$sel:connectionId:AcceptInboundConnection' :: Text
connectionId = Text
a} :: AcceptInboundConnection)
instance Core.AWSRequest AcceptInboundConnection where
type
AWSResponse AcceptInboundConnection =
AcceptInboundConnectionResponse
request :: AcceptInboundConnection -> Request AcceptInboundConnection
request = Service
-> AcceptInboundConnection -> Request AcceptInboundConnection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AcceptInboundConnection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AcceptInboundConnection)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AcceptInboundConnection))
-> Logger
-> Service
-> Proxy AcceptInboundConnection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AcceptInboundConnection)))
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 InboundConnection -> Int -> AcceptInboundConnectionResponse
AcceptInboundConnectionResponse'
(Maybe InboundConnection -> Int -> AcceptInboundConnectionResponse)
-> Either String (Maybe InboundConnection)
-> Either String (Int -> AcceptInboundConnectionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe InboundConnection)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Connection")
Either String (Int -> AcceptInboundConnectionResponse)
-> Either String Int
-> Either String AcceptInboundConnectionResponse
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 AcceptInboundConnection
instance Prelude.NFData AcceptInboundConnection
instance Core.ToHeaders AcceptInboundConnection where
toHeaders :: AcceptInboundConnection -> ResponseHeaders
toHeaders = ResponseHeaders -> AcceptInboundConnection -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON AcceptInboundConnection where
toJSON :: AcceptInboundConnection -> Value
toJSON = Value -> AcceptInboundConnection -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath AcceptInboundConnection where
toPath :: AcceptInboundConnection -> ByteString
toPath AcceptInboundConnection' {Text
connectionId :: Text
$sel:connectionId:AcceptInboundConnection' :: AcceptInboundConnection -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2021-01-01/opensearch/cc/inboundConnection/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
connectionId,
ByteString
"/accept"
]
instance Core.ToQuery AcceptInboundConnection where
toQuery :: AcceptInboundConnection -> QueryString
toQuery = QueryString -> AcceptInboundConnection -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AcceptInboundConnectionResponse = AcceptInboundConnectionResponse'
{
AcceptInboundConnectionResponse -> Maybe InboundConnection
connection :: Prelude.Maybe InboundConnection,
AcceptInboundConnectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AcceptInboundConnectionResponse
-> AcceptInboundConnectionResponse -> Bool
(AcceptInboundConnectionResponse
-> AcceptInboundConnectionResponse -> Bool)
-> (AcceptInboundConnectionResponse
-> AcceptInboundConnectionResponse -> Bool)
-> Eq AcceptInboundConnectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptInboundConnectionResponse
-> AcceptInboundConnectionResponse -> Bool
$c/= :: AcceptInboundConnectionResponse
-> AcceptInboundConnectionResponse -> Bool
== :: AcceptInboundConnectionResponse
-> AcceptInboundConnectionResponse -> Bool
$c== :: AcceptInboundConnectionResponse
-> AcceptInboundConnectionResponse -> Bool
Prelude.Eq, ReadPrec [AcceptInboundConnectionResponse]
ReadPrec AcceptInboundConnectionResponse
Int -> ReadS AcceptInboundConnectionResponse
ReadS [AcceptInboundConnectionResponse]
(Int -> ReadS AcceptInboundConnectionResponse)
-> ReadS [AcceptInboundConnectionResponse]
-> ReadPrec AcceptInboundConnectionResponse
-> ReadPrec [AcceptInboundConnectionResponse]
-> Read AcceptInboundConnectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptInboundConnectionResponse]
$creadListPrec :: ReadPrec [AcceptInboundConnectionResponse]
readPrec :: ReadPrec AcceptInboundConnectionResponse
$creadPrec :: ReadPrec AcceptInboundConnectionResponse
readList :: ReadS [AcceptInboundConnectionResponse]
$creadList :: ReadS [AcceptInboundConnectionResponse]
readsPrec :: Int -> ReadS AcceptInboundConnectionResponse
$creadsPrec :: Int -> ReadS AcceptInboundConnectionResponse
Prelude.Read, Int -> AcceptInboundConnectionResponse -> ShowS
[AcceptInboundConnectionResponse] -> ShowS
AcceptInboundConnectionResponse -> String
(Int -> AcceptInboundConnectionResponse -> ShowS)
-> (AcceptInboundConnectionResponse -> String)
-> ([AcceptInboundConnectionResponse] -> ShowS)
-> Show AcceptInboundConnectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptInboundConnectionResponse] -> ShowS
$cshowList :: [AcceptInboundConnectionResponse] -> ShowS
show :: AcceptInboundConnectionResponse -> String
$cshow :: AcceptInboundConnectionResponse -> String
showsPrec :: Int -> AcceptInboundConnectionResponse -> ShowS
$cshowsPrec :: Int -> AcceptInboundConnectionResponse -> ShowS
Prelude.Show, (forall x.
AcceptInboundConnectionResponse
-> Rep AcceptInboundConnectionResponse x)
-> (forall x.
Rep AcceptInboundConnectionResponse x
-> AcceptInboundConnectionResponse)
-> Generic AcceptInboundConnectionResponse
forall x.
Rep AcceptInboundConnectionResponse x
-> AcceptInboundConnectionResponse
forall x.
AcceptInboundConnectionResponse
-> Rep AcceptInboundConnectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AcceptInboundConnectionResponse x
-> AcceptInboundConnectionResponse
$cfrom :: forall x.
AcceptInboundConnectionResponse
-> Rep AcceptInboundConnectionResponse x
Prelude.Generic)
newAcceptInboundConnectionResponse ::
Prelude.Int ->
AcceptInboundConnectionResponse
newAcceptInboundConnectionResponse :: Int -> AcceptInboundConnectionResponse
newAcceptInboundConnectionResponse Int
pHttpStatus_ =
AcceptInboundConnectionResponse' :: Maybe InboundConnection -> Int -> AcceptInboundConnectionResponse
AcceptInboundConnectionResponse'
{ $sel:connection:AcceptInboundConnectionResponse' :: Maybe InboundConnection
connection =
Maybe InboundConnection
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AcceptInboundConnectionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
acceptInboundConnectionResponse_connection :: Lens.Lens' AcceptInboundConnectionResponse (Prelude.Maybe InboundConnection)
acceptInboundConnectionResponse_connection :: (Maybe InboundConnection -> f (Maybe InboundConnection))
-> AcceptInboundConnectionResponse
-> f AcceptInboundConnectionResponse
acceptInboundConnectionResponse_connection = (AcceptInboundConnectionResponse -> Maybe InboundConnection)
-> (AcceptInboundConnectionResponse
-> Maybe InboundConnection -> AcceptInboundConnectionResponse)
-> Lens
AcceptInboundConnectionResponse
AcceptInboundConnectionResponse
(Maybe InboundConnection)
(Maybe InboundConnection)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptInboundConnectionResponse' {Maybe InboundConnection
connection :: Maybe InboundConnection
$sel:connection:AcceptInboundConnectionResponse' :: AcceptInboundConnectionResponse -> Maybe InboundConnection
connection} -> Maybe InboundConnection
connection) (\s :: AcceptInboundConnectionResponse
s@AcceptInboundConnectionResponse' {} Maybe InboundConnection
a -> AcceptInboundConnectionResponse
s {$sel:connection:AcceptInboundConnectionResponse' :: Maybe InboundConnection
connection = Maybe InboundConnection
a} :: AcceptInboundConnectionResponse)
acceptInboundConnectionResponse_httpStatus :: Lens.Lens' AcceptInboundConnectionResponse Prelude.Int
acceptInboundConnectionResponse_httpStatus :: (Int -> f Int)
-> AcceptInboundConnectionResponse
-> f AcceptInboundConnectionResponse
acceptInboundConnectionResponse_httpStatus = (AcceptInboundConnectionResponse -> Int)
-> (AcceptInboundConnectionResponse
-> Int -> AcceptInboundConnectionResponse)
-> Lens
AcceptInboundConnectionResponse
AcceptInboundConnectionResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptInboundConnectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:AcceptInboundConnectionResponse' :: AcceptInboundConnectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AcceptInboundConnectionResponse
s@AcceptInboundConnectionResponse' {} Int
a -> AcceptInboundConnectionResponse
s {$sel:httpStatus:AcceptInboundConnectionResponse' :: Int
httpStatus = Int
a} :: AcceptInboundConnectionResponse)
instance
Prelude.NFData
AcceptInboundConnectionResponse