{-# 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.NFSDataRepositoryConfiguration
-- 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.NFSDataRepositoryConfiguration 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.AutoExportPolicy
import Amazonka.FSx.Types.NfsVersion
import qualified Amazonka.Prelude as Prelude

-- | The configuration for a data repository association that links an Amazon
-- File Cache resource to an NFS data repository.
--
-- /See:/ 'newNFSDataRepositoryConfiguration' smart constructor.
data NFSDataRepositoryConfiguration = NFSDataRepositoryConfiguration'
  { -- | This parameter is not supported for Amazon File Cache.
    NFSDataRepositoryConfiguration -> Maybe AutoExportPolicy
autoExportPolicy :: Prelude.Maybe AutoExportPolicy,
    -- | A list of up to 2 IP addresses of DNS servers used to resolve the NFS
    -- file system domain name. The provided IP addresses can either be the IP
    -- addresses of a DNS forwarder or resolver that the customer manages and
    -- runs inside the customer VPC, or the IP addresses of the on-premises DNS
    -- servers.
    NFSDataRepositoryConfiguration -> Maybe [Text]
dnsIps :: Prelude.Maybe [Prelude.Text],
    -- | The version of the NFS (Network File System) protocol of the NFS data
    -- repository. Currently, the only supported value is @NFS3@, which
    -- indicates that the data repository must support the NFSv3 protocol.
    NFSDataRepositoryConfiguration -> NfsVersion
version :: NfsVersion
  }
  deriving (NFSDataRepositoryConfiguration
-> NFSDataRepositoryConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NFSDataRepositoryConfiguration
-> NFSDataRepositoryConfiguration -> Bool
$c/= :: NFSDataRepositoryConfiguration
-> NFSDataRepositoryConfiguration -> Bool
== :: NFSDataRepositoryConfiguration
-> NFSDataRepositoryConfiguration -> Bool
$c== :: NFSDataRepositoryConfiguration
-> NFSDataRepositoryConfiguration -> Bool
Prelude.Eq, ReadPrec [NFSDataRepositoryConfiguration]
ReadPrec NFSDataRepositoryConfiguration
Int -> ReadS NFSDataRepositoryConfiguration
ReadS [NFSDataRepositoryConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NFSDataRepositoryConfiguration]
$creadListPrec :: ReadPrec [NFSDataRepositoryConfiguration]
readPrec :: ReadPrec NFSDataRepositoryConfiguration
$creadPrec :: ReadPrec NFSDataRepositoryConfiguration
readList :: ReadS [NFSDataRepositoryConfiguration]
$creadList :: ReadS [NFSDataRepositoryConfiguration]
readsPrec :: Int -> ReadS NFSDataRepositoryConfiguration
$creadsPrec :: Int -> ReadS NFSDataRepositoryConfiguration
Prelude.Read, Int -> NFSDataRepositoryConfiguration -> ShowS
[NFSDataRepositoryConfiguration] -> ShowS
NFSDataRepositoryConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NFSDataRepositoryConfiguration] -> ShowS
$cshowList :: [NFSDataRepositoryConfiguration] -> ShowS
show :: NFSDataRepositoryConfiguration -> String
$cshow :: NFSDataRepositoryConfiguration -> String
showsPrec :: Int -> NFSDataRepositoryConfiguration -> ShowS
$cshowsPrec :: Int -> NFSDataRepositoryConfiguration -> ShowS
Prelude.Show, forall x.
Rep NFSDataRepositoryConfiguration x
-> NFSDataRepositoryConfiguration
forall x.
NFSDataRepositoryConfiguration
-> Rep NFSDataRepositoryConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NFSDataRepositoryConfiguration x
-> NFSDataRepositoryConfiguration
$cfrom :: forall x.
NFSDataRepositoryConfiguration
-> Rep NFSDataRepositoryConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'NFSDataRepositoryConfiguration' 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:
--
-- 'autoExportPolicy', 'nFSDataRepositoryConfiguration_autoExportPolicy' - This parameter is not supported for Amazon File Cache.
--
-- 'dnsIps', 'nFSDataRepositoryConfiguration_dnsIps' - A list of up to 2 IP addresses of DNS servers used to resolve the NFS
-- file system domain name. The provided IP addresses can either be the IP
-- addresses of a DNS forwarder or resolver that the customer manages and
-- runs inside the customer VPC, or the IP addresses of the on-premises DNS
-- servers.
--
-- 'version', 'nFSDataRepositoryConfiguration_version' - The version of the NFS (Network File System) protocol of the NFS data
-- repository. Currently, the only supported value is @NFS3@, which
-- indicates that the data repository must support the NFSv3 protocol.
newNFSDataRepositoryConfiguration ::
  -- | 'version'
  NfsVersion ->
  NFSDataRepositoryConfiguration
newNFSDataRepositoryConfiguration :: NfsVersion -> NFSDataRepositoryConfiguration
newNFSDataRepositoryConfiguration NfsVersion
pVersion_ =
  NFSDataRepositoryConfiguration'
    { $sel:autoExportPolicy:NFSDataRepositoryConfiguration' :: Maybe AutoExportPolicy
autoExportPolicy =
        forall a. Maybe a
Prelude.Nothing,
      $sel:dnsIps:NFSDataRepositoryConfiguration' :: Maybe [Text]
dnsIps = forall a. Maybe a
Prelude.Nothing,
      $sel:version:NFSDataRepositoryConfiguration' :: NfsVersion
version = NfsVersion
pVersion_
    }

-- | This parameter is not supported for Amazon File Cache.
nFSDataRepositoryConfiguration_autoExportPolicy :: Lens.Lens' NFSDataRepositoryConfiguration (Prelude.Maybe AutoExportPolicy)
nFSDataRepositoryConfiguration_autoExportPolicy :: Lens' NFSDataRepositoryConfiguration (Maybe AutoExportPolicy)
nFSDataRepositoryConfiguration_autoExportPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NFSDataRepositoryConfiguration' {Maybe AutoExportPolicy
autoExportPolicy :: Maybe AutoExportPolicy
$sel:autoExportPolicy:NFSDataRepositoryConfiguration' :: NFSDataRepositoryConfiguration -> Maybe AutoExportPolicy
autoExportPolicy} -> Maybe AutoExportPolicy
autoExportPolicy) (\s :: NFSDataRepositoryConfiguration
s@NFSDataRepositoryConfiguration' {} Maybe AutoExportPolicy
a -> NFSDataRepositoryConfiguration
s {$sel:autoExportPolicy:NFSDataRepositoryConfiguration' :: Maybe AutoExportPolicy
autoExportPolicy = Maybe AutoExportPolicy
a} :: NFSDataRepositoryConfiguration)

-- | A list of up to 2 IP addresses of DNS servers used to resolve the NFS
-- file system domain name. The provided IP addresses can either be the IP
-- addresses of a DNS forwarder or resolver that the customer manages and
-- runs inside the customer VPC, or the IP addresses of the on-premises DNS
-- servers.
nFSDataRepositoryConfiguration_dnsIps :: Lens.Lens' NFSDataRepositoryConfiguration (Prelude.Maybe [Prelude.Text])
nFSDataRepositoryConfiguration_dnsIps :: Lens' NFSDataRepositoryConfiguration (Maybe [Text])
nFSDataRepositoryConfiguration_dnsIps = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NFSDataRepositoryConfiguration' {Maybe [Text]
dnsIps :: Maybe [Text]
$sel:dnsIps:NFSDataRepositoryConfiguration' :: NFSDataRepositoryConfiguration -> Maybe [Text]
dnsIps} -> Maybe [Text]
dnsIps) (\s :: NFSDataRepositoryConfiguration
s@NFSDataRepositoryConfiguration' {} Maybe [Text]
a -> NFSDataRepositoryConfiguration
s {$sel:dnsIps:NFSDataRepositoryConfiguration' :: Maybe [Text]
dnsIps = Maybe [Text]
a} :: NFSDataRepositoryConfiguration) 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

-- | The version of the NFS (Network File System) protocol of the NFS data
-- repository. Currently, the only supported value is @NFS3@, which
-- indicates that the data repository must support the NFSv3 protocol.
nFSDataRepositoryConfiguration_version :: Lens.Lens' NFSDataRepositoryConfiguration NfsVersion
nFSDataRepositoryConfiguration_version :: Lens' NFSDataRepositoryConfiguration NfsVersion
nFSDataRepositoryConfiguration_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NFSDataRepositoryConfiguration' {NfsVersion
version :: NfsVersion
$sel:version:NFSDataRepositoryConfiguration' :: NFSDataRepositoryConfiguration -> NfsVersion
version} -> NfsVersion
version) (\s :: NFSDataRepositoryConfiguration
s@NFSDataRepositoryConfiguration' {} NfsVersion
a -> NFSDataRepositoryConfiguration
s {$sel:version:NFSDataRepositoryConfiguration' :: NfsVersion
version = NfsVersion
a} :: NFSDataRepositoryConfiguration)

instance Data.FromJSON NFSDataRepositoryConfiguration where
  parseJSON :: Value -> Parser NFSDataRepositoryConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NFSDataRepositoryConfiguration"
      ( \Object
x ->
          Maybe AutoExportPolicy
-> Maybe [Text] -> NfsVersion -> NFSDataRepositoryConfiguration
NFSDataRepositoryConfiguration'
            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
"AutoExportPolicy")
            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
"DnsIps" 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 a
Data..: Key
"Version")
      )

instance
  Prelude.Hashable
    NFSDataRepositoryConfiguration
  where
  hashWithSalt :: Int -> NFSDataRepositoryConfiguration -> Int
hashWithSalt
    Int
_salt
    NFSDataRepositoryConfiguration' {Maybe [Text]
Maybe AutoExportPolicy
NfsVersion
version :: NfsVersion
dnsIps :: Maybe [Text]
autoExportPolicy :: Maybe AutoExportPolicy
$sel:version:NFSDataRepositoryConfiguration' :: NFSDataRepositoryConfiguration -> NfsVersion
$sel:dnsIps:NFSDataRepositoryConfiguration' :: NFSDataRepositoryConfiguration -> Maybe [Text]
$sel:autoExportPolicy:NFSDataRepositoryConfiguration' :: NFSDataRepositoryConfiguration -> Maybe AutoExportPolicy
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AutoExportPolicy
autoExportPolicy
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
dnsIps
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NfsVersion
version

instance
  Prelude.NFData
    NFSDataRepositoryConfiguration
  where
  rnf :: NFSDataRepositoryConfiguration -> ()
rnf NFSDataRepositoryConfiguration' {Maybe [Text]
Maybe AutoExportPolicy
NfsVersion
version :: NfsVersion
dnsIps :: Maybe [Text]
autoExportPolicy :: Maybe AutoExportPolicy
$sel:version:NFSDataRepositoryConfiguration' :: NFSDataRepositoryConfiguration -> NfsVersion
$sel:dnsIps:NFSDataRepositoryConfiguration' :: NFSDataRepositoryConfiguration -> Maybe [Text]
$sel:autoExportPolicy:NFSDataRepositoryConfiguration' :: NFSDataRepositoryConfiguration -> Maybe AutoExportPolicy
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AutoExportPolicy
autoExportPolicy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
dnsIps
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NfsVersion
version