Chilkat Online Tools

DescribePipeline 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","DescribePipeline")

$oSbResponseBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$bSuccess = $oRest.FullRequestNoBodySb("GET","/pipelines/{pipelineName}",$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 $sV_String
Local $sAddAttributesName
Local $sV_Next
Local $sChannelName
Local $sChannelName
Local $sChannelNext
Local $sDatastoreName
Local $sDatastoreName
Local $sAttribute
Local $sDeviceRegistryEnrichName
Local $sDeviceRegistryEnrichNext
Local $sRoleArn
Local $sThingName
Local $sDeviceShadowEnrichAttribute
Local $sDeviceShadowEnrichName
Local $sDeviceShadowEnrichNext
Local $sDeviceShadowEnrichRoleArn
Local $sDeviceShadowEnrichThingName
Local $sFilter
Local $sFilterName
Local $sFilterNext
Local $iBatchSize
Local $sLambdaName
Local $sLambdaName
Local $sLambdaNext
Local $sMathAttribute
Local $sMath
Local $sMathName
Local $sMathNext
Local $sRemoveAttributesName
Local $sRemoveAttributesNext
Local $selectAttributesName
Local $selectAttributesNext
Local $iJ
Local $iCount_j
Local $strVal
Local $iCreationTime
Local $sId
Local $status

Local $sArn = $oJResp.StringOf("pipeline.arn")
Local $iCreationTime = $oJResp.IntOf("pipeline.creationTime")
Local $iLastUpdateTime = $oJResp.IntOf("pipeline.lastUpdateTime")
Local $sName = $oJResp.StringOf("pipeline.name")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("pipeline.activities")
While $i < $iCount_i
    $oJResp.I = $i
    $sV_String = $oJResp.StringOf("pipeline.activities[i].addAttributes.attributes.string")
    $sAddAttributesName = $oJResp.StringOf("pipeline.activities[i].addAttributes.name")
    $sV_Next = $oJResp.StringOf("pipeline.activities[i].addAttributes.next")
    $sChannelName = $oJResp.StringOf("pipeline.activities[i].channel.channelName")
    $sChannelName = $oJResp.StringOf("pipeline.activities[i].channel.name")
    $sChannelNext = $oJResp.StringOf("pipeline.activities[i].channel.next")
    $sDatastoreName = $oJResp.StringOf("pipeline.activities[i].datastore.datastoreName")
    $sDatastoreName = $oJResp.StringOf("pipeline.activities[i].datastore.name")
    $sAttribute = $oJResp.StringOf("pipeline.activities[i].deviceRegistryEnrich.attribute")
    $sDeviceRegistryEnrichName = $oJResp.StringOf("pipeline.activities[i].deviceRegistryEnrich.name")
    $sDeviceRegistryEnrichNext = $oJResp.StringOf("pipeline.activities[i].deviceRegistryEnrich.next")
    $sRoleArn = $oJResp.StringOf("pipeline.activities[i].deviceRegistryEnrich.roleArn")
    $sThingName = $oJResp.StringOf("pipeline.activities[i].deviceRegistryEnrich.thingName")
    $sDeviceShadowEnrichAttribute = $oJResp.StringOf("pipeline.activities[i].deviceShadowEnrich.attribute")
    $sDeviceShadowEnrichName = $oJResp.StringOf("pipeline.activities[i].deviceShadowEnrich.name")
    $sDeviceShadowEnrichNext = $oJResp.StringOf("pipeline.activities[i].deviceShadowEnrich.next")
    $sDeviceShadowEnrichRoleArn = $oJResp.StringOf("pipeline.activities[i].deviceShadowEnrich.roleArn")
    $sDeviceShadowEnrichThingName = $oJResp.StringOf("pipeline.activities[i].deviceShadowEnrich.thingName")
    $sFilter = $oJResp.StringOf("pipeline.activities[i].filter.filter")
    $sFilterName = $oJResp.StringOf("pipeline.activities[i].filter.name")
    $sFilterNext = $oJResp.StringOf("pipeline.activities[i].filter.next")
    $iBatchSize = $oJResp.IntOf("pipeline.activities[i].lambda.batchSize")
    $sLambdaName = $oJResp.StringOf("pipeline.activities[i].lambda.lambdaName")
    $sLambdaName = $oJResp.StringOf("pipeline.activities[i].lambda.name")
    $sLambdaNext = $oJResp.StringOf("pipeline.activities[i].lambda.next")
    $sMathAttribute = $oJResp.StringOf("pipeline.activities[i].math.attribute")
    $sMath = $oJResp.StringOf("pipeline.activities[i].math.math")
    $sMathName = $oJResp.StringOf("pipeline.activities[i].math.name")
    $sMathNext = $oJResp.StringOf("pipeline.activities[i].math.next")
    $sRemoveAttributesName = $oJResp.StringOf("pipeline.activities[i].removeAttributes.name")
    $sRemoveAttributesNext = $oJResp.StringOf("pipeline.activities[i].removeAttributes.next")
    $selectAttributesName = $oJResp.StringOf("pipeline.activities[i].selectAttributes.name")
    $selectAttributesNext = $oJResp.StringOf("pipeline.activities[i].selectAttributes.next")
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("pipeline.activities[i].removeAttributes.attributes")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("pipeline.activities[i].removeAttributes.attributes[j]")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("pipeline.activities[i].selectAttributes.attributes")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("pipeline.activities[i].selectAttributes.attributes[j]")
        $iJ = $iJ + 1
    Wend
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("pipeline.reprocessingSummaries")
While $i < $iCount_i
    $oJResp.I = $i
    $iCreationTime = $oJResp.IntOf("pipeline.reprocessingSummaries[i].creationTime")
    $sId = $oJResp.StringOf("pipeline.reprocessingSummaries[i].id")
    $status = $oJResp.StringOf("pipeline.reprocessingSummaries[i].status")
    $i = $i + 1
Wend

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

; {
;   "pipeline": {
;     "activities": [
;       {
;         "addAttributes": {
;           "attributes": {
;             "string": "string"
;           },
;           "name": "string",
;           "next": "string"
;         },
;         "channel": {
;           "channelName": "string",
;           "name": "string",
;           "next": "string"
;         },
;         "datastore": {
;           "datastoreName": "string",
;           "name": "string"
;         },
;         "deviceRegistryEnrich": {
;           "attribute": "string",
;           "name": "string",
;           "next": "string",
;           "roleArn": "string",
;           "thingName": "string"
;         },
;         "deviceShadowEnrich": {
;           "attribute": "string",
;           "name": "string",
;           "next": "string",
;           "roleArn": "string",
;           "thingName": "string"
;         },
;         "filter": {
;           "filter": "string",
;           "name": "string",
;           "next": "string"
;         },
;         "lambda": {
;           "batchSize": number,
;           "lambdaName": "string",
;           "name": "string",
;           "next": "string"
;         },
;         "math": {
;           "attribute": "string",
;           "math": "string",
;           "name": "string",
;           "next": "string"
;         },
;         "removeAttributes": {
;           "attributes": [
;             "string"
;           ],
;           "name": "string",
;           "next": "string"
;         },
;         "selectAttributes": {
;           "attributes": [
;             "string"
;           ],
;           "name": "string",
;           "next": "string"
;         }
;       }
;     ],
;     "arn": "string",
;     "creationTime": number,
;     "lastUpdateTime": number,
;     "name": "string",
;     "reprocessingSummaries": [
;       {
;         "creationTime": number,
;         "id": "string",
;         "status": "string"
;       }
;     ]
;   }
; }