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

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

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

-- |
-- Create a value of 'VpcDestinationProperties' 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', 'vpcDestinationProperties_securityGroups' - The security groups of the VPC destination.
--
-- 'subnetIds', 'vpcDestinationProperties_subnetIds' - The subnet IDs of the VPC destination.
--
-- 'vpcId', 'vpcDestinationProperties_vpcId' - The ID of the VPC.
--
-- 'roleArn', 'vpcDestinationProperties_roleArn' - The ARN of a role that has permission to create and attach to elastic
-- network interfaces (ENIs).
newVpcDestinationProperties ::
  VpcDestinationProperties
newVpcDestinationProperties :: VpcDestinationProperties
newVpcDestinationProperties =
  VpcDestinationProperties' :: Maybe [Text]
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> VpcDestinationProperties
VpcDestinationProperties'
    { $sel:securityGroups:VpcDestinationProperties' :: Maybe [Text]
securityGroups =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:VpcDestinationProperties' :: Maybe [Text]
subnetIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:vpcId:VpcDestinationProperties' :: Maybe Text
vpcId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:VpcDestinationProperties' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

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

instance Core.FromJSON VpcDestinationProperties where
  parseJSON :: Value -> Parser VpcDestinationProperties
parseJSON =
    String
-> (Object -> Parser VpcDestinationProperties)
-> Value
-> Parser VpcDestinationProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VpcDestinationProperties"
      ( \Object
x ->
          Maybe [Text]
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> VpcDestinationProperties
VpcDestinationProperties'
            (Maybe [Text]
 -> Maybe [Text]
 -> Maybe Text
 -> Maybe Text
 -> VpcDestinationProperties)
-> Parser (Maybe [Text])
-> Parser
     (Maybe [Text]
      -> Maybe Text -> Maybe Text -> VpcDestinationProperties)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"securityGroups" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe [Text]
   -> Maybe Text -> Maybe Text -> VpcDestinationProperties)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> Maybe Text -> VpcDestinationProperties)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"subnetIds" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> Maybe Text -> VpcDestinationProperties)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> VpcDestinationProperties)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"vpcId")
            Parser (Maybe Text -> VpcDestinationProperties)
-> Parser (Maybe Text) -> Parser VpcDestinationProperties
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"roleArn")
      )

instance Prelude.Hashable VpcDestinationProperties

instance Prelude.NFData VpcDestinationProperties