Chilkat Online Tools

GetMilestone VB.NET Example

AWS Well-Architected Tool

' 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 = "wellarchitected"
' SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
rest.SetAuthAws(authAws)

' URL: https://wellarchitected.us-west-2.amazonaws.com/
' Use the same region as specified above.
success = rest.Connect("wellarchitected.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","GetMilestone")

Dim sbResponseBody As New Chilkat.StringBuilder
success = rest.FullRequestNoBodySb("GET","/workloads/{WorkloadId}/milestones/{MilestoneNumber}",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 strVal As String

Dim MilestoneName As String = jResp.StringOf("Milestone.MilestoneName")
Dim MilestoneNumber As Integer = jResp.IntOf("Milestone.MilestoneNumber")
Dim RecordedAt As Integer = jResp.IntOf("Milestone.RecordedAt")
Dim ArchitecturalDesign As String = jResp.StringOf("Milestone.Workload.ArchitecturalDesign")
Dim Description As String = jResp.StringOf("Milestone.Workload.Description")
Dim Environment As String = jResp.StringOf("Milestone.Workload.Environment")
Dim ImprovementStatus As String = jResp.StringOf("Milestone.Workload.ImprovementStatus")
Dim Industry As String = jResp.StringOf("Milestone.Workload.Industry")
Dim IndustryType As String = jResp.StringOf("Milestone.Workload.IndustryType")
Dim IsReviewOwnerUpdateAcknowledged As Integer = jResp.IntOf("Milestone.Workload.IsReviewOwnerUpdateAcknowledged")
Dim Notes As String = jResp.StringOf("Milestone.Workload.Notes")
Dim Owner As String = jResp.StringOf("Milestone.Workload.Owner")
Dim ReviewOwner As String = jResp.StringOf("Milestone.Workload.ReviewOwner")
Dim ReviewRestrictionDate As Integer = jResp.IntOf("Milestone.Workload.ReviewRestrictionDate")
Dim v_String As Integer = jResp.IntOf("Milestone.Workload.RiskCounts.string")
Dim ShareInvitationId As String = jResp.StringOf("Milestone.Workload.ShareInvitationId")
Dim TagsString As String = jResp.StringOf("Milestone.Workload.Tags.string")
Dim UpdatedAt As Integer = jResp.IntOf("Milestone.Workload.UpdatedAt")
Dim WorkloadArn As String = jResp.StringOf("Milestone.Workload.WorkloadArn")
Dim WorkloadId As String = jResp.StringOf("Milestone.Workload.WorkloadId")
Dim WorkloadName As String = jResp.StringOf("Milestone.Workload.WorkloadName")
WorkloadId = jResp.StringOf("WorkloadId")
Dim i As Integer = 0
Dim count_i As Integer = jResp.SizeOfArray("Milestone.Workload.AccountIds")
While i < count_i
    jResp.I = i
    strVal = jResp.StringOf("Milestone.Workload.AccountIds[i]")
    i = i + 1
End While
i = 0
count_i = jResp.SizeOfArray("Milestone.Workload.AwsRegions")
While i < count_i
    jResp.I = i
    strVal = jResp.StringOf("Milestone.Workload.AwsRegions[i]")
    i = i + 1
End While
i = 0
count_i = jResp.SizeOfArray("Milestone.Workload.Lenses")
While i < count_i
    jResp.I = i
    strVal = jResp.StringOf("Milestone.Workload.Lenses[i]")
    i = i + 1
End While
i = 0
count_i = jResp.SizeOfArray("Milestone.Workload.NonAwsRegions")
While i < count_i
    jResp.I = i
    strVal = jResp.StringOf("Milestone.Workload.NonAwsRegions[i]")
    i = i + 1
End While
i = 0
count_i = jResp.SizeOfArray("Milestone.Workload.PillarPriorities")
While i < count_i
    jResp.I = i
    strVal = jResp.StringOf("Milestone.Workload.PillarPriorities[i]")
    i = i + 1
End While


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

' {
'   "Milestone": {
'     "MilestoneName": "string",
'     "MilestoneNumber": number,
'     "RecordedAt": number,
'     "Workload": {
'       "AccountIds": [
'         "string"
'       ],
'       "ArchitecturalDesign": "string",
'       "AwsRegions": [
'         "string"
'       ],
'       "Description": "string",
'       "Environment": "string",
'       "ImprovementStatus": "string",
'       "Industry": "string",
'       "IndustryType": "string",
'       "IsReviewOwnerUpdateAcknowledged": boolean,
'       "Lenses": [
'         "string"
'       ],
'       "NonAwsRegions": [
'         "string"
'       ],
'       "Notes": "string",
'       "Owner": "string",
'       "PillarPriorities": [
'         "string"
'       ],
'       "ReviewOwner": "string",
'       "ReviewRestrictionDate": number,
'       "RiskCounts": {
'         "string": number
'       },
'       "ShareInvitationId": "string",
'       "Tags": {
'         "string": "string"
'       },
'       "UpdatedAt": number,
'       "WorkloadArn": "string",
'       "WorkloadId": "string",
'       "WorkloadName": "string"
'     }
'   },
'   "WorkloadId": "string"
' }