{-# 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.M2.Types.DataSet
-- 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.M2.Types.DataSet where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.M2.Types.DatasetOrgAttributes
import Amazonka.M2.Types.RecordLength
import qualified Amazonka.Prelude as Prelude

-- | Defines a data set.
--
-- /See:/ 'newDataSet' smart constructor.
data DataSet = DataSet'
  { -- | The relative location of the data set in the database or file system.
    DataSet -> Maybe Text
relativePath :: Prelude.Maybe Prelude.Text,
    -- | The storage type of the data set: database or file system. For Micro
    -- Focus, database corresponds to datastore and file system corresponds to
    -- EFS\/FSX. For Blu Age, there is no support of file system and database
    -- corresponds to Blusam.
    DataSet -> Maybe Text
storageType :: Prelude.Maybe Prelude.Text,
    -- | The logical identifier for a specific data set (in mainframe format).
    DataSet -> Text
datasetName :: Prelude.Text,
    -- | The type of dataset. The only supported value is VSAM.
    DataSet -> DatasetOrgAttributes
datasetOrg :: DatasetOrgAttributes,
    -- | The length of a record.
    DataSet -> RecordLength
recordLength :: RecordLength
  }
  deriving (DataSet -> DataSet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataSet -> DataSet -> Bool
$c/= :: DataSet -> DataSet -> Bool
== :: DataSet -> DataSet -> Bool
$c== :: DataSet -> DataSet -> Bool
Prelude.Eq, ReadPrec [DataSet]
ReadPrec DataSet
Int -> ReadS DataSet
ReadS [DataSet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataSet]
$creadListPrec :: ReadPrec [DataSet]
readPrec :: ReadPrec DataSet
$creadPrec :: ReadPrec DataSet
readList :: ReadS [DataSet]
$creadList :: ReadS [DataSet]
readsPrec :: Int -> ReadS DataSet
$creadsPrec :: Int -> ReadS DataSet
Prelude.Read, Int -> DataSet -> ShowS
[DataSet] -> ShowS
DataSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataSet] -> ShowS
$cshowList :: [DataSet] -> ShowS
show :: DataSet -> String
$cshow :: DataSet -> String
showsPrec :: Int -> DataSet -> ShowS
$cshowsPrec :: Int -> DataSet -> ShowS
Prelude.Show, forall x. Rep DataSet x -> DataSet
forall x. DataSet -> Rep DataSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataSet x -> DataSet
$cfrom :: forall x. DataSet -> Rep DataSet x
Prelude.Generic)

-- |
-- Create a value of 'DataSet' 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:
--
-- 'relativePath', 'dataSet_relativePath' - The relative location of the data set in the database or file system.
--
-- 'storageType', 'dataSet_storageType' - The storage type of the data set: database or file system. For Micro
-- Focus, database corresponds to datastore and file system corresponds to
-- EFS\/FSX. For Blu Age, there is no support of file system and database
-- corresponds to Blusam.
--
-- 'datasetName', 'dataSet_datasetName' - The logical identifier for a specific data set (in mainframe format).
--
-- 'datasetOrg', 'dataSet_datasetOrg' - The type of dataset. The only supported value is VSAM.
--
-- 'recordLength', 'dataSet_recordLength' - The length of a record.
newDataSet ::
  -- | 'datasetName'
  Prelude.Text ->
  -- | 'datasetOrg'
  DatasetOrgAttributes ->
  -- | 'recordLength'
  RecordLength ->
  DataSet
newDataSet :: Text -> DatasetOrgAttributes -> RecordLength -> DataSet
newDataSet Text
pDatasetName_ DatasetOrgAttributes
pDatasetOrg_ RecordLength
pRecordLength_ =
  DataSet'
    { $sel:relativePath:DataSet' :: Maybe Text
relativePath = forall a. Maybe a
Prelude.Nothing,
      $sel:storageType:DataSet' :: Maybe Text
storageType = forall a. Maybe a
Prelude.Nothing,
      $sel:datasetName:DataSet' :: Text
datasetName = Text
pDatasetName_,
      $sel:datasetOrg:DataSet' :: DatasetOrgAttributes
datasetOrg = DatasetOrgAttributes
pDatasetOrg_,
      $sel:recordLength:DataSet' :: RecordLength
recordLength = RecordLength
pRecordLength_
    }

-- | The relative location of the data set in the database or file system.
dataSet_relativePath :: Lens.Lens' DataSet (Prelude.Maybe Prelude.Text)
dataSet_relativePath :: Lens' DataSet (Maybe Text)
dataSet_relativePath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSet' {Maybe Text
relativePath :: Maybe Text
$sel:relativePath:DataSet' :: DataSet -> Maybe Text
relativePath} -> Maybe Text
relativePath) (\s :: DataSet
s@DataSet' {} Maybe Text
a -> DataSet
s {$sel:relativePath:DataSet' :: Maybe Text
relativePath = Maybe Text
a} :: DataSet)

-- | The storage type of the data set: database or file system. For Micro
-- Focus, database corresponds to datastore and file system corresponds to
-- EFS\/FSX. For Blu Age, there is no support of file system and database
-- corresponds to Blusam.
dataSet_storageType :: Lens.Lens' DataSet (Prelude.Maybe Prelude.Text)
dataSet_storageType :: Lens' DataSet (Maybe Text)
dataSet_storageType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSet' {Maybe Text
storageType :: Maybe Text
$sel:storageType:DataSet' :: DataSet -> Maybe Text
storageType} -> Maybe Text
storageType) (\s :: DataSet
s@DataSet' {} Maybe Text
a -> DataSet
s {$sel:storageType:DataSet' :: Maybe Text
storageType = Maybe Text
a} :: DataSet)

-- | The logical identifier for a specific data set (in mainframe format).
dataSet_datasetName :: Lens.Lens' DataSet Prelude.Text
dataSet_datasetName :: Lens' DataSet Text
dataSet_datasetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSet' {Text
datasetName :: Text
$sel:datasetName:DataSet' :: DataSet -> Text
datasetName} -> Text
datasetName) (\s :: DataSet
s@DataSet' {} Text
a -> DataSet
s {$sel:datasetName:DataSet' :: Text
datasetName = Text
a} :: DataSet)

-- | The type of dataset. The only supported value is VSAM.
dataSet_datasetOrg :: Lens.Lens' DataSet DatasetOrgAttributes
dataSet_datasetOrg :: Lens' DataSet DatasetOrgAttributes
dataSet_datasetOrg = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSet' {DatasetOrgAttributes
datasetOrg :: DatasetOrgAttributes
$sel:datasetOrg:DataSet' :: DataSet -> DatasetOrgAttributes
datasetOrg} -> DatasetOrgAttributes
datasetOrg) (\s :: DataSet
s@DataSet' {} DatasetOrgAttributes
a -> DataSet
s {$sel:datasetOrg:DataSet' :: DatasetOrgAttributes
datasetOrg = DatasetOrgAttributes
a} :: DataSet)

-- | The length of a record.
dataSet_recordLength :: Lens.Lens' DataSet RecordLength
dataSet_recordLength :: Lens' DataSet RecordLength
dataSet_recordLength = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSet' {RecordLength
recordLength :: RecordLength
$sel:recordLength:DataSet' :: DataSet -> RecordLength
recordLength} -> RecordLength
recordLength) (\s :: DataSet
s@DataSet' {} RecordLength
a -> DataSet
s {$sel:recordLength:DataSet' :: RecordLength
recordLength = RecordLength
a} :: DataSet)

instance Prelude.Hashable DataSet where
  hashWithSalt :: Int -> DataSet -> Int
hashWithSalt Int
_salt DataSet' {Maybe Text
Text
RecordLength
DatasetOrgAttributes
recordLength :: RecordLength
datasetOrg :: DatasetOrgAttributes
datasetName :: Text
storageType :: Maybe Text
relativePath :: Maybe Text
$sel:recordLength:DataSet' :: DataSet -> RecordLength
$sel:datasetOrg:DataSet' :: DataSet -> DatasetOrgAttributes
$sel:datasetName:DataSet' :: DataSet -> Text
$sel:storageType:DataSet' :: DataSet -> Maybe Text
$sel:relativePath:DataSet' :: DataSet -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
relativePath
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
storageType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
datasetName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DatasetOrgAttributes
datasetOrg
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RecordLength
recordLength

instance Prelude.NFData DataSet where
  rnf :: DataSet -> ()
rnf DataSet' {Maybe Text
Text
RecordLength
DatasetOrgAttributes
recordLength :: RecordLength
datasetOrg :: DatasetOrgAttributes
datasetName :: Text
storageType :: Maybe Text
relativePath :: Maybe Text
$sel:recordLength:DataSet' :: DataSet -> RecordLength
$sel:datasetOrg:DataSet' :: DataSet -> DatasetOrgAttributes
$sel:datasetName:DataSet' :: DataSet -> Text
$sel:storageType:DataSet' :: DataSet -> Maybe Text
$sel:relativePath:DataSet' :: DataSet -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
relativePath
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
storageType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
datasetName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DatasetOrgAttributes
datasetOrg
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RecordLength
recordLength

instance Data.ToJSON DataSet where
  toJSON :: DataSet -> Value
toJSON DataSet' {Maybe Text
Text
RecordLength
DatasetOrgAttributes
recordLength :: RecordLength
datasetOrg :: DatasetOrgAttributes
datasetName :: Text
storageType :: Maybe Text
relativePath :: Maybe Text
$sel:recordLength:DataSet' :: DataSet -> RecordLength
$sel:datasetOrg:DataSet' :: DataSet -> DatasetOrgAttributes
$sel:datasetName:DataSet' :: DataSet -> Text
$sel:storageType:DataSet' :: DataSet -> Maybe Text
$sel:relativePath:DataSet' :: DataSet -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"relativePath" 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 Text
relativePath,
            (Key
"storageType" 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 Text
storageType,
            forall a. a -> Maybe a
Prelude.Just (Key
"datasetName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
datasetName),
            forall a. a -> Maybe a
Prelude.Just (Key
"datasetOrg" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DatasetOrgAttributes
datasetOrg),
            forall a. a -> Maybe a
Prelude.Just (Key
"recordLength" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= RecordLength
recordLength)
          ]
      )