{-# 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.Translate.ListParallelData
-- 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)
--
-- Provides a list of your parallel data resources in Amazon Translate.
module Amazonka.Translate.ListParallelData
  ( -- * Creating a Request
    ListParallelData (..),
    newListParallelData,

    -- * Request Lenses
    listParallelData_nextToken,
    listParallelData_maxResults,

    -- * Destructuring the Response
    ListParallelDataResponse (..),
    newListParallelDataResponse,

    -- * Response Lenses
    listParallelDataResponse_parallelDataPropertiesList,
    listParallelDataResponse_nextToken,
    listParallelDataResponse_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.Translate.Types

-- | /See:/ 'newListParallelData' smart constructor.
data ListParallelData = ListParallelData'
  { -- | A string that specifies the next page of results to return in a
    -- paginated response.
    ListParallelData -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of parallel data resources returned for each request.
    ListParallelData -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListParallelData -> ListParallelData -> Bool
(ListParallelData -> ListParallelData -> Bool)
-> (ListParallelData -> ListParallelData -> Bool)
-> Eq ListParallelData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListParallelData -> ListParallelData -> Bool
$c/= :: ListParallelData -> ListParallelData -> Bool
== :: ListParallelData -> ListParallelData -> Bool
$c== :: ListParallelData -> ListParallelData -> Bool
Prelude.Eq, ReadPrec [ListParallelData]
ReadPrec ListParallelData
Int -> ReadS ListParallelData
ReadS [ListParallelData]
(Int -> ReadS ListParallelData)
-> ReadS [ListParallelData]
-> ReadPrec ListParallelData
-> ReadPrec [ListParallelData]
-> Read ListParallelData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListParallelData]
$creadListPrec :: ReadPrec [ListParallelData]
readPrec :: ReadPrec ListParallelData
$creadPrec :: ReadPrec ListParallelData
readList :: ReadS [ListParallelData]
$creadList :: ReadS [ListParallelData]
readsPrec :: Int -> ReadS ListParallelData
$creadsPrec :: Int -> ReadS ListParallelData
Prelude.Read, Int -> ListParallelData -> ShowS
[ListParallelData] -> ShowS
ListParallelData -> String
(Int -> ListParallelData -> ShowS)
-> (ListParallelData -> String)
-> ([ListParallelData] -> ShowS)
-> Show ListParallelData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListParallelData] -> ShowS
$cshowList :: [ListParallelData] -> ShowS
show :: ListParallelData -> String
$cshow :: ListParallelData -> String
showsPrec :: Int -> ListParallelData -> ShowS
$cshowsPrec :: Int -> ListParallelData -> ShowS
Prelude.Show, (forall x. ListParallelData -> Rep ListParallelData x)
-> (forall x. Rep ListParallelData x -> ListParallelData)
-> Generic ListParallelData
forall x. Rep ListParallelData x -> ListParallelData
forall x. ListParallelData -> Rep ListParallelData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListParallelData x -> ListParallelData
$cfrom :: forall x. ListParallelData -> Rep ListParallelData x
Prelude.Generic)

-- |
-- Create a value of 'ListParallelData' 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', 'listParallelData_nextToken' - A string that specifies the next page of results to return in a
-- paginated response.
--
-- 'maxResults', 'listParallelData_maxResults' - The maximum number of parallel data resources returned for each request.
newListParallelData ::
  ListParallelData
newListParallelData :: ListParallelData
newListParallelData =
  ListParallelData' :: Maybe Text -> Maybe Natural -> ListParallelData
ListParallelData'
    { $sel:nextToken:ListParallelData' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListParallelData' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | A string that specifies the next page of results to return in a
-- paginated response.
listParallelData_nextToken :: Lens.Lens' ListParallelData (Prelude.Maybe Prelude.Text)
listParallelData_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListParallelData -> f ListParallelData
listParallelData_nextToken = (ListParallelData -> Maybe Text)
-> (ListParallelData -> Maybe Text -> ListParallelData)
-> Lens ListParallelData ListParallelData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListParallelData' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListParallelData' :: ListParallelData -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListParallelData
s@ListParallelData' {} Maybe Text
a -> ListParallelData
s {$sel:nextToken:ListParallelData' :: Maybe Text
nextToken = Maybe Text
a} :: ListParallelData)

-- | The maximum number of parallel data resources returned for each request.
listParallelData_maxResults :: Lens.Lens' ListParallelData (Prelude.Maybe Prelude.Natural)
listParallelData_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListParallelData -> f ListParallelData
listParallelData_maxResults = (ListParallelData -> Maybe Natural)
-> (ListParallelData -> Maybe Natural -> ListParallelData)
-> Lens
     ListParallelData ListParallelData (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListParallelData' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListParallelData' :: ListParallelData -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListParallelData
s@ListParallelData' {} Maybe Natural
a -> ListParallelData
s {$sel:maxResults:ListParallelData' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListParallelData)

instance Core.AWSRequest ListParallelData where
  type
    AWSResponse ListParallelData =
      ListParallelDataResponse
  request :: ListParallelData -> Request ListParallelData
request = Service -> ListParallelData -> Request ListParallelData
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListParallelData
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListParallelData)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListParallelData))
-> Logger
-> Service
-> Proxy ListParallelData
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListParallelData)))
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 [ParallelDataProperties]
-> Maybe Text -> Int -> ListParallelDataResponse
ListParallelDataResponse'
            (Maybe [ParallelDataProperties]
 -> Maybe Text -> Int -> ListParallelDataResponse)
-> Either String (Maybe [ParallelDataProperties])
-> Either String (Maybe Text -> Int -> ListParallelDataResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [ParallelDataProperties]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ParallelDataPropertiesList"
                            Either String (Maybe (Maybe [ParallelDataProperties]))
-> Maybe [ParallelDataProperties]
-> Either String (Maybe [ParallelDataProperties])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ParallelDataProperties]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Maybe Text -> Int -> ListParallelDataResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListParallelDataResponse)
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 -> ListParallelDataResponse)
-> Either String Int -> Either String ListParallelDataResponse
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 ListParallelData

instance Prelude.NFData ListParallelData

instance Core.ToHeaders ListParallelData where
  toHeaders :: ListParallelData -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListParallelData -> 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
"AWSShineFrontendService_20170701.ListParallelData" ::
                          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 ListParallelData where
  toJSON :: ListParallelData -> Value
toJSON ListParallelData' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListParallelData' :: ListParallelData -> Maybe Natural
$sel:nextToken:ListParallelData' :: ListParallelData -> 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 ListParallelData where
  toPath :: ListParallelData -> ByteString
toPath = ByteString -> ListParallelData -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newListParallelDataResponse' smart constructor.
data ListParallelDataResponse = ListParallelDataResponse'
  { -- | The properties of the parallel data resources returned by this request.
    ListParallelDataResponse -> Maybe [ParallelDataProperties]
parallelDataPropertiesList :: Prelude.Maybe [ParallelDataProperties],
    -- | The string to use in a subsequent request to get the next page of
    -- results in a paginated response. This value is null if there are no
    -- additional pages.
    ListParallelDataResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListParallelDataResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListParallelDataResponse -> ListParallelDataResponse -> Bool
(ListParallelDataResponse -> ListParallelDataResponse -> Bool)
-> (ListParallelDataResponse -> ListParallelDataResponse -> Bool)
-> Eq ListParallelDataResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListParallelDataResponse -> ListParallelDataResponse -> Bool
$c/= :: ListParallelDataResponse -> ListParallelDataResponse -> Bool
== :: ListParallelDataResponse -> ListParallelDataResponse -> Bool
$c== :: ListParallelDataResponse -> ListParallelDataResponse -> Bool
Prelude.Eq, ReadPrec [ListParallelDataResponse]
ReadPrec ListParallelDataResponse
Int -> ReadS ListParallelDataResponse
ReadS [ListParallelDataResponse]
(Int -> ReadS ListParallelDataResponse)
-> ReadS [ListParallelDataResponse]
-> ReadPrec ListParallelDataResponse
-> ReadPrec [ListParallelDataResponse]
-> Read ListParallelDataResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListParallelDataResponse]
$creadListPrec :: ReadPrec [ListParallelDataResponse]
readPrec :: ReadPrec ListParallelDataResponse
$creadPrec :: ReadPrec ListParallelDataResponse
readList :: ReadS [ListParallelDataResponse]
$creadList :: ReadS [ListParallelDataResponse]
readsPrec :: Int -> ReadS ListParallelDataResponse
$creadsPrec :: Int -> ReadS ListParallelDataResponse
Prelude.Read, Int -> ListParallelDataResponse -> ShowS
[ListParallelDataResponse] -> ShowS
ListParallelDataResponse -> String
(Int -> ListParallelDataResponse -> ShowS)
-> (ListParallelDataResponse -> String)
-> ([ListParallelDataResponse] -> ShowS)
-> Show ListParallelDataResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListParallelDataResponse] -> ShowS
$cshowList :: [ListParallelDataResponse] -> ShowS
show :: ListParallelDataResponse -> String
$cshow :: ListParallelDataResponse -> String
showsPrec :: Int -> ListParallelDataResponse -> ShowS
$cshowsPrec :: Int -> ListParallelDataResponse -> ShowS
Prelude.Show, (forall x.
 ListParallelDataResponse -> Rep ListParallelDataResponse x)
-> (forall x.
    Rep ListParallelDataResponse x -> ListParallelDataResponse)
-> Generic ListParallelDataResponse
forall x.
Rep ListParallelDataResponse x -> ListParallelDataResponse
forall x.
ListParallelDataResponse -> Rep ListParallelDataResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListParallelDataResponse x -> ListParallelDataResponse
$cfrom :: forall x.
ListParallelDataResponse -> Rep ListParallelDataResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListParallelDataResponse' 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:
--
-- 'parallelDataPropertiesList', 'listParallelDataResponse_parallelDataPropertiesList' - The properties of the parallel data resources returned by this request.
--
-- 'nextToken', 'listParallelDataResponse_nextToken' - The string to use in a subsequent request to get the next page of
-- results in a paginated response. This value is null if there are no
-- additional pages.
--
-- 'httpStatus', 'listParallelDataResponse_httpStatus' - The response's http status code.
newListParallelDataResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListParallelDataResponse
newListParallelDataResponse :: Int -> ListParallelDataResponse
newListParallelDataResponse Int
pHttpStatus_ =
  ListParallelDataResponse' :: Maybe [ParallelDataProperties]
-> Maybe Text -> Int -> ListParallelDataResponse
ListParallelDataResponse'
    { $sel:parallelDataPropertiesList:ListParallelDataResponse' :: Maybe [ParallelDataProperties]
parallelDataPropertiesList =
        Maybe [ParallelDataProperties]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListParallelDataResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListParallelDataResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The properties of the parallel data resources returned by this request.
listParallelDataResponse_parallelDataPropertiesList :: Lens.Lens' ListParallelDataResponse (Prelude.Maybe [ParallelDataProperties])
listParallelDataResponse_parallelDataPropertiesList :: (Maybe [ParallelDataProperties]
 -> f (Maybe [ParallelDataProperties]))
-> ListParallelDataResponse -> f ListParallelDataResponse
listParallelDataResponse_parallelDataPropertiesList = (ListParallelDataResponse -> Maybe [ParallelDataProperties])
-> (ListParallelDataResponse
    -> Maybe [ParallelDataProperties] -> ListParallelDataResponse)
-> Lens
     ListParallelDataResponse
     ListParallelDataResponse
     (Maybe [ParallelDataProperties])
     (Maybe [ParallelDataProperties])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListParallelDataResponse' {Maybe [ParallelDataProperties]
parallelDataPropertiesList :: Maybe [ParallelDataProperties]
$sel:parallelDataPropertiesList:ListParallelDataResponse' :: ListParallelDataResponse -> Maybe [ParallelDataProperties]
parallelDataPropertiesList} -> Maybe [ParallelDataProperties]
parallelDataPropertiesList) (\s :: ListParallelDataResponse
s@ListParallelDataResponse' {} Maybe [ParallelDataProperties]
a -> ListParallelDataResponse
s {$sel:parallelDataPropertiesList:ListParallelDataResponse' :: Maybe [ParallelDataProperties]
parallelDataPropertiesList = Maybe [ParallelDataProperties]
a} :: ListParallelDataResponse) ((Maybe [ParallelDataProperties]
  -> f (Maybe [ParallelDataProperties]))
 -> ListParallelDataResponse -> f ListParallelDataResponse)
-> ((Maybe [ParallelDataProperties]
     -> f (Maybe [ParallelDataProperties]))
    -> Maybe [ParallelDataProperties]
    -> f (Maybe [ParallelDataProperties]))
-> (Maybe [ParallelDataProperties]
    -> f (Maybe [ParallelDataProperties]))
-> ListParallelDataResponse
-> f ListParallelDataResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ParallelDataProperties]
  [ParallelDataProperties]
  [ParallelDataProperties]
  [ParallelDataProperties]
-> Iso
     (Maybe [ParallelDataProperties])
     (Maybe [ParallelDataProperties])
     (Maybe [ParallelDataProperties])
     (Maybe [ParallelDataProperties])
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
  [ParallelDataProperties]
  [ParallelDataProperties]
  [ParallelDataProperties]
  [ParallelDataProperties]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The string to use in a subsequent request to get the next page of
-- results in a paginated response. This value is null if there are no
-- additional pages.
listParallelDataResponse_nextToken :: Lens.Lens' ListParallelDataResponse (Prelude.Maybe Prelude.Text)
listParallelDataResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListParallelDataResponse -> f ListParallelDataResponse
listParallelDataResponse_nextToken = (ListParallelDataResponse -> Maybe Text)
-> (ListParallelDataResponse
    -> Maybe Text -> ListParallelDataResponse)
-> Lens
     ListParallelDataResponse
     ListParallelDataResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListParallelDataResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListParallelDataResponse' :: ListParallelDataResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListParallelDataResponse
s@ListParallelDataResponse' {} Maybe Text
a -> ListParallelDataResponse
s {$sel:nextToken:ListParallelDataResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListParallelDataResponse)

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

instance Prelude.NFData ListParallelDataResponse