{-# 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.MediaConnect.Types.VpcInterfaceAttachment
-- 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.MediaConnect.Types.VpcInterfaceAttachment 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

-- | The settings for attaching a VPC interface to an output.
--
-- /See:/ 'newVpcInterfaceAttachment' smart constructor.
data VpcInterfaceAttachment = VpcInterfaceAttachment'
  { -- | The name of the VPC interface to use for this output.
    VpcInterfaceAttachment -> Maybe Text
vpcInterfaceName :: Prelude.Maybe Prelude.Text
  }
  deriving (VpcInterfaceAttachment -> VpcInterfaceAttachment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcInterfaceAttachment -> VpcInterfaceAttachment -> Bool
$c/= :: VpcInterfaceAttachment -> VpcInterfaceAttachment -> Bool
== :: VpcInterfaceAttachment -> VpcInterfaceAttachment -> Bool
$c== :: VpcInterfaceAttachment -> VpcInterfaceAttachment -> Bool
Prelude.Eq, ReadPrec [VpcInterfaceAttachment]
ReadPrec VpcInterfaceAttachment
Int -> ReadS VpcInterfaceAttachment
ReadS [VpcInterfaceAttachment]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcInterfaceAttachment]
$creadListPrec :: ReadPrec [VpcInterfaceAttachment]
readPrec :: ReadPrec VpcInterfaceAttachment
$creadPrec :: ReadPrec VpcInterfaceAttachment
readList :: ReadS [VpcInterfaceAttachment]
$creadList :: ReadS [VpcInterfaceAttachment]
readsPrec :: Int -> ReadS VpcInterfaceAttachment
$creadsPrec :: Int -> ReadS VpcInterfaceAttachment
Prelude.Read, Int -> VpcInterfaceAttachment -> ShowS
[VpcInterfaceAttachment] -> ShowS
VpcInterfaceAttachment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcInterfaceAttachment] -> ShowS
$cshowList :: [VpcInterfaceAttachment] -> ShowS
show :: VpcInterfaceAttachment -> String
$cshow :: VpcInterfaceAttachment -> String
showsPrec :: Int -> VpcInterfaceAttachment -> ShowS
$cshowsPrec :: Int -> VpcInterfaceAttachment -> ShowS
Prelude.Show, forall x. Rep VpcInterfaceAttachment x -> VpcInterfaceAttachment
forall x. VpcInterfaceAttachment -> Rep VpcInterfaceAttachment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpcInterfaceAttachment x -> VpcInterfaceAttachment
$cfrom :: forall x. VpcInterfaceAttachment -> Rep VpcInterfaceAttachment x
Prelude.Generic)

-- |
-- Create a value of 'VpcInterfaceAttachment' 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:
--
-- 'vpcInterfaceName', 'vpcInterfaceAttachment_vpcInterfaceName' - The name of the VPC interface to use for this output.
newVpcInterfaceAttachment ::
  VpcInterfaceAttachment
newVpcInterfaceAttachment :: VpcInterfaceAttachment
newVpcInterfaceAttachment =
  VpcInterfaceAttachment'
    { $sel:vpcInterfaceName:VpcInterfaceAttachment' :: Maybe Text
vpcInterfaceName =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the VPC interface to use for this output.
vpcInterfaceAttachment_vpcInterfaceName :: Lens.Lens' VpcInterfaceAttachment (Prelude.Maybe Prelude.Text)
vpcInterfaceAttachment_vpcInterfaceName :: Lens' VpcInterfaceAttachment (Maybe Text)
vpcInterfaceAttachment_vpcInterfaceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcInterfaceAttachment' {Maybe Text
vpcInterfaceName :: Maybe Text
$sel:vpcInterfaceName:VpcInterfaceAttachment' :: VpcInterfaceAttachment -> Maybe Text
vpcInterfaceName} -> Maybe Text
vpcInterfaceName) (\s :: VpcInterfaceAttachment
s@VpcInterfaceAttachment' {} Maybe Text
a -> VpcInterfaceAttachment
s {$sel:vpcInterfaceName:VpcInterfaceAttachment' :: Maybe Text
vpcInterfaceName = Maybe Text
a} :: VpcInterfaceAttachment)

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

instance Prelude.Hashable VpcInterfaceAttachment where
  hashWithSalt :: Int -> VpcInterfaceAttachment -> Int
hashWithSalt Int
_salt VpcInterfaceAttachment' {Maybe Text
vpcInterfaceName :: Maybe Text
$sel:vpcInterfaceName:VpcInterfaceAttachment' :: VpcInterfaceAttachment -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpcInterfaceName

instance Prelude.NFData VpcInterfaceAttachment where
  rnf :: VpcInterfaceAttachment -> ()
rnf VpcInterfaceAttachment' {Maybe Text
vpcInterfaceName :: Maybe Text
$sel:vpcInterfaceName:VpcInterfaceAttachment' :: VpcInterfaceAttachment -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vpcInterfaceName

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