{-# 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.EC2.Types.Ipv6Pool
-- 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.EC2.Types.Ipv6Pool where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import Amazonka.EC2.Types.PoolCidrBlock
import Amazonka.EC2.Types.Tag
import qualified Amazonka.Prelude as Prelude

-- | Describes an IPv6 address pool.
--
-- /See:/ 'newIpv6Pool' smart constructor.
data Ipv6Pool = Ipv6Pool'
  { -- | The description for the address pool.
    Ipv6Pool -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The CIDR blocks for the address pool.
    Ipv6Pool -> Maybe [PoolCidrBlock]
poolCidrBlocks :: Prelude.Maybe [PoolCidrBlock],
    -- | The ID of the address pool.
    Ipv6Pool -> Maybe Text
poolId :: Prelude.Maybe Prelude.Text,
    -- | Any tags for the address pool.
    Ipv6Pool -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  deriving (Ipv6Pool -> Ipv6Pool -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Ipv6Pool -> Ipv6Pool -> Bool
$c/= :: Ipv6Pool -> Ipv6Pool -> Bool
== :: Ipv6Pool -> Ipv6Pool -> Bool
$c== :: Ipv6Pool -> Ipv6Pool -> Bool
Prelude.Eq, ReadPrec [Ipv6Pool]
ReadPrec Ipv6Pool
Int -> ReadS Ipv6Pool
ReadS [Ipv6Pool]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Ipv6Pool]
$creadListPrec :: ReadPrec [Ipv6Pool]
readPrec :: ReadPrec Ipv6Pool
$creadPrec :: ReadPrec Ipv6Pool
readList :: ReadS [Ipv6Pool]
$creadList :: ReadS [Ipv6Pool]
readsPrec :: Int -> ReadS Ipv6Pool
$creadsPrec :: Int -> ReadS Ipv6Pool
Prelude.Read, Int -> Ipv6Pool -> ShowS
[Ipv6Pool] -> ShowS
Ipv6Pool -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Ipv6Pool] -> ShowS
$cshowList :: [Ipv6Pool] -> ShowS
show :: Ipv6Pool -> String
$cshow :: Ipv6Pool -> String
showsPrec :: Int -> Ipv6Pool -> ShowS
$cshowsPrec :: Int -> Ipv6Pool -> ShowS
Prelude.Show, forall x. Rep Ipv6Pool x -> Ipv6Pool
forall x. Ipv6Pool -> Rep Ipv6Pool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Ipv6Pool x -> Ipv6Pool
$cfrom :: forall x. Ipv6Pool -> Rep Ipv6Pool x
Prelude.Generic)

-- |
-- Create a value of 'Ipv6Pool' 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:
--
-- 'description', 'ipv6Pool_description' - The description for the address pool.
--
-- 'poolCidrBlocks', 'ipv6Pool_poolCidrBlocks' - The CIDR blocks for the address pool.
--
-- 'poolId', 'ipv6Pool_poolId' - The ID of the address pool.
--
-- 'tags', 'ipv6Pool_tags' - Any tags for the address pool.
newIpv6Pool ::
  Ipv6Pool
newIpv6Pool :: Ipv6Pool
newIpv6Pool =
  Ipv6Pool'
    { $sel:description:Ipv6Pool' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:poolCidrBlocks:Ipv6Pool' :: Maybe [PoolCidrBlock]
poolCidrBlocks = forall a. Maybe a
Prelude.Nothing,
      $sel:poolId:Ipv6Pool' :: Maybe Text
poolId = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:Ipv6Pool' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The description for the address pool.
ipv6Pool_description :: Lens.Lens' Ipv6Pool (Prelude.Maybe Prelude.Text)
ipv6Pool_description :: Lens' Ipv6Pool (Maybe Text)
ipv6Pool_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ipv6Pool' {Maybe Text
description :: Maybe Text
$sel:description:Ipv6Pool' :: Ipv6Pool -> Maybe Text
description} -> Maybe Text
description) (\s :: Ipv6Pool
s@Ipv6Pool' {} Maybe Text
a -> Ipv6Pool
s {$sel:description:Ipv6Pool' :: Maybe Text
description = Maybe Text
a} :: Ipv6Pool)

-- | The CIDR blocks for the address pool.
ipv6Pool_poolCidrBlocks :: Lens.Lens' Ipv6Pool (Prelude.Maybe [PoolCidrBlock])
ipv6Pool_poolCidrBlocks :: Lens' Ipv6Pool (Maybe [PoolCidrBlock])
ipv6Pool_poolCidrBlocks = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ipv6Pool' {Maybe [PoolCidrBlock]
poolCidrBlocks :: Maybe [PoolCidrBlock]
$sel:poolCidrBlocks:Ipv6Pool' :: Ipv6Pool -> Maybe [PoolCidrBlock]
poolCidrBlocks} -> Maybe [PoolCidrBlock]
poolCidrBlocks) (\s :: Ipv6Pool
s@Ipv6Pool' {} Maybe [PoolCidrBlock]
a -> Ipv6Pool
s {$sel:poolCidrBlocks:Ipv6Pool' :: Maybe [PoolCidrBlock]
poolCidrBlocks = Maybe [PoolCidrBlock]
a} :: Ipv6Pool) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the address pool.
ipv6Pool_poolId :: Lens.Lens' Ipv6Pool (Prelude.Maybe Prelude.Text)
ipv6Pool_poolId :: Lens' Ipv6Pool (Maybe Text)
ipv6Pool_poolId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ipv6Pool' {Maybe Text
poolId :: Maybe Text
$sel:poolId:Ipv6Pool' :: Ipv6Pool -> Maybe Text
poolId} -> Maybe Text
poolId) (\s :: Ipv6Pool
s@Ipv6Pool' {} Maybe Text
a -> Ipv6Pool
s {$sel:poolId:Ipv6Pool' :: Maybe Text
poolId = Maybe Text
a} :: Ipv6Pool)

-- | Any tags for the address pool.
ipv6Pool_tags :: Lens.Lens' Ipv6Pool (Prelude.Maybe [Tag])
ipv6Pool_tags :: Lens' Ipv6Pool (Maybe [Tag])
ipv6Pool_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ipv6Pool' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:Ipv6Pool' :: Ipv6Pool -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: Ipv6Pool
s@Ipv6Pool' {} Maybe [Tag]
a -> Ipv6Pool
s {$sel:tags:Ipv6Pool' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: Ipv6Pool) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromXML Ipv6Pool where
  parseXML :: [Node] -> Either String Ipv6Pool
parseXML [Node]
x =
    Maybe Text
-> Maybe [PoolCidrBlock] -> Maybe Text -> Maybe [Tag] -> Ipv6Pool
Ipv6Pool'
      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
"description")
      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
"poolCidrBlockSet"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                  )
      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
"poolId")
      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
"tagSet"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                  )

instance Prelude.Hashable Ipv6Pool where
  hashWithSalt :: Int -> Ipv6Pool -> Int
hashWithSalt Int
_salt Ipv6Pool' {Maybe [PoolCidrBlock]
Maybe [Tag]
Maybe Text
tags :: Maybe [Tag]
poolId :: Maybe Text
poolCidrBlocks :: Maybe [PoolCidrBlock]
description :: Maybe Text
$sel:tags:Ipv6Pool' :: Ipv6Pool -> Maybe [Tag]
$sel:poolId:Ipv6Pool' :: Ipv6Pool -> Maybe Text
$sel:poolCidrBlocks:Ipv6Pool' :: Ipv6Pool -> Maybe [PoolCidrBlock]
$sel:description:Ipv6Pool' :: Ipv6Pool -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [PoolCidrBlock]
poolCidrBlocks
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
poolId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags

instance Prelude.NFData Ipv6Pool where
  rnf :: Ipv6Pool -> ()
rnf Ipv6Pool' {Maybe [PoolCidrBlock]
Maybe [Tag]
Maybe Text
tags :: Maybe [Tag]
poolId :: Maybe Text
poolCidrBlocks :: Maybe [PoolCidrBlock]
description :: Maybe Text
$sel:tags:Ipv6Pool' :: Ipv6Pool -> Maybe [Tag]
$sel:poolId:Ipv6Pool' :: Ipv6Pool -> Maybe Text
$sel:poolCidrBlocks:Ipv6Pool' :: Ipv6Pool -> Maybe [PoolCidrBlock]
$sel:description:Ipv6Pool' :: Ipv6Pool -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [PoolCidrBlock]
poolCidrBlocks
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
poolId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags