* Address `boto` deprecation warnings
This commit eliminates the following warning:
../boto/ec2/connection.py:582:
PendingDeprecationWarning: The current get_all_instances implementation will be replaced with get_all_reservations.
`boto` isn't likely to ever make good on this warning, but doing the replacement will
declutter the `moto` test output.
* Remove `invoke_lambda` tracebacks from unit test logging
If an exception is encountered, the details are returned in the response payload.
Printing the traceback was just adding noise to the pytest output.
* Use known AMIs in unit tests
This commit eliminates the following warning in the pytest output:
`PendingDeprecationWarning: Could not find AMI with image-id:ami-123456, in the near future this will cause an error.`
Known, pre-loaded AMI image ids are used instead of random ids that don't actually
exist in the moto backend. The integrity of the tests is unaffected by this change.
A test has been added to provide explicit coverage of the PendingDeprecationWarning
raised when an invalid AMI image id is passed to moto.
The latest release of `botocore` (1.19.62) makes changes to the parameter
validation code, which for some reason was also covered by a couple of
`moto` tests.
These tests, when run, do not execute any `moto` code. They fail the
parameter validation check in `botocore`, which raises an exception
before ever sending a request. These tests do not cover or verify
any `moto` behavior and have been removed.
Ref: ff8ae76eccCloses#3627
Replace the special-case code to handle Cloud Formation tags with a more
generic implementation that covers all instance tags.
Supersedes #2863Closes#2862
* Enforce parameter naming
Parameters are not allowed to start with `ssm` or `aws`. This commit adds error messages which
correspond exactly to the error messages returned by boto3.
* Fix for Python 2 compatibility
f-strings not supported in Python 2.7
* Implement Filter: Contains functionality for describe_params
This commit adds the Contains functionality. Tests were created
to mimic behavior in AWS/boto3, including that filters with values
in the form of `/name` will match parameters named `/name/match` but
not parameters named `match/with/other-name`. In the test example, a
Contains filter with the value `/tan` would match: `/tangent-3` and
`tangram-4` but not `standby-5`.
* Enforce parameter filter restrictions on get_parameters_by_path
According to the boto3 documentation [1], `Name`, `Path`, and `Tier` are not
allowed values for `Key` in a parameter filter for `get_parameters_by_path`.
This commit enforces this by calling `_validate_parameter_filters` from the
`get_parameters_by_path` method, and adding a check to `_validate_parameter_filters`.
I added 3 test cases to `test_get_parameters_by_path` which check for the correct
exception when calling with a parameter filter using any of these keys.
* Code formatted to match style
* Refactored logic
Currently, the delete_parameter function for the ssm client will respond with a dict containing a key of Invalid Parameter which has a value of a list containing the parameter name that was requested to be deleted when a parameter with said name doesn't exist which doesn't match the behavior of boto3.
SendCommand allows filtering for instances by tags. This adds support
for filtering by a cloud formation stack resource when creating command
invocations.
Users can make send_command requests and then retrieve the invocations
of those commands with get_command_invocation. Getting a command
invocation by instance and command id is supported but only the
'aws:runShellScript' plugin name is supported and only one plugin in a
document is supported.
* added tests for SSM Parameter Store filters (GetParametersByPath - ParameterStringFilter)
* implemented SSM Parameter Store filters support (only for get_parameters_by_path API)
* adding myself to authors file
Test that ListCommands returns commands sent by SendCommand as well as
filters by CommandId and InstanceId. In addition update the SendCommand
test for optional parameters.
TimeoutSeconds isn't a required field so we can't rely on it being there.
Quick tests against the AWS API show that when it's not specified the ExpiresAfter field seems to be 1 hour after the request.
* Added support for SSM get_parameters_by_path.
Signed-off-by: Kai Xia <xiaket@gmail.com>
* add logic to handle trailing '/'.
Also, fix pep8.
Signed-off-by: Kai Xia <kai.xia@sportsbet.com.au>
* add tests for parameter value in response.
Signed-off-by: Kai Xia <kai.xia@sportsbet.com.au>
This commit adds initial support for the Simple System Manager client.
It currently only mocks the following api endpoints:
- delete_parameter()
- put_parameter()
- get_parameters()