GetJob VB.NET Example
' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
Dim rest As New Chilkat.Rest
Dim success As Boolean
Dim authAws As New Chilkat.AuthAws
authAws.AccessKey = "AWS_ACCESS_KEY"
authAws.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.)
authAws.Region = "us-west-2"
authAws.ServiceName = "braket"
' SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
rest.SetAuthAws(authAws)
' URL: https://braket.us-west-2.amazonaws.com/
' Use the same region as specified above.
success = rest.Connect("braket.us-west-2.amazonaws.com",443,True,True)
If (success <> True) Then
Debug.WriteLine("ConnectFailReason: " & rest.ConnectFailReason)
Debug.WriteLine(rest.LastErrorText)
Exit Sub
End If
rest.AddHeader("Content-Type","application/x-amz-json-1.1")
rest.AddHeader("X-Amz-Target","GetJob")
Dim sbResponseBody As New Chilkat.StringBuilder
success = rest.FullRequestNoBodySb("GET","/job/{jobArn}",sbResponseBody)
If (success <> True) Then
Debug.WriteLine(rest.LastErrorText)
Exit Sub
End If
Dim respStatusCode As Integer = rest.ResponseStatusCode
Debug.WriteLine("response status code = " & respStatusCode)
If (respStatusCode <> 200) Then
Debug.WriteLine("Response Header:")
Debug.WriteLine(rest.ResponseHeader)
Debug.WriteLine("Response Body:")
Debug.WriteLine(sbResponseBody.GetAsString())
Exit Sub
End If
Dim jResp As New Chilkat.JsonObject
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
Dim eventType As String
Dim message As String
Dim timeOfEvent As Integer
Dim channelName As String
Dim contentType As String
Dim S3DataSourceS3Uri As String
Dim Uri As String = jResp.StringOf("algorithmSpecification.containerImage.uri")
Dim CompressionType As String = jResp.StringOf("algorithmSpecification.scriptModeConfig.compressionType")
Dim EntryPoint As String = jResp.StringOf("algorithmSpecification.scriptModeConfig.entryPoint")
Dim S3Uri As String = jResp.StringOf("algorithmSpecification.scriptModeConfig.s3Uri")
Dim billableDuration As Integer = jResp.IntOf("billableDuration")
Dim LocalPath As String = jResp.StringOf("checkpointConfig.localPath")
Dim checkpointConfigS3Uri As String = jResp.StringOf("checkpointConfig.s3Uri")
Dim createdAt As Integer = jResp.IntOf("createdAt")
Dim Device As String = jResp.StringOf("deviceConfig.device")
Dim endedAt As Integer = jResp.IntOf("endedAt")
Dim failureReason As String = jResp.StringOf("failureReason")
Dim v_String As String = jResp.StringOf("hyperParameters.string")
Dim InstanceCount As Integer = jResp.IntOf("instanceConfig.instanceCount")
Dim InstanceType As String = jResp.StringOf("instanceConfig.instanceType")
Dim VolumeSizeInGb As Integer = jResp.IntOf("instanceConfig.volumeSizeInGb")
Dim jobArn As String = jResp.StringOf("jobArn")
Dim jobName As String = jResp.StringOf("jobName")
Dim KmsKeyId As String = jResp.StringOf("outputDataConfig.kmsKeyId")
Dim S3Path As String = jResp.StringOf("outputDataConfig.s3Path")
Dim roleArn As String = jResp.StringOf("roleArn")
Dim startedAt As Integer = jResp.IntOf("startedAt")
Dim status As String = jResp.StringOf("status")
Dim MaxRuntimeInSeconds As Integer = jResp.IntOf("stoppingCondition.maxRuntimeInSeconds")
Dim tagsString As String = jResp.StringOf("tags.string")
Dim i As Integer = 0
Dim count_i As Integer = jResp.SizeOfArray("events")
While i < count_i
jResp.I = i
eventType = jResp.StringOf("events[i].eventType")
message = jResp.StringOf("events[i].message")
timeOfEvent = jResp.IntOf("events[i].timeOfEvent")
i = i + 1
End While
i = 0
count_i = jResp.SizeOfArray("inputDataConfig")
While i < count_i
jResp.I = i
channelName = jResp.StringOf("inputDataConfig[i].channelName")
contentType = jResp.StringOf("inputDataConfig[i].contentType")
S3DataSourceS3Uri = jResp.StringOf("inputDataConfig[i].dataSource.s3DataSource.s3Uri")
i = i + 1
End While
' A sample JSON response body parsed by the above code:
' {
' "algorithmSpecification": {
' "containerImage": {
' "uri": "string"
' },
' "scriptModeConfig": {
' "compressionType": "string",
' "entryPoint": "string",
' "s3Uri": "string"
' }
' },
' "billableDuration": number,
' "checkpointConfig": {
' "localPath": "string",
' "s3Uri": "string"
' },
' "createdAt": number,
' "deviceConfig": {
' "device": "string"
' },
' "endedAt": number,
' "events": [
' {
' "eventType": "string",
' "message": "string",
' "timeOfEvent": number
' }
' ],
' "failureReason": "string",
' "hyperParameters": {
' "string": "string"
' },
' "inputDataConfig": [
' {
' "channelName": "string",
' "contentType": "string",
' "dataSource": {
' "s3DataSource": {
' "s3Uri": "string"
' }
' }
' }
' ],
' "instanceConfig": {
' "instanceCount": number,
' "instanceType": "string",
' "volumeSizeInGb": number
' },
' "jobArn": "string",
' "jobName": "string",
' "outputDataConfig": {
' "kmsKeyId": "string",
' "s3Path": "string"
' },
' "roleArn": "string",
' "startedAt": number,
' "status": "string",
' "stoppingCondition": {
' "maxRuntimeInSeconds": number
' },
' "tags": {
' "string": "string"
' }
' }