{-# 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.Route53.CreateHealthCheck
(
CreateHealthCheck (..),
newCreateHealthCheck,
createHealthCheck_callerReference,
createHealthCheck_healthCheckConfig,
CreateHealthCheckResponse (..),
newCreateHealthCheckResponse,
createHealthCheckResponse_httpStatus,
createHealthCheckResponse_healthCheck,
createHealthCheckResponse_location,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Route53.Types
data CreateHealthCheck = CreateHealthCheck'
{
CreateHealthCheck -> Text
callerReference :: Prelude.Text,
CreateHealthCheck -> HealthCheckConfig
healthCheckConfig :: HealthCheckConfig
}
deriving (CreateHealthCheck -> CreateHealthCheck -> Bool
(CreateHealthCheck -> CreateHealthCheck -> Bool)
-> (CreateHealthCheck -> CreateHealthCheck -> Bool)
-> Eq CreateHealthCheck
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateHealthCheck -> CreateHealthCheck -> Bool
$c/= :: CreateHealthCheck -> CreateHealthCheck -> Bool
== :: CreateHealthCheck -> CreateHealthCheck -> Bool
$c== :: CreateHealthCheck -> CreateHealthCheck -> Bool
Prelude.Eq, ReadPrec [CreateHealthCheck]
ReadPrec CreateHealthCheck
Int -> ReadS CreateHealthCheck
ReadS [CreateHealthCheck]
(Int -> ReadS CreateHealthCheck)
-> ReadS [CreateHealthCheck]
-> ReadPrec CreateHealthCheck
-> ReadPrec [CreateHealthCheck]
-> Read CreateHealthCheck
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateHealthCheck]
$creadListPrec :: ReadPrec [CreateHealthCheck]
readPrec :: ReadPrec CreateHealthCheck
$creadPrec :: ReadPrec CreateHealthCheck
readList :: ReadS [CreateHealthCheck]
$creadList :: ReadS [CreateHealthCheck]
readsPrec :: Int -> ReadS CreateHealthCheck
$creadsPrec :: Int -> ReadS CreateHealthCheck
Prelude.Read, Int -> CreateHealthCheck -> ShowS
[CreateHealthCheck] -> ShowS
CreateHealthCheck -> String
(Int -> CreateHealthCheck -> ShowS)
-> (CreateHealthCheck -> String)
-> ([CreateHealthCheck] -> ShowS)
-> Show CreateHealthCheck
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateHealthCheck] -> ShowS
$cshowList :: [CreateHealthCheck] -> ShowS
show :: CreateHealthCheck -> String
$cshow :: CreateHealthCheck -> String
showsPrec :: Int -> CreateHealthCheck -> ShowS
$cshowsPrec :: Int -> CreateHealthCheck -> ShowS
Prelude.Show, (forall x. CreateHealthCheck -> Rep CreateHealthCheck x)
-> (forall x. Rep CreateHealthCheck x -> CreateHealthCheck)
-> Generic CreateHealthCheck
forall x. Rep CreateHealthCheck x -> CreateHealthCheck
forall x. CreateHealthCheck -> Rep CreateHealthCheck x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateHealthCheck x -> CreateHealthCheck
$cfrom :: forall x. CreateHealthCheck -> Rep CreateHealthCheck x
Prelude.Generic)
newCreateHealthCheck ::
Prelude.Text ->
HealthCheckConfig ->
CreateHealthCheck
newCreateHealthCheck :: Text -> HealthCheckConfig -> CreateHealthCheck
newCreateHealthCheck
Text
pCallerReference_
HealthCheckConfig
pHealthCheckConfig_ =
CreateHealthCheck' :: Text -> HealthCheckConfig -> CreateHealthCheck
CreateHealthCheck'
{ $sel:callerReference:CreateHealthCheck' :: Text
callerReference =
Text
pCallerReference_,
$sel:healthCheckConfig:CreateHealthCheck' :: HealthCheckConfig
healthCheckConfig = HealthCheckConfig
pHealthCheckConfig_
}
createHealthCheck_callerReference :: Lens.Lens' CreateHealthCheck Prelude.Text
createHealthCheck_callerReference :: (Text -> f Text) -> CreateHealthCheck -> f CreateHealthCheck
createHealthCheck_callerReference = (CreateHealthCheck -> Text)
-> (CreateHealthCheck -> Text -> CreateHealthCheck)
-> Lens CreateHealthCheck CreateHealthCheck Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHealthCheck' {Text
callerReference :: Text
$sel:callerReference:CreateHealthCheck' :: CreateHealthCheck -> Text
callerReference} -> Text
callerReference) (\s :: CreateHealthCheck
s@CreateHealthCheck' {} Text
a -> CreateHealthCheck
s {$sel:callerReference:CreateHealthCheck' :: Text
callerReference = Text
a} :: CreateHealthCheck)
createHealthCheck_healthCheckConfig :: Lens.Lens' CreateHealthCheck HealthCheckConfig
createHealthCheck_healthCheckConfig :: (HealthCheckConfig -> f HealthCheckConfig)
-> CreateHealthCheck -> f CreateHealthCheck
createHealthCheck_healthCheckConfig = (CreateHealthCheck -> HealthCheckConfig)
-> (CreateHealthCheck -> HealthCheckConfig -> CreateHealthCheck)
-> Lens
CreateHealthCheck
CreateHealthCheck
HealthCheckConfig
HealthCheckConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHealthCheck' {HealthCheckConfig
healthCheckConfig :: HealthCheckConfig
$sel:healthCheckConfig:CreateHealthCheck' :: CreateHealthCheck -> HealthCheckConfig
healthCheckConfig} -> HealthCheckConfig
healthCheckConfig) (\s :: CreateHealthCheck
s@CreateHealthCheck' {} HealthCheckConfig
a -> CreateHealthCheck
s {$sel:healthCheckConfig:CreateHealthCheck' :: HealthCheckConfig
healthCheckConfig = HealthCheckConfig
a} :: CreateHealthCheck)
instance Core.AWSRequest CreateHealthCheck where
type
AWSResponse CreateHealthCheck =
CreateHealthCheckResponse
request :: CreateHealthCheck -> Request CreateHealthCheck
request = Service -> CreateHealthCheck -> Request CreateHealthCheck
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.postXML Service
defaultService
response :: Logger
-> Service
-> Proxy CreateHealthCheck
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateHealthCheck)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateHealthCheck))
-> Logger
-> Service
-> Proxy CreateHealthCheck
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateHealthCheck)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> HealthCheck -> Text -> CreateHealthCheckResponse
CreateHealthCheckResponse'
(Int -> HealthCheck -> Text -> CreateHealthCheckResponse)
-> Either String Int
-> Either String (HealthCheck -> Text -> CreateHealthCheckResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (HealthCheck -> Text -> CreateHealthCheckResponse)
-> Either String HealthCheck
-> Either String (Text -> CreateHealthCheckResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String HealthCheck
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"HealthCheck")
Either String (Text -> CreateHealthCheckResponse)
-> Either String Text -> Either String CreateHealthCheckResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (ResponseHeaders
h ResponseHeaders -> HeaderName -> Either String Text
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String a
Core..# HeaderName
"Location")
)
instance Prelude.Hashable CreateHealthCheck
instance Prelude.NFData CreateHealthCheck
instance Core.ToElement CreateHealthCheck where
toElement :: CreateHealthCheck -> Element
toElement =
Name -> CreateHealthCheck -> Element
forall a. ToXML a => Name -> a -> Element
Core.mkElement
Name
"{https://route53.amazonaws.com/doc/2013-04-01/}CreateHealthCheckRequest"
instance Core.ToHeaders CreateHealthCheck where
toHeaders :: CreateHealthCheck -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateHealthCheck -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateHealthCheck where
toPath :: CreateHealthCheck -> ByteString
toPath = ByteString -> CreateHealthCheck -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2013-04-01/healthcheck"
instance Core.ToQuery CreateHealthCheck where
toQuery :: CreateHealthCheck -> QueryString
toQuery = QueryString -> CreateHealthCheck -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
instance Core.ToXML CreateHealthCheck where
toXML :: CreateHealthCheck -> XML
toXML CreateHealthCheck' {Text
HealthCheckConfig
healthCheckConfig :: HealthCheckConfig
callerReference :: Text
$sel:healthCheckConfig:CreateHealthCheck' :: CreateHealthCheck -> HealthCheckConfig
$sel:callerReference:CreateHealthCheck' :: CreateHealthCheck -> Text
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"CallerReference" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
callerReference,
Name
"HealthCheckConfig" Name -> HealthCheckConfig -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= HealthCheckConfig
healthCheckConfig
]
data CreateHealthCheckResponse = CreateHealthCheckResponse'
{
CreateHealthCheckResponse -> Int
httpStatus :: Prelude.Int,
CreateHealthCheckResponse -> HealthCheck
healthCheck :: HealthCheck,
CreateHealthCheckResponse -> Text
location :: Prelude.Text
}
deriving (CreateHealthCheckResponse -> CreateHealthCheckResponse -> Bool
(CreateHealthCheckResponse -> CreateHealthCheckResponse -> Bool)
-> (CreateHealthCheckResponse -> CreateHealthCheckResponse -> Bool)
-> Eq CreateHealthCheckResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateHealthCheckResponse -> CreateHealthCheckResponse -> Bool
$c/= :: CreateHealthCheckResponse -> CreateHealthCheckResponse -> Bool
== :: CreateHealthCheckResponse -> CreateHealthCheckResponse -> Bool
$c== :: CreateHealthCheckResponse -> CreateHealthCheckResponse -> Bool
Prelude.Eq, ReadPrec [CreateHealthCheckResponse]
ReadPrec CreateHealthCheckResponse
Int -> ReadS CreateHealthCheckResponse
ReadS [CreateHealthCheckResponse]
(Int -> ReadS CreateHealthCheckResponse)
-> ReadS [CreateHealthCheckResponse]
-> ReadPrec CreateHealthCheckResponse
-> ReadPrec [CreateHealthCheckResponse]
-> Read CreateHealthCheckResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateHealthCheckResponse]
$creadListPrec :: ReadPrec [CreateHealthCheckResponse]
readPrec :: ReadPrec CreateHealthCheckResponse
$creadPrec :: ReadPrec CreateHealthCheckResponse
readList :: ReadS [CreateHealthCheckResponse]
$creadList :: ReadS [CreateHealthCheckResponse]
readsPrec :: Int -> ReadS CreateHealthCheckResponse
$creadsPrec :: Int -> ReadS CreateHealthCheckResponse
Prelude.Read, Int -> CreateHealthCheckResponse -> ShowS
[CreateHealthCheckResponse] -> ShowS
CreateHealthCheckResponse -> String
(Int -> CreateHealthCheckResponse -> ShowS)
-> (CreateHealthCheckResponse -> String)
-> ([CreateHealthCheckResponse] -> ShowS)
-> Show CreateHealthCheckResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateHealthCheckResponse] -> ShowS
$cshowList :: [CreateHealthCheckResponse] -> ShowS
show :: CreateHealthCheckResponse -> String
$cshow :: CreateHealthCheckResponse -> String
showsPrec :: Int -> CreateHealthCheckResponse -> ShowS
$cshowsPrec :: Int -> CreateHealthCheckResponse -> ShowS
Prelude.Show, (forall x.
CreateHealthCheckResponse -> Rep CreateHealthCheckResponse x)
-> (forall x.
Rep CreateHealthCheckResponse x -> CreateHealthCheckResponse)
-> Generic CreateHealthCheckResponse
forall x.
Rep CreateHealthCheckResponse x -> CreateHealthCheckResponse
forall x.
CreateHealthCheckResponse -> Rep CreateHealthCheckResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateHealthCheckResponse x -> CreateHealthCheckResponse
$cfrom :: forall x.
CreateHealthCheckResponse -> Rep CreateHealthCheckResponse x
Prelude.Generic)
newCreateHealthCheckResponse ::
Prelude.Int ->
HealthCheck ->
Prelude.Text ->
CreateHealthCheckResponse
newCreateHealthCheckResponse :: Int -> HealthCheck -> Text -> CreateHealthCheckResponse
newCreateHealthCheckResponse
Int
pHttpStatus_
HealthCheck
pHealthCheck_
Text
pLocation_ =
CreateHealthCheckResponse' :: Int -> HealthCheck -> Text -> CreateHealthCheckResponse
CreateHealthCheckResponse'
{ $sel:httpStatus:CreateHealthCheckResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:healthCheck:CreateHealthCheckResponse' :: HealthCheck
healthCheck = HealthCheck
pHealthCheck_,
$sel:location:CreateHealthCheckResponse' :: Text
location = Text
pLocation_
}
createHealthCheckResponse_httpStatus :: Lens.Lens' CreateHealthCheckResponse Prelude.Int
createHealthCheckResponse_httpStatus :: (Int -> f Int)
-> CreateHealthCheckResponse -> f CreateHealthCheckResponse
createHealthCheckResponse_httpStatus = (CreateHealthCheckResponse -> Int)
-> (CreateHealthCheckResponse -> Int -> CreateHealthCheckResponse)
-> Lens CreateHealthCheckResponse CreateHealthCheckResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHealthCheckResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateHealthCheckResponse' :: CreateHealthCheckResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateHealthCheckResponse
s@CreateHealthCheckResponse' {} Int
a -> CreateHealthCheckResponse
s {$sel:httpStatus:CreateHealthCheckResponse' :: Int
httpStatus = Int
a} :: CreateHealthCheckResponse)
createHealthCheckResponse_healthCheck :: Lens.Lens' CreateHealthCheckResponse HealthCheck
createHealthCheckResponse_healthCheck :: (HealthCheck -> f HealthCheck)
-> CreateHealthCheckResponse -> f CreateHealthCheckResponse
createHealthCheckResponse_healthCheck = (CreateHealthCheckResponse -> HealthCheck)
-> (CreateHealthCheckResponse
-> HealthCheck -> CreateHealthCheckResponse)
-> Lens
CreateHealthCheckResponse
CreateHealthCheckResponse
HealthCheck
HealthCheck
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHealthCheckResponse' {HealthCheck
healthCheck :: HealthCheck
$sel:healthCheck:CreateHealthCheckResponse' :: CreateHealthCheckResponse -> HealthCheck
healthCheck} -> HealthCheck
healthCheck) (\s :: CreateHealthCheckResponse
s@CreateHealthCheckResponse' {} HealthCheck
a -> CreateHealthCheckResponse
s {$sel:healthCheck:CreateHealthCheckResponse' :: HealthCheck
healthCheck = HealthCheck
a} :: CreateHealthCheckResponse)
createHealthCheckResponse_location :: Lens.Lens' CreateHealthCheckResponse Prelude.Text
createHealthCheckResponse_location :: (Text -> f Text)
-> CreateHealthCheckResponse -> f CreateHealthCheckResponse
createHealthCheckResponse_location = (CreateHealthCheckResponse -> Text)
-> (CreateHealthCheckResponse -> Text -> CreateHealthCheckResponse)
-> Lens
CreateHealthCheckResponse CreateHealthCheckResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHealthCheckResponse' {Text
location :: Text
$sel:location:CreateHealthCheckResponse' :: CreateHealthCheckResponse -> Text
location} -> Text
location) (\s :: CreateHealthCheckResponse
s@CreateHealthCheckResponse' {} Text
a -> CreateHealthCheckResponse
s {$sel:location:CreateHealthCheckResponse' :: Text
location = Text
a} :: CreateHealthCheckResponse)
instance Prelude.NFData CreateHealthCheckResponse