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

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

-- | Desired VPC Interface for a Flow
--
-- /See:/ 'newVpcInterfaceRequest' smart constructor.
data VpcInterfaceRequest = VpcInterfaceRequest'
  { -- | The type of network interface. If this value is not included in the
    -- request, MediaConnect uses ENA as the networkInterfaceType.
    VpcInterfaceRequest -> Maybe NetworkInterfaceType
networkInterfaceType :: Prelude.Maybe NetworkInterfaceType,
    -- | Subnet must be in the AZ of the Flow
    VpcInterfaceRequest -> Text
subnetId :: Prelude.Text,
    -- | Security Group IDs to be used on ENI.
    VpcInterfaceRequest -> [Text]
securityGroupIds :: [Prelude.Text],
    -- | Role Arn MediaConnect can assumes to create ENIs in customer\'s account
    VpcInterfaceRequest -> Text
roleArn :: Prelude.Text,
    -- | The name of the VPC Interface. This value must be unique within the
    -- current flow.
    VpcInterfaceRequest -> Text
name :: Prelude.Text
  }
  deriving (VpcInterfaceRequest -> VpcInterfaceRequest -> Bool
(VpcInterfaceRequest -> VpcInterfaceRequest -> Bool)
-> (VpcInterfaceRequest -> VpcInterfaceRequest -> Bool)
-> Eq VpcInterfaceRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcInterfaceRequest -> VpcInterfaceRequest -> Bool
$c/= :: VpcInterfaceRequest -> VpcInterfaceRequest -> Bool
== :: VpcInterfaceRequest -> VpcInterfaceRequest -> Bool
$c== :: VpcInterfaceRequest -> VpcInterfaceRequest -> Bool
Prelude.Eq, ReadPrec [VpcInterfaceRequest]
ReadPrec VpcInterfaceRequest
Int -> ReadS VpcInterfaceRequest
ReadS [VpcInterfaceRequest]
(Int -> ReadS VpcInterfaceRequest)
-> ReadS [VpcInterfaceRequest]
-> ReadPrec VpcInterfaceRequest
-> ReadPrec [VpcInterfaceRequest]
-> Read VpcInterfaceRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcInterfaceRequest]
$creadListPrec :: ReadPrec [VpcInterfaceRequest]
readPrec :: ReadPrec VpcInterfaceRequest
$creadPrec :: ReadPrec VpcInterfaceRequest
readList :: ReadS [VpcInterfaceRequest]
$creadList :: ReadS [VpcInterfaceRequest]
readsPrec :: Int -> ReadS VpcInterfaceRequest
$creadsPrec :: Int -> ReadS VpcInterfaceRequest
Prelude.Read, Int -> VpcInterfaceRequest -> ShowS
[VpcInterfaceRequest] -> ShowS
VpcInterfaceRequest -> String
(Int -> VpcInterfaceRequest -> ShowS)
-> (VpcInterfaceRequest -> String)
-> ([VpcInterfaceRequest] -> ShowS)
-> Show VpcInterfaceRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcInterfaceRequest] -> ShowS
$cshowList :: [VpcInterfaceRequest] -> ShowS
show :: VpcInterfaceRequest -> String
$cshow :: VpcInterfaceRequest -> String
showsPrec :: Int -> VpcInterfaceRequest -> ShowS
$cshowsPrec :: Int -> VpcInterfaceRequest -> ShowS
Prelude.Show, (forall x. VpcInterfaceRequest -> Rep VpcInterfaceRequest x)
-> (forall x. Rep VpcInterfaceRequest x -> VpcInterfaceRequest)
-> Generic VpcInterfaceRequest
forall x. Rep VpcInterfaceRequest x -> VpcInterfaceRequest
forall x. VpcInterfaceRequest -> Rep VpcInterfaceRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpcInterfaceRequest x -> VpcInterfaceRequest
$cfrom :: forall x. VpcInterfaceRequest -> Rep VpcInterfaceRequest x
Prelude.Generic)

-- |
-- Create a value of 'VpcInterfaceRequest' 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', 'vpcInterfaceRequest_networkInterfaceType' - The type of network interface. If this value is not included in the
-- request, MediaConnect uses ENA as the networkInterfaceType.
--
-- 'subnetId', 'vpcInterfaceRequest_subnetId' - Subnet must be in the AZ of the Flow
--
-- 'securityGroupIds', 'vpcInterfaceRequest_securityGroupIds' - Security Group IDs to be used on ENI.
--
-- 'roleArn', 'vpcInterfaceRequest_roleArn' - Role Arn MediaConnect can assumes to create ENIs in customer\'s account
--
-- 'name', 'vpcInterfaceRequest_name' - The name of the VPC Interface. This value must be unique within the
-- current flow.
newVpcInterfaceRequest ::
  -- | 'subnetId'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  VpcInterfaceRequest
newVpcInterfaceRequest :: Text -> Text -> Text -> VpcInterfaceRequest
newVpcInterfaceRequest Text
pSubnetId_ Text
pRoleArn_ Text
pName_ =
  VpcInterfaceRequest' :: Maybe NetworkInterfaceType
-> Text -> [Text] -> Text -> Text -> VpcInterfaceRequest
VpcInterfaceRequest'
    { $sel:networkInterfaceType:VpcInterfaceRequest' :: Maybe NetworkInterfaceType
networkInterfaceType =
        Maybe NetworkInterfaceType
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetId:VpcInterfaceRequest' :: Text
subnetId = Text
pSubnetId_,
      $sel:securityGroupIds:VpcInterfaceRequest' :: [Text]
securityGroupIds = [Text]
forall a. Monoid a => a
Prelude.mempty,
      $sel:roleArn:VpcInterfaceRequest' :: Text
roleArn = Text
pRoleArn_,
      $sel:name:VpcInterfaceRequest' :: Text
name = Text
pName_
    }

-- | The type of network interface. If this value is not included in the
-- request, MediaConnect uses ENA as the networkInterfaceType.
vpcInterfaceRequest_networkInterfaceType :: Lens.Lens' VpcInterfaceRequest (Prelude.Maybe NetworkInterfaceType)
vpcInterfaceRequest_networkInterfaceType :: (Maybe NetworkInterfaceType -> f (Maybe NetworkInterfaceType))
-> VpcInterfaceRequest -> f VpcInterfaceRequest
vpcInterfaceRequest_networkInterfaceType = (VpcInterfaceRequest -> Maybe NetworkInterfaceType)
-> (VpcInterfaceRequest
    -> Maybe NetworkInterfaceType -> VpcInterfaceRequest)
-> Lens
     VpcInterfaceRequest
     VpcInterfaceRequest
     (Maybe NetworkInterfaceType)
     (Maybe NetworkInterfaceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcInterfaceRequest' {Maybe NetworkInterfaceType
networkInterfaceType :: Maybe NetworkInterfaceType
$sel:networkInterfaceType:VpcInterfaceRequest' :: VpcInterfaceRequest -> Maybe NetworkInterfaceType
networkInterfaceType} -> Maybe NetworkInterfaceType
networkInterfaceType) (\s :: VpcInterfaceRequest
s@VpcInterfaceRequest' {} Maybe NetworkInterfaceType
a -> VpcInterfaceRequest
s {$sel:networkInterfaceType:VpcInterfaceRequest' :: Maybe NetworkInterfaceType
networkInterfaceType = Maybe NetworkInterfaceType
a} :: VpcInterfaceRequest)

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

-- | Security Group IDs to be used on ENI.
vpcInterfaceRequest_securityGroupIds :: Lens.Lens' VpcInterfaceRequest [Prelude.Text]
vpcInterfaceRequest_securityGroupIds :: ([Text] -> f [Text])
-> VpcInterfaceRequest -> f VpcInterfaceRequest
vpcInterfaceRequest_securityGroupIds = (VpcInterfaceRequest -> [Text])
-> (VpcInterfaceRequest -> [Text] -> VpcInterfaceRequest)
-> Lens VpcInterfaceRequest VpcInterfaceRequest [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcInterfaceRequest' {[Text]
securityGroupIds :: [Text]
$sel:securityGroupIds:VpcInterfaceRequest' :: VpcInterfaceRequest -> [Text]
securityGroupIds} -> [Text]
securityGroupIds) (\s :: VpcInterfaceRequest
s@VpcInterfaceRequest' {} [Text]
a -> VpcInterfaceRequest
s {$sel:securityGroupIds:VpcInterfaceRequest' :: [Text]
securityGroupIds = [Text]
a} :: VpcInterfaceRequest) (([Text] -> f [Text])
 -> VpcInterfaceRequest -> f VpcInterfaceRequest)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> VpcInterfaceRequest
-> f VpcInterfaceRequest
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
vpcInterfaceRequest_roleArn :: Lens.Lens' VpcInterfaceRequest Prelude.Text
vpcInterfaceRequest_roleArn :: (Text -> f Text) -> VpcInterfaceRequest -> f VpcInterfaceRequest
vpcInterfaceRequest_roleArn = (VpcInterfaceRequest -> Text)
-> (VpcInterfaceRequest -> Text -> VpcInterfaceRequest)
-> Lens VpcInterfaceRequest VpcInterfaceRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcInterfaceRequest' {Text
roleArn :: Text
$sel:roleArn:VpcInterfaceRequest' :: VpcInterfaceRequest -> Text
roleArn} -> Text
roleArn) (\s :: VpcInterfaceRequest
s@VpcInterfaceRequest' {} Text
a -> VpcInterfaceRequest
s {$sel:roleArn:VpcInterfaceRequest' :: Text
roleArn = Text
a} :: VpcInterfaceRequest)

-- | The name of the VPC Interface. This value must be unique within the
-- current flow.
vpcInterfaceRequest_name :: Lens.Lens' VpcInterfaceRequest Prelude.Text
vpcInterfaceRequest_name :: (Text -> f Text) -> VpcInterfaceRequest -> f VpcInterfaceRequest
vpcInterfaceRequest_name = (VpcInterfaceRequest -> Text)
-> (VpcInterfaceRequest -> Text -> VpcInterfaceRequest)
-> Lens VpcInterfaceRequest VpcInterfaceRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcInterfaceRequest' {Text
name :: Text
$sel:name:VpcInterfaceRequest' :: VpcInterfaceRequest -> Text
name} -> Text
name) (\s :: VpcInterfaceRequest
s@VpcInterfaceRequest' {} Text
a -> VpcInterfaceRequest
s {$sel:name:VpcInterfaceRequest' :: Text
name = Text
a} :: VpcInterfaceRequest)

instance Prelude.Hashable VpcInterfaceRequest

instance Prelude.NFData VpcInterfaceRequest

instance Core.ToJSON VpcInterfaceRequest where
  toJSON :: VpcInterfaceRequest -> Value
toJSON VpcInterfaceRequest' {[Text]
Maybe NetworkInterfaceType
Text
name :: Text
roleArn :: Text
securityGroupIds :: [Text]
subnetId :: Text
networkInterfaceType :: Maybe NetworkInterfaceType
$sel:name:VpcInterfaceRequest' :: VpcInterfaceRequest -> Text
$sel:roleArn:VpcInterfaceRequest' :: VpcInterfaceRequest -> Text
$sel:securityGroupIds:VpcInterfaceRequest' :: VpcInterfaceRequest -> [Text]
$sel:subnetId:VpcInterfaceRequest' :: VpcInterfaceRequest -> Text
$sel:networkInterfaceType:VpcInterfaceRequest' :: VpcInterfaceRequest -> Maybe NetworkInterfaceType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"networkInterfaceType" Text -> NetworkInterfaceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NetworkInterfaceType -> Pair)
-> Maybe NetworkInterfaceType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NetworkInterfaceType
networkInterfaceType,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"subnetId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
subnetId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"securityGroupIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
securityGroupIds),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
          ]
      )