Is there a way to make a boto3 client pass a parameter with an explict null value (as opposed to omitting the parameter entirely)?
I'm trying to use create_recipt_rule on the boto3 SES client to add a new receipt rule that I want to be the first rule.
The AWS API docs (also pulled through to boto docs above) say this should be achieved by passing the After
parameter with a null value:
After (string) -- The name of an existing rule after which the new rule will be placed. If this parameter is null, the new rule will be inserted at the beginning of the rule list
From testing I've found that this must be explictly passed as null
. Simply ommiting the After
parameter results in the rule being added at the end of the list.
I thought I'd be able to pass an explict value by having the After
parameter present with an explit None
value. However this fails on boto3's parameter validation. i.e.
client.create_receipt_rule(
RuleSetName='my-ruleset',
After=None,
Rule={ ... },
)
Results in the following error:
Parameter validation failed:
Invalid type for parameter After, value: None, type: <type 'NoneType'>, valid types: <type 'basestring'>
I also tried passing the string 'null'
but that looks for a rule called null
to put the rule after rather than putting the rule at the start.
Is there a way to pass an expit null
value to a parameter via the boto3 client?
As it turns out my test was incorrect and so I miss-understood how create_receipt_rule
behaves when the after
parameter is omitted.
When the after
parameter is omitted the new rule is added as the first rule, not the last as I thought.
So the answer to this question is there is no need to pass an explict null
value, just omitting the after
parameter achieves the goal.