Chilkat Online Tools

ListAnomaliesForInsight TCL Example

Amazon DevOps Guru

load ./chilkat.dll

# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

set rest [new_CkRest]

set authAws [new_CkAuthAws]

CkAuthAws_put_AccessKey $authAws "AWS_ACCESS_KEY"
CkAuthAws_put_SecretKey $authAws "AWS_SECRET_KEY"

# Don't forget to change the region to your particular region. (Also make the same change in the call to Connect below.)
CkAuthAws_put_Region $authAws "us-west-2"
CkAuthAws_put_ServiceName $authAws "devops-guru"
# SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
CkRest_SetAuthAws $rest $authAws

# URL: https://devops-guru.us-west-2.amazonaws.com/
# Use the same region as specified above.
set success [CkRest_Connect $rest "devops-guru.us-west-2.amazonaws.com" 443 1 1]
if {$success != 1} then {
    puts "ConnectFailReason: [CkRest_get_ConnectFailReason $rest]"
    puts [CkRest_lastErrorText $rest]
    delete_CkRest $rest
    delete_CkAuthAws $authAws
    exit
}

# The following code creates the JSON request body.
# The JSON created by this code is shown below.

# Use this online tool to generate code from sample JSON:
# Generate Code to Create JSON

set json [new_CkJsonObject]

CkJsonObject_UpdateString $json "AccountId" "string"
CkJsonObject_UpdateInt $json "MaxResults" 123
CkJsonObject_UpdateString $json "NextToken" "string"
CkJsonObject_UpdateInt $json "StartTimeRange.FromTime" 123
CkJsonObject_UpdateInt $json "StartTimeRange.ToTime" 123

# The JSON request body created by the above code:

# {
#   "AccountId": "string",
#   "MaxResults": number,
#   "NextToken": "string",
#   "StartTimeRange": {
#     "FromTime": number,
#     "ToTime": number
#   }
# }

CkRest_AddHeader $rest "Content-Type" "application/x-amz-json-1.1"
CkRest_AddHeader $rest "X-Amz-Target" "ListAnomaliesForInsight"

set sbRequestBody [new_CkStringBuilder]

CkJsonObject_EmitSb $json $sbRequestBody
set sbResponseBody [new_CkStringBuilder]

set success [CkRest_FullRequestSb $rest "POST" "/anomalies/insight/{InsightId}" $sbRequestBody $sbResponseBody]
if {$success != 1} then {
    puts [CkRest_lastErrorText $rest]
    delete_CkRest $rest
    delete_CkAuthAws $authAws
    delete_CkJsonObject $json
    delete_CkStringBuilder $sbRequestBody
    delete_CkStringBuilder $sbResponseBody
    exit
}

set respStatusCode [CkRest_get_ResponseStatusCode $rest]
puts "response status code = $respStatusCode"
if {$respStatusCode != 200} then {
    puts "Response Header:"
    puts [CkRest_responseHeader $rest]
    puts "Response Body:"
    puts [CkStringBuilder_getAsString $sbResponseBody]
    delete_CkRest $rest
    delete_CkAuthAws $authAws
    delete_CkJsonObject $json
    delete_CkStringBuilder $sbRequestBody
    delete_CkStringBuilder $sbResponseBody
    exit
}

set jResp [new_CkJsonObject]

CkJsonObject_LoadSb $jResp $sbResponseBody

# The following code parses the JSON response.
# A sample JSON response is shown below the sample code.

# Use this online tool to generate parsing code from sample JSON:
# Generate Parsing Code from JSON

# json1 is a CkJsonObject

set NextToken [CkJsonObject_stringOf $jResp "NextToken"]
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "ProactiveAnomalies"]
while {$i < $count_i} {
    CkJsonObject_put_I $jResp $i
    set CloseTime [CkJsonObject_IntOf $jResp "ProactiveAnomalies[i].AnomalyReportedTimeRange.CloseTime"]
    set OpenTime [CkJsonObject_IntOf $jResp "ProactiveAnomalies[i].AnomalyReportedTimeRange.OpenTime"]
    set EndTime [CkJsonObject_IntOf $jResp "ProactiveAnomalies[i].AnomalyTimeRange.EndTime"]
    set StartTime [CkJsonObject_IntOf $jResp "ProactiveAnomalies[i].AnomalyTimeRange.StartTime"]
    set AssociatedInsightId [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].AssociatedInsightId"]
    set Id [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].Id"]
    set Limit [CkJsonObject_IntOf $jResp "ProactiveAnomalies[i].Limit"]
    set PredictionTimeRangeEndTime [CkJsonObject_IntOf $jResp "ProactiveAnomalies[i].PredictionTimeRange.EndTime"]
    set PredictionTimeRangeStartTime [CkJsonObject_IntOf $jResp "ProactiveAnomalies[i].PredictionTimeRange.StartTime"]
    set Severity [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].Severity"]
    set Source [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceMetadata.Source"]
    set SourceResourceName [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceMetadata.SourceResourceName"]
    set SourceResourceType [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceMetadata.SourceResourceType"]
    set Status [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].Status"]
    set UpdateTime [CkJsonObject_IntOf $jResp "ProactiveAnomalies[i].UpdateTime"]
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jResp "ProactiveAnomalies[i].AnomalyResources"]
    while {$j < $count_j} {
        CkJsonObject_put_J $jResp $j
        set Name [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].AnomalyResources[j].Name"]
        set v_Type [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].AnomalyResources[j].Type"]
        set j [expr $j + 1]
    }
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jResp "ProactiveAnomalies[i].ResourceCollection.CloudFormation.StackNames"]
    while {$j < $count_j} {
        CkJsonObject_put_J $jResp $j
        set strVal [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].ResourceCollection.CloudFormation.StackNames[j]"]
        set j [expr $j + 1]
    }
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jResp "ProactiveAnomalies[i].ResourceCollection.Tags"]
    while {$j < $count_j} {
        CkJsonObject_put_J $jResp $j
        set AppBoundaryKey [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].ResourceCollection.Tags[j].AppBoundaryKey"]
        set k 0
        set count_k [CkJsonObject_SizeOfArray $jResp "ProactiveAnomalies[i].ResourceCollection.Tags[j].TagValues"]
        while {$k < $count_k} {
            CkJsonObject_put_K $jResp $k
            set strVal [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].ResourceCollection.Tags[j].TagValues[k]"]
            set k [expr $k + 1]
        }
        set j [expr $j + 1]
    }
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jResp "ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics"]
    while {$j < $count_j} {
        CkJsonObject_put_J $jResp $j
        set StatusCode [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.StatusCode"]
        set MetricName [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricName"]
        set Namespace [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Namespace"]
        set Period [CkJsonObject_IntOf $jResp "ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Period"]
        set Stat [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Stat"]
        set Unit [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Unit"]
        set k 0
        set count_k [CkJsonObject_SizeOfArray $jResp "ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions"]
        while {$k < $count_k} {
            CkJsonObject_put_K $jResp $k
            set Name [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions[k].Name"]
            set Value [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions[k].Value"]
            set k [expr $k + 1]
        }
        set k 0
        set count_k [CkJsonObject_SizeOfArray $jResp "ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList"]
        while {$k < $count_k} {
            CkJsonObject_put_K $jResp $k
            set MetricValue [CkJsonObject_IntOf $jResp "ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList[k].MetricValue"]
            set Timestamp [CkJsonObject_IntOf $jResp "ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList[k].Timestamp"]
            set k [expr $k + 1]
        }
        set j [expr $j + 1]
    }
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics"]
    while {$j < $count_j} {
        CkJsonObject_put_J $jResp $j
        set MetricDisplayName [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricDisplayName"]
        set v_String [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.Filter.string"]
        set Group [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Group"]
        set GroupByLimit [CkJsonObject_IntOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Limit"]
        set Metric [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.Metric"]
        set Unit [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].Unit"]
        set k 0
        set count_k [CkJsonObject_SizeOfArray $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Dimensions"]
        while {$k < $count_k} {
            CkJsonObject_put_K $jResp $k
            set strVal [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Dimensions[k]"]
            set k [expr $k + 1]
        }
        set k 0
        set count_k [CkJsonObject_SizeOfArray $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData"]
        while {$k < $count_k} {
            CkJsonObject_put_K $jResp $k
            set FilterString [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.Filter.string"]
            set GroupByGroup [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Group"]
            set GroupByLimit [CkJsonObject_IntOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Limit"]
            set MetricQueryMetric [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.Metric"]
            set ReferenceScalarValue [CkJsonObject_IntOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceScalar.Value"]
            set Name [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].Name"]

            set json1 [CkJsonObject_ObjectOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k]"]
            set i1 0
            set count_i1 [CkJsonObject_SizeOfArray $json1 "ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Dimensions"]
            while {$i1 < $count_i1} {
                CkJsonObject_put_I $json1 $i1
                set strVal [CkJsonObject_stringOf $json1 "ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Dimensions[i]"]
                set i1 [expr $i1 + 1]
            }
            delete_CkJsonObject $json1

            set k [expr $k + 1]
        }
        set k 0
        set count_k [CkJsonObject_SizeOfArray $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly"]
        while {$k < $count_k} {
            CkJsonObject_put_K $jResp $k
            set v_Type [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly[k].Type"]
            set Value_int [CkJsonObject_IntOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly[k].Value"]
            set k [expr $k + 1]
        }
        set k 0
        set count_k [CkJsonObject_SizeOfArray $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline"]
        while {$k < $count_k} {
            CkJsonObject_put_K $jResp $k
            set v_Type [CkJsonObject_stringOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline[k].Type"]
            set Value_int [CkJsonObject_IntOf $jResp "ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline[k].Value"]
            set k [expr $k + 1]
        }
        set j [expr $j + 1]
    }
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "ReactiveAnomalies"]
while {$i < $count_i} {
    CkJsonObject_put_I $jResp $i
    set AnomalyReportedTimeRangeCloseTime [CkJsonObject_IntOf $jResp "ReactiveAnomalies[i].AnomalyReportedTimeRange.CloseTime"]
    set AnomalyReportedTimeRangeOpenTime [CkJsonObject_IntOf $jResp "ReactiveAnomalies[i].AnomalyReportedTimeRange.OpenTime"]
    set AnomalyTimeRangeEndTime [CkJsonObject_IntOf $jResp "ReactiveAnomalies[i].AnomalyTimeRange.EndTime"]
    set AnomalyTimeRangeStartTime [CkJsonObject_IntOf $jResp "ReactiveAnomalies[i].AnomalyTimeRange.StartTime"]
    set AssociatedInsightId [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].AssociatedInsightId"]
    set CausalAnomalyId [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].CausalAnomalyId"]
    set Description [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].Description"]
    set Id [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].Id"]
    set Name [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].Name"]
    set Severity [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].Severity"]
    set Status [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].Status"]
    set v_Type [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].Type"]
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jResp "ReactiveAnomalies[i].AnomalyResources"]
    while {$j < $count_j} {
        CkJsonObject_put_J $jResp $j
        set Name [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].AnomalyResources[j].Name"]
        set v_Type [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].AnomalyResources[j].Type"]
        set j [expr $j + 1]
    }
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jResp "ReactiveAnomalies[i].ResourceCollection.CloudFormation.StackNames"]
    while {$j < $count_j} {
        CkJsonObject_put_J $jResp $j
        set strVal [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].ResourceCollection.CloudFormation.StackNames[j]"]
        set j [expr $j + 1]
    }
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jResp "ReactiveAnomalies[i].ResourceCollection.Tags"]
    while {$j < $count_j} {
        CkJsonObject_put_J $jResp $j
        set AppBoundaryKey [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].ResourceCollection.Tags[j].AppBoundaryKey"]
        set k 0
        set count_k [CkJsonObject_SizeOfArray $jResp "ReactiveAnomalies[i].ResourceCollection.Tags[j].TagValues"]
        while {$k < $count_k} {
            CkJsonObject_put_K $jResp $k
            set strVal [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].ResourceCollection.Tags[j].TagValues[k]"]
            set k [expr $k + 1]
        }
        set j [expr $j + 1]
    }
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jResp "ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics"]
    while {$j < $count_j} {
        CkJsonObject_put_J $jResp $j
        set MetricDataSummaryStatusCode [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.StatusCode"]
        set MetricName [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricName"]
        set Namespace [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Namespace"]
        set Period [CkJsonObject_IntOf $jResp "ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Period"]
        set Stat [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Stat"]
        set Unit [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Unit"]
        set k 0
        set count_k [CkJsonObject_SizeOfArray $jResp "ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions"]
        while {$k < $count_k} {
            CkJsonObject_put_K $jResp $k
            set Name [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions[k].Name"]
            set Value [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions[k].Value"]
            set k [expr $k + 1]
        }
        set k 0
        set count_k [CkJsonObject_SizeOfArray $jResp "ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList"]
        while {$k < $count_k} {
            CkJsonObject_put_K $jResp $k
            set MetricValue [CkJsonObject_IntOf $jResp "ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList[k].MetricValue"]
            set Timestamp [CkJsonObject_IntOf $jResp "ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList[k].Timestamp"]
            set k [expr $k + 1]
        }
        set j [expr $j + 1]
    }
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics"]
    while {$j < $count_j} {
        CkJsonObject_put_J $jResp $j
        set MetricDisplayName [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricDisplayName"]
        set FilterString [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.Filter.string"]
        set GroupByGroup [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Group"]
        set GroupByLimit [CkJsonObject_IntOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Limit"]
        set MetricQueryMetric [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.Metric"]
        set Unit [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].Unit"]
        set k 0
        set count_k [CkJsonObject_SizeOfArray $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Dimensions"]
        while {$k < $count_k} {
            CkJsonObject_put_K $jResp $k
            set strVal [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Dimensions[k]"]
            set k [expr $k + 1]
        }
        set k 0
        set count_k [CkJsonObject_SizeOfArray $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData"]
        while {$k < $count_k} {
            CkJsonObject_put_K $jResp $k
            set FilterString [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.Filter.string"]
            set GroupByGroup [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Group"]
            set GroupByLimit [CkJsonObject_IntOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Limit"]
            set MetricQueryMetric [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.Metric"]
            set ReferenceScalarValue [CkJsonObject_IntOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceScalar.Value"]
            set Name [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].Name"]

            set json1 [CkJsonObject_ObjectOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k]"]
            set i1 0
            set count_i1 [CkJsonObject_SizeOfArray $json1 "ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Dimensions"]
            while {$i1 < $count_i1} {
                CkJsonObject_put_I $json1 $i1
                set strVal [CkJsonObject_stringOf $json1 "ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Dimensions[i]"]
                set i1 [expr $i1 + 1]
            }
            delete_CkJsonObject $json1

            set k [expr $k + 1]
        }
        set k 0
        set count_k [CkJsonObject_SizeOfArray $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly"]
        while {$k < $count_k} {
            CkJsonObject_put_K $jResp $k
            set v_Type [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly[k].Type"]
            set Value_int [CkJsonObject_IntOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly[k].Value"]
            set k [expr $k + 1]
        }
        set k 0
        set count_k [CkJsonObject_SizeOfArray $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline"]
        while {$k < $count_k} {
            CkJsonObject_put_K $jResp $k
            set v_Type [CkJsonObject_stringOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline[k].Type"]
            set Value_int [CkJsonObject_IntOf $jResp "ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline[k].Value"]
            set k [expr $k + 1]
        }
        set j [expr $j + 1]
    }
    set i [expr $i + 1]
}

# A sample JSON response body parsed by the above code:

# {
#   "NextToken": "string",
#   "ProactiveAnomalies": [
#     {
#       "AnomalyReportedTimeRange": {
#         "CloseTime": number,
#         "OpenTime": number
#       },
#       "AnomalyResources": [
#         {
#           "Name": "string",
#           "Type": "string"
#         }
#       ],
#       "AnomalyTimeRange": {
#         "EndTime": number,
#         "StartTime": number
#       },
#       "AssociatedInsightId": "string",
#       "Id": "string",
#       "Limit": number,
#       "PredictionTimeRange": {
#         "EndTime": number,
#         "StartTime": number
#       },
#       "ResourceCollection": {
#         "CloudFormation": {
#           "StackNames": [
#             "string"
#           ]
#         },
#         "Tags": [
#           {
#             "AppBoundaryKey": "string",
#             "TagValues": [
#               "string"
#             ]
#           }
#         ]
#       },
#       "Severity": "string",
#       "SourceDetails": {
#         "CloudWatchMetrics": [
#           {
#             "Dimensions": [
#               {
#                 "Name": "string",
#                 "Value": "string"
#               }
#             ],
#             "MetricDataSummary": {
#               "StatusCode": "string",
#               "TimestampMetricValuePairList": [
#                 {
#                   "MetricValue": number,
#                   "Timestamp": number
#                 }
#               ]
#             },
#             "MetricName": "string",
#             "Namespace": "string",
#             "Period": number,
#             "Stat": "string",
#             "Unit": "string"
#           }
#         ],
#         "PerformanceInsightsMetrics": [
#           {
#             "MetricDisplayName": "string",
#             "MetricQuery": {
#               "Filter": {
#                 "string": "string"
#               },
#               "GroupBy": {
#                 "Dimensions": [
#                   "string"
#                 ],
#                 "Group": "string",
#                 "Limit": number
#               },
#               "Metric": "string"
#             },
#             "ReferenceData": [
#               {
#                 "ComparisonValues": {
#                   "ReferenceMetric": {
#                     "MetricQuery": {
#                       "Filter": {
#                         "string": "string"
#                       },
#                       "GroupBy": {
#                         "Dimensions": [
#                           "string"
#                         ],
#                         "Group": "string",
#                         "Limit": number
#                       },
#                       "Metric": "string"
#                     }
#                   },
#                   "ReferenceScalar": {
#                     "Value": number
#                   }
#                 },
#                 "Name": "string"
#               }
#             ],
#             "StatsAtAnomaly": [
#               {
#                 "Type": "string",
#                 "Value": number
#               }
#             ],
#             "StatsAtBaseline": [
#               {
#                 "Type": "string",
#                 "Value": number
#               }
#             ],
#             "Unit": "string"
#           }
#         ]
#       },
#       "SourceMetadata": {
#         "Source": "string",
#         "SourceResourceName": "string",
#         "SourceResourceType": "string"
#       },
#       "Status": "string",
#       "UpdateTime": number
#     }
#   ],
#   "ReactiveAnomalies": [
#     {
#       "AnomalyReportedTimeRange": {
#         "CloseTime": number,
#         "OpenTime": number
#       },
#       "AnomalyResources": [
#         {
#           "Name": "string",
#           "Type": "string"
#         }
#       ],
#       "AnomalyTimeRange": {
#         "EndTime": number,
#         "StartTime": number
#       },
#       "AssociatedInsightId": "string",
#       "CausalAnomalyId": "string",
#       "Description": "string",
#       "Id": "string",
#       "Name": "string",
#       "ResourceCollection": {
#         "CloudFormation": {
#           "StackNames": [
#             "string"
#           ]
#         },
#         "Tags": [
#           {
#             "AppBoundaryKey": "string",
#             "TagValues": [
#               "string"
#             ]
#           }
#         ]
#       },
#       "Severity": "string",
#       "SourceDetails": {
#         "CloudWatchMetrics": [
#           {
#             "Dimensions": [
#               {
#                 "Name": "string",
#                 "Value": "string"
#               }
#             ],
#             "MetricDataSummary": {
#               "StatusCode": "string",
#               "TimestampMetricValuePairList": [
#                 {
#                   "MetricValue": number,
#                   "Timestamp": number
#                 }
#               ]
#             },
#             "MetricName": "string",
#             "Namespace": "string",
#             "Period": number,
#             "Stat": "string",
#             "Unit": "string"
#           }
#         ],
#         "PerformanceInsightsMetrics": [
#           {
#             "MetricDisplayName": "string",
#             "MetricQuery": {
#               "Filter": {
#                 "string": "string"
#               },
#               "GroupBy": {
#                 "Dimensions": [
#                   "string"
#                 ],
#                 "Group": "string",
#                 "Limit": number
#               },
#               "Metric": "string"
#             },
#             "ReferenceData": [
#               {
#                 "ComparisonValues": {
#                   "ReferenceMetric": {
#                     "MetricQuery": {
#                       "Filter": {
#                         "string": "string"
#                       },
#                       "GroupBy": {
#                         "Dimensions": [
#                           "string"
#                         ],
#                         "Group": "string",
#                         "Limit": number
#                       },
#                       "Metric": "string"
#                     }
#                   },
#                   "ReferenceScalar": {
#                     "Value": number
#                   }
#                 },
#                 "Name": "string"
#               }
#             ],
#             "StatsAtAnomaly": [
#               {
#                 "Type": "string",
#                 "Value": number
#               }
#             ],
#             "StatsAtBaseline": [
#               {
#                 "Type": "string",
#                 "Value": number
#               }
#             ],
#             "Unit": "string"
#           }
#         ]
#       },
#       "Status": "string",
#       "Type": "string"
#     }
#   ]
# }

delete_CkRest $rest
delete_CkAuthAws $authAws
delete_CkJsonObject $json
delete_CkStringBuilder $sbRequestBody
delete_CkStringBuilder $sbResponseBody
delete_CkJsonObject $jResp