{-# 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.Synthetics.StartCanary
(
StartCanary (..),
newStartCanary,
startCanary_name,
StartCanaryResponse (..),
newStartCanaryResponse,
startCanaryResponse_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.Synthetics.Types
data StartCanary = StartCanary'
{
StartCanary -> Text
name :: Prelude.Text
}
deriving (StartCanary -> StartCanary -> Bool
(StartCanary -> StartCanary -> Bool)
-> (StartCanary -> StartCanary -> Bool) -> Eq StartCanary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartCanary -> StartCanary -> Bool
$c/= :: StartCanary -> StartCanary -> Bool
== :: StartCanary -> StartCanary -> Bool
$c== :: StartCanary -> StartCanary -> Bool
Prelude.Eq, ReadPrec [StartCanary]
ReadPrec StartCanary
Int -> ReadS StartCanary
ReadS [StartCanary]
(Int -> ReadS StartCanary)
-> ReadS [StartCanary]
-> ReadPrec StartCanary
-> ReadPrec [StartCanary]
-> Read StartCanary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartCanary]
$creadListPrec :: ReadPrec [StartCanary]
readPrec :: ReadPrec StartCanary
$creadPrec :: ReadPrec StartCanary
readList :: ReadS [StartCanary]
$creadList :: ReadS [StartCanary]
readsPrec :: Int -> ReadS StartCanary
$creadsPrec :: Int -> ReadS StartCanary
Prelude.Read, Int -> StartCanary -> ShowS
[StartCanary] -> ShowS
StartCanary -> String
(Int -> StartCanary -> ShowS)
-> (StartCanary -> String)
-> ([StartCanary] -> ShowS)
-> Show StartCanary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartCanary] -> ShowS
$cshowList :: [StartCanary] -> ShowS
show :: StartCanary -> String
$cshow :: StartCanary -> String
showsPrec :: Int -> StartCanary -> ShowS
$cshowsPrec :: Int -> StartCanary -> ShowS
Prelude.Show, (forall x. StartCanary -> Rep StartCanary x)
-> (forall x. Rep StartCanary x -> StartCanary)
-> Generic StartCanary
forall x. Rep StartCanary x -> StartCanary
forall x. StartCanary -> Rep StartCanary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartCanary x -> StartCanary
$cfrom :: forall x. StartCanary -> Rep StartCanary x
Prelude.Generic)
newStartCanary ::
Prelude.Text ->
StartCanary
newStartCanary :: Text -> StartCanary
newStartCanary Text
pName_ = StartCanary' :: Text -> StartCanary
StartCanary' {$sel:name:StartCanary' :: Text
name = Text
pName_}
startCanary_name :: Lens.Lens' StartCanary Prelude.Text
startCanary_name :: (Text -> f Text) -> StartCanary -> f StartCanary
startCanary_name = (StartCanary -> Text)
-> (StartCanary -> Text -> StartCanary)
-> Lens StartCanary StartCanary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartCanary' {Text
name :: Text
$sel:name:StartCanary' :: StartCanary -> Text
name} -> Text
name) (\s :: StartCanary
s@StartCanary' {} Text
a -> StartCanary
s {$sel:name:StartCanary' :: Text
name = Text
a} :: StartCanary)
instance Core.AWSRequest StartCanary where
type AWSResponse StartCanary = StartCanaryResponse
request :: StartCanary -> Request StartCanary
request = Service -> StartCanary -> Request StartCanary
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartCanary
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartCanary)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse StartCanary))
-> Logger
-> Service
-> Proxy StartCanary
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartCanary)))
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 -> StartCanaryResponse
StartCanaryResponse'
(Int -> StartCanaryResponse)
-> Either String Int -> Either String StartCanaryResponse
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 StartCanary
instance Prelude.NFData StartCanary
instance Core.ToHeaders StartCanary where
toHeaders :: StartCanary -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartCanary -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 StartCanary where
toJSON :: StartCanary -> Value
toJSON = Value -> StartCanary -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath StartCanary where
toPath :: StartCanary -> ByteString
toPath StartCanary' {Text
name :: Text
$sel:name:StartCanary' :: StartCanary -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/canary/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name, ByteString
"/start"]
instance Core.ToQuery StartCanary where
toQuery :: StartCanary -> QueryString
toQuery = QueryString -> StartCanary -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartCanaryResponse = StartCanaryResponse'
{
StartCanaryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartCanaryResponse -> StartCanaryResponse -> Bool
(StartCanaryResponse -> StartCanaryResponse -> Bool)
-> (StartCanaryResponse -> StartCanaryResponse -> Bool)
-> Eq StartCanaryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartCanaryResponse -> StartCanaryResponse -> Bool
$c/= :: StartCanaryResponse -> StartCanaryResponse -> Bool
== :: StartCanaryResponse -> StartCanaryResponse -> Bool
$c== :: StartCanaryResponse -> StartCanaryResponse -> Bool
Prelude.Eq, ReadPrec [StartCanaryResponse]
ReadPrec StartCanaryResponse
Int -> ReadS StartCanaryResponse
ReadS [StartCanaryResponse]
(Int -> ReadS StartCanaryResponse)
-> ReadS [StartCanaryResponse]
-> ReadPrec StartCanaryResponse
-> ReadPrec [StartCanaryResponse]
-> Read StartCanaryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartCanaryResponse]
$creadListPrec :: ReadPrec [StartCanaryResponse]
readPrec :: ReadPrec StartCanaryResponse
$creadPrec :: ReadPrec StartCanaryResponse
readList :: ReadS [StartCanaryResponse]
$creadList :: ReadS [StartCanaryResponse]
readsPrec :: Int -> ReadS StartCanaryResponse
$creadsPrec :: Int -> ReadS StartCanaryResponse
Prelude.Read, Int -> StartCanaryResponse -> ShowS
[StartCanaryResponse] -> ShowS
StartCanaryResponse -> String
(Int -> StartCanaryResponse -> ShowS)
-> (StartCanaryResponse -> String)
-> ([StartCanaryResponse] -> ShowS)
-> Show StartCanaryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartCanaryResponse] -> ShowS
$cshowList :: [StartCanaryResponse] -> ShowS
show :: StartCanaryResponse -> String
$cshow :: StartCanaryResponse -> String
showsPrec :: Int -> StartCanaryResponse -> ShowS
$cshowsPrec :: Int -> StartCanaryResponse -> ShowS
Prelude.Show, (forall x. StartCanaryResponse -> Rep StartCanaryResponse x)
-> (forall x. Rep StartCanaryResponse x -> StartCanaryResponse)
-> Generic StartCanaryResponse
forall x. Rep StartCanaryResponse x -> StartCanaryResponse
forall x. StartCanaryResponse -> Rep StartCanaryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartCanaryResponse x -> StartCanaryResponse
$cfrom :: forall x. StartCanaryResponse -> Rep StartCanaryResponse x
Prelude.Generic)
newStartCanaryResponse ::
Prelude.Int ->
StartCanaryResponse
newStartCanaryResponse :: Int -> StartCanaryResponse
newStartCanaryResponse Int
pHttpStatus_ =
StartCanaryResponse' :: Int -> StartCanaryResponse
StartCanaryResponse' {$sel:httpStatus:StartCanaryResponse' :: Int
httpStatus = Int
pHttpStatus_}
startCanaryResponse_httpStatus :: Lens.Lens' StartCanaryResponse Prelude.Int
startCanaryResponse_httpStatus :: (Int -> f Int) -> StartCanaryResponse -> f StartCanaryResponse
startCanaryResponse_httpStatus = (StartCanaryResponse -> Int)
-> (StartCanaryResponse -> Int -> StartCanaryResponse)
-> Lens StartCanaryResponse StartCanaryResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartCanaryResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartCanaryResponse' :: StartCanaryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartCanaryResponse
s@StartCanaryResponse' {} Int
a -> StartCanaryResponse
s {$sel:httpStatus:StartCanaryResponse' :: Int
httpStatus = Int
a} :: StartCanaryResponse)
instance Prelude.NFData StartCanaryResponse