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