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

-- |
-- Create a value of 'VpcDestinationSummary' 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', 'vpcDestinationSummary_roleArn' - The ARN of a role that has permission to create and attach to elastic
-- network interfaces (ENIs).
--
-- 'securityGroups', 'vpcDestinationSummary_securityGroups' - The security groups of the VPC destination.
--
-- 'subnetIds', 'vpcDestinationSummary_subnetIds' - The subnet IDs of the VPC destination.
--
-- 'vpcId', 'vpcDestinationSummary_vpcId' - The ID of the VPC.
newVpcDestinationSummary ::
  VpcDestinationSummary
newVpcDestinationSummary :: VpcDestinationSummary
newVpcDestinationSummary =
  VpcDestinationSummary'
    { $sel:roleArn:VpcDestinationSummary' :: Maybe Text
roleArn = forall a. Maybe a
Prelude.Nothing,
      $sel:securityGroups:VpcDestinationSummary' :: Maybe [Text]
securityGroups = forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:VpcDestinationSummary' :: Maybe [Text]
subnetIds = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcId:VpcDestinationSummary' :: 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).
vpcDestinationSummary_roleArn :: Lens.Lens' VpcDestinationSummary (Prelude.Maybe Prelude.Text)
vpcDestinationSummary_roleArn :: Lens' VpcDestinationSummary (Maybe Text)
vpcDestinationSummary_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcDestinationSummary' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:VpcDestinationSummary' :: VpcDestinationSummary -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: VpcDestinationSummary
s@VpcDestinationSummary' {} Maybe Text
a -> VpcDestinationSummary
s {$sel:roleArn:VpcDestinationSummary' :: Maybe Text
roleArn = Maybe Text
a} :: VpcDestinationSummary)

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

instance Data.FromJSON VpcDestinationSummary where
  parseJSON :: Value -> Parser VpcDestinationSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VpcDestinationSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe [Text]
-> Maybe [Text]
-> Maybe Text
-> VpcDestinationSummary
VpcDestinationSummary'
            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 VpcDestinationSummary where
  hashWithSalt :: Int -> VpcDestinationSummary -> Int
hashWithSalt Int
_salt VpcDestinationSummary' {Maybe [Text]
Maybe Text
vpcId :: Maybe Text
subnetIds :: Maybe [Text]
securityGroups :: Maybe [Text]
roleArn :: Maybe Text
$sel:vpcId:VpcDestinationSummary' :: VpcDestinationSummary -> Maybe Text
$sel:subnetIds:VpcDestinationSummary' :: VpcDestinationSummary -> Maybe [Text]
$sel:securityGroups:VpcDestinationSummary' :: VpcDestinationSummary -> Maybe [Text]
$sel:roleArn:VpcDestinationSummary' :: VpcDestinationSummary -> 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 VpcDestinationSummary where
  rnf :: VpcDestinationSummary -> ()
rnf VpcDestinationSummary' {Maybe [Text]
Maybe Text
vpcId :: Maybe Text
subnetIds :: Maybe [Text]
securityGroups :: Maybe [Text]
roleArn :: Maybe Text
$sel:vpcId:VpcDestinationSummary' :: VpcDestinationSummary -> Maybe Text
$sel:subnetIds:VpcDestinationSummary' :: VpcDestinationSummary -> Maybe [Text]
$sel:securityGroups:VpcDestinationSummary' :: VpcDestinationSummary -> Maybe [Text]
$sel:roleArn:VpcDestinationSummary' :: VpcDestinationSummary -> 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