{-# 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_maxResults,
getCanaryRuns_nextToken,
getCanaryRuns_name,
GetCanaryRunsResponse (..),
newGetCanaryRunsResponse,
getCanaryRunsResponse_canaryRuns,
getCanaryRunsResponse_nextToken,
getCanaryRunsResponse_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.Synthetics.Types
data GetCanaryRuns = GetCanaryRuns'
{
GetCanaryRuns -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
GetCanaryRuns -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetCanaryRuns -> Text
name :: Prelude.Text
}
deriving (GetCanaryRuns -> GetCanaryRuns -> Bool
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]
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
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. 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'
{ $sel:maxResults:GetCanaryRuns' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetCanaryRuns' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:name:GetCanaryRuns' :: Text
name = Text
pName_
}
getCanaryRuns_maxResults :: Lens.Lens' GetCanaryRuns (Prelude.Maybe Prelude.Natural)
getCanaryRuns_maxResults :: Lens' GetCanaryRuns (Maybe Natural)
getCanaryRuns_maxResults = 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_nextToken :: Lens.Lens' GetCanaryRuns (Prelude.Maybe Prelude.Text)
getCanaryRuns_nextToken :: Lens' GetCanaryRuns (Maybe Text)
getCanaryRuns_nextToken = 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_name :: Lens.Lens' GetCanaryRuns Prelude.Text
getCanaryRuns_name :: Lens' GetCanaryRuns Text
getCanaryRuns_name = 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 :: (Service -> Service) -> GetCanaryRuns -> Request GetCanaryRuns
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 GetCanaryRuns
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCanaryRuns)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [CanaryRun] -> Maybe Text -> Int -> GetCanaryRunsResponse
GetCanaryRunsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"CanaryRuns" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
forall (f :: * -> *) a b. Applicative f => 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 GetCanaryRuns where
hashWithSalt :: Int -> GetCanaryRuns -> Int
hashWithSalt Int
_salt GetCanaryRuns' {Maybe Natural
Maybe Text
Text
name :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:name:GetCanaryRuns' :: GetCanaryRuns -> Text
$sel:nextToken:GetCanaryRuns' :: GetCanaryRuns -> Maybe Text
$sel:maxResults:GetCanaryRuns' :: GetCanaryRuns -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData GetCanaryRuns where
rnf :: GetCanaryRuns -> ()
rnf GetCanaryRuns' {Maybe Natural
Maybe Text
Text
name :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:name:GetCanaryRuns' :: GetCanaryRuns -> Text
$sel:nextToken:GetCanaryRuns' :: GetCanaryRuns -> Maybe Text
$sel:maxResults:GetCanaryRuns' :: GetCanaryRuns -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.ToHeaders GetCanaryRuns where
toHeaders :: GetCanaryRuns -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetCanaryRuns where
toJSON :: GetCanaryRuns -> Value
toJSON GetCanaryRuns' {Maybe Natural
Maybe Text
Text
name :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:name:GetCanaryRuns' :: GetCanaryRuns -> Text
$sel:nextToken:GetCanaryRuns' :: GetCanaryRuns -> Maybe Text
$sel:maxResults:GetCanaryRuns' :: GetCanaryRuns -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
(Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken
]
)
instance Data.ToPath GetCanaryRuns where
toPath :: GetCanaryRuns -> ByteString
toPath GetCanaryRuns' {Maybe Natural
Maybe Text
Text
name :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:name:GetCanaryRuns' :: GetCanaryRuns -> Text
$sel:nextToken:GetCanaryRuns' :: GetCanaryRuns -> Maybe Text
$sel:maxResults:GetCanaryRuns' :: GetCanaryRuns -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/canary/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
name, ByteString
"/runs"]
instance Data.ToQuery GetCanaryRuns where
toQuery :: GetCanaryRuns -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetCanaryRunsResponse = GetCanaryRunsResponse'
{
GetCanaryRunsResponse -> Maybe [CanaryRun]
canaryRuns :: Prelude.Maybe [CanaryRun],
GetCanaryRunsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetCanaryRunsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetCanaryRunsResponse -> GetCanaryRunsResponse -> Bool
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]
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
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. 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'
{ $sel:canaryRuns:GetCanaryRunsResponse' :: Maybe [CanaryRun]
canaryRuns =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetCanaryRunsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetCanaryRunsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getCanaryRunsResponse_canaryRuns :: Lens.Lens' GetCanaryRunsResponse (Prelude.Maybe [CanaryRun])
getCanaryRunsResponse_canaryRuns :: Lens' GetCanaryRunsResponse (Maybe [CanaryRun])
getCanaryRunsResponse_canaryRuns = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getCanaryRunsResponse_nextToken :: Lens.Lens' GetCanaryRunsResponse (Prelude.Maybe Prelude.Text)
getCanaryRunsResponse_nextToken :: Lens' GetCanaryRunsResponse (Maybe Text)
getCanaryRunsResponse_nextToken = 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_httpStatus :: Lens.Lens' GetCanaryRunsResponse Prelude.Int
getCanaryRunsResponse_httpStatus :: Lens' GetCanaryRunsResponse Int
getCanaryRunsResponse_httpStatus = 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 where
rnf :: GetCanaryRunsResponse -> ()
rnf GetCanaryRunsResponse' {Int
Maybe [CanaryRun]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
canaryRuns :: Maybe [CanaryRun]
$sel:httpStatus:GetCanaryRunsResponse' :: GetCanaryRunsResponse -> Int
$sel:nextToken:GetCanaryRunsResponse' :: GetCanaryRunsResponse -> Maybe Text
$sel:canaryRuns:GetCanaryRunsResponse' :: GetCanaryRunsResponse -> Maybe [CanaryRun]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [CanaryRun]
canaryRuns
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus