Marketplace Resource Identifiers
This document describes the identifier fields used in Waldur marketplace Resources and provides examples of how they work with OpenStack instances and volumes.
Identifier Fields Overview
The marketplace Resource model (src/waldur_mastermind/marketplace/models.py:1255
) provides a comprehensive identifier system through various mixins and direct fields:
Field | Type | Source | Purpose | Uniqueness | Notes |
---|---|---|---|---|---|
id |
int |
Django AutoField | Primary key | Globally unique | Auto-incremented database ID |
uuid |
UUID |
UuidMixin | External API identifier | Globally unique | Used in REST API endpoints |
name |
CharField(150) |
NameMixin | Human-readable identifier | Per scope | Display name with validation |
slug |
SlugField |
SlugMixin | URL-friendly identifier | Per scope | Auto-generated from name |
backend_id |
CharField(255) |
BackendMixin | Backend system identifier | Per backend | External system mapping |
effective_id |
CharField(255) |
Resource | Remote Waldur identifier | Per remote system | Used for remote provisioning |
content_type |
ForeignKey |
ScopeMixin | Generic relation type | N/A | Part of generic foreign key |
object_id |
PositiveIntegerField |
ScopeMixin | Generic relation ID | N/A | Part of generic foreign key |
Identifier Categories
Internal Identification
id
: Primary key for database operationsuuid
: Public API identifier, used in REST endpoints like/api/marketplace-resources/{uuid}/
Human Identification
name
: User-friendly display nameslug
: URL-safe version of name for web interfaces
External Integration
backend_id
: Maps to external system identifiers (e.g., OpenStack instance UUID)effective_id
: Used when resource is provisioned through remote Waldur instances
Scope Linking
content_type
/object_id
: Generic foreign key linking to the underlying resource implementation
Examples with OpenStack Resources
OpenStack Instance Resource
When a marketplace Resource represents an OpenStack virtual machine (offering type "OpenStack.Instance"
):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
OpenStack Volume Resource
When a marketplace Resource represents an OpenStack volume (offering type "OpenStack.Volume"
):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
Identifier Relationships
API Usage
- REST API endpoints use
uuid
:/api/marketplace-resources/{uuid}/
Backend Synchronization
backend_id
stores the OpenStack UUID for API calls to OpenStack- The linked scope object (Instance/Volume) also stores this UUID in its
backend_id
- This creates a redundant but necessary mapping for efficient queries
Remote Provisioning
effective_id
is used when resources are provisioned through remote Waldur instances- For local OpenStack resources, this field remains empty
- Enables federated deployments where one Waldur manages resources on another
Best Practices
- Always use
uuid
for API operations - it's the stable public identifier - Use
backend_id
for backend system integration - direct mapping to external UUIDs - Leverage scope relationships - access the underlying resource through
resource.scope
- Maintain identifier consistency - ensure
backend_id
matches the scope object's identifiers - Handle effective_id for federation - check this field when dealing with remote resources