

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

# @InjectKeywordedSecretString
<a name="retrieving-secrets_cache-decor-keyword"></a>

Questo decoratore prevede una stringa identificativa del segreto e [SecretCache](retrieving-secrets_cache-ref-secretcache.md) come primo e secondo argomento. Gli argomenti rimanenti mappano i parametri dalla funzione wrapping alle chiavi JSON nel segreto. Il segreto deve contenere una stringa nella struttura JSON. 

Per un segreto che contiene questo JSON:

```
{
  "username": "{{saanvi}}",
  "password": "{{EXAMPLE-PASSWORD}}"
}
```

Gli esempi seguenti mostrano come estrarre i valori JSON per `username` e `password` dal segreto.

```
from aws_secretsmanager_caching import SecretCache 
  from aws_secretsmanager_caching import InjectKeywordedSecretString,  InjectSecretString 
  
  cache = SecretCache()
  
  @InjectKeywordedSecretString ( secret_id = '{{mysecret}}' ,  cache = cache ,  func_username = 'username' ,  func_password = 'password' ) 
  def {{function_to_be_decorated}}( func_username,  func_password):
       print( 'Do something with the func_username and func_password parameters')
```