{-# 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.OpsWorksCM.StartMaintenance
(
StartMaintenance (..),
newStartMaintenance,
startMaintenance_engineAttributes,
startMaintenance_serverName,
StartMaintenanceResponse (..),
newStartMaintenanceResponse,
startMaintenanceResponse_server,
startMaintenanceResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorksCM.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data StartMaintenance = StartMaintenance'
{
StartMaintenance -> Maybe [EngineAttribute]
engineAttributes :: Prelude.Maybe [EngineAttribute],
StartMaintenance -> Text
serverName :: Prelude.Text
}
deriving (StartMaintenance -> StartMaintenance -> Bool
(StartMaintenance -> StartMaintenance -> Bool)
-> (StartMaintenance -> StartMaintenance -> Bool)
-> Eq StartMaintenance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartMaintenance -> StartMaintenance -> Bool
$c/= :: StartMaintenance -> StartMaintenance -> Bool
== :: StartMaintenance -> StartMaintenance -> Bool
$c== :: StartMaintenance -> StartMaintenance -> Bool
Prelude.Eq, Int -> StartMaintenance -> ShowS
[StartMaintenance] -> ShowS
StartMaintenance -> String
(Int -> StartMaintenance -> ShowS)
-> (StartMaintenance -> String)
-> ([StartMaintenance] -> ShowS)
-> Show StartMaintenance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartMaintenance] -> ShowS
$cshowList :: [StartMaintenance] -> ShowS
show :: StartMaintenance -> String
$cshow :: StartMaintenance -> String
showsPrec :: Int -> StartMaintenance -> ShowS
$cshowsPrec :: Int -> StartMaintenance -> ShowS
Prelude.Show, (forall x. StartMaintenance -> Rep StartMaintenance x)
-> (forall x. Rep StartMaintenance x -> StartMaintenance)
-> Generic StartMaintenance
forall x. Rep StartMaintenance x -> StartMaintenance
forall x. StartMaintenance -> Rep StartMaintenance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartMaintenance x -> StartMaintenance
$cfrom :: forall x. StartMaintenance -> Rep StartMaintenance x
Prelude.Generic)
newStartMaintenance ::
Prelude.Text ->
StartMaintenance
newStartMaintenance :: Text -> StartMaintenance
newStartMaintenance Text
pServerName_ =
StartMaintenance' :: Maybe [EngineAttribute] -> Text -> StartMaintenance
StartMaintenance'
{ $sel:engineAttributes:StartMaintenance' :: Maybe [EngineAttribute]
engineAttributes =
Maybe [EngineAttribute]
forall a. Maybe a
Prelude.Nothing,
$sel:serverName:StartMaintenance' :: Text
serverName = Text
pServerName_
}
startMaintenance_engineAttributes :: Lens.Lens' StartMaintenance (Prelude.Maybe [EngineAttribute])
startMaintenance_engineAttributes :: (Maybe [EngineAttribute] -> f (Maybe [EngineAttribute]))
-> StartMaintenance -> f StartMaintenance
startMaintenance_engineAttributes = (StartMaintenance -> Maybe [EngineAttribute])
-> (StartMaintenance
-> Maybe [EngineAttribute] -> StartMaintenance)
-> Lens
StartMaintenance
StartMaintenance
(Maybe [EngineAttribute])
(Maybe [EngineAttribute])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMaintenance' {Maybe [EngineAttribute]
engineAttributes :: Maybe [EngineAttribute]
$sel:engineAttributes:StartMaintenance' :: StartMaintenance -> Maybe [EngineAttribute]
engineAttributes} -> Maybe [EngineAttribute]
engineAttributes) (\s :: StartMaintenance
s@StartMaintenance' {} Maybe [EngineAttribute]
a -> StartMaintenance
s {$sel:engineAttributes:StartMaintenance' :: Maybe [EngineAttribute]
engineAttributes = Maybe [EngineAttribute]
a} :: StartMaintenance) ((Maybe [EngineAttribute] -> f (Maybe [EngineAttribute]))
-> StartMaintenance -> f StartMaintenance)
-> ((Maybe [EngineAttribute] -> f (Maybe [EngineAttribute]))
-> Maybe [EngineAttribute] -> f (Maybe [EngineAttribute]))
-> (Maybe [EngineAttribute] -> f (Maybe [EngineAttribute]))
-> StartMaintenance
-> f StartMaintenance
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[EngineAttribute]
[EngineAttribute]
[EngineAttribute]
[EngineAttribute]
-> Iso
(Maybe [EngineAttribute])
(Maybe [EngineAttribute])
(Maybe [EngineAttribute])
(Maybe [EngineAttribute])
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
[EngineAttribute]
[EngineAttribute]
[EngineAttribute]
[EngineAttribute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
startMaintenance_serverName :: Lens.Lens' StartMaintenance Prelude.Text
startMaintenance_serverName :: (Text -> f Text) -> StartMaintenance -> f StartMaintenance
startMaintenance_serverName = (StartMaintenance -> Text)
-> (StartMaintenance -> Text -> StartMaintenance)
-> Lens StartMaintenance StartMaintenance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMaintenance' {Text
serverName :: Text
$sel:serverName:StartMaintenance' :: StartMaintenance -> Text
serverName} -> Text
serverName) (\s :: StartMaintenance
s@StartMaintenance' {} Text
a -> StartMaintenance
s {$sel:serverName:StartMaintenance' :: Text
serverName = Text
a} :: StartMaintenance)
instance Core.AWSRequest StartMaintenance where
type
AWSResponse StartMaintenance =
StartMaintenanceResponse
request :: StartMaintenance -> Request StartMaintenance
request = Service -> StartMaintenance -> Request StartMaintenance
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartMaintenance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartMaintenance)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartMaintenance))
-> Logger
-> Service
-> Proxy StartMaintenance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartMaintenance)))
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 Server -> Int -> StartMaintenanceResponse
StartMaintenanceResponse'
(Maybe Server -> Int -> StartMaintenanceResponse)
-> Either String (Maybe Server)
-> Either String (Int -> StartMaintenanceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Server)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Server")
Either String (Int -> StartMaintenanceResponse)
-> Either String Int -> Either String StartMaintenanceResponse
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 StartMaintenance
instance Prelude.NFData StartMaintenance
instance Core.ToHeaders StartMaintenance where
toHeaders :: StartMaintenance -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartMaintenance -> 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
"OpsWorksCM_V2016_11_01.StartMaintenance" ::
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 StartMaintenance where
toJSON :: StartMaintenance -> Value
toJSON StartMaintenance' {Maybe [EngineAttribute]
Text
serverName :: Text
engineAttributes :: Maybe [EngineAttribute]
$sel:serverName:StartMaintenance' :: StartMaintenance -> Text
$sel:engineAttributes:StartMaintenance' :: StartMaintenance -> Maybe [EngineAttribute]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"EngineAttributes" Text -> [EngineAttribute] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([EngineAttribute] -> Pair)
-> Maybe [EngineAttribute] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [EngineAttribute]
engineAttributes,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ServerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serverName)
]
)
instance Core.ToPath StartMaintenance where
toPath :: StartMaintenance -> ByteString
toPath = ByteString -> StartMaintenance -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StartMaintenance where
toQuery :: StartMaintenance -> QueryString
toQuery = QueryString -> StartMaintenance -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartMaintenanceResponse = StartMaintenanceResponse'
{
StartMaintenanceResponse -> Maybe Server
server :: Prelude.Maybe Server,
StartMaintenanceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartMaintenanceResponse -> StartMaintenanceResponse -> Bool
(StartMaintenanceResponse -> StartMaintenanceResponse -> Bool)
-> (StartMaintenanceResponse -> StartMaintenanceResponse -> Bool)
-> Eq StartMaintenanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartMaintenanceResponse -> StartMaintenanceResponse -> Bool
$c/= :: StartMaintenanceResponse -> StartMaintenanceResponse -> Bool
== :: StartMaintenanceResponse -> StartMaintenanceResponse -> Bool
$c== :: StartMaintenanceResponse -> StartMaintenanceResponse -> Bool
Prelude.Eq, Int -> StartMaintenanceResponse -> ShowS
[StartMaintenanceResponse] -> ShowS
StartMaintenanceResponse -> String
(Int -> StartMaintenanceResponse -> ShowS)
-> (StartMaintenanceResponse -> String)
-> ([StartMaintenanceResponse] -> ShowS)
-> Show StartMaintenanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartMaintenanceResponse] -> ShowS
$cshowList :: [StartMaintenanceResponse] -> ShowS
show :: StartMaintenanceResponse -> String
$cshow :: StartMaintenanceResponse -> String
showsPrec :: Int -> StartMaintenanceResponse -> ShowS
$cshowsPrec :: Int -> StartMaintenanceResponse -> ShowS
Prelude.Show, (forall x.
StartMaintenanceResponse -> Rep StartMaintenanceResponse x)
-> (forall x.
Rep StartMaintenanceResponse x -> StartMaintenanceResponse)
-> Generic StartMaintenanceResponse
forall x.
Rep StartMaintenanceResponse x -> StartMaintenanceResponse
forall x.
StartMaintenanceResponse -> Rep StartMaintenanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartMaintenanceResponse x -> StartMaintenanceResponse
$cfrom :: forall x.
StartMaintenanceResponse -> Rep StartMaintenanceResponse x
Prelude.Generic)
newStartMaintenanceResponse ::
Prelude.Int ->
StartMaintenanceResponse
newStartMaintenanceResponse :: Int -> StartMaintenanceResponse
newStartMaintenanceResponse Int
pHttpStatus_ =
StartMaintenanceResponse' :: Maybe Server -> Int -> StartMaintenanceResponse
StartMaintenanceResponse'
{ $sel:server:StartMaintenanceResponse' :: Maybe Server
server = Maybe Server
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartMaintenanceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startMaintenanceResponse_server :: Lens.Lens' StartMaintenanceResponse (Prelude.Maybe Server)
startMaintenanceResponse_server :: (Maybe Server -> f (Maybe Server))
-> StartMaintenanceResponse -> f StartMaintenanceResponse
startMaintenanceResponse_server = (StartMaintenanceResponse -> Maybe Server)
-> (StartMaintenanceResponse
-> Maybe Server -> StartMaintenanceResponse)
-> Lens
StartMaintenanceResponse
StartMaintenanceResponse
(Maybe Server)
(Maybe Server)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMaintenanceResponse' {Maybe Server
server :: Maybe Server
$sel:server:StartMaintenanceResponse' :: StartMaintenanceResponse -> Maybe Server
server} -> Maybe Server
server) (\s :: StartMaintenanceResponse
s@StartMaintenanceResponse' {} Maybe Server
a -> StartMaintenanceResponse
s {$sel:server:StartMaintenanceResponse' :: Maybe Server
server = Maybe Server
a} :: StartMaintenanceResponse)
startMaintenanceResponse_httpStatus :: Lens.Lens' StartMaintenanceResponse Prelude.Int
startMaintenanceResponse_httpStatus :: (Int -> f Int)
-> StartMaintenanceResponse -> f StartMaintenanceResponse
startMaintenanceResponse_httpStatus = (StartMaintenanceResponse -> Int)
-> (StartMaintenanceResponse -> Int -> StartMaintenanceResponse)
-> Lens StartMaintenanceResponse StartMaintenanceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMaintenanceResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartMaintenanceResponse' :: StartMaintenanceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartMaintenanceResponse
s@StartMaintenanceResponse' {} Int
a -> StartMaintenanceResponse
s {$sel:httpStatus:StartMaintenanceResponse' :: Int
httpStatus = Int
a} :: StartMaintenanceResponse)
instance Prelude.NFData StartMaintenanceResponse