{-# 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.MacieV2.Types.Occurrences
-- 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.MacieV2.Types.Occurrences where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MacieV2.Types.Cell
import Amazonka.MacieV2.Types.Page
import Amazonka.MacieV2.Types.Range
import Amazonka.MacieV2.Types.Record
import qualified Amazonka.Prelude as Prelude

-- | Specifies the location of 1-15 occurrences of sensitive data that was
-- detected by a managed data identifier or a custom data identifier and
-- produced a sensitive data finding.
--
-- /See:/ 'newOccurrences' smart constructor.
data Occurrences = Occurrences'
  { -- | An array of objects, one for each occurrence of sensitive data in a
    -- Microsoft Excel workbook, CSV file, or TSV file. This value is null for
    -- all other types of files.
    --
    -- Each Cell object specifies a cell or field that contains the sensitive
    -- data.
    Occurrences -> Maybe [Cell]
cells :: Prelude.Maybe [Cell],
    -- | An array of objects, one for each occurrence of sensitive data in a
    -- non-binary text file, such as an HTML, TXT, or XML file. Each Range
    -- object specifies a line or inclusive range of lines that contains the
    -- sensitive data, and the position of the data on the specified line or
    -- lines.
    --
    -- This value is often null for file types that are supported by Cell,
    -- Page, or Record objects. Exceptions are the location of sensitive data
    -- in: unstructured sections of an otherwise structured file, such as a
    -- comment in a file; a malformed file that Amazon Macie analyzes as plain
    -- text; and, a CSV or TSV file that has any column names that contain
    -- sensitive data.
    Occurrences -> Maybe [Range]
lineRanges :: Prelude.Maybe [Range],
    -- | Reserved for future use.
    Occurrences -> Maybe [Range]
offsetRanges :: Prelude.Maybe [Range],
    -- | An array of objects, one for each occurrence of sensitive data in an
    -- Adobe Portable Document Format file. This value is null for all other
    -- types of files.
    --
    -- Each Page object specifies a page that contains the sensitive data.
    Occurrences -> Maybe [Page]
pages :: Prelude.Maybe [Page],
    -- | An array of objects, one for each occurrence of sensitive data in an
    -- Apache Avro object container, Apache Parquet file, JSON file, or JSON
    -- Lines file. This value is null for all other types of files.
    --
    -- For an Avro object container or Parquet file, each Record object
    -- specifies a record index and the path to a field in a record that
    -- contains the sensitive data. For a JSON or JSON Lines file, each Record
    -- object specifies the path to a field or array that contains the
    -- sensitive data. For a JSON Lines file, it also specifies the index of
    -- the line that contains the data.
    Occurrences -> Maybe [Record]
records :: Prelude.Maybe [Record]
  }
  deriving (Occurrences -> Occurrences -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Occurrences -> Occurrences -> Bool
$c/= :: Occurrences -> Occurrences -> Bool
== :: Occurrences -> Occurrences -> Bool
$c== :: Occurrences -> Occurrences -> Bool
Prelude.Eq, ReadPrec [Occurrences]
ReadPrec Occurrences
Int -> ReadS Occurrences
ReadS [Occurrences]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Occurrences]
$creadListPrec :: ReadPrec [Occurrences]
readPrec :: ReadPrec Occurrences
$creadPrec :: ReadPrec Occurrences
readList :: ReadS [Occurrences]
$creadList :: ReadS [Occurrences]
readsPrec :: Int -> ReadS Occurrences
$creadsPrec :: Int -> ReadS Occurrences
Prelude.Read, Int -> Occurrences -> ShowS
[Occurrences] -> ShowS
Occurrences -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Occurrences] -> ShowS
$cshowList :: [Occurrences] -> ShowS
show :: Occurrences -> String
$cshow :: Occurrences -> String
showsPrec :: Int -> Occurrences -> ShowS
$cshowsPrec :: Int -> Occurrences -> ShowS
Prelude.Show, forall x. Rep Occurrences x -> Occurrences
forall x. Occurrences -> Rep Occurrences x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Occurrences x -> Occurrences
$cfrom :: forall x. Occurrences -> Rep Occurrences x
Prelude.Generic)

-- |
-- Create a value of 'Occurrences' 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:
--
-- 'cells', 'occurrences_cells' - An array of objects, one for each occurrence of sensitive data in a
-- Microsoft Excel workbook, CSV file, or TSV file. This value is null for
-- all other types of files.
--
-- Each Cell object specifies a cell or field that contains the sensitive
-- data.
--
-- 'lineRanges', 'occurrences_lineRanges' - An array of objects, one for each occurrence of sensitive data in a
-- non-binary text file, such as an HTML, TXT, or XML file. Each Range
-- object specifies a line or inclusive range of lines that contains the
-- sensitive data, and the position of the data on the specified line or
-- lines.
--
-- This value is often null for file types that are supported by Cell,
-- Page, or Record objects. Exceptions are the location of sensitive data
-- in: unstructured sections of an otherwise structured file, such as a
-- comment in a file; a malformed file that Amazon Macie analyzes as plain
-- text; and, a CSV or TSV file that has any column names that contain
-- sensitive data.
--
-- 'offsetRanges', 'occurrences_offsetRanges' - Reserved for future use.
--
-- 'pages', 'occurrences_pages' - An array of objects, one for each occurrence of sensitive data in an
-- Adobe Portable Document Format file. This value is null for all other
-- types of files.
--
-- Each Page object specifies a page that contains the sensitive data.
--
-- 'records', 'occurrences_records' - An array of objects, one for each occurrence of sensitive data in an
-- Apache Avro object container, Apache Parquet file, JSON file, or JSON
-- Lines file. This value is null for all other types of files.
--
-- For an Avro object container or Parquet file, each Record object
-- specifies a record index and the path to a field in a record that
-- contains the sensitive data. For a JSON or JSON Lines file, each Record
-- object specifies the path to a field or array that contains the
-- sensitive data. For a JSON Lines file, it also specifies the index of
-- the line that contains the data.
newOccurrences ::
  Occurrences
newOccurrences :: Occurrences
newOccurrences =
  Occurrences'
    { $sel:cells:Occurrences' :: Maybe [Cell]
cells = forall a. Maybe a
Prelude.Nothing,
      $sel:lineRanges:Occurrences' :: Maybe [Range]
lineRanges = forall a. Maybe a
Prelude.Nothing,
      $sel:offsetRanges:Occurrences' :: Maybe [Range]
offsetRanges = forall a. Maybe a
Prelude.Nothing,
      $sel:pages:Occurrences' :: Maybe [Page]
pages = forall a. Maybe a
Prelude.Nothing,
      $sel:records:Occurrences' :: Maybe [Record]
records = forall a. Maybe a
Prelude.Nothing
    }

-- | An array of objects, one for each occurrence of sensitive data in a
-- Microsoft Excel workbook, CSV file, or TSV file. This value is null for
-- all other types of files.
--
-- Each Cell object specifies a cell or field that contains the sensitive
-- data.
occurrences_cells :: Lens.Lens' Occurrences (Prelude.Maybe [Cell])
occurrences_cells :: Lens' Occurrences (Maybe [Cell])
occurrences_cells = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Occurrences' {Maybe [Cell]
cells :: Maybe [Cell]
$sel:cells:Occurrences' :: Occurrences -> Maybe [Cell]
cells} -> Maybe [Cell]
cells) (\s :: Occurrences
s@Occurrences' {} Maybe [Cell]
a -> Occurrences
s {$sel:cells:Occurrences' :: Maybe [Cell]
cells = Maybe [Cell]
a} :: Occurrences) 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

-- | An array of objects, one for each occurrence of sensitive data in a
-- non-binary text file, such as an HTML, TXT, or XML file. Each Range
-- object specifies a line or inclusive range of lines that contains the
-- sensitive data, and the position of the data on the specified line or
-- lines.
--
-- This value is often null for file types that are supported by Cell,
-- Page, or Record objects. Exceptions are the location of sensitive data
-- in: unstructured sections of an otherwise structured file, such as a
-- comment in a file; a malformed file that Amazon Macie analyzes as plain
-- text; and, a CSV or TSV file that has any column names that contain
-- sensitive data.
occurrences_lineRanges :: Lens.Lens' Occurrences (Prelude.Maybe [Range])
occurrences_lineRanges :: Lens' Occurrences (Maybe [Range])
occurrences_lineRanges = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Occurrences' {Maybe [Range]
lineRanges :: Maybe [Range]
$sel:lineRanges:Occurrences' :: Occurrences -> Maybe [Range]
lineRanges} -> Maybe [Range]
lineRanges) (\s :: Occurrences
s@Occurrences' {} Maybe [Range]
a -> Occurrences
s {$sel:lineRanges:Occurrences' :: Maybe [Range]
lineRanges = Maybe [Range]
a} :: Occurrences) 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

-- | Reserved for future use.
occurrences_offsetRanges :: Lens.Lens' Occurrences (Prelude.Maybe [Range])
occurrences_offsetRanges :: Lens' Occurrences (Maybe [Range])
occurrences_offsetRanges = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Occurrences' {Maybe [Range]
offsetRanges :: Maybe [Range]
$sel:offsetRanges:Occurrences' :: Occurrences -> Maybe [Range]
offsetRanges} -> Maybe [Range]
offsetRanges) (\s :: Occurrences
s@Occurrences' {} Maybe [Range]
a -> Occurrences
s {$sel:offsetRanges:Occurrences' :: Maybe [Range]
offsetRanges = Maybe [Range]
a} :: Occurrences) 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

-- | An array of objects, one for each occurrence of sensitive data in an
-- Adobe Portable Document Format file. This value is null for all other
-- types of files.
--
-- Each Page object specifies a page that contains the sensitive data.
occurrences_pages :: Lens.Lens' Occurrences (Prelude.Maybe [Page])
occurrences_pages :: Lens' Occurrences (Maybe [Page])
occurrences_pages = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Occurrences' {Maybe [Page]
pages :: Maybe [Page]
$sel:pages:Occurrences' :: Occurrences -> Maybe [Page]
pages} -> Maybe [Page]
pages) (\s :: Occurrences
s@Occurrences' {} Maybe [Page]
a -> Occurrences
s {$sel:pages:Occurrences' :: Maybe [Page]
pages = Maybe [Page]
a} :: Occurrences) 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

-- | An array of objects, one for each occurrence of sensitive data in an
-- Apache Avro object container, Apache Parquet file, JSON file, or JSON
-- Lines file. This value is null for all other types of files.
--
-- For an Avro object container or Parquet file, each Record object
-- specifies a record index and the path to a field in a record that
-- contains the sensitive data. For a JSON or JSON Lines file, each Record
-- object specifies the path to a field or array that contains the
-- sensitive data. For a JSON Lines file, it also specifies the index of
-- the line that contains the data.
occurrences_records :: Lens.Lens' Occurrences (Prelude.Maybe [Record])
occurrences_records :: Lens' Occurrences (Maybe [Record])
occurrences_records = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Occurrences' {Maybe [Record]
records :: Maybe [Record]
$sel:records:Occurrences' :: Occurrences -> Maybe [Record]
records} -> Maybe [Record]
records) (\s :: Occurrences
s@Occurrences' {} Maybe [Record]
a -> Occurrences
s {$sel:records:Occurrences' :: Maybe [Record]
records = Maybe [Record]
a} :: Occurrences) 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

instance Data.FromJSON Occurrences where
  parseJSON :: Value -> Parser Occurrences
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Occurrences"
      ( \Object
x ->
          Maybe [Cell]
-> Maybe [Range]
-> Maybe [Range]
-> Maybe [Page]
-> Maybe [Record]
-> Occurrences
Occurrences'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"cells" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"lineRanges" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"offsetRanges" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"pages" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"records" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Occurrences where
  hashWithSalt :: Int -> Occurrences -> Int
hashWithSalt Int
_salt Occurrences' {Maybe [Cell]
Maybe [Range]
Maybe [Page]
Maybe [Record]
records :: Maybe [Record]
pages :: Maybe [Page]
offsetRanges :: Maybe [Range]
lineRanges :: Maybe [Range]
cells :: Maybe [Cell]
$sel:records:Occurrences' :: Occurrences -> Maybe [Record]
$sel:pages:Occurrences' :: Occurrences -> Maybe [Page]
$sel:offsetRanges:Occurrences' :: Occurrences -> Maybe [Range]
$sel:lineRanges:Occurrences' :: Occurrences -> Maybe [Range]
$sel:cells:Occurrences' :: Occurrences -> Maybe [Cell]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Cell]
cells
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Range]
lineRanges
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Range]
offsetRanges
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Page]
pages
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Record]
records

instance Prelude.NFData Occurrences where
  rnf :: Occurrences -> ()
rnf Occurrences' {Maybe [Cell]
Maybe [Range]
Maybe [Page]
Maybe [Record]
records :: Maybe [Record]
pages :: Maybe [Page]
offsetRanges :: Maybe [Range]
lineRanges :: Maybe [Range]
cells :: Maybe [Cell]
$sel:records:Occurrences' :: Occurrences -> Maybe [Record]
$sel:pages:Occurrences' :: Occurrences -> Maybe [Page]
$sel:offsetRanges:Occurrences' :: Occurrences -> Maybe [Range]
$sel:lineRanges:Occurrences' :: Occurrences -> Maybe [Range]
$sel:cells:Occurrences' :: Occurrences -> Maybe [Cell]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Cell]
cells
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Range]
lineRanges
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Range]
offsetRanges
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Page]
pages
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Record]
records