{-# 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.SecretsManager.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) -- -- Attaches one or more tags, each consisting of a key name and a value, to the specified secret. Tags are part of the secret's overall metadata, and are not associated with any specific version of the secret. This operation only appends tags to the existing list of tags. To remove tags, you must use 'UntagResource' . -- -- -- The following basic restrictions apply to tags: -- -- * Maximum number of tags per secret—50 -- -- * Maximum key length—127 Unicode characters in UTF-8 -- -- * Maximum value length—255 Unicode characters in UTF-8 -- -- * Tag keys and values are case sensitive. -- -- * Do not use the @aws:@ prefix in your tag names or values because it is reserved for AWS use. You can't edit or delete tag names or values with this prefix. Tags with this prefix do not count against your tags per secret limit. -- -- * If your tagging schema will be used across multiple services and resources, remember that other services might have restrictions on allowed characters. Generally allowed characters are: letters, spaces, and numbers representable in UTF-8, plus the following special characters: + - = . _ : / @. -- -- -- -- /Important:/ If you use tags as part of your security strategy, then adding or removing a tag can change permissions. If successfully completing this operation would result in you losing your permissions for this secret, then the operation is blocked and returns an Access Denied error. -- -- __Minimum permissions__ -- -- To run this command, you must have the following permissions: -- -- * secretsmanager:TagResource -- -- -- -- __Related operations__ -- -- * To remove one or more tags from the collection attached to a secret, use 'UntagResource' . -- -- * To view the list of tags attached to a secret, use 'DescribeSecret' . -- -- -- module Network.AWS.SecretsManager.TagResource ( -- * Creating a Request tagResource , TagResource -- * Request Lenses , trSecretId , trTags -- * Destructuring the Response , tagResourceResponse , TagResourceResponse ) where import Network.AWS.Lens import Network.AWS.Prelude import Network.AWS.Request import Network.AWS.Response import Network.AWS.SecretsManager.Types import Network.AWS.SecretsManager.Types.Product -- | /See:/ 'tagResource' smart constructor. data TagResource = TagResource' { _trSecretId :: !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: -- -- * 'trSecretId' - The identifier for the secret that you want to attach tags to. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret. -- -- * 'trTags' - The tags to attach to the secret. Each element in the list consists of a @Key@ and a @Value@ . This parameter to the API requires a JSON text string argument. For information on how to format a JSON parameter for the various command line tool environments, see in the /AWS CLI User Guide/ . For the AWS CLI, you can also use the syntax: @--Tags Key="Key1",Value="Value1",Key="Key2",Value="Value2"[,…]@ tagResource :: Text -- ^ 'trSecretId' -> TagResource tagResource pSecretId_ = TagResource' {_trSecretId = pSecretId_, _trTags = mempty} -- | The identifier for the secret that you want to attach tags to. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret. trSecretId :: Lens' TagResource Text trSecretId = lens _trSecretId (\ s a -> s{_trSecretId = a}) -- | The tags to attach to the secret. Each element in the list consists of a @Key@ and a @Value@ . This parameter to the API requires a JSON text string argument. For information on how to format a JSON parameter for the various command line tool environments, see in the /AWS CLI User Guide/ . For the AWS CLI, you can also use the syntax: @--Tags Key="Key1",Value="Value1",Key="Key2",Value="Value2"[,…]@ trTags :: Lens' TagResource [Tag] trTags = lens _trTags (\ s a -> s{_trTags = a}) . _Coerce instance AWSRequest TagResource where type Rs TagResource = TagResourceResponse request = postJSON secretsManager response = receiveNull TagResourceResponse' instance Hashable TagResource where instance NFData TagResource where instance ToHeaders TagResource where toHeaders = const (mconcat ["X-Amz-Target" =# ("secretsmanager.TagResource" :: ByteString), "Content-Type" =# ("application/x-amz-json-1.1" :: ByteString)]) instance ToJSON TagResource where toJSON TagResource'{..} = object (catMaybes [Just ("SecretId" .= _trSecretId), Just ("Tags" .= _trTags)]) instance ToPath TagResource where toPath = const "/" 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