{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-cost-management/json-schema/microsoft-azure-cost-management-cost-allocation-rule-list-schema.json",
  "title": "CostAllocationRuleList",
  "description": "Result of listing cost allocation rules. It contains a list of available rules in the billing account or enterprise enrollment provided.",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_superseded/microsoft-azure-cost-management-costallocationruledefinitions-api-openapi.yml#/components/schemas/CostAllocationRuleList",
  "type": "object",
  "properties": {
    "value": {
      "type": "array",
      "description": "The list of cost allocation rules.",
      "items": {
        "$ref": "#/$defs/CostAllocationRuleDefinition"
      },
      "x-ms-identifiers": [
        "id"
      ]
    },
    "nextLink": {
      "type": "string",
      "description": "URL to get the next set of rule list results if there are any."
    }
  },
  "$defs": {
    "CostAllocationPolicyType": {
      "type": "string",
      "description": "Method to use for allocating cost. FixedProportion indicates that cost will be split based on specified percentage values.",
      "enum": [
        "FixedProportion"
      ],
      "x-ms-enum": {
        "name": "CostAllocationPolicyType",
        "modelAsString": true,
        "values": [
          {
            "name": "FixedProportion",
            "value": "FixedProportion"
          }
        ]
      }
    },
    "CostAllocationProportion": {
      "type": "object",
      "description": "Target resources and allocation",
      "properties": {
        "name": {
          "type": "string",
          "description": "Target resource for cost allocation"
        },
        "percentage": {
          "type": "number",
          "format": "float",
          "description": "Percentage of source cost to allocate to this resource. This value can be specified to two decimal places and the total percentage of all resources in this rule must sum to 100.00."
        }
      },
      "required": [
        "name",
        "percentage"
      ]
    },
    "CostAllocationResource": {
      "type": "object",
      "description": "Common values for resources for cost allocation",
      "properties": {
        "resourceType": {
          "$ref": "#/$defs/CostAllocationResourceType",
          "description": "Type of resources contained in this cost allocation rule"
        },
        "name": {
          "type": "string",
          "description": "If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag"
        }
      },
      "required": [
        "resourceType",
        "name"
      ]
    },
    "CostAllocationResourceType": {
      "type": "string",
      "description": "Category of resource to use for allocation.",
      "enum": [
        "Dimension",
        "Tag"
      ],
      "x-ms-enum": {
        "name": "CostAllocationResourceType",
        "modelAsString": true,
        "values": [
          {
            "name": "Dimension",
            "value": "Dimension",
            "description": "Indicates an Azure dimension such as a subscription id or resource group name is being used for allocation."
          },
          {
            "name": "Tag",
            "value": "Tag",
            "description": "Allocates cost based on Azure Tag key value pairs."
          }
        ]
      }
    },
    "CostAllocationRuleDefinition": {
      "type": "object",
      "description": "The cost allocation rule model definition",
      "properties": {
        "properties": {
          "$ref": "#/$defs/CostAllocationRuleProperties",
          "description": "Cost allocation rule properties"
        }
      },
      "allOf": [
        {
          "$ref": "../../../../../../common-types/resource-management/v5/types.json#/definitions/ProxyResource"
        }
      ]
    },
    "CostAllocationRuleDetails": {
      "type": "object",
      "description": "Resource details of the cost allocation rule",
      "properties": {
        "sourceResources": {
          "type": "array",
          "description": "Source resources for cost allocation. At this time, this list can contain no more than one element.",
          "items": {
            "$ref": "#/$defs/SourceCostAllocationResource"
          },
          "x-ms-identifiers": [
            "name"
          ]
        },
        "targetResources": {
          "type": "array",
          "description": "Target resources for cost allocation. At this time, this list can contain no more than one element.",
          "items": {
            "$ref": "#/$defs/TargetCostAllocationResource"
          },
          "x-ms-identifiers": [
            "name"
          ]
        }
      }
    },
    "CostAllocationRuleProperties": {
      "type": "object",
      "description": "The properties of a cost allocation rule",
      "properties": {
        "description": {
          "type": "string",
          "description": "Description of a cost allocation rule."
        },
        "details": {
          "$ref": "#/$defs/CostAllocationRuleDetails",
          "description": "Resource information for the cost allocation rule"
        },
        "status": {
          "$ref": "#/$defs/RuleStatus",
          "description": "Status of the rule"
        },
        "createdDate": {
          "type": "string",
          "format": "date-time",
          "description": "Time at which the rule was created. Rules that change cost for the same resource are applied in order of creation.",
          "readOnly": true
        },
        "updatedDate": {
          "type": "string",
          "format": "date-time",
          "description": "Time at which the rule was last updated.",
          "readOnly": true
        }
      },
      "required": [
        "details",
        "status"
      ]
    },
    "RuleStatus": {
      "type": "string",
      "description": "Current status of the rule.",
      "enum": [
        "NotActive",
        "Active",
        "Processing"
      ],
      "x-ms-enum": {
        "name": "RuleStatus",
        "modelAsString": true,
        "values": [
          {
            "name": "NotActive",
            "value": "NotActive",
            "description": "Rule is saved but not used to allocate costs."
          },
          {
            "name": "Active",
            "value": "Active",
            "description": "Rule is saved and impacting cost allocation."
          },
          {
            "name": "Processing",
            "value": "Processing",
            "description": "Rule is saved and cost allocation is being updated. Readonly value that cannot be submitted in a put request."
          }
        ]
      }
    },
    "SourceCostAllocationResource": {
      "type": "object",
      "description": "Source resources for cost allocation",
      "properties": {
        "values": {
          "type": "array",
          "description": "Source Resources for cost allocation. This list cannot contain more than 25 values.",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "values"
      ],
      "allOf": [
        {
          "$ref": "#/$defs/CostAllocationResource"
        }
      ]
    },
    "TargetCostAllocationResource": {
      "type": "object",
      "description": "Target resources for cost allocation.",
      "properties": {
        "values": {
          "type": "array",
          "description": "Target resources for cost allocation. This list cannot contain more than 25 values.",
          "items": {
            "$ref": "#/$defs/CostAllocationProportion"
          },
          "x-ms-identifiers": [
            "name"
          ]
        },
        "policyType": {
          "$ref": "#/$defs/CostAllocationPolicyType",
          "description": "Method of cost allocation for the rule"
        }
      },
      "required": [
        "values",
        "policyType"
      ],
      "allOf": [
        {
          "$ref": "#/$defs/CostAllocationResource"
        }
      ]
    }
  }
}