{-# 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.GetCanaryRuns
(
GetCanaryRuns (..),
newGetCanaryRuns,
getCanaryRuns_nextToken,
getCanaryRuns_maxResults,
getCanaryRuns_name,
GetCanaryRunsResponse (..),
newGetCanaryRunsResponse,
getCanaryRunsResponse_nextToken,
getCanaryRunsResponse_canaryRuns,
getCanaryRunsResponse_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 GetCanaryRuns = GetCanaryRuns'
{
GetCanaryRuns -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetCanaryRuns -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
GetCanaryRuns -> Text
name :: Prelude.Text
}
deriving (GetCanaryRuns -> GetCanaryRuns -> Bool
(GetCanaryRuns -> GetCanaryRuns -> Bool)
-> (GetCanaryRuns -> GetCanaryRuns -> Bool) -> Eq GetCanaryRuns
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCanaryRuns -> GetCanaryRuns -> Bool
$c/= :: GetCanaryRuns -> GetCanaryRuns -> Bool
== :: GetCanaryRuns -> GetCanaryRuns -> Bool
$c== :: GetCanaryRuns -> GetCanaryRuns -> Bool
Prelude.Eq, ReadPrec [GetCanaryRuns]
ReadPrec GetCanaryRuns
Int -> ReadS GetCanaryRuns
ReadS [GetCanaryRuns]
(Int -> ReadS GetCanaryRuns)
-> ReadS [GetCanaryRuns]
-> ReadPrec GetCanaryRuns
-> ReadPrec [GetCanaryRuns]
-> Read GetCanaryRuns
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCanaryRuns]
$creadListPrec :: ReadPrec [GetCanaryRuns]
readPrec :: ReadPrec GetCanaryRuns
$creadPrec :: ReadPrec GetCanaryRuns
readList :: ReadS [GetCanaryRuns]
$creadList :: ReadS [GetCanaryRuns]
readsPrec :: Int -> ReadS GetCanaryRuns
$creadsPrec :: Int -> ReadS GetCanaryRuns
Prelude.Read, Int -> GetCanaryRuns -> ShowS
[GetCanaryRuns] -> ShowS
GetCanaryRuns -> String
(Int -> GetCanaryRuns -> ShowS)
-> (GetCanaryRuns -> String)
-> ([GetCanaryRuns] -> ShowS)
-> Show GetCanaryRuns
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCanaryRuns] -> ShowS
$cshowList :: [GetCanaryRuns] -> ShowS
show :: GetCanaryRuns -> String
$cshow :: GetCanaryRuns -> String
showsPrec :: Int -> GetCanaryRuns -> ShowS
$cshowsPrec :: Int -> GetCanaryRuns -> ShowS
Prelude.Show, (forall x. GetCanaryRuns -> Rep GetCanaryRuns x)
-> (forall x. Rep GetCanaryRuns x -> GetCanaryRuns)
-> Generic GetCanaryRuns
forall x. Rep GetCanaryRuns x -> GetCanaryRuns
forall x. GetCanaryRuns -> Rep GetCanaryRuns x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCanaryRuns x -> GetCanaryRuns
$cfrom :: forall x. GetCanaryRuns -> Rep GetCanaryRuns x
Prelude.Generic)
newGetCanaryRuns ::
Prelude.Text ->
GetCanaryRuns
newGetCanaryRuns :: Text -> GetCanaryRuns
newGetCanaryRuns Text
pName_ =
GetCanaryRuns' :: Maybe Text -> Maybe Natural -> Text -> GetCanaryRuns
GetCanaryRuns'
{ $sel:nextToken:GetCanaryRuns' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:GetCanaryRuns' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:name:GetCanaryRuns' :: Text
name = Text
pName_
}
getCanaryRuns_nextToken :: Lens.Lens' GetCanaryRuns (Prelude.Maybe Prelude.Text)
getCanaryRuns_nextToken :: (Maybe Text -> f (Maybe Text)) -> GetCanaryRuns -> f GetCanaryRuns
getCanaryRuns_nextToken = (GetCanaryRuns -> Maybe Text)
-> (GetCanaryRuns -> Maybe Text -> GetCanaryRuns)
-> Lens GetCanaryRuns GetCanaryRuns (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCanaryRuns' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetCanaryRuns' :: GetCanaryRuns -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetCanaryRuns
s@GetCanaryRuns' {} Maybe Text
a -> GetCanaryRuns
s {$sel:nextToken:GetCanaryRuns' :: Maybe Text
nextToken = Maybe Text
a} :: GetCanaryRuns)
getCanaryRuns_maxResults :: Lens.Lens' GetCanaryRuns (Prelude.Maybe Prelude.Natural)
getCanaryRuns_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetCanaryRuns -> f GetCanaryRuns
getCanaryRuns_maxResults = (GetCanaryRuns -> Maybe Natural)
-> (GetCanaryRuns -> Maybe Natural -> GetCanaryRuns)
-> Lens GetCanaryRuns GetCanaryRuns (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCanaryRuns' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetCanaryRuns' :: GetCanaryRuns -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetCanaryRuns
s@GetCanaryRuns' {} Maybe Natural
a -> GetCanaryRuns
s {$sel:maxResults:GetCanaryRuns' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetCanaryRuns)
getCanaryRuns_name :: Lens.Lens' GetCanaryRuns Prelude.Text
getCanaryRuns_name :: (Text -> f Text) -> GetCanaryRuns -> f GetCanaryRuns
getCanaryRuns_name = (GetCanaryRuns -> Text)
-> (GetCanaryRuns -> Text -> GetCanaryRuns)
-> Lens GetCanaryRuns GetCanaryRuns Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCanaryRuns' {Text
name :: Text
$sel:name:GetCanaryRuns' :: GetCanaryRuns -> Text
name} -> Text
name) (\s :: GetCanaryRuns
s@GetCanaryRuns' {} Text
a -> GetCanaryRuns
s {$sel:name:GetCanaryRuns' :: Text
name = Text
a} :: GetCanaryRuns)
instance Core.AWSRequest GetCanaryRuns where
type
AWSResponse GetCanaryRuns =
GetCanaryRunsResponse
request :: GetCanaryRuns -> Request GetCanaryRuns
request = Service -> GetCanaryRuns -> Request GetCanaryRuns
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetCanaryRuns
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCanaryRuns)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetCanaryRuns))
-> Logger
-> Service
-> Proxy GetCanaryRuns
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCanaryRuns)))
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 Text -> Maybe [CanaryRun] -> Int -> GetCanaryRunsResponse
GetCanaryRunsResponse'
(Maybe Text -> Maybe [CanaryRun] -> Int -> GetCanaryRunsResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe [CanaryRun] -> Int -> GetCanaryRunsResponse)
forall (f :: * -> *) a b. Functor 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 (Maybe [CanaryRun] -> Int -> GetCanaryRunsResponse)
-> Either String (Maybe [CanaryRun])
-> Either String (Int -> GetCanaryRunsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [CanaryRun]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CanaryRuns" Either String (Maybe (Maybe [CanaryRun]))
-> Maybe [CanaryRun] -> Either String (Maybe [CanaryRun])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [CanaryRun]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> GetCanaryRunsResponse)
-> Either String Int -> Either String GetCanaryRunsResponse
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 GetCanaryRuns
instance Prelude.NFData GetCanaryRuns
instance Core.ToHeaders GetCanaryRuns where
toHeaders :: GetCanaryRuns -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetCanaryRuns -> 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 GetCanaryRuns where
toJSON :: GetCanaryRuns -> Value
toJSON GetCanaryRuns' {Maybe Natural
Maybe Text
Text
name :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:name:GetCanaryRuns' :: GetCanaryRuns -> Text
$sel:maxResults:GetCanaryRuns' :: GetCanaryRuns -> Maybe Natural
$sel:nextToken:GetCanaryRuns' :: GetCanaryRuns -> 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 GetCanaryRuns where
toPath :: GetCanaryRuns -> ByteString
toPath GetCanaryRuns' {Maybe Natural
Maybe Text
Text
name :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:name:GetCanaryRuns' :: GetCanaryRuns -> Text
$sel:maxResults:GetCanaryRuns' :: GetCanaryRuns -> Maybe Natural
$sel:nextToken:GetCanaryRuns' :: GetCanaryRuns -> Maybe 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
"/runs"]
instance Core.ToQuery GetCanaryRuns where
toQuery :: GetCanaryRuns -> QueryString
toQuery = QueryString -> GetCanaryRuns -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetCanaryRunsResponse = GetCanaryRunsResponse'
{
GetCanaryRunsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetCanaryRunsResponse -> Maybe [CanaryRun]
canaryRuns :: Prelude.Maybe [CanaryRun],
GetCanaryRunsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetCanaryRunsResponse -> GetCanaryRunsResponse -> Bool
(GetCanaryRunsResponse -> GetCanaryRunsResponse -> Bool)
-> (GetCanaryRunsResponse -> GetCanaryRunsResponse -> Bool)
-> Eq GetCanaryRunsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCanaryRunsResponse -> GetCanaryRunsResponse -> Bool
$c/= :: GetCanaryRunsResponse -> GetCanaryRunsResponse -> Bool
== :: GetCanaryRunsResponse -> GetCanaryRunsResponse -> Bool
$c== :: GetCanaryRunsResponse -> GetCanaryRunsResponse -> Bool
Prelude.Eq, ReadPrec [GetCanaryRunsResponse]
ReadPrec GetCanaryRunsResponse
Int -> ReadS GetCanaryRunsResponse
ReadS [GetCanaryRunsResponse]
(Int -> ReadS GetCanaryRunsResponse)
-> ReadS [GetCanaryRunsResponse]
-> ReadPrec GetCanaryRunsResponse
-> ReadPrec [GetCanaryRunsResponse]
-> Read GetCanaryRunsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCanaryRunsResponse]
$creadListPrec :: ReadPrec [GetCanaryRunsResponse]
readPrec :: ReadPrec GetCanaryRunsResponse
$creadPrec :: ReadPrec GetCanaryRunsResponse
readList :: ReadS [GetCanaryRunsResponse]
$creadList :: ReadS [GetCanaryRunsResponse]
readsPrec :: Int -> ReadS GetCanaryRunsResponse
$creadsPrec :: Int -> ReadS GetCanaryRunsResponse
Prelude.Read, Int -> GetCanaryRunsResponse -> ShowS
[GetCanaryRunsResponse] -> ShowS
GetCanaryRunsResponse -> String
(Int -> GetCanaryRunsResponse -> ShowS)
-> (GetCanaryRunsResponse -> String)
-> ([GetCanaryRunsResponse] -> ShowS)
-> Show GetCanaryRunsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCanaryRunsResponse] -> ShowS
$cshowList :: [GetCanaryRunsResponse] -> ShowS
show :: GetCanaryRunsResponse -> String
$cshow :: GetCanaryRunsResponse -> String
showsPrec :: Int -> GetCanaryRunsResponse -> ShowS
$cshowsPrec :: Int -> GetCanaryRunsResponse -> ShowS
Prelude.Show, (forall x. GetCanaryRunsResponse -> Rep GetCanaryRunsResponse x)
-> (forall x. Rep GetCanaryRunsResponse x -> GetCanaryRunsResponse)
-> Generic GetCanaryRunsResponse
forall x. Rep GetCanaryRunsResponse x -> GetCanaryRunsResponse
forall x. GetCanaryRunsResponse -> Rep GetCanaryRunsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCanaryRunsResponse x -> GetCanaryRunsResponse
$cfrom :: forall x. GetCanaryRunsResponse -> Rep GetCanaryRunsResponse x
Prelude.Generic)
newGetCanaryRunsResponse ::
Prelude.Int ->
GetCanaryRunsResponse
newGetCanaryRunsResponse :: Int -> GetCanaryRunsResponse
newGetCanaryRunsResponse Int
pHttpStatus_ =
GetCanaryRunsResponse' :: Maybe Text -> Maybe [CanaryRun] -> Int -> GetCanaryRunsResponse
GetCanaryRunsResponse'
{ $sel:nextToken:GetCanaryRunsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:canaryRuns:GetCanaryRunsResponse' :: Maybe [CanaryRun]
canaryRuns = Maybe [CanaryRun]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetCanaryRunsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getCanaryRunsResponse_nextToken :: Lens.Lens' GetCanaryRunsResponse (Prelude.Maybe Prelude.Text)
getCanaryRunsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetCanaryRunsResponse -> f GetCanaryRunsResponse
getCanaryRunsResponse_nextToken = (GetCanaryRunsResponse -> Maybe Text)
-> (GetCanaryRunsResponse -> Maybe Text -> GetCanaryRunsResponse)
-> Lens
GetCanaryRunsResponse
GetCanaryRunsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCanaryRunsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetCanaryRunsResponse' :: GetCanaryRunsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetCanaryRunsResponse
s@GetCanaryRunsResponse' {} Maybe Text
a -> GetCanaryRunsResponse
s {$sel:nextToken:GetCanaryRunsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetCanaryRunsResponse)
getCanaryRunsResponse_canaryRuns :: Lens.Lens' GetCanaryRunsResponse (Prelude.Maybe [CanaryRun])
getCanaryRunsResponse_canaryRuns :: (Maybe [CanaryRun] -> f (Maybe [CanaryRun]))
-> GetCanaryRunsResponse -> f GetCanaryRunsResponse
getCanaryRunsResponse_canaryRuns = (GetCanaryRunsResponse -> Maybe [CanaryRun])
-> (GetCanaryRunsResponse
-> Maybe [CanaryRun] -> GetCanaryRunsResponse)
-> Lens
GetCanaryRunsResponse
GetCanaryRunsResponse
(Maybe [CanaryRun])
(Maybe [CanaryRun])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCanaryRunsResponse' {Maybe [CanaryRun]
canaryRuns :: Maybe [CanaryRun]
$sel:canaryRuns:GetCanaryRunsResponse' :: GetCanaryRunsResponse -> Maybe [CanaryRun]
canaryRuns} -> Maybe [CanaryRun]
canaryRuns) (\s :: GetCanaryRunsResponse
s@GetCanaryRunsResponse' {} Maybe [CanaryRun]
a -> GetCanaryRunsResponse
s {$sel:canaryRuns:GetCanaryRunsResponse' :: Maybe [CanaryRun]
canaryRuns = Maybe [CanaryRun]
a} :: GetCanaryRunsResponse) ((Maybe [CanaryRun] -> f (Maybe [CanaryRun]))
-> GetCanaryRunsResponse -> f GetCanaryRunsResponse)
-> ((Maybe [CanaryRun] -> f (Maybe [CanaryRun]))
-> Maybe [CanaryRun] -> f (Maybe [CanaryRun]))
-> (Maybe [CanaryRun] -> f (Maybe [CanaryRun]))
-> GetCanaryRunsResponse
-> f GetCanaryRunsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [CanaryRun] [CanaryRun] [CanaryRun] [CanaryRun]
-> Iso
(Maybe [CanaryRun])
(Maybe [CanaryRun])
(Maybe [CanaryRun])
(Maybe [CanaryRun])
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 [CanaryRun] [CanaryRun] [CanaryRun] [CanaryRun]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getCanaryRunsResponse_httpStatus :: Lens.Lens' GetCanaryRunsResponse Prelude.Int
getCanaryRunsResponse_httpStatus :: (Int -> f Int) -> GetCanaryRunsResponse -> f GetCanaryRunsResponse
getCanaryRunsResponse_httpStatus = (GetCanaryRunsResponse -> Int)
-> (GetCanaryRunsResponse -> Int -> GetCanaryRunsResponse)
-> Lens GetCanaryRunsResponse GetCanaryRunsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCanaryRunsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCanaryRunsResponse' :: GetCanaryRunsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCanaryRunsResponse
s@GetCanaryRunsResponse' {} Int
a -> GetCanaryRunsResponse
s {$sel:httpStatus:GetCanaryRunsResponse' :: Int
httpStatus = Int
a} :: GetCanaryRunsResponse)
instance Prelude.NFData GetCanaryRunsResponse