{-# 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.CoipPool
-- 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.CoipPool 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.Tag
import qualified Amazonka.Prelude as Prelude

-- | Describes a customer-owned address pool.
--
-- /See:/ 'newCoipPool' smart constructor.
data CoipPool = CoipPool'
  { -- | The ID of the local gateway route table.
    CoipPool -> Maybe Text
localGatewayRouteTableId :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the address pool.
    CoipPool -> Maybe Text
poolArn :: Prelude.Maybe Prelude.Text,
    -- | The address ranges of the address pool.
    CoipPool -> Maybe [Text]
poolCidrs :: Prelude.Maybe [Prelude.Text],
    -- | The ID of the address pool.
    CoipPool -> Maybe Text
poolId :: Prelude.Maybe Prelude.Text,
    -- | The tags.
    CoipPool -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  deriving (CoipPool -> CoipPool -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CoipPool -> CoipPool -> Bool
$c/= :: CoipPool -> CoipPool -> Bool
== :: CoipPool -> CoipPool -> Bool
$c== :: CoipPool -> CoipPool -> Bool
Prelude.Eq, ReadPrec [CoipPool]
ReadPrec CoipPool
Int -> ReadS CoipPool
ReadS [CoipPool]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CoipPool]
$creadListPrec :: ReadPrec [CoipPool]
readPrec :: ReadPrec CoipPool
$creadPrec :: ReadPrec CoipPool
readList :: ReadS [CoipPool]
$creadList :: ReadS [CoipPool]
readsPrec :: Int -> ReadS CoipPool
$creadsPrec :: Int -> ReadS CoipPool
Prelude.Read, Int -> CoipPool -> ShowS
[CoipPool] -> ShowS
CoipPool -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CoipPool] -> ShowS
$cshowList :: [CoipPool] -> ShowS
show :: CoipPool -> String
$cshow :: CoipPool -> String
showsPrec :: Int -> CoipPool -> ShowS
$cshowsPrec :: Int -> CoipPool -> ShowS
Prelude.Show, forall x. Rep CoipPool x -> CoipPool
forall x. CoipPool -> Rep CoipPool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CoipPool x -> CoipPool
$cfrom :: forall x. CoipPool -> Rep CoipPool x
Prelude.Generic)

-- |
-- Create a value of 'CoipPool' 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:
--
-- 'localGatewayRouteTableId', 'coipPool_localGatewayRouteTableId' - The ID of the local gateway route table.
--
-- 'poolArn', 'coipPool_poolArn' - The ARN of the address pool.
--
-- 'poolCidrs', 'coipPool_poolCidrs' - The address ranges of the address pool.
--
-- 'poolId', 'coipPool_poolId' - The ID of the address pool.
--
-- 'tags', 'coipPool_tags' - The tags.
newCoipPool ::
  CoipPool
newCoipPool :: CoipPool
newCoipPool =
  CoipPool'
    { $sel:localGatewayRouteTableId:CoipPool' :: Maybe Text
localGatewayRouteTableId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:poolArn:CoipPool' :: Maybe Text
poolArn = forall a. Maybe a
Prelude.Nothing,
      $sel:poolCidrs:CoipPool' :: Maybe [Text]
poolCidrs = forall a. Maybe a
Prelude.Nothing,
      $sel:poolId:CoipPool' :: Maybe Text
poolId = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CoipPool' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the local gateway route table.
coipPool_localGatewayRouteTableId :: Lens.Lens' CoipPool (Prelude.Maybe Prelude.Text)
coipPool_localGatewayRouteTableId :: Lens' CoipPool (Maybe Text)
coipPool_localGatewayRouteTableId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CoipPool' {Maybe Text
localGatewayRouteTableId :: Maybe Text
$sel:localGatewayRouteTableId:CoipPool' :: CoipPool -> Maybe Text
localGatewayRouteTableId} -> Maybe Text
localGatewayRouteTableId) (\s :: CoipPool
s@CoipPool' {} Maybe Text
a -> CoipPool
s {$sel:localGatewayRouteTableId:CoipPool' :: Maybe Text
localGatewayRouteTableId = Maybe Text
a} :: CoipPool)

-- | The ARN of the address pool.
coipPool_poolArn :: Lens.Lens' CoipPool (Prelude.Maybe Prelude.Text)
coipPool_poolArn :: Lens' CoipPool (Maybe Text)
coipPool_poolArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CoipPool' {Maybe Text
poolArn :: Maybe Text
$sel:poolArn:CoipPool' :: CoipPool -> Maybe Text
poolArn} -> Maybe Text
poolArn) (\s :: CoipPool
s@CoipPool' {} Maybe Text
a -> CoipPool
s {$sel:poolArn:CoipPool' :: Maybe Text
poolArn = Maybe Text
a} :: CoipPool)

-- | The address ranges of the address pool.
coipPool_poolCidrs :: Lens.Lens' CoipPool (Prelude.Maybe [Prelude.Text])
coipPool_poolCidrs :: Lens' CoipPool (Maybe [Text])
coipPool_poolCidrs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CoipPool' {Maybe [Text]
poolCidrs :: Maybe [Text]
$sel:poolCidrs:CoipPool' :: CoipPool -> Maybe [Text]
poolCidrs} -> Maybe [Text]
poolCidrs) (\s :: CoipPool
s@CoipPool' {} Maybe [Text]
a -> CoipPool
s {$sel:poolCidrs:CoipPool' :: Maybe [Text]
poolCidrs = Maybe [Text]
a} :: CoipPool) 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.
coipPool_poolId :: Lens.Lens' CoipPool (Prelude.Maybe Prelude.Text)
coipPool_poolId :: Lens' CoipPool (Maybe Text)
coipPool_poolId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CoipPool' {Maybe Text
poolId :: Maybe Text
$sel:poolId:CoipPool' :: CoipPool -> Maybe Text
poolId} -> Maybe Text
poolId) (\s :: CoipPool
s@CoipPool' {} Maybe Text
a -> CoipPool
s {$sel:poolId:CoipPool' :: Maybe Text
poolId = Maybe Text
a} :: CoipPool)

-- | The tags.
coipPool_tags :: Lens.Lens' CoipPool (Prelude.Maybe [Tag])
coipPool_tags :: Lens' CoipPool (Maybe [Tag])
coipPool_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CoipPool' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CoipPool' :: CoipPool -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CoipPool
s@CoipPool' {} Maybe [Tag]
a -> CoipPool
s {$sel:tags:CoipPool' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CoipPool) 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 CoipPool where
  parseXML :: [Node] -> Either String CoipPool
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe [Tag]
-> CoipPool
CoipPool'
      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
"localGatewayRouteTableId")
      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
"poolArn")
      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
"poolCidrSet"
                      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 CoipPool where
  hashWithSalt :: Int -> CoipPool -> Int
hashWithSalt Int
_salt CoipPool' {Maybe [Text]
Maybe [Tag]
Maybe Text
tags :: Maybe [Tag]
poolId :: Maybe Text
poolCidrs :: Maybe [Text]
poolArn :: Maybe Text
localGatewayRouteTableId :: Maybe Text
$sel:tags:CoipPool' :: CoipPool -> Maybe [Tag]
$sel:poolId:CoipPool' :: CoipPool -> Maybe Text
$sel:poolCidrs:CoipPool' :: CoipPool -> Maybe [Text]
$sel:poolArn:CoipPool' :: CoipPool -> Maybe Text
$sel:localGatewayRouteTableId:CoipPool' :: CoipPool -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
localGatewayRouteTableId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
poolArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
poolCidrs
      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 CoipPool where
  rnf :: CoipPool -> ()
rnf CoipPool' {Maybe [Text]
Maybe [Tag]
Maybe Text
tags :: Maybe [Tag]
poolId :: Maybe Text
poolCidrs :: Maybe [Text]
poolArn :: Maybe Text
localGatewayRouteTableId :: Maybe Text
$sel:tags:CoipPool' :: CoipPool -> Maybe [Tag]
$sel:poolId:CoipPool' :: CoipPool -> Maybe Text
$sel:poolCidrs:CoipPool' :: CoipPool -> Maybe [Text]
$sel:poolArn:CoipPool' :: CoipPool -> Maybe Text
$sel:localGatewayRouteTableId:CoipPool' :: CoipPool -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
localGatewayRouteTableId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
poolArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
poolCidrs
      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