{-# 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.CidrCollection
-- 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.CidrCollection 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 identifies a CIDR collection.
--
-- /See:/ 'newCidrCollection' smart constructor.
data CidrCollection = CidrCollection'
  { -- | The ARN of the collection. Can be used to reference the collection in
    -- IAM policy or in another Amazon Web Services account.
    CidrCollection -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The unique ID of the CIDR collection.
    CidrCollection -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The name of a CIDR collection.
    CidrCollection -> 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.
    CidrCollection -> Maybe Natural
version :: Prelude.Maybe Prelude.Natural
  }
  deriving (CidrCollection -> CidrCollection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CidrCollection -> CidrCollection -> Bool
$c/= :: CidrCollection -> CidrCollection -> Bool
== :: CidrCollection -> CidrCollection -> Bool
$c== :: CidrCollection -> CidrCollection -> Bool
Prelude.Eq, ReadPrec [CidrCollection]
ReadPrec CidrCollection
Int -> ReadS CidrCollection
ReadS [CidrCollection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CidrCollection]
$creadListPrec :: ReadPrec [CidrCollection]
readPrec :: ReadPrec CidrCollection
$creadPrec :: ReadPrec CidrCollection
readList :: ReadS [CidrCollection]
$creadList :: ReadS [CidrCollection]
readsPrec :: Int -> ReadS CidrCollection
$creadsPrec :: Int -> ReadS CidrCollection
Prelude.Read, Int -> CidrCollection -> ShowS
[CidrCollection] -> ShowS
CidrCollection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CidrCollection] -> ShowS
$cshowList :: [CidrCollection] -> ShowS
show :: CidrCollection -> String
$cshow :: CidrCollection -> String
showsPrec :: Int -> CidrCollection -> ShowS
$cshowsPrec :: Int -> CidrCollection -> ShowS
Prelude.Show, forall x. Rep CidrCollection x -> CidrCollection
forall x. CidrCollection -> Rep CidrCollection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CidrCollection x -> CidrCollection
$cfrom :: forall x. CidrCollection -> Rep CidrCollection x
Prelude.Generic)

-- |
-- Create a value of 'CidrCollection' 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', 'cidrCollection_arn' - The ARN of the collection. Can be used to reference the collection in
-- IAM policy or in another Amazon Web Services account.
--
-- 'id', 'cidrCollection_id' - The unique ID of the CIDR collection.
--
-- 'name', 'cidrCollection_name' - The name of a CIDR collection.
--
-- 'version', 'cidrCollection_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.
newCidrCollection ::
  CidrCollection
newCidrCollection :: CidrCollection
newCidrCollection =
  CidrCollection'
    { $sel:arn:CidrCollection' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:id:CidrCollection' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CidrCollection' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:version:CidrCollection' :: Maybe Natural
version = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The unique ID of the CIDR collection.
cidrCollection_id :: Lens.Lens' CidrCollection (Prelude.Maybe Prelude.Text)
cidrCollection_id :: Lens' CidrCollection (Maybe Text)
cidrCollection_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CidrCollection' {Maybe Text
id :: Maybe Text
$sel:id:CidrCollection' :: CidrCollection -> Maybe Text
id} -> Maybe Text
id) (\s :: CidrCollection
s@CidrCollection' {} Maybe Text
a -> CidrCollection
s {$sel:id:CidrCollection' :: Maybe Text
id = Maybe Text
a} :: CidrCollection)

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

-- | 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.
cidrCollection_version :: Lens.Lens' CidrCollection (Prelude.Maybe Prelude.Natural)
cidrCollection_version :: Lens' CidrCollection (Maybe Natural)
cidrCollection_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CidrCollection' {Maybe Natural
version :: Maybe Natural
$sel:version:CidrCollection' :: CidrCollection -> Maybe Natural
version} -> Maybe Natural
version) (\s :: CidrCollection
s@CidrCollection' {} Maybe Natural
a -> CidrCollection
s {$sel:version:CidrCollection' :: Maybe Natural
version = Maybe Natural
a} :: CidrCollection)

instance Data.FromXML CidrCollection where
  parseXML :: [Node] -> Either String CidrCollection
parseXML [Node]
x =
    Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Natural -> CidrCollection
CidrCollection'
      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 CidrCollection where
  hashWithSalt :: Int -> CidrCollection -> Int
hashWithSalt Int
_salt CidrCollection' {Maybe Natural
Maybe Text
version :: Maybe Natural
name :: Maybe Text
id :: Maybe Text
arn :: Maybe Text
$sel:version:CidrCollection' :: CidrCollection -> Maybe Natural
$sel:name:CidrCollection' :: CidrCollection -> Maybe Text
$sel:id:CidrCollection' :: CidrCollection -> Maybe Text
$sel:arn:CidrCollection' :: CidrCollection -> 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 CidrCollection where
  rnf :: CidrCollection -> ()
rnf CidrCollection' {Maybe Natural
Maybe Text
version :: Maybe Natural
name :: Maybe Text
id :: Maybe Text
arn :: Maybe Text
$sel:version:CidrCollection' :: CidrCollection -> Maybe Natural
$sel:name:CidrCollection' :: CidrCollection -> Maybe Text
$sel:id:CidrCollection' :: CidrCollection -> Maybe Text
$sel:arn:CidrCollection' :: CidrCollection -> 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