{-# 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.KinesisAnalyticsV2.DiscoverInputSchema
-- 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)
--
-- Infers a schema for a SQL-based Kinesis Data Analytics application by
-- evaluating sample records on the specified streaming source (Kinesis
-- data stream or Kinesis Data Firehose delivery stream) or Amazon S3
-- object. In the response, the operation returns the inferred schema and
-- also the sample records that the operation used to infer the schema.
--
-- You can use the inferred schema when configuring a streaming source for
-- your application. When you create an application using the Kinesis Data
-- Analytics console, the console uses this operation to infer a schema and
-- show it in the console user interface.
module Amazonka.KinesisAnalyticsV2.DiscoverInputSchema
  ( -- * Creating a Request
    DiscoverInputSchema (..),
    newDiscoverInputSchema,

    -- * Request Lenses
    discoverInputSchema_inputStartingPositionConfiguration,
    discoverInputSchema_inputProcessingConfiguration,
    discoverInputSchema_s3Configuration,
    discoverInputSchema_resourceARN,
    discoverInputSchema_serviceExecutionRole,

    -- * Destructuring the Response
    DiscoverInputSchemaResponse (..),
    newDiscoverInputSchemaResponse,

    -- * Response Lenses
    discoverInputSchemaResponse_rawInputRecords,
    discoverInputSchemaResponse_inputSchema,
    discoverInputSchemaResponse_processedInputRecords,
    discoverInputSchemaResponse_parsedInputRecords,
    discoverInputSchemaResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.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:/ 'newDiscoverInputSchema' smart constructor.
data DiscoverInputSchema = DiscoverInputSchema'
  { -- | The point at which you want Kinesis Data Analytics to start reading
    -- records from the specified streaming source discovery purposes.
    DiscoverInputSchema -> Maybe InputStartingPositionConfiguration
inputStartingPositionConfiguration :: Prelude.Maybe InputStartingPositionConfiguration,
    -- | The InputProcessingConfiguration to use to preprocess the records before
    -- discovering the schema of the records.
    DiscoverInputSchema -> Maybe InputProcessingConfiguration
inputProcessingConfiguration :: Prelude.Maybe InputProcessingConfiguration,
    -- | Specify this parameter to discover a schema from data in an Amazon S3
    -- object.
    DiscoverInputSchema -> Maybe S3Configuration
s3Configuration :: Prelude.Maybe S3Configuration,
    -- | The Amazon Resource Name (ARN) of the streaming source.
    DiscoverInputSchema -> Maybe Text
resourceARN :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the role that is used to access the streaming source.
    DiscoverInputSchema -> Text
serviceExecutionRole :: Prelude.Text
  }
  deriving (DiscoverInputSchema -> DiscoverInputSchema -> Bool
(DiscoverInputSchema -> DiscoverInputSchema -> Bool)
-> (DiscoverInputSchema -> DiscoverInputSchema -> Bool)
-> Eq DiscoverInputSchema
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DiscoverInputSchema -> DiscoverInputSchema -> Bool
$c/= :: DiscoverInputSchema -> DiscoverInputSchema -> Bool
== :: DiscoverInputSchema -> DiscoverInputSchema -> Bool
$c== :: DiscoverInputSchema -> DiscoverInputSchema -> Bool
Prelude.Eq, ReadPrec [DiscoverInputSchema]
ReadPrec DiscoverInputSchema
Int -> ReadS DiscoverInputSchema
ReadS [DiscoverInputSchema]
(Int -> ReadS DiscoverInputSchema)
-> ReadS [DiscoverInputSchema]
-> ReadPrec DiscoverInputSchema
-> ReadPrec [DiscoverInputSchema]
-> Read DiscoverInputSchema
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DiscoverInputSchema]
$creadListPrec :: ReadPrec [DiscoverInputSchema]
readPrec :: ReadPrec DiscoverInputSchema
$creadPrec :: ReadPrec DiscoverInputSchema
readList :: ReadS [DiscoverInputSchema]
$creadList :: ReadS [DiscoverInputSchema]
readsPrec :: Int -> ReadS DiscoverInputSchema
$creadsPrec :: Int -> ReadS DiscoverInputSchema
Prelude.Read, Int -> DiscoverInputSchema -> ShowS
[DiscoverInputSchema] -> ShowS
DiscoverInputSchema -> String
(Int -> DiscoverInputSchema -> ShowS)
-> (DiscoverInputSchema -> String)
-> ([DiscoverInputSchema] -> ShowS)
-> Show DiscoverInputSchema
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DiscoverInputSchema] -> ShowS
$cshowList :: [DiscoverInputSchema] -> ShowS
show :: DiscoverInputSchema -> String
$cshow :: DiscoverInputSchema -> String
showsPrec :: Int -> DiscoverInputSchema -> ShowS
$cshowsPrec :: Int -> DiscoverInputSchema -> ShowS
Prelude.Show, (forall x. DiscoverInputSchema -> Rep DiscoverInputSchema x)
-> (forall x. Rep DiscoverInputSchema x -> DiscoverInputSchema)
-> Generic DiscoverInputSchema
forall x. Rep DiscoverInputSchema x -> DiscoverInputSchema
forall x. DiscoverInputSchema -> Rep DiscoverInputSchema x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DiscoverInputSchema x -> DiscoverInputSchema
$cfrom :: forall x. DiscoverInputSchema -> Rep DiscoverInputSchema x
Prelude.Generic)

-- |
-- Create a value of 'DiscoverInputSchema' 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:
--
-- 'inputStartingPositionConfiguration', 'discoverInputSchema_inputStartingPositionConfiguration' - The point at which you want Kinesis Data Analytics to start reading
-- records from the specified streaming source discovery purposes.
--
-- 'inputProcessingConfiguration', 'discoverInputSchema_inputProcessingConfiguration' - The InputProcessingConfiguration to use to preprocess the records before
-- discovering the schema of the records.
--
-- 's3Configuration', 'discoverInputSchema_s3Configuration' - Specify this parameter to discover a schema from data in an Amazon S3
-- object.
--
-- 'resourceARN', 'discoverInputSchema_resourceARN' - The Amazon Resource Name (ARN) of the streaming source.
--
-- 'serviceExecutionRole', 'discoverInputSchema_serviceExecutionRole' - The ARN of the role that is used to access the streaming source.
newDiscoverInputSchema ::
  -- | 'serviceExecutionRole'
  Prelude.Text ->
  DiscoverInputSchema
newDiscoverInputSchema :: Text -> DiscoverInputSchema
newDiscoverInputSchema Text
pServiceExecutionRole_ =
  DiscoverInputSchema' :: Maybe InputStartingPositionConfiguration
-> Maybe InputProcessingConfiguration
-> Maybe S3Configuration
-> Maybe Text
-> Text
-> DiscoverInputSchema
DiscoverInputSchema'
    { $sel:inputStartingPositionConfiguration:DiscoverInputSchema' :: Maybe InputStartingPositionConfiguration
inputStartingPositionConfiguration =
        Maybe InputStartingPositionConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:inputProcessingConfiguration:DiscoverInputSchema' :: Maybe InputProcessingConfiguration
inputProcessingConfiguration = Maybe InputProcessingConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:s3Configuration:DiscoverInputSchema' :: Maybe S3Configuration
s3Configuration = Maybe S3Configuration
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceARN:DiscoverInputSchema' :: Maybe Text
resourceARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceExecutionRole:DiscoverInputSchema' :: Text
serviceExecutionRole = Text
pServiceExecutionRole_
    }

-- | The point at which you want Kinesis Data Analytics to start reading
-- records from the specified streaming source discovery purposes.
discoverInputSchema_inputStartingPositionConfiguration :: Lens.Lens' DiscoverInputSchema (Prelude.Maybe InputStartingPositionConfiguration)
discoverInputSchema_inputStartingPositionConfiguration :: (Maybe InputStartingPositionConfiguration
 -> f (Maybe InputStartingPositionConfiguration))
-> DiscoverInputSchema -> f DiscoverInputSchema
discoverInputSchema_inputStartingPositionConfiguration = (DiscoverInputSchema -> Maybe InputStartingPositionConfiguration)
-> (DiscoverInputSchema
    -> Maybe InputStartingPositionConfiguration -> DiscoverInputSchema)
-> Lens
     DiscoverInputSchema
     DiscoverInputSchema
     (Maybe InputStartingPositionConfiguration)
     (Maybe InputStartingPositionConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscoverInputSchema' {Maybe InputStartingPositionConfiguration
inputStartingPositionConfiguration :: Maybe InputStartingPositionConfiguration
$sel:inputStartingPositionConfiguration:DiscoverInputSchema' :: DiscoverInputSchema -> Maybe InputStartingPositionConfiguration
inputStartingPositionConfiguration} -> Maybe InputStartingPositionConfiguration
inputStartingPositionConfiguration) (\s :: DiscoverInputSchema
s@DiscoverInputSchema' {} Maybe InputStartingPositionConfiguration
a -> DiscoverInputSchema
s {$sel:inputStartingPositionConfiguration:DiscoverInputSchema' :: Maybe InputStartingPositionConfiguration
inputStartingPositionConfiguration = Maybe InputStartingPositionConfiguration
a} :: DiscoverInputSchema)

-- | The InputProcessingConfiguration to use to preprocess the records before
-- discovering the schema of the records.
discoverInputSchema_inputProcessingConfiguration :: Lens.Lens' DiscoverInputSchema (Prelude.Maybe InputProcessingConfiguration)
discoverInputSchema_inputProcessingConfiguration :: (Maybe InputProcessingConfiguration
 -> f (Maybe InputProcessingConfiguration))
-> DiscoverInputSchema -> f DiscoverInputSchema
discoverInputSchema_inputProcessingConfiguration = (DiscoverInputSchema -> Maybe InputProcessingConfiguration)
-> (DiscoverInputSchema
    -> Maybe InputProcessingConfiguration -> DiscoverInputSchema)
-> Lens
     DiscoverInputSchema
     DiscoverInputSchema
     (Maybe InputProcessingConfiguration)
     (Maybe InputProcessingConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscoverInputSchema' {Maybe InputProcessingConfiguration
inputProcessingConfiguration :: Maybe InputProcessingConfiguration
$sel:inputProcessingConfiguration:DiscoverInputSchema' :: DiscoverInputSchema -> Maybe InputProcessingConfiguration
inputProcessingConfiguration} -> Maybe InputProcessingConfiguration
inputProcessingConfiguration) (\s :: DiscoverInputSchema
s@DiscoverInputSchema' {} Maybe InputProcessingConfiguration
a -> DiscoverInputSchema
s {$sel:inputProcessingConfiguration:DiscoverInputSchema' :: Maybe InputProcessingConfiguration
inputProcessingConfiguration = Maybe InputProcessingConfiguration
a} :: DiscoverInputSchema)

-- | Specify this parameter to discover a schema from data in an Amazon S3
-- object.
discoverInputSchema_s3Configuration :: Lens.Lens' DiscoverInputSchema (Prelude.Maybe S3Configuration)
discoverInputSchema_s3Configuration :: (Maybe S3Configuration -> f (Maybe S3Configuration))
-> DiscoverInputSchema -> f DiscoverInputSchema
discoverInputSchema_s3Configuration = (DiscoverInputSchema -> Maybe S3Configuration)
-> (DiscoverInputSchema
    -> Maybe S3Configuration -> DiscoverInputSchema)
-> Lens
     DiscoverInputSchema
     DiscoverInputSchema
     (Maybe S3Configuration)
     (Maybe S3Configuration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscoverInputSchema' {Maybe S3Configuration
s3Configuration :: Maybe S3Configuration
$sel:s3Configuration:DiscoverInputSchema' :: DiscoverInputSchema -> Maybe S3Configuration
s3Configuration} -> Maybe S3Configuration
s3Configuration) (\s :: DiscoverInputSchema
s@DiscoverInputSchema' {} Maybe S3Configuration
a -> DiscoverInputSchema
s {$sel:s3Configuration:DiscoverInputSchema' :: Maybe S3Configuration
s3Configuration = Maybe S3Configuration
a} :: DiscoverInputSchema)

-- | The Amazon Resource Name (ARN) of the streaming source.
discoverInputSchema_resourceARN :: Lens.Lens' DiscoverInputSchema (Prelude.Maybe Prelude.Text)
discoverInputSchema_resourceARN :: (Maybe Text -> f (Maybe Text))
-> DiscoverInputSchema -> f DiscoverInputSchema
discoverInputSchema_resourceARN = (DiscoverInputSchema -> Maybe Text)
-> (DiscoverInputSchema -> Maybe Text -> DiscoverInputSchema)
-> Lens
     DiscoverInputSchema DiscoverInputSchema (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscoverInputSchema' {Maybe Text
resourceARN :: Maybe Text
$sel:resourceARN:DiscoverInputSchema' :: DiscoverInputSchema -> Maybe Text
resourceARN} -> Maybe Text
resourceARN) (\s :: DiscoverInputSchema
s@DiscoverInputSchema' {} Maybe Text
a -> DiscoverInputSchema
s {$sel:resourceARN:DiscoverInputSchema' :: Maybe Text
resourceARN = Maybe Text
a} :: DiscoverInputSchema)

-- | The ARN of the role that is used to access the streaming source.
discoverInputSchema_serviceExecutionRole :: Lens.Lens' DiscoverInputSchema Prelude.Text
discoverInputSchema_serviceExecutionRole :: (Text -> f Text) -> DiscoverInputSchema -> f DiscoverInputSchema
discoverInputSchema_serviceExecutionRole = (DiscoverInputSchema -> Text)
-> (DiscoverInputSchema -> Text -> DiscoverInputSchema)
-> Lens DiscoverInputSchema DiscoverInputSchema Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscoverInputSchema' {Text
serviceExecutionRole :: Text
$sel:serviceExecutionRole:DiscoverInputSchema' :: DiscoverInputSchema -> Text
serviceExecutionRole} -> Text
serviceExecutionRole) (\s :: DiscoverInputSchema
s@DiscoverInputSchema' {} Text
a -> DiscoverInputSchema
s {$sel:serviceExecutionRole:DiscoverInputSchema' :: Text
serviceExecutionRole = Text
a} :: DiscoverInputSchema)

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

instance Prelude.NFData DiscoverInputSchema

instance Core.ToHeaders DiscoverInputSchema where
  toHeaders :: DiscoverInputSchema -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DiscoverInputSchema -> 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
"KinesisAnalytics_20180523.DiscoverInputSchema" ::
                          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 DiscoverInputSchema where
  toJSON :: DiscoverInputSchema -> Value
toJSON DiscoverInputSchema' {Maybe Text
Maybe InputProcessingConfiguration
Maybe InputStartingPositionConfiguration
Maybe S3Configuration
Text
serviceExecutionRole :: Text
resourceARN :: Maybe Text
s3Configuration :: Maybe S3Configuration
inputProcessingConfiguration :: Maybe InputProcessingConfiguration
inputStartingPositionConfiguration :: Maybe InputStartingPositionConfiguration
$sel:serviceExecutionRole:DiscoverInputSchema' :: DiscoverInputSchema -> Text
$sel:resourceARN:DiscoverInputSchema' :: DiscoverInputSchema -> Maybe Text
$sel:s3Configuration:DiscoverInputSchema' :: DiscoverInputSchema -> Maybe S3Configuration
$sel:inputProcessingConfiguration:DiscoverInputSchema' :: DiscoverInputSchema -> Maybe InputProcessingConfiguration
$sel:inputStartingPositionConfiguration:DiscoverInputSchema' :: DiscoverInputSchema -> Maybe InputStartingPositionConfiguration
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"InputStartingPositionConfiguration" Text -> InputStartingPositionConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (InputStartingPositionConfiguration -> Pair)
-> Maybe InputStartingPositionConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InputStartingPositionConfiguration
inputStartingPositionConfiguration,
            (Text
"InputProcessingConfiguration" Text -> InputProcessingConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (InputProcessingConfiguration -> Pair)
-> Maybe InputProcessingConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InputProcessingConfiguration
inputProcessingConfiguration,
            (Text
"S3Configuration" Text -> S3Configuration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (S3Configuration -> Pair) -> Maybe S3Configuration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3Configuration
s3Configuration,
            (Text
"ResourceARN" 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
resourceARN,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"ServiceExecutionRole"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serviceExecutionRole
              )
          ]
      )

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

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

-- | /See:/ 'newDiscoverInputSchemaResponse' smart constructor.
data DiscoverInputSchemaResponse = DiscoverInputSchemaResponse'
  { -- | The raw stream data that was sampled to infer the schema.
    DiscoverInputSchemaResponse -> Maybe [Text]
rawInputRecords :: Prelude.Maybe [Prelude.Text],
    -- | The schema inferred from the streaming source. It identifies the format
    -- of the data in the streaming source and how each data element maps to
    -- corresponding columns in the in-application stream that you can create.
    DiscoverInputSchemaResponse -> Maybe SourceSchema
inputSchema :: Prelude.Maybe SourceSchema,
    -- | The stream data that was modified by the processor specified in the
    -- @InputProcessingConfiguration@ parameter.
    DiscoverInputSchemaResponse -> Maybe [Text]
processedInputRecords :: Prelude.Maybe [Prelude.Text],
    -- | An array of elements, where each element corresponds to a row in a
    -- stream record (a stream record can have more than one row).
    DiscoverInputSchemaResponse -> Maybe [[Text]]
parsedInputRecords :: Prelude.Maybe [[Prelude.Text]],
    -- | The response's http status code.
    DiscoverInputSchemaResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DiscoverInputSchemaResponse -> DiscoverInputSchemaResponse -> Bool
(DiscoverInputSchemaResponse
 -> DiscoverInputSchemaResponse -> Bool)
-> (DiscoverInputSchemaResponse
    -> DiscoverInputSchemaResponse -> Bool)
-> Eq DiscoverInputSchemaResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DiscoverInputSchemaResponse -> DiscoverInputSchemaResponse -> Bool
$c/= :: DiscoverInputSchemaResponse -> DiscoverInputSchemaResponse -> Bool
== :: DiscoverInputSchemaResponse -> DiscoverInputSchemaResponse -> Bool
$c== :: DiscoverInputSchemaResponse -> DiscoverInputSchemaResponse -> Bool
Prelude.Eq, ReadPrec [DiscoverInputSchemaResponse]
ReadPrec DiscoverInputSchemaResponse
Int -> ReadS DiscoverInputSchemaResponse
ReadS [DiscoverInputSchemaResponse]
(Int -> ReadS DiscoverInputSchemaResponse)
-> ReadS [DiscoverInputSchemaResponse]
-> ReadPrec DiscoverInputSchemaResponse
-> ReadPrec [DiscoverInputSchemaResponse]
-> Read DiscoverInputSchemaResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DiscoverInputSchemaResponse]
$creadListPrec :: ReadPrec [DiscoverInputSchemaResponse]
readPrec :: ReadPrec DiscoverInputSchemaResponse
$creadPrec :: ReadPrec DiscoverInputSchemaResponse
readList :: ReadS [DiscoverInputSchemaResponse]
$creadList :: ReadS [DiscoverInputSchemaResponse]
readsPrec :: Int -> ReadS DiscoverInputSchemaResponse
$creadsPrec :: Int -> ReadS DiscoverInputSchemaResponse
Prelude.Read, Int -> DiscoverInputSchemaResponse -> ShowS
[DiscoverInputSchemaResponse] -> ShowS
DiscoverInputSchemaResponse -> String
(Int -> DiscoverInputSchemaResponse -> ShowS)
-> (DiscoverInputSchemaResponse -> String)
-> ([DiscoverInputSchemaResponse] -> ShowS)
-> Show DiscoverInputSchemaResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DiscoverInputSchemaResponse] -> ShowS
$cshowList :: [DiscoverInputSchemaResponse] -> ShowS
show :: DiscoverInputSchemaResponse -> String
$cshow :: DiscoverInputSchemaResponse -> String
showsPrec :: Int -> DiscoverInputSchemaResponse -> ShowS
$cshowsPrec :: Int -> DiscoverInputSchemaResponse -> ShowS
Prelude.Show, (forall x.
 DiscoverInputSchemaResponse -> Rep DiscoverInputSchemaResponse x)
-> (forall x.
    Rep DiscoverInputSchemaResponse x -> DiscoverInputSchemaResponse)
-> Generic DiscoverInputSchemaResponse
forall x.
Rep DiscoverInputSchemaResponse x -> DiscoverInputSchemaResponse
forall x.
DiscoverInputSchemaResponse -> Rep DiscoverInputSchemaResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DiscoverInputSchemaResponse x -> DiscoverInputSchemaResponse
$cfrom :: forall x.
DiscoverInputSchemaResponse -> Rep DiscoverInputSchemaResponse x
Prelude.Generic)

-- |
-- Create a value of 'DiscoverInputSchemaResponse' 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:
--
-- 'rawInputRecords', 'discoverInputSchemaResponse_rawInputRecords' - The raw stream data that was sampled to infer the schema.
--
-- 'inputSchema', 'discoverInputSchemaResponse_inputSchema' - The schema inferred from the streaming source. It identifies the format
-- of the data in the streaming source and how each data element maps to
-- corresponding columns in the in-application stream that you can create.
--
-- 'processedInputRecords', 'discoverInputSchemaResponse_processedInputRecords' - The stream data that was modified by the processor specified in the
-- @InputProcessingConfiguration@ parameter.
--
-- 'parsedInputRecords', 'discoverInputSchemaResponse_parsedInputRecords' - An array of elements, where each element corresponds to a row in a
-- stream record (a stream record can have more than one row).
--
-- 'httpStatus', 'discoverInputSchemaResponse_httpStatus' - The response's http status code.
newDiscoverInputSchemaResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DiscoverInputSchemaResponse
newDiscoverInputSchemaResponse :: Int -> DiscoverInputSchemaResponse
newDiscoverInputSchemaResponse Int
pHttpStatus_ =
  DiscoverInputSchemaResponse' :: Maybe [Text]
-> Maybe SourceSchema
-> Maybe [Text]
-> Maybe [[Text]]
-> Int
-> DiscoverInputSchemaResponse
DiscoverInputSchemaResponse'
    { $sel:rawInputRecords:DiscoverInputSchemaResponse' :: Maybe [Text]
rawInputRecords =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:inputSchema:DiscoverInputSchemaResponse' :: Maybe SourceSchema
inputSchema = Maybe SourceSchema
forall a. Maybe a
Prelude.Nothing,
      $sel:processedInputRecords:DiscoverInputSchemaResponse' :: Maybe [Text]
processedInputRecords = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:parsedInputRecords:DiscoverInputSchemaResponse' :: Maybe [[Text]]
parsedInputRecords = Maybe [[Text]]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DiscoverInputSchemaResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The raw stream data that was sampled to infer the schema.
discoverInputSchemaResponse_rawInputRecords :: Lens.Lens' DiscoverInputSchemaResponse (Prelude.Maybe [Prelude.Text])
discoverInputSchemaResponse_rawInputRecords :: (Maybe [Text] -> f (Maybe [Text]))
-> DiscoverInputSchemaResponse -> f DiscoverInputSchemaResponse
discoverInputSchemaResponse_rawInputRecords = (DiscoverInputSchemaResponse -> Maybe [Text])
-> (DiscoverInputSchemaResponse
    -> Maybe [Text] -> DiscoverInputSchemaResponse)
-> Lens
     DiscoverInputSchemaResponse
     DiscoverInputSchemaResponse
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscoverInputSchemaResponse' {Maybe [Text]
rawInputRecords :: Maybe [Text]
$sel:rawInputRecords:DiscoverInputSchemaResponse' :: DiscoverInputSchemaResponse -> Maybe [Text]
rawInputRecords} -> Maybe [Text]
rawInputRecords) (\s :: DiscoverInputSchemaResponse
s@DiscoverInputSchemaResponse' {} Maybe [Text]
a -> DiscoverInputSchemaResponse
s {$sel:rawInputRecords:DiscoverInputSchemaResponse' :: Maybe [Text]
rawInputRecords = Maybe [Text]
a} :: DiscoverInputSchemaResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> DiscoverInputSchemaResponse -> f DiscoverInputSchemaResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DiscoverInputSchemaResponse
-> f DiscoverInputSchemaResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The schema inferred from the streaming source. It identifies the format
-- of the data in the streaming source and how each data element maps to
-- corresponding columns in the in-application stream that you can create.
discoverInputSchemaResponse_inputSchema :: Lens.Lens' DiscoverInputSchemaResponse (Prelude.Maybe SourceSchema)
discoverInputSchemaResponse_inputSchema :: (Maybe SourceSchema -> f (Maybe SourceSchema))
-> DiscoverInputSchemaResponse -> f DiscoverInputSchemaResponse
discoverInputSchemaResponse_inputSchema = (DiscoverInputSchemaResponse -> Maybe SourceSchema)
-> (DiscoverInputSchemaResponse
    -> Maybe SourceSchema -> DiscoverInputSchemaResponse)
-> Lens
     DiscoverInputSchemaResponse
     DiscoverInputSchemaResponse
     (Maybe SourceSchema)
     (Maybe SourceSchema)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscoverInputSchemaResponse' {Maybe SourceSchema
inputSchema :: Maybe SourceSchema
$sel:inputSchema:DiscoverInputSchemaResponse' :: DiscoverInputSchemaResponse -> Maybe SourceSchema
inputSchema} -> Maybe SourceSchema
inputSchema) (\s :: DiscoverInputSchemaResponse
s@DiscoverInputSchemaResponse' {} Maybe SourceSchema
a -> DiscoverInputSchemaResponse
s {$sel:inputSchema:DiscoverInputSchemaResponse' :: Maybe SourceSchema
inputSchema = Maybe SourceSchema
a} :: DiscoverInputSchemaResponse)

-- | The stream data that was modified by the processor specified in the
-- @InputProcessingConfiguration@ parameter.
discoverInputSchemaResponse_processedInputRecords :: Lens.Lens' DiscoverInputSchemaResponse (Prelude.Maybe [Prelude.Text])
discoverInputSchemaResponse_processedInputRecords :: (Maybe [Text] -> f (Maybe [Text]))
-> DiscoverInputSchemaResponse -> f DiscoverInputSchemaResponse
discoverInputSchemaResponse_processedInputRecords = (DiscoverInputSchemaResponse -> Maybe [Text])
-> (DiscoverInputSchemaResponse
    -> Maybe [Text] -> DiscoverInputSchemaResponse)
-> Lens
     DiscoverInputSchemaResponse
     DiscoverInputSchemaResponse
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscoverInputSchemaResponse' {Maybe [Text]
processedInputRecords :: Maybe [Text]
$sel:processedInputRecords:DiscoverInputSchemaResponse' :: DiscoverInputSchemaResponse -> Maybe [Text]
processedInputRecords} -> Maybe [Text]
processedInputRecords) (\s :: DiscoverInputSchemaResponse
s@DiscoverInputSchemaResponse' {} Maybe [Text]
a -> DiscoverInputSchemaResponse
s {$sel:processedInputRecords:DiscoverInputSchemaResponse' :: Maybe [Text]
processedInputRecords = Maybe [Text]
a} :: DiscoverInputSchemaResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> DiscoverInputSchemaResponse -> f DiscoverInputSchemaResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DiscoverInputSchemaResponse
-> f DiscoverInputSchemaResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An array of elements, where each element corresponds to a row in a
-- stream record (a stream record can have more than one row).
discoverInputSchemaResponse_parsedInputRecords :: Lens.Lens' DiscoverInputSchemaResponse (Prelude.Maybe [[Prelude.Text]])
discoverInputSchemaResponse_parsedInputRecords :: (Maybe [[Text]] -> f (Maybe [[Text]]))
-> DiscoverInputSchemaResponse -> f DiscoverInputSchemaResponse
discoverInputSchemaResponse_parsedInputRecords = (DiscoverInputSchemaResponse -> Maybe [[Text]])
-> (DiscoverInputSchemaResponse
    -> Maybe [[Text]] -> DiscoverInputSchemaResponse)
-> Lens
     DiscoverInputSchemaResponse
     DiscoverInputSchemaResponse
     (Maybe [[Text]])
     (Maybe [[Text]])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscoverInputSchemaResponse' {Maybe [[Text]]
parsedInputRecords :: Maybe [[Text]]
$sel:parsedInputRecords:DiscoverInputSchemaResponse' :: DiscoverInputSchemaResponse -> Maybe [[Text]]
parsedInputRecords} -> Maybe [[Text]]
parsedInputRecords) (\s :: DiscoverInputSchemaResponse
s@DiscoverInputSchemaResponse' {} Maybe [[Text]]
a -> DiscoverInputSchemaResponse
s {$sel:parsedInputRecords:DiscoverInputSchemaResponse' :: Maybe [[Text]]
parsedInputRecords = Maybe [[Text]]
a} :: DiscoverInputSchemaResponse) ((Maybe [[Text]] -> f (Maybe [[Text]]))
 -> DiscoverInputSchemaResponse -> f DiscoverInputSchemaResponse)
-> ((Maybe [[Text]] -> f (Maybe [[Text]]))
    -> Maybe [[Text]] -> f (Maybe [[Text]]))
-> (Maybe [[Text]] -> f (Maybe [[Text]]))
-> DiscoverInputSchemaResponse
-> f DiscoverInputSchemaResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [[Text]] [[Text]] [[Text]] [[Text]]
-> Iso
     (Maybe [[Text]]) (Maybe [[Text]]) (Maybe [[Text]]) (Maybe [[Text]])
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 [[Text]] [[Text]] [[Text]] [[Text]]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData DiscoverInputSchemaResponse