{-# 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.APIGateway.TagResource -- 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 or updates a tag on a given resource. -- -- module Network.AWS.APIGateway.TagResource ( -- * Creating a Request tagResource , TagResource -- * Request Lenses , trResourceARN , trTags -- * Destructuring the Response , tagResourceResponse , TagResourceResponse ) where import Network.AWS.APIGateway.Types import Network.AWS.APIGateway.Types.Product import Network.AWS.Lens import Network.AWS.Prelude import Network.AWS.Request import Network.AWS.Response -- | Adds or updates a tag on a given resource. -- -- -- -- /See:/ 'tagResource' smart constructor. data TagResource = TagResource' { _trResourceARN :: !Text , _trTags :: !(Map Text Text) } deriving (Eq, Read, Show, Data, Typeable, Generic) -- | Creates a value of 'TagResource' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'trResourceARN' - [Required] The ARN of a resource that can be tagged. The resource ARN must be URL-encoded. At present, 'Stage' is the only taggable resource. -- -- * 'trTags' - [Required] The key-value map of strings. The valid character set is [a-zA-Z+-=._:/]. The tag key can be up to 128 characters and must not start with @aws:@ . The tag value can be up to 256 characters. tagResource :: Text -- ^ 'trResourceARN' -> TagResource tagResource pResourceARN_ = TagResource' {_trResourceARN = pResourceARN_, _trTags = mempty} -- | [Required] The ARN of a resource that can be tagged. The resource ARN must be URL-encoded. At present, 'Stage' is the only taggable resource. trResourceARN :: Lens' TagResource Text trResourceARN = lens _trResourceARN (\ s a -> s{_trResourceARN = a}) -- | [Required] The key-value map of strings. The valid character set is [a-zA-Z+-=._:/]. The tag key can be up to 128 characters and must not start with @aws:@ . The tag value can be up to 256 characters. trTags :: Lens' TagResource (HashMap Text Text) trTags = lens _trTags (\ s a -> s{_trTags = a}) . _Map instance AWSRequest TagResource where type Rs TagResource = TagResourceResponse request = putJSON apiGateway response = receiveNull TagResourceResponse' instance Hashable TagResource where instance NFData TagResource where instance ToHeaders TagResource where toHeaders = const (mconcat ["Accept" =# ("application/json" :: ByteString)]) instance ToJSON TagResource where toJSON TagResource'{..} = object (catMaybes [Just ("tags" .= _trTags)]) instance ToPath TagResource where toPath TagResource'{..} = mconcat ["/tags/", toBS _trResourceARN] instance ToQuery TagResource where toQuery = const mempty -- | /See:/ 'tagResourceResponse' smart constructor. data TagResourceResponse = TagResourceResponse' deriving (Eq, Read, Show, Data, Typeable, Generic) -- | Creates a value of 'TagResourceResponse' with the minimum fields required to make a request. -- tagResourceResponse :: TagResourceResponse tagResourceResponse = TagResourceResponse' instance NFData TagResourceResponse where