aws-cloudformation / aws-cloudformation-resource-provider-qbusiness

Cloudformation resource schemas and handlers for the resources of Amazon Q for Business.
https://docs.aws.amazon.com/amazonq/latest/business-use-dg/what-is.html
Apache License 2.0
0 stars 3 forks source link

Updates: Q app and fix for datasource configuration #56

Closed jregistr closed 4 months ago

jregistr commented 4 months ago

Issue #, if available: Fixes https://github.com/aws-cloudformation/aws-cloudformation-resource-provider-qbusiness/issues/54

Description of changes:

  1. Adds Q apps configuration to Application schema
  2. Fix issue where an invalid request error was returned for DataSource configurations that used a boolean in the config json. For freeform JSONs in cfn (see Web crawler JSON schema for example), we'll receive number and boolean values as String in handler code and that String would then be sent to Q api which will reject it since it expects a boolean. This PR introduces a fix that will check string values for "true" or "false" and turn them into a boolean document. With this fix it is now possible to create a Datasource using the template below
    {
      "Type": "AWS::QBusiness::DataSource",
      "Properties": {
        "DisplayName": "I-Am-DataSource",
        "Description": "A datasource created with cfn",
        "ApplicationId": {"Fn::ImportValue":  "appId"},
        "IndexId": {"Fn::ImportValue":  "indexId"},
        "RoleArn": {"Fn::ImportValue":  "theDataSourceRole"},
        "Configuration": {
          "type": "WEBCRAWLERV2",
          "syncMode": "FORCED_FULL_CRAWL",
          "connectionConfiguration": {
            "repositoryEndpointMetadata": {
              "seedUrlConnections": [
                {
                  "seedUrl": "https://en.wikipedia.org/wiki/Dijkstra's_algorithm"
                }
              ]
            }
          },
          "repositoryConfigurations": {
            "webPage": {
              "fieldMappings": [
                {
                  "dataSourceFieldName": "webs_id",
                  "indexFieldName": "webs_id",
                  "indexFieldType": "LONG"
                }
              ]
            }
          },
          "additionalProperties": {
            "rateLimit": "300",
            "maxFileSize": "50",
            "crawlDepth": "1",
            "crawlSubDomain": true,
            "crawlAllDomain": false,
            "maxLinksPerUrl": "5",
            "honorRobots": true,
            "proxy": {}
          }
        }
      }
    }

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.