{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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
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.
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'
      { $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 :: Lens' DistributionConfigWithTags DistributionConfig
distributionConfigWithTags_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 :: Lens' DistributionConfigWithTags Tags
distributionConfigWithTags_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 where
  hashWithSalt :: Int -> DistributionConfigWithTags -> Int
hashWithSalt Int
_salt DistributionConfigWithTags' {Tags
DistributionConfig
tags :: Tags
distributionConfig :: DistributionConfig
$sel:tags:DistributionConfigWithTags' :: DistributionConfigWithTags -> Tags
$sel:distributionConfig:DistributionConfigWithTags' :: DistributionConfigWithTags -> DistributionConfig
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DistributionConfig
distributionConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Tags
tags

instance Prelude.NFData DistributionConfigWithTags where
  rnf :: DistributionConfigWithTags -> ()
rnf DistributionConfigWithTags' {Tags
DistributionConfig
tags :: Tags
distributionConfig :: DistributionConfig
$sel:tags:DistributionConfigWithTags' :: DistributionConfigWithTags -> Tags
$sel:distributionConfig:DistributionConfigWithTags' :: DistributionConfigWithTags -> DistributionConfig
..} =
    forall a. NFData a => a -> ()
Prelude.rnf DistributionConfig
distributionConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Tags
tags

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