{-# 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.ConnectAttachment
-- 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.ConnectAttachment 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.Attachment
import Amazonka.NetworkManager.Types.ConnectAttachmentOptions
import qualified Amazonka.Prelude as Prelude

-- | Describes a core network Connect attachment.
--
-- /See:/ 'newConnectAttachment' smart constructor.
data ConnectAttachment = ConnectAttachment'
  { -- | The attachment details.
    ConnectAttachment -> Maybe Attachment
attachment :: Prelude.Maybe Attachment,
    -- | Options for connecting an attachment.
    ConnectAttachment -> Maybe ConnectAttachmentOptions
options :: Prelude.Maybe ConnectAttachmentOptions,
    -- | The ID of the transport attachment.
    ConnectAttachment -> Maybe Text
transportAttachmentId :: Prelude.Maybe Prelude.Text
  }
  deriving (ConnectAttachment -> ConnectAttachment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectAttachment -> ConnectAttachment -> Bool
$c/= :: ConnectAttachment -> ConnectAttachment -> Bool
== :: ConnectAttachment -> ConnectAttachment -> Bool
$c== :: ConnectAttachment -> ConnectAttachment -> Bool
Prelude.Eq, ReadPrec [ConnectAttachment]
ReadPrec ConnectAttachment
Int -> ReadS ConnectAttachment
ReadS [ConnectAttachment]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectAttachment]
$creadListPrec :: ReadPrec [ConnectAttachment]
readPrec :: ReadPrec ConnectAttachment
$creadPrec :: ReadPrec ConnectAttachment
readList :: ReadS [ConnectAttachment]
$creadList :: ReadS [ConnectAttachment]
readsPrec :: Int -> ReadS ConnectAttachment
$creadsPrec :: Int -> ReadS ConnectAttachment
Prelude.Read, Int -> ConnectAttachment -> ShowS
[ConnectAttachment] -> ShowS
ConnectAttachment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectAttachment] -> ShowS
$cshowList :: [ConnectAttachment] -> ShowS
show :: ConnectAttachment -> String
$cshow :: ConnectAttachment -> String
showsPrec :: Int -> ConnectAttachment -> ShowS
$cshowsPrec :: Int -> ConnectAttachment -> ShowS
Prelude.Show, forall x. Rep ConnectAttachment x -> ConnectAttachment
forall x. ConnectAttachment -> Rep ConnectAttachment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConnectAttachment x -> ConnectAttachment
$cfrom :: forall x. ConnectAttachment -> Rep ConnectAttachment x
Prelude.Generic)

-- |
-- Create a value of 'ConnectAttachment' 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:
--
-- 'attachment', 'connectAttachment_attachment' - The attachment details.
--
-- 'options', 'connectAttachment_options' - Options for connecting an attachment.
--
-- 'transportAttachmentId', 'connectAttachment_transportAttachmentId' - The ID of the transport attachment.
newConnectAttachment ::
  ConnectAttachment
newConnectAttachment :: ConnectAttachment
newConnectAttachment =
  ConnectAttachment'
    { $sel:attachment:ConnectAttachment' :: Maybe Attachment
attachment = forall a. Maybe a
Prelude.Nothing,
      $sel:options:ConnectAttachment' :: Maybe ConnectAttachmentOptions
options = forall a. Maybe a
Prelude.Nothing,
      $sel:transportAttachmentId:ConnectAttachment' :: Maybe Text
transportAttachmentId = forall a. Maybe a
Prelude.Nothing
    }

-- | The attachment details.
connectAttachment_attachment :: Lens.Lens' ConnectAttachment (Prelude.Maybe Attachment)
connectAttachment_attachment :: Lens' ConnectAttachment (Maybe Attachment)
connectAttachment_attachment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectAttachment' {Maybe Attachment
attachment :: Maybe Attachment
$sel:attachment:ConnectAttachment' :: ConnectAttachment -> Maybe Attachment
attachment} -> Maybe Attachment
attachment) (\s :: ConnectAttachment
s@ConnectAttachment' {} Maybe Attachment
a -> ConnectAttachment
s {$sel:attachment:ConnectAttachment' :: Maybe Attachment
attachment = Maybe Attachment
a} :: ConnectAttachment)

-- | Options for connecting an attachment.
connectAttachment_options :: Lens.Lens' ConnectAttachment (Prelude.Maybe ConnectAttachmentOptions)
connectAttachment_options :: Lens' ConnectAttachment (Maybe ConnectAttachmentOptions)
connectAttachment_options = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectAttachment' {Maybe ConnectAttachmentOptions
options :: Maybe ConnectAttachmentOptions
$sel:options:ConnectAttachment' :: ConnectAttachment -> Maybe ConnectAttachmentOptions
options} -> Maybe ConnectAttachmentOptions
options) (\s :: ConnectAttachment
s@ConnectAttachment' {} Maybe ConnectAttachmentOptions
a -> ConnectAttachment
s {$sel:options:ConnectAttachment' :: Maybe ConnectAttachmentOptions
options = Maybe ConnectAttachmentOptions
a} :: ConnectAttachment)

-- | The ID of the transport attachment.
connectAttachment_transportAttachmentId :: Lens.Lens' ConnectAttachment (Prelude.Maybe Prelude.Text)
connectAttachment_transportAttachmentId :: Lens' ConnectAttachment (Maybe Text)
connectAttachment_transportAttachmentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectAttachment' {Maybe Text
transportAttachmentId :: Maybe Text
$sel:transportAttachmentId:ConnectAttachment' :: ConnectAttachment -> Maybe Text
transportAttachmentId} -> Maybe Text
transportAttachmentId) (\s :: ConnectAttachment
s@ConnectAttachment' {} Maybe Text
a -> ConnectAttachment
s {$sel:transportAttachmentId:ConnectAttachment' :: Maybe Text
transportAttachmentId = Maybe Text
a} :: ConnectAttachment)

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

instance Prelude.Hashable ConnectAttachment where
  hashWithSalt :: Int -> ConnectAttachment -> Int
hashWithSalt Int
_salt ConnectAttachment' {Maybe Text
Maybe Attachment
Maybe ConnectAttachmentOptions
transportAttachmentId :: Maybe Text
options :: Maybe ConnectAttachmentOptions
attachment :: Maybe Attachment
$sel:transportAttachmentId:ConnectAttachment' :: ConnectAttachment -> Maybe Text
$sel:options:ConnectAttachment' :: ConnectAttachment -> Maybe ConnectAttachmentOptions
$sel:attachment:ConnectAttachment' :: ConnectAttachment -> Maybe Attachment
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Attachment
attachment
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConnectAttachmentOptions
options
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
transportAttachmentId

instance Prelude.NFData ConnectAttachment where
  rnf :: ConnectAttachment -> ()
rnf ConnectAttachment' {Maybe Text
Maybe Attachment
Maybe ConnectAttachmentOptions
transportAttachmentId :: Maybe Text
options :: Maybe ConnectAttachmentOptions
attachment :: Maybe Attachment
$sel:transportAttachmentId:ConnectAttachment' :: ConnectAttachment -> Maybe Text
$sel:options:ConnectAttachment' :: ConnectAttachment -> Maybe ConnectAttachmentOptions
$sel:attachment:ConnectAttachment' :: ConnectAttachment -> Maybe Attachment
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Attachment
attachment
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConnectAttachmentOptions
options
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
transportAttachmentId