Documentation
¶
Overview ¶
Package aura provides a Go client library for the Neo4j Aura API.
The client supports all major Aura API operations including instance management, snapshots, tenant operations, and customer-managed encryption keys (CMEK).
Example usage:
client, err := aura.NewClient(
aura.WithCredentials("client-id", "client-secret"),
)
if err != nil {
log.Fatal(err)
}
instances, err := client.Instances.List(ctx)
types.go - Exported error types for use by consumers
interfaces.go
Index ¶
- Constants
- type AuraAPIClient
- type CmekService
- type ConnectionMetrics
- type CreateGDSSessionConfigData
- type CreateInstanceConfigData
- type CreateInstanceData
- type CreateInstanceResponse
- type CreateSnapshotData
- type CreateSnapshotResponse
- type DeleteGDSSession
- type DeleteGDSSessionResponse
- type DeleteInstanceResponse
- type Error
- type ErrorDetail
- type GDSSessionService
- type GDSSessionSizeEstimationData
- type GDSSessionSizeEstimationResponse
- type GetCmeksData
- type GetCmeksResponse
- type GetGDSSessionData
- type GetGDSSessionListResponse
- type GetGDSSessionResponse
- type GetGDSSessionSizeEstimation
- type GetInstanceResponse
- type GetSnapshotData
- type GetSnapshotDataResponse
- type GetSnapshotsResponse
- type GetTenantMetricsURLData
- type GetTenantMetricsURLResponse
- type GetTenantResponse
- type InstanceData
- type InstanceService
- type ListInstanceData
- type ListInstancesResponse
- type ListTenantsResponse
- type Option
- type OverwriteInstanceResponse
- type PrometheusHealthMetrics
- type PrometheusMetric
- type PrometheusMetricsResponse
- type PrometheusService
- type QueryMetrics
- type ResourceMetrics
- type RestoreSnapshotResponse
- type SnapshotService
- type StorageMetrics
- type TenantInstanceConfiguration
- type TenantResponseData
- type TenantService
- type TenantsResponseData
- type UpdateInstanceData
Constants ¶
const ( StatusRunning = "running" StatusStopped = "stopped" StatusPaused = "paused" StatusAvailable = "available" )
instance status values that we're interested in
const AuraAPIClientVersion = "v1.6.1"
Currently set manually to match changie latest
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuraAPIClient ¶
type AuraAPIClient struct {
// Grouped services - using interface types for testability
Tenants TenantService
Instances InstanceService
Snapshots SnapshotService
Cmek CmekService
GraphAnalytics GDSSessionService
Prometheus PrometheusService
// contains filtered or unexported fields
}
AuraAPIClient is the main client for interacting with the Neo4j Aura API
func NewClient ¶
func NewClient(opts ...Option) (*AuraAPIClient, error)
NewClient creates a new Aura API client with functional options
type CmekService ¶ added in v1.1.0
type CmekService interface {
// List returns all customer-managed encryption keys, optionally filtered by tenant
List(ctx context.Context, tenantID string) (*GetCmeksResponse, error)
}
CmekService defines operations for customer-managed encryption keys
type ConnectionMetrics ¶ added in v1.3.1
type ConnectionMetrics struct {
ActiveConnections int `json:"active_connections"`
MaxConnections int `json:"max_connections"`
UsagePercent float64 `json:"usage_percent"`
}
ConnectionMetrics contains connection pool information
type CreateGDSSessionConfigData ¶ added in v1.5.1
type CreateGDSSessionConfigData struct {
Name string `json:"name"`
Ttl string `json:"ttl"`
TenantId string `json:"tenant_id"`
InstanceId string `json:"instance_id"`
DatabaseId string `json:"database_uuid"`
CloudProvider string `json:"cloud_provider"`
Region string `json:"region"`
Memory string `json:"memory"`
}
type CreateInstanceData ¶
type CreateInstanceData struct {
Id string `json:"id"`
Name string `json:"name"`
TenantId string `json:"tenant_id"`
CloudProvider string `json:"cloud_provider"`
ConnectionUrl string `json:"connection_url"`
Region string `json:"region"`
Type string `json:"type"`
Username string `json:"username"`
Password string `json:"password"`
}
type CreateInstanceResponse ¶ added in v1.1.0
type CreateInstanceResponse struct {
Data CreateInstanceData `json:"data"`
}
type CreateSnapshotData ¶ added in v1.1.0
type CreateSnapshotData struct {
SnapshotId string `json:"snapshot_id"`
}
type CreateSnapshotResponse ¶ added in v1.1.0
type CreateSnapshotResponse struct {
Data CreateSnapshotData `json:"data"`
}
CreateSnapshotResponse contains the result of creating a snapshot
type DeleteGDSSession ¶ added in v1.5.1
type DeleteGDSSession struct {
ID string `json:"id"`
}
type DeleteGDSSessionResponse ¶ added in v1.5.1
type DeleteGDSSessionResponse struct {
Data DeleteGDSSession `json:"data"`
}
type DeleteInstanceResponse ¶ added in v1.6.1
type DeleteInstanceResponse struct {
Data InstanceData `json:"data"`
}
type ErrorDetail ¶ added in v1.6.0
type ErrorDetail = api.ErrorDetail
ErrorDetail represents individual error details
type GDSSessionService ¶ added in v1.1.0
type GDSSessionService interface {
// List returns all GDS sessions accessible to the authenticated user
List(ctx context.Context) (*GetGDSSessionListResponse, error)
// Estimate the size of a GDS session
Estimate(ctx context.Context, GDSSessionSizeEstimateRequest *GetGDSSessionSizeEstimation) (*GDSSessionSizeEstimationResponse, error)
// Create a new GDS session
Create(ctx context.Context, GDSSessionConfigRequest *CreateGDSSessionConfigData) (*GetGDSSessionResponse, error)
// Get the details for a single GDS Session
Get(ctx context.Context, GDSSessionID string) (*GetGDSSessionResponse, error)
// Delete a single GDS Session
Delete(ctx context.Context, GDSSessionID string) (*DeleteGDSSessionResponse, error)
}
GDSSessionService defines operations for Graph Data Science sessions
type GDSSessionSizeEstimationData ¶ added in v1.5.1
type GDSSessionSizeEstimationResponse ¶ added in v1.5.1
type GDSSessionSizeEstimationResponse struct {
Data GDSSessionSizeEstimationData `json:"data"`
}
type GetCmeksData ¶ added in v1.1.0
type GetCmeksResponse ¶ added in v1.1.0
type GetCmeksResponse struct {
Data []GetCmeksData `json:"data"`
}
GetCmeksResponse contains a list of customer managed encryption keys
type GetGDSSessionData ¶ added in v1.1.0
type GetGDSSessionData struct {
Id string `json:"id"`
Name string `json:"name"`
Memory string `json:"memory"`
InstanceId string `json:"instance_id"`
DatabaseId string `json:"database_uuid"`
Status string `json:"status"`
Create string `json:"created_at"`
Host string `json:"host"`
Expiry string `json:"expiry_date"`
Ttl string `json:"ttl"`
UserId string `json:"user_id"`
TenantId string `json:"tenant_id"`
CloudProvider string `json:"cloud_provider"`
Region string `json:"region"`
}
type GetGDSSessionListResponse ¶ added in v1.5.1
type GetGDSSessionListResponse struct {
Data []GetGDSSessionData `json:"data"`
}
GetGDSSessionListResponse contains a list of GDS sessions
type GetGDSSessionResponse ¶ added in v1.1.0
type GetGDSSessionResponse struct {
Data []GetGDSSessionData `json:"data"`
}
GetGDSSessionResponse contains information about a single GDS Session
type GetGDSSessionSizeEstimation ¶ added in v1.5.1
type GetGDSSessionSizeEstimation struct {
NodeCount int `json:"node_count"`
NodePropertyCount int `json:"node_property_count"`
NodeLabelCount int `json:"node_label_count"`
RelationshipCount int `json:"relationship_count"`
RelationshipPropertyCount int `json:"relationship_property_count"`
AlgorithmCategories []string `json:"algorithm_categories"`
}
type GetInstanceResponse ¶ added in v1.1.0
type GetInstanceResponse struct {
Data InstanceData `json:"data"`
}
type GetSnapshotData ¶ added in v1.1.0
type GetSnapshotDataResponse ¶ added in v1.4.1
type GetSnapshotDataResponse struct {
Data GetSnapshotData `json:"data"`
}
type GetSnapshotsResponse ¶ added in v1.1.0
type GetSnapshotsResponse struct {
Data []GetSnapshotData `json:"data"`
}
GetSnapshotsResponse contains a list of snapshots for an instance
type GetTenantMetricsURLData ¶ added in v1.5.1
type GetTenantMetricsURLData struct {
Endpoint string `json:"endpoint"`
}
type GetTenantMetricsURLResponse ¶ added in v1.5.1
type GetTenantMetricsURLResponse struct {
Data GetTenantMetricsURLData `json:"data"`
}
type GetTenantResponse ¶ added in v1.1.0
type GetTenantResponse struct {
Data TenantResponseData `json:"data"`
}
GetTenantResponse contains details of a tenant
type InstanceData ¶ added in v1.6.1
type InstanceData struct {
Id string `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
TenantId string `json:"tenant_id"`
CloudProvider string `json:"cloud_provider"`
ConnectionUrl string `json:"connection_url"`
Region string `json:"region"`
Type string `json:"type"`
Memory string `json:"memory"`
Storage *string `json:"storage"`
CDCEnrichment string `json:"cdc_enrichment_mode"`
GDSPlugin bool `json:"graph_analytics_plugin"`
MetricsURL string `json:"metrics_integration_url"`
Secondaries int `json:"secondaries_count"`
VectorOptimized bool `json:"vector_optimized"`
}
type InstanceService ¶ added in v1.1.0
type InstanceService interface {
// List returns all instances accessible to the authenticated user
List(ctx context.Context) (*ListInstancesResponse, error)
// Get retrieves details for a specific instance by ID
Get(ctx context.Context, instanceID string) (*GetInstanceResponse, error)
// Create provisions a new database instance
Create(ctx context.Context, instanceRequest *CreateInstanceConfigData) (*CreateInstanceResponse, error)
// Delete removes an instance by ID
Delete(ctx context.Context, instanceID string) (*DeleteInstanceResponse, error)
// Pause suspends an instance by ID
Pause(ctx context.Context, instanceID string) (*GetInstanceResponse, error)
// Resume restarts a paused instance by ID
Resume(ctx context.Context, instanceID string) (*GetInstanceResponse, error)
// Update modifies an instance's configuration
Update(ctx context.Context, instanceID string, instanceRequest *UpdateInstanceData) (*GetInstanceResponse, error)
// Overwrite replaces instance data from another instance or snapshot
Overwrite(ctx context.Context, instanceID string, sourceInstanceID string, sourceSnapshotID string) (*OverwriteInstanceResponse, error)
}
InstanceService defines operations for managing database instances
type ListInstanceData ¶ added in v1.1.0
type ListInstancesResponse ¶ added in v1.1.0
type ListInstancesResponse struct {
Data []ListInstanceData `json:"data"`
}
ListInstancesResponse contains a list of instances in a tenant
type ListTenantsResponse ¶ added in v1.1.0
type ListTenantsResponse struct {
Data []TenantsResponseData `json:"data"`
}
ListTenantsResponse contains a list of tenants in your organisation
type Option ¶
type Option func(*options) error
Option is a functional option for configuring the AuraAPIClient
func WithBaseURL ¶ added in v1.6.1
WithBaseURL overrides the default API base URL. Useful for staging or sandbox environments.
func WithCredentials ¶
WithCredentials sets both client ID and secret
func WithLogger ¶
WithLogger sets a custom logger (optional)
func WithMaxRetry ¶ added in v1.0.2
WithMaxRetry sets a custom max number of retries (optional)
func WithTimeout ¶
WithTimeout sets a custom API timeout (optional)
type OverwriteInstanceResponse ¶ added in v1.1.0
type OverwriteInstanceResponse struct {
Data string `json:"data"`
}
type PrometheusHealthMetrics ¶ added in v1.3.1
type PrometheusHealthMetrics struct {
InstanceID string `json:"instance_id"`
Timestamp time.Time `json:"timestamp"`
Resources ResourceMetrics `json:"resources"`
Query QueryMetrics `json:"query"`
Connections ConnectionMetrics `json:"connections"`
Storage StorageMetrics `json:"storage"`
OverallStatus string `json:"overall_status"`
Issues []string `json:"issues"`
Recommendations []string `json:"recommendations"`
}
PrometheusHealthMetrics contains parsed health metrics for an instance
type PrometheusMetric ¶ added in v1.3.1
PrometheusMetric represents a single parsed metric from Prometheus exposition format
type PrometheusMetricsResponse ¶ added in v1.3.1
type PrometheusMetricsResponse struct {
Metrics map[string][]PrometheusMetric
}
PrometheusMetricsResponse contains parsed metrics from the raw endpoint
type PrometheusService ¶ added in v1.3.1
type PrometheusService interface {
// FetchRawMetrics fetches and parses raw Prometheus metrics from an Aura metrics endpoint
FetchRawMetrics(ctx context.Context, prometheusURL string) (*PrometheusMetricsResponse, error)
// GetMetricValue retrieves a specific metric value by name and optional label filters
GetMetricValue(ctx context.Context, metrics *PrometheusMetricsResponse, name string, labelFilters map[string]string) (float64, error)
// GetInstanceHealth retrieves comprehensive health metrics for an instance
GetInstanceHealth(ctx context.Context, instanceID string, prometheusURL string) (*PrometheusHealthMetrics, error)
}
PrometheusService defines operations for querying Prometheus metrics
type QueryMetrics ¶ added in v1.3.1
type QueryMetrics struct {
QueriesPerSecond float64 `json:"queries_per_second"`
AvgLatencyMS float64 `json:"avg_latency_ms"`
}
QueryMetrics contains query performance statistics
type ResourceMetrics ¶ added in v1.3.1
type ResourceMetrics struct {
CPUUsagePercent float64 `json:"cpu_usage_percent"`
MemoryUsagePercent float64 `json:"memory_usage_percent"`
}
ResourceMetrics contains CPU and memory usage
type RestoreSnapshotResponse ¶ added in v1.4.1
type RestoreSnapshotResponse struct {
Data InstanceData `json:"data"`
}
RestoreSnapshotResponse stores the response from initiating restoration of an instance using a snapshot The response is the same as for getting instance configuration details
type SnapshotService ¶ added in v1.1.0
type SnapshotService interface {
// List returns snapshots for an instance, optionally filtered by date (YYYY-MM-DD)
List(ctx context.Context, instanceID string, snapshotDate string) (*GetSnapshotsResponse, error)
// Create triggers an on-demand snapshot for an instance
Create(ctx context.Context, instanceID string) (*CreateSnapshotResponse, error)
// Get returns details for a snapshot of an instance
Get(ctx context.Context, instanceID string, snapshotID string) (*GetSnapshotDataResponse, error)
// Restore instance from a snapshot
Restore(ctx context.Context, instanceID string, snapshotID string) (*RestoreSnapshotResponse, error)
}
SnapshotService defines operations for managing instance snapshots
type StorageMetrics ¶ added in v1.3.1
type StorageMetrics struct {
PageCacheHitRate float64 `json:"page_cache_hit_rate,omitempty"`
}
StorageMetrics contains storage usage information
type TenantInstanceConfiguration ¶ added in v1.1.0
type TenantResponseData ¶ added in v1.1.0
type TenantResponseData struct {
Id string `json:"id"`
Name string `json:"name"`
InstanceConfigurations []TenantInstanceConfiguration `json:"instance_configurations"`
}
type TenantService ¶ added in v1.1.0
type TenantService interface {
// List returns all tenants accessible to the authenticated user
List(ctx context.Context) (*ListTenantsResponse, error)
// Get retrieves details for a specific tenant by ID
Get(ctx context.Context, tenantID string) (*GetTenantResponse, error)
// GetMetrics gets URL for project level Prometheus metrics
GetMetrics(ctx context.Context, tenantID string) (*GetTenantMetricsURLResponse, error)
}
TenantService defines operations for managing tenants