server

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: May 24, 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.
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.
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.
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.
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.
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.
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.
Package azure assembles CloudEmu's Azure-compatible HTTP server.
Package azure assembles CloudEmu's Azure-compatible HTTP server.
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.
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.
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.
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.
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.
images
Package images serves Azure ARM Microsoft.Compute/images requests.
Package images serves Azure ARM Microsoft.Compute/images requests.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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