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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(InputVpcRequest -> InputVpcRequest -> Bool)
-> (InputVpcRequest -> InputVpcRequest -> Bool)
-> Eq InputVpcRequest
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]
(Int -> ReadS InputVpcRequest)
-> ReadS [InputVpcRequest]
-> ReadPrec InputVpcRequest
-> ReadPrec [InputVpcRequest]
-> Read 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
(Int -> InputVpcRequest -> ShowS)
-> (InputVpcRequest -> String)
-> ([InputVpcRequest] -> ShowS)
-> Show InputVpcRequest
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. InputVpcRequest -> Rep InputVpcRequest x)
-> (forall x. Rep InputVpcRequest x -> InputVpcRequest)
-> Generic InputVpcRequest
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' :: Maybe [Text] -> [Text] -> InputVpcRequest
InputVpcRequest'
    { $sel:securityGroupIds:InputVpcRequest' :: Maybe [Text]
securityGroupIds =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:InputVpcRequest' :: [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 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 :: (Maybe [Text] -> f (Maybe [Text]))
-> InputVpcRequest -> f InputVpcRequest
inputVpcRequest_securityGroupIds = (InputVpcRequest -> Maybe [Text])
-> (InputVpcRequest -> Maybe [Text] -> InputVpcRequest)
-> Lens
     InputVpcRequest InputVpcRequest (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> InputVpcRequest -> f InputVpcRequest)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> InputVpcRequest
-> f InputVpcRequest
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 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 :: ([Text] -> f [Text]) -> InputVpcRequest -> f InputVpcRequest
inputVpcRequest_subnetIds = (InputVpcRequest -> [Text])
-> (InputVpcRequest -> [Text] -> InputVpcRequest)
-> Lens InputVpcRequest InputVpcRequest [Text] [Text]
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) (([Text] -> f [Text]) -> InputVpcRequest -> f InputVpcRequest)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> InputVpcRequest
-> f InputVpcRequest
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 InputVpcRequest

instance Prelude.NFData InputVpcRequest

instance Core.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
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,
            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)
          ]
      )