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

-- | One or more targets associated with the event window.
--
-- /See:/ 'newInstanceEventWindowAssociationTarget' smart constructor.
data InstanceEventWindowAssociationTarget = InstanceEventWindowAssociationTarget'
  { -- | The IDs of the Dedicated Hosts associated with the event window.
    InstanceEventWindowAssociationTarget -> Maybe [Text]
dedicatedHostIds :: Prelude.Maybe [Prelude.Text],
    -- | The IDs of the instances associated with the event window.
    InstanceEventWindowAssociationTarget -> Maybe [Text]
instanceIds :: Prelude.Maybe [Prelude.Text],
    -- | The instance tags associated with the event window. Any instances
    -- associated with the tags will be associated with the event window.
    InstanceEventWindowAssociationTarget -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  deriving (InstanceEventWindowAssociationTarget
-> InstanceEventWindowAssociationTarget -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceEventWindowAssociationTarget
-> InstanceEventWindowAssociationTarget -> Bool
$c/= :: InstanceEventWindowAssociationTarget
-> InstanceEventWindowAssociationTarget -> Bool
== :: InstanceEventWindowAssociationTarget
-> InstanceEventWindowAssociationTarget -> Bool
$c== :: InstanceEventWindowAssociationTarget
-> InstanceEventWindowAssociationTarget -> Bool
Prelude.Eq, ReadPrec [InstanceEventWindowAssociationTarget]
ReadPrec InstanceEventWindowAssociationTarget
Int -> ReadS InstanceEventWindowAssociationTarget
ReadS [InstanceEventWindowAssociationTarget]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceEventWindowAssociationTarget]
$creadListPrec :: ReadPrec [InstanceEventWindowAssociationTarget]
readPrec :: ReadPrec InstanceEventWindowAssociationTarget
$creadPrec :: ReadPrec InstanceEventWindowAssociationTarget
readList :: ReadS [InstanceEventWindowAssociationTarget]
$creadList :: ReadS [InstanceEventWindowAssociationTarget]
readsPrec :: Int -> ReadS InstanceEventWindowAssociationTarget
$creadsPrec :: Int -> ReadS InstanceEventWindowAssociationTarget
Prelude.Read, Int -> InstanceEventWindowAssociationTarget -> ShowS
[InstanceEventWindowAssociationTarget] -> ShowS
InstanceEventWindowAssociationTarget -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceEventWindowAssociationTarget] -> ShowS
$cshowList :: [InstanceEventWindowAssociationTarget] -> ShowS
show :: InstanceEventWindowAssociationTarget -> String
$cshow :: InstanceEventWindowAssociationTarget -> String
showsPrec :: Int -> InstanceEventWindowAssociationTarget -> ShowS
$cshowsPrec :: Int -> InstanceEventWindowAssociationTarget -> ShowS
Prelude.Show, forall x.
Rep InstanceEventWindowAssociationTarget x
-> InstanceEventWindowAssociationTarget
forall x.
InstanceEventWindowAssociationTarget
-> Rep InstanceEventWindowAssociationTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InstanceEventWindowAssociationTarget x
-> InstanceEventWindowAssociationTarget
$cfrom :: forall x.
InstanceEventWindowAssociationTarget
-> Rep InstanceEventWindowAssociationTarget x
Prelude.Generic)

-- |
-- Create a value of 'InstanceEventWindowAssociationTarget' 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:
--
-- 'dedicatedHostIds', 'instanceEventWindowAssociationTarget_dedicatedHostIds' - The IDs of the Dedicated Hosts associated with the event window.
--
-- 'instanceIds', 'instanceEventWindowAssociationTarget_instanceIds' - The IDs of the instances associated with the event window.
--
-- 'tags', 'instanceEventWindowAssociationTarget_tags' - The instance tags associated with the event window. Any instances
-- associated with the tags will be associated with the event window.
newInstanceEventWindowAssociationTarget ::
  InstanceEventWindowAssociationTarget
newInstanceEventWindowAssociationTarget :: InstanceEventWindowAssociationTarget
newInstanceEventWindowAssociationTarget =
  InstanceEventWindowAssociationTarget'
    { $sel:dedicatedHostIds:InstanceEventWindowAssociationTarget' :: Maybe [Text]
dedicatedHostIds =
        forall a. Maybe a
Prelude.Nothing,
      $sel:instanceIds:InstanceEventWindowAssociationTarget' :: Maybe [Text]
instanceIds = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:InstanceEventWindowAssociationTarget' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The IDs of the Dedicated Hosts associated with the event window.
instanceEventWindowAssociationTarget_dedicatedHostIds :: Lens.Lens' InstanceEventWindowAssociationTarget (Prelude.Maybe [Prelude.Text])
instanceEventWindowAssociationTarget_dedicatedHostIds :: Lens' InstanceEventWindowAssociationTarget (Maybe [Text])
instanceEventWindowAssociationTarget_dedicatedHostIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceEventWindowAssociationTarget' {Maybe [Text]
dedicatedHostIds :: Maybe [Text]
$sel:dedicatedHostIds:InstanceEventWindowAssociationTarget' :: InstanceEventWindowAssociationTarget -> Maybe [Text]
dedicatedHostIds} -> Maybe [Text]
dedicatedHostIds) (\s :: InstanceEventWindowAssociationTarget
s@InstanceEventWindowAssociationTarget' {} Maybe [Text]
a -> InstanceEventWindowAssociationTarget
s {$sel:dedicatedHostIds:InstanceEventWindowAssociationTarget' :: Maybe [Text]
dedicatedHostIds = Maybe [Text]
a} :: InstanceEventWindowAssociationTarget) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The IDs of the instances associated with the event window.
instanceEventWindowAssociationTarget_instanceIds :: Lens.Lens' InstanceEventWindowAssociationTarget (Prelude.Maybe [Prelude.Text])
instanceEventWindowAssociationTarget_instanceIds :: Lens' InstanceEventWindowAssociationTarget (Maybe [Text])
instanceEventWindowAssociationTarget_instanceIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceEventWindowAssociationTarget' {Maybe [Text]
instanceIds :: Maybe [Text]
$sel:instanceIds:InstanceEventWindowAssociationTarget' :: InstanceEventWindowAssociationTarget -> Maybe [Text]
instanceIds} -> Maybe [Text]
instanceIds) (\s :: InstanceEventWindowAssociationTarget
s@InstanceEventWindowAssociationTarget' {} Maybe [Text]
a -> InstanceEventWindowAssociationTarget
s {$sel:instanceIds:InstanceEventWindowAssociationTarget' :: Maybe [Text]
instanceIds = Maybe [Text]
a} :: InstanceEventWindowAssociationTarget) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The instance tags associated with the event window. Any instances
-- associated with the tags will be associated with the event window.
instanceEventWindowAssociationTarget_tags :: Lens.Lens' InstanceEventWindowAssociationTarget (Prelude.Maybe [Tag])
instanceEventWindowAssociationTarget_tags :: Lens' InstanceEventWindowAssociationTarget (Maybe [Tag])
instanceEventWindowAssociationTarget_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceEventWindowAssociationTarget' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:InstanceEventWindowAssociationTarget' :: InstanceEventWindowAssociationTarget -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: InstanceEventWindowAssociationTarget
s@InstanceEventWindowAssociationTarget' {} Maybe [Tag]
a -> InstanceEventWindowAssociationTarget
s {$sel:tags:InstanceEventWindowAssociationTarget' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: InstanceEventWindowAssociationTarget) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Data.FromXML
    InstanceEventWindowAssociationTarget
  where
  parseXML :: [Node] -> Either String InstanceEventWindowAssociationTarget
parseXML [Node]
x =
    Maybe [Text]
-> Maybe [Text]
-> Maybe [Tag]
-> InstanceEventWindowAssociationTarget
InstanceEventWindowAssociationTarget'
      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
"dedicatedHostIdSet"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                  )
      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
"instanceIdSet"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                  )
      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
"tagSet"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                  )

instance
  Prelude.Hashable
    InstanceEventWindowAssociationTarget
  where
  hashWithSalt :: Int -> InstanceEventWindowAssociationTarget -> Int
hashWithSalt
    Int
_salt
    InstanceEventWindowAssociationTarget' {Maybe [Text]
Maybe [Tag]
tags :: Maybe [Tag]
instanceIds :: Maybe [Text]
dedicatedHostIds :: Maybe [Text]
$sel:tags:InstanceEventWindowAssociationTarget' :: InstanceEventWindowAssociationTarget -> Maybe [Tag]
$sel:instanceIds:InstanceEventWindowAssociationTarget' :: InstanceEventWindowAssociationTarget -> Maybe [Text]
$sel:dedicatedHostIds:InstanceEventWindowAssociationTarget' :: InstanceEventWindowAssociationTarget -> Maybe [Text]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
dedicatedHostIds
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
instanceIds
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags

instance
  Prelude.NFData
    InstanceEventWindowAssociationTarget
  where
  rnf :: InstanceEventWindowAssociationTarget -> ()
rnf InstanceEventWindowAssociationTarget' {Maybe [Text]
Maybe [Tag]
tags :: Maybe [Tag]
instanceIds :: Maybe [Text]
dedicatedHostIds :: Maybe [Text]
$sel:tags:InstanceEventWindowAssociationTarget' :: InstanceEventWindowAssociationTarget -> Maybe [Tag]
$sel:instanceIds:InstanceEventWindowAssociationTarget' :: InstanceEventWindowAssociationTarget -> Maybe [Text]
$sel:dedicatedHostIds:InstanceEventWindowAssociationTarget' :: InstanceEventWindowAssociationTarget -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
dedicatedHostIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
instanceIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags