{-# 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.HostedZoneSummary
-- 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.HostedZoneSummary 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.HostedZoneOwner

-- | In the response to a @ListHostedZonesByVPC@ request, the
-- @HostedZoneSummaries@ element contains one @HostedZoneSummary@ element
-- for each hosted zone that the specified Amazon VPC is associated with.
-- Each @HostedZoneSummary@ element contains the hosted zone name and ID,
-- and information about who owns the hosted zone.
--
-- /See:/ 'newHostedZoneSummary' smart constructor.
data HostedZoneSummary = HostedZoneSummary'
  { -- | The Route 53 hosted zone ID of a private hosted zone that the specified
    -- VPC is associated with.
    HostedZoneSummary -> ResourceId
hostedZoneId :: ResourceId,
    -- | The name of the private hosted zone, such as @example.com@.
    HostedZoneSummary -> Text
name :: Prelude.Text,
    -- | The owner of a private hosted zone that the specified VPC is associated
    -- with. The owner can be either an Amazon Web Services account or an
    -- Amazon Web Services service.
    HostedZoneSummary -> HostedZoneOwner
owner :: HostedZoneOwner
  }
  deriving (HostedZoneSummary -> HostedZoneSummary -> Bool
(HostedZoneSummary -> HostedZoneSummary -> Bool)
-> (HostedZoneSummary -> HostedZoneSummary -> Bool)
-> Eq HostedZoneSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HostedZoneSummary -> HostedZoneSummary -> Bool
$c/= :: HostedZoneSummary -> HostedZoneSummary -> Bool
== :: HostedZoneSummary -> HostedZoneSummary -> Bool
$c== :: HostedZoneSummary -> HostedZoneSummary -> Bool
Prelude.Eq, ReadPrec [HostedZoneSummary]
ReadPrec HostedZoneSummary
Int -> ReadS HostedZoneSummary
ReadS [HostedZoneSummary]
(Int -> ReadS HostedZoneSummary)
-> ReadS [HostedZoneSummary]
-> ReadPrec HostedZoneSummary
-> ReadPrec [HostedZoneSummary]
-> Read HostedZoneSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HostedZoneSummary]
$creadListPrec :: ReadPrec [HostedZoneSummary]
readPrec :: ReadPrec HostedZoneSummary
$creadPrec :: ReadPrec HostedZoneSummary
readList :: ReadS [HostedZoneSummary]
$creadList :: ReadS [HostedZoneSummary]
readsPrec :: Int -> ReadS HostedZoneSummary
$creadsPrec :: Int -> ReadS HostedZoneSummary
Prelude.Read, Int -> HostedZoneSummary -> ShowS
[HostedZoneSummary] -> ShowS
HostedZoneSummary -> String
(Int -> HostedZoneSummary -> ShowS)
-> (HostedZoneSummary -> String)
-> ([HostedZoneSummary] -> ShowS)
-> Show HostedZoneSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HostedZoneSummary] -> ShowS
$cshowList :: [HostedZoneSummary] -> ShowS
show :: HostedZoneSummary -> String
$cshow :: HostedZoneSummary -> String
showsPrec :: Int -> HostedZoneSummary -> ShowS
$cshowsPrec :: Int -> HostedZoneSummary -> ShowS
Prelude.Show, (forall x. HostedZoneSummary -> Rep HostedZoneSummary x)
-> (forall x. Rep HostedZoneSummary x -> HostedZoneSummary)
-> Generic HostedZoneSummary
forall x. Rep HostedZoneSummary x -> HostedZoneSummary
forall x. HostedZoneSummary -> Rep HostedZoneSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HostedZoneSummary x -> HostedZoneSummary
$cfrom :: forall x. HostedZoneSummary -> Rep HostedZoneSummary x
Prelude.Generic)

-- |
-- Create a value of 'HostedZoneSummary' 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:
--
-- 'hostedZoneId', 'hostedZoneSummary_hostedZoneId' - The Route 53 hosted zone ID of a private hosted zone that the specified
-- VPC is associated with.
--
-- 'name', 'hostedZoneSummary_name' - The name of the private hosted zone, such as @example.com@.
--
-- 'owner', 'hostedZoneSummary_owner' - The owner of a private hosted zone that the specified VPC is associated
-- with. The owner can be either an Amazon Web Services account or an
-- Amazon Web Services service.
newHostedZoneSummary ::
  -- | 'hostedZoneId'
  ResourceId ->
  -- | 'name'
  Prelude.Text ->
  -- | 'owner'
  HostedZoneOwner ->
  HostedZoneSummary
newHostedZoneSummary :: ResourceId -> Text -> HostedZoneOwner -> HostedZoneSummary
newHostedZoneSummary ResourceId
pHostedZoneId_ Text
pName_ HostedZoneOwner
pOwner_ =
  HostedZoneSummary' :: ResourceId -> Text -> HostedZoneOwner -> HostedZoneSummary
HostedZoneSummary'
    { $sel:hostedZoneId:HostedZoneSummary' :: ResourceId
hostedZoneId = ResourceId
pHostedZoneId_,
      $sel:name:HostedZoneSummary' :: Text
name = Text
pName_,
      $sel:owner:HostedZoneSummary' :: HostedZoneOwner
owner = HostedZoneOwner
pOwner_
    }

-- | The Route 53 hosted zone ID of a private hosted zone that the specified
-- VPC is associated with.
hostedZoneSummary_hostedZoneId :: Lens.Lens' HostedZoneSummary ResourceId
hostedZoneSummary_hostedZoneId :: (ResourceId -> f ResourceId)
-> HostedZoneSummary -> f HostedZoneSummary
hostedZoneSummary_hostedZoneId = (HostedZoneSummary -> ResourceId)
-> (HostedZoneSummary -> ResourceId -> HostedZoneSummary)
-> Lens HostedZoneSummary HostedZoneSummary ResourceId ResourceId
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostedZoneSummary' {ResourceId
hostedZoneId :: ResourceId
$sel:hostedZoneId:HostedZoneSummary' :: HostedZoneSummary -> ResourceId
hostedZoneId} -> ResourceId
hostedZoneId) (\s :: HostedZoneSummary
s@HostedZoneSummary' {} ResourceId
a -> HostedZoneSummary
s {$sel:hostedZoneId:HostedZoneSummary' :: ResourceId
hostedZoneId = ResourceId
a} :: HostedZoneSummary)

-- | The name of the private hosted zone, such as @example.com@.
hostedZoneSummary_name :: Lens.Lens' HostedZoneSummary Prelude.Text
hostedZoneSummary_name :: (Text -> f Text) -> HostedZoneSummary -> f HostedZoneSummary
hostedZoneSummary_name = (HostedZoneSummary -> Text)
-> (HostedZoneSummary -> Text -> HostedZoneSummary)
-> Lens HostedZoneSummary HostedZoneSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostedZoneSummary' {Text
name :: Text
$sel:name:HostedZoneSummary' :: HostedZoneSummary -> Text
name} -> Text
name) (\s :: HostedZoneSummary
s@HostedZoneSummary' {} Text
a -> HostedZoneSummary
s {$sel:name:HostedZoneSummary' :: Text
name = Text
a} :: HostedZoneSummary)

-- | The owner of a private hosted zone that the specified VPC is associated
-- with. The owner can be either an Amazon Web Services account or an
-- Amazon Web Services service.
hostedZoneSummary_owner :: Lens.Lens' HostedZoneSummary HostedZoneOwner
hostedZoneSummary_owner :: (HostedZoneOwner -> f HostedZoneOwner)
-> HostedZoneSummary -> f HostedZoneSummary
hostedZoneSummary_owner = (HostedZoneSummary -> HostedZoneOwner)
-> (HostedZoneSummary -> HostedZoneOwner -> HostedZoneSummary)
-> Lens
     HostedZoneSummary HostedZoneSummary HostedZoneOwner HostedZoneOwner
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostedZoneSummary' {HostedZoneOwner
owner :: HostedZoneOwner
$sel:owner:HostedZoneSummary' :: HostedZoneSummary -> HostedZoneOwner
owner} -> HostedZoneOwner
owner) (\s :: HostedZoneSummary
s@HostedZoneSummary' {} HostedZoneOwner
a -> HostedZoneSummary
s {$sel:owner:HostedZoneSummary' :: HostedZoneOwner
owner = HostedZoneOwner
a} :: HostedZoneSummary)

instance Core.FromXML HostedZoneSummary where
  parseXML :: [Node] -> Either String HostedZoneSummary
parseXML [Node]
x =
    ResourceId -> Text -> HostedZoneOwner -> HostedZoneSummary
HostedZoneSummary'
      (ResourceId -> Text -> HostedZoneOwner -> HostedZoneSummary)
-> Either String ResourceId
-> Either String (Text -> HostedZoneOwner -> HostedZoneSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String ResourceId
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"HostedZoneId")
      Either String (Text -> HostedZoneOwner -> HostedZoneSummary)
-> Either String Text
-> Either String (HostedZoneOwner -> HostedZoneSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Name")
      Either String (HostedZoneOwner -> HostedZoneSummary)
-> Either String HostedZoneOwner -> Either String HostedZoneSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String HostedZoneOwner
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Owner")

instance Prelude.Hashable HostedZoneSummary

instance Prelude.NFData HostedZoneSummary