943ecb7ea7
* Feature: Support --filters opton in secretsmanager:ListSecrets * Implement some of the secret filters * Check listSecrets filters combine with an implicit AND operator * Test all filter and multi-value filter and multi-word filter * Fix matcher behavior, restructure code * Implement remaining listSecrets filter cases * Linter fixes * Use contains-in-any-order assertions for test_list_secrets * Linter fix again * Attempt Python 2 fix for assert_items_equal * Remove docstrings from test_list_secrets tests as they make the test reports weird * Test and handle listSecrets filter with no values
65 lines
1.9 KiB
Python
65 lines
1.9 KiB
Python
from __future__ import unicode_literals
|
|
from moto.core.exceptions import JsonRESTError
|
|
|
|
|
|
class SecretsManagerClientError(JsonRESTError):
|
|
code = 400
|
|
|
|
|
|
class ResourceNotFoundException(SecretsManagerClientError):
|
|
def __init__(self, message):
|
|
self.code = 404
|
|
super(ResourceNotFoundException, self).__init__(
|
|
"ResourceNotFoundException", message
|
|
)
|
|
|
|
|
|
class SecretNotFoundException(SecretsManagerClientError):
|
|
def __init__(self):
|
|
self.code = 404
|
|
super(SecretNotFoundException, self).__init__(
|
|
"ResourceNotFoundException",
|
|
message="Secrets Manager can't find the specified secret.",
|
|
)
|
|
|
|
|
|
class SecretHasNoValueException(SecretsManagerClientError):
|
|
def __init__(self, version_stage):
|
|
self.code = 404
|
|
super(SecretHasNoValueException, self).__init__(
|
|
"ResourceNotFoundException",
|
|
message="Secrets Manager can't find the specified secret "
|
|
"value for staging label: {}".format(version_stage),
|
|
)
|
|
|
|
|
|
class ClientError(SecretsManagerClientError):
|
|
def __init__(self, message):
|
|
super(ClientError, self).__init__("InvalidParameterValue", message)
|
|
|
|
|
|
class InvalidParameterException(SecretsManagerClientError):
|
|
def __init__(self, message):
|
|
super(InvalidParameterException, self).__init__(
|
|
"InvalidParameterException", message
|
|
)
|
|
|
|
|
|
class ResourceExistsException(SecretsManagerClientError):
|
|
def __init__(self, message):
|
|
super(ResourceExistsException, self).__init__(
|
|
"ResourceExistsException", message
|
|
)
|
|
|
|
|
|
class InvalidRequestException(SecretsManagerClientError):
|
|
def __init__(self, message):
|
|
super(InvalidRequestException, self).__init__(
|
|
"InvalidRequestException", message
|
|
)
|
|
|
|
|
|
class ValidationException(SecretsManagerClientError):
|
|
def __init__(self, message):
|
|
super(ValidationException, self).__init__("ValidationException", message)
|