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

-- | 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
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]
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
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. 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'
    { $sel:owningAccount:HostedZoneOwner' :: Maybe Text
owningAccount = forall a. Maybe a
Prelude.Nothing,
      $sel:owningService:HostedZoneOwner' :: Maybe Text
owningService = 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 :: Lens' HostedZoneOwner (Maybe Text)
hostedZoneOwner_owningAccount = 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 :: Lens' HostedZoneOwner (Maybe Text)
hostedZoneOwner_owningService = 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 Data.FromXML HostedZoneOwner where
  parseXML :: [Node] -> Either String HostedZoneOwner
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> HostedZoneOwner
HostedZoneOwner'
      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
"OwningAccount")
      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
"OwningService")

instance Prelude.Hashable HostedZoneOwner where
  hashWithSalt :: Int -> HostedZoneOwner -> Int
hashWithSalt Int
_salt HostedZoneOwner' {Maybe Text
owningService :: Maybe Text
owningAccount :: Maybe Text
$sel:owningService:HostedZoneOwner' :: HostedZoneOwner -> Maybe Text
$sel:owningAccount:HostedZoneOwner' :: HostedZoneOwner -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
owningAccount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
owningService

instance Prelude.NFData HostedZoneOwner where
  rnf :: HostedZoneOwner -> ()
rnf HostedZoneOwner' {Maybe Text
owningService :: Maybe Text
owningAccount :: Maybe Text
$sel:owningService:HostedZoneOwner' :: HostedZoneOwner -> Maybe Text
$sel:owningAccount:HostedZoneOwner' :: HostedZoneOwner -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
owningAccount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
owningService