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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaConnect.Types.NetworkInterfaceType
import qualified Amazonka.Prelude as Prelude

-- | The settings for a VPC Source.
--
-- /See:/ 'newVpcInterface' smart constructor.
data VpcInterface = VpcInterface'
  { -- | The type of network interface.
    VpcInterface -> NetworkInterfaceType
networkInterfaceType :: NetworkInterfaceType,
    -- | IDs of the network interfaces created in customer\'s account by
    -- MediaConnect.
    VpcInterface -> [Text]
networkInterfaceIds :: [Prelude.Text],
    -- | Subnet must be in the AZ of the Flow
    VpcInterface -> Text
subnetId :: Prelude.Text,
    -- | Security Group IDs to be used on ENI.
    VpcInterface -> [Text]
securityGroupIds :: [Prelude.Text],
    -- | Role Arn MediaConnect can assumes to create ENIs in customer\'s account
    VpcInterface -> Text
roleArn :: Prelude.Text,
    -- | Immutable and has to be a unique against other VpcInterfaces in this
    -- Flow.
    VpcInterface -> Text
name :: Prelude.Text
  }
  deriving (VpcInterface -> VpcInterface -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcInterface -> VpcInterface -> Bool
$c/= :: VpcInterface -> VpcInterface -> Bool
== :: VpcInterface -> VpcInterface -> Bool
$c== :: VpcInterface -> VpcInterface -> Bool
Prelude.Eq, ReadPrec [VpcInterface]
ReadPrec VpcInterface
Int -> ReadS VpcInterface
ReadS [VpcInterface]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcInterface]
$creadListPrec :: ReadPrec [VpcInterface]
readPrec :: ReadPrec VpcInterface
$creadPrec :: ReadPrec VpcInterface
readList :: ReadS [VpcInterface]
$creadList :: ReadS [VpcInterface]
readsPrec :: Int -> ReadS VpcInterface
$creadsPrec :: Int -> ReadS VpcInterface
Prelude.Read, Int -> VpcInterface -> ShowS
[VpcInterface] -> ShowS
VpcInterface -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcInterface] -> ShowS
$cshowList :: [VpcInterface] -> ShowS
show :: VpcInterface -> String
$cshow :: VpcInterface -> String
showsPrec :: Int -> VpcInterface -> ShowS
$cshowsPrec :: Int -> VpcInterface -> ShowS
Prelude.Show, forall x. Rep VpcInterface x -> VpcInterface
forall x. VpcInterface -> Rep VpcInterface x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpcInterface x -> VpcInterface
$cfrom :: forall x. VpcInterface -> Rep VpcInterface x
Prelude.Generic)

-- |
-- Create a value of 'VpcInterface' 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:
--
-- 'networkInterfaceType', 'vpcInterface_networkInterfaceType' - The type of network interface.
--
-- 'networkInterfaceIds', 'vpcInterface_networkInterfaceIds' - IDs of the network interfaces created in customer\'s account by
-- MediaConnect.
--
-- 'subnetId', 'vpcInterface_subnetId' - Subnet must be in the AZ of the Flow
--
-- 'securityGroupIds', 'vpcInterface_securityGroupIds' - Security Group IDs to be used on ENI.
--
-- 'roleArn', 'vpcInterface_roleArn' - Role Arn MediaConnect can assumes to create ENIs in customer\'s account
--
-- 'name', 'vpcInterface_name' - Immutable and has to be a unique against other VpcInterfaces in this
-- Flow.
newVpcInterface ::
  -- | 'networkInterfaceType'
  NetworkInterfaceType ->
  -- | 'subnetId'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  VpcInterface
newVpcInterface :: NetworkInterfaceType -> Text -> Text -> Text -> VpcInterface
newVpcInterface
  NetworkInterfaceType
pNetworkInterfaceType_
  Text
pSubnetId_
  Text
pRoleArn_
  Text
pName_ =
    VpcInterface'
      { $sel:networkInterfaceType:VpcInterface' :: NetworkInterfaceType
networkInterfaceType =
          NetworkInterfaceType
pNetworkInterfaceType_,
        $sel:networkInterfaceIds:VpcInterface' :: [Text]
networkInterfaceIds = forall a. Monoid a => a
Prelude.mempty,
        $sel:subnetId:VpcInterface' :: Text
subnetId = Text
pSubnetId_,
        $sel:securityGroupIds:VpcInterface' :: [Text]
securityGroupIds = forall a. Monoid a => a
Prelude.mempty,
        $sel:roleArn:VpcInterface' :: Text
roleArn = Text
pRoleArn_,
        $sel:name:VpcInterface' :: Text
name = Text
pName_
      }

-- | The type of network interface.
vpcInterface_networkInterfaceType :: Lens.Lens' VpcInterface NetworkInterfaceType
vpcInterface_networkInterfaceType :: Lens' VpcInterface NetworkInterfaceType
vpcInterface_networkInterfaceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcInterface' {NetworkInterfaceType
networkInterfaceType :: NetworkInterfaceType
$sel:networkInterfaceType:VpcInterface' :: VpcInterface -> NetworkInterfaceType
networkInterfaceType} -> NetworkInterfaceType
networkInterfaceType) (\s :: VpcInterface
s@VpcInterface' {} NetworkInterfaceType
a -> VpcInterface
s {$sel:networkInterfaceType:VpcInterface' :: NetworkInterfaceType
networkInterfaceType = NetworkInterfaceType
a} :: VpcInterface)

-- | IDs of the network interfaces created in customer\'s account by
-- MediaConnect.
vpcInterface_networkInterfaceIds :: Lens.Lens' VpcInterface [Prelude.Text]
vpcInterface_networkInterfaceIds :: Lens' VpcInterface [Text]
vpcInterface_networkInterfaceIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcInterface' {[Text]
networkInterfaceIds :: [Text]
$sel:networkInterfaceIds:VpcInterface' :: VpcInterface -> [Text]
networkInterfaceIds} -> [Text]
networkInterfaceIds) (\s :: VpcInterface
s@VpcInterface' {} [Text]
a -> VpcInterface
s {$sel:networkInterfaceIds:VpcInterface' :: [Text]
networkInterfaceIds = [Text]
a} :: VpcInterface) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Subnet must be in the AZ of the Flow
vpcInterface_subnetId :: Lens.Lens' VpcInterface Prelude.Text
vpcInterface_subnetId :: Lens' VpcInterface Text
vpcInterface_subnetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcInterface' {Text
subnetId :: Text
$sel:subnetId:VpcInterface' :: VpcInterface -> Text
subnetId} -> Text
subnetId) (\s :: VpcInterface
s@VpcInterface' {} Text
a -> VpcInterface
s {$sel:subnetId:VpcInterface' :: Text
subnetId = Text
a} :: VpcInterface)

-- | Security Group IDs to be used on ENI.
vpcInterface_securityGroupIds :: Lens.Lens' VpcInterface [Prelude.Text]
vpcInterface_securityGroupIds :: Lens' VpcInterface [Text]
vpcInterface_securityGroupIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcInterface' {[Text]
securityGroupIds :: [Text]
$sel:securityGroupIds:VpcInterface' :: VpcInterface -> [Text]
securityGroupIds} -> [Text]
securityGroupIds) (\s :: VpcInterface
s@VpcInterface' {} [Text]
a -> VpcInterface
s {$sel:securityGroupIds:VpcInterface' :: [Text]
securityGroupIds = [Text]
a} :: VpcInterface) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Role Arn MediaConnect can assumes to create ENIs in customer\'s account
vpcInterface_roleArn :: Lens.Lens' VpcInterface Prelude.Text
vpcInterface_roleArn :: Lens' VpcInterface Text
vpcInterface_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcInterface' {Text
roleArn :: Text
$sel:roleArn:VpcInterface' :: VpcInterface -> Text
roleArn} -> Text
roleArn) (\s :: VpcInterface
s@VpcInterface' {} Text
a -> VpcInterface
s {$sel:roleArn:VpcInterface' :: Text
roleArn = Text
a} :: VpcInterface)

-- | Immutable and has to be a unique against other VpcInterfaces in this
-- Flow.
vpcInterface_name :: Lens.Lens' VpcInterface Prelude.Text
vpcInterface_name :: Lens' VpcInterface Text
vpcInterface_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcInterface' {Text
name :: Text
$sel:name:VpcInterface' :: VpcInterface -> Text
name} -> Text
name) (\s :: VpcInterface
s@VpcInterface' {} Text
a -> VpcInterface
s {$sel:name:VpcInterface' :: Text
name = Text
a} :: VpcInterface)

instance Data.FromJSON VpcInterface where
  parseJSON :: Value -> Parser VpcInterface
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VpcInterface"
      ( \Object
x ->
          NetworkInterfaceType
-> [Text] -> Text -> [Text] -> Text -> Text -> VpcInterface
VpcInterface'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"networkInterfaceType")
            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
"networkInterfaceIds"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"subnetId")
            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
"securityGroupIds"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"roleArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
      )

instance Prelude.Hashable VpcInterface where
  hashWithSalt :: Int -> VpcInterface -> Int
hashWithSalt Int
_salt VpcInterface' {[Text]
Text
NetworkInterfaceType
name :: Text
roleArn :: Text
securityGroupIds :: [Text]
subnetId :: Text
networkInterfaceIds :: [Text]
networkInterfaceType :: NetworkInterfaceType
$sel:name:VpcInterface' :: VpcInterface -> Text
$sel:roleArn:VpcInterface' :: VpcInterface -> Text
$sel:securityGroupIds:VpcInterface' :: VpcInterface -> [Text]
$sel:subnetId:VpcInterface' :: VpcInterface -> Text
$sel:networkInterfaceIds:VpcInterface' :: VpcInterface -> [Text]
$sel:networkInterfaceType:VpcInterface' :: VpcInterface -> NetworkInterfaceType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NetworkInterfaceType
networkInterfaceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
networkInterfaceIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
subnetId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
securityGroupIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData VpcInterface where
  rnf :: VpcInterface -> ()
rnf VpcInterface' {[Text]
Text
NetworkInterfaceType
name :: Text
roleArn :: Text
securityGroupIds :: [Text]
subnetId :: Text
networkInterfaceIds :: [Text]
networkInterfaceType :: NetworkInterfaceType
$sel:name:VpcInterface' :: VpcInterface -> Text
$sel:roleArn:VpcInterface' :: VpcInterface -> Text
$sel:securityGroupIds:VpcInterface' :: VpcInterface -> [Text]
$sel:subnetId:VpcInterface' :: VpcInterface -> Text
$sel:networkInterfaceIds:VpcInterface' :: VpcInterface -> [Text]
$sel:networkInterfaceType:VpcInterface' :: VpcInterface -> NetworkInterfaceType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf NetworkInterfaceType
networkInterfaceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
networkInterfaceIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
subnetId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
securityGroupIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name