{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-binds #-} {-# OPTIONS_GHC -fno-warn-unused-matches #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Network.AWS.EMR.AddTags -- Copyright : (c) 2013-2018 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Adds tags to an Amazon EMR resource. Tags make it easier to associate clusters in various ways, such as grouping clusters to track your Amazon EMR resource allocation costs. For more information, see . -- -- module Network.AWS.EMR.AddTags ( -- * Creating a Request addTags , AddTags -- * Request Lenses , atResourceId , atTags -- * Destructuring the Response , addTagsResponse , AddTagsResponse -- * Response Lenses , atrsResponseStatus ) where import Network.AWS.EMR.Types import Network.AWS.EMR.Types.Product import Network.AWS.Lens import Network.AWS.Prelude import Network.AWS.Request import Network.AWS.Response -- | This input identifies a cluster and a list of tags to attach. -- -- -- -- /See:/ 'addTags' smart constructor. data AddTags = AddTags' { _atResourceId :: !Text , _atTags :: ![Tag] } deriving (Eq, Read, Show, Data, Typeable, Generic) -- | Creates a value of 'AddTags' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'atResourceId' - The Amazon EMR resource identifier to which tags will be added. This value must be a cluster identifier. -- -- * 'atTags' - A list of tags to associate with a cluster and propagate to EC2 instances. Tags are user-defined key/value pairs that consist of a required key string with a maximum of 128 characters, and an optional value string with a maximum of 256 characters. addTags :: Text -- ^ 'atResourceId' -> AddTags addTags pResourceId_ = AddTags' {_atResourceId = pResourceId_, _atTags = mempty} -- | The Amazon EMR resource identifier to which tags will be added. This value must be a cluster identifier. atResourceId :: Lens' AddTags Text atResourceId = lens _atResourceId (\ s a -> s{_atResourceId = a}) -- | A list of tags to associate with a cluster and propagate to EC2 instances. Tags are user-defined key/value pairs that consist of a required key string with a maximum of 128 characters, and an optional value string with a maximum of 256 characters. atTags :: Lens' AddTags [Tag] atTags = lens _atTags (\ s a -> s{_atTags = a}) . _Coerce instance AWSRequest AddTags where type Rs AddTags = AddTagsResponse request = postJSON emr response = receiveEmpty (\ s h x -> AddTagsResponse' <$> (pure (fromEnum s))) instance Hashable AddTags where instance NFData AddTags where instance ToHeaders AddTags where toHeaders = const (mconcat ["X-Amz-Target" =# ("ElasticMapReduce.AddTags" :: ByteString), "Content-Type" =# ("application/x-amz-json-1.1" :: ByteString)]) instance ToJSON AddTags where toJSON AddTags'{..} = object (catMaybes [Just ("ResourceId" .= _atResourceId), Just ("Tags" .= _atTags)]) instance ToPath AddTags where toPath = const "/" instance ToQuery AddTags where toQuery = const mempty -- | This output indicates the result of adding tags to a resource. -- -- -- -- /See:/ 'addTagsResponse' smart constructor. newtype AddTagsResponse = AddTagsResponse' { _atrsResponseStatus :: Int } deriving (Eq, Read, Show, Data, Typeable, Generic) -- | Creates a value of 'AddTagsResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'atrsResponseStatus' - -- | The response status code. addTagsResponse :: Int -- ^ 'atrsResponseStatus' -> AddTagsResponse addTagsResponse pResponseStatus_ = AddTagsResponse' {_atrsResponseStatus = pResponseStatus_} -- | -- | The response status code. atrsResponseStatus :: Lens' AddTagsResponse Int atrsResponseStatus = lens _atrsResponseStatus (\ s a -> s{_atrsResponseStatus = a}) instance NFData AddTagsResponse where