### Install Scaleway Baremetal SDK Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/baremetal/README.md Installs the Scaleway Baremetal SDK and client packages using npm, pnpm, or yarn. Requires prior setup of access and secret keys. ```bash npm install @scaleway/sdk-baremetal @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-baremetal @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-baremetal @scaleway/sdk-client ``` -------------------------------- ### Scaleway SDK for JavaScript - Serverless Deployment Example Source: https://context7.com/scaleway/scaleway-sdk-js/llms.txt This section demonstrates how to deploy the Scaleway SDK for JavaScript within serverless functions, including setup, client creation, and examples for listing, getting, and creating namespaces. ```APIDOC ## Deploying SDK in serverless functions This documentation outlines the setup and usage of the Scaleway SDK for JavaScript within serverless function environments. It covers initializing the SDK client using environment variables and provides practical examples for common API operations like managing namespaces. ### Setup 1. **Install SDK:** Ensure the Scaleway SDK is installed in your project. 2. **Load Configuration:** Use `loadProfileFromEnvironmentValues()` to load credentials and configuration from environment variables (e.g., `SCW_ACCESS_KEY`, `SCW_SECRET_KEY`). 3. **Create Client:** Instantiate the SDK client with the loaded profile. 4. **Instantiate API:** Create an instance of the specific API class (e.g., `Registry.v1.API`) using the client. ### Helper Functions - `buildJsonResponse(data: object): LambdaResponse`: Constructs a standard JSON response for successful API calls. - `buildErrorResponse(error?: unknown): LambdaResponse`: Constructs an error response, handling Scaleway-specific errors and generic errors. ### API Endpoints Examples #### List Namespaces - **Description**: Retrieves a list of all namespaces. - **Method**: `GET` (simulated within serverless function) - **Endpoint**: `/namespaces` (example path for a serverless function) - **Request Body**: None - **Response Example (Success)**: ```json { "namespaces": [...], "count": 5, "timestamp": "2023-10-27T10:00:00.000Z" } ``` #### Get Namespace - **Description**: Retrieves details for a specific namespace by its ID. - **Method**: `GET` (simulated within serverless function) - **Endpoint**: `/namespaces/{id}` - **Path Parameters**: - `id` (string) - Required - The unique identifier of the namespace. - **Query Parameters**: None - **Request Body**: None - **Response Example (Success)**: ```json { "id": "...", "name": "my-namespace", "description": "Example namespace", "createdAt": "...", "updatedAt": "..." } ``` - **Response Example (Not Found)**: ```json { "error": "Namespace not found" } ``` #### Create Namespace - **Description**: Creates a new namespace. - **Method**: `POST` (simulated within serverless function) - **Endpoint**: `/namespaces` - **Request Body**: ```json { "name": "string", "description": "string", "isPublic": "boolean" (optional, defaults to false) } ``` - **Response Example (Success)**: ```json { "id": "...", "name": "new-namespace", "description": "Newly created namespace", "isPublic": false, "createdAt": "...", "updatedAt": "..." } ``` ### Error Handling - The SDK provides specific error types (e.g., `Errors.ScalewayError`, `Errors.ResourceNotFoundError`). - The `buildErrorResponse` helper function standardizes error responses. - Specific status codes (e.g., 404 for not found) are handled. ``` -------------------------------- ### Create, Manage, and Delete a Virtual Machine (TypeScript) Source: https://context7.com/scaleway/scaleway-sdk-js/llms.txt Provides a comprehensive example of managing a virtual machine using the Scaleway Instance API. It covers creating a server with specific configurations (image, volume, tags), starting it, waiting for it to be running, updating its properties, stopping it, and finally deleting it. ```typescript import { createClient } from '@scaleway/sdk-client' import { Instance } from '@scaleway/sdk' import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader' const client = createClient(loadProfileFromConfigurationFile()) const api = new Instance.v1.API(client) // Create a new server const createResponse = await api.createServer({ zone: 'fr-par-1', name: 'my-web-server', commercialType: 'DEV1-S', image: 'ubuntu_jammy', // Ubuntu 22.04 enableIpv6: true, volumes: { '0': { name: 'root-volume', size: 20000000000, // 20 GB in bytes volumeType: 'l_ssd', } }, tags: ['web', 'production'], }) const server = createResponse.server console.log(`Server created: ${server?.id}`) // Start the server await api.serverAction({ zone: 'fr-par-1', serverId: server?.id ?? '', action: 'poweron', }) // Wait for server to be running (with automatic retry) const runningServer = await api.waitForServer({ zone: 'fr-par-1', serverId: server?.id ?? '', }, { timeout: 300000, // 5 minutes stop: (server) => server.state === 'running' || server.state === 'stopped', }) console.log(`Server is now ${runningServer.state}`) console.log(`Public IP: ${runningServer.publicIp?.address}`) // Update server await api.updateServer({ zone: 'fr-par-1', serverId: server?.id ?? '', name: 'my-updated-web-server', tags: ['web', 'production', 'updated'], }) // Stop and delete server await api.serverAction({ zone: 'fr-par-1', serverId: server?.id ?? '', action: 'poweroff', }) await api.waitForServer({ zone: 'fr-par-1', serverId: server?.id ?? '', }, { stop: (server) => server.state === 'stopped', }) await api.deleteServer({ zone: 'fr-par-1', serverId: server?.id ?? '', }) ``` -------------------------------- ### Install Scaleway SDK Product Catalog (pnpm) Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/product_catalog/README.md Shows the installation steps using pnpm package manager to install the Scaleway SDK for Product Catalog and the client library. ```bash pnpm add @scaleway/sdk-product-catalog @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway SDK Marketplace Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/marketplace/README.md Installs the Marketplace SDK and the core SDK client using various package managers. ```bash npm install @scaleway/sdk-marketplace @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-marketplace @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-marketplace @scaleway/sdk-client ``` -------------------------------- ### Install @scaleway/sdk-audit-trail with pnpm Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/audit_trail/README.md Installs the @scaleway/sdk-audit-trail and @scaleway/sdk-client packages using pnpm. Requires Node.js and pnpm installed. Outputs include successful package installation or errors if dependencies conflict. ```bash pnpm add @scaleway/sdk-audit-trail @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway SDK Product Catalog (npm) Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/product_catalog/README.md Shows the installation steps using npm package manager to install the Scaleway SDK for Product Catalog and the client library. ```bash npm install @scaleway/sdk-product-catalog @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway SDK Product Catalog (yarn) Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/product_catalog/README.md Shows the installation steps using yarn package manager to install the Scaleway SDK for Product Catalog and the client library. ```bash yarn add @scaleway/sdk-product-catalog @scaleway/sdk-client ``` -------------------------------- ### Install @scaleway/sdk-audit-trail with npm Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/audit_trail/README.md Installs the @scaleway/sdk-audit-trail and @scaleway/sdk-client packages using npm. Requires Node.js and npm installed. Outputs include successful package installation or errors if dependencies conflict. ```bash npm install @scaleway/sdk-audit-trail @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway VPC Gateway SDK Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/vpcgw/README.md Installs the @scaleway/sdk-vpcgw package and its client dependency using npm, pnpm, or yarn. Required before using the SDK in a project. ```bash npm install @scaleway/sdk-vpcgw @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-vpcgw @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-vpcgw @scaleway/sdk-client ``` -------------------------------- ### Installing Scaleway SDK for IoT via Package Managers Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/iot/README.md Install the @scaleway/sdk-iot and @scaleway/sdk-client packages using npm, pnpm, or yarn. This setup requires Node.js version 20 or higher. The installation prepares the environment for API interactions without additional dependencies. ```bash npm install @scaleway/sdk-iot @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-iot @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-iot @scaleway/sdk-client ``` -------------------------------- ### Install @scaleway/sdk-audit-trail with yarn Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/audit_trail/README.md Installs the @scaleway/sdk-audit-trail and @scaleway/sdk-client packages using yarn. Requires Node.js and yarn installed. Outputs include successful package installation or errors if dependencies conflict. ```bash yarn add @scaleway/sdk-audit-trail @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway SDK Key Manager (npm) Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/key_manager/README.md Shows how to install the Scaleway SDK Key Manager and the SDK client using npm. ```bash npm install @scaleway/sdk-key-manager @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway QAAS SDK (Bash) Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/qaas/README.md Install the QAAS SDK and client dependencies using popular JavaScript package managers. Requires Node.js ≥ 20 and an internet connection. Outputs successful package installation in the project directory, compatible with npm, pnpm, or yarn ecosystems. ```bash npm install @scaleway/sdk-qaas @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-qaas @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-qaas @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway SDK Key Manager (pnpm) Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/key_manager/README.md Shows how to install the Scaleway SDK Key Manager and the SDK client using pnpm. ```bash pnpm add @scaleway/sdk-key-manager @scaleway/sdk-client ``` -------------------------------- ### Install @scaleway/sdk-redis Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/redis/README.md Instructions for installing the @scaleway/sdk-redis package and its dependency @scaleway/sdk-client using different package managers (npm, pnpm, yarn). ```bash npm install @scaleway/sdk-redis @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-redis @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-redis @scaleway/sdk-client ``` -------------------------------- ### Install @scaleway/sdk-instance and @scaleway/sdk-client Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/instance/README.md Installs the Scaleway SDK for Instance API and the core SDK client using npm, pnpm, or yarn. These packages are necessary for interacting with Scaleway's Instance API. ```bash npm install @scaleway/sdk-instance @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-instance @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-instance @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway SDK Flexible IP with Package Managers Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/flexibleip/README.md Installs the Flexible IP SDK and core client dependencies using NPM, PNPM, or Yarn. Requires Node.js >=20 and an active project directory. No inputs beyond command execution; outputs installed packages ready for import. ```bash npm install @scaleway/sdk-flexibleip @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-flexibleip @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-flexibleip @scaleway/sdk-client ``` -------------------------------- ### Install @scaleway/sdk-datawarehouse with npm, pnpm, or yarn Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/datawarehouse/README.md Installation instructions for the @scaleway/sdk-datawarehouse package using different package managers. It also requires the @scaleway/sdk-client. ```bash npm install @scaleway/sdk-datawarehouse @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-datawarehouse @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-datawarehouse @scaleway/sdk-client ``` -------------------------------- ### Install @scaleway/sdk-s2s-vpn and @scaleway/sdk-client Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/s2s_vpn/README.md Installs the S2S VPN SDK and the core SDK client using npm, pnpm, or yarn. ```bash npm install @scaleway/sdk-s2s-vpn @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-s2s-vpn @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-s2s-vpn @scaleway/sdk-client ``` -------------------------------- ### Install @scaleway/sdk-test and @scaleway/sdk-client Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/test/README.md Instructions for installing the @scaleway/sdk-test package along with the core @scaleway/sdk-client dependency using npm, pnpm, or yarn. ```bash npm install @scaleway/sdk-test @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-test @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-test @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway SDK Key Manager (yarn) Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/key_manager/README.md Shows how to install the Scaleway SDK Key Manager and the SDK client using yarn. ```bash yarn add @scaleway/sdk-key-manager @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway SDK Account Package Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/account/README.md Demonstrates how to install the @scaleway/sdk-account and @scaleway/sdk-client packages using npm, pnpm, or yarn. This is required to interact with the Scaleway Account API in JavaScript or TypeScript projects. ```bash npm install @scaleway/sdk-account @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-account @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-account @scaleway/sdk-client ``` -------------------------------- ### Load Scaleway Configuration from File Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/account/README.md Demonstrates loading Scaleway credentials from configuration files or environment variables using the configuration loader. Simplifies client setup by avoiding hardcoded credentials. ```typescript import { createClient } from '@scaleway/sdk-client' import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader' import { Account } from '@scaleway/sdk-account' const profile = loadProfileFromConfigurationFile() const client = createClient(profile) const api = new Account.v1.API(client) ``` -------------------------------- ### Install @scaleway/sdk-applesilicon and @scaleway/sdk-client Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/applesilicon/README.md Install the @scaleway/sdk-applesilicon package along with the @scaleway/sdk-client for necessary client functionalities. This can be done using npm, pnpm, or yarn package managers. ```bash npm install @scaleway/sdk-applesilicon @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-applesilicon @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-applesilicon @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway Interlink SDK Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/interlink/README.md Bash commands to install the @scaleway/sdk-interlink and @scaleway/sdk-client packages using npm, pnpm, or yarn. Dependencies include Node.js and the chosen package manager. Inputs: Package names. Outputs: Successful installation of packages. Limitations: Requires internet connection and appropriate permissions. ```bash npm install @scaleway/sdk-interlink @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-interlink @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-interlink @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway SDK Webhosting (npm) Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/webhosting/README.md Demonstrates how to install the Scaleway SDK for Webhosting package using npm. Requires @scaleway/sdk-client as a dependency. This allows developers to integrate the Scaleway Webhosting API into their JavaScript projects. ```bash npm install @scaleway/sdk-webhosting @scaleway/sdk-client ``` -------------------------------- ### Load Configuration from File or Environment Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/baremetal/README.md Loads client configuration from a configuration file or environment variables for simplified setup. Depends on configuration-loader package. ```typescript import { createClient } from '@scaleway/sdk-client' import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader' import { Baremetal } from '@scaleway/sdk-baremetal' const profile = loadProfileFromConfigurationFile() const client = createClient(profile) const api = new Baremetal.v1.API(client) ``` -------------------------------- ### Load Scaleway Configuration from File Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/vpcgw/README.md Simplifies client setup by loading credentials from a configuration file or environment variables. Uses the configuration loader package for automatic profile detection. ```typescript import { createClient } from '@scaleway/sdk-client' import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader' import { Vpcgw } from '@scaleway/sdk-vpcgw' const profile = loadProfileFromConfigurationFile() const client = createClient(profile) const api = new Vpcgw.v1.API(client) ``` -------------------------------- ### Install Scaleway SDK Webhosting (pnpm) Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/webhosting/README.md Demonstrates how to install the Scaleway SDK for Webhosting package using pnpm. Requires @scaleway/sdk-client as a dependency. This allows developers to integrate the Scaleway Webhosting API into their JavaScript projects. ```bash pnpm add @scaleway/sdk-webhosting @scaleway/sdk-client ``` -------------------------------- ### Install SDK with npm Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/registry/README.md Install the Scaleway Registry SDK and client dependencies using npm package manager. Required for basic functionality. ```bash npm install @scaleway/sdk-registry @scaleway/sdk-client ``` -------------------------------- ### Install SDK with npm Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/dedibox/README.md Install the Scaleway Dedibox SDK and client using npm. Requires Node.js ≥ 20. ```bash npm install @scaleway/sdk-dedibox @scaleway/sdk-client ``` -------------------------------- ### Install SDK with npm/pnpm/yarn Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/cockpit/README.md Installation commands for the Scaleway Cockpit SDK using different package managers. Requires Node.js ≥ 20 and @scaleway/sdk-client as a peer dependency. ```bash npm install @scaleway/sdk-cockpit @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-cockpit @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-cockpit @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway SDK VPC Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/vpc/README.md Installs the necessary Scaleway SDK packages for VPC and client functionality using npm, pnpm, or yarn. ```bash npm install @scaleway/sdk-vpc @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-vpc @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-vpc @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway SDK Webhosting (yarn) Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/webhosting/README.md Demonstrates how to install the Scaleway SDK for Webhosting package using yarn. Requires @scaleway/sdk-client as a dependency. This allows developers to integrate the Scaleway Webhosting API into their JavaScript projects. ```bash yarn add @scaleway/sdk-webhosting @scaleway/sdk-client ``` -------------------------------- ### Install @scaleway/sdk-file and @scaleway/sdk-client Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/file/README.md Install the necessary Scaleway SDK packages for the File API. Supports npm, pnpm, and yarn package managers. ```bash npm install @scaleway/sdk-file @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-file @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-file @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway RDB SDK Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/rdb/README.md Installs the Scaleway RDB SDK and the core SDK client using npm, pnpm, or yarn. These packages are required to interact with the RDB API. ```bash npm install @scaleway/sdk-rdb @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-rdb @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-rdb @scaleway/sdk-client ``` -------------------------------- ### Basic Usage with Scaleway SDK Product Catalog (TypeScript) Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/product_catalog/README.md Demonstrates how to create a client with access and secret keys and use the Product Catalog API. Requires installation of the SDK and client library. ```typescript import { createClient } from '@scaleway/sdk-client' import { ProductCatalog } from '@scaleway/sdk-product-catalog' const client = createClient({ accessKey: 'SCWXXXXXXXXXXXXXXXXX', secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultRegion: 'fr-par', defaultZone: 'fr-par-1', }) const api = new ProductCatalog.v1.API(client) // Use the API // Example: await api.listServers() ``` -------------------------------- ### Install SDK with npm, pnpm, or yarn Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/billing/README.md Installs the Scaleway Billing SDK and client dependency using popular package managers. Supports npm, pnpm, and yarn commands for adding the required packages. Requires Node.js environment with active package manager. ```bash npm install @scaleway/sdk-billing @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-billing @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-billing @scaleway/sdk-client ``` -------------------------------- ### Initialize Scaleway Datawarehouse API client using configuration loader Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/datawarehouse/README.md Example showing how to initialize the Scaleway client and Datawarehouse API using a profile loaded from a configuration file or environment variables, simplifying credential management. ```typescript import { createClient } from '@scaleway/sdk-client' import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader' import { Datawarehouse } from '@scaleway/sdk-datawarehouse' const profile = loadProfileFromConfigurationFile() const client = createClient(profile) const api = new Datawarehouse.v1.API(client) ``` -------------------------------- ### Install Scaleway SDK Domain package Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/domain/README.md Install the @scaleway/sdk-domain package and its required @scaleway/sdk-client dependency using npm, pnpm, or yarn package managers. These commands add the packages to your project for accessing Scaleway's Domain API. All three package managers achieve the same result with their respective syntax. ```bash npm install @scaleway/sdk-domain @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-domain @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-domain @scaleway/sdk-client ``` -------------------------------- ### Install SDK with npm/pnpm/yarn Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/environmental_footprint/README.md Installation commands for the Scaleway Environmental Footprint SDK using different package managers. Requires @scaleway/sdk-client as a peer dependency. ```bash npm install @scaleway/sdk-environmental-footprint @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-environmental-footprint @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-environmental-footprint @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway SDK Serverless SQLDB - npm, pnpm, yarn Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/serverless_sqldb/README.md Install the `@scaleway/sdk-serverless-sqldb` and `@scaleway/sdk-client` packages using npm, pnpm, or yarn. These are the core dependencies for interacting with the Scaleway Serverless SQLDB API. ```bash npm install @scaleway/sdk-serverless-sqldb @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-serverless-sqldb @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-serverless-sqldb @scaleway/sdk-client ``` -------------------------------- ### Client Setup Using Configuration Loader in TypeScript Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/flexibleip/README.md Loads Scaleway profile from configuration file or environment variables to create client and Flexible IP API instance, avoiding hardcoded credentials. Depends on @scaleway/configuration-loader and valid config/env setup. Inputs are profile sources; outputs API instance for API calls with automatic credential handling. ```typescript import { createClient } from '@scaleway/sdk-client' import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader' import { Flexibleip } from '@scaleway/sdk-flexibleip' const profile = loadProfileFromConfigurationFile() const client = createClient(profile) const api = new Flexibleip.v1.API(client) ``` -------------------------------- ### Install Scaleway SDK LB Package via NPM, PNPM, or Yarn Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/lb/README.md Installs the @scaleway/sdk-lb and @scaleway/sdk-client packages required for the Load Balancer API. Use npm, pnpm, or yarn as the package manager. No additional dependencies beyond Node.js; runs in terminal environments and prepares the project for API usage without runtime inputs/outputs. ```bash npm install @scaleway/sdk-lb @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-lb @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-lb @scaleway/sdk-client ``` -------------------------------- ### Instance: Create and Power On Server Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/examples/README.md Creates a new Scaleway Instance server with specified configuration (DEV1-S type, Ubuntu image) and powers it on. Demonstrates client initialization, server creation with parameters, and synchronous server action handling. Requires @scaleway/sdk and @scaleway/configuration-loader packages. ```typescript import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader' import { Instance, createClient } from '@scaleway/sdk' const profile = loadProfileFromConfigurationFile() const client = createClient(profile) const api = new Instance.v1.API(client) // Create a server. console.log(`Creating server...`) let server = await api .createServer({ bootType: 'local', commercialType: 'DEV1-S', enableIpv6: true, image: '881d7a33-4cfa-4046-b5cf-c33cb9c62fb6', // ubuntu_focal zone: 'fr-par-1', }) .then(res => res.server!) console.log(`\tCreated, ID=${server.id} ; State=${server.state}`) // Power on the server. console.log(`Powering on server...`) server = await api.serverActionAndWait({ serverId: server.id, action: 'poweron', }) console.log(`\tPowered ON (now ${server.state})`) ``` -------------------------------- ### Install @scaleway/sdk-autoscaling and @scaleway/sdk-client via npm, pnpm, or yarn Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/autoscaling/README.md Installs the Autoscaling SDK and core client package using popular JavaScript package managers. Requires Node.js and internet connectivity. No runtime execution, only adds dependencies. ```bash npm install @scaleway/sdk-autoscaling @scaleway/sdk-client pnpm add @scaleway/sdk-autoscaling @scaleway/sdk-client yarn add @scaleway/sdk-autoscaling @scaleway/sdk-client ``` -------------------------------- ### Initialize Environmental Footprint API Client Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/environmental_footprint/README.md Basic TypeScript example showing how to create a client and initialize the Environmental Footprint API. Requires access keys and project configuration. ```typescript import { createClient } from '@scaleway/sdk-client' import { EnvironmentalFootprint } from '@scaleway/sdk-environmental-footprint' const client = createClient({ accessKey: 'SCWXXXXXXXXXXXXXXXXX', secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultRegion: 'fr-par', defaultZone: 'fr-par-1', }) const api = new EnvironmentalFootprint.v1.API(client) ``` -------------------------------- ### Initialize Baremetal API Client Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/baremetal/README.md Creates a client instance for the Scaleway Baremetal API using access keys and project details. Includes default region and zone settings. ```typescript import { createClient } from '@scaleway/sdk-client' import { Baremetal } from '@scaleway/sdk-baremetal' const client = createClient({ accessKey: 'SCWXXXXXXXXXXXXXXXXX', secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultRegion: 'fr-par', defaultZone: 'fr-par-1', }) const api = new Baremetal.v1.API(client) // Use the API // Example: await api.listServers() ``` -------------------------------- ### Install SDK with yarn Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/registry/README.md Alternative installation method using yarn package manager. Installs the same dependencies as npm version. ```bash yarn add @scaleway/sdk-registry @scaleway/sdk-client ``` -------------------------------- ### Install SDK with pnpm Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/registry/README.md Alternative installation method using pnpm package manager. Installs the same dependencies as npm version. ```bash pnpm add @scaleway/sdk-registry @scaleway/sdk-client ``` -------------------------------- ### Basic Interlink API Client Setup in TypeScript Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/interlink/README.md TypeScript example for creating a Scaleway client and initializing the Interlink API for basic interactions. Dependencies: @scaleway/sdk-client and @scaleway/sdk-interlink. Inputs: Access key, secret key, project ID, region, and zone. Outputs: Interlink API instance for methods like listServers(). Limitations: Requires valid Scaleway credentials. ```typescript import { createClient } from '@scaleway/sdk-client' import { Interlink } from '@scaleway/sdk-interlink' const client = createClient({ accessKey: 'SCWXXXXXXXXXXXXXXXXX', secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultRegion: 'fr-par', defaultZone: 'fr-par-1', }) const api = new Interlink.v1.API(client) // Use the API // Example: await api.listServers() ``` -------------------------------- ### Initialize Scaleway Client from Profile Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/README.md Shows how to initialize the Scaleway client by loading profile information from a configuration file or environment variables. This simplifies client creation when credentials are pre-configured. ```typescript import { loadProfileFromConfigurationFile, // loadProfileFromEnvironmentValues, } from '@scaleway/configuration-loader' const profile = loadProfileFromConfigurationFile() // loadProfileFromEnvironmentValues() const client = createClient(profile) ``` -------------------------------- ### Install Scaleway SDK Ipam with npm Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/ipam/README.md Demonstrates how to install the Scaleway SDK for Ipam API using npm. Requires the @scaleway/sdk-ipam and @scaleway/sdk-client packages. This is the most common installation method for Node.js projects. ```bash npm install @scaleway/sdk-ipam @scaleway/sdk-client ``` -------------------------------- ### Initialize Scaleway VPC Gateway Client Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/vpcgw/README.md Creates a client instance with access credentials and default project/region settings. Requires valid Scaleway API keys and project configuration. ```typescript import { createClient } from '@scaleway/sdk-client' import { Vpcgw } from '@scaleway/sdk-vpcgw' const client = createClient({ accessKey: 'SCWXXXXXXXXXXXXXXXXX', secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultRegion: 'fr-par', defaultZone: 'fr-par-1', }) const api = new Vpcgw.v1.API(client) // Use the API // Example: await api.listServers() ``` -------------------------------- ### Install SDK with yarn Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/dedibox/README.md Install the Scaleway Dedibox SDK and client using yarn. Requires Node.js ≥ 20. ```bash yarn add @scaleway/sdk-dedibox @scaleway/sdk-client ``` -------------------------------- ### Load Scaleway Configuration from File (TypeScript) Source: https://context7.com/scaleway/scaleway-sdk-js/llms.txt Illustrates loading Scaleway SDK configuration from a file, compatible with the Scaleway CLI's configuration format (e.g., ~/.config/scaleway/config.yaml). This approach simplifies client creation by automatically picking up credentials and defaults. An example shows listing servers using the Instance API. ```typescript import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader' import { createClient } from '@scaleway/sdk-client' import { Instance } from '@scaleway/sdk' // Load from ~/.config/scaleway/config.yaml const profile = loadProfileFromConfigurationFile() const client = createClient(profile) const instanceApi = new Instance.v1.API(client) // List all servers in the account const servers = await instanceApi.listServers({ zone: 'fr-par-1', }).all() console.log(`Found ${servers.length} servers`) ``` -------------------------------- ### Install SDK with pnpm Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/dedibox/README.md Install the Scaleway Dedibox SDK and client using pnpm. Requires Node.js ≥ 20. ```bash pnpm add @scaleway/sdk-dedibox @scaleway/sdk-client ``` -------------------------------- ### Install SDK with npm/pnpm/yarn Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/secret/README.md Installation commands for the Scaleway Secret SDK using different package managers. Requires @scaleway/sdk-client as a peer dependency. ```bash npm install @scaleway/sdk-secret @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-secret @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-secret @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway SDK with yarn Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/k8s/README.md Installs the required Scaleway SDK packages using yarn. Requires Node.js version 20 or higher. ```bash yarn add @scaleway/sdk-k8s @scaleway/sdk-client ``` -------------------------------- ### Initialize Scaleway Account Client Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/account/README.md Shows how to create a Scaleway client using access keys and initialize the Account API. Requires valid access key, secret key, project ID, region, and zone. ```typescript import { createClient } from '@scaleway/sdk-client' import { Account } from '@scaleway/sdk-account' const client = createClient({ accessKey: 'SCWXXXXXXXXXXXXXXXXX', secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultRegion: 'fr-par', defaultZone: 'fr-par-1', }) const api = new Account.v1.API(client) // Use the API // Example: await api.listServers() ``` -------------------------------- ### Install Scaleway SDK with pnpm Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/k8s/README.md Installs the required Scaleway SDK packages using pnpm. Requires Node.js version 20 or higher. ```bash pnpm add @scaleway/sdk-k8s @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway SDK with npm Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/k8s/README.md Installs the required Scaleway SDK packages using npm. Requires Node.js version 20 or higher. ```bash npm install @scaleway/sdk-k8s @scaleway/sdk-client ``` -------------------------------- ### POST /instance/v1/zones/{zone}/servers Source: https://context7.com/scaleway/scaleway-sdk-js/llms.txt Creates a new server in the specified zone with the provided configuration such as commercial type and image. ```APIDOC ## POST /instance/v1/zones/{zone}/servers ### Description Creates a server instance in the chosen zone. The operation is asynchronous; the server can be polled using the `waitForServer` helper. ### Method POST ### Endpoint /instance/v1/zones/{zone}/servers ### Parameters #### Path Parameters - **zone** (string) - Required - The zone where the server will be created. #### Request Body - **name** (string) - Required - Desired name of the server. - **_type** (string) - Required - Type of the server (e.g., `DEV1-S`). - **image** (string) - Required - Image identifier (e.g., `ubuntu_jammy`). - **dynamic_ip_required** (boolean) - Optional - Whether a dynamic IP is allocated. ### Request Example ```json { "name": "test-server", "commercial_type": "DEV1-S", "image": "ubuntu_jammy" } ``` ### Response #### Success Response (200) - **server** (object) - Details of the newly created server. - **id** (string) - Server identifier. - **state** (string) - Initial state, typically `starting`. #### Response Example ```json { "server": { "id": "abcd1234", "state": "starting", "name": "test-server" } } ``` ``` -------------------------------- ### Basic Usage of Scaleway Webhosting API (TypeScript) Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/webhosting/README.md Illustrates a basic usage example of the Scaleway Webhosting API using TypeScript. It shows how to create a client with access keys and then use the Webhosting API to list servers. This assumes you have access and secret keys configured. ```typescript import { createClient } from '@scaleway/sdk-client' import { Webhosting } from '@scaleway/sdk-webhosting' const client = createClient({ accessKey: 'SCWXXXXXXXXXXXXXXXXX', secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultRegion: 'fr-par', defaultZone: 'fr-par-1', }) const api = new Webhosting.v1.API(client) // Use the API // Example: await api.listServers() ``` -------------------------------- ### Load credentials from configuration file Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/billing/README.md Simplified client initialization using configuration loader. Loads credentials from Scaleway configuration file or environment variables. Creates client and Billing API instance automatically. Requires @scaleway/configuration-loader package. ```typescript import { createClient } from '@scaleway/sdk-client' import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader' import { Billing } from '@scaleway/sdk-billing' const profile = loadProfileFromConfigurationFile() const client = createClient(profile) const api = new Billing.v1.API(client) ``` -------------------------------- ### Install @scaleway/sdk-jobs and @scaleway/sdk-client Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/jobs/README.md Install the Scaleway SDK for Jobs API and the core SDK client using npm, pnpm, or yarn. These packages are necessary to interact with Scaleway services. ```bash npm install @scaleway/sdk-jobs @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-jobs @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-jobs @scaleway/sdk-client ``` -------------------------------- ### Install Scaleway SDK Ipam with pnpm Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/ipam/README.md Shows how to install the Scaleway SDK for Ipam API using pnpm. Requires the @scaleway/sdk-ipam and @scaleway/sdk-client packages. pnpm is an alternative package manager for Node.js. ```bash pnpm add @scaleway/sdk-ipam @scaleway/sdk-client ``` -------------------------------- ### Scaleway IoT Client Setup Using Configuration Loader Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/iot/README.md Load credentials from a configuration file or environment variables via the profile loader. Create the client with the loaded profile and instantiate the IoT API v1. This approach simplifies credential management without embedding keys in code; falls back to environment vars if no file present. ```typescript import { createClient } from '@scaleway/sdk-client' import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader' import { Iot } from '@scaleway/sdk-iot' const profile = loadProfileFromConfigurationFile() const client = createClient(profile) const api = new Iot.v1.API(client) ``` -------------------------------- ### Install Scaleway IAM SDK Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/iam/README.md Installs the @scaleway/sdk-iam package along with its core dependency, @scaleway/sdk-client, using npm, pnpm, or yarn. These packages are essential for interacting with the Scaleway IAM API. ```bash npm install @scaleway/sdk-iam @scaleway/sdk-client ``` ```bash pnpm add @scaleway/sdk-iam @scaleway/sdk-client ``` ```bash yarn add @scaleway/sdk-iam @scaleway/sdk-client ``` -------------------------------- ### Initialize Scaleway Client with Credentials Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/README.md Demonstrates how to create a Scaleway client instance using explicit access keys, secret keys, and project/region/zone details. This method is suitable for direct credential provision. ```typescript import { Registry, createClient } from '@scaleway/sdk' const client = createClient({ accessKey: 'SCWXXXXXXXXXXXXXXXXX', secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultRegion: 'fr-par', defaultZone: 'fr-par-1', }) const api = new Registry.v1.API(client) ``` -------------------------------- ### Basic Scaleway IoT Client Setup with API Keys Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/iot/README.md Initialize a Scaleway client using access key, secret key, project ID, region, and zone. Create an instance of the IoT API v1. This allows calling methods like listServers for IoT resource management; handles authentication automatically but requires valid credentials. ```typescript import { createClient } from '@scaleway/sdk-client' import { Iot } from '@scaleway/sdk-iot' const client = createClient({ accessKey: 'SCWXXXXXXXXXXXXXXXXX', secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultRegion: 'fr-par', defaultZone: 'fr-par-1', }) const api = new Iot.v1.API(client) // Use the API // Example: await api.listServers() ``` -------------------------------- ### Install Scaleway SDK Ipam with yarn Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/ipam/README.md Illustrates installation of the Scaleway SDK for Ipam API using yarn. Requires @scaleway/sdk-ipam and @scaleway/sdk-client packages. Yarn is another popular package manager for Node.js. ```bash yarn add @scaleway/sdk-ipam @scaleway/sdk-client ``` -------------------------------- ### Initialize Scaleway File API Client (Basic Usage) Source: https://github.com/scaleway/scaleway-sdk-js/blob/main/packages_generated/file/README.md Create a Scaleway client instance with explicit credentials and region/zone, then instantiate the File API client. Requires access key, secret key, and project ID. Assumes @scaleway/sdk-client and @scaleway/sdk-file are installed. ```typescript import { createClient } from '@scaleway/sdk-client' import { File } from '@scaleway/sdk-file' const client = createClient({ accessKey: 'SCWXXXXXXXXXXXXXXXXX', secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', defaultRegion: 'fr-par', defaultZone: 'fr-par-1', }) const api = new File.v1.API(client) // Use the API // Example: await api.listServers() ```