{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaConnect.Types.VpcInterface where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(VpcInterface -> VpcInterface -> Bool)
-> (VpcInterface -> VpcInterface -> Bool) -> Eq VpcInterface
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]
(Int -> ReadS VpcInterface)
-> ReadS [VpcInterface]
-> ReadPrec VpcInterface
-> ReadPrec [VpcInterface]
-> Read 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
(Int -> VpcInterface -> ShowS)
-> (VpcInterface -> String)
-> ([VpcInterface] -> ShowS)
-> Show VpcInterface
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. VpcInterface -> Rep VpcInterface x)
-> (forall x. Rep VpcInterface x -> VpcInterface)
-> Generic VpcInterface
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' :: NetworkInterfaceType
-> [Text] -> Text -> [Text] -> Text -> Text -> VpcInterface
VpcInterface'
      { $sel:networkInterfaceType:VpcInterface' :: NetworkInterfaceType
networkInterfaceType =
          NetworkInterfaceType
pNetworkInterfaceType_,
        $sel:networkInterfaceIds:VpcInterface' :: [Text]
networkInterfaceIds = [Text]
forall a. Monoid a => a
Prelude.mempty,
        $sel:subnetId:VpcInterface' :: Text
subnetId = Text
pSubnetId_,
        $sel:securityGroupIds:VpcInterface' :: [Text]
securityGroupIds = [Text]
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 :: (NetworkInterfaceType -> f NetworkInterfaceType)
-> VpcInterface -> f VpcInterface
vpcInterface_networkInterfaceType = (VpcInterface -> NetworkInterfaceType)
-> (VpcInterface -> NetworkInterfaceType -> VpcInterface)
-> Lens
     VpcInterface VpcInterface NetworkInterfaceType 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 :: ([Text] -> f [Text]) -> VpcInterface -> f VpcInterface
vpcInterface_networkInterfaceIds = (VpcInterface -> [Text])
-> (VpcInterface -> [Text] -> VpcInterface)
-> Lens VpcInterface VpcInterface [Text] [Text]
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) (([Text] -> f [Text]) -> VpcInterface -> f VpcInterface)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> VpcInterface
-> f VpcInterface
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
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 :: (Text -> f Text) -> VpcInterface -> f VpcInterface
vpcInterface_subnetId = (VpcInterface -> Text)
-> (VpcInterface -> Text -> VpcInterface)
-> Lens VpcInterface VpcInterface Text Text
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 :: ([Text] -> f [Text]) -> VpcInterface -> f VpcInterface
vpcInterface_securityGroupIds = (VpcInterface -> [Text])
-> (VpcInterface -> [Text] -> VpcInterface)
-> Lens VpcInterface VpcInterface [Text] [Text]
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) (([Text] -> f [Text]) -> VpcInterface -> f VpcInterface)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> VpcInterface
-> f VpcInterface
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
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 :: (Text -> f Text) -> VpcInterface -> f VpcInterface
vpcInterface_roleArn = (VpcInterface -> Text)
-> (VpcInterface -> Text -> VpcInterface)
-> Lens VpcInterface VpcInterface Text Text
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 :: (Text -> f Text) -> VpcInterface -> f VpcInterface
vpcInterface_name = (VpcInterface -> Text)
-> (VpcInterface -> Text -> VpcInterface)
-> Lens VpcInterface VpcInterface Text Text
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 Core.FromJSON VpcInterface where
  parseJSON :: Value -> Parser VpcInterface
parseJSON =
    String
-> (Object -> Parser VpcInterface) -> Value -> Parser VpcInterface
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VpcInterface"
      ( \Object
x ->
          NetworkInterfaceType
-> [Text] -> Text -> [Text] -> Text -> Text -> VpcInterface
VpcInterface'
            (NetworkInterfaceType
 -> [Text] -> Text -> [Text] -> Text -> Text -> VpcInterface)
-> Parser NetworkInterfaceType
-> Parser
     ([Text] -> Text -> [Text] -> Text -> Text -> VpcInterface)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser NetworkInterfaceType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"networkInterfaceType")
            Parser ([Text] -> Text -> [Text] -> Text -> Text -> VpcInterface)
-> Parser [Text]
-> Parser (Text -> [Text] -> Text -> Text -> VpcInterface)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"networkInterfaceIds"
                            Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Text -> [Text] -> Text -> Text -> VpcInterface)
-> Parser Text -> Parser ([Text] -> Text -> Text -> VpcInterface)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"subnetId")
            Parser ([Text] -> Text -> Text -> VpcInterface)
-> Parser [Text] -> Parser (Text -> Text -> VpcInterface)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"securityGroupIds"
                            Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Text -> Text -> VpcInterface)
-> Parser Text -> Parser (Text -> VpcInterface)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"roleArn")
            Parser (Text -> VpcInterface) -> Parser Text -> Parser VpcInterface
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
      )

instance Prelude.Hashable VpcInterface

instance Prelude.NFData VpcInterface