{-# 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.Route53.Types.VPC
-- 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.Route53.Types.VPC where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53.Internal
import Amazonka.Route53.Types.VPCRegion

-- | (Private hosted zones only) A complex type that contains information
-- about an Amazon VPC.
--
-- /See:/ 'newVPC' smart constructor.
data VPC = VPC'
  { -- | (Private hosted zones only) The region that an Amazon VPC was created
    -- in.
    VPC -> Maybe VPCRegion
vPCRegion :: Prelude.Maybe VPCRegion,
    VPC -> Maybe Text
vPCId :: Prelude.Maybe Prelude.Text
  }
  deriving (VPC -> VPC -> Bool
(VPC -> VPC -> Bool) -> (VPC -> VPC -> Bool) -> Eq VPC
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VPC -> VPC -> Bool
$c/= :: VPC -> VPC -> Bool
== :: VPC -> VPC -> Bool
$c== :: VPC -> VPC -> Bool
Prelude.Eq, ReadPrec [VPC]
ReadPrec VPC
Int -> ReadS VPC
ReadS [VPC]
(Int -> ReadS VPC)
-> ReadS [VPC] -> ReadPrec VPC -> ReadPrec [VPC] -> Read VPC
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VPC]
$creadListPrec :: ReadPrec [VPC]
readPrec :: ReadPrec VPC
$creadPrec :: ReadPrec VPC
readList :: ReadS [VPC]
$creadList :: ReadS [VPC]
readsPrec :: Int -> ReadS VPC
$creadsPrec :: Int -> ReadS VPC
Prelude.Read, Int -> VPC -> ShowS
[VPC] -> ShowS
VPC -> String
(Int -> VPC -> ShowS)
-> (VPC -> String) -> ([VPC] -> ShowS) -> Show VPC
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VPC] -> ShowS
$cshowList :: [VPC] -> ShowS
show :: VPC -> String
$cshow :: VPC -> String
showsPrec :: Int -> VPC -> ShowS
$cshowsPrec :: Int -> VPC -> ShowS
Prelude.Show, (forall x. VPC -> Rep VPC x)
-> (forall x. Rep VPC x -> VPC) -> Generic VPC
forall x. Rep VPC x -> VPC
forall x. VPC -> Rep VPC x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VPC x -> VPC
$cfrom :: forall x. VPC -> Rep VPC x
Prelude.Generic)

-- |
-- Create a value of 'VPC' 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:
--
-- 'vPCRegion', 'vpc_vPCRegion' - (Private hosted zones only) The region that an Amazon VPC was created
-- in.
--
-- 'vPCId', 'vpc_vPCId' - Undocumented member.
newVPC ::
  VPC
newVPC :: VPC
newVPC =
  VPC' :: Maybe VPCRegion -> Maybe Text -> VPC
VPC'
    { $sel:vPCRegion:VPC' :: Maybe VPCRegion
vPCRegion = Maybe VPCRegion
forall a. Maybe a
Prelude.Nothing,
      $sel:vPCId:VPC' :: Maybe Text
vPCId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | (Private hosted zones only) The region that an Amazon VPC was created
-- in.
vpc_vPCRegion :: Lens.Lens' VPC (Prelude.Maybe VPCRegion)
vpc_vPCRegion :: (Maybe VPCRegion -> f (Maybe VPCRegion)) -> VPC -> f VPC
vpc_vPCRegion = (VPC -> Maybe VPCRegion)
-> (VPC -> Maybe VPCRegion -> VPC)
-> Lens VPC VPC (Maybe VPCRegion) (Maybe VPCRegion)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VPC' {Maybe VPCRegion
vPCRegion :: Maybe VPCRegion
$sel:vPCRegion:VPC' :: VPC -> Maybe VPCRegion
vPCRegion} -> Maybe VPCRegion
vPCRegion) (\s :: VPC
s@VPC' {} Maybe VPCRegion
a -> VPC
s {$sel:vPCRegion:VPC' :: Maybe VPCRegion
vPCRegion = Maybe VPCRegion
a} :: VPC)

-- | Undocumented member.
vpc_vPCId :: Lens.Lens' VPC (Prelude.Maybe Prelude.Text)
vpc_vPCId :: (Maybe Text -> f (Maybe Text)) -> VPC -> f VPC
vpc_vPCId = (VPC -> Maybe Text)
-> (VPC -> Maybe Text -> VPC)
-> Lens VPC VPC (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VPC' {Maybe Text
vPCId :: Maybe Text
$sel:vPCId:VPC' :: VPC -> Maybe Text
vPCId} -> Maybe Text
vPCId) (\s :: VPC
s@VPC' {} Maybe Text
a -> VPC
s {$sel:vPCId:VPC' :: Maybe Text
vPCId = Maybe Text
a} :: VPC)

instance Core.FromXML VPC where
  parseXML :: [Node] -> Either String VPC
parseXML [Node]
x =
    Maybe VPCRegion -> Maybe Text -> VPC
VPC'
      (Maybe VPCRegion -> Maybe Text -> VPC)
-> Either String (Maybe VPCRegion)
-> Either String (Maybe Text -> VPC)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe VPCRegion)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"VPCRegion")
      Either String (Maybe Text -> VPC)
-> Either String (Maybe Text) -> Either String VPC
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"VPCId")

instance Prelude.Hashable VPC

instance Prelude.NFData VPC

instance Core.ToXML VPC where
  toXML :: VPC -> XML
toXML VPC' {Maybe Text
Maybe VPCRegion
vPCId :: Maybe Text
vPCRegion :: Maybe VPCRegion
$sel:vPCId:VPC' :: VPC -> Maybe Text
$sel:vPCRegion:VPC' :: VPC -> Maybe VPCRegion
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"VPCRegion" Name -> Maybe VPCRegion -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe VPCRegion
vPCRegion,
        Name
"VPCId" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
vPCId
      ]