{-# 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.StartInstance
(
StartInstance (..),
newStartInstance,
startInstance_instanceName,
StartInstanceResponse (..),
newStartInstanceResponse,
startInstanceResponse_operations,
startInstanceResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data StartInstance = StartInstance'
{
StartInstance -> Text
instanceName :: Prelude.Text
}
deriving (StartInstance -> StartInstance -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartInstance -> StartInstance -> Bool
$c/= :: StartInstance -> StartInstance -> Bool
== :: StartInstance -> StartInstance -> Bool
$c== :: StartInstance -> StartInstance -> Bool
Prelude.Eq, ReadPrec [StartInstance]
ReadPrec StartInstance
Int -> ReadS StartInstance
ReadS [StartInstance]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartInstance]
$creadListPrec :: ReadPrec [StartInstance]
readPrec :: ReadPrec StartInstance
$creadPrec :: ReadPrec StartInstance
readList :: ReadS [StartInstance]
$creadList :: ReadS [StartInstance]
readsPrec :: Int -> ReadS StartInstance
$creadsPrec :: Int -> ReadS StartInstance
Prelude.Read, Int -> StartInstance -> ShowS
[StartInstance] -> ShowS
StartInstance -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartInstance] -> ShowS
$cshowList :: [StartInstance] -> ShowS
show :: StartInstance -> String
$cshow :: StartInstance -> String
showsPrec :: Int -> StartInstance -> ShowS
$cshowsPrec :: Int -> StartInstance -> ShowS
Prelude.Show, forall x. Rep StartInstance x -> StartInstance
forall x. StartInstance -> Rep StartInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartInstance x -> StartInstance
$cfrom :: forall x. StartInstance -> Rep StartInstance x
Prelude.Generic)
newStartInstance ::
Prelude.Text ->
StartInstance
newStartInstance :: Text -> StartInstance
newStartInstance Text
pInstanceName_ =
StartInstance' {$sel:instanceName:StartInstance' :: Text
instanceName = Text
pInstanceName_}
startInstance_instanceName :: Lens.Lens' StartInstance Prelude.Text
startInstance_instanceName :: Lens' StartInstance Text
startInstance_instanceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartInstance' {Text
instanceName :: Text
$sel:instanceName:StartInstance' :: StartInstance -> Text
instanceName} -> Text
instanceName) (\s :: StartInstance
s@StartInstance' {} Text
a -> StartInstance
s {$sel:instanceName:StartInstance' :: Text
instanceName = Text
a} :: StartInstance)
instance Core.AWSRequest StartInstance where
type
AWSResponse StartInstance =
StartInstanceResponse
request :: (Service -> Service) -> StartInstance -> Request StartInstance
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy StartInstance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartInstance)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [Operation] -> Int -> StartInstanceResponse
StartInstanceResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"operations" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
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 StartInstance where
hashWithSalt :: Int -> StartInstance -> Int
hashWithSalt Int
_salt StartInstance' {Text
instanceName :: Text
$sel:instanceName:StartInstance' :: StartInstance -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceName
instance Prelude.NFData StartInstance where
rnf :: StartInstance -> ()
rnf StartInstance' {Text
instanceName :: Text
$sel:instanceName:StartInstance' :: StartInstance -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
instanceName
instance Data.ToHeaders StartInstance where
toHeaders :: StartInstance -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Lightsail_20161128.StartInstance" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON StartInstance where
toJSON :: StartInstance -> Value
toJSON StartInstance' {Text
instanceName :: Text
$sel:instanceName:StartInstance' :: StartInstance -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"instanceName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
instanceName)]
)
instance Data.ToPath StartInstance where
toPath :: StartInstance -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery StartInstance where
toQuery :: StartInstance -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data StartInstanceResponse = StartInstanceResponse'
{
StartInstanceResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
StartInstanceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartInstanceResponse -> StartInstanceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartInstanceResponse -> StartInstanceResponse -> Bool
$c/= :: StartInstanceResponse -> StartInstanceResponse -> Bool
== :: StartInstanceResponse -> StartInstanceResponse -> Bool
$c== :: StartInstanceResponse -> StartInstanceResponse -> Bool
Prelude.Eq, ReadPrec [StartInstanceResponse]
ReadPrec StartInstanceResponse
Int -> ReadS StartInstanceResponse
ReadS [StartInstanceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartInstanceResponse]
$creadListPrec :: ReadPrec [StartInstanceResponse]
readPrec :: ReadPrec StartInstanceResponse
$creadPrec :: ReadPrec StartInstanceResponse
readList :: ReadS [StartInstanceResponse]
$creadList :: ReadS [StartInstanceResponse]
readsPrec :: Int -> ReadS StartInstanceResponse
$creadsPrec :: Int -> ReadS StartInstanceResponse
Prelude.Read, Int -> StartInstanceResponse -> ShowS
[StartInstanceResponse] -> ShowS
StartInstanceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartInstanceResponse] -> ShowS
$cshowList :: [StartInstanceResponse] -> ShowS
show :: StartInstanceResponse -> String
$cshow :: StartInstanceResponse -> String
showsPrec :: Int -> StartInstanceResponse -> ShowS
$cshowsPrec :: Int -> StartInstanceResponse -> ShowS
Prelude.Show, forall x. Rep StartInstanceResponse x -> StartInstanceResponse
forall x. StartInstanceResponse -> Rep StartInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartInstanceResponse x -> StartInstanceResponse
$cfrom :: forall x. StartInstanceResponse -> Rep StartInstanceResponse x
Prelude.Generic)
newStartInstanceResponse ::
Prelude.Int ->
StartInstanceResponse
newStartInstanceResponse :: Int -> StartInstanceResponse
newStartInstanceResponse Int
pHttpStatus_ =
StartInstanceResponse'
{ $sel:operations:StartInstanceResponse' :: Maybe [Operation]
operations =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartInstanceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startInstanceResponse_operations :: Lens.Lens' StartInstanceResponse (Prelude.Maybe [Operation])
startInstanceResponse_operations :: Lens' StartInstanceResponse (Maybe [Operation])
startInstanceResponse_operations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartInstanceResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:StartInstanceResponse' :: StartInstanceResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: StartInstanceResponse
s@StartInstanceResponse' {} Maybe [Operation]
a -> StartInstanceResponse
s {$sel:operations:StartInstanceResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: StartInstanceResponse) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
startInstanceResponse_httpStatus :: Lens.Lens' StartInstanceResponse Prelude.Int
startInstanceResponse_httpStatus :: Lens' StartInstanceResponse Int
startInstanceResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartInstanceResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartInstanceResponse' :: StartInstanceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartInstanceResponse
s@StartInstanceResponse' {} Int
a -> StartInstanceResponse
s {$sel:httpStatus:StartInstanceResponse' :: Int
httpStatus = Int
a} :: StartInstanceResponse)
instance Prelude.NFData StartInstanceResponse where
rnf :: StartInstanceResponse -> ()
rnf StartInstanceResponse' {Int
Maybe [Operation]
httpStatus :: Int
operations :: Maybe [Operation]
$sel:httpStatus:StartInstanceResponse' :: StartInstanceResponse -> Int
$sel:operations:StartInstanceResponse' :: StartInstanceResponse -> Maybe [Operation]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Operation]
operations
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus