{-# 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.Synthetics.Types.VpcConfigOutput
-- 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.Synthetics.Types.VpcConfigOutput 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

-- | If this canary is to test an endpoint in a VPC, this structure contains
-- information about the subnets and security groups of the VPC endpoint.
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_VPC.html Running a Canary in a VPC>.
--
-- /See:/ 'newVpcConfigOutput' smart constructor.
data VpcConfigOutput = VpcConfigOutput'
  { -- | The IDs of the security groups for this canary.
    VpcConfigOutput -> Maybe [Text]
securityGroupIds :: Prelude.Maybe [Prelude.Text],
    -- | The IDs of the subnets where this canary is to run.
    VpcConfigOutput -> Maybe [Text]
subnetIds :: Prelude.Maybe [Prelude.Text],
    -- | The IDs of the VPC where this canary is to run.
    VpcConfigOutput -> Maybe Text
vpcId :: Prelude.Maybe Prelude.Text
  }
  deriving (VpcConfigOutput -> VpcConfigOutput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcConfigOutput -> VpcConfigOutput -> Bool
$c/= :: VpcConfigOutput -> VpcConfigOutput -> Bool
== :: VpcConfigOutput -> VpcConfigOutput -> Bool
$c== :: VpcConfigOutput -> VpcConfigOutput -> Bool
Prelude.Eq, ReadPrec [VpcConfigOutput]
ReadPrec VpcConfigOutput
Int -> ReadS VpcConfigOutput
ReadS [VpcConfigOutput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcConfigOutput]
$creadListPrec :: ReadPrec [VpcConfigOutput]
readPrec :: ReadPrec VpcConfigOutput
$creadPrec :: ReadPrec VpcConfigOutput
readList :: ReadS [VpcConfigOutput]
$creadList :: ReadS [VpcConfigOutput]
readsPrec :: Int -> ReadS VpcConfigOutput
$creadsPrec :: Int -> ReadS VpcConfigOutput
Prelude.Read, Int -> VpcConfigOutput -> ShowS
[VpcConfigOutput] -> ShowS
VpcConfigOutput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcConfigOutput] -> ShowS
$cshowList :: [VpcConfigOutput] -> ShowS
show :: VpcConfigOutput -> String
$cshow :: VpcConfigOutput -> String
showsPrec :: Int -> VpcConfigOutput -> ShowS
$cshowsPrec :: Int -> VpcConfigOutput -> ShowS
Prelude.Show, forall x. Rep VpcConfigOutput x -> VpcConfigOutput
forall x. VpcConfigOutput -> Rep VpcConfigOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpcConfigOutput x -> VpcConfigOutput
$cfrom :: forall x. VpcConfigOutput -> Rep VpcConfigOutput x
Prelude.Generic)

-- |
-- Create a value of 'VpcConfigOutput' 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', 'vpcConfigOutput_securityGroupIds' - The IDs of the security groups for this canary.
--
-- 'subnetIds', 'vpcConfigOutput_subnetIds' - The IDs of the subnets where this canary is to run.
--
-- 'vpcId', 'vpcConfigOutput_vpcId' - The IDs of the VPC where this canary is to run.
newVpcConfigOutput ::
  VpcConfigOutput
newVpcConfigOutput :: VpcConfigOutput
newVpcConfigOutput =
  VpcConfigOutput'
    { $sel:securityGroupIds:VpcConfigOutput' :: Maybe [Text]
securityGroupIds =
        forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:VpcConfigOutput' :: Maybe [Text]
subnetIds = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcId:VpcConfigOutput' :: Maybe Text
vpcId = forall a. Maybe a
Prelude.Nothing
    }

-- | The IDs of the security groups for this canary.
vpcConfigOutput_securityGroupIds :: Lens.Lens' VpcConfigOutput (Prelude.Maybe [Prelude.Text])
vpcConfigOutput_securityGroupIds :: Lens' VpcConfigOutput (Maybe [Text])
vpcConfigOutput_securityGroupIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfigOutput' {Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:securityGroupIds:VpcConfigOutput' :: VpcConfigOutput -> Maybe [Text]
securityGroupIds} -> Maybe [Text]
securityGroupIds) (\s :: VpcConfigOutput
s@VpcConfigOutput' {} Maybe [Text]
a -> VpcConfigOutput
s {$sel:securityGroupIds:VpcConfigOutput' :: Maybe [Text]
securityGroupIds = Maybe [Text]
a} :: VpcConfigOutput) 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 IDs of the subnets where this canary is to run.
vpcConfigOutput_subnetIds :: Lens.Lens' VpcConfigOutput (Prelude.Maybe [Prelude.Text])
vpcConfigOutput_subnetIds :: Lens' VpcConfigOutput (Maybe [Text])
vpcConfigOutput_subnetIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfigOutput' {Maybe [Text]
subnetIds :: Maybe [Text]
$sel:subnetIds:VpcConfigOutput' :: VpcConfigOutput -> Maybe [Text]
subnetIds} -> Maybe [Text]
subnetIds) (\s :: VpcConfigOutput
s@VpcConfigOutput' {} Maybe [Text]
a -> VpcConfigOutput
s {$sel:subnetIds:VpcConfigOutput' :: Maybe [Text]
subnetIds = Maybe [Text]
a} :: VpcConfigOutput) 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 IDs of the VPC where this canary is to run.
vpcConfigOutput_vpcId :: Lens.Lens' VpcConfigOutput (Prelude.Maybe Prelude.Text)
vpcConfigOutput_vpcId :: Lens' VpcConfigOutput (Maybe Text)
vpcConfigOutput_vpcId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfigOutput' {Maybe Text
vpcId :: Maybe Text
$sel:vpcId:VpcConfigOutput' :: VpcConfigOutput -> Maybe Text
vpcId} -> Maybe Text
vpcId) (\s :: VpcConfigOutput
s@VpcConfigOutput' {} Maybe Text
a -> VpcConfigOutput
s {$sel:vpcId:VpcConfigOutput' :: Maybe Text
vpcId = Maybe Text
a} :: VpcConfigOutput)

instance Data.FromJSON VpcConfigOutput where
  parseJSON :: Value -> Parser VpcConfigOutput
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VpcConfigOutput"
      ( \Object
x ->
          Maybe [Text] -> Maybe [Text] -> Maybe Text -> VpcConfigOutput
VpcConfigOutput'
            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
"SecurityGroupIds"
                            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 VpcConfigOutput where
  hashWithSalt :: Int -> VpcConfigOutput -> Int
hashWithSalt Int
_salt VpcConfigOutput' {Maybe [Text]
Maybe Text
vpcId :: Maybe Text
subnetIds :: Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:vpcId:VpcConfigOutput' :: VpcConfigOutput -> Maybe Text
$sel:subnetIds:VpcConfigOutput' :: VpcConfigOutput -> Maybe [Text]
$sel:securityGroupIds:VpcConfigOutput' :: VpcConfigOutput -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
securityGroupIds
      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 VpcConfigOutput where
  rnf :: VpcConfigOutput -> ()
rnf VpcConfigOutput' {Maybe [Text]
Maybe Text
vpcId :: Maybe Text
subnetIds :: Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:vpcId:VpcConfigOutput' :: VpcConfigOutput -> Maybe Text
$sel:subnetIds:VpcConfigOutput' :: VpcConfigOutput -> Maybe [Text]
$sel:securityGroupIds:VpcConfigOutput' :: VpcConfigOutput -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
securityGroupIds
      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