{-# 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.IoT.Types.VpcDestinationConfiguration
-- 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.IoT.Types.VpcDestinationConfiguration where

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

-- | The configuration information for a virtual private cloud (VPC)
-- destination.
--
-- /See:/ 'newVpcDestinationConfiguration' smart constructor.
data VpcDestinationConfiguration = VpcDestinationConfiguration'
  { -- | The security groups of the VPC destination.
    VpcDestinationConfiguration -> Maybe [Text]
securityGroups :: Prelude.Maybe [Prelude.Text],
    -- | The subnet IDs of the VPC destination.
    VpcDestinationConfiguration -> [Text]
subnetIds :: [Prelude.Text],
    -- | The ID of the VPC.
    VpcDestinationConfiguration -> Text
vpcId :: Prelude.Text,
    -- | The ARN of a role that has permission to create and attach to elastic
    -- network interfaces (ENIs).
    VpcDestinationConfiguration -> Text
roleArn :: Prelude.Text
  }
  deriving (VpcDestinationConfiguration -> VpcDestinationConfiguration -> Bool
(VpcDestinationConfiguration
 -> VpcDestinationConfiguration -> Bool)
-> (VpcDestinationConfiguration
    -> VpcDestinationConfiguration -> Bool)
-> Eq VpcDestinationConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcDestinationConfiguration -> VpcDestinationConfiguration -> Bool
$c/= :: VpcDestinationConfiguration -> VpcDestinationConfiguration -> Bool
== :: VpcDestinationConfiguration -> VpcDestinationConfiguration -> Bool
$c== :: VpcDestinationConfiguration -> VpcDestinationConfiguration -> Bool
Prelude.Eq, ReadPrec [VpcDestinationConfiguration]
ReadPrec VpcDestinationConfiguration
Int -> ReadS VpcDestinationConfiguration
ReadS [VpcDestinationConfiguration]
(Int -> ReadS VpcDestinationConfiguration)
-> ReadS [VpcDestinationConfiguration]
-> ReadPrec VpcDestinationConfiguration
-> ReadPrec [VpcDestinationConfiguration]
-> Read VpcDestinationConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcDestinationConfiguration]
$creadListPrec :: ReadPrec [VpcDestinationConfiguration]
readPrec :: ReadPrec VpcDestinationConfiguration
$creadPrec :: ReadPrec VpcDestinationConfiguration
readList :: ReadS [VpcDestinationConfiguration]
$creadList :: ReadS [VpcDestinationConfiguration]
readsPrec :: Int -> ReadS VpcDestinationConfiguration
$creadsPrec :: Int -> ReadS VpcDestinationConfiguration
Prelude.Read, Int -> VpcDestinationConfiguration -> ShowS
[VpcDestinationConfiguration] -> ShowS
VpcDestinationConfiguration -> String
(Int -> VpcDestinationConfiguration -> ShowS)
-> (VpcDestinationConfiguration -> String)
-> ([VpcDestinationConfiguration] -> ShowS)
-> Show VpcDestinationConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcDestinationConfiguration] -> ShowS
$cshowList :: [VpcDestinationConfiguration] -> ShowS
show :: VpcDestinationConfiguration -> String
$cshow :: VpcDestinationConfiguration -> String
showsPrec :: Int -> VpcDestinationConfiguration -> ShowS
$cshowsPrec :: Int -> VpcDestinationConfiguration -> ShowS
Prelude.Show, (forall x.
 VpcDestinationConfiguration -> Rep VpcDestinationConfiguration x)
-> (forall x.
    Rep VpcDestinationConfiguration x -> VpcDestinationConfiguration)
-> Generic VpcDestinationConfiguration
forall x.
Rep VpcDestinationConfiguration x -> VpcDestinationConfiguration
forall x.
VpcDestinationConfiguration -> Rep VpcDestinationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VpcDestinationConfiguration x -> VpcDestinationConfiguration
$cfrom :: forall x.
VpcDestinationConfiguration -> Rep VpcDestinationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'VpcDestinationConfiguration' 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:
--
-- 'securityGroups', 'vpcDestinationConfiguration_securityGroups' - The security groups of the VPC destination.
--
-- 'subnetIds', 'vpcDestinationConfiguration_subnetIds' - The subnet IDs of the VPC destination.
--
-- 'vpcId', 'vpcDestinationConfiguration_vpcId' - The ID of the VPC.
--
-- 'roleArn', 'vpcDestinationConfiguration_roleArn' - The ARN of a role that has permission to create and attach to elastic
-- network interfaces (ENIs).
newVpcDestinationConfiguration ::
  -- | 'vpcId'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  VpcDestinationConfiguration
newVpcDestinationConfiguration :: Text -> Text -> VpcDestinationConfiguration
newVpcDestinationConfiguration Text
pVpcId_ Text
pRoleArn_ =
  VpcDestinationConfiguration' :: Maybe [Text]
-> [Text] -> Text -> Text -> VpcDestinationConfiguration
VpcDestinationConfiguration'
    { $sel:securityGroups:VpcDestinationConfiguration' :: Maybe [Text]
securityGroups =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:VpcDestinationConfiguration' :: [Text]
subnetIds = [Text]
forall a. Monoid a => a
Prelude.mempty,
      $sel:vpcId:VpcDestinationConfiguration' :: Text
vpcId = Text
pVpcId_,
      $sel:roleArn:VpcDestinationConfiguration' :: Text
roleArn = Text
pRoleArn_
    }

-- | The security groups of the VPC destination.
vpcDestinationConfiguration_securityGroups :: Lens.Lens' VpcDestinationConfiguration (Prelude.Maybe [Prelude.Text])
vpcDestinationConfiguration_securityGroups :: (Maybe [Text] -> f (Maybe [Text]))
-> VpcDestinationConfiguration -> f VpcDestinationConfiguration
vpcDestinationConfiguration_securityGroups = (VpcDestinationConfiguration -> Maybe [Text])
-> (VpcDestinationConfiguration
    -> Maybe [Text] -> VpcDestinationConfiguration)
-> Lens
     VpcDestinationConfiguration
     VpcDestinationConfiguration
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcDestinationConfiguration' {Maybe [Text]
securityGroups :: Maybe [Text]
$sel:securityGroups:VpcDestinationConfiguration' :: VpcDestinationConfiguration -> Maybe [Text]
securityGroups} -> Maybe [Text]
securityGroups) (\s :: VpcDestinationConfiguration
s@VpcDestinationConfiguration' {} Maybe [Text]
a -> VpcDestinationConfiguration
s {$sel:securityGroups:VpcDestinationConfiguration' :: Maybe [Text]
securityGroups = Maybe [Text]
a} :: VpcDestinationConfiguration) ((Maybe [Text] -> f (Maybe [Text]))
 -> VpcDestinationConfiguration -> f VpcDestinationConfiguration)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VpcDestinationConfiguration
-> f VpcDestinationConfiguration
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

-- | The subnet IDs of the VPC destination.
vpcDestinationConfiguration_subnetIds :: Lens.Lens' VpcDestinationConfiguration [Prelude.Text]
vpcDestinationConfiguration_subnetIds :: ([Text] -> f [Text])
-> VpcDestinationConfiguration -> f VpcDestinationConfiguration
vpcDestinationConfiguration_subnetIds = (VpcDestinationConfiguration -> [Text])
-> (VpcDestinationConfiguration
    -> [Text] -> VpcDestinationConfiguration)
-> Lens
     VpcDestinationConfiguration
     VpcDestinationConfiguration
     [Text]
     [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcDestinationConfiguration' {[Text]
subnetIds :: [Text]
$sel:subnetIds:VpcDestinationConfiguration' :: VpcDestinationConfiguration -> [Text]
subnetIds} -> [Text]
subnetIds) (\s :: VpcDestinationConfiguration
s@VpcDestinationConfiguration' {} [Text]
a -> VpcDestinationConfiguration
s {$sel:subnetIds:VpcDestinationConfiguration' :: [Text]
subnetIds = [Text]
a} :: VpcDestinationConfiguration) (([Text] -> f [Text])
 -> VpcDestinationConfiguration -> f VpcDestinationConfiguration)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> VpcDestinationConfiguration
-> f VpcDestinationConfiguration
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

-- | The ID of the VPC.
vpcDestinationConfiguration_vpcId :: Lens.Lens' VpcDestinationConfiguration Prelude.Text
vpcDestinationConfiguration_vpcId :: (Text -> f Text)
-> VpcDestinationConfiguration -> f VpcDestinationConfiguration
vpcDestinationConfiguration_vpcId = (VpcDestinationConfiguration -> Text)
-> (VpcDestinationConfiguration
    -> Text -> VpcDestinationConfiguration)
-> Lens
     VpcDestinationConfiguration VpcDestinationConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcDestinationConfiguration' {Text
vpcId :: Text
$sel:vpcId:VpcDestinationConfiguration' :: VpcDestinationConfiguration -> Text
vpcId} -> Text
vpcId) (\s :: VpcDestinationConfiguration
s@VpcDestinationConfiguration' {} Text
a -> VpcDestinationConfiguration
s {$sel:vpcId:VpcDestinationConfiguration' :: Text
vpcId = Text
a} :: VpcDestinationConfiguration)

-- | The ARN of a role that has permission to create and attach to elastic
-- network interfaces (ENIs).
vpcDestinationConfiguration_roleArn :: Lens.Lens' VpcDestinationConfiguration Prelude.Text
vpcDestinationConfiguration_roleArn :: (Text -> f Text)
-> VpcDestinationConfiguration -> f VpcDestinationConfiguration
vpcDestinationConfiguration_roleArn = (VpcDestinationConfiguration -> Text)
-> (VpcDestinationConfiguration
    -> Text -> VpcDestinationConfiguration)
-> Lens
     VpcDestinationConfiguration VpcDestinationConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcDestinationConfiguration' {Text
roleArn :: Text
$sel:roleArn:VpcDestinationConfiguration' :: VpcDestinationConfiguration -> Text
roleArn} -> Text
roleArn) (\s :: VpcDestinationConfiguration
s@VpcDestinationConfiguration' {} Text
a -> VpcDestinationConfiguration
s {$sel:roleArn:VpcDestinationConfiguration' :: Text
roleArn = Text
a} :: VpcDestinationConfiguration)

instance Prelude.Hashable VpcDestinationConfiguration

instance Prelude.NFData VpcDestinationConfiguration

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