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

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

-- | A complex type that identifies a hosted zone that a specified Amazon VPC
-- is associated with and the owner of the hosted zone. If there is a value
-- for @OwningAccount@, there is no value for @OwningService@, and vice
-- versa.
--
-- /See:/ 'newHostedZoneOwner' smart constructor.
data HostedZoneOwner = HostedZoneOwner'
  { -- | If the hosted zone was created by an Amazon Web Services account, or was
    -- created by an Amazon Web Services service that creates hosted zones
    -- using the current account, @OwningAccount@ contains the account ID of
    -- that account. For example, when you use Cloud Map to create a hosted
    -- zone, Cloud Map creates the hosted zone using the current Amazon Web
    -- Services account.
    HostedZoneOwner -> Maybe Text
owningAccount :: Prelude.Maybe Prelude.Text,
    -- | If an Amazon Web Services service uses its own account to create a
    -- hosted zone and associate the specified VPC with that hosted zone,
    -- @OwningService@ contains an abbreviation that identifies the service.
    -- For example, if Amazon Elastic File System (Amazon EFS) created a hosted
    -- zone and associated a VPC with the hosted zone, the value of
    -- @OwningService@ is @efs.amazonaws.com@.
    HostedZoneOwner -> Maybe Text
owningService :: Prelude.Maybe Prelude.Text
  }
  deriving (HostedZoneOwner -> HostedZoneOwner -> Bool
(HostedZoneOwner -> HostedZoneOwner -> Bool)
-> (HostedZoneOwner -> HostedZoneOwner -> Bool)
-> Eq HostedZoneOwner
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HostedZoneOwner -> HostedZoneOwner -> Bool
$c/= :: HostedZoneOwner -> HostedZoneOwner -> Bool
== :: HostedZoneOwner -> HostedZoneOwner -> Bool
$c== :: HostedZoneOwner -> HostedZoneOwner -> Bool
Prelude.Eq, ReadPrec [HostedZoneOwner]
ReadPrec HostedZoneOwner
Int -> ReadS HostedZoneOwner
ReadS [HostedZoneOwner]
(Int -> ReadS HostedZoneOwner)
-> ReadS [HostedZoneOwner]
-> ReadPrec HostedZoneOwner
-> ReadPrec [HostedZoneOwner]
-> Read HostedZoneOwner
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HostedZoneOwner]
$creadListPrec :: ReadPrec [HostedZoneOwner]
readPrec :: ReadPrec HostedZoneOwner
$creadPrec :: ReadPrec HostedZoneOwner
readList :: ReadS [HostedZoneOwner]
$creadList :: ReadS [HostedZoneOwner]
readsPrec :: Int -> ReadS HostedZoneOwner
$creadsPrec :: Int -> ReadS HostedZoneOwner
Prelude.Read, Int -> HostedZoneOwner -> ShowS
[HostedZoneOwner] -> ShowS
HostedZoneOwner -> String
(Int -> HostedZoneOwner -> ShowS)
-> (HostedZoneOwner -> String)
-> ([HostedZoneOwner] -> ShowS)
-> Show HostedZoneOwner
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HostedZoneOwner] -> ShowS
$cshowList :: [HostedZoneOwner] -> ShowS
show :: HostedZoneOwner -> String
$cshow :: HostedZoneOwner -> String
showsPrec :: Int -> HostedZoneOwner -> ShowS
$cshowsPrec :: Int -> HostedZoneOwner -> ShowS
Prelude.Show, (forall x. HostedZoneOwner -> Rep HostedZoneOwner x)
-> (forall x. Rep HostedZoneOwner x -> HostedZoneOwner)
-> Generic HostedZoneOwner
forall x. Rep HostedZoneOwner x -> HostedZoneOwner
forall x. HostedZoneOwner -> Rep HostedZoneOwner x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HostedZoneOwner x -> HostedZoneOwner
$cfrom :: forall x. HostedZoneOwner -> Rep HostedZoneOwner x
Prelude.Generic)

-- |
-- Create a value of 'HostedZoneOwner' 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:
--
-- 'owningAccount', 'hostedZoneOwner_owningAccount' - If the hosted zone was created by an Amazon Web Services account, or was
-- created by an Amazon Web Services service that creates hosted zones
-- using the current account, @OwningAccount@ contains the account ID of
-- that account. For example, when you use Cloud Map to create a hosted
-- zone, Cloud Map creates the hosted zone using the current Amazon Web
-- Services account.
--
-- 'owningService', 'hostedZoneOwner_owningService' - If an Amazon Web Services service uses its own account to create a
-- hosted zone and associate the specified VPC with that hosted zone,
-- @OwningService@ contains an abbreviation that identifies the service.
-- For example, if Amazon Elastic File System (Amazon EFS) created a hosted
-- zone and associated a VPC with the hosted zone, the value of
-- @OwningService@ is @efs.amazonaws.com@.
newHostedZoneOwner ::
  HostedZoneOwner
newHostedZoneOwner :: HostedZoneOwner
newHostedZoneOwner =
  HostedZoneOwner' :: Maybe Text -> Maybe Text -> HostedZoneOwner
HostedZoneOwner'
    { $sel:owningAccount:HostedZoneOwner' :: Maybe Text
owningAccount = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:owningService:HostedZoneOwner' :: Maybe Text
owningService = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | If the hosted zone was created by an Amazon Web Services account, or was
-- created by an Amazon Web Services service that creates hosted zones
-- using the current account, @OwningAccount@ contains the account ID of
-- that account. For example, when you use Cloud Map to create a hosted
-- zone, Cloud Map creates the hosted zone using the current Amazon Web
-- Services account.
hostedZoneOwner_owningAccount :: Lens.Lens' HostedZoneOwner (Prelude.Maybe Prelude.Text)
hostedZoneOwner_owningAccount :: (Maybe Text -> f (Maybe Text))
-> HostedZoneOwner -> f HostedZoneOwner
hostedZoneOwner_owningAccount = (HostedZoneOwner -> Maybe Text)
-> (HostedZoneOwner -> Maybe Text -> HostedZoneOwner)
-> Lens HostedZoneOwner HostedZoneOwner (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostedZoneOwner' {Maybe Text
owningAccount :: Maybe Text
$sel:owningAccount:HostedZoneOwner' :: HostedZoneOwner -> Maybe Text
owningAccount} -> Maybe Text
owningAccount) (\s :: HostedZoneOwner
s@HostedZoneOwner' {} Maybe Text
a -> HostedZoneOwner
s {$sel:owningAccount:HostedZoneOwner' :: Maybe Text
owningAccount = Maybe Text
a} :: HostedZoneOwner)

-- | If an Amazon Web Services service uses its own account to create a
-- hosted zone and associate the specified VPC with that hosted zone,
-- @OwningService@ contains an abbreviation that identifies the service.
-- For example, if Amazon Elastic File System (Amazon EFS) created a hosted
-- zone and associated a VPC with the hosted zone, the value of
-- @OwningService@ is @efs.amazonaws.com@.
hostedZoneOwner_owningService :: Lens.Lens' HostedZoneOwner (Prelude.Maybe Prelude.Text)
hostedZoneOwner_owningService :: (Maybe Text -> f (Maybe Text))
-> HostedZoneOwner -> f HostedZoneOwner
hostedZoneOwner_owningService = (HostedZoneOwner -> Maybe Text)
-> (HostedZoneOwner -> Maybe Text -> HostedZoneOwner)
-> Lens HostedZoneOwner HostedZoneOwner (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostedZoneOwner' {Maybe Text
owningService :: Maybe Text
$sel:owningService:HostedZoneOwner' :: HostedZoneOwner -> Maybe Text
owningService} -> Maybe Text
owningService) (\s :: HostedZoneOwner
s@HostedZoneOwner' {} Maybe Text
a -> HostedZoneOwner
s {$sel:owningService:HostedZoneOwner' :: Maybe Text
owningService = Maybe Text
a} :: HostedZoneOwner)

instance Core.FromXML HostedZoneOwner where
  parseXML :: [Node] -> Either String HostedZoneOwner
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> HostedZoneOwner
HostedZoneOwner'
      (Maybe Text -> Maybe Text -> HostedZoneOwner)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> HostedZoneOwner)
forall (f :: * -> *) a b. Functor 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
"OwningAccount")
      Either String (Maybe Text -> HostedZoneOwner)
-> Either String (Maybe Text) -> Either String HostedZoneOwner
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
"OwningService")

instance Prelude.Hashable HostedZoneOwner

instance Prelude.NFData HostedZoneOwner