in costcategory/src/main/java/software/amazon/ce/costcategory/ReadHandler.java [29:58]
public ProgressEvent<ResourceModel, CallbackContext> handleRequest(
final AmazonWebServicesClientProxy proxy,
final ResourceHandlerRequest<ResourceModel> request,
final CallbackContext callbackContext,
final Logger logger) {
final ResourceModel model = request.getDesiredResourceState();
try {
DescribeCostCategoryDefinitionResponse response = proxy.injectCredentialsAndInvokeV2(
CostCategoryRequestBuilder.buildDescribeRequest(model),
costExplorerClient::describeCostCategoryDefinition
);
CostCategory costCategory = response.costCategory();
model.setName(costCategory.name());
model.setEffectiveStart(costCategory.effectiveStart());
model.setRuleVersion(costCategory.ruleVersionAsString());
model.setRules(CostCategoryParser.costCategoryRulesToJson(costCategory.rules()));
model.setSplitChargeRules(CostCategoryParser.costCategorySplitChargeRulesToJson(costCategory.splitChargeRules()));
model.setDefaultValue(costCategory.defaultValue());
return ProgressEvent.<ResourceModel, CallbackContext>builder()
.resourceModel(model)
.status(OperationStatus.SUCCESS)
.build();
} catch (ResourceNotFoundException ex) {
throw new CfnNotFoundException(ex);
}
}