{-# 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.CoipCidr
-- 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.CoipCidr 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 qualified Amazonka.Prelude as Prelude

-- | Information about a customer-owned IP address range.
--
-- /See:/ 'newCoipCidr' smart constructor.
data CoipCidr = CoipCidr'
  { -- | An address range in a customer-owned IP address space.
    CoipCidr -> Maybe Text
cidr :: Prelude.Maybe Prelude.Text,
    -- | The ID of the address pool.
    CoipCidr -> Maybe Text
coipPoolId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the local gateway route table.
    CoipCidr -> Maybe Text
localGatewayRouteTableId :: Prelude.Maybe Prelude.Text
  }
  deriving (CoipCidr -> CoipCidr -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CoipCidr -> CoipCidr -> Bool
$c/= :: CoipCidr -> CoipCidr -> Bool
== :: CoipCidr -> CoipCidr -> Bool
$c== :: CoipCidr -> CoipCidr -> Bool
Prelude.Eq, ReadPrec [CoipCidr]
ReadPrec CoipCidr
Int -> ReadS CoipCidr
ReadS [CoipCidr]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CoipCidr]
$creadListPrec :: ReadPrec [CoipCidr]
readPrec :: ReadPrec CoipCidr
$creadPrec :: ReadPrec CoipCidr
readList :: ReadS [CoipCidr]
$creadList :: ReadS [CoipCidr]
readsPrec :: Int -> ReadS CoipCidr
$creadsPrec :: Int -> ReadS CoipCidr
Prelude.Read, Int -> CoipCidr -> ShowS
[CoipCidr] -> ShowS
CoipCidr -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CoipCidr] -> ShowS
$cshowList :: [CoipCidr] -> ShowS
show :: CoipCidr -> String
$cshow :: CoipCidr -> String
showsPrec :: Int -> CoipCidr -> ShowS
$cshowsPrec :: Int -> CoipCidr -> ShowS
Prelude.Show, forall x. Rep CoipCidr x -> CoipCidr
forall x. CoipCidr -> Rep CoipCidr x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CoipCidr x -> CoipCidr
$cfrom :: forall x. CoipCidr -> Rep CoipCidr x
Prelude.Generic)

-- |
-- Create a value of 'CoipCidr' 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:
--
-- 'cidr', 'coipCidr_cidr' - An address range in a customer-owned IP address space.
--
-- 'coipPoolId', 'coipCidr_coipPoolId' - The ID of the address pool.
--
-- 'localGatewayRouteTableId', 'coipCidr_localGatewayRouteTableId' - The ID of the local gateway route table.
newCoipCidr ::
  CoipCidr
newCoipCidr :: CoipCidr
newCoipCidr =
  CoipCidr'
    { $sel:cidr:CoipCidr' :: Maybe Text
cidr = forall a. Maybe a
Prelude.Nothing,
      $sel:coipPoolId:CoipCidr' :: Maybe Text
coipPoolId = forall a. Maybe a
Prelude.Nothing,
      $sel:localGatewayRouteTableId:CoipCidr' :: Maybe Text
localGatewayRouteTableId = forall a. Maybe a
Prelude.Nothing
    }

-- | An address range in a customer-owned IP address space.
coipCidr_cidr :: Lens.Lens' CoipCidr (Prelude.Maybe Prelude.Text)
coipCidr_cidr :: Lens' CoipCidr (Maybe Text)
coipCidr_cidr = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CoipCidr' {Maybe Text
cidr :: Maybe Text
$sel:cidr:CoipCidr' :: CoipCidr -> Maybe Text
cidr} -> Maybe Text
cidr) (\s :: CoipCidr
s@CoipCidr' {} Maybe Text
a -> CoipCidr
s {$sel:cidr:CoipCidr' :: Maybe Text
cidr = Maybe Text
a} :: CoipCidr)

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

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

instance Data.FromXML CoipCidr where
  parseXML :: [Node] -> Either String CoipCidr
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> Maybe Text -> CoipCidr
CoipCidr'
      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
"cidr")
      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
"coipPoolId")
      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
"localGatewayRouteTableId")

instance Prelude.Hashable CoipCidr where
  hashWithSalt :: Int -> CoipCidr -> Int
hashWithSalt Int
_salt CoipCidr' {Maybe Text
localGatewayRouteTableId :: Maybe Text
coipPoolId :: Maybe Text
cidr :: Maybe Text
$sel:localGatewayRouteTableId:CoipCidr' :: CoipCidr -> Maybe Text
$sel:coipPoolId:CoipCidr' :: CoipCidr -> Maybe Text
$sel:cidr:CoipCidr' :: CoipCidr -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cidr
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
coipPoolId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
localGatewayRouteTableId

instance Prelude.NFData CoipCidr where
  rnf :: CoipCidr -> ()
rnf CoipCidr' {Maybe Text
localGatewayRouteTableId :: Maybe Text
coipPoolId :: Maybe Text
cidr :: Maybe Text
$sel:localGatewayRouteTableId:CoipCidr' :: CoipCidr -> Maybe Text
$sel:coipPoolId:CoipCidr' :: CoipCidr -> Maybe Text
$sel:cidr:CoipCidr' :: CoipCidr -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cidr
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
coipPoolId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
localGatewayRouteTableId