ListGraphqlApis 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 = "appsync"
; SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
$oRest.SetAuthAws($oAuthAws)
; URL: https://appsync.us-west-2.amazonaws.com/
; Use the same region as specified above.
$bSuccess = $oRest.Connect("appsync.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","ListGraphqlApis")
$oSbResponseBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$bSuccess = $oRest.FullRequestNoBodySb("GET","/v1/apis",$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 $sApiId
Local $sArn
Local $sAuthenticationType
Local $iAuthorizerResultTtlInSeconds
Local $sAuthorizerUri
Local $sIdentityValidationExpression
Local $sCloudWatchLogsRoleArn
Local $iExcludeVerboseContent
Local $sFieldLogLevel
Local $sName
Local $iAuthTTL
Local $sClientId
Local $iIatTTL
Local $sIssuer
Local $sV_String
Local $sUrisString
Local $sAppIdClientRegex
Local $sAwsRegion
Local $sDefaultAction
Local $sUserPoolId
Local $sWafWebAclArn
Local $iXrayEnabled
Local $iJ
Local $iCount_j
Local $iLambdaAuthorizerConfigAuthorizerResultTtlInSeconds
Local $sLambdaAuthorizerConfigAuthorizerUri
Local $sLambdaAuthorizerConfigIdentityValidationExpression
Local $iOpenIDConnectConfigAuthTTL
Local $sOpenIDConnectConfigClientId
Local $iOpenIDConnectConfigIatTTL
Local $sOpenIDConnectConfigIssuer
Local $sUserPoolConfigAppIdClientRegex
Local $sUserPoolConfigAwsRegion
Local $sUserPoolConfigUserPoolId
Local $sNextToken = $oJResp.StringOf("nextToken")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("graphqlApis")
While $i < $iCount_i
$oJResp.I = $i
$sApiId = $oJResp.StringOf("graphqlApis[i].apiId")
$sArn = $oJResp.StringOf("graphqlApis[i].arn")
$sAuthenticationType = $oJResp.StringOf("graphqlApis[i].authenticationType")
$iAuthorizerResultTtlInSeconds = $oJResp.IntOf("graphqlApis[i].lambdaAuthorizerConfig.authorizerResultTtlInSeconds")
$sAuthorizerUri = $oJResp.StringOf("graphqlApis[i].lambdaAuthorizerConfig.authorizerUri")
$sIdentityValidationExpression = $oJResp.StringOf("graphqlApis[i].lambdaAuthorizerConfig.identityValidationExpression")
$sCloudWatchLogsRoleArn = $oJResp.StringOf("graphqlApis[i].logConfig.cloudWatchLogsRoleArn")
$iExcludeVerboseContent = $oJResp.IntOf("graphqlApis[i].logConfig.excludeVerboseContent")
$sFieldLogLevel = $oJResp.StringOf("graphqlApis[i].logConfig.fieldLogLevel")
$sName = $oJResp.StringOf("graphqlApis[i].name")
$iAuthTTL = $oJResp.IntOf("graphqlApis[i].openIDConnectConfig.authTTL")
$sClientId = $oJResp.StringOf("graphqlApis[i].openIDConnectConfig.clientId")
$iIatTTL = $oJResp.IntOf("graphqlApis[i].openIDConnectConfig.iatTTL")
$sIssuer = $oJResp.StringOf("graphqlApis[i].openIDConnectConfig.issuer")
$sV_String = $oJResp.StringOf("graphqlApis[i].tags.string")
$sUrisString = $oJResp.StringOf("graphqlApis[i].uris.string")
$sAppIdClientRegex = $oJResp.StringOf("graphqlApis[i].userPoolConfig.appIdClientRegex")
$sAwsRegion = $oJResp.StringOf("graphqlApis[i].userPoolConfig.awsRegion")
$sDefaultAction = $oJResp.StringOf("graphqlApis[i].userPoolConfig.defaultAction")
$sUserPoolId = $oJResp.StringOf("graphqlApis[i].userPoolConfig.userPoolId")
$sWafWebAclArn = $oJResp.StringOf("graphqlApis[i].wafWebAclArn")
$iXrayEnabled = $oJResp.IntOf("graphqlApis[i].xrayEnabled")
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("graphqlApis[i].additionalAuthenticationProviders")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sAuthenticationType = $oJResp.StringOf("graphqlApis[i].additionalAuthenticationProviders[j].authenticationType")
$iLambdaAuthorizerConfigAuthorizerResultTtlInSeconds = $oJResp.IntOf("graphqlApis[i].additionalAuthenticationProviders[j].lambdaAuthorizerConfig.authorizerResultTtlInSeconds")
$sLambdaAuthorizerConfigAuthorizerUri = $oJResp.StringOf("graphqlApis[i].additionalAuthenticationProviders[j].lambdaAuthorizerConfig.authorizerUri")
$sLambdaAuthorizerConfigIdentityValidationExpression = $oJResp.StringOf("graphqlApis[i].additionalAuthenticationProviders[j].lambdaAuthorizerConfig.identityValidationExpression")
$iOpenIDConnectConfigAuthTTL = $oJResp.IntOf("graphqlApis[i].additionalAuthenticationProviders[j].openIDConnectConfig.authTTL")
$sOpenIDConnectConfigClientId = $oJResp.StringOf("graphqlApis[i].additionalAuthenticationProviders[j].openIDConnectConfig.clientId")
$iOpenIDConnectConfigIatTTL = $oJResp.IntOf("graphqlApis[i].additionalAuthenticationProviders[j].openIDConnectConfig.iatTTL")
$sOpenIDConnectConfigIssuer = $oJResp.StringOf("graphqlApis[i].additionalAuthenticationProviders[j].openIDConnectConfig.issuer")
$sUserPoolConfigAppIdClientRegex = $oJResp.StringOf("graphqlApis[i].additionalAuthenticationProviders[j].userPoolConfig.appIdClientRegex")
$sUserPoolConfigAwsRegion = $oJResp.StringOf("graphqlApis[i].additionalAuthenticationProviders[j].userPoolConfig.awsRegion")
$sUserPoolConfigUserPoolId = $oJResp.StringOf("graphqlApis[i].additionalAuthenticationProviders[j].userPoolConfig.userPoolId")
$iJ = $iJ + 1
Wend
$i = $i + 1
Wend
; A sample JSON response body parsed by the above code:
; {
; "graphqlApis": [
; {
; "additionalAuthenticationProviders": [
; {
; "authenticationType": "string",
; "lambdaAuthorizerConfig": {
; "authorizerResultTtlInSeconds": number,
; "authorizerUri": "string",
; "identityValidationExpression": "string"
; },
; "openIDConnectConfig": {
; "authTTL": number,
; "clientId": "string",
; "iatTTL": number,
; "issuer": "string"
; },
; "userPoolConfig": {
; "appIdClientRegex": "string",
; "awsRegion": "string",
; "userPoolId": "string"
; }
; }
; ],
; "apiId": "string",
; "arn": "string",
; "authenticationType": "string",
; "lambdaAuthorizerConfig": {
; "authorizerResultTtlInSeconds": number,
; "authorizerUri": "string",
; "identityValidationExpression": "string"
; },
; "logConfig": {
; "cloudWatchLogsRoleArn": "string",
; "excludeVerboseContent": boolean,
; "fieldLogLevel": "string"
; },
; "name": "string",
; "openIDConnectConfig": {
; "authTTL": number,
; "clientId": "string",
; "iatTTL": number,
; "issuer": "string"
; },
; "tags": {
; "string": "string"
; },
; "uris": {
; "string": "string"
; },
; "userPoolConfig": {
; "appIdClientRegex": "string",
; "awsRegion": "string",
; "defaultAction": "string",
; "userPoolId": "string"
; },
; "wafWebAclArn": "string",
; "xrayEnabled": boolean
; }
; ],
; "nextToken": "string"
; }