{-# 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.DAX.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) -- -- Associates a set of tags with a DAX resource. You can call @TagResource@ up to 5 times per second, per account. -- -- module Network.AWS.DAX.TagResource ( -- * Creating a Request tagResource , TagResource -- * Request Lenses , trResourceName , trTags -- * Destructuring the Response , tagResourceResponse , TagResourceResponse -- * Response Lenses , trrsTags , trrsResponseStatus ) where import Network.AWS.DAX.Types import Network.AWS.DAX.Types.Product import Network.AWS.Lens import Network.AWS.Prelude import Network.AWS.Request import Network.AWS.Response -- | /See:/ 'tagResource' smart constructor. data TagResource = TagResource' { _trResourceName :: !Text , _trTags :: ![Tag] } 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: -- -- * 'trResourceName' - The name of the DAX resource to which tags should be added. -- -- * 'trTags' - The tags to be assigned to the DAX resource. tagResource :: Text -- ^ 'trResourceName' -> TagResource tagResource pResourceName_ = TagResource' {_trResourceName = pResourceName_, _trTags = mempty} -- | The name of the DAX resource to which tags should be added. trResourceName :: Lens' TagResource Text trResourceName = lens _trResourceName (\ s a -> s{_trResourceName = a}) -- | The tags to be assigned to the DAX resource. trTags :: Lens' TagResource [Tag] trTags = lens _trTags (\ s a -> s{_trTags = a}) . _Coerce instance AWSRequest TagResource where type Rs TagResource = TagResourceResponse request = postJSON dax response = receiveJSON (\ s h x -> TagResourceResponse' <$> (x .?> "Tags" .!@ mempty) <*> (pure (fromEnum s))) instance Hashable TagResource where instance NFData TagResource where instance ToHeaders TagResource where toHeaders = const (mconcat ["X-Amz-Target" =# ("AmazonDAXV3.TagResource" :: ByteString), "Content-Type" =# ("application/x-amz-json-1.1" :: ByteString)]) instance ToJSON TagResource where toJSON TagResource'{..} = object (catMaybes [Just ("ResourceName" .= _trResourceName), Just ("Tags" .= _trTags)]) instance ToPath TagResource where toPath = const "/" instance ToQuery TagResource where toQuery = const mempty -- | /See:/ 'tagResourceResponse' smart constructor. data TagResourceResponse = TagResourceResponse' { _trrsTags :: !(Maybe [Tag]) , _trrsResponseStatus :: !Int } deriving (Eq, Read, Show, Data, Typeable, Generic) -- | Creates a value of 'TagResourceResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'trrsTags' - The list of tags that are associated with the DAX resource. -- -- * 'trrsResponseStatus' - -- | The response status code. tagResourceResponse :: Int -- ^ 'trrsResponseStatus' -> TagResourceResponse tagResourceResponse pResponseStatus_ = TagResourceResponse' {_trrsTags = Nothing, _trrsResponseStatus = pResponseStatus_} -- | The list of tags that are associated with the DAX resource. trrsTags :: Lens' TagResourceResponse [Tag] trrsTags = lens _trrsTags (\ s a -> s{_trrsTags = a}) . _Default . _Coerce -- | -- | The response status code. trrsResponseStatus :: Lens' TagResourceResponse Int trrsResponseStatus = lens _trrsResponseStatus (\ s a -> s{_trrsResponseStatus = a}) instance NFData TagResourceResponse where