{-# 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.CollectionSummary
-- 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.CollectionSummary 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

-- | A complex type that is an entry in an
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_CidrCollection.html CidrCollection>
-- array.
--
-- /See:/ 'newCollectionSummary' smart constructor.
data CollectionSummary = CollectionSummary'
  { -- | The ARN of the collection summary. Can be used to reference the
    -- collection in IAM policy or cross-account.
    CollectionSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | Unique ID for the CIDR collection.
    CollectionSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The name of a CIDR collection.
    CollectionSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | A sequential counter that Route 53 sets to 1 when you create a CIDR
    -- collection and increments by 1 each time you update settings for the
    -- CIDR collection.
    CollectionSummary -> Maybe Natural
version :: Prelude.Maybe Prelude.Natural
  }
  deriving (CollectionSummary -> CollectionSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CollectionSummary -> CollectionSummary -> Bool
$c/= :: CollectionSummary -> CollectionSummary -> Bool
== :: CollectionSummary -> CollectionSummary -> Bool
$c== :: CollectionSummary -> CollectionSummary -> Bool
Prelude.Eq, ReadPrec [CollectionSummary]
ReadPrec CollectionSummary
Int -> ReadS CollectionSummary
ReadS [CollectionSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CollectionSummary]
$creadListPrec :: ReadPrec [CollectionSummary]
readPrec :: ReadPrec CollectionSummary
$creadPrec :: ReadPrec CollectionSummary
readList :: ReadS [CollectionSummary]
$creadList :: ReadS [CollectionSummary]
readsPrec :: Int -> ReadS CollectionSummary
$creadsPrec :: Int -> ReadS CollectionSummary
Prelude.Read, Int -> CollectionSummary -> ShowS
[CollectionSummary] -> ShowS
CollectionSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CollectionSummary] -> ShowS
$cshowList :: [CollectionSummary] -> ShowS
show :: CollectionSummary -> String
$cshow :: CollectionSummary -> String
showsPrec :: Int -> CollectionSummary -> ShowS
$cshowsPrec :: Int -> CollectionSummary -> ShowS
Prelude.Show, forall x. Rep CollectionSummary x -> CollectionSummary
forall x. CollectionSummary -> Rep CollectionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CollectionSummary x -> CollectionSummary
$cfrom :: forall x. CollectionSummary -> Rep CollectionSummary x
Prelude.Generic)

-- |
-- Create a value of 'CollectionSummary' 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:
--
-- 'arn', 'collectionSummary_arn' - The ARN of the collection summary. Can be used to reference the
-- collection in IAM policy or cross-account.
--
-- 'id', 'collectionSummary_id' - Unique ID for the CIDR collection.
--
-- 'name', 'collectionSummary_name' - The name of a CIDR collection.
--
-- 'version', 'collectionSummary_version' - A sequential counter that Route 53 sets to 1 when you create a CIDR
-- collection and increments by 1 each time you update settings for the
-- CIDR collection.
newCollectionSummary ::
  CollectionSummary
newCollectionSummary :: CollectionSummary
newCollectionSummary =
  CollectionSummary'
    { $sel:arn:CollectionSummary' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:id:CollectionSummary' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CollectionSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:version:CollectionSummary' :: Maybe Natural
version = forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the collection summary. Can be used to reference the
-- collection in IAM policy or cross-account.
collectionSummary_arn :: Lens.Lens' CollectionSummary (Prelude.Maybe Prelude.Text)
collectionSummary_arn :: Lens' CollectionSummary (Maybe Text)
collectionSummary_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CollectionSummary' {Maybe Text
arn :: Maybe Text
$sel:arn:CollectionSummary' :: CollectionSummary -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CollectionSummary
s@CollectionSummary' {} Maybe Text
a -> CollectionSummary
s {$sel:arn:CollectionSummary' :: Maybe Text
arn = Maybe Text
a} :: CollectionSummary)

-- | Unique ID for the CIDR collection.
collectionSummary_id :: Lens.Lens' CollectionSummary (Prelude.Maybe Prelude.Text)
collectionSummary_id :: Lens' CollectionSummary (Maybe Text)
collectionSummary_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CollectionSummary' {Maybe Text
id :: Maybe Text
$sel:id:CollectionSummary' :: CollectionSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: CollectionSummary
s@CollectionSummary' {} Maybe Text
a -> CollectionSummary
s {$sel:id:CollectionSummary' :: Maybe Text
id = Maybe Text
a} :: CollectionSummary)

-- | The name of a CIDR collection.
collectionSummary_name :: Lens.Lens' CollectionSummary (Prelude.Maybe Prelude.Text)
collectionSummary_name :: Lens' CollectionSummary (Maybe Text)
collectionSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CollectionSummary' {Maybe Text
name :: Maybe Text
$sel:name:CollectionSummary' :: CollectionSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: CollectionSummary
s@CollectionSummary' {} Maybe Text
a -> CollectionSummary
s {$sel:name:CollectionSummary' :: Maybe Text
name = Maybe Text
a} :: CollectionSummary)

-- | A sequential counter that Route 53 sets to 1 when you create a CIDR
-- collection and increments by 1 each time you update settings for the
-- CIDR collection.
collectionSummary_version :: Lens.Lens' CollectionSummary (Prelude.Maybe Prelude.Natural)
collectionSummary_version :: Lens' CollectionSummary (Maybe Natural)
collectionSummary_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CollectionSummary' {Maybe Natural
version :: Maybe Natural
$sel:version:CollectionSummary' :: CollectionSummary -> Maybe Natural
version} -> Maybe Natural
version) (\s :: CollectionSummary
s@CollectionSummary' {} Maybe Natural
a -> CollectionSummary
s {$sel:version:CollectionSummary' :: Maybe Natural
version = Maybe Natural
a} :: CollectionSummary)

instance Data.FromXML CollectionSummary where
  parseXML :: [Node] -> Either String CollectionSummary
parseXML [Node]
x =
    Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Natural -> CollectionSummary
CollectionSummary'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Arn")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe 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 (Maybe 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 (Maybe a)
Data..@? Text
"Version")

instance Prelude.Hashable CollectionSummary where
  hashWithSalt :: Int -> CollectionSummary -> Int
hashWithSalt Int
_salt CollectionSummary' {Maybe Natural
Maybe Text
version :: Maybe Natural
name :: Maybe Text
id :: Maybe Text
arn :: Maybe Text
$sel:version:CollectionSummary' :: CollectionSummary -> Maybe Natural
$sel:name:CollectionSummary' :: CollectionSummary -> Maybe Text
$sel:id:CollectionSummary' :: CollectionSummary -> Maybe Text
$sel:arn:CollectionSummary' :: CollectionSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
version

instance Prelude.NFData CollectionSummary where
  rnf :: CollectionSummary -> ()
rnf CollectionSummary' {Maybe Natural
Maybe Text
version :: Maybe Natural
name :: Maybe Text
id :: Maybe Text
arn :: Maybe Text
$sel:version:CollectionSummary' :: CollectionSummary -> Maybe Natural
$sel:name:CollectionSummary' :: CollectionSummary -> Maybe Text
$sel:id:CollectionSummary' :: CollectionSummary -> Maybe Text
$sel:arn:CollectionSummary' :: CollectionSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
version