{-# 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.VsamAttributes
-- 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.VsamAttributes 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.AlternateKey
import Amazonka.M2.Types.PrimaryKey
import qualified Amazonka.Prelude as Prelude

-- | The attributes of a VSAM type data set.
--
-- /See:/ 'newVsamAttributes' smart constructor.
data VsamAttributes = VsamAttributes'
  { -- | The alternate key definitions, if any. A legacy dataset might not have
    -- any alternate key defined, but if those alternate keys definitions
    -- exist, provide them as some applications will make use of them.
    VsamAttributes -> Maybe [AlternateKey]
alternateKeys :: Prelude.Maybe [AlternateKey],
    -- | Indicates whether indexes for this dataset are stored as compressed
    -- values. If you have a large data set (typically > 100 Mb), consider
    -- setting this flag to True.
    VsamAttributes -> Maybe Bool
compressed :: Prelude.Maybe Prelude.Bool,
    -- | The character set used by the data set. Can be ASCII, EBCDIC, or
    -- unknown.
    VsamAttributes -> Maybe Text
encoding :: Prelude.Maybe Prelude.Text,
    -- | The primary key of the data set.
    VsamAttributes -> Maybe PrimaryKey
primaryKey :: Prelude.Maybe PrimaryKey,
    -- | The record format of the data set.
    VsamAttributes -> Text
format :: Prelude.Text
  }
  deriving (VsamAttributes -> VsamAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VsamAttributes -> VsamAttributes -> Bool
$c/= :: VsamAttributes -> VsamAttributes -> Bool
== :: VsamAttributes -> VsamAttributes -> Bool
$c== :: VsamAttributes -> VsamAttributes -> Bool
Prelude.Eq, ReadPrec [VsamAttributes]
ReadPrec VsamAttributes
Int -> ReadS VsamAttributes
ReadS [VsamAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VsamAttributes]
$creadListPrec :: ReadPrec [VsamAttributes]
readPrec :: ReadPrec VsamAttributes
$creadPrec :: ReadPrec VsamAttributes
readList :: ReadS [VsamAttributes]
$creadList :: ReadS [VsamAttributes]
readsPrec :: Int -> ReadS VsamAttributes
$creadsPrec :: Int -> ReadS VsamAttributes
Prelude.Read, Int -> VsamAttributes -> ShowS
[VsamAttributes] -> ShowS
VsamAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VsamAttributes] -> ShowS
$cshowList :: [VsamAttributes] -> ShowS
show :: VsamAttributes -> String
$cshow :: VsamAttributes -> String
showsPrec :: Int -> VsamAttributes -> ShowS
$cshowsPrec :: Int -> VsamAttributes -> ShowS
Prelude.Show, forall x. Rep VsamAttributes x -> VsamAttributes
forall x. VsamAttributes -> Rep VsamAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VsamAttributes x -> VsamAttributes
$cfrom :: forall x. VsamAttributes -> Rep VsamAttributes x
Prelude.Generic)

-- |
-- Create a value of 'VsamAttributes' 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:
--
-- 'alternateKeys', 'vsamAttributes_alternateKeys' - The alternate key definitions, if any. A legacy dataset might not have
-- any alternate key defined, but if those alternate keys definitions
-- exist, provide them as some applications will make use of them.
--
-- 'compressed', 'vsamAttributes_compressed' - Indicates whether indexes for this dataset are stored as compressed
-- values. If you have a large data set (typically > 100 Mb), consider
-- setting this flag to True.
--
-- 'encoding', 'vsamAttributes_encoding' - The character set used by the data set. Can be ASCII, EBCDIC, or
-- unknown.
--
-- 'primaryKey', 'vsamAttributes_primaryKey' - The primary key of the data set.
--
-- 'format', 'vsamAttributes_format' - The record format of the data set.
newVsamAttributes ::
  -- | 'format'
  Prelude.Text ->
  VsamAttributes
newVsamAttributes :: Text -> VsamAttributes
newVsamAttributes Text
pFormat_ =
  VsamAttributes'
    { $sel:alternateKeys:VsamAttributes' :: Maybe [AlternateKey]
alternateKeys = forall a. Maybe a
Prelude.Nothing,
      $sel:compressed:VsamAttributes' :: Maybe Bool
compressed = forall a. Maybe a
Prelude.Nothing,
      $sel:encoding:VsamAttributes' :: Maybe Text
encoding = forall a. Maybe a
Prelude.Nothing,
      $sel:primaryKey:VsamAttributes' :: Maybe PrimaryKey
primaryKey = forall a. Maybe a
Prelude.Nothing,
      $sel:format:VsamAttributes' :: Text
format = Text
pFormat_
    }

-- | The alternate key definitions, if any. A legacy dataset might not have
-- any alternate key defined, but if those alternate keys definitions
-- exist, provide them as some applications will make use of them.
vsamAttributes_alternateKeys :: Lens.Lens' VsamAttributes (Prelude.Maybe [AlternateKey])
vsamAttributes_alternateKeys :: Lens' VsamAttributes (Maybe [AlternateKey])
vsamAttributes_alternateKeys = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VsamAttributes' {Maybe [AlternateKey]
alternateKeys :: Maybe [AlternateKey]
$sel:alternateKeys:VsamAttributes' :: VsamAttributes -> Maybe [AlternateKey]
alternateKeys} -> Maybe [AlternateKey]
alternateKeys) (\s :: VsamAttributes
s@VsamAttributes' {} Maybe [AlternateKey]
a -> VsamAttributes
s {$sel:alternateKeys:VsamAttributes' :: Maybe [AlternateKey]
alternateKeys = Maybe [AlternateKey]
a} :: VsamAttributes) 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

-- | Indicates whether indexes for this dataset are stored as compressed
-- values. If you have a large data set (typically > 100 Mb), consider
-- setting this flag to True.
vsamAttributes_compressed :: Lens.Lens' VsamAttributes (Prelude.Maybe Prelude.Bool)
vsamAttributes_compressed :: Lens' VsamAttributes (Maybe Bool)
vsamAttributes_compressed = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VsamAttributes' {Maybe Bool
compressed :: Maybe Bool
$sel:compressed:VsamAttributes' :: VsamAttributes -> Maybe Bool
compressed} -> Maybe Bool
compressed) (\s :: VsamAttributes
s@VsamAttributes' {} Maybe Bool
a -> VsamAttributes
s {$sel:compressed:VsamAttributes' :: Maybe Bool
compressed = Maybe Bool
a} :: VsamAttributes)

-- | The character set used by the data set. Can be ASCII, EBCDIC, or
-- unknown.
vsamAttributes_encoding :: Lens.Lens' VsamAttributes (Prelude.Maybe Prelude.Text)
vsamAttributes_encoding :: Lens' VsamAttributes (Maybe Text)
vsamAttributes_encoding = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VsamAttributes' {Maybe Text
encoding :: Maybe Text
$sel:encoding:VsamAttributes' :: VsamAttributes -> Maybe Text
encoding} -> Maybe Text
encoding) (\s :: VsamAttributes
s@VsamAttributes' {} Maybe Text
a -> VsamAttributes
s {$sel:encoding:VsamAttributes' :: Maybe Text
encoding = Maybe Text
a} :: VsamAttributes)

-- | The primary key of the data set.
vsamAttributes_primaryKey :: Lens.Lens' VsamAttributes (Prelude.Maybe PrimaryKey)
vsamAttributes_primaryKey :: Lens' VsamAttributes (Maybe PrimaryKey)
vsamAttributes_primaryKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VsamAttributes' {Maybe PrimaryKey
primaryKey :: Maybe PrimaryKey
$sel:primaryKey:VsamAttributes' :: VsamAttributes -> Maybe PrimaryKey
primaryKey} -> Maybe PrimaryKey
primaryKey) (\s :: VsamAttributes
s@VsamAttributes' {} Maybe PrimaryKey
a -> VsamAttributes
s {$sel:primaryKey:VsamAttributes' :: Maybe PrimaryKey
primaryKey = Maybe PrimaryKey
a} :: VsamAttributes)

-- | The record format of the data set.
vsamAttributes_format :: Lens.Lens' VsamAttributes Prelude.Text
vsamAttributes_format :: Lens' VsamAttributes Text
vsamAttributes_format = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VsamAttributes' {Text
format :: Text
$sel:format:VsamAttributes' :: VsamAttributes -> Text
format} -> Text
format) (\s :: VsamAttributes
s@VsamAttributes' {} Text
a -> VsamAttributes
s {$sel:format:VsamAttributes' :: Text
format = Text
a} :: VsamAttributes)

instance Prelude.Hashable VsamAttributes where
  hashWithSalt :: Int -> VsamAttributes -> Int
hashWithSalt Int
_salt VsamAttributes' {Maybe Bool
Maybe [AlternateKey]
Maybe Text
Maybe PrimaryKey
Text
format :: Text
primaryKey :: Maybe PrimaryKey
encoding :: Maybe Text
compressed :: Maybe Bool
alternateKeys :: Maybe [AlternateKey]
$sel:format:VsamAttributes' :: VsamAttributes -> Text
$sel:primaryKey:VsamAttributes' :: VsamAttributes -> Maybe PrimaryKey
$sel:encoding:VsamAttributes' :: VsamAttributes -> Maybe Text
$sel:compressed:VsamAttributes' :: VsamAttributes -> Maybe Bool
$sel:alternateKeys:VsamAttributes' :: VsamAttributes -> Maybe [AlternateKey]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AlternateKey]
alternateKeys
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
compressed
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
encoding
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PrimaryKey
primaryKey
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
format

instance Prelude.NFData VsamAttributes where
  rnf :: VsamAttributes -> ()
rnf VsamAttributes' {Maybe Bool
Maybe [AlternateKey]
Maybe Text
Maybe PrimaryKey
Text
format :: Text
primaryKey :: Maybe PrimaryKey
encoding :: Maybe Text
compressed :: Maybe Bool
alternateKeys :: Maybe [AlternateKey]
$sel:format:VsamAttributes' :: VsamAttributes -> Text
$sel:primaryKey:VsamAttributes' :: VsamAttributes -> Maybe PrimaryKey
$sel:encoding:VsamAttributes' :: VsamAttributes -> Maybe Text
$sel:compressed:VsamAttributes' :: VsamAttributes -> Maybe Bool
$sel:alternateKeys:VsamAttributes' :: VsamAttributes -> Maybe [AlternateKey]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AlternateKey]
alternateKeys
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
compressed
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
encoding
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PrimaryKey
primaryKey
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
format

instance Data.ToJSON VsamAttributes where
  toJSON :: VsamAttributes -> Value
toJSON VsamAttributes' {Maybe Bool
Maybe [AlternateKey]
Maybe Text
Maybe PrimaryKey
Text
format :: Text
primaryKey :: Maybe PrimaryKey
encoding :: Maybe Text
compressed :: Maybe Bool
alternateKeys :: Maybe [AlternateKey]
$sel:format:VsamAttributes' :: VsamAttributes -> Text
$sel:primaryKey:VsamAttributes' :: VsamAttributes -> Maybe PrimaryKey
$sel:encoding:VsamAttributes' :: VsamAttributes -> Maybe Text
$sel:compressed:VsamAttributes' :: VsamAttributes -> Maybe Bool
$sel:alternateKeys:VsamAttributes' :: VsamAttributes -> Maybe [AlternateKey]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"alternateKeys" 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 [AlternateKey]
alternateKeys,
            (Key
"compressed" 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 Bool
compressed,
            (Key
"encoding" 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
encoding,
            (Key
"primaryKey" 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 PrimaryKey
primaryKey,
            forall a. a -> Maybe a
Prelude.Just (Key
"format" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
format)
          ]
      )