pydo.functions.create_namespace()

Description

Creates a new serverless functions namespace in the desired region and associates it with the provided label. A namespace is a collection of functions and their associated packages, triggers, and project specifications. To create a namespace, send a POST request to /v2/functions/namespaces with the region and label properties.

Request Sample

import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "region": "nyc1",
  "label": "my namespace"
}

resp = client.functions.create_namespace(body=req)

Responses

See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.

A JSON response object with a key called namespace. The object contains the properties associated with the namespace.

Click to expand an example response.
{
  "namespace": {
    "api_host": "https://api_host.io",
    "namespace": "fn-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "created_at": "2022-09-14T04:16:45Z",
    "updated_at": "2022-09-14T04:16:45Z",
    "label": "my namespace",
    "region": "nyc1",
    "uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "key": "d1zcd455h01mqjfs4s2eaewyejehi5f2uj4etqq3h7cera8iwkub6xg5of1wdde2"
  }
}

Unauthorized

Click to expand an example response.
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}

Bad Request.

Click to expand an example response.
{
  "id": "bad_request",
  "message": "Invalid request payload: missing label field",
  "request_id": "4851a473-1621-42ea-b2f9-5071c0ea8414"
}

Limit Reached

Click to expand an example response.
{
  "id": "unprocessable_entity",
  "message": "namespace limit reached",
  "request_id": "a3275238-3d04-4405-a123-55c389b406c0"
}

API Rate limit exceeded

Click to expand an example response.
{
  "id": "too_many_requests",
  "message": "API Rate limit exceeded."
}

Server error.

Click to expand an example response.
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}

Unexpected error

Click to expand an example response.
{
  "id": "example_error",
  "message": "some error message"
}