{-# 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.GetCanary
(
GetCanary (..),
newGetCanary,
getCanary_name,
GetCanaryResponse (..),
newGetCanaryResponse,
getCanaryResponse_canary,
getCanaryResponse_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 GetCanary = GetCanary'
{
GetCanary -> Text
name :: Prelude.Text
}
deriving (GetCanary -> GetCanary -> Bool
(GetCanary -> GetCanary -> Bool)
-> (GetCanary -> GetCanary -> Bool) -> Eq GetCanary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCanary -> GetCanary -> Bool
$c/= :: GetCanary -> GetCanary -> Bool
== :: GetCanary -> GetCanary -> Bool
$c== :: GetCanary -> GetCanary -> Bool
Prelude.Eq, ReadPrec [GetCanary]
ReadPrec GetCanary
Int -> ReadS GetCanary
ReadS [GetCanary]
(Int -> ReadS GetCanary)
-> ReadS [GetCanary]
-> ReadPrec GetCanary
-> ReadPrec [GetCanary]
-> Read GetCanary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCanary]
$creadListPrec :: ReadPrec [GetCanary]
readPrec :: ReadPrec GetCanary
$creadPrec :: ReadPrec GetCanary
readList :: ReadS [GetCanary]
$creadList :: ReadS [GetCanary]
readsPrec :: Int -> ReadS GetCanary
$creadsPrec :: Int -> ReadS GetCanary
Prelude.Read, Int -> GetCanary -> ShowS
[GetCanary] -> ShowS
GetCanary -> String
(Int -> GetCanary -> ShowS)
-> (GetCanary -> String)
-> ([GetCanary] -> ShowS)
-> Show GetCanary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCanary] -> ShowS
$cshowList :: [GetCanary] -> ShowS
show :: GetCanary -> String
$cshow :: GetCanary -> String
showsPrec :: Int -> GetCanary -> ShowS
$cshowsPrec :: Int -> GetCanary -> ShowS
Prelude.Show, (forall x. GetCanary -> Rep GetCanary x)
-> (forall x. Rep GetCanary x -> GetCanary) -> Generic GetCanary
forall x. Rep GetCanary x -> GetCanary
forall x. GetCanary -> Rep GetCanary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCanary x -> GetCanary
$cfrom :: forall x. GetCanary -> Rep GetCanary x
Prelude.Generic)
newGetCanary ::
Prelude.Text ->
GetCanary
newGetCanary :: Text -> GetCanary
newGetCanary Text
pName_ = GetCanary' :: Text -> GetCanary
GetCanary' {$sel:name:GetCanary' :: Text
name = Text
pName_}
getCanary_name :: Lens.Lens' GetCanary Prelude.Text
getCanary_name :: (Text -> f Text) -> GetCanary -> f GetCanary
getCanary_name = (GetCanary -> Text)
-> (GetCanary -> Text -> GetCanary)
-> Lens GetCanary GetCanary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCanary' {Text
name :: Text
$sel:name:GetCanary' :: GetCanary -> Text
name} -> Text
name) (\s :: GetCanary
s@GetCanary' {} Text
a -> GetCanary
s {$sel:name:GetCanary' :: Text
name = Text
a} :: GetCanary)
instance Core.AWSRequest GetCanary where
type AWSResponse GetCanary = GetCanaryResponse
request :: GetCanary -> Request GetCanary
request = Service -> GetCanary -> Request GetCanary
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetCanary
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCanary)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetCanary))
-> Logger
-> Service
-> Proxy GetCanary
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCanary)))
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 Canary -> Int -> GetCanaryResponse
GetCanaryResponse'
(Maybe Canary -> Int -> GetCanaryResponse)
-> Either String (Maybe Canary)
-> Either String (Int -> GetCanaryResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Canary)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Canary")
Either String (Int -> GetCanaryResponse)
-> Either String Int -> Either String GetCanaryResponse
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 GetCanary
instance Prelude.NFData GetCanary
instance Core.ToHeaders GetCanary where
toHeaders :: GetCanary -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetCanary -> 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.ToPath GetCanary where
toPath :: GetCanary -> ByteString
toPath GetCanary' {Text
name :: Text
$sel:name:GetCanary' :: GetCanary -> 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]
instance Core.ToQuery GetCanary where
toQuery :: GetCanary -> QueryString
toQuery = QueryString -> GetCanary -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetCanaryResponse = GetCanaryResponse'
{
GetCanaryResponse -> Maybe Canary
canary :: Prelude.Maybe Canary,
GetCanaryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetCanaryResponse -> GetCanaryResponse -> Bool
(GetCanaryResponse -> GetCanaryResponse -> Bool)
-> (GetCanaryResponse -> GetCanaryResponse -> Bool)
-> Eq GetCanaryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCanaryResponse -> GetCanaryResponse -> Bool
$c/= :: GetCanaryResponse -> GetCanaryResponse -> Bool
== :: GetCanaryResponse -> GetCanaryResponse -> Bool
$c== :: GetCanaryResponse -> GetCanaryResponse -> Bool
Prelude.Eq, ReadPrec [GetCanaryResponse]
ReadPrec GetCanaryResponse
Int -> ReadS GetCanaryResponse
ReadS [GetCanaryResponse]
(Int -> ReadS GetCanaryResponse)
-> ReadS [GetCanaryResponse]
-> ReadPrec GetCanaryResponse
-> ReadPrec [GetCanaryResponse]
-> Read GetCanaryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCanaryResponse]
$creadListPrec :: ReadPrec [GetCanaryResponse]
readPrec :: ReadPrec GetCanaryResponse
$creadPrec :: ReadPrec GetCanaryResponse
readList :: ReadS [GetCanaryResponse]
$creadList :: ReadS [GetCanaryResponse]
readsPrec :: Int -> ReadS GetCanaryResponse
$creadsPrec :: Int -> ReadS GetCanaryResponse
Prelude.Read, Int -> GetCanaryResponse -> ShowS
[GetCanaryResponse] -> ShowS
GetCanaryResponse -> String
(Int -> GetCanaryResponse -> ShowS)
-> (GetCanaryResponse -> String)
-> ([GetCanaryResponse] -> ShowS)
-> Show GetCanaryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCanaryResponse] -> ShowS
$cshowList :: [GetCanaryResponse] -> ShowS
show :: GetCanaryResponse -> String
$cshow :: GetCanaryResponse -> String
showsPrec :: Int -> GetCanaryResponse -> ShowS
$cshowsPrec :: Int -> GetCanaryResponse -> ShowS
Prelude.Show, (forall x. GetCanaryResponse -> Rep GetCanaryResponse x)
-> (forall x. Rep GetCanaryResponse x -> GetCanaryResponse)
-> Generic GetCanaryResponse
forall x. Rep GetCanaryResponse x -> GetCanaryResponse
forall x. GetCanaryResponse -> Rep GetCanaryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCanaryResponse x -> GetCanaryResponse
$cfrom :: forall x. GetCanaryResponse -> Rep GetCanaryResponse x
Prelude.Generic)
newGetCanaryResponse ::
Prelude.Int ->
GetCanaryResponse
newGetCanaryResponse :: Int -> GetCanaryResponse
newGetCanaryResponse Int
pHttpStatus_ =
GetCanaryResponse' :: Maybe Canary -> Int -> GetCanaryResponse
GetCanaryResponse'
{ $sel:canary:GetCanaryResponse' :: Maybe Canary
canary = Maybe Canary
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetCanaryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getCanaryResponse_canary :: Lens.Lens' GetCanaryResponse (Prelude.Maybe Canary)
getCanaryResponse_canary :: (Maybe Canary -> f (Maybe Canary))
-> GetCanaryResponse -> f GetCanaryResponse
getCanaryResponse_canary = (GetCanaryResponse -> Maybe Canary)
-> (GetCanaryResponse -> Maybe Canary -> GetCanaryResponse)
-> Lens
GetCanaryResponse GetCanaryResponse (Maybe Canary) (Maybe Canary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCanaryResponse' {Maybe Canary
canary :: Maybe Canary
$sel:canary:GetCanaryResponse' :: GetCanaryResponse -> Maybe Canary
canary} -> Maybe Canary
canary) (\s :: GetCanaryResponse
s@GetCanaryResponse' {} Maybe Canary
a -> GetCanaryResponse
s {$sel:canary:GetCanaryResponse' :: Maybe Canary
canary = Maybe Canary
a} :: GetCanaryResponse)
getCanaryResponse_httpStatus :: Lens.Lens' GetCanaryResponse Prelude.Int
getCanaryResponse_httpStatus :: (Int -> f Int) -> GetCanaryResponse -> f GetCanaryResponse
getCanaryResponse_httpStatus = (GetCanaryResponse -> Int)
-> (GetCanaryResponse -> Int -> GetCanaryResponse)
-> Lens GetCanaryResponse GetCanaryResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCanaryResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCanaryResponse' :: GetCanaryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCanaryResponse
s@GetCanaryResponse' {} Int
a -> GetCanaryResponse
s {$sel:httpStatus:GetCanaryResponse' :: Int
httpStatus = Int
a} :: GetCanaryResponse)
instance Prelude.NFData GetCanaryResponse