Chilkat Online Tools

DescribeDataset autoit Example

AWS IoT Analytics

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

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

$oAuthAws = ObjCreate("Chilkat_9_5_0.AuthAws")
$oAuthAws.AccessKey = "AWS_ACCESS_KEY"
$oAuthAws.SecretKey = "AWS_SECRET_KEY"

; Don't forget to change the region to your particular region. (Also make the same change in the call to Connect below.)
$oAuthAws.Region = "us-west-2"
$oAuthAws.ServiceName = "iotanalytics"
; SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
$oRest.SetAuthAws($oAuthAws)

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

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

$oSbResponseBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$bSuccess = $oRest.FullRequestNoBodySb("GET","/datasets/{datasetName}",$oSbResponseBody)
If ($bSuccess <> True) Then
    ConsoleWrite($oRest.LastErrorText & @CRLF)
    Exit
EndIf

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

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

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

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

Local $sActionName
Local $sExecutionRoleArn
Local $sImage
Local $sComputeType
Local $iVolumeSizeInGB
Local $sSqlQuery
Local $iJ
Local $iCount_j
Local $sDatasetName
Local $iDoubleValue
Local $sName
Local $sFileName
Local $stringValue
Local $iOffsetSeconds
Local $sTimeExpression
Local $sInputName
Local $sRoleArn
Local $sBucket
Local $sDatabaseName
Local $sTableName
Local $sKey
Local $sS3DestinationConfigurationRoleArn
Local $sEntryName
Local $iTimeoutInMinutes
Local $sRuleName
Local $sDatasetName
Local $sExpression

Local $sArn = $oJResp.StringOf("dataset.arn")
Local $iCreationTime = $oJResp.IntOf("dataset.creationTime")
Local $iLastUpdateTime = $oJResp.IntOf("dataset.lastUpdateTime")
Local $sName = $oJResp.StringOf("dataset.name")
Local $iNumberOfDays = $oJResp.IntOf("dataset.retentionPeriod.numberOfDays")
Local $iUnlimited = $oJResp.IntOf("dataset.retentionPeriod.unlimited")
Local $sStatus = $oJResp.StringOf("dataset.status")
Local $iMaxVersions = $oJResp.IntOf("dataset.versioningConfiguration.maxVersions")
Local $iVersioningConfigurationUnlimited = $oJResp.IntOf("dataset.versioningConfiguration.unlimited")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("dataset.actions")
While $i < $iCount_i
    $oJResp.I = $i
    $sActionName = $oJResp.StringOf("dataset.actions[i].actionName")
    $sExecutionRoleArn = $oJResp.StringOf("dataset.actions[i].containerAction.executionRoleArn")
    $sImage = $oJResp.StringOf("dataset.actions[i].containerAction.image")
    $sComputeType = $oJResp.StringOf("dataset.actions[i].containerAction.resourceConfiguration.computeType")
    $iVolumeSizeInGB = $oJResp.IntOf("dataset.actions[i].containerAction.resourceConfiguration.volumeSizeInGB")
    $sSqlQuery = $oJResp.StringOf("dataset.actions[i].queryAction.sqlQuery")
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("dataset.actions[i].containerAction.variables")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sDatasetName = $oJResp.StringOf("dataset.actions[i].containerAction.variables[j].datasetContentVersionValue.datasetName")
        $iDoubleValue = $oJResp.IntOf("dataset.actions[i].containerAction.variables[j].doubleValue")
        $sName = $oJResp.StringOf("dataset.actions[i].containerAction.variables[j].name")
        $sFileName = $oJResp.StringOf("dataset.actions[i].containerAction.variables[j].outputFileUriValue.fileName")
        $stringValue = $oJResp.StringOf("dataset.actions[i].containerAction.variables[j].stringValue")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("dataset.actions[i].queryAction.filters")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $iOffsetSeconds = $oJResp.IntOf("dataset.actions[i].queryAction.filters[j].deltaTime.offsetSeconds")
        $sTimeExpression = $oJResp.StringOf("dataset.actions[i].queryAction.filters[j].deltaTime.timeExpression")
        $iJ = $iJ + 1
    Wend
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("dataset.contentDeliveryRules")
While $i < $iCount_i
    $oJResp.I = $i
    $sInputName = $oJResp.StringOf("dataset.contentDeliveryRules[i].destination.iotEventsDestinationConfiguration.inputName")
    $sRoleArn = $oJResp.StringOf("dataset.contentDeliveryRules[i].destination.iotEventsDestinationConfiguration.roleArn")
    $sBucket = $oJResp.StringOf("dataset.contentDeliveryRules[i].destination.s3DestinationConfiguration.bucket")
    $sDatabaseName = $oJResp.StringOf("dataset.contentDeliveryRules[i].destination.s3DestinationConfiguration.glueConfiguration.databaseName")
    $sTableName = $oJResp.StringOf("dataset.contentDeliveryRules[i].destination.s3DestinationConfiguration.glueConfiguration.tableName")
    $sKey = $oJResp.StringOf("dataset.contentDeliveryRules[i].destination.s3DestinationConfiguration.key")
    $sS3DestinationConfigurationRoleArn = $oJResp.StringOf("dataset.contentDeliveryRules[i].destination.s3DestinationConfiguration.roleArn")
    $sEntryName = $oJResp.StringOf("dataset.contentDeliveryRules[i].entryName")
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("dataset.lateDataRules")
While $i < $iCount_i
    $oJResp.I = $i
    $iTimeoutInMinutes = $oJResp.IntOf("dataset.lateDataRules[i].ruleConfiguration.deltaTimeSessionWindowConfiguration.timeoutInMinutes")
    $sRuleName = $oJResp.StringOf("dataset.lateDataRules[i].ruleName")
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("dataset.triggers")
While $i < $iCount_i
    $oJResp.I = $i
    $sDatasetName = $oJResp.StringOf("dataset.triggers[i].dataset.name")
    $sExpression = $oJResp.StringOf("dataset.triggers[i].schedule.expression")
    $i = $i + 1
Wend

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

; {
;   "dataset": {
;     "actions": [
;       {
;         "actionName": "string",
;         "containerAction": {
;           "executionRoleArn": "string",
;           "image": "string",
;           "resourceConfiguration": {
;             "computeType": "string",
;             "volumeSizeInGB": number
;           },
;           "variables": [
;             {
;               "datasetContentVersionValue": {
;                 "datasetName": "string"
;               },
;               "doubleValue": number,
;               "name": "string",
;               "outputFileUriValue": {
;                 "fileName": "string"
;               },
;               "stringValue": "string"
;             }
;           ]
;         },
;         "queryAction": {
;           "filters": [
;             {
;               "deltaTime": {
;                 "offsetSeconds": number,
;                 "timeExpression": "string"
;               }
;             }
;           ],
;           "sqlQuery": "string"
;         }
;       }
;     ],
;     "arn": "string",
;     "contentDeliveryRules": [
;       {
;         "destination": {
;           "iotEventsDestinationConfiguration": {
;             "inputName": "string",
;             "roleArn": "string"
;           },
;           "s3DestinationConfiguration": {
;             "bucket": "string",
;             "glueConfiguration": {
;               "databaseName": "string",
;               "tableName": "string"
;             },
;             "key": "string",
;             "roleArn": "string"
;           }
;         },
;         "entryName": "string"
;       }
;     ],
;     "creationTime": number,
;     "lastUpdateTime": number,
;     "lateDataRules": [
;       {
;         "ruleConfiguration": {
;           "deltaTimeSessionWindowConfiguration": {
;             "timeoutInMinutes": number
;           }
;         },
;         "ruleName": "string"
;       }
;     ],
;     "name": "string",
;     "retentionPeriod": {
;       "numberOfDays": number,
;       "unlimited": boolean
;     },
;     "status": "string",
;     "triggers": [
;       {
;         "dataset": {
;           "name": "string"
;         },
;         "schedule": {
;           "expression": "string"
;         }
;       }
;     ],
;     "versioningConfiguration": {
;       "maxVersions": number,
;       "unlimited": boolean
;     }
;   }
; }