{-# 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.TrafficPolicySummary
-- 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.TrafficPolicySummary 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
import Amazonka.Route53.Types.RRType

-- | A complex type that contains information about the latest version of one
-- traffic policy that is associated with the current Amazon Web Services
-- account.
--
-- /See:/ 'newTrafficPolicySummary' smart constructor.
data TrafficPolicySummary = TrafficPolicySummary'
  { -- | The ID that Amazon Route 53 assigned to the traffic policy when you
    -- created it.
    TrafficPolicySummary -> Text
id :: Prelude.Text,
    -- | The name that you specified for the traffic policy when you created it.
    TrafficPolicySummary -> Text
name :: Prelude.Text,
    -- | The DNS type of the resource record sets that Amazon Route 53 creates
    -- when you use a traffic policy to create a traffic policy instance.
    TrafficPolicySummary -> RRType
type' :: RRType,
    -- | The version number of the latest version of the traffic policy.
    TrafficPolicySummary -> Natural
latestVersion :: Prelude.Natural,
    -- | The number of traffic policies that are associated with the current
    -- Amazon Web Services account.
    TrafficPolicySummary -> Natural
trafficPolicyCount :: Prelude.Natural
  }
  deriving (TrafficPolicySummary -> TrafficPolicySummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TrafficPolicySummary -> TrafficPolicySummary -> Bool
$c/= :: TrafficPolicySummary -> TrafficPolicySummary -> Bool
== :: TrafficPolicySummary -> TrafficPolicySummary -> Bool
$c== :: TrafficPolicySummary -> TrafficPolicySummary -> Bool
Prelude.Eq, ReadPrec [TrafficPolicySummary]
ReadPrec TrafficPolicySummary
Int -> ReadS TrafficPolicySummary
ReadS [TrafficPolicySummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TrafficPolicySummary]
$creadListPrec :: ReadPrec [TrafficPolicySummary]
readPrec :: ReadPrec TrafficPolicySummary
$creadPrec :: ReadPrec TrafficPolicySummary
readList :: ReadS [TrafficPolicySummary]
$creadList :: ReadS [TrafficPolicySummary]
readsPrec :: Int -> ReadS TrafficPolicySummary
$creadsPrec :: Int -> ReadS TrafficPolicySummary
Prelude.Read, Int -> TrafficPolicySummary -> ShowS
[TrafficPolicySummary] -> ShowS
TrafficPolicySummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TrafficPolicySummary] -> ShowS
$cshowList :: [TrafficPolicySummary] -> ShowS
show :: TrafficPolicySummary -> String
$cshow :: TrafficPolicySummary -> String
showsPrec :: Int -> TrafficPolicySummary -> ShowS
$cshowsPrec :: Int -> TrafficPolicySummary -> ShowS
Prelude.Show, forall x. Rep TrafficPolicySummary x -> TrafficPolicySummary
forall x. TrafficPolicySummary -> Rep TrafficPolicySummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TrafficPolicySummary x -> TrafficPolicySummary
$cfrom :: forall x. TrafficPolicySummary -> Rep TrafficPolicySummary x
Prelude.Generic)

-- |
-- Create a value of 'TrafficPolicySummary' 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:
--
-- 'id', 'trafficPolicySummary_id' - The ID that Amazon Route 53 assigned to the traffic policy when you
-- created it.
--
-- 'name', 'trafficPolicySummary_name' - The name that you specified for the traffic policy when you created it.
--
-- 'type'', 'trafficPolicySummary_type' - The DNS type of the resource record sets that Amazon Route 53 creates
-- when you use a traffic policy to create a traffic policy instance.
--
-- 'latestVersion', 'trafficPolicySummary_latestVersion' - The version number of the latest version of the traffic policy.
--
-- 'trafficPolicyCount', 'trafficPolicySummary_trafficPolicyCount' - The number of traffic policies that are associated with the current
-- Amazon Web Services account.
newTrafficPolicySummary ::
  -- | 'id'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'type''
  RRType ->
  -- | 'latestVersion'
  Prelude.Natural ->
  -- | 'trafficPolicyCount'
  Prelude.Natural ->
  TrafficPolicySummary
newTrafficPolicySummary :: Text
-> Text -> RRType -> Natural -> Natural -> TrafficPolicySummary
newTrafficPolicySummary
  Text
pId_
  Text
pName_
  RRType
pType_
  Natural
pLatestVersion_
  Natural
pTrafficPolicyCount_ =
    TrafficPolicySummary'
      { $sel:id:TrafficPolicySummary' :: Text
id = Text
pId_,
        $sel:name:TrafficPolicySummary' :: Text
name = Text
pName_,
        $sel:type':TrafficPolicySummary' :: RRType
type' = RRType
pType_,
        $sel:latestVersion:TrafficPolicySummary' :: Natural
latestVersion = Natural
pLatestVersion_,
        $sel:trafficPolicyCount:TrafficPolicySummary' :: Natural
trafficPolicyCount = Natural
pTrafficPolicyCount_
      }

-- | The ID that Amazon Route 53 assigned to the traffic policy when you
-- created it.
trafficPolicySummary_id :: Lens.Lens' TrafficPolicySummary Prelude.Text
trafficPolicySummary_id :: Lens' TrafficPolicySummary Text
trafficPolicySummary_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrafficPolicySummary' {Text
id :: Text
$sel:id:TrafficPolicySummary' :: TrafficPolicySummary -> Text
id} -> Text
id) (\s :: TrafficPolicySummary
s@TrafficPolicySummary' {} Text
a -> TrafficPolicySummary
s {$sel:id:TrafficPolicySummary' :: Text
id = Text
a} :: TrafficPolicySummary)

-- | The name that you specified for the traffic policy when you created it.
trafficPolicySummary_name :: Lens.Lens' TrafficPolicySummary Prelude.Text
trafficPolicySummary_name :: Lens' TrafficPolicySummary Text
trafficPolicySummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrafficPolicySummary' {Text
name :: Text
$sel:name:TrafficPolicySummary' :: TrafficPolicySummary -> Text
name} -> Text
name) (\s :: TrafficPolicySummary
s@TrafficPolicySummary' {} Text
a -> TrafficPolicySummary
s {$sel:name:TrafficPolicySummary' :: Text
name = Text
a} :: TrafficPolicySummary)

-- | The DNS type of the resource record sets that Amazon Route 53 creates
-- when you use a traffic policy to create a traffic policy instance.
trafficPolicySummary_type :: Lens.Lens' TrafficPolicySummary RRType
trafficPolicySummary_type :: Lens' TrafficPolicySummary RRType
trafficPolicySummary_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrafficPolicySummary' {RRType
type' :: RRType
$sel:type':TrafficPolicySummary' :: TrafficPolicySummary -> RRType
type'} -> RRType
type') (\s :: TrafficPolicySummary
s@TrafficPolicySummary' {} RRType
a -> TrafficPolicySummary
s {$sel:type':TrafficPolicySummary' :: RRType
type' = RRType
a} :: TrafficPolicySummary)

-- | The version number of the latest version of the traffic policy.
trafficPolicySummary_latestVersion :: Lens.Lens' TrafficPolicySummary Prelude.Natural
trafficPolicySummary_latestVersion :: Lens' TrafficPolicySummary Natural
trafficPolicySummary_latestVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrafficPolicySummary' {Natural
latestVersion :: Natural
$sel:latestVersion:TrafficPolicySummary' :: TrafficPolicySummary -> Natural
latestVersion} -> Natural
latestVersion) (\s :: TrafficPolicySummary
s@TrafficPolicySummary' {} Natural
a -> TrafficPolicySummary
s {$sel:latestVersion:TrafficPolicySummary' :: Natural
latestVersion = Natural
a} :: TrafficPolicySummary)

-- | The number of traffic policies that are associated with the current
-- Amazon Web Services account.
trafficPolicySummary_trafficPolicyCount :: Lens.Lens' TrafficPolicySummary Prelude.Natural
trafficPolicySummary_trafficPolicyCount :: Lens' TrafficPolicySummary Natural
trafficPolicySummary_trafficPolicyCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrafficPolicySummary' {Natural
trafficPolicyCount :: Natural
$sel:trafficPolicyCount:TrafficPolicySummary' :: TrafficPolicySummary -> Natural
trafficPolicyCount} -> Natural
trafficPolicyCount) (\s :: TrafficPolicySummary
s@TrafficPolicySummary' {} Natural
a -> TrafficPolicySummary
s {$sel:trafficPolicyCount:TrafficPolicySummary' :: Natural
trafficPolicyCount = Natural
a} :: TrafficPolicySummary)

instance Data.FromXML TrafficPolicySummary where
  parseXML :: [Node] -> Either String TrafficPolicySummary
parseXML [Node]
x =
    Text
-> Text -> RRType -> Natural -> Natural -> TrafficPolicySummary
TrafficPolicySummary'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Id")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Name")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Type")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"LatestVersion")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"TrafficPolicyCount")

instance Prelude.Hashable TrafficPolicySummary where
  hashWithSalt :: Int -> TrafficPolicySummary -> Int
hashWithSalt Int
_salt TrafficPolicySummary' {Natural
Text
RRType
trafficPolicyCount :: Natural
latestVersion :: Natural
type' :: RRType
name :: Text
id :: Text
$sel:trafficPolicyCount:TrafficPolicySummary' :: TrafficPolicySummary -> Natural
$sel:latestVersion:TrafficPolicySummary' :: TrafficPolicySummary -> Natural
$sel:type':TrafficPolicySummary' :: TrafficPolicySummary -> RRType
$sel:name:TrafficPolicySummary' :: TrafficPolicySummary -> Text
$sel:id:TrafficPolicySummary' :: TrafficPolicySummary -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RRType
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
latestVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
trafficPolicyCount

instance Prelude.NFData TrafficPolicySummary where
  rnf :: TrafficPolicySummary -> ()
rnf TrafficPolicySummary' {Natural
Text
RRType
trafficPolicyCount :: Natural
latestVersion :: Natural
type' :: RRType
name :: Text
id :: Text
$sel:trafficPolicyCount:TrafficPolicySummary' :: TrafficPolicySummary -> Natural
$sel:latestVersion:TrafficPolicySummary' :: TrafficPolicySummary -> Natural
$sel:type':TrafficPolicySummary' :: TrafficPolicySummary -> RRType
$sel:name:TrafficPolicySummary' :: TrafficPolicySummary -> Text
$sel:id:TrafficPolicySummary' :: TrafficPolicySummary -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RRType
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
latestVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
trafficPolicyCount