{-# 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.StopInstances
(
StopInstances (..),
newStopInstances,
stopInstances_dryRun,
stopInstances_force,
stopInstances_hibernate,
stopInstances_instanceIds,
StopInstancesResponse (..),
newStopInstancesResponse,
stopInstancesResponse_stoppingInstances,
stopInstancesResponse_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 StopInstances = StopInstances'
{
StopInstances -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
StopInstances -> Maybe Bool
force :: Prelude.Maybe Prelude.Bool,
StopInstances -> Maybe Bool
hibernate :: Prelude.Maybe Prelude.Bool,
StopInstances -> [Text]
instanceIds :: [Prelude.Text]
}
deriving (StopInstances -> StopInstances -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopInstances -> StopInstances -> Bool
$c/= :: StopInstances -> StopInstances -> Bool
== :: StopInstances -> StopInstances -> Bool
$c== :: StopInstances -> StopInstances -> Bool
Prelude.Eq, ReadPrec [StopInstances]
ReadPrec StopInstances
Int -> ReadS StopInstances
ReadS [StopInstances]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopInstances]
$creadListPrec :: ReadPrec [StopInstances]
readPrec :: ReadPrec StopInstances
$creadPrec :: ReadPrec StopInstances
readList :: ReadS [StopInstances]
$creadList :: ReadS [StopInstances]
readsPrec :: Int -> ReadS StopInstances
$creadsPrec :: Int -> ReadS StopInstances
Prelude.Read, Int -> StopInstances -> ShowS
[StopInstances] -> ShowS
StopInstances -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopInstances] -> ShowS
$cshowList :: [StopInstances] -> ShowS
show :: StopInstances -> String
$cshow :: StopInstances -> String
showsPrec :: Int -> StopInstances -> ShowS
$cshowsPrec :: Int -> StopInstances -> ShowS
Prelude.Show, forall x. Rep StopInstances x -> StopInstances
forall x. StopInstances -> Rep StopInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopInstances x -> StopInstances
$cfrom :: forall x. StopInstances -> Rep StopInstances x
Prelude.Generic)
newStopInstances ::
StopInstances
newStopInstances :: StopInstances
newStopInstances =
StopInstances'
{ $sel:dryRun:StopInstances' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
$sel:force:StopInstances' :: Maybe Bool
force = forall a. Maybe a
Prelude.Nothing,
$sel:hibernate:StopInstances' :: Maybe Bool
hibernate = forall a. Maybe a
Prelude.Nothing,
$sel:instanceIds:StopInstances' :: [Text]
instanceIds = forall a. Monoid a => a
Prelude.mempty
}
stopInstances_dryRun :: Lens.Lens' StopInstances (Prelude.Maybe Prelude.Bool)
stopInstances_dryRun :: Lens' StopInstances (Maybe Bool)
stopInstances_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopInstances' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:StopInstances' :: StopInstances -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: StopInstances
s@StopInstances' {} Maybe Bool
a -> StopInstances
s {$sel:dryRun:StopInstances' :: Maybe Bool
dryRun = Maybe Bool
a} :: StopInstances)
stopInstances_force :: Lens.Lens' StopInstances (Prelude.Maybe Prelude.Bool)
stopInstances_force :: Lens' StopInstances (Maybe Bool)
stopInstances_force = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopInstances' {Maybe Bool
force :: Maybe Bool
$sel:force:StopInstances' :: StopInstances -> Maybe Bool
force} -> Maybe Bool
force) (\s :: StopInstances
s@StopInstances' {} Maybe Bool
a -> StopInstances
s {$sel:force:StopInstances' :: Maybe Bool
force = Maybe Bool
a} :: StopInstances)
stopInstances_hibernate :: Lens.Lens' StopInstances (Prelude.Maybe Prelude.Bool)
stopInstances_hibernate :: Lens' StopInstances (Maybe Bool)
stopInstances_hibernate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopInstances' {Maybe Bool
hibernate :: Maybe Bool
$sel:hibernate:StopInstances' :: StopInstances -> Maybe Bool
hibernate} -> Maybe Bool
hibernate) (\s :: StopInstances
s@StopInstances' {} Maybe Bool
a -> StopInstances
s {$sel:hibernate:StopInstances' :: Maybe Bool
hibernate = Maybe Bool
a} :: StopInstances)
stopInstances_instanceIds :: Lens.Lens' StopInstances [Prelude.Text]
stopInstances_instanceIds :: Lens' StopInstances [Text]
stopInstances_instanceIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopInstances' {[Text]
instanceIds :: [Text]
$sel:instanceIds:StopInstances' :: StopInstances -> [Text]
instanceIds} -> [Text]
instanceIds) (\s :: StopInstances
s@StopInstances' {} [Text]
a -> StopInstances
s {$sel:instanceIds:StopInstances' :: [Text]
instanceIds = [Text]
a} :: StopInstances) 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 StopInstances where
type
AWSResponse StopInstances =
StopInstancesResponse
request :: (Service -> Service) -> StopInstances -> Request StopInstances
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 StopInstances
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopInstances)))
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 -> StopInstancesResponse
StopInstancesResponse'
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 StopInstances where
hashWithSalt :: Int -> StopInstances -> Int
hashWithSalt Int
_salt StopInstances' {[Text]
Maybe Bool
instanceIds :: [Text]
hibernate :: Maybe Bool
force :: Maybe Bool
dryRun :: Maybe Bool
$sel:instanceIds:StopInstances' :: StopInstances -> [Text]
$sel:hibernate:StopInstances' :: StopInstances -> Maybe Bool
$sel:force:StopInstances' :: StopInstances -> Maybe Bool
$sel:dryRun:StopInstances' :: StopInstances -> 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
force
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
hibernate
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
instanceIds
instance Prelude.NFData StopInstances where
rnf :: StopInstances -> ()
rnf StopInstances' {[Text]
Maybe Bool
instanceIds :: [Text]
hibernate :: Maybe Bool
force :: Maybe Bool
dryRun :: Maybe Bool
$sel:instanceIds:StopInstances' :: StopInstances -> [Text]
$sel:hibernate:StopInstances' :: StopInstances -> Maybe Bool
$sel:force:StopInstances' :: StopInstances -> Maybe Bool
$sel:dryRun:StopInstances' :: StopInstances -> 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
force
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
hibernate
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
instanceIds
instance Data.ToHeaders StopInstances where
toHeaders :: StopInstances -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath StopInstances where
toPath :: StopInstances -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery StopInstances where
toQuery :: StopInstances -> QueryString
toQuery StopInstances' {[Text]
Maybe Bool
instanceIds :: [Text]
hibernate :: Maybe Bool
force :: Maybe Bool
dryRun :: Maybe Bool
$sel:instanceIds:StopInstances' :: StopInstances -> [Text]
$sel:hibernate:StopInstances' :: StopInstances -> Maybe Bool
$sel:force:StopInstances' :: StopInstances -> Maybe Bool
$sel:dryRun:StopInstances' :: StopInstances -> Maybe Bool
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"StopInstances" :: 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
"Force" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
force,
ByteString
"Hibernate" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
hibernate,
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"InstanceId" [Text]
instanceIds
]
data StopInstancesResponse = StopInstancesResponse'
{
StopInstancesResponse -> Maybe [InstanceStateChange]
stoppingInstances :: Prelude.Maybe [InstanceStateChange],
StopInstancesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StopInstancesResponse -> StopInstancesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopInstancesResponse -> StopInstancesResponse -> Bool
$c/= :: StopInstancesResponse -> StopInstancesResponse -> Bool
== :: StopInstancesResponse -> StopInstancesResponse -> Bool
$c== :: StopInstancesResponse -> StopInstancesResponse -> Bool
Prelude.Eq, ReadPrec [StopInstancesResponse]
ReadPrec StopInstancesResponse
Int -> ReadS StopInstancesResponse
ReadS [StopInstancesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopInstancesResponse]
$creadListPrec :: ReadPrec [StopInstancesResponse]
readPrec :: ReadPrec StopInstancesResponse
$creadPrec :: ReadPrec StopInstancesResponse
readList :: ReadS [StopInstancesResponse]
$creadList :: ReadS [StopInstancesResponse]
readsPrec :: Int -> ReadS StopInstancesResponse
$creadsPrec :: Int -> ReadS StopInstancesResponse
Prelude.Read, Int -> StopInstancesResponse -> ShowS
[StopInstancesResponse] -> ShowS
StopInstancesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopInstancesResponse] -> ShowS
$cshowList :: [StopInstancesResponse] -> ShowS
show :: StopInstancesResponse -> String
$cshow :: StopInstancesResponse -> String
showsPrec :: Int -> StopInstancesResponse -> ShowS
$cshowsPrec :: Int -> StopInstancesResponse -> ShowS
Prelude.Show, forall x. Rep StopInstancesResponse x -> StopInstancesResponse
forall x. StopInstancesResponse -> Rep StopInstancesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopInstancesResponse x -> StopInstancesResponse
$cfrom :: forall x. StopInstancesResponse -> Rep StopInstancesResponse x
Prelude.Generic)
newStopInstancesResponse ::
Prelude.Int ->
StopInstancesResponse
newStopInstancesResponse :: Int -> StopInstancesResponse
newStopInstancesResponse Int
pHttpStatus_ =
StopInstancesResponse'
{ $sel:stoppingInstances:StopInstancesResponse' :: Maybe [InstanceStateChange]
stoppingInstances =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StopInstancesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
stopInstancesResponse_stoppingInstances :: Lens.Lens' StopInstancesResponse (Prelude.Maybe [InstanceStateChange])
stopInstancesResponse_stoppingInstances :: Lens' StopInstancesResponse (Maybe [InstanceStateChange])
stopInstancesResponse_stoppingInstances = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopInstancesResponse' {Maybe [InstanceStateChange]
stoppingInstances :: Maybe [InstanceStateChange]
$sel:stoppingInstances:StopInstancesResponse' :: StopInstancesResponse -> Maybe [InstanceStateChange]
stoppingInstances} -> Maybe [InstanceStateChange]
stoppingInstances) (\s :: StopInstancesResponse
s@StopInstancesResponse' {} Maybe [InstanceStateChange]
a -> StopInstancesResponse
s {$sel:stoppingInstances:StopInstancesResponse' :: Maybe [InstanceStateChange]
stoppingInstances = Maybe [InstanceStateChange]
a} :: StopInstancesResponse) 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
stopInstancesResponse_httpStatus :: Lens.Lens' StopInstancesResponse Prelude.Int
stopInstancesResponse_httpStatus :: Lens' StopInstancesResponse Int
stopInstancesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopInstancesResponse' {Int
httpStatus :: Int
$sel:httpStatus:StopInstancesResponse' :: StopInstancesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StopInstancesResponse
s@StopInstancesResponse' {} Int
a -> StopInstancesResponse
s {$sel:httpStatus:StopInstancesResponse' :: Int
httpStatus = Int
a} :: StopInstancesResponse)
instance Prelude.NFData StopInstancesResponse where
rnf :: StopInstancesResponse -> ()
rnf StopInstancesResponse' {Int
Maybe [InstanceStateChange]
httpStatus :: Int
stoppingInstances :: Maybe [InstanceStateChange]
$sel:httpStatus:StopInstancesResponse' :: StopInstancesResponse -> Int
$sel:stoppingInstances:StopInstancesResponse' :: StopInstancesResponse -> Maybe [InstanceStateChange]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [InstanceStateChange]
stoppingInstances
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus