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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(VpcConfigOutput -> VpcConfigOutput -> Bool)
-> (VpcConfigOutput -> VpcConfigOutput -> Bool)
-> Eq VpcConfigOutput
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]
(Int -> ReadS VpcConfigOutput)
-> ReadS [VpcConfigOutput]
-> ReadPrec VpcConfigOutput
-> ReadPrec [VpcConfigOutput]
-> Read 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
(Int -> VpcConfigOutput -> ShowS)
-> (VpcConfigOutput -> String)
-> ([VpcConfigOutput] -> ShowS)
-> Show VpcConfigOutput
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. VpcConfigOutput -> Rep VpcConfigOutput x)
-> (forall x. Rep VpcConfigOutput x -> VpcConfigOutput)
-> Generic VpcConfigOutput
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' :: Maybe [Text] -> Maybe [Text] -> Maybe Text -> VpcConfigOutput
VpcConfigOutput'
    { $sel:securityGroupIds:VpcConfigOutput' :: Maybe [Text]
securityGroupIds =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:VpcConfigOutput' :: Maybe [Text]
subnetIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:vpcId:VpcConfigOutput' :: Maybe Text
vpcId = Maybe Text
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 :: (Maybe [Text] -> f (Maybe [Text]))
-> VpcConfigOutput -> f VpcConfigOutput
vpcConfigOutput_securityGroupIds = (VpcConfigOutput -> Maybe [Text])
-> (VpcConfigOutput -> Maybe [Text] -> VpcConfigOutput)
-> Lens
     VpcConfigOutput VpcConfigOutput (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> VpcConfigOutput -> f VpcConfigOutput)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VpcConfigOutput
-> f VpcConfigOutput
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 IDs of the subnets where this canary is to run.
vpcConfigOutput_subnetIds :: Lens.Lens' VpcConfigOutput (Prelude.Maybe [Prelude.Text])
vpcConfigOutput_subnetIds :: (Maybe [Text] -> f (Maybe [Text]))
-> VpcConfigOutput -> f VpcConfigOutput
vpcConfigOutput_subnetIds = (VpcConfigOutput -> Maybe [Text])
-> (VpcConfigOutput -> Maybe [Text] -> VpcConfigOutput)
-> Lens
     VpcConfigOutput VpcConfigOutput (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> VpcConfigOutput -> f VpcConfigOutput)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VpcConfigOutput
-> f VpcConfigOutput
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 IDs of the VPC where this canary is to run.
vpcConfigOutput_vpcId :: Lens.Lens' VpcConfigOutput (Prelude.Maybe Prelude.Text)
vpcConfigOutput_vpcId :: (Maybe Text -> f (Maybe Text))
-> VpcConfigOutput -> f VpcConfigOutput
vpcConfigOutput_vpcId = (VpcConfigOutput -> Maybe Text)
-> (VpcConfigOutput -> Maybe Text -> VpcConfigOutput)
-> Lens VpcConfigOutput VpcConfigOutput (Maybe Text) (Maybe Text)
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 Core.FromJSON VpcConfigOutput where
  parseJSON :: Value -> Parser VpcConfigOutput
parseJSON =
    String
-> (Object -> Parser VpcConfigOutput)
-> Value
-> Parser VpcConfigOutput
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VpcConfigOutput"
      ( \Object
x ->
          Maybe [Text] -> Maybe [Text] -> Maybe Text -> VpcConfigOutput
VpcConfigOutput'
            (Maybe [Text] -> Maybe [Text] -> Maybe Text -> VpcConfigOutput)
-> Parser (Maybe [Text])
-> Parser (Maybe [Text] -> Maybe Text -> VpcConfigOutput)
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
"SecurityGroupIds"
                            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 -> VpcConfigOutput)
-> Parser (Maybe [Text]) -> Parser (Maybe Text -> VpcConfigOutput)
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 -> VpcConfigOutput)
-> Parser (Maybe Text) -> Parser VpcConfigOutput
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")
      )

instance Prelude.Hashable VpcConfigOutput

instance Prelude.NFData VpcConfigOutput