Chilkat Online Tools

DeleteApp VB6 Example

Amplify

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

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

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

Dim sbResponseBody As New ChilkatStringBuilder
success = rest.FullRequestNoBodySb("DELETE","/apps/{appId}",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 strVal As String
Dim condition As String
Dim source As String
Dim status As String
Dim target As String

Dim AppArn As String
AppArn = jResp.StringOf("app.appArn")
Dim AppId As String
AppId = jResp.StringOf("app.appId")
Dim BasicAuthCredentials As String
BasicAuthCredentials = jResp.StringOf("app.autoBranchCreationConfig.basicAuthCredentials")
Dim BuildSpec As String
BuildSpec = jResp.StringOf("app.autoBranchCreationConfig.buildSpec")
Dim EnableAutoBuild As Long
EnableAutoBuild = jResp.IntOf("app.autoBranchCreationConfig.enableAutoBuild")
Dim EnableBasicAuth As Long
EnableBasicAuth = jResp.IntOf("app.autoBranchCreationConfig.enableBasicAuth")
Dim EnablePerformanceMode As Long
EnablePerformanceMode = jResp.IntOf("app.autoBranchCreationConfig.enablePerformanceMode")
Dim EnablePullRequestPreview As Long
EnablePullRequestPreview = jResp.IntOf("app.autoBranchCreationConfig.enablePullRequestPreview")
Dim v_String As String
v_String = jResp.StringOf("app.autoBranchCreationConfig.environmentVariables.string")
Dim Framework As String
Framework = jResp.StringOf("app.autoBranchCreationConfig.framework")
Dim PullRequestEnvironmentName As String
PullRequestEnvironmentName = jResp.StringOf("app.autoBranchCreationConfig.pullRequestEnvironmentName")
Dim Stage As String
Stage = jResp.StringOf("app.autoBranchCreationConfig.stage")
Dim appBasicAuthCredentials As String
appBasicAuthCredentials = jResp.StringOf("app.basicAuthCredentials")
Dim appBuildSpec As String
appBuildSpec = jResp.StringOf("app.buildSpec")
Dim CreateTime As Long
CreateTime = jResp.IntOf("app.createTime")
Dim CustomHeaders As String
CustomHeaders = jResp.StringOf("app.customHeaders")
Dim DefaultDomain As String
DefaultDomain = jResp.StringOf("app.defaultDomain")
Dim Description As String
Description = jResp.StringOf("app.description")
Dim EnableAutoBranchCreation As Long
EnableAutoBranchCreation = jResp.IntOf("app.enableAutoBranchCreation")
Dim appEnableBasicAuth As Long
appEnableBasicAuth = jResp.IntOf("app.enableBasicAuth")
Dim EnableBranchAutoBuild As Long
EnableBranchAutoBuild = jResp.IntOf("app.enableBranchAutoBuild")
Dim EnableBranchAutoDeletion As Long
EnableBranchAutoDeletion = jResp.IntOf("app.enableBranchAutoDeletion")
Dim EnvironmentVariablesString As String
EnvironmentVariablesString = jResp.StringOf("app.environmentVariables.string")
Dim IamServiceRoleArn As String
IamServiceRoleArn = jResp.StringOf("app.iamServiceRoleArn")
Dim Name As String
Name = jResp.StringOf("app.name")
Dim Platform As String
Platform = jResp.StringOf("app.platform")
Dim BranchName As String
BranchName = jResp.StringOf("app.productionBranch.branchName")
Dim LastDeployTime As Long
LastDeployTime = jResp.IntOf("app.productionBranch.lastDeployTime")
Dim Status As String
Status = jResp.StringOf("app.productionBranch.status")
Dim ThumbnailUrl As String
ThumbnailUrl = jResp.StringOf("app.productionBranch.thumbnailUrl")
Dim Repository As String
Repository = jResp.StringOf("app.repository")
Dim RepositoryCloneMethod As String
RepositoryCloneMethod = jResp.StringOf("app.repositoryCloneMethod")
Dim TagsString As String
TagsString = jResp.StringOf("app.tags.string")
Dim UpdateTime As Long
UpdateTime = jResp.IntOf("app.updateTime")
Dim i As Long
i = 0
Dim count_i As Long
count_i = jResp.SizeOfArray("app.autoBranchCreationPatterns")
Do While i < count_i
    jResp.I = i
    strVal = jResp.StringOf("app.autoBranchCreationPatterns[i]")
    i = i + 1
Loop
i = 0
count_i = jResp.SizeOfArray("app.customRules")
Do While i < count_i
    jResp.I = i
    condition = jResp.StringOf("app.customRules[i].condition")
    source = jResp.StringOf("app.customRules[i].source")
    status = jResp.StringOf("app.customRules[i].status")
    target = jResp.StringOf("app.customRules[i].target")
    i = i + 1
Loop

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

' {
'   "app": {
'     "appArn": "string",
'     "appId": "string",
'     "autoBranchCreationConfig": {
'       "basicAuthCredentials": "string",
'       "buildSpec": "string",
'       "enableAutoBuild": boolean,
'       "enableBasicAuth": boolean,
'       "enablePerformanceMode": boolean,
'       "enablePullRequestPreview": boolean,
'       "environmentVariables": {
'         "string": "string"
'       },
'       "framework": "string",
'       "pullRequestEnvironmentName": "string",
'       "stage": "string"
'     },
'     "autoBranchCreationPatterns": [
'       "string"
'     ],
'     "basicAuthCredentials": "string",
'     "buildSpec": "string",
'     "createTime": number,
'     "customHeaders": "string",
'     "customRules": [
'       {
'         "condition": "string",
'         "source": "string",
'         "status": "string",
'         "target": "string"
'       }
'     ],
'     "defaultDomain": "string",
'     "description": "string",
'     "enableAutoBranchCreation": boolean,
'     "enableBasicAuth": boolean,
'     "enableBranchAutoBuild": boolean,
'     "enableBranchAutoDeletion": boolean,
'     "environmentVariables": {
'       "string": "string"
'     },
'     "iamServiceRoleArn": "string",
'     "name": "string",
'     "platform": "string",
'     "productionBranch": {
'       "branchName": "string",
'       "lastDeployTime": number,
'       "status": "string",
'       "thumbnailUrl": "string"
'     },
'     "repository": "string",
'     "repositoryCloneMethod": "string",
'     "tags": {
'       "string": "string"
'     },
'     "updateTime": number
'   }
' }