{-# 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.StorageGateway.ListTapes
(
ListTapes (..),
newListTapes,
listTapes_limit,
listTapes_marker,
listTapes_tapeARNs,
ListTapesResponse (..),
newListTapesResponse,
listTapesResponse_marker,
listTapesResponse_tapeInfos,
listTapesResponse_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.StorageGateway.Types
data ListTapes = ListTapes'
{
ListTapes -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
ListTapes -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
ListTapes -> Maybe [Text]
tapeARNs :: Prelude.Maybe [Prelude.Text]
}
deriving (ListTapes -> ListTapes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTapes -> ListTapes -> Bool
$c/= :: ListTapes -> ListTapes -> Bool
== :: ListTapes -> ListTapes -> Bool
$c== :: ListTapes -> ListTapes -> Bool
Prelude.Eq, ReadPrec [ListTapes]
ReadPrec ListTapes
Int -> ReadS ListTapes
ReadS [ListTapes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTapes]
$creadListPrec :: ReadPrec [ListTapes]
readPrec :: ReadPrec ListTapes
$creadPrec :: ReadPrec ListTapes
readList :: ReadS [ListTapes]
$creadList :: ReadS [ListTapes]
readsPrec :: Int -> ReadS ListTapes
$creadsPrec :: Int -> ReadS ListTapes
Prelude.Read, Int -> ListTapes -> ShowS
[ListTapes] -> ShowS
ListTapes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTapes] -> ShowS
$cshowList :: [ListTapes] -> ShowS
show :: ListTapes -> String
$cshow :: ListTapes -> String
showsPrec :: Int -> ListTapes -> ShowS
$cshowsPrec :: Int -> ListTapes -> ShowS
Prelude.Show, forall x. Rep ListTapes x -> ListTapes
forall x. ListTapes -> Rep ListTapes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTapes x -> ListTapes
$cfrom :: forall x. ListTapes -> Rep ListTapes x
Prelude.Generic)
newListTapes ::
ListTapes
newListTapes :: ListTapes
newListTapes =
ListTapes'
{ $sel:limit:ListTapes' :: Maybe Natural
limit = forall a. Maybe a
Prelude.Nothing,
$sel:marker:ListTapes' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
$sel:tapeARNs:ListTapes' :: Maybe [Text]
tapeARNs = forall a. Maybe a
Prelude.Nothing
}
listTapes_limit :: Lens.Lens' ListTapes (Prelude.Maybe Prelude.Natural)
listTapes_limit :: Lens' ListTapes (Maybe Natural)
listTapes_limit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTapes' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListTapes' :: ListTapes -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListTapes
s@ListTapes' {} Maybe Natural
a -> ListTapes
s {$sel:limit:ListTapes' :: Maybe Natural
limit = Maybe Natural
a} :: ListTapes)
listTapes_marker :: Lens.Lens' ListTapes (Prelude.Maybe Prelude.Text)
listTapes_marker :: Lens' ListTapes (Maybe Text)
listTapes_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTapes' {Maybe Text
marker :: Maybe Text
$sel:marker:ListTapes' :: ListTapes -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListTapes
s@ListTapes' {} Maybe Text
a -> ListTapes
s {$sel:marker:ListTapes' :: Maybe Text
marker = Maybe Text
a} :: ListTapes)
listTapes_tapeARNs :: Lens.Lens' ListTapes (Prelude.Maybe [Prelude.Text])
listTapes_tapeARNs :: Lens' ListTapes (Maybe [Text])
listTapes_tapeARNs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTapes' {Maybe [Text]
tapeARNs :: Maybe [Text]
$sel:tapeARNs:ListTapes' :: ListTapes -> Maybe [Text]
tapeARNs} -> Maybe [Text]
tapeARNs) (\s :: ListTapes
s@ListTapes' {} Maybe [Text]
a -> ListTapes
s {$sel:tapeARNs:ListTapes' :: Maybe [Text]
tapeARNs = Maybe [Text]
a} :: ListTapes) 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
instance Core.AWSPager ListTapes where
page :: ListTapes -> AWSResponse ListTapes -> Maybe ListTapes
page ListTapes
rq AWSResponse ListTapes
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListTapes
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListTapesResponse (Maybe Text)
listTapesResponse_marker
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 ListTapes
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListTapesResponse (Maybe [TapeInfo])
listTapesResponse_tapeInfos
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
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListTapes
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListTapes (Maybe Text)
listTapes_marker
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListTapes
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListTapesResponse (Maybe Text)
listTapesResponse_marker
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 ListTapes where
type AWSResponse ListTapes = ListTapesResponse
request :: (Service -> Service) -> ListTapes -> Request ListTapes
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 ListTapes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTapes)))
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 -> Maybe [TapeInfo] -> Int -> ListTapesResponse
ListTapesResponse'
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
"Marker")
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
"TapeInfos" 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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListTapes where
hashWithSalt :: Int -> ListTapes -> Int
hashWithSalt Int
_salt ListTapes' {Maybe Natural
Maybe [Text]
Maybe Text
tapeARNs :: Maybe [Text]
marker :: Maybe Text
limit :: Maybe Natural
$sel:tapeARNs:ListTapes' :: ListTapes -> Maybe [Text]
$sel:marker:ListTapes' :: ListTapes -> Maybe Text
$sel:limit:ListTapes' :: ListTapes -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
limit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
marker
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
tapeARNs
instance Prelude.NFData ListTapes where
rnf :: ListTapes -> ()
rnf ListTapes' {Maybe Natural
Maybe [Text]
Maybe Text
tapeARNs :: Maybe [Text]
marker :: Maybe Text
limit :: Maybe Natural
$sel:tapeARNs:ListTapes' :: ListTapes -> Maybe [Text]
$sel:marker:ListTapes' :: ListTapes -> Maybe Text
$sel:limit:ListTapes' :: ListTapes -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
limit
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
tapeARNs
instance Data.ToHeaders ListTapes where
toHeaders :: ListTapes -> 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
"StorageGateway_20130630.ListTapes" ::
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 ListTapes where
toJSON :: ListTapes -> Value
toJSON ListTapes' {Maybe Natural
Maybe [Text]
Maybe Text
tapeARNs :: Maybe [Text]
marker :: Maybe Text
limit :: Maybe Natural
$sel:tapeARNs:ListTapes' :: ListTapes -> Maybe [Text]
$sel:marker:ListTapes' :: ListTapes -> Maybe Text
$sel:limit:ListTapes' :: ListTapes -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Limit" 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
limit,
(Key
"Marker" 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
marker,
(Key
"TapeARNs" 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]
tapeARNs
]
)
instance Data.ToPath ListTapes where
toPath :: ListTapes -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListTapes where
toQuery :: ListTapes -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListTapesResponse = ListTapesResponse'
{
ListTapesResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
ListTapesResponse -> Maybe [TapeInfo]
tapeInfos :: Prelude.Maybe [TapeInfo],
ListTapesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListTapesResponse -> ListTapesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTapesResponse -> ListTapesResponse -> Bool
$c/= :: ListTapesResponse -> ListTapesResponse -> Bool
== :: ListTapesResponse -> ListTapesResponse -> Bool
$c== :: ListTapesResponse -> ListTapesResponse -> Bool
Prelude.Eq, ReadPrec [ListTapesResponse]
ReadPrec ListTapesResponse
Int -> ReadS ListTapesResponse
ReadS [ListTapesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTapesResponse]
$creadListPrec :: ReadPrec [ListTapesResponse]
readPrec :: ReadPrec ListTapesResponse
$creadPrec :: ReadPrec ListTapesResponse
readList :: ReadS [ListTapesResponse]
$creadList :: ReadS [ListTapesResponse]
readsPrec :: Int -> ReadS ListTapesResponse
$creadsPrec :: Int -> ReadS ListTapesResponse
Prelude.Read, Int -> ListTapesResponse -> ShowS
[ListTapesResponse] -> ShowS
ListTapesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTapesResponse] -> ShowS
$cshowList :: [ListTapesResponse] -> ShowS
show :: ListTapesResponse -> String
$cshow :: ListTapesResponse -> String
showsPrec :: Int -> ListTapesResponse -> ShowS
$cshowsPrec :: Int -> ListTapesResponse -> ShowS
Prelude.Show, forall x. Rep ListTapesResponse x -> ListTapesResponse
forall x. ListTapesResponse -> Rep ListTapesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTapesResponse x -> ListTapesResponse
$cfrom :: forall x. ListTapesResponse -> Rep ListTapesResponse x
Prelude.Generic)
newListTapesResponse ::
Prelude.Int ->
ListTapesResponse
newListTapesResponse :: Int -> ListTapesResponse
newListTapesResponse Int
pHttpStatus_ =
ListTapesResponse'
{ $sel:marker:ListTapesResponse' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
$sel:tapeInfos:ListTapesResponse' :: Maybe [TapeInfo]
tapeInfos = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListTapesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listTapesResponse_marker :: Lens.Lens' ListTapesResponse (Prelude.Maybe Prelude.Text)
listTapesResponse_marker :: Lens' ListTapesResponse (Maybe Text)
listTapesResponse_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTapesResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:ListTapesResponse' :: ListTapesResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListTapesResponse
s@ListTapesResponse' {} Maybe Text
a -> ListTapesResponse
s {$sel:marker:ListTapesResponse' :: Maybe Text
marker = Maybe Text
a} :: ListTapesResponse)
listTapesResponse_tapeInfos :: Lens.Lens' ListTapesResponse (Prelude.Maybe [TapeInfo])
listTapesResponse_tapeInfos :: Lens' ListTapesResponse (Maybe [TapeInfo])
listTapesResponse_tapeInfos = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTapesResponse' {Maybe [TapeInfo]
tapeInfos :: Maybe [TapeInfo]
$sel:tapeInfos:ListTapesResponse' :: ListTapesResponse -> Maybe [TapeInfo]
tapeInfos} -> Maybe [TapeInfo]
tapeInfos) (\s :: ListTapesResponse
s@ListTapesResponse' {} Maybe [TapeInfo]
a -> ListTapesResponse
s {$sel:tapeInfos:ListTapesResponse' :: Maybe [TapeInfo]
tapeInfos = Maybe [TapeInfo]
a} :: ListTapesResponse) 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
listTapesResponse_httpStatus :: Lens.Lens' ListTapesResponse Prelude.Int
listTapesResponse_httpStatus :: Lens' ListTapesResponse Int
listTapesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTapesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListTapesResponse' :: ListTapesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListTapesResponse
s@ListTapesResponse' {} Int
a -> ListTapesResponse
s {$sel:httpStatus:ListTapesResponse' :: Int
httpStatus = Int
a} :: ListTapesResponse)
instance Prelude.NFData ListTapesResponse where
rnf :: ListTapesResponse -> ()
rnf ListTapesResponse' {Int
Maybe [TapeInfo]
Maybe Text
httpStatus :: Int
tapeInfos :: Maybe [TapeInfo]
marker :: Maybe Text
$sel:httpStatus:ListTapesResponse' :: ListTapesResponse -> Int
$sel:tapeInfos:ListTapesResponse' :: ListTapesResponse -> Maybe [TapeInfo]
$sel:marker:ListTapesResponse' :: ListTapesResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [TapeInfo]
tapeInfos
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus