> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/infra-controller/llms.txt.
> For full documentation content, see https://docs.nvidia.com/infra-controller/llms-full.txt.

# Retrieve all Allocations

GET https://carbide-rest-api.carbide.svc.cluster.local/v2/org/{org}/carbide/allocation

Retrieve all Allocations for the org.

Provider and Tenant roles are inferred from the org's membership. User must have `FORGE_PROVIDER_ADMIN` or `FORGE_TENANT_ADMIN` role.

Results are returned from both Provider and Tenant perspectives when the org has both roles.

Reference: https://docs.nvidia.com/infra-controller/infra-controller/rest-api-reference/api-reference/allocation/get-all-allocation

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: NCX Infra Controller REST API
  version: 1.0.0
paths:
  /v2/org/{org}/carbide/allocation:
    get:
      operationId: get-all-allocation
      summary: Retrieve all Allocations
      description: >-
        Retrieve all Allocations for the org.


        Provider and Tenant roles are inferred from the org's membership. User
        must have `FORGE_PROVIDER_ADMIN` or `FORGE_TENANT_ADMIN` role.


        Results are returned from both Provider and Tenant perspectives when the
        org has both roles.
      tags:
        - subpackage_allocation
      parameters:
        - name: org
          in: path
          required: true
          schema:
            type: string
        - name: infrastructureProviderId
          in: query
          description: Filter Allocations by Infrastructure Provider ID.
          required: false
          schema:
            type: string
            format: uuid
        - name: tenantId
          in: query
          description: Filter Allocations by Tenant ID.
          required: false
          schema:
            type: string
            format: uuid
        - name: siteId
          in: query
          description: >-
            Filter Allocations by Site ID.  Can be specified multiple times to
            filter on more than one Site ID.
          required: false
          schema:
            type: string
            format: uuid
        - name: id
          in: query
          description: >-
            Filter Allocations by ID.  Can be specified multiple times to filter
            on more than one ID.
          required: false
          schema:
            type: string
        - name: resourceType
          in: query
          description: >-
            Filter Allocations by Constraint Resource Type.  Can be specified
            multiple times to filter on more than one Constraint Resource Type.
          required: false
          schema:
            $ref: >-
              #/components/schemas/V2OrgOrgCarbideAllocationGetParametersResourceType
        - name: status
          in: query
          description: >-
            Filter Allocations by Status.  Can be specified multiple times to
            filter on more than one Status.
          required: false
          schema:
            type: string
        - name: resourceTypeId
          in: query
          description: >-
            Filter Allocations by Constraint Resource Type ID.  Can be specified
            multiple times to filter on more than one Constraint Resource Type
            ID.
          required: false
          schema:
            type: string
        - name: constraintType
          in: query
          description: >-
            Filter Allocations by Constraint Type.  Can be specified multiple
            times to filter on more than one Constraint Type.
          required: false
          schema:
            $ref: >-
              #/components/schemas/V2OrgOrgCarbideAllocationGetParametersConstraintType
        - name: constraintValue
          in: query
          description: >-
            Filter Allocations by Constraint Value.  Can be specified multiple
            times to filter on more than one Constraint Value.
          required: false
          schema:
            type: integer
        - name: query
          in: query
          description: >-
            Search for matches across all Sites. Input will be matched against
            name, description and status fields
          required: false
          schema:
            type: string
        - name: includeRelation
          in: query
          description: Related entity to expand
          required: false
          schema:
            $ref: >-
              #/components/schemas/V2OrgOrgCarbideAllocationGetParametersIncludeRelation
        - name: pageNumber
          in: query
          description: Page number for pagination query
          required: false
          schema:
            type: integer
            default: 1
        - name: pageSize
          in: query
          description: Page size for pagination query
          required: false
          schema:
            type: integer
        - name: orderBy
          in: query
          description: Ordering for pagination query
          required: false
          schema:
            $ref: '#/components/schemas/V2OrgOrgCarbideAllocationGetParametersOrderBy'
        - name: Authorization
          in: header
          description: >-
            ```

            export JWT_BEARER_TOKEN="<jwt-bearer-token>"


            # Example org name: "acme-inc

            export ORG_NAME=<org-name>


            # Use the JWT bearer token in your API request auth header:

            curl -v -X GET -H "Content-Type: application/json" -H
            "Authorization: Bearer $JWT_BEARER_TOKEN"
            https://carbide-rest-api.carbide.svc.cluster.local/v2/org/$ORG_NAME/carbide/user/current

            ```
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Allocation'
        '403':
          description: >-
            Error response when user is not authorized to call an endpoint or
            retrieve/modify objects
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CarbideAPIError'
servers:
  - url: https://carbide-rest-api.carbide.svc.cluster.local
components:
  schemas:
    V2OrgOrgCarbideAllocationGetParametersResourceType:
      type: string
      enum:
        - InstanceType
        - IPBlock
      title: V2OrgOrgCarbideAllocationGetParametersResourceType
    V2OrgOrgCarbideAllocationGetParametersConstraintType:
      type: string
      enum:
        - Reserved
        - OnDemand
        - Preemptible
      title: V2OrgOrgCarbideAllocationGetParametersConstraintType
    V2OrgOrgCarbideAllocationGetParametersIncludeRelation:
      type: string
      enum:
        - InfrastructureProvider
        - Tenant
        - Site
      title: V2OrgOrgCarbideAllocationGetParametersIncludeRelation
    V2OrgOrgCarbideAllocationGetParametersOrderBy:
      type: string
      enum:
        - NAME_ASC
        - NAME_DESC
        - STATUS_ASC
        - STATUS_DESC
        - CREATED_ASC
        - CREATED_DESC
        - UPDATED_ASC
        - UPDATED_DESC
        - SITE_NAME_ASC
        - SITE_NAME_DESC
        - TENANT_ORG_DISPLAY_NAME_ASC
        - TENANT_ORG_DISPLAY_NAME_DESC
        - INSTANCE_TYPE_NAME_ASC
        - INSTANCE_TYPE_NAME_DESC
        - IP_BLOCK_NAME_ASC
        - IP_BLOCK_NAME_DESC
        - CONSTRAINT_VALUE_ASC
        - CONSTRAINT_VALUE_DESC
      title: V2OrgOrgCarbideAllocationGetParametersOrderBy
    AllocationStatus:
      type: string
      enum:
        - Pending
        - Registered
        - Deleting
        - Error
      description: Status values for Allocation objects
      title: AllocationStatus
    StatusDetail:
      type: object
      properties:
        status:
          type: string
        message:
          type: string
        created:
          type: string
          format: date-time
        updated:
          type: string
          format: date-time
      description: Describes the details of a status transition for a resource
      title: StatusDetail
    AllocationConstraintResourceType:
      type: string
      enum:
        - InstanceType
        - IPBlock
      description: Type of the Resource that the Allocation Constraint applies to
      title: AllocationConstraintResourceType
    AllocationConstraintConstraintType:
      type: string
      enum:
        - Reserved
        - OnDemand
        - Preemptible
      description: >-
        Type of the Allocation Constraint. Please note that OnDemand and
        Preemptible are not supported by current implementation.
      title: AllocationConstraintConstraintType
    InstanceTypeStatus:
      type: string
      enum:
        - Pending
        - Registering
        - Ready
        - Deleting
        - Error
      description: Status values for Instance Type objects
      title: InstanceTypeStatus
    InstanceTypeSummary:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        infrastructureProviderId:
          type: string
          format: uuid
        siteId:
          type: string
          format: uuid
        status:
          $ref: '#/components/schemas/InstanceTypeStatus'
      description: Describes a subset of core attributes of an Instance Type
      title: InstanceTypeSummary
    IpBlockSummaryRoutingType:
      type: string
      enum:
        - Public
        - DatacenterOnly
      title: IpBlockSummaryRoutingType
    IpBlockStatus:
      type: string
      enum:
        - Pending
        - Provisioning
        - Ready
        - Deleting
        - Error
      description: Status values for IP Block objects
      title: IpBlockStatus
    IpBlockSummary:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        routingType:
          $ref: '#/components/schemas/IpBlockSummaryRoutingType'
        prefix:
          type: string
          description: Either IPv4 or IPv6 address
        prefixLength:
          type: integer
          description: 'Min: 1, Max: 32 for ipv4, 128 for ipv6'
        status:
          $ref: '#/components/schemas/IpBlockStatus'
      description: Describes a subset of core attributes of an IP block
      title: IpBlockSummary
    AllocationConstraint:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: ID of the Allocation Constraint
        allocationId:
          type: string
          format: uuid
          description: ID of the Allocation that contains the Allocation Constraint
        resourceType:
          $ref: '#/components/schemas/AllocationConstraintResourceType'
          description: Type of the Resource that the Allocation Constraint applies to
        resourceTypeId:
          type: string
          format: uuid
          description: >-
            ID of the Resource Type that the Allocation Constraint applies to.
            For InstanceType, this is the ID of the Instance Type. For IPBlock,
            this is the ID of the IP Block.
        constraintType:
          $ref: '#/components/schemas/AllocationConstraintConstraintType'
          description: >-
            Type of the Allocation Constraint. Please note that OnDemand and
            Preemptible are not supported by current implementation.
        constraintValue:
          type: integer
          description: >-
            Value of the Allocation Constraint. For InstanceType, this value
            represents number of Machines allocated for Tenant. For IPBlock,
            this value represents the prefix Length of the IP Block.
        derivedResourceId:
          type:
            - string
            - 'null'
          description: ID of the allocated Tenant IP Block when resource type is IPBlock
        instanceType:
          $ref: '#/components/schemas/InstanceTypeSummary'
        ipBlock:
          $ref: '#/components/schemas/IpBlockSummary'
        created:
          type: string
          format: date-time
          description: Date/time when the Allocation Constraint was created
        updated:
          type: string
          format: date-time
          description: Date/time when the Allocation Constraint was last updated
      description: >-
        Constraints on an Allocation that specify limits for different resource
        types
      title: AllocationConstraint
    Allocation:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: ID of the Allocation
        name:
          type: string
          description: Concise and descriptive name of the Allocation
        description:
          type: string
          description: Detailed description of the Allocation
        infrastructureProviderId:
          type: string
          format: uuid
          description: ID of the Infrastructure Provider that created the Allocation
        tenantId:
          type: string
          format: uuid
          description: ID of the Tenant that received the Allocation
        siteId:
          type: string
          format: uuid
          description: ID of the Site where resources are allocated
        status:
          $ref: '#/components/schemas/AllocationStatus'
        statusHistory:
          type: array
          items:
            $ref: '#/components/schemas/StatusDetail'
        allocationConstraints:
          type: array
          items:
            $ref: '#/components/schemas/AllocationConstraint'
        created:
          type: string
          format: date-time
          description: Date/time when the Allocation was created
        updated:
          type: string
          format: date-time
          description: Date/time when the Allocation was last updated
      description: >-
        Specifies a group of resources on a Site that has been allocated to a
        Tenant
      title: Allocation
    CarbideApiErrorSource:
      type: string
      enum:
        - carbide
      description: Source of the error. Only 'carbide' is supported
      title: CarbideApiErrorSource
    CarbideApiErrorData:
      type: object
      properties: {}
      description: Additional data about the error
      title: CarbideApiErrorData
    CarbideAPIError:
      type: object
      properties:
        source:
          $ref: '#/components/schemas/CarbideApiErrorSource'
          description: Source of the error. Only 'carbide' is supported
        message:
          type: string
          description: Message describing the error
        data:
          oneOf:
            - $ref: '#/components/schemas/CarbideApiErrorData'
            - type: 'null'
          description: Additional data about the error
      description: Describes the error response from NCX Infra Controller REST API
      title: CarbideAPIError
  securitySchemes:
    JWTBearerToken:
      type: http
      scheme: bearer
      description: >-
        ```

        export JWT_BEARER_TOKEN="<jwt-bearer-token>"


        # Example org name: "acme-inc

        export ORG_NAME=<org-name>


        # Use the JWT bearer token in your API request auth header:

        curl -v -X GET -H "Content-Type: application/json" -H "Authorization:
        Bearer $JWT_BEARER_TOKEN"
        https://carbide-rest-api.carbide.svc.cluster.local/v2/org/$ORG_NAME/carbide/user/current

        ```

```

## SDK Code Examples

```python example-1
import requests

url = "https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/allocation"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript example-1
const url = 'https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/allocation';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go example-1
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/allocation"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby example-1
require 'uri'
require 'net/http'

url = URI("https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/allocation")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java example-1
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/allocation")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php example-1
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/allocation', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp example-1
using RestSharp;

var client = new RestClient("https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/allocation");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift example-1
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://carbide-rest-api.carbide.svc.cluster.local/v2/org/org/carbide/allocation")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```