amazonka-lakeformation-2.0: gen/Amazonka/LakeFormation/GetWorkUnitResults.hs
{-# 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.LakeFormation.GetWorkUnitResults
-- Copyright : (c) 2013-2023 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns the work units resulting from the query. Work units can be
-- executed in any order and in parallel.
module Amazonka.LakeFormation.GetWorkUnitResults
( -- * Creating a Request
GetWorkUnitResults (..),
newGetWorkUnitResults,
-- * Request Lenses
getWorkUnitResults_queryId,
getWorkUnitResults_workUnitId,
getWorkUnitResults_workUnitToken,
-- * Destructuring the Response
GetWorkUnitResultsResponse (..),
newGetWorkUnitResultsResponse,
-- * Response Lenses
getWorkUnitResultsResponse_httpStatus,
getWorkUnitResultsResponse_resultStream,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LakeFormation.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
-- | /See:/ 'newGetWorkUnitResults' smart constructor.
data GetWorkUnitResults = GetWorkUnitResults'
{ -- | The ID of the plan query operation for which to get results.
queryId :: Prelude.Text,
-- | The work unit ID for which to get results. Value generated by
-- enumerating @WorkUnitIdMin@ to @WorkUnitIdMax@ (inclusive) from the
-- @WorkUnitRange@ in the output of @GetWorkUnits@.
workUnitId :: Prelude.Natural,
-- | A work token used to query the execution service. Token output from
-- @GetWorkUnits@.
workUnitToken :: Data.Sensitive Prelude.Text
}
deriving (Prelude.Eq, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'GetWorkUnitResults' 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:
--
-- 'queryId', 'getWorkUnitResults_queryId' - The ID of the plan query operation for which to get results.
--
-- 'workUnitId', 'getWorkUnitResults_workUnitId' - The work unit ID for which to get results. Value generated by
-- enumerating @WorkUnitIdMin@ to @WorkUnitIdMax@ (inclusive) from the
-- @WorkUnitRange@ in the output of @GetWorkUnits@.
--
-- 'workUnitToken', 'getWorkUnitResults_workUnitToken' - A work token used to query the execution service. Token output from
-- @GetWorkUnits@.
newGetWorkUnitResults ::
-- | 'queryId'
Prelude.Text ->
-- | 'workUnitId'
Prelude.Natural ->
-- | 'workUnitToken'
Prelude.Text ->
GetWorkUnitResults
newGetWorkUnitResults
pQueryId_
pWorkUnitId_
pWorkUnitToken_ =
GetWorkUnitResults'
{ queryId = pQueryId_,
workUnitId = pWorkUnitId_,
workUnitToken =
Data._Sensitive Lens.# pWorkUnitToken_
}
-- | The ID of the plan query operation for which to get results.
getWorkUnitResults_queryId :: Lens.Lens' GetWorkUnitResults Prelude.Text
getWorkUnitResults_queryId = Lens.lens (\GetWorkUnitResults' {queryId} -> queryId) (\s@GetWorkUnitResults' {} a -> s {queryId = a} :: GetWorkUnitResults)
-- | The work unit ID for which to get results. Value generated by
-- enumerating @WorkUnitIdMin@ to @WorkUnitIdMax@ (inclusive) from the
-- @WorkUnitRange@ in the output of @GetWorkUnits@.
getWorkUnitResults_workUnitId :: Lens.Lens' GetWorkUnitResults Prelude.Natural
getWorkUnitResults_workUnitId = Lens.lens (\GetWorkUnitResults' {workUnitId} -> workUnitId) (\s@GetWorkUnitResults' {} a -> s {workUnitId = a} :: GetWorkUnitResults)
-- | A work token used to query the execution service. Token output from
-- @GetWorkUnits@.
getWorkUnitResults_workUnitToken :: Lens.Lens' GetWorkUnitResults Prelude.Text
getWorkUnitResults_workUnitToken = Lens.lens (\GetWorkUnitResults' {workUnitToken} -> workUnitToken) (\s@GetWorkUnitResults' {} a -> s {workUnitToken = a} :: GetWorkUnitResults) Prelude.. Data._Sensitive
instance Core.AWSRequest GetWorkUnitResults where
type
AWSResponse GetWorkUnitResults =
GetWorkUnitResultsResponse
request overrides =
Request.postJSON (overrides defaultService)
response =
Response.receiveBody
( \s h x ->
GetWorkUnitResultsResponse'
Prelude.<$> (Prelude.pure (Prelude.fromEnum s))
Prelude.<*> (Prelude.pure x)
)
instance Prelude.Hashable GetWorkUnitResults where
hashWithSalt _salt GetWorkUnitResults' {..} =
_salt
`Prelude.hashWithSalt` queryId
`Prelude.hashWithSalt` workUnitId
`Prelude.hashWithSalt` workUnitToken
instance Prelude.NFData GetWorkUnitResults where
rnf GetWorkUnitResults' {..} =
Prelude.rnf queryId
`Prelude.seq` Prelude.rnf workUnitId
`Prelude.seq` Prelude.rnf workUnitToken
instance Data.ToHeaders GetWorkUnitResults where
toHeaders =
Prelude.const
( Prelude.mconcat
[ "Content-Type"
Data.=# ( "application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetWorkUnitResults where
toJSON GetWorkUnitResults' {..} =
Data.object
( Prelude.catMaybes
[ Prelude.Just ("QueryId" Data..= queryId),
Prelude.Just ("WorkUnitId" Data..= workUnitId),
Prelude.Just
("WorkUnitToken" Data..= workUnitToken)
]
)
instance Data.ToPath GetWorkUnitResults where
toPath = Prelude.const "/GetWorkUnitResults"
instance Data.ToQuery GetWorkUnitResults where
toQuery = Prelude.const Prelude.mempty
-- | A structure for the output.
--
-- /See:/ 'newGetWorkUnitResultsResponse' smart constructor.
data GetWorkUnitResultsResponse = GetWorkUnitResultsResponse'
{ -- | The response's http status code.
httpStatus :: Prelude.Int,
-- | Rows returned from the @GetWorkUnitResults@ operation as a stream of
-- Apache Arrow v1.0 messages.
resultStream :: Data.ResponseBody
}
deriving (Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'GetWorkUnitResultsResponse' 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', 'getWorkUnitResultsResponse_httpStatus' - The response's http status code.
--
-- 'resultStream', 'getWorkUnitResultsResponse_resultStream' - Rows returned from the @GetWorkUnitResults@ operation as a stream of
-- Apache Arrow v1.0 messages.
newGetWorkUnitResultsResponse ::
-- | 'httpStatus'
Prelude.Int ->
-- | 'resultStream'
Data.ResponseBody ->
GetWorkUnitResultsResponse
newGetWorkUnitResultsResponse
pHttpStatus_
pResultStream_ =
GetWorkUnitResultsResponse'
{ httpStatus =
pHttpStatus_,
resultStream = pResultStream_
}
-- | The response's http status code.
getWorkUnitResultsResponse_httpStatus :: Lens.Lens' GetWorkUnitResultsResponse Prelude.Int
getWorkUnitResultsResponse_httpStatus = Lens.lens (\GetWorkUnitResultsResponse' {httpStatus} -> httpStatus) (\s@GetWorkUnitResultsResponse' {} a -> s {httpStatus = a} :: GetWorkUnitResultsResponse)
-- | Rows returned from the @GetWorkUnitResults@ operation as a stream of
-- Apache Arrow v1.0 messages.
getWorkUnitResultsResponse_resultStream :: Lens.Lens' GetWorkUnitResultsResponse Data.ResponseBody
getWorkUnitResultsResponse_resultStream = Lens.lens (\GetWorkUnitResultsResponse' {resultStream} -> resultStream) (\s@GetWorkUnitResultsResponse' {} a -> s {resultStream = a} :: GetWorkUnitResultsResponse)