forked from aws/aws-sdk-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathErrorCode.cpp
More file actions
140 lines (133 loc) · 4.3 KB
/
ErrorCode.cpp
File metadata and controls
140 lines (133 loc) · 4.3 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
* Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#include <aws/codedeploy/model/ErrorCode.h>
#include <aws/core/utils/HashingUtils.h>
using namespace Aws::Utils;
static const int DEPLOYMENT_GROUP_MISSING_HASH = HashingUtils::HashString("DEPLOYMENT_GROUP_MISSING");
static const int APPLICATION_MISSING_HASH = HashingUtils::HashString("APPLICATION_MISSING");
static const int REVISION_MISSING_HASH = HashingUtils::HashString("REVISION_MISSING");
static const int IAM_ROLE_MISSING_HASH = HashingUtils::HashString("IAM_ROLE_MISSING");
static const int IAM_ROLE_PERMISSIONS_HASH = HashingUtils::HashString("IAM_ROLE_PERMISSIONS");
static const int NO_EC2_SUBSCRIPTION_HASH = HashingUtils::HashString("NO_EC2_SUBSCRIPTION");
static const int OVER_MAX_INSTANCES_HASH = HashingUtils::HashString("OVER_MAX_INSTANCES");
static const int NO_INSTANCES_HASH = HashingUtils::HashString("NO_INSTANCES");
static const int TIMEOUT_HASH = HashingUtils::HashString("TIMEOUT");
static const int HEALTH_CONSTRAINTS_INVALID_HASH = HashingUtils::HashString("HEALTH_CONSTRAINTS_INVALID");
static const int HEALTH_CONSTRAINTS_HASH = HashingUtils::HashString("HEALTH_CONSTRAINTS");
static const int INTERNAL_ERROR_HASH = HashingUtils::HashString("INTERNAL_ERROR");
static const int THROTTLED_HASH = HashingUtils::HashString("THROTTLED");
namespace Aws
{
namespace CodeDeploy
{
namespace Model
{
namespace ErrorCodeMapper
{
ErrorCode GetErrorCodeForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == DEPLOYMENT_GROUP_MISSING_HASH)
{
return ErrorCode::DEPLOYMENT_GROUP_MISSING;
}
else if (hashCode == APPLICATION_MISSING_HASH)
{
return ErrorCode::APPLICATION_MISSING;
}
else if (hashCode == REVISION_MISSING_HASH)
{
return ErrorCode::REVISION_MISSING;
}
else if (hashCode == IAM_ROLE_MISSING_HASH)
{
return ErrorCode::IAM_ROLE_MISSING;
}
else if (hashCode == IAM_ROLE_PERMISSIONS_HASH)
{
return ErrorCode::IAM_ROLE_PERMISSIONS;
}
else if (hashCode == NO_EC2_SUBSCRIPTION_HASH)
{
return ErrorCode::NO_EC2_SUBSCRIPTION;
}
else if (hashCode == OVER_MAX_INSTANCES_HASH)
{
return ErrorCode::OVER_MAX_INSTANCES;
}
else if (hashCode == NO_INSTANCES_HASH)
{
return ErrorCode::NO_INSTANCES;
}
else if (hashCode == TIMEOUT_HASH)
{
return ErrorCode::TIMEOUT;
}
else if (hashCode == HEALTH_CONSTRAINTS_INVALID_HASH)
{
return ErrorCode::HEALTH_CONSTRAINTS_INVALID;
}
else if (hashCode == HEALTH_CONSTRAINTS_HASH)
{
return ErrorCode::HEALTH_CONSTRAINTS;
}
else if (hashCode == INTERNAL_ERROR_HASH)
{
return ErrorCode::INTERNAL_ERROR;
}
else if (hashCode == THROTTLED_HASH)
{
return ErrorCode::THROTTLED;
}
return ErrorCode::NOT_SET;
}
Aws::String GetNameForErrorCode(ErrorCode value)
{
switch(value)
{
case ErrorCode::DEPLOYMENT_GROUP_MISSING:
return "DEPLOYMENT_GROUP_MISSING";
case ErrorCode::APPLICATION_MISSING:
return "APPLICATION_MISSING";
case ErrorCode::REVISION_MISSING:
return "REVISION_MISSING";
case ErrorCode::IAM_ROLE_MISSING:
return "IAM_ROLE_MISSING";
case ErrorCode::IAM_ROLE_PERMISSIONS:
return "IAM_ROLE_PERMISSIONS";
case ErrorCode::NO_EC2_SUBSCRIPTION:
return "NO_EC2_SUBSCRIPTION";
case ErrorCode::OVER_MAX_INSTANCES:
return "OVER_MAX_INSTANCES";
case ErrorCode::NO_INSTANCES:
return "NO_INSTANCES";
case ErrorCode::TIMEOUT:
return "TIMEOUT";
case ErrorCode::HEALTH_CONSTRAINTS_INVALID:
return "HEALTH_CONSTRAINTS_INVALID";
case ErrorCode::HEALTH_CONSTRAINTS:
return "HEALTH_CONSTRAINTS";
case ErrorCode::INTERNAL_ERROR:
return "INTERNAL_ERROR";
case ErrorCode::THROTTLED:
return "THROTTLED";
default:
return "";
}
}
} // namespace ErrorCodeMapper
} // namespace Model
} // namespace CodeDeploy
} // namespace Aws