Skip to content
Get started

Create ingress

client.Ingresses.New(ctx, body) (*Ingress, error)
post/ingresses

Create ingress

ParametersExpand Collapse
body IngressNewParams
Name param.Field[string]

Human-readable name (lowercase letters, digits, and dashes only; cannot start or end with a dash)

maxLength63
Rules param.Field[[]IngressRule]

Routing rules for this ingress

Hostname string

Hostname to match. Can be:

  • Literal: "api.example.com" (exact match on Host header)
  • Pattern: "{instance}.example.com" (dynamic routing based on subdomain)

Pattern hostnames use named captures in curly braces (e.g., {instance}, {app}) that extract parts of the hostname for routing. The extracted values can be referenced in the target.instance field.

Port int64optional

Host port to listen on for this rule (default 80)

Instance string

Target instance name, ID, or capture reference.

  • For literal hostnames: Use the instance name or ID directly (e.g., "my-api")
  • For pattern hostnames: Reference a capture from the hostname (e.g., "{instance}")

When using pattern hostnames, the instance is resolved dynamically at request time.

Port int64

Target port on the instance

RedirectHTTP booloptional

Auto-create HTTP to HTTPS redirect for this hostname (only applies when tls is enabled)

Tls booloptional

Enable TLS termination (certificate auto-issued via ACME).

ReturnsExpand Collapse
type Ingress struct{…}
ID string

Auto-generated unique identifier

CreatedAt Time

Creation timestamp (RFC3339)

formatdate-time
Name string

Human-readable name

Rules []IngressRule

Routing rules for this ingress

Hostname string

Hostname to match. Can be:

  • Literal: "api.example.com" (exact match on Host header)
  • Pattern: "{instance}.example.com" (dynamic routing based on subdomain)

Pattern hostnames use named captures in curly braces (e.g., {instance}, {app}) that extract parts of the hostname for routing. The extracted values can be referenced in the target.instance field.

Port int64optional

Host port to listen on for this rule (default 80)

Instance string

Target instance name, ID, or capture reference.

  • For literal hostnames: Use the instance name or ID directly (e.g., "my-api")
  • For pattern hostnames: Reference a capture from the hostname (e.g., "{instance}")

When using pattern hostnames, the instance is resolved dynamically at request time.

Port int64

Target port on the instance

RedirectHTTP booloptional

Auto-create HTTP to HTTPS redirect for this hostname (only applies when tls is enabled)

Tls booloptional

Enable TLS termination (certificate auto-issued via ACME).

Create ingress
package main

import (
  "context"
  "fmt"

  "github.com/onkernel/hypeman-go"
  "github.com/onkernel/hypeman-go/option"
)

func main() {
  client := hypeman.NewClient(
    option.WithAPIKey("My API Key"),
  )
  ingress, err := client.Ingresses.New(context.TODO(), hypeman.IngressNewParams{
    Name: "my-api-ingress",
    Rules: []hypeman.IngressRuleParam{hypeman.IngressRuleParam{
      Match: hypeman.IngressMatchParam{
        Hostname: "{instance}.example.com",
      },
      Target: hypeman.IngressTargetParam{
        Instance: "{instance}",
        Port: 8080,
      },
    }},
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", ingress.ID)
}
{
  "id": "2OgJqXsP7j1qLVVYvGJDNiYVlPO",
  "created_at": "2025-01-15T10:00:00Z",
  "name": "my-api-ingress",
  "rules": [
    {
      "match": {
        "hostname": "{instance}.example.com",
        "port": 8080
      },
      "target": {
        "instance": "{instance}",
        "port": 8080
      },
      "redirect_http": true,
      "tls": true
    }
  ]
}
Returns Examples
{
  "id": "2OgJqXsP7j1qLVVYvGJDNiYVlPO",
  "created_at": "2025-01-15T10:00:00Z",
  "name": "my-api-ingress",
  "rules": [
    {
      "match": {
        "hostname": "{instance}.example.com",
        "port": 8080
      },
      "target": {
        "instance": "{instance}",
        "port": 8080
      },
      "redirect_http": true,
      "tls": true
    }
  ]
}