Chilkat Online Tools

GetApplicationComponentDetails autoit Example

Migration Hub Strategy Recommendations

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

$oRest = ObjCreate("Chilkat_9_5_0.Rest")
Local $bSuccess

$oAuthAws = ObjCreate("Chilkat_9_5_0.AuthAws")
$oAuthAws.AccessKey = "AWS_ACCESS_KEY"
$oAuthAws.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.)
$oAuthAws.Region = "us-west-2"
$oAuthAws.ServiceName = "migrationhub-strategy"
; SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
$oRest.SetAuthAws($oAuthAws)

; URL: https://migrationhub-strategy.us-west-2.amazonaws.com/
; Use the same region as specified above.
$bSuccess = $oRest.Connect("migrationhub-strategy.us-west-2.amazonaws.com",443,True,True)
If ($bSuccess <> True) Then
    ConsoleWrite("ConnectFailReason: " & $oRest.ConnectFailReason & @CRLF)
    ConsoleWrite($oRest.LastErrorText & @CRLF)
    Exit
EndIf

$oRest.AddHeader("Content-Type","application/x-amz-json-1.1")
$oRest.AddHeader("X-Amz-Target","GetApplicationComponentDetails")

$oSbResponseBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$bSuccess = $oRest.FullRequestNoBodySb("GET","/get-applicationcomponent-details/{applicationComponentId}",$oSbResponseBody)
If ($bSuccess <> True) Then
    ConsoleWrite($oRest.LastErrorText & @CRLF)
    Exit
EndIf

Local $iRespStatusCode = $oRest.ResponseStatusCode
ConsoleWrite("response status code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode <> 200) Then
    ConsoleWrite("Response Header:" & @CRLF)
    ConsoleWrite($oRest.ResponseHeader & @CRLF)
    ConsoleWrite("Response Body:" & @CRLF)
    ConsoleWrite($oSbResponseBody.GetAsString() & @CRLF)
    Exit
EndIf

$oJResp = ObjCreate("Chilkat_9_5_0.JsonObject")
$oJResp.LoadSb($oSbResponseBody)

; 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

Local $iCount
Local $severity
Local $sBranch
Local $sRepository
Local $sVersionControlType
Local $sId
Local $sName
Local $strVal

Local $sAnalysisStatus = $oJResp.StringOf("applicationComponentDetail.analysisStatus")
Local $sS3Bucket = $oJResp.StringOf("applicationComponentDetail.antipatternReportS3Object.s3Bucket")
Local $sS3key = $oJResp.StringOf("applicationComponentDetail.antipatternReportS3Object.s3key")
Local $sAntipatternReportStatus = $oJResp.StringOf("applicationComponentDetail.antipatternReportStatus")
Local $sAntipatternReportStatusMessage = $oJResp.StringOf("applicationComponentDetail.antipatternReportStatusMessage")
Local $sAppType = $oJResp.StringOf("applicationComponentDetail.appType")
Local $sAssociatedServerId = $oJResp.StringOf("applicationComponentDetail.associatedServerId")
Local $sSecretName = $oJResp.StringOf("applicationComponentDetail.databaseConfigDetail.secretName")
Local $sId = $oJResp.StringOf("applicationComponentDetail.id")
Local $sInclusionStatus = $oJResp.StringOf("applicationComponentDetail.inclusionStatus")
Local $iLastAnalyzedTimestamp = $oJResp.IntOf("applicationComponentDetail.lastAnalyzedTimestamp")
Local $iMoreServerAssociationExists = $oJResp.IntOf("applicationComponentDetail.moreServerAssociationExists")
Local $sName = $oJResp.StringOf("applicationComponentDetail.name")
Local $sOsDriver = $oJResp.StringOf("applicationComponentDetail.osDriver")
Local $sOsVersion = $oJResp.StringOf("applicationComponentDetail.osVersion")
Local $sStrategy = $oJResp.StringOf("applicationComponentDetail.recommendationSet.strategy")
Local $sTargetDestination = $oJResp.StringOf("applicationComponentDetail.recommendationSet.targetDestination")
Local $sDescription = $oJResp.StringOf("applicationComponentDetail.recommendationSet.transformationTool.description")
Local $sTransformationToolName = $oJResp.StringOf("applicationComponentDetail.recommendationSet.transformationTool.name")
Local $sTranformationToolInstallationLink = $oJResp.StringOf("applicationComponentDetail.recommendationSet.transformationTool.tranformationToolInstallationLink")
Local $sResourceSubType = $oJResp.StringOf("applicationComponentDetail.resourceSubType")
Local $sStatusMessage = $oJResp.StringOf("applicationComponentDetail.statusMessage")
Local $iMoreApplicationResource = $oJResp.IntOf("moreApplicationResource")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("applicationComponentDetail.listAntipatternSeveritySummary")
While $i < $iCount_i
    $oJResp.I = $i
    $iCount = $oJResp.IntOf("applicationComponentDetail.listAntipatternSeveritySummary[i].count")
    $severity = $oJResp.StringOf("applicationComponentDetail.listAntipatternSeveritySummary[i].severity")
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("applicationComponentDetail.sourceCodeRepositories")
While $i < $iCount_i
    $oJResp.I = $i
    $sBranch = $oJResp.StringOf("applicationComponentDetail.sourceCodeRepositories[i].branch")
    $sRepository = $oJResp.StringOf("applicationComponentDetail.sourceCodeRepositories[i].repository")
    $sVersionControlType = $oJResp.StringOf("applicationComponentDetail.sourceCodeRepositories[i].versionControlType")
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("associatedApplications")
While $i < $iCount_i
    $oJResp.I = $i
    $sId = $oJResp.StringOf("associatedApplications[i].id")
    $sName = $oJResp.StringOf("associatedApplications[i].name")
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("associatedServerIds")
While $i < $iCount_i
    $oJResp.I = $i
    $strVal = $oJResp.StringOf("associatedServerIds[i]")
    $i = $i + 1
Wend

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

; {
;   "applicationComponentDetail": {
;     "analysisStatus": "string",
;     "antipatternReportS3Object": {
;       "s3Bucket": "string",
;       "s3key": "string"
;     },
;     "antipatternReportStatus": "string",
;     "antipatternReportStatusMessage": "string",
;     "appType": "string",
;     "associatedServerId": "string",
;     "databaseConfigDetail": {
;       "secretName": "string"
;     },
;     "id": "string",
;     "inclusionStatus": "string",
;     "lastAnalyzedTimestamp": number,
;     "listAntipatternSeveritySummary": [
;       {
;         "count": number,
;         "severity": "string"
;       }
;     ],
;     "moreServerAssociationExists": boolean,
;     "name": "string",
;     "osDriver": "string",
;     "osVersion": "string",
;     "recommendationSet": {
;       "strategy": "string",
;       "targetDestination": "string",
;       "transformationTool": {
;         "description": "string",
;         "name": "string",
;         "tranformationToolInstallationLink": "string"
;       }
;     },
;     "resourceSubType": "string",
;     "sourceCodeRepositories": [
;       {
;         "branch": "string",
;         "repository": "string",
;         "versionControlType": "string"
;       }
;     ],
;     "statusMessage": "string"
;   },
;   "associatedApplications": [
;     {
;       "id": "string",
;       "name": "string"
;     }
;   ],
;   "associatedServerIds": [
;     "string"
;   ],
;   "moreApplicationResource": boolean
; }