DescribeNodegroup autoit Example
; 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 = "eks"
; SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
$oRest.SetAuthAws($oAuthAws)
; URL: https://eks.us-west-2.amazonaws.com/
; Use the same region as specified above.
$bSuccess = $oRest.Connect("eks.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","DescribeNodegroup")
$oSbResponseBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$bSuccess = $oRest.FullRequestNoBodySb("GET","/clusters/{name}/node-groups/{nodegroupName}",$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 $sCode
Local $sMessage
Local $iJ
Local $iCount_j
Local $strVal
Local $sName
Local $sEffect
Local $sKey
Local $sValue
Local $sAmiType = $oJResp.StringOf("nodegroup.amiType")
Local $sCapacityType = $oJResp.StringOf("nodegroup.capacityType")
Local $sClusterName = $oJResp.StringOf("nodegroup.clusterName")
Local $iCreatedAt = $oJResp.IntOf("nodegroup.createdAt")
Local $iDiskSize = $oJResp.IntOf("nodegroup.diskSize")
Local $sV_String = $oJResp.StringOf("nodegroup.labels.string")
Local $sId = $oJResp.StringOf("nodegroup.launchTemplate.id")
Local $sName = $oJResp.StringOf("nodegroup.launchTemplate.name")
Local $sVersion = $oJResp.StringOf("nodegroup.launchTemplate.version")
Local $iModifiedAt = $oJResp.IntOf("nodegroup.modifiedAt")
Local $sNodegroupArn = $oJResp.StringOf("nodegroup.nodegroupArn")
Local $sNodegroupName = $oJResp.StringOf("nodegroup.nodegroupName")
Local $sNodeRole = $oJResp.StringOf("nodegroup.nodeRole")
Local $sReleaseVersion = $oJResp.StringOf("nodegroup.releaseVersion")
Local $sEc2SshKey = $oJResp.StringOf("nodegroup.remoteAccess.ec2SshKey")
Local $sRemoteAccessSecurityGroup = $oJResp.StringOf("nodegroup.resources.remoteAccessSecurityGroup")
Local $iDesiredSize = $oJResp.IntOf("nodegroup.scalingConfig.desiredSize")
Local $iMaxSize = $oJResp.IntOf("nodegroup.scalingConfig.maxSize")
Local $iMinSize = $oJResp.IntOf("nodegroup.scalingConfig.minSize")
Local $sStatus = $oJResp.StringOf("nodegroup.status")
Local $sTagsString = $oJResp.StringOf("nodegroup.tags.string")
Local $iMaxUnavailable = $oJResp.IntOf("nodegroup.updateConfig.maxUnavailable")
Local $iMaxUnavailablePercentage = $oJResp.IntOf("nodegroup.updateConfig.maxUnavailablePercentage")
Local $sNodegroupVersion = $oJResp.StringOf("nodegroup.version")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("nodegroup.health.issues")
While $i < $iCount_i
$oJResp.I = $i
$sCode = $oJResp.StringOf("nodegroup.health.issues[i].code")
$sMessage = $oJResp.StringOf("nodegroup.health.issues[i].message")
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("nodegroup.health.issues[i].resourceIds")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("nodegroup.health.issues[i].resourceIds[j]")
$iJ = $iJ + 1
Wend
$i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("nodegroup.instanceTypes")
While $i < $iCount_i
$oJResp.I = $i
$strVal = $oJResp.StringOf("nodegroup.instanceTypes[i]")
$i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("nodegroup.remoteAccess.sourceSecurityGroups")
While $i < $iCount_i
$oJResp.I = $i
$strVal = $oJResp.StringOf("nodegroup.remoteAccess.sourceSecurityGroups[i]")
$i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("nodegroup.resources.autoScalingGroups")
While $i < $iCount_i
$oJResp.I = $i
$sName = $oJResp.StringOf("nodegroup.resources.autoScalingGroups[i].name")
$i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("nodegroup.subnets")
While $i < $iCount_i
$oJResp.I = $i
$strVal = $oJResp.StringOf("nodegroup.subnets[i]")
$i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("nodegroup.taints")
While $i < $iCount_i
$oJResp.I = $i
$sEffect = $oJResp.StringOf("nodegroup.taints[i].effect")
$sKey = $oJResp.StringOf("nodegroup.taints[i].key")
$sValue = $oJResp.StringOf("nodegroup.taints[i].value")
$i = $i + 1
Wend
; A sample JSON response body parsed by the above code:
; {
; "nodegroup": {
; "amiType": "string",
; "capacityType": "string",
; "clusterName": "string",
; "createdAt": number,
; "diskSize": number,
; "health": {
; "issues": [
; {
; "code": "string",
; "message": "string",
; "resourceIds": [
; "string"
; ]
; }
; ]
; },
; "instanceTypes": [
; "string"
; ],
; "labels": {
; "string": "string"
; },
; "launchTemplate": {
; "id": "string",
; "name": "string",
; "version": "string"
; },
; "modifiedAt": number,
; "nodegroupArn": "string",
; "nodegroupName": "string",
; "nodeRole": "string",
; "releaseVersion": "string",
; "remoteAccess": {
; "ec2SshKey": "string",
; "sourceSecurityGroups": [
; "string"
; ]
; },
; "resources": {
; "autoScalingGroups": [
; {
; "name": "string"
; }
; ],
; "remoteAccessSecurityGroup": "string"
; },
; "scalingConfig": {
; "desiredSize": number,
; "maxSize": number,
; "minSize": number
; },
; "status": "string",
; "subnets": [
; "string"
; ],
; "tags": {
; "string": "string"
; },
; "taints": [
; {
; "effect": "string",
; "key": "string",
; "value": "string"
; }
; ],
; "updateConfig": {
; "maxUnavailable": number,
; "maxUnavailablePercentage": number
; },
; "version": "string"
; }
; }