{-# 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-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.Route53.Types.TrafficPolicySummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(TrafficPolicySummary -> TrafficPolicySummary -> Bool)
-> (TrafficPolicySummary -> TrafficPolicySummary -> Bool)
-> Eq TrafficPolicySummary
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]
(Int -> ReadS TrafficPolicySummary)
-> ReadS [TrafficPolicySummary]
-> ReadPrec TrafficPolicySummary
-> ReadPrec [TrafficPolicySummary]
-> Read 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
(Int -> TrafficPolicySummary -> ShowS)
-> (TrafficPolicySummary -> String)
-> ([TrafficPolicySummary] -> ShowS)
-> Show TrafficPolicySummary
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. TrafficPolicySummary -> Rep TrafficPolicySummary x)
-> (forall x. Rep TrafficPolicySummary x -> TrafficPolicySummary)
-> Generic TrafficPolicySummary
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' :: Text
-> Text -> RRType -> Natural -> Natural -> TrafficPolicySummary
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 :: (Text -> f Text) -> TrafficPolicySummary -> f TrafficPolicySummary
trafficPolicySummary_id = (TrafficPolicySummary -> Text)
-> (TrafficPolicySummary -> Text -> TrafficPolicySummary)
-> Lens TrafficPolicySummary TrafficPolicySummary Text Text
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 :: (Text -> f Text) -> TrafficPolicySummary -> f TrafficPolicySummary
trafficPolicySummary_name = (TrafficPolicySummary -> Text)
-> (TrafficPolicySummary -> Text -> TrafficPolicySummary)
-> Lens TrafficPolicySummary TrafficPolicySummary Text Text
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 :: (RRType -> f RRType)
-> TrafficPolicySummary -> f TrafficPolicySummary
trafficPolicySummary_type = (TrafficPolicySummary -> RRType)
-> (TrafficPolicySummary -> RRType -> TrafficPolicySummary)
-> Lens TrafficPolicySummary TrafficPolicySummary RRType RRType
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 :: (Natural -> f Natural)
-> TrafficPolicySummary -> f TrafficPolicySummary
trafficPolicySummary_latestVersion = (TrafficPolicySummary -> Natural)
-> (TrafficPolicySummary -> Natural -> TrafficPolicySummary)
-> Lens TrafficPolicySummary TrafficPolicySummary Natural Natural
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 :: (Natural -> f Natural)
-> TrafficPolicySummary -> f TrafficPolicySummary
trafficPolicySummary_trafficPolicyCount = (TrafficPolicySummary -> Natural)
-> (TrafficPolicySummary -> Natural -> TrafficPolicySummary)
-> Lens TrafficPolicySummary TrafficPolicySummary Natural Natural
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 Core.FromXML TrafficPolicySummary where
  parseXML :: [Node] -> Either String TrafficPolicySummary
parseXML [Node]
x =
    Text
-> Text -> RRType -> Natural -> Natural -> TrafficPolicySummary
TrafficPolicySummary'
      (Text
 -> Text -> RRType -> Natural -> Natural -> TrafficPolicySummary)
-> Either String Text
-> Either
     String
     (Text -> RRType -> Natural -> Natural -> TrafficPolicySummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Id")
      Either
  String
  (Text -> RRType -> Natural -> Natural -> TrafficPolicySummary)
-> Either String Text
-> Either
     String (RRType -> Natural -> Natural -> TrafficPolicySummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Name")
      Either
  String (RRType -> Natural -> Natural -> TrafficPolicySummary)
-> Either String RRType
-> Either String (Natural -> Natural -> TrafficPolicySummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String RRType
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Type")
      Either String (Natural -> Natural -> TrafficPolicySummary)
-> Either String Natural
-> Either String (Natural -> TrafficPolicySummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Natural
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"LatestVersion")
      Either String (Natural -> TrafficPolicySummary)
-> Either String Natural -> Either String TrafficPolicySummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Natural
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"TrafficPolicyCount")

instance Prelude.Hashable TrafficPolicySummary

instance Prelude.NFData TrafficPolicySummary