{-# 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.SecurityHub.Types.Ipv6CidrBlockAssociation
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SecurityHub.Types.Ipv6CidrBlockAssociation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'Ipv6CidrBlockAssociation' 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', 'ipv6CidrBlockAssociation_associationId' - The association ID for the IPv6 CIDR block.
--
-- 'ipv6CidrBlock', 'ipv6CidrBlockAssociation_ipv6CidrBlock' - The IPv6 CIDR block.
--
-- 'cidrBlockState', 'ipv6CidrBlockAssociation_cidrBlockState' - Information about the state of the CIDR block.
newIpv6CidrBlockAssociation ::
  Ipv6CidrBlockAssociation
newIpv6CidrBlockAssociation :: Ipv6CidrBlockAssociation
newIpv6CidrBlockAssociation =
  Ipv6CidrBlockAssociation' :: Maybe Text -> Maybe Text -> Maybe Text -> Ipv6CidrBlockAssociation
Ipv6CidrBlockAssociation'
    { $sel:associationId:Ipv6CidrBlockAssociation' :: Maybe Text
associationId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ipv6CidrBlock:Ipv6CidrBlockAssociation' :: Maybe Text
ipv6CidrBlock = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cidrBlockState:Ipv6CidrBlockAssociation' :: Maybe Text
cidrBlockState = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The IPv6 CIDR block.
ipv6CidrBlockAssociation_ipv6CidrBlock :: Lens.Lens' Ipv6CidrBlockAssociation (Prelude.Maybe Prelude.Text)
ipv6CidrBlockAssociation_ipv6CidrBlock :: (Maybe Text -> f (Maybe Text))
-> Ipv6CidrBlockAssociation -> f Ipv6CidrBlockAssociation
ipv6CidrBlockAssociation_ipv6CidrBlock = (Ipv6CidrBlockAssociation -> Maybe Text)
-> (Ipv6CidrBlockAssociation
    -> Maybe Text -> Ipv6CidrBlockAssociation)
-> Lens
     Ipv6CidrBlockAssociation
     Ipv6CidrBlockAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ipv6CidrBlockAssociation' {Maybe Text
ipv6CidrBlock :: Maybe Text
$sel:ipv6CidrBlock:Ipv6CidrBlockAssociation' :: Ipv6CidrBlockAssociation -> Maybe Text
ipv6CidrBlock} -> Maybe Text
ipv6CidrBlock) (\s :: Ipv6CidrBlockAssociation
s@Ipv6CidrBlockAssociation' {} Maybe Text
a -> Ipv6CidrBlockAssociation
s {$sel:ipv6CidrBlock:Ipv6CidrBlockAssociation' :: Maybe Text
ipv6CidrBlock = Maybe Text
a} :: Ipv6CidrBlockAssociation)

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

instance Core.FromJSON Ipv6CidrBlockAssociation where
  parseJSON :: Value -> Parser Ipv6CidrBlockAssociation
parseJSON =
    String
-> (Object -> Parser Ipv6CidrBlockAssociation)
-> Value
-> Parser Ipv6CidrBlockAssociation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Ipv6CidrBlockAssociation"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> Ipv6CidrBlockAssociation
Ipv6CidrBlockAssociation'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Ipv6CidrBlockAssociation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Ipv6CidrBlockAssociation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AssociationId")
            Parser (Maybe Text -> Maybe Text -> Ipv6CidrBlockAssociation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Ipv6CidrBlockAssociation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Ipv6CidrBlock")
            Parser (Maybe Text -> Ipv6CidrBlockAssociation)
-> Parser (Maybe Text) -> Parser Ipv6CidrBlockAssociation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CidrBlockState")
      )

instance Prelude.Hashable Ipv6CidrBlockAssociation

instance Prelude.NFData Ipv6CidrBlockAssociation

instance Core.ToJSON Ipv6CidrBlockAssociation where
  toJSON :: Ipv6CidrBlockAssociation -> Value
toJSON Ipv6CidrBlockAssociation' {Maybe Text
cidrBlockState :: Maybe Text
ipv6CidrBlock :: Maybe Text
associationId :: Maybe Text
$sel:cidrBlockState:Ipv6CidrBlockAssociation' :: Ipv6CidrBlockAssociation -> Maybe Text
$sel:ipv6CidrBlock:Ipv6CidrBlockAssociation' :: Ipv6CidrBlockAssociation -> Maybe Text
$sel:associationId:Ipv6CidrBlockAssociation' :: Ipv6CidrBlockAssociation -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AssociationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
associationId,
            (Text
"Ipv6CidrBlock" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
ipv6CidrBlock,
            (Text
"CidrBlockState" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cidrBlockState
          ]
      )