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

import Amazonka.Athena.Types.S3AclOption
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Indicates that an Amazon S3 canned ACL should be set to control
-- ownership of stored query results. When Athena stores query results in
-- Amazon S3, the canned ACL is set with the @x-amz-acl@ request header.
-- For more information about S3 Object Ownership, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html#object-ownership-overview Object Ownership settings>
-- in the /Amazon S3 User Guide/.
--
-- /See:/ 'newAclConfiguration' smart constructor.
data AclConfiguration = AclConfiguration'
  { -- | The Amazon S3 canned ACL that Athena should specify when storing query
    -- results. Currently the only supported canned ACL is
    -- @BUCKET_OWNER_FULL_CONTROL@. If a query runs in a workgroup and the
    -- workgroup overrides client-side settings, then the Amazon S3 canned ACL
    -- specified in the workgroup\'s settings is used for all queries that run
    -- in the workgroup. For more information about Amazon S3 canned ACLs, see
    -- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl Canned ACL>
    -- in the /Amazon S3 User Guide/.
    AclConfiguration -> S3AclOption
s3AclOption :: S3AclOption
  }
  deriving (AclConfiguration -> AclConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AclConfiguration -> AclConfiguration -> Bool
$c/= :: AclConfiguration -> AclConfiguration -> Bool
== :: AclConfiguration -> AclConfiguration -> Bool
$c== :: AclConfiguration -> AclConfiguration -> Bool
Prelude.Eq, ReadPrec [AclConfiguration]
ReadPrec AclConfiguration
Int -> ReadS AclConfiguration
ReadS [AclConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AclConfiguration]
$creadListPrec :: ReadPrec [AclConfiguration]
readPrec :: ReadPrec AclConfiguration
$creadPrec :: ReadPrec AclConfiguration
readList :: ReadS [AclConfiguration]
$creadList :: ReadS [AclConfiguration]
readsPrec :: Int -> ReadS AclConfiguration
$creadsPrec :: Int -> ReadS AclConfiguration
Prelude.Read, Int -> AclConfiguration -> ShowS
[AclConfiguration] -> ShowS
AclConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AclConfiguration] -> ShowS
$cshowList :: [AclConfiguration] -> ShowS
show :: AclConfiguration -> String
$cshow :: AclConfiguration -> String
showsPrec :: Int -> AclConfiguration -> ShowS
$cshowsPrec :: Int -> AclConfiguration -> ShowS
Prelude.Show, forall x. Rep AclConfiguration x -> AclConfiguration
forall x. AclConfiguration -> Rep AclConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AclConfiguration x -> AclConfiguration
$cfrom :: forall x. AclConfiguration -> Rep AclConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'AclConfiguration' 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:
--
-- 's3AclOption', 'aclConfiguration_s3AclOption' - The Amazon S3 canned ACL that Athena should specify when storing query
-- results. Currently the only supported canned ACL is
-- @BUCKET_OWNER_FULL_CONTROL@. If a query runs in a workgroup and the
-- workgroup overrides client-side settings, then the Amazon S3 canned ACL
-- specified in the workgroup\'s settings is used for all queries that run
-- in the workgroup. For more information about Amazon S3 canned ACLs, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl Canned ACL>
-- in the /Amazon S3 User Guide/.
newAclConfiguration ::
  -- | 's3AclOption'
  S3AclOption ->
  AclConfiguration
newAclConfiguration :: S3AclOption -> AclConfiguration
newAclConfiguration S3AclOption
pS3AclOption_ =
  AclConfiguration' {$sel:s3AclOption:AclConfiguration' :: S3AclOption
s3AclOption = S3AclOption
pS3AclOption_}

-- | The Amazon S3 canned ACL that Athena should specify when storing query
-- results. Currently the only supported canned ACL is
-- @BUCKET_OWNER_FULL_CONTROL@. If a query runs in a workgroup and the
-- workgroup overrides client-side settings, then the Amazon S3 canned ACL
-- specified in the workgroup\'s settings is used for all queries that run
-- in the workgroup. For more information about Amazon S3 canned ACLs, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl Canned ACL>
-- in the /Amazon S3 User Guide/.
aclConfiguration_s3AclOption :: Lens.Lens' AclConfiguration S3AclOption
aclConfiguration_s3AclOption :: Lens' AclConfiguration S3AclOption
aclConfiguration_s3AclOption = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AclConfiguration' {S3AclOption
s3AclOption :: S3AclOption
$sel:s3AclOption:AclConfiguration' :: AclConfiguration -> S3AclOption
s3AclOption} -> S3AclOption
s3AclOption) (\s :: AclConfiguration
s@AclConfiguration' {} S3AclOption
a -> AclConfiguration
s {$sel:s3AclOption:AclConfiguration' :: S3AclOption
s3AclOption = S3AclOption
a} :: AclConfiguration)

instance Data.FromJSON AclConfiguration where
  parseJSON :: Value -> Parser AclConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AclConfiguration"
      ( \Object
x ->
          S3AclOption -> AclConfiguration
AclConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"S3AclOption")
      )

instance Prelude.Hashable AclConfiguration where
  hashWithSalt :: Int -> AclConfiguration -> Int
hashWithSalt Int
_salt AclConfiguration' {S3AclOption
s3AclOption :: S3AclOption
$sel:s3AclOption:AclConfiguration' :: AclConfiguration -> S3AclOption
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` S3AclOption
s3AclOption

instance Prelude.NFData AclConfiguration where
  rnf :: AclConfiguration -> ()
rnf AclConfiguration' {S3AclOption
s3AclOption :: S3AclOption
$sel:s3AclOption:AclConfiguration' :: AclConfiguration -> S3AclOption
..} = forall a. NFData a => a -> ()
Prelude.rnf S3AclOption
s3AclOption

instance Data.ToJSON AclConfiguration where
  toJSON :: AclConfiguration -> Value
toJSON AclConfiguration' {S3AclOption
s3AclOption :: S3AclOption
$sel:s3AclOption:AclConfiguration' :: AclConfiguration -> S3AclOption
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"S3AclOption" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= S3AclOption
s3AclOption)]
      )