{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaLive.Types.VpcOutputSettings 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 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'
  { -- | 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 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],
    -- | 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
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]
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
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. 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:
--
-- '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
--
-- '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
--
-- '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'
    { $sel:publicAddressAllocationIds:VpcOutputSettings' :: Maybe [Text]
publicAddressAllocationIds =
        forall a. Maybe a
Prelude.Nothing,
      $sel:securityGroupIds:VpcOutputSettings' :: Maybe [Text]
securityGroupIds = forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:VpcOutputSettings' :: [Text]
subnetIds = forall a. Monoid a => a
Prelude.mempty
    }

-- | 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 :: Lens' VpcOutputSettings (Maybe [Text])
vpcOutputSettings_publicAddressAllocationIds = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: Lens' VpcOutputSettings (Maybe [Text])
vpcOutputSettings_securityGroupIds = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' VpcOutputSettings [Text]
vpcOutputSettings_subnetIds = 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) 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

instance Prelude.Hashable VpcOutputSettings where
  hashWithSalt :: Int -> VpcOutputSettings -> Int
hashWithSalt Int
_salt VpcOutputSettings' {[Text]
Maybe [Text]
subnetIds :: [Text]
securityGroupIds :: Maybe [Text]
publicAddressAllocationIds :: Maybe [Text]
$sel:subnetIds:VpcOutputSettings' :: VpcOutputSettings -> [Text]
$sel:securityGroupIds:VpcOutputSettings' :: VpcOutputSettings -> Maybe [Text]
$sel:publicAddressAllocationIds:VpcOutputSettings' :: VpcOutputSettings -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
publicAddressAllocationIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
securityGroupIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
subnetIds

instance Prelude.NFData VpcOutputSettings where
  rnf :: VpcOutputSettings -> ()
rnf VpcOutputSettings' {[Text]
Maybe [Text]
subnetIds :: [Text]
securityGroupIds :: Maybe [Text]
publicAddressAllocationIds :: Maybe [Text]
$sel:subnetIds:VpcOutputSettings' :: VpcOutputSettings -> [Text]
$sel:securityGroupIds:VpcOutputSettings' :: VpcOutputSettings -> Maybe [Text]
$sel:publicAddressAllocationIds:VpcOutputSettings' :: VpcOutputSettings -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
publicAddressAllocationIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
securityGroupIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
subnetIds

instance Data.ToJSON VpcOutputSettings where
  toJSON :: VpcOutputSettings -> Value
toJSON VpcOutputSettings' {[Text]
Maybe [Text]
subnetIds :: [Text]
securityGroupIds :: Maybe [Text]
publicAddressAllocationIds :: Maybe [Text]
$sel:subnetIds:VpcOutputSettings' :: VpcOutputSettings -> [Text]
$sel:securityGroupIds:VpcOutputSettings' :: VpcOutputSettings -> Maybe [Text]
$sel:publicAddressAllocationIds:VpcOutputSettings' :: VpcOutputSettings -> Maybe [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"publicAddressAllocationIds" 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]
publicAddressAllocationIds,
            (Key
"securityGroupIds" 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]
securityGroupIds,
            forall a. a -> Maybe a
Prelude.Just (Key
"subnetIds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
subnetIds)
          ]
      )