{-# 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.WellArchitected.ListWorkloads
(
ListWorkloads (..),
newListWorkloads,
listWorkloads_nextToken,
listWorkloads_workloadNamePrefix,
listWorkloads_maxResults,
ListWorkloadsResponse (..),
newListWorkloadsResponse,
listWorkloadsResponse_workloadSummaries,
listWorkloadsResponse_nextToken,
listWorkloadsResponse_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.WellArchitected.Types
data ListWorkloads = ListWorkloads'
{ ListWorkloads -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListWorkloads -> Maybe Text
workloadNamePrefix :: Prelude.Maybe Prelude.Text,
ListWorkloads -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListWorkloads -> ListWorkloads -> Bool
(ListWorkloads -> ListWorkloads -> Bool)
-> (ListWorkloads -> ListWorkloads -> Bool) -> Eq ListWorkloads
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListWorkloads -> ListWorkloads -> Bool
$c/= :: ListWorkloads -> ListWorkloads -> Bool
== :: ListWorkloads -> ListWorkloads -> Bool
$c== :: ListWorkloads -> ListWorkloads -> Bool
Prelude.Eq, ReadPrec [ListWorkloads]
ReadPrec ListWorkloads
Int -> ReadS ListWorkloads
ReadS [ListWorkloads]
(Int -> ReadS ListWorkloads)
-> ReadS [ListWorkloads]
-> ReadPrec ListWorkloads
-> ReadPrec [ListWorkloads]
-> Read ListWorkloads
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListWorkloads]
$creadListPrec :: ReadPrec [ListWorkloads]
readPrec :: ReadPrec ListWorkloads
$creadPrec :: ReadPrec ListWorkloads
readList :: ReadS [ListWorkloads]
$creadList :: ReadS [ListWorkloads]
readsPrec :: Int -> ReadS ListWorkloads
$creadsPrec :: Int -> ReadS ListWorkloads
Prelude.Read, Int -> ListWorkloads -> ShowS
[ListWorkloads] -> ShowS
ListWorkloads -> String
(Int -> ListWorkloads -> ShowS)
-> (ListWorkloads -> String)
-> ([ListWorkloads] -> ShowS)
-> Show ListWorkloads
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListWorkloads] -> ShowS
$cshowList :: [ListWorkloads] -> ShowS
show :: ListWorkloads -> String
$cshow :: ListWorkloads -> String
showsPrec :: Int -> ListWorkloads -> ShowS
$cshowsPrec :: Int -> ListWorkloads -> ShowS
Prelude.Show, (forall x. ListWorkloads -> Rep ListWorkloads x)
-> (forall x. Rep ListWorkloads x -> ListWorkloads)
-> Generic ListWorkloads
forall x. Rep ListWorkloads x -> ListWorkloads
forall x. ListWorkloads -> Rep ListWorkloads x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListWorkloads x -> ListWorkloads
$cfrom :: forall x. ListWorkloads -> Rep ListWorkloads x
Prelude.Generic)
newListWorkloads ::
ListWorkloads
newListWorkloads :: ListWorkloads
newListWorkloads =
ListWorkloads' :: Maybe Text -> Maybe Text -> Maybe Natural -> ListWorkloads
ListWorkloads'
{ $sel:nextToken:ListWorkloads' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:workloadNamePrefix:ListWorkloads' :: Maybe Text
workloadNamePrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListWorkloads' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listWorkloads_nextToken :: Lens.Lens' ListWorkloads (Prelude.Maybe Prelude.Text)
listWorkloads_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListWorkloads -> f ListWorkloads
listWorkloads_nextToken = (ListWorkloads -> Maybe Text)
-> (ListWorkloads -> Maybe Text -> ListWorkloads)
-> Lens ListWorkloads ListWorkloads (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkloads' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListWorkloads' :: ListWorkloads -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListWorkloads
s@ListWorkloads' {} Maybe Text
a -> ListWorkloads
s {$sel:nextToken:ListWorkloads' :: Maybe Text
nextToken = Maybe Text
a} :: ListWorkloads)
listWorkloads_workloadNamePrefix :: Lens.Lens' ListWorkloads (Prelude.Maybe Prelude.Text)
listWorkloads_workloadNamePrefix :: (Maybe Text -> f (Maybe Text)) -> ListWorkloads -> f ListWorkloads
listWorkloads_workloadNamePrefix = (ListWorkloads -> Maybe Text)
-> (ListWorkloads -> Maybe Text -> ListWorkloads)
-> Lens ListWorkloads ListWorkloads (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkloads' {Maybe Text
workloadNamePrefix :: Maybe Text
$sel:workloadNamePrefix:ListWorkloads' :: ListWorkloads -> Maybe Text
workloadNamePrefix} -> Maybe Text
workloadNamePrefix) (\s :: ListWorkloads
s@ListWorkloads' {} Maybe Text
a -> ListWorkloads
s {$sel:workloadNamePrefix:ListWorkloads' :: Maybe Text
workloadNamePrefix = Maybe Text
a} :: ListWorkloads)
listWorkloads_maxResults :: Lens.Lens' ListWorkloads (Prelude.Maybe Prelude.Natural)
listWorkloads_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListWorkloads -> f ListWorkloads
listWorkloads_maxResults = (ListWorkloads -> Maybe Natural)
-> (ListWorkloads -> Maybe Natural -> ListWorkloads)
-> Lens ListWorkloads ListWorkloads (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkloads' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListWorkloads' :: ListWorkloads -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListWorkloads
s@ListWorkloads' {} Maybe Natural
a -> ListWorkloads
s {$sel:maxResults:ListWorkloads' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListWorkloads)
instance Core.AWSRequest ListWorkloads where
type
AWSResponse ListWorkloads =
ListWorkloadsResponse
request :: ListWorkloads -> Request ListWorkloads
request = Service -> ListWorkloads -> Request ListWorkloads
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListWorkloads
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListWorkloads)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListWorkloads))
-> Logger
-> Service
-> Proxy ListWorkloads
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListWorkloads)))
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 [WorkloadSummary]
-> Maybe Text -> Int -> ListWorkloadsResponse
ListWorkloadsResponse'
(Maybe [WorkloadSummary]
-> Maybe Text -> Int -> ListWorkloadsResponse)
-> Either String (Maybe [WorkloadSummary])
-> Either String (Maybe Text -> Int -> ListWorkloadsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [WorkloadSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"WorkloadSummaries"
Either String (Maybe (Maybe [WorkloadSummary]))
-> Maybe [WorkloadSummary]
-> Either String (Maybe [WorkloadSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [WorkloadSummary]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Maybe Text -> Int -> ListWorkloadsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListWorkloadsResponse)
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 -> ListWorkloadsResponse)
-> Either String Int -> Either String ListWorkloadsResponse
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 ListWorkloads
instance Prelude.NFData ListWorkloads
instance Core.ToHeaders ListWorkloads where
toHeaders :: ListWorkloads -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListWorkloads -> 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 ListWorkloads where
toJSON :: ListWorkloads -> Value
toJSON ListWorkloads' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
workloadNamePrefix :: Maybe Text
nextToken :: Maybe Text
$sel:maxResults:ListWorkloads' :: ListWorkloads -> Maybe Natural
$sel:workloadNamePrefix:ListWorkloads' :: ListWorkloads -> Maybe Text
$sel:nextToken:ListWorkloads' :: ListWorkloads -> 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
"WorkloadNamePrefix" 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
workloadNamePrefix,
(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 ListWorkloads where
toPath :: ListWorkloads -> ByteString
toPath = ByteString -> ListWorkloads -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/workloadsSummaries"
instance Core.ToQuery ListWorkloads where
toQuery :: ListWorkloads -> QueryString
toQuery = QueryString -> ListWorkloads -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListWorkloadsResponse = ListWorkloadsResponse'
{ ListWorkloadsResponse -> Maybe [WorkloadSummary]
workloadSummaries :: Prelude.Maybe [WorkloadSummary],
ListWorkloadsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListWorkloadsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListWorkloadsResponse -> ListWorkloadsResponse -> Bool
(ListWorkloadsResponse -> ListWorkloadsResponse -> Bool)
-> (ListWorkloadsResponse -> ListWorkloadsResponse -> Bool)
-> Eq ListWorkloadsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListWorkloadsResponse -> ListWorkloadsResponse -> Bool
$c/= :: ListWorkloadsResponse -> ListWorkloadsResponse -> Bool
== :: ListWorkloadsResponse -> ListWorkloadsResponse -> Bool
$c== :: ListWorkloadsResponse -> ListWorkloadsResponse -> Bool
Prelude.Eq, ReadPrec [ListWorkloadsResponse]
ReadPrec ListWorkloadsResponse
Int -> ReadS ListWorkloadsResponse
ReadS [ListWorkloadsResponse]
(Int -> ReadS ListWorkloadsResponse)
-> ReadS [ListWorkloadsResponse]
-> ReadPrec ListWorkloadsResponse
-> ReadPrec [ListWorkloadsResponse]
-> Read ListWorkloadsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListWorkloadsResponse]
$creadListPrec :: ReadPrec [ListWorkloadsResponse]
readPrec :: ReadPrec ListWorkloadsResponse
$creadPrec :: ReadPrec ListWorkloadsResponse
readList :: ReadS [ListWorkloadsResponse]
$creadList :: ReadS [ListWorkloadsResponse]
readsPrec :: Int -> ReadS ListWorkloadsResponse
$creadsPrec :: Int -> ReadS ListWorkloadsResponse
Prelude.Read, Int -> ListWorkloadsResponse -> ShowS
[ListWorkloadsResponse] -> ShowS
ListWorkloadsResponse -> String
(Int -> ListWorkloadsResponse -> ShowS)
-> (ListWorkloadsResponse -> String)
-> ([ListWorkloadsResponse] -> ShowS)
-> Show ListWorkloadsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListWorkloadsResponse] -> ShowS
$cshowList :: [ListWorkloadsResponse] -> ShowS
show :: ListWorkloadsResponse -> String
$cshow :: ListWorkloadsResponse -> String
showsPrec :: Int -> ListWorkloadsResponse -> ShowS
$cshowsPrec :: Int -> ListWorkloadsResponse -> ShowS
Prelude.Show, (forall x. ListWorkloadsResponse -> Rep ListWorkloadsResponse x)
-> (forall x. Rep ListWorkloadsResponse x -> ListWorkloadsResponse)
-> Generic ListWorkloadsResponse
forall x. Rep ListWorkloadsResponse x -> ListWorkloadsResponse
forall x. ListWorkloadsResponse -> Rep ListWorkloadsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListWorkloadsResponse x -> ListWorkloadsResponse
$cfrom :: forall x. ListWorkloadsResponse -> Rep ListWorkloadsResponse x
Prelude.Generic)
newListWorkloadsResponse ::
Prelude.Int ->
ListWorkloadsResponse
newListWorkloadsResponse :: Int -> ListWorkloadsResponse
newListWorkloadsResponse Int
pHttpStatus_ =
ListWorkloadsResponse' :: Maybe [WorkloadSummary]
-> Maybe Text -> Int -> ListWorkloadsResponse
ListWorkloadsResponse'
{ $sel:workloadSummaries:ListWorkloadsResponse' :: Maybe [WorkloadSummary]
workloadSummaries =
Maybe [WorkloadSummary]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListWorkloadsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListWorkloadsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listWorkloadsResponse_workloadSummaries :: Lens.Lens' ListWorkloadsResponse (Prelude.Maybe [WorkloadSummary])
listWorkloadsResponse_workloadSummaries :: (Maybe [WorkloadSummary] -> f (Maybe [WorkloadSummary]))
-> ListWorkloadsResponse -> f ListWorkloadsResponse
listWorkloadsResponse_workloadSummaries = (ListWorkloadsResponse -> Maybe [WorkloadSummary])
-> (ListWorkloadsResponse
-> Maybe [WorkloadSummary] -> ListWorkloadsResponse)
-> Lens
ListWorkloadsResponse
ListWorkloadsResponse
(Maybe [WorkloadSummary])
(Maybe [WorkloadSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkloadsResponse' {Maybe [WorkloadSummary]
workloadSummaries :: Maybe [WorkloadSummary]
$sel:workloadSummaries:ListWorkloadsResponse' :: ListWorkloadsResponse -> Maybe [WorkloadSummary]
workloadSummaries} -> Maybe [WorkloadSummary]
workloadSummaries) (\s :: ListWorkloadsResponse
s@ListWorkloadsResponse' {} Maybe [WorkloadSummary]
a -> ListWorkloadsResponse
s {$sel:workloadSummaries:ListWorkloadsResponse' :: Maybe [WorkloadSummary]
workloadSummaries = Maybe [WorkloadSummary]
a} :: ListWorkloadsResponse) ((Maybe [WorkloadSummary] -> f (Maybe [WorkloadSummary]))
-> ListWorkloadsResponse -> f ListWorkloadsResponse)
-> ((Maybe [WorkloadSummary] -> f (Maybe [WorkloadSummary]))
-> Maybe [WorkloadSummary] -> f (Maybe [WorkloadSummary]))
-> (Maybe [WorkloadSummary] -> f (Maybe [WorkloadSummary]))
-> ListWorkloadsResponse
-> f ListWorkloadsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[WorkloadSummary]
[WorkloadSummary]
[WorkloadSummary]
[WorkloadSummary]
-> Iso
(Maybe [WorkloadSummary])
(Maybe [WorkloadSummary])
(Maybe [WorkloadSummary])
(Maybe [WorkloadSummary])
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
[WorkloadSummary]
[WorkloadSummary]
[WorkloadSummary]
[WorkloadSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listWorkloadsResponse_nextToken :: Lens.Lens' ListWorkloadsResponse (Prelude.Maybe Prelude.Text)
listWorkloadsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListWorkloadsResponse -> f ListWorkloadsResponse
listWorkloadsResponse_nextToken = (ListWorkloadsResponse -> Maybe Text)
-> (ListWorkloadsResponse -> Maybe Text -> ListWorkloadsResponse)
-> Lens
ListWorkloadsResponse
ListWorkloadsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkloadsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListWorkloadsResponse' :: ListWorkloadsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListWorkloadsResponse
s@ListWorkloadsResponse' {} Maybe Text
a -> ListWorkloadsResponse
s {$sel:nextToken:ListWorkloadsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListWorkloadsResponse)
listWorkloadsResponse_httpStatus :: Lens.Lens' ListWorkloadsResponse Prelude.Int
listWorkloadsResponse_httpStatus :: (Int -> f Int) -> ListWorkloadsResponse -> f ListWorkloadsResponse
listWorkloadsResponse_httpStatus = (ListWorkloadsResponse -> Int)
-> (ListWorkloadsResponse -> Int -> ListWorkloadsResponse)
-> Lens ListWorkloadsResponse ListWorkloadsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkloadsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListWorkloadsResponse' :: ListWorkloadsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListWorkloadsResponse
s@ListWorkloadsResponse' {} Int
a -> ListWorkloadsResponse
s {$sel:httpStatus:ListWorkloadsResponse' :: Int
httpStatus = Int
a} :: ListWorkloadsResponse)
instance Prelude.NFData ListWorkloadsResponse