{-# 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.MediaStore.ListContainers
(
ListContainers (..),
newListContainers,
listContainers_nextToken,
listContainers_maxResults,
ListContainersResponse (..),
newListContainersResponse,
listContainersResponse_nextToken,
listContainersResponse_httpStatus,
listContainersResponse_containers,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaStore.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListContainers = ListContainers'
{
ListContainers -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListContainers -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListContainers -> ListContainers -> Bool
(ListContainers -> ListContainers -> Bool)
-> (ListContainers -> ListContainers -> Bool) -> Eq ListContainers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListContainers -> ListContainers -> Bool
$c/= :: ListContainers -> ListContainers -> Bool
== :: ListContainers -> ListContainers -> Bool
$c== :: ListContainers -> ListContainers -> Bool
Prelude.Eq, ReadPrec [ListContainers]
ReadPrec ListContainers
Int -> ReadS ListContainers
ReadS [ListContainers]
(Int -> ReadS ListContainers)
-> ReadS [ListContainers]
-> ReadPrec ListContainers
-> ReadPrec [ListContainers]
-> Read ListContainers
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListContainers]
$creadListPrec :: ReadPrec [ListContainers]
readPrec :: ReadPrec ListContainers
$creadPrec :: ReadPrec ListContainers
readList :: ReadS [ListContainers]
$creadList :: ReadS [ListContainers]
readsPrec :: Int -> ReadS ListContainers
$creadsPrec :: Int -> ReadS ListContainers
Prelude.Read, Int -> ListContainers -> ShowS
[ListContainers] -> ShowS
ListContainers -> String
(Int -> ListContainers -> ShowS)
-> (ListContainers -> String)
-> ([ListContainers] -> ShowS)
-> Show ListContainers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListContainers] -> ShowS
$cshowList :: [ListContainers] -> ShowS
show :: ListContainers -> String
$cshow :: ListContainers -> String
showsPrec :: Int -> ListContainers -> ShowS
$cshowsPrec :: Int -> ListContainers -> ShowS
Prelude.Show, (forall x. ListContainers -> Rep ListContainers x)
-> (forall x. Rep ListContainers x -> ListContainers)
-> Generic ListContainers
forall x. Rep ListContainers x -> ListContainers
forall x. ListContainers -> Rep ListContainers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListContainers x -> ListContainers
$cfrom :: forall x. ListContainers -> Rep ListContainers x
Prelude.Generic)
newListContainers ::
ListContainers
newListContainers :: ListContainers
newListContainers =
ListContainers' :: Maybe Text -> Maybe Natural -> ListContainers
ListContainers'
{ $sel:nextToken:ListContainers' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListContainers' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listContainers_nextToken :: Lens.Lens' ListContainers (Prelude.Maybe Prelude.Text)
listContainers_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListContainers -> f ListContainers
listContainers_nextToken = (ListContainers -> Maybe Text)
-> (ListContainers -> Maybe Text -> ListContainers)
-> Lens ListContainers ListContainers (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContainers' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListContainers' :: ListContainers -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListContainers
s@ListContainers' {} Maybe Text
a -> ListContainers
s {$sel:nextToken:ListContainers' :: Maybe Text
nextToken = Maybe Text
a} :: ListContainers)
listContainers_maxResults :: Lens.Lens' ListContainers (Prelude.Maybe Prelude.Natural)
listContainers_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListContainers -> f ListContainers
listContainers_maxResults = (ListContainers -> Maybe Natural)
-> (ListContainers -> Maybe Natural -> ListContainers)
-> Lens
ListContainers ListContainers (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContainers' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListContainers' :: ListContainers -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListContainers
s@ListContainers' {} Maybe Natural
a -> ListContainers
s {$sel:maxResults:ListContainers' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListContainers)
instance Core.AWSPager ListContainers where
page :: ListContainers
-> AWSResponse ListContainers -> Maybe ListContainers
page ListContainers
rq AWSResponse ListContainers
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListContainers
ListContainersResponse
rs
ListContainersResponse
-> Getting (First Text) ListContainersResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListContainersResponse
-> Const (First Text) ListContainersResponse
Lens' ListContainersResponse (Maybe Text)
listContainersResponse_nextToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> ListContainersResponse
-> Const (First Text) ListContainersResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListContainersResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListContainers
forall a. Maybe a
Prelude.Nothing
| [Container] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
(AWSResponse ListContainers
ListContainersResponse
rs ListContainersResponse
-> Getting [Container] ListContainersResponse [Container]
-> [Container]
forall s a. s -> Getting a s a -> a
Lens.^. Getting [Container] ListContainersResponse [Container]
Lens' ListContainersResponse [Container]
listContainersResponse_containers) =
Maybe ListContainers
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListContainers -> Maybe ListContainers
forall a. a -> Maybe a
Prelude.Just (ListContainers -> Maybe ListContainers)
-> ListContainers -> Maybe ListContainers
forall a b. (a -> b) -> a -> b
Prelude.$
ListContainers
rq
ListContainers
-> (ListContainers -> ListContainers) -> ListContainers
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListContainers -> Identity ListContainers
Lens ListContainers ListContainers (Maybe Text) (Maybe Text)
listContainers_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListContainers -> Identity ListContainers)
-> Maybe Text -> ListContainers -> ListContainers
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListContainers
ListContainersResponse
rs
ListContainersResponse
-> Getting (First Text) ListContainersResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListContainersResponse
-> Const (First Text) ListContainersResponse
Lens' ListContainersResponse (Maybe Text)
listContainersResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListContainersResponse
-> Const (First Text) ListContainersResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListContainersResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListContainers where
type
AWSResponse ListContainers =
ListContainersResponse
request :: ListContainers -> Request ListContainers
request = Service -> ListContainers -> Request ListContainers
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListContainers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListContainers)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListContainers))
-> Logger
-> Service
-> Proxy ListContainers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListContainers)))
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 -> Int -> [Container] -> ListContainersResponse
ListContainersResponse'
(Maybe Text -> Int -> [Container] -> ListContainersResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [Container] -> ListContainersResponse)
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 (Int -> [Container] -> ListContainersResponse)
-> Either String Int
-> Either String ([Container] -> ListContainersResponse)
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))
Either String ([Container] -> ListContainersResponse)
-> Either String [Container]
-> Either String ListContainersResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [Container])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Containers" Either String (Maybe [Container])
-> [Container] -> Either String [Container]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Container]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListContainers
instance Prelude.NFData ListContainers
instance Core.ToHeaders ListContainers where
toHeaders :: ListContainers -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListContainers -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"MediaStore_20170901.ListContainers" ::
Prelude.ByteString
),
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 ListContainers where
toJSON :: ListContainers -> Value
toJSON ListContainers' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListContainers' :: ListContainers -> Maybe Natural
$sel:nextToken:ListContainers' :: ListContainers -> 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 ListContainers where
toPath :: ListContainers -> ByteString
toPath = ByteString -> ListContainers -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListContainers where
toQuery :: ListContainers -> QueryString
toQuery = QueryString -> ListContainers -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListContainersResponse = ListContainersResponse'
{
ListContainersResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListContainersResponse -> Int
httpStatus :: Prelude.Int,
ListContainersResponse -> [Container]
containers :: [Container]
}
deriving (ListContainersResponse -> ListContainersResponse -> Bool
(ListContainersResponse -> ListContainersResponse -> Bool)
-> (ListContainersResponse -> ListContainersResponse -> Bool)
-> Eq ListContainersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListContainersResponse -> ListContainersResponse -> Bool
$c/= :: ListContainersResponse -> ListContainersResponse -> Bool
== :: ListContainersResponse -> ListContainersResponse -> Bool
$c== :: ListContainersResponse -> ListContainersResponse -> Bool
Prelude.Eq, ReadPrec [ListContainersResponse]
ReadPrec ListContainersResponse
Int -> ReadS ListContainersResponse
ReadS [ListContainersResponse]
(Int -> ReadS ListContainersResponse)
-> ReadS [ListContainersResponse]
-> ReadPrec ListContainersResponse
-> ReadPrec [ListContainersResponse]
-> Read ListContainersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListContainersResponse]
$creadListPrec :: ReadPrec [ListContainersResponse]
readPrec :: ReadPrec ListContainersResponse
$creadPrec :: ReadPrec ListContainersResponse
readList :: ReadS [ListContainersResponse]
$creadList :: ReadS [ListContainersResponse]
readsPrec :: Int -> ReadS ListContainersResponse
$creadsPrec :: Int -> ReadS ListContainersResponse
Prelude.Read, Int -> ListContainersResponse -> ShowS
[ListContainersResponse] -> ShowS
ListContainersResponse -> String
(Int -> ListContainersResponse -> ShowS)
-> (ListContainersResponse -> String)
-> ([ListContainersResponse] -> ShowS)
-> Show ListContainersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListContainersResponse] -> ShowS
$cshowList :: [ListContainersResponse] -> ShowS
show :: ListContainersResponse -> String
$cshow :: ListContainersResponse -> String
showsPrec :: Int -> ListContainersResponse -> ShowS
$cshowsPrec :: Int -> ListContainersResponse -> ShowS
Prelude.Show, (forall x. ListContainersResponse -> Rep ListContainersResponse x)
-> (forall x.
Rep ListContainersResponse x -> ListContainersResponse)
-> Generic ListContainersResponse
forall x. Rep ListContainersResponse x -> ListContainersResponse
forall x. ListContainersResponse -> Rep ListContainersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListContainersResponse x -> ListContainersResponse
$cfrom :: forall x. ListContainersResponse -> Rep ListContainersResponse x
Prelude.Generic)
newListContainersResponse ::
Prelude.Int ->
ListContainersResponse
newListContainersResponse :: Int -> ListContainersResponse
newListContainersResponse Int
pHttpStatus_ =
ListContainersResponse' :: Maybe Text -> Int -> [Container] -> ListContainersResponse
ListContainersResponse'
{ $sel:nextToken:ListContainersResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListContainersResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:containers:ListContainersResponse' :: [Container]
containers = [Container]
forall a. Monoid a => a
Prelude.mempty
}
listContainersResponse_nextToken :: Lens.Lens' ListContainersResponse (Prelude.Maybe Prelude.Text)
listContainersResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListContainersResponse -> f ListContainersResponse
listContainersResponse_nextToken = (ListContainersResponse -> Maybe Text)
-> (ListContainersResponse -> Maybe Text -> ListContainersResponse)
-> Lens' ListContainersResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContainersResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListContainersResponse' :: ListContainersResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListContainersResponse
s@ListContainersResponse' {} Maybe Text
a -> ListContainersResponse
s {$sel:nextToken:ListContainersResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListContainersResponse)
listContainersResponse_httpStatus :: Lens.Lens' ListContainersResponse Prelude.Int
listContainersResponse_httpStatus :: (Int -> f Int)
-> ListContainersResponse -> f ListContainersResponse
listContainersResponse_httpStatus = (ListContainersResponse -> Int)
-> (ListContainersResponse -> Int -> ListContainersResponse)
-> Lens ListContainersResponse ListContainersResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContainersResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListContainersResponse' :: ListContainersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListContainersResponse
s@ListContainersResponse' {} Int
a -> ListContainersResponse
s {$sel:httpStatus:ListContainersResponse' :: Int
httpStatus = Int
a} :: ListContainersResponse)
listContainersResponse_containers :: Lens.Lens' ListContainersResponse [Container]
listContainersResponse_containers :: ([Container] -> f [Container])
-> ListContainersResponse -> f ListContainersResponse
listContainersResponse_containers = (ListContainersResponse -> [Container])
-> (ListContainersResponse
-> [Container] -> ListContainersResponse)
-> Lens' ListContainersResponse [Container]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContainersResponse' {[Container]
containers :: [Container]
$sel:containers:ListContainersResponse' :: ListContainersResponse -> [Container]
containers} -> [Container]
containers) (\s :: ListContainersResponse
s@ListContainersResponse' {} [Container]
a -> ListContainersResponse
s {$sel:containers:ListContainersResponse' :: [Container]
containers = [Container]
a} :: ListContainersResponse) (([Container] -> f [Container])
-> ListContainersResponse -> f ListContainersResponse)
-> (([Container] -> f [Container]) -> [Container] -> f [Container])
-> ([Container] -> f [Container])
-> ListContainersResponse
-> f ListContainersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Container] -> f [Container]) -> [Container] -> f [Container]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListContainersResponse