{-# 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_maxResults,
listContainers_nextToken,
ListContainersResponse (..),
newListContainersResponse,
listContainersResponse_nextToken,
listContainersResponse_httpStatus,
listContainersResponse_containers,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListContainers -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListContainers -> ListContainers -> Bool
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]
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
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. 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'
{ $sel:maxResults:ListContainers' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListContainers' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listContainers_maxResults :: Lens.Lens' ListContainers (Prelude.Maybe Prelude.Natural)
listContainers_maxResults :: Lens' ListContainers (Maybe Natural)
listContainers_maxResults = 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)
listContainers_nextToken :: Lens.Lens' ListContainers (Prelude.Maybe Prelude.Text)
listContainers_nextToken :: Lens' ListContainers (Maybe Text)
listContainers_nextToken = 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)
instance Core.AWSPager ListContainers where
page :: ListContainers
-> AWSResponse ListContainers -> Maybe ListContainers
page ListContainers
rq AWSResponse ListContainers
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListContainers
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListContainersResponse (Maybe Text)
listContainersResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
(AWSResponse ListContainers
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListContainersResponse [Container]
listContainersResponse_containers) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListContainers
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListContainers (Maybe Text)
listContainers_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListContainers
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListContainersResponse (Maybe Text)
listContainersResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListContainers where
type
AWSResponse ListContainers =
ListContainersResponse
request :: (Service -> Service) -> ListContainers -> Request ListContainers
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 ListContainers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListContainers)))
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 Text -> Int -> [Container] -> ListContainersResponse
ListContainersResponse'
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
"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))
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
"Containers" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListContainers where
hashWithSalt :: Int -> ListContainers -> Int
hashWithSalt Int
_salt ListContainers' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListContainers' :: ListContainers -> Maybe Text
$sel:maxResults:ListContainers' :: ListContainers -> 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
instance Prelude.NFData ListContainers where
rnf :: ListContainers -> ()
rnf ListContainers' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListContainers' :: ListContainers -> Maybe Text
$sel:maxResults:ListContainers' :: ListContainers -> 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
instance Data.ToHeaders ListContainers where
toHeaders :: ListContainers -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"MediaStore_20170901.ListContainers" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListContainers where
toJSON :: ListContainers -> Value
toJSON ListContainers' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListContainers' :: ListContainers -> Maybe Text
$sel:maxResults:ListContainers' :: ListContainers -> 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 ListContainers where
toPath :: ListContainers -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListContainers where
toQuery :: ListContainers -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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. 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'
{ $sel:nextToken:ListContainersResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListContainersResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:containers:ListContainersResponse' :: [Container]
containers = forall a. Monoid a => a
Prelude.mempty
}
listContainersResponse_nextToken :: Lens.Lens' ListContainersResponse (Prelude.Maybe Prelude.Text)
listContainersResponse_nextToken :: Lens' ListContainersResponse (Maybe Text)
listContainersResponse_nextToken = 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 :: Lens' ListContainersResponse Int
listContainersResponse_httpStatus = 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 :: Lens' ListContainersResponse [Container]
listContainersResponse_containers = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListContainersResponse where
rnf :: ListContainersResponse -> ()
rnf ListContainersResponse' {Int
[Container]
Maybe Text
containers :: [Container]
httpStatus :: Int
nextToken :: Maybe Text
$sel:containers:ListContainersResponse' :: ListContainersResponse -> [Container]
$sel:httpStatus:ListContainersResponse' :: ListContainersResponse -> Int
$sel:nextToken:ListContainersResponse' :: ListContainersResponse -> Maybe Text
..} =
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
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Container]
containers