in sdk/src/Handlers/AwsSdk/Internal/XRayPipelineHandler.cs [538:606]
private void AddResponseSpecificInformation(string serviceName, string operation, AmazonWebServiceResponse response, IDictionary<string, object> aws)
{
if (serviceName == null)
{
throw new ArgumentNullException(nameof(serviceName));
}
if (operation == null)
{
throw new ArgumentNullException(nameof(operation));
}
if (response == null)
{
throw new ArgumentNullException(nameof(response));
}
if (aws == null)
{
throw new ArgumentNullException(nameof(aws));
}
if (AWSServiceHandlerManifest == null)
{
_logger.DebugFormat("AWSServiceHandlerManifest doesn't exist.");
return;
}
if (!AWSServiceHandlerManifest.Services.TryGetValue(serviceName, out AWSServiceHandler serviceHandler))
{
_logger.DebugFormat("Service name doesn't exist in AWSServiceHandlerManifest: serviceName = {0}.", serviceName);
return;
}
if (!serviceHandler.Operations.TryGetValue(operation, out AWSOperationHandler operationHandler))
{
_logger.DebugFormat("Operation doesn't exist in AwsServiceInfo: serviceName = {0}, operation = {1}.", serviceName, operation);
return;
}
if (operationHandler.ResponseParameters != null)
{
foreach (string parameter in operationHandler.ResponseParameters)
{
if (TryReadPropertyValue(response, parameter, out object propertyValue))
{
aws[parameter.FromCamelCaseToSnakeCase()] = propertyValue;
}
}
}
if (operationHandler.ResponseDescriptors != null)
{
foreach (KeyValuePair<string, AWSOperationResponseDescriptor> kv in operationHandler.ResponseDescriptors)
{
var propertyName = kv.Key;
var descriptor = kv.Value;
if (descriptor.Map && descriptor.GetKeys)
{
XRayPipelineHandler.AddMapKeyProperty(aws, response, propertyName, descriptor.RenameTo);
}
else if (descriptor.List && descriptor.GetCount)
{
XRayPipelineHandler.AddListLengthProperty(aws, response, propertyName, descriptor.RenameTo);
}
}
}
}