Chilkat Online Tools

BatchGetProjects VB6 Example

AWS CodeBuild

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

Dim rest As New ChilkatRest
Dim success As Long

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

' URL: https://codebuild.us-west-2.amazonaws.com/
' Use the same region as specified above.
success = rest.Connect("codebuild.us-west-2.amazonaws.com",443,1,1)
If (success <> 1) Then
    Debug.Print "ConnectFailReason: " & rest.ConnectFailReason
    Debug.Print rest.LastErrorText
    Exit Sub
End If

' 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

Dim json As New ChilkatJsonObject
success = json.UpdateString("names[0]","string")

' The JSON request body created by the above code:

' {
'   "names": [
'     "string"
'   ]
' }

success = rest.AddHeader("Content-Type","application/x-amz-json-1.1")
success = rest.AddHeader("X-Amz-Target","CodeBuild_20161006.BatchGetProjects")

Dim sbRequestBody As New ChilkatStringBuilder
success = json.EmitSb(sbRequestBody)
Dim sbResponseBody As New ChilkatStringBuilder
success = rest.FullRequestSb("POST","/",sbRequestBody,sbResponseBody)
If (success <> 1) Then
    Debug.Print rest.LastErrorText
    Exit Sub
End If

Dim respStatusCode As Long
respStatusCode = rest.ResponseStatusCode
Debug.Print "response status code = " & respStatusCode
If (respStatusCode <> 200) Then
    Debug.Print "Response Header:"
    Debug.Print rest.ResponseHeader
    Debug.Print "Response Body:"
    Debug.Print sbResponseBody.GetAsString()
    Exit Sub
End If

Dim jResp As New ChilkatJsonObject
success = 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 arn As String
Dim ArtifactIdentifier As String
Dim BucketOwnerAccess As String
Dim EncryptionDisabled As Long
Dim Location As String
Dim Name As String
Dim NamespaceType As String
Dim OverrideArtifactName As Long
Dim Packaging As String
Dim Path As String
Dim v_Type As String
Dim BadgeEnabled As Long
Dim BadgeRequestUrl As String
Dim BatchReportMode As String
Dim CombineArtifacts As Long
Dim MaximumBuildsAllowed As Long
Dim ServiceRole As String
Dim TimeoutInMins As Long
Dim cacheLocation As String
Dim cacheType As String
Dim concurrentBuildLimit As Long
Dim created As Long
Dim description As String
Dim encryptionKey As String
Dim Certificate As String
Dim ComputeType As String
Dim Image As String
Dim ImagePullCredentialsType As String
Dim PrivilegedMode As Long
Dim Credential As String
Dim CredentialProvider As String
Dim environmentType As String
Dim lastModified As Long
Dim GroupName As String
Dim Status As String
Dim StreamName As String
Dim S3LogsBucketOwnerAccess As String
Dim S3LogsEncryptionDisabled As Long
Dim S3LogsLocation As String
Dim S3LogsStatus As String
Dim name As String
Dim projectVisibility As String
Dim publicProjectAlias As String
Dim queuedTimeoutInMinutes As Long
Dim resourceAccessRole As String
Dim serviceRole As String
Dim Resource As String
Dim AuthType As String
Dim Buildspec As String
Dim Context As String
Dim TargetUrl As String
Dim GitCloneDepth As Long
Dim FetchSubmodules As Long
Dim InsecureSsl As Long
Dim sourceLocation As String
Dim ReportBuildStatus As Long
Dim SourceIdentifier As String
Dim sourceType As String
Dim sourceVersion As String
Dim timeoutInMinutes As Long
Dim VpcId As String
Dim BranchFilter As String
Dim BuildType As String
Dim LastModifiedSecret As Long
Dim PayloadUrl As String
Dim Secret As String
Dim v_Url As String
Dim j As Long
Dim count_j As Long
Dim strVal As String
Dim v_type As String
Dim value As String
Dim identifier As String
Dim location As String
Dim mountOptions As String
Dim mountPoint As String
Dim artifactIdentifier As String
Dim bucketOwnerAccess As String
Dim encryptionDisabled As Long
Dim namespaceType As String
Dim overrideArtifactName As Long
Dim packaging As String
Dim path As String
Dim authResource As String
Dim authType As String
Dim buildspec As String
Dim buildStatusConfigContext As String
Dim buildStatusConfigTargetUrl As String
Dim gitCloneDepth As Long
Dim gitSubmodulesConfigFetchSubmodules As Long
Dim insecureSsl As Long
Dim reportBuildStatus As Long
Dim sourceIdentifier As String
Dim key As String
Dim k As Long
Dim count_k As Long
Dim excludeMatchedPattern As Long
Dim pattern As String

Dim i As Long
i = 0
Dim count_i As Long
count_i = jResp.SizeOfArray("projects")
Do While i < count_i
    jResp.I = i
    arn = jResp.StringOf("projects[i].arn")
    ArtifactIdentifier = jResp.StringOf("projects[i].artifacts.artifactIdentifier")
    BucketOwnerAccess = jResp.StringOf("projects[i].artifacts.bucketOwnerAccess")
    EncryptionDisabled = jResp.IntOf("projects[i].artifacts.encryptionDisabled")
    Location = jResp.StringOf("projects[i].artifacts.location")
    Name = jResp.StringOf("projects[i].artifacts.name")
    NamespaceType = jResp.StringOf("projects[i].artifacts.namespaceType")
    OverrideArtifactName = jResp.IntOf("projects[i].artifacts.overrideArtifactName")
    Packaging = jResp.StringOf("projects[i].artifacts.packaging")
    Path = jResp.StringOf("projects[i].artifacts.path")
    v_Type = jResp.StringOf("projects[i].artifacts.type")
    BadgeEnabled = jResp.IntOf("projects[i].badge.badgeEnabled")
    BadgeRequestUrl = jResp.StringOf("projects[i].badge.badgeRequestUrl")
    BatchReportMode = jResp.StringOf("projects[i].buildBatchConfig.batchReportMode")
    CombineArtifacts = jResp.IntOf("projects[i].buildBatchConfig.combineArtifacts")
    MaximumBuildsAllowed = jResp.IntOf("projects[i].buildBatchConfig.restrictions.maximumBuildsAllowed")
    ServiceRole = jResp.StringOf("projects[i].buildBatchConfig.serviceRole")
    TimeoutInMins = jResp.IntOf("projects[i].buildBatchConfig.timeoutInMins")
    cacheLocation = jResp.StringOf("projects[i].cache.location")
    cacheType = jResp.StringOf("projects[i].cache.type")
    concurrentBuildLimit = jResp.IntOf("projects[i].concurrentBuildLimit")
    created = jResp.IntOf("projects[i].created")
    description = jResp.StringOf("projects[i].description")
    encryptionKey = jResp.StringOf("projects[i].encryptionKey")
    Certificate = jResp.StringOf("projects[i].environment.certificate")
    ComputeType = jResp.StringOf("projects[i].environment.computeType")
    Image = jResp.StringOf("projects[i].environment.image")
    ImagePullCredentialsType = jResp.StringOf("projects[i].environment.imagePullCredentialsType")
    PrivilegedMode = jResp.IntOf("projects[i].environment.privilegedMode")
    Credential = jResp.StringOf("projects[i].environment.registryCredential.credential")
    CredentialProvider = jResp.StringOf("projects[i].environment.registryCredential.credentialProvider")
    environmentType = jResp.StringOf("projects[i].environment.type")
    lastModified = jResp.IntOf("projects[i].lastModified")
    GroupName = jResp.StringOf("projects[i].logsConfig.cloudWatchLogs.groupName")
    Status = jResp.StringOf("projects[i].logsConfig.cloudWatchLogs.status")
    StreamName = jResp.StringOf("projects[i].logsConfig.cloudWatchLogs.streamName")
    S3LogsBucketOwnerAccess = jResp.StringOf("projects[i].logsConfig.s3Logs.bucketOwnerAccess")
    S3LogsEncryptionDisabled = jResp.IntOf("projects[i].logsConfig.s3Logs.encryptionDisabled")
    S3LogsLocation = jResp.StringOf("projects[i].logsConfig.s3Logs.location")
    S3LogsStatus = jResp.StringOf("projects[i].logsConfig.s3Logs.status")
    name = jResp.StringOf("projects[i].name")
    projectVisibility = jResp.StringOf("projects[i].projectVisibility")
    publicProjectAlias = jResp.StringOf("projects[i].publicProjectAlias")
    queuedTimeoutInMinutes = jResp.IntOf("projects[i].queuedTimeoutInMinutes")
    resourceAccessRole = jResp.StringOf("projects[i].resourceAccessRole")
    serviceRole = jResp.StringOf("projects[i].serviceRole")
    Resource = jResp.StringOf("projects[i].source.auth.resource")
    AuthType = jResp.StringOf("projects[i].source.auth.type")
    Buildspec = jResp.StringOf("projects[i].source.buildspec")
    Context = jResp.StringOf("projects[i].source.buildStatusConfig.context")
    TargetUrl = jResp.StringOf("projects[i].source.buildStatusConfig.targetUrl")
    GitCloneDepth = jResp.IntOf("projects[i].source.gitCloneDepth")
    FetchSubmodules = jResp.IntOf("projects[i].source.gitSubmodulesConfig.fetchSubmodules")
    InsecureSsl = jResp.IntOf("projects[i].source.insecureSsl")
    sourceLocation = jResp.StringOf("projects[i].source.location")
    ReportBuildStatus = jResp.IntOf("projects[i].source.reportBuildStatus")
    SourceIdentifier = jResp.StringOf("projects[i].source.sourceIdentifier")
    sourceType = jResp.StringOf("projects[i].source.type")
    sourceVersion = jResp.StringOf("projects[i].sourceVersion")
    timeoutInMinutes = jResp.IntOf("projects[i].timeoutInMinutes")
    VpcId = jResp.StringOf("projects[i].vpcConfig.vpcId")
    BranchFilter = jResp.StringOf("projects[i].webhook.branchFilter")
    BuildType = jResp.StringOf("projects[i].webhook.buildType")
    LastModifiedSecret = jResp.IntOf("projects[i].webhook.lastModifiedSecret")
    PayloadUrl = jResp.StringOf("projects[i].webhook.payloadUrl")
    Secret = jResp.StringOf("projects[i].webhook.secret")
    v_Url = jResp.StringOf("projects[i].webhook.url")
    j = 0
    count_j = jResp.SizeOfArray("projects[i].buildBatchConfig.restrictions.computeTypesAllowed")
    Do While j < count_j
        jResp.J = j
        strVal = jResp.StringOf("projects[i].buildBatchConfig.restrictions.computeTypesAllowed[j]")
        j = j + 1
    Loop
    j = 0
    count_j = jResp.SizeOfArray("projects[i].cache.modes")
    Do While j < count_j
        jResp.J = j
        strVal = jResp.StringOf("projects[i].cache.modes[j]")
        j = j + 1
    Loop
    j = 0
    count_j = jResp.SizeOfArray("projects[i].environment.environmentVariables")
    Do While j < count_j
        jResp.J = j
        name = jResp.StringOf("projects[i].environment.environmentVariables[j].name")
        v_type = jResp.StringOf("projects[i].environment.environmentVariables[j].type")
        value = jResp.StringOf("projects[i].environment.environmentVariables[j].value")
        j = j + 1
    Loop
    j = 0
    count_j = jResp.SizeOfArray("projects[i].fileSystemLocations")
    Do While j < count_j
        jResp.J = j
        identifier = jResp.StringOf("projects[i].fileSystemLocations[j].identifier")
        location = jResp.StringOf("projects[i].fileSystemLocations[j].location")
        mountOptions = jResp.StringOf("projects[i].fileSystemLocations[j].mountOptions")
        mountPoint = jResp.StringOf("projects[i].fileSystemLocations[j].mountPoint")
        v_type = jResp.StringOf("projects[i].fileSystemLocations[j].type")
        j = j + 1
    Loop
    j = 0
    count_j = jResp.SizeOfArray("projects[i].secondaryArtifacts")
    Do While j < count_j
        jResp.J = j
        artifactIdentifier = jResp.StringOf("projects[i].secondaryArtifacts[j].artifactIdentifier")
        bucketOwnerAccess = jResp.StringOf("projects[i].secondaryArtifacts[j].bucketOwnerAccess")
        encryptionDisabled = jResp.IntOf("projects[i].secondaryArtifacts[j].encryptionDisabled")
        location = jResp.StringOf("projects[i].secondaryArtifacts[j].location")
        name = jResp.StringOf("projects[i].secondaryArtifacts[j].name")
        namespaceType = jResp.StringOf("projects[i].secondaryArtifacts[j].namespaceType")
        overrideArtifactName = jResp.IntOf("projects[i].secondaryArtifacts[j].overrideArtifactName")
        packaging = jResp.StringOf("projects[i].secondaryArtifacts[j].packaging")
        path = jResp.StringOf("projects[i].secondaryArtifacts[j].path")
        v_type = jResp.StringOf("projects[i].secondaryArtifacts[j].type")
        j = j + 1
    Loop
    j = 0
    count_j = jResp.SizeOfArray("projects[i].secondarySources")
    Do While j < count_j
        jResp.J = j
        authResource = jResp.StringOf("projects[i].secondarySources[j].auth.resource")
        authType = jResp.StringOf("projects[i].secondarySources[j].auth.type")
        buildspec = jResp.StringOf("projects[i].secondarySources[j].buildspec")
        buildStatusConfigContext = jResp.StringOf("projects[i].secondarySources[j].buildStatusConfig.context")
        buildStatusConfigTargetUrl = jResp.StringOf("projects[i].secondarySources[j].buildStatusConfig.targetUrl")
        gitCloneDepth = jResp.IntOf("projects[i].secondarySources[j].gitCloneDepth")
        gitSubmodulesConfigFetchSubmodules = jResp.IntOf("projects[i].secondarySources[j].gitSubmodulesConfig.fetchSubmodules")
        insecureSsl = jResp.IntOf("projects[i].secondarySources[j].insecureSsl")
        location = jResp.StringOf("projects[i].secondarySources[j].location")
        reportBuildStatus = jResp.IntOf("projects[i].secondarySources[j].reportBuildStatus")
        sourceIdentifier = jResp.StringOf("projects[i].secondarySources[j].sourceIdentifier")
        v_type = jResp.StringOf("projects[i].secondarySources[j].type")
        j = j + 1
    Loop
    j = 0
    count_j = jResp.SizeOfArray("projects[i].secondarySourceVersions")
    Do While j < count_j
        jResp.J = j
        sourceIdentifier = jResp.StringOf("projects[i].secondarySourceVersions[j].sourceIdentifier")
        sourceVersion = jResp.StringOf("projects[i].secondarySourceVersions[j].sourceVersion")
        j = j + 1
    Loop
    j = 0
    count_j = jResp.SizeOfArray("projects[i].tags")
    Do While j < count_j
        jResp.J = j
        key = jResp.StringOf("projects[i].tags[j].key")
        value = jResp.StringOf("projects[i].tags[j].value")
        j = j + 1
    Loop
    j = 0
    count_j = jResp.SizeOfArray("projects[i].vpcConfig.securityGroupIds")
    Do While j < count_j
        jResp.J = j
        strVal = jResp.StringOf("projects[i].vpcConfig.securityGroupIds[j]")
        j = j + 1
    Loop
    j = 0
    count_j = jResp.SizeOfArray("projects[i].vpcConfig.subnets")
    Do While j < count_j
        jResp.J = j
        strVal = jResp.StringOf("projects[i].vpcConfig.subnets[j]")
        j = j + 1
    Loop
    j = 0
    count_j = jResp.SizeOfArray("projects[i].webhook.filterGroups")
    Do While j < count_j
        jResp.J = j
        k = 0
        count_k = jResp.SizeOfArray("projects[i].webhook.filterGroups[j]")
        Do While k < count_k
            jResp.K = k
            excludeMatchedPattern = jResp.IntOf("projects[i].webhook.filterGroups[j][k].excludeMatchedPattern")
            pattern = jResp.StringOf("projects[i].webhook.filterGroups[j][k].pattern")
            v_type = jResp.StringOf("projects[i].webhook.filterGroups[j][k].type")
            k = k + 1
        Loop
        j = j + 1
    Loop
    i = i + 1
Loop
i = 0
count_i = jResp.SizeOfArray("projectsNotFound")
Do While i < count_i
    jResp.I = i
    strVal = jResp.StringOf("projectsNotFound[i]")
    i = i + 1
Loop

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

' {
'   "projects": [
'     {
'       "arn": "string",
'       "artifacts": {
'         "artifactIdentifier": "string",
'         "bucketOwnerAccess": "string",
'         "encryptionDisabled": boolean,
'         "location": "string",
'         "name": "string",
'         "namespaceType": "string",
'         "overrideArtifactName": boolean,
'         "packaging": "string",
'         "path": "string",
'         "type": "string"
'       },
'       "badge": {
'         "badgeEnabled": boolean,
'         "badgeRequestUrl": "string"
'       },
'       "buildBatchConfig": {
'         "batchReportMode": "string",
'         "combineArtifacts": boolean,
'         "restrictions": {
'           "computeTypesAllowed": [
'             "string"
'           ],
'           "maximumBuildsAllowed": number
'         },
'         "serviceRole": "string",
'         "timeoutInMins": number
'       },
'       "cache": {
'         "location": "string",
'         "modes": [
'           "string"
'         ],
'         "type": "string"
'       },
'       "concurrentBuildLimit": number,
'       "created": number,
'       "description": "string",
'       "encryptionKey": "string",
'       "environment": {
'         "certificate": "string",
'         "computeType": "string",
'         "environmentVariables": [
'           {
'             "name": "string",
'             "type": "string",
'             "value": "string"
'           }
'         ],
'         "image": "string",
'         "imagePullCredentialsType": "string",
'         "privilegedMode": boolean,
'         "registryCredential": {
'           "credential": "string",
'           "credentialProvider": "string"
'         },
'         "type": "string"
'       },
'       "fileSystemLocations": [
'         {
'           "identifier": "string",
'           "location": "string",
'           "mountOptions": "string",
'           "mountPoint": "string",
'           "type": "string"
'         }
'       ],
'       "lastModified": number,
'       "logsConfig": {
'         "cloudWatchLogs": {
'           "groupName": "string",
'           "status": "string",
'           "streamName": "string"
'         },
'         "s3Logs": {
'           "bucketOwnerAccess": "string",
'           "encryptionDisabled": boolean,
'           "location": "string",
'           "status": "string"
'         }
'       },
'       "name": "string",
'       "projectVisibility": "string",
'       "publicProjectAlias": "string",
'       "queuedTimeoutInMinutes": number,
'       "resourceAccessRole": "string",
'       "secondaryArtifacts": [
'         {
'           "artifactIdentifier": "string",
'           "bucketOwnerAccess": "string",
'           "encryptionDisabled": boolean,
'           "location": "string",
'           "name": "string",
'           "namespaceType": "string",
'           "overrideArtifactName": boolean,
'           "packaging": "string",
'           "path": "string",
'           "type": "string"
'         }
'       ],
'       "secondarySources": [
'         {
'           "auth": {
'             "resource": "string",
'             "type": "string"
'           },
'           "buildspec": "string",
'           "buildStatusConfig": {
'             "context": "string",
'             "targetUrl": "string"
'           },
'           "gitCloneDepth": number,
'           "gitSubmodulesConfig": {
'             "fetchSubmodules": boolean
'           },
'           "insecureSsl": boolean,
'           "location": "string",
'           "reportBuildStatus": boolean,
'           "sourceIdentifier": "string",
'           "type": "string"
'         }
'       ],
'       "secondarySourceVersions": [
'         {
'           "sourceIdentifier": "string",
'           "sourceVersion": "string"
'         }
'       ],
'       "serviceRole": "string",
'       "source": {
'         "auth": {
'           "resource": "string",
'           "type": "string"
'         },
'         "buildspec": "string",
'         "buildStatusConfig": {
'           "context": "string",
'           "targetUrl": "string"
'         },
'         "gitCloneDepth": number,
'         "gitSubmodulesConfig": {
'           "fetchSubmodules": boolean
'         },
'         "insecureSsl": boolean,
'         "location": "string",
'         "reportBuildStatus": boolean,
'         "sourceIdentifier": "string",
'         "type": "string"
'       },
'       "sourceVersion": "string",
'       "tags": [
'         {
'           "key": "string",
'           "value": "string"
'         }
'       ],
'       "timeoutInMinutes": number,
'       "vpcConfig": {
'         "securityGroupIds": [
'           "string"
'         ],
'         "subnets": [
'           "string"
'         ],
'         "vpcId": "string"
'       },
'       "webhook": {
'         "branchFilter": "string",
'         "buildType": "string",
'         "filterGroups": [
'           [
'             {
'               "excludeMatchedPattern": boolean,
'               "pattern": "string",
'               "type": "string"
'             }
'           ]
'         ],
'         "lastModifiedSecret": number,
'         "payloadUrl": "string",
'         "secret": "string",
'         "url": "string"
'       }
'     }
'   ],
'   "projectsNotFound": [
'     "string"
'   ]
' }