{-# 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.VpcConfigInput
-- 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.VpcConfigInput 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:/ 'newVpcConfigInput' smart constructor.
data VpcConfigInput = VpcConfigInput'
  { -- | The IDs of the security groups for this canary.
    VpcConfigInput -> Maybe [Text]
securityGroupIds :: Prelude.Maybe [Prelude.Text],
    -- | The IDs of the subnets where this canary is to run.
    VpcConfigInput -> Maybe [Text]
subnetIds :: Prelude.Maybe [Prelude.Text]
  }
  deriving (VpcConfigInput -> VpcConfigInput -> Bool
(VpcConfigInput -> VpcConfigInput -> Bool)
-> (VpcConfigInput -> VpcConfigInput -> Bool) -> Eq VpcConfigInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcConfigInput -> VpcConfigInput -> Bool
$c/= :: VpcConfigInput -> VpcConfigInput -> Bool
== :: VpcConfigInput -> VpcConfigInput -> Bool
$c== :: VpcConfigInput -> VpcConfigInput -> Bool
Prelude.Eq, ReadPrec [VpcConfigInput]
ReadPrec VpcConfigInput
Int -> ReadS VpcConfigInput
ReadS [VpcConfigInput]
(Int -> ReadS VpcConfigInput)
-> ReadS [VpcConfigInput]
-> ReadPrec VpcConfigInput
-> ReadPrec [VpcConfigInput]
-> Read VpcConfigInput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcConfigInput]
$creadListPrec :: ReadPrec [VpcConfigInput]
readPrec :: ReadPrec VpcConfigInput
$creadPrec :: ReadPrec VpcConfigInput
readList :: ReadS [VpcConfigInput]
$creadList :: ReadS [VpcConfigInput]
readsPrec :: Int -> ReadS VpcConfigInput
$creadsPrec :: Int -> ReadS VpcConfigInput
Prelude.Read, Int -> VpcConfigInput -> ShowS
[VpcConfigInput] -> ShowS
VpcConfigInput -> String
(Int -> VpcConfigInput -> ShowS)
-> (VpcConfigInput -> String)
-> ([VpcConfigInput] -> ShowS)
-> Show VpcConfigInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcConfigInput] -> ShowS
$cshowList :: [VpcConfigInput] -> ShowS
show :: VpcConfigInput -> String
$cshow :: VpcConfigInput -> String
showsPrec :: Int -> VpcConfigInput -> ShowS
$cshowsPrec :: Int -> VpcConfigInput -> ShowS
Prelude.Show, (forall x. VpcConfigInput -> Rep VpcConfigInput x)
-> (forall x. Rep VpcConfigInput x -> VpcConfigInput)
-> Generic VpcConfigInput
forall x. Rep VpcConfigInput x -> VpcConfigInput
forall x. VpcConfigInput -> Rep VpcConfigInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpcConfigInput x -> VpcConfigInput
$cfrom :: forall x. VpcConfigInput -> Rep VpcConfigInput x
Prelude.Generic)

-- |
-- Create a value of 'VpcConfigInput' 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', 'vpcConfigInput_securityGroupIds' - The IDs of the security groups for this canary.
--
-- 'subnetIds', 'vpcConfigInput_subnetIds' - The IDs of the subnets where this canary is to run.
newVpcConfigInput ::
  VpcConfigInput
newVpcConfigInput :: VpcConfigInput
newVpcConfigInput =
  VpcConfigInput' :: Maybe [Text] -> Maybe [Text] -> VpcConfigInput
VpcConfigInput'
    { $sel:securityGroupIds:VpcConfigInput' :: Maybe [Text]
securityGroupIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:VpcConfigInput' :: Maybe [Text]
subnetIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | The IDs of the security groups for this canary.
vpcConfigInput_securityGroupIds :: Lens.Lens' VpcConfigInput (Prelude.Maybe [Prelude.Text])
vpcConfigInput_securityGroupIds :: (Maybe [Text] -> f (Maybe [Text]))
-> VpcConfigInput -> f VpcConfigInput
vpcConfigInput_securityGroupIds = (VpcConfigInput -> Maybe [Text])
-> (VpcConfigInput -> Maybe [Text] -> VpcConfigInput)
-> Lens VpcConfigInput VpcConfigInput (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfigInput' {Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:securityGroupIds:VpcConfigInput' :: VpcConfigInput -> Maybe [Text]
securityGroupIds} -> Maybe [Text]
securityGroupIds) (\s :: VpcConfigInput
s@VpcConfigInput' {} Maybe [Text]
a -> VpcConfigInput
s {$sel:securityGroupIds:VpcConfigInput' :: Maybe [Text]
securityGroupIds = Maybe [Text]
a} :: VpcConfigInput) ((Maybe [Text] -> f (Maybe [Text]))
 -> VpcConfigInput -> f VpcConfigInput)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VpcConfigInput
-> f VpcConfigInput
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.
vpcConfigInput_subnetIds :: Lens.Lens' VpcConfigInput (Prelude.Maybe [Prelude.Text])
vpcConfigInput_subnetIds :: (Maybe [Text] -> f (Maybe [Text]))
-> VpcConfigInput -> f VpcConfigInput
vpcConfigInput_subnetIds = (VpcConfigInput -> Maybe [Text])
-> (VpcConfigInput -> Maybe [Text] -> VpcConfigInput)
-> Lens VpcConfigInput VpcConfigInput (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfigInput' {Maybe [Text]
subnetIds :: Maybe [Text]
$sel:subnetIds:VpcConfigInput' :: VpcConfigInput -> Maybe [Text]
subnetIds} -> Maybe [Text]
subnetIds) (\s :: VpcConfigInput
s@VpcConfigInput' {} Maybe [Text]
a -> VpcConfigInput
s {$sel:subnetIds:VpcConfigInput' :: Maybe [Text]
subnetIds = Maybe [Text]
a} :: VpcConfigInput) ((Maybe [Text] -> f (Maybe [Text]))
 -> VpcConfigInput -> f VpcConfigInput)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VpcConfigInput
-> f VpcConfigInput
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

instance Prelude.Hashable VpcConfigInput

instance Prelude.NFData VpcConfigInput

instance Core.ToJSON VpcConfigInput where
  toJSON :: VpcConfigInput -> Value
toJSON VpcConfigInput' {Maybe [Text]
subnetIds :: Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:subnetIds:VpcConfigInput' :: VpcConfigInput -> Maybe [Text]
$sel:securityGroupIds:VpcConfigInput' :: VpcConfigInput -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SecurityGroupIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
securityGroupIds,
            (Text
"SubnetIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
subnetIds
          ]
      )