DeleteApp Foxpro Example
LOCAL loRest
LOCAL lnSuccess
LOCAL loAuthAws
LOCAL loSbResponseBody
LOCAL lnRespStatusCode
LOCAL loJResp
LOCAL lcStrVal
LOCAL lcCondition
LOCAL lcSource
LOCAL lcStatus
LOCAL lcTarget
LOCAL lcAppArn
LOCAL lcAppId
LOCAL lcBasicAuthCredentials
LOCAL lcBuildSpec
LOCAL lnEnableAutoBuild
LOCAL lnEnableBasicAuth
LOCAL lnEnablePerformanceMode
LOCAL lnEnablePullRequestPreview
LOCAL lcV_String
LOCAL lcFramework
LOCAL lcPullRequestEnvironmentName
LOCAL lcStage
LOCAL lcAppBasicAuthCredentials
LOCAL lcAppBuildSpec
LOCAL lnCreateTime
LOCAL lcCustomHeaders
LOCAL lcDefaultDomain
LOCAL lcDescription
LOCAL lnEnableAutoBranchCreation
LOCAL lnAppEnableBasicAuth
LOCAL lnEnableBranchAutoBuild
LOCAL lnEnableBranchAutoDeletion
LOCAL lcEnvironmentVariablesString
LOCAL lcIamServiceRoleArn
LOCAL lcName
LOCAL lcPlatform
LOCAL lcBranchName
LOCAL lnLastDeployTime
LOCAL lcStatus
LOCAL lcThumbnailUrl
LOCAL lcRepository
LOCAL lcRepositoryCloneMethod
LOCAL lcTagsString
LOCAL lnUpdateTime
LOCAL i
LOCAL lnCount_i
* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
loRest = CreateObject('Chilkat_9_5_0.Rest')
loAuthAws = CreateObject('Chilkat_9_5_0.AuthAws')
loAuthAws.AccessKey = "AWS_ACCESS_KEY"
loAuthAws.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.)
loAuthAws.Region = "us-west-2"
loAuthAws.ServiceName = "amplify"
* SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
loRest.SetAuthAws(loAuthAws)
* URL: https://amplify.us-west-2.amazonaws.com/
* Use the same region as specified above.
lnSuccess = loRest.Connect("amplify.us-west-2.amazonaws.com",443,1,1)
IF (lnSuccess <> 1) THEN
? "ConnectFailReason: " + STR(loRest.ConnectFailReason)
? loRest.LastErrorText
RELEASE loRest
RELEASE loAuthAws
CANCEL
ENDIF
loRest.AddHeader("Content-Type","application/x-amz-json-1.1")
loRest.AddHeader("X-Amz-Target","DeleteApp")
loSbResponseBody = CreateObject('Chilkat_9_5_0.StringBuilder')
lnSuccess = loRest.FullRequestNoBodySb("DELETE","/apps/{appId}",loSbResponseBody)
IF (lnSuccess <> 1) THEN
? loRest.LastErrorText
RELEASE loRest
RELEASE loAuthAws
RELEASE loSbResponseBody
CANCEL
ENDIF
lnRespStatusCode = loRest.ResponseStatusCode
? "response status code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode <> 200) THEN
? "Response Header:"
? loRest.ResponseHeader
? "Response Body:"
? loSbResponseBody.GetAsString()
RELEASE loRest
RELEASE loAuthAws
RELEASE loSbResponseBody
CANCEL
ENDIF
loJResp = CreateObject('Chilkat_9_5_0.JsonObject')
loJResp.LoadSb(loSbResponseBody)
* 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
lcAppArn = loJResp.StringOf("app.appArn")
lcAppId = loJResp.StringOf("app.appId")
lcBasicAuthCredentials = loJResp.StringOf("app.autoBranchCreationConfig.basicAuthCredentials")
lcBuildSpec = loJResp.StringOf("app.autoBranchCreationConfig.buildSpec")
lnEnableAutoBuild = loJResp.IntOf("app.autoBranchCreationConfig.enableAutoBuild")
lnEnableBasicAuth = loJResp.IntOf("app.autoBranchCreationConfig.enableBasicAuth")
lnEnablePerformanceMode = loJResp.IntOf("app.autoBranchCreationConfig.enablePerformanceMode")
lnEnablePullRequestPreview = loJResp.IntOf("app.autoBranchCreationConfig.enablePullRequestPreview")
lcV_String = loJResp.StringOf("app.autoBranchCreationConfig.environmentVariables.string")
lcFramework = loJResp.StringOf("app.autoBranchCreationConfig.framework")
lcPullRequestEnvironmentName = loJResp.StringOf("app.autoBranchCreationConfig.pullRequestEnvironmentName")
lcStage = loJResp.StringOf("app.autoBranchCreationConfig.stage")
lcAppBasicAuthCredentials = loJResp.StringOf("app.basicAuthCredentials")
lcAppBuildSpec = loJResp.StringOf("app.buildSpec")
lnCreateTime = loJResp.IntOf("app.createTime")
lcCustomHeaders = loJResp.StringOf("app.customHeaders")
lcDefaultDomain = loJResp.StringOf("app.defaultDomain")
lcDescription = loJResp.StringOf("app.description")
lnEnableAutoBranchCreation = loJResp.IntOf("app.enableAutoBranchCreation")
lnAppEnableBasicAuth = loJResp.IntOf("app.enableBasicAuth")
lnEnableBranchAutoBuild = loJResp.IntOf("app.enableBranchAutoBuild")
lnEnableBranchAutoDeletion = loJResp.IntOf("app.enableBranchAutoDeletion")
lcEnvironmentVariablesString = loJResp.StringOf("app.environmentVariables.string")
lcIamServiceRoleArn = loJResp.StringOf("app.iamServiceRoleArn")
lcName = loJResp.StringOf("app.name")
lcPlatform = loJResp.StringOf("app.platform")
lcBranchName = loJResp.StringOf("app.productionBranch.branchName")
lnLastDeployTime = loJResp.IntOf("app.productionBranch.lastDeployTime")
lcStatus = loJResp.StringOf("app.productionBranch.status")
lcThumbnailUrl = loJResp.StringOf("app.productionBranch.thumbnailUrl")
lcRepository = loJResp.StringOf("app.repository")
lcRepositoryCloneMethod = loJResp.StringOf("app.repositoryCloneMethod")
lcTagsString = loJResp.StringOf("app.tags.string")
lnUpdateTime = loJResp.IntOf("app.updateTime")
i = 0
lnCount_i = loJResp.SizeOfArray("app.autoBranchCreationPatterns")
DO WHILE i < lnCount_i
loJResp.I = i
lcStrVal = loJResp.StringOf("app.autoBranchCreationPatterns[i]")
i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("app.customRules")
DO WHILE i < lnCount_i
loJResp.I = i
lcCondition = loJResp.StringOf("app.customRules[i].condition")
lcSource = loJResp.StringOf("app.customRules[i].source")
lcStatus = loJResp.StringOf("app.customRules[i].status")
lcTarget = loJResp.StringOf("app.customRules[i].target")
i = i + 1
ENDDO
* 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
* }
* }
RELEASE loRest
RELEASE loAuthAws
RELEASE loSbResponseBody
RELEASE loJResp