{-# 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.CreateDiskSnapshot
(
CreateDiskSnapshot (..),
newCreateDiskSnapshot,
createDiskSnapshot_diskName,
createDiskSnapshot_instanceName,
createDiskSnapshot_tags,
createDiskSnapshot_diskSnapshotName,
CreateDiskSnapshotResponse (..),
newCreateDiskSnapshotResponse,
createDiskSnapshotResponse_operations,
createDiskSnapshotResponse_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 CreateDiskSnapshot = CreateDiskSnapshot'
{
CreateDiskSnapshot -> Maybe Text
diskName :: Prelude.Maybe Prelude.Text,
CreateDiskSnapshot -> Maybe Text
instanceName :: Prelude.Maybe Prelude.Text,
CreateDiskSnapshot -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateDiskSnapshot -> Text
diskSnapshotName :: Prelude.Text
}
deriving (CreateDiskSnapshot -> CreateDiskSnapshot -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDiskSnapshot -> CreateDiskSnapshot -> Bool
$c/= :: CreateDiskSnapshot -> CreateDiskSnapshot -> Bool
== :: CreateDiskSnapshot -> CreateDiskSnapshot -> Bool
$c== :: CreateDiskSnapshot -> CreateDiskSnapshot -> Bool
Prelude.Eq, ReadPrec [CreateDiskSnapshot]
ReadPrec CreateDiskSnapshot
Int -> ReadS CreateDiskSnapshot
ReadS [CreateDiskSnapshot]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDiskSnapshot]
$creadListPrec :: ReadPrec [CreateDiskSnapshot]
readPrec :: ReadPrec CreateDiskSnapshot
$creadPrec :: ReadPrec CreateDiskSnapshot
readList :: ReadS [CreateDiskSnapshot]
$creadList :: ReadS [CreateDiskSnapshot]
readsPrec :: Int -> ReadS CreateDiskSnapshot
$creadsPrec :: Int -> ReadS CreateDiskSnapshot
Prelude.Read, Int -> CreateDiskSnapshot -> ShowS
[CreateDiskSnapshot] -> ShowS
CreateDiskSnapshot -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDiskSnapshot] -> ShowS
$cshowList :: [CreateDiskSnapshot] -> ShowS
show :: CreateDiskSnapshot -> String
$cshow :: CreateDiskSnapshot -> String
showsPrec :: Int -> CreateDiskSnapshot -> ShowS
$cshowsPrec :: Int -> CreateDiskSnapshot -> ShowS
Prelude.Show, forall x. Rep CreateDiskSnapshot x -> CreateDiskSnapshot
forall x. CreateDiskSnapshot -> Rep CreateDiskSnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDiskSnapshot x -> CreateDiskSnapshot
$cfrom :: forall x. CreateDiskSnapshot -> Rep CreateDiskSnapshot x
Prelude.Generic)
newCreateDiskSnapshot ::
Prelude.Text ->
CreateDiskSnapshot
newCreateDiskSnapshot :: Text -> CreateDiskSnapshot
newCreateDiskSnapshot Text
pDiskSnapshotName_ =
CreateDiskSnapshot'
{ $sel:diskName:CreateDiskSnapshot' :: Maybe Text
diskName = forall a. Maybe a
Prelude.Nothing,
$sel:instanceName:CreateDiskSnapshot' :: Maybe Text
instanceName = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateDiskSnapshot' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:diskSnapshotName:CreateDiskSnapshot' :: Text
diskSnapshotName = Text
pDiskSnapshotName_
}
createDiskSnapshot_diskName :: Lens.Lens' CreateDiskSnapshot (Prelude.Maybe Prelude.Text)
createDiskSnapshot_diskName :: Lens' CreateDiskSnapshot (Maybe Text)
createDiskSnapshot_diskName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDiskSnapshot' {Maybe Text
diskName :: Maybe Text
$sel:diskName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe Text
diskName} -> Maybe Text
diskName) (\s :: CreateDiskSnapshot
s@CreateDiskSnapshot' {} Maybe Text
a -> CreateDiskSnapshot
s {$sel:diskName:CreateDiskSnapshot' :: Maybe Text
diskName = Maybe Text
a} :: CreateDiskSnapshot)
createDiskSnapshot_instanceName :: Lens.Lens' CreateDiskSnapshot (Prelude.Maybe Prelude.Text)
createDiskSnapshot_instanceName :: Lens' CreateDiskSnapshot (Maybe Text)
createDiskSnapshot_instanceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDiskSnapshot' {Maybe Text
instanceName :: Maybe Text
$sel:instanceName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe Text
instanceName} -> Maybe Text
instanceName) (\s :: CreateDiskSnapshot
s@CreateDiskSnapshot' {} Maybe Text
a -> CreateDiskSnapshot
s {$sel:instanceName:CreateDiskSnapshot' :: Maybe Text
instanceName = Maybe Text
a} :: CreateDiskSnapshot)
createDiskSnapshot_tags :: Lens.Lens' CreateDiskSnapshot (Prelude.Maybe [Tag])
createDiskSnapshot_tags :: Lens' CreateDiskSnapshot (Maybe [Tag])
createDiskSnapshot_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDiskSnapshot' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateDiskSnapshot
s@CreateDiskSnapshot' {} Maybe [Tag]
a -> CreateDiskSnapshot
s {$sel:tags:CreateDiskSnapshot' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateDiskSnapshot) 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
createDiskSnapshot_diskSnapshotName :: Lens.Lens' CreateDiskSnapshot Prelude.Text
createDiskSnapshot_diskSnapshotName :: Lens' CreateDiskSnapshot Text
createDiskSnapshot_diskSnapshotName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDiskSnapshot' {Text
diskSnapshotName :: Text
$sel:diskSnapshotName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Text
diskSnapshotName} -> Text
diskSnapshotName) (\s :: CreateDiskSnapshot
s@CreateDiskSnapshot' {} Text
a -> CreateDiskSnapshot
s {$sel:diskSnapshotName:CreateDiskSnapshot' :: Text
diskSnapshotName = Text
a} :: CreateDiskSnapshot)
instance Core.AWSRequest CreateDiskSnapshot where
type
AWSResponse CreateDiskSnapshot =
CreateDiskSnapshotResponse
request :: (Service -> Service)
-> CreateDiskSnapshot -> Request CreateDiskSnapshot
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 CreateDiskSnapshot
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDiskSnapshot)))
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 -> CreateDiskSnapshotResponse
CreateDiskSnapshotResponse'
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 CreateDiskSnapshot where
hashWithSalt :: Int -> CreateDiskSnapshot -> Int
hashWithSalt Int
_salt CreateDiskSnapshot' {Maybe [Tag]
Maybe Text
Text
diskSnapshotName :: Text
tags :: Maybe [Tag]
instanceName :: Maybe Text
diskName :: Maybe Text
$sel:diskSnapshotName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Text
$sel:tags:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe [Tag]
$sel:instanceName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe Text
$sel:diskName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
diskName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
instanceName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
diskSnapshotName
instance Prelude.NFData CreateDiskSnapshot where
rnf :: CreateDiskSnapshot -> ()
rnf CreateDiskSnapshot' {Maybe [Tag]
Maybe Text
Text
diskSnapshotName :: Text
tags :: Maybe [Tag]
instanceName :: Maybe Text
diskName :: Maybe Text
$sel:diskSnapshotName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Text
$sel:tags:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe [Tag]
$sel:instanceName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe Text
$sel:diskName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
diskName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
instanceName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
diskSnapshotName
instance Data.ToHeaders CreateDiskSnapshot where
toHeaders :: CreateDiskSnapshot -> 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.CreateDiskSnapshot" ::
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 CreateDiskSnapshot where
toJSON :: CreateDiskSnapshot -> Value
toJSON CreateDiskSnapshot' {Maybe [Tag]
Maybe Text
Text
diskSnapshotName :: Text
tags :: Maybe [Tag]
instanceName :: Maybe Text
diskName :: Maybe Text
$sel:diskSnapshotName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Text
$sel:tags:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe [Tag]
$sel:instanceName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe Text
$sel:diskName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"diskName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
diskName,
(Key
"instanceName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
instanceName,
(Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
forall a. a -> Maybe a
Prelude.Just
(Key
"diskSnapshotName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
diskSnapshotName)
]
)
instance Data.ToPath CreateDiskSnapshot where
toPath :: CreateDiskSnapshot -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateDiskSnapshot where
toQuery :: CreateDiskSnapshot -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateDiskSnapshotResponse = CreateDiskSnapshotResponse'
{
CreateDiskSnapshotResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
CreateDiskSnapshotResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateDiskSnapshotResponse -> CreateDiskSnapshotResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDiskSnapshotResponse -> CreateDiskSnapshotResponse -> Bool
$c/= :: CreateDiskSnapshotResponse -> CreateDiskSnapshotResponse -> Bool
== :: CreateDiskSnapshotResponse -> CreateDiskSnapshotResponse -> Bool
$c== :: CreateDiskSnapshotResponse -> CreateDiskSnapshotResponse -> Bool
Prelude.Eq, ReadPrec [CreateDiskSnapshotResponse]
ReadPrec CreateDiskSnapshotResponse
Int -> ReadS CreateDiskSnapshotResponse
ReadS [CreateDiskSnapshotResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDiskSnapshotResponse]
$creadListPrec :: ReadPrec [CreateDiskSnapshotResponse]
readPrec :: ReadPrec CreateDiskSnapshotResponse
$creadPrec :: ReadPrec CreateDiskSnapshotResponse
readList :: ReadS [CreateDiskSnapshotResponse]
$creadList :: ReadS [CreateDiskSnapshotResponse]
readsPrec :: Int -> ReadS CreateDiskSnapshotResponse
$creadsPrec :: Int -> ReadS CreateDiskSnapshotResponse
Prelude.Read, Int -> CreateDiskSnapshotResponse -> ShowS
[CreateDiskSnapshotResponse] -> ShowS
CreateDiskSnapshotResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDiskSnapshotResponse] -> ShowS
$cshowList :: [CreateDiskSnapshotResponse] -> ShowS
show :: CreateDiskSnapshotResponse -> String
$cshow :: CreateDiskSnapshotResponse -> String
showsPrec :: Int -> CreateDiskSnapshotResponse -> ShowS
$cshowsPrec :: Int -> CreateDiskSnapshotResponse -> ShowS
Prelude.Show, forall x.
Rep CreateDiskSnapshotResponse x -> CreateDiskSnapshotResponse
forall x.
CreateDiskSnapshotResponse -> Rep CreateDiskSnapshotResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDiskSnapshotResponse x -> CreateDiskSnapshotResponse
$cfrom :: forall x.
CreateDiskSnapshotResponse -> Rep CreateDiskSnapshotResponse x
Prelude.Generic)
newCreateDiskSnapshotResponse ::
Prelude.Int ->
CreateDiskSnapshotResponse
newCreateDiskSnapshotResponse :: Int -> CreateDiskSnapshotResponse
newCreateDiskSnapshotResponse Int
pHttpStatus_ =
CreateDiskSnapshotResponse'
{ $sel:operations:CreateDiskSnapshotResponse' :: Maybe [Operation]
operations =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateDiskSnapshotResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createDiskSnapshotResponse_operations :: Lens.Lens' CreateDiskSnapshotResponse (Prelude.Maybe [Operation])
createDiskSnapshotResponse_operations :: Lens' CreateDiskSnapshotResponse (Maybe [Operation])
createDiskSnapshotResponse_operations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDiskSnapshotResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:CreateDiskSnapshotResponse' :: CreateDiskSnapshotResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: CreateDiskSnapshotResponse
s@CreateDiskSnapshotResponse' {} Maybe [Operation]
a -> CreateDiskSnapshotResponse
s {$sel:operations:CreateDiskSnapshotResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: CreateDiskSnapshotResponse) 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
createDiskSnapshotResponse_httpStatus :: Lens.Lens' CreateDiskSnapshotResponse Prelude.Int
createDiskSnapshotResponse_httpStatus :: Lens' CreateDiskSnapshotResponse Int
createDiskSnapshotResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDiskSnapshotResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDiskSnapshotResponse' :: CreateDiskSnapshotResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDiskSnapshotResponse
s@CreateDiskSnapshotResponse' {} Int
a -> CreateDiskSnapshotResponse
s {$sel:httpStatus:CreateDiskSnapshotResponse' :: Int
httpStatus = Int
a} :: CreateDiskSnapshotResponse)
instance Prelude.NFData CreateDiskSnapshotResponse where
rnf :: CreateDiskSnapshotResponse -> ()
rnf CreateDiskSnapshotResponse' {Int
Maybe [Operation]
httpStatus :: Int
operations :: Maybe [Operation]
$sel:httpStatus:CreateDiskSnapshotResponse' :: CreateDiskSnapshotResponse -> Int
$sel:operations:CreateDiskSnapshotResponse' :: CreateDiskSnapshotResponse -> 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