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

-- | Describes the state of an association between a route table and a subnet
-- or gateway.
--
-- /See:/ 'newRouteTableAssociationState' smart constructor.
data RouteTableAssociationState = RouteTableAssociationState'
  { -- | The state of the association.
    RouteTableAssociationState -> Maybe RouteTableAssociationStateCode
state :: Prelude.Maybe RouteTableAssociationStateCode,
    -- | The status message, if applicable.
    RouteTableAssociationState -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (RouteTableAssociationState -> RouteTableAssociationState -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RouteTableAssociationState -> RouteTableAssociationState -> Bool
$c/= :: RouteTableAssociationState -> RouteTableAssociationState -> Bool
== :: RouteTableAssociationState -> RouteTableAssociationState -> Bool
$c== :: RouteTableAssociationState -> RouteTableAssociationState -> Bool
Prelude.Eq, ReadPrec [RouteTableAssociationState]
ReadPrec RouteTableAssociationState
Int -> ReadS RouteTableAssociationState
ReadS [RouteTableAssociationState]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RouteTableAssociationState]
$creadListPrec :: ReadPrec [RouteTableAssociationState]
readPrec :: ReadPrec RouteTableAssociationState
$creadPrec :: ReadPrec RouteTableAssociationState
readList :: ReadS [RouteTableAssociationState]
$creadList :: ReadS [RouteTableAssociationState]
readsPrec :: Int -> ReadS RouteTableAssociationState
$creadsPrec :: Int -> ReadS RouteTableAssociationState
Prelude.Read, Int -> RouteTableAssociationState -> ShowS
[RouteTableAssociationState] -> ShowS
RouteTableAssociationState -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RouteTableAssociationState] -> ShowS
$cshowList :: [RouteTableAssociationState] -> ShowS
show :: RouteTableAssociationState -> String
$cshow :: RouteTableAssociationState -> String
showsPrec :: Int -> RouteTableAssociationState -> ShowS
$cshowsPrec :: Int -> RouteTableAssociationState -> ShowS
Prelude.Show, forall x.
Rep RouteTableAssociationState x -> RouteTableAssociationState
forall x.
RouteTableAssociationState -> Rep RouteTableAssociationState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RouteTableAssociationState x -> RouteTableAssociationState
$cfrom :: forall x.
RouteTableAssociationState -> Rep RouteTableAssociationState x
Prelude.Generic)

-- |
-- Create a value of 'RouteTableAssociationState' 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:
--
-- 'state', 'routeTableAssociationState_state' - The state of the association.
--
-- 'statusMessage', 'routeTableAssociationState_statusMessage' - The status message, if applicable.
newRouteTableAssociationState ::
  RouteTableAssociationState
newRouteTableAssociationState :: RouteTableAssociationState
newRouteTableAssociationState =
  RouteTableAssociationState'
    { $sel:state:RouteTableAssociationState' :: Maybe RouteTableAssociationStateCode
state =
        forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:RouteTableAssociationState' :: Maybe Text
statusMessage = forall a. Maybe a
Prelude.Nothing
    }

-- | The state of the association.
routeTableAssociationState_state :: Lens.Lens' RouteTableAssociationState (Prelude.Maybe RouteTableAssociationStateCode)
routeTableAssociationState_state :: Lens'
  RouteTableAssociationState (Maybe RouteTableAssociationStateCode)
routeTableAssociationState_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RouteTableAssociationState' {Maybe RouteTableAssociationStateCode
state :: Maybe RouteTableAssociationStateCode
$sel:state:RouteTableAssociationState' :: RouteTableAssociationState -> Maybe RouteTableAssociationStateCode
state} -> Maybe RouteTableAssociationStateCode
state) (\s :: RouteTableAssociationState
s@RouteTableAssociationState' {} Maybe RouteTableAssociationStateCode
a -> RouteTableAssociationState
s {$sel:state:RouteTableAssociationState' :: Maybe RouteTableAssociationStateCode
state = Maybe RouteTableAssociationStateCode
a} :: RouteTableAssociationState)

-- | The status message, if applicable.
routeTableAssociationState_statusMessage :: Lens.Lens' RouteTableAssociationState (Prelude.Maybe Prelude.Text)
routeTableAssociationState_statusMessage :: Lens' RouteTableAssociationState (Maybe Text)
routeTableAssociationState_statusMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RouteTableAssociationState' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:RouteTableAssociationState' :: RouteTableAssociationState -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: RouteTableAssociationState
s@RouteTableAssociationState' {} Maybe Text
a -> RouteTableAssociationState
s {$sel:statusMessage:RouteTableAssociationState' :: Maybe Text
statusMessage = Maybe Text
a} :: RouteTableAssociationState)

instance Data.FromXML RouteTableAssociationState where
  parseXML :: [Node] -> Either String RouteTableAssociationState
parseXML [Node]
x =
    Maybe RouteTableAssociationStateCode
-> Maybe Text -> RouteTableAssociationState
RouteTableAssociationState'
      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
"state")
      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
"statusMessage")

instance Prelude.Hashable RouteTableAssociationState where
  hashWithSalt :: Int -> RouteTableAssociationState -> Int
hashWithSalt Int
_salt RouteTableAssociationState' {Maybe Text
Maybe RouteTableAssociationStateCode
statusMessage :: Maybe Text
state :: Maybe RouteTableAssociationStateCode
$sel:statusMessage:RouteTableAssociationState' :: RouteTableAssociationState -> Maybe Text
$sel:state:RouteTableAssociationState' :: RouteTableAssociationState -> Maybe RouteTableAssociationStateCode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RouteTableAssociationStateCode
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
statusMessage

instance Prelude.NFData RouteTableAssociationState where
  rnf :: RouteTableAssociationState -> ()
rnf RouteTableAssociationState' {Maybe Text
Maybe RouteTableAssociationStateCode
statusMessage :: Maybe Text
state :: Maybe RouteTableAssociationStateCode
$sel:statusMessage:RouteTableAssociationState' :: RouteTableAssociationState -> Maybe Text
$sel:state:RouteTableAssociationState' :: RouteTableAssociationState -> Maybe RouteTableAssociationStateCode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe RouteTableAssociationStateCode
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
statusMessage