{-# 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.NetworkManager.Types.ConnectAttachmentOptions
-- 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.NetworkManager.Types.ConnectAttachmentOptions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.NetworkManager.Types.TunnelProtocol
import qualified Amazonka.Prelude as Prelude

-- | Describes a core network Connect attachment options.
--
-- /See:/ 'newConnectAttachmentOptions' smart constructor.
data ConnectAttachmentOptions = ConnectAttachmentOptions'
  { -- | The protocol used for the attachment connection.
    ConnectAttachmentOptions -> Maybe TunnelProtocol
protocol :: Prelude.Maybe TunnelProtocol
  }
  deriving (ConnectAttachmentOptions -> ConnectAttachmentOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectAttachmentOptions -> ConnectAttachmentOptions -> Bool
$c/= :: ConnectAttachmentOptions -> ConnectAttachmentOptions -> Bool
== :: ConnectAttachmentOptions -> ConnectAttachmentOptions -> Bool
$c== :: ConnectAttachmentOptions -> ConnectAttachmentOptions -> Bool
Prelude.Eq, ReadPrec [ConnectAttachmentOptions]
ReadPrec ConnectAttachmentOptions
Int -> ReadS ConnectAttachmentOptions
ReadS [ConnectAttachmentOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectAttachmentOptions]
$creadListPrec :: ReadPrec [ConnectAttachmentOptions]
readPrec :: ReadPrec ConnectAttachmentOptions
$creadPrec :: ReadPrec ConnectAttachmentOptions
readList :: ReadS [ConnectAttachmentOptions]
$creadList :: ReadS [ConnectAttachmentOptions]
readsPrec :: Int -> ReadS ConnectAttachmentOptions
$creadsPrec :: Int -> ReadS ConnectAttachmentOptions
Prelude.Read, Int -> ConnectAttachmentOptions -> ShowS
[ConnectAttachmentOptions] -> ShowS
ConnectAttachmentOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectAttachmentOptions] -> ShowS
$cshowList :: [ConnectAttachmentOptions] -> ShowS
show :: ConnectAttachmentOptions -> String
$cshow :: ConnectAttachmentOptions -> String
showsPrec :: Int -> ConnectAttachmentOptions -> ShowS
$cshowsPrec :: Int -> ConnectAttachmentOptions -> ShowS
Prelude.Show, forall x.
Rep ConnectAttachmentOptions x -> ConnectAttachmentOptions
forall x.
ConnectAttachmentOptions -> Rep ConnectAttachmentOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConnectAttachmentOptions x -> ConnectAttachmentOptions
$cfrom :: forall x.
ConnectAttachmentOptions -> Rep ConnectAttachmentOptions x
Prelude.Generic)

-- |
-- Create a value of 'ConnectAttachmentOptions' 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:
--
-- 'protocol', 'connectAttachmentOptions_protocol' - The protocol used for the attachment connection.
newConnectAttachmentOptions ::
  ConnectAttachmentOptions
newConnectAttachmentOptions :: ConnectAttachmentOptions
newConnectAttachmentOptions =
  ConnectAttachmentOptions'
    { $sel:protocol:ConnectAttachmentOptions' :: Maybe TunnelProtocol
protocol =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The protocol used for the attachment connection.
connectAttachmentOptions_protocol :: Lens.Lens' ConnectAttachmentOptions (Prelude.Maybe TunnelProtocol)
connectAttachmentOptions_protocol :: Lens' ConnectAttachmentOptions (Maybe TunnelProtocol)
connectAttachmentOptions_protocol = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectAttachmentOptions' {Maybe TunnelProtocol
protocol :: Maybe TunnelProtocol
$sel:protocol:ConnectAttachmentOptions' :: ConnectAttachmentOptions -> Maybe TunnelProtocol
protocol} -> Maybe TunnelProtocol
protocol) (\s :: ConnectAttachmentOptions
s@ConnectAttachmentOptions' {} Maybe TunnelProtocol
a -> ConnectAttachmentOptions
s {$sel:protocol:ConnectAttachmentOptions' :: Maybe TunnelProtocol
protocol = Maybe TunnelProtocol
a} :: ConnectAttachmentOptions)

instance Data.FromJSON ConnectAttachmentOptions where
  parseJSON :: Value -> Parser ConnectAttachmentOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConnectAttachmentOptions"
      ( \Object
x ->
          Maybe TunnelProtocol -> ConnectAttachmentOptions
ConnectAttachmentOptions'
            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
"Protocol")
      )

instance Prelude.Hashable ConnectAttachmentOptions where
  hashWithSalt :: Int -> ConnectAttachmentOptions -> Int
hashWithSalt Int
_salt ConnectAttachmentOptions' {Maybe TunnelProtocol
protocol :: Maybe TunnelProtocol
$sel:protocol:ConnectAttachmentOptions' :: ConnectAttachmentOptions -> Maybe TunnelProtocol
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TunnelProtocol
protocol

instance Prelude.NFData ConnectAttachmentOptions where
  rnf :: ConnectAttachmentOptions -> ()
rnf ConnectAttachmentOptions' {Maybe TunnelProtocol
protocol :: Maybe TunnelProtocol
$sel:protocol:ConnectAttachmentOptions' :: ConnectAttachmentOptions -> Maybe TunnelProtocol
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe TunnelProtocol
protocol

instance Data.ToJSON ConnectAttachmentOptions where
  toJSON :: ConnectAttachmentOptions -> Value
toJSON ConnectAttachmentOptions' {Maybe TunnelProtocol
protocol :: Maybe TunnelProtocol
$sel:protocol:ConnectAttachmentOptions' :: ConnectAttachmentOptions -> Maybe TunnelProtocol
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"Protocol" 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 TunnelProtocol
protocol]
      )