{
  "typeName" : "AWS::AppSync::DataSource",
  "description" : "Resource Type definition for AWS::AppSync::DataSource",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-appsync",
  "additionalProperties" : false,
  "tagging" : {
    "taggable" : false
  },
  "properties" : {
    "ApiId" : {
      "description" : "Unique AWS AppSync GraphQL API identifier where this data source will be created.",
      "type" : "string"
    },
    "Description" : {
      "description" : "The description of the data source.",
      "type" : "string"
    },
    "DynamoDBConfig" : {
      "description" : "AWS Region and TableName for an Amazon DynamoDB table in your account.",
      "$ref" : "#/definitions/DynamoDBConfig"
    },
    "ElasticsearchConfig" : {
      "description" : "AWS Region and Endpoints for an Amazon OpenSearch Service domain in your account.\nAs of September 2021, Amazon Elasticsearch Service is Amazon OpenSearch Service. This property is deprecated. For new data sources, use OpenSearchServiceConfig to specify an OpenSearch Service data source.",
      "$ref" : "#/definitions/ElasticsearchConfig"
    },
    "EventBridgeConfig" : {
      "description" : "ARN for the EventBridge bus.",
      "$ref" : "#/definitions/EventBridgeConfig"
    },
    "HttpConfig" : {
      "description" : "Endpoints for an HTTP data source.",
      "$ref" : "#/definitions/HttpConfig"
    },
    "LambdaConfig" : {
      "description" : "An ARN of a Lambda function in valid ARN format. This can be the ARN of a Lambda function that exists in the current account or in another account.",
      "$ref" : "#/definitions/LambdaConfig"
    },
    "Name" : {
      "description" : "Friendly name for you to identify your AppSync data source after creation.",
      "type" : "string"
    },
    "OpenSearchServiceConfig" : {
      "description" : "AWS Region and Endpoints for an Amazon OpenSearch Service domain in your account.",
      "$ref" : "#/definitions/OpenSearchServiceConfig"
    },
    "RelationalDatabaseConfig" : {
      "description" : "Relational Database configuration of the relational database data source.",
      "$ref" : "#/definitions/RelationalDatabaseConfig"
    },
    "ServiceRoleArn" : {
      "description" : "The AWS Identity and Access Management service role ARN for the data source. The system assumes this role when accessing the data source.",
      "type" : "string"
    },
    "Type" : {
      "description" : "The type of the data source.",
      "type" : "string"
    },
    "DataSourceArn" : {
      "description" : "The Amazon Resource Name (ARN) of the API key, such as arn:aws:appsync:us-east-1:123456789012:apis/graphqlapiid/datasources/datasourcename.",
      "type" : "string"
    },
    "MetricsConfig" : {
      "description" : "",
      "type" : "string",
      "enum" : [ "DISABLED", "ENABLED" ]
    }
  },
  "definitions" : {
    "RdsHttpEndpointConfig" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "DatabaseName" : {
          "description" : "Logical database name.",
          "type" : "string"
        },
        "AwsRegion" : {
          "description" : "AWS Region for RDS HTTP endpoint.",
          "type" : "string"
        },
        "DbClusterIdentifier" : {
          "description" : "Amazon RDS cluster Amazon Resource Name (ARN).",
          "type" : "string"
        },
        "AwsSecretStoreArn" : {
          "description" : "The ARN for database credentials stored in AWS Secrets Manager.",
          "type" : "string"
        },
        "Schema" : {
          "description" : "Logical schema name.",
          "type" : "string"
        }
      },
      "required" : [ "AwsRegion", "DbClusterIdentifier", "AwsSecretStoreArn" ]
    },
    "OpenSearchServiceConfig" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "AwsRegion" : {
          "description" : "The AWS Region.",
          "type" : "string"
        },
        "Endpoint" : {
          "description" : "The endpoint.",
          "type" : "string"
        }
      },
      "required" : [ "AwsRegion", "Endpoint" ]
    },
    "AwsIamConfig" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "SigningRegion" : {
          "description" : "The signing Region for AWS Identity and Access Management authorization.",
          "type" : "string"
        },
        "SigningServiceName" : {
          "description" : "The signing service name for AWS Identity and Access Management authorization.",
          "type" : "string"
        }
      }
    },
    "EventBridgeConfig" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "EventBusArn" : {
          "description" : "ARN for the EventBridge bus.",
          "type" : "string"
        }
      },
      "required" : [ "EventBusArn" ]
    },
    "AuthorizationConfig" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "AuthorizationType" : {
          "description" : "The authorization type that the HTTP endpoint requires.",
          "type" : "string"
        },
        "AwsIamConfig" : {
          "description" : "The AWS Identity and Access Management settings.",
          "$ref" : "#/definitions/AwsIamConfig"
        }
      },
      "required" : [ "AuthorizationType" ]
    },
    "DeltaSyncConfig" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "BaseTableTTL" : {
          "description" : "The number of minutes that an Item is stored in the data source.",
          "type" : "string"
        },
        "DeltaSyncTableTTL" : {
          "description" : "The number of minutes that a Delta Sync log entry is stored in the Delta Sync table.",
          "type" : "string"
        },
        "DeltaSyncTableName" : {
          "description" : "The Delta Sync table name.",
          "type" : "string"
        }
      },
      "required" : [ "BaseTableTTL", "DeltaSyncTableTTL", "DeltaSyncTableName" ]
    },
    "RelationalDatabaseConfig" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "RdsHttpEndpointConfig" : {
          "description" : "Information about the Amazon RDS resource.",
          "$ref" : "#/definitions/RdsHttpEndpointConfig"
        },
        "RelationalDatabaseSourceType" : {
          "description" : "The type of relational data source.",
          "type" : "string"
        }
      },
      "required" : [ "RelationalDatabaseSourceType" ]
    },
    "HttpConfig" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Endpoint" : {
          "description" : "The endpoint.",
          "type" : "string"
        },
        "AuthorizationConfig" : {
          "description" : "The authorization configuration.",
          "$ref" : "#/definitions/AuthorizationConfig"
        }
      },
      "required" : [ "Endpoint" ]
    },
    "LambdaConfig" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "LambdaFunctionArn" : {
          "description" : "The ARN for the Lambda function.",
          "type" : "string"
        }
      },
      "required" : [ "LambdaFunctionArn" ]
    },
    "ElasticsearchConfig" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "AwsRegion" : {
          "description" : "The AWS Region.",
          "type" : "string"
        },
        "Endpoint" : {
          "description" : "The endpoint.",
          "type" : "string"
        }
      },
      "required" : [ "AwsRegion", "Endpoint" ]
    },
    "DynamoDBConfig" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "TableName" : {
          "description" : "The table name.",
          "type" : "string"
        },
        "DeltaSyncConfig" : {
          "description" : "The DeltaSyncConfig for a versioned datasource.",
          "$ref" : "#/definitions/DeltaSyncConfig"
        },
        "UseCallerCredentials" : {
          "description" : "Set to TRUE to use AWS Identity and Access Management with this data source.",
          "type" : "boolean"
        },
        "AwsRegion" : {
          "description" : "The AWS Region.",
          "type" : "string"
        },
        "Versioned" : {
          "description" : "Set to TRUE to use Conflict Detection and Resolution with this data source.",
          "type" : "boolean"
        }
      },
      "required" : [ "TableName", "AwsRegion" ]
    }
  },
  "required" : [ "Type", "ApiId", "Name" ],
  "createOnlyProperties" : [ "/properties/ApiId", "/properties/Name" ],
  "primaryIdentifier" : [ "/properties/DataSourceArn" ],
  "readOnlyProperties" : [ "/properties/DataSourceArn" ],
  "deprecatedProperties" : [ "/properties/ElasticsearchConfig" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "appsync:CreateDataSource", "appsync:GetDataSource", "iam:PassRole" ]
    },
    "read" : {
      "permissions" : [ "appsync:GetDataSource" ]
    },
    "update" : {
      "permissions" : [ "appsync:UpdateDataSource", "iam:PassRole" ]
    },
    "delete" : {
      "permissions" : [ "appsync:DeleteDataSource", "appsync:GetDataSource" ]
    },
    "list" : {
      "handlerSchema" : {
        "properties" : {
          "ApiId" : {
            "$ref" : "resource-schema.json#/properties/ApiId"
          }
        },
        "required" : [ "ApiId" ]
      },
      "permissions" : [ "appsync:ListDataSources" ]
    }
  }
}