{-# 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.HoneyCode.StartTableDataImportJob
-- 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)
--
-- The StartTableDataImportJob API allows you to start an import job on a
-- table. This API will only return the id of the job that was started. To
-- find out the status of the import request, you need to call the
-- DescribeTableDataImportJob API.
module Amazonka.HoneyCode.StartTableDataImportJob
  ( -- * Creating a Request
    StartTableDataImportJob (..),
    newStartTableDataImportJob,

    -- * Request Lenses
    startTableDataImportJob_workbookId,
    startTableDataImportJob_dataSource,
    startTableDataImportJob_dataFormat,
    startTableDataImportJob_destinationTableId,
    startTableDataImportJob_importOptions,
    startTableDataImportJob_clientRequestToken,

    -- * Destructuring the Response
    StartTableDataImportJobResponse (..),
    newStartTableDataImportJobResponse,

    -- * Response Lenses
    startTableDataImportJobResponse_httpStatus,
    startTableDataImportJobResponse_jobId,
    startTableDataImportJobResponse_jobStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.HoneyCode.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

-- | /See:/ 'newStartTableDataImportJob' smart constructor.
data StartTableDataImportJob = StartTableDataImportJob'
  { -- | The ID of the workbook where the rows are being imported.
    --
    -- If a workbook with the specified id could not be found, this API throws
    -- ResourceNotFoundException.
    StartTableDataImportJob -> Text
workbookId :: Prelude.Text,
    -- | The source of the data that is being imported. The size of source must
    -- be no larger than 100 MB. Source must have no more than 100,000 cells
    -- and no more than 1,000 rows.
    StartTableDataImportJob -> ImportDataSource
dataSource :: ImportDataSource,
    -- | The format of the data that is being imported. Currently the only option
    -- supported is \"DELIMITED_TEXT\".
    StartTableDataImportJob -> ImportSourceDataFormat
dataFormat :: ImportSourceDataFormat,
    -- | The ID of the table where the rows are being imported.
    --
    -- If a table with the specified id could not be found, this API throws
    -- ResourceNotFoundException.
    StartTableDataImportJob -> Text
destinationTableId :: Prelude.Text,
    -- | The options for customizing this import request.
    StartTableDataImportJob -> ImportOptions
importOptions :: ImportOptions,
    -- | The request token for performing the update action. Request tokens help
    -- to identify duplicate requests. If a call times out or fails due to a
    -- transient error like a failed network connection, you can retry the call
    -- with the same request token. The service ensures that if the first call
    -- using that request token is successfully performed, the second call will
    -- not perform the action again.
    --
    -- Note that request tokens are valid only for a few minutes. You cannot
    -- use request tokens to dedupe requests spanning hours or days.
    StartTableDataImportJob -> Text
clientRequestToken :: Prelude.Text
  }
  deriving (StartTableDataImportJob -> StartTableDataImportJob -> Bool
(StartTableDataImportJob -> StartTableDataImportJob -> Bool)
-> (StartTableDataImportJob -> StartTableDataImportJob -> Bool)
-> Eq StartTableDataImportJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartTableDataImportJob -> StartTableDataImportJob -> Bool
$c/= :: StartTableDataImportJob -> StartTableDataImportJob -> Bool
== :: StartTableDataImportJob -> StartTableDataImportJob -> Bool
$c== :: StartTableDataImportJob -> StartTableDataImportJob -> Bool
Prelude.Eq, ReadPrec [StartTableDataImportJob]
ReadPrec StartTableDataImportJob
Int -> ReadS StartTableDataImportJob
ReadS [StartTableDataImportJob]
(Int -> ReadS StartTableDataImportJob)
-> ReadS [StartTableDataImportJob]
-> ReadPrec StartTableDataImportJob
-> ReadPrec [StartTableDataImportJob]
-> Read StartTableDataImportJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartTableDataImportJob]
$creadListPrec :: ReadPrec [StartTableDataImportJob]
readPrec :: ReadPrec StartTableDataImportJob
$creadPrec :: ReadPrec StartTableDataImportJob
readList :: ReadS [StartTableDataImportJob]
$creadList :: ReadS [StartTableDataImportJob]
readsPrec :: Int -> ReadS StartTableDataImportJob
$creadsPrec :: Int -> ReadS StartTableDataImportJob
Prelude.Read, Int -> StartTableDataImportJob -> ShowS
[StartTableDataImportJob] -> ShowS
StartTableDataImportJob -> String
(Int -> StartTableDataImportJob -> ShowS)
-> (StartTableDataImportJob -> String)
-> ([StartTableDataImportJob] -> ShowS)
-> Show StartTableDataImportJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartTableDataImportJob] -> ShowS
$cshowList :: [StartTableDataImportJob] -> ShowS
show :: StartTableDataImportJob -> String
$cshow :: StartTableDataImportJob -> String
showsPrec :: Int -> StartTableDataImportJob -> ShowS
$cshowsPrec :: Int -> StartTableDataImportJob -> ShowS
Prelude.Show, (forall x.
 StartTableDataImportJob -> Rep StartTableDataImportJob x)
-> (forall x.
    Rep StartTableDataImportJob x -> StartTableDataImportJob)
-> Generic StartTableDataImportJob
forall x. Rep StartTableDataImportJob x -> StartTableDataImportJob
forall x. StartTableDataImportJob -> Rep StartTableDataImportJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartTableDataImportJob x -> StartTableDataImportJob
$cfrom :: forall x. StartTableDataImportJob -> Rep StartTableDataImportJob x
Prelude.Generic)

-- |
-- Create a value of 'StartTableDataImportJob' 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:
--
-- 'workbookId', 'startTableDataImportJob_workbookId' - The ID of the workbook where the rows are being imported.
--
-- If a workbook with the specified id could not be found, this API throws
-- ResourceNotFoundException.
--
-- 'dataSource', 'startTableDataImportJob_dataSource' - The source of the data that is being imported. The size of source must
-- be no larger than 100 MB. Source must have no more than 100,000 cells
-- and no more than 1,000 rows.
--
-- 'dataFormat', 'startTableDataImportJob_dataFormat' - The format of the data that is being imported. Currently the only option
-- supported is \"DELIMITED_TEXT\".
--
-- 'destinationTableId', 'startTableDataImportJob_destinationTableId' - The ID of the table where the rows are being imported.
--
-- If a table with the specified id could not be found, this API throws
-- ResourceNotFoundException.
--
-- 'importOptions', 'startTableDataImportJob_importOptions' - The options for customizing this import request.
--
-- 'clientRequestToken', 'startTableDataImportJob_clientRequestToken' - The request token for performing the update action. Request tokens help
-- to identify duplicate requests. If a call times out or fails due to a
-- transient error like a failed network connection, you can retry the call
-- with the same request token. The service ensures that if the first call
-- using that request token is successfully performed, the second call will
-- not perform the action again.
--
-- Note that request tokens are valid only for a few minutes. You cannot
-- use request tokens to dedupe requests spanning hours or days.
newStartTableDataImportJob ::
  -- | 'workbookId'
  Prelude.Text ->
  -- | 'dataSource'
  ImportDataSource ->
  -- | 'dataFormat'
  ImportSourceDataFormat ->
  -- | 'destinationTableId'
  Prelude.Text ->
  -- | 'importOptions'
  ImportOptions ->
  -- | 'clientRequestToken'
  Prelude.Text ->
  StartTableDataImportJob
newStartTableDataImportJob :: Text
-> ImportDataSource
-> ImportSourceDataFormat
-> Text
-> ImportOptions
-> Text
-> StartTableDataImportJob
newStartTableDataImportJob
  Text
pWorkbookId_
  ImportDataSource
pDataSource_
  ImportSourceDataFormat
pDataFormat_
  Text
pDestinationTableId_
  ImportOptions
pImportOptions_
  Text
pClientRequestToken_ =
    StartTableDataImportJob' :: Text
-> ImportDataSource
-> ImportSourceDataFormat
-> Text
-> ImportOptions
-> Text
-> StartTableDataImportJob
StartTableDataImportJob'
      { $sel:workbookId:StartTableDataImportJob' :: Text
workbookId = Text
pWorkbookId_,
        $sel:dataSource:StartTableDataImportJob' :: ImportDataSource
dataSource = ImportDataSource
pDataSource_,
        $sel:dataFormat:StartTableDataImportJob' :: ImportSourceDataFormat
dataFormat = ImportSourceDataFormat
pDataFormat_,
        $sel:destinationTableId:StartTableDataImportJob' :: Text
destinationTableId = Text
pDestinationTableId_,
        $sel:importOptions:StartTableDataImportJob' :: ImportOptions
importOptions = ImportOptions
pImportOptions_,
        $sel:clientRequestToken:StartTableDataImportJob' :: Text
clientRequestToken = Text
pClientRequestToken_
      }

-- | The ID of the workbook where the rows are being imported.
--
-- If a workbook with the specified id could not be found, this API throws
-- ResourceNotFoundException.
startTableDataImportJob_workbookId :: Lens.Lens' StartTableDataImportJob Prelude.Text
startTableDataImportJob_workbookId :: (Text -> f Text)
-> StartTableDataImportJob -> f StartTableDataImportJob
startTableDataImportJob_workbookId = (StartTableDataImportJob -> Text)
-> (StartTableDataImportJob -> Text -> StartTableDataImportJob)
-> Lens StartTableDataImportJob StartTableDataImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTableDataImportJob' {Text
workbookId :: Text
$sel:workbookId:StartTableDataImportJob' :: StartTableDataImportJob -> Text
workbookId} -> Text
workbookId) (\s :: StartTableDataImportJob
s@StartTableDataImportJob' {} Text
a -> StartTableDataImportJob
s {$sel:workbookId:StartTableDataImportJob' :: Text
workbookId = Text
a} :: StartTableDataImportJob)

-- | The source of the data that is being imported. The size of source must
-- be no larger than 100 MB. Source must have no more than 100,000 cells
-- and no more than 1,000 rows.
startTableDataImportJob_dataSource :: Lens.Lens' StartTableDataImportJob ImportDataSource
startTableDataImportJob_dataSource :: (ImportDataSource -> f ImportDataSource)
-> StartTableDataImportJob -> f StartTableDataImportJob
startTableDataImportJob_dataSource = (StartTableDataImportJob -> ImportDataSource)
-> (StartTableDataImportJob
    -> ImportDataSource -> StartTableDataImportJob)
-> Lens
     StartTableDataImportJob
     StartTableDataImportJob
     ImportDataSource
     ImportDataSource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTableDataImportJob' {ImportDataSource
dataSource :: ImportDataSource
$sel:dataSource:StartTableDataImportJob' :: StartTableDataImportJob -> ImportDataSource
dataSource} -> ImportDataSource
dataSource) (\s :: StartTableDataImportJob
s@StartTableDataImportJob' {} ImportDataSource
a -> StartTableDataImportJob
s {$sel:dataSource:StartTableDataImportJob' :: ImportDataSource
dataSource = ImportDataSource
a} :: StartTableDataImportJob)

-- | The format of the data that is being imported. Currently the only option
-- supported is \"DELIMITED_TEXT\".
startTableDataImportJob_dataFormat :: Lens.Lens' StartTableDataImportJob ImportSourceDataFormat
startTableDataImportJob_dataFormat :: (ImportSourceDataFormat -> f ImportSourceDataFormat)
-> StartTableDataImportJob -> f StartTableDataImportJob
startTableDataImportJob_dataFormat = (StartTableDataImportJob -> ImportSourceDataFormat)
-> (StartTableDataImportJob
    -> ImportSourceDataFormat -> StartTableDataImportJob)
-> Lens
     StartTableDataImportJob
     StartTableDataImportJob
     ImportSourceDataFormat
     ImportSourceDataFormat
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTableDataImportJob' {ImportSourceDataFormat
dataFormat :: ImportSourceDataFormat
$sel:dataFormat:StartTableDataImportJob' :: StartTableDataImportJob -> ImportSourceDataFormat
dataFormat} -> ImportSourceDataFormat
dataFormat) (\s :: StartTableDataImportJob
s@StartTableDataImportJob' {} ImportSourceDataFormat
a -> StartTableDataImportJob
s {$sel:dataFormat:StartTableDataImportJob' :: ImportSourceDataFormat
dataFormat = ImportSourceDataFormat
a} :: StartTableDataImportJob)

-- | The ID of the table where the rows are being imported.
--
-- If a table with the specified id could not be found, this API throws
-- ResourceNotFoundException.
startTableDataImportJob_destinationTableId :: Lens.Lens' StartTableDataImportJob Prelude.Text
startTableDataImportJob_destinationTableId :: (Text -> f Text)
-> StartTableDataImportJob -> f StartTableDataImportJob
startTableDataImportJob_destinationTableId = (StartTableDataImportJob -> Text)
-> (StartTableDataImportJob -> Text -> StartTableDataImportJob)
-> Lens StartTableDataImportJob StartTableDataImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTableDataImportJob' {Text
destinationTableId :: Text
$sel:destinationTableId:StartTableDataImportJob' :: StartTableDataImportJob -> Text
destinationTableId} -> Text
destinationTableId) (\s :: StartTableDataImportJob
s@StartTableDataImportJob' {} Text
a -> StartTableDataImportJob
s {$sel:destinationTableId:StartTableDataImportJob' :: Text
destinationTableId = Text
a} :: StartTableDataImportJob)

-- | The options for customizing this import request.
startTableDataImportJob_importOptions :: Lens.Lens' StartTableDataImportJob ImportOptions
startTableDataImportJob_importOptions :: (ImportOptions -> f ImportOptions)
-> StartTableDataImportJob -> f StartTableDataImportJob
startTableDataImportJob_importOptions = (StartTableDataImportJob -> ImportOptions)
-> (StartTableDataImportJob
    -> ImportOptions -> StartTableDataImportJob)
-> Lens
     StartTableDataImportJob
     StartTableDataImportJob
     ImportOptions
     ImportOptions
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTableDataImportJob' {ImportOptions
importOptions :: ImportOptions
$sel:importOptions:StartTableDataImportJob' :: StartTableDataImportJob -> ImportOptions
importOptions} -> ImportOptions
importOptions) (\s :: StartTableDataImportJob
s@StartTableDataImportJob' {} ImportOptions
a -> StartTableDataImportJob
s {$sel:importOptions:StartTableDataImportJob' :: ImportOptions
importOptions = ImportOptions
a} :: StartTableDataImportJob)

-- | The request token for performing the update action. Request tokens help
-- to identify duplicate requests. If a call times out or fails due to a
-- transient error like a failed network connection, you can retry the call
-- with the same request token. The service ensures that if the first call
-- using that request token is successfully performed, the second call will
-- not perform the action again.
--
-- Note that request tokens are valid only for a few minutes. You cannot
-- use request tokens to dedupe requests spanning hours or days.
startTableDataImportJob_clientRequestToken :: Lens.Lens' StartTableDataImportJob Prelude.Text
startTableDataImportJob_clientRequestToken :: (Text -> f Text)
-> StartTableDataImportJob -> f StartTableDataImportJob
startTableDataImportJob_clientRequestToken = (StartTableDataImportJob -> Text)
-> (StartTableDataImportJob -> Text -> StartTableDataImportJob)
-> Lens StartTableDataImportJob StartTableDataImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTableDataImportJob' {Text
clientRequestToken :: Text
$sel:clientRequestToken:StartTableDataImportJob' :: StartTableDataImportJob -> Text
clientRequestToken} -> Text
clientRequestToken) (\s :: StartTableDataImportJob
s@StartTableDataImportJob' {} Text
a -> StartTableDataImportJob
s {$sel:clientRequestToken:StartTableDataImportJob' :: Text
clientRequestToken = Text
a} :: StartTableDataImportJob)

instance Core.AWSRequest StartTableDataImportJob where
  type
    AWSResponse StartTableDataImportJob =
      StartTableDataImportJobResponse
  request :: StartTableDataImportJob -> Request StartTableDataImportJob
request = Service
-> StartTableDataImportJob -> Request StartTableDataImportJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StartTableDataImportJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartTableDataImportJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StartTableDataImportJob))
-> Logger
-> Service
-> Proxy StartTableDataImportJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartTableDataImportJob)))
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 ->
          Int
-> Text
-> TableDataImportJobStatus
-> StartTableDataImportJobResponse
StartTableDataImportJobResponse'
            (Int
 -> Text
 -> TableDataImportJobStatus
 -> StartTableDataImportJobResponse)
-> Either String Int
-> Either
     String
     (Text
      -> TableDataImportJobStatus -> StartTableDataImportJobResponse)
forall (f :: * -> *) a b. Functor 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
  (Text
   -> TableDataImportJobStatus -> StartTableDataImportJobResponse)
-> Either String Text
-> Either
     String
     (TableDataImportJobStatus -> StartTableDataImportJobResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"jobId")
            Either
  String
  (TableDataImportJobStatus -> StartTableDataImportJobResponse)
-> Either String TableDataImportJobStatus
-> Either String StartTableDataImportJobResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String TableDataImportJobStatus
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"jobStatus")
      )

instance Prelude.Hashable StartTableDataImportJob

instance Prelude.NFData StartTableDataImportJob

instance Core.ToHeaders StartTableDataImportJob where
  toHeaders :: StartTableDataImportJob -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StartTableDataImportJob -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 StartTableDataImportJob where
  toJSON :: StartTableDataImportJob -> Value
toJSON StartTableDataImportJob' {Text
ImportDataSource
ImportSourceDataFormat
ImportOptions
clientRequestToken :: Text
importOptions :: ImportOptions
destinationTableId :: Text
dataFormat :: ImportSourceDataFormat
dataSource :: ImportDataSource
workbookId :: Text
$sel:clientRequestToken:StartTableDataImportJob' :: StartTableDataImportJob -> Text
$sel:importOptions:StartTableDataImportJob' :: StartTableDataImportJob -> ImportOptions
$sel:destinationTableId:StartTableDataImportJob' :: StartTableDataImportJob -> Text
$sel:dataFormat:StartTableDataImportJob' :: StartTableDataImportJob -> ImportSourceDataFormat
$sel:dataSource:StartTableDataImportJob' :: StartTableDataImportJob -> ImportDataSource
$sel:workbookId:StartTableDataImportJob' :: StartTableDataImportJob -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"dataSource" Text -> ImportDataSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ImportDataSource
dataSource),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"dataFormat" Text -> ImportSourceDataFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ImportSourceDataFormat
dataFormat),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"importOptions" Text -> ImportOptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ImportOptions
importOptions),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"clientRequestToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientRequestToken)
          ]
      )

instance Core.ToPath StartTableDataImportJob where
  toPath :: StartTableDataImportJob -> ByteString
toPath StartTableDataImportJob' {Text
ImportDataSource
ImportSourceDataFormat
ImportOptions
clientRequestToken :: Text
importOptions :: ImportOptions
destinationTableId :: Text
dataFormat :: ImportSourceDataFormat
dataSource :: ImportDataSource
workbookId :: Text
$sel:clientRequestToken:StartTableDataImportJob' :: StartTableDataImportJob -> Text
$sel:importOptions:StartTableDataImportJob' :: StartTableDataImportJob -> ImportOptions
$sel:destinationTableId:StartTableDataImportJob' :: StartTableDataImportJob -> Text
$sel:dataFormat:StartTableDataImportJob' :: StartTableDataImportJob -> ImportSourceDataFormat
$sel:dataSource:StartTableDataImportJob' :: StartTableDataImportJob -> ImportDataSource
$sel:workbookId:StartTableDataImportJob' :: StartTableDataImportJob -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/workbooks/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
workbookId,
        ByteString
"/tables/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
destinationTableId,
        ByteString
"/import"
      ]

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

-- | /See:/ 'newStartTableDataImportJobResponse' smart constructor.
data StartTableDataImportJobResponse = StartTableDataImportJobResponse'
  { -- | The response's http status code.
    StartTableDataImportJobResponse -> Int
httpStatus :: Prelude.Int,
    -- | The id that is assigned to this import job. Future requests to find out
    -- the status of this import job need to send this id in the appropriate
    -- parameter in the request.
    StartTableDataImportJobResponse -> Text
jobId :: Prelude.Text,
    -- | The status of the import job immediately after submitting the request.
    StartTableDataImportJobResponse -> TableDataImportJobStatus
jobStatus :: TableDataImportJobStatus
  }
  deriving (StartTableDataImportJobResponse
-> StartTableDataImportJobResponse -> Bool
(StartTableDataImportJobResponse
 -> StartTableDataImportJobResponse -> Bool)
-> (StartTableDataImportJobResponse
    -> StartTableDataImportJobResponse -> Bool)
-> Eq StartTableDataImportJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartTableDataImportJobResponse
-> StartTableDataImportJobResponse -> Bool
$c/= :: StartTableDataImportJobResponse
-> StartTableDataImportJobResponse -> Bool
== :: StartTableDataImportJobResponse
-> StartTableDataImportJobResponse -> Bool
$c== :: StartTableDataImportJobResponse
-> StartTableDataImportJobResponse -> Bool
Prelude.Eq, ReadPrec [StartTableDataImportJobResponse]
ReadPrec StartTableDataImportJobResponse
Int -> ReadS StartTableDataImportJobResponse
ReadS [StartTableDataImportJobResponse]
(Int -> ReadS StartTableDataImportJobResponse)
-> ReadS [StartTableDataImportJobResponse]
-> ReadPrec StartTableDataImportJobResponse
-> ReadPrec [StartTableDataImportJobResponse]
-> Read StartTableDataImportJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartTableDataImportJobResponse]
$creadListPrec :: ReadPrec [StartTableDataImportJobResponse]
readPrec :: ReadPrec StartTableDataImportJobResponse
$creadPrec :: ReadPrec StartTableDataImportJobResponse
readList :: ReadS [StartTableDataImportJobResponse]
$creadList :: ReadS [StartTableDataImportJobResponse]
readsPrec :: Int -> ReadS StartTableDataImportJobResponse
$creadsPrec :: Int -> ReadS StartTableDataImportJobResponse
Prelude.Read, Int -> StartTableDataImportJobResponse -> ShowS
[StartTableDataImportJobResponse] -> ShowS
StartTableDataImportJobResponse -> String
(Int -> StartTableDataImportJobResponse -> ShowS)
-> (StartTableDataImportJobResponse -> String)
-> ([StartTableDataImportJobResponse] -> ShowS)
-> Show StartTableDataImportJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartTableDataImportJobResponse] -> ShowS
$cshowList :: [StartTableDataImportJobResponse] -> ShowS
show :: StartTableDataImportJobResponse -> String
$cshow :: StartTableDataImportJobResponse -> String
showsPrec :: Int -> StartTableDataImportJobResponse -> ShowS
$cshowsPrec :: Int -> StartTableDataImportJobResponse -> ShowS
Prelude.Show, (forall x.
 StartTableDataImportJobResponse
 -> Rep StartTableDataImportJobResponse x)
-> (forall x.
    Rep StartTableDataImportJobResponse x
    -> StartTableDataImportJobResponse)
-> Generic StartTableDataImportJobResponse
forall x.
Rep StartTableDataImportJobResponse x
-> StartTableDataImportJobResponse
forall x.
StartTableDataImportJobResponse
-> Rep StartTableDataImportJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartTableDataImportJobResponse x
-> StartTableDataImportJobResponse
$cfrom :: forall x.
StartTableDataImportJobResponse
-> Rep StartTableDataImportJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartTableDataImportJobResponse' 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:
--
-- 'httpStatus', 'startTableDataImportJobResponse_httpStatus' - The response's http status code.
--
-- 'jobId', 'startTableDataImportJobResponse_jobId' - The id that is assigned to this import job. Future requests to find out
-- the status of this import job need to send this id in the appropriate
-- parameter in the request.
--
-- 'jobStatus', 'startTableDataImportJobResponse_jobStatus' - The status of the import job immediately after submitting the request.
newStartTableDataImportJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'jobId'
  Prelude.Text ->
  -- | 'jobStatus'
  TableDataImportJobStatus ->
  StartTableDataImportJobResponse
newStartTableDataImportJobResponse :: Int
-> Text
-> TableDataImportJobStatus
-> StartTableDataImportJobResponse
newStartTableDataImportJobResponse
  Int
pHttpStatus_
  Text
pJobId_
  TableDataImportJobStatus
pJobStatus_ =
    StartTableDataImportJobResponse' :: Int
-> Text
-> TableDataImportJobStatus
-> StartTableDataImportJobResponse
StartTableDataImportJobResponse'
      { $sel:httpStatus:StartTableDataImportJobResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:jobId:StartTableDataImportJobResponse' :: Text
jobId = Text
pJobId_,
        $sel:jobStatus:StartTableDataImportJobResponse' :: TableDataImportJobStatus
jobStatus = TableDataImportJobStatus
pJobStatus_
      }

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

-- | The id that is assigned to this import job. Future requests to find out
-- the status of this import job need to send this id in the appropriate
-- parameter in the request.
startTableDataImportJobResponse_jobId :: Lens.Lens' StartTableDataImportJobResponse Prelude.Text
startTableDataImportJobResponse_jobId :: (Text -> f Text)
-> StartTableDataImportJobResponse
-> f StartTableDataImportJobResponse
startTableDataImportJobResponse_jobId = (StartTableDataImportJobResponse -> Text)
-> (StartTableDataImportJobResponse
    -> Text -> StartTableDataImportJobResponse)
-> Lens
     StartTableDataImportJobResponse
     StartTableDataImportJobResponse
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTableDataImportJobResponse' {Text
jobId :: Text
$sel:jobId:StartTableDataImportJobResponse' :: StartTableDataImportJobResponse -> Text
jobId} -> Text
jobId) (\s :: StartTableDataImportJobResponse
s@StartTableDataImportJobResponse' {} Text
a -> StartTableDataImportJobResponse
s {$sel:jobId:StartTableDataImportJobResponse' :: Text
jobId = Text
a} :: StartTableDataImportJobResponse)

-- | The status of the import job immediately after submitting the request.
startTableDataImportJobResponse_jobStatus :: Lens.Lens' StartTableDataImportJobResponse TableDataImportJobStatus
startTableDataImportJobResponse_jobStatus :: (TableDataImportJobStatus -> f TableDataImportJobStatus)
-> StartTableDataImportJobResponse
-> f StartTableDataImportJobResponse
startTableDataImportJobResponse_jobStatus = (StartTableDataImportJobResponse -> TableDataImportJobStatus)
-> (StartTableDataImportJobResponse
    -> TableDataImportJobStatus -> StartTableDataImportJobResponse)
-> Lens
     StartTableDataImportJobResponse
     StartTableDataImportJobResponse
     TableDataImportJobStatus
     TableDataImportJobStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTableDataImportJobResponse' {TableDataImportJobStatus
jobStatus :: TableDataImportJobStatus
$sel:jobStatus:StartTableDataImportJobResponse' :: StartTableDataImportJobResponse -> TableDataImportJobStatus
jobStatus} -> TableDataImportJobStatus
jobStatus) (\s :: StartTableDataImportJobResponse
s@StartTableDataImportJobResponse' {} TableDataImportJobStatus
a -> StartTableDataImportJobResponse
s {$sel:jobStatus:StartTableDataImportJobResponse' :: TableDataImportJobStatus
jobStatus = TableDataImportJobStatus
a} :: StartTableDataImportJobResponse)

instance
  Prelude.NFData
    StartTableDataImportJobResponse