{-# 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.CloudFront.Types.ConflictingAlias
-- 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.CloudFront.Types.ConflictingAlias where

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

-- | An alias (also called a CNAME) and the CloudFront distribution and
-- Amazon Web Services account ID that it’s associated with. The
-- distribution and account IDs are partially hidden, which allows you to
-- identify the distributions and accounts that you own, but helps to
-- protect the information of ones that you don’t own.
--
-- /See:/ 'newConflictingAlias' smart constructor.
data ConflictingAlias = ConflictingAlias'
  { -- | An alias (also called a CNAME).
    ConflictingAlias -> Maybe Text
alias :: Prelude.Maybe Prelude.Text,
    -- | The (partially hidden) ID of the Amazon Web Services account that owns
    -- the distribution that’s associated with the alias.
    ConflictingAlias -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The (partially hidden) ID of the CloudFront distribution associated with
    -- the alias.
    ConflictingAlias -> Maybe Text
distributionId :: Prelude.Maybe Prelude.Text
  }
  deriving (ConflictingAlias -> ConflictingAlias -> Bool
(ConflictingAlias -> ConflictingAlias -> Bool)
-> (ConflictingAlias -> ConflictingAlias -> Bool)
-> Eq ConflictingAlias
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConflictingAlias -> ConflictingAlias -> Bool
$c/= :: ConflictingAlias -> ConflictingAlias -> Bool
== :: ConflictingAlias -> ConflictingAlias -> Bool
$c== :: ConflictingAlias -> ConflictingAlias -> Bool
Prelude.Eq, ReadPrec [ConflictingAlias]
ReadPrec ConflictingAlias
Int -> ReadS ConflictingAlias
ReadS [ConflictingAlias]
(Int -> ReadS ConflictingAlias)
-> ReadS [ConflictingAlias]
-> ReadPrec ConflictingAlias
-> ReadPrec [ConflictingAlias]
-> Read ConflictingAlias
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConflictingAlias]
$creadListPrec :: ReadPrec [ConflictingAlias]
readPrec :: ReadPrec ConflictingAlias
$creadPrec :: ReadPrec ConflictingAlias
readList :: ReadS [ConflictingAlias]
$creadList :: ReadS [ConflictingAlias]
readsPrec :: Int -> ReadS ConflictingAlias
$creadsPrec :: Int -> ReadS ConflictingAlias
Prelude.Read, Int -> ConflictingAlias -> ShowS
[ConflictingAlias] -> ShowS
ConflictingAlias -> String
(Int -> ConflictingAlias -> ShowS)
-> (ConflictingAlias -> String)
-> ([ConflictingAlias] -> ShowS)
-> Show ConflictingAlias
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConflictingAlias] -> ShowS
$cshowList :: [ConflictingAlias] -> ShowS
show :: ConflictingAlias -> String
$cshow :: ConflictingAlias -> String
showsPrec :: Int -> ConflictingAlias -> ShowS
$cshowsPrec :: Int -> ConflictingAlias -> ShowS
Prelude.Show, (forall x. ConflictingAlias -> Rep ConflictingAlias x)
-> (forall x. Rep ConflictingAlias x -> ConflictingAlias)
-> Generic ConflictingAlias
forall x. Rep ConflictingAlias x -> ConflictingAlias
forall x. ConflictingAlias -> Rep ConflictingAlias x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConflictingAlias x -> ConflictingAlias
$cfrom :: forall x. ConflictingAlias -> Rep ConflictingAlias x
Prelude.Generic)

-- |
-- Create a value of 'ConflictingAlias' 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:
--
-- 'alias', 'conflictingAlias_alias' - An alias (also called a CNAME).
--
-- 'accountId', 'conflictingAlias_accountId' - The (partially hidden) ID of the Amazon Web Services account that owns
-- the distribution that’s associated with the alias.
--
-- 'distributionId', 'conflictingAlias_distributionId' - The (partially hidden) ID of the CloudFront distribution associated with
-- the alias.
newConflictingAlias ::
  ConflictingAlias
newConflictingAlias :: ConflictingAlias
newConflictingAlias =
  ConflictingAlias' :: Maybe Text -> Maybe Text -> Maybe Text -> ConflictingAlias
ConflictingAlias'
    { $sel:alias:ConflictingAlias' :: Maybe Text
alias = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:accountId:ConflictingAlias' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:distributionId:ConflictingAlias' :: Maybe Text
distributionId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | An alias (also called a CNAME).
conflictingAlias_alias :: Lens.Lens' ConflictingAlias (Prelude.Maybe Prelude.Text)
conflictingAlias_alias :: (Maybe Text -> f (Maybe Text))
-> ConflictingAlias -> f ConflictingAlias
conflictingAlias_alias = (ConflictingAlias -> Maybe Text)
-> (ConflictingAlias -> Maybe Text -> ConflictingAlias)
-> Lens ConflictingAlias ConflictingAlias (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConflictingAlias' {Maybe Text
alias :: Maybe Text
$sel:alias:ConflictingAlias' :: ConflictingAlias -> Maybe Text
alias} -> Maybe Text
alias) (\s :: ConflictingAlias
s@ConflictingAlias' {} Maybe Text
a -> ConflictingAlias
s {$sel:alias:ConflictingAlias' :: Maybe Text
alias = Maybe Text
a} :: ConflictingAlias)

-- | The (partially hidden) ID of the Amazon Web Services account that owns
-- the distribution that’s associated with the alias.
conflictingAlias_accountId :: Lens.Lens' ConflictingAlias (Prelude.Maybe Prelude.Text)
conflictingAlias_accountId :: (Maybe Text -> f (Maybe Text))
-> ConflictingAlias -> f ConflictingAlias
conflictingAlias_accountId = (ConflictingAlias -> Maybe Text)
-> (ConflictingAlias -> Maybe Text -> ConflictingAlias)
-> Lens ConflictingAlias ConflictingAlias (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConflictingAlias' {Maybe Text
accountId :: Maybe Text
$sel:accountId:ConflictingAlias' :: ConflictingAlias -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: ConflictingAlias
s@ConflictingAlias' {} Maybe Text
a -> ConflictingAlias
s {$sel:accountId:ConflictingAlias' :: Maybe Text
accountId = Maybe Text
a} :: ConflictingAlias)

-- | The (partially hidden) ID of the CloudFront distribution associated with
-- the alias.
conflictingAlias_distributionId :: Lens.Lens' ConflictingAlias (Prelude.Maybe Prelude.Text)
conflictingAlias_distributionId :: (Maybe Text -> f (Maybe Text))
-> ConflictingAlias -> f ConflictingAlias
conflictingAlias_distributionId = (ConflictingAlias -> Maybe Text)
-> (ConflictingAlias -> Maybe Text -> ConflictingAlias)
-> Lens ConflictingAlias ConflictingAlias (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConflictingAlias' {Maybe Text
distributionId :: Maybe Text
$sel:distributionId:ConflictingAlias' :: ConflictingAlias -> Maybe Text
distributionId} -> Maybe Text
distributionId) (\s :: ConflictingAlias
s@ConflictingAlias' {} Maybe Text
a -> ConflictingAlias
s {$sel:distributionId:ConflictingAlias' :: Maybe Text
distributionId = Maybe Text
a} :: ConflictingAlias)

instance Core.FromXML ConflictingAlias where
  parseXML :: [Node] -> Either String ConflictingAlias
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> Maybe Text -> ConflictingAlias
ConflictingAlias'
      (Maybe Text -> Maybe Text -> Maybe Text -> ConflictingAlias)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Maybe Text -> ConflictingAlias)
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
"Alias")
      Either String (Maybe Text -> Maybe Text -> ConflictingAlias)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> ConflictingAlias)
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
"AccountId")
      Either String (Maybe Text -> ConflictingAlias)
-> Either String (Maybe Text) -> Either String ConflictingAlias
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
"DistributionId")

instance Prelude.Hashable ConflictingAlias

instance Prelude.NFData ConflictingAlias