{-# 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.Athena.Types.ResultConfigurationUpdates
-- 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.Athena.Types.ResultConfigurationUpdates where

import Amazonka.Athena.Types.EncryptionConfiguration
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The information about the updates in the query results, such as output
-- location and encryption configuration for the query results.
--
-- /See:/ 'newResultConfigurationUpdates' smart constructor.
data ResultConfigurationUpdates = ResultConfigurationUpdates'
  { -- | If set to \"true\", indicates that the previously-specified query
    -- results location (also known as a client-side setting) for queries in
    -- this workgroup should be ignored and set to null. If set to \"false\" or
    -- not set, and a value is present in the @OutputLocation@ in
    -- @ResultConfigurationUpdates@ (the client-side setting), the
    -- @OutputLocation@ in the workgroup\'s @ResultConfiguration@ will be
    -- updated with the new value. For more information, see
    -- <https://docs.aws.amazon.com/athena/latest/ug/workgroups-settings-override.html Workgroup Settings Override Client-Side Settings>.
    ResultConfigurationUpdates -> Maybe Bool
removeOutputLocation :: Prelude.Maybe Prelude.Bool,
    -- | If set to \"true\", indicates that the previously-specified encryption
    -- configuration (also known as the client-side setting) for queries in
    -- this workgroup should be ignored and set to null. If set to \"false\" or
    -- not set, and a value is present in the @EncryptionConfiguration@ in
    -- @ResultConfigurationUpdates@ (the client-side setting), the
    -- @EncryptionConfiguration@ in the workgroup\'s @ResultConfiguration@ will
    -- be updated with the new value. For more information, see
    -- <https://docs.aws.amazon.com/athena/latest/ug/workgroups-settings-override.html Workgroup Settings Override Client-Side Settings>.
    ResultConfigurationUpdates -> Maybe Bool
removeEncryptionConfiguration :: Prelude.Maybe Prelude.Bool,
    -- | The encryption configuration for the query results.
    ResultConfigurationUpdates -> Maybe EncryptionConfiguration
encryptionConfiguration :: Prelude.Maybe EncryptionConfiguration,
    -- | The location in Amazon S3 where your query results are stored, such as
    -- @s3:\/\/path\/to\/query\/bucket\/@. For more information, see
    -- <https://docs.aws.amazon.com/athena/latest/ug/querying.html Query Results>
    -- If workgroup settings override client-side settings, then the query uses
    -- the location for the query results and the encryption configuration that
    -- are specified for the workgroup. The \"workgroup settings override\" is
    -- specified in @EnforceWorkGroupConfiguration@ (true\/false) in the
    -- @WorkGroupConfiguration@. See
    -- WorkGroupConfiguration$EnforceWorkGroupConfiguration.
    ResultConfigurationUpdates -> Maybe Text
outputLocation :: Prelude.Maybe Prelude.Text
  }
  deriving (ResultConfigurationUpdates -> ResultConfigurationUpdates -> Bool
(ResultConfigurationUpdates -> ResultConfigurationUpdates -> Bool)
-> (ResultConfigurationUpdates
    -> ResultConfigurationUpdates -> Bool)
-> Eq ResultConfigurationUpdates
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResultConfigurationUpdates -> ResultConfigurationUpdates -> Bool
$c/= :: ResultConfigurationUpdates -> ResultConfigurationUpdates -> Bool
== :: ResultConfigurationUpdates -> ResultConfigurationUpdates -> Bool
$c== :: ResultConfigurationUpdates -> ResultConfigurationUpdates -> Bool
Prelude.Eq, ReadPrec [ResultConfigurationUpdates]
ReadPrec ResultConfigurationUpdates
Int -> ReadS ResultConfigurationUpdates
ReadS [ResultConfigurationUpdates]
(Int -> ReadS ResultConfigurationUpdates)
-> ReadS [ResultConfigurationUpdates]
-> ReadPrec ResultConfigurationUpdates
-> ReadPrec [ResultConfigurationUpdates]
-> Read ResultConfigurationUpdates
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResultConfigurationUpdates]
$creadListPrec :: ReadPrec [ResultConfigurationUpdates]
readPrec :: ReadPrec ResultConfigurationUpdates
$creadPrec :: ReadPrec ResultConfigurationUpdates
readList :: ReadS [ResultConfigurationUpdates]
$creadList :: ReadS [ResultConfigurationUpdates]
readsPrec :: Int -> ReadS ResultConfigurationUpdates
$creadsPrec :: Int -> ReadS ResultConfigurationUpdates
Prelude.Read, Int -> ResultConfigurationUpdates -> ShowS
[ResultConfigurationUpdates] -> ShowS
ResultConfigurationUpdates -> String
(Int -> ResultConfigurationUpdates -> ShowS)
-> (ResultConfigurationUpdates -> String)
-> ([ResultConfigurationUpdates] -> ShowS)
-> Show ResultConfigurationUpdates
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResultConfigurationUpdates] -> ShowS
$cshowList :: [ResultConfigurationUpdates] -> ShowS
show :: ResultConfigurationUpdates -> String
$cshow :: ResultConfigurationUpdates -> String
showsPrec :: Int -> ResultConfigurationUpdates -> ShowS
$cshowsPrec :: Int -> ResultConfigurationUpdates -> ShowS
Prelude.Show, (forall x.
 ResultConfigurationUpdates -> Rep ResultConfigurationUpdates x)
-> (forall x.
    Rep ResultConfigurationUpdates x -> ResultConfigurationUpdates)
-> Generic ResultConfigurationUpdates
forall x.
Rep ResultConfigurationUpdates x -> ResultConfigurationUpdates
forall x.
ResultConfigurationUpdates -> Rep ResultConfigurationUpdates x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResultConfigurationUpdates x -> ResultConfigurationUpdates
$cfrom :: forall x.
ResultConfigurationUpdates -> Rep ResultConfigurationUpdates x
Prelude.Generic)

-- |
-- Create a value of 'ResultConfigurationUpdates' 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:
--
-- 'removeOutputLocation', 'resultConfigurationUpdates_removeOutputLocation' - If set to \"true\", indicates that the previously-specified query
-- results location (also known as a client-side setting) for queries in
-- this workgroup should be ignored and set to null. If set to \"false\" or
-- not set, and a value is present in the @OutputLocation@ in
-- @ResultConfigurationUpdates@ (the client-side setting), the
-- @OutputLocation@ in the workgroup\'s @ResultConfiguration@ will be
-- updated with the new value. For more information, see
-- <https://docs.aws.amazon.com/athena/latest/ug/workgroups-settings-override.html Workgroup Settings Override Client-Side Settings>.
--
-- 'removeEncryptionConfiguration', 'resultConfigurationUpdates_removeEncryptionConfiguration' - If set to \"true\", indicates that the previously-specified encryption
-- configuration (also known as the client-side setting) for queries in
-- this workgroup should be ignored and set to null. If set to \"false\" or
-- not set, and a value is present in the @EncryptionConfiguration@ in
-- @ResultConfigurationUpdates@ (the client-side setting), the
-- @EncryptionConfiguration@ in the workgroup\'s @ResultConfiguration@ will
-- be updated with the new value. For more information, see
-- <https://docs.aws.amazon.com/athena/latest/ug/workgroups-settings-override.html Workgroup Settings Override Client-Side Settings>.
--
-- 'encryptionConfiguration', 'resultConfigurationUpdates_encryptionConfiguration' - The encryption configuration for the query results.
--
-- 'outputLocation', 'resultConfigurationUpdates_outputLocation' - The location in Amazon S3 where your query results are stored, such as
-- @s3:\/\/path\/to\/query\/bucket\/@. For more information, see
-- <https://docs.aws.amazon.com/athena/latest/ug/querying.html Query Results>
-- If workgroup settings override client-side settings, then the query uses
-- the location for the query results and the encryption configuration that
-- are specified for the workgroup. The \"workgroup settings override\" is
-- specified in @EnforceWorkGroupConfiguration@ (true\/false) in the
-- @WorkGroupConfiguration@. See
-- WorkGroupConfiguration$EnforceWorkGroupConfiguration.
newResultConfigurationUpdates ::
  ResultConfigurationUpdates
newResultConfigurationUpdates :: ResultConfigurationUpdates
newResultConfigurationUpdates =
  ResultConfigurationUpdates' :: Maybe Bool
-> Maybe Bool
-> Maybe EncryptionConfiguration
-> Maybe Text
-> ResultConfigurationUpdates
ResultConfigurationUpdates'
    { $sel:removeOutputLocation:ResultConfigurationUpdates' :: Maybe Bool
removeOutputLocation =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:removeEncryptionConfiguration:ResultConfigurationUpdates' :: Maybe Bool
removeEncryptionConfiguration = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:encryptionConfiguration:ResultConfigurationUpdates' :: Maybe EncryptionConfiguration
encryptionConfiguration = Maybe EncryptionConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:outputLocation:ResultConfigurationUpdates' :: Maybe Text
outputLocation = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | If set to \"true\", indicates that the previously-specified query
-- results location (also known as a client-side setting) for queries in
-- this workgroup should be ignored and set to null. If set to \"false\" or
-- not set, and a value is present in the @OutputLocation@ in
-- @ResultConfigurationUpdates@ (the client-side setting), the
-- @OutputLocation@ in the workgroup\'s @ResultConfiguration@ will be
-- updated with the new value. For more information, see
-- <https://docs.aws.amazon.com/athena/latest/ug/workgroups-settings-override.html Workgroup Settings Override Client-Side Settings>.
resultConfigurationUpdates_removeOutputLocation :: Lens.Lens' ResultConfigurationUpdates (Prelude.Maybe Prelude.Bool)
resultConfigurationUpdates_removeOutputLocation :: (Maybe Bool -> f (Maybe Bool))
-> ResultConfigurationUpdates -> f ResultConfigurationUpdates
resultConfigurationUpdates_removeOutputLocation = (ResultConfigurationUpdates -> Maybe Bool)
-> (ResultConfigurationUpdates
    -> Maybe Bool -> ResultConfigurationUpdates)
-> Lens
     ResultConfigurationUpdates
     ResultConfigurationUpdates
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResultConfigurationUpdates' {Maybe Bool
removeOutputLocation :: Maybe Bool
$sel:removeOutputLocation:ResultConfigurationUpdates' :: ResultConfigurationUpdates -> Maybe Bool
removeOutputLocation} -> Maybe Bool
removeOutputLocation) (\s :: ResultConfigurationUpdates
s@ResultConfigurationUpdates' {} Maybe Bool
a -> ResultConfigurationUpdates
s {$sel:removeOutputLocation:ResultConfigurationUpdates' :: Maybe Bool
removeOutputLocation = Maybe Bool
a} :: ResultConfigurationUpdates)

-- | If set to \"true\", indicates that the previously-specified encryption
-- configuration (also known as the client-side setting) for queries in
-- this workgroup should be ignored and set to null. If set to \"false\" or
-- not set, and a value is present in the @EncryptionConfiguration@ in
-- @ResultConfigurationUpdates@ (the client-side setting), the
-- @EncryptionConfiguration@ in the workgroup\'s @ResultConfiguration@ will
-- be updated with the new value. For more information, see
-- <https://docs.aws.amazon.com/athena/latest/ug/workgroups-settings-override.html Workgroup Settings Override Client-Side Settings>.
resultConfigurationUpdates_removeEncryptionConfiguration :: Lens.Lens' ResultConfigurationUpdates (Prelude.Maybe Prelude.Bool)
resultConfigurationUpdates_removeEncryptionConfiguration :: (Maybe Bool -> f (Maybe Bool))
-> ResultConfigurationUpdates -> f ResultConfigurationUpdates
resultConfigurationUpdates_removeEncryptionConfiguration = (ResultConfigurationUpdates -> Maybe Bool)
-> (ResultConfigurationUpdates
    -> Maybe Bool -> ResultConfigurationUpdates)
-> Lens
     ResultConfigurationUpdates
     ResultConfigurationUpdates
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResultConfigurationUpdates' {Maybe Bool
removeEncryptionConfiguration :: Maybe Bool
$sel:removeEncryptionConfiguration:ResultConfigurationUpdates' :: ResultConfigurationUpdates -> Maybe Bool
removeEncryptionConfiguration} -> Maybe Bool
removeEncryptionConfiguration) (\s :: ResultConfigurationUpdates
s@ResultConfigurationUpdates' {} Maybe Bool
a -> ResultConfigurationUpdates
s {$sel:removeEncryptionConfiguration:ResultConfigurationUpdates' :: Maybe Bool
removeEncryptionConfiguration = Maybe Bool
a} :: ResultConfigurationUpdates)

-- | The encryption configuration for the query results.
resultConfigurationUpdates_encryptionConfiguration :: Lens.Lens' ResultConfigurationUpdates (Prelude.Maybe EncryptionConfiguration)
resultConfigurationUpdates_encryptionConfiguration :: (Maybe EncryptionConfiguration
 -> f (Maybe EncryptionConfiguration))
-> ResultConfigurationUpdates -> f ResultConfigurationUpdates
resultConfigurationUpdates_encryptionConfiguration = (ResultConfigurationUpdates -> Maybe EncryptionConfiguration)
-> (ResultConfigurationUpdates
    -> Maybe EncryptionConfiguration -> ResultConfigurationUpdates)
-> Lens
     ResultConfigurationUpdates
     ResultConfigurationUpdates
     (Maybe EncryptionConfiguration)
     (Maybe EncryptionConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResultConfigurationUpdates' {Maybe EncryptionConfiguration
encryptionConfiguration :: Maybe EncryptionConfiguration
$sel:encryptionConfiguration:ResultConfigurationUpdates' :: ResultConfigurationUpdates -> Maybe EncryptionConfiguration
encryptionConfiguration} -> Maybe EncryptionConfiguration
encryptionConfiguration) (\s :: ResultConfigurationUpdates
s@ResultConfigurationUpdates' {} Maybe EncryptionConfiguration
a -> ResultConfigurationUpdates
s {$sel:encryptionConfiguration:ResultConfigurationUpdates' :: Maybe EncryptionConfiguration
encryptionConfiguration = Maybe EncryptionConfiguration
a} :: ResultConfigurationUpdates)

-- | The location in Amazon S3 where your query results are stored, such as
-- @s3:\/\/path\/to\/query\/bucket\/@. For more information, see
-- <https://docs.aws.amazon.com/athena/latest/ug/querying.html Query Results>
-- If workgroup settings override client-side settings, then the query uses
-- the location for the query results and the encryption configuration that
-- are specified for the workgroup. The \"workgroup settings override\" is
-- specified in @EnforceWorkGroupConfiguration@ (true\/false) in the
-- @WorkGroupConfiguration@. See
-- WorkGroupConfiguration$EnforceWorkGroupConfiguration.
resultConfigurationUpdates_outputLocation :: Lens.Lens' ResultConfigurationUpdates (Prelude.Maybe Prelude.Text)
resultConfigurationUpdates_outputLocation :: (Maybe Text -> f (Maybe Text))
-> ResultConfigurationUpdates -> f ResultConfigurationUpdates
resultConfigurationUpdates_outputLocation = (ResultConfigurationUpdates -> Maybe Text)
-> (ResultConfigurationUpdates
    -> Maybe Text -> ResultConfigurationUpdates)
-> Lens
     ResultConfigurationUpdates
     ResultConfigurationUpdates
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResultConfigurationUpdates' {Maybe Text
outputLocation :: Maybe Text
$sel:outputLocation:ResultConfigurationUpdates' :: ResultConfigurationUpdates -> Maybe Text
outputLocation} -> Maybe Text
outputLocation) (\s :: ResultConfigurationUpdates
s@ResultConfigurationUpdates' {} Maybe Text
a -> ResultConfigurationUpdates
s {$sel:outputLocation:ResultConfigurationUpdates' :: Maybe Text
outputLocation = Maybe Text
a} :: ResultConfigurationUpdates)

instance Prelude.Hashable ResultConfigurationUpdates

instance Prelude.NFData ResultConfigurationUpdates

instance Core.ToJSON ResultConfigurationUpdates where
  toJSON :: ResultConfigurationUpdates -> Value
toJSON ResultConfigurationUpdates' {Maybe Bool
Maybe Text
Maybe EncryptionConfiguration
outputLocation :: Maybe Text
encryptionConfiguration :: Maybe EncryptionConfiguration
removeEncryptionConfiguration :: Maybe Bool
removeOutputLocation :: Maybe Bool
$sel:outputLocation:ResultConfigurationUpdates' :: ResultConfigurationUpdates -> Maybe Text
$sel:encryptionConfiguration:ResultConfigurationUpdates' :: ResultConfigurationUpdates -> Maybe EncryptionConfiguration
$sel:removeEncryptionConfiguration:ResultConfigurationUpdates' :: ResultConfigurationUpdates -> Maybe Bool
$sel:removeOutputLocation:ResultConfigurationUpdates' :: ResultConfigurationUpdates -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RemoveOutputLocation" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
removeOutputLocation,
            (Text
"RemoveEncryptionConfiguration" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
removeEncryptionConfiguration,
            (Text
"EncryptionConfiguration" Text -> EncryptionConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EncryptionConfiguration -> Pair)
-> Maybe EncryptionConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EncryptionConfiguration
encryptionConfiguration,
            (Text
"OutputLocation" 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
outputLocation
          ]
      )