{-# 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.FSx.Types.OpenZFSNfsExport
-- 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.FSx.Types.OpenZFSNfsExport where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FSx.Types.OpenZFSClientConfiguration
import qualified Amazonka.Prelude as Prelude

-- | The Network File System (NFS) configurations for mounting an Amazon FSx
-- for OpenZFS file system.
--
-- /See:/ 'newOpenZFSNfsExport' smart constructor.
data OpenZFSNfsExport = OpenZFSNfsExport'
  { -- | A list of configuration objects that contain the client and options for
    -- mounting the OpenZFS file system.
    OpenZFSNfsExport -> [OpenZFSClientConfiguration]
clientConfigurations :: [OpenZFSClientConfiguration]
  }
  deriving (OpenZFSNfsExport -> OpenZFSNfsExport -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OpenZFSNfsExport -> OpenZFSNfsExport -> Bool
$c/= :: OpenZFSNfsExport -> OpenZFSNfsExport -> Bool
== :: OpenZFSNfsExport -> OpenZFSNfsExport -> Bool
$c== :: OpenZFSNfsExport -> OpenZFSNfsExport -> Bool
Prelude.Eq, ReadPrec [OpenZFSNfsExport]
ReadPrec OpenZFSNfsExport
Int -> ReadS OpenZFSNfsExport
ReadS [OpenZFSNfsExport]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OpenZFSNfsExport]
$creadListPrec :: ReadPrec [OpenZFSNfsExport]
readPrec :: ReadPrec OpenZFSNfsExport
$creadPrec :: ReadPrec OpenZFSNfsExport
readList :: ReadS [OpenZFSNfsExport]
$creadList :: ReadS [OpenZFSNfsExport]
readsPrec :: Int -> ReadS OpenZFSNfsExport
$creadsPrec :: Int -> ReadS OpenZFSNfsExport
Prelude.Read, Int -> OpenZFSNfsExport -> ShowS
[OpenZFSNfsExport] -> ShowS
OpenZFSNfsExport -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OpenZFSNfsExport] -> ShowS
$cshowList :: [OpenZFSNfsExport] -> ShowS
show :: OpenZFSNfsExport -> String
$cshow :: OpenZFSNfsExport -> String
showsPrec :: Int -> OpenZFSNfsExport -> ShowS
$cshowsPrec :: Int -> OpenZFSNfsExport -> ShowS
Prelude.Show, forall x. Rep OpenZFSNfsExport x -> OpenZFSNfsExport
forall x. OpenZFSNfsExport -> Rep OpenZFSNfsExport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OpenZFSNfsExport x -> OpenZFSNfsExport
$cfrom :: forall x. OpenZFSNfsExport -> Rep OpenZFSNfsExport x
Prelude.Generic)

-- |
-- Create a value of 'OpenZFSNfsExport' 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:
--
-- 'clientConfigurations', 'openZFSNfsExport_clientConfigurations' - A list of configuration objects that contain the client and options for
-- mounting the OpenZFS file system.
newOpenZFSNfsExport ::
  OpenZFSNfsExport
newOpenZFSNfsExport :: OpenZFSNfsExport
newOpenZFSNfsExport =
  OpenZFSNfsExport'
    { $sel:clientConfigurations:OpenZFSNfsExport' :: [OpenZFSClientConfiguration]
clientConfigurations =
        forall a. Monoid a => a
Prelude.mempty
    }

-- | A list of configuration objects that contain the client and options for
-- mounting the OpenZFS file system.
openZFSNfsExport_clientConfigurations :: Lens.Lens' OpenZFSNfsExport [OpenZFSClientConfiguration]
openZFSNfsExport_clientConfigurations :: Lens' OpenZFSNfsExport [OpenZFSClientConfiguration]
openZFSNfsExport_clientConfigurations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpenZFSNfsExport' {[OpenZFSClientConfiguration]
clientConfigurations :: [OpenZFSClientConfiguration]
$sel:clientConfigurations:OpenZFSNfsExport' :: OpenZFSNfsExport -> [OpenZFSClientConfiguration]
clientConfigurations} -> [OpenZFSClientConfiguration]
clientConfigurations) (\s :: OpenZFSNfsExport
s@OpenZFSNfsExport' {} [OpenZFSClientConfiguration]
a -> OpenZFSNfsExport
s {$sel:clientConfigurations:OpenZFSNfsExport' :: [OpenZFSClientConfiguration]
clientConfigurations = [OpenZFSClientConfiguration]
a} :: OpenZFSNfsExport) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON OpenZFSNfsExport where
  parseJSON :: Value -> Parser OpenZFSNfsExport
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OpenZFSNfsExport"
      ( \Object
x ->
          [OpenZFSClientConfiguration] -> OpenZFSNfsExport
OpenZFSNfsExport'
            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
"ClientConfigurations"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable OpenZFSNfsExport where
  hashWithSalt :: Int -> OpenZFSNfsExport -> Int
hashWithSalt Int
_salt OpenZFSNfsExport' {[OpenZFSClientConfiguration]
clientConfigurations :: [OpenZFSClientConfiguration]
$sel:clientConfigurations:OpenZFSNfsExport' :: OpenZFSNfsExport -> [OpenZFSClientConfiguration]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [OpenZFSClientConfiguration]
clientConfigurations

instance Prelude.NFData OpenZFSNfsExport where
  rnf :: OpenZFSNfsExport -> ()
rnf OpenZFSNfsExport' {[OpenZFSClientConfiguration]
clientConfigurations :: [OpenZFSClientConfiguration]
$sel:clientConfigurations:OpenZFSNfsExport' :: OpenZFSNfsExport -> [OpenZFSClientConfiguration]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf [OpenZFSClientConfiguration]
clientConfigurations

instance Data.ToJSON OpenZFSNfsExport where
  toJSON :: OpenZFSNfsExport -> Value
toJSON OpenZFSNfsExport' {[OpenZFSClientConfiguration]
clientConfigurations :: [OpenZFSClientConfiguration]
$sel:clientConfigurations:OpenZFSNfsExport' :: OpenZFSNfsExport -> [OpenZFSClientConfiguration]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"ClientConfigurations"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [OpenZFSClientConfiguration]
clientConfigurations
              )
          ]
      )