Chilkat Online Tools

BatchGetProjects SQL Server Example

AWS CodeBuild

CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    DECLARE @sTmp0 nvarchar(max)
    -- This example requires the Chilkat API to have been previously unlocked.
    -- See Global Unlock Sample for sample code.

    DECLARE @rest int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Rest', @rest OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    DECLARE @authAws int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.AuthAws', @authAws OUT

    EXEC sp_OASetProperty @authAws, 'AccessKey', 'AWS_ACCESS_KEY'
    EXEC sp_OASetProperty @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.)
    EXEC sp_OASetProperty @authAws, 'Region', 'us-west-2'
    EXEC sp_OASetProperty @authAws, 'ServiceName', 'codebuild'
    -- SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
    EXEC sp_OAMethod @rest, 'SetAuthAws', @success OUT, @authAws

    -- URL: https://codebuild.us-west-2.amazonaws.com/
    -- Use the same region as specified above.
    EXEC sp_OAMethod @rest, 'Connect', @success OUT, 'codebuild.us-west-2.amazonaws.com', 443, 1, 1
    IF @success <> 1
      BEGIN

        EXEC sp_OAGetProperty @rest, 'ConnectFailReason', @iTmp0 OUT
        PRINT 'ConnectFailReason: ' + @iTmp0
        EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @rest
        EXEC @hr = sp_OADestroy @authAws
        RETURN
      END

    -- The following code creates the JSON request body.
    -- The JSON created by this code is shown below.

    -- Use this online tool to generate code from sample JSON:
    -- Generate Code to Create JSON

    DECLARE @json int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @json OUT

    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'names[0]', 'string'

    -- The JSON request body created by the above code:

    -- {
    --   "names": [
    --     "string"
    --   ]
    -- }

    EXEC sp_OAMethod @rest, 'AddHeader', @success OUT, 'Content-Type', 'application/x-amz-json-1.1'
    EXEC sp_OAMethod @rest, 'AddHeader', @success OUT, 'X-Amz-Target', 'CodeBuild_20161006.BatchGetProjects'

    DECLARE @sbRequestBody int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbRequestBody OUT

    EXEC sp_OAMethod @json, 'EmitSb', @success OUT, @sbRequestBody
    DECLARE @sbResponseBody int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbResponseBody OUT

    EXEC sp_OAMethod @rest, 'FullRequestSb', @success OUT, 'POST', '/', @sbRequestBody, @sbResponseBody
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @rest
        EXEC @hr = sp_OADestroy @authAws
        EXEC @hr = sp_OADestroy @json
        EXEC @hr = sp_OADestroy @sbRequestBody
        EXEC @hr = sp_OADestroy @sbResponseBody
        RETURN
      END
    DECLARE @respStatusCode int
    EXEC sp_OAGetProperty @rest, 'ResponseStatusCode', @respStatusCode OUT

    PRINT 'response status code = ' + @respStatusCode
    IF @respStatusCode <> 200
      BEGIN

        PRINT 'Response Header:'
        EXEC sp_OAGetProperty @rest, 'ResponseHeader', @sTmp0 OUT
        PRINT @sTmp0

        PRINT 'Response Body:'
        EXEC sp_OAMethod @sbResponseBody, 'GetAsString', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @rest
        EXEC @hr = sp_OADestroy @authAws
        EXEC @hr = sp_OADestroy @json
        EXEC @hr = sp_OADestroy @sbRequestBody
        EXEC @hr = sp_OADestroy @sbResponseBody
        RETURN
      END

    DECLARE @jResp int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @jResp OUT

    EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @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

    DECLARE @arn nvarchar(max)

    DECLARE @ArtifactIdentifier nvarchar(max)

    DECLARE @BucketOwnerAccess nvarchar(max)

    DECLARE @EncryptionDisabled int

    DECLARE @Location nvarchar(max)

    DECLARE @Name nvarchar(max)

    DECLARE @NamespaceType nvarchar(max)

    DECLARE @OverrideArtifactName int

    DECLARE @Packaging nvarchar(max)

    DECLARE @Path nvarchar(max)

    DECLARE @v_Type nvarchar(max)

    DECLARE @BadgeEnabled int

    DECLARE @BadgeRequestUrl nvarchar(max)

    DECLARE @BatchReportMode nvarchar(max)

    DECLARE @CombineArtifacts int

    DECLARE @MaximumBuildsAllowed int

    DECLARE @ServiceRole nvarchar(max)

    DECLARE @TimeoutInMins int

    DECLARE @cacheLocation nvarchar(max)

    DECLARE @cacheType nvarchar(max)

    DECLARE @concurrentBuildLimit int

    DECLARE @created int

    DECLARE @description nvarchar(max)

    DECLARE @encryptionKey nvarchar(max)

    DECLARE @Certificate nvarchar(max)

    DECLARE @ComputeType nvarchar(max)

    DECLARE @Image nvarchar(max)

    DECLARE @ImagePullCredentialsType nvarchar(max)

    DECLARE @PrivilegedMode int

    DECLARE @Credential nvarchar(max)

    DECLARE @CredentialProvider nvarchar(max)

    DECLARE @environmentType nvarchar(max)

    DECLARE @lastModified int

    DECLARE @GroupName nvarchar(max)

    DECLARE @Status nvarchar(max)

    DECLARE @StreamName nvarchar(max)

    DECLARE @S3LogsBucketOwnerAccess nvarchar(max)

    DECLARE @S3LogsEncryptionDisabled int

    DECLARE @S3LogsLocation nvarchar(max)

    DECLARE @S3LogsStatus nvarchar(max)

    DECLARE @name nvarchar(max)

    DECLARE @projectVisibility nvarchar(max)

    DECLARE @publicProjectAlias nvarchar(max)

    DECLARE @queuedTimeoutInMinutes int

    DECLARE @resourceAccessRole nvarchar(max)

    DECLARE @serviceRole nvarchar(max)

    DECLARE @Resource nvarchar(max)

    DECLARE @AuthType nvarchar(max)

    DECLARE @Buildspec nvarchar(max)

    DECLARE @Context nvarchar(max)

    DECLARE @TargetUrl nvarchar(max)

    DECLARE @GitCloneDepth int

    DECLARE @FetchSubmodules int

    DECLARE @InsecureSsl int

    DECLARE @sourceLocation nvarchar(max)

    DECLARE @ReportBuildStatus int

    DECLARE @SourceIdentifier nvarchar(max)

    DECLARE @sourceType nvarchar(max)

    DECLARE @sourceVersion nvarchar(max)

    DECLARE @timeoutInMinutes int

    DECLARE @VpcId nvarchar(max)

    DECLARE @BranchFilter nvarchar(max)

    DECLARE @BuildType nvarchar(max)

    DECLARE @LastModifiedSecret int

    DECLARE @PayloadUrl nvarchar(max)

    DECLARE @Secret nvarchar(max)

    DECLARE @v_Url nvarchar(max)

    DECLARE @j int

    DECLARE @count_j int

    DECLARE @strVal nvarchar(max)

    DECLARE @v_type nvarchar(max)

    DECLARE @value nvarchar(max)

    DECLARE @identifier nvarchar(max)

    DECLARE @location nvarchar(max)

    DECLARE @mountOptions nvarchar(max)

    DECLARE @mountPoint nvarchar(max)

    DECLARE @artifactIdentifier nvarchar(max)

    DECLARE @bucketOwnerAccess nvarchar(max)

    DECLARE @encryptionDisabled int

    DECLARE @namespaceType nvarchar(max)

    DECLARE @overrideArtifactName int

    DECLARE @packaging nvarchar(max)

    DECLARE @path nvarchar(max)

    DECLARE @authResource nvarchar(max)

    DECLARE @authType nvarchar(max)

    DECLARE @buildspec nvarchar(max)

    DECLARE @buildStatusConfigContext nvarchar(max)

    DECLARE @buildStatusConfigTargetUrl nvarchar(max)

    DECLARE @gitCloneDepth int

    DECLARE @gitSubmodulesConfigFetchSubmodules int

    DECLARE @insecureSsl int

    DECLARE @reportBuildStatus int

    DECLARE @sourceIdentifier nvarchar(max)

    DECLARE @key nvarchar(max)

    DECLARE @k int

    DECLARE @count_k int

    DECLARE @excludeMatchedPattern int

    DECLARE @pattern nvarchar(max)

    DECLARE @i int
    SELECT @i = 0
    DECLARE @count_i int
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'projects'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @arn OUT, 'projects[i].arn'
        EXEC sp_OAMethod @jResp, 'StringOf', @ArtifactIdentifier OUT, 'projects[i].artifacts.artifactIdentifier'
        EXEC sp_OAMethod @jResp, 'StringOf', @BucketOwnerAccess OUT, 'projects[i].artifacts.bucketOwnerAccess'
        EXEC sp_OAMethod @jResp, 'IntOf', @EncryptionDisabled OUT, 'projects[i].artifacts.encryptionDisabled'
        EXEC sp_OAMethod @jResp, 'StringOf', @Location OUT, 'projects[i].artifacts.location'
        EXEC sp_OAMethod @jResp, 'StringOf', @Name OUT, 'projects[i].artifacts.name'
        EXEC sp_OAMethod @jResp, 'StringOf', @NamespaceType OUT, 'projects[i].artifacts.namespaceType'
        EXEC sp_OAMethod @jResp, 'IntOf', @OverrideArtifactName OUT, 'projects[i].artifacts.overrideArtifactName'
        EXEC sp_OAMethod @jResp, 'StringOf', @Packaging OUT, 'projects[i].artifacts.packaging'
        EXEC sp_OAMethod @jResp, 'StringOf', @Path OUT, 'projects[i].artifacts.path'
        EXEC sp_OAMethod @jResp, 'StringOf', @v_Type OUT, 'projects[i].artifacts.type'
        EXEC sp_OAMethod @jResp, 'IntOf', @BadgeEnabled OUT, 'projects[i].badge.badgeEnabled'
        EXEC sp_OAMethod @jResp, 'StringOf', @BadgeRequestUrl OUT, 'projects[i].badge.badgeRequestUrl'
        EXEC sp_OAMethod @jResp, 'StringOf', @BatchReportMode OUT, 'projects[i].buildBatchConfig.batchReportMode'
        EXEC sp_OAMethod @jResp, 'IntOf', @CombineArtifacts OUT, 'projects[i].buildBatchConfig.combineArtifacts'
        EXEC sp_OAMethod @jResp, 'IntOf', @MaximumBuildsAllowed OUT, 'projects[i].buildBatchConfig.restrictions.maximumBuildsAllowed'
        EXEC sp_OAMethod @jResp, 'StringOf', @ServiceRole OUT, 'projects[i].buildBatchConfig.serviceRole'
        EXEC sp_OAMethod @jResp, 'IntOf', @TimeoutInMins OUT, 'projects[i].buildBatchConfig.timeoutInMins'
        EXEC sp_OAMethod @jResp, 'StringOf', @cacheLocation OUT, 'projects[i].cache.location'
        EXEC sp_OAMethod @jResp, 'StringOf', @cacheType OUT, 'projects[i].cache.type'
        EXEC sp_OAMethod @jResp, 'IntOf', @concurrentBuildLimit OUT, 'projects[i].concurrentBuildLimit'
        EXEC sp_OAMethod @jResp, 'IntOf', @created OUT, 'projects[i].created'
        EXEC sp_OAMethod @jResp, 'StringOf', @description OUT, 'projects[i].description'
        EXEC sp_OAMethod @jResp, 'StringOf', @encryptionKey OUT, 'projects[i].encryptionKey'
        EXEC sp_OAMethod @jResp, 'StringOf', @Certificate OUT, 'projects[i].environment.certificate'
        EXEC sp_OAMethod @jResp, 'StringOf', @ComputeType OUT, 'projects[i].environment.computeType'
        EXEC sp_OAMethod @jResp, 'StringOf', @Image OUT, 'projects[i].environment.image'
        EXEC sp_OAMethod @jResp, 'StringOf', @ImagePullCredentialsType OUT, 'projects[i].environment.imagePullCredentialsType'
        EXEC sp_OAMethod @jResp, 'IntOf', @PrivilegedMode OUT, 'projects[i].environment.privilegedMode'
        EXEC sp_OAMethod @jResp, 'StringOf', @Credential OUT, 'projects[i].environment.registryCredential.credential'
        EXEC sp_OAMethod @jResp, 'StringOf', @CredentialProvider OUT, 'projects[i].environment.registryCredential.credentialProvider'
        EXEC sp_OAMethod @jResp, 'StringOf', @environmentType OUT, 'projects[i].environment.type'
        EXEC sp_OAMethod @jResp, 'IntOf', @lastModified OUT, 'projects[i].lastModified'
        EXEC sp_OAMethod @jResp, 'StringOf', @GroupName OUT, 'projects[i].logsConfig.cloudWatchLogs.groupName'
        EXEC sp_OAMethod @jResp, 'StringOf', @Status OUT, 'projects[i].logsConfig.cloudWatchLogs.status'
        EXEC sp_OAMethod @jResp, 'StringOf', @StreamName OUT, 'projects[i].logsConfig.cloudWatchLogs.streamName'
        EXEC sp_OAMethod @jResp, 'StringOf', @S3LogsBucketOwnerAccess OUT, 'projects[i].logsConfig.s3Logs.bucketOwnerAccess'
        EXEC sp_OAMethod @jResp, 'IntOf', @S3LogsEncryptionDisabled OUT, 'projects[i].logsConfig.s3Logs.encryptionDisabled'
        EXEC sp_OAMethod @jResp, 'StringOf', @S3LogsLocation OUT, 'projects[i].logsConfig.s3Logs.location'
        EXEC sp_OAMethod @jResp, 'StringOf', @S3LogsStatus OUT, 'projects[i].logsConfig.s3Logs.status'
        EXEC sp_OAMethod @jResp, 'StringOf', @name OUT, 'projects[i].name'
        EXEC sp_OAMethod @jResp, 'StringOf', @projectVisibility OUT, 'projects[i].projectVisibility'
        EXEC sp_OAMethod @jResp, 'StringOf', @publicProjectAlias OUT, 'projects[i].publicProjectAlias'
        EXEC sp_OAMethod @jResp, 'IntOf', @queuedTimeoutInMinutes OUT, 'projects[i].queuedTimeoutInMinutes'
        EXEC sp_OAMethod @jResp, 'StringOf', @resourceAccessRole OUT, 'projects[i].resourceAccessRole'
        EXEC sp_OAMethod @jResp, 'StringOf', @serviceRole OUT, 'projects[i].serviceRole'
        EXEC sp_OAMethod @jResp, 'StringOf', @Resource OUT, 'projects[i].source.auth.resource'
        EXEC sp_OAMethod @jResp, 'StringOf', @AuthType OUT, 'projects[i].source.auth.type'
        EXEC sp_OAMethod @jResp, 'StringOf', @Buildspec OUT, 'projects[i].source.buildspec'
        EXEC sp_OAMethod @jResp, 'StringOf', @Context OUT, 'projects[i].source.buildStatusConfig.context'
        EXEC sp_OAMethod @jResp, 'StringOf', @TargetUrl OUT, 'projects[i].source.buildStatusConfig.targetUrl'
        EXEC sp_OAMethod @jResp, 'IntOf', @GitCloneDepth OUT, 'projects[i].source.gitCloneDepth'
        EXEC sp_OAMethod @jResp, 'IntOf', @FetchSubmodules OUT, 'projects[i].source.gitSubmodulesConfig.fetchSubmodules'
        EXEC sp_OAMethod @jResp, 'IntOf', @InsecureSsl OUT, 'projects[i].source.insecureSsl'
        EXEC sp_OAMethod @jResp, 'StringOf', @sourceLocation OUT, 'projects[i].source.location'
        EXEC sp_OAMethod @jResp, 'IntOf', @ReportBuildStatus OUT, 'projects[i].source.reportBuildStatus'
        EXEC sp_OAMethod @jResp, 'StringOf', @SourceIdentifier OUT, 'projects[i].source.sourceIdentifier'
        EXEC sp_OAMethod @jResp, 'StringOf', @sourceType OUT, 'projects[i].source.type'
        EXEC sp_OAMethod @jResp, 'StringOf', @sourceVersion OUT, 'projects[i].sourceVersion'
        EXEC sp_OAMethod @jResp, 'IntOf', @timeoutInMinutes OUT, 'projects[i].timeoutInMinutes'
        EXEC sp_OAMethod @jResp, 'StringOf', @VpcId OUT, 'projects[i].vpcConfig.vpcId'
        EXEC sp_OAMethod @jResp, 'StringOf', @BranchFilter OUT, 'projects[i].webhook.branchFilter'
        EXEC sp_OAMethod @jResp, 'StringOf', @BuildType OUT, 'projects[i].webhook.buildType'
        EXEC sp_OAMethod @jResp, 'IntOf', @LastModifiedSecret OUT, 'projects[i].webhook.lastModifiedSecret'
        EXEC sp_OAMethod @jResp, 'StringOf', @PayloadUrl OUT, 'projects[i].webhook.payloadUrl'
        EXEC sp_OAMethod @jResp, 'StringOf', @Secret OUT, 'projects[i].webhook.secret'
        EXEC sp_OAMethod @jResp, 'StringOf', @v_Url OUT, 'projects[i].webhook.url'
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'projects[i].buildBatchConfig.restrictions.computeTypesAllowed'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'projects[i].buildBatchConfig.restrictions.computeTypesAllowed[j]'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'projects[i].cache.modes'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'projects[i].cache.modes[j]'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'projects[i].environment.environmentVariables'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @name OUT, 'projects[i].environment.environmentVariables[j].name'
            EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'projects[i].environment.environmentVariables[j].type'
            EXEC sp_OAMethod @jResp, 'StringOf', @value OUT, 'projects[i].environment.environmentVariables[j].value'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'projects[i].fileSystemLocations'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @identifier OUT, 'projects[i].fileSystemLocations[j].identifier'
            EXEC sp_OAMethod @jResp, 'StringOf', @location OUT, 'projects[i].fileSystemLocations[j].location'
            EXEC sp_OAMethod @jResp, 'StringOf', @mountOptions OUT, 'projects[i].fileSystemLocations[j].mountOptions'
            EXEC sp_OAMethod @jResp, 'StringOf', @mountPoint OUT, 'projects[i].fileSystemLocations[j].mountPoint'
            EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'projects[i].fileSystemLocations[j].type'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'projects[i].secondaryArtifacts'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @artifactIdentifier OUT, 'projects[i].secondaryArtifacts[j].artifactIdentifier'
            EXEC sp_OAMethod @jResp, 'StringOf', @bucketOwnerAccess OUT, 'projects[i].secondaryArtifacts[j].bucketOwnerAccess'
            EXEC sp_OAMethod @jResp, 'IntOf', @encryptionDisabled OUT, 'projects[i].secondaryArtifacts[j].encryptionDisabled'
            EXEC sp_OAMethod @jResp, 'StringOf', @location OUT, 'projects[i].secondaryArtifacts[j].location'
            EXEC sp_OAMethod @jResp, 'StringOf', @name OUT, 'projects[i].secondaryArtifacts[j].name'
            EXEC sp_OAMethod @jResp, 'StringOf', @namespaceType OUT, 'projects[i].secondaryArtifacts[j].namespaceType'
            EXEC sp_OAMethod @jResp, 'IntOf', @overrideArtifactName OUT, 'projects[i].secondaryArtifacts[j].overrideArtifactName'
            EXEC sp_OAMethod @jResp, 'StringOf', @packaging OUT, 'projects[i].secondaryArtifacts[j].packaging'
            EXEC sp_OAMethod @jResp, 'StringOf', @path OUT, 'projects[i].secondaryArtifacts[j].path'
            EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'projects[i].secondaryArtifacts[j].type'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'projects[i].secondarySources'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @authResource OUT, 'projects[i].secondarySources[j].auth.resource'
            EXEC sp_OAMethod @jResp, 'StringOf', @authType OUT, 'projects[i].secondarySources[j].auth.type'
            EXEC sp_OAMethod @jResp, 'StringOf', @buildspec OUT, 'projects[i].secondarySources[j].buildspec'
            EXEC sp_OAMethod @jResp, 'StringOf', @buildStatusConfigContext OUT, 'projects[i].secondarySources[j].buildStatusConfig.context'
            EXEC sp_OAMethod @jResp, 'StringOf', @buildStatusConfigTargetUrl OUT, 'projects[i].secondarySources[j].buildStatusConfig.targetUrl'
            EXEC sp_OAMethod @jResp, 'IntOf', @gitCloneDepth OUT, 'projects[i].secondarySources[j].gitCloneDepth'
            EXEC sp_OAMethod @jResp, 'IntOf', @gitSubmodulesConfigFetchSubmodules OUT, 'projects[i].secondarySources[j].gitSubmodulesConfig.fetchSubmodules'
            EXEC sp_OAMethod @jResp, 'IntOf', @insecureSsl OUT, 'projects[i].secondarySources[j].insecureSsl'
            EXEC sp_OAMethod @jResp, 'StringOf', @location OUT, 'projects[i].secondarySources[j].location'
            EXEC sp_OAMethod @jResp, 'IntOf', @reportBuildStatus OUT, 'projects[i].secondarySources[j].reportBuildStatus'
            EXEC sp_OAMethod @jResp, 'StringOf', @sourceIdentifier OUT, 'projects[i].secondarySources[j].sourceIdentifier'
            EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'projects[i].secondarySources[j].type'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'projects[i].secondarySourceVersions'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @sourceIdentifier OUT, 'projects[i].secondarySourceVersions[j].sourceIdentifier'
            EXEC sp_OAMethod @jResp, 'StringOf', @sourceVersion OUT, 'projects[i].secondarySourceVersions[j].sourceVersion'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'projects[i].tags'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @key OUT, 'projects[i].tags[j].key'
            EXEC sp_OAMethod @jResp, 'StringOf', @value OUT, 'projects[i].tags[j].value'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'projects[i].vpcConfig.securityGroupIds'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'projects[i].vpcConfig.securityGroupIds[j]'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'projects[i].vpcConfig.subnets'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'projects[i].vpcConfig.subnets[j]'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'projects[i].webhook.filterGroups'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            SELECT @k = 0
            EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_k OUT, 'projects[i].webhook.filterGroups[j]'
            WHILE @k < @count_k
              BEGIN
                EXEC sp_OASetProperty @jResp, 'K', @k
                EXEC sp_OAMethod @jResp, 'IntOf', @excludeMatchedPattern OUT, 'projects[i].webhook.filterGroups[j][k].excludeMatchedPattern'
                EXEC sp_OAMethod @jResp, 'StringOf', @pattern OUT, 'projects[i].webhook.filterGroups[j][k].pattern'
                EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'projects[i].webhook.filterGroups[j][k].type'
                SELECT @k = @k + 1
              END
            SELECT @j = @j + 1
          END
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'projectsNotFound'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'projectsNotFound[i]'
        SELECT @i = @i + 1
      END

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

    -- {
    --   "projects": [
    --     {
    --       "arn": "string",
    --       "artifacts": {
    --         "artifactIdentifier": "string",
    --         "bucketOwnerAccess": "string",
    --         "encryptionDisabled": boolean,
    --         "location": "string",
    --         "name": "string",
    --         "namespaceType": "string",
    --         "overrideArtifactName": boolean,
    --         "packaging": "string",
    --         "path": "string",
    --         "type": "string"
    --       },
    --       "badge": {
    --         "badgeEnabled": boolean,
    --         "badgeRequestUrl": "string"
    --       },
    --       "buildBatchConfig": {
    --         "batchReportMode": "string",
    --         "combineArtifacts": boolean,
    --         "restrictions": {
    --           "computeTypesAllowed": [
    --             "string"
    --           ],
    --           "maximumBuildsAllowed": number
    --         },
    --         "serviceRole": "string",
    --         "timeoutInMins": number
    --       },
    --       "cache": {
    --         "location": "string",
    --         "modes": [
    --           "string"
    --         ],
    --         "type": "string"
    --       },
    --       "concurrentBuildLimit": number,
    --       "created": number,
    --       "description": "string",
    --       "encryptionKey": "string",
    --       "environment": {
    --         "certificate": "string",
    --         "computeType": "string",
    --         "environmentVariables": [
    --           {
    --             "name": "string",
    --             "type": "string",
    --             "value": "string"
    --           }
    --         ],
    --         "image": "string",
    --         "imagePullCredentialsType": "string",
    --         "privilegedMode": boolean,
    --         "registryCredential": {
    --           "credential": "string",
    --           "credentialProvider": "string"
    --         },
    --         "type": "string"
    --       },
    --       "fileSystemLocations": [
    --         {
    --           "identifier": "string",
    --           "location": "string",
    --           "mountOptions": "string",
    --           "mountPoint": "string",
    --           "type": "string"
    --         }
    --       ],
    --       "lastModified": number,
    --       "logsConfig": {
    --         "cloudWatchLogs": {
    --           "groupName": "string",
    --           "status": "string",
    --           "streamName": "string"
    --         },
    --         "s3Logs": {
    --           "bucketOwnerAccess": "string",
    --           "encryptionDisabled": boolean,
    --           "location": "string",
    --           "status": "string"
    --         }
    --       },
    --       "name": "string",
    --       "projectVisibility": "string",
    --       "publicProjectAlias": "string",
    --       "queuedTimeoutInMinutes": number,
    --       "resourceAccessRole": "string",
    --       "secondaryArtifacts": [
    --         {
    --           "artifactIdentifier": "string",
    --           "bucketOwnerAccess": "string",
    --           "encryptionDisabled": boolean,
    --           "location": "string",
    --           "name": "string",
    --           "namespaceType": "string",
    --           "overrideArtifactName": boolean,
    --           "packaging": "string",
    --           "path": "string",
    --           "type": "string"
    --         }
    --       ],
    --       "secondarySources": [
    --         {
    --           "auth": {
    --             "resource": "string",
    --             "type": "string"
    --           },
    --           "buildspec": "string",
    --           "buildStatusConfig": {
    --             "context": "string",
    --             "targetUrl": "string"
    --           },
    --           "gitCloneDepth": number,
    --           "gitSubmodulesConfig": {
    --             "fetchSubmodules": boolean
    --           },
    --           "insecureSsl": boolean,
    --           "location": "string",
    --           "reportBuildStatus": boolean,
    --           "sourceIdentifier": "string",
    --           "type": "string"
    --         }
    --       ],
    --       "secondarySourceVersions": [
    --         {
    --           "sourceIdentifier": "string",
    --           "sourceVersion": "string"
    --         }
    --       ],
    --       "serviceRole": "string",
    --       "source": {
    --         "auth": {
    --           "resource": "string",
    --           "type": "string"
    --         },
    --         "buildspec": "string",
    --         "buildStatusConfig": {
    --           "context": "string",
    --           "targetUrl": "string"
    --         },
    --         "gitCloneDepth": number,
    --         "gitSubmodulesConfig": {
    --           "fetchSubmodules": boolean
    --         },
    --         "insecureSsl": boolean,
    --         "location": "string",
    --         "reportBuildStatus": boolean,
    --         "sourceIdentifier": "string",
    --         "type": "string"
    --       },
    --       "sourceVersion": "string",
    --       "tags": [
    --         {
    --           "key": "string",
    --           "value": "string"
    --         }
    --       ],
    --       "timeoutInMinutes": number,
    --       "vpcConfig": {
    --         "securityGroupIds": [
    --           "string"
    --         ],
    --         "subnets": [
    --           "string"
    --         ],
    --         "vpcId": "string"
    --       },
    --       "webhook": {
    --         "branchFilter": "string",
    --         "buildType": "string",
    --         "filterGroups": [
    --           [
    --             {
    --               "excludeMatchedPattern": boolean,
    --               "pattern": "string",
    --               "type": "string"
    --             }
    --           ]
    --         ],
    --         "lastModifiedSecret": number,
    --         "payloadUrl": "string",
    --         "secret": "string",
    --         "url": "string"
    --       }
    --     }
    --   ],
    --   "projectsNotFound": [
    --     "string"
    --   ]
    -- }

    EXEC @hr = sp_OADestroy @rest
    EXEC @hr = sp_OADestroy @authAws
    EXEC @hr = sp_OADestroy @json
    EXEC @hr = sp_OADestroy @sbRequestBody
    EXEC @hr = sp_OADestroy @sbResponseBody
    EXEC @hr = sp_OADestroy @jResp


END
GO