{-# 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.SvmEndpoint
-- 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.SvmEndpoint 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 storage virtual machine (SVM) has four
-- endpoints that are used to access data or to manage the SVM using the
-- NetApp ONTAP CLI, REST API, or NetApp CloudManager. They are the
-- @Iscsi@, @Management@, @Nfs@, and @Smb@ endpoints.
--
-- /See:/ 'newSvmEndpoint' smart constructor.
data SvmEndpoint = SvmEndpoint'
  { SvmEndpoint -> Maybe Text
dNSName :: Prelude.Maybe Prelude.Text,
    -- | The SVM endpoint\'s IP addresses.
    SvmEndpoint -> Maybe (NonEmpty Text)
ipAddresses :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text)
  }
  deriving (SvmEndpoint -> SvmEndpoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SvmEndpoint -> SvmEndpoint -> Bool
$c/= :: SvmEndpoint -> SvmEndpoint -> Bool
== :: SvmEndpoint -> SvmEndpoint -> Bool
$c== :: SvmEndpoint -> SvmEndpoint -> Bool
Prelude.Eq, ReadPrec [SvmEndpoint]
ReadPrec SvmEndpoint
Int -> ReadS SvmEndpoint
ReadS [SvmEndpoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SvmEndpoint]
$creadListPrec :: ReadPrec [SvmEndpoint]
readPrec :: ReadPrec SvmEndpoint
$creadPrec :: ReadPrec SvmEndpoint
readList :: ReadS [SvmEndpoint]
$creadList :: ReadS [SvmEndpoint]
readsPrec :: Int -> ReadS SvmEndpoint
$creadsPrec :: Int -> ReadS SvmEndpoint
Prelude.Read, Int -> SvmEndpoint -> ShowS
[SvmEndpoint] -> ShowS
SvmEndpoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SvmEndpoint] -> ShowS
$cshowList :: [SvmEndpoint] -> ShowS
show :: SvmEndpoint -> String
$cshow :: SvmEndpoint -> String
showsPrec :: Int -> SvmEndpoint -> ShowS
$cshowsPrec :: Int -> SvmEndpoint -> ShowS
Prelude.Show, forall x. Rep SvmEndpoint x -> SvmEndpoint
forall x. SvmEndpoint -> Rep SvmEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SvmEndpoint x -> SvmEndpoint
$cfrom :: forall x. SvmEndpoint -> Rep SvmEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'SvmEndpoint' 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', 'svmEndpoint_dNSName' - Undocumented member.
--
-- 'ipAddresses', 'svmEndpoint_ipAddresses' - The SVM endpoint\'s IP addresses.
newSvmEndpoint ::
  SvmEndpoint
newSvmEndpoint :: SvmEndpoint
newSvmEndpoint =
  SvmEndpoint'
    { $sel:dNSName:SvmEndpoint' :: Maybe Text
dNSName = forall a. Maybe a
Prelude.Nothing,
      $sel:ipAddresses:SvmEndpoint' :: Maybe (NonEmpty Text)
ipAddresses = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The SVM endpoint\'s IP addresses.
svmEndpoint_ipAddresses :: Lens.Lens' SvmEndpoint (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
svmEndpoint_ipAddresses :: Lens' SvmEndpoint (Maybe (NonEmpty Text))
svmEndpoint_ipAddresses = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SvmEndpoint' {Maybe (NonEmpty Text)
ipAddresses :: Maybe (NonEmpty Text)
$sel:ipAddresses:SvmEndpoint' :: SvmEndpoint -> Maybe (NonEmpty Text)
ipAddresses} -> Maybe (NonEmpty Text)
ipAddresses) (\s :: SvmEndpoint
s@SvmEndpoint' {} Maybe (NonEmpty Text)
a -> SvmEndpoint
s {$sel:ipAddresses:SvmEndpoint' :: Maybe (NonEmpty Text)
ipAddresses = Maybe (NonEmpty Text)
a} :: SvmEndpoint) 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 SvmEndpoint where
  parseJSON :: Value -> Parser SvmEndpoint
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SvmEndpoint"
      ( \Object
x ->
          Maybe Text -> Maybe (NonEmpty Text) -> SvmEndpoint
SvmEndpoint'
            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 SvmEndpoint where
  hashWithSalt :: Int -> SvmEndpoint -> Int
hashWithSalt Int
_salt SvmEndpoint' {Maybe (NonEmpty Text)
Maybe Text
ipAddresses :: Maybe (NonEmpty Text)
dNSName :: Maybe Text
$sel:ipAddresses:SvmEndpoint' :: SvmEndpoint -> Maybe (NonEmpty Text)
$sel:dNSName:SvmEndpoint' :: SvmEndpoint -> 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 SvmEndpoint where
  rnf :: SvmEndpoint -> ()
rnf SvmEndpoint' {Maybe (NonEmpty Text)
Maybe Text
ipAddresses :: Maybe (NonEmpty Text)
dNSName :: Maybe Text
$sel:ipAddresses:SvmEndpoint' :: SvmEndpoint -> Maybe (NonEmpty Text)
$sel:dNSName:SvmEndpoint' :: SvmEndpoint -> 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