{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53.Types.VPC 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
import Amazonka.Route53.Internal
import Amazonka.Route53.Types.VPCRegion

-- | (Private hosted zones only) A complex type that contains information
-- about an Amazon VPC.
--
-- If you associate a private hosted zone with an Amazon VPC when you make
-- a
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateHostedZone.html CreateHostedZone>
-- request, the following parameters are also required.
--
-- /See:/ 'newVPC' smart constructor.
data VPC = VPC'
  { VPC -> Maybe Text
vPCId :: Prelude.Maybe Prelude.Text,
    -- | (Private hosted zones only) The region that an Amazon VPC was created
    -- in.
    VPC -> Maybe VPCRegion
vPCRegion :: Prelude.Maybe VPCRegion
  }
  deriving (VPC -> VPC -> Bool
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]
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
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. 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:
--
-- 'vPCId', 'vpc_vPCId' - Undocumented member.
--
-- 'vPCRegion', 'vpc_vPCRegion' - (Private hosted zones only) The region that an Amazon VPC was created
-- in.
newVPC ::
  VPC
newVPC :: VPC
newVPC =
  VPC'
    { $sel:vPCId:VPC' :: Maybe Text
vPCId = forall a. Maybe a
Prelude.Nothing,
      $sel:vPCRegion:VPC' :: Maybe VPCRegion
vPCRegion = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
vpc_vPCId :: Lens.Lens' VPC (Prelude.Maybe Prelude.Text)
vpc_vPCId :: Lens' VPC (Maybe Text)
vpc_vPCId = 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)

-- | (Private hosted zones only) The region that an Amazon VPC was created
-- in.
vpc_vPCRegion :: Lens.Lens' VPC (Prelude.Maybe VPCRegion)
vpc_vPCRegion :: Lens' VPC (Maybe VPCRegion)
vpc_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)

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

instance Prelude.Hashable VPC where
  hashWithSalt :: Int -> VPC -> Int
hashWithSalt Int
_salt VPC' {Maybe Text
Maybe VPCRegion
vPCRegion :: Maybe VPCRegion
vPCId :: Maybe Text
$sel:vPCRegion:VPC' :: VPC -> Maybe VPCRegion
$sel:vPCId:VPC' :: VPC -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vPCId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VPCRegion
vPCRegion

instance Prelude.NFData VPC where
  rnf :: VPC -> ()
rnf VPC' {Maybe Text
Maybe VPCRegion
vPCRegion :: Maybe VPCRegion
vPCId :: Maybe Text
$sel:vPCRegion:VPC' :: VPC -> Maybe VPCRegion
$sel:vPCId:VPC' :: VPC -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vPCId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VPCRegion
vPCRegion

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