## create_resource()


Create a new resource with the given name and kind.


Usage


``` python
create_resource(
    name,
    kind="default",
)
```


Initializes a resource and registers it in the internal registry. Uses [validate_input()](validate_input.md#gdtest_stress_everything.validate_input) to check the name and [ResourceManager](ResourceManager.md#gdtest_stress_everything.ResourceManager) for lifecycle management.

> **Note: Added in version 2.0**

> **Note: Note**
>
> This replaces the deprecated `make_resource` function.


## Parameters


`name: str`  
The name of the resource. Must be non-empty and contain only alphanumeric characters and hyphens.

`kind: str = ``"default"`  
The type of resource to create. One of `"default"`, `"premium"`, or `"ephemeral"`. Defaults to `"default"`.


## Returns


`dict`  
A dictionary with the following keys:

- `"name"` -- the resource name (str).
- `"kind"` -- the resource kind (str).
- `"id"` -- the assigned resource ID (int).


## Raises


`ValueError`  
If `name` is empty or `kind` is not recognized.


## Notes

Resources created with `kind="ephemeral"` are automatically garbage-collected after 24 hours. The cleanup runs on a background timer managed by [ResourceManager](ResourceManager.md#gdtest_stress_everything.ResourceManager).

The resource ID is assigned sequentially using an atomic counter, so IDs are guaranteed to be unique within a single process.


## See Also

[ResourceManager](ResourceManager.md#gdtest_stress_everything.ResourceManager)  
Manages resource lifecycle.

[validate_input()](validate_input.md#gdtest_stress_everything.validate_input)  
Validates resource names.


## Examples

Create a default resource:

``` python
>>> res = create_resource("my-item")
>>> res["kind"]
```

'default'

Create a premium resource:

``` python
>>> res = create_resource("premium-item", kind="premium")
>>> res["name"]
```

'premium-item'
