I am using boto3 within a Python script and I'm using the describe_db_cluster_parameters to get the TLS ParameterName and its ParameterValue. I'm using this code below:
import boto3
import json
client = boto3.client('docdb')
response = client.describe_db_cluster_parameters(
DBClusterParameterGroupName='testaudit',
Filters=[
{
'Name': 'ParameterName',
'Values': [
'tls',
]
}
]
)
parameter = response.get('Parameters', {})
This is the sample response when I output it to json format. Though the sequence could be changed depending on the parameter.
[
{
"ApplyMethod": "pending-reboot",
"Description": "Enables auditing on cluster.",
"DataType": "string",
"IsModifiable": true,
"AllowedValues": "enabled,disabled",
"Source": "system",
"ParameterValue": "disabled",
"ParameterName": "audit_logs",
"ApplyType": "dynamic"
},
{
"ApplyMethod": "pending-reboot",
"Description": "Operations longer than profiler_threshold_ms will be logged",
"DataType": "integer",
"IsModifiable": true,
"AllowedValues": "50-2147483646",
"Source": "system",
"ParameterValue": "100",
"ParameterName": "profiler_threshold_ms",
"ApplyType": "dynamic"
},
{
"ApplyMethod": "pending-reboot",
"Description": "Config to enable/disable TLS",
"DataType": "string",
"IsModifiable": true,
"AllowedValues": "disabled,enabled",
"Source": "user",
"ParameterValue": "disabled",
"ParameterName": "tls",
"ApplyType": "static"
},
{
"ApplyMethod": "pending-reboot",
"Description": "Enables TTL Monitoring",
"DataType": "string",
"IsModifiable": true,
"AllowedValues": "disabled,enabled",
"Source": "system",
"ParameterValue": "enabled",
"ParameterName": "ttl_monitor",
"ApplyType": "dynamic"
}
]
If I need to get only the dictionary with the ParameterName equal to "tls" since I need to also get its ParameterValue, how would I do that? Do I need to use for loop or iterate to check each ParameterName per dictionary? Thanks!