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