{-# 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.Shield.AssociateHealthCheck
(
AssociateHealthCheck (..),
newAssociateHealthCheck,
associateHealthCheck_protectionId,
associateHealthCheck_healthCheckArn,
AssociateHealthCheckResponse (..),
newAssociateHealthCheckResponse,
associateHealthCheckResponse_httpStatus,
)
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.Shield.Types
data AssociateHealthCheck = AssociateHealthCheck'
{
AssociateHealthCheck -> Text
protectionId :: Prelude.Text,
AssociateHealthCheck -> Text
healthCheckArn :: Prelude.Text
}
deriving (AssociateHealthCheck -> AssociateHealthCheck -> Bool
(AssociateHealthCheck -> AssociateHealthCheck -> Bool)
-> (AssociateHealthCheck -> AssociateHealthCheck -> Bool)
-> Eq AssociateHealthCheck
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateHealthCheck -> AssociateHealthCheck -> Bool
$c/= :: AssociateHealthCheck -> AssociateHealthCheck -> Bool
== :: AssociateHealthCheck -> AssociateHealthCheck -> Bool
$c== :: AssociateHealthCheck -> AssociateHealthCheck -> Bool
Prelude.Eq, ReadPrec [AssociateHealthCheck]
ReadPrec AssociateHealthCheck
Int -> ReadS AssociateHealthCheck
ReadS [AssociateHealthCheck]
(Int -> ReadS AssociateHealthCheck)
-> ReadS [AssociateHealthCheck]
-> ReadPrec AssociateHealthCheck
-> ReadPrec [AssociateHealthCheck]
-> Read AssociateHealthCheck
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateHealthCheck]
$creadListPrec :: ReadPrec [AssociateHealthCheck]
readPrec :: ReadPrec AssociateHealthCheck
$creadPrec :: ReadPrec AssociateHealthCheck
readList :: ReadS [AssociateHealthCheck]
$creadList :: ReadS [AssociateHealthCheck]
readsPrec :: Int -> ReadS AssociateHealthCheck
$creadsPrec :: Int -> ReadS AssociateHealthCheck
Prelude.Read, Int -> AssociateHealthCheck -> ShowS
[AssociateHealthCheck] -> ShowS
AssociateHealthCheck -> String
(Int -> AssociateHealthCheck -> ShowS)
-> (AssociateHealthCheck -> String)
-> ([AssociateHealthCheck] -> ShowS)
-> Show AssociateHealthCheck
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateHealthCheck] -> ShowS
$cshowList :: [AssociateHealthCheck] -> ShowS
show :: AssociateHealthCheck -> String
$cshow :: AssociateHealthCheck -> String
showsPrec :: Int -> AssociateHealthCheck -> ShowS
$cshowsPrec :: Int -> AssociateHealthCheck -> ShowS
Prelude.Show, (forall x. AssociateHealthCheck -> Rep AssociateHealthCheck x)
-> (forall x. Rep AssociateHealthCheck x -> AssociateHealthCheck)
-> Generic AssociateHealthCheck
forall x. Rep AssociateHealthCheck x -> AssociateHealthCheck
forall x. AssociateHealthCheck -> Rep AssociateHealthCheck x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateHealthCheck x -> AssociateHealthCheck
$cfrom :: forall x. AssociateHealthCheck -> Rep AssociateHealthCheck x
Prelude.Generic)
newAssociateHealthCheck ::
Prelude.Text ->
Prelude.Text ->
AssociateHealthCheck
newAssociateHealthCheck :: Text -> Text -> AssociateHealthCheck
newAssociateHealthCheck
Text
pProtectionId_
Text
pHealthCheckArn_ =
AssociateHealthCheck' :: Text -> Text -> AssociateHealthCheck
AssociateHealthCheck'
{ $sel:protectionId:AssociateHealthCheck' :: Text
protectionId =
Text
pProtectionId_,
$sel:healthCheckArn:AssociateHealthCheck' :: Text
healthCheckArn = Text
pHealthCheckArn_
}
associateHealthCheck_protectionId :: Lens.Lens' AssociateHealthCheck Prelude.Text
associateHealthCheck_protectionId :: (Text -> f Text) -> AssociateHealthCheck -> f AssociateHealthCheck
associateHealthCheck_protectionId = (AssociateHealthCheck -> Text)
-> (AssociateHealthCheck -> Text -> AssociateHealthCheck)
-> Lens AssociateHealthCheck AssociateHealthCheck Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateHealthCheck' {Text
protectionId :: Text
$sel:protectionId:AssociateHealthCheck' :: AssociateHealthCheck -> Text
protectionId} -> Text
protectionId) (\s :: AssociateHealthCheck
s@AssociateHealthCheck' {} Text
a -> AssociateHealthCheck
s {$sel:protectionId:AssociateHealthCheck' :: Text
protectionId = Text
a} :: AssociateHealthCheck)
associateHealthCheck_healthCheckArn :: Lens.Lens' AssociateHealthCheck Prelude.Text
associateHealthCheck_healthCheckArn :: (Text -> f Text) -> AssociateHealthCheck -> f AssociateHealthCheck
associateHealthCheck_healthCheckArn = (AssociateHealthCheck -> Text)
-> (AssociateHealthCheck -> Text -> AssociateHealthCheck)
-> Lens AssociateHealthCheck AssociateHealthCheck Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateHealthCheck' {Text
healthCheckArn :: Text
$sel:healthCheckArn:AssociateHealthCheck' :: AssociateHealthCheck -> Text
healthCheckArn} -> Text
healthCheckArn) (\s :: AssociateHealthCheck
s@AssociateHealthCheck' {} Text
a -> AssociateHealthCheck
s {$sel:healthCheckArn:AssociateHealthCheck' :: Text
healthCheckArn = Text
a} :: AssociateHealthCheck)
instance Core.AWSRequest AssociateHealthCheck where
type
AWSResponse AssociateHealthCheck =
AssociateHealthCheckResponse
request :: AssociateHealthCheck -> Request AssociateHealthCheck
request = Service -> AssociateHealthCheck -> Request AssociateHealthCheck
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateHealthCheck
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateHealthCheck)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AssociateHealthCheck))
-> Logger
-> Service
-> Proxy AssociateHealthCheck
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateHealthCheck)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> AssociateHealthCheckResponse
AssociateHealthCheckResponse'
(Int -> AssociateHealthCheckResponse)
-> Either String Int -> Either String AssociateHealthCheckResponse
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))
)
instance Prelude.Hashable AssociateHealthCheck
instance Prelude.NFData AssociateHealthCheck
instance Core.ToHeaders AssociateHealthCheck where
toHeaders :: AssociateHealthCheck -> ResponseHeaders
toHeaders =
ResponseHeaders -> AssociateHealthCheck -> 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
"AWSShield_20160616.AssociateHealthCheck" ::
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 AssociateHealthCheck where
toJSON :: AssociateHealthCheck -> Value
toJSON AssociateHealthCheck' {Text
healthCheckArn :: Text
protectionId :: Text
$sel:healthCheckArn:AssociateHealthCheck' :: AssociateHealthCheck -> Text
$sel:protectionId:AssociateHealthCheck' :: AssociateHealthCheck -> 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
"ProtectionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
protectionId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"HealthCheckArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
healthCheckArn)
]
)
instance Core.ToPath AssociateHealthCheck where
toPath :: AssociateHealthCheck -> ByteString
toPath = ByteString -> AssociateHealthCheck -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AssociateHealthCheck where
toQuery :: AssociateHealthCheck -> QueryString
toQuery = QueryString -> AssociateHealthCheck -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AssociateHealthCheckResponse = AssociateHealthCheckResponse'
{
AssociateHealthCheckResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateHealthCheckResponse
-> AssociateHealthCheckResponse -> Bool
(AssociateHealthCheckResponse
-> AssociateHealthCheckResponse -> Bool)
-> (AssociateHealthCheckResponse
-> AssociateHealthCheckResponse -> Bool)
-> Eq AssociateHealthCheckResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateHealthCheckResponse
-> AssociateHealthCheckResponse -> Bool
$c/= :: AssociateHealthCheckResponse
-> AssociateHealthCheckResponse -> Bool
== :: AssociateHealthCheckResponse
-> AssociateHealthCheckResponse -> Bool
$c== :: AssociateHealthCheckResponse
-> AssociateHealthCheckResponse -> Bool
Prelude.Eq, ReadPrec [AssociateHealthCheckResponse]
ReadPrec AssociateHealthCheckResponse
Int -> ReadS AssociateHealthCheckResponse
ReadS [AssociateHealthCheckResponse]
(Int -> ReadS AssociateHealthCheckResponse)
-> ReadS [AssociateHealthCheckResponse]
-> ReadPrec AssociateHealthCheckResponse
-> ReadPrec [AssociateHealthCheckResponse]
-> Read AssociateHealthCheckResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateHealthCheckResponse]
$creadListPrec :: ReadPrec [AssociateHealthCheckResponse]
readPrec :: ReadPrec AssociateHealthCheckResponse
$creadPrec :: ReadPrec AssociateHealthCheckResponse
readList :: ReadS [AssociateHealthCheckResponse]
$creadList :: ReadS [AssociateHealthCheckResponse]
readsPrec :: Int -> ReadS AssociateHealthCheckResponse
$creadsPrec :: Int -> ReadS AssociateHealthCheckResponse
Prelude.Read, Int -> AssociateHealthCheckResponse -> ShowS
[AssociateHealthCheckResponse] -> ShowS
AssociateHealthCheckResponse -> String
(Int -> AssociateHealthCheckResponse -> ShowS)
-> (AssociateHealthCheckResponse -> String)
-> ([AssociateHealthCheckResponse] -> ShowS)
-> Show AssociateHealthCheckResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateHealthCheckResponse] -> ShowS
$cshowList :: [AssociateHealthCheckResponse] -> ShowS
show :: AssociateHealthCheckResponse -> String
$cshow :: AssociateHealthCheckResponse -> String
showsPrec :: Int -> AssociateHealthCheckResponse -> ShowS
$cshowsPrec :: Int -> AssociateHealthCheckResponse -> ShowS
Prelude.Show, (forall x.
AssociateHealthCheckResponse -> Rep AssociateHealthCheckResponse x)
-> (forall x.
Rep AssociateHealthCheckResponse x -> AssociateHealthCheckResponse)
-> Generic AssociateHealthCheckResponse
forall x.
Rep AssociateHealthCheckResponse x -> AssociateHealthCheckResponse
forall x.
AssociateHealthCheckResponse -> Rep AssociateHealthCheckResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateHealthCheckResponse x -> AssociateHealthCheckResponse
$cfrom :: forall x.
AssociateHealthCheckResponse -> Rep AssociateHealthCheckResponse x
Prelude.Generic)
newAssociateHealthCheckResponse ::
Prelude.Int ->
AssociateHealthCheckResponse
newAssociateHealthCheckResponse :: Int -> AssociateHealthCheckResponse
newAssociateHealthCheckResponse Int
pHttpStatus_ =
AssociateHealthCheckResponse' :: Int -> AssociateHealthCheckResponse
AssociateHealthCheckResponse'
{ $sel:httpStatus:AssociateHealthCheckResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
associateHealthCheckResponse_httpStatus :: Lens.Lens' AssociateHealthCheckResponse Prelude.Int
associateHealthCheckResponse_httpStatus :: (Int -> f Int)
-> AssociateHealthCheckResponse -> f AssociateHealthCheckResponse
associateHealthCheckResponse_httpStatus = (AssociateHealthCheckResponse -> Int)
-> (AssociateHealthCheckResponse
-> Int -> AssociateHealthCheckResponse)
-> Lens
AssociateHealthCheckResponse AssociateHealthCheckResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateHealthCheckResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateHealthCheckResponse' :: AssociateHealthCheckResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateHealthCheckResponse
s@AssociateHealthCheckResponse' {} Int
a -> AssociateHealthCheckResponse
s {$sel:httpStatus:AssociateHealthCheckResponse' :: Int
httpStatus = Int
a} :: AssociateHealthCheckResponse)
instance Prelude.NFData AssociateHealthCheckResponse