Azion `Client` interface
Interact with Azion products and services through Azion Libraries' Client interface.
The Azion Client interface provides a unified interface to interact with all products and services. You can use the client to access and manage all products and functionalities across Storage, SQL, Purge, KV, Domains, and more.
When instantiating a client, you can define configurations such as token and debug explicitly as parameters. You can then interact with Azion functionalities directly through the client, in a simplified and centralized way.
Using Azion Client
To use the Client interface, you must import the createClient function from Azion Lib. You can then pass your token as a parameter and use the instance of client to access modules and their functionalities.
The example below shows an implementation in JavaScript:
If you’re using TypeScript, import the appropriate types as in the example below:
Azion Client vs independent package Functions
Alternatively, if you prefer to use individual functions directly from each package, you need to configure tokens and settings via environment variables (for example, using a .env file).
Each module has its own internal client that manages the interactions. The following example shows the usage of a client for a specific module:
It’s also possible to use specific functions directly from their packages, without using a client, as shown in the example below.
This flexibility allows you to either manage everything through the client for simplicity or call specific functions from each package with more control over environment configurations.
Available modules
The Azion Client provides access to the following modules:
| Module | Description |
|---|---|
storage | Manage buckets and objects in Object Storage. |
sql | Create and query SQL databases. |
purge | Purge cache by URL, cache key, or wildcard. |
domains | Manage domains and their configurations. |
kv | Interact with KV Store using a Redis-like API. |
Using the KV module
The kv module provides a Redis-like interface for key-value operations:
For more details on KV operations, see the KV library documentation.