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

import Amazonka.CloudFront.Types.DistributionConfig
import Amazonka.CloudFront.Types.Tags
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A distribution Configuration and a list of tags to be associated with
-- the distribution.
--
-- /See:/ 'newDistributionConfigWithTags' smart constructor.
data DistributionConfigWithTags = DistributionConfigWithTags'
  { -- | A distribution configuration.
    DistributionConfigWithTags -> DistributionConfig
distributionConfig :: DistributionConfig,
    -- | A complex type that contains zero or more @Tag@ elements.
    DistributionConfigWithTags -> Tags
tags :: Tags
  }
  deriving (DistributionConfigWithTags -> DistributionConfigWithTags -> Bool
(DistributionConfigWithTags -> DistributionConfigWithTags -> Bool)
-> (DistributionConfigWithTags
    -> DistributionConfigWithTags -> Bool)
-> Eq DistributionConfigWithTags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DistributionConfigWithTags -> DistributionConfigWithTags -> Bool
$c/= :: DistributionConfigWithTags -> DistributionConfigWithTags -> Bool
== :: DistributionConfigWithTags -> DistributionConfigWithTags -> Bool
$c== :: DistributionConfigWithTags -> DistributionConfigWithTags -> Bool
Prelude.Eq, Int -> DistributionConfigWithTags -> ShowS
[DistributionConfigWithTags] -> ShowS
DistributionConfigWithTags -> String
(Int -> DistributionConfigWithTags -> ShowS)
-> (DistributionConfigWithTags -> String)
-> ([DistributionConfigWithTags] -> ShowS)
-> Show DistributionConfigWithTags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DistributionConfigWithTags] -> ShowS
$cshowList :: [DistributionConfigWithTags] -> ShowS
show :: DistributionConfigWithTags -> String
$cshow :: DistributionConfigWithTags -> String
showsPrec :: Int -> DistributionConfigWithTags -> ShowS
$cshowsPrec :: Int -> DistributionConfigWithTags -> ShowS
Prelude.Show, (forall x.
 DistributionConfigWithTags -> Rep DistributionConfigWithTags x)
-> (forall x.
    Rep DistributionConfigWithTags x -> DistributionConfigWithTags)
-> Generic DistributionConfigWithTags
forall x.
Rep DistributionConfigWithTags x -> DistributionConfigWithTags
forall x.
DistributionConfigWithTags -> Rep DistributionConfigWithTags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DistributionConfigWithTags x -> DistributionConfigWithTags
$cfrom :: forall x.
DistributionConfigWithTags -> Rep DistributionConfigWithTags x
Prelude.Generic)

-- |
-- Create a value of 'DistributionConfigWithTags' 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:
--
-- 'distributionConfig', 'distributionConfigWithTags_distributionConfig' - A distribution configuration.
--
-- 'tags', 'distributionConfigWithTags_tags' - A complex type that contains zero or more @Tag@ elements.
newDistributionConfigWithTags ::
  -- | 'distributionConfig'
  DistributionConfig ->
  -- | 'tags'
  Tags ->
  DistributionConfigWithTags
newDistributionConfigWithTags :: DistributionConfig -> Tags -> DistributionConfigWithTags
newDistributionConfigWithTags
  DistributionConfig
pDistributionConfig_
  Tags
pTags_ =
    DistributionConfigWithTags' :: DistributionConfig -> Tags -> DistributionConfigWithTags
DistributionConfigWithTags'
      { $sel:distributionConfig:DistributionConfigWithTags' :: DistributionConfig
distributionConfig =
          DistributionConfig
pDistributionConfig_,
        $sel:tags:DistributionConfigWithTags' :: Tags
tags = Tags
pTags_
      }

-- | A distribution configuration.
distributionConfigWithTags_distributionConfig :: Lens.Lens' DistributionConfigWithTags DistributionConfig
distributionConfigWithTags_distributionConfig :: (DistributionConfig -> f DistributionConfig)
-> DistributionConfigWithTags -> f DistributionConfigWithTags
distributionConfigWithTags_distributionConfig = (DistributionConfigWithTags -> DistributionConfig)
-> (DistributionConfigWithTags
    -> DistributionConfig -> DistributionConfigWithTags)
-> Lens
     DistributionConfigWithTags
     DistributionConfigWithTags
     DistributionConfig
     DistributionConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfigWithTags' {DistributionConfig
distributionConfig :: DistributionConfig
$sel:distributionConfig:DistributionConfigWithTags' :: DistributionConfigWithTags -> DistributionConfig
distributionConfig} -> DistributionConfig
distributionConfig) (\s :: DistributionConfigWithTags
s@DistributionConfigWithTags' {} DistributionConfig
a -> DistributionConfigWithTags
s {$sel:distributionConfig:DistributionConfigWithTags' :: DistributionConfig
distributionConfig = DistributionConfig
a} :: DistributionConfigWithTags)

-- | A complex type that contains zero or more @Tag@ elements.
distributionConfigWithTags_tags :: Lens.Lens' DistributionConfigWithTags Tags
distributionConfigWithTags_tags :: (Tags -> f Tags)
-> DistributionConfigWithTags -> f DistributionConfigWithTags
distributionConfigWithTags_tags = (DistributionConfigWithTags -> Tags)
-> (DistributionConfigWithTags
    -> Tags -> DistributionConfigWithTags)
-> Lens
     DistributionConfigWithTags DistributionConfigWithTags Tags Tags
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfigWithTags' {Tags
tags :: Tags
$sel:tags:DistributionConfigWithTags' :: DistributionConfigWithTags -> Tags
tags} -> Tags
tags) (\s :: DistributionConfigWithTags
s@DistributionConfigWithTags' {} Tags
a -> DistributionConfigWithTags
s {$sel:tags:DistributionConfigWithTags' :: Tags
tags = Tags
a} :: DistributionConfigWithTags)

instance Prelude.Hashable DistributionConfigWithTags

instance Prelude.NFData DistributionConfigWithTags

instance Core.ToXML DistributionConfigWithTags where
  toXML :: DistributionConfigWithTags -> XML
toXML DistributionConfigWithTags' {Tags
DistributionConfig
tags :: Tags
distributionConfig :: DistributionConfig
$sel:tags:DistributionConfigWithTags' :: DistributionConfigWithTags -> Tags
$sel:distributionConfig:DistributionConfigWithTags' :: DistributionConfigWithTags -> DistributionConfig
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"DistributionConfig" Name -> DistributionConfig -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= DistributionConfig
distributionConfig,
        Name
"Tags" Name -> Tags -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Tags
tags
      ]