{-# 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.SecurityHub.Types.AwsS3ObjectDetails
-- 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.SecurityHub.Types.AwsS3ObjectDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Details about an Amazon S3 object.
--
-- /See:/ 'newAwsS3ObjectDetails' smart constructor.
data AwsS3ObjectDetails = AwsS3ObjectDetails'
  { -- | The opaque identifier assigned by a web server to a specific version of
    -- a resource found at a URL.
    AwsS3ObjectDetails -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
    -- | The version of the object.
    AwsS3ObjectDetails -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the KMS symmetric customer managed key that was used
    -- for the object.
    AwsS3ObjectDetails -> Maybe Text
sSEKMSKeyId :: Prelude.Maybe Prelude.Text,
    -- | Indicates when the object was last modified.
    --
    -- Uses the @date-time@ format specified in
    -- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
    -- The value cannot contain spaces. For example,
    -- @2020-03-22T13:22:13.933Z@.
    AwsS3ObjectDetails -> Maybe Text
lastModified :: Prelude.Maybe Prelude.Text,
    -- | If the object is stored using server-side encryption, the value of the
    -- server-side encryption algorithm used when storing this object in Amazon
    -- S3.
    AwsS3ObjectDetails -> Maybe Text
serverSideEncryption :: Prelude.Maybe Prelude.Text,
    -- | A standard MIME type describing the format of the object data.
    AwsS3ObjectDetails -> Maybe Text
contentType :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsS3ObjectDetails -> AwsS3ObjectDetails -> Bool
(AwsS3ObjectDetails -> AwsS3ObjectDetails -> Bool)
-> (AwsS3ObjectDetails -> AwsS3ObjectDetails -> Bool)
-> Eq AwsS3ObjectDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsS3ObjectDetails -> AwsS3ObjectDetails -> Bool
$c/= :: AwsS3ObjectDetails -> AwsS3ObjectDetails -> Bool
== :: AwsS3ObjectDetails -> AwsS3ObjectDetails -> Bool
$c== :: AwsS3ObjectDetails -> AwsS3ObjectDetails -> Bool
Prelude.Eq, ReadPrec [AwsS3ObjectDetails]
ReadPrec AwsS3ObjectDetails
Int -> ReadS AwsS3ObjectDetails
ReadS [AwsS3ObjectDetails]
(Int -> ReadS AwsS3ObjectDetails)
-> ReadS [AwsS3ObjectDetails]
-> ReadPrec AwsS3ObjectDetails
-> ReadPrec [AwsS3ObjectDetails]
-> Read AwsS3ObjectDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsS3ObjectDetails]
$creadListPrec :: ReadPrec [AwsS3ObjectDetails]
readPrec :: ReadPrec AwsS3ObjectDetails
$creadPrec :: ReadPrec AwsS3ObjectDetails
readList :: ReadS [AwsS3ObjectDetails]
$creadList :: ReadS [AwsS3ObjectDetails]
readsPrec :: Int -> ReadS AwsS3ObjectDetails
$creadsPrec :: Int -> ReadS AwsS3ObjectDetails
Prelude.Read, Int -> AwsS3ObjectDetails -> ShowS
[AwsS3ObjectDetails] -> ShowS
AwsS3ObjectDetails -> String
(Int -> AwsS3ObjectDetails -> ShowS)
-> (AwsS3ObjectDetails -> String)
-> ([AwsS3ObjectDetails] -> ShowS)
-> Show AwsS3ObjectDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsS3ObjectDetails] -> ShowS
$cshowList :: [AwsS3ObjectDetails] -> ShowS
show :: AwsS3ObjectDetails -> String
$cshow :: AwsS3ObjectDetails -> String
showsPrec :: Int -> AwsS3ObjectDetails -> ShowS
$cshowsPrec :: Int -> AwsS3ObjectDetails -> ShowS
Prelude.Show, (forall x. AwsS3ObjectDetails -> Rep AwsS3ObjectDetails x)
-> (forall x. Rep AwsS3ObjectDetails x -> AwsS3ObjectDetails)
-> Generic AwsS3ObjectDetails
forall x. Rep AwsS3ObjectDetails x -> AwsS3ObjectDetails
forall x. AwsS3ObjectDetails -> Rep AwsS3ObjectDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AwsS3ObjectDetails x -> AwsS3ObjectDetails
$cfrom :: forall x. AwsS3ObjectDetails -> Rep AwsS3ObjectDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsS3ObjectDetails' 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:
--
-- 'eTag', 'awsS3ObjectDetails_eTag' - The opaque identifier assigned by a web server to a specific version of
-- a resource found at a URL.
--
-- 'versionId', 'awsS3ObjectDetails_versionId' - The version of the object.
--
-- 'sSEKMSKeyId', 'awsS3ObjectDetails_sSEKMSKeyId' - The identifier of the KMS symmetric customer managed key that was used
-- for the object.
--
-- 'lastModified', 'awsS3ObjectDetails_lastModified' - Indicates when the object was last modified.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
--
-- 'serverSideEncryption', 'awsS3ObjectDetails_serverSideEncryption' - If the object is stored using server-side encryption, the value of the
-- server-side encryption algorithm used when storing this object in Amazon
-- S3.
--
-- 'contentType', 'awsS3ObjectDetails_contentType' - A standard MIME type describing the format of the object data.
newAwsS3ObjectDetails ::
  AwsS3ObjectDetails
newAwsS3ObjectDetails :: AwsS3ObjectDetails
newAwsS3ObjectDetails =
  AwsS3ObjectDetails' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> AwsS3ObjectDetails
AwsS3ObjectDetails'
    { $sel:eTag:AwsS3ObjectDetails' :: Maybe Text
eTag = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:versionId:AwsS3ObjectDetails' :: Maybe Text
versionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sSEKMSKeyId:AwsS3ObjectDetails' :: Maybe Text
sSEKMSKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModified:AwsS3ObjectDetails' :: Maybe Text
lastModified = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:serverSideEncryption:AwsS3ObjectDetails' :: Maybe Text
serverSideEncryption = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:contentType:AwsS3ObjectDetails' :: Maybe Text
contentType = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The opaque identifier assigned by a web server to a specific version of
-- a resource found at a URL.
awsS3ObjectDetails_eTag :: Lens.Lens' AwsS3ObjectDetails (Prelude.Maybe Prelude.Text)
awsS3ObjectDetails_eTag :: (Maybe Text -> f (Maybe Text))
-> AwsS3ObjectDetails -> f AwsS3ObjectDetails
awsS3ObjectDetails_eTag = (AwsS3ObjectDetails -> Maybe Text)
-> (AwsS3ObjectDetails -> Maybe Text -> AwsS3ObjectDetails)
-> Lens
     AwsS3ObjectDetails AwsS3ObjectDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsS3ObjectDetails' {Maybe Text
eTag :: Maybe Text
$sel:eTag:AwsS3ObjectDetails' :: AwsS3ObjectDetails -> Maybe Text
eTag} -> Maybe Text
eTag) (\s :: AwsS3ObjectDetails
s@AwsS3ObjectDetails' {} Maybe Text
a -> AwsS3ObjectDetails
s {$sel:eTag:AwsS3ObjectDetails' :: Maybe Text
eTag = Maybe Text
a} :: AwsS3ObjectDetails)

-- | The version of the object.
awsS3ObjectDetails_versionId :: Lens.Lens' AwsS3ObjectDetails (Prelude.Maybe Prelude.Text)
awsS3ObjectDetails_versionId :: (Maybe Text -> f (Maybe Text))
-> AwsS3ObjectDetails -> f AwsS3ObjectDetails
awsS3ObjectDetails_versionId = (AwsS3ObjectDetails -> Maybe Text)
-> (AwsS3ObjectDetails -> Maybe Text -> AwsS3ObjectDetails)
-> Lens
     AwsS3ObjectDetails AwsS3ObjectDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsS3ObjectDetails' {Maybe Text
versionId :: Maybe Text
$sel:versionId:AwsS3ObjectDetails' :: AwsS3ObjectDetails -> Maybe Text
versionId} -> Maybe Text
versionId) (\s :: AwsS3ObjectDetails
s@AwsS3ObjectDetails' {} Maybe Text
a -> AwsS3ObjectDetails
s {$sel:versionId:AwsS3ObjectDetails' :: Maybe Text
versionId = Maybe Text
a} :: AwsS3ObjectDetails)

-- | The identifier of the KMS symmetric customer managed key that was used
-- for the object.
awsS3ObjectDetails_sSEKMSKeyId :: Lens.Lens' AwsS3ObjectDetails (Prelude.Maybe Prelude.Text)
awsS3ObjectDetails_sSEKMSKeyId :: (Maybe Text -> f (Maybe Text))
-> AwsS3ObjectDetails -> f AwsS3ObjectDetails
awsS3ObjectDetails_sSEKMSKeyId = (AwsS3ObjectDetails -> Maybe Text)
-> (AwsS3ObjectDetails -> Maybe Text -> AwsS3ObjectDetails)
-> Lens
     AwsS3ObjectDetails AwsS3ObjectDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsS3ObjectDetails' {Maybe Text
sSEKMSKeyId :: Maybe Text
$sel:sSEKMSKeyId:AwsS3ObjectDetails' :: AwsS3ObjectDetails -> Maybe Text
sSEKMSKeyId} -> Maybe Text
sSEKMSKeyId) (\s :: AwsS3ObjectDetails
s@AwsS3ObjectDetails' {} Maybe Text
a -> AwsS3ObjectDetails
s {$sel:sSEKMSKeyId:AwsS3ObjectDetails' :: Maybe Text
sSEKMSKeyId = Maybe Text
a} :: AwsS3ObjectDetails)

-- | Indicates when the object was last modified.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
awsS3ObjectDetails_lastModified :: Lens.Lens' AwsS3ObjectDetails (Prelude.Maybe Prelude.Text)
awsS3ObjectDetails_lastModified :: (Maybe Text -> f (Maybe Text))
-> AwsS3ObjectDetails -> f AwsS3ObjectDetails
awsS3ObjectDetails_lastModified = (AwsS3ObjectDetails -> Maybe Text)
-> (AwsS3ObjectDetails -> Maybe Text -> AwsS3ObjectDetails)
-> Lens
     AwsS3ObjectDetails AwsS3ObjectDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsS3ObjectDetails' {Maybe Text
lastModified :: Maybe Text
$sel:lastModified:AwsS3ObjectDetails' :: AwsS3ObjectDetails -> Maybe Text
lastModified} -> Maybe Text
lastModified) (\s :: AwsS3ObjectDetails
s@AwsS3ObjectDetails' {} Maybe Text
a -> AwsS3ObjectDetails
s {$sel:lastModified:AwsS3ObjectDetails' :: Maybe Text
lastModified = Maybe Text
a} :: AwsS3ObjectDetails)

-- | If the object is stored using server-side encryption, the value of the
-- server-side encryption algorithm used when storing this object in Amazon
-- S3.
awsS3ObjectDetails_serverSideEncryption :: Lens.Lens' AwsS3ObjectDetails (Prelude.Maybe Prelude.Text)
awsS3ObjectDetails_serverSideEncryption :: (Maybe Text -> f (Maybe Text))
-> AwsS3ObjectDetails -> f AwsS3ObjectDetails
awsS3ObjectDetails_serverSideEncryption = (AwsS3ObjectDetails -> Maybe Text)
-> (AwsS3ObjectDetails -> Maybe Text -> AwsS3ObjectDetails)
-> Lens
     AwsS3ObjectDetails AwsS3ObjectDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsS3ObjectDetails' {Maybe Text
serverSideEncryption :: Maybe Text
$sel:serverSideEncryption:AwsS3ObjectDetails' :: AwsS3ObjectDetails -> Maybe Text
serverSideEncryption} -> Maybe Text
serverSideEncryption) (\s :: AwsS3ObjectDetails
s@AwsS3ObjectDetails' {} Maybe Text
a -> AwsS3ObjectDetails
s {$sel:serverSideEncryption:AwsS3ObjectDetails' :: Maybe Text
serverSideEncryption = Maybe Text
a} :: AwsS3ObjectDetails)

-- | A standard MIME type describing the format of the object data.
awsS3ObjectDetails_contentType :: Lens.Lens' AwsS3ObjectDetails (Prelude.Maybe Prelude.Text)
awsS3ObjectDetails_contentType :: (Maybe Text -> f (Maybe Text))
-> AwsS3ObjectDetails -> f AwsS3ObjectDetails
awsS3ObjectDetails_contentType = (AwsS3ObjectDetails -> Maybe Text)
-> (AwsS3ObjectDetails -> Maybe Text -> AwsS3ObjectDetails)
-> Lens
     AwsS3ObjectDetails AwsS3ObjectDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsS3ObjectDetails' {Maybe Text
contentType :: Maybe Text
$sel:contentType:AwsS3ObjectDetails' :: AwsS3ObjectDetails -> Maybe Text
contentType} -> Maybe Text
contentType) (\s :: AwsS3ObjectDetails
s@AwsS3ObjectDetails' {} Maybe Text
a -> AwsS3ObjectDetails
s {$sel:contentType:AwsS3ObjectDetails' :: Maybe Text
contentType = Maybe Text
a} :: AwsS3ObjectDetails)

instance Core.FromJSON AwsS3ObjectDetails where
  parseJSON :: Value -> Parser AwsS3ObjectDetails
parseJSON =
    String
-> (Object -> Parser AwsS3ObjectDetails)
-> Value
-> Parser AwsS3ObjectDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsS3ObjectDetails"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> AwsS3ObjectDetails
AwsS3ObjectDetails'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> AwsS3ObjectDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> AwsS3ObjectDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ETag")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> AwsS3ObjectDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> AwsS3ObjectDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"VersionId")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> AwsS3ObjectDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> AwsS3ObjectDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SSEKMSKeyId")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> AwsS3ObjectDetails)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> AwsS3ObjectDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastModified")
            Parser (Maybe Text -> Maybe Text -> AwsS3ObjectDetails)
-> Parser (Maybe Text) -> Parser (Maybe Text -> AwsS3ObjectDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ServerSideEncryption")
            Parser (Maybe Text -> AwsS3ObjectDetails)
-> Parser (Maybe Text) -> Parser AwsS3ObjectDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ContentType")
      )

instance Prelude.Hashable AwsS3ObjectDetails

instance Prelude.NFData AwsS3ObjectDetails

instance Core.ToJSON AwsS3ObjectDetails where
  toJSON :: AwsS3ObjectDetails -> Value
toJSON AwsS3ObjectDetails' {Maybe Text
contentType :: Maybe Text
serverSideEncryption :: Maybe Text
lastModified :: Maybe Text
sSEKMSKeyId :: Maybe Text
versionId :: Maybe Text
eTag :: Maybe Text
$sel:contentType:AwsS3ObjectDetails' :: AwsS3ObjectDetails -> Maybe Text
$sel:serverSideEncryption:AwsS3ObjectDetails' :: AwsS3ObjectDetails -> Maybe Text
$sel:lastModified:AwsS3ObjectDetails' :: AwsS3ObjectDetails -> Maybe Text
$sel:sSEKMSKeyId:AwsS3ObjectDetails' :: AwsS3ObjectDetails -> Maybe Text
$sel:versionId:AwsS3ObjectDetails' :: AwsS3ObjectDetails -> Maybe Text
$sel:eTag:AwsS3ObjectDetails' :: AwsS3ObjectDetails -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ETag" 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
eTag,
            (Text
"VersionId" 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
versionId,
            (Text
"SSEKMSKeyId" 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
sSEKMSKeyId,
            (Text
"LastModified" 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
lastModified,
            (Text
"ServerSideEncryption" 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
serverSideEncryption,
            (Text
"ContentType" 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
contentType
          ]
      )