{-# 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.InstanceEventWindowAssociationRequest
-- 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.InstanceEventWindowAssociationRequest 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 specified event window. Only one
-- /type/ of target (instance ID, instance tag, or Dedicated Host ID) can
-- be associated with an event window.
--
-- /See:/ 'newInstanceEventWindowAssociationRequest' smart constructor.
data InstanceEventWindowAssociationRequest = InstanceEventWindowAssociationRequest'
  { -- | The IDs of the Dedicated Hosts to associate with the event window.
    InstanceEventWindowAssociationRequest -> Maybe [Text]
dedicatedHostIds :: Prelude.Maybe [Prelude.Text],
    -- | The IDs of the instances to associate with the event window. If the
    -- instance is on a Dedicated Host, you can\'t specify the Instance ID
    -- parameter; you must use the Dedicated Host ID parameter.
    InstanceEventWindowAssociationRequest -> Maybe [Text]
instanceIds :: Prelude.Maybe [Prelude.Text],
    -- | The instance tags to associate with the event window. Any instances
    -- associated with the tags will be associated with the event window.
    InstanceEventWindowAssociationRequest -> Maybe [Tag]
instanceTags :: Prelude.Maybe [Tag]
  }
  deriving (InstanceEventWindowAssociationRequest
-> InstanceEventWindowAssociationRequest -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceEventWindowAssociationRequest
-> InstanceEventWindowAssociationRequest -> Bool
$c/= :: InstanceEventWindowAssociationRequest
-> InstanceEventWindowAssociationRequest -> Bool
== :: InstanceEventWindowAssociationRequest
-> InstanceEventWindowAssociationRequest -> Bool
$c== :: InstanceEventWindowAssociationRequest
-> InstanceEventWindowAssociationRequest -> Bool
Prelude.Eq, ReadPrec [InstanceEventWindowAssociationRequest]
ReadPrec InstanceEventWindowAssociationRequest
Int -> ReadS InstanceEventWindowAssociationRequest
ReadS [InstanceEventWindowAssociationRequest]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceEventWindowAssociationRequest]
$creadListPrec :: ReadPrec [InstanceEventWindowAssociationRequest]
readPrec :: ReadPrec InstanceEventWindowAssociationRequest
$creadPrec :: ReadPrec InstanceEventWindowAssociationRequest
readList :: ReadS [InstanceEventWindowAssociationRequest]
$creadList :: ReadS [InstanceEventWindowAssociationRequest]
readsPrec :: Int -> ReadS InstanceEventWindowAssociationRequest
$creadsPrec :: Int -> ReadS InstanceEventWindowAssociationRequest
Prelude.Read, Int -> InstanceEventWindowAssociationRequest -> ShowS
[InstanceEventWindowAssociationRequest] -> ShowS
InstanceEventWindowAssociationRequest -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceEventWindowAssociationRequest] -> ShowS
$cshowList :: [InstanceEventWindowAssociationRequest] -> ShowS
show :: InstanceEventWindowAssociationRequest -> String
$cshow :: InstanceEventWindowAssociationRequest -> String
showsPrec :: Int -> InstanceEventWindowAssociationRequest -> ShowS
$cshowsPrec :: Int -> InstanceEventWindowAssociationRequest -> ShowS
Prelude.Show, forall x.
Rep InstanceEventWindowAssociationRequest x
-> InstanceEventWindowAssociationRequest
forall x.
InstanceEventWindowAssociationRequest
-> Rep InstanceEventWindowAssociationRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InstanceEventWindowAssociationRequest x
-> InstanceEventWindowAssociationRequest
$cfrom :: forall x.
InstanceEventWindowAssociationRequest
-> Rep InstanceEventWindowAssociationRequest x
Prelude.Generic)

-- |
-- Create a value of 'InstanceEventWindowAssociationRequest' 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', 'instanceEventWindowAssociationRequest_dedicatedHostIds' - The IDs of the Dedicated Hosts to associate with the event window.
--
-- 'instanceIds', 'instanceEventWindowAssociationRequest_instanceIds' - The IDs of the instances to associate with the event window. If the
-- instance is on a Dedicated Host, you can\'t specify the Instance ID
-- parameter; you must use the Dedicated Host ID parameter.
--
-- 'instanceTags', 'instanceEventWindowAssociationRequest_instanceTags' - The instance tags to associate with the event window. Any instances
-- associated with the tags will be associated with the event window.
newInstanceEventWindowAssociationRequest ::
  InstanceEventWindowAssociationRequest
newInstanceEventWindowAssociationRequest :: InstanceEventWindowAssociationRequest
newInstanceEventWindowAssociationRequest =
  InstanceEventWindowAssociationRequest'
    { $sel:dedicatedHostIds:InstanceEventWindowAssociationRequest' :: Maybe [Text]
dedicatedHostIds =
        forall a. Maybe a
Prelude.Nothing,
      $sel:instanceIds:InstanceEventWindowAssociationRequest' :: Maybe [Text]
instanceIds = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceTags:InstanceEventWindowAssociationRequest' :: Maybe [Tag]
instanceTags = forall a. Maybe a
Prelude.Nothing
    }

-- | The IDs of the Dedicated Hosts to associate with the event window.
instanceEventWindowAssociationRequest_dedicatedHostIds :: Lens.Lens' InstanceEventWindowAssociationRequest (Prelude.Maybe [Prelude.Text])
instanceEventWindowAssociationRequest_dedicatedHostIds :: Lens' InstanceEventWindowAssociationRequest (Maybe [Text])
instanceEventWindowAssociationRequest_dedicatedHostIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceEventWindowAssociationRequest' {Maybe [Text]
dedicatedHostIds :: Maybe [Text]
$sel:dedicatedHostIds:InstanceEventWindowAssociationRequest' :: InstanceEventWindowAssociationRequest -> Maybe [Text]
dedicatedHostIds} -> Maybe [Text]
dedicatedHostIds) (\s :: InstanceEventWindowAssociationRequest
s@InstanceEventWindowAssociationRequest' {} Maybe [Text]
a -> InstanceEventWindowAssociationRequest
s {$sel:dedicatedHostIds:InstanceEventWindowAssociationRequest' :: Maybe [Text]
dedicatedHostIds = Maybe [Text]
a} :: InstanceEventWindowAssociationRequest) 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 to associate with the event window. If the
-- instance is on a Dedicated Host, you can\'t specify the Instance ID
-- parameter; you must use the Dedicated Host ID parameter.
instanceEventWindowAssociationRequest_instanceIds :: Lens.Lens' InstanceEventWindowAssociationRequest (Prelude.Maybe [Prelude.Text])
instanceEventWindowAssociationRequest_instanceIds :: Lens' InstanceEventWindowAssociationRequest (Maybe [Text])
instanceEventWindowAssociationRequest_instanceIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceEventWindowAssociationRequest' {Maybe [Text]
instanceIds :: Maybe [Text]
$sel:instanceIds:InstanceEventWindowAssociationRequest' :: InstanceEventWindowAssociationRequest -> Maybe [Text]
instanceIds} -> Maybe [Text]
instanceIds) (\s :: InstanceEventWindowAssociationRequest
s@InstanceEventWindowAssociationRequest' {} Maybe [Text]
a -> InstanceEventWindowAssociationRequest
s {$sel:instanceIds:InstanceEventWindowAssociationRequest' :: Maybe [Text]
instanceIds = Maybe [Text]
a} :: InstanceEventWindowAssociationRequest) 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 to associate with the event window. Any instances
-- associated with the tags will be associated with the event window.
instanceEventWindowAssociationRequest_instanceTags :: Lens.Lens' InstanceEventWindowAssociationRequest (Prelude.Maybe [Tag])
instanceEventWindowAssociationRequest_instanceTags :: Lens' InstanceEventWindowAssociationRequest (Maybe [Tag])
instanceEventWindowAssociationRequest_instanceTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceEventWindowAssociationRequest' {Maybe [Tag]
instanceTags :: Maybe [Tag]
$sel:instanceTags:InstanceEventWindowAssociationRequest' :: InstanceEventWindowAssociationRequest -> Maybe [Tag]
instanceTags} -> Maybe [Tag]
instanceTags) (\s :: InstanceEventWindowAssociationRequest
s@InstanceEventWindowAssociationRequest' {} Maybe [Tag]
a -> InstanceEventWindowAssociationRequest
s {$sel:instanceTags:InstanceEventWindowAssociationRequest' :: Maybe [Tag]
instanceTags = Maybe [Tag]
a} :: InstanceEventWindowAssociationRequest) 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
  Prelude.Hashable
    InstanceEventWindowAssociationRequest
  where
  hashWithSalt :: Int -> InstanceEventWindowAssociationRequest -> Int
hashWithSalt
    Int
_salt
    InstanceEventWindowAssociationRequest' {Maybe [Text]
Maybe [Tag]
instanceTags :: Maybe [Tag]
instanceIds :: Maybe [Text]
dedicatedHostIds :: Maybe [Text]
$sel:instanceTags:InstanceEventWindowAssociationRequest' :: InstanceEventWindowAssociationRequest -> Maybe [Tag]
$sel:instanceIds:InstanceEventWindowAssociationRequest' :: InstanceEventWindowAssociationRequest -> Maybe [Text]
$sel:dedicatedHostIds:InstanceEventWindowAssociationRequest' :: InstanceEventWindowAssociationRequest -> 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]
instanceTags

instance
  Prelude.NFData
    InstanceEventWindowAssociationRequest
  where
  rnf :: InstanceEventWindowAssociationRequest -> ()
rnf InstanceEventWindowAssociationRequest' {Maybe [Text]
Maybe [Tag]
instanceTags :: Maybe [Tag]
instanceIds :: Maybe [Text]
dedicatedHostIds :: Maybe [Text]
$sel:instanceTags:InstanceEventWindowAssociationRequest' :: InstanceEventWindowAssociationRequest -> Maybe [Tag]
$sel:instanceIds:InstanceEventWindowAssociationRequest' :: InstanceEventWindowAssociationRequest -> Maybe [Text]
$sel:dedicatedHostIds:InstanceEventWindowAssociationRequest' :: InstanceEventWindowAssociationRequest -> 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]
instanceTags

instance
  Data.ToQuery
    InstanceEventWindowAssociationRequest
  where
  toQuery :: InstanceEventWindowAssociationRequest -> QueryString
toQuery InstanceEventWindowAssociationRequest' {Maybe [Text]
Maybe [Tag]
instanceTags :: Maybe [Tag]
instanceIds :: Maybe [Text]
dedicatedHostIds :: Maybe [Text]
$sel:instanceTags:InstanceEventWindowAssociationRequest' :: InstanceEventWindowAssociationRequest -> Maybe [Tag]
$sel:instanceIds:InstanceEventWindowAssociationRequest' :: InstanceEventWindowAssociationRequest -> Maybe [Text]
$sel:dedicatedHostIds:InstanceEventWindowAssociationRequest' :: InstanceEventWindowAssociationRequest -> Maybe [Text]
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ forall a. ToQuery a => a -> QueryString
Data.toQuery
          ( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"DedicatedHostId"
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
dedicatedHostIds
          ),
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          ( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"InstanceId"
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
instanceIds
          ),
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          ( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"InstanceTag"
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
instanceTags
          )
      ]