{-# 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.LakeFormation.Types.AddObjectInput
-- 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.LakeFormation.Types.AddObjectInput where

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

-- | A new object to add to the governed table.
--
-- /See:/ 'newAddObjectInput' smart constructor.
data AddObjectInput = AddObjectInput'
  { -- | A list of partition values for the object. A value must be specified for
    -- each partition key associated with the table.
    --
    -- The supported data types are integer, long, date(yyyy-MM-dd),
    -- timestamp(yyyy-MM-dd HH:mm:ssXXX or yyyy-MM-dd HH:mm:ss\"), string and
    -- decimal.
    AddObjectInput -> Maybe (NonEmpty Text)
partitionValues :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The Amazon S3 location of the object.
    AddObjectInput -> Text
uri :: Prelude.Text,
    -- | The Amazon S3 ETag of the object. Returned by @GetTableObjects@ for
    -- validation and used to identify changes to the underlying data.
    AddObjectInput -> Text
eTag :: Prelude.Text,
    -- | The size of the Amazon S3 object in bytes.
    AddObjectInput -> Integer
size :: Prelude.Integer
  }
  deriving (AddObjectInput -> AddObjectInput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddObjectInput -> AddObjectInput -> Bool
$c/= :: AddObjectInput -> AddObjectInput -> Bool
== :: AddObjectInput -> AddObjectInput -> Bool
$c== :: AddObjectInput -> AddObjectInput -> Bool
Prelude.Eq, ReadPrec [AddObjectInput]
ReadPrec AddObjectInput
Int -> ReadS AddObjectInput
ReadS [AddObjectInput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddObjectInput]
$creadListPrec :: ReadPrec [AddObjectInput]
readPrec :: ReadPrec AddObjectInput
$creadPrec :: ReadPrec AddObjectInput
readList :: ReadS [AddObjectInput]
$creadList :: ReadS [AddObjectInput]
readsPrec :: Int -> ReadS AddObjectInput
$creadsPrec :: Int -> ReadS AddObjectInput
Prelude.Read, Int -> AddObjectInput -> ShowS
[AddObjectInput] -> ShowS
AddObjectInput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddObjectInput] -> ShowS
$cshowList :: [AddObjectInput] -> ShowS
show :: AddObjectInput -> String
$cshow :: AddObjectInput -> String
showsPrec :: Int -> AddObjectInput -> ShowS
$cshowsPrec :: Int -> AddObjectInput -> ShowS
Prelude.Show, forall x. Rep AddObjectInput x -> AddObjectInput
forall x. AddObjectInput -> Rep AddObjectInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddObjectInput x -> AddObjectInput
$cfrom :: forall x. AddObjectInput -> Rep AddObjectInput x
Prelude.Generic)

-- |
-- Create a value of 'AddObjectInput' 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:
--
-- 'partitionValues', 'addObjectInput_partitionValues' - A list of partition values for the object. A value must be specified for
-- each partition key associated with the table.
--
-- The supported data types are integer, long, date(yyyy-MM-dd),
-- timestamp(yyyy-MM-dd HH:mm:ssXXX or yyyy-MM-dd HH:mm:ss\"), string and
-- decimal.
--
-- 'uri', 'addObjectInput_uri' - The Amazon S3 location of the object.
--
-- 'eTag', 'addObjectInput_eTag' - The Amazon S3 ETag of the object. Returned by @GetTableObjects@ for
-- validation and used to identify changes to the underlying data.
--
-- 'size', 'addObjectInput_size' - The size of the Amazon S3 object in bytes.
newAddObjectInput ::
  -- | 'uri'
  Prelude.Text ->
  -- | 'eTag'
  Prelude.Text ->
  -- | 'size'
  Prelude.Integer ->
  AddObjectInput
newAddObjectInput :: Text -> Text -> Integer -> AddObjectInput
newAddObjectInput Text
pUri_ Text
pETag_ Integer
pSize_ =
  AddObjectInput'
    { $sel:partitionValues:AddObjectInput' :: Maybe (NonEmpty Text)
partitionValues = forall a. Maybe a
Prelude.Nothing,
      $sel:uri:AddObjectInput' :: Text
uri = Text
pUri_,
      $sel:eTag:AddObjectInput' :: Text
eTag = Text
pETag_,
      $sel:size:AddObjectInput' :: Integer
size = Integer
pSize_
    }

-- | A list of partition values for the object. A value must be specified for
-- each partition key associated with the table.
--
-- The supported data types are integer, long, date(yyyy-MM-dd),
-- timestamp(yyyy-MM-dd HH:mm:ssXXX or yyyy-MM-dd HH:mm:ss\"), string and
-- decimal.
addObjectInput_partitionValues :: Lens.Lens' AddObjectInput (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
addObjectInput_partitionValues :: Lens' AddObjectInput (Maybe (NonEmpty Text))
addObjectInput_partitionValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddObjectInput' {Maybe (NonEmpty Text)
partitionValues :: Maybe (NonEmpty Text)
$sel:partitionValues:AddObjectInput' :: AddObjectInput -> Maybe (NonEmpty Text)
partitionValues} -> Maybe (NonEmpty Text)
partitionValues) (\s :: AddObjectInput
s@AddObjectInput' {} Maybe (NonEmpty Text)
a -> AddObjectInput
s {$sel:partitionValues:AddObjectInput' :: Maybe (NonEmpty Text)
partitionValues = Maybe (NonEmpty Text)
a} :: AddObjectInput) 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 Amazon S3 location of the object.
addObjectInput_uri :: Lens.Lens' AddObjectInput Prelude.Text
addObjectInput_uri :: Lens' AddObjectInput Text
addObjectInput_uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddObjectInput' {Text
uri :: Text
$sel:uri:AddObjectInput' :: AddObjectInput -> Text
uri} -> Text
uri) (\s :: AddObjectInput
s@AddObjectInput' {} Text
a -> AddObjectInput
s {$sel:uri:AddObjectInput' :: Text
uri = Text
a} :: AddObjectInput)

-- | The Amazon S3 ETag of the object. Returned by @GetTableObjects@ for
-- validation and used to identify changes to the underlying data.
addObjectInput_eTag :: Lens.Lens' AddObjectInput Prelude.Text
addObjectInput_eTag :: Lens' AddObjectInput Text
addObjectInput_eTag = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddObjectInput' {Text
eTag :: Text
$sel:eTag:AddObjectInput' :: AddObjectInput -> Text
eTag} -> Text
eTag) (\s :: AddObjectInput
s@AddObjectInput' {} Text
a -> AddObjectInput
s {$sel:eTag:AddObjectInput' :: Text
eTag = Text
a} :: AddObjectInput)

-- | The size of the Amazon S3 object in bytes.
addObjectInput_size :: Lens.Lens' AddObjectInput Prelude.Integer
addObjectInput_size :: Lens' AddObjectInput Integer
addObjectInput_size = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddObjectInput' {Integer
size :: Integer
$sel:size:AddObjectInput' :: AddObjectInput -> Integer
size} -> Integer
size) (\s :: AddObjectInput
s@AddObjectInput' {} Integer
a -> AddObjectInput
s {$sel:size:AddObjectInput' :: Integer
size = Integer
a} :: AddObjectInput)

instance Prelude.Hashable AddObjectInput where
  hashWithSalt :: Int -> AddObjectInput -> Int
hashWithSalt Int
_salt AddObjectInput' {Integer
Maybe (NonEmpty Text)
Text
size :: Integer
eTag :: Text
uri :: Text
partitionValues :: Maybe (NonEmpty Text)
$sel:size:AddObjectInput' :: AddObjectInput -> Integer
$sel:eTag:AddObjectInput' :: AddObjectInput -> Text
$sel:uri:AddObjectInput' :: AddObjectInput -> Text
$sel:partitionValues:AddObjectInput' :: AddObjectInput -> Maybe (NonEmpty Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
partitionValues
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
uri
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
eTag
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
size

instance Prelude.NFData AddObjectInput where
  rnf :: AddObjectInput -> ()
rnf AddObjectInput' {Integer
Maybe (NonEmpty Text)
Text
size :: Integer
eTag :: Text
uri :: Text
partitionValues :: Maybe (NonEmpty Text)
$sel:size:AddObjectInput' :: AddObjectInput -> Integer
$sel:eTag:AddObjectInput' :: AddObjectInput -> Text
$sel:uri:AddObjectInput' :: AddObjectInput -> Text
$sel:partitionValues:AddObjectInput' :: AddObjectInput -> Maybe (NonEmpty Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
partitionValues
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
uri
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
eTag
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
size

instance Data.ToJSON AddObjectInput where
  toJSON :: AddObjectInput -> Value
toJSON AddObjectInput' {Integer
Maybe (NonEmpty Text)
Text
size :: Integer
eTag :: Text
uri :: Text
partitionValues :: Maybe (NonEmpty Text)
$sel:size:AddObjectInput' :: AddObjectInput -> Integer
$sel:eTag:AddObjectInput' :: AddObjectInput -> Text
$sel:uri:AddObjectInput' :: AddObjectInput -> Text
$sel:partitionValues:AddObjectInput' :: AddObjectInput -> Maybe (NonEmpty Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"PartitionValues" 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 (NonEmpty Text)
partitionValues,
            forall a. a -> Maybe a
Prelude.Just (Key
"Uri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
uri),
            forall a. a -> Maybe a
Prelude.Just (Key
"ETag" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
eTag),
            forall a. a -> Maybe a
Prelude.Just (Key
"Size" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Integer
size)
          ]
      )