server

package
v2.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package server provides a pluggable SDK-compatible HTTP server.

The core Server is protocol-agnostic: it dispatches incoming requests to registered Handlers via a Matches predicate. Each Handler is a self-contained package (e.g. server/aws/s3, server/aws/dynamodb) that speaks its own wire format. Adding a new service — AWS EC2, Azure Blob, GCP GCS — is one new package and one Register call; the core server never changes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Matches(r *http.Request) bool
	ServeHTTP(w http.ResponseWriter, r *http.Request)
}

Handler is a self-contained protocol handler registered with a Server. Matches inspects the request and returns true if this handler should serve it; ServeHTTP writes the response. Handlers are evaluated in registration order, first match wins.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server routes incoming HTTP requests to registered Handlers. Server itself implements http.Handler, so httptest.NewServer(srv) works.

func New

func New(handlers ...Handler) *Server

New creates a Server preloaded with the given handlers. Additional handlers can be added later via Register.

func (*Server) Register

func (s *Server) Register(h Handler)

Register appends a handler. Handlers registered earlier take precedence, so register more specific handlers before catch-all ones.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP dispatches to the first handler whose Matches returns true, or responds 501 Not Implemented if no handler matches.

Directories

Path Synopsis
aws
Package aws assembles CloudEmu's AWS-compatible HTTP server.
Package aws assembles CloudEmu's AWS-compatible HTTP server.
bedrock
Package bedrock implements the AWS Bedrock restJson1 control-plane API and the bedrock-runtime InvokeModel / Converse data-plane API as a server.Handler.
Package bedrock implements the AWS Bedrock restJson1 control-plane API and the bedrock-runtime InvokeModel / Converse data-plane API as a server.Handler.
cloudwatch
Package cloudwatch implements AWS CloudWatch's Smithy RPC-v2-CBOR protocol as a server.Handler.
Package cloudwatch implements AWS CloudWatch's Smithy RPC-v2-CBOR protocol as a server.Handler.
cloudwatchlogs
Package cloudwatchlogs implements the AWS CloudWatch Logs JSON-RPC protocol as a server.Handler.
Package cloudwatchlogs implements the AWS CloudWatch Logs JSON-RPC protocol as a server.Handler.
dynamodb
Package dynamodb implements the DynamoDB JSON-RPC protocol as a server.Handler.
Package dynamodb implements the DynamoDB JSON-RPC protocol as a server.Handler.
ec2
Package ec2 implements the AWS EC2 query-protocol as a server.Handler.
Package ec2 implements the AWS EC2 query-protocol as a server.Handler.
ecr
Package ecr implements the AWS ECR JSON-RPC protocol as a server.Handler.
Package ecr implements the AWS ECR JSON-RPC protocol as a server.Handler.
eks
Package eks implements the AWS EKS REST/JSON control-plane API as a server.Handler.
Package eks implements the AWS EKS REST/JSON control-plane API as a server.Handler.
elasticache
Package elasticache implements the AWS ElastiCache query-protocol as a server.Handler.
Package elasticache implements the AWS ElastiCache query-protocol as a server.Handler.
elbv2
Package elbv2 implements the AWS Elastic Load Balancing v2 (ALB/NLB) query-protocol as a server.Handler.
Package elbv2 implements the AWS Elastic Load Balancing v2 (ALB/NLB) query-protocol as a server.Handler.
eventbridge
Package eventbridge implements the AWS EventBridge JSON-RPC protocol as a server.Handler.
Package eventbridge implements the AWS EventBridge JSON-RPC protocol as a server.Handler.
iam
Package iam implements the AWS IAM query-protocol as a server.Handler.
Package iam implements the AWS IAM query-protocol as a server.Handler.
lambda
Package lambda implements the AWS Lambda REST+JSON control-plane protocol as a server.Handler.
Package lambda implements the AWS Lambda REST+JSON control-plane protocol as a server.Handler.
rds
Package rds implements the AWS RDS query-protocol as a server.Handler.
Package rds implements the AWS RDS query-protocol as a server.Handler.
redshift
Package redshift implements the AWS Redshift query-protocol as a server.Handler.
Package redshift implements the AWS Redshift query-protocol as a server.Handler.
resourceexplorer2
Package resourceexplorer2 serves the AWS Resource Explorer 2 REST-JSON protocol against a *resourcediscovery.Engine.
Package resourceexplorer2 serves the AWS Resource Explorer 2 REST-JSON protocol against a *resourcediscovery.Engine.
resourcegroupstaggingapi
Package resourcegroupstaggingapi serves the AWS Resource Groups Tagging API JSON 1.1 protocol against a *resourcediscovery.Engine.
Package resourcegroupstaggingapi serves the AWS Resource Groups Tagging API JSON 1.1 protocol against a *resourcediscovery.Engine.
route53
Package route53 implements the AWS Route 53 REST+XML protocol as a server.Handler.
Package route53 implements the AWS Route 53 REST+XML protocol as a server.Handler.
s3
Package s3 implements the S3 REST+XML protocol as a server.Handler.
Package s3 implements the S3 REST+XML protocol as a server.Handler.
sagemaker
Package sagemaker implements the Amazon SageMaker awsJson1_1 control-plane API and the sagemaker-runtime restJson1 InvokeEndpoint data-plane API as a server.Handler.
Package sagemaker implements the Amazon SageMaker awsJson1_1 control-plane API and the sagemaker-runtime restJson1 InvokeEndpoint data-plane API as a server.Handler.
secretsmanager
Package secretsmanager implements the AWS Secrets Manager JSON-RPC protocol as a server.Handler.
Package secretsmanager implements the AWS Secrets Manager JSON-RPC protocol as a server.Handler.
sns
Package sns implements the AWS SNS query-protocol as a server.Handler.
Package sns implements the AWS SNS query-protocol as a server.Handler.
sqs
Package sqs implements the AWS SQS JSON-RPC protocol as a server.Handler.
Package sqs implements the AWS SQS JSON-RPC protocol as a server.Handler.
ssm
Package ssm implements the AWS Systems Manager (SSM) Parameter Store JSON-RPC protocol as a server.Handler.
Package ssm implements the AWS Systems Manager (SSM) Parameter Store JSON-RPC protocol as a server.Handler.
sts
Package sts implements the AWS STS query-protocol as a server.Handler.
Package sts implements the AWS STS query-protocol as a server.Handler.
Package azure assembles CloudEmu's Azure-compatible HTTP server.
Package azure assembles CloudEmu's Azure-compatible HTTP server.
acr
Package acr implements the Azure Container Registry data-plane catalog API (/acr/v1/…) as a server.Handler.
Package acr implements the Azure Container Registry data-plane catalog API (/acr/v1/…) as a server.Handler.
aks
Package aks implements the Azure Kubernetes Service (Microsoft.ContainerService) ARM REST API as a server.Handler.
Package aks implements the Azure Kubernetes Service (Microsoft.ContainerService) ARM REST API as a server.Handler.
azureai
Package azureai implements the Azure AI ARM REST APIs as server.Handlers.
Package azureai implements the Azure AI ARM REST APIs as server.Handlers.
azuresearch
Package azuresearch implements the Azure AI Search REST APIs as server.Handlers: the Microsoft.Search ARM control plane (service lifecycle, admin/query keys, private links) and the {service}.search.windows.net data plane (indexes, documents, indexers, data sources, skillsets, synonym maps, aliases, service statistics).
Package azuresearch implements the Azure AI Search REST APIs as server.Handlers: the Microsoft.Search ARM control plane (service lifecycle, admin/query keys, private links) and the {service}.search.windows.net data plane (indexes, documents, indexers, data sources, skillsets, synonym maps, aliases, service statistics).
azuresql
Package azuresql implements the Azure SQL Database (Microsoft.Sql) ARM REST API as a server.Handler.
Package azuresql implements the Azure SQL Database (Microsoft.Sql) ARM REST API as a server.Handler.
blob
Package blob implements the Azure Blob Storage REST+XML wire protocol as a server.Handler.
Package blob implements the Azure Blob Storage REST+XML wire protocol as a server.Handler.
cache
Package cache implements the Azure Cache for Redis (Microsoft.Cache/redis) ARM REST API as a server.Handler.
Package cache implements the Azure Cache for Redis (Microsoft.Cache/redis) ARM REST API as a server.Handler.
cosmos
Package cosmos implements the Azure Cosmos DB SQL data-plane REST API against a CloudEmu database driver.
Package cosmos implements the Azure Cosmos DB SQL data-plane REST API against a CloudEmu database driver.
databricks
Package databricks also implements the Databricks workspace data-plane REST API (the /api/2.x surface served at the workspace URL) as a server.Handler, distinct from the ARM workspace-management handler in this package.
Package databricks also implements the Databricks workspace data-plane REST API (the /api/2.x surface served at the workspace URL) as a server.Handler, distinct from the ARM workspace-management handler in this package.
databricks/dbfs
Package dbfs implements the Databricks DBFS data-plane REST API (the /api/2.0/dbfs/...
Package dbfs implements the Databricks DBFS data-plane REST API (the /api/2.0/dbfs/...
databricks/gitcredentials
Package gitcredentials emulates the Databricks Git Credentials data-plane REST API (the /api/2.0/git-credentials surface served at the workspace URL) as a server.Handler.
Package gitcredentials emulates the Databricks Git Credentials data-plane REST API (the /api/2.0/git-credentials surface served at the workspace URL) as a server.Handler.
databricks/hostmeta
Package hostmeta serves the Databricks host-metadata discovery endpoint (GET /.well-known/databricks-config) as a server.Handler.
Package hostmeta serves the Databricks host-metadata discovery endpoint (GET /.well-known/databricks-config) as a server.Handler.
databricks/pipelines
Package pipelines implements the Databricks Pipelines (Delta Live Tables) data-plane REST API (the /api/2.0/pipelines surface) as a server.Handler.
Package pipelines implements the Databricks Pipelines (Delta Live Tables) data-plane REST API (the /api/2.0/pipelines surface) as a server.Handler.
databricks/queryhistory
Package queryhistory implements the Databricks SQL query-history data-plane REST API (the /api/2.0/sql/history/queries surface) as a server.Handler.
Package queryhistory implements the Databricks SQL query-history data-plane REST API (the /api/2.0/sql/history/queries surface) as a server.Handler.
databricks/repos
Package repos implements the Databricks Repos (Git folders) data-plane REST API (the /api/2.0/repos surface served at the workspace URL) as a server.Handler.
Package repos implements the Databricks Repos (Git folders) data-plane REST API (the /api/2.0/repos surface served at the workspace URL) as a server.Handler.
databricks/scim
Package scim emulates the Databricks workspace SCIM 2.0 identity APIs (the /api/2.0/preview/scim/v2/...
Package scim emulates the Databricks workspace SCIM 2.0 identity APIs (the /api/2.0/preview/scim/v2/...
databricks/secrets
Package secrets emulates the Databricks Secrets data-plane REST API (the /api/2.0/secrets/...
Package secrets emulates the Databricks Secrets data-plane REST API (the /api/2.0/secrets/...
databricks/serving
Package serving implements the Databricks Serving Endpoints data-plane REST API (the /api/2.0/serving-endpoints surface served at the workspace URL) as a server.Handler.
Package serving implements the Databricks Serving Endpoints data-plane REST API (the /api/2.0/serving-endpoints surface served at the workspace URL) as a server.Handler.
databricks/sqlwarehouses
Package sqlwarehouses implements the Databricks SQL Warehouses data-plane REST API (the /api/2.0/sql/warehouses surface) as a server.Handler.
Package sqlwarehouses implements the Databricks SQL Warehouses data-plane REST API (the /api/2.0/sql/warehouses surface) as a server.Handler.
databricks/token
Package token implements the Databricks personal-access-token data-plane REST API (the /api/2.0/token surface served at the workspace URL) as a server.Handler.
Package token implements the Databricks personal-access-token data-plane REST API (the /api/2.0/token surface served at the workspace URL) as a server.Handler.
databricks/ucstorage
Package ucstorage emulates the Databricks Unity Catalog storage/governance REST APIs (Metastores, External Locations, Storage Credentials, Volumes) served under /api/2.1/unity-catalog/...
Package ucstorage emulates the Databricks Unity Catalog storage/governance REST APIs (Metastores, External Locations, Storage Credentials, Volumes) served under /api/2.1/unity-catalog/...
databricks/unitycatalog
Package unitycatalog emulates the Databricks Unity Catalog core REST API (the /api/2.1/unity-catalog/{catalogs,schemas,tables} surface served at the workspace URL) as a server.Handler.
Package unitycatalog emulates the Databricks Unity Catalog core REST API (the /api/2.1/unity-catalog/{catalogs,schemas,tables} surface served at the workspace URL) as a server.Handler.
databricks/wsfs
Package wsfs implements the Databricks Workspace (notebooks/directories) data-plane REST API (the /api/2.0/workspace surface) as a self-contained server.Handler backed by in-memory state.
Package wsfs implements the Databricks Workspace (notebooks/directories) data-plane REST API (the /api/2.0/workspace surface) as a self-contained server.Handler backed by in-memory state.
disks
Package disks serves Azure ARM Microsoft.Compute/disks requests against a CloudEmu compute driver's volume operations.
Package disks serves Azure ARM Microsoft.Compute/disks requests against a CloudEmu compute driver's volume operations.
dns
Package dns implements the Azure DNS (Microsoft.Network/dnsZones) ARM REST API as a server.Handler.
Package dns implements the Azure DNS (Microsoft.Network/dnsZones) ARM REST API as a server.Handler.
eventgrid
Package eventgrid implements the Azure Event Grid (Microsoft.EventGrid/topics) ARM REST API as a server.Handler.
Package eventgrid implements the Azure Event Grid (Microsoft.EventGrid/topics) ARM REST API as a server.Handler.
functions
Package functions serves Azure ARM Microsoft.Web/sites (Function Apps) requests against a CloudEmu serverless driver.
Package functions serves Azure ARM Microsoft.Web/sites (Function Apps) requests against a CloudEmu serverless driver.
iam
Package iam implements the Azure Microsoft.Authorization ARM REST API as a server.Handler.
Package iam implements the Azure Microsoft.Authorization ARM REST API as a server.Handler.
images
Package images serves Azure ARM Microsoft.Compute/images requests.
Package images serves Azure ARM Microsoft.Compute/images requests.
keyvault
Package keyvault implements the Azure Key Vault secrets data-plane API (/secrets/…) as a server.Handler.
Package keyvault implements the Azure Key Vault secrets data-plane API (/secrets/…) as a server.Handler.
loadbalancer
Package loadbalancer implements the Azure Load Balancer (Microsoft.Network/loadBalancers) ARM REST API as a server.Handler.
Package loadbalancer implements the Azure Load Balancer (Microsoft.Network/loadBalancers) ARM REST API as a server.Handler.
loganalytics
Package loganalytics implements the Azure Log Analytics (Microsoft.OperationalInsights/workspaces) ARM REST API as a server.Handler.
Package loganalytics implements the Azure Log Analytics (Microsoft.OperationalInsights/workspaces) ARM REST API as a server.Handler.
monitor
Package monitor implements the Azure microsoft.insights metric-alerts resource against a CloudEmu monitoring driver.
Package monitor implements the Azure microsoft.insights metric-alerts resource against a CloudEmu monitoring driver.
mysqlflex
Package mysqlflex implements the Azure Database for MySQL — Flexible Server (Microsoft.DBforMySQL/flexibleServers) ARM REST API as a server.Handler.
Package mysqlflex implements the Azure Database for MySQL — Flexible Server (Microsoft.DBforMySQL/flexibleServers) ARM REST API as a server.Handler.
network
Package network implements the Microsoft.Network ARM resources we expose: virtualNetworks, subnets (nested), and networkSecurityGroups.
Package network implements the Microsoft.Network ARM resources we expose: virtualNetworks, subnets (nested), and networkSecurityGroups.
notificationhubs
Package notificationhubs implements the Azure Notification Hubs (Microsoft.NotificationHubs) ARM REST API as a server.Handler.
Package notificationhubs implements the Azure Notification Hubs (Microsoft.NotificationHubs) ARM REST API as a server.Handler.
postgresflex
Package postgresflex implements the Azure Database for PostgreSQL Flexible Server (Microsoft.DBforPostgreSQL/flexibleServers) ARM REST API as a server.Handler.
Package postgresflex implements the Azure Database for PostgreSQL Flexible Server (Microsoft.DBforPostgreSQL/flexibleServers) ARM REST API as a server.Handler.
queue
Package queue implements the Azure Queue Storage REST+XML wire protocol as a server.Handler.
Package queue implements the Azure Queue Storage REST+XML wire protocol as a server.Handler.
resourcegraph
Package resourcegraph serves Azure Resource Graph (armresourcegraph) REST requests against a *resourcediscovery.Engine.
Package resourcegraph serves Azure Resource Graph (armresourcegraph) REST requests against a *resourcediscovery.Engine.
servicebus
Package servicebus serves Azure Service Bus ARM control-plane requests (Microsoft.ServiceBus/namespaces[/queues]) plus a raw-HTTP data plane for send/receive against a CloudEmu messagequeue driver.
Package servicebus serves Azure Service Bus ARM control-plane requests (Microsoft.ServiceBus/namespaces[/queues]) plus a raw-HTTP data plane for send/receive against a CloudEmu messagequeue driver.
snapshots
Package snapshots serves Azure ARM Microsoft.Compute/snapshots requests.
Package snapshots serves Azure ARM Microsoft.Compute/snapshots requests.
sshpublickeys
Package sshpublickeys serves Azure ARM Microsoft.Compute/sshPublicKeys requests against the underlying compute driver's KeyPair operations.
Package sshpublickeys serves Azure ARM Microsoft.Compute/sshPublicKeys requests against the underlying compute driver's KeyPair operations.
table
Package table implements the Azure Table Storage data-plane REST protocol (OData/JSON) as a server.Handler.
Package table implements the Azure Table Storage data-plane REST protocol (OData/JSON) as a server.Handler.
virtualmachines
Package virtualmachines serves Azure ARM Microsoft.Compute/virtualMachines requests against a CloudEmu compute driver.
Package virtualmachines serves Azure ARM Microsoft.Compute/virtualMachines requests against a CloudEmu compute driver.
gcp
Package gcp assembles CloudEmu's GCP-compatible HTTP server.
Package gcp assembles CloudEmu's GCP-compatible HTTP server.
artifactregistry
Package artifactregistry implements the artifactregistry.googleapis.com v1 REST API as a server.Handler.
Package artifactregistry implements the artifactregistry.googleapis.com v1 REST API as a server.Handler.
cloudasset
Package cloudasset serves the GCP Cloud Asset Inventory v1 REST API against a *resourcediscovery.Engine.
Package cloudasset serves the GCP Cloud Asset Inventory v1 REST API against a *resourcediscovery.Engine.
clouddns
Package clouddns implements the Cloud DNS (dns.googleapis.com) v1 REST API as a server.Handler.
Package clouddns implements the Cloud DNS (dns.googleapis.com) v1 REST API as a server.Handler.
cloudfunctions
Package cloudfunctions implements the GCP Cloud Functions v1 REST API as a server.Handler.
Package cloudfunctions implements the GCP Cloud Functions v1 REST API as a server.Handler.
cloudlogging
Package cloudlogging implements the Cloud Logging (logging.googleapis.com) v2 REST API as a server.Handler.
Package cloudlogging implements the Cloud Logging (logging.googleapis.com) v2 REST API as a server.Handler.
cloudsql
Package cloudsql implements the GCP Cloud SQL Admin REST API as a server.Handler.
Package cloudsql implements the GCP Cloud SQL Admin REST API as a server.Handler.
compute
Package compute serves GCP Compute Engine REST API requests against a CloudEmu compute driver.
Package compute serves GCP Compute Engine REST API requests against a CloudEmu compute driver.
eventarc
Package eventarc implements the eventarc.googleapis.com v1 REST API as a server.Handler.
Package eventarc implements the eventarc.googleapis.com v1 REST API as a server.Handler.
fcm
Package fcm implements the Firebase Cloud Messaging (fcm.googleapis.com) v1 REST API as a server.Handler.
Package fcm implements the Firebase Cloud Messaging (fcm.googleapis.com) v1 REST API as a server.Handler.
firestore
Package firestore implements the GCP Firestore REST API as a server.Handler.
Package firestore implements the GCP Firestore REST API as a server.Handler.
gcs
Package gcs implements the Google Cloud Storage JSON REST API as a server.Handler.
Package gcs implements the Google Cloud Storage JSON REST API as a server.Handler.
gke
Package gke implements the GCP Kubernetes Engine (Container) API as a server.Handler.
Package gke implements the GCP Kubernetes Engine (Container) API as a server.Handler.
iam
Package iam implements the GCP iam.googleapis.com v1 REST API as a server.Handler.
Package iam implements the GCP iam.googleapis.com v1 REST API as a server.Handler.
loadbalancer
Package loadbalancer implements the GCP Cloud Load Balancing REST API (backendServices + forwardingRules) against a CloudEmu loadbalancer driver.
Package loadbalancer implements the GCP Cloud Load Balancing REST API (backendServices + forwardingRules) against a CloudEmu loadbalancer driver.
memorystore
Package memorystore implements the GCP Memorystore for Redis (redis.googleapis.com) v1 REST API as a server.Handler.
Package memorystore implements the GCP Memorystore for Redis (redis.googleapis.com) v1 REST API as a server.Handler.
monitoring
Package monitoring implements the GCP Cloud Monitoring REST API surface for alert policies.
Package monitoring implements the GCP Cloud Monitoring REST API surface for alert policies.
networks
Package networks implements the GCP Compute Engine networking REST API (networks, subnetworks, firewalls) against a CloudEmu networking driver.
Package networks implements the GCP Compute Engine networking REST API (networks, subnetworks, firewalls) against a CloudEmu networking driver.
pubsub
Package pubsub implements the GCP Pub/Sub v1 REST API as a server.Handler.
Package pubsub implements the GCP Pub/Sub v1 REST API as a server.Handler.
secretmanager
Package secretmanager implements the secretmanager.googleapis.com v1 REST API as a server.Handler.
Package secretmanager implements the secretmanager.googleapis.com v1 REST API as a server.Handler.
vertexai
Package vertexai implements the Google Cloud Vertex AI (aiplatform.googleapis.com) REST API as a server.Handler.
Package vertexai implements the Google Cloud Vertex AI (aiplatform.googleapis.com) REST API as a server.Handler.
Package wire provides shared HTTP wire-format helpers for service handlers: XML and JSON encoding, JSON decoding, and HTTP-date formatting.
Package wire provides shared HTTP wire-format helpers for service handlers: XML and JSON encoding, JSON decoding, and HTTP-date formatting.
awsquery
Package awsquery provides parsers and encoders for the AWS query-protocol wire format used by EC2, Auto-Scaling, STS, and several other services.
Package awsquery provides parsers and encoders for the AWS query-protocol wire format used by EC2, Auto-Scaling, STS, and several other services.
azurearm
Package azurearm provides shared HTTP wire-format helpers for Azure Resource Manager (ARM) JSON REST handlers.
Package azurearm provides shared HTTP wire-format helpers for Azure Resource Manager (ARM) JSON REST handlers.
gcprest
Package gcprest provides shared HTTP wire-format helpers for GCP Compute (and other GCP REST APIs) JSON handlers.
Package gcprest provides shared HTTP wire-format helpers for GCP Compute (and other GCP REST APIs) JSON handlers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL