{-# 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.InputVpcRequest
-- 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.InputVpcRequest 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

-- | Settings for a private VPC Input. When this property is specified, the
-- input destination addresses will be created in a VPC rather than with
-- public Internet addresses. This property requires setting the roleArn
-- property on Input creation. Not compatible with the inputSecurityGroups
-- property.
--
-- /See:/ 'newInputVpcRequest' smart constructor.
data InputVpcRequest = InputVpcRequest'
  { -- | A list of up to 5 EC2 VPC security group IDs to attach to the Input VPC
    -- network interfaces. Requires subnetIds. If none are specified then the
    -- VPC default security group will be used.
    InputVpcRequest -> Maybe [Text]
securityGroupIds :: Prelude.Maybe [Prelude.Text],
    -- | A list of 2 VPC subnet IDs from the same VPC. Subnet IDs must be mapped
    -- to two unique availability zones (AZ).
    InputVpcRequest -> [Text]
subnetIds :: [Prelude.Text]
  }
  deriving (InputVpcRequest -> InputVpcRequest -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputVpcRequest -> InputVpcRequest -> Bool
$c/= :: InputVpcRequest -> InputVpcRequest -> Bool
== :: InputVpcRequest -> InputVpcRequest -> Bool
$c== :: InputVpcRequest -> InputVpcRequest -> Bool
Prelude.Eq, ReadPrec [InputVpcRequest]
ReadPrec InputVpcRequest
Int -> ReadS InputVpcRequest
ReadS [InputVpcRequest]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputVpcRequest]
$creadListPrec :: ReadPrec [InputVpcRequest]
readPrec :: ReadPrec InputVpcRequest
$creadPrec :: ReadPrec InputVpcRequest
readList :: ReadS [InputVpcRequest]
$creadList :: ReadS [InputVpcRequest]
readsPrec :: Int -> ReadS InputVpcRequest
$creadsPrec :: Int -> ReadS InputVpcRequest
Prelude.Read, Int -> InputVpcRequest -> ShowS
[InputVpcRequest] -> ShowS
InputVpcRequest -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputVpcRequest] -> ShowS
$cshowList :: [InputVpcRequest] -> ShowS
show :: InputVpcRequest -> String
$cshow :: InputVpcRequest -> String
showsPrec :: Int -> InputVpcRequest -> ShowS
$cshowsPrec :: Int -> InputVpcRequest -> ShowS
Prelude.Show, forall x. Rep InputVpcRequest x -> InputVpcRequest
forall x. InputVpcRequest -> Rep InputVpcRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputVpcRequest x -> InputVpcRequest
$cfrom :: forall x. InputVpcRequest -> Rep InputVpcRequest x
Prelude.Generic)

-- |
-- Create a value of 'InputVpcRequest' 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', 'inputVpcRequest_securityGroupIds' - A list of up to 5 EC2 VPC security group IDs to attach to the Input VPC
-- network interfaces. Requires subnetIds. If none are specified then the
-- VPC default security group will be used.
--
-- 'subnetIds', 'inputVpcRequest_subnetIds' - A list of 2 VPC subnet IDs from the same VPC. Subnet IDs must be mapped
-- to two unique availability zones (AZ).
newInputVpcRequest ::
  InputVpcRequest
newInputVpcRequest :: InputVpcRequest
newInputVpcRequest =
  InputVpcRequest'
    { $sel:securityGroupIds:InputVpcRequest' :: Maybe [Text]
securityGroupIds =
        forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:InputVpcRequest' :: [Text]
subnetIds = forall a. Monoid a => a
Prelude.mempty
    }

-- | A list of up to 5 EC2 VPC security group IDs to attach to the Input VPC
-- network interfaces. Requires subnetIds. If none are specified then the
-- VPC default security group will be used.
inputVpcRequest_securityGroupIds :: Lens.Lens' InputVpcRequest (Prelude.Maybe [Prelude.Text])
inputVpcRequest_securityGroupIds :: Lens' InputVpcRequest (Maybe [Text])
inputVpcRequest_securityGroupIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputVpcRequest' {Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:securityGroupIds:InputVpcRequest' :: InputVpcRequest -> Maybe [Text]
securityGroupIds} -> Maybe [Text]
securityGroupIds) (\s :: InputVpcRequest
s@InputVpcRequest' {} Maybe [Text]
a -> InputVpcRequest
s {$sel:securityGroupIds:InputVpcRequest' :: Maybe [Text]
securityGroupIds = Maybe [Text]
a} :: InputVpcRequest) 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 2 VPC subnet IDs from the same VPC. Subnet IDs must be mapped
-- to two unique availability zones (AZ).
inputVpcRequest_subnetIds :: Lens.Lens' InputVpcRequest [Prelude.Text]
inputVpcRequest_subnetIds :: Lens' InputVpcRequest [Text]
inputVpcRequest_subnetIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputVpcRequest' {[Text]
subnetIds :: [Text]
$sel:subnetIds:InputVpcRequest' :: InputVpcRequest -> [Text]
subnetIds} -> [Text]
subnetIds) (\s :: InputVpcRequest
s@InputVpcRequest' {} [Text]
a -> InputVpcRequest
s {$sel:subnetIds:InputVpcRequest' :: [Text]
subnetIds = [Text]
a} :: InputVpcRequest) 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 InputVpcRequest where
  hashWithSalt :: Int -> InputVpcRequest -> Int
hashWithSalt Int
_salt InputVpcRequest' {[Text]
Maybe [Text]
subnetIds :: [Text]
securityGroupIds :: Maybe [Text]
$sel:subnetIds:InputVpcRequest' :: InputVpcRequest -> [Text]
$sel:securityGroupIds:InputVpcRequest' :: InputVpcRequest -> Maybe [Text]
..} =
    Int
_salt
      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 InputVpcRequest where
  rnf :: InputVpcRequest -> ()
rnf InputVpcRequest' {[Text]
Maybe [Text]
subnetIds :: [Text]
securityGroupIds :: Maybe [Text]
$sel:subnetIds:InputVpcRequest' :: InputVpcRequest -> [Text]
$sel:securityGroupIds:InputVpcRequest' :: InputVpcRequest -> Maybe [Text]
..} =
    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 InputVpcRequest where
  toJSON :: InputVpcRequest -> Value
toJSON InputVpcRequest' {[Text]
Maybe [Text]
subnetIds :: [Text]
securityGroupIds :: Maybe [Text]
$sel:subnetIds:InputVpcRequest' :: InputVpcRequest -> [Text]
$sel:securityGroupIds:InputVpcRequest' :: InputVpcRequest -> Maybe [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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)
          ]
      )