{-# 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.Kendra.CreateDataSource
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a data source connector that you want to use with an Amazon
-- Kendra index.
--
-- You specify a name, data source connector type and description for your
-- data source. You also specify configuration information for the data
-- source connector.
--
-- @CreateDataSource@ is a synchronous operation. The operation returns 200
-- if the data source was successfully created. Otherwise, an exception is
-- raised.
--
-- Amazon S3 and
-- <https://docs.aws.amazon.com/kendra/latest/dg/data-source-custom.html custom>
-- data sources are the only supported data sources in the Amazon Web
-- Services GovCloud (US-West) region.
--
-- For an example of creating an index and data source using the Python
-- SDK, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/gs-python.html Getting started with Python SDK>.
-- For an example of creating an index and data source using the Java SDK,
-- see
-- <https://docs.aws.amazon.com/kendra/latest/dg/gs-java.html Getting started with Java SDK>.
module Amazonka.Kendra.CreateDataSource
  ( -- * Creating a Request
    CreateDataSource (..),
    newCreateDataSource,

    -- * Request Lenses
    createDataSource_clientToken,
    createDataSource_configuration,
    createDataSource_customDocumentEnrichmentConfiguration,
    createDataSource_description,
    createDataSource_languageCode,
    createDataSource_roleArn,
    createDataSource_schedule,
    createDataSource_tags,
    createDataSource_vpcConfiguration,
    createDataSource_name,
    createDataSource_indexId,
    createDataSource_type,

    -- * Destructuring the Response
    CreateDataSourceResponse (..),
    newCreateDataSourceResponse,

    -- * Response Lenses
    createDataSourceResponse_httpStatus,
    createDataSourceResponse_id,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Kendra.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateDataSource' smart constructor.
data CreateDataSource = CreateDataSource'
  { -- | A token that you provide to identify the request to create a data source
    -- connector. Multiple calls to the @CreateDataSource@ API with the same
    -- client token will create only one data source connector.
    CreateDataSource -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | Configuration information to connect to your data source repository.
    --
    -- You can\'t specify the @Configuration@ parameter when the @Type@
    -- parameter is set to @CUSTOM@. If you do, you receive a
    -- @ValidationException@ exception.
    --
    -- The @Configuration@ parameter is required for all other data sources.
    CreateDataSource -> Maybe DataSourceConfiguration
configuration :: Prelude.Maybe DataSourceConfiguration,
    -- | Configuration information for altering document metadata and content
    -- during the document ingestion process.
    --
    -- For more information on how to create, modify and delete document
    -- metadata, or make other content alterations when you ingest documents
    -- into Amazon Kendra, see
    -- <https://docs.aws.amazon.com/kendra/latest/dg/custom-document-enrichment.html Customizing document metadata during the ingestion process>.
    CreateDataSource -> Maybe CustomDocumentEnrichmentConfiguration
customDocumentEnrichmentConfiguration :: Prelude.Maybe CustomDocumentEnrichmentConfiguration,
    -- | A description for the data source connector.
    CreateDataSource -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The code for a language. This allows you to support a language for all
    -- documents when creating the data source connector. English is supported
    -- by default. For more information on supported languages, including their
    -- codes, see
    -- <https://docs.aws.amazon.com/kendra/latest/dg/in-adding-languages.html Adding documents in languages other than English>.
    CreateDataSource -> Maybe Text
languageCode :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of a role with permission to access the
    -- data source and required resources. For more information, see
    -- <https://docs.aws.amazon.com/kendra/latest/dg/iam-roles.html IAM roles for Amazon Kendra>.
    --
    -- You can\'t specify the @RoleArn@ parameter when the @Type@ parameter is
    -- set to @CUSTOM@. If you do, you receive a @ValidationException@
    -- exception.
    --
    -- The @RoleArn@ parameter is required for all other data sources.
    CreateDataSource -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
    -- | Sets the frequency for Amazon Kendra to check the documents in your data
    -- source repository and update the index. If you don\'t set a schedule
    -- Amazon Kendra will not periodically update the index. You can call the
    -- @StartDataSourceSyncJob@ API to update the index.
    --
    -- You can\'t specify the @Schedule@ parameter when the @Type@ parameter is
    -- set to @CUSTOM@. If you do, you receive a @ValidationException@
    -- exception.
    CreateDataSource -> Maybe Text
schedule :: Prelude.Maybe Prelude.Text,
    -- | A list of key-value pairs that identify the data source connector. You
    -- can use the tags to identify and organize your resources and to control
    -- access to resources.
    CreateDataSource -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | Configuration information for an Amazon Virtual Private Cloud to connect
    -- to your data source. For more information, see
    -- <https://docs.aws.amazon.com/kendra/latest/dg/vpc-configuration.html Configuring a VPC>.
    CreateDataSource -> Maybe DataSourceVpcConfiguration
vpcConfiguration :: Prelude.Maybe DataSourceVpcConfiguration,
    -- | A name for the data source connector.
    CreateDataSource -> Text
name :: Prelude.Text,
    -- | The identifier of the index you want to use with the data source
    -- connector.
    CreateDataSource -> Text
indexId :: Prelude.Text,
    -- | The type of data source repository. For example, @SHAREPOINT@.
    CreateDataSource -> DataSourceType
type' :: DataSourceType
  }
  deriving (CreateDataSource -> CreateDataSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDataSource -> CreateDataSource -> Bool
$c/= :: CreateDataSource -> CreateDataSource -> Bool
== :: CreateDataSource -> CreateDataSource -> Bool
$c== :: CreateDataSource -> CreateDataSource -> Bool
Prelude.Eq, ReadPrec [CreateDataSource]
ReadPrec CreateDataSource
Int -> ReadS CreateDataSource
ReadS [CreateDataSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDataSource]
$creadListPrec :: ReadPrec [CreateDataSource]
readPrec :: ReadPrec CreateDataSource
$creadPrec :: ReadPrec CreateDataSource
readList :: ReadS [CreateDataSource]
$creadList :: ReadS [CreateDataSource]
readsPrec :: Int -> ReadS CreateDataSource
$creadsPrec :: Int -> ReadS CreateDataSource
Prelude.Read, Int -> CreateDataSource -> ShowS
[CreateDataSource] -> ShowS
CreateDataSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDataSource] -> ShowS
$cshowList :: [CreateDataSource] -> ShowS
show :: CreateDataSource -> String
$cshow :: CreateDataSource -> String
showsPrec :: Int -> CreateDataSource -> ShowS
$cshowsPrec :: Int -> CreateDataSource -> ShowS
Prelude.Show, forall x. Rep CreateDataSource x -> CreateDataSource
forall x. CreateDataSource -> Rep CreateDataSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDataSource x -> CreateDataSource
$cfrom :: forall x. CreateDataSource -> Rep CreateDataSource x
Prelude.Generic)

-- |
-- Create a value of 'CreateDataSource' 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:
--
-- 'clientToken', 'createDataSource_clientToken' - A token that you provide to identify the request to create a data source
-- connector. Multiple calls to the @CreateDataSource@ API with the same
-- client token will create only one data source connector.
--
-- 'configuration', 'createDataSource_configuration' - Configuration information to connect to your data source repository.
--
-- You can\'t specify the @Configuration@ parameter when the @Type@
-- parameter is set to @CUSTOM@. If you do, you receive a
-- @ValidationException@ exception.
--
-- The @Configuration@ parameter is required for all other data sources.
--
-- 'customDocumentEnrichmentConfiguration', 'createDataSource_customDocumentEnrichmentConfiguration' - Configuration information for altering document metadata and content
-- during the document ingestion process.
--
-- For more information on how to create, modify and delete document
-- metadata, or make other content alterations when you ingest documents
-- into Amazon Kendra, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/custom-document-enrichment.html Customizing document metadata during the ingestion process>.
--
-- 'description', 'createDataSource_description' - A description for the data source connector.
--
-- 'languageCode', 'createDataSource_languageCode' - The code for a language. This allows you to support a language for all
-- documents when creating the data source connector. English is supported
-- by default. For more information on supported languages, including their
-- codes, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/in-adding-languages.html Adding documents in languages other than English>.
--
-- 'roleArn', 'createDataSource_roleArn' - The Amazon Resource Name (ARN) of a role with permission to access the
-- data source and required resources. For more information, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/iam-roles.html IAM roles for Amazon Kendra>.
--
-- You can\'t specify the @RoleArn@ parameter when the @Type@ parameter is
-- set to @CUSTOM@. If you do, you receive a @ValidationException@
-- exception.
--
-- The @RoleArn@ parameter is required for all other data sources.
--
-- 'schedule', 'createDataSource_schedule' - Sets the frequency for Amazon Kendra to check the documents in your data
-- source repository and update the index. If you don\'t set a schedule
-- Amazon Kendra will not periodically update the index. You can call the
-- @StartDataSourceSyncJob@ API to update the index.
--
-- You can\'t specify the @Schedule@ parameter when the @Type@ parameter is
-- set to @CUSTOM@. If you do, you receive a @ValidationException@
-- exception.
--
-- 'tags', 'createDataSource_tags' - A list of key-value pairs that identify the data source connector. You
-- can use the tags to identify and organize your resources and to control
-- access to resources.
--
-- 'vpcConfiguration', 'createDataSource_vpcConfiguration' - Configuration information for an Amazon Virtual Private Cloud to connect
-- to your data source. For more information, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/vpc-configuration.html Configuring a VPC>.
--
-- 'name', 'createDataSource_name' - A name for the data source connector.
--
-- 'indexId', 'createDataSource_indexId' - The identifier of the index you want to use with the data source
-- connector.
--
-- 'type'', 'createDataSource_type' - The type of data source repository. For example, @SHAREPOINT@.
newCreateDataSource ::
  -- | 'name'
  Prelude.Text ->
  -- | 'indexId'
  Prelude.Text ->
  -- | 'type''
  DataSourceType ->
  CreateDataSource
newCreateDataSource :: Text -> Text -> DataSourceType -> CreateDataSource
newCreateDataSource Text
pName_ Text
pIndexId_ DataSourceType
pType_ =
  CreateDataSource'
    { $sel:clientToken:CreateDataSource' :: Maybe Text
clientToken = forall a. Maybe a
Prelude.Nothing,
      $sel:configuration:CreateDataSource' :: Maybe DataSourceConfiguration
configuration = forall a. Maybe a
Prelude.Nothing,
      $sel:customDocumentEnrichmentConfiguration:CreateDataSource' :: Maybe CustomDocumentEnrichmentConfiguration
customDocumentEnrichmentConfiguration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateDataSource' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:languageCode:CreateDataSource' :: Maybe Text
languageCode = forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:CreateDataSource' :: Maybe Text
roleArn = forall a. Maybe a
Prelude.Nothing,
      $sel:schedule:CreateDataSource' :: Maybe Text
schedule = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateDataSource' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcConfiguration:CreateDataSource' :: Maybe DataSourceVpcConfiguration
vpcConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateDataSource' :: Text
name = Text
pName_,
      $sel:indexId:CreateDataSource' :: Text
indexId = Text
pIndexId_,
      $sel:type':CreateDataSource' :: DataSourceType
type' = DataSourceType
pType_
    }

-- | A token that you provide to identify the request to create a data source
-- connector. Multiple calls to the @CreateDataSource@ API with the same
-- client token will create only one data source connector.
createDataSource_clientToken :: Lens.Lens' CreateDataSource (Prelude.Maybe Prelude.Text)
createDataSource_clientToken :: Lens' CreateDataSource (Maybe Text)
createDataSource_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateDataSource' :: CreateDataSource -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateDataSource
s@CreateDataSource' {} Maybe Text
a -> CreateDataSource
s {$sel:clientToken:CreateDataSource' :: Maybe Text
clientToken = Maybe Text
a} :: CreateDataSource)

-- | Configuration information to connect to your data source repository.
--
-- You can\'t specify the @Configuration@ parameter when the @Type@
-- parameter is set to @CUSTOM@. If you do, you receive a
-- @ValidationException@ exception.
--
-- The @Configuration@ parameter is required for all other data sources.
createDataSource_configuration :: Lens.Lens' CreateDataSource (Prelude.Maybe DataSourceConfiguration)
createDataSource_configuration :: Lens' CreateDataSource (Maybe DataSourceConfiguration)
createDataSource_configuration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Maybe DataSourceConfiguration
configuration :: Maybe DataSourceConfiguration
$sel:configuration:CreateDataSource' :: CreateDataSource -> Maybe DataSourceConfiguration
configuration} -> Maybe DataSourceConfiguration
configuration) (\s :: CreateDataSource
s@CreateDataSource' {} Maybe DataSourceConfiguration
a -> CreateDataSource
s {$sel:configuration:CreateDataSource' :: Maybe DataSourceConfiguration
configuration = Maybe DataSourceConfiguration
a} :: CreateDataSource)

-- | Configuration information for altering document metadata and content
-- during the document ingestion process.
--
-- For more information on how to create, modify and delete document
-- metadata, or make other content alterations when you ingest documents
-- into Amazon Kendra, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/custom-document-enrichment.html Customizing document metadata during the ingestion process>.
createDataSource_customDocumentEnrichmentConfiguration :: Lens.Lens' CreateDataSource (Prelude.Maybe CustomDocumentEnrichmentConfiguration)
createDataSource_customDocumentEnrichmentConfiguration :: Lens'
  CreateDataSource (Maybe CustomDocumentEnrichmentConfiguration)
createDataSource_customDocumentEnrichmentConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Maybe CustomDocumentEnrichmentConfiguration
customDocumentEnrichmentConfiguration :: Maybe CustomDocumentEnrichmentConfiguration
$sel:customDocumentEnrichmentConfiguration:CreateDataSource' :: CreateDataSource -> Maybe CustomDocumentEnrichmentConfiguration
customDocumentEnrichmentConfiguration} -> Maybe CustomDocumentEnrichmentConfiguration
customDocumentEnrichmentConfiguration) (\s :: CreateDataSource
s@CreateDataSource' {} Maybe CustomDocumentEnrichmentConfiguration
a -> CreateDataSource
s {$sel:customDocumentEnrichmentConfiguration:CreateDataSource' :: Maybe CustomDocumentEnrichmentConfiguration
customDocumentEnrichmentConfiguration = Maybe CustomDocumentEnrichmentConfiguration
a} :: CreateDataSource)

-- | A description for the data source connector.
createDataSource_description :: Lens.Lens' CreateDataSource (Prelude.Maybe Prelude.Text)
createDataSource_description :: Lens' CreateDataSource (Maybe Text)
createDataSource_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Maybe Text
description :: Maybe Text
$sel:description:CreateDataSource' :: CreateDataSource -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateDataSource
s@CreateDataSource' {} Maybe Text
a -> CreateDataSource
s {$sel:description:CreateDataSource' :: Maybe Text
description = Maybe Text
a} :: CreateDataSource)

-- | The code for a language. This allows you to support a language for all
-- documents when creating the data source connector. English is supported
-- by default. For more information on supported languages, including their
-- codes, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/in-adding-languages.html Adding documents in languages other than English>.
createDataSource_languageCode :: Lens.Lens' CreateDataSource (Prelude.Maybe Prelude.Text)
createDataSource_languageCode :: Lens' CreateDataSource (Maybe Text)
createDataSource_languageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Maybe Text
languageCode :: Maybe Text
$sel:languageCode:CreateDataSource' :: CreateDataSource -> Maybe Text
languageCode} -> Maybe Text
languageCode) (\s :: CreateDataSource
s@CreateDataSource' {} Maybe Text
a -> CreateDataSource
s {$sel:languageCode:CreateDataSource' :: Maybe Text
languageCode = Maybe Text
a} :: CreateDataSource)

-- | The Amazon Resource Name (ARN) of a role with permission to access the
-- data source and required resources. For more information, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/iam-roles.html IAM roles for Amazon Kendra>.
--
-- You can\'t specify the @RoleArn@ parameter when the @Type@ parameter is
-- set to @CUSTOM@. If you do, you receive a @ValidationException@
-- exception.
--
-- The @RoleArn@ parameter is required for all other data sources.
createDataSource_roleArn :: Lens.Lens' CreateDataSource (Prelude.Maybe Prelude.Text)
createDataSource_roleArn :: Lens' CreateDataSource (Maybe Text)
createDataSource_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:CreateDataSource' :: CreateDataSource -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: CreateDataSource
s@CreateDataSource' {} Maybe Text
a -> CreateDataSource
s {$sel:roleArn:CreateDataSource' :: Maybe Text
roleArn = Maybe Text
a} :: CreateDataSource)

-- | Sets the frequency for Amazon Kendra to check the documents in your data
-- source repository and update the index. If you don\'t set a schedule
-- Amazon Kendra will not periodically update the index. You can call the
-- @StartDataSourceSyncJob@ API to update the index.
--
-- You can\'t specify the @Schedule@ parameter when the @Type@ parameter is
-- set to @CUSTOM@. If you do, you receive a @ValidationException@
-- exception.
createDataSource_schedule :: Lens.Lens' CreateDataSource (Prelude.Maybe Prelude.Text)
createDataSource_schedule :: Lens' CreateDataSource (Maybe Text)
createDataSource_schedule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Maybe Text
schedule :: Maybe Text
$sel:schedule:CreateDataSource' :: CreateDataSource -> Maybe Text
schedule} -> Maybe Text
schedule) (\s :: CreateDataSource
s@CreateDataSource' {} Maybe Text
a -> CreateDataSource
s {$sel:schedule:CreateDataSource' :: Maybe Text
schedule = Maybe Text
a} :: CreateDataSource)

-- | A list of key-value pairs that identify the data source connector. You
-- can use the tags to identify and organize your resources and to control
-- access to resources.
createDataSource_tags :: Lens.Lens' CreateDataSource (Prelude.Maybe [Tag])
createDataSource_tags :: Lens' CreateDataSource (Maybe [Tag])
createDataSource_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateDataSource' :: CreateDataSource -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateDataSource
s@CreateDataSource' {} Maybe [Tag]
a -> CreateDataSource
s {$sel:tags:CreateDataSource' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateDataSource) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Configuration information for an Amazon Virtual Private Cloud to connect
-- to your data source. For more information, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/vpc-configuration.html Configuring a VPC>.
createDataSource_vpcConfiguration :: Lens.Lens' CreateDataSource (Prelude.Maybe DataSourceVpcConfiguration)
createDataSource_vpcConfiguration :: Lens' CreateDataSource (Maybe DataSourceVpcConfiguration)
createDataSource_vpcConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Maybe DataSourceVpcConfiguration
vpcConfiguration :: Maybe DataSourceVpcConfiguration
$sel:vpcConfiguration:CreateDataSource' :: CreateDataSource -> Maybe DataSourceVpcConfiguration
vpcConfiguration} -> Maybe DataSourceVpcConfiguration
vpcConfiguration) (\s :: CreateDataSource
s@CreateDataSource' {} Maybe DataSourceVpcConfiguration
a -> CreateDataSource
s {$sel:vpcConfiguration:CreateDataSource' :: Maybe DataSourceVpcConfiguration
vpcConfiguration = Maybe DataSourceVpcConfiguration
a} :: CreateDataSource)

-- | A name for the data source connector.
createDataSource_name :: Lens.Lens' CreateDataSource Prelude.Text
createDataSource_name :: Lens' CreateDataSource Text
createDataSource_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Text
name :: Text
$sel:name:CreateDataSource' :: CreateDataSource -> Text
name} -> Text
name) (\s :: CreateDataSource
s@CreateDataSource' {} Text
a -> CreateDataSource
s {$sel:name:CreateDataSource' :: Text
name = Text
a} :: CreateDataSource)

-- | The identifier of the index you want to use with the data source
-- connector.
createDataSource_indexId :: Lens.Lens' CreateDataSource Prelude.Text
createDataSource_indexId :: Lens' CreateDataSource Text
createDataSource_indexId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {Text
indexId :: Text
$sel:indexId:CreateDataSource' :: CreateDataSource -> Text
indexId} -> Text
indexId) (\s :: CreateDataSource
s@CreateDataSource' {} Text
a -> CreateDataSource
s {$sel:indexId:CreateDataSource' :: Text
indexId = Text
a} :: CreateDataSource)

-- | The type of data source repository. For example, @SHAREPOINT@.
createDataSource_type :: Lens.Lens' CreateDataSource DataSourceType
createDataSource_type :: Lens' CreateDataSource DataSourceType
createDataSource_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSource' {DataSourceType
type' :: DataSourceType
$sel:type':CreateDataSource' :: CreateDataSource -> DataSourceType
type'} -> DataSourceType
type') (\s :: CreateDataSource
s@CreateDataSource' {} DataSourceType
a -> CreateDataSource
s {$sel:type':CreateDataSource' :: DataSourceType
type' = DataSourceType
a} :: CreateDataSource)

instance Core.AWSRequest CreateDataSource where
  type
    AWSResponse CreateDataSource =
      CreateDataSourceResponse
  request :: (Service -> Service)
-> CreateDataSource -> Request CreateDataSource
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateDataSource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDataSource)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Text -> CreateDataSourceResponse
CreateDataSourceResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"Id")
      )

instance Prelude.Hashable CreateDataSource where
  hashWithSalt :: Int -> CreateDataSource -> Int
hashWithSalt Int
_salt CreateDataSource' {Maybe [Tag]
Maybe Text
Maybe DataSourceVpcConfiguration
Maybe CustomDocumentEnrichmentConfiguration
Maybe DataSourceConfiguration
Text
DataSourceType
type' :: DataSourceType
indexId :: Text
name :: Text
vpcConfiguration :: Maybe DataSourceVpcConfiguration
tags :: Maybe [Tag]
schedule :: Maybe Text
roleArn :: Maybe Text
languageCode :: Maybe Text
description :: Maybe Text
customDocumentEnrichmentConfiguration :: Maybe CustomDocumentEnrichmentConfiguration
configuration :: Maybe DataSourceConfiguration
clientToken :: Maybe Text
$sel:type':CreateDataSource' :: CreateDataSource -> DataSourceType
$sel:indexId:CreateDataSource' :: CreateDataSource -> Text
$sel:name:CreateDataSource' :: CreateDataSource -> Text
$sel:vpcConfiguration:CreateDataSource' :: CreateDataSource -> Maybe DataSourceVpcConfiguration
$sel:tags:CreateDataSource' :: CreateDataSource -> Maybe [Tag]
$sel:schedule:CreateDataSource' :: CreateDataSource -> Maybe Text
$sel:roleArn:CreateDataSource' :: CreateDataSource -> Maybe Text
$sel:languageCode:CreateDataSource' :: CreateDataSource -> Maybe Text
$sel:description:CreateDataSource' :: CreateDataSource -> Maybe Text
$sel:customDocumentEnrichmentConfiguration:CreateDataSource' :: CreateDataSource -> Maybe CustomDocumentEnrichmentConfiguration
$sel:configuration:CreateDataSource' :: CreateDataSource -> Maybe DataSourceConfiguration
$sel:clientToken:CreateDataSource' :: CreateDataSource -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DataSourceConfiguration
configuration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CustomDocumentEnrichmentConfiguration
customDocumentEnrichmentConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
languageCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
schedule
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DataSourceVpcConfiguration
vpcConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
indexId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DataSourceType
type'

instance Prelude.NFData CreateDataSource where
  rnf :: CreateDataSource -> ()
rnf CreateDataSource' {Maybe [Tag]
Maybe Text
Maybe DataSourceVpcConfiguration
Maybe CustomDocumentEnrichmentConfiguration
Maybe DataSourceConfiguration
Text
DataSourceType
type' :: DataSourceType
indexId :: Text
name :: Text
vpcConfiguration :: Maybe DataSourceVpcConfiguration
tags :: Maybe [Tag]
schedule :: Maybe Text
roleArn :: Maybe Text
languageCode :: Maybe Text
description :: Maybe Text
customDocumentEnrichmentConfiguration :: Maybe CustomDocumentEnrichmentConfiguration
configuration :: Maybe DataSourceConfiguration
clientToken :: Maybe Text
$sel:type':CreateDataSource' :: CreateDataSource -> DataSourceType
$sel:indexId:CreateDataSource' :: CreateDataSource -> Text
$sel:name:CreateDataSource' :: CreateDataSource -> Text
$sel:vpcConfiguration:CreateDataSource' :: CreateDataSource -> Maybe DataSourceVpcConfiguration
$sel:tags:CreateDataSource' :: CreateDataSource -> Maybe [Tag]
$sel:schedule:CreateDataSource' :: CreateDataSource -> Maybe Text
$sel:roleArn:CreateDataSource' :: CreateDataSource -> Maybe Text
$sel:languageCode:CreateDataSource' :: CreateDataSource -> Maybe Text
$sel:description:CreateDataSource' :: CreateDataSource -> Maybe Text
$sel:customDocumentEnrichmentConfiguration:CreateDataSource' :: CreateDataSource -> Maybe CustomDocumentEnrichmentConfiguration
$sel:configuration:CreateDataSource' :: CreateDataSource -> Maybe DataSourceConfiguration
$sel:clientToken:CreateDataSource' :: CreateDataSource -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DataSourceConfiguration
configuration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CustomDocumentEnrichmentConfiguration
customDocumentEnrichmentConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
languageCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
schedule
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DataSourceVpcConfiguration
vpcConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
indexId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DataSourceType
type'

instance Data.ToHeaders CreateDataSource where
  toHeaders :: CreateDataSource -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSKendraFrontendService.CreateDataSource" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateDataSource where
  toJSON :: CreateDataSource -> Value
toJSON CreateDataSource' {Maybe [Tag]
Maybe Text
Maybe DataSourceVpcConfiguration
Maybe CustomDocumentEnrichmentConfiguration
Maybe DataSourceConfiguration
Text
DataSourceType
type' :: DataSourceType
indexId :: Text
name :: Text
vpcConfiguration :: Maybe DataSourceVpcConfiguration
tags :: Maybe [Tag]
schedule :: Maybe Text
roleArn :: Maybe Text
languageCode :: Maybe Text
description :: Maybe Text
customDocumentEnrichmentConfiguration :: Maybe CustomDocumentEnrichmentConfiguration
configuration :: Maybe DataSourceConfiguration
clientToken :: Maybe Text
$sel:type':CreateDataSource' :: CreateDataSource -> DataSourceType
$sel:indexId:CreateDataSource' :: CreateDataSource -> Text
$sel:name:CreateDataSource' :: CreateDataSource -> Text
$sel:vpcConfiguration:CreateDataSource' :: CreateDataSource -> Maybe DataSourceVpcConfiguration
$sel:tags:CreateDataSource' :: CreateDataSource -> Maybe [Tag]
$sel:schedule:CreateDataSource' :: CreateDataSource -> Maybe Text
$sel:roleArn:CreateDataSource' :: CreateDataSource -> Maybe Text
$sel:languageCode:CreateDataSource' :: CreateDataSource -> Maybe Text
$sel:description:CreateDataSource' :: CreateDataSource -> Maybe Text
$sel:customDocumentEnrichmentConfiguration:CreateDataSource' :: CreateDataSource -> Maybe CustomDocumentEnrichmentConfiguration
$sel:configuration:CreateDataSource' :: CreateDataSource -> Maybe DataSourceConfiguration
$sel:clientToken:CreateDataSource' :: CreateDataSource -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ClientToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
            (Key
"Configuration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DataSourceConfiguration
configuration,
            (Key
"CustomDocumentEnrichmentConfiguration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CustomDocumentEnrichmentConfiguration
customDocumentEnrichmentConfiguration,
            (Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Key
"LanguageCode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
languageCode,
            (Key
"RoleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
roleArn,
            (Key
"Schedule" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
schedule,
            (Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            (Key
"VpcConfiguration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DataSourceVpcConfiguration
vpcConfiguration,
            forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"IndexId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
indexId),
            forall a. a -> Maybe a
Prelude.Just (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DataSourceType
type')
          ]
      )

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

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

-- | /See:/ 'newCreateDataSourceResponse' smart constructor.
data CreateDataSourceResponse = CreateDataSourceResponse'
  { -- | The response's http status code.
    CreateDataSourceResponse -> Int
httpStatus :: Prelude.Int,
    -- | The identifier of the data source connector.
    CreateDataSourceResponse -> Text
id :: Prelude.Text
  }
  deriving (CreateDataSourceResponse -> CreateDataSourceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDataSourceResponse -> CreateDataSourceResponse -> Bool
$c/= :: CreateDataSourceResponse -> CreateDataSourceResponse -> Bool
== :: CreateDataSourceResponse -> CreateDataSourceResponse -> Bool
$c== :: CreateDataSourceResponse -> CreateDataSourceResponse -> Bool
Prelude.Eq, ReadPrec [CreateDataSourceResponse]
ReadPrec CreateDataSourceResponse
Int -> ReadS CreateDataSourceResponse
ReadS [CreateDataSourceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDataSourceResponse]
$creadListPrec :: ReadPrec [CreateDataSourceResponse]
readPrec :: ReadPrec CreateDataSourceResponse
$creadPrec :: ReadPrec CreateDataSourceResponse
readList :: ReadS [CreateDataSourceResponse]
$creadList :: ReadS [CreateDataSourceResponse]
readsPrec :: Int -> ReadS CreateDataSourceResponse
$creadsPrec :: Int -> ReadS CreateDataSourceResponse
Prelude.Read, Int -> CreateDataSourceResponse -> ShowS
[CreateDataSourceResponse] -> ShowS
CreateDataSourceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDataSourceResponse] -> ShowS
$cshowList :: [CreateDataSourceResponse] -> ShowS
show :: CreateDataSourceResponse -> String
$cshow :: CreateDataSourceResponse -> String
showsPrec :: Int -> CreateDataSourceResponse -> ShowS
$cshowsPrec :: Int -> CreateDataSourceResponse -> ShowS
Prelude.Show, forall x.
Rep CreateDataSourceResponse x -> CreateDataSourceResponse
forall x.
CreateDataSourceResponse -> Rep CreateDataSourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDataSourceResponse x -> CreateDataSourceResponse
$cfrom :: forall x.
CreateDataSourceResponse -> Rep CreateDataSourceResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateDataSourceResponse' 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', 'createDataSourceResponse_httpStatus' - The response's http status code.
--
-- 'id', 'createDataSourceResponse_id' - The identifier of the data source connector.
newCreateDataSourceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'id'
  Prelude.Text ->
  CreateDataSourceResponse
newCreateDataSourceResponse :: Int -> Text -> CreateDataSourceResponse
newCreateDataSourceResponse Int
pHttpStatus_ Text
pId_ =
  CreateDataSourceResponse'
    { $sel:httpStatus:CreateDataSourceResponse' :: Int
httpStatus =
        Int
pHttpStatus_,
      $sel:id:CreateDataSourceResponse' :: Text
id = Text
pId_
    }

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

-- | The identifier of the data source connector.
createDataSourceResponse_id :: Lens.Lens' CreateDataSourceResponse Prelude.Text
createDataSourceResponse_id :: Lens' CreateDataSourceResponse Text
createDataSourceResponse_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSourceResponse' {Text
id :: Text
$sel:id:CreateDataSourceResponse' :: CreateDataSourceResponse -> Text
id} -> Text
id) (\s :: CreateDataSourceResponse
s@CreateDataSourceResponse' {} Text
a -> CreateDataSourceResponse
s {$sel:id:CreateDataSourceResponse' :: Text
id = Text
a} :: CreateDataSourceResponse)

instance Prelude.NFData CreateDataSourceResponse where
  rnf :: CreateDataSourceResponse -> ()
rnf CreateDataSourceResponse' {Int
Text
id :: Text
httpStatus :: Int
$sel:id:CreateDataSourceResponse' :: CreateDataSourceResponse -> Text
$sel:httpStatus:CreateDataSourceResponse' :: CreateDataSourceResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id