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

-- | The state of the event window.
--
-- /See:/ 'newInstanceEventWindowStateChange' smart constructor.
data InstanceEventWindowStateChange = InstanceEventWindowStateChange'
  { -- | The ID of the event window.
    InstanceEventWindowStateChange -> Maybe Text
instanceEventWindowId :: Prelude.Maybe Prelude.Text,
    -- | The current state of the event window.
    InstanceEventWindowStateChange -> Maybe InstanceEventWindowState
state :: Prelude.Maybe InstanceEventWindowState
  }
  deriving (InstanceEventWindowStateChange
-> InstanceEventWindowStateChange -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceEventWindowStateChange
-> InstanceEventWindowStateChange -> Bool
$c/= :: InstanceEventWindowStateChange
-> InstanceEventWindowStateChange -> Bool
== :: InstanceEventWindowStateChange
-> InstanceEventWindowStateChange -> Bool
$c== :: InstanceEventWindowStateChange
-> InstanceEventWindowStateChange -> Bool
Prelude.Eq, ReadPrec [InstanceEventWindowStateChange]
ReadPrec InstanceEventWindowStateChange
Int -> ReadS InstanceEventWindowStateChange
ReadS [InstanceEventWindowStateChange]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceEventWindowStateChange]
$creadListPrec :: ReadPrec [InstanceEventWindowStateChange]
readPrec :: ReadPrec InstanceEventWindowStateChange
$creadPrec :: ReadPrec InstanceEventWindowStateChange
readList :: ReadS [InstanceEventWindowStateChange]
$creadList :: ReadS [InstanceEventWindowStateChange]
readsPrec :: Int -> ReadS InstanceEventWindowStateChange
$creadsPrec :: Int -> ReadS InstanceEventWindowStateChange
Prelude.Read, Int -> InstanceEventWindowStateChange -> ShowS
[InstanceEventWindowStateChange] -> ShowS
InstanceEventWindowStateChange -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceEventWindowStateChange] -> ShowS
$cshowList :: [InstanceEventWindowStateChange] -> ShowS
show :: InstanceEventWindowStateChange -> String
$cshow :: InstanceEventWindowStateChange -> String
showsPrec :: Int -> InstanceEventWindowStateChange -> ShowS
$cshowsPrec :: Int -> InstanceEventWindowStateChange -> ShowS
Prelude.Show, forall x.
Rep InstanceEventWindowStateChange x
-> InstanceEventWindowStateChange
forall x.
InstanceEventWindowStateChange
-> Rep InstanceEventWindowStateChange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InstanceEventWindowStateChange x
-> InstanceEventWindowStateChange
$cfrom :: forall x.
InstanceEventWindowStateChange
-> Rep InstanceEventWindowStateChange x
Prelude.Generic)

-- |
-- Create a value of 'InstanceEventWindowStateChange' 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:
--
-- 'instanceEventWindowId', 'instanceEventWindowStateChange_instanceEventWindowId' - The ID of the event window.
--
-- 'state', 'instanceEventWindowStateChange_state' - The current state of the event window.
newInstanceEventWindowStateChange ::
  InstanceEventWindowStateChange
newInstanceEventWindowStateChange :: InstanceEventWindowStateChange
newInstanceEventWindowStateChange =
  InstanceEventWindowStateChange'
    { $sel:instanceEventWindowId:InstanceEventWindowStateChange' :: Maybe Text
instanceEventWindowId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:state:InstanceEventWindowStateChange' :: Maybe InstanceEventWindowState
state = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the event window.
instanceEventWindowStateChange_instanceEventWindowId :: Lens.Lens' InstanceEventWindowStateChange (Prelude.Maybe Prelude.Text)
instanceEventWindowStateChange_instanceEventWindowId :: Lens' InstanceEventWindowStateChange (Maybe Text)
instanceEventWindowStateChange_instanceEventWindowId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceEventWindowStateChange' {Maybe Text
instanceEventWindowId :: Maybe Text
$sel:instanceEventWindowId:InstanceEventWindowStateChange' :: InstanceEventWindowStateChange -> Maybe Text
instanceEventWindowId} -> Maybe Text
instanceEventWindowId) (\s :: InstanceEventWindowStateChange
s@InstanceEventWindowStateChange' {} Maybe Text
a -> InstanceEventWindowStateChange
s {$sel:instanceEventWindowId:InstanceEventWindowStateChange' :: Maybe Text
instanceEventWindowId = Maybe Text
a} :: InstanceEventWindowStateChange)

-- | The current state of the event window.
instanceEventWindowStateChange_state :: Lens.Lens' InstanceEventWindowStateChange (Prelude.Maybe InstanceEventWindowState)
instanceEventWindowStateChange_state :: Lens'
  InstanceEventWindowStateChange (Maybe InstanceEventWindowState)
instanceEventWindowStateChange_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceEventWindowStateChange' {Maybe InstanceEventWindowState
state :: Maybe InstanceEventWindowState
$sel:state:InstanceEventWindowStateChange' :: InstanceEventWindowStateChange -> Maybe InstanceEventWindowState
state} -> Maybe InstanceEventWindowState
state) (\s :: InstanceEventWindowStateChange
s@InstanceEventWindowStateChange' {} Maybe InstanceEventWindowState
a -> InstanceEventWindowStateChange
s {$sel:state:InstanceEventWindowStateChange' :: Maybe InstanceEventWindowState
state = Maybe InstanceEventWindowState
a} :: InstanceEventWindowStateChange)

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

instance
  Prelude.Hashable
    InstanceEventWindowStateChange
  where
  hashWithSalt :: Int -> InstanceEventWindowStateChange -> Int
hashWithSalt
    Int
_salt
    InstanceEventWindowStateChange' {Maybe Text
Maybe InstanceEventWindowState
state :: Maybe InstanceEventWindowState
instanceEventWindowId :: Maybe Text
$sel:state:InstanceEventWindowStateChange' :: InstanceEventWindowStateChange -> Maybe InstanceEventWindowState
$sel:instanceEventWindowId:InstanceEventWindowStateChange' :: InstanceEventWindowStateChange -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
instanceEventWindowId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstanceEventWindowState
state

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