(cls, instance)
| 119 | |
| 120 | @classmethod |
| 121 | def to_model(cls, instance): |
| 122 | # If PrimaryKey ID is provided, - we want to work with existing ST2 API key |
| 123 | id = getattr(instance, "id", None) |
| 124 | user = str(instance.user) if instance.user else None |
| 125 | key_hash = getattr(instance, "key_hash", None) |
| 126 | metadata = getattr(instance, "metadata", {}) |
| 127 | enabled = bool(getattr(instance, "enabled", True)) |
| 128 | model = cls.model( |
| 129 | id=id, user=user, key_hash=key_hash, metadata=metadata, enabled=enabled |
| 130 | ) |
| 131 | return model |
| 132 | |
| 133 | |
| 134 | class ApiKeyCreateResponseAPI(BaseAPI): |
nothing calls this directly
no outgoing calls
no test coverage detected