{-# 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.LaunchTemplateTagSpecificationRequest
-- 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.LaunchTemplateTagSpecificationRequest 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.ResourceType
import Amazonka.EC2.Types.Tag
import qualified Amazonka.Prelude as Prelude

-- | The tags specification for the resources that are created during
-- instance launch.
--
-- /See:/ 'newLaunchTemplateTagSpecificationRequest' smart constructor.
data LaunchTemplateTagSpecificationRequest = LaunchTemplateTagSpecificationRequest'
  { -- | The type of resource to tag.
    --
    -- The @Valid Values@ are all the resource types that can be tagged.
    -- However, when creating a launch template, you can specify tags for the
    -- following resource types only: @instance@ | @volume@ | @elastic-gpu@ |
    -- @network-interface@ | @spot-instances-request@
    --
    -- To tag a resource after it has been created, see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html CreateTags>.
    LaunchTemplateTagSpecificationRequest -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
    -- | The tags to apply to the resource.
    LaunchTemplateTagSpecificationRequest -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  deriving (LaunchTemplateTagSpecificationRequest
-> LaunchTemplateTagSpecificationRequest -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LaunchTemplateTagSpecificationRequest
-> LaunchTemplateTagSpecificationRequest -> Bool
$c/= :: LaunchTemplateTagSpecificationRequest
-> LaunchTemplateTagSpecificationRequest -> Bool
== :: LaunchTemplateTagSpecificationRequest
-> LaunchTemplateTagSpecificationRequest -> Bool
$c== :: LaunchTemplateTagSpecificationRequest
-> LaunchTemplateTagSpecificationRequest -> Bool
Prelude.Eq, ReadPrec [LaunchTemplateTagSpecificationRequest]
ReadPrec LaunchTemplateTagSpecificationRequest
Int -> ReadS LaunchTemplateTagSpecificationRequest
ReadS [LaunchTemplateTagSpecificationRequest]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LaunchTemplateTagSpecificationRequest]
$creadListPrec :: ReadPrec [LaunchTemplateTagSpecificationRequest]
readPrec :: ReadPrec LaunchTemplateTagSpecificationRequest
$creadPrec :: ReadPrec LaunchTemplateTagSpecificationRequest
readList :: ReadS [LaunchTemplateTagSpecificationRequest]
$creadList :: ReadS [LaunchTemplateTagSpecificationRequest]
readsPrec :: Int -> ReadS LaunchTemplateTagSpecificationRequest
$creadsPrec :: Int -> ReadS LaunchTemplateTagSpecificationRequest
Prelude.Read, Int -> LaunchTemplateTagSpecificationRequest -> ShowS
[LaunchTemplateTagSpecificationRequest] -> ShowS
LaunchTemplateTagSpecificationRequest -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LaunchTemplateTagSpecificationRequest] -> ShowS
$cshowList :: [LaunchTemplateTagSpecificationRequest] -> ShowS
show :: LaunchTemplateTagSpecificationRequest -> String
$cshow :: LaunchTemplateTagSpecificationRequest -> String
showsPrec :: Int -> LaunchTemplateTagSpecificationRequest -> ShowS
$cshowsPrec :: Int -> LaunchTemplateTagSpecificationRequest -> ShowS
Prelude.Show, forall x.
Rep LaunchTemplateTagSpecificationRequest x
-> LaunchTemplateTagSpecificationRequest
forall x.
LaunchTemplateTagSpecificationRequest
-> Rep LaunchTemplateTagSpecificationRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LaunchTemplateTagSpecificationRequest x
-> LaunchTemplateTagSpecificationRequest
$cfrom :: forall x.
LaunchTemplateTagSpecificationRequest
-> Rep LaunchTemplateTagSpecificationRequest x
Prelude.Generic)

-- |
-- Create a value of 'LaunchTemplateTagSpecificationRequest' 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:
--
-- 'resourceType', 'launchTemplateTagSpecificationRequest_resourceType' - The type of resource to tag.
--
-- The @Valid Values@ are all the resource types that can be tagged.
-- However, when creating a launch template, you can specify tags for the
-- following resource types only: @instance@ | @volume@ | @elastic-gpu@ |
-- @network-interface@ | @spot-instances-request@
--
-- To tag a resource after it has been created, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html CreateTags>.
--
-- 'tags', 'launchTemplateTagSpecificationRequest_tags' - The tags to apply to the resource.
newLaunchTemplateTagSpecificationRequest ::
  LaunchTemplateTagSpecificationRequest
newLaunchTemplateTagSpecificationRequest :: LaunchTemplateTagSpecificationRequest
newLaunchTemplateTagSpecificationRequest =
  LaunchTemplateTagSpecificationRequest'
    { $sel:resourceType:LaunchTemplateTagSpecificationRequest' :: Maybe ResourceType
resourceType =
        forall a. Maybe a
Prelude.Nothing,
      $sel:tags:LaunchTemplateTagSpecificationRequest' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The type of resource to tag.
--
-- The @Valid Values@ are all the resource types that can be tagged.
-- However, when creating a launch template, you can specify tags for the
-- following resource types only: @instance@ | @volume@ | @elastic-gpu@ |
-- @network-interface@ | @spot-instances-request@
--
-- To tag a resource after it has been created, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html CreateTags>.
launchTemplateTagSpecificationRequest_resourceType :: Lens.Lens' LaunchTemplateTagSpecificationRequest (Prelude.Maybe ResourceType)
launchTemplateTagSpecificationRequest_resourceType :: Lens' LaunchTemplateTagSpecificationRequest (Maybe ResourceType)
launchTemplateTagSpecificationRequest_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchTemplateTagSpecificationRequest' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:LaunchTemplateTagSpecificationRequest' :: LaunchTemplateTagSpecificationRequest -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: LaunchTemplateTagSpecificationRequest
s@LaunchTemplateTagSpecificationRequest' {} Maybe ResourceType
a -> LaunchTemplateTagSpecificationRequest
s {$sel:resourceType:LaunchTemplateTagSpecificationRequest' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: LaunchTemplateTagSpecificationRequest)

-- | The tags to apply to the resource.
launchTemplateTagSpecificationRequest_tags :: Lens.Lens' LaunchTemplateTagSpecificationRequest (Prelude.Maybe [Tag])
launchTemplateTagSpecificationRequest_tags :: Lens' LaunchTemplateTagSpecificationRequest (Maybe [Tag])
launchTemplateTagSpecificationRequest_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchTemplateTagSpecificationRequest' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:LaunchTemplateTagSpecificationRequest' :: LaunchTemplateTagSpecificationRequest -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: LaunchTemplateTagSpecificationRequest
s@LaunchTemplateTagSpecificationRequest' {} Maybe [Tag]
a -> LaunchTemplateTagSpecificationRequest
s {$sel:tags:LaunchTemplateTagSpecificationRequest' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: LaunchTemplateTagSpecificationRequest) 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
    LaunchTemplateTagSpecificationRequest
  where
  hashWithSalt :: Int -> LaunchTemplateTagSpecificationRequest -> Int
hashWithSalt
    Int
_salt
    LaunchTemplateTagSpecificationRequest' {Maybe [Tag]
Maybe ResourceType
tags :: Maybe [Tag]
resourceType :: Maybe ResourceType
$sel:tags:LaunchTemplateTagSpecificationRequest' :: LaunchTemplateTagSpecificationRequest -> Maybe [Tag]
$sel:resourceType:LaunchTemplateTagSpecificationRequest' :: LaunchTemplateTagSpecificationRequest -> Maybe ResourceType
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceType
resourceType
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags

instance
  Prelude.NFData
    LaunchTemplateTagSpecificationRequest
  where
  rnf :: LaunchTemplateTagSpecificationRequest -> ()
rnf LaunchTemplateTagSpecificationRequest' {Maybe [Tag]
Maybe ResourceType
tags :: Maybe [Tag]
resourceType :: Maybe ResourceType
$sel:tags:LaunchTemplateTagSpecificationRequest' :: LaunchTemplateTagSpecificationRequest -> Maybe [Tag]
$sel:resourceType:LaunchTemplateTagSpecificationRequest' :: LaunchTemplateTagSpecificationRequest -> Maybe ResourceType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceType
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags

instance
  Data.ToQuery
    LaunchTemplateTagSpecificationRequest
  where
  toQuery :: LaunchTemplateTagSpecificationRequest -> QueryString
toQuery LaunchTemplateTagSpecificationRequest' {Maybe [Tag]
Maybe ResourceType
tags :: Maybe [Tag]
resourceType :: Maybe ResourceType
$sel:tags:LaunchTemplateTagSpecificationRequest' :: LaunchTemplateTagSpecificationRequest -> Maybe [Tag]
$sel:resourceType:LaunchTemplateTagSpecificationRequest' :: LaunchTemplateTagSpecificationRequest -> Maybe ResourceType
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"ResourceType" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe ResourceType
resourceType,
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          (forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"Tag" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags)
      ]