{-# 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.StartInstances
(
StartInstances (..),
newStartInstances,
startInstances_additionalInfo,
startInstances_dryRun,
startInstances_instanceIds,
StartInstancesResponse (..),
newStartInstancesResponse,
startInstancesResponse_startingInstances,
startInstancesResponse_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 StartInstances = StartInstances'
{
StartInstances -> Maybe Text
additionalInfo :: Prelude.Maybe Prelude.Text,
StartInstances -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
StartInstances -> [Text]
instanceIds :: [Prelude.Text]
}
deriving (StartInstances -> StartInstances -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartInstances -> StartInstances -> Bool
$c/= :: StartInstances -> StartInstances -> Bool
== :: StartInstances -> StartInstances -> Bool
$c== :: StartInstances -> StartInstances -> Bool
Prelude.Eq, ReadPrec [StartInstances]
ReadPrec StartInstances
Int -> ReadS StartInstances
ReadS [StartInstances]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartInstances]
$creadListPrec :: ReadPrec [StartInstances]
readPrec :: ReadPrec StartInstances
$creadPrec :: ReadPrec StartInstances
readList :: ReadS [StartInstances]
$creadList :: ReadS [StartInstances]
readsPrec :: Int -> ReadS StartInstances
$creadsPrec :: Int -> ReadS StartInstances
Prelude.Read, Int -> StartInstances -> ShowS
[StartInstances] -> ShowS
StartInstances -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartInstances] -> ShowS
$cshowList :: [StartInstances] -> ShowS
show :: StartInstances -> String
$cshow :: StartInstances -> String
showsPrec :: Int -> StartInstances -> ShowS
$cshowsPrec :: Int -> StartInstances -> ShowS
Prelude.Show, forall x. Rep StartInstances x -> StartInstances
forall x. StartInstances -> Rep StartInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartInstances x -> StartInstances
$cfrom :: forall x. StartInstances -> Rep StartInstances x
Prelude.Generic)
newStartInstances ::
StartInstances
newStartInstances :: StartInstances
newStartInstances =
StartInstances'
{ $sel:additionalInfo:StartInstances' :: Maybe Text
additionalInfo = forall a. Maybe a
Prelude.Nothing,
$sel:dryRun:StartInstances' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
$sel:instanceIds:StartInstances' :: [Text]
instanceIds = forall a. Monoid a => a
Prelude.mempty
}
startInstances_additionalInfo :: Lens.Lens' StartInstances (Prelude.Maybe Prelude.Text)
startInstances_additionalInfo :: Lens' StartInstances (Maybe Text)
startInstances_additionalInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartInstances' {Maybe Text
additionalInfo :: Maybe Text
$sel:additionalInfo:StartInstances' :: StartInstances -> Maybe Text
additionalInfo} -> Maybe Text
additionalInfo) (\s :: StartInstances
s@StartInstances' {} Maybe Text
a -> StartInstances
s {$sel:additionalInfo:StartInstances' :: Maybe Text
additionalInfo = Maybe Text
a} :: StartInstances)
startInstances_dryRun :: Lens.Lens' StartInstances (Prelude.Maybe Prelude.Bool)
startInstances_dryRun :: Lens' StartInstances (Maybe Bool)
startInstances_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartInstances' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:StartInstances' :: StartInstances -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: StartInstances
s@StartInstances' {} Maybe Bool
a -> StartInstances
s {$sel:dryRun:StartInstances' :: Maybe Bool
dryRun = Maybe Bool
a} :: StartInstances)
startInstances_instanceIds :: Lens.Lens' StartInstances [Prelude.Text]
startInstances_instanceIds :: Lens' StartInstances [Text]
startInstances_instanceIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartInstances' {[Text]
instanceIds :: [Text]
$sel:instanceIds:StartInstances' :: StartInstances -> [Text]
instanceIds} -> [Text]
instanceIds) (\s :: StartInstances
s@StartInstances' {} [Text]
a -> StartInstances
s {$sel:instanceIds:StartInstances' :: [Text]
instanceIds = [Text]
a} :: StartInstances) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest StartInstances where
type
AWSResponse StartInstances =
StartInstancesResponse
request :: (Service -> Service) -> StartInstances -> Request StartInstances
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 StartInstances
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartInstances)))
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 [InstanceStateChange] -> Int -> StartInstancesResponse
StartInstancesResponse'
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
"instancesSet"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
)
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 StartInstances where
hashWithSalt :: Int -> StartInstances -> Int
hashWithSalt Int
_salt StartInstances' {[Text]
Maybe Bool
Maybe Text
instanceIds :: [Text]
dryRun :: Maybe Bool
additionalInfo :: Maybe Text
$sel:instanceIds:StartInstances' :: StartInstances -> [Text]
$sel:dryRun:StartInstances' :: StartInstances -> Maybe Bool
$sel:additionalInfo:StartInstances' :: StartInstances -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
additionalInfo
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
instanceIds
instance Prelude.NFData StartInstances where
rnf :: StartInstances -> ()
rnf StartInstances' {[Text]
Maybe Bool
Maybe Text
instanceIds :: [Text]
dryRun :: Maybe Bool
additionalInfo :: Maybe Text
$sel:instanceIds:StartInstances' :: StartInstances -> [Text]
$sel:dryRun:StartInstances' :: StartInstances -> Maybe Bool
$sel:additionalInfo:StartInstances' :: StartInstances -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
additionalInfo
seq :: forall a b. a -> b -> b
`Prelude.seq` 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 [Text]
instanceIds
instance Data.ToHeaders StartInstances where
toHeaders :: StartInstances -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath StartInstances where
toPath :: StartInstances -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery StartInstances where
toQuery :: StartInstances -> QueryString
toQuery StartInstances' {[Text]
Maybe Bool
Maybe Text
instanceIds :: [Text]
dryRun :: Maybe Bool
additionalInfo :: Maybe Text
$sel:instanceIds:StartInstances' :: StartInstances -> [Text]
$sel:dryRun:StartInstances' :: StartInstances -> Maybe Bool
$sel:additionalInfo:StartInstances' :: StartInstances -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"StartInstances" :: Prelude.ByteString),
ByteString
"Version"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
ByteString
"AdditionalInfo" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
additionalInfo,
ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"InstanceId" [Text]
instanceIds
]
data StartInstancesResponse = StartInstancesResponse'
{
StartInstancesResponse -> Maybe [InstanceStateChange]
startingInstances :: Prelude.Maybe [InstanceStateChange],
StartInstancesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartInstancesResponse -> StartInstancesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartInstancesResponse -> StartInstancesResponse -> Bool
$c/= :: StartInstancesResponse -> StartInstancesResponse -> Bool
== :: StartInstancesResponse -> StartInstancesResponse -> Bool
$c== :: StartInstancesResponse -> StartInstancesResponse -> Bool
Prelude.Eq, ReadPrec [StartInstancesResponse]
ReadPrec StartInstancesResponse
Int -> ReadS StartInstancesResponse
ReadS [StartInstancesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartInstancesResponse]
$creadListPrec :: ReadPrec [StartInstancesResponse]
readPrec :: ReadPrec StartInstancesResponse
$creadPrec :: ReadPrec StartInstancesResponse
readList :: ReadS [StartInstancesResponse]
$creadList :: ReadS [StartInstancesResponse]
readsPrec :: Int -> ReadS StartInstancesResponse
$creadsPrec :: Int -> ReadS StartInstancesResponse
Prelude.Read, Int -> StartInstancesResponse -> ShowS
[StartInstancesResponse] -> ShowS
StartInstancesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartInstancesResponse] -> ShowS
$cshowList :: [StartInstancesResponse] -> ShowS
show :: StartInstancesResponse -> String
$cshow :: StartInstancesResponse -> String
showsPrec :: Int -> StartInstancesResponse -> ShowS
$cshowsPrec :: Int -> StartInstancesResponse -> ShowS
Prelude.Show, forall x. Rep StartInstancesResponse x -> StartInstancesResponse
forall x. StartInstancesResponse -> Rep StartInstancesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartInstancesResponse x -> StartInstancesResponse
$cfrom :: forall x. StartInstancesResponse -> Rep StartInstancesResponse x
Prelude.Generic)
newStartInstancesResponse ::
Prelude.Int ->
StartInstancesResponse
newStartInstancesResponse :: Int -> StartInstancesResponse
newStartInstancesResponse Int
pHttpStatus_ =
StartInstancesResponse'
{ $sel:startingInstances:StartInstancesResponse' :: Maybe [InstanceStateChange]
startingInstances =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartInstancesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startInstancesResponse_startingInstances :: Lens.Lens' StartInstancesResponse (Prelude.Maybe [InstanceStateChange])
startInstancesResponse_startingInstances :: Lens' StartInstancesResponse (Maybe [InstanceStateChange])
startInstancesResponse_startingInstances = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartInstancesResponse' {Maybe [InstanceStateChange]
startingInstances :: Maybe [InstanceStateChange]
$sel:startingInstances:StartInstancesResponse' :: StartInstancesResponse -> Maybe [InstanceStateChange]
startingInstances} -> Maybe [InstanceStateChange]
startingInstances) (\s :: StartInstancesResponse
s@StartInstancesResponse' {} Maybe [InstanceStateChange]
a -> StartInstancesResponse
s {$sel:startingInstances:StartInstancesResponse' :: Maybe [InstanceStateChange]
startingInstances = Maybe [InstanceStateChange]
a} :: StartInstancesResponse) 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
startInstancesResponse_httpStatus :: Lens.Lens' StartInstancesResponse Prelude.Int
startInstancesResponse_httpStatus :: Lens' StartInstancesResponse Int
startInstancesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartInstancesResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartInstancesResponse' :: StartInstancesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartInstancesResponse
s@StartInstancesResponse' {} Int
a -> StartInstancesResponse
s {$sel:httpStatus:StartInstancesResponse' :: Int
httpStatus = Int
a} :: StartInstancesResponse)
instance Prelude.NFData StartInstancesResponse where
rnf :: StartInstancesResponse -> ()
rnf StartInstancesResponse' {Int
Maybe [InstanceStateChange]
httpStatus :: Int
startingInstances :: Maybe [InstanceStateChange]
$sel:httpStatus:StartInstancesResponse' :: StartInstancesResponse -> Int
$sel:startingInstances:StartInstancesResponse' :: StartInstancesResponse -> Maybe [InstanceStateChange]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [InstanceStateChange]
startingInstances
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus