{-# 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.Lightsail.GetInstanceAccessDetails
(
GetInstanceAccessDetails (..),
newGetInstanceAccessDetails,
getInstanceAccessDetails_protocol,
getInstanceAccessDetails_instanceName,
GetInstanceAccessDetailsResponse (..),
newGetInstanceAccessDetailsResponse,
getInstanceAccessDetailsResponse_accessDetails,
getInstanceAccessDetailsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetInstanceAccessDetails = GetInstanceAccessDetails'
{
GetInstanceAccessDetails -> Maybe InstanceAccessProtocol
protocol :: Prelude.Maybe InstanceAccessProtocol,
GetInstanceAccessDetails -> Text
instanceName :: Prelude.Text
}
deriving (GetInstanceAccessDetails -> GetInstanceAccessDetails -> Bool
(GetInstanceAccessDetails -> GetInstanceAccessDetails -> Bool)
-> (GetInstanceAccessDetails -> GetInstanceAccessDetails -> Bool)
-> Eq GetInstanceAccessDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInstanceAccessDetails -> GetInstanceAccessDetails -> Bool
$c/= :: GetInstanceAccessDetails -> GetInstanceAccessDetails -> Bool
== :: GetInstanceAccessDetails -> GetInstanceAccessDetails -> Bool
$c== :: GetInstanceAccessDetails -> GetInstanceAccessDetails -> Bool
Prelude.Eq, ReadPrec [GetInstanceAccessDetails]
ReadPrec GetInstanceAccessDetails
Int -> ReadS GetInstanceAccessDetails
ReadS [GetInstanceAccessDetails]
(Int -> ReadS GetInstanceAccessDetails)
-> ReadS [GetInstanceAccessDetails]
-> ReadPrec GetInstanceAccessDetails
-> ReadPrec [GetInstanceAccessDetails]
-> Read GetInstanceAccessDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInstanceAccessDetails]
$creadListPrec :: ReadPrec [GetInstanceAccessDetails]
readPrec :: ReadPrec GetInstanceAccessDetails
$creadPrec :: ReadPrec GetInstanceAccessDetails
readList :: ReadS [GetInstanceAccessDetails]
$creadList :: ReadS [GetInstanceAccessDetails]
readsPrec :: Int -> ReadS GetInstanceAccessDetails
$creadsPrec :: Int -> ReadS GetInstanceAccessDetails
Prelude.Read, Int -> GetInstanceAccessDetails -> ShowS
[GetInstanceAccessDetails] -> ShowS
GetInstanceAccessDetails -> String
(Int -> GetInstanceAccessDetails -> ShowS)
-> (GetInstanceAccessDetails -> String)
-> ([GetInstanceAccessDetails] -> ShowS)
-> Show GetInstanceAccessDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInstanceAccessDetails] -> ShowS
$cshowList :: [GetInstanceAccessDetails] -> ShowS
show :: GetInstanceAccessDetails -> String
$cshow :: GetInstanceAccessDetails -> String
showsPrec :: Int -> GetInstanceAccessDetails -> ShowS
$cshowsPrec :: Int -> GetInstanceAccessDetails -> ShowS
Prelude.Show, (forall x.
GetInstanceAccessDetails -> Rep GetInstanceAccessDetails x)
-> (forall x.
Rep GetInstanceAccessDetails x -> GetInstanceAccessDetails)
-> Generic GetInstanceAccessDetails
forall x.
Rep GetInstanceAccessDetails x -> GetInstanceAccessDetails
forall x.
GetInstanceAccessDetails -> Rep GetInstanceAccessDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetInstanceAccessDetails x -> GetInstanceAccessDetails
$cfrom :: forall x.
GetInstanceAccessDetails -> Rep GetInstanceAccessDetails x
Prelude.Generic)
newGetInstanceAccessDetails ::
Prelude.Text ->
GetInstanceAccessDetails
newGetInstanceAccessDetails :: Text -> GetInstanceAccessDetails
newGetInstanceAccessDetails Text
pInstanceName_ =
GetInstanceAccessDetails' :: Maybe InstanceAccessProtocol -> Text -> GetInstanceAccessDetails
GetInstanceAccessDetails'
{ $sel:protocol:GetInstanceAccessDetails' :: Maybe InstanceAccessProtocol
protocol =
Maybe InstanceAccessProtocol
forall a. Maybe a
Prelude.Nothing,
$sel:instanceName:GetInstanceAccessDetails' :: Text
instanceName = Text
pInstanceName_
}
getInstanceAccessDetails_protocol :: Lens.Lens' GetInstanceAccessDetails (Prelude.Maybe InstanceAccessProtocol)
getInstanceAccessDetails_protocol :: (Maybe InstanceAccessProtocol -> f (Maybe InstanceAccessProtocol))
-> GetInstanceAccessDetails -> f GetInstanceAccessDetails
getInstanceAccessDetails_protocol = (GetInstanceAccessDetails -> Maybe InstanceAccessProtocol)
-> (GetInstanceAccessDetails
-> Maybe InstanceAccessProtocol -> GetInstanceAccessDetails)
-> Lens
GetInstanceAccessDetails
GetInstanceAccessDetails
(Maybe InstanceAccessProtocol)
(Maybe InstanceAccessProtocol)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceAccessDetails' {Maybe InstanceAccessProtocol
protocol :: Maybe InstanceAccessProtocol
$sel:protocol:GetInstanceAccessDetails' :: GetInstanceAccessDetails -> Maybe InstanceAccessProtocol
protocol} -> Maybe InstanceAccessProtocol
protocol) (\s :: GetInstanceAccessDetails
s@GetInstanceAccessDetails' {} Maybe InstanceAccessProtocol
a -> GetInstanceAccessDetails
s {$sel:protocol:GetInstanceAccessDetails' :: Maybe InstanceAccessProtocol
protocol = Maybe InstanceAccessProtocol
a} :: GetInstanceAccessDetails)
getInstanceAccessDetails_instanceName :: Lens.Lens' GetInstanceAccessDetails Prelude.Text
getInstanceAccessDetails_instanceName :: (Text -> f Text)
-> GetInstanceAccessDetails -> f GetInstanceAccessDetails
getInstanceAccessDetails_instanceName = (GetInstanceAccessDetails -> Text)
-> (GetInstanceAccessDetails -> Text -> GetInstanceAccessDetails)
-> Lens GetInstanceAccessDetails GetInstanceAccessDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceAccessDetails' {Text
instanceName :: Text
$sel:instanceName:GetInstanceAccessDetails' :: GetInstanceAccessDetails -> Text
instanceName} -> Text
instanceName) (\s :: GetInstanceAccessDetails
s@GetInstanceAccessDetails' {} Text
a -> GetInstanceAccessDetails
s {$sel:instanceName:GetInstanceAccessDetails' :: Text
instanceName = Text
a} :: GetInstanceAccessDetails)
instance Core.AWSRequest GetInstanceAccessDetails where
type
AWSResponse GetInstanceAccessDetails =
GetInstanceAccessDetailsResponse
request :: GetInstanceAccessDetails -> Request GetInstanceAccessDetails
request = Service
-> GetInstanceAccessDetails -> Request GetInstanceAccessDetails
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetInstanceAccessDetails
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetInstanceAccessDetails)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetInstanceAccessDetails))
-> Logger
-> Service
-> Proxy GetInstanceAccessDetails
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetInstanceAccessDetails)))
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 InstanceAccessDetails
-> Int -> GetInstanceAccessDetailsResponse
GetInstanceAccessDetailsResponse'
(Maybe InstanceAccessDetails
-> Int -> GetInstanceAccessDetailsResponse)
-> Either String (Maybe InstanceAccessDetails)
-> Either String (Int -> GetInstanceAccessDetailsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe InstanceAccessDetails)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"accessDetails")
Either String (Int -> GetInstanceAccessDetailsResponse)
-> Either String Int
-> Either String GetInstanceAccessDetailsResponse
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 GetInstanceAccessDetails
instance Prelude.NFData GetInstanceAccessDetails
instance Core.ToHeaders GetInstanceAccessDetails where
toHeaders :: GetInstanceAccessDetails -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetInstanceAccessDetails -> 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
"Lightsail_20161128.GetInstanceAccessDetails" ::
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 GetInstanceAccessDetails where
toJSON :: GetInstanceAccessDetails -> Value
toJSON GetInstanceAccessDetails' {Maybe InstanceAccessProtocol
Text
instanceName :: Text
protocol :: Maybe InstanceAccessProtocol
$sel:instanceName:GetInstanceAccessDetails' :: GetInstanceAccessDetails -> Text
$sel:protocol:GetInstanceAccessDetails' :: GetInstanceAccessDetails -> Maybe InstanceAccessProtocol
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"protocol" Text -> InstanceAccessProtocol -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (InstanceAccessProtocol -> Pair)
-> Maybe InstanceAccessProtocol -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InstanceAccessProtocol
protocol,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"instanceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceName)
]
)
instance Core.ToPath GetInstanceAccessDetails where
toPath :: GetInstanceAccessDetails -> ByteString
toPath = ByteString -> GetInstanceAccessDetails -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetInstanceAccessDetails where
toQuery :: GetInstanceAccessDetails -> QueryString
toQuery = QueryString -> GetInstanceAccessDetails -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetInstanceAccessDetailsResponse = GetInstanceAccessDetailsResponse'
{
GetInstanceAccessDetailsResponse -> Maybe InstanceAccessDetails
accessDetails :: Prelude.Maybe InstanceAccessDetails,
GetInstanceAccessDetailsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetInstanceAccessDetailsResponse
-> GetInstanceAccessDetailsResponse -> Bool
(GetInstanceAccessDetailsResponse
-> GetInstanceAccessDetailsResponse -> Bool)
-> (GetInstanceAccessDetailsResponse
-> GetInstanceAccessDetailsResponse -> Bool)
-> Eq GetInstanceAccessDetailsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInstanceAccessDetailsResponse
-> GetInstanceAccessDetailsResponse -> Bool
$c/= :: GetInstanceAccessDetailsResponse
-> GetInstanceAccessDetailsResponse -> Bool
== :: GetInstanceAccessDetailsResponse
-> GetInstanceAccessDetailsResponse -> Bool
$c== :: GetInstanceAccessDetailsResponse
-> GetInstanceAccessDetailsResponse -> Bool
Prelude.Eq, ReadPrec [GetInstanceAccessDetailsResponse]
ReadPrec GetInstanceAccessDetailsResponse
Int -> ReadS GetInstanceAccessDetailsResponse
ReadS [GetInstanceAccessDetailsResponse]
(Int -> ReadS GetInstanceAccessDetailsResponse)
-> ReadS [GetInstanceAccessDetailsResponse]
-> ReadPrec GetInstanceAccessDetailsResponse
-> ReadPrec [GetInstanceAccessDetailsResponse]
-> Read GetInstanceAccessDetailsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInstanceAccessDetailsResponse]
$creadListPrec :: ReadPrec [GetInstanceAccessDetailsResponse]
readPrec :: ReadPrec GetInstanceAccessDetailsResponse
$creadPrec :: ReadPrec GetInstanceAccessDetailsResponse
readList :: ReadS [GetInstanceAccessDetailsResponse]
$creadList :: ReadS [GetInstanceAccessDetailsResponse]
readsPrec :: Int -> ReadS GetInstanceAccessDetailsResponse
$creadsPrec :: Int -> ReadS GetInstanceAccessDetailsResponse
Prelude.Read, Int -> GetInstanceAccessDetailsResponse -> ShowS
[GetInstanceAccessDetailsResponse] -> ShowS
GetInstanceAccessDetailsResponse -> String
(Int -> GetInstanceAccessDetailsResponse -> ShowS)
-> (GetInstanceAccessDetailsResponse -> String)
-> ([GetInstanceAccessDetailsResponse] -> ShowS)
-> Show GetInstanceAccessDetailsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInstanceAccessDetailsResponse] -> ShowS
$cshowList :: [GetInstanceAccessDetailsResponse] -> ShowS
show :: GetInstanceAccessDetailsResponse -> String
$cshow :: GetInstanceAccessDetailsResponse -> String
showsPrec :: Int -> GetInstanceAccessDetailsResponse -> ShowS
$cshowsPrec :: Int -> GetInstanceAccessDetailsResponse -> ShowS
Prelude.Show, (forall x.
GetInstanceAccessDetailsResponse
-> Rep GetInstanceAccessDetailsResponse x)
-> (forall x.
Rep GetInstanceAccessDetailsResponse x
-> GetInstanceAccessDetailsResponse)
-> Generic GetInstanceAccessDetailsResponse
forall x.
Rep GetInstanceAccessDetailsResponse x
-> GetInstanceAccessDetailsResponse
forall x.
GetInstanceAccessDetailsResponse
-> Rep GetInstanceAccessDetailsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetInstanceAccessDetailsResponse x
-> GetInstanceAccessDetailsResponse
$cfrom :: forall x.
GetInstanceAccessDetailsResponse
-> Rep GetInstanceAccessDetailsResponse x
Prelude.Generic)
newGetInstanceAccessDetailsResponse ::
Prelude.Int ->
GetInstanceAccessDetailsResponse
newGetInstanceAccessDetailsResponse :: Int -> GetInstanceAccessDetailsResponse
newGetInstanceAccessDetailsResponse Int
pHttpStatus_ =
GetInstanceAccessDetailsResponse' :: Maybe InstanceAccessDetails
-> Int -> GetInstanceAccessDetailsResponse
GetInstanceAccessDetailsResponse'
{ $sel:accessDetails:GetInstanceAccessDetailsResponse' :: Maybe InstanceAccessDetails
accessDetails =
Maybe InstanceAccessDetails
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetInstanceAccessDetailsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getInstanceAccessDetailsResponse_accessDetails :: Lens.Lens' GetInstanceAccessDetailsResponse (Prelude.Maybe InstanceAccessDetails)
getInstanceAccessDetailsResponse_accessDetails :: (Maybe InstanceAccessDetails -> f (Maybe InstanceAccessDetails))
-> GetInstanceAccessDetailsResponse
-> f GetInstanceAccessDetailsResponse
getInstanceAccessDetailsResponse_accessDetails = (GetInstanceAccessDetailsResponse -> Maybe InstanceAccessDetails)
-> (GetInstanceAccessDetailsResponse
-> Maybe InstanceAccessDetails -> GetInstanceAccessDetailsResponse)
-> Lens
GetInstanceAccessDetailsResponse
GetInstanceAccessDetailsResponse
(Maybe InstanceAccessDetails)
(Maybe InstanceAccessDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceAccessDetailsResponse' {Maybe InstanceAccessDetails
accessDetails :: Maybe InstanceAccessDetails
$sel:accessDetails:GetInstanceAccessDetailsResponse' :: GetInstanceAccessDetailsResponse -> Maybe InstanceAccessDetails
accessDetails} -> Maybe InstanceAccessDetails
accessDetails) (\s :: GetInstanceAccessDetailsResponse
s@GetInstanceAccessDetailsResponse' {} Maybe InstanceAccessDetails
a -> GetInstanceAccessDetailsResponse
s {$sel:accessDetails:GetInstanceAccessDetailsResponse' :: Maybe InstanceAccessDetails
accessDetails = Maybe InstanceAccessDetails
a} :: GetInstanceAccessDetailsResponse)
getInstanceAccessDetailsResponse_httpStatus :: Lens.Lens' GetInstanceAccessDetailsResponse Prelude.Int
getInstanceAccessDetailsResponse_httpStatus :: (Int -> f Int)
-> GetInstanceAccessDetailsResponse
-> f GetInstanceAccessDetailsResponse
getInstanceAccessDetailsResponse_httpStatus = (GetInstanceAccessDetailsResponse -> Int)
-> (GetInstanceAccessDetailsResponse
-> Int -> GetInstanceAccessDetailsResponse)
-> Lens
GetInstanceAccessDetailsResponse
GetInstanceAccessDetailsResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceAccessDetailsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetInstanceAccessDetailsResponse' :: GetInstanceAccessDetailsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetInstanceAccessDetailsResponse
s@GetInstanceAccessDetailsResponse' {} Int
a -> GetInstanceAccessDetailsResponse
s {$sel:httpStatus:GetInstanceAccessDetailsResponse' :: Int
httpStatus = Int
a} :: GetInstanceAccessDetailsResponse)
instance
Prelude.NFData
GetInstanceAccessDetailsResponse