GetFindings unicodeC Example
#include <C_CkRestW.h>
#include <C_CkAuthAwsW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkStringBuilderW.h>
void ChilkatSample(void)
{
HCkRestW rest;
BOOL success;
HCkAuthAwsW authAws;
HCkJsonObjectW json;
HCkStringBuilderW sbRequestBody;
HCkStringBuilderW sbResponseBody;
int respStatusCode;
HCkJsonObjectW jResp;
const wchar_t *accountId;
const wchar_t *arn;
int confidence;
const wchar_t *createdAt;
const wchar_t *description;
const wchar_t *id;
const wchar_t *partition;
const wchar_t *region;
const wchar_t *AccessKeyId;
const wchar_t *PrincipalId;
const wchar_t *UserName;
const wchar_t *UserType;
const wchar_t *Arn;
int CreatedAt;
const wchar_t *Name;
const wchar_t *Status;
const wchar_t *VpcId;
const wchar_t *AvailabilityZone;
const wchar_t *IamInstanceProfileArn;
const wchar_t *Id;
const wchar_t *ImageDescription;
const wchar_t *ImageId;
const wchar_t *InstanceId;
const wchar_t *InstanceState;
const wchar_t *InstanceType;
const wchar_t *LaunchTime;
const wchar_t *OutpostArn;
const wchar_t *Platform;
const wchar_t *Uid;
const wchar_t *Username;
int HostNetwork;
const wchar_t *KubernetesWorkloadDetailsName;
const wchar_t *Namespace;
const wchar_t *v_Type;
const wchar_t *KubernetesWorkloadDetailsUid;
const wchar_t *ResourceType;
const wchar_t *schemaVersion;
const wchar_t *ActionType;
const wchar_t *Api;
const wchar_t *CallerType;
const wchar_t *Domain;
const wchar_t *ErrorCode;
const wchar_t *AccountId;
int Affiliated;
const wchar_t *CityName;
const wchar_t *CountryCode;
const wchar_t *CountryName;
int Lat;
int Lon;
const wchar_t *IpAddressV4;
const wchar_t *v_Asn;
const wchar_t *AsnOrg;
const wchar_t *Isp;
const wchar_t *Org;
const wchar_t *ServiceName;
const wchar_t *UserAgent;
const wchar_t *DnsRequestActionDomain;
const wchar_t *Parameters;
const wchar_t *CityCityName;
const wchar_t *CountryCountryCode;
const wchar_t *CountryCountryName;
int GeoLocationLat;
int GeoLocationLon;
const wchar_t *RemoteIpDetailsIpAddressV4;
const wchar_t *OrganizationAsn;
const wchar_t *OrganizationAsnOrg;
const wchar_t *OrganizationIsp;
const wchar_t *OrganizationOrg;
const wchar_t *RequestUri;
int StatusCode;
const wchar_t *KubernetesApiCallActionUserAgent;
const wchar_t *Verb;
int Blocked;
const wchar_t *ConnectionDirection;
const wchar_t *LocalIpDetailsIpAddressV4;
int Port;
const wchar_t *PortName;
const wchar_t *Protocol;
int RemotePortDetailsPort;
const wchar_t *RemotePortDetailsPortName;
int PortProbeActionBlocked;
int Archived;
int Count;
const wchar_t *DetectorId;
const wchar_t *EventFirstSeen;
const wchar_t *EventLastSeen;
const wchar_t *ResourceRole;
const wchar_t *serviceServiceName;
const wchar_t *UserFeedback;
int severity;
const wchar_t *title;
const wchar_t *v_type;
const wchar_t *updatedAt;
int j;
int count_j;
const wchar_t *key;
const wchar_t *value;
const wchar_t *networkInterfaceId;
const wchar_t *privateDnsName;
const wchar_t *privateIpAddress;
const wchar_t *publicDnsName;
const wchar_t *publicIp;
const wchar_t *subnetId;
const wchar_t *vpcId;
int k;
int count_k;
const wchar_t *strVal;
const wchar_t *groupId;
const wchar_t *groupName;
const wchar_t *code;
const wchar_t *productType;
const wchar_t *containerRuntime;
const wchar_t *image;
const wchar_t *imagePrefix;
const wchar_t *name;
int Privileged;
const wchar_t *mountPath;
const wchar_t *Path;
int createdAt_int;
const wchar_t *EncryptionType;
const wchar_t *KmsMasterKeyArn;
const wchar_t *ownerId;
const wchar_t *EffectivePermission;
int BlockPublicAcls;
int BlockPublicPolicy;
int IgnorePublicAcls;
int RestrictPublicBuckets;
int AllowsPublicReadAccess;
int AllowsPublicWriteAccess;
int BlockPublicAccessBlockPublicAcls;
int BlockPublicAccessBlockPublicPolicy;
int BlockPublicAccessIgnorePublicAcls;
int BlockPublicAccessRestrictPublicBuckets;
int BucketPolicyAllowsPublicReadAccess;
int BucketPolicyAllowsPublicWriteAccess;
const wchar_t *localIpDetailsIpAddressV4;
int localPortDetailsPort;
const wchar_t *localPortDetailsPortName;
const wchar_t *remoteIpDetailsIpAddressV4;
const wchar_t *threatListName;
int i;
int count_i;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
rest = CkRestW_Create();
authAws = CkAuthAwsW_Create();
CkAuthAwsW_putAccessKey(authAws,L"AWS_ACCESS_KEY");
CkAuthAwsW_putSecretKey(authAws,L"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.)
CkAuthAwsW_putRegion(authAws,L"us-west-2");
CkAuthAwsW_putServiceName(authAws,L"guardduty");
// SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
CkRestW_SetAuthAws(rest,authAws);
// URL: https://guardduty.us-west-2.amazonaws.com/
// Use the same region as specified above.
success = CkRestW_Connect(rest,L"guardduty.us-west-2.amazonaws.com",443,TRUE,TRUE);
if (success != TRUE) {
wprintf(L"ConnectFailReason: %d\n",CkRestW_getConnectFailReason(rest));
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkRestW_Dispose(rest);
CkAuthAwsW_Dispose(authAws);
return;
}
// 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 = CkJsonObjectW_Create();
CkJsonObjectW_UpdateString(json,L"findingIds[0]",L"string");
CkJsonObjectW_UpdateString(json,L"sortCriteria.attributeName",L"string");
CkJsonObjectW_UpdateString(json,L"sortCriteria.orderBy",L"string");
// The JSON request body created by the above code:
// {
// "findingIds": [
// "string"
// ],
// "sortCriteria": {
// "attributeName": "string",
// "orderBy": "string"
// }
// }
CkRestW_AddHeader(rest,L"Content-Type",L"application/x-amz-json-1.1");
CkRestW_AddHeader(rest,L"X-Amz-Target",L"GetFindings");
sbRequestBody = CkStringBuilderW_Create();
CkJsonObjectW_EmitSb(json,sbRequestBody);
sbResponseBody = CkStringBuilderW_Create();
success = CkRestW_FullRequestSb(rest,L"POST",L"/detector/{detectorId}/findings/get",sbRequestBody,sbResponseBody);
if (success != TRUE) {
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkRestW_Dispose(rest);
CkAuthAwsW_Dispose(authAws);
CkJsonObjectW_Dispose(json);
CkStringBuilderW_Dispose(sbRequestBody);
CkStringBuilderW_Dispose(sbResponseBody);
return;
}
respStatusCode = CkRestW_getResponseStatusCode(rest);
wprintf(L"response status code = %d\n",respStatusCode);
if (respStatusCode != 200) {
wprintf(L"Response Header:\n");
wprintf(L"%s\n",CkRestW_responseHeader(rest));
wprintf(L"Response Body:\n");
wprintf(L"%s\n",CkStringBuilderW_getAsString(sbResponseBody));
CkRestW_Dispose(rest);
CkAuthAwsW_Dispose(authAws);
CkJsonObjectW_Dispose(json);
CkStringBuilderW_Dispose(sbRequestBody);
CkStringBuilderW_Dispose(sbResponseBody);
return;
}
jResp = CkJsonObjectW_Create();
CkJsonObjectW_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
// Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.
// See this example explaining how this memory should be used: const char * functions.
i = 0;
count_i = CkJsonObjectW_SizeOfArray(jResp,L"findings");
while (i < count_i) {
CkJsonObjectW_putI(jResp,i);
accountId = CkJsonObjectW_stringOf(jResp,L"findings[i].accountId");
arn = CkJsonObjectW_stringOf(jResp,L"findings[i].arn");
confidence = CkJsonObjectW_IntOf(jResp,L"findings[i].confidence");
createdAt = CkJsonObjectW_stringOf(jResp,L"findings[i].createdAt");
description = CkJsonObjectW_stringOf(jResp,L"findings[i].description");
id = CkJsonObjectW_stringOf(jResp,L"findings[i].id");
partition = CkJsonObjectW_stringOf(jResp,L"findings[i].partition");
region = CkJsonObjectW_stringOf(jResp,L"findings[i].region");
AccessKeyId = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.accessKeyDetails.accessKeyId");
PrincipalId = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.accessKeyDetails.principalId");
UserName = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.accessKeyDetails.userName");
UserType = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.accessKeyDetails.userType");
Arn = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.eksClusterDetails.arn");
CreatedAt = CkJsonObjectW_IntOf(jResp,L"findings[i].resource.eksClusterDetails.createdAt");
Name = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.eksClusterDetails.name");
Status = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.eksClusterDetails.status");
VpcId = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.eksClusterDetails.vpcId");
AvailabilityZone = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.availabilityZone");
IamInstanceProfileArn = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.iamInstanceProfile.arn");
Id = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.iamInstanceProfile.id");
ImageDescription = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.imageDescription");
ImageId = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.imageId");
InstanceId = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.instanceId");
InstanceState = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.instanceState");
InstanceType = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.instanceType");
LaunchTime = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.launchTime");
OutpostArn = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.outpostArn");
Platform = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.platform");
Uid = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesUserDetails.uid");
Username = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesUserDetails.username");
HostNetwork = CkJsonObjectW_IntOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.hostNetwork");
KubernetesWorkloadDetailsName = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.name");
Namespace = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.namespace");
v_Type = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.type");
KubernetesWorkloadDetailsUid = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.uid");
ResourceType = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.resourceType");
schemaVersion = CkJsonObjectW_stringOf(jResp,L"findings[i].schemaVersion");
ActionType = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.actionType");
Api = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.awsApiCallAction.api");
CallerType = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.awsApiCallAction.callerType");
Domain = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.awsApiCallAction.domainDetails.domain");
ErrorCode = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.awsApiCallAction.errorCode");
AccountId = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.awsApiCallAction.remoteAccountDetails.accountId");
Affiliated = CkJsonObjectW_IntOf(jResp,L"findings[i].service.action.awsApiCallAction.remoteAccountDetails.affiliated");
CityName = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.awsApiCallAction.remoteIpDetails.city.cityName");
CountryCode = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.awsApiCallAction.remoteIpDetails.country.countryCode");
CountryName = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.awsApiCallAction.remoteIpDetails.country.countryName");
Lat = CkJsonObjectW_IntOf(jResp,L"findings[i].service.action.awsApiCallAction.remoteIpDetails.geoLocation.lat");
Lon = CkJsonObjectW_IntOf(jResp,L"findings[i].service.action.awsApiCallAction.remoteIpDetails.geoLocation.lon");
IpAddressV4 = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.awsApiCallAction.remoteIpDetails.ipAddressV4");
v_Asn = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.awsApiCallAction.remoteIpDetails.organization.asn");
AsnOrg = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.awsApiCallAction.remoteIpDetails.organization.asnOrg");
Isp = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.awsApiCallAction.remoteIpDetails.organization.isp");
Org = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.awsApiCallAction.remoteIpDetails.organization.org");
ServiceName = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.awsApiCallAction.serviceName");
UserAgent = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.awsApiCallAction.userAgent");
DnsRequestActionDomain = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.dnsRequestAction.domain");
Parameters = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.kubernetesApiCallAction.parameters");
CityCityName = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.city.cityName");
CountryCountryCode = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.country.countryCode");
CountryCountryName = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.country.countryName");
GeoLocationLat = CkJsonObjectW_IntOf(jResp,L"findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.geoLocation.lat");
GeoLocationLon = CkJsonObjectW_IntOf(jResp,L"findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.geoLocation.lon");
RemoteIpDetailsIpAddressV4 = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.ipAddressV4");
OrganizationAsn = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.organization.asn");
OrganizationAsnOrg = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.organization.asnOrg");
OrganizationIsp = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.organization.isp");
OrganizationOrg = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.kubernetesApiCallAction.remoteIpDetails.organization.org");
RequestUri = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.kubernetesApiCallAction.requestUri");
StatusCode = CkJsonObjectW_IntOf(jResp,L"findings[i].service.action.kubernetesApiCallAction.statusCode");
KubernetesApiCallActionUserAgent = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.kubernetesApiCallAction.userAgent");
Verb = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.kubernetesApiCallAction.verb");
Blocked = CkJsonObjectW_IntOf(jResp,L"findings[i].service.action.networkConnectionAction.blocked");
ConnectionDirection = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.networkConnectionAction.connectionDirection");
LocalIpDetailsIpAddressV4 = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.networkConnectionAction.localIpDetails.ipAddressV4");
Port = CkJsonObjectW_IntOf(jResp,L"findings[i].service.action.networkConnectionAction.localPortDetails.port");
PortName = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.networkConnectionAction.localPortDetails.portName");
Protocol = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.networkConnectionAction.protocol");
CityCityName = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.networkConnectionAction.remoteIpDetails.city.cityName");
CountryCountryCode = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.networkConnectionAction.remoteIpDetails.country.countryCode");
CountryCountryName = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.networkConnectionAction.remoteIpDetails.country.countryName");
GeoLocationLat = CkJsonObjectW_IntOf(jResp,L"findings[i].service.action.networkConnectionAction.remoteIpDetails.geoLocation.lat");
GeoLocationLon = CkJsonObjectW_IntOf(jResp,L"findings[i].service.action.networkConnectionAction.remoteIpDetails.geoLocation.lon");
RemoteIpDetailsIpAddressV4 = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.networkConnectionAction.remoteIpDetails.ipAddressV4");
OrganizationAsn = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.networkConnectionAction.remoteIpDetails.organization.asn");
OrganizationAsnOrg = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.networkConnectionAction.remoteIpDetails.organization.asnOrg");
OrganizationIsp = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.networkConnectionAction.remoteIpDetails.organization.isp");
OrganizationOrg = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.networkConnectionAction.remoteIpDetails.organization.org");
RemotePortDetailsPort = CkJsonObjectW_IntOf(jResp,L"findings[i].service.action.networkConnectionAction.remotePortDetails.port");
RemotePortDetailsPortName = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.networkConnectionAction.remotePortDetails.portName");
PortProbeActionBlocked = CkJsonObjectW_IntOf(jResp,L"findings[i].service.action.portProbeAction.blocked");
Archived = CkJsonObjectW_IntOf(jResp,L"findings[i].service.archived");
Count = CkJsonObjectW_IntOf(jResp,L"findings[i].service.count");
DetectorId = CkJsonObjectW_stringOf(jResp,L"findings[i].service.detectorId");
EventFirstSeen = CkJsonObjectW_stringOf(jResp,L"findings[i].service.eventFirstSeen");
EventLastSeen = CkJsonObjectW_stringOf(jResp,L"findings[i].service.eventLastSeen");
ResourceRole = CkJsonObjectW_stringOf(jResp,L"findings[i].service.resourceRole");
serviceServiceName = CkJsonObjectW_stringOf(jResp,L"findings[i].service.serviceName");
UserFeedback = CkJsonObjectW_stringOf(jResp,L"findings[i].service.userFeedback");
severity = CkJsonObjectW_IntOf(jResp,L"findings[i].severity");
title = CkJsonObjectW_stringOf(jResp,L"findings[i].title");
v_type = CkJsonObjectW_stringOf(jResp,L"findings[i].type");
updatedAt = CkJsonObjectW_stringOf(jResp,L"findings[i].updatedAt");
j = 0;
count_j = CkJsonObjectW_SizeOfArray(jResp,L"findings[i].resource.eksClusterDetails.tags");
while (j < count_j) {
CkJsonObjectW_putJ(jResp,j);
key = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.eksClusterDetails.tags[j].key");
value = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.eksClusterDetails.tags[j].value");
j = j + 1;
}
j = 0;
count_j = CkJsonObjectW_SizeOfArray(jResp,L"findings[i].resource.instanceDetails.networkInterfaces");
while (j < count_j) {
CkJsonObjectW_putJ(jResp,j);
networkInterfaceId = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.networkInterfaces[j].networkInterfaceId");
privateDnsName = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.networkInterfaces[j].privateDnsName");
privateIpAddress = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.networkInterfaces[j].privateIpAddress");
publicDnsName = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.networkInterfaces[j].publicDnsName");
publicIp = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.networkInterfaces[j].publicIp");
subnetId = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.networkInterfaces[j].subnetId");
vpcId = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.networkInterfaces[j].vpcId");
k = 0;
count_k = CkJsonObjectW_SizeOfArray(jResp,L"findings[i].resource.instanceDetails.networkInterfaces[j].ipv6Addresses");
while (k < count_k) {
CkJsonObjectW_putK(jResp,k);
strVal = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.networkInterfaces[j].ipv6Addresses[k]");
k = k + 1;
}
k = 0;
count_k = CkJsonObjectW_SizeOfArray(jResp,L"findings[i].resource.instanceDetails.networkInterfaces[j].privateIpAddresses");
while (k < count_k) {
CkJsonObjectW_putK(jResp,k);
privateDnsName = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.networkInterfaces[j].privateIpAddresses[k].privateDnsName");
privateIpAddress = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.networkInterfaces[j].privateIpAddresses[k].privateIpAddress");
k = k + 1;
}
k = 0;
count_k = CkJsonObjectW_SizeOfArray(jResp,L"findings[i].resource.instanceDetails.networkInterfaces[j].securityGroups");
while (k < count_k) {
CkJsonObjectW_putK(jResp,k);
groupId = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.networkInterfaces[j].securityGroups[k].groupId");
groupName = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.networkInterfaces[j].securityGroups[k].groupName");
k = k + 1;
}
j = j + 1;
}
j = 0;
count_j = CkJsonObjectW_SizeOfArray(jResp,L"findings[i].resource.instanceDetails.productCodes");
while (j < count_j) {
CkJsonObjectW_putJ(jResp,j);
code = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.productCodes[j].code");
productType = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.productCodes[j].productType");
j = j + 1;
}
j = 0;
count_j = CkJsonObjectW_SizeOfArray(jResp,L"findings[i].resource.instanceDetails.tags");
while (j < count_j) {
CkJsonObjectW_putJ(jResp,j);
key = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.tags[j].key");
value = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.instanceDetails.tags[j].value");
j = j + 1;
}
j = 0;
count_j = CkJsonObjectW_SizeOfArray(jResp,L"findings[i].resource.kubernetesDetails.kubernetesUserDetails.groups");
while (j < count_j) {
CkJsonObjectW_putJ(jResp,j);
strVal = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesUserDetails.groups[j]");
j = j + 1;
}
j = 0;
count_j = CkJsonObjectW_SizeOfArray(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers");
while (j < count_j) {
CkJsonObjectW_putJ(jResp,j);
containerRuntime = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].containerRuntime");
id = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].id");
image = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].image");
imagePrefix = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].imagePrefix");
name = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].name");
Privileged = CkJsonObjectW_IntOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].securityContext.privileged");
k = 0;
count_k = CkJsonObjectW_SizeOfArray(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].volumeMounts");
while (k < count_k) {
CkJsonObjectW_putK(jResp,k);
mountPath = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].volumeMounts[k].mountPath");
name = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.containers[j].volumeMounts[k].name");
k = k + 1;
}
j = j + 1;
}
j = 0;
count_j = CkJsonObjectW_SizeOfArray(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.volumes");
while (j < count_j) {
CkJsonObjectW_putJ(jResp,j);
Path = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.volumes[j].hostPath.path");
name = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.kubernetesDetails.kubernetesWorkloadDetails.volumes[j].name");
j = j + 1;
}
j = 0;
count_j = CkJsonObjectW_SizeOfArray(jResp,L"findings[i].resource.s3BucketDetails");
while (j < count_j) {
CkJsonObjectW_putJ(jResp,j);
arn = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.s3BucketDetails[j].arn");
createdAt_int = CkJsonObjectW_IntOf(jResp,L"findings[i].resource.s3BucketDetails[j].createdAt");
EncryptionType = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.s3BucketDetails[j].defaultServerSideEncryption.encryptionType");
KmsMasterKeyArn = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.s3BucketDetails[j].defaultServerSideEncryption.kmsMasterKeyArn");
name = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.s3BucketDetails[j].name");
ownerId = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.s3BucketDetails[j].owner.id");
EffectivePermission = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.s3BucketDetails[j].publicAccess.effectivePermission");
BlockPublicAcls = CkJsonObjectW_IntOf(jResp,L"findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.accountLevelPermissions.blockPublicAccess.blockPublicAcls");
BlockPublicPolicy = CkJsonObjectW_IntOf(jResp,L"findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.accountLevelPermissions.blockPublicAccess.blockPublicPolicy");
IgnorePublicAcls = CkJsonObjectW_IntOf(jResp,L"findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.accountLevelPermissions.blockPublicAccess.ignorePublicAcls");
RestrictPublicBuckets = CkJsonObjectW_IntOf(jResp,L"findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.accountLevelPermissions.blockPublicAccess.restrictPublicBuckets");
AllowsPublicReadAccess = CkJsonObjectW_IntOf(jResp,L"findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.bucketLevelPermissions.accessControlList.allowsPublicReadAccess");
AllowsPublicWriteAccess = CkJsonObjectW_IntOf(jResp,L"findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.bucketLevelPermissions.accessControlList.allowsPublicWriteAccess");
BlockPublicAccessBlockPublicAcls = CkJsonObjectW_IntOf(jResp,L"findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.bucketLevelPermissions.blockPublicAccess.blockPublicAcls");
BlockPublicAccessBlockPublicPolicy = CkJsonObjectW_IntOf(jResp,L"findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.bucketLevelPermissions.blockPublicAccess.blockPublicPolicy");
BlockPublicAccessIgnorePublicAcls = CkJsonObjectW_IntOf(jResp,L"findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.bucketLevelPermissions.blockPublicAccess.ignorePublicAcls");
BlockPublicAccessRestrictPublicBuckets = CkJsonObjectW_IntOf(jResp,L"findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.bucketLevelPermissions.blockPublicAccess.restrictPublicBuckets");
BucketPolicyAllowsPublicReadAccess = CkJsonObjectW_IntOf(jResp,L"findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.bucketLevelPermissions.bucketPolicy.allowsPublicReadAccess");
BucketPolicyAllowsPublicWriteAccess = CkJsonObjectW_IntOf(jResp,L"findings[i].resource.s3BucketDetails[j].publicAccess.permissionConfiguration.bucketLevelPermissions.bucketPolicy.allowsPublicWriteAccess");
v_type = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.s3BucketDetails[j].type");
k = 0;
count_k = CkJsonObjectW_SizeOfArray(jResp,L"findings[i].resource.s3BucketDetails[j].tags");
while (k < count_k) {
CkJsonObjectW_putK(jResp,k);
key = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.s3BucketDetails[j].tags[k].key");
value = CkJsonObjectW_stringOf(jResp,L"findings[i].resource.s3BucketDetails[j].tags[k].value");
k = k + 1;
}
j = j + 1;
}
j = 0;
count_j = CkJsonObjectW_SizeOfArray(jResp,L"findings[i].service.action.kubernetesApiCallAction.sourceIps");
while (j < count_j) {
CkJsonObjectW_putJ(jResp,j);
strVal = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.kubernetesApiCallAction.sourceIps[j]");
j = j + 1;
}
j = 0;
count_j = CkJsonObjectW_SizeOfArray(jResp,L"findings[i].service.action.portProbeAction.portProbeDetails");
while (j < count_j) {
CkJsonObjectW_putJ(jResp,j);
localIpDetailsIpAddressV4 = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.portProbeAction.portProbeDetails[j].localIpDetails.ipAddressV4");
localPortDetailsPort = CkJsonObjectW_IntOf(jResp,L"findings[i].service.action.portProbeAction.portProbeDetails[j].localPortDetails.port");
localPortDetailsPortName = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.portProbeAction.portProbeDetails[j].localPortDetails.portName");
CityCityName = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.city.cityName");
CountryCountryCode = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.country.countryCode");
CountryCountryName = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.country.countryName");
GeoLocationLat = CkJsonObjectW_IntOf(jResp,L"findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.geoLocation.lat");
GeoLocationLon = CkJsonObjectW_IntOf(jResp,L"findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.geoLocation.lon");
remoteIpDetailsIpAddressV4 = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.ipAddressV4");
OrganizationAsn = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.organization.asn");
OrganizationAsnOrg = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.organization.asnOrg");
OrganizationIsp = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.organization.isp");
OrganizationOrg = CkJsonObjectW_stringOf(jResp,L"findings[i].service.action.portProbeAction.portProbeDetails[j].remoteIpDetails.organization.org");
j = j + 1;
}
j = 0;
count_j = CkJsonObjectW_SizeOfArray(jResp,L"findings[i].service.evidence.threatIntelligenceDetails");
while (j < count_j) {
CkJsonObjectW_putJ(jResp,j);
threatListName = CkJsonObjectW_stringOf(jResp,L"findings[i].service.evidence.threatIntelligenceDetails[j].threatListName");
k = 0;
count_k = CkJsonObjectW_SizeOfArray(jResp,L"findings[i].service.evidence.threatIntelligenceDetails[j].threatNames");
while (k < count_k) {
CkJsonObjectW_putK(jResp,k);
strVal = CkJsonObjectW_stringOf(jResp,L"findings[i].service.evidence.threatIntelligenceDetails[j].threatNames[k]");
k = k + 1;
}
j = j + 1;
}
i = i + 1;
}
// A sample JSON response body parsed by the above code:
// {
// "findings": [
// {
// "accountId": "string",
// "arn": "string",
// "confidence": number,
// "createdAt": "string",
// "description": "string",
// "id": "string",
// "partition": "string",
// "region": "string",
// "resource": {
// "accessKeyDetails": {
// "accessKeyId": "string",
// "principalId": "string",
// "userName": "string",
// "userType": "string"
// },
// "eksClusterDetails": {
// "arn": "string",
// "createdAt": number,
// "name": "string",
// "status": "string",
// "tags": [
// {
// "key": "string",
// "value": "string"
// }
// ],
// "vpcId": "string"
// },
// "instanceDetails": {
// "availabilityZone": "string",
// "iamInstanceProfile": {
// "arn": "string",
// "id": "string"
// },
// "imageDescription": "string",
// "imageId": "string",
// "instanceId": "string",
// "instanceState": "string",
// "instanceType": "string",
// "launchTime": "string",
// "networkInterfaces": [
// {
// "ipv6Addresses": [
// "string"
// ],
// "networkInterfaceId": "string",
// "privateDnsName": "string",
// "privateIpAddress": "string",
// "privateIpAddresses": [
// {
// "privateDnsName": "string",
// "privateIpAddress": "string"
// }
// ],
// "publicDnsName": "string",
// "publicIp": "string",
// "securityGroups": [
// {
// "groupId": "string",
// "groupName": "string"
// }
// ],
// "subnetId": "string",
// "vpcId": "string"
// }
// ],
// "outpostArn": "string",
// "platform": "string",
// "productCodes": [
// {
// "code": "string",
// "productType": "string"
// }
// ],
// "tags": [
// {
// "key": "string",
// "value": "string"
// }
// ]
// },
// "kubernetesDetails": {
// "kubernetesUserDetails": {
// "groups": [
// "string"
// ],
// "uid": "string",
// "username": "string"
// },
// "kubernetesWorkloadDetails": {
// "containers": [
// {
// "containerRuntime": "string",
// "id": "string",
// "image": "string",
// "imagePrefix": "string",
// "name": "string",
// "securityContext": {
// "privileged": boolean
// },
// "volumeMounts": [
// {
// "mountPath": "string",
// "name": "string"
// }
// ]
// }
// ],
// "hostNetwork": boolean,
// "name": "string",
// "namespace": "string",
// "type": "string",
// "uid": "string",
// "volumes": [
// {
// "hostPath": {
// "path": "string"
// },
// "name": "string"
// }
// ]
// }
// },
// "resourceType": "string",
// "s3BucketDetails": [
// {
// "arn": "string",
// "createdAt": number,
// "defaultServerSideEncryption": {
// "encryptionType": "string",
// "kmsMasterKeyArn": "string"
// },
// "name": "string",
// "owner": {
// "id": "string"
// },
// "publicAccess": {
// "effectivePermission": "string",
// "permissionConfiguration": {
// "accountLevelPermissions": {
// "blockPublicAccess": {
// "blockPublicAcls": boolean,
// "blockPublicPolicy": boolean,
// "ignorePublicAcls": boolean,
// "restrictPublicBuckets": boolean
// }
// },
// "bucketLevelPermissions": {
// "accessControlList": {
// "allowsPublicReadAccess": boolean,
// "allowsPublicWriteAccess": boolean
// },
// "blockPublicAccess": {
// "blockPublicAcls": boolean,
// "blockPublicPolicy": boolean,
// "ignorePublicAcls": boolean,
// "restrictPublicBuckets": boolean
// },
// "bucketPolicy": {
// "allowsPublicReadAccess": boolean,
// "allowsPublicWriteAccess": boolean
// }
// }
// }
// },
// "tags": [
// {
// "key": "string",
// "value": "string"
// }
// ],
// "type": "string"
// }
// ]
// },
// "schemaVersion": "string",
// "service": {
// "action": {
// "actionType": "string",
// "awsApiCallAction": {
// "api": "string",
// "callerType": "string",
// "domainDetails": {
// "domain": "string"
// },
// "errorCode": "string",
// "remoteAccountDetails": {
// "accountId": "string",
// "affiliated": boolean
// },
// "remoteIpDetails": {
// "city": {
// "cityName": "string"
// },
// "country": {
// "countryCode": "string",
// "countryName": "string"
// },
// "geoLocation": {
// "lat": number,
// "lon": number
// },
// "ipAddressV4": "string",
// "organization": {
// "asn": "string",
// "asnOrg": "string",
// "isp": "string",
// "org": "string"
// }
// },
// "serviceName": "string",
// "userAgent": "string"
// },
// "dnsRequestAction": {
// "domain": "string"
// },
// "kubernetesApiCallAction": {
// "parameters": "string",
// "remoteIpDetails": {
// "city": {
// "cityName": "string"
// },
// "country": {
// "countryCode": "string",
// "countryName": "string"
// },
// "geoLocation": {
// "lat": number,
// "lon": number
// },
// "ipAddressV4": "string",
// "organization": {
// "asn": "string",
// "asnOrg": "string",
// "isp": "string",
// "org": "string"
// }
// },
// "requestUri": "string",
// "sourceIps": [
// "string"
// ],
// "statusCode": number,
// "userAgent": "string",
// "verb": "string"
// },
// "networkConnectionAction": {
// "blocked": boolean,
// "connectionDirection": "string",
// "localIpDetails": {
// "ipAddressV4": "string"
// },
// "localPortDetails": {
// "port": number,
// "portName": "string"
// },
// "protocol": "string",
// "remoteIpDetails": {
// "city": {
// "cityName": "string"
// },
// "country": {
// "countryCode": "string",
// "countryName": "string"
// },
// "geoLocation": {
// "lat": number,
// "lon": number
// },
// "ipAddressV4": "string",
// "organization": {
// "asn": "string",
// "asnOrg": "string",
// "isp": "string",
// "org": "string"
// }
// },
// "remotePortDetails": {
// "port": number,
// "portName": "string"
// }
// },
// "portProbeAction": {
// "blocked": boolean,
// "portProbeDetails": [
// {
// "localIpDetails": {
// "ipAddressV4": "string"
// },
// "localPortDetails": {
// "port": number,
// "portName": "string"
// },
// "remoteIpDetails": {
// "city": {
// "cityName": "string"
// },
// "country": {
// "countryCode": "string",
// "countryName": "string"
// },
// "geoLocation": {
// "lat": number,
// "lon": number
// },
// "ipAddressV4": "string",
// "organization": {
// "asn": "string",
// "asnOrg": "string",
// "isp": "string",
// "org": "string"
// }
// }
// }
// ]
// }
// },
// "archived": boolean,
// "count": number,
// "detectorId": "string",
// "eventFirstSeen": "string",
// "eventLastSeen": "string",
// "evidence": {
// "threatIntelligenceDetails": [
// {
// "threatListName": "string",
// "threatNames": [
// "string"
// ]
// }
// ]
// },
// "resourceRole": "string",
// "serviceName": "string",
// "userFeedback": "string"
// },
// "severity": number,
// "title": "string",
// "type": "string",
// "updatedAt": "string"
// }
// ]
// }
CkRestW_Dispose(rest);
CkAuthAwsW_Dispose(authAws);
CkJsonObjectW_Dispose(json);
CkStringBuilderW_Dispose(sbRequestBody);
CkStringBuilderW_Dispose(sbResponseBody);
CkJsonObjectW_Dispose(jResp);
}