{-# 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.DataSync.Types.QopConfiguration
-- 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.DataSync.Types.QopConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DataSync.Types.HdfsDataTransferProtection
import Amazonka.DataSync.Types.HdfsRpcProtection
import qualified Amazonka.Prelude as Prelude

-- | The Quality of Protection (QOP) configuration specifies the Remote
-- Procedure Call (RPC) and data transfer privacy settings configured on
-- the Hadoop Distributed File System (HDFS) cluster.
--
-- /See:/ 'newQopConfiguration' smart constructor.
data QopConfiguration = QopConfiguration'
  { -- | The data transfer protection setting configured on the HDFS cluster.
    -- This setting corresponds to your @dfs.data.transfer.protection@ setting
    -- in the @hdfs-site.xml@ file on your Hadoop cluster.
    QopConfiguration -> Maybe HdfsDataTransferProtection
dataTransferProtection :: Prelude.Maybe HdfsDataTransferProtection,
    -- | The RPC protection setting configured on the HDFS cluster. This setting
    -- corresponds to your @hadoop.rpc.protection@ setting in your
    -- @core-site.xml@ file on your Hadoop cluster.
    QopConfiguration -> Maybe HdfsRpcProtection
rpcProtection :: Prelude.Maybe HdfsRpcProtection
  }
  deriving (QopConfiguration -> QopConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QopConfiguration -> QopConfiguration -> Bool
$c/= :: QopConfiguration -> QopConfiguration -> Bool
== :: QopConfiguration -> QopConfiguration -> Bool
$c== :: QopConfiguration -> QopConfiguration -> Bool
Prelude.Eq, ReadPrec [QopConfiguration]
ReadPrec QopConfiguration
Int -> ReadS QopConfiguration
ReadS [QopConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QopConfiguration]
$creadListPrec :: ReadPrec [QopConfiguration]
readPrec :: ReadPrec QopConfiguration
$creadPrec :: ReadPrec QopConfiguration
readList :: ReadS [QopConfiguration]
$creadList :: ReadS [QopConfiguration]
readsPrec :: Int -> ReadS QopConfiguration
$creadsPrec :: Int -> ReadS QopConfiguration
Prelude.Read, Int -> QopConfiguration -> ShowS
[QopConfiguration] -> ShowS
QopConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QopConfiguration] -> ShowS
$cshowList :: [QopConfiguration] -> ShowS
show :: QopConfiguration -> String
$cshow :: QopConfiguration -> String
showsPrec :: Int -> QopConfiguration -> ShowS
$cshowsPrec :: Int -> QopConfiguration -> ShowS
Prelude.Show, forall x. Rep QopConfiguration x -> QopConfiguration
forall x. QopConfiguration -> Rep QopConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QopConfiguration x -> QopConfiguration
$cfrom :: forall x. QopConfiguration -> Rep QopConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'QopConfiguration' 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:
--
-- 'dataTransferProtection', 'qopConfiguration_dataTransferProtection' - The data transfer protection setting configured on the HDFS cluster.
-- This setting corresponds to your @dfs.data.transfer.protection@ setting
-- in the @hdfs-site.xml@ file on your Hadoop cluster.
--
-- 'rpcProtection', 'qopConfiguration_rpcProtection' - The RPC protection setting configured on the HDFS cluster. This setting
-- corresponds to your @hadoop.rpc.protection@ setting in your
-- @core-site.xml@ file on your Hadoop cluster.
newQopConfiguration ::
  QopConfiguration
newQopConfiguration :: QopConfiguration
newQopConfiguration =
  QopConfiguration'
    { $sel:dataTransferProtection:QopConfiguration' :: Maybe HdfsDataTransferProtection
dataTransferProtection =
        forall a. Maybe a
Prelude.Nothing,
      $sel:rpcProtection:QopConfiguration' :: Maybe HdfsRpcProtection
rpcProtection = forall a. Maybe a
Prelude.Nothing
    }

-- | The data transfer protection setting configured on the HDFS cluster.
-- This setting corresponds to your @dfs.data.transfer.protection@ setting
-- in the @hdfs-site.xml@ file on your Hadoop cluster.
qopConfiguration_dataTransferProtection :: Lens.Lens' QopConfiguration (Prelude.Maybe HdfsDataTransferProtection)
qopConfiguration_dataTransferProtection :: Lens' QopConfiguration (Maybe HdfsDataTransferProtection)
qopConfiguration_dataTransferProtection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QopConfiguration' {Maybe HdfsDataTransferProtection
dataTransferProtection :: Maybe HdfsDataTransferProtection
$sel:dataTransferProtection:QopConfiguration' :: QopConfiguration -> Maybe HdfsDataTransferProtection
dataTransferProtection} -> Maybe HdfsDataTransferProtection
dataTransferProtection) (\s :: QopConfiguration
s@QopConfiguration' {} Maybe HdfsDataTransferProtection
a -> QopConfiguration
s {$sel:dataTransferProtection:QopConfiguration' :: Maybe HdfsDataTransferProtection
dataTransferProtection = Maybe HdfsDataTransferProtection
a} :: QopConfiguration)

-- | The RPC protection setting configured on the HDFS cluster. This setting
-- corresponds to your @hadoop.rpc.protection@ setting in your
-- @core-site.xml@ file on your Hadoop cluster.
qopConfiguration_rpcProtection :: Lens.Lens' QopConfiguration (Prelude.Maybe HdfsRpcProtection)
qopConfiguration_rpcProtection :: Lens' QopConfiguration (Maybe HdfsRpcProtection)
qopConfiguration_rpcProtection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QopConfiguration' {Maybe HdfsRpcProtection
rpcProtection :: Maybe HdfsRpcProtection
$sel:rpcProtection:QopConfiguration' :: QopConfiguration -> Maybe HdfsRpcProtection
rpcProtection} -> Maybe HdfsRpcProtection
rpcProtection) (\s :: QopConfiguration
s@QopConfiguration' {} Maybe HdfsRpcProtection
a -> QopConfiguration
s {$sel:rpcProtection:QopConfiguration' :: Maybe HdfsRpcProtection
rpcProtection = Maybe HdfsRpcProtection
a} :: QopConfiguration)

instance Data.FromJSON QopConfiguration where
  parseJSON :: Value -> Parser QopConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"QopConfiguration"
      ( \Object
x ->
          Maybe HdfsDataTransferProtection
-> Maybe HdfsRpcProtection -> QopConfiguration
QopConfiguration'
            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
"DataTransferProtection")
            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
"RpcProtection")
      )

instance Prelude.Hashable QopConfiguration where
  hashWithSalt :: Int -> QopConfiguration -> Int
hashWithSalt Int
_salt QopConfiguration' {Maybe HdfsDataTransferProtection
Maybe HdfsRpcProtection
rpcProtection :: Maybe HdfsRpcProtection
dataTransferProtection :: Maybe HdfsDataTransferProtection
$sel:rpcProtection:QopConfiguration' :: QopConfiguration -> Maybe HdfsRpcProtection
$sel:dataTransferProtection:QopConfiguration' :: QopConfiguration -> Maybe HdfsDataTransferProtection
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HdfsDataTransferProtection
dataTransferProtection
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HdfsRpcProtection
rpcProtection

instance Prelude.NFData QopConfiguration where
  rnf :: QopConfiguration -> ()
rnf QopConfiguration' {Maybe HdfsDataTransferProtection
Maybe HdfsRpcProtection
rpcProtection :: Maybe HdfsRpcProtection
dataTransferProtection :: Maybe HdfsDataTransferProtection
$sel:rpcProtection:QopConfiguration' :: QopConfiguration -> Maybe HdfsRpcProtection
$sel:dataTransferProtection:QopConfiguration' :: QopConfiguration -> Maybe HdfsDataTransferProtection
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe HdfsDataTransferProtection
dataTransferProtection
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe HdfsRpcProtection
rpcProtection

instance Data.ToJSON QopConfiguration where
  toJSON :: QopConfiguration -> Value
toJSON QopConfiguration' {Maybe HdfsDataTransferProtection
Maybe HdfsRpcProtection
rpcProtection :: Maybe HdfsRpcProtection
dataTransferProtection :: Maybe HdfsDataTransferProtection
$sel:rpcProtection:QopConfiguration' :: QopConfiguration -> Maybe HdfsRpcProtection
$sel:dataTransferProtection:QopConfiguration' :: QopConfiguration -> Maybe HdfsDataTransferProtection
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DataTransferProtection" 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 HdfsDataTransferProtection
dataTransferProtection,
            (Key
"RpcProtection" 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 HdfsRpcProtection
rpcProtection
          ]
      )