{-# 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.EC2.GetConsoleOutput
(
GetConsoleOutput (..),
newGetConsoleOutput,
getConsoleOutput_dryRun,
getConsoleOutput_latest,
getConsoleOutput_instanceId,
GetConsoleOutputResponse (..),
newGetConsoleOutputResponse,
getConsoleOutputResponse_instanceId,
getConsoleOutputResponse_output,
getConsoleOutputResponse_timestamp,
getConsoleOutputResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetConsoleOutput = GetConsoleOutput'
{
GetConsoleOutput -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
GetConsoleOutput -> Maybe Bool
latest :: Prelude.Maybe Prelude.Bool,
GetConsoleOutput -> Text
instanceId :: Prelude.Text
}
deriving (GetConsoleOutput -> GetConsoleOutput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConsoleOutput -> GetConsoleOutput -> Bool
$c/= :: GetConsoleOutput -> GetConsoleOutput -> Bool
== :: GetConsoleOutput -> GetConsoleOutput -> Bool
$c== :: GetConsoleOutput -> GetConsoleOutput -> Bool
Prelude.Eq, ReadPrec [GetConsoleOutput]
ReadPrec GetConsoleOutput
Int -> ReadS GetConsoleOutput
ReadS [GetConsoleOutput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConsoleOutput]
$creadListPrec :: ReadPrec [GetConsoleOutput]
readPrec :: ReadPrec GetConsoleOutput
$creadPrec :: ReadPrec GetConsoleOutput
readList :: ReadS [GetConsoleOutput]
$creadList :: ReadS [GetConsoleOutput]
readsPrec :: Int -> ReadS GetConsoleOutput
$creadsPrec :: Int -> ReadS GetConsoleOutput
Prelude.Read, Int -> GetConsoleOutput -> ShowS
[GetConsoleOutput] -> ShowS
GetConsoleOutput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConsoleOutput] -> ShowS
$cshowList :: [GetConsoleOutput] -> ShowS
show :: GetConsoleOutput -> String
$cshow :: GetConsoleOutput -> String
showsPrec :: Int -> GetConsoleOutput -> ShowS
$cshowsPrec :: Int -> GetConsoleOutput -> ShowS
Prelude.Show, forall x. Rep GetConsoleOutput x -> GetConsoleOutput
forall x. GetConsoleOutput -> Rep GetConsoleOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetConsoleOutput x -> GetConsoleOutput
$cfrom :: forall x. GetConsoleOutput -> Rep GetConsoleOutput x
Prelude.Generic)
newGetConsoleOutput ::
Prelude.Text ->
GetConsoleOutput
newGetConsoleOutput :: Text -> GetConsoleOutput
newGetConsoleOutput Text
pInstanceId_ =
GetConsoleOutput'
{ $sel:dryRun:GetConsoleOutput' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
$sel:latest:GetConsoleOutput' :: Maybe Bool
latest = forall a. Maybe a
Prelude.Nothing,
$sel:instanceId:GetConsoleOutput' :: Text
instanceId = Text
pInstanceId_
}
getConsoleOutput_dryRun :: Lens.Lens' GetConsoleOutput (Prelude.Maybe Prelude.Bool)
getConsoleOutput_dryRun :: Lens' GetConsoleOutput (Maybe Bool)
getConsoleOutput_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConsoleOutput' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:GetConsoleOutput' :: GetConsoleOutput -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: GetConsoleOutput
s@GetConsoleOutput' {} Maybe Bool
a -> GetConsoleOutput
s {$sel:dryRun:GetConsoleOutput' :: Maybe Bool
dryRun = Maybe Bool
a} :: GetConsoleOutput)
getConsoleOutput_latest :: Lens.Lens' GetConsoleOutput (Prelude.Maybe Prelude.Bool)
getConsoleOutput_latest :: Lens' GetConsoleOutput (Maybe Bool)
getConsoleOutput_latest = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConsoleOutput' {Maybe Bool
latest :: Maybe Bool
$sel:latest:GetConsoleOutput' :: GetConsoleOutput -> Maybe Bool
latest} -> Maybe Bool
latest) (\s :: GetConsoleOutput
s@GetConsoleOutput' {} Maybe Bool
a -> GetConsoleOutput
s {$sel:latest:GetConsoleOutput' :: Maybe Bool
latest = Maybe Bool
a} :: GetConsoleOutput)
getConsoleOutput_instanceId :: Lens.Lens' GetConsoleOutput Prelude.Text
getConsoleOutput_instanceId :: Lens' GetConsoleOutput Text
getConsoleOutput_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConsoleOutput' {Text
instanceId :: Text
$sel:instanceId:GetConsoleOutput' :: GetConsoleOutput -> Text
instanceId} -> Text
instanceId) (\s :: GetConsoleOutput
s@GetConsoleOutput' {} Text
a -> GetConsoleOutput
s {$sel:instanceId:GetConsoleOutput' :: Text
instanceId = Text
a} :: GetConsoleOutput)
instance Core.AWSRequest GetConsoleOutput where
type
AWSResponse GetConsoleOutput =
GetConsoleOutputResponse
request :: (Service -> Service)
-> GetConsoleOutput -> Request GetConsoleOutput
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetConsoleOutput
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetConsoleOutput)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text
-> Maybe Text -> Maybe ISO8601 -> Int -> GetConsoleOutputResponse
GetConsoleOutputResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"instanceId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"output")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"timestamp")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetConsoleOutput where
hashWithSalt :: Int -> GetConsoleOutput -> Int
hashWithSalt Int
_salt GetConsoleOutput' {Maybe Bool
Text
instanceId :: Text
latest :: Maybe Bool
dryRun :: Maybe Bool
$sel:instanceId:GetConsoleOutput' :: GetConsoleOutput -> Text
$sel:latest:GetConsoleOutput' :: GetConsoleOutput -> Maybe Bool
$sel:dryRun:GetConsoleOutput' :: GetConsoleOutput -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
latest
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId
instance Prelude.NFData GetConsoleOutput where
rnf :: GetConsoleOutput -> ()
rnf GetConsoleOutput' {Maybe Bool
Text
instanceId :: Text
latest :: Maybe Bool
dryRun :: Maybe Bool
$sel:instanceId:GetConsoleOutput' :: GetConsoleOutput -> Text
$sel:latest:GetConsoleOutput' :: GetConsoleOutput -> Maybe Bool
$sel:dryRun:GetConsoleOutput' :: GetConsoleOutput -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
latest
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId
instance Data.ToHeaders GetConsoleOutput where
toHeaders :: GetConsoleOutput -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath GetConsoleOutput where
toPath :: GetConsoleOutput -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetConsoleOutput where
toQuery :: GetConsoleOutput -> QueryString
toQuery GetConsoleOutput' {Maybe Bool
Text
instanceId :: Text
latest :: Maybe Bool
dryRun :: Maybe Bool
$sel:instanceId:GetConsoleOutput' :: GetConsoleOutput -> Text
$sel:latest:GetConsoleOutput' :: GetConsoleOutput -> Maybe Bool
$sel:dryRun:GetConsoleOutput' :: GetConsoleOutput -> Maybe Bool
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"GetConsoleOutput" :: Prelude.ByteString),
ByteString
"Version"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
ByteString
"Latest" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
latest,
ByteString
"InstanceId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
instanceId
]
data GetConsoleOutputResponse = GetConsoleOutputResponse'
{
GetConsoleOutputResponse -> Maybe Text
instanceId :: Prelude.Maybe Prelude.Text,
GetConsoleOutputResponse -> Maybe Text
output :: Prelude.Maybe Prelude.Text,
GetConsoleOutputResponse -> Maybe ISO8601
timestamp :: Prelude.Maybe Data.ISO8601,
GetConsoleOutputResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetConsoleOutputResponse -> GetConsoleOutputResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConsoleOutputResponse -> GetConsoleOutputResponse -> Bool
$c/= :: GetConsoleOutputResponse -> GetConsoleOutputResponse -> Bool
== :: GetConsoleOutputResponse -> GetConsoleOutputResponse -> Bool
$c== :: GetConsoleOutputResponse -> GetConsoleOutputResponse -> Bool
Prelude.Eq, ReadPrec [GetConsoleOutputResponse]
ReadPrec GetConsoleOutputResponse
Int -> ReadS GetConsoleOutputResponse
ReadS [GetConsoleOutputResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConsoleOutputResponse]
$creadListPrec :: ReadPrec [GetConsoleOutputResponse]
readPrec :: ReadPrec GetConsoleOutputResponse
$creadPrec :: ReadPrec GetConsoleOutputResponse
readList :: ReadS [GetConsoleOutputResponse]
$creadList :: ReadS [GetConsoleOutputResponse]
readsPrec :: Int -> ReadS GetConsoleOutputResponse
$creadsPrec :: Int -> ReadS GetConsoleOutputResponse
Prelude.Read, Int -> GetConsoleOutputResponse -> ShowS
[GetConsoleOutputResponse] -> ShowS
GetConsoleOutputResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConsoleOutputResponse] -> ShowS
$cshowList :: [GetConsoleOutputResponse] -> ShowS
show :: GetConsoleOutputResponse -> String
$cshow :: GetConsoleOutputResponse -> String
showsPrec :: Int -> GetConsoleOutputResponse -> ShowS
$cshowsPrec :: Int -> GetConsoleOutputResponse -> ShowS
Prelude.Show, forall x.
Rep GetConsoleOutputResponse x -> GetConsoleOutputResponse
forall x.
GetConsoleOutputResponse -> Rep GetConsoleOutputResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetConsoleOutputResponse x -> GetConsoleOutputResponse
$cfrom :: forall x.
GetConsoleOutputResponse -> Rep GetConsoleOutputResponse x
Prelude.Generic)
newGetConsoleOutputResponse ::
Prelude.Int ->
GetConsoleOutputResponse
newGetConsoleOutputResponse :: Int -> GetConsoleOutputResponse
newGetConsoleOutputResponse Int
pHttpStatus_ =
GetConsoleOutputResponse'
{ $sel:instanceId:GetConsoleOutputResponse' :: Maybe Text
instanceId =
forall a. Maybe a
Prelude.Nothing,
$sel:output:GetConsoleOutputResponse' :: Maybe Text
output = forall a. Maybe a
Prelude.Nothing,
$sel:timestamp:GetConsoleOutputResponse' :: Maybe ISO8601
timestamp = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetConsoleOutputResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getConsoleOutputResponse_instanceId :: Lens.Lens' GetConsoleOutputResponse (Prelude.Maybe Prelude.Text)
getConsoleOutputResponse_instanceId :: Lens' GetConsoleOutputResponse (Maybe Text)
getConsoleOutputResponse_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConsoleOutputResponse' {Maybe Text
instanceId :: Maybe Text
$sel:instanceId:GetConsoleOutputResponse' :: GetConsoleOutputResponse -> Maybe Text
instanceId} -> Maybe Text
instanceId) (\s :: GetConsoleOutputResponse
s@GetConsoleOutputResponse' {} Maybe Text
a -> GetConsoleOutputResponse
s {$sel:instanceId:GetConsoleOutputResponse' :: Maybe Text
instanceId = Maybe Text
a} :: GetConsoleOutputResponse)
getConsoleOutputResponse_output :: Lens.Lens' GetConsoleOutputResponse (Prelude.Maybe Prelude.Text)
getConsoleOutputResponse_output :: Lens' GetConsoleOutputResponse (Maybe Text)
getConsoleOutputResponse_output = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConsoleOutputResponse' {Maybe Text
output :: Maybe Text
$sel:output:GetConsoleOutputResponse' :: GetConsoleOutputResponse -> Maybe Text
output} -> Maybe Text
output) (\s :: GetConsoleOutputResponse
s@GetConsoleOutputResponse' {} Maybe Text
a -> GetConsoleOutputResponse
s {$sel:output:GetConsoleOutputResponse' :: Maybe Text
output = Maybe Text
a} :: GetConsoleOutputResponse)
getConsoleOutputResponse_timestamp :: Lens.Lens' GetConsoleOutputResponse (Prelude.Maybe Prelude.UTCTime)
getConsoleOutputResponse_timestamp :: Lens' GetConsoleOutputResponse (Maybe UTCTime)
getConsoleOutputResponse_timestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConsoleOutputResponse' {Maybe ISO8601
timestamp :: Maybe ISO8601
$sel:timestamp:GetConsoleOutputResponse' :: GetConsoleOutputResponse -> Maybe ISO8601
timestamp} -> Maybe ISO8601
timestamp) (\s :: GetConsoleOutputResponse
s@GetConsoleOutputResponse' {} Maybe ISO8601
a -> GetConsoleOutputResponse
s {$sel:timestamp:GetConsoleOutputResponse' :: Maybe ISO8601
timestamp = Maybe ISO8601
a} :: GetConsoleOutputResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
getConsoleOutputResponse_httpStatus :: Lens.Lens' GetConsoleOutputResponse Prelude.Int
getConsoleOutputResponse_httpStatus :: Lens' GetConsoleOutputResponse Int
getConsoleOutputResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConsoleOutputResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetConsoleOutputResponse' :: GetConsoleOutputResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetConsoleOutputResponse
s@GetConsoleOutputResponse' {} Int
a -> GetConsoleOutputResponse
s {$sel:httpStatus:GetConsoleOutputResponse' :: Int
httpStatus = Int
a} :: GetConsoleOutputResponse)
instance Prelude.NFData GetConsoleOutputResponse where
rnf :: GetConsoleOutputResponse -> ()
rnf GetConsoleOutputResponse' {Int
Maybe Text
Maybe ISO8601
httpStatus :: Int
timestamp :: Maybe ISO8601
output :: Maybe Text
instanceId :: Maybe Text
$sel:httpStatus:GetConsoleOutputResponse' :: GetConsoleOutputResponse -> Int
$sel:timestamp:GetConsoleOutputResponse' :: GetConsoleOutputResponse -> Maybe ISO8601
$sel:output:GetConsoleOutputResponse' :: GetConsoleOutputResponse -> Maybe Text
$sel:instanceId:GetConsoleOutputResponse' :: GetConsoleOutputResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
instanceId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
output
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
timestamp
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus