|
1 | 1 | package software.amazon.qbusiness.application;
|
2 | 2 |
|
3 |
| -import java.util.Optional; |
4 |
| - |
5 |
| -import org.json.JSONObject; |
6 |
| - |
7 | 3 | import software.amazon.awssdk.services.qbusiness.QBusinessClient;
|
8 |
| -import software.amazon.awssdk.services.qbusiness.model.AccessDeniedException; |
9 |
| -import software.amazon.awssdk.services.qbusiness.model.ConflictException; |
10 |
| -import software.amazon.awssdk.services.qbusiness.model.QBusinessRequest; |
11 | 4 | import software.amazon.awssdk.services.qbusiness.model.GetApplicationRequest;
|
12 | 5 | import software.amazon.awssdk.services.qbusiness.model.GetApplicationResponse;
|
13 | 6 | import software.amazon.awssdk.services.qbusiness.model.ListTagsForResourceRequest;
|
14 | 7 | import software.amazon.awssdk.services.qbusiness.model.ListTagsForResourceResponse;
|
15 |
| -import software.amazon.awssdk.services.qbusiness.model.ResourceNotFoundException; |
16 |
| -import software.amazon.awssdk.services.qbusiness.model.ServiceQuotaExceededException; |
17 |
| -import software.amazon.awssdk.services.qbusiness.model.ThrottlingException; |
18 |
| -import software.amazon.awssdk.services.qbusiness.model.ValidationException; |
19 | 8 | import software.amazon.awssdk.utils.StringUtils;
|
20 |
| -import software.amazon.cloudformation.exceptions.BaseHandlerException; |
21 |
| -import software.amazon.cloudformation.exceptions.CfnAccessDeniedException; |
22 |
| -import software.amazon.cloudformation.exceptions.CfnGeneralServiceException; |
23 |
| -import software.amazon.cloudformation.exceptions.CfnInvalidRequestException; |
24 |
| -import software.amazon.cloudformation.exceptions.CfnNotFoundException; |
25 |
| -import software.amazon.cloudformation.exceptions.CfnResourceConflictException; |
26 |
| -import software.amazon.cloudformation.exceptions.CfnServiceLimitExceededException; |
27 |
| -import software.amazon.cloudformation.exceptions.CfnThrottlingException; |
28 | 9 | import software.amazon.cloudformation.proxy.AmazonWebServicesClientProxy;
|
29 | 10 | import software.amazon.cloudformation.proxy.Logger;
|
30 | 11 | import software.amazon.cloudformation.proxy.ProgressEvent;
|
@@ -71,39 +52,4 @@ protected GetApplicationResponse getApplication(ResourceModel model, ProxyClient
|
71 | 52 | GetApplicationRequest getApplicationRequest = Translator.translateToReadRequest(model);
|
72 | 53 | return proxyClient.injectCredentialsAndInvokeV2(getApplicationRequest, proxyClient.client()::getApplication);
|
73 | 54 | }
|
74 |
| - |
75 |
| - /* protected ProgressEvent<ResourceModel, CallbackContext> handleError( |
76 |
| - QBusinessRequest qBusinessRequest, |
77 |
| - ResourceModel resourceModel, |
78 |
| - Exception error, |
79 |
| - CallbackContext context, |
80 |
| - Logger logger, |
81 |
| - String apiName |
82 |
| - ) { |
83 |
| - logger.log("[ERROR] Failed Request: %s. Error Message: %s".formatted(apiName, error.getMessage())); |
84 |
| - BaseHandlerException cfnException; |
85 |
| -
|
86 |
| - var primaryIdentifier = Optional.ofNullable(resourceModel) |
87 |
| - .map(ResourceModel::getPrimaryIdentifier) |
88 |
| - .map(JSONObject::toString) |
89 |
| - .orElse(""); |
90 |
| -
|
91 |
| - if (error instanceof ResourceNotFoundException) { |
92 |
| - cfnException = new CfnNotFoundException(ResourceModel.TYPE_NAME, primaryIdentifier, error); |
93 |
| - } else if (error instanceof ValidationException || error instanceof CfnInvalidRequestException) { |
94 |
| - cfnException = new CfnInvalidRequestException(error); |
95 |
| - } else if (error instanceof ThrottlingException) { |
96 |
| - cfnException = new CfnThrottlingException(apiName, error); |
97 |
| - } else if (error instanceof ConflictException) { |
98 |
| - cfnException = new CfnResourceConflictException(error); |
99 |
| - } else if (error instanceof AccessDeniedException) { |
100 |
| - cfnException = new CfnAccessDeniedException(apiName, error); |
101 |
| - } else if (error instanceof ServiceQuotaExceededException) { |
102 |
| - cfnException = new CfnServiceLimitExceededException(error); |
103 |
| - } else { |
104 |
| - cfnException = new CfnGeneralServiceException(error); |
105 |
| - } |
106 |
| -
|
107 |
| - return ProgressEvent.failed(resourceModel, context, cfnException.getErrorCode(), cfnException.getMessage()); |
108 |
| - }*/ |
109 | 55 | }
|
0 commit comments