{-# 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.DescribeCanaries
(
DescribeCanaries (..),
newDescribeCanaries,
describeCanaries_nextToken,
describeCanaries_maxResults,
DescribeCanariesResponse (..),
newDescribeCanariesResponse,
describeCanariesResponse_canaries,
describeCanariesResponse_nextToken,
describeCanariesResponse_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 DescribeCanaries = DescribeCanaries'
{
DescribeCanaries -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
DescribeCanaries -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (DescribeCanaries -> DescribeCanaries -> Bool
(DescribeCanaries -> DescribeCanaries -> Bool)
-> (DescribeCanaries -> DescribeCanaries -> Bool)
-> Eq DescribeCanaries
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCanaries -> DescribeCanaries -> Bool
$c/= :: DescribeCanaries -> DescribeCanaries -> Bool
== :: DescribeCanaries -> DescribeCanaries -> Bool
$c== :: DescribeCanaries -> DescribeCanaries -> Bool
Prelude.Eq, ReadPrec [DescribeCanaries]
ReadPrec DescribeCanaries
Int -> ReadS DescribeCanaries
ReadS [DescribeCanaries]
(Int -> ReadS DescribeCanaries)
-> ReadS [DescribeCanaries]
-> ReadPrec DescribeCanaries
-> ReadPrec [DescribeCanaries]
-> Read DescribeCanaries
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCanaries]
$creadListPrec :: ReadPrec [DescribeCanaries]
readPrec :: ReadPrec DescribeCanaries
$creadPrec :: ReadPrec DescribeCanaries
readList :: ReadS [DescribeCanaries]
$creadList :: ReadS [DescribeCanaries]
readsPrec :: Int -> ReadS DescribeCanaries
$creadsPrec :: Int -> ReadS DescribeCanaries
Prelude.Read, Int -> DescribeCanaries -> ShowS
[DescribeCanaries] -> ShowS
DescribeCanaries -> String
(Int -> DescribeCanaries -> ShowS)
-> (DescribeCanaries -> String)
-> ([DescribeCanaries] -> ShowS)
-> Show DescribeCanaries
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCanaries] -> ShowS
$cshowList :: [DescribeCanaries] -> ShowS
show :: DescribeCanaries -> String
$cshow :: DescribeCanaries -> String
showsPrec :: Int -> DescribeCanaries -> ShowS
$cshowsPrec :: Int -> DescribeCanaries -> ShowS
Prelude.Show, (forall x. DescribeCanaries -> Rep DescribeCanaries x)
-> (forall x. Rep DescribeCanaries x -> DescribeCanaries)
-> Generic DescribeCanaries
forall x. Rep DescribeCanaries x -> DescribeCanaries
forall x. DescribeCanaries -> Rep DescribeCanaries x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeCanaries x -> DescribeCanaries
$cfrom :: forall x. DescribeCanaries -> Rep DescribeCanaries x
Prelude.Generic)
newDescribeCanaries ::
DescribeCanaries
newDescribeCanaries :: DescribeCanaries
newDescribeCanaries =
DescribeCanaries' :: Maybe Text -> Maybe Natural -> DescribeCanaries
DescribeCanaries'
{ $sel:nextToken:DescribeCanaries' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:DescribeCanaries' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
describeCanaries_nextToken :: Lens.Lens' DescribeCanaries (Prelude.Maybe Prelude.Text)
describeCanaries_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeCanaries -> f DescribeCanaries
describeCanaries_nextToken = (DescribeCanaries -> Maybe Text)
-> (DescribeCanaries -> Maybe Text -> DescribeCanaries)
-> Lens DescribeCanaries DescribeCanaries (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCanaries' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeCanaries' :: DescribeCanaries -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeCanaries
s@DescribeCanaries' {} Maybe Text
a -> DescribeCanaries
s {$sel:nextToken:DescribeCanaries' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeCanaries)
describeCanaries_maxResults :: Lens.Lens' DescribeCanaries (Prelude.Maybe Prelude.Natural)
describeCanaries_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeCanaries -> f DescribeCanaries
describeCanaries_maxResults = (DescribeCanaries -> Maybe Natural)
-> (DescribeCanaries -> Maybe Natural -> DescribeCanaries)
-> Lens
DescribeCanaries DescribeCanaries (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCanaries' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeCanaries' :: DescribeCanaries -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeCanaries
s@DescribeCanaries' {} Maybe Natural
a -> DescribeCanaries
s {$sel:maxResults:DescribeCanaries' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeCanaries)
instance Core.AWSRequest DescribeCanaries where
type
AWSResponse DescribeCanaries =
DescribeCanariesResponse
request :: DescribeCanaries -> Request DescribeCanaries
request = Service -> DescribeCanaries -> Request DescribeCanaries
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeCanaries
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeCanaries)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeCanaries))
-> Logger
-> Service
-> Proxy DescribeCanaries
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeCanaries)))
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] -> Maybe Text -> Int -> DescribeCanariesResponse
DescribeCanariesResponse'
(Maybe [Canary] -> Maybe Text -> Int -> DescribeCanariesResponse)
-> Either String (Maybe [Canary])
-> Either String (Maybe Text -> Int -> DescribeCanariesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Canary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Canaries" Either String (Maybe (Maybe [Canary]))
-> Maybe [Canary] -> Either String (Maybe [Canary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Canary]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> DescribeCanariesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeCanariesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
Either String (Int -> DescribeCanariesResponse)
-> Either String Int -> Either String DescribeCanariesResponse
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 DescribeCanaries
instance Prelude.NFData DescribeCanaries
instance Core.ToHeaders DescribeCanaries where
toHeaders :: DescribeCanaries -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeCanaries -> 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 DescribeCanaries where
toJSON :: DescribeCanaries -> Value
toJSON DescribeCanaries' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:DescribeCanaries' :: DescribeCanaries -> Maybe Natural
$sel:nextToken:DescribeCanaries' :: DescribeCanaries -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
(Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
]
)
instance Core.ToPath DescribeCanaries where
toPath :: DescribeCanaries -> ByteString
toPath = ByteString -> DescribeCanaries -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/canaries"
instance Core.ToQuery DescribeCanaries where
toQuery :: DescribeCanaries -> QueryString
toQuery = QueryString -> DescribeCanaries -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeCanariesResponse = DescribeCanariesResponse'
{
DescribeCanariesResponse -> Maybe [Canary]
canaries :: Prelude.Maybe [Canary],
DescribeCanariesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
DescribeCanariesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeCanariesResponse -> DescribeCanariesResponse -> Bool
(DescribeCanariesResponse -> DescribeCanariesResponse -> Bool)
-> (DescribeCanariesResponse -> DescribeCanariesResponse -> Bool)
-> Eq DescribeCanariesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCanariesResponse -> DescribeCanariesResponse -> Bool
$c/= :: DescribeCanariesResponse -> DescribeCanariesResponse -> Bool
== :: DescribeCanariesResponse -> DescribeCanariesResponse -> Bool
$c== :: DescribeCanariesResponse -> DescribeCanariesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeCanariesResponse]
ReadPrec DescribeCanariesResponse
Int -> ReadS DescribeCanariesResponse
ReadS [DescribeCanariesResponse]
(Int -> ReadS DescribeCanariesResponse)
-> ReadS [DescribeCanariesResponse]
-> ReadPrec DescribeCanariesResponse
-> ReadPrec [DescribeCanariesResponse]
-> Read DescribeCanariesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCanariesResponse]
$creadListPrec :: ReadPrec [DescribeCanariesResponse]
readPrec :: ReadPrec DescribeCanariesResponse
$creadPrec :: ReadPrec DescribeCanariesResponse
readList :: ReadS [DescribeCanariesResponse]
$creadList :: ReadS [DescribeCanariesResponse]
readsPrec :: Int -> ReadS DescribeCanariesResponse
$creadsPrec :: Int -> ReadS DescribeCanariesResponse
Prelude.Read, Int -> DescribeCanariesResponse -> ShowS
[DescribeCanariesResponse] -> ShowS
DescribeCanariesResponse -> String
(Int -> DescribeCanariesResponse -> ShowS)
-> (DescribeCanariesResponse -> String)
-> ([DescribeCanariesResponse] -> ShowS)
-> Show DescribeCanariesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCanariesResponse] -> ShowS
$cshowList :: [DescribeCanariesResponse] -> ShowS
show :: DescribeCanariesResponse -> String
$cshow :: DescribeCanariesResponse -> String
showsPrec :: Int -> DescribeCanariesResponse -> ShowS
$cshowsPrec :: Int -> DescribeCanariesResponse -> ShowS
Prelude.Show, (forall x.
DescribeCanariesResponse -> Rep DescribeCanariesResponse x)
-> (forall x.
Rep DescribeCanariesResponse x -> DescribeCanariesResponse)
-> Generic DescribeCanariesResponse
forall x.
Rep DescribeCanariesResponse x -> DescribeCanariesResponse
forall x.
DescribeCanariesResponse -> Rep DescribeCanariesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCanariesResponse x -> DescribeCanariesResponse
$cfrom :: forall x.
DescribeCanariesResponse -> Rep DescribeCanariesResponse x
Prelude.Generic)
newDescribeCanariesResponse ::
Prelude.Int ->
DescribeCanariesResponse
newDescribeCanariesResponse :: Int -> DescribeCanariesResponse
newDescribeCanariesResponse Int
pHttpStatus_ =
DescribeCanariesResponse' :: Maybe [Canary] -> Maybe Text -> Int -> DescribeCanariesResponse
DescribeCanariesResponse'
{ $sel:canaries:DescribeCanariesResponse' :: Maybe [Canary]
canaries =
Maybe [Canary]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:DescribeCanariesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeCanariesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeCanariesResponse_canaries :: Lens.Lens' DescribeCanariesResponse (Prelude.Maybe [Canary])
describeCanariesResponse_canaries :: (Maybe [Canary] -> f (Maybe [Canary]))
-> DescribeCanariesResponse -> f DescribeCanariesResponse
describeCanariesResponse_canaries = (DescribeCanariesResponse -> Maybe [Canary])
-> (DescribeCanariesResponse
-> Maybe [Canary] -> DescribeCanariesResponse)
-> Lens
DescribeCanariesResponse
DescribeCanariesResponse
(Maybe [Canary])
(Maybe [Canary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCanariesResponse' {Maybe [Canary]
canaries :: Maybe [Canary]
$sel:canaries:DescribeCanariesResponse' :: DescribeCanariesResponse -> Maybe [Canary]
canaries} -> Maybe [Canary]
canaries) (\s :: DescribeCanariesResponse
s@DescribeCanariesResponse' {} Maybe [Canary]
a -> DescribeCanariesResponse
s {$sel:canaries:DescribeCanariesResponse' :: Maybe [Canary]
canaries = Maybe [Canary]
a} :: DescribeCanariesResponse) ((Maybe [Canary] -> f (Maybe [Canary]))
-> DescribeCanariesResponse -> f DescribeCanariesResponse)
-> ((Maybe [Canary] -> f (Maybe [Canary]))
-> Maybe [Canary] -> f (Maybe [Canary]))
-> (Maybe [Canary] -> f (Maybe [Canary]))
-> DescribeCanariesResponse
-> f DescribeCanariesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Canary] [Canary] [Canary] [Canary]
-> Iso
(Maybe [Canary]) (Maybe [Canary]) (Maybe [Canary]) (Maybe [Canary])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Canary] [Canary] [Canary] [Canary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeCanariesResponse_nextToken :: Lens.Lens' DescribeCanariesResponse (Prelude.Maybe Prelude.Text)
describeCanariesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeCanariesResponse -> f DescribeCanariesResponse
describeCanariesResponse_nextToken = (DescribeCanariesResponse -> Maybe Text)
-> (DescribeCanariesResponse
-> Maybe Text -> DescribeCanariesResponse)
-> Lens
DescribeCanariesResponse
DescribeCanariesResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCanariesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeCanariesResponse' :: DescribeCanariesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeCanariesResponse
s@DescribeCanariesResponse' {} Maybe Text
a -> DescribeCanariesResponse
s {$sel:nextToken:DescribeCanariesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeCanariesResponse)
describeCanariesResponse_httpStatus :: Lens.Lens' DescribeCanariesResponse Prelude.Int
describeCanariesResponse_httpStatus :: (Int -> f Int)
-> DescribeCanariesResponse -> f DescribeCanariesResponse
describeCanariesResponse_httpStatus = (DescribeCanariesResponse -> Int)
-> (DescribeCanariesResponse -> Int -> DescribeCanariesResponse)
-> Lens DescribeCanariesResponse DescribeCanariesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCanariesResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeCanariesResponse' :: DescribeCanariesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeCanariesResponse
s@DescribeCanariesResponse' {} Int
a -> DescribeCanariesResponse
s {$sel:httpStatus:DescribeCanariesResponse' :: Int
httpStatus = Int
a} :: DescribeCanariesResponse)
instance Prelude.NFData DescribeCanariesResponse