File: exceptions.py

package info (click to toggle)
python-moto 5.1.18-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 116,520 kB
  • sloc: python: 636,725; javascript: 181; makefile: 39; sh: 3
file content (107 lines) | stat: -rw-r--r-- 3,135 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
from moto.core.exceptions import ServiceException


class ElastiCacheException(ServiceException):
    pass


class PasswordTooShort(ElastiCacheException):
    code = "InvalidParameterValue"
    message = "Passwords length must be between 16-128 characters."


class PasswordRequired(ElastiCacheException):
    code = "InvalidParameterValue"
    message = "No password was provided. If you want to create/update the user without password, please use the NoPasswordRequired flag."


class InvalidParameterValueException(ElastiCacheException):
    code = "InvalidParameterValue"


class InvalidParameterCombinationException(ElastiCacheException):
    code = "InvalidParameterCombination"


class UserAlreadyExists(ElastiCacheException):
    code = "UserAlreadyExists"

    def __init__(self) -> None:
        super().__init__("User user1 already exists.")


class UserNotFound(ElastiCacheException):
    code = "UserNotFound"

    def __init__(self, user_id: str):
        super().__init__(f"User {user_id} not found.")


class CacheClusterAlreadyExists(ElastiCacheException):
    code = "CacheClusterAlreadyExists"

    def __init__(self, cache_cluster_id: str):
        super().__init__(f"Cache cluster {cache_cluster_id} already exists.")


class CacheClusterNotFound(ElastiCacheException):
    code = "CacheClusterNotFound"

    def __init__(self, cache_cluster_id: str):
        super().__init__(f"Cache cluster {cache_cluster_id} not found.")


class CacheSubnetGroupAlreadyExists(ElastiCacheException):
    code = "CacheSubnetGroupAlreadyExists"

    def __init__(self, cache_subnet_group_name: str):
        super().__init__(f"CacheSubnetGroup {cache_subnet_group_name} already exists.")


class CacheSubnetGroupNotFound(ElastiCacheException):
    code = "CacheSubnetGroupNotFoundFault"

    def __init__(self, cache_subnet_group_name: str):
        super().__init__(f"CacheSubnetGroup {cache_subnet_group_name} not found.")


class InvalidARNFault(ElastiCacheException):
    code = "InvalidARN"

    def __init__(self, arn: str):
        super().__init__(f"ARN {arn} is invalid.")


class InvalidSubnet(ElastiCacheException):
    code = "InvalidSubnet"

    def __init__(self, subnet_id: str):
        super().__init__(f"Subnet {subnet_id} is invalid.")


class ReplicationGroupAlreadyExists(ElastiCacheException):
    code = "ReplicationGroupAlreadyExists"

    def __init__(self, replication_group_id: str):
        super().__init__(f"Replication group {replication_group_id} already exists.")


class ReplicationGroupNotFound(ElastiCacheException):
    code = "ReplicationGroupNotFoundFault"

    def __init__(self, replication_group_id: str):
        super().__init__(f"Replication group {replication_group_id} not found.")


class SnapshotNotFound(ElastiCacheException):
    code = "SnapshotNotFoundFault"

    def __init__(self, snapshot_name: str):
        super().__init__(f"Snapshot {snapshot_name} not found.")


class SnapshotAlreadyExists(ElastiCacheException):
    code = "SnapshotAlreadyExistsFault"

    def __init__(self, snapshot_name: str):
        super().__init__(f"Snapshot {snapshot_name} already exists.")