{-# 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.MediaLive.Types.VpcOutputSettings
-- 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.MediaLive.Types.VpcOutputSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The properties for a private VPC Output When this property is specified,
-- the output egress addresses will be created in a user specified VPC
--
-- /See:/ 'newVpcOutputSettings' smart constructor.
data VpcOutputSettings = VpcOutputSettings'
  { -- | A list of up to 5 EC2 VPC security group IDs to attach to the Output VPC
    -- network interfaces. If none are specified then the VPC default security
    -- group will be used
    VpcOutputSettings -> Maybe [Text]
securityGroupIds :: Prelude.Maybe [Prelude.Text],
    -- | List of public address allocation ids to associate with ENIs that will
    -- be created in Output VPC. Must specify one for SINGLE_PIPELINE, two for
    -- STANDARD channels
    VpcOutputSettings -> Maybe [Text]
publicAddressAllocationIds :: Prelude.Maybe [Prelude.Text],
    -- | A list of VPC subnet IDs from the same VPC. If STANDARD channel, subnet
    -- IDs must be mapped to two unique availability zones (AZ).
    VpcOutputSettings -> [Text]
subnetIds :: [Prelude.Text]
  }
  deriving (VpcOutputSettings -> VpcOutputSettings -> Bool
(VpcOutputSettings -> VpcOutputSettings -> Bool)
-> (VpcOutputSettings -> VpcOutputSettings -> Bool)
-> Eq VpcOutputSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcOutputSettings -> VpcOutputSettings -> Bool
$c/= :: VpcOutputSettings -> VpcOutputSettings -> Bool
== :: VpcOutputSettings -> VpcOutputSettings -> Bool
$c== :: VpcOutputSettings -> VpcOutputSettings -> Bool
Prelude.Eq, ReadPrec [VpcOutputSettings]
ReadPrec VpcOutputSettings
Int -> ReadS VpcOutputSettings
ReadS [VpcOutputSettings]
(Int -> ReadS VpcOutputSettings)
-> ReadS [VpcOutputSettings]
-> ReadPrec VpcOutputSettings
-> ReadPrec [VpcOutputSettings]
-> Read VpcOutputSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcOutputSettings]
$creadListPrec :: ReadPrec [VpcOutputSettings]
readPrec :: ReadPrec VpcOutputSettings
$creadPrec :: ReadPrec VpcOutputSettings
readList :: ReadS [VpcOutputSettings]
$creadList :: ReadS [VpcOutputSettings]
readsPrec :: Int -> ReadS VpcOutputSettings
$creadsPrec :: Int -> ReadS VpcOutputSettings
Prelude.Read, Int -> VpcOutputSettings -> ShowS
[VpcOutputSettings] -> ShowS
VpcOutputSettings -> String
(Int -> VpcOutputSettings -> ShowS)
-> (VpcOutputSettings -> String)
-> ([VpcOutputSettings] -> ShowS)
-> Show VpcOutputSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcOutputSettings] -> ShowS
$cshowList :: [VpcOutputSettings] -> ShowS
show :: VpcOutputSettings -> String
$cshow :: VpcOutputSettings -> String
showsPrec :: Int -> VpcOutputSettings -> ShowS
$cshowsPrec :: Int -> VpcOutputSettings -> ShowS
Prelude.Show, (forall x. VpcOutputSettings -> Rep VpcOutputSettings x)
-> (forall x. Rep VpcOutputSettings x -> VpcOutputSettings)
-> Generic VpcOutputSettings
forall x. Rep VpcOutputSettings x -> VpcOutputSettings
forall x. VpcOutputSettings -> Rep VpcOutputSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpcOutputSettings x -> VpcOutputSettings
$cfrom :: forall x. VpcOutputSettings -> Rep VpcOutputSettings x
Prelude.Generic)

-- |
-- Create a value of 'VpcOutputSettings' 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:
--
-- 'securityGroupIds', 'vpcOutputSettings_securityGroupIds' - A list of up to 5 EC2 VPC security group IDs to attach to the Output VPC
-- network interfaces. If none are specified then the VPC default security
-- group will be used
--
-- 'publicAddressAllocationIds', 'vpcOutputSettings_publicAddressAllocationIds' - List of public address allocation ids to associate with ENIs that will
-- be created in Output VPC. Must specify one for SINGLE_PIPELINE, two for
-- STANDARD channels
--
-- 'subnetIds', 'vpcOutputSettings_subnetIds' - A list of VPC subnet IDs from the same VPC. If STANDARD channel, subnet
-- IDs must be mapped to two unique availability zones (AZ).
newVpcOutputSettings ::
  VpcOutputSettings
newVpcOutputSettings :: VpcOutputSettings
newVpcOutputSettings =
  VpcOutputSettings' :: Maybe [Text] -> Maybe [Text] -> [Text] -> VpcOutputSettings
VpcOutputSettings'
    { $sel:securityGroupIds:VpcOutputSettings' :: Maybe [Text]
securityGroupIds =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:publicAddressAllocationIds:VpcOutputSettings' :: Maybe [Text]
publicAddressAllocationIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:VpcOutputSettings' :: [Text]
subnetIds = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | A list of up to 5 EC2 VPC security group IDs to attach to the Output VPC
-- network interfaces. If none are specified then the VPC default security
-- group will be used
vpcOutputSettings_securityGroupIds :: Lens.Lens' VpcOutputSettings (Prelude.Maybe [Prelude.Text])
vpcOutputSettings_securityGroupIds :: (Maybe [Text] -> f (Maybe [Text]))
-> VpcOutputSettings -> f VpcOutputSettings
vpcOutputSettings_securityGroupIds = (VpcOutputSettings -> Maybe [Text])
-> (VpcOutputSettings -> Maybe [Text] -> VpcOutputSettings)
-> Lens
     VpcOutputSettings VpcOutputSettings (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcOutputSettings' {Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:securityGroupIds:VpcOutputSettings' :: VpcOutputSettings -> Maybe [Text]
securityGroupIds} -> Maybe [Text]
securityGroupIds) (\s :: VpcOutputSettings
s@VpcOutputSettings' {} Maybe [Text]
a -> VpcOutputSettings
s {$sel:securityGroupIds:VpcOutputSettings' :: Maybe [Text]
securityGroupIds = Maybe [Text]
a} :: VpcOutputSettings) ((Maybe [Text] -> f (Maybe [Text]))
 -> VpcOutputSettings -> f VpcOutputSettings)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VpcOutputSettings
-> f VpcOutputSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | List of public address allocation ids to associate with ENIs that will
-- be created in Output VPC. Must specify one for SINGLE_PIPELINE, two for
-- STANDARD channels
vpcOutputSettings_publicAddressAllocationIds :: Lens.Lens' VpcOutputSettings (Prelude.Maybe [Prelude.Text])
vpcOutputSettings_publicAddressAllocationIds :: (Maybe [Text] -> f (Maybe [Text]))
-> VpcOutputSettings -> f VpcOutputSettings
vpcOutputSettings_publicAddressAllocationIds = (VpcOutputSettings -> Maybe [Text])
-> (VpcOutputSettings -> Maybe [Text] -> VpcOutputSettings)
-> Lens
     VpcOutputSettings VpcOutputSettings (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcOutputSettings' {Maybe [Text]
publicAddressAllocationIds :: Maybe [Text]
$sel:publicAddressAllocationIds:VpcOutputSettings' :: VpcOutputSettings -> Maybe [Text]
publicAddressAllocationIds} -> Maybe [Text]
publicAddressAllocationIds) (\s :: VpcOutputSettings
s@VpcOutputSettings' {} Maybe [Text]
a -> VpcOutputSettings
s {$sel:publicAddressAllocationIds:VpcOutputSettings' :: Maybe [Text]
publicAddressAllocationIds = Maybe [Text]
a} :: VpcOutputSettings) ((Maybe [Text] -> f (Maybe [Text]))
 -> VpcOutputSettings -> f VpcOutputSettings)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VpcOutputSettings
-> f VpcOutputSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of VPC subnet IDs from the same VPC. If STANDARD channel, subnet
-- IDs must be mapped to two unique availability zones (AZ).
vpcOutputSettings_subnetIds :: Lens.Lens' VpcOutputSettings [Prelude.Text]
vpcOutputSettings_subnetIds :: ([Text] -> f [Text]) -> VpcOutputSettings -> f VpcOutputSettings
vpcOutputSettings_subnetIds = (VpcOutputSettings -> [Text])
-> (VpcOutputSettings -> [Text] -> VpcOutputSettings)
-> Lens VpcOutputSettings VpcOutputSettings [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcOutputSettings' {[Text]
subnetIds :: [Text]
$sel:subnetIds:VpcOutputSettings' :: VpcOutputSettings -> [Text]
subnetIds} -> [Text]
subnetIds) (\s :: VpcOutputSettings
s@VpcOutputSettings' {} [Text]
a -> VpcOutputSettings
s {$sel:subnetIds:VpcOutputSettings' :: [Text]
subnetIds = [Text]
a} :: VpcOutputSettings) (([Text] -> f [Text]) -> VpcOutputSettings -> f VpcOutputSettings)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> VpcOutputSettings
-> f VpcOutputSettings
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

instance Prelude.Hashable VpcOutputSettings

instance Prelude.NFData VpcOutputSettings

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