{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:protectionId:AssociateHealthCheck' :: Text
protectionId =
Text
pProtectionId_,
$sel:healthCheckArn:AssociateHealthCheck' :: Text
healthCheckArn = Text
pHealthCheckArn_
}
associateHealthCheck_protectionId :: Lens.Lens' AssociateHealthCheck Prelude.Text
associateHealthCheck_protectionId :: Lens' AssociateHealthCheck Text
associateHealthCheck_protectionId = 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 :: Lens' AssociateHealthCheck Text
associateHealthCheck_healthCheckArn = 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 :: (Service -> Service)
-> AssociateHealthCheck -> Request AssociateHealthCheck
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 AssociateHealthCheck
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateHealthCheck)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> AssociateHealthCheckResponse
AssociateHealthCheckResponse'
forall (f :: * -> *) a b. Functor 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 AssociateHealthCheck where
hashWithSalt :: Int -> AssociateHealthCheck -> Int
hashWithSalt Int
_salt AssociateHealthCheck' {Text
healthCheckArn :: Text
protectionId :: Text
$sel:healthCheckArn:AssociateHealthCheck' :: AssociateHealthCheck -> Text
$sel:protectionId:AssociateHealthCheck' :: AssociateHealthCheck -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
protectionId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
healthCheckArn
instance Prelude.NFData AssociateHealthCheck where
rnf :: AssociateHealthCheck -> ()
rnf AssociateHealthCheck' {Text
healthCheckArn :: Text
protectionId :: Text
$sel:healthCheckArn:AssociateHealthCheck' :: AssociateHealthCheck -> Text
$sel:protectionId:AssociateHealthCheck' :: AssociateHealthCheck -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
protectionId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
healthCheckArn
instance Data.ToHeaders AssociateHealthCheck where
toHeaders :: AssociateHealthCheck -> 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
"AWSShield_20160616.AssociateHealthCheck" ::
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 AssociateHealthCheck where
toJSON :: AssociateHealthCheck -> Value
toJSON AssociateHealthCheck' {Text
healthCheckArn :: Text
protectionId :: Text
$sel:healthCheckArn:AssociateHealthCheck' :: AssociateHealthCheck -> Text
$sel:protectionId:AssociateHealthCheck' :: AssociateHealthCheck -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"ProtectionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
protectionId),
forall a. a -> Maybe a
Prelude.Just
(Key
"HealthCheckArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
healthCheckArn)
]
)
instance Data.ToPath AssociateHealthCheck where
toPath :: AssociateHealthCheck -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery AssociateHealthCheck where
toQuery :: AssociateHealthCheck -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data AssociateHealthCheckResponse = AssociateHealthCheckResponse'
{
AssociateHealthCheckResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateHealthCheckResponse
-> AssociateHealthCheckResponse -> Bool
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]
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
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.
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'
{ $sel:httpStatus:AssociateHealthCheckResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
associateHealthCheckResponse_httpStatus :: Lens.Lens' AssociateHealthCheckResponse Prelude.Int
associateHealthCheckResponse_httpStatus :: Lens' AssociateHealthCheckResponse Int
associateHealthCheckResponse_httpStatus = 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 where
rnf :: AssociateHealthCheckResponse -> ()
rnf AssociateHealthCheckResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateHealthCheckResponse' :: AssociateHealthCheckResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus