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

-- | Describes an IPv4 CIDR block associated with a VPC.
--
-- /See:/ 'newVpcCidrBlockAssociation' smart constructor.
data VpcCidrBlockAssociation = VpcCidrBlockAssociation'
  { -- | The association ID for the IPv4 CIDR block.
    VpcCidrBlockAssociation -> Maybe Text
associationId :: Prelude.Maybe Prelude.Text,
    -- | The IPv4 CIDR block.
    VpcCidrBlockAssociation -> Maybe Text
cidrBlock :: Prelude.Maybe Prelude.Text,
    -- | Information about the state of the CIDR block.
    VpcCidrBlockAssociation -> Maybe VpcCidrBlockState
cidrBlockState :: Prelude.Maybe VpcCidrBlockState
  }
  deriving (VpcCidrBlockAssociation -> VpcCidrBlockAssociation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcCidrBlockAssociation -> VpcCidrBlockAssociation -> Bool
$c/= :: VpcCidrBlockAssociation -> VpcCidrBlockAssociation -> Bool
== :: VpcCidrBlockAssociation -> VpcCidrBlockAssociation -> Bool
$c== :: VpcCidrBlockAssociation -> VpcCidrBlockAssociation -> Bool
Prelude.Eq, ReadPrec [VpcCidrBlockAssociation]
ReadPrec VpcCidrBlockAssociation
Int -> ReadS VpcCidrBlockAssociation
ReadS [VpcCidrBlockAssociation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcCidrBlockAssociation]
$creadListPrec :: ReadPrec [VpcCidrBlockAssociation]
readPrec :: ReadPrec VpcCidrBlockAssociation
$creadPrec :: ReadPrec VpcCidrBlockAssociation
readList :: ReadS [VpcCidrBlockAssociation]
$creadList :: ReadS [VpcCidrBlockAssociation]
readsPrec :: Int -> ReadS VpcCidrBlockAssociation
$creadsPrec :: Int -> ReadS VpcCidrBlockAssociation
Prelude.Read, Int -> VpcCidrBlockAssociation -> ShowS
[VpcCidrBlockAssociation] -> ShowS
VpcCidrBlockAssociation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcCidrBlockAssociation] -> ShowS
$cshowList :: [VpcCidrBlockAssociation] -> ShowS
show :: VpcCidrBlockAssociation -> String
$cshow :: VpcCidrBlockAssociation -> String
showsPrec :: Int -> VpcCidrBlockAssociation -> ShowS
$cshowsPrec :: Int -> VpcCidrBlockAssociation -> ShowS
Prelude.Show, forall x. Rep VpcCidrBlockAssociation x -> VpcCidrBlockAssociation
forall x. VpcCidrBlockAssociation -> Rep VpcCidrBlockAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpcCidrBlockAssociation x -> VpcCidrBlockAssociation
$cfrom :: forall x. VpcCidrBlockAssociation -> Rep VpcCidrBlockAssociation x
Prelude.Generic)

-- |
-- Create a value of 'VpcCidrBlockAssociation' 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:
--
-- 'associationId', 'vpcCidrBlockAssociation_associationId' - The association ID for the IPv4 CIDR block.
--
-- 'cidrBlock', 'vpcCidrBlockAssociation_cidrBlock' - The IPv4 CIDR block.
--
-- 'cidrBlockState', 'vpcCidrBlockAssociation_cidrBlockState' - Information about the state of the CIDR block.
newVpcCidrBlockAssociation ::
  VpcCidrBlockAssociation
newVpcCidrBlockAssociation :: VpcCidrBlockAssociation
newVpcCidrBlockAssociation =
  VpcCidrBlockAssociation'
    { $sel:associationId:VpcCidrBlockAssociation' :: Maybe Text
associationId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:cidrBlock:VpcCidrBlockAssociation' :: Maybe Text
cidrBlock = forall a. Maybe a
Prelude.Nothing,
      $sel:cidrBlockState:VpcCidrBlockAssociation' :: Maybe VpcCidrBlockState
cidrBlockState = forall a. Maybe a
Prelude.Nothing
    }

-- | The association ID for the IPv4 CIDR block.
vpcCidrBlockAssociation_associationId :: Lens.Lens' VpcCidrBlockAssociation (Prelude.Maybe Prelude.Text)
vpcCidrBlockAssociation_associationId :: Lens' VpcCidrBlockAssociation (Maybe Text)
vpcCidrBlockAssociation_associationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcCidrBlockAssociation' {Maybe Text
associationId :: Maybe Text
$sel:associationId:VpcCidrBlockAssociation' :: VpcCidrBlockAssociation -> Maybe Text
associationId} -> Maybe Text
associationId) (\s :: VpcCidrBlockAssociation
s@VpcCidrBlockAssociation' {} Maybe Text
a -> VpcCidrBlockAssociation
s {$sel:associationId:VpcCidrBlockAssociation' :: Maybe Text
associationId = Maybe Text
a} :: VpcCidrBlockAssociation)

-- | The IPv4 CIDR block.
vpcCidrBlockAssociation_cidrBlock :: Lens.Lens' VpcCidrBlockAssociation (Prelude.Maybe Prelude.Text)
vpcCidrBlockAssociation_cidrBlock :: Lens' VpcCidrBlockAssociation (Maybe Text)
vpcCidrBlockAssociation_cidrBlock = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcCidrBlockAssociation' {Maybe Text
cidrBlock :: Maybe Text
$sel:cidrBlock:VpcCidrBlockAssociation' :: VpcCidrBlockAssociation -> Maybe Text
cidrBlock} -> Maybe Text
cidrBlock) (\s :: VpcCidrBlockAssociation
s@VpcCidrBlockAssociation' {} Maybe Text
a -> VpcCidrBlockAssociation
s {$sel:cidrBlock:VpcCidrBlockAssociation' :: Maybe Text
cidrBlock = Maybe Text
a} :: VpcCidrBlockAssociation)

-- | Information about the state of the CIDR block.
vpcCidrBlockAssociation_cidrBlockState :: Lens.Lens' VpcCidrBlockAssociation (Prelude.Maybe VpcCidrBlockState)
vpcCidrBlockAssociation_cidrBlockState :: Lens' VpcCidrBlockAssociation (Maybe VpcCidrBlockState)
vpcCidrBlockAssociation_cidrBlockState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcCidrBlockAssociation' {Maybe VpcCidrBlockState
cidrBlockState :: Maybe VpcCidrBlockState
$sel:cidrBlockState:VpcCidrBlockAssociation' :: VpcCidrBlockAssociation -> Maybe VpcCidrBlockState
cidrBlockState} -> Maybe VpcCidrBlockState
cidrBlockState) (\s :: VpcCidrBlockAssociation
s@VpcCidrBlockAssociation' {} Maybe VpcCidrBlockState
a -> VpcCidrBlockAssociation
s {$sel:cidrBlockState:VpcCidrBlockAssociation' :: Maybe VpcCidrBlockState
cidrBlockState = Maybe VpcCidrBlockState
a} :: VpcCidrBlockAssociation)

instance Data.FromXML VpcCidrBlockAssociation where
  parseXML :: [Node] -> Either String VpcCidrBlockAssociation
parseXML [Node]
x =
    Maybe Text
-> Maybe Text -> Maybe VpcCidrBlockState -> VpcCidrBlockAssociation
VpcCidrBlockAssociation'
      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
"associationId")
      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
"cidrBlock")
      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
"cidrBlockState")

instance Prelude.Hashable VpcCidrBlockAssociation where
  hashWithSalt :: Int -> VpcCidrBlockAssociation -> Int
hashWithSalt Int
_salt VpcCidrBlockAssociation' {Maybe Text
Maybe VpcCidrBlockState
cidrBlockState :: Maybe VpcCidrBlockState
cidrBlock :: Maybe Text
associationId :: Maybe Text
$sel:cidrBlockState:VpcCidrBlockAssociation' :: VpcCidrBlockAssociation -> Maybe VpcCidrBlockState
$sel:cidrBlock:VpcCidrBlockAssociation' :: VpcCidrBlockAssociation -> Maybe Text
$sel:associationId:VpcCidrBlockAssociation' :: VpcCidrBlockAssociation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
associationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cidrBlock
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VpcCidrBlockState
cidrBlockState

instance Prelude.NFData VpcCidrBlockAssociation where
  rnf :: VpcCidrBlockAssociation -> ()
rnf VpcCidrBlockAssociation' {Maybe Text
Maybe VpcCidrBlockState
cidrBlockState :: Maybe VpcCidrBlockState
cidrBlock :: Maybe Text
associationId :: Maybe Text
$sel:cidrBlockState:VpcCidrBlockAssociation' :: VpcCidrBlockAssociation -> Maybe VpcCidrBlockState
$sel:cidrBlock:VpcCidrBlockAssociation' :: VpcCidrBlockAssociation -> Maybe Text
$sel:associationId:VpcCidrBlockAssociation' :: VpcCidrBlockAssociation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
associationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cidrBlock
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VpcCidrBlockState
cidrBlockState