{-# 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.SSM.GetConnectionStatus
(
GetConnectionStatus (..),
newGetConnectionStatus,
getConnectionStatus_target,
GetConnectionStatusResponse (..),
newGetConnectionStatusResponse,
getConnectionStatusResponse_status,
getConnectionStatusResponse_target,
getConnectionStatusResponse_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.SSM.Types
data GetConnectionStatus = GetConnectionStatus'
{
GetConnectionStatus -> Text
target :: Prelude.Text
}
deriving (GetConnectionStatus -> GetConnectionStatus -> Bool
(GetConnectionStatus -> GetConnectionStatus -> Bool)
-> (GetConnectionStatus -> GetConnectionStatus -> Bool)
-> Eq GetConnectionStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConnectionStatus -> GetConnectionStatus -> Bool
$c/= :: GetConnectionStatus -> GetConnectionStatus -> Bool
== :: GetConnectionStatus -> GetConnectionStatus -> Bool
$c== :: GetConnectionStatus -> GetConnectionStatus -> Bool
Prelude.Eq, ReadPrec [GetConnectionStatus]
ReadPrec GetConnectionStatus
Int -> ReadS GetConnectionStatus
ReadS [GetConnectionStatus]
(Int -> ReadS GetConnectionStatus)
-> ReadS [GetConnectionStatus]
-> ReadPrec GetConnectionStatus
-> ReadPrec [GetConnectionStatus]
-> Read GetConnectionStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConnectionStatus]
$creadListPrec :: ReadPrec [GetConnectionStatus]
readPrec :: ReadPrec GetConnectionStatus
$creadPrec :: ReadPrec GetConnectionStatus
readList :: ReadS [GetConnectionStatus]
$creadList :: ReadS [GetConnectionStatus]
readsPrec :: Int -> ReadS GetConnectionStatus
$creadsPrec :: Int -> ReadS GetConnectionStatus
Prelude.Read, Int -> GetConnectionStatus -> ShowS
[GetConnectionStatus] -> ShowS
GetConnectionStatus -> String
(Int -> GetConnectionStatus -> ShowS)
-> (GetConnectionStatus -> String)
-> ([GetConnectionStatus] -> ShowS)
-> Show GetConnectionStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConnectionStatus] -> ShowS
$cshowList :: [GetConnectionStatus] -> ShowS
show :: GetConnectionStatus -> String
$cshow :: GetConnectionStatus -> String
showsPrec :: Int -> GetConnectionStatus -> ShowS
$cshowsPrec :: Int -> GetConnectionStatus -> ShowS
Prelude.Show, (forall x. GetConnectionStatus -> Rep GetConnectionStatus x)
-> (forall x. Rep GetConnectionStatus x -> GetConnectionStatus)
-> Generic GetConnectionStatus
forall x. Rep GetConnectionStatus x -> GetConnectionStatus
forall x. GetConnectionStatus -> Rep GetConnectionStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetConnectionStatus x -> GetConnectionStatus
$cfrom :: forall x. GetConnectionStatus -> Rep GetConnectionStatus x
Prelude.Generic)
newGetConnectionStatus ::
Prelude.Text ->
GetConnectionStatus
newGetConnectionStatus :: Text -> GetConnectionStatus
newGetConnectionStatus Text
pTarget_ =
GetConnectionStatus' :: Text -> GetConnectionStatus
GetConnectionStatus' {$sel:target:GetConnectionStatus' :: Text
target = Text
pTarget_}
getConnectionStatus_target :: Lens.Lens' GetConnectionStatus Prelude.Text
getConnectionStatus_target :: (Text -> f Text) -> GetConnectionStatus -> f GetConnectionStatus
getConnectionStatus_target = (GetConnectionStatus -> Text)
-> (GetConnectionStatus -> Text -> GetConnectionStatus)
-> Lens GetConnectionStatus GetConnectionStatus Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConnectionStatus' {Text
target :: Text
$sel:target:GetConnectionStatus' :: GetConnectionStatus -> Text
target} -> Text
target) (\s :: GetConnectionStatus
s@GetConnectionStatus' {} Text
a -> GetConnectionStatus
s {$sel:target:GetConnectionStatus' :: Text
target = Text
a} :: GetConnectionStatus)
instance Core.AWSRequest GetConnectionStatus where
type
AWSResponse GetConnectionStatus =
GetConnectionStatusResponse
request :: GetConnectionStatus -> Request GetConnectionStatus
request = Service -> GetConnectionStatus -> Request GetConnectionStatus
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetConnectionStatus
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetConnectionStatus)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetConnectionStatus))
-> Logger
-> Service
-> Proxy GetConnectionStatus
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetConnectionStatus)))
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 ConnectionStatus
-> Maybe Text -> Int -> GetConnectionStatusResponse
GetConnectionStatusResponse'
(Maybe ConnectionStatus
-> Maybe Text -> Int -> GetConnectionStatusResponse)
-> Either String (Maybe ConnectionStatus)
-> Either String (Maybe Text -> Int -> GetConnectionStatusResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ConnectionStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Status")
Either String (Maybe Text -> Int -> GetConnectionStatusResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetConnectionStatusResponse)
forall (f :: * -> *) a b. Applicative f => 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
"Target")
Either String (Int -> GetConnectionStatusResponse)
-> Either String Int -> Either String GetConnectionStatusResponse
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 GetConnectionStatus
instance Prelude.NFData GetConnectionStatus
instance Core.ToHeaders GetConnectionStatus where
toHeaders :: GetConnectionStatus -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetConnectionStatus -> 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
"AmazonSSM.GetConnectionStatus" ::
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 GetConnectionStatus where
toJSON :: GetConnectionStatus -> Value
toJSON GetConnectionStatus' {Text
target :: Text
$sel:target:GetConnectionStatus' :: GetConnectionStatus -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Target" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
target)]
)
instance Core.ToPath GetConnectionStatus where
toPath :: GetConnectionStatus -> ByteString
toPath = ByteString -> GetConnectionStatus -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetConnectionStatus where
toQuery :: GetConnectionStatus -> QueryString
toQuery = QueryString -> GetConnectionStatus -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetConnectionStatusResponse = GetConnectionStatusResponse'
{
GetConnectionStatusResponse -> Maybe ConnectionStatus
status :: Prelude.Maybe ConnectionStatus,
GetConnectionStatusResponse -> Maybe Text
target :: Prelude.Maybe Prelude.Text,
GetConnectionStatusResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetConnectionStatusResponse -> GetConnectionStatusResponse -> Bool
(GetConnectionStatusResponse
-> GetConnectionStatusResponse -> Bool)
-> (GetConnectionStatusResponse
-> GetConnectionStatusResponse -> Bool)
-> Eq GetConnectionStatusResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConnectionStatusResponse -> GetConnectionStatusResponse -> Bool
$c/= :: GetConnectionStatusResponse -> GetConnectionStatusResponse -> Bool
== :: GetConnectionStatusResponse -> GetConnectionStatusResponse -> Bool
$c== :: GetConnectionStatusResponse -> GetConnectionStatusResponse -> Bool
Prelude.Eq, ReadPrec [GetConnectionStatusResponse]
ReadPrec GetConnectionStatusResponse
Int -> ReadS GetConnectionStatusResponse
ReadS [GetConnectionStatusResponse]
(Int -> ReadS GetConnectionStatusResponse)
-> ReadS [GetConnectionStatusResponse]
-> ReadPrec GetConnectionStatusResponse
-> ReadPrec [GetConnectionStatusResponse]
-> Read GetConnectionStatusResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConnectionStatusResponse]
$creadListPrec :: ReadPrec [GetConnectionStatusResponse]
readPrec :: ReadPrec GetConnectionStatusResponse
$creadPrec :: ReadPrec GetConnectionStatusResponse
readList :: ReadS [GetConnectionStatusResponse]
$creadList :: ReadS [GetConnectionStatusResponse]
readsPrec :: Int -> ReadS GetConnectionStatusResponse
$creadsPrec :: Int -> ReadS GetConnectionStatusResponse
Prelude.Read, Int -> GetConnectionStatusResponse -> ShowS
[GetConnectionStatusResponse] -> ShowS
GetConnectionStatusResponse -> String
(Int -> GetConnectionStatusResponse -> ShowS)
-> (GetConnectionStatusResponse -> String)
-> ([GetConnectionStatusResponse] -> ShowS)
-> Show GetConnectionStatusResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConnectionStatusResponse] -> ShowS
$cshowList :: [GetConnectionStatusResponse] -> ShowS
show :: GetConnectionStatusResponse -> String
$cshow :: GetConnectionStatusResponse -> String
showsPrec :: Int -> GetConnectionStatusResponse -> ShowS
$cshowsPrec :: Int -> GetConnectionStatusResponse -> ShowS
Prelude.Show, (forall x.
GetConnectionStatusResponse -> Rep GetConnectionStatusResponse x)
-> (forall x.
Rep GetConnectionStatusResponse x -> GetConnectionStatusResponse)
-> Generic GetConnectionStatusResponse
forall x.
Rep GetConnectionStatusResponse x -> GetConnectionStatusResponse
forall x.
GetConnectionStatusResponse -> Rep GetConnectionStatusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetConnectionStatusResponse x -> GetConnectionStatusResponse
$cfrom :: forall x.
GetConnectionStatusResponse -> Rep GetConnectionStatusResponse x
Prelude.Generic)
newGetConnectionStatusResponse ::
Prelude.Int ->
GetConnectionStatusResponse
newGetConnectionStatusResponse :: Int -> GetConnectionStatusResponse
newGetConnectionStatusResponse Int
pHttpStatus_ =
GetConnectionStatusResponse' :: Maybe ConnectionStatus
-> Maybe Text -> Int -> GetConnectionStatusResponse
GetConnectionStatusResponse'
{ $sel:status:GetConnectionStatusResponse' :: Maybe ConnectionStatus
status =
Maybe ConnectionStatus
forall a. Maybe a
Prelude.Nothing,
$sel:target:GetConnectionStatusResponse' :: Maybe Text
target = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetConnectionStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getConnectionStatusResponse_status :: Lens.Lens' GetConnectionStatusResponse (Prelude.Maybe ConnectionStatus)
getConnectionStatusResponse_status :: (Maybe ConnectionStatus -> f (Maybe ConnectionStatus))
-> GetConnectionStatusResponse -> f GetConnectionStatusResponse
getConnectionStatusResponse_status = (GetConnectionStatusResponse -> Maybe ConnectionStatus)
-> (GetConnectionStatusResponse
-> Maybe ConnectionStatus -> GetConnectionStatusResponse)
-> Lens
GetConnectionStatusResponse
GetConnectionStatusResponse
(Maybe ConnectionStatus)
(Maybe ConnectionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConnectionStatusResponse' {Maybe ConnectionStatus
status :: Maybe ConnectionStatus
$sel:status:GetConnectionStatusResponse' :: GetConnectionStatusResponse -> Maybe ConnectionStatus
status} -> Maybe ConnectionStatus
status) (\s :: GetConnectionStatusResponse
s@GetConnectionStatusResponse' {} Maybe ConnectionStatus
a -> GetConnectionStatusResponse
s {$sel:status:GetConnectionStatusResponse' :: Maybe ConnectionStatus
status = Maybe ConnectionStatus
a} :: GetConnectionStatusResponse)
getConnectionStatusResponse_target :: Lens.Lens' GetConnectionStatusResponse (Prelude.Maybe Prelude.Text)
getConnectionStatusResponse_target :: (Maybe Text -> f (Maybe Text))
-> GetConnectionStatusResponse -> f GetConnectionStatusResponse
getConnectionStatusResponse_target = (GetConnectionStatusResponse -> Maybe Text)
-> (GetConnectionStatusResponse
-> Maybe Text -> GetConnectionStatusResponse)
-> Lens
GetConnectionStatusResponse
GetConnectionStatusResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConnectionStatusResponse' {Maybe Text
target :: Maybe Text
$sel:target:GetConnectionStatusResponse' :: GetConnectionStatusResponse -> Maybe Text
target} -> Maybe Text
target) (\s :: GetConnectionStatusResponse
s@GetConnectionStatusResponse' {} Maybe Text
a -> GetConnectionStatusResponse
s {$sel:target:GetConnectionStatusResponse' :: Maybe Text
target = Maybe Text
a} :: GetConnectionStatusResponse)
getConnectionStatusResponse_httpStatus :: Lens.Lens' GetConnectionStatusResponse Prelude.Int
getConnectionStatusResponse_httpStatus :: (Int -> f Int)
-> GetConnectionStatusResponse -> f GetConnectionStatusResponse
getConnectionStatusResponse_httpStatus = (GetConnectionStatusResponse -> Int)
-> (GetConnectionStatusResponse
-> Int -> GetConnectionStatusResponse)
-> Lens
GetConnectionStatusResponse GetConnectionStatusResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConnectionStatusResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetConnectionStatusResponse' :: GetConnectionStatusResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetConnectionStatusResponse
s@GetConnectionStatusResponse' {} Int
a -> GetConnectionStatusResponse
s {$sel:httpStatus:GetConnectionStatusResponse' :: Int
httpStatus = Int
a} :: GetConnectionStatusResponse)
instance Prelude.NFData GetConnectionStatusResponse