{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoT.Types.VpcDestinationProperties 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 of a virtual private cloud (VPC) destination.
--
-- /See:/ 'newVpcDestinationProperties' smart constructor.
data VpcDestinationProperties = VpcDestinationProperties'
  { -- | 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,
    -- | 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
  }
  deriving (VpcDestinationProperties -> VpcDestinationProperties -> Bool
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]
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
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.
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:
--
-- 'roleArn', 'vpcDestinationProperties_roleArn' - The ARN of a role that has permission to create and attach to elastic
-- network interfaces (ENIs).
--
-- '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.
newVpcDestinationProperties ::
  VpcDestinationProperties
newVpcDestinationProperties :: VpcDestinationProperties
newVpcDestinationProperties =
  VpcDestinationProperties'
    { $sel:roleArn:VpcDestinationProperties' :: Maybe Text
roleArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:securityGroups:VpcDestinationProperties' :: Maybe [Text]
securityGroups = forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:VpcDestinationProperties' :: Maybe [Text]
subnetIds = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcId:VpcDestinationProperties' :: Maybe Text
vpcId = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' VpcDestinationProperties (Maybe Text)
vpcDestinationProperties_roleArn = 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)

-- | The security groups of the VPC destination.
vpcDestinationProperties_securityGroups :: Lens.Lens' VpcDestinationProperties (Prelude.Maybe [Prelude.Text])
vpcDestinationProperties_securityGroups :: Lens' VpcDestinationProperties (Maybe [Text])
vpcDestinationProperties_securityGroups = 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) 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

-- | The subnet IDs of the VPC destination.
vpcDestinationProperties_subnetIds :: Lens.Lens' VpcDestinationProperties (Prelude.Maybe [Prelude.Text])
vpcDestinationProperties_subnetIds :: Lens' VpcDestinationProperties (Maybe [Text])
vpcDestinationProperties_subnetIds = 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) 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

-- | The ID of the VPC.
vpcDestinationProperties_vpcId :: Lens.Lens' VpcDestinationProperties (Prelude.Maybe Prelude.Text)
vpcDestinationProperties_vpcId :: Lens' VpcDestinationProperties (Maybe Text)
vpcDestinationProperties_vpcId = 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)

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

instance Prelude.Hashable VpcDestinationProperties where
  hashWithSalt :: Int -> VpcDestinationProperties -> Int
hashWithSalt Int
_salt VpcDestinationProperties' {Maybe [Text]
Maybe Text
vpcId :: Maybe Text
subnetIds :: Maybe [Text]
securityGroups :: Maybe [Text]
roleArn :: Maybe Text
$sel:vpcId:VpcDestinationProperties' :: VpcDestinationProperties -> Maybe Text
$sel:subnetIds:VpcDestinationProperties' :: VpcDestinationProperties -> Maybe [Text]
$sel:securityGroups:VpcDestinationProperties' :: VpcDestinationProperties -> Maybe [Text]
$sel:roleArn:VpcDestinationProperties' :: VpcDestinationProperties -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
securityGroups
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
subnetIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpcId

instance Prelude.NFData VpcDestinationProperties where
  rnf :: VpcDestinationProperties -> ()
rnf VpcDestinationProperties' {Maybe [Text]
Maybe Text
vpcId :: Maybe Text
subnetIds :: Maybe [Text]
securityGroups :: Maybe [Text]
roleArn :: Maybe Text
$sel:vpcId:VpcDestinationProperties' :: VpcDestinationProperties -> Maybe Text
$sel:subnetIds:VpcDestinationProperties' :: VpcDestinationProperties -> Maybe [Text]
$sel:securityGroups:VpcDestinationProperties' :: VpcDestinationProperties -> Maybe [Text]
$sel:roleArn:VpcDestinationProperties' :: VpcDestinationProperties -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
securityGroups
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
subnetIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vpcId