Chilkat Online Tools

ListAnomaliesForInsight delphiDll Example

Amazon DevOps Guru

var
rest: HCkRest;
success: Boolean;
authAws: HCkAuthAws;
json: HCkJsonObject;
sbRequestBody: HCkStringBuilder;
sbResponseBody: HCkStringBuilder;
respStatusCode: Integer;
jResp: HCkJsonObject;
CloseTime: Integer;
OpenTime: Integer;
EndTime: Integer;
StartTime: Integer;
AssociatedInsightId: PWideChar;
Id: PWideChar;
Limit: Integer;
PredictionTimeRangeEndTime: Integer;
PredictionTimeRangeStartTime: Integer;
Severity: PWideChar;
Source: PWideChar;
SourceResourceName: PWideChar;
SourceResourceType: PWideChar;
Status: PWideChar;
UpdateTime: Integer;
j: Integer;
count_j: Integer;
Name: PWideChar;
v_Type: PWideChar;
strVal: PWideChar;
AppBoundaryKey: PWideChar;
k: Integer;
count_k: Integer;
StatusCode: PWideChar;
MetricName: PWideChar;
Namespace: PWideChar;
Period: Integer;
Stat: PWideChar;
Unit: PWideChar;
Value: PWideChar;
MetricValue: Integer;
Timestamp: Integer;
MetricDisplayName: PWideChar;
v_String: PWideChar;
Group: PWideChar;
GroupByLimit: Integer;
Metric: PWideChar;
FilterString: PWideChar;
GroupByGroup: PWideChar;
MetricQueryMetric: PWideChar;
ReferenceScalarValue: Integer;
json1: HCkJsonObject;
i1: Integer;
count_i1: Integer;
Value_int: Integer;
AnomalyReportedTimeRangeCloseTime: Integer;
AnomalyReportedTimeRangeOpenTime: Integer;
AnomalyTimeRangeEndTime: Integer;
AnomalyTimeRangeStartTime: Integer;
CausalAnomalyId: PWideChar;
Description: PWideChar;
MetricDataSummaryStatusCode: PWideChar;
NextToken: PWideChar;
i: Integer;
count_i: Integer;

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

rest := CkRest_Create();

authAws := CkAuthAws_Create();
CkAuthAws_putAccessKey(authAws,'AWS_ACCESS_KEY');
CkAuthAws_putSecretKey(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_putRegion(authAws,'us-west-2');
CkAuthAws_putServiceName(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.
success := CkRest_Connect(rest,'devops-guru.us-west-2.amazonaws.com',443,True,True);
if (success <> True) then
  begin
    Memo1.Lines.Add('ConnectFailReason: ' + IntToStr(CkRest_getConnectFailReason(rest)));
    Memo1.Lines.Add(CkRest__lastErrorText(rest));
    Exit;
  end;

// 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

json := CkJsonObject_Create();
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');

sbRequestBody := CkStringBuilder_Create();
CkJsonObject_EmitSb(json,sbRequestBody);
sbResponseBody := CkStringBuilder_Create();
success := CkRest_FullRequestSb(rest,'POST','/anomalies/insight/{InsightId}',sbRequestBody,sbResponseBody);
if (success <> True) then
  begin
    Memo1.Lines.Add(CkRest__lastErrorText(rest));
    Exit;
  end;
respStatusCode := CkRest_getResponseStatusCode(rest);
Memo1.Lines.Add('response status code = ' + IntToStr(respStatusCode));
if (respStatusCode <> 200) then
  begin
    Memo1.Lines.Add('Response Header:');
    Memo1.Lines.Add(CkRest__responseHeader(rest));
    Memo1.Lines.Add('Response Body:');
    Memo1.Lines.Add(CkStringBuilder__getAsString(sbResponseBody));
    Exit;
  end;

jResp := CkJsonObject_Create();
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

NextToken := CkJsonObject__stringOf(jResp,'NextToken');
i := 0;
count_i := CkJsonObject_SizeOfArray(jResp,'ProactiveAnomalies');
while i < count_i do
  begin
    CkJsonObject_putI(jResp,i);
    CloseTime := CkJsonObject_IntOf(jResp,'ProactiveAnomalies[i].AnomalyReportedTimeRange.CloseTime');
    OpenTime := CkJsonObject_IntOf(jResp,'ProactiveAnomalies[i].AnomalyReportedTimeRange.OpenTime');
    EndTime := CkJsonObject_IntOf(jResp,'ProactiveAnomalies[i].AnomalyTimeRange.EndTime');
    StartTime := CkJsonObject_IntOf(jResp,'ProactiveAnomalies[i].AnomalyTimeRange.StartTime');
    AssociatedInsightId := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].AssociatedInsightId');
    Id := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].Id');
    Limit := CkJsonObject_IntOf(jResp,'ProactiveAnomalies[i].Limit');
    PredictionTimeRangeEndTime := CkJsonObject_IntOf(jResp,'ProactiveAnomalies[i].PredictionTimeRange.EndTime');
    PredictionTimeRangeStartTime := CkJsonObject_IntOf(jResp,'ProactiveAnomalies[i].PredictionTimeRange.StartTime');
    Severity := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].Severity');
    Source := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceMetadata.Source');
    SourceResourceName := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceMetadata.SourceResourceName');
    SourceResourceType := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceMetadata.SourceResourceType');
    Status := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].Status');
    UpdateTime := CkJsonObject_IntOf(jResp,'ProactiveAnomalies[i].UpdateTime');
    j := 0;
    count_j := CkJsonObject_SizeOfArray(jResp,'ProactiveAnomalies[i].AnomalyResources');
    while j < count_j do
      begin
        CkJsonObject_putJ(jResp,j);
        Name := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].AnomalyResources[j].Name');
        v_Type := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].AnomalyResources[j].Type');
        j := j + 1;
      end;

    j := 0;
    count_j := CkJsonObject_SizeOfArray(jResp,'ProactiveAnomalies[i].ResourceCollection.CloudFormation.StackNames');
    while j < count_j do
      begin
        CkJsonObject_putJ(jResp,j);
        strVal := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].ResourceCollection.CloudFormation.StackNames[j]');
        j := j + 1;
      end;

    j := 0;
    count_j := CkJsonObject_SizeOfArray(jResp,'ProactiveAnomalies[i].ResourceCollection.Tags');
    while j < count_j do
      begin
        CkJsonObject_putJ(jResp,j);
        AppBoundaryKey := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].ResourceCollection.Tags[j].AppBoundaryKey');
        k := 0;
        count_k := CkJsonObject_SizeOfArray(jResp,'ProactiveAnomalies[i].ResourceCollection.Tags[j].TagValues');
        while k < count_k do
          begin
            CkJsonObject_putK(jResp,k);
            strVal := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].ResourceCollection.Tags[j].TagValues[k]');
            k := k + 1;
          end;

        j := j + 1;
      end;

    j := 0;
    count_j := CkJsonObject_SizeOfArray(jResp,'ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics');
    while j < count_j do
      begin
        CkJsonObject_putJ(jResp,j);
        StatusCode := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.StatusCode');
        MetricName := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricName');
        Namespace := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Namespace');
        Period := CkJsonObject_IntOf(jResp,'ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Period');
        Stat := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Stat');
        Unit := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Unit');
        k := 0;
        count_k := CkJsonObject_SizeOfArray(jResp,'ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions');
        while k < count_k do
          begin
            CkJsonObject_putK(jResp,k);
            Name := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions[k].Name');
            Value := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions[k].Value');
            k := k + 1;
          end;

        k := 0;
        count_k := CkJsonObject_SizeOfArray(jResp,'ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList');
        while k < count_k do
          begin
            CkJsonObject_putK(jResp,k);
            MetricValue := CkJsonObject_IntOf(jResp,'ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList[k].MetricValue');
            Timestamp := CkJsonObject_IntOf(jResp,'ProactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList[k].Timestamp');
            k := k + 1;
          end;

        j := j + 1;
      end;

    j := 0;
    count_j := CkJsonObject_SizeOfArray(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics');
    while j < count_j do
      begin
        CkJsonObject_putJ(jResp,j);
        MetricDisplayName := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricDisplayName');
        v_String := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.Filter.string');
        Group := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Group');
        GroupByLimit := CkJsonObject_IntOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Limit');
        Metric := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.Metric');
        Unit := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].Unit');
        k := 0;
        count_k := CkJsonObject_SizeOfArray(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Dimensions');
        while k < count_k do
          begin
            CkJsonObject_putK(jResp,k);
            strVal := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Dimensions[k]');
            k := k + 1;
          end;

        k := 0;
        count_k := CkJsonObject_SizeOfArray(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData');
        while k < count_k do
          begin
            CkJsonObject_putK(jResp,k);
            FilterString := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.Filter.string');
            GroupByGroup := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Group');
            GroupByLimit := CkJsonObject_IntOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Limit');
            MetricQueryMetric := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.Metric');
            ReferenceScalarValue := CkJsonObject_IntOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceScalar.Value');
            Name := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].Name');

            json1 := CkJsonObject_ObjectOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k]');
            i1 := 0;
            count_i1 := CkJsonObject_SizeOfArray(json1,'ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Dimensions');
            while i1 < count_i1 do
              begin
                CkJsonObject_putI(json1,i1);
                strVal := CkJsonObject__stringOf(json1,'ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Dimensions[i]');
                i1 := i1 + 1;
              end;

            CkJsonObject_Dispose(json1);
            k := k + 1;
          end;

        k := 0;
        count_k := CkJsonObject_SizeOfArray(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly');
        while k < count_k do
          begin
            CkJsonObject_putK(jResp,k);
            v_Type := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly[k].Type');
            Value_int := CkJsonObject_IntOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly[k].Value');
            k := k + 1;
          end;

        k := 0;
        count_k := CkJsonObject_SizeOfArray(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline');
        while k < count_k do
          begin
            CkJsonObject_putK(jResp,k);
            v_Type := CkJsonObject__stringOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline[k].Type');
            Value_int := CkJsonObject_IntOf(jResp,'ProactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline[k].Value');
            k := k + 1;
          end;

        j := j + 1;
      end;

    i := i + 1;
  end;

i := 0;
count_i := CkJsonObject_SizeOfArray(jResp,'ReactiveAnomalies');
while i < count_i do
  begin
    CkJsonObject_putI(jResp,i);
    AnomalyReportedTimeRangeCloseTime := CkJsonObject_IntOf(jResp,'ReactiveAnomalies[i].AnomalyReportedTimeRange.CloseTime');
    AnomalyReportedTimeRangeOpenTime := CkJsonObject_IntOf(jResp,'ReactiveAnomalies[i].AnomalyReportedTimeRange.OpenTime');
    AnomalyTimeRangeEndTime := CkJsonObject_IntOf(jResp,'ReactiveAnomalies[i].AnomalyTimeRange.EndTime');
    AnomalyTimeRangeStartTime := CkJsonObject_IntOf(jResp,'ReactiveAnomalies[i].AnomalyTimeRange.StartTime');
    AssociatedInsightId := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].AssociatedInsightId');
    CausalAnomalyId := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].CausalAnomalyId');
    Description := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].Description');
    Id := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].Id');
    Name := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].Name');
    Severity := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].Severity');
    Status := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].Status');
    v_Type := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].Type');
    j := 0;
    count_j := CkJsonObject_SizeOfArray(jResp,'ReactiveAnomalies[i].AnomalyResources');
    while j < count_j do
      begin
        CkJsonObject_putJ(jResp,j);
        Name := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].AnomalyResources[j].Name');
        v_Type := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].AnomalyResources[j].Type');
        j := j + 1;
      end;

    j := 0;
    count_j := CkJsonObject_SizeOfArray(jResp,'ReactiveAnomalies[i].ResourceCollection.CloudFormation.StackNames');
    while j < count_j do
      begin
        CkJsonObject_putJ(jResp,j);
        strVal := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].ResourceCollection.CloudFormation.StackNames[j]');
        j := j + 1;
      end;

    j := 0;
    count_j := CkJsonObject_SizeOfArray(jResp,'ReactiveAnomalies[i].ResourceCollection.Tags');
    while j < count_j do
      begin
        CkJsonObject_putJ(jResp,j);
        AppBoundaryKey := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].ResourceCollection.Tags[j].AppBoundaryKey');
        k := 0;
        count_k := CkJsonObject_SizeOfArray(jResp,'ReactiveAnomalies[i].ResourceCollection.Tags[j].TagValues');
        while k < count_k do
          begin
            CkJsonObject_putK(jResp,k);
            strVal := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].ResourceCollection.Tags[j].TagValues[k]');
            k := k + 1;
          end;

        j := j + 1;
      end;

    j := 0;
    count_j := CkJsonObject_SizeOfArray(jResp,'ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics');
    while j < count_j do
      begin
        CkJsonObject_putJ(jResp,j);
        MetricDataSummaryStatusCode := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.StatusCode');
        MetricName := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricName');
        Namespace := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Namespace');
        Period := CkJsonObject_IntOf(jResp,'ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Period');
        Stat := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Stat');
        Unit := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Unit');
        k := 0;
        count_k := CkJsonObject_SizeOfArray(jResp,'ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions');
        while k < count_k do
          begin
            CkJsonObject_putK(jResp,k);
            Name := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions[k].Name');
            Value := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].Dimensions[k].Value');
            k := k + 1;
          end;

        k := 0;
        count_k := CkJsonObject_SizeOfArray(jResp,'ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList');
        while k < count_k do
          begin
            CkJsonObject_putK(jResp,k);
            MetricValue := CkJsonObject_IntOf(jResp,'ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList[k].MetricValue');
            Timestamp := CkJsonObject_IntOf(jResp,'ReactiveAnomalies[i].SourceDetails.CloudWatchMetrics[j].MetricDataSummary.TimestampMetricValuePairList[k].Timestamp');
            k := k + 1;
          end;

        j := j + 1;
      end;

    j := 0;
    count_j := CkJsonObject_SizeOfArray(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics');
    while j < count_j do
      begin
        CkJsonObject_putJ(jResp,j);
        MetricDisplayName := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricDisplayName');
        FilterString := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.Filter.string');
        GroupByGroup := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Group');
        GroupByLimit := CkJsonObject_IntOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Limit');
        MetricQueryMetric := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.Metric');
        Unit := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].Unit');
        k := 0;
        count_k := CkJsonObject_SizeOfArray(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Dimensions');
        while k < count_k do
          begin
            CkJsonObject_putK(jResp,k);
            strVal := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].MetricQuery.GroupBy.Dimensions[k]');
            k := k + 1;
          end;

        k := 0;
        count_k := CkJsonObject_SizeOfArray(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData');
        while k < count_k do
          begin
            CkJsonObject_putK(jResp,k);
            FilterString := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.Filter.string');
            GroupByGroup := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Group');
            GroupByLimit := CkJsonObject_IntOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Limit');
            MetricQueryMetric := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceMetric.MetricQuery.Metric');
            ReferenceScalarValue := CkJsonObject_IntOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].ComparisonValues.ReferenceScalar.Value');
            Name := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k].Name');

            json1 := CkJsonObject_ObjectOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].ReferenceData[k]');
            i1 := 0;
            count_i1 := CkJsonObject_SizeOfArray(json1,'ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Dimensions');
            while i1 < count_i1 do
              begin
                CkJsonObject_putI(json1,i1);
                strVal := CkJsonObject__stringOf(json1,'ComparisonValues.ReferenceMetric.MetricQuery.GroupBy.Dimensions[i]');
                i1 := i1 + 1;
              end;

            CkJsonObject_Dispose(json1);
            k := k + 1;
          end;

        k := 0;
        count_k := CkJsonObject_SizeOfArray(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly');
        while k < count_k do
          begin
            CkJsonObject_putK(jResp,k);
            v_Type := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly[k].Type');
            Value_int := CkJsonObject_IntOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtAnomaly[k].Value');
            k := k + 1;
          end;

        k := 0;
        count_k := CkJsonObject_SizeOfArray(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline');
        while k < count_k do
          begin
            CkJsonObject_putK(jResp,k);
            v_Type := CkJsonObject__stringOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline[k].Type');
            Value_int := CkJsonObject_IntOf(jResp,'ReactiveAnomalies[i].SourceDetails.PerformanceInsightsMetrics[j].StatsAtBaseline[k].Value');
            k := k + 1;
          end;

        j := j + 1;
      end;

    i := i + 1;
  end;

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

CkRest_Dispose(rest);
CkAuthAws_Dispose(authAws);
CkJsonObject_Dispose(json);
CkStringBuilder_Dispose(sbRequestBody);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);