Chilkat Online Tools

ListAnomaliesForInsight autoit Example

Amazon DevOps Guru

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

$oRest = ObjCreate("Chilkat_9_5_0.Rest")
Local $bSuccess

$oAuthAws = ObjCreate("Chilkat_9_5_0.AuthAws")
$oAuthAws.AccessKey = "AWS_ACCESS_KEY"
$oAuthAws.SecretKey = "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.)
$oAuthAws.Region = "us-west-2"
$oAuthAws.ServiceName = "devops-guru"
; SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
$oRest.SetAuthAws($oAuthAws)

; URL: https://devops-guru.us-west-2.amazonaws.com/
; Use the same region as specified above.
$bSuccess = $oRest.Connect("devops-guru.us-west-2.amazonaws.com",443,True,True)
If ($bSuccess <> True) Then
    ConsoleWrite("ConnectFailReason: " & $oRest.ConnectFailReason & @CRLF)
    ConsoleWrite($oRest.LastErrorText & @CRLF)
    Exit
EndIf

; 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

$oJson = ObjCreate("Chilkat_9_5_0.JsonObject")
$oJson.UpdateString("AccountId","string")
$oJson.UpdateInt("MaxResults",123)
$oJson.UpdateString("NextToken","string")
$oJson.UpdateInt("StartTimeRange.FromTime",123)
$oJson.UpdateInt("StartTimeRange.ToTime",123)

; The JSON request body created by the above code:

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

$oRest.AddHeader("Content-Type","application/x-amz-json-1.1")
$oRest.AddHeader("X-Amz-Target","ListAnomaliesForInsight")

$oSbRequestBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$oJson.EmitSb($oSbRequestBody)
$oSbResponseBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$bSuccess = $oRest.FullRequestSb("POST","/anomalies/insight/{InsightId}",$oSbRequestBody,$oSbResponseBody)
If ($bSuccess <> True) Then
    ConsoleWrite($oRest.LastErrorText & @CRLF)
    Exit
EndIf

Local $iRespStatusCode = $oRest.ResponseStatusCode
ConsoleWrite("response status code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode <> 200) Then
    ConsoleWrite("Response Header:" & @CRLF)
    ConsoleWrite($oRest.ResponseHeader & @CRLF)
    ConsoleWrite("Response Body:" & @CRLF)
    ConsoleWrite($oSbResponseBody.GetAsString() & @CRLF)
    Exit
EndIf

$oJResp = ObjCreate("Chilkat_9_5_0.JsonObject")
$oJResp.LoadSb($oSbResponseBody)

; 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

Local $iCloseTime
Local $iOpenTime
Local $iEndTime
Local $iStartTime
Local $sAssociatedInsightId
Local $sId
Local $iLimit
Local $iPredictionTimeRangeEndTime
Local $iPredictionTimeRangeStartTime
Local $sSeverity
Local $sSource
Local $sSourceResourceName
Local $sSourceResourceType
Local $sStatus
Local $iUpdateTime
Local $iJ
Local $iCount_j
Local $sName
Local $sV_Type
Local $strVal
Local $sAppBoundaryKey
Local $iK
Local $iCount_k
Local $sStatusCode
Local $sMetricName
Local $sNamespace
Local $iPeriod
Local $sStat
Local $sUnit
Local $sValue
Local $iMetricValue
Local $iTimestamp
Local $sMetricDisplayName
Local $sV_String
Local $sGroup
Local $iGroupByLimit
Local $sMetric
Local $sFilterString
Local $sGroupByGroup
Local $sMetricQueryMetric
Local $iReferenceScalarValue
Local $oJson1
Local $i1
Local $iCount_i1
Local $iValue_int
Local $iAnomalyReportedTimeRangeCloseTime
Local $iAnomalyReportedTimeRangeOpenTime
Local $iAnomalyTimeRangeEndTime
Local $iAnomalyTimeRangeStartTime
Local $sCausalAnomalyId
Local $sDescription
Local $sMetricDataSummaryStatusCode

Local $sNextToken = $oJResp.StringOf("NextToken")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("ProactiveAnomalies")
While $i < $iCount_i
    $oJResp.I = $i
    $iCloseTime = $oJResp.IntOf("ProactiveAnomalies[i].AnomalyReportedTimeRange.CloseTime")
    $iOpenTime = $oJResp.IntOf("ProactiveAnomalies[i].AnomalyReportedTimeRange.OpenTime")
    $iEndTime = $oJResp.IntOf("ProactiveAnomalies[i].AnomalyTimeRange.EndTime")
    $iStartTime = $oJResp.IntOf("ProactiveAnomalies[i].AnomalyTimeRange.StartTime")
    $sAssociatedInsightId = $oJResp.StringOf("ProactiveAnomalies[i].AssociatedInsightId")
    $sId = $oJResp.StringOf("ProactiveAnomalies[i].Id")
    $iLimit = $oJResp.IntOf("ProactiveAnomalies[i].Limit")
    $iPredictionTimeRangeEndTime = $oJResp.IntOf("ProactiveAnomalies[i].PredictionTimeRange.EndTime")
    $iPredictionTimeRangeStartTime = $oJResp.IntOf("ProactiveAnomalies[i].PredictionTimeRange.StartTime")
    $sSeverity = $oJResp.StringOf("ProactiveAnomalies[i].Severity")
    $sSource = $oJResp.StringOf("ProactiveAnomalies[i].SourceMetadata.Source")
    $sSourceResourceName = $oJResp.StringOf("ProactiveAnomalies[i].SourceMetadata.SourceResourceName")
    $sSourceResourceType = $oJResp.StringOf("ProactiveAnomalies[i].SourceMetadata.SourceResourceType")
    $sStatus = $oJResp.StringOf("ProactiveAnomalies[i].Status")
    $iUpdateTime = $oJResp.IntOf("ProactiveAnomalies[i].UpdateTime")
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("ProactiveAnomalies[i].AnomalyResources")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sName = $oJResp.StringOf("ProactiveAnomalies[i].AnomalyResources[j].Name")
        $sV_Type = $oJResp.StringOf("ProactiveAnomalies[i].AnomalyResources[j].Type")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("ProactiveAnomalies[i].ResourceCollection.CloudFormation.StackNames")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("ProactiveAnomalies[i].ResourceCollection.CloudFormation.StackNames[j]")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("ProactiveAnomalies[i].ResourceCollection.Tags")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sAppBoundaryKey = $oJResp.StringOf("ProactiveAnomalies[i].ResourceCollection.Tags[j].AppBoundaryKey")
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("ProactiveAnomalies[i].ResourceCollection.Tags[j].TagValues")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $strVal = $oJResp.StringOf("ProactiveAnomalies[i].ResourceCollection.Tags[j].TagValues[k]")
            $iK = $iK + 1
        Wend
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sStatusCode = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.StatusCode")
        $sMetricName = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricName")
        $sNamespace = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Namespace")
        $iPeriod = $oJResp.IntOf("ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Period")
        $sStat = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Stat")
        $sUnit = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Unit")
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $sName = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions[k].Name")
            $sValue = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions[k].Value")
            $iK = $iK + 1
        Wend
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $iMetricValue = $oJResp.IntOf("ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList[k].MetricValue")
            $iTimestamp = $oJResp.IntOf("ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList[k].Timestamp")
            $iK = $iK + 1
        Wend
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sMetricDisplayName = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricDisplayName")
        $sV_String = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.Filter.string")
        $sGroup = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Group")
        $iGroupByLimit = $oJResp.IntOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Limit")
        $sMetric = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.Metric")
        $sUnit = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].Unit")
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Dimensions")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $strVal = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Dimensions[k]")
            $iK = $iK + 1
        Wend
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $sFilterString = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.Filter.string")
            $sGroupByGroup = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Group")
            $iGroupByLimit = $oJResp.IntOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Limit")
            $sMetricQueryMetric = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.Metric")
            $iReferenceScalarValue = $oJResp.IntOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceScalar.Value")
            $sName = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].Name")

            $oJson1 = $oJResp.ObjectOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k]")
            $i1 = 0
            $iCount_i1 = $oJson1.SizeOfArray("ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Dimensions")
            While $i1 < $iCount_i1
                $oJson1.I = $i1
                $strVal = $oJson1.StringOf("ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Dimensions[i]")
                $i1 = $i1 + 1
            Wend

            $iK = $iK + 1
        Wend
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $sV_Type = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly[k].Type")
            $iValue_int = $oJResp.IntOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly[k].Value")
            $iK = $iK + 1
        Wend
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $sV_Type = $oJResp.StringOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline[k].Type")
            $iValue_int = $oJResp.IntOf("ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline[k].Value")
            $iK = $iK + 1
        Wend
        $iJ = $iJ + 1
    Wend
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("ReactiveAnomalies")
While $i < $iCount_i
    $oJResp.I = $i
    $iAnomalyReportedTimeRangeCloseTime = $oJResp.IntOf("ReactiveAnomalies[i].AnomalyReportedTimeRange.CloseTime")
    $iAnomalyReportedTimeRangeOpenTime = $oJResp.IntOf("ReactiveAnomalies[i].AnomalyReportedTimeRange.OpenTime")
    $iAnomalyTimeRangeEndTime = $oJResp.IntOf("ReactiveAnomalies[i].AnomalyTimeRange.EndTime")
    $iAnomalyTimeRangeStartTime = $oJResp.IntOf("ReactiveAnomalies[i].AnomalyTimeRange.StartTime")
    $sAssociatedInsightId = $oJResp.StringOf("ReactiveAnomalies[i].AssociatedInsightId")
    $sCausalAnomalyId = $oJResp.StringOf("ReactiveAnomalies[i].CausalAnomalyId")
    $sDescription = $oJResp.StringOf("ReactiveAnomalies[i].Description")
    $sId = $oJResp.StringOf("ReactiveAnomalies[i].Id")
    $sName = $oJResp.StringOf("ReactiveAnomalies[i].Name")
    $sSeverity = $oJResp.StringOf("ReactiveAnomalies[i].Severity")
    $sStatus = $oJResp.StringOf("ReactiveAnomalies[i].Status")
    $sV_Type = $oJResp.StringOf("ReactiveAnomalies[i].Type")
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("ReactiveAnomalies[i].AnomalyResources")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sName = $oJResp.StringOf("ReactiveAnomalies[i].AnomalyResources[j].Name")
        $sV_Type = $oJResp.StringOf("ReactiveAnomalies[i].AnomalyResources[j].Type")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("ReactiveAnomalies[i].ResourceCollection.CloudFormation.StackNames")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("ReactiveAnomalies[i].ResourceCollection.CloudFormation.StackNames[j]")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("ReactiveAnomalies[i].ResourceCollection.Tags")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sAppBoundaryKey = $oJResp.StringOf("ReactiveAnomalies[i].ResourceCollection.Tags[j].AppBoundaryKey")
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("ReactiveAnomalies[i].ResourceCollection.Tags[j].TagValues")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $strVal = $oJResp.StringOf("ReactiveAnomalies[i].ResourceCollection.Tags[j].TagValues[k]")
            $iK = $iK + 1
        Wend
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sMetricDataSummaryStatusCode = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.StatusCode")
        $sMetricName = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricName")
        $sNamespace = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Namespace")
        $iPeriod = $oJResp.IntOf("ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Period")
        $sStat = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Stat")
        $sUnit = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Unit")
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $sName = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions[k].Name")
            $sValue = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions[k].Value")
            $iK = $iK + 1
        Wend
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $iMetricValue = $oJResp.IntOf("ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList[k].MetricValue")
            $iTimestamp = $oJResp.IntOf("ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList[k].Timestamp")
            $iK = $iK + 1
        Wend
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sMetricDisplayName = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricDisplayName")
        $sFilterString = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.Filter.string")
        $sGroupByGroup = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Group")
        $iGroupByLimit = $oJResp.IntOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Limit")
        $sMetricQueryMetric = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.Metric")
        $sUnit = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].Unit")
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Dimensions")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $strVal = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Dimensions[k]")
            $iK = $iK + 1
        Wend
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $sFilterString = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.Filter.string")
            $sGroupByGroup = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Group")
            $iGroupByLimit = $oJResp.IntOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Limit")
            $sMetricQueryMetric = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.Metric")
            $iReferenceScalarValue = $oJResp.IntOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceScalar.Value")
            $sName = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].Name")

            $oJson1 = $oJResp.ObjectOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k]")
            $i1 = 0
            $iCount_i1 = $oJson1.SizeOfArray("ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Dimensions")
            While $i1 < $iCount_i1
                $oJson1.I = $i1
                $strVal = $oJson1.StringOf("ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Dimensions[i]")
                $i1 = $i1 + 1
            Wend

            $iK = $iK + 1
        Wend
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $sV_Type = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly[k].Type")
            $iValue_int = $oJResp.IntOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly[k].Value")
            $iK = $iK + 1
        Wend
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $sV_Type = $oJResp.StringOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline[k].Type")
            $iValue_int = $oJResp.IntOf("ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline[k].Value")
            $iK = $iK + 1
        Wend
        $iJ = $iJ + 1
    Wend
    $i = $i + 1
Wend

; 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"
;     }
;   ]
; }