{-# 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.CancelBundleTask
(
CancelBundleTask (..),
newCancelBundleTask,
cancelBundleTask_dryRun,
cancelBundleTask_bundleId,
CancelBundleTaskResponse (..),
newCancelBundleTaskResponse,
cancelBundleTaskResponse_bundleTask,
cancelBundleTaskResponse_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 CancelBundleTask = CancelBundleTask'
{
CancelBundleTask -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
CancelBundleTask -> Text
bundleId :: Prelude.Text
}
deriving (CancelBundleTask -> CancelBundleTask -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelBundleTask -> CancelBundleTask -> Bool
$c/= :: CancelBundleTask -> CancelBundleTask -> Bool
== :: CancelBundleTask -> CancelBundleTask -> Bool
$c== :: CancelBundleTask -> CancelBundleTask -> Bool
Prelude.Eq, ReadPrec [CancelBundleTask]
ReadPrec CancelBundleTask
Int -> ReadS CancelBundleTask
ReadS [CancelBundleTask]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelBundleTask]
$creadListPrec :: ReadPrec [CancelBundleTask]
readPrec :: ReadPrec CancelBundleTask
$creadPrec :: ReadPrec CancelBundleTask
readList :: ReadS [CancelBundleTask]
$creadList :: ReadS [CancelBundleTask]
readsPrec :: Int -> ReadS CancelBundleTask
$creadsPrec :: Int -> ReadS CancelBundleTask
Prelude.Read, Int -> CancelBundleTask -> ShowS
[CancelBundleTask] -> ShowS
CancelBundleTask -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelBundleTask] -> ShowS
$cshowList :: [CancelBundleTask] -> ShowS
show :: CancelBundleTask -> String
$cshow :: CancelBundleTask -> String
showsPrec :: Int -> CancelBundleTask -> ShowS
$cshowsPrec :: Int -> CancelBundleTask -> ShowS
Prelude.Show, forall x. Rep CancelBundleTask x -> CancelBundleTask
forall x. CancelBundleTask -> Rep CancelBundleTask x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CancelBundleTask x -> CancelBundleTask
$cfrom :: forall x. CancelBundleTask -> Rep CancelBundleTask x
Prelude.Generic)
newCancelBundleTask ::
Prelude.Text ->
CancelBundleTask
newCancelBundleTask :: Text -> CancelBundleTask
newCancelBundleTask Text
pBundleId_ =
CancelBundleTask'
{ $sel:dryRun:CancelBundleTask' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
$sel:bundleId:CancelBundleTask' :: Text
bundleId = Text
pBundleId_
}
cancelBundleTask_dryRun :: Lens.Lens' CancelBundleTask (Prelude.Maybe Prelude.Bool)
cancelBundleTask_dryRun :: Lens' CancelBundleTask (Maybe Bool)
cancelBundleTask_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelBundleTask' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:CancelBundleTask' :: CancelBundleTask -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: CancelBundleTask
s@CancelBundleTask' {} Maybe Bool
a -> CancelBundleTask
s {$sel:dryRun:CancelBundleTask' :: Maybe Bool
dryRun = Maybe Bool
a} :: CancelBundleTask)
cancelBundleTask_bundleId :: Lens.Lens' CancelBundleTask Prelude.Text
cancelBundleTask_bundleId :: Lens' CancelBundleTask Text
cancelBundleTask_bundleId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelBundleTask' {Text
bundleId :: Text
$sel:bundleId:CancelBundleTask' :: CancelBundleTask -> Text
bundleId} -> Text
bundleId) (\s :: CancelBundleTask
s@CancelBundleTask' {} Text
a -> CancelBundleTask
s {$sel:bundleId:CancelBundleTask' :: Text
bundleId = Text
a} :: CancelBundleTask)
instance Core.AWSRequest CancelBundleTask where
type
AWSResponse CancelBundleTask =
CancelBundleTaskResponse
request :: (Service -> Service)
-> CancelBundleTask -> Request CancelBundleTask
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 CancelBundleTask
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CancelBundleTask)))
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 BundleTask -> Int -> CancelBundleTaskResponse
CancelBundleTaskResponse'
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
"bundleInstanceTask")
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 CancelBundleTask where
hashWithSalt :: Int -> CancelBundleTask -> Int
hashWithSalt Int
_salt CancelBundleTask' {Maybe Bool
Text
bundleId :: Text
dryRun :: Maybe Bool
$sel:bundleId:CancelBundleTask' :: CancelBundleTask -> Text
$sel:dryRun:CancelBundleTask' :: CancelBundleTask -> 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` Text
bundleId
instance Prelude.NFData CancelBundleTask where
rnf :: CancelBundleTask -> ()
rnf CancelBundleTask' {Maybe Bool
Text
bundleId :: Text
dryRun :: Maybe Bool
$sel:bundleId:CancelBundleTask' :: CancelBundleTask -> Text
$sel:dryRun:CancelBundleTask' :: CancelBundleTask -> 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 Text
bundleId
instance Data.ToHeaders CancelBundleTask where
toHeaders :: CancelBundleTask -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath CancelBundleTask where
toPath :: CancelBundleTask -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CancelBundleTask where
toQuery :: CancelBundleTask -> QueryString
toQuery CancelBundleTask' {Maybe Bool
Text
bundleId :: Text
dryRun :: Maybe Bool
$sel:bundleId:CancelBundleTask' :: CancelBundleTask -> Text
$sel:dryRun:CancelBundleTask' :: CancelBundleTask -> Maybe Bool
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"CancelBundleTask" :: 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
"BundleId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
bundleId
]
data CancelBundleTaskResponse = CancelBundleTaskResponse'
{
CancelBundleTaskResponse -> Maybe BundleTask
bundleTask :: Prelude.Maybe BundleTask,
CancelBundleTaskResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CancelBundleTaskResponse -> CancelBundleTaskResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelBundleTaskResponse -> CancelBundleTaskResponse -> Bool
$c/= :: CancelBundleTaskResponse -> CancelBundleTaskResponse -> Bool
== :: CancelBundleTaskResponse -> CancelBundleTaskResponse -> Bool
$c== :: CancelBundleTaskResponse -> CancelBundleTaskResponse -> Bool
Prelude.Eq, ReadPrec [CancelBundleTaskResponse]
ReadPrec CancelBundleTaskResponse
Int -> ReadS CancelBundleTaskResponse
ReadS [CancelBundleTaskResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelBundleTaskResponse]
$creadListPrec :: ReadPrec [CancelBundleTaskResponse]
readPrec :: ReadPrec CancelBundleTaskResponse
$creadPrec :: ReadPrec CancelBundleTaskResponse
readList :: ReadS [CancelBundleTaskResponse]
$creadList :: ReadS [CancelBundleTaskResponse]
readsPrec :: Int -> ReadS CancelBundleTaskResponse
$creadsPrec :: Int -> ReadS CancelBundleTaskResponse
Prelude.Read, Int -> CancelBundleTaskResponse -> ShowS
[CancelBundleTaskResponse] -> ShowS
CancelBundleTaskResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelBundleTaskResponse] -> ShowS
$cshowList :: [CancelBundleTaskResponse] -> ShowS
show :: CancelBundleTaskResponse -> String
$cshow :: CancelBundleTaskResponse -> String
showsPrec :: Int -> CancelBundleTaskResponse -> ShowS
$cshowsPrec :: Int -> CancelBundleTaskResponse -> ShowS
Prelude.Show, forall x.
Rep CancelBundleTaskResponse x -> CancelBundleTaskResponse
forall x.
CancelBundleTaskResponse -> Rep CancelBundleTaskResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CancelBundleTaskResponse x -> CancelBundleTaskResponse
$cfrom :: forall x.
CancelBundleTaskResponse -> Rep CancelBundleTaskResponse x
Prelude.Generic)
newCancelBundleTaskResponse ::
Prelude.Int ->
CancelBundleTaskResponse
newCancelBundleTaskResponse :: Int -> CancelBundleTaskResponse
newCancelBundleTaskResponse Int
pHttpStatus_ =
CancelBundleTaskResponse'
{ $sel:bundleTask:CancelBundleTaskResponse' :: Maybe BundleTask
bundleTask =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CancelBundleTaskResponse' :: Int
httpStatus = Int
pHttpStatus_
}
cancelBundleTaskResponse_bundleTask :: Lens.Lens' CancelBundleTaskResponse (Prelude.Maybe BundleTask)
cancelBundleTaskResponse_bundleTask :: Lens' CancelBundleTaskResponse (Maybe BundleTask)
cancelBundleTaskResponse_bundleTask = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelBundleTaskResponse' {Maybe BundleTask
bundleTask :: Maybe BundleTask
$sel:bundleTask:CancelBundleTaskResponse' :: CancelBundleTaskResponse -> Maybe BundleTask
bundleTask} -> Maybe BundleTask
bundleTask) (\s :: CancelBundleTaskResponse
s@CancelBundleTaskResponse' {} Maybe BundleTask
a -> CancelBundleTaskResponse
s {$sel:bundleTask:CancelBundleTaskResponse' :: Maybe BundleTask
bundleTask = Maybe BundleTask
a} :: CancelBundleTaskResponse)
cancelBundleTaskResponse_httpStatus :: Lens.Lens' CancelBundleTaskResponse Prelude.Int
cancelBundleTaskResponse_httpStatus :: Lens' CancelBundleTaskResponse Int
cancelBundleTaskResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelBundleTaskResponse' {Int
httpStatus :: Int
$sel:httpStatus:CancelBundleTaskResponse' :: CancelBundleTaskResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CancelBundleTaskResponse
s@CancelBundleTaskResponse' {} Int
a -> CancelBundleTaskResponse
s {$sel:httpStatus:CancelBundleTaskResponse' :: Int
httpStatus = Int
a} :: CancelBundleTaskResponse)
instance Prelude.NFData CancelBundleTaskResponse where
rnf :: CancelBundleTaskResponse -> ()
rnf CancelBundleTaskResponse' {Int
Maybe BundleTask
httpStatus :: Int
bundleTask :: Maybe BundleTask
$sel:httpStatus:CancelBundleTaskResponse' :: CancelBundleTaskResponse -> Int
$sel:bundleTask:CancelBundleTaskResponse' :: CancelBundleTaskResponse -> Maybe BundleTask
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe BundleTask
bundleTask
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus