{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-clean-rooms/json-schema/amazon-clean-rooms-update-configured-table-analysis-rule-input-schema.json",
  "title": "UpdateConfiguredTableAnalysisRuleInput",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-clean-rooms-analysisrule-api-openapi.yml#/components/schemas/UpdateConfiguredTableAnalysisRuleInput",
  "type": "object",
  "properties": {
    "configuredTableIdentifier": {
      "type": "string",
      "description": "The unique identifier for the configured table that the analysis rule applies to. Currently accepts the configured table ID."
    },
    "analysisRuleType": {
      "type": "string",
      "enum": [
        "AGGREGATION",
        "LIST",
        "CUSTOM"
      ],
      "description": "The analysis rule type to be updated. Configured table analysis rules are uniquely identified by their configured table identifier and analysis rule type."
    },
    "analysisRulePolicy": {
      "$ref": "#/$defs/ConfiguredTableAnalysisRulePolicy"
    }
  },
  "required": [
    "configuredTableIdentifier",
    "analysisRuleType",
    "analysisRulePolicy"
  ],
  "$defs": {
    "AggregateColumn": {
      "type": "object",
      "properties": {
        "columnNames": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Column names in configured table of aggregate columns."
        },
        "function": {
          "type": "string",
          "description": "Aggregation function that can be applied to aggregate column in query."
        }
      },
      "required": [
        "columnNames",
        "function"
      ]
    },
    "AggregationConstraint": {
      "type": "object",
      "properties": {
        "columnName": {
          "type": "string",
          "description": "Column in aggregation constraint for which there must be a minimum number of distinct values in an output row for it to be in the query output."
        },
        "minimum": {
          "type": "integer",
          "description": "The minimum number of distinct values that an output row must be an aggregation of. Minimum threshold of distinct values for a specified column that must exist in an output row for it to be in the query output."
        },
        "type": {
          "type": "string",
          "description": "The type of aggregation the constraint allows. The only valid value is currently `COUNT_DISTINCT`."
        }
      },
      "required": [
        "columnName",
        "minimum",
        "type"
      ]
    },
    "AggregationThreshold": {
      "type": "object",
      "properties": {
        "identityColumns": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The identity column, such as user_id, whose distinct values Clean Rooms counts to enforce minimum aggregation thresholds. Currently, you can specify only one column, and its data type must be string, varchar, or char."
        },
        "minimumIdentityCount": {
          "type": "integer",
          "description": "The minimum number of distinct identities that each query output group must represent. This threshold applies to all output columns in the table. To override this threshold for a specific column, use outputColumnThresholds."
        },
        "type": {
          "type": "string",
          "enum": [
            "COUNT_DISTINCT"
          ],
          "description": "The type of aggregation that the threshold enforces. Currently, the only supported value is COUNT_DISTINCT, which counts the distinct values in the identity column."
        },
        "outputColumnThresholds": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/OutputColumnThreshold"
          },
          "description": "The per-column overrides of minimumIdentityCount. An output column without an override uses minimumIdentityCount."
        },
        "allowedAggregateExpressionType": {
          "type": "string",
          "enum": [
            "COLUMNS_ONLY",
            "ANY_EXPRESSION"
          ],
          "description": "Specifies whether a query can aggregate a transformed column. This applies to the arguments of both aggregate and window functions. Valid values are: COLUMNS_ONLY – A query can aggregate only a direct column reference, such as SUM(amount), or a constant. Clean Rooms rejects a query that transforms a column and then aggregates it, such as SUM(amount * 2) or SUM(ROUND(amount)). ANY_EXPRESSION – A query can aggregate any expression. This includes arithmetic, such as SUM(price * quantity); a cast, such as SUM(CAST(amount AS DECIMAL)); a nested function call, such as SUM(COALESCE(amount, 0)); and a"
        }
      },
      "required": [
        "identityColumns",
        "minimumIdentityCount",
        "type",
        "allowedAggregateExpressionType"
      ]
    },
    "AnalysisRuleAggregation": {
      "type": "object",
      "properties": {
        "aggregateColumns": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AggregateColumn"
          },
          "description": "The columns that query runners are allowed to use in aggregation queries."
        },
        "joinColumns": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Columns in configured table that can be used in join statements and/or as aggregate columns. They can never be outputted directly."
        },
        "joinRequired": {
          "type": "string",
          "description": "Control that requires member who runs query to do a join with their configured table and/or other configured table in query."
        },
        "allowedJoinOperators": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Which logical operators (if any) are to be used in an INNER JOIN match condition. Default is AND."
        },
        "dimensionColumns": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The columns that query runners are allowed to select, group by, or filter by."
        },
        "scalarFunctions": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Set of scalar functions that are allowed to be used on dimension columns and the output of aggregation of metrics."
        },
        "outputConstraints": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AggregationConstraint"
          },
          "description": "Columns that must meet a specific threshold value (after an aggregation function is applied to it) for each output row to be returned."
        },
        "additionalAnalyses": {
          "type": "string",
          "enum": [
            "ALLOWED",
            "REQUIRED",
            "NOT_ALLOWED"
          ],
          "description": "An indicator as to whether additional analyses (such as Clean Rooms ML) can be applied to the output of the direct query. The additionalAnalyses parameter is currently supported for the list analysis rule (AnalysisRuleList) and the custom analysis rule (AnalysisRuleCustom)."
        }
      },
      "required": [
        "aggregateColumns",
        "joinColumns",
        "dimensionColumns",
        "scalarFunctions",
        "outputConstraints"
      ]
    },
    "AnalysisRuleCustom": {
      "type": "object",
      "properties": {
        "allowedAnalyses": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The ARN of the analysis templates that are allowed by the custom analysis rule."
        },
        "allowedAnalysisProviders": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The IDs of the Amazon Web Services accounts that are allowed to query by the custom analysis rule. Required when allowedAnalyses is ANY_QUERY."
        },
        "additionalAnalyses": {
          "type": "string",
          "enum": [
            "ALLOWED",
            "REQUIRED",
            "NOT_ALLOWED"
          ],
          "description": "An indicator as to whether additional analyses (such as Clean Rooms ML) can be applied to the output of the direct query."
        },
        "disallowedOutputColumns": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "A list of columns that aren't allowed to be shown in the query output."
        },
        "differentialPrivacy": {
          "$ref": "#/$defs/DifferentialPrivacyConfiguration"
        },
        "aggregationThresholds": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AggregationThreshold"
          },
          "description": "The aggregation thresholds that each query output group must satisfy. Clean Rooms filters out any group that represents fewer than the specified number of distinct identities. You can specify at most one threshold. You can't use aggregation thresholds with differential privacy, or when allowedAnalyses allows only jobs."
        },
        "comparisonControls": {
          "$ref": "#/$defs/ComparisonControls"
        },
        "allowedResultReceivers": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The list of Amazon Web Services account IDs that are allowed to receive results from queries run on the configured table."
        },
        "allowedAdditionalAnalyses": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The list of allowed additional analyses for the custom analysis rule."
        }
      },
      "required": [
        "allowedAnalyses"
      ]
    },
    "AnalysisRuleList": {
      "type": "object",
      "properties": {
        "joinColumns": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Columns that can be used to join a configured table with the table of the member who can query and other members' configured tables."
        },
        "allowedJoinOperators": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The logical operators (if any) that are to be used in an INNER JOIN match condition. Default is AND."
        },
        "listColumns": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Columns that can be listed in the output."
        },
        "additionalAnalyses": {
          "type": "string",
          "enum": [
            "ALLOWED",
            "REQUIRED",
            "NOT_ALLOWED"
          ],
          "description": "An indicator as to whether additional analyses (such as Clean Rooms ML) can be applied to the output of the direct query."
        }
      },
      "required": [
        "joinColumns",
        "listColumns"
      ]
    },
    "ComparisonControls": {
      "type": "object",
      "properties": {
        "allowedLiteralComparisonColumns": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The columns that a query can compare to literal values, for example, in a WHERE clause. Clean Rooms rejects a query that compares any other column to a literal value. Specify an empty list to block literal comparison on every column. You can't specify a column that you also use as an identity column in an aggregation threshold."
        },
        "allowedColumnComparisonColumns": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The columns that a query can compare to another column, for example, in a join, a WHERE clause, a GROUP BY clause, or a window function. Clean Rooms rejects a query that uses any other column in a column-to-column comparison. Specify an empty list to block column-to-column comparison on every column."
        }
      },
      "required": [
        "allowedLiteralComparisonColumns",
        "allowedColumnComparisonColumns"
      ]
    },
    "ConfiguredTableAnalysisRulePolicy": {
      "type": "object",
      "properties": {
        "v1": {
          "$ref": "#/$defs/ConfiguredTableAnalysisRulePolicyV1"
        }
      },
      "description": "Exactly one member is set."
    },
    "ConfiguredTableAnalysisRulePolicyV1": {
      "type": "object",
      "properties": {
        "list": {
          "$ref": "#/$defs/AnalysisRuleList"
        },
        "aggregation": {
          "$ref": "#/$defs/AnalysisRuleAggregation"
        },
        "custom": {
          "$ref": "#/$defs/AnalysisRuleCustom"
        }
      },
      "description": "Exactly one member is set."
    },
    "DifferentialPrivacyColumn": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the column, such as user_id, that contains the unique identifier of your users, whose privacy you want to protect. If you want to turn on differential privacy for two or more tables in a collaboration, you must configure the same column as the user identifier column in both analysis rules."
        }
      },
      "required": [
        "name"
      ]
    },
    "DifferentialPrivacyConfiguration": {
      "type": "object",
      "properties": {
        "columns": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DifferentialPrivacyColumn"
          },
          "description": "The name of the column (such as user_id) that contains the unique identifier of your users whose privacy you want to protect. If you want to turn on diﬀerential privacy for two or more tables in a collaboration, you must conﬁgure the same column as the user identiﬁer column in both analysis rules."
        }
      },
      "required": [
        "columns"
      ]
    },
    "OutputColumnThreshold": {
      "type": "object",
      "properties": {
        "outputColumnName": {
          "type": "string",
          "description": "The name of the output column that the override applies to. You can specify each column only once."
        },
        "minimumIdentityCount": {
          "type": "integer",
          "description": "The minimum number of distinct identities that each query output group must represent for this column. Specify 0 to exempt the column from the threshold, or a value of 2 or greater to enforce a threshold."
        }
      },
      "required": [
        "outputColumnName",
        "minimumIdentityCount"
      ]
    }
  }
}