{-# 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.FileSystemEndpoint
-- 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.FileSystemEndpoint where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | An Amazon FSx for NetApp ONTAP file system has two endpoints that are
-- used to access data or to manage the file system using the NetApp ONTAP
-- CLI, REST API, or NetApp SnapMirror. They are the @Management@ and
-- @Intercluster@ endpoints.
--
-- /See:/ 'newFileSystemEndpoint' smart constructor.
data FileSystemEndpoint = FileSystemEndpoint'
  { FileSystemEndpoint -> Maybe Text
dNSName :: Prelude.Maybe Prelude.Text,
    -- | IP addresses of the file system endpoint.
    FileSystemEndpoint -> Maybe (NonEmpty Text)
ipAddresses :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text)
  }
  deriving (FileSystemEndpoint -> FileSystemEndpoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileSystemEndpoint -> FileSystemEndpoint -> Bool
$c/= :: FileSystemEndpoint -> FileSystemEndpoint -> Bool
== :: FileSystemEndpoint -> FileSystemEndpoint -> Bool
$c== :: FileSystemEndpoint -> FileSystemEndpoint -> Bool
Prelude.Eq, ReadPrec [FileSystemEndpoint]
ReadPrec FileSystemEndpoint
Int -> ReadS FileSystemEndpoint
ReadS [FileSystemEndpoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FileSystemEndpoint]
$creadListPrec :: ReadPrec [FileSystemEndpoint]
readPrec :: ReadPrec FileSystemEndpoint
$creadPrec :: ReadPrec FileSystemEndpoint
readList :: ReadS [FileSystemEndpoint]
$creadList :: ReadS [FileSystemEndpoint]
readsPrec :: Int -> ReadS FileSystemEndpoint
$creadsPrec :: Int -> ReadS FileSystemEndpoint
Prelude.Read, Int -> FileSystemEndpoint -> ShowS
[FileSystemEndpoint] -> ShowS
FileSystemEndpoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileSystemEndpoint] -> ShowS
$cshowList :: [FileSystemEndpoint] -> ShowS
show :: FileSystemEndpoint -> String
$cshow :: FileSystemEndpoint -> String
showsPrec :: Int -> FileSystemEndpoint -> ShowS
$cshowsPrec :: Int -> FileSystemEndpoint -> ShowS
Prelude.Show, forall x. Rep FileSystemEndpoint x -> FileSystemEndpoint
forall x. FileSystemEndpoint -> Rep FileSystemEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FileSystemEndpoint x -> FileSystemEndpoint
$cfrom :: forall x. FileSystemEndpoint -> Rep FileSystemEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'FileSystemEndpoint' 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:
--
-- 'dNSName', 'fileSystemEndpoint_dNSName' - Undocumented member.
--
-- 'ipAddresses', 'fileSystemEndpoint_ipAddresses' - IP addresses of the file system endpoint.
newFileSystemEndpoint ::
  FileSystemEndpoint
newFileSystemEndpoint :: FileSystemEndpoint
newFileSystemEndpoint =
  FileSystemEndpoint'
    { $sel:dNSName:FileSystemEndpoint' :: Maybe Text
dNSName = forall a. Maybe a
Prelude.Nothing,
      $sel:ipAddresses:FileSystemEndpoint' :: Maybe (NonEmpty Text)
ipAddresses = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
fileSystemEndpoint_dNSName :: Lens.Lens' FileSystemEndpoint (Prelude.Maybe Prelude.Text)
fileSystemEndpoint_dNSName :: Lens' FileSystemEndpoint (Maybe Text)
fileSystemEndpoint_dNSName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileSystemEndpoint' {Maybe Text
dNSName :: Maybe Text
$sel:dNSName:FileSystemEndpoint' :: FileSystemEndpoint -> Maybe Text
dNSName} -> Maybe Text
dNSName) (\s :: FileSystemEndpoint
s@FileSystemEndpoint' {} Maybe Text
a -> FileSystemEndpoint
s {$sel:dNSName:FileSystemEndpoint' :: Maybe Text
dNSName = Maybe Text
a} :: FileSystemEndpoint)

-- | IP addresses of the file system endpoint.
fileSystemEndpoint_ipAddresses :: Lens.Lens' FileSystemEndpoint (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
fileSystemEndpoint_ipAddresses :: Lens' FileSystemEndpoint (Maybe (NonEmpty Text))
fileSystemEndpoint_ipAddresses = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileSystemEndpoint' {Maybe (NonEmpty Text)
ipAddresses :: Maybe (NonEmpty Text)
$sel:ipAddresses:FileSystemEndpoint' :: FileSystemEndpoint -> Maybe (NonEmpty Text)
ipAddresses} -> Maybe (NonEmpty Text)
ipAddresses) (\s :: FileSystemEndpoint
s@FileSystemEndpoint' {} Maybe (NonEmpty Text)
a -> FileSystemEndpoint
s {$sel:ipAddresses:FileSystemEndpoint' :: Maybe (NonEmpty Text)
ipAddresses = Maybe (NonEmpty Text)
a} :: FileSystemEndpoint) 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

instance Data.FromJSON FileSystemEndpoint where
  parseJSON :: Value -> Parser FileSystemEndpoint
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FileSystemEndpoint"
      ( \Object
x ->
          Maybe Text -> Maybe (NonEmpty Text) -> FileSystemEndpoint
FileSystemEndpoint'
            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
"DNSName")
            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
"IpAddresses")
      )

instance Prelude.Hashable FileSystemEndpoint where
  hashWithSalt :: Int -> FileSystemEndpoint -> Int
hashWithSalt Int
_salt FileSystemEndpoint' {Maybe (NonEmpty Text)
Maybe Text
ipAddresses :: Maybe (NonEmpty Text)
dNSName :: Maybe Text
$sel:ipAddresses:FileSystemEndpoint' :: FileSystemEndpoint -> Maybe (NonEmpty Text)
$sel:dNSName:FileSystemEndpoint' :: FileSystemEndpoint -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dNSName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
ipAddresses

instance Prelude.NFData FileSystemEndpoint where
  rnf :: FileSystemEndpoint -> ()
rnf FileSystemEndpoint' {Maybe (NonEmpty Text)
Maybe Text
ipAddresses :: Maybe (NonEmpty Text)
dNSName :: Maybe Text
$sel:ipAddresses:FileSystemEndpoint' :: FileSystemEndpoint -> Maybe (NonEmpty Text)
$sel:dNSName:FileSystemEndpoint' :: FileSystemEndpoint -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dNSName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
ipAddresses