{-# 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.S3.Types.SelectParameters
-- 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)
module Amazonka.S3.Types.SelectParameters where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal
import Amazonka.S3.Types.ExpressionType
import Amazonka.S3.Types.InputSerialization
import Amazonka.S3.Types.OutputSerialization

-- | Describes the parameters for Select job types.
--
-- /See:/ 'newSelectParameters' smart constructor.
data SelectParameters = SelectParameters'
  { -- | Describes the serialization format of the object.
    SelectParameters -> InputSerialization
inputSerialization :: InputSerialization,
    -- | The type of the provided expression (for example, SQL).
    SelectParameters -> ExpressionType
expressionType :: ExpressionType,
    -- | The expression that is used to query the object.
    SelectParameters -> Text
expression :: Prelude.Text,
    -- | Describes how the results of the Select job are serialized.
    SelectParameters -> OutputSerialization
outputSerialization :: OutputSerialization
  }
  deriving (SelectParameters -> SelectParameters -> Bool
(SelectParameters -> SelectParameters -> Bool)
-> (SelectParameters -> SelectParameters -> Bool)
-> Eq SelectParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SelectParameters -> SelectParameters -> Bool
$c/= :: SelectParameters -> SelectParameters -> Bool
== :: SelectParameters -> SelectParameters -> Bool
$c== :: SelectParameters -> SelectParameters -> Bool
Prelude.Eq, ReadPrec [SelectParameters]
ReadPrec SelectParameters
Int -> ReadS SelectParameters
ReadS [SelectParameters]
(Int -> ReadS SelectParameters)
-> ReadS [SelectParameters]
-> ReadPrec SelectParameters
-> ReadPrec [SelectParameters]
-> Read SelectParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SelectParameters]
$creadListPrec :: ReadPrec [SelectParameters]
readPrec :: ReadPrec SelectParameters
$creadPrec :: ReadPrec SelectParameters
readList :: ReadS [SelectParameters]
$creadList :: ReadS [SelectParameters]
readsPrec :: Int -> ReadS SelectParameters
$creadsPrec :: Int -> ReadS SelectParameters
Prelude.Read, Int -> SelectParameters -> ShowS
[SelectParameters] -> ShowS
SelectParameters -> String
(Int -> SelectParameters -> ShowS)
-> (SelectParameters -> String)
-> ([SelectParameters] -> ShowS)
-> Show SelectParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SelectParameters] -> ShowS
$cshowList :: [SelectParameters] -> ShowS
show :: SelectParameters -> String
$cshow :: SelectParameters -> String
showsPrec :: Int -> SelectParameters -> ShowS
$cshowsPrec :: Int -> SelectParameters -> ShowS
Prelude.Show, (forall x. SelectParameters -> Rep SelectParameters x)
-> (forall x. Rep SelectParameters x -> SelectParameters)
-> Generic SelectParameters
forall x. Rep SelectParameters x -> SelectParameters
forall x. SelectParameters -> Rep SelectParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SelectParameters x -> SelectParameters
$cfrom :: forall x. SelectParameters -> Rep SelectParameters x
Prelude.Generic)

-- |
-- Create a value of 'SelectParameters' 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:
--
-- 'inputSerialization', 'selectParameters_inputSerialization' - Describes the serialization format of the object.
--
-- 'expressionType', 'selectParameters_expressionType' - The type of the provided expression (for example, SQL).
--
-- 'expression', 'selectParameters_expression' - The expression that is used to query the object.
--
-- 'outputSerialization', 'selectParameters_outputSerialization' - Describes how the results of the Select job are serialized.
newSelectParameters ::
  -- | 'inputSerialization'
  InputSerialization ->
  -- | 'expressionType'
  ExpressionType ->
  -- | 'expression'
  Prelude.Text ->
  -- | 'outputSerialization'
  OutputSerialization ->
  SelectParameters
newSelectParameters :: InputSerialization
-> ExpressionType
-> Text
-> OutputSerialization
-> SelectParameters
newSelectParameters
  InputSerialization
pInputSerialization_
  ExpressionType
pExpressionType_
  Text
pExpression_
  OutputSerialization
pOutputSerialization_ =
    SelectParameters' :: InputSerialization
-> ExpressionType
-> Text
-> OutputSerialization
-> SelectParameters
SelectParameters'
      { $sel:inputSerialization:SelectParameters' :: InputSerialization
inputSerialization =
          InputSerialization
pInputSerialization_,
        $sel:expressionType:SelectParameters' :: ExpressionType
expressionType = ExpressionType
pExpressionType_,
        $sel:expression:SelectParameters' :: Text
expression = Text
pExpression_,
        $sel:outputSerialization:SelectParameters' :: OutputSerialization
outputSerialization = OutputSerialization
pOutputSerialization_
      }

-- | Describes the serialization format of the object.
selectParameters_inputSerialization :: Lens.Lens' SelectParameters InputSerialization
selectParameters_inputSerialization :: (InputSerialization -> f InputSerialization)
-> SelectParameters -> f SelectParameters
selectParameters_inputSerialization = (SelectParameters -> InputSerialization)
-> (SelectParameters -> InputSerialization -> SelectParameters)
-> Lens
     SelectParameters
     SelectParameters
     InputSerialization
     InputSerialization
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectParameters' {InputSerialization
inputSerialization :: InputSerialization
$sel:inputSerialization:SelectParameters' :: SelectParameters -> InputSerialization
inputSerialization} -> InputSerialization
inputSerialization) (\s :: SelectParameters
s@SelectParameters' {} InputSerialization
a -> SelectParameters
s {$sel:inputSerialization:SelectParameters' :: InputSerialization
inputSerialization = InputSerialization
a} :: SelectParameters)

-- | The type of the provided expression (for example, SQL).
selectParameters_expressionType :: Lens.Lens' SelectParameters ExpressionType
selectParameters_expressionType :: (ExpressionType -> f ExpressionType)
-> SelectParameters -> f SelectParameters
selectParameters_expressionType = (SelectParameters -> ExpressionType)
-> (SelectParameters -> ExpressionType -> SelectParameters)
-> Lens
     SelectParameters SelectParameters ExpressionType ExpressionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectParameters' {ExpressionType
expressionType :: ExpressionType
$sel:expressionType:SelectParameters' :: SelectParameters -> ExpressionType
expressionType} -> ExpressionType
expressionType) (\s :: SelectParameters
s@SelectParameters' {} ExpressionType
a -> SelectParameters
s {$sel:expressionType:SelectParameters' :: ExpressionType
expressionType = ExpressionType
a} :: SelectParameters)

-- | The expression that is used to query the object.
selectParameters_expression :: Lens.Lens' SelectParameters Prelude.Text
selectParameters_expression :: (Text -> f Text) -> SelectParameters -> f SelectParameters
selectParameters_expression = (SelectParameters -> Text)
-> (SelectParameters -> Text -> SelectParameters)
-> Lens SelectParameters SelectParameters Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectParameters' {Text
expression :: Text
$sel:expression:SelectParameters' :: SelectParameters -> Text
expression} -> Text
expression) (\s :: SelectParameters
s@SelectParameters' {} Text
a -> SelectParameters
s {$sel:expression:SelectParameters' :: Text
expression = Text
a} :: SelectParameters)

-- | Describes how the results of the Select job are serialized.
selectParameters_outputSerialization :: Lens.Lens' SelectParameters OutputSerialization
selectParameters_outputSerialization :: (OutputSerialization -> f OutputSerialization)
-> SelectParameters -> f SelectParameters
selectParameters_outputSerialization = (SelectParameters -> OutputSerialization)
-> (SelectParameters -> OutputSerialization -> SelectParameters)
-> Lens
     SelectParameters
     SelectParameters
     OutputSerialization
     OutputSerialization
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectParameters' {OutputSerialization
outputSerialization :: OutputSerialization
$sel:outputSerialization:SelectParameters' :: SelectParameters -> OutputSerialization
outputSerialization} -> OutputSerialization
outputSerialization) (\s :: SelectParameters
s@SelectParameters' {} OutputSerialization
a -> SelectParameters
s {$sel:outputSerialization:SelectParameters' :: OutputSerialization
outputSerialization = OutputSerialization
a} :: SelectParameters)

instance Prelude.Hashable SelectParameters

instance Prelude.NFData SelectParameters

instance Core.ToXML SelectParameters where
  toXML :: SelectParameters -> XML
toXML SelectParameters' {Text
ExpressionType
InputSerialization
OutputSerialization
outputSerialization :: OutputSerialization
expression :: Text
expressionType :: ExpressionType
inputSerialization :: InputSerialization
$sel:outputSerialization:SelectParameters' :: SelectParameters -> OutputSerialization
$sel:expression:SelectParameters' :: SelectParameters -> Text
$sel:expressionType:SelectParameters' :: SelectParameters -> ExpressionType
$sel:inputSerialization:SelectParameters' :: SelectParameters -> InputSerialization
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"InputSerialization" Name -> InputSerialization -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= InputSerialization
inputSerialization,
        Name
"ExpressionType" Name -> ExpressionType -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= ExpressionType
expressionType,
        Name
"Expression" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
expression,
        Name
"OutputSerialization" Name -> OutputSerialization -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= OutputSerialization
outputSerialization
      ]