Documentation
ΒΆ
Overview ΒΆ
Package kiri provides a public API for running an in-process GCP service emulator.
Usage:
srv := kiri.NewServer()
defer srv.Close()
client, _ := storage.NewClient(ctx,
option.WithEndpoint(srv.URL),
option.WithoutAuthentication(),
)
For gRPC clients (Pub/Sub, Firestore):
conn, _ := grpc.NewClient(srv.GRPCURL, grpc.WithTransportCredentials(insecure.NewCredentials())) pubsubClient := pubsubpb.NewPublisherClient(conn)
Index ΒΆ
Constants ΒΆ
View Source
const Version = "0.2.0" // x-release-please-version
Version is the current version of kiri. release-please keeps this in sync with the released tag; do not edit it by hand.
Variables ΒΆ
This section is empty.
Functions ΒΆ
This section is empty.
Types ΒΆ
type Server ΒΆ
type Server struct {
// URL is the base REST URL, e.g. "http://127.0.0.1:PORT".
URL string
// GRPCURL is the base gRPC URL, e.g. "127.0.0.1:PORT".
GRPCURL string
// contains filtered or unexported fields
}
Server is an in-process GCP emulator wrapping an HTTP + gRPC server.
Directories
ΒΆ
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
kiri
command
Package main is the entry point for the kiri emulator binary.
|
Package main is the entry point for the kiri emulator binary. |
|
internal
|
|
|
catalog
Package catalog renders the README "Supported Services" section from the registered services.
|
Package catalog renders the README "Supported Services" section from the registered services. |
|
grpcsvc/firestore
Package firestoregrpc implements the gRPC Firestore service (google.firestore.v1.Firestore) for the kiri emulator.
|
Package firestoregrpc implements the gRPC Firestore service (google.firestore.v1.Firestore) for the kiri emulator. |
|
grpcsvc/pubsub
Package pubsubgrpc implements the gRPC Pub/Sub service (google.pubsub.v1.Publisher + google.pubsub.v1.Subscriber) for the kiri emulator.
|
Package pubsubgrpc implements the gRPC Pub/Sub service (google.pubsub.v1.Publisher + google.pubsub.v1.Subscriber) for the kiri emulator. |
|
grpcutil
Package grpcutil provides a custom gRPC codec that works with protow message types (which implement Encode() []byte).
|
Package grpcutil provides a custom gRPC codec that works with protow message types (which implement Encode() []byte). |
|
httpx
Package httpx provides small REST/JSON helpers shared by every GCP service: canonical Google-style JSON responses and errors, request decoding, and ID generation.
|
Package httpx provides small REST/JSON helpers shared by every GCP service: canonical Google-style JSON responses and errors, request decoding, and ID generation. |
|
protow
Package protow provides lightweight protobuf wire-format encoding and decoding helpers for gRPC message types.
|
Package protow provides lightweight protobuf wire-format encoding and decoding helpers for gRPC message types. |
|
registry
Package registry is the single canonical list of every emulated GCP service.
|
Package registry is the single canonical list of every emulated GCP service. |
|
server
Package server wires the emulator together: it builds the router, registers every service from the global registry, serves HTTP, and shuts down gracefully, saving persistent snapshots for services that support it.
|
Package server wires the emulator together: it builds the router, registers every service from the global registry, serves HTTP, and shuts down gracefully, saving persistent snapshots for services that support it. |
|
service
Package service provides the interfaces and utilities shared by all GCP service emulations.
|
Package service provides the interfaces and utilities shared by all GCP service emulations. |
|
service/alloydb
Package alloydb emulates AlloyDB (alloydb.googleapis.com): clusters and the primary/read-pool instances within them.
|
Package alloydb emulates AlloyDB (alloydb.googleapis.com): clusters and the primary/read-pool instances within them. |
|
service/apigateway
Package apigateway emulates API Gateway (apigateway.googleapis.com/v1): APIs, their configs, and the gateways that serve a config.
|
Package apigateway emulates API Gateway (apigateway.googleapis.com/v1): APIs, their configs, and the gateways that serve a config. |
|
service/appengine
Package appengine emulates App Engine Admin (appengine.googleapis.com/v1): services and the versions deployed to them, with a traffic split on the service tracking which version is live.
|
Package appengine emulates App Engine Admin (appengine.googleapis.com/v1): services and the versions deployed to them, with a traffic split on the service tracking which version is live. |
|
service/artifactregistry
Package artifactregistry emulates Artifact Registry (artifactregistry.googleapis.com/v1): repositories and their packages.
|
Package artifactregistry emulates Artifact Registry (artifactregistry.googleapis.com/v1): repositories and their packages. |
|
service/batch
Package batch emulates Cloud Batch (batch.googleapis.com/v1): job scheduling and execution.
|
Package batch emulates Cloud Batch (batch.googleapis.com/v1): job scheduling and execution. |
|
service/bigtable
Package bigtable emulates Bigtable admin (bigtableadmin.googleapis.com/v2): instances and the tables (with column families) within them.
|
Package bigtable emulates Bigtable admin (bigtableadmin.googleapis.com/v2): instances and the tables (with column families) within them. |
|
service/billing
Package billing emulates GCP's cost and billing surface β the closest analogue to AWS Cost Explorer.
|
Package billing emulates GCP's cost and billing surface β the closest analogue to AWS Cost Explorer. |
|
service/binaryauthorization
Package binaryauthorization emulates Binary Authorization (binaryauthorization.googleapis.com/v1): the single project-scoped policy resource, plus attestors.
|
Package binaryauthorization emulates Binary Authorization (binaryauthorization.googleapis.com/v1): the single project-scoped policy resource, plus attestors. |
|
service/certificatemanager
Package certificatemanager emulates Certificate Manager (certificatemanager.googleapis.com/v1): TLS certificate provisioning.
|
Package certificatemanager emulates Certificate Manager (certificatemanager.googleapis.com/v1): TLS certificate provisioning. |
|
service/cloudbuild
Package cloudbuild emulates Cloud Build (cloudbuild.googleapis.com/v1): build triggers and the builds they (or a direct submission) produce.
|
Package cloudbuild emulates Cloud Build (cloudbuild.googleapis.com/v1): build triggers and the builds they (or a direct submission) produce. |
|
service/cloudcomposer
Package cloudcomposer emulates Cloud Composer (composer.googleapis.com/v1): managed Apache Airflow environments.
|
Package cloudcomposer emulates Cloud Composer (composer.googleapis.com/v1): managed Apache Airflow environments. |
|
service/clouddeploy
Package clouddeploy emulates Cloud Deploy (clouddeploy.googleapis.com/v1): delivery pipelines, their releases, and the rollouts each release creates.
|
Package clouddeploy emulates Cloud Deploy (clouddeploy.googleapis.com/v1): delivery pipelines, their releases, and the rollouts each release creates. |
|
service/clouddns
Package clouddns emulates Cloud DNS (dns.googleapis.com/dns/v1): managed zones and their record sets.
|
Package clouddns emulates Cloud DNS (dns.googleapis.com/dns/v1): managed zones and their record sets. |
|
service/cloudrun
Package cloudrun emulates Cloud Run (run.googleapis.com/v1): services with container image, environment variables, and a tracked latest revision.
|
Package cloudrun emulates Cloud Run (run.googleapis.com/v1): services with container image, environment variables, and a tracked latest revision. |
|
service/cloudrunjobs
Package cloudrunjobs emulates Cloud Run Jobs (run.googleapis.com/v2): run-to-completion jobs where each ":run" call creates a tracked execution.
|
Package cloudrunjobs emulates Cloud Run Jobs (run.googleapis.com/v2): run-to-completion jobs where each ":run" call creates a tracked execution. |
|
service/cloudscheduler
Package cloudscheduler emulates Cloud Scheduler (cloudscheduler.googleapis.com/v1): cron jobs with pause/resume/run lifecycle actions.
|
Package cloudscheduler emulates Cloud Scheduler (cloudscheduler.googleapis.com/v1): cron jobs with pause/resume/run lifecycle actions. |
|
service/cloudservicemesh
Package cloudservicemesh emulates Cloud Service Mesh (a subset of networkservices.googleapis.com/v1): meshes and the routes attached to them.
|
Package cloudservicemesh emulates Cloud Service Mesh (a subset of networkservices.googleapis.com/v1): meshes and the routes attached to them. |
|
service/cloudsql
Package cloudsql emulates Cloud SQL (sqladmin.googleapis.com/sql/v1beta4): instances with start/stop lifecycle, plus nested databases and users.
|
Package cloudsql emulates Cloud SQL (sqladmin.googleapis.com/sql/v1beta4): instances with start/stop lifecycle, plus nested databases and users. |
|
service/cloudtasks
Package cloudtasks emulates Cloud Tasks (cloudtasks.googleapis.com/v2): queues and their tasks, with a :run custom method that executes a task immediately (the emulator does not model queue-driven delivery delay).
|
Package cloudtasks emulates Cloud Tasks (cloudtasks.googleapis.com/v2): queues and their tasks, with a :run custom method that executes a task immediately (the emulator does not model queue-driven delivery delay). |
|
service/compute
Package compute emulates Compute Engine (compute.googleapis.com/compute/v1): instances (with start/stop/reset lifecycle actions), persistent disks, and global firewall rules.
|
Package compute emulates Compute Engine (compute.googleapis.com/compute/v1): instances (with start/stop/reset lifecycle actions), persistent disks, and global firewall rules. |
|
service/dataflow
Package dataflow emulates Dataflow (dataflow.googleapis.com/v1b3): jobs and their state transitions (cancel/drain via PUT requestedState, matching the real API).
|
Package dataflow emulates Dataflow (dataflow.googleapis.com/v1b3): jobs and their state transitions (cancel/drain via PUT requestedState, matching the real API). |
|
service/dataproc
Package dataproc emulates Dataproc (dataproc.googleapis.com/v1): managed Spark/Hadoop clusters and the jobs submitted to them.
|
Package dataproc emulates Dataproc (dataproc.googleapis.com/v1): managed Spark/Hadoop clusters and the jobs submitted to them. |
|
service/errorreporting
Package errorreporting emulates Error Reporting (clouderrorreporting.googleapis.com/v1beta1): reported error events, aggregated into groups by their message.
|
Package errorreporting emulates Error Reporting (clouderrorreporting.googleapis.com/v1beta1): reported error events, aggregated into groups by their message. |
|
service/eventarc
Package eventarc emulates Eventarc (eventarc.googleapis.com/v1): event triggers and channels.
|
Package eventarc emulates Eventarc (eventarc.googleapis.com/v1): event triggers and channels. |
|
service/fcm
Package fcm emulates Firebase Cloud Messaging (fcm.googleapis.com/v1): message send, plus a /kiri/fcm/sent-messages inspection endpoint so tests can assert on what was actually pushed without a real device.
|
Package fcm emulates Firebase Cloud Messaging (fcm.googleapis.com/v1): message send, plus a /kiri/fcm/sent-messages inspection endpoint so tests can assert on what was actually pushed without a real device. |
|
service/gcs
Package gcs emulates Google Cloud Storage: the JSON API (storage/v1) for bucket/object management, plus the XML-API-style root-level download path ("GET /{bucket}/{object}") that the official Go client's object Reader actually issues by default β verified against the real cloud.google.com/go/storage SDK, not assumed from the JSON API docs alone.
|
Package gcs emulates Google Cloud Storage: the JSON API (storage/v1) for bucket/object management, plus the XML-API-style root-level download path ("GET /{bucket}/{object}") that the official Go client's object Reader actually issues by default β verified against the real cloud.google.com/go/storage SDK, not assumed from the JSON API docs alone. |
|
service/gke
Package gke emulates Google Kubernetes Engine (container.googleapis.com/v1): clusters and their node pools.
|
Package gke emulates Google Kubernetes Engine (container.googleapis.com/v1): clusters and their node pools. |
|
service/gkeautopilot
Package gkeautopilot emulates GKE Autopilot (container.googleapis.com): clusters only β unlike standard GKE, Autopilot manages nodes automatically and does not expose a node pool API to callers.
|
Package gkeautopilot emulates GKE Autopilot (container.googleapis.com): clusters only β unlike standard GKE, Autopilot manages nodes automatically and does not expose a node pool API to callers. |
|
service/globalloadbalancing
Package globalloadbalancing emulates global Cloud Load Balancing resources (compute.googleapis.com/v1): URL maps, target HTTP proxies, and global forwarding rules β the chain a global external HTTP(S) load balancer wires together.
|
Package globalloadbalancing emulates global Cloud Load Balancing resources (compute.googleapis.com/v1): URL maps, target HTTP proxies, and global forwarding rules β the chain a global external HTTP(S) load balancer wires together. |
|
service/iam
Package iam emulates Cloud IAM's project-level surface (iam.googleapis.com/v1): service accounts, their keys, and the predefined role catalog.
|
Package iam emulates Cloud IAM's project-level surface (iam.googleapis.com/v1): service accounts, their keys, and the predefined role catalog. |
|
service/iampolicy
Package iampolicy emulates Cloud IAM's resource-level policy surface (google.iam.v1.IAMPolicy): setIamPolicy, getIamPolicy, and testIamPermissions.
|
Package iampolicy emulates Cloud IAM's resource-level policy surface (google.iam.v1.IAMPolicy): setIamPolicy, getIamPolicy, and testIamPermissions. |
|
service/identityplatform
Package identityplatform emulates Identity Platform (identitytoolkit.googleapis.com/v2): tenants and the users within each.
|
Package identityplatform emulates Identity Platform (identitytoolkit.googleapis.com/v2): tenants and the users within each. |
|
service/loadbalancing
Package loadbalancing emulates regional Cloud Load Balancing resources (compute.googleapis.com/v1): backend services and health checks.
|
Package loadbalancing emulates regional Cloud Load Balancing resources (compute.googleapis.com/v1): backend services and health checks. |
|
service/logging
Package logging emulates Cloud Logging (logging.googleapis.com/v2): log entry write/list, log-based metrics, and sinks.
|
Package logging emulates Cloud Logging (logging.googleapis.com/v2): log entry write/list, log-based metrics, and sinks. |
|
service/managedkafka
Package managedkafka emulates Managed Service for Apache Kafka (managedkafka.googleapis.com/v1): clusters and their topics.
|
Package managedkafka emulates Managed Service for Apache Kafka (managedkafka.googleapis.com/v1): clusters and their topics. |
|
service/memorystore
Package memorystore emulates Memorystore for Redis (redis.googleapis.com/v1): Redis instances with basic lifecycle actions.
|
Package memorystore emulates Memorystore for Redis (redis.googleapis.com/v1): Redis instances with basic lifecycle actions. |
|
service/monitoring
Package monitoring emulates Cloud Monitoring (monitoring.googleapis.com/v3): metric descriptors, time series ingestion, and alert policies.
|
Package monitoring emulates Cloud Monitoring (monitoring.googleapis.com/v3): metric descriptors, time series ingestion, and alert policies. |
|
service/naturallanguage
Package naturallanguage emulates Natural Language AI (language.googleapis.com/v1): sentiment and entity analysis over caller-supplied text, using simple heuristics (not real NLP) β enough for integration tests that assert on response shape and basic polarity.
|
Package naturallanguage emulates Natural Language AI (language.googleapis.com/v1): sentiment and entity analysis over caller-supplied text, using simple heuristics (not real NLP) β enough for integration tests that assert on response shape and basic polarity. |
|
service/networkconnectivity
Package networkconnectivity emulates Network Connectivity Center (networkconnectivity.googleapis.com/v1): hubs and the spokes attached to them.
|
Package networkconnectivity emulates Network Connectivity Center (networkconnectivity.googleapis.com/v1): hubs and the spokes attached to them. |
|
service/organizationpolicy
Package organizationpolicy emulates the Org Policy API (orgpolicy.googleapis.com/v1) scoped to projects: listing, getting, creating, updating, and deleting policy constraints, plus resolving the effective policy for a constraint.
|
Package organizationpolicy emulates the Org Policy API (orgpolicy.googleapis.com/v1) scoped to projects: listing, getting, creating, updating, and deleting policy constraints, plus resolving the effective policy for a constraint. |
|
service/privateconnect
Package privateconnect emulates Private Service Connect (compute.googleapis.com/v1): service attachments (the producer side) and forwarding-rule-based endpoints that connect to them (the consumer side).
|
Package privateconnect emulates Private Service Connect (compute.googleapis.com/v1): service attachments (the producer side) and forwarding-rule-based endpoints that connect to them (the consumer side). |
|
service/pubsub
Package pubsub emulates Cloud Pub/Sub's REST API v1: topics, subscriptions, publish, pull, and acknowledge.
|
Package pubsub emulates Cloud Pub/Sub's REST API v1: topics, subscriptions, publish, pull, and acknowledge. |
|
service/resourcemanager
Package resourcemanager emulates Resource Manager (cloudresourcemanager.googleapis.com/v1): project lifecycle and labels.
|
Package resourcemanager emulates Resource Manager (cloudresourcemanager.googleapis.com/v1): project lifecycle and labels. |
|
service/secretmanager
Package secretmanager emulates Google Secret Manager's REST API v1: secret CRUD, incrementing versions, and version access.
|
Package secretmanager emulates Google Secret Manager's REST API v1: secret CRUD, incrementing versions, and version access. |
|
service/securitycommandcenter
Package securitycommandcenter emulates Security Command Center (securitycenter.googleapis.com/v1): sources and the findings reported under them.
|
Package securitycommandcenter emulates Security Command Center (securitycenter.googleapis.com/v1): sources and the findings reported under them. |
|
service/servicedirectory
Package servicedirectory emulates Service Directory (servicedirectory.googleapis.com/v1): a three-level hierarchy of namespaces, services, and endpoints, plus the :resolve custom method clients use to look up a service's live endpoints.
|
Package servicedirectory emulates Service Directory (servicedirectory.googleapis.com/v1): a three-level hierarchy of namespaces, services, and endpoints, plus the :resolve custom method clients use to look up a service's live endpoints. |
|
service/serviceusage
Package serviceusage emulates Service Usage (serviceusage.googleapis.com/v1): per-project API enablement state.
|
Package serviceusage emulates Service Usage (serviceusage.googleapis.com/v1): per-project API enablement state. |
|
service/spannersql
Package spannersql emulates Cloud Spanner admin (spanner.googleapis.com/v1): instances and the databases within them.
|
Package spannersql emulates Cloud Spanner admin (spanner.googleapis.com/v1): instances and the databases within them. |
|
service/vertexai
Package vertexai emulates Vertex AI (aiplatform.googleapis.com/v1): custom training jobs, models, and endpoints with deploy/predict.
|
Package vertexai emulates Vertex AI (aiplatform.googleapis.com/v1): custom training jobs, models, and endpoints with deploy/predict. |
|
service/visionai
Package visionai emulates Vision AI (vision.googleapis.com/v1): image annotation requests, returning deterministic stub labels/text per feature type requested (real detection is out of scope for an emulator).
|
Package visionai emulates Vision AI (vision.googleapis.com/v1): image annotation requests, returning deterministic stub labels/text per feature type requested (real detection is out of scope for an emulator). |
|
service/workflows
Package workflows emulates Workflows (workflows.googleapis.com/v1): workflow definitions and their executions.
|
Package workflows emulates Workflows (workflows.googleapis.com/v1): workflow definitions and their executions. |
|
storage
Package storage provides common persistence utilities: atomic JSON snapshots under $KIRI_DATA_DIR.
|
Package storage provides common persistence utilities: atomic JSON snapshots under $KIRI_DATA_DIR. |
Click to show internal directories.
Click to hide internal directories.