> ## Documentation Index
> Fetch the complete documentation index at: https://datum-4926dda5-docs-api-reference-demo.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ResourceClaim

> ResourceClaim requests quota allocation during resource creation, consuming quota capacity from AllowanceBuckets.

<Note>
  API resource reference for **ResourceClaim**, part of the [Quota service](/api/quota/overview). To create or change one, see [Changing resources](/datumctl/resources/changing); to inspect, see [Reading resources](/datumctl/resources/reading).
</Note>

<Warning>
  This resource is part of the `v1alpha1` API and is subject to change. Fields and behavior may change in future releases.
</Warning>

## Identity

|         |                      |
| ------- | -------------------- |
| Group   | `quota.miloapis.com` |
| Version | `v1alpha1`           |
| Kind    | `ResourceClaim`      |
| Scope   | Project              |

## Overview

A `ResourceClaim` requests quota allocation when a resource is created. Each claim consumes quota capacity from the matching `AllowanceBucket` and links back to the resource that triggered it, so quota usage can be tracked, audited, and cleaned up over its lifecycle.

Most claims are created automatically by a `ClaimCreationPolicy` during admission, but administrators can also create them by hand for testing or special allocation scenarios. All requests in a single claim are evaluated atomically: either every request has sufficient quota and the whole claim is granted, or any shortage denies the entire claim. Once granted, a claim reserves the requested amounts until it is deleted.

## Spec fields

| Field                          | Type      | Required | Description                                                                                                                                                                              |
| ------------------------------ | --------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `spec.requests`                | \[]Object | Yes      | The resource types and amounts being claimed. Minimum 1, maximum 20 requests per claim; each resource type may appear only once. Processed atomically.                                   |
| `spec.requests[].resourceType` | string    | Yes      | Identifies the resource type being claimed. Must exactly match an active `ResourceRegistration.spec.resourceType` (e.g. `resourcemanager.miloapis.com/projects`, `compute_cpu`).         |
| `spec.requests[].amount`       | integer   | Yes      | How much quota to claim, measured in the BaseUnit from the `ResourceRegistration`. Use `1` for single instances (Entity registrations) or a capacity value for Allocation registrations. |
| `spec.consumerRef`             | Object    | No       | Identifies the quota consumer making the claim. Can be omitted when created via `ClaimCreationPolicy` (auto-filled from the authenticated context).                                      |
| `spec.consumerRef.kind`        | string    | Yes\*    | Type of consumer resource (e.g. `Organization`, `Project`, `User`). Required when `consumerRef` is set.                                                                                  |
| `spec.consumerRef.name`        | string    | Yes\*    | Name of the specific consumer instance. Required when `consumerRef` is set.                                                                                                              |
| `spec.consumerRef.apiGroup`    | string    | No       | API group of the consumer resource (e.g. `resourcemanager.miloapis.com`, `iam.miloapis.com`).                                                                                            |
| `spec.consumerRef.namespace`   | string    | No       | Scope of the consumer resource. Required for Project-scoped consumers (e.g. Projects); empty for Platform-scoped consumers (e.g. Organizations).                                         |
| `spec.resourceRef`             | Object    | No       | Identifies the resource that triggered this claim. Auto-populated by `ClaimCreationPolicy` during admission.                                                                             |
| `spec.resourceRef.kind`        | string    | Yes\*    | Type of the referenced resource (e.g. `Project`, `User`, `Organization`). Required when `resourceRef` is set.                                                                            |
| `spec.resourceRef.name`        | string    | Yes\*    | Name of the specific triggering resource instance. Required when `resourceRef` is set.                                                                                                   |
| `spec.resourceRef.apiGroup`    | string    | No       | API group of the referenced resource (e.g. `resourcemanager.miloapis.com`).                                                                                                              |
| `spec.resourceRef.namespace`   | string    | No       | Scope containing the referenced resource. Required for Project-scoped resources, omitted for Platform-scoped ones.                                                                       |

<Note>
  Fields marked Yes\* are required only when their parent object (`consumerRef` or `resourceRef`) is present.
</Note>

## Status fields (read-only)

| Field                                     | Type      | Description                                                                                                                                                                      |
| ----------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `status.conditions`                       | \[]Object | Overall claim evaluation status. The `Granted` condition indicates approval, with reasons such as `QuotaAvailable`, `QuotaExceeded`, `ValidationFailed`, or `PendingEvaluation`. |
| `status.allocations`                      | \[]Object | Per-request allocation detail, one entry per `spec.requests` item, indexed by resource type.                                                                                     |
| `status.allocations[].resourceType`       | string    | Which request this allocation describes; matches a `spec.requests[].resourceType`.                                                                                               |
| `status.allocations[].status`             | string    | Allocation result for this request: `Granted`, `Denied`, or `Pending`.                                                                                                           |
| `status.allocations[].allocatedAmount`    | integer   | How much quota was allocated. Equals the requested amount when granted, `0` when denied or pending.                                                                              |
| `status.allocations[].allocatingBucket`   | string    | Name of the `AllowanceBucket` that provided the quota. Set only when granted.                                                                                                    |
| `status.allocations[].reason`             | string    | Machine-readable status reason (e.g. `QuotaAvailable`, `QuotaExceeded`, `ValidationFailed`).                                                                                     |
| `status.allocations[].message`            | string    | Human-readable explanation of the allocation result.                                                                                                                             |
| `status.allocations[].lastTransitionTime` | string    | When this allocation status last changed.                                                                                                                                        |
| `status.observedGeneration`               | integer   | Most recent spec generation the system has processed.                                                                                                                            |

## Usage

```yaml theme={null}
apiVersion: quota.miloapis.com/v1alpha1
kind: ResourceClaim
metadata:
  name: web-app-project-claim
spec:
  consumerRef:
    apiGroup: resourcemanager.miloapis.com
    kind: Organization
    name: acme-corp
  resourceRef:
    apiGroup: resourcemanager.miloapis.com
    kind: Project
    name: web-app-project
    namespace: acme-corp
  requests:
    - resourceType: resourcemanager.miloapis.com/projects
      amount: 1
```

```bash theme={null}
datumctl apply -f resourceclaim.yaml --project my-project
datumctl get resourceclaims --project my-project
datumctl describe resourceclaim web-app-project-claim --project my-project
```

<Tip>
  Run `datumctl explain resourceclaims --recursive` to see the full, live field tree for this resource.
</Tip>
