{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.DeviceFarm.ListUploads
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets information about uploads, given an AWS Device Farm project ARN.
--
-- This operation returns paginated results.
module Amazonka.DeviceFarm.ListUploads
  ( -- * Creating a Request
    ListUploads (..),
    newListUploads,

    -- * Request Lenses
    listUploads_nextToken,
    listUploads_type,
    listUploads_arn,

    -- * Destructuring the Response
    ListUploadsResponse (..),
    newListUploadsResponse,

    -- * Response Lenses
    listUploadsResponse_nextToken,
    listUploadsResponse_uploads,
    listUploadsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DeviceFarm.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Represents a request to the list uploads operation.
--
-- /See:/ 'newListUploads' smart constructor.
data ListUploads = ListUploads'
  { -- | An identifier that was returned from the previous call to this
    -- operation, which can be used to return the next set of items in the
    -- list.
    ListUploads -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The type of upload.
    --
    -- Must be one of the following values:
    --
    -- -   ANDROID_APP
    --
    -- -   IOS_APP
    --
    -- -   WEB_APP
    --
    -- -   EXTERNAL_DATA
    --
    -- -   APPIUM_JAVA_JUNIT_TEST_PACKAGE
    --
    -- -   APPIUM_JAVA_TESTNG_TEST_PACKAGE
    --
    -- -   APPIUM_PYTHON_TEST_PACKAGE
    --
    -- -   APPIUM_NODE_TEST_PACKAGE
    --
    -- -   APPIUM_RUBY_TEST_PACKAGE
    --
    -- -   APPIUM_WEB_JAVA_JUNIT_TEST_PACKAGE
    --
    -- -   APPIUM_WEB_JAVA_TESTNG_TEST_PACKAGE
    --
    -- -   APPIUM_WEB_PYTHON_TEST_PACKAGE
    --
    -- -   APPIUM_WEB_NODE_TEST_PACKAGE
    --
    -- -   APPIUM_WEB_RUBY_TEST_PACKAGE
    --
    -- -   CALABASH_TEST_PACKAGE
    --
    -- -   INSTRUMENTATION_TEST_PACKAGE
    --
    -- -   UIAUTOMATION_TEST_PACKAGE
    --
    -- -   UIAUTOMATOR_TEST_PACKAGE
    --
    -- -   XCTEST_TEST_PACKAGE
    --
    -- -   XCTEST_UI_TEST_PACKAGE
    --
    -- -   APPIUM_JAVA_JUNIT_TEST_SPEC
    --
    -- -   APPIUM_JAVA_TESTNG_TEST_SPEC
    --
    -- -   APPIUM_PYTHON_TEST_SPEC
    --
    -- -   APPIUM_NODE_TEST_SPEC
    --
    -- -   APPIUM_RUBY_TEST_SPEC
    --
    -- -   APPIUM_WEB_JAVA_JUNIT_TEST_SPEC
    --
    -- -   APPIUM_WEB_JAVA_TESTNG_TEST_SPEC
    --
    -- -   APPIUM_WEB_PYTHON_TEST_SPEC
    --
    -- -   APPIUM_WEB_NODE_TEST_SPEC
    --
    -- -   APPIUM_WEB_RUBY_TEST_SPEC
    --
    -- -   INSTRUMENTATION_TEST_SPEC
    --
    -- -   XCTEST_UI_TEST_SPEC
    ListUploads -> Maybe UploadType
type' :: Prelude.Maybe UploadType,
    -- | The Amazon Resource Name (ARN) of the project for which you want to list
    -- uploads.
    ListUploads -> Text
arn :: Prelude.Text
  }
  deriving (ListUploads -> ListUploads -> Bool
(ListUploads -> ListUploads -> Bool)
-> (ListUploads -> ListUploads -> Bool) -> Eq ListUploads
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListUploads -> ListUploads -> Bool
$c/= :: ListUploads -> ListUploads -> Bool
== :: ListUploads -> ListUploads -> Bool
$c== :: ListUploads -> ListUploads -> Bool
Prelude.Eq, ReadPrec [ListUploads]
ReadPrec ListUploads
Int -> ReadS ListUploads
ReadS [ListUploads]
(Int -> ReadS ListUploads)
-> ReadS [ListUploads]
-> ReadPrec ListUploads
-> ReadPrec [ListUploads]
-> Read ListUploads
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListUploads]
$creadListPrec :: ReadPrec [ListUploads]
readPrec :: ReadPrec ListUploads
$creadPrec :: ReadPrec ListUploads
readList :: ReadS [ListUploads]
$creadList :: ReadS [ListUploads]
readsPrec :: Int -> ReadS ListUploads
$creadsPrec :: Int -> ReadS ListUploads
Prelude.Read, Int -> ListUploads -> ShowS
[ListUploads] -> ShowS
ListUploads -> String
(Int -> ListUploads -> ShowS)
-> (ListUploads -> String)
-> ([ListUploads] -> ShowS)
-> Show ListUploads
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListUploads] -> ShowS
$cshowList :: [ListUploads] -> ShowS
show :: ListUploads -> String
$cshow :: ListUploads -> String
showsPrec :: Int -> ListUploads -> ShowS
$cshowsPrec :: Int -> ListUploads -> ShowS
Prelude.Show, (forall x. ListUploads -> Rep ListUploads x)
-> (forall x. Rep ListUploads x -> ListUploads)
-> Generic ListUploads
forall x. Rep ListUploads x -> ListUploads
forall x. ListUploads -> Rep ListUploads x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListUploads x -> ListUploads
$cfrom :: forall x. ListUploads -> Rep ListUploads x
Prelude.Generic)

-- |
-- Create a value of 'ListUploads' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listUploads_nextToken' - An identifier that was returned from the previous call to this
-- operation, which can be used to return the next set of items in the
-- list.
--
-- 'type'', 'listUploads_type' - The type of upload.
--
-- Must be one of the following values:
--
-- -   ANDROID_APP
--
-- -   IOS_APP
--
-- -   WEB_APP
--
-- -   EXTERNAL_DATA
--
-- -   APPIUM_JAVA_JUNIT_TEST_PACKAGE
--
-- -   APPIUM_JAVA_TESTNG_TEST_PACKAGE
--
-- -   APPIUM_PYTHON_TEST_PACKAGE
--
-- -   APPIUM_NODE_TEST_PACKAGE
--
-- -   APPIUM_RUBY_TEST_PACKAGE
--
-- -   APPIUM_WEB_JAVA_JUNIT_TEST_PACKAGE
--
-- -   APPIUM_WEB_JAVA_TESTNG_TEST_PACKAGE
--
-- -   APPIUM_WEB_PYTHON_TEST_PACKAGE
--
-- -   APPIUM_WEB_NODE_TEST_PACKAGE
--
-- -   APPIUM_WEB_RUBY_TEST_PACKAGE
--
-- -   CALABASH_TEST_PACKAGE
--
-- -   INSTRUMENTATION_TEST_PACKAGE
--
-- -   UIAUTOMATION_TEST_PACKAGE
--
-- -   UIAUTOMATOR_TEST_PACKAGE
--
-- -   XCTEST_TEST_PACKAGE
--
-- -   XCTEST_UI_TEST_PACKAGE
--
-- -   APPIUM_JAVA_JUNIT_TEST_SPEC
--
-- -   APPIUM_JAVA_TESTNG_TEST_SPEC
--
-- -   APPIUM_PYTHON_TEST_SPEC
--
-- -   APPIUM_NODE_TEST_SPEC
--
-- -   APPIUM_RUBY_TEST_SPEC
--
-- -   APPIUM_WEB_JAVA_JUNIT_TEST_SPEC
--
-- -   APPIUM_WEB_JAVA_TESTNG_TEST_SPEC
--
-- -   APPIUM_WEB_PYTHON_TEST_SPEC
--
-- -   APPIUM_WEB_NODE_TEST_SPEC
--
-- -   APPIUM_WEB_RUBY_TEST_SPEC
--
-- -   INSTRUMENTATION_TEST_SPEC
--
-- -   XCTEST_UI_TEST_SPEC
--
-- 'arn', 'listUploads_arn' - The Amazon Resource Name (ARN) of the project for which you want to list
-- uploads.
newListUploads ::
  -- | 'arn'
  Prelude.Text ->
  ListUploads
newListUploads :: Text -> ListUploads
newListUploads Text
pArn_ =
  ListUploads' :: Maybe Text -> Maybe UploadType -> Text -> ListUploads
ListUploads'
    { $sel:nextToken:ListUploads' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':ListUploads' :: Maybe UploadType
type' = Maybe UploadType
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:ListUploads' :: Text
arn = Text
pArn_
    }

-- | An identifier that was returned from the previous call to this
-- operation, which can be used to return the next set of items in the
-- list.
listUploads_nextToken :: Lens.Lens' ListUploads (Prelude.Maybe Prelude.Text)
listUploads_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListUploads -> f ListUploads
listUploads_nextToken = (ListUploads -> Maybe Text)
-> (ListUploads -> Maybe Text -> ListUploads)
-> Lens ListUploads ListUploads (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUploads' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListUploads' :: ListUploads -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListUploads
s@ListUploads' {} Maybe Text
a -> ListUploads
s {$sel:nextToken:ListUploads' :: Maybe Text
nextToken = Maybe Text
a} :: ListUploads)

-- | The type of upload.
--
-- Must be one of the following values:
--
-- -   ANDROID_APP
--
-- -   IOS_APP
--
-- -   WEB_APP
--
-- -   EXTERNAL_DATA
--
-- -   APPIUM_JAVA_JUNIT_TEST_PACKAGE
--
-- -   APPIUM_JAVA_TESTNG_TEST_PACKAGE
--
-- -   APPIUM_PYTHON_TEST_PACKAGE
--
-- -   APPIUM_NODE_TEST_PACKAGE
--
-- -   APPIUM_RUBY_TEST_PACKAGE
--
-- -   APPIUM_WEB_JAVA_JUNIT_TEST_PACKAGE
--
-- -   APPIUM_WEB_JAVA_TESTNG_TEST_PACKAGE
--
-- -   APPIUM_WEB_PYTHON_TEST_PACKAGE
--
-- -   APPIUM_WEB_NODE_TEST_PACKAGE
--
-- -   APPIUM_WEB_RUBY_TEST_PACKAGE
--
-- -   CALABASH_TEST_PACKAGE
--
-- -   INSTRUMENTATION_TEST_PACKAGE
--
-- -   UIAUTOMATION_TEST_PACKAGE
--
-- -   UIAUTOMATOR_TEST_PACKAGE
--
-- -   XCTEST_TEST_PACKAGE
--
-- -   XCTEST_UI_TEST_PACKAGE
--
-- -   APPIUM_JAVA_JUNIT_TEST_SPEC
--
-- -   APPIUM_JAVA_TESTNG_TEST_SPEC
--
-- -   APPIUM_PYTHON_TEST_SPEC
--
-- -   APPIUM_NODE_TEST_SPEC
--
-- -   APPIUM_RUBY_TEST_SPEC
--
-- -   APPIUM_WEB_JAVA_JUNIT_TEST_SPEC
--
-- -   APPIUM_WEB_JAVA_TESTNG_TEST_SPEC
--
-- -   APPIUM_WEB_PYTHON_TEST_SPEC
--
-- -   APPIUM_WEB_NODE_TEST_SPEC
--
-- -   APPIUM_WEB_RUBY_TEST_SPEC
--
-- -   INSTRUMENTATION_TEST_SPEC
--
-- -   XCTEST_UI_TEST_SPEC
listUploads_type :: Lens.Lens' ListUploads (Prelude.Maybe UploadType)
listUploads_type :: (Maybe UploadType -> f (Maybe UploadType))
-> ListUploads -> f ListUploads
listUploads_type = (ListUploads -> Maybe UploadType)
-> (ListUploads -> Maybe UploadType -> ListUploads)
-> Lens
     ListUploads ListUploads (Maybe UploadType) (Maybe UploadType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUploads' {Maybe UploadType
type' :: Maybe UploadType
$sel:type':ListUploads' :: ListUploads -> Maybe UploadType
type'} -> Maybe UploadType
type') (\s :: ListUploads
s@ListUploads' {} Maybe UploadType
a -> ListUploads
s {$sel:type':ListUploads' :: Maybe UploadType
type' = Maybe UploadType
a} :: ListUploads)

-- | The Amazon Resource Name (ARN) of the project for which you want to list
-- uploads.
listUploads_arn :: Lens.Lens' ListUploads Prelude.Text
listUploads_arn :: (Text -> f Text) -> ListUploads -> f ListUploads
listUploads_arn = (ListUploads -> Text)
-> (ListUploads -> Text -> ListUploads)
-> Lens ListUploads ListUploads Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUploads' {Text
arn :: Text
$sel:arn:ListUploads' :: ListUploads -> Text
arn} -> Text
arn) (\s :: ListUploads
s@ListUploads' {} Text
a -> ListUploads
s {$sel:arn:ListUploads' :: Text
arn = Text
a} :: ListUploads)

instance Core.AWSPager ListUploads where
  page :: ListUploads -> AWSResponse ListUploads -> Maybe ListUploads
page ListUploads
rq AWSResponse ListUploads
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListUploads
ListUploadsResponse
rs
            ListUploadsResponse
-> Getting (First Text) ListUploadsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListUploadsResponse -> Const (First Text) ListUploadsResponse
Lens' ListUploadsResponse (Maybe Text)
listUploadsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListUploadsResponse -> Const (First Text) ListUploadsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListUploadsResponse 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 ListUploads
forall a. Maybe a
Prelude.Nothing
    | Maybe [Upload] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListUploads
ListUploadsResponse
rs
            ListUploadsResponse
-> Getting (First [Upload]) ListUploadsResponse [Upload]
-> Maybe [Upload]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Upload] -> Const (First [Upload]) (Maybe [Upload]))
-> ListUploadsResponse
-> Const (First [Upload]) ListUploadsResponse
Lens' ListUploadsResponse (Maybe [Upload])
listUploadsResponse_uploads ((Maybe [Upload] -> Const (First [Upload]) (Maybe [Upload]))
 -> ListUploadsResponse
 -> Const (First [Upload]) ListUploadsResponse)
-> (([Upload] -> Const (First [Upload]) [Upload])
    -> Maybe [Upload] -> Const (First [Upload]) (Maybe [Upload]))
-> Getting (First [Upload]) ListUploadsResponse [Upload]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Upload] -> Const (First [Upload]) [Upload])
-> Maybe [Upload] -> Const (First [Upload]) (Maybe [Upload])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListUploads
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListUploads -> Maybe ListUploads
forall a. a -> Maybe a
Prelude.Just (ListUploads -> Maybe ListUploads)
-> ListUploads -> Maybe ListUploads
forall a b. (a -> b) -> a -> b
Prelude.$
        ListUploads
rq
          ListUploads -> (ListUploads -> ListUploads) -> ListUploads
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListUploads -> Identity ListUploads
Lens ListUploads ListUploads (Maybe Text) (Maybe Text)
listUploads_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListUploads -> Identity ListUploads)
-> Maybe Text -> ListUploads -> ListUploads
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListUploads
ListUploadsResponse
rs
          ListUploadsResponse
-> Getting (First Text) ListUploadsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListUploadsResponse -> Const (First Text) ListUploadsResponse
Lens' ListUploadsResponse (Maybe Text)
listUploadsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListUploadsResponse -> Const (First Text) ListUploadsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListUploadsResponse 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 ListUploads where
  type AWSResponse ListUploads = ListUploadsResponse
  request :: ListUploads -> Request ListUploads
request = Service -> ListUploads -> Request ListUploads
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListUploads
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListUploads)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListUploads))
-> Logger
-> Service
-> Proxy ListUploads
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListUploads)))
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 -> Maybe [Upload] -> Int -> ListUploadsResponse
ListUploadsResponse'
            (Maybe Text -> Maybe [Upload] -> Int -> ListUploadsResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [Upload] -> Int -> ListUploadsResponse)
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 (Maybe [Upload] -> Int -> ListUploadsResponse)
-> Either String (Maybe [Upload])
-> Either String (Int -> ListUploadsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Upload]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"uploads" Either String (Maybe (Maybe [Upload]))
-> Maybe [Upload] -> Either String (Maybe [Upload])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Upload]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> ListUploadsResponse)
-> Either String Int -> Either String ListUploadsResponse
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 ListUploads

instance Prelude.NFData ListUploads

instance Core.ToHeaders ListUploads where
  toHeaders :: ListUploads -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListUploads -> 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
"DeviceFarm_20150623.ListUploads" ::
                          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 ListUploads where
  toJSON :: ListUploads -> Value
toJSON ListUploads' {Maybe Text
Maybe UploadType
Text
arn :: Text
type' :: Maybe UploadType
nextToken :: Maybe Text
$sel:arn:ListUploads' :: ListUploads -> Text
$sel:type':ListUploads' :: ListUploads -> Maybe UploadType
$sel:nextToken:ListUploads' :: ListUploads -> 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
"type" Text -> UploadType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (UploadType -> Pair) -> Maybe UploadType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UploadType
type',
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"arn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
arn)
          ]
      )

instance Core.ToPath ListUploads where
  toPath :: ListUploads -> ByteString
toPath = ByteString -> ListUploads -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery ListUploads where
  toQuery :: ListUploads -> QueryString
toQuery = QueryString -> ListUploads -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | Represents the result of a list uploads request.
--
-- /See:/ 'newListUploadsResponse' smart constructor.
data ListUploadsResponse = ListUploadsResponse'
  { -- | If the number of items that are returned is significantly large, this is
    -- an identifier that is also returned. It can be used in a subsequent call
    -- to this operation to return the next set of items in the list.
    ListUploadsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Information about the uploads.
    ListUploadsResponse -> Maybe [Upload]
uploads :: Prelude.Maybe [Upload],
    -- | The response's http status code.
    ListUploadsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListUploadsResponse -> ListUploadsResponse -> Bool
(ListUploadsResponse -> ListUploadsResponse -> Bool)
-> (ListUploadsResponse -> ListUploadsResponse -> Bool)
-> Eq ListUploadsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListUploadsResponse -> ListUploadsResponse -> Bool
$c/= :: ListUploadsResponse -> ListUploadsResponse -> Bool
== :: ListUploadsResponse -> ListUploadsResponse -> Bool
$c== :: ListUploadsResponse -> ListUploadsResponse -> Bool
Prelude.Eq, Int -> ListUploadsResponse -> ShowS
[ListUploadsResponse] -> ShowS
ListUploadsResponse -> String
(Int -> ListUploadsResponse -> ShowS)
-> (ListUploadsResponse -> String)
-> ([ListUploadsResponse] -> ShowS)
-> Show ListUploadsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListUploadsResponse] -> ShowS
$cshowList :: [ListUploadsResponse] -> ShowS
show :: ListUploadsResponse -> String
$cshow :: ListUploadsResponse -> String
showsPrec :: Int -> ListUploadsResponse -> ShowS
$cshowsPrec :: Int -> ListUploadsResponse -> ShowS
Prelude.Show, (forall x. ListUploadsResponse -> Rep ListUploadsResponse x)
-> (forall x. Rep ListUploadsResponse x -> ListUploadsResponse)
-> Generic ListUploadsResponse
forall x. Rep ListUploadsResponse x -> ListUploadsResponse
forall x. ListUploadsResponse -> Rep ListUploadsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListUploadsResponse x -> ListUploadsResponse
$cfrom :: forall x. ListUploadsResponse -> Rep ListUploadsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListUploadsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listUploadsResponse_nextToken' - If the number of items that are returned is significantly large, this is
-- an identifier that is also returned. It can be used in a subsequent call
-- to this operation to return the next set of items in the list.
--
-- 'uploads', 'listUploadsResponse_uploads' - Information about the uploads.
--
-- 'httpStatus', 'listUploadsResponse_httpStatus' - The response's http status code.
newListUploadsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListUploadsResponse
newListUploadsResponse :: Int -> ListUploadsResponse
newListUploadsResponse Int
pHttpStatus_ =
  ListUploadsResponse' :: Maybe Text -> Maybe [Upload] -> Int -> ListUploadsResponse
ListUploadsResponse'
    { $sel:nextToken:ListUploadsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:uploads:ListUploadsResponse' :: Maybe [Upload]
uploads = Maybe [Upload]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListUploadsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If the number of items that are returned is significantly large, this is
-- an identifier that is also returned. It can be used in a subsequent call
-- to this operation to return the next set of items in the list.
listUploadsResponse_nextToken :: Lens.Lens' ListUploadsResponse (Prelude.Maybe Prelude.Text)
listUploadsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListUploadsResponse -> f ListUploadsResponse
listUploadsResponse_nextToken = (ListUploadsResponse -> Maybe Text)
-> (ListUploadsResponse -> Maybe Text -> ListUploadsResponse)
-> Lens' ListUploadsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUploadsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListUploadsResponse' :: ListUploadsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListUploadsResponse
s@ListUploadsResponse' {} Maybe Text
a -> ListUploadsResponse
s {$sel:nextToken:ListUploadsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListUploadsResponse)

-- | Information about the uploads.
listUploadsResponse_uploads :: Lens.Lens' ListUploadsResponse (Prelude.Maybe [Upload])
listUploadsResponse_uploads :: (Maybe [Upload] -> f (Maybe [Upload]))
-> ListUploadsResponse -> f ListUploadsResponse
listUploadsResponse_uploads = (ListUploadsResponse -> Maybe [Upload])
-> (ListUploadsResponse -> Maybe [Upload] -> ListUploadsResponse)
-> Lens' ListUploadsResponse (Maybe [Upload])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUploadsResponse' {Maybe [Upload]
uploads :: Maybe [Upload]
$sel:uploads:ListUploadsResponse' :: ListUploadsResponse -> Maybe [Upload]
uploads} -> Maybe [Upload]
uploads) (\s :: ListUploadsResponse
s@ListUploadsResponse' {} Maybe [Upload]
a -> ListUploadsResponse
s {$sel:uploads:ListUploadsResponse' :: Maybe [Upload]
uploads = Maybe [Upload]
a} :: ListUploadsResponse) ((Maybe [Upload] -> f (Maybe [Upload]))
 -> ListUploadsResponse -> f ListUploadsResponse)
-> ((Maybe [Upload] -> f (Maybe [Upload]))
    -> Maybe [Upload] -> f (Maybe [Upload]))
-> (Maybe [Upload] -> f (Maybe [Upload]))
-> ListUploadsResponse
-> f ListUploadsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Upload] [Upload] [Upload] [Upload]
-> Iso
     (Maybe [Upload]) (Maybe [Upload]) (Maybe [Upload]) (Maybe [Upload])
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 [Upload] [Upload] [Upload] [Upload]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
listUploadsResponse_httpStatus :: Lens.Lens' ListUploadsResponse Prelude.Int
listUploadsResponse_httpStatus :: (Int -> f Int) -> ListUploadsResponse -> f ListUploadsResponse
listUploadsResponse_httpStatus = (ListUploadsResponse -> Int)
-> (ListUploadsResponse -> Int -> ListUploadsResponse)
-> Lens ListUploadsResponse ListUploadsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUploadsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListUploadsResponse' :: ListUploadsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListUploadsResponse
s@ListUploadsResponse' {} Int
a -> ListUploadsResponse
s {$sel:httpStatus:ListUploadsResponse' :: Int
httpStatus = Int
a} :: ListUploadsResponse)

instance Prelude.NFData ListUploadsResponse