{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Glue.Types.AthenaConnectorSource
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Glue.Types.AthenaConnectorSource where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types.GlueSchema
import qualified Amazonka.Prelude as Prelude

-- | Specifies a connector to an Amazon Athena data source.
--
-- /See:/ 'newAthenaConnectorSource' smart constructor.
data AthenaConnectorSource = AthenaConnectorSource'
  { -- | The name of the table in the data source.
    AthenaConnectorSource -> Maybe Text
connectionTable :: Prelude.Maybe Prelude.Text,
    -- | Specifies the data schema for the custom Athena source.
    AthenaConnectorSource -> Maybe [GlueSchema]
outputSchemas :: Prelude.Maybe [GlueSchema],
    -- | The name of the data source.
    AthenaConnectorSource -> Text
name :: Prelude.Text,
    -- | The name of the connection that is associated with the connector.
    AthenaConnectorSource -> Text
connectionName :: Prelude.Text,
    -- | The name of a connector that assists with accessing the data store in
    -- Glue Studio.
    AthenaConnectorSource -> Text
connectorName :: Prelude.Text,
    -- | The type of connection, such as marketplace.athena or custom.athena,
    -- designating a connection to an Amazon Athena data store.
    AthenaConnectorSource -> Text
connectionType :: Prelude.Text,
    -- | The name of the Cloudwatch log group to read from. For example,
    -- @\/aws-glue\/jobs\/output@.
    AthenaConnectorSource -> Text
schemaName :: Prelude.Text
  }
  deriving (AthenaConnectorSource -> AthenaConnectorSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AthenaConnectorSource -> AthenaConnectorSource -> Bool
$c/= :: AthenaConnectorSource -> AthenaConnectorSource -> Bool
== :: AthenaConnectorSource -> AthenaConnectorSource -> Bool
$c== :: AthenaConnectorSource -> AthenaConnectorSource -> Bool
Prelude.Eq, ReadPrec [AthenaConnectorSource]
ReadPrec AthenaConnectorSource
Int -> ReadS AthenaConnectorSource
ReadS [AthenaConnectorSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AthenaConnectorSource]
$creadListPrec :: ReadPrec [AthenaConnectorSource]
readPrec :: ReadPrec AthenaConnectorSource
$creadPrec :: ReadPrec AthenaConnectorSource
readList :: ReadS [AthenaConnectorSource]
$creadList :: ReadS [AthenaConnectorSource]
readsPrec :: Int -> ReadS AthenaConnectorSource
$creadsPrec :: Int -> ReadS AthenaConnectorSource
Prelude.Read, Int -> AthenaConnectorSource -> ShowS
[AthenaConnectorSource] -> ShowS
AthenaConnectorSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AthenaConnectorSource] -> ShowS
$cshowList :: [AthenaConnectorSource] -> ShowS
show :: AthenaConnectorSource -> String
$cshow :: AthenaConnectorSource -> String
showsPrec :: Int -> AthenaConnectorSource -> ShowS
$cshowsPrec :: Int -> AthenaConnectorSource -> ShowS
Prelude.Show, forall x. Rep AthenaConnectorSource x -> AthenaConnectorSource
forall x. AthenaConnectorSource -> Rep AthenaConnectorSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AthenaConnectorSource x -> AthenaConnectorSource
$cfrom :: forall x. AthenaConnectorSource -> Rep AthenaConnectorSource x
Prelude.Generic)

-- |
-- Create a value of 'AthenaConnectorSource' 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:
--
-- 'connectionTable', 'athenaConnectorSource_connectionTable' - The name of the table in the data source.
--
-- 'outputSchemas', 'athenaConnectorSource_outputSchemas' - Specifies the data schema for the custom Athena source.
--
-- 'name', 'athenaConnectorSource_name' - The name of the data source.
--
-- 'connectionName', 'athenaConnectorSource_connectionName' - The name of the connection that is associated with the connector.
--
-- 'connectorName', 'athenaConnectorSource_connectorName' - The name of a connector that assists with accessing the data store in
-- Glue Studio.
--
-- 'connectionType', 'athenaConnectorSource_connectionType' - The type of connection, such as marketplace.athena or custom.athena,
-- designating a connection to an Amazon Athena data store.
--
-- 'schemaName', 'athenaConnectorSource_schemaName' - The name of the Cloudwatch log group to read from. For example,
-- @\/aws-glue\/jobs\/output@.
newAthenaConnectorSource ::
  -- | 'name'
  Prelude.Text ->
  -- | 'connectionName'
  Prelude.Text ->
  -- | 'connectorName'
  Prelude.Text ->
  -- | 'connectionType'
  Prelude.Text ->
  -- | 'schemaName'
  Prelude.Text ->
  AthenaConnectorSource
newAthenaConnectorSource :: Text -> Text -> Text -> Text -> Text -> AthenaConnectorSource
newAthenaConnectorSource
  Text
pName_
  Text
pConnectionName_
  Text
pConnectorName_
  Text
pConnectionType_
  Text
pSchemaName_ =
    AthenaConnectorSource'
      { $sel:connectionTable:AthenaConnectorSource' :: Maybe Text
connectionTable =
          forall a. Maybe a
Prelude.Nothing,
        $sel:outputSchemas:AthenaConnectorSource' :: Maybe [GlueSchema]
outputSchemas = forall a. Maybe a
Prelude.Nothing,
        $sel:name:AthenaConnectorSource' :: Text
name = Text
pName_,
        $sel:connectionName:AthenaConnectorSource' :: Text
connectionName = Text
pConnectionName_,
        $sel:connectorName:AthenaConnectorSource' :: Text
connectorName = Text
pConnectorName_,
        $sel:connectionType:AthenaConnectorSource' :: Text
connectionType = Text
pConnectionType_,
        $sel:schemaName:AthenaConnectorSource' :: Text
schemaName = Text
pSchemaName_
      }

-- | The name of the table in the data source.
athenaConnectorSource_connectionTable :: Lens.Lens' AthenaConnectorSource (Prelude.Maybe Prelude.Text)
athenaConnectorSource_connectionTable :: Lens' AthenaConnectorSource (Maybe Text)
athenaConnectorSource_connectionTable = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AthenaConnectorSource' {Maybe Text
connectionTable :: Maybe Text
$sel:connectionTable:AthenaConnectorSource' :: AthenaConnectorSource -> Maybe Text
connectionTable} -> Maybe Text
connectionTable) (\s :: AthenaConnectorSource
s@AthenaConnectorSource' {} Maybe Text
a -> AthenaConnectorSource
s {$sel:connectionTable:AthenaConnectorSource' :: Maybe Text
connectionTable = Maybe Text
a} :: AthenaConnectorSource)

-- | Specifies the data schema for the custom Athena source.
athenaConnectorSource_outputSchemas :: Lens.Lens' AthenaConnectorSource (Prelude.Maybe [GlueSchema])
athenaConnectorSource_outputSchemas :: Lens' AthenaConnectorSource (Maybe [GlueSchema])
athenaConnectorSource_outputSchemas = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AthenaConnectorSource' {Maybe [GlueSchema]
outputSchemas :: Maybe [GlueSchema]
$sel:outputSchemas:AthenaConnectorSource' :: AthenaConnectorSource -> Maybe [GlueSchema]
outputSchemas} -> Maybe [GlueSchema]
outputSchemas) (\s :: AthenaConnectorSource
s@AthenaConnectorSource' {} Maybe [GlueSchema]
a -> AthenaConnectorSource
s {$sel:outputSchemas:AthenaConnectorSource' :: Maybe [GlueSchema]
outputSchemas = Maybe [GlueSchema]
a} :: AthenaConnectorSource) 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

-- | The name of the data source.
athenaConnectorSource_name :: Lens.Lens' AthenaConnectorSource Prelude.Text
athenaConnectorSource_name :: Lens' AthenaConnectorSource Text
athenaConnectorSource_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AthenaConnectorSource' {Text
name :: Text
$sel:name:AthenaConnectorSource' :: AthenaConnectorSource -> Text
name} -> Text
name) (\s :: AthenaConnectorSource
s@AthenaConnectorSource' {} Text
a -> AthenaConnectorSource
s {$sel:name:AthenaConnectorSource' :: Text
name = Text
a} :: AthenaConnectorSource)

-- | The name of the connection that is associated with the connector.
athenaConnectorSource_connectionName :: Lens.Lens' AthenaConnectorSource Prelude.Text
athenaConnectorSource_connectionName :: Lens' AthenaConnectorSource Text
athenaConnectorSource_connectionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AthenaConnectorSource' {Text
connectionName :: Text
$sel:connectionName:AthenaConnectorSource' :: AthenaConnectorSource -> Text
connectionName} -> Text
connectionName) (\s :: AthenaConnectorSource
s@AthenaConnectorSource' {} Text
a -> AthenaConnectorSource
s {$sel:connectionName:AthenaConnectorSource' :: Text
connectionName = Text
a} :: AthenaConnectorSource)

-- | The name of a connector that assists with accessing the data store in
-- Glue Studio.
athenaConnectorSource_connectorName :: Lens.Lens' AthenaConnectorSource Prelude.Text
athenaConnectorSource_connectorName :: Lens' AthenaConnectorSource Text
athenaConnectorSource_connectorName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AthenaConnectorSource' {Text
connectorName :: Text
$sel:connectorName:AthenaConnectorSource' :: AthenaConnectorSource -> Text
connectorName} -> Text
connectorName) (\s :: AthenaConnectorSource
s@AthenaConnectorSource' {} Text
a -> AthenaConnectorSource
s {$sel:connectorName:AthenaConnectorSource' :: Text
connectorName = Text
a} :: AthenaConnectorSource)

-- | The type of connection, such as marketplace.athena or custom.athena,
-- designating a connection to an Amazon Athena data store.
athenaConnectorSource_connectionType :: Lens.Lens' AthenaConnectorSource Prelude.Text
athenaConnectorSource_connectionType :: Lens' AthenaConnectorSource Text
athenaConnectorSource_connectionType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AthenaConnectorSource' {Text
connectionType :: Text
$sel:connectionType:AthenaConnectorSource' :: AthenaConnectorSource -> Text
connectionType} -> Text
connectionType) (\s :: AthenaConnectorSource
s@AthenaConnectorSource' {} Text
a -> AthenaConnectorSource
s {$sel:connectionType:AthenaConnectorSource' :: Text
connectionType = Text
a} :: AthenaConnectorSource)

-- | The name of the Cloudwatch log group to read from. For example,
-- @\/aws-glue\/jobs\/output@.
athenaConnectorSource_schemaName :: Lens.Lens' AthenaConnectorSource Prelude.Text
athenaConnectorSource_schemaName :: Lens' AthenaConnectorSource Text
athenaConnectorSource_schemaName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AthenaConnectorSource' {Text
schemaName :: Text
$sel:schemaName:AthenaConnectorSource' :: AthenaConnectorSource -> Text
schemaName} -> Text
schemaName) (\s :: AthenaConnectorSource
s@AthenaConnectorSource' {} Text
a -> AthenaConnectorSource
s {$sel:schemaName:AthenaConnectorSource' :: Text
schemaName = Text
a} :: AthenaConnectorSource)

instance Data.FromJSON AthenaConnectorSource where
  parseJSON :: Value -> Parser AthenaConnectorSource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AthenaConnectorSource"
      ( \Object
x ->
          Maybe Text
-> Maybe [GlueSchema]
-> Text
-> Text
-> Text
-> Text
-> Text
-> AthenaConnectorSource
AthenaConnectorSource'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ConnectionTable")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"OutputSchemas" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ConnectionName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ConnectorName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ConnectionType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"SchemaName")
      )

instance Prelude.Hashable AthenaConnectorSource where
  hashWithSalt :: Int -> AthenaConnectorSource -> Int
hashWithSalt Int
_salt AthenaConnectorSource' {Maybe [GlueSchema]
Maybe Text
Text
schemaName :: Text
connectionType :: Text
connectorName :: Text
connectionName :: Text
name :: Text
outputSchemas :: Maybe [GlueSchema]
connectionTable :: Maybe Text
$sel:schemaName:AthenaConnectorSource' :: AthenaConnectorSource -> Text
$sel:connectionType:AthenaConnectorSource' :: AthenaConnectorSource -> Text
$sel:connectorName:AthenaConnectorSource' :: AthenaConnectorSource -> Text
$sel:connectionName:AthenaConnectorSource' :: AthenaConnectorSource -> Text
$sel:name:AthenaConnectorSource' :: AthenaConnectorSource -> Text
$sel:outputSchemas:AthenaConnectorSource' :: AthenaConnectorSource -> Maybe [GlueSchema]
$sel:connectionTable:AthenaConnectorSource' :: AthenaConnectorSource -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
connectionTable
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [GlueSchema]
outputSchemas
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
connectionName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
connectorName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
connectionType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
schemaName

instance Prelude.NFData AthenaConnectorSource where
  rnf :: AthenaConnectorSource -> ()
rnf AthenaConnectorSource' {Maybe [GlueSchema]
Maybe Text
Text
schemaName :: Text
connectionType :: Text
connectorName :: Text
connectionName :: Text
name :: Text
outputSchemas :: Maybe [GlueSchema]
connectionTable :: Maybe Text
$sel:schemaName:AthenaConnectorSource' :: AthenaConnectorSource -> Text
$sel:connectionType:AthenaConnectorSource' :: AthenaConnectorSource -> Text
$sel:connectorName:AthenaConnectorSource' :: AthenaConnectorSource -> Text
$sel:connectionName:AthenaConnectorSource' :: AthenaConnectorSource -> Text
$sel:name:AthenaConnectorSource' :: AthenaConnectorSource -> Text
$sel:outputSchemas:AthenaConnectorSource' :: AthenaConnectorSource -> Maybe [GlueSchema]
$sel:connectionTable:AthenaConnectorSource' :: AthenaConnectorSource -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
connectionTable
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [GlueSchema]
outputSchemas
      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
connectionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
connectorName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
connectionType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
schemaName

instance Data.ToJSON AthenaConnectorSource where
  toJSON :: AthenaConnectorSource -> Value
toJSON AthenaConnectorSource' {Maybe [GlueSchema]
Maybe Text
Text
schemaName :: Text
connectionType :: Text
connectorName :: Text
connectionName :: Text
name :: Text
outputSchemas :: Maybe [GlueSchema]
connectionTable :: Maybe Text
$sel:schemaName:AthenaConnectorSource' :: AthenaConnectorSource -> Text
$sel:connectionType:AthenaConnectorSource' :: AthenaConnectorSource -> Text
$sel:connectorName:AthenaConnectorSource' :: AthenaConnectorSource -> Text
$sel:connectionName:AthenaConnectorSource' :: AthenaConnectorSource -> Text
$sel:name:AthenaConnectorSource' :: AthenaConnectorSource -> Text
$sel:outputSchemas:AthenaConnectorSource' :: AthenaConnectorSource -> Maybe [GlueSchema]
$sel:connectionTable:AthenaConnectorSource' :: AthenaConnectorSource -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ConnectionTable" 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
connectionTable,
            (Key
"OutputSchemas" 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 [GlueSchema]
outputSchemas,
            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
"ConnectionName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
connectionName),
            forall a. a -> Maybe a
Prelude.Just (Key
"ConnectorName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
connectorName),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"ConnectionType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
connectionType),
            forall a. a -> Maybe a
Prelude.Just (Key
"SchemaName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
schemaName)
          ]
      )