sdk

package module
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2025 License: MIT Imports: 12 Imported by: 8

README

Go SDK for Neon Postgres SaaS Platform


⭐ The project needs your support! Please leave a star and become a GitHub sponsor! ⭐

💖 Thank you @neondatabase for sponsoring the project! 💖

logo

Go Report Card Licenses Check

An SDK to manage the Neon Platform programmatically.

Neon is a serverless Postgres platform designed to help you build reliable and scalable applications faster. Neon separates compute and storage to offer modern developer features such as autoscaling, branching, point-in-time restore, and more. Neon is open source and written in Rust.

Find more about Neon here.

How to use

Prerequisites
Installation

Add the SDK as a module dependency:

go get github.com/kislerdm/neon-sdk-go

Run to specify the release version:

go get github.com/kislerdm/neon-sdk-go@{{.Ver}}

Where {{.Ver}} is the release version.

Code Snippets
Default HTTP Client

The following snippet demonstrates how to initialize SDK which will use default HTTP client.

package main

import (
	"log"

	neon "github.com/kislerdm/neon-sdk-go"
)

func main() {
	client, err := neon.NewClient(neon.Config{Key: "{{.NeonApiKey}}"})
	if err != nil {
		panic(err)
	}

	v, err := client.ListProjects(nil, nil, nil)
	if err != nil {
		panic(err)
	}

	log.Printf("%d projects found", len(v.Projects))
}
Custom HTTP client

The SDK can be initialized with a custom HTTP client.

package main

import (
	"net/http"
	"log"
	"time"

	neon "github.com/kislerdm/neon-sdk-go"
)

func main() {
	myHTTPClient := &http.Client{Timeout: 30 * time.Second}

	client, err := neon.NewClient(neon.Config{Key: "{{.NeonApiKey}}", HTTPClient: myHTTPClient})
	if err != nil {
		panic(err)
	}

	v, err := client.ListProjects(nil, nil, nil)
	if err != nil {
		panic(err)
	}

	log.Printf("%d projects found", len(v.Projects))
}
Mock

The SDK provides the http client's mock for unit tests. An example snippet is shown below.

package main

import (
	"log"

	neon "github.com/kislerdm/neon-sdk-go"
)

func main() {
	client, err := neon.NewClient(neon.Config{HTTPClient: neon.NewMockHTTPClient()})
	if err != nil {
		panic(err)
	}

	v, err := client.ListProjects(nil, nil, nil)
	if err != nil {
		panic(err)
	}

	log.Printf("%d projects found", len(v.Projects))
}

End-to-end example

Find here the example of how to use the SDK to create a Neon project and use its default database afterward.

Development

The SDK codebase is generated using the OpenAPI from the Neon API reference page. The generator application codebase can be found here.

Commands

Prerequisites:

  • go ~> 1.22
  • gnuMake / cmake

Run to see all available commands:

make help

Run to generate the SDK codebase and store it to PWD, given the OpenAPI spec is available in the file openAPIDefinition.json:

make generate-sdk

Set the flag SKIP_TEST=1 to generate the codebase without running the unit tests afterward:

SKIP_TEST=1 make generate-sdk

Run to customise the locations:

make generate-sdk PATH_SDK=##/PATH/TO/OUTPUT/SDK/CODE## PATH_SPEC=##/PATH/TO/SPEC.json##

Run to test generated SDK:

make tests

Run to test generated SDK stored to /PATH/TO/OUTPUT/SDK/CODE:

make tests DIR=/PATH/TO/OUTPUT/SDK/CODE

Run to test the code generator:

make tests DIR=generator

Run to build the code generator:

make build DIR=generator

Contribution

The SDK is distributed under the MIT license. You can find a full list of dependency licenses here.

Please feel free to open an issue ticket or PR to contribute.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptProjectTransferRequestReqObj added in v0.14.0

type AcceptProjectTransferRequestReqObj struct {
	OrgID *string `json:"org_id,omitempty"`
}

type ActiveRegionsResponse added in v0.8.0

type ActiveRegionsResponse struct {
	// Regions The list of active regions
	Regions []RegionResponse `json:"regions"`
}

type AddProjectJWKSRequest added in v0.9.0

type AddProjectJWKSRequest struct {
	// BranchID Branch ID
	BranchID *string `json:"branch_id,omitempty"`
	// JwksURL The URL that lists the JWKS
	JwksURL string `json:"jwks_url"`
	// JwtAudience The name of the required JWT Audience to be used
	JwtAudience *string `json:"jwt_audience,omitempty"`
	// ProviderName The name of the authentication provider (e.g., Clerk, Stytch, Auth0)
	ProviderName string `json:"provider_name"`
	// RoleNames DEPRECATED. This field should only be used when using Neon RLS. The roles the JWKS should be mapped to. By default, the JWKS is mapped to the `authenticator`, `authenticated` and `anonymous` roles.
	RoleNames *[]string `json:"role_names,omitempty"`
}

AddProjectJWKSRequest Add a new JWKS to a specific endpoint of a project

type AllowedIps added in v0.3.2

type AllowedIps struct {
	// Ips A list of IP addresses that are allowed to connect to the endpoint.
	Ips *[]string `json:"ips,omitempty"`
	// ProtectedBranchesOnly If true, the list will be applied only to protected branches.
	ProtectedBranchesOnly *bool `json:"protected_branches_only,omitempty"`
}

AllowedIps A list of IP addresses that are allowed to connect to the compute endpoint. If the list is empty or not set, all IP addresses are allowed. If protected_branches_only is true, the list will be applied only to protected branches.

type AnnotationCreateValueRequest added in v0.6.0

type AnnotationCreateValueRequest struct {
	AnnotationValue *AnnotationValueData `json:"annotation_value,omitempty"`
}

type AnnotationData added in v0.6.0

type AnnotationData struct {
	CreatedAt *time.Time           `json:"created_at,omitempty"`
	Object    AnnotationObjectData `json:"object"`
	UpdatedAt *time.Time           `json:"updated_at,omitempty"`
	Value     AnnotationValueData  `json:"value"`
}

type AnnotationObjectData added in v0.6.0

type AnnotationObjectData struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

type AnnotationResponse added in v0.6.0

type AnnotationResponse struct {
	Annotation AnnotationData `json:"annotation"`
}

type AnnotationValueData added in v0.6.0

type AnnotationValueData struct{}

AnnotationValueData Annotation properties.

type AnnotationsMapResponse added in v0.6.0

type AnnotationsMapResponse struct {
	Annotations AnnotationsMapResponseAnnotations `json:"annotations"`
}

type AnnotationsMapResponseAnnotations added in v0.6.0

type AnnotationsMapResponseAnnotations struct{}

type ApiKeyCreateRequest

type ApiKeyCreateRequest struct {
	// KeyName A user-specified API key name. This value is required when creating an API key.
	KeyName string `json:"key_name"`
}

type ApiKeyCreateResponse

type ApiKeyCreateResponse struct {
	// CreatedAt A timestamp indicating when the API key was created
	CreatedAt time.Time `json:"created_at"`
	// CreatedBy ID of the user who created this API key
	CreatedBy string `json:"created_by"`
	// ID The API key ID
	ID int64 `json:"id"`
	// Key The generated 64-bit token required to access the Neon API
	Key string `json:"key"`
	// Name The user-specified API key name
	Name string `json:"name"`
}

type ApiKeyCreatorData added in v0.8.0

type ApiKeyCreatorData struct {
	// ID of the user who created this API key
	ID string `json:"id"`
	// Image The URL to the user's avatar image.
	Image string `json:"image"`
	// Name The name of the user.
	Name string `json:"name"`
}

ApiKeyCreatorData The user data of the user that created this API key.

type ApiKeyRevokeResponse

type ApiKeyRevokeResponse struct {
	// CreatedAt A timestamp indicating when the API key was created
	CreatedAt time.Time `json:"created_at"`
	// CreatedBy ID of the user who created this API key
	CreatedBy string `json:"created_by"`
	// ID The API key ID
	ID int64 `json:"id"`
	// LastUsedAt A timestamp indicating when the API was last used
	LastUsedAt *time.Time `json:"last_used_at,omitempty"`
	// LastUsedFromAddr The IP address from which the API key was last used
	LastUsedFromAddr string `json:"last_used_from_addr"`
	// Name The user-specified API key name
	Name string `json:"name"`
	// Revoked A `true` or `false` value indicating whether the API key is revoked
	Revoked bool `json:"revoked"`
}

type ApiKeysListResponseItem

type ApiKeysListResponseItem struct {
	// CreatedAt A timestamp indicating when the API key was created
	CreatedAt time.Time         `json:"created_at"`
	CreatedBy ApiKeyCreatorData `json:"created_by"`
	// ID The API key ID
	ID int64 `json:"id"`
	// LastUsedAt A timestamp indicating when the API was last used
	LastUsedAt *time.Time `json:"last_used_at,omitempty"`
	// LastUsedFromAddr The IP address from which the API key was last used
	LastUsedFromAddr string `json:"last_used_from_addr"`
	// Name The user-specified API key name
	Name string `json:"name"`
}

type AuthDetailsResponse added in v0.14.0

type AuthDetailsResponse struct {
	AccountID  string  `json:"account_id"`
	AuthData   *string `json:"auth_data,omitempty"`
	AuthMethod string  `json:"auth_method"`
}

type AvailablePreloadLibraries added in v0.14.0

type AvailablePreloadLibraries struct {
	Libraries *[]AvailablePreloadLibrary `json:"libraries,omitempty"`
}

type AvailablePreloadLibrary added in v0.14.0

type AvailablePreloadLibrary struct {
	Description    string `json:"description"`
	IsDefault      bool   `json:"is_default"`
	IsExperimental bool   `json:"is_experimental"`
	LibraryName    string `json:"library_name"`
	Version        string `json:"version"`
}

type BillingAccount added in v0.2.3

type BillingAccount struct {
	// AddressCity Billing address city.
	AddressCity string `json:"address_city"`
	// AddressCountry Billing address country code defined by ISO 3166-1 alpha-2.
	AddressCountry string `json:"address_country"`
	// AddressCountryName Billing address country name.
	AddressCountryName *string `json:"address_country_name,omitempty"`
	// AddressLine1 Billing address line 1.
	AddressLine1 string `json:"address_line1"`
	// AddressLine2 Billing address line 2.
	AddressLine2 string `json:"address_line2"`
	// AddressPostalCode Billing address postal code.
	AddressPostalCode string `json:"address_postal_code"`
	// AddressState Billing address state or region.
	AddressState string `json:"address_state"`
	// Email Billing email, to receive emails related to invoices and subscriptions.
	Email string `json:"email"`
	// Name The full name of the individual or entity that owns the billing account. This name appears on invoices.
	Name string `json:"name"`
	// OrbPortalURL Orb user portal url
	OrbPortalURL  *string              `json:"orb_portal_url,omitempty"`
	PaymentMethod BillingPaymentMethod `json:"payment_method"`
	PaymentSource PaymentSource        `json:"payment_source"`
	PlanDetails   *PlanDetails         `json:"plan_details,omitempty"`
	// QuotaResetAtLast The last time the quota was reset. Defaults to the date-time the account is created.
	QuotaResetAtLast time.Time               `json:"quota_reset_at_last"`
	State            BillingAccountState     `json:"state"`
	SubscriptionType BillingSubscriptionType `json:"subscription_type"`
	// TaxID The tax identification number for the billing account, displayed on invoices.
	TaxID *string `json:"tax_id,omitempty"`
	// TaxIDType The type of the tax identification number based on the country.
	TaxIDType *string `json:"tax_id_type,omitempty"`
}

type BillingAccountState added in v0.8.0

type BillingAccountState string

BillingAccountState State of the billing account.

const (
	BillingAccountStateUNKNOWN     BillingAccountState = "UNKNOWN"
	BillingAccountStateActive      BillingAccountState = "active"
	BillingAccountStateDeactivated BillingAccountState = "deactivated"
	BillingAccountStateDeleted     BillingAccountState = "deleted"
	BillingAccountStateSuspended   BillingAccountState = "suspended"
)

type BillingPaymentMethod added in v0.6.0

type BillingPaymentMethod string

BillingPaymentMethod Indicates whether and how an account makes payments.

const (
	BillingPaymentMethodUNKNOWN       BillingPaymentMethod = "UNKNOWN"
	BillingPaymentMethodAwsMp         BillingPaymentMethod = "aws_mp"
	BillingPaymentMethodAzureMp       BillingPaymentMethod = "azure_mp"
	BillingPaymentMethodDirectPayment BillingPaymentMethod = "direct_payment"
	BillingPaymentMethodNone          BillingPaymentMethod = "none"
	BillingPaymentMethodSponsorship   BillingPaymentMethod = "sponsorship"
	BillingPaymentMethodStaff         BillingPaymentMethod = "staff"
	BillingPaymentMethodStripe        BillingPaymentMethod = "stripe"
	BillingPaymentMethodTrial         BillingPaymentMethod = "trial"
	BillingPaymentMethodVercelMp      BillingPaymentMethod = "vercel_mp"
)

type BillingSubscriptionType added in v0.2.0

type BillingSubscriptionType string

BillingSubscriptionType Type of subscription to Neon Cloud. Notice that for users without billing account this will be "UNKNOWN"

const (
	BillingSubscriptionTypeUNKNOWN        BillingSubscriptionType = "UNKNOWN"
	BillingSubscriptionTypeAwsMarketplace BillingSubscriptionType = "aws_marketplace"
	BillingSubscriptionTypeBusiness       BillingSubscriptionType = "business"
	BillingSubscriptionTypeDirectSales    BillingSubscriptionType = "direct_sales"
	BillingSubscriptionTypeDirectSalesV3  BillingSubscriptionType = "direct_sales_v3"
	BillingSubscriptionTypeFreeV2         BillingSubscriptionType = "free_v2"
	BillingSubscriptionTypeFreeV3         BillingSubscriptionType = "free_v3"
	BillingSubscriptionTypeLaunch         BillingSubscriptionType = "launch"
	BillingSubscriptionTypeLaunchV3       BillingSubscriptionType = "launch_v3"
	BillingSubscriptionTypeScale          BillingSubscriptionType = "scale"
	BillingSubscriptionTypeScaleV3        BillingSubscriptionType = "scale_v3"
	BillingSubscriptionTypeVercelPgLegacy BillingSubscriptionType = "vercel_pg_legacy"
)

type Branch

type Branch struct {
	ActiveTimeSeconds  int64 `json:"active_time_seconds"`
	ComputeTimeSeconds int64 `json:"compute_time_seconds"`
	// CpuUsedSec CPU seconds used by all of the branch's compute endpoints, including deleted ones.
	// This value is reset at the beginning of each billing period.
	// Examples:
	// 1. A branch that uses 1 CPU for 1 second is equal to `cpu_used_sec=1`.
	// 2. A branch that uses 2 CPUs simultaneously for 1 second is equal to `cpu_used_sec=2`.
	CpuUsedSec int64 `json:"cpu_used_sec"`
	// CreatedAt A timestamp indicating when the branch was created
	CreatedAt time.Time        `json:"created_at"`
	CreatedBy *BranchCreatedBy `json:"created_by,omitempty"`
	// CreationSource The branch creation source
	CreationSource    string      `json:"creation_source"`
	CurrentState      BranchState `json:"current_state"`
	DataTransferBytes int64       `json:"data_transfer_bytes"`
	// Default Whether the branch is the project's default branch
	Default bool `json:"default"`
	// ExpiresAt The timestamp when the branch is scheduled to expire and be automatically deleted. Must be set by the client following the [RFC 3339, section 5.6](https://tools.ietf.org/html/rfc3339#section-5.6) format with precision up to seconds (such as 2025-06-09T18:02:16Z). Deletion is performed by a background job and may not occur exactly at the specified time.
	//
	// Access to this feature is currently limited to participants in the Early Access Program.
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
	// ID The branch ID. This value is generated when a branch is created. A `branch_id` value has a `br` prefix. For example: `br-small-term-683261`.
	ID string `json:"id"`
	// InitSource The source of initialization for the branch. Valid values are `schema-only` and `parent-data` (default).
	//   * `schema-only` - creates a new root branch containing only the schema. Use `parent_id` to specify the source branch. Optionally, you can provide `parent_lsn` or `parent_timestamp` to branch from a specific point in time or LSN. These fields define which branch to copy the schema from and at what point—they do not establish a parent-child relationship between the `parent_id` branch and the new schema-only branch.
	//   * `parent-data` - creates the branch with both schema and data from the parent.
	InitSource *string `json:"init_source,omitempty"`
	// LastResetAt A timestamp indicating when the branch was last reset
	LastResetAt *time.Time `json:"last_reset_at,omitempty"`
	// LogicalSize The logical size of the branch, in bytes
	LogicalSize *int64 `json:"logical_size,omitempty"`
	// Name The branch name
	Name string `json:"name"`
	// ParentID The `branch_id` of the parent branch
	ParentID *string `json:"parent_id,omitempty"`
	// ParentLsn The Log Sequence Number (LSN) on the parent branch from which this branch was created.
	// When restoring a branch using the [Restore branch](https://api-docs.neon.tech/reference/restoreprojectbranch) endpoint,
	// this value isn’t finalized until all operations related to the restore have completed successfully.
	ParentLsn *string `json:"parent_lsn,omitempty"`
	// ParentTimestamp The point in time on the parent branch from which this branch was created.
	// When restoring a branch using the [Restore branch](https://api-docs.neon.tech/reference/restoreprojectbranch) endpoint,
	// this value isn’t finalized until all operations related to the restore have completed successfully.
	// After all the operations completed, this value might stay empty.
	ParentTimestamp *time.Time   `json:"parent_timestamp,omitempty"`
	PendingState    *BranchState `json:"pending_state,omitempty"`
	// Primary DEPRECATED. Use `default` field.
	// Whether the branch is the project's primary branch
	Primary *bool `json:"primary,omitempty"`
	// ProjectID The ID of the project to which the branch belongs
	ProjectID string `json:"project_id"`
	// Protected Whether the branch is protected
	Protected     bool                 `json:"protected"`
	RestoreStatus *BranchRestoreStatus `json:"restore_status,omitempty"`
	// RestoredAs ID of the target branch which was replaced when this branch was restored
	RestoredAs *string `json:"restored_as,omitempty"`
	// RestoredActions A list of actions that are currently restricted for this branch and the reason why.
	RestoredActions []BranchRestrictedAction `json:"restricted_actions,omitempty"`
	// RestoredFrom ID of the snapshot that was the restore source for this branch
	RestoredFrom *string `json:"restored_from,omitempty"`
	// StateChangedAt A UTC timestamp indicating when the `current_state` began
	StateChangedAt time.Time `json:"state_changed_at"`
	// TtlIntervalSeconds The time-to-live (TTL) duration originally configured for the branch, in seconds. This read-only value represents the interval between the time `expires_at` was set and the expiration timestamp itself. It is preserved to ensure the same TTL duration is reapplied when resetting the branch from its parent, and only updates when a new `expires_at` value is set.
	//
	// Access to this feature is currently limited to participants in the Early Access Program.
	TtlIntervalSeconds *int `json:"ttl_interval_seconds,omitempty"`
	// UpdatedAt A timestamp indicating when the branch was last updated
	UpdatedAt        time.Time `json:"updated_at"`
	WrittenDataBytes int64     `json:"written_data_bytes"`
}

type BranchCreateRequest

type BranchCreateRequest struct {
	Branch    *BranchCreateRequestBranch            `json:"branch,omitempty"`
	Endpoints *[]BranchCreateRequestEndpointOptions `json:"endpoints,omitempty"`
}

type BranchCreateRequestBranch

type BranchCreateRequestBranch struct {
	// Archived Whether to create the branch as archived
	Archived *bool `json:"archived,omitempty"`
	// ExpiresAt The timestamp when the branch is scheduled to expire and be automatically deleted. Must be set by the client following the [RFC 3339, section 5.6](https://tools.ietf.org/html/rfc3339#section-5.6) format with precision up to seconds (such as 2025-06-09T18:02:16Z). Deletion is performed by a background job and may not occur exactly at the specified time.
	//
	// Access to this feature is currently limited to participants in the Early Access Program.
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
	// InitSource The source of initialization for the branch. Valid values are `schema-only` and `parent-data` (default).
	//   * `schema-only` - creates a new root branch containing only the schema. Use `parent_id` to specify the source branch. Optionally, you can provide `parent_lsn` or `parent_timestamp` to branch from a specific point in time or LSN. These fields define which branch to copy the schema from and at what point—they do not establish a parent-child relationship between the `parent_id` branch and the new schema-only branch.
	//   * `parent-data` - creates the branch with both schema and data from the parent.
	InitSource *string `json:"init_source,omitempty"`
	// Name The branch name
	Name *string `json:"name,omitempty"`
	// ParentID The `branch_id` of the parent branch. If omitted or empty, the branch will be created from the project's default branch.
	ParentID *string `json:"parent_id,omitempty"`
	// ParentLsn A Log Sequence Number (LSN) on the parent branch. The branch will be created with data from this LSN.
	ParentLsn *string `json:"parent_lsn,omitempty"`
	// ParentTimestamp A timestamp identifying a point in time on the parent branch. The branch will be created with data starting from this point in time.
	// The timestamp must be provided in ISO 8601 format; for example: `2024-02-26T12:00:00Z`.
	ParentTimestamp *time.Time `json:"parent_timestamp,omitempty"`
	// Protected Whether the branch is protected
	Protected *bool `json:"protected,omitempty"`
}

type BranchCreateRequestEndpointOptions

type BranchCreateRequestEndpointOptions struct {
	AutoscalingLimitMaxCu *ComputeUnit           `json:"autoscaling_limit_max_cu,omitempty"`
	AutoscalingLimitMinCu *ComputeUnit           `json:"autoscaling_limit_min_cu,omitempty"`
	Provisioner           *Provisioner           `json:"provisioner,omitempty"`
	Settings              *EndpointSettingsData  `json:"settings,omitempty"`
	SuspendTimeoutSeconds *SuspendTimeoutSeconds `json:"suspend_timeout_seconds,omitempty"`
	Type                  EndpointType           `json:"type"`
}

type BranchCreatedBy added in v0.6.0

type BranchCreatedBy struct {
	// Image The URL to the user's avatar image.
	Image *string `json:"image,omitempty"`
	// Name The name of the user.
	Name *string `json:"name,omitempty"`
}

BranchCreatedBy The resolved user model that contains details of the user/org/integration/api_key used for branch creation. This field is filled only in listing/get/create/get/update/delete methods, if it is empty when calling other handlers, it does not mean that it is empty in the system.

type BranchOperations

type BranchOperations struct {
	BranchResponse
	OperationsResponse
}

type BranchResponse

type BranchResponse struct {
	Branch Branch `json:"branch"`
}

type BranchRestoreRequest added in v0.4.7

type BranchRestoreRequest struct {
	// PreserveUnderName If not empty, the previous state of the branch will be saved to a branch with this name.
	// If the branch has children or the `source_branch_id` is equal to the branch id, this field is required. All existing child branches will be moved to the newly created branch under the name `preserve_under_name`.
	PreserveUnderName *string `json:"preserve_under_name,omitempty"`
	// SourceBranchID The `branch_id` of the restore source branch.
	// If `source_timestamp` and `source_lsn` are omitted, the branch will be restored to head.
	// If `source_branch_id` is equal to the branch's id, `source_timestamp` or `source_lsn` is required.
	SourceBranchID string `json:"source_branch_id"`
	// SourceLsn A Log Sequence Number (LSN) on the source branch. The branch will be restored with data from this LSN.
	SourceLsn *string `json:"source_lsn,omitempty"`
	// SourceTimestamp A timestamp identifying a point in time on the source branch. The branch will be restored with data starting from this point in time.
	// The timestamp must be provided in ISO 8601 format; for example: `2024-02-26T12:00:00Z`.
	SourceTimestamp *time.Time `json:"source_timestamp,omitempty"`
}

type BranchRestoreStatus added in v0.14.0

type BranchRestoreStatus string

BranchRestoreStatus Could be `restored`, `finalized` or `detaching`. A `restored` branch becomes permanently `finalized` when you call `finalizeRestoreBranch` A `restored` or `finalized` branch may begin `detaching` as a one-time performance optimisation, after which it will continue in its original state

type BranchRestrictedAction added in v0.15.0

type BranchRestrictedAction struct {
	// Name The name of a restricted action. Possible values include `restore`, `delete-rw-endpoint`.
	Name string `json:"name"`
	// Reason A human-readable explanation of why the action is restricted.
	Reason string `json:"reason"`
}

BranchRestrictedAction An action that is currently restricted for the branch and the reason why.

type BranchSchemaCompareResponse added in v0.12.0

type BranchSchemaCompareResponse struct {
	Diff *string `json:"diff,omitempty"`
}

type BranchSchemaJSON added in v0.14.0

type BranchSchemaJSON struct {
	Tables []BranchSchemaJSONTable `json:"tables"`
}

type BranchSchemaJSONTable added in v0.14.0

type BranchSchemaJSONTable struct {
	Schema  string                        `json:"schema"`
	Name    string                        `json:"name"`
	Columns []BranchSchemaJSONTableColumn `json:"columns"`
}

type BranchSchemaJSONTableColumn added in v0.14.0

type BranchSchemaJSONTableColumn struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type BranchSchemaResponse added in v0.5.0

type BranchSchemaResponse struct {
	Json *BranchSchemaJSON `json:"json,omitempty"`
	Sql  *string           `json:"sql,omitempty"`
}

type BranchState

type BranchState string

BranchState The branch’s state, indicating if it is initializing, ready for use, or archived.

  • 'init' - the branch is being created but is not available for querying.
  • 'resetting' - the branch is being reset to a specific point in time or LSN and is not yet available for querying.
  • 'ready' - the branch is fully operational and ready for querying. Expect normal query response times.
  • 'archived' - the branch is stored in cost-effective archival storage. Expect slow query response times.

type BranchUpdateRequest

type BranchUpdateRequest struct {
	Branch BranchUpdateRequestBranch `json:"branch"`
}

type BranchUpdateRequestBranch

type BranchUpdateRequestBranch struct {
	// ExpiresAt The timestamp when the branch is scheduled to expire and be automatically deleted. Must be set by the client following the [RFC 3339, section 5.6](https://tools.ietf.org/html/rfc3339#section-5.6) format with precision up to seconds (such as 2025-06-09T18:02:16Z). Deletion is performed by a background job and may not occur exactly at the specified time. If this field is set to null, the expiration timestamp is removed.
	//
	// Access to this feature is currently limited to participants in the Early Access Program.
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
	Name      *string    `json:"name,omitempty"`
	Protected *bool      `json:"protected,omitempty"`
}

type BranchesCountResponse added in v0.12.0

type BranchesCountResponse struct {
	Count int `json:"count"`
}

type BranchesResponse

type BranchesResponse struct {
	Branches []Branch `json:"branches"`
}

type Client

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

Client defines the Neon SDK client.

func NewClient

func NewClient(cfg Config) (*Client, error)

NewClient initialised the Client to communicate to the Neon Platform.

func (Client) AcceptProjectTransferRequest added in v0.14.0

func (c Client) AcceptProjectTransferRequest(projectID string, requestID string, cfg *AcceptProjectTransferRequestReqObj) error

AcceptProjectTransferRequest Accepts a transfer request for the specified project, transferring it to the specified organization or user. If org_id is not passed, the project will be transferred to the current user or organization account.

func (Client) AddNeonAuthDomainToRedirectURIWhitelist added in v0.14.0

func (c Client) AddNeonAuthDomainToRedirectURIWhitelist(projectID string, cfg NeonAuthAddDomainToRedirectURIWhitelistRequest) error

AddNeonAuthDomainToRedirectURIWhitelist Adds a domain to the redirect_uri whitelist for the specified project.

func (Client) AddNeonAuthOauthProvider added in v0.14.0

func (c Client) AddNeonAuthOauthProvider(projectID string, cfg NeonAuthAddOAuthProviderRequest) (NeonAuthOauthProvider, error)

AddNeonAuthOauthProvider Adds a OAuth provider to the specified project.

func (Client) AddProjectJWKS added in v0.9.0

func (c Client) AddProjectJWKS(projectID string, cfg AddProjectJWKSRequest) (JWKSCreationOperation, error)

AddProjectJWKS Add a new JWKS URL to a project, such that it can be used for verifying JWTs used as the authentication mechanism for the specified project. The URL must be a valid HTTPS URL that returns a JSON Web Key Set. The `provider_name` field allows you to specify which authentication provider you're using (e.g., Clerk, Auth0, AWS Cognito, etc.). The `branch_id` can be used to specify on which branches the JWKS URL will be accepted. If not specified, then it will work on any branch. The `role_names` can be used to specify for which roles the JWKS URL will be accepted. If not specified, then default roles will be used (authenticator, authenticated and anonymous). The `jwt_audience` can be used to specify which "aud" values should be accepted by Neon in the JWTs that are used for authentication.

func (Client) AssignOrganizationVPCEndpoint added in v0.12.0

func (c Client) AssignOrganizationVPCEndpoint(orgID string, regionID string, vpcEndpointID string, cfg VPCEndpointAssignment) error

AssignOrganizationVPCEndpoint Assigns a VPC endpoint to a Neon organization or updates its existing assignment.

func (Client) AssignProjectVPCEndpoint added in v0.12.0

func (c Client) AssignProjectVPCEndpoint(projectID string, vpcEndpointID string, cfg VPCEndpointAssignment) error

AssignProjectVPCEndpoint Sets or updates a VPC endpoint restriction for a Neon project. When a VPC endpoint restriction is set, the project only accepts connections from the specified VPC. A VPC endpoint can be set as a restriction only after it is assigned to the parent organization of the Neon project.

func (Client) CountProjectBranches added in v0.12.0

func (c Client) CountProjectBranches(projectID string, search *string) (CountProjectBranchesRespObj, error)

CountProjectBranches Retrieves the total number of branches in the specified project. You can obtain a `project_id` by listing the projects for your Neon account.

func (Client) CreateApiKey

func (c Client) CreateApiKey(cfg ApiKeyCreateRequest) (ApiKeyCreateResponse, error)

CreateApiKey Creates an API key. The `key_name` is a user-specified name for the key. This method returns an `id` and `key`. The `key` is a randomly generated, 64-bit token required to access the Neon API. API keys can also be managed in the Neon Console. See [Manage API keys](https://neon.tech/docs/manage/api-keys/).

func (Client) CreateNeonAuthIntegration added in v0.14.0

CreateNeonAuthIntegration Creates a project on a third-party authentication provider's platform for use with Neon Auth. Use this endpoint if the frontend integration flow can't be used.

func (Client) CreateNeonAuthNewUser added in v0.14.0

CreateNeonAuthNewUser Creates a new user in Neon Auth. The user will be created in your neon_auth.users_sync table and automatically propagated to your auth project, whether Neon-managed or provider-owned.

func (Client) CreateNeonAuthProviderSDKKeys added in v0.14.0

CreateNeonAuthProviderSDKKeys Generates SDK or API Keys for the auth provider. These might be called different things depending on the auth provider you're using, but are generally used for setting up the frontend and backend SDKs.

func (Client) CreateOrgApiKey added in v0.12.0

func (c Client) CreateOrgApiKey(orgID string, cfg OrgApiKeyCreateRequest) (OrgApiKeyCreateResponse, error)

CreateOrgApiKey Creates an API key for the specified organization. The `key_name` is a user-specified name for the key. This method returns an `id` and `key`. The `key` is a randomly generated, 64-bit token required to access the Neon API. API keys can also be managed in the Neon Console. See [Manage API keys](https://neon.tech/docs/manage/api-keys/).

func (Client) CreateOrganizationInvitations added in v0.9.0

func (c Client) CreateOrganizationInvitations(orgID string, cfg OrganizationInvitesCreateRequest) (OrganizationInvitationsResponse, error)

CreateOrganizationInvitations Creates invitations for a specific organization. If the invited user has an existing account, they automatically join as a member. If they don't yet have an account, they are invited to create one, after which they become a member. Each invited user receives an email notification.

func (Client) CreateProject

func (c Client) CreateProject(cfg ProjectCreateRequest) (CreatedProject, error)

CreateProject Creates a Neon project within an organization. You may need to specify an org_id parameter depending on your API key type. Plan limits define how many projects you can create. For more information, see [Manage projects](https://neon.tech/docs/manage/projects/). You can specify a region and Postgres version in the request body. Neon currently supports PostgreSQL 14, 15, 16, and 17. For supported regions and `region_id` values, see [Regions](https://neon.tech/docs/introduction/regions/).

func (Client) CreateProjectBranch

func (c Client) CreateProjectBranch(projectID string, cfg *CreateProjectBranchReqObj) (CreatedBranch, error)

CreateProjectBranch Creates a branch in the specified project. You can obtain a `project_id` by listing the projects for your Neon account. This method does not require a request body, but you can specify one to create a compute endpoint for the branch or to select a non-default parent branch. By default, the branch is created from the project's default branch with no compute endpoint, and the branch name is auto-generated. To access the branch, you must add an endpoint object. A `read_write` endpoint allows you to perform read and write operations on the branch. Each branch supports one read-write endpoint and multiple read-only endpoints. For related information, see [Manage branches](https://neon.tech/docs/manage/branches/).

func (Client) CreateProjectBranchDataAPI added in v0.14.0

func (c Client) CreateProjectBranchDataAPI(projectID string, branchID string, databaseName string, cfg *DataAPICreateRequest) (DataAPICreateResponse, error)

CreateProjectBranchDataAPI Creates a new instance of Neon Data API in the specified branch. You can obtain the `project_id` and `branch_id` by listing the projects and branches for your Neon account.

func (Client) CreateProjectBranchDatabase

func (c Client) CreateProjectBranchDatabase(projectID string, branchID string, cfg DatabaseCreateRequest) (DatabaseOperations, error)

CreateProjectBranchDatabase Creates a database in the specified branch. A branch can have multiple databases. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain the `branch_id` by listing the project's branches. For related information, see [Manage databases](https://neon.tech/docs/manage/databases/).

func (Client) CreateProjectBranchRole

func (c Client) CreateProjectBranchRole(projectID string, branchID string, cfg RoleCreateRequest) (RoleOperations, error)

CreateProjectBranchRole Creates a Postgres role in the specified branch. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain the `branch_id` by listing the project's branches. For related information, see [Manage roles](https://neon.tech/docs/manage/roles/). Connections established to the active compute endpoint will be dropped. If the compute endpoint is idle, the endpoint becomes active for a short period of time and is suspended afterward.

func (Client) CreateProjectEndpoint

func (c Client) CreateProjectEndpoint(projectID string, cfg EndpointCreateRequest) (EndpointOperations, error)

CreateProjectEndpoint Creates a compute endpoint for the specified branch. An endpoint is a Neon compute instance. There is a maximum of one read-write compute endpoint per branch. If the specified branch already has a read-write compute endpoint, the operation fails. A branch can have multiple read-only compute endpoints. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain `branch_id` by listing the project's branches. A `branch_id` has a `br-` prefix. For supported regions and `region_id` values, see [Regions](https://neon.tech/docs/introduction/regions/). For more information about compute endpoints, see [Manage computes](https://neon.tech/docs/manage/endpoints/).

func (Client) CreateProjectTransferRequest added in v0.14.0

func (c Client) CreateProjectTransferRequest(projectID string, cfg *CreateProjectTransferRequestReqObj) (ProjectTransferRequestResponse, error)

CreateProjectTransferRequest Creates a transfer request for the specified project. A transfer request allows the project to be transferred to another account or organization. The request has an expiration time after which it can no longer be used. To accept/claim the transfer request, the recipient user/organization must call the `/projects/{project_id}/transfer_requests/{request_id}` API endpoint, or visit `https://console.neon.tech/app/claim?p={project_id}&tr={request_id}&ru={redirect_url}` in the Neon Console. The `ru` parameter is optional and can be used to redirect the user after accepting the transfer request.

func (Client) CreateSnapshot added in v0.14.0

func (c Client) CreateSnapshot(projectID string, branchID string, lsn *string, timestamp *string, name *string, expiresAt *string) (CreateSnapshotRespObj, error)

CreateSnapshot Create a snapshot from the specified branch using the provided parameters. This endpoint may initiate an asynchronous operation. **Note**: This endpoint is currently in Beta.

func (Client) DeleteNeonAuthDomainFromRedirectURIWhitelist added in v0.14.0

func (c Client) DeleteNeonAuthDomainFromRedirectURIWhitelist(projectID string, cfg NeonAuthDeleteDomainFromRedirectURIWhitelistRequest) error

DeleteNeonAuthDomainFromRedirectURIWhitelist Deletes a domain from the redirect_uri whitelist for the specified project.

func (Client) DeleteNeonAuthIntegration added in v0.14.0

func (c Client) DeleteNeonAuthIntegration(projectID string, authProvider NeonAuthSupportedAuthProvider, cfg *DeleteNeonAuthIntegrationReqObj) error

func (Client) DeleteNeonAuthOauthProvider added in v0.14.0

func (c Client) DeleteNeonAuthOauthProvider(projectID string, oauthProviderID NeonAuthOauthProviderId) error

DeleteNeonAuthOauthProvider Deletes a OAuth provider from the specified project.

func (Client) DeleteNeonAuthUser added in v0.14.0

func (c Client) DeleteNeonAuthUser(projectID string, authUserID string) error

DeleteNeonAuthUser Deletes the auth user for the specified project.

func (Client) DeleteOrganizationVPCEndpoint added in v0.12.0

func (c Client) DeleteOrganizationVPCEndpoint(orgID string, regionID string, vpcEndpointID string) error

DeleteOrganizationVPCEndpoint Deletes the VPC endpoint from the specified Neon organization. If you delete a VPC endpoint from a Neon organization, that VPC endpoint cannot be added back to the Neon organization.

func (Client) DeleteProject

func (c Client) DeleteProject(projectID string) (ProjectResponse, error)

DeleteProject Deletes the specified project. You can obtain a `project_id` by listing the projects for your Neon account. Deleting a project is a permanent action. Deleting a project also deletes endpoints, branches, databases, and users that belong to the project.

func (Client) DeleteProjectBranch

func (c Client) DeleteProjectBranch(projectID string, branchID string) (BranchOperations, error)

DeleteProjectBranch Deletes the specified branch from a project, and places all compute endpoints into an idle state, breaking existing client connections. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain a `branch_id` by listing the project's branches. For related information, see [Manage branches](https://neon.tech/docs/manage/branches/). When a successful response status is received, the compute endpoints are still active, and the branch is not yet deleted from storage. The deletion occurs after all operations finish. You cannot delete a project's root or default branch, and you cannot delete a branch that has a child branch. A project must have at least one branch.

func (Client) DeleteProjectBranchDataAPI added in v0.14.0

func (c Client) DeleteProjectBranchDataAPI(projectID string, branchID string, databaseName string) (EmptyResponse, error)

DeleteProjectBranchDataAPI Deletes the Neon Data API for the specified branch. You can obtain the `project_id` and `branch_id` by listing the projects and branches for your Neon account.

func (Client) DeleteProjectBranchDatabase

func (c Client) DeleteProjectBranchDatabase(projectID string, branchID string, databaseName string) (DatabaseOperations, error)

DeleteProjectBranchDatabase Deletes the specified database from the branch. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain the `branch_id` and `database_name` by listing the branch's databases. For related information, see [Manage databases](https://neon.tech/docs/manage/databases/).

func (Client) DeleteProjectBranchRole

func (c Client) DeleteProjectBranchRole(projectID string, branchID string, roleName string) (RoleOperations, error)

DeleteProjectBranchRole Deletes the specified Postgres role from the branch. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain the `branch_id` by listing the project's branches. You can obtain the `role_name` by listing the roles for a branch. For related information, see [Manage roles](https://neon.tech/docs/manage/roles/).

func (Client) DeleteProjectEndpoint

func (c Client) DeleteProjectEndpoint(projectID string, endpointID string) (EndpointOperations, error)

DeleteProjectEndpoint Delete the specified compute endpoint. A compute endpoint is a Neon compute instance. Deleting a compute endpoint drops existing network connections to the compute endpoint. The deletion is completed when last operation in the chain finishes successfully. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain an `endpoint_id` by listing your project's compute endpoints. An `endpoint_id` has an `ep-` prefix. For information about compute endpoints, see [Manage computes](https://neon.tech/docs/manage/endpoints/).

func (Client) DeleteProjectJWKS added in v0.9.0

func (c Client) DeleteProjectJWKS(projectID string, jwksID string) (JWKS, error)

DeleteProjectJWKS Deletes a JWKS URL from the specified project

func (Client) DeleteProjectVPCEndpoint added in v0.12.0

func (c Client) DeleteProjectVPCEndpoint(projectID string, vpcEndpointID string) error

DeleteProjectVPCEndpoint Removes the specified VPC endpoint restriction from a Neon project.

func (Client) DeleteSnapshot added in v0.14.0

func (c Client) DeleteSnapshot(projectID string, snapshotID string) error

DeleteSnapshot Delete the specified snapshot. **Note**: This endpoint is currently in Beta.

func (Client) FinalizeRestoreBranch added in v0.14.0

func (c Client) FinalizeRestoreBranch(projectID string, branchID string, cfg *FinalizeRestoreBranchReqObj) (OperationsResponse, error)

FinalizeRestoreBranch Finalize the restore operation for a branch created from a snapshot. This operation updates the branch so it functions as the original branch it replaced. This includes: - Reassigning any computes from the original branch to the restored branch (this will restart the computes) - Renaming the restored branch to the original branch's name - Renaming the original branch so it no longer uses the original name This operation only applies to branches created using the `restoreSnapshot` endpoint with `finalize_restore: false`. **Note**: This endpoint is currently in Beta.

func (Client) GetActiveRegions added in v0.8.0

func (c Client) GetActiveRegions() (ActiveRegionsResponse, error)

GetActiveRegions Lists supported Neon regions

func (Client) GetAuthDetails added in v0.14.0

func (c Client) GetAuthDetails() (AuthDetailsResponse, error)

GetAuthDetails Returns auth information about the passed credentials. It can refer to an API key, Bearer token or OAuth session.

func (Client) GetAvailablePreloadLibraries added in v0.14.0

func (c Client) GetAvailablePreloadLibraries(projectID string) (AvailablePreloadLibraries, error)

GetAvailablePreloadLibraries Return available shared preload libraries

func (Client) GetConnectionURI added in v0.4.8

func (c Client) GetConnectionURI(projectID string, branchID *string, endpointID *string, databaseName string, roleName string, pooled *bool) (ConnectionURIResponse, error)

GetConnectionURI Retrieves a connection URI for the specified database. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain the `database_name` by listing the databases for a branch. You can obtain a `role_name` by listing the roles for a branch.

func (Client) GetConsumptionHistoryPerAccount added in v0.5.0

func (c Client) GetConsumptionHistoryPerAccount(from time.Time, to time.Time, granularity ConsumptionHistoryGranularity, orgID *string, includeV1Metrics *bool, metrics []string) (ConsumptionHistoryPerAccountResponse, error)

GetConsumptionHistoryPerAccount Retrieves consumption metrics for Scale, Business, and Enterprise plan accounts. History begins at the time of upgrade. metrics argument defined a list of metrics to include in the response. If omitted, active_time, compute_time, written_data, synthetic_storage_size are returned. Possible values: - `active_time_seconds` - `compute_time_seconds` - `written_data_bytes` - `synthetic_storage_size_bytes` - `data_storage_bytes_hour`

func (Client) GetConsumptionHistoryPerProject added in v0.5.0

func (c Client) GetConsumptionHistoryPerProject(cursor *string, limit *int, projectIDs []string, from time.Time, to time.Time, granularity ConsumptionHistoryGranularity, orgID *string, includeV1Metrics *bool, metrics []string) (GetConsumptionHistoryPerProjectRespObj, error)

GetConsumptionHistoryPerProject Retrieves consumption metrics for Scale, Business, and Enterprise plan projects. History begins at the time of upgrade. Issuing a call to this API does not wake a project's compute endpoint. metrics argument defined a list of metrics to include in the response. If omitted, active_time, compute_time, written_data, synthetic_storage_size are returned. Possible values: - `active_time_seconds` - `compute_time_seconds` - `written_data_bytes` - `synthetic_storage_size_bytes` - `data_storage_bytes_hour`

func (Client) GetCurrentUserInfo added in v0.2.3

func (c Client) GetCurrentUserInfo() (CurrentUserInfoResponse, error)

GetCurrentUserInfo Retrieves information about the current Neon user account.

func (Client) GetCurrentUserOrganizations added in v0.5.0

func (c Client) GetCurrentUserOrganizations() (OrganizationsResponse, error)

GetCurrentUserOrganizations Retrieves information about the current Neon user's organizations

func (Client) GetNeonAuthEmailServer added in v0.14.0

func (c Client) GetNeonAuthEmailServer(projectID string) (NeonAuthEmailServerConfig, error)

GetNeonAuthEmailServer Gets the email server configuration for the specified project.

func (Client) GetOrganization added in v0.9.0

func (c Client) GetOrganization(orgID string) (Organization, error)

GetOrganization Retrieves information about the specified organization.

func (Client) GetOrganizationInvitations added in v0.9.0

func (c Client) GetOrganizationInvitations(orgID string) (OrganizationInvitationsResponse, error)

GetOrganizationInvitations Retrieves information about extended invitations for the specified organization

func (Client) GetOrganizationMember added in v0.9.0

func (c Client) GetOrganizationMember(orgID string, memberID string) (Member, error)

GetOrganizationMember Retrieves information about the specified organization member.

func (Client) GetOrganizationMembers added in v0.9.0

func (c Client) GetOrganizationMembers(orgID string) (OrganizationMembersResponse, error)

GetOrganizationMembers Retrieves information about the specified organization members.

func (Client) GetOrganizationVPCEndpointDetails added in v0.12.0

func (c Client) GetOrganizationVPCEndpointDetails(orgID string, regionID string, vpcEndpointID string) (VPCEndpointDetails, error)

GetOrganizationVPCEndpointDetails Retrieves the current state and configuration details of a specified VPC endpoint.

func (Client) GetProject

func (c Client) GetProject(projectID string) (ProjectResponse, error)

GetProject Retrieves information about the specified project. You can obtain a `project_id` by listing the projects for an organization.

func (Client) GetProjectBranch

func (c Client) GetProjectBranch(projectID string, branchID string) (GetProjectBranchRespObj, error)

GetProjectBranch Retrieves information about the specified branch. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain a `branch_id` by listing the project's branches. A `branch_id` value has a `br-` prefix. Each Neon project is initially created with a root and default branch named `main`. A project can contain one or more branches. A parent branch is identified by a `parent_id` value, which is the `id` of the parent branch. For related information, see [Manage branches](https://neon.tech/docs/manage/branches/).

func (Client) GetProjectBranchDataAPI added in v0.14.0

func (c Client) GetProjectBranchDataAPI(projectID string, branchID string, databaseName string) (DataAPIReponse, error)

GetProjectBranchDataAPI Retrieves the Neon Data API for the specified branch.

func (Client) GetProjectBranchDatabase

func (c Client) GetProjectBranchDatabase(projectID string, branchID string, databaseName string) (DatabaseResponse, error)

GetProjectBranchDatabase Retrieves information about the specified database. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain the `branch_id` and `database_name` by listing the branch's databases. For related information, see [Manage databases](https://neon.tech/docs/manage/databases/).

func (Client) GetProjectBranchRole

func (c Client) GetProjectBranchRole(projectID string, branchID string, roleName string) (RoleResponse, error)

GetProjectBranchRole Retrieves details about the specified role. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain the `branch_id` by listing the project's branches. You can obtain the `role_name` by listing the roles for a branch. In Neon, the terms "role" and "user" are synonymous. For related information, see [Manage roles](https://neon.tech/docs/manage/roles/).

func (Client) GetProjectBranchRolePassword added in v0.2.0

func (c Client) GetProjectBranchRolePassword(projectID string, branchID string, roleName string) (RolePasswordResponse, error)

GetProjectBranchRolePassword Retrieves the password for the specified Postgres role, if possible. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain the `branch_id` by listing the project's branches. You can obtain the `role_name` by listing the roles for a branch. For related information, see [Manage roles](https://neon.tech/docs/manage/roles/).

func (Client) GetProjectBranchSchema added in v0.5.0

func (c Client) GetProjectBranchSchema(projectID string, branchID string, dbName string, lsn *string, timestamp *time.Time, format *string) (BranchSchemaResponse, error)

GetProjectBranchSchema Retrieves the schema from the specified database. The `lsn` and `timestamp` values cannot be specified at the same time. If both are omitted, the database schema is retrieved from database's head.

func (Client) GetProjectBranchSchemaComparison added in v0.12.0

func (c Client) GetProjectBranchSchemaComparison(projectID string, branchID string, baseBranchID *string, dbName string, lsn *string, timestamp *time.Time, baseLsn *string, baseTimestamp *time.Time) (BranchSchemaCompareResponse, error)

GetProjectBranchSchemaComparison Compares the schema from the specified database with another branch's schema.

func (Client) GetProjectEndpoint

func (c Client) GetProjectEndpoint(projectID string, endpointID string) (EndpointResponse, error)

GetProjectEndpoint Retrieves information about the specified compute endpoint. A compute endpoint is a Neon compute instance. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain an `endpoint_id` by listing your project's compute endpoints. An `endpoint_id` has an `ep-` prefix. For information about compute endpoints, see [Manage computes](https://neon.tech/docs/manage/endpoints/).

func (Client) GetProjectJWKS added in v0.9.0

func (c Client) GetProjectJWKS(projectID string) (ProjectJWKSResponse, error)

GetProjectJWKS Returns the JWKS URLs available for verifying JWTs used as the authentication mechanism for the specified project.

func (Client) GetProjectOperation

func (c Client) GetProjectOperation(projectID string, operationID string) (OperationResponse, error)

GetProjectOperation Retrieves details for the specified operation. An operation is an action performed on a Neon project resource. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain a `operation_id` by listing operations for the project.

func (Client) GrantPermissionToProject added in v0.4.3

func (c Client) GrantPermissionToProject(projectID string, cfg GrantPermissionToProjectRequest) (ProjectPermission, error)

GrantPermissionToProject Grants project access to the account associated with the specified email address

func (Client) ListApiKeys

func (c Client) ListApiKeys() ([]ApiKeysListResponseItem, error)

ListApiKeys Retrieves the API keys for your Neon account. The response does not include API key tokens. A token is only provided when creating an API key. API keys can also be managed in the Neon Console. For more information, see [Manage API keys](https://neon.tech/docs/manage/api-keys/).

func (Client) ListNeonAuthIntegrations added in v0.14.0

func (c Client) ListNeonAuthIntegrations(projectID string) (ListNeonAuthIntegrationsResponse, error)

func (Client) ListNeonAuthOauthProviders added in v0.14.0

func (c Client) ListNeonAuthOauthProviders(projectID string) (ListNeonAuthOauthProvidersResponse, error)

ListNeonAuthOauthProviders Lists the OAuth providers for the specified project.

func (Client) ListNeonAuthRedirectURIWhitelistDomains added in v0.14.0

func (c Client) ListNeonAuthRedirectURIWhitelistDomains(projectID string) (NeonAuthRedirectURIWhitelistResponse, error)

ListNeonAuthRedirectURIWhitelistDomains Lists the domains in the redirect_uri whitelist for the specified project.

func (Client) ListOrgApiKeys added in v0.12.0

func (c Client) ListOrgApiKeys(orgID string) ([]OrgApiKeysListResponseItem, error)

ListOrgApiKeys Retrieves the API keys for the specified organization. The response does not include API key tokens. A token is only provided when creating an API key. API keys can also be managed in the Neon Console. For more information, see [Manage API keys](https://neon.tech/docs/manage/api-keys/).

func (Client) ListOrganizationVPCEndpoints added in v0.12.0

func (c Client) ListOrganizationVPCEndpoints(orgID string, regionID string) (VPCEndpointsResponse, error)

ListOrganizationVPCEndpoints Retrieves the list of VPC endpoints for the specified Neon organization.

func (Client) ListOrganizationVPCEndpointsAllRegions added in v0.14.0

func (c Client) ListOrganizationVPCEndpointsAllRegions(orgID string) (VPCEndpointsWithRegionResponse, error)

ListOrganizationVPCEndpointsAllRegions Retrieves the list of VPC endpoints for the specified Neon organization across all regions.

func (Client) ListProjectBranchDatabases

func (c Client) ListProjectBranchDatabases(projectID string, branchID string) (DatabasesResponse, error)

ListProjectBranchDatabases Retrieves a list of databases for the specified branch. A branch can have multiple databases. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain the `branch_id` by listing the project's branches. For related information, see [Manage databases](https://neon.tech/docs/manage/databases/).

func (Client) ListProjectBranchEndpoints

func (c Client) ListProjectBranchEndpoints(projectID string, branchID string) (EndpointsResponse, error)

ListProjectBranchEndpoints Retrieves a list of compute endpoints for the specified branch. Neon permits only one read-write compute endpoint per branch. A branch can have multiple read-only compute endpoints. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain the `branch_id` by listing the project's branches.

func (Client) ListProjectBranchRoles

func (c Client) ListProjectBranchRoles(projectID string, branchID string) (RolesResponse, error)

ListProjectBranchRoles Retrieves a list of Postgres roles from the specified branch. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain the `branch_id` by listing the project's branches. For related information, see [Manage roles](https://neon.tech/docs/manage/roles/).

func (Client) ListProjectBranches

func (c Client) ListProjectBranches(projectID string, search *string, sortBy *string, cursor *string, sortOrder *string, limit *int) (ListProjectBranchesRespObj, error)

ListProjectBranches Retrieves a list of branches for the specified project. You can obtain a `project_id` by listing the projects for your Neon account. Each Neon project has a root branch named `main`. A `branch_id` value has a `br-` prefix. A project may contain child branches that were branched from `main` or from another branch. A parent branch is identified by the `parent_id` value, which is the `id` of the parent branch. For related information, see [Manage branches](https://neon.tech/docs/manage/branches/).

func (Client) ListProjectEndpoints

func (c Client) ListProjectEndpoints(projectID string) (EndpointsResponse, error)

ListProjectEndpoints Retrieves a list of compute endpoints for the specified project. A compute endpoint is a Neon compute instance. You can obtain a `project_id` by listing the projects for your Neon account. For information about compute endpoints, see [Manage computes](https://neon.tech/docs/manage/endpoints/).

func (Client) ListProjectOperations

func (c Client) ListProjectOperations(projectID string, cursor *string, limit *int) (ListOperations, error)

ListProjectOperations Retrieves a list of operations for the specified Neon project. You can obtain a `project_id` by listing the projects for your Neon account. The number of operations returned can be large. To paginate the response, issue an initial request with a `limit` value. Then, add the `cursor` value that was returned in the response to the next request. Operations older than 6 months may be deleted from our systems. If you need more history than that, you should store your own history.

func (Client) ListProjectPermissions added in v0.4.3

func (c Client) ListProjectPermissions(projectID string) (ProjectPermissions, error)

ListProjectPermissions Retrieves details about users who have access to the project, including the permission `id`, the granted-to email address, and the date project access was granted.

func (Client) ListProjectVPCEndpoints added in v0.12.0

func (c Client) ListProjectVPCEndpoints(projectID string) (VPCEndpointsResponse, error)

ListProjectVPCEndpoints Lists VPC endpoint restrictions for the specified Neon project.

func (Client) ListProjects

func (c Client) ListProjects(cursor *string, limit *int, search *string, orgID *string, timeout *int) (ListProjectsRespObj, error)

ListProjects Retrieves a list of projects for an organization. You may need to specify an org_id parameter depending on your API key type. For more information, see [Manage projects](https://neon.tech/docs/manage/projects/).

func (Client) ListSharedProjects added in v0.4.2

func (c Client) ListSharedProjects(cursor *string, limit *int, search *string, timeout *int) (ListSharedProjectsRespObj, error)

ListSharedProjects Retrieves a list of projects shared with your Neon account. For more information, see [Manage projects](https://neon.tech/docs/manage/projects/).

func (Client) ListSnapshots added in v0.14.0

func (c Client) ListSnapshots(projectID string) (ListSnapshotsRespObj, error)

ListSnapshots List the snapshots for the specified project. **Note**: This endpoint is currently in Beta.

func (Client) RefreshSchemaCacheDataAPI added in v0.14.0

func (c Client) RefreshSchemaCacheDataAPI(projectID string, branchID string, databaseName string) (EmptyResponse, error)

RefreshSchemaCacheDataAPI Refreshes the schema cache for the Neon Data API in the specified branch. You can obtain the `project_id` and `branch_id` by listing the projects and branches for your Neon account.

func (Client) RemoveOrganizationMember added in v0.10.0

func (c Client) RemoveOrganizationMember(orgID string, memberID string) (EmptyResponse, error)

RemoveOrganizationMember Remove member from the organization. Only an admin of the organization can perform this action. If another admin is being removed, it will not be allows in case it is the only admin left in the organization.

func (Client) ResetProjectBranchRolePassword

func (c Client) ResetProjectBranchRolePassword(projectID string, branchID string, roleName string) (RoleOperations, error)

ResetProjectBranchRolePassword Resets the password for the specified Postgres role. Returns a new password and operations. The new password is ready to use when the last operation finishes. The old password remains valid until last operation finishes. Connections to the compute endpoint are dropped. If idle, the compute endpoint becomes active for a short period of time. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain the `branch_id` by listing the project's branches. You can obtain the `role_name` by listing the roles for a branch. For related information, see [Manage roles](https://neon.tech/docs/manage/roles/).

func (Client) RestartProjectEndpoint added in v0.4.9

func (c Client) RestartProjectEndpoint(projectID string, endpointID string) (EndpointOperations, error)

RestartProjectEndpoint Restart the specified compute endpoint: suspend immediately followed by start operations. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain an `endpoint_id` by listing your project's compute endpoints. An `endpoint_id` has an `ep-` prefix. For information about compute endpoints, see [Manage computes](https://neon.tech/docs/manage/endpoints/).

func (Client) RestoreProjectBranch added in v0.4.7

func (c Client) RestoreProjectBranch(projectID string, branchID string, cfg BranchRestoreRequest) (BranchOperations, error)

RestoreProjectBranch Restores a branch to an earlier state in its own or another branch's history

func (Client) RestoreSnapshot added in v0.14.0

func (c Client) RestoreSnapshot(projectID string, snapshotID string, name *string, cfg *RestoreSnapshotReqObj) (RestoredSnapshot, error)

RestoreSnapshot Restore the specified snapshot to a new branch and optionally finalize the restore operation. **Note**: This endpoint is currently in Beta.

func (Client) RevokeApiKey

func (c Client) RevokeApiKey(keyID int64) (ApiKeyRevokeResponse, error)

RevokeApiKey Revokes the specified API key. An API key that is no longer needed can be revoked. This action cannot be reversed. You can obtain `key_id` values by listing the API keys for your Neon account. API keys can also be managed in the Neon Console. See [Manage API keys](https://neon.tech/docs/manage/api-keys/).

func (Client) RevokeOrgApiKey added in v0.12.0

func (c Client) RevokeOrgApiKey(orgID string, keyID int64) (OrgApiKeyRevokeResponse, error)

RevokeOrgApiKey Revokes the specified organization API key. An API key that is no longer needed can be revoked. This action cannot be reversed. You can obtain `key_id` values by listing the API keys for an organization. API keys can also be managed in the Neon Console. See [Manage API keys](https://neon.tech/docs/manage/api-keys/).

func (Client) RevokePermissionFromProject added in v0.4.3

func (c Client) RevokePermissionFromProject(projectID string, permissionID string) (ProjectPermission, error)

RevokePermissionFromProject Revokes project access from the user associated with the specified permission `id`. You can retrieve a user's permission `id` by listing project access.

func (Client) SetDefaultProjectBranch added in v0.5.0

func (c Client) SetDefaultProjectBranch(projectID string, branchID string) (BranchOperations, error)

SetDefaultProjectBranch Sets the specified branch as the project's default branch. The default designation is automatically removed from the previous default branch. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain the `branch_id` by listing the project's branches. For more information, see [Manage branches](https://neon.tech/docs/manage/branches/).

func (Client) StartProjectEndpoint

func (c Client) StartProjectEndpoint(projectID string, endpointID string) (EndpointOperations, error)

StartProjectEndpoint Starts a compute endpoint. The compute endpoint is ready to use after the last operation in chain finishes successfully. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain an `endpoint_id` by listing your project's compute endpoints. An `endpoint_id` has an `ep-` prefix. For information about compute endpoints, see [Manage computes](https://neon.tech/docs/manage/endpoints/).

func (Client) SuspendProjectEndpoint

func (c Client) SuspendProjectEndpoint(projectID string, endpointID string) (EndpointOperations, error)

SuspendProjectEndpoint Suspend the specified compute endpoint You can obtain a `project_id` by listing the projects for your Neon account. You can obtain an `endpoint_id` by listing your project's compute endpoints. An `endpoint_id` has an `ep-` prefix. For information about compute endpoints, see [Manage computes](https://neon.tech/docs/manage/endpoints/).

func (Client) TransferNeonAuthProviderProject added in v0.14.0

TransferNeonAuthProviderProject Transfer ownership of your Neon-managed auth project to your own auth provider account.

func (Client) TransferProjectsFromOrgToOrg added in v0.12.0

func (c Client) TransferProjectsFromOrgToOrg(sourceOrgID string, cfg TransferProjectsToOrganizationRequest) (EmptyResponse, error)

TransferProjectsFromOrgToOrg Transfers selected projects, identified by their IDs, from your organization to another specified organization.

func (Client) TransferProjectsFromUserToOrg added in v0.6.0

func (c Client) TransferProjectsFromUserToOrg(cfg TransferProjectsToOrganizationRequest) (EmptyResponse, error)

TransferProjectsFromUserToOrg Transfers selected projects, identified by their IDs, from your personal account to a specified organization.

func (Client) UpdateNeonAuthEmailServer added in v0.14.0

func (c Client) UpdateNeonAuthEmailServer(projectID string, cfg NeonAuthEmailServerConfig) (NeonAuthEmailServerConfig, error)

UpdateNeonAuthEmailServer Updates the email server configuration for the specified project.

func (Client) UpdateNeonAuthOauthProvider added in v0.14.0

func (c Client) UpdateNeonAuthOauthProvider(projectID string, oauthProviderID NeonAuthOauthProviderId, cfg NeonAuthUpdateOAuthProviderRequest) (NeonAuthOauthProvider, error)

UpdateNeonAuthOauthProvider Updates a OAuth provider for the specified project.

func (Client) UpdateOrganizationMember added in v0.10.0

func (c Client) UpdateOrganizationMember(orgID string, memberID string, cfg OrganizationMemberUpdateRequest) (Member, error)

UpdateOrganizationMember Only an admin can perform this action.

func (Client) UpdateProject

func (c Client) UpdateProject(projectID string, cfg ProjectUpdateRequest) (UpdateProjectRespObj, error)

UpdateProject Updates the specified project. You can obtain a `project_id` by listing the projects for your Neon account.

func (Client) UpdateProjectBranch

func (c Client) UpdateProjectBranch(projectID string, branchID string, cfg BranchUpdateRequest) (BranchOperations, error)

UpdateProjectBranch Updates the specified branch. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain the `branch_id` by listing the project's branches. For more information, see [Manage branches](https://neon.tech/docs/manage/branches/).

func (Client) UpdateProjectBranchDatabase

func (c Client) UpdateProjectBranchDatabase(projectID string, branchID string, databaseName string, cfg DatabaseUpdateRequest) (DatabaseOperations, error)

UpdateProjectBranchDatabase Updates the specified database in the branch. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain the `branch_id` and `database_name` by listing the branch's databases. For related information, see [Manage databases](https://neon.tech/docs/manage/databases/).

func (Client) UpdateProjectEndpoint

func (c Client) UpdateProjectEndpoint(projectID string, endpointID string, cfg EndpointUpdateRequest) (EndpointOperations, error)

UpdateProjectEndpoint Updates the specified compute endpoint. You can obtain a `project_id` by listing the projects for your Neon account. You can obtain an `endpoint_id` and `branch_id` by listing your project's compute endpoints. An `endpoint_id` has an `ep-` prefix. A `branch_id` has a `br-` prefix. For more information about compute endpoints, see [Manage computes](https://neon.tech/docs/manage/endpoints/). If the returned list of operations is not empty, the compute endpoint is not ready to use. The client must wait for the last operation to finish before using the compute endpoint. If the compute endpoint was idle before the update, it becomes active for a short period of time, and the control plane suspends it again after the update.

func (Client) UpdateSnapshot added in v0.14.0

func (c Client) UpdateSnapshot(projectID string, snapshotID string, cfg SnapshotUpdateRequest) (UpdateSnapshotRespObj, error)

UpdateSnapshot Update the specified snapshot. **Note**: This endpoint is currently in Beta.

type ComputeUnit added in v0.2.0

type ComputeUnit float64

type Config added in v0.3.0

type Config struct {
	// Key defines the access API key.
	Key string

	// HTTPClient HTTP client to communicate with the API.
	HTTPClient HTTPClient
}

Config defines the client's configuration.

type ConnectionDetails added in v0.2.0

type ConnectionDetails struct {
	ConnectionParameters ConnectionParameters `json:"connection_parameters"`
	// ConnectionURI The connection URI is defined as specified here: [Connection URIs](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING-URIS)
	// The connection URI can be used to connect to a Postgres database with psql or defined in a DATABASE_URL environment variable.
	// When creating a branch from a parent with more than one role or database, the response body does not include a connection URI.
	ConnectionURI string `json:"connection_uri"`
}

type ConnectionParameters added in v0.2.0

type ConnectionParameters struct {
	// Database name
	Database string `json:"database"`
	// Host Hostname
	Host string `json:"host"`
	// Password for the role
	Password string `json:"password"`
	// PoolerHost Pooler hostname
	PoolerHost string `json:"pooler_host"`
	// Role name
	Role string `json:"role"`
}

type ConnectionURIResponse added in v0.4.8

type ConnectionURIResponse struct {
	// URI The connection URI.
	URI string `json:"uri"`
}

type ConnectionURIsOptionalResponse added in v0.2.0

type ConnectionURIsOptionalResponse struct {
	ConnectionURIs *[]ConnectionDetails `json:"connection_uris,omitempty"`
}

type ConnectionURIsResponse

type ConnectionURIsResponse struct {
	ConnectionURIs []ConnectionDetails `json:"connection_uris"`
}

type ConsumptionHistoryGranularity added in v0.5.0

type ConsumptionHistoryGranularity string
const (
	ConsumptionHistoryGranularityDaily   ConsumptionHistoryGranularity = "daily"
	ConsumptionHistoryGranularityHourly  ConsumptionHistoryGranularity = "hourly"
	ConsumptionHistoryGranularityMonthly ConsumptionHistoryGranularity = "monthly"
)

type ConsumptionHistoryPerAccountResponse added in v0.5.0

type ConsumptionHistoryPerAccountResponse struct {
	Periods []ConsumptionHistoryPerPeriod `json:"periods"`
}

type ConsumptionHistoryPerPeriod added in v0.5.0

type ConsumptionHistoryPerPeriod struct {
	Consumption []ConsumptionHistoryPerTimeframe `json:"consumption"`
	// PeriodEnd The end date-time of the billing period, available for the past periods only.
	PeriodEnd *time.Time `json:"period_end,omitempty"`
	// PeriodID The ID assigned to the specified billing period.
	PeriodID string `json:"period_id"`
	// PeriodPlan The billing plan applicable during the billing period.
	PeriodPlan string `json:"period_plan"`
	// PeriodStart The start date-time of the billing period.
	PeriodStart time.Time `json:"period_start"`
}

type ConsumptionHistoryPerProject added in v0.5.0

type ConsumptionHistoryPerProject struct {
	Periods []ConsumptionHistoryPerPeriod `json:"periods"`
	// ProjectID The project ID
	ProjectID string `json:"project_id"`
}

type ConsumptionHistoryPerProjectResponse added in v0.5.0

type ConsumptionHistoryPerProjectResponse struct {
	Projects []ConsumptionHistoryPerProject `json:"projects"`
}

type ConsumptionHistoryPerTimeframe added in v0.5.0

type ConsumptionHistoryPerTimeframe struct {
	// ActiveTimeSeconds Seconds. The amount of time the compute endpoints have been active.
	ActiveTimeSeconds int `json:"active_time_seconds"`
	// ComputeTimeSeconds Seconds. The number of CPU seconds used by compute endpoints, including compute endpoints that have been deleted.
	ComputeTimeSeconds int `json:"compute_time_seconds"`
	// DataStorageBytesHour Bytes-Hour. The amount of storage consumed hourly.
	DataStorageBytesHour *int `json:"data_storage_bytes_hour,omitempty"`
	// LogicalSizeBytes Bytes. The amount of logical size consumed.
	LogicalSizeBytes *int `json:"logical_size_bytes,omitempty"`
	// LogicalSizeBytesHour Bytes-Hour. The amount of logical size consumed hourly.
	LogicalSizeBytesHour *int `json:"logical_size_bytes_hour,omitempty"`
	// SyntheticStorageSizeBytes Bytes. The space occupied in storage. Synthetic storage size combines the logical data size and Write-Ahead Log (WAL) size for all branches.
	SyntheticStorageSizeBytes int `json:"synthetic_storage_size_bytes"`
	// TimeframeEnd The specified end date-time for the reported consumption.
	TimeframeEnd time.Time `json:"timeframe_end"`
	// TimeframeStart The specified start date-time for the reported consumption.
	TimeframeStart time.Time `json:"timeframe_start"`
	// WrittenDataBytes Bytes. The amount of written data for all branches.
	WrittenDataBytes int `json:"written_data_bytes"`
}

type CountProjectBranchesRespObj added in v0.12.0

type CountProjectBranchesRespObj struct {
	BranchesCountResponse
}

type CreateProjectBranchReqObj added in v0.6.0

type CreateProjectBranchReqObj struct {
	AnnotationCreateValueRequest
	BranchCreateRequest
}

type CreateProjectTransferRequestReqObj added in v0.14.0

type CreateProjectTransferRequestReqObj struct {
	TtlSeconds *int64 `json:"ttl_seconds,omitempty"`
}

type CreateSnapshotRespObj added in v0.14.0

type CreateSnapshotRespObj struct {
	Operations []Operation `json:"operations"`
	Snapshot   Snapshot    `json:"snapshot"`
}

type CurrentUserAuthAccount added in v0.2.3

type CurrentUserAuthAccount struct {
	Email string `json:"email"`
	Image string `json:"image"`
	// Login DEPRECATED. Use `email` field.
	Login    string             `json:"login"`
	Name     string             `json:"name"`
	Provider IdentityProviderId `json:"provider"`
}

type CurrentUserInfoResponse added in v0.2.3

type CurrentUserInfoResponse struct {
	// ActiveSecondsLimit Control plane observes active endpoints of a user this amount of wall-clock time.
	ActiveSecondsLimit  int64                    `json:"active_seconds_limit"`
	AuthAccounts        []CurrentUserAuthAccount `json:"auth_accounts"`
	BillingAccount      *BillingAccount          `json:"billing_account,omitempty"`
	BranchesLimit       int64                    `json:"branches_limit"`
	ComputeSecondsLimit *int64                   `json:"compute_seconds_limit,omitempty"`
	Email               string                   `json:"email"`
	ID                  string                   `json:"id"`
	Image               string                   `json:"image"`
	LastName            string                   `json:"last_name"`
	// Login DEPRECATED. Use `email` field.
	Login               string      `json:"login"`
	MaxAutoscalingLimit ComputeUnit `json:"max_autoscaling_limit"`
	Name                string      `json:"name"`
	Plan                string      `json:"plan"`
	ProjectsLimit       int64       `json:"projects_limit"`
}

type CursorPagination added in v0.12.0

type CursorPagination struct {
	Next      *string `json:"next,omitempty"`
	SortBy    *string `json:"sort_by,omitempty"`
	SortOrder *string `json:"sort_order,omitempty"`
}

CursorPagination To paginate the response, issue an initial request with `limit` value. Then, add the value returned in the response `.pagination.next` attribute into the request under the `cursor` query parameter to the subsequent request to retrieve next page in pagination. The contents on cursor `next` are opaque, clients are not expected to make any assumptions on the format of the data inside the cursor.

type CursorPaginationResponse added in v0.12.0

type CursorPaginationResponse struct {
	Pagination *CursorPagination `json:"pagination,omitempty"`
}

type DataAPICreateRequest added in v0.14.0

type DataAPICreateRequest struct {
	// AddDefaultGrants Grant all permissions to the tables in the public schema to authenticated users
	AddDefaultGrants *bool `json:"add_default_grants,omitempty"`
	// AuthProvider The authentication provider to use for the Neon Data API
	AuthProvider *string `json:"auth_provider,omitempty"`
	// JwksURL The URL that lists the JWKS
	JwksURL *string `json:"jwks_url,omitempty"`
	// JwtAudience WARNING - using this setting will only reject tokens with a
	// different audience claim. Tokens without audience claim will still
	// be accepted.
	JwtAudience *string `json:"jwt_audience,omitempty"`
	// ProviderName The name of the authentication provider (e.g., Clerk, Stytch, Auth0)
	ProviderName *string `json:"provider_name,omitempty"`
}

DataAPICreateRequest Create Neon Data API

type DataAPICreateResponse added in v0.14.0

type DataAPICreateResponse struct {
	URL string `json:"url"`
}

DataAPICreateResponse Neon Data API created successfully

type DataAPIReponse added in v0.14.0

type DataAPIReponse struct {
	// Status The status of the Neon Data API deployment
	Status string `json:"status"`
	// URL The URL of the Neon Data API
	URL string `json:"url"`
}

DataAPIReponse Neon Data API response

type Database

type Database struct {
	// BranchID The ID of the branch to which the database belongs
	BranchID string `json:"branch_id"`
	// CreatedAt A timestamp indicating when the database was created
	CreatedAt time.Time `json:"created_at"`
	// ID The database ID
	ID int64 `json:"id"`
	// Name The database name
	Name string `json:"name"`
	// OwnerName The name of role that owns the database
	OwnerName string `json:"owner_name"`
	// UpdatedAt A timestamp indicating when the database was last updated
	UpdatedAt time.Time `json:"updated_at"`
}

type DatabaseCreateRequest

type DatabaseCreateRequest struct {
	Database DatabaseCreateRequestDatabase `json:"database"`
}

type DatabaseCreateRequestDatabase

type DatabaseCreateRequestDatabase struct {
	// Name The name of the database
	Name string `json:"name"`
	// OwnerName The name of the role that owns the database
	OwnerName string `json:"owner_name"`
}

type DatabaseOperations

type DatabaseOperations struct {
	DatabaseResponse
	OperationsResponse
}

type DatabaseResponse

type DatabaseResponse struct {
	Database Database `json:"database"`
}

type DatabaseUpdateRequest

type DatabaseUpdateRequest struct {
	Database DatabaseUpdateRequestDatabase `json:"database"`
}

type DatabaseUpdateRequestDatabase

type DatabaseUpdateRequestDatabase struct {
	// Name The name of the database
	Name *string `json:"name,omitempty"`
	// OwnerName The name of the role that owns the database
	OwnerName *string `json:"owner_name,omitempty"`
}

type DatabasesResponse

type DatabasesResponse struct {
	Databases []Database `json:"databases"`
}

type DefaultEndpointSettings added in v0.2.0

type DefaultEndpointSettings struct {
	AutoscalingLimitMaxCu *ComputeUnit           `json:"autoscaling_limit_max_cu,omitempty"`
	AutoscalingLimitMinCu *ComputeUnit           `json:"autoscaling_limit_min_cu,omitempty"`
	PgSettings            map[string]any         `json:"pg_settings,omitempty"`
	PgbouncerSettings     *PgbouncerSettingsData `json:"pgbouncer_settings,omitempty"`
	SuspendTimeoutSeconds *SuspendTimeoutSeconds `json:"suspend_timeout_seconds,omitempty"`
}

DefaultEndpointSettings A collection of settings for a Neon endpoint

type DeleteNeonAuthIntegrationReqObj added in v0.14.0

type DeleteNeonAuthIntegrationReqObj struct {
	DeleteData *bool `json:"delete_data,omitempty"`
}

type EmptyResponse added in v0.6.0

type EmptyResponse struct{}

EmptyResponse Empty response.

type Endpoint

type Endpoint struct {
	AutoscalingLimitMaxCu ComputeUnit `json:"autoscaling_limit_max_cu"`
	AutoscalingLimitMinCu ComputeUnit `json:"autoscaling_limit_min_cu"`
	// BranchID The ID of the branch that the compute endpoint is associated with
	BranchID string `json:"branch_id"`
	// ComputeReleaseVersion Attached compute's release version number.
	ComputeReleaseVersion *string `json:"compute_release_version,omitempty"`
	// CreatedAt A timestamp indicating when the compute endpoint was created
	CreatedAt time.Time `json:"created_at"`
	// CreationSource The compute endpoint creation source
	CreationSource string        `json:"creation_source"`
	CurrentState   EndpointState `json:"current_state"`
	// Disabled Whether to restrict connections to the compute endpoint.
	// Enabling this option schedules a suspend compute operation.
	// A disabled compute endpoint cannot be enabled by a connection or
	// console action.
	Disabled bool `json:"disabled"`
	// Host The hostname of the compute endpoint. This is the hostname specified when connecting to a Neon database.
	Host string `json:"host"`
	// ID The compute endpoint ID. Compute endpoint IDs have an `ep-` prefix. For example: `ep-little-smoke-851426`
	ID string `json:"id"`
	// LastActive A timestamp indicating when the compute endpoint was last active
	LastActive *time.Time `json:"last_active,omitempty"`
	// Name Optional name of the compute endpoint
	Name *string `json:"name,omitempty"`
	// PasswordlessAccess Whether to permit passwordless access to the compute endpoint
	PasswordlessAccess bool           `json:"passwordless_access"`
	PendingState       *EndpointState `json:"pending_state,omitempty"`
	// PoolerEnabled Whether connection pooling is enabled for the compute endpoint
	PoolerEnabled bool               `json:"pooler_enabled"`
	PoolerMode    EndpointPoolerMode `json:"pooler_mode"`
	// ProjectID The ID of the project to which the compute endpoint belongs
	ProjectID   string      `json:"project_id"`
	Provisioner Provisioner `json:"provisioner"`
	// ProxyHost DEPRECATED. Use the "host" property instead.
	ProxyHost string `json:"proxy_host"`
	// RegionID The region identifier
	RegionID string               `json:"region_id"`
	Settings EndpointSettingsData `json:"settings"`
	// StartedAt A timestamp indicating when the compute endpoint was last started
	StartedAt             *time.Time            `json:"started_at,omitempty"`
	SuspendTimeoutSeconds SuspendTimeoutSeconds `json:"suspend_timeout_seconds"`
	// SuspendedAt A timestamp indicating when the compute endpoint was last suspended
	SuspendedAt *time.Time   `json:"suspended_at,omitempty"`
	Type        EndpointType `json:"type"`
	// UpdatedAt A timestamp indicating when the compute endpoint was last updated
	UpdatedAt time.Time `json:"updated_at"`
}

type EndpointCreateRequest

type EndpointCreateRequest struct {
	Endpoint EndpointCreateRequestEndpoint `json:"endpoint"`
}

type EndpointCreateRequestEndpoint

type EndpointCreateRequestEndpoint struct {
	AutoscalingLimitMaxCu *ComputeUnit `json:"autoscaling_limit_max_cu,omitempty"`
	AutoscalingLimitMinCu *ComputeUnit `json:"autoscaling_limit_min_cu,omitempty"`
	// BranchID The ID of the branch the compute endpoint will be associated with
	BranchID string `json:"branch_id"`
	// Disabled Whether to restrict connections to the compute endpoint.
	// Enabling this option schedules a suspend compute operation.
	// A disabled compute endpoint cannot be enabled by a connection or
	// console action. However, the compute endpoint is periodically
	// enabled by check_availability operations.
	Disabled *bool `json:"disabled,omitempty"`
	// Name Optional name of the compute endpoint
	Name *string `json:"name,omitempty"`
	// PasswordlessAccess NOT YET IMPLEMENTED. Whether to permit passwordless access to the compute endpoint.
	PasswordlessAccess *bool `json:"passwordless_access,omitempty"`
	// PoolerEnabled Whether to enable connection pooling for the compute endpoint
	PoolerEnabled *bool               `json:"pooler_enabled,omitempty"`
	PoolerMode    *EndpointPoolerMode `json:"pooler_mode,omitempty"`
	Provisioner   *Provisioner        `json:"provisioner,omitempty"`
	// RegionID The region where the compute endpoint will be created. Only the project's `region_id` is permitted.
	RegionID              *string                `json:"region_id,omitempty"`
	Settings              *EndpointSettingsData  `json:"settings,omitempty"`
	SuspendTimeoutSeconds *SuspendTimeoutSeconds `json:"suspend_timeout_seconds,omitempty"`
	Type                  EndpointType           `json:"type"`
}

type EndpointOperations

type EndpointOperations struct {
	EndpointResponse
	OperationsResponse
}

type EndpointPoolerMode

type EndpointPoolerMode string

EndpointPoolerMode The connection pooler mode. Neon supports PgBouncer in `transaction` mode only.

const (
	EndpointPoolerModeTransaction EndpointPoolerMode = "transaction"
)

type EndpointResponse

type EndpointResponse struct {
	Endpoint Endpoint `json:"endpoint"`
}

type EndpointSettingsData

type EndpointSettingsData struct {
	PgSettings        map[string]any         `json:"pg_settings,omitempty"`
	PgbouncerSettings *PgbouncerSettingsData `json:"pgbouncer_settings,omitempty"`
	PreloadLibraries  *PreloadLibraries      `json:"preload_libraries,omitempty"`
}

EndpointSettingsData A collection of settings for a compute endpoint

type EndpointState

type EndpointState string

EndpointState The state of the compute endpoint

const (
	EndpointStateActive EndpointState = "active"
	EndpointStateIdle   EndpointState = "idle"
	EndpointStateInit   EndpointState = "init"
)

type EndpointType

type EndpointType string

EndpointType The compute endpoint type. Either `read_write` or `read_only`.

const (
	EndpointTypeReadOnly  EndpointType = "read_only"
	EndpointTypeReadWrite EndpointType = "read_write"
)

type EndpointUpdateRequest

type EndpointUpdateRequest struct {
	Endpoint EndpointUpdateRequestEndpoint `json:"endpoint"`
}

type EndpointUpdateRequestEndpoint

type EndpointUpdateRequestEndpoint struct {
	AutoscalingLimitMaxCu *ComputeUnit `json:"autoscaling_limit_max_cu,omitempty"`
	AutoscalingLimitMinCu *ComputeUnit `json:"autoscaling_limit_min_cu,omitempty"`
	// BranchID DEPRECATED: This field will be removed in a future release.
	// The destination branch ID. The destination branch must not have an existing read-write endpoint.
	BranchID *string `json:"branch_id,omitempty"`
	// Disabled Whether to restrict connections to the compute endpoint.
	// Enabling this option schedules a suspend compute operation.
	// A disabled compute endpoint cannot be enabled by a connection or
	// console action. However, the compute endpoint is periodically
	// enabled by check_availability operations.
	Disabled *bool `json:"disabled,omitempty"`
	// Name Optional name of the compute endpoint
	Name *string `json:"name,omitempty"`
	// PasswordlessAccess NOT YET IMPLEMENTED. Whether to permit passwordless access to the compute endpoint.
	PasswordlessAccess *bool `json:"passwordless_access,omitempty"`
	// PoolerEnabled Whether to enable connection pooling for the compute endpoint
	PoolerEnabled         *bool                  `json:"pooler_enabled,omitempty"`
	PoolerMode            *EndpointPoolerMode    `json:"pooler_mode,omitempty"`
	Provisioner           *Provisioner           `json:"provisioner,omitempty"`
	Settings              *EndpointSettingsData  `json:"settings,omitempty"`
	SuspendTimeoutSeconds *SuspendTimeoutSeconds `json:"suspend_timeout_seconds,omitempty"`
}

type EndpointsOptionalResponse added in v0.14.0

type EndpointsOptionalResponse struct {
	Endpoints *[]Endpoint `json:"endpoints,omitempty"`
}

type EndpointsResponse

type EndpointsResponse struct {
	Endpoints []Endpoint `json:"endpoints"`
}

type Error

type Error struct {
	HTTPCode int
	// contains filtered or unexported fields
}

Error API error.

func (Error) Error

func (e Error) Error() string

type FinalizeRestoreBranchReqObj added in v0.14.0

type FinalizeRestoreBranchReqObj struct {
	Name *string `json:"name,omitempty"`
}

type GetConsumptionHistoryPerProjectRespObj added in v0.5.0

type GetConsumptionHistoryPerProjectRespObj struct {
	ConsumptionHistoryPerProjectResponse
	PaginationResponse
}

type GetProjectBranchRespObj added in v0.6.0

type GetProjectBranchRespObj struct {
	AnnotationResponse
	BranchResponse
}

type GrantPermissionToProjectRequest added in v0.4.3

type GrantPermissionToProjectRequest struct {
	Email string `json:"email"`
}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient client to handle http requests.

type IdentityProviderId added in v0.4.8

type IdentityProviderId string

IdentityProviderId Identity provider id from keycloak

const (
	IdentityProviderIdGithub      IdentityProviderId = "github"
	IdentityProviderIdGoogle      IdentityProviderId = "google"
	IdentityProviderIdHasura      IdentityProviderId = "hasura"
	IdentityProviderIdKeycloak    IdentityProviderId = "keycloak"
	IdentityProviderIdMicrosoft   IdentityProviderId = "microsoft"
	IdentityProviderIdMicrosoftv2 IdentityProviderId = "microsoftv2"
	IdentityProviderIdVercelmp    IdentityProviderId = "vercelmp"
)

type Invitation added in v0.9.0

type Invitation struct {
	// Email of the invited user
	Email string `json:"email"`
	ID    string `json:"id"`
	// InvitedAt Timestamp when the invitation was created
	InvitedAt time.Time `json:"invited_at"`
	// InvitedBy UUID for the user_id who extended the invitation
	InvitedBy string `json:"invited_by"`
	// OrgID Organization id as it is stored in Neon
	OrgID string     `json:"org_id"`
	Role  MemberRole `json:"role"`
}

type JWKS added in v0.9.0

type JWKS struct {
	// BranchID Branch ID
	BranchID *string `json:"branch_id,omitempty"`
	// CreatedAt The date and time when the JWKS was created
	CreatedAt time.Time `json:"created_at"`
	// ID JWKS ID
	ID string `json:"id"`
	// JwksURL The URL that lists the JWKS
	JwksURL string `json:"jwks_url"`
	// JwtAudience The name of the required JWT Audience to be used
	JwtAudience *string `json:"jwt_audience,omitempty"`
	// ProjectID Project ID
	ProjectID string `json:"project_id"`
	// ProviderName The name of the authentication provider (e.g., Clerk, Stytch, Auth0)
	ProviderName string    `json:"provider_name"`
	RoleNames    *[]string `json:"role_names,omitempty"`
	// UpdatedAt The date and time when the JWKS was last modified
	UpdatedAt time.Time `json:"updated_at"`
}

type JWKSCreationOperation added in v0.9.0

type JWKSCreationOperation struct {
	JWKSResponse
	OperationsResponse
}

type JWKSResponse added in v0.9.0

type JWKSResponse struct {
	Jwks JWKS `json:"jwks"`
}

type ListNeonAuthIntegrationsResponse added in v0.14.0

type ListNeonAuthIntegrationsResponse struct {
	Data []NeonAuthIntegration `json:"data"`
}

type ListNeonAuthOauthProvidersResponse added in v0.14.0

type ListNeonAuthOauthProvidersResponse struct {
	Providers []NeonAuthOauthProvider `json:"providers"`
}

type ListOperations

type ListOperations struct {
	OperationsResponse
	PaginationResponse
}

type ListProjectBranchesRespObj added in v0.6.0

type ListProjectBranchesRespObj struct {
	AnnotationsMapResponse
	BranchesResponse
	CursorPaginationResponse
}

type ListSharedProjectsRespObj added in v0.4.2

type ListSharedProjectsRespObj struct {
	PaginationResponse
	ProjectsResponse
}

type ListSnapshotsRespObj added in v0.14.0

type ListSnapshotsRespObj struct {
	Snapshots []Snapshot `json:"snapshots"`
}

type MaintenanceWindow added in v0.10.0

type MaintenanceWindow struct {
	// EndTime End time of the maintenance window, in the format of "HH:MM". Uses UTC.
	EndTime string `json:"end_time"`
	// StartTime Start time of the maintenance window, in the format of "HH:MM". Uses UTC.
	StartTime string `json:"start_time"`
	// Weekdays A list of weekdays when the maintenance window is active.
	// Encoded as ints, where 1 - Monday, and 7 - Sunday.
	Weekdays []int `json:"weekdays"`
}

MaintenanceWindow A maintenance window is a time period during which Neon may perform maintenance on the project's infrastructure. During this time, the project's compute endpoints may be unavailable and existing connections can be interrupted.

type Member added in v0.9.0

type Member struct {
	ID       string     `json:"id"`
	JoinedAt *time.Time `json:"joined_at,omitempty"`
	OrgID    string     `json:"org_id"`
	Role     MemberRole `json:"role"`
	UserID   string     `json:"user_id"`
}

type MemberRole added in v0.9.0

type MemberRole string

MemberRole The role of the organization member

const (
	MemberRoleAdmin  MemberRole = "admin"
	MemberRoleMember MemberRole = "member"
)

type MemberUserInfo added in v0.9.0

type MemberUserInfo struct {
	Email string `json:"email"`
}

type MemberWithUser added in v0.9.0

type MemberWithUser struct {
	Member Member         `json:"member"`
	User   MemberUserInfo `json:"user"`
}

type MockHTTPClient added in v0.12.0

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

MockHTTPClient defines http client to mock the SDK client.

func NewMockHTTPClient

func NewMockHTTPClient() MockHTTPClient

NewMockHTTPClient initiates a mock fo the HTTP client required for the SDK client. Mock client return the response as per API spec, except for the errors: 404 and 401 status codes are covered only. - 401 is returned when the string `invalidApiKey` is used as the API key; - 404 is returned if either of the following:

  • the string value `notFound` is used as the string argument, e.g. projectID
  • a negative int/float value is used as the int/float argument, e.g. database ID

func (MockHTTPClient) Do added in v0.12.0

func (m MockHTTPClient) Do(req *http.Request) (*http.Response, error)

type NeonAuthAddDomainToRedirectURIWhitelistRequest added in v0.14.0

type NeonAuthAddDomainToRedirectURIWhitelistRequest struct {
	AuthProvider NeonAuthSupportedAuthProvider `json:"auth_provider"`
	Domain       string                        `json:"domain"`
}

type NeonAuthAddOAuthProviderRequest added in v0.14.0

type NeonAuthAddOAuthProviderRequest struct {
	ClientID     *string                 `json:"client_id,omitempty"`
	ClientSecret *string                 `json:"client_secret,omitempty"`
	ID           NeonAuthOauthProviderId `json:"id"`
}

type NeonAuthCreateAuthProviderSDKKeysRequest added in v0.14.0

type NeonAuthCreateAuthProviderSDKKeysRequest struct {
	AuthProvider NeonAuthSupportedAuthProvider `json:"auth_provider"`
	ProjectID    string                        `json:"project_id"`
}

type NeonAuthCreateIntegrationRequest added in v0.14.0

type NeonAuthCreateIntegrationRequest struct {
	AuthProvider NeonAuthSupportedAuthProvider `json:"auth_provider"`
	BranchID     string                        `json:"branch_id"`
	DatabaseName *string                       `json:"database_name,omitempty"`
	ProjectID    string                        `json:"project_id"`
	RoleName     *string                       `json:"role_name,omitempty"`
}

type NeonAuthCreateIntegrationResponse added in v0.14.0

type NeonAuthCreateIntegrationResponse struct {
	AuthProvider          NeonAuthSupportedAuthProvider `json:"auth_provider"`
	AuthProviderProjectID string                        `json:"auth_provider_project_id"`
	BaseURL               *string                       `json:"base_url,omitempty"`
	JwksURL               string                        `json:"jwks_url"`
	PubClientKey          string                        `json:"pub_client_key"`
	SchemaName            string                        `json:"schema_name"`
	SecretServerKey       string                        `json:"secret_server_key"`
	TableName             string                        `json:"table_name"`
}

type NeonAuthCreateNewUserRequest added in v0.14.0

type NeonAuthCreateNewUserRequest struct {
	AuthProvider NeonAuthSupportedAuthProvider `json:"auth_provider"`
	Email        string                        `json:"email"`
	Name         *string                       `json:"name,omitempty"`
	Password     *string                       `json:"password,omitempty"`
	ProjectID    string                        `json:"project_id"`
}

type NeonAuthCreateNewUserResponse added in v0.14.0

type NeonAuthCreateNewUserResponse struct {
	// ID of newly created user
	ID string `json:"id"`
}

type NeonAuthDeleteDomainFromRedirectURIWhitelistItem added in v0.14.0

type NeonAuthDeleteDomainFromRedirectURIWhitelistItem struct {
	Domain string `json:"domain"`
}

type NeonAuthDeleteDomainFromRedirectURIWhitelistRequest added in v0.14.0

type NeonAuthDeleteDomainFromRedirectURIWhitelistRequest struct {
	AuthProvider NeonAuthSupportedAuthProvider                      `json:"auth_provider"`
	Domains      []NeonAuthDeleteDomainFromRedirectURIWhitelistItem `json:"domains"`
}

type NeonAuthEmailServerConfig added in v0.14.0

type NeonAuthEmailServerConfig struct{}

type NeonAuthIntegration added in v0.14.0

type NeonAuthIntegration struct {
	AuthProvider          NeonAuthSupportedAuthProvider          `json:"auth_provider"`
	AuthProviderProjectID string                                 `json:"auth_provider_project_id"`
	BaseURL               *string                                `json:"base_url,omitempty"`
	BranchID              string                                 `json:"branch_id"`
	CreatedAt             time.Time                              `json:"created_at"`
	DbName                string                                 `json:"db_name"`
	JwksURL               string                                 `json:"jwks_url"`
	OwnedBy               NeonAuthProviderProjectOwnedBy         `json:"owned_by"`
	TransferStatus        *NeonAuthProviderProjectTransferStatus `json:"transfer_status,omitempty"`
}

type NeonAuthOauthProvider added in v0.14.0

type NeonAuthOauthProvider struct {
	ClientID     *string                   `json:"client_id,omitempty"`
	ClientSecret *string                   `json:"client_secret,omitempty"`
	ID           NeonAuthOauthProviderId   `json:"id"`
	Type         NeonAuthOauthProviderType `json:"type"`
}

type NeonAuthOauthProviderId added in v0.14.0

type NeonAuthOauthProviderId string
const (
	NeonAuthOauthProviderIdGithub    NeonAuthOauthProviderId = "github"
	NeonAuthOauthProviderIdGoogle    NeonAuthOauthProviderId = "google"
	NeonAuthOauthProviderIdMicrosoft NeonAuthOauthProviderId = "microsoft"
)

type NeonAuthOauthProviderType added in v0.14.0

type NeonAuthOauthProviderType string
const (
	NeonAuthOauthProviderTypeShared   NeonAuthOauthProviderType = "shared"
	NeonAuthOauthProviderTypeStandard NeonAuthOauthProviderType = "standard"
)

type NeonAuthProviderProjectOwnedBy added in v0.14.0

type NeonAuthProviderProjectOwnedBy string
const (
	NeonAuthProviderProjectOwnedByNeon NeonAuthProviderProjectOwnedBy = "neon"
	NeonAuthProviderProjectOwnedByUser NeonAuthProviderProjectOwnedBy = "user"
)

type NeonAuthProviderProjectTransferStatus added in v0.14.0

type NeonAuthProviderProjectTransferStatus string
const (
	NeonAuthProviderProjectTransferStatusFinished  NeonAuthProviderProjectTransferStatus = "finished"
	NeonAuthProviderProjectTransferStatusInitiated NeonAuthProviderProjectTransferStatus = "initiated"
)

type NeonAuthRedirectURIWhitelistDomain added in v0.14.0

type NeonAuthRedirectURIWhitelistDomain struct {
	AuthProvider NeonAuthSupportedAuthProvider `json:"auth_provider"`
	Domain       string                        `json:"domain"`
}

type NeonAuthRedirectURIWhitelistResponse added in v0.14.0

type NeonAuthRedirectURIWhitelistResponse struct {
	Domains []NeonAuthRedirectURIWhitelistDomain `json:"domains"`
}

type NeonAuthSupportedAuthProvider added in v0.14.0

type NeonAuthSupportedAuthProvider string
const (
	NeonAuthSupportedAuthProviderBetterAuth NeonAuthSupportedAuthProvider = "better_auth"
	NeonAuthSupportedAuthProviderMock       NeonAuthSupportedAuthProvider = "mock"
	NeonAuthSupportedAuthProviderStack      NeonAuthSupportedAuthProvider = "stack"
	NeonAuthSupportedAuthProviderStackV2    NeonAuthSupportedAuthProvider = "stack_v2"
)

type NeonAuthTransferAuthProviderProjectRequest added in v0.14.0

type NeonAuthTransferAuthProviderProjectRequest struct {
	AuthProvider NeonAuthSupportedAuthProvider `json:"auth_provider"`
	ProjectID    string                        `json:"project_id"`
}

type NeonAuthTransferAuthProviderProjectResponse added in v0.14.0

type NeonAuthTransferAuthProviderProjectResponse struct {
	// URL for completing the process of ownership transfer
	URL string `json:"url"`
}

type NeonAuthUpdateOAuthProviderRequest added in v0.14.0

type NeonAuthUpdateOAuthProviderRequest struct {
	ClientID     *string `json:"client_id,omitempty"`
	ClientSecret *string `json:"client_secret,omitempty"`
}

type Operation

type Operation struct {
	Action OperationAction `json:"action"`
	// BranchID The branch ID
	BranchID *string `json:"branch_id,omitempty"`
	// CreatedAt A timestamp indicating when the operation was created
	CreatedAt time.Time `json:"created_at"`
	// EndpointID The endpoint ID
	EndpointID *string `json:"endpoint_id,omitempty"`
	// Error The error that occurred
	Error *string `json:"error,omitempty"`
	// FailuresCount The number of times the operation failed
	FailuresCount int32 `json:"failures_count"`
	// ID The operation ID
	ID string `json:"id"`
	// ProjectID The Neon project ID
	ProjectID string `json:"project_id"`
	// RetryAt A timestamp indicating when the operation was last retried
	RetryAt *time.Time      `json:"retry_at,omitempty"`
	Status  OperationStatus `json:"status"`
	// TotalDurationMs The total duration of the operation in milliseconds
	TotalDurationMs int32 `json:"total_duration_ms"`
	// UpdatedAt A timestamp indicating when the operation status was last updated
	UpdatedAt time.Time `json:"updated_at"`
}

type OperationAction

type OperationAction string

OperationAction The action performed by the operation

const (
	OperationActionApplyConfig                OperationAction = "apply_config"
	OperationActionApplySchemaFromBranch      OperationAction = "apply_schema_from_branch"
	OperationActionApplyStorageConfig         OperationAction = "apply_storage_config"
	OperationActionCheckAvailability          OperationAction = "check_availability"
	OperationActionCreateBranch               OperationAction = "create_branch"
	OperationActionCreateCompute              OperationAction = "create_compute"
	OperationActionCreateTimeline             OperationAction = "create_timeline"
	OperationActionDeleteTimeline             OperationAction = "delete_timeline"
	OperationActionDetachParentBranch         OperationAction = "detach_parent_branch"
	OperationActionDisableMaintenance         OperationAction = "disable_maintenance"
	OperationActionImportData                 OperationAction = "import_data"
	OperationActionPrepareSecondaryPageserver OperationAction = "prepare_secondary_pageserver"
	OperationActionPrewarmReplica             OperationAction = "prewarm_replica"
	OperationActionPromoteReplica             OperationAction = "promote_replica"
	OperationActionReplaceSafekeeper          OperationAction = "replace_safekeeper"
	OperationActionSetStorageNonDirty         OperationAction = "set_storage_non_dirty"
	OperationActionStartCompute               OperationAction = "start_compute"
	OperationActionStartReservedCompute       OperationAction = "start_reserved_compute"
	OperationActionSuspendCompute             OperationAction = "suspend_compute"
	OperationActionSwitchPageserver           OperationAction = "switch_pageserver"
	OperationActionSyncDbsAndRolesFromCompute OperationAction = "sync_dbs_and_roles_from_compute"
	OperationActionTenantAttach               OperationAction = "tenant_attach"
	OperationActionTenantDetach               OperationAction = "tenant_detach"
	OperationActionTenantIgnore               OperationAction = "tenant_ignore"
	OperationActionTenantReattach             OperationAction = "tenant_reattach"
	OperationActionTimelineArchive            OperationAction = "timeline_archive"
	OperationActionTimelineMarkInvisible      OperationAction = "timeline_mark_invisible"
	OperationActionTimelineUnarchive          OperationAction = "timeline_unarchive"
)

type OperationResponse

type OperationResponse struct {
	Operation Operation `json:"operation"`
}

type OperationStatus

type OperationStatus string

OperationStatus The status of the operation

const (
	OperationStatusCancelled  OperationStatus = "cancelled"
	OperationStatusCancelling OperationStatus = "cancelling"
	OperationStatusError      OperationStatus = "error"
	OperationStatusFailed     OperationStatus = "failed"
	OperationStatusFinished   OperationStatus = "finished"
	OperationStatusRunning    OperationStatus = "running"
	OperationStatusScheduling OperationStatus = "scheduling"
	OperationStatusSkipped    OperationStatus = "skipped"
)

type OperationsResponse

type OperationsResponse struct {
	Operations []Operation `json:"operations"`
}

type OrgApiKeyCreateRequest added in v0.12.0

type OrgApiKeyCreateRequest struct {
	ApiKeyCreateRequest
	ProjectID *string `json:"project_id,omitempty"`
}

type OrgApiKeyCreateResponse added in v0.12.0

type OrgApiKeyCreateResponse struct {
	ApiKeyCreateResponse
}

type OrgApiKeyRevokeResponse added in v0.12.0

type OrgApiKeyRevokeResponse struct {
	ApiKeyRevokeResponse
}

type OrgApiKeysListResponseItem added in v0.12.0

type OrgApiKeysListResponseItem struct {
	ApiKeysListResponseItem
}

type Organization added in v0.5.0

type Organization struct {
	// AllowHipaaProjects If true, allow account to mark projects as HIPAA
	AllowHipaaProjects *bool `json:"allow_hipaa_projects,omitempty"`
	// CreatedAt A timestamp indicting when the organization was created
	CreatedAt time.Time `json:"created_at"`
	Handle    string    `json:"handle"`
	ID        string    `json:"id"`
	// ManagedBy Organizations created via the Console or the API are managed by `console`.
	// Organizations created by other methods can't be deleted via the Console or the API.
	ManagedBy string `json:"managed_by"`
	Name      string `json:"name"`
	Plan      string `json:"plan"`
	// UpdatedAt A timestamp indicating when the organization was updated
	UpdatedAt time.Time `json:"updated_at"`
}

type OrganizationInvitationsResponse added in v0.9.0

type OrganizationInvitationsResponse struct {
	Invitations []Invitation `json:"invitations"`
}

type OrganizationInviteCreateRequest added in v0.9.0

type OrganizationInviteCreateRequest struct {
	Email string     `json:"email"`
	Role  MemberRole `json:"role"`
}

type OrganizationInvitesCreateRequest added in v0.9.0

type OrganizationInvitesCreateRequest struct {
	Invitations []OrganizationInviteCreateRequest `json:"invitations"`
}

type OrganizationMemberUpdateRequest added in v0.10.0

type OrganizationMemberUpdateRequest struct {
	Role MemberRole `json:"role"`
}

type OrganizationMembersResponse added in v0.9.0

type OrganizationMembersResponse struct {
	Members []MemberWithUser `json:"members"`
}

type OrganizationsResponse added in v0.5.0

type OrganizationsResponse struct {
	Organizations []Organization `json:"organizations"`
}

type Pagination

type Pagination struct {
	Cursor string `json:"cursor"`
}

Pagination Cursor based pagination is used. The user must pass the cursor as is to the backend. For more information about cursor based pagination, see https://learn.microsoft.com/en-us/ef/core/querying/pagination#keyset-pagination

type PaginationResponse

type PaginationResponse struct {
	Pagination *Pagination `json:"pagination,omitempty"`
}

type PaymentSource added in v0.2.3

type PaymentSource struct {
	Card *PaymentSourceBankCard `json:"card,omitempty"`
	// Type of payment source. E.g. "card".
	Type string `json:"type"`
}

type PaymentSourceBankCard added in v0.2.3

type PaymentSourceBankCard struct {
	// Brand of credit card.
	Brand *string `json:"brand,omitempty"`
	// ExpMonth Credit card expiration month
	ExpMonth *int64 `json:"exp_month,omitempty"`
	// ExpYear Credit card expiration year
	ExpYear *int64 `json:"exp_year,omitempty"`
	// Last4 Last 4 digits of the card.
	Last4 string `json:"last4"`
}

type PgVersion

type PgVersion int

PgVersion The major Postgres version number. Currently supported versions are `14`, `15`, `16`, `17`, and `18`.

type PgbouncerSettingsData added in v0.4.2

type PgbouncerSettingsData struct{}

PgbouncerSettingsData A raw representation of PgBouncer settings

type PlanDetails added in v0.14.0

type PlanDetails struct {
	Name    string       `json:"name"`
	Version *PlanVersion `json:"version,omitempty"`
}

type PlanVersion added in v0.14.0

type PlanVersion struct {
	Major int `json:"major"`
	Minor int `json:"minor"`
}

type PreloadLibraries added in v0.14.0

type PreloadLibraries struct {
	EnabledLibraries *[]string `json:"enabled_libraries,omitempty"`
	UseDefaults      *bool     `json:"use_defaults,omitempty"`
}

PreloadLibraries The shared libraries to preload into the project's compute instances.

type Project

type Project struct {
	// ActiveTimeSeconds Seconds. Control plane observed endpoints of this project being active this amount of wall-clock time.
	// The value has some lag.
	// The value is reset at the beginning of each billing period.
	ActiveTimeSeconds int64 `json:"active_time_seconds"`
	// BranchLogicalSizeLimit The logical size limit for a branch. The value is in MiB.
	BranchLogicalSizeLimit int64 `json:"branch_logical_size_limit"`
	// BranchLogicalSizeLimitBytes The logical size limit for a branch. The value is in B.
	BranchLogicalSizeLimitBytes int64 `json:"branch_logical_size_limit_bytes"`
	// ComputeLastActiveAt The most recent time when any endpoint of this project was active.
	//
	// Omitted when observed no activity for endpoints of this project.
	ComputeLastActiveAt *time.Time `json:"compute_last_active_at,omitempty"`
	// ComputeTimeSeconds Seconds. The number of CPU seconds used by the project's compute endpoints, including compute endpoints that have been deleted.
	// The value has some lag. The value is reset at the beginning of each billing period.
	// Examples:
	// 1. An endpoint that uses 1 CPU for 1 second is equal to `compute_time=1`.
	// 2. An endpoint that uses 2 CPUs simultaneously for 1 second is equal to `compute_time=2`.
	ComputeTimeSeconds int64 `json:"compute_time_seconds"`
	// ConsumptionPeriodEnd A date-time indicating when Neon Cloud plans to stop measuring consumption for current consumption period.
	ConsumptionPeriodEnd time.Time `json:"consumption_period_end"`
	// ConsumptionPeriodStart A date-time indicating when Neon Cloud started measuring consumption for current consumption period.
	ConsumptionPeriodStart time.Time `json:"consumption_period_start"`
	// CpuUsedSec DEPRECATED, use compute_time instead.
	CpuUsedSec int64 `json:"cpu_used_sec"`
	// CreatedAt A timestamp indicating when the project was created
	CreatedAt time.Time `json:"created_at"`
	// CreationSource The project creation source
	CreationSource string `json:"creation_source"`
	// DataStorageBytesHour Bytes-Hour. Project consumed that much storage hourly during the billing period. The value has some lag.
	// The value is reset at the beginning of each billing period.
	DataStorageBytesHour int64 `json:"data_storage_bytes_hour"`
	// DataTransferBytes Bytes. Egress traffic from the Neon cloud to the client for given project over the billing period.
	// Includes deleted endpoints. The value has some lag. The value is reset at the beginning of each billing period.
	DataTransferBytes       int64                    `json:"data_transfer_bytes"`
	DefaultEndpointSettings *DefaultEndpointSettings `json:"default_endpoint_settings,omitempty"`
	// HipaaEnabledAt A timestamp indicating when HIPAA was enabled for this project
	HipaaEnabledAt *time.Time `json:"hipaa_enabled_at,omitempty"`
	// HistoryRetentionSeconds The number of seconds to retain the shared history for all branches in this project.
	HistoryRetentionSeconds int32 `json:"history_retention_seconds"`
	// ID The project ID
	ID string `json:"id"`
	// MaintenanceScheduledFor A timestamp indicating when project update begins. If set, computes might experience a brief restart around this time.
	MaintenanceScheduledFor *time.Time `json:"maintenance_scheduled_for,omitempty"`
	// MaintenanceStartsAt A timestamp indicating when project maintenance begins. If set, the project is placed into maintenance mode at this time.
	MaintenanceStartsAt *time.Time `json:"maintenance_starts_at,omitempty"`
	// Name The project name
	Name      string            `json:"name"`
	OrgID     *string           `json:"org_id,omitempty"`
	Owner     *ProjectOwnerData `json:"owner,omitempty"`
	OwnerID   string            `json:"owner_id"`
	PgVersion PgVersion         `json:"pg_version"`
	// PlatformID The cloud platform identifier. Currently, only AWS is supported, for which the identifier is `aws`.
	PlatformID  string      `json:"platform_id"`
	Provisioner Provisioner `json:"provisioner"`
	// ProxyHost The proxy host for the project. This value combines the `region_id`, the `platform_id`, and the Neon domain (`neon.tech`).
	ProxyHost string `json:"proxy_host"`
	// QuotaResetAt DEPRECATED. Use `consumption_period_end` from the getProject endpoint instead.
	// A timestamp indicating when the project quota resets.
	QuotaResetAt *time.Time `json:"quota_reset_at,omitempty"`
	// RegionID The region identifier
	RegionID string               `json:"region_id"`
	Settings *ProjectSettingsData `json:"settings,omitempty"`
	// StorePasswords Whether or not passwords are stored for roles in the Neon project. Storing passwords facilitates access to Neon features that require authorization.
	StorePasswords bool `json:"store_passwords"`
	// SyntheticStorageSize The current space occupied by the project in storage, in bytes. Synthetic storage size combines the logical data size and Write-Ahead Log (WAL) size for all branches in a project.
	SyntheticStorageSize *int64 `json:"synthetic_storage_size,omitempty"`
	// UpdatedAt A timestamp indicating when the project was last updated
	UpdatedAt time.Time `json:"updated_at"`
	// WrittenDataBytes Bytes. Amount of WAL that travelled through storage for given project across all branches.
	// The value has some lag. The value is reset at the beginning of each billing period.
	WrittenDataBytes int64 `json:"written_data_bytes"`
}

type ProjectAuditLogLevel added in v0.14.0

type ProjectAuditLogLevel string
const (
	ProjectAuditLogLevelBase     ProjectAuditLogLevel = "base"
	ProjectAuditLogLevelExtended ProjectAuditLogLevel = "extended"
	ProjectAuditLogLevelFull     ProjectAuditLogLevel = "full"
)

type ProjectCreateRequest

type ProjectCreateRequest struct {
	Project ProjectCreateRequestProject `json:"project"`
}

type ProjectCreateRequestProject

type ProjectCreateRequestProject struct {
	AutoscalingLimitMaxCu   *ComputeUnit                       `json:"autoscaling_limit_max_cu,omitempty"`
	AutoscalingLimitMinCu   *ComputeUnit                       `json:"autoscaling_limit_min_cu,omitempty"`
	Branch                  *ProjectCreateRequestProjectBranch `json:"branch,omitempty"`
	DefaultEndpointSettings *DefaultEndpointSettings           `json:"default_endpoint_settings,omitempty"`
	// HistoryRetentionSeconds The number of seconds to retain the shared history for all branches in this project.
	// The default is 1 day (86400 seconds).
	HistoryRetentionSeconds *int32 `json:"history_retention_seconds,omitempty"`
	// Name The project name. If not specified, the name will be identical to the generated project ID
	Name *string `json:"name,omitempty"`
	// OrgID Organization id in case the project created belongs to an organization.
	// If not present, project is owned by a user and not by org.
	OrgID       *string      `json:"org_id,omitempty"`
	PgVersion   *PgVersion   `json:"pg_version,omitempty"`
	Provisioner *Provisioner `json:"provisioner,omitempty"`
	// RegionID The region identifier. Refer to our [Regions](https://neon.tech/docs/introduction/regions) documentation for supported regions. Values are specified in this format: `aws-us-east-1`
	RegionID *string              `json:"region_id,omitempty"`
	Settings *ProjectSettingsData `json:"settings,omitempty"`
	// StorePasswords Whether or not passwords are stored for roles in the Neon project. Storing passwords facilitates access to Neon features that require authorization.
	StorePasswords *bool `json:"store_passwords,omitempty"`
}

type ProjectCreateRequestProjectBranch added in v0.2.0

type ProjectCreateRequestProjectBranch struct {
	Annotations *AnnotationValueData `json:"annotations,omitempty"`
	// DatabaseName The database name. If not specified, the default database name, `neondb`, will be used.
	DatabaseName *string `json:"database_name,omitempty"`
	// Name The default branch name. If not specified, the default branch name, `main`, will be used.
	Name *string `json:"name,omitempty"`
	// RoleName The role name. If not specified, the default role name, `{database_name}_owner`, will be used.
	RoleName *string `json:"role_name,omitempty"`
}

type ProjectJWKSResponse added in v0.9.0

type ProjectJWKSResponse struct {
	Jwks []JWKS `json:"jwks"`
}

ProjectJWKSResponse The list of configured JWKS definitions for a project

type ProjectListItem added in v0.2.0

type ProjectListItem struct {
	// ActiveTime Control plane observed endpoints of this project being active this amount of wall-clock time.
	ActiveTime int64 `json:"active_time"`
	// BranchLogicalSizeLimit The logical size limit for a branch. The value is in MiB.
	BranchLogicalSizeLimit int64 `json:"branch_logical_size_limit"`
	// BranchLogicalSizeLimitBytes The logical size limit for a branch. The value is in B.
	BranchLogicalSizeLimitBytes int64 `json:"branch_logical_size_limit_bytes"`
	// ComputeLastActiveAt The most recent time when any endpoint of this project was active.
	//
	// Omitted when observed no activity for endpoints of this project.
	ComputeLastActiveAt *time.Time `json:"compute_last_active_at,omitempty"`
	// CpuUsedSec DEPRECATED. Use data from the getProject endpoint instead.
	CpuUsedSec int64 `json:"cpu_used_sec"`
	// CreatedAt A timestamp indicating when the project was created
	CreatedAt time.Time `json:"created_at"`
	// CreationSource The project creation source
	CreationSource          string                   `json:"creation_source"`
	DefaultEndpointSettings *DefaultEndpointSettings `json:"default_endpoint_settings,omitempty"`
	// HipaaEnabledAt A timestamp indicating when HIPAA was enabled for this project
	HipaaEnabledAt *time.Time `json:"hipaa_enabled_at,omitempty"`
	// HistoryRetentionSeconds The number of seconds to retain the shared history for all branches in this project.
	HistoryRetentionSeconds *int32 `json:"history_retention_seconds,omitempty"`
	// ID The project ID
	ID string `json:"id"`
	// MaintenanceStartsAt A timestamp indicating when project maintenance begins. If set, the project is placed into maintenance mode at this time.
	MaintenanceStartsAt *time.Time `json:"maintenance_starts_at,omitempty"`
	// Name The project name
	Name string `json:"name"`
	// OrgID Organization id if the project belongs to an organization.
	// Permissions for the project will be given to organization members as defined by the organization admins.
	// The permissions of the project do not depend on the user that created the project if a project belongs to an organization.
	OrgID *string `json:"org_id,omitempty"`
	// OrgName Organization name if the project belongs to an organization.
	OrgName   *string   `json:"org_name,omitempty"`
	OwnerID   string    `json:"owner_id"`
	PgVersion PgVersion `json:"pg_version"`
	// PlatformID The cloud platform identifier. Currently, only AWS is supported, for which the identifier is `aws`.
	PlatformID  string      `json:"platform_id"`
	Provisioner Provisioner `json:"provisioner"`
	// ProxyHost The proxy host for the project. This value combines the `region_id`, the `platform_id`, and the Neon domain (`neon.tech`).
	ProxyHost string `json:"proxy_host"`
	// QuotaResetAt DEPRECATED. Use `consumption_period_end` from the getProject endpoint instead.
	// A timestamp indicating when the project quota resets
	QuotaResetAt *time.Time `json:"quota_reset_at,omitempty"`
	// RegionID The region identifier
	RegionID string               `json:"region_id"`
	Settings *ProjectSettingsData `json:"settings,omitempty"`
	// StorePasswords Whether or not passwords are stored for roles in the Neon project. Storing passwords facilitates access to Neon features that require authorization.
	StorePasswords bool `json:"store_passwords"`
	// SyntheticStorageSize The current space occupied by the project in storage, in bytes. Synthetic storage size combines the logical data size and Write-Ahead Log (WAL) size for all branches in a project.
	SyntheticStorageSize *int64 `json:"synthetic_storage_size,omitempty"`
	// UpdatedAt A timestamp indicating when the project was last updated
	UpdatedAt time.Time `json:"updated_at"`
}

ProjectListItem Essential data about the project. Full data is available at the getProject endpoint.

type ProjectOwnerData added in v0.2.0

type ProjectOwnerData struct {
	BranchesLimit    int                     `json:"branches_limit"`
	Email            string                  `json:"email"`
	Name             string                  `json:"name"`
	SubscriptionType BillingSubscriptionType `json:"subscription_type"`
}

type ProjectPermission added in v0.4.3

type ProjectPermission struct {
	GrantedAt      time.Time  `json:"granted_at"`
	GrantedToEmail string     `json:"granted_to_email"`
	ID             string     `json:"id"`
	RevokedAt      *time.Time `json:"revoked_at,omitempty"`
}

type ProjectPermissions added in v0.4.3

type ProjectPermissions struct {
	ProjectPermissions []ProjectPermission `json:"project_permissions"`
}

type ProjectQuota added in v0.1.1

type ProjectQuota struct {
	// ActiveTimeSeconds The total amount of wall-clock time allowed to be spent by the project's compute endpoints.
	ActiveTimeSeconds *int64 `json:"active_time_seconds,omitempty"`
	// ComputeTimeSeconds The total amount of CPU seconds allowed to be spent by the project's compute endpoints.
	ComputeTimeSeconds *int64 `json:"compute_time_seconds,omitempty"`
	// DataTransferBytes Total amount of data transferred from all of a project's branches using the proxy.
	DataTransferBytes *int64 `json:"data_transfer_bytes,omitempty"`
	// LogicalSizeBytes Limit on the logical size of every project's branch.
	//
	// If a branch exceeds its `logical_size_bytes` quota, computes can still be started,
	// but write operations will fail—allowing data to be deleted to free up space.
	// Computes on other branches are not affected.
	//
	// Setting `logical_size_bytes` overrides any lower value set by the `neon.max_cluster_size` Postgres setting.
	LogicalSizeBytes *int64 `json:"logical_size_bytes,omitempty"`
	// WrittenDataBytes Total amount of data written to all of a project's branches.
	WrittenDataBytes *int64 `json:"written_data_bytes,omitempty"`
}

ProjectQuota Per-project consumption quotas. If a quota is exceeded, all active computes are automatically suspended and cannot be started via API calls or incoming connections.

The exception is `logical_size_bytes`, which is enforced per branch. If a branch exceeds its `logical_size_bytes` quota, computes can still be started, but write operations will fail—allowing data to be deleted to free up space. Computes on other branches are not affected.

Setting `logical_size_bytes` overrides any lower value set by the `neon.max_cluster_size` Postgres setting.

Quotas are enforced using per-project consumption metrics with the same names. These metrics reset at the start of each billing period. `logical_size_bytes` is also an exception—it reflects the total data stored in a branch and does not reset.

A zero or empty quota value means “unlimited.”

type ProjectResponse

type ProjectResponse struct {
	Project Project `json:"project"`
}

type ProjectSettingsData

type ProjectSettingsData struct {
	AllowedIps    *AllowedIps           `json:"allowed_ips,omitempty"`
	AuditLogLevel *ProjectAuditLogLevel `json:"audit_log_level,omitempty"`
	// BlockPublicConnections When set, connections from the public internet
	// are disallowed. This supersedes the AllowedIPs list.
	// This parameter is under active development and its semantics may change in the future.
	BlockPublicConnections *bool `json:"block_public_connections,omitempty"`
	// BlockVpcConnections When set, connections using VPC endpoints are disallowed.
	// This parameter is under active development and its semantics may change in the future.
	BlockVpcConnections *bool `json:"block_vpc_connections,omitempty"`
	// EnableLogicalReplication Sets wal_level=logical for all compute endpoints in this project.
	// All active endpoints will be suspended.
	// Once enabled, logical replication cannot be disabled.
	EnableLogicalReplication *bool              `json:"enable_logical_replication,omitempty"`
	Hipaa                    *bool              `json:"hipaa,omitempty"`
	MaintenanceWindow        *MaintenanceWindow `json:"maintenance_window,omitempty"`
	PreloadLibraries         *PreloadLibraries  `json:"preload_libraries,omitempty"`
	Quota                    *ProjectQuota      `json:"quota,omitempty"`
}

type ProjectTransferRequestResponse added in v0.14.0

type ProjectTransferRequestResponse struct {
	// CreatedAt The timestamp when the transfer request was created
	CreatedAt time.Time `json:"created_at"`
	// ExpiresAt The timestamp when the transfer request will expire
	ExpiresAt time.Time `json:"expires_at"`
	// ID The unique identifier for the transfer request
	ID string `json:"id"`
	// ProjectID The ID of the project that is being transferred
	ProjectID string `json:"project_id"`
}

type ProjectUpdateRequest

type ProjectUpdateRequest struct {
	Project ProjectUpdateRequestProject `json:"project"`
}

type ProjectUpdateRequestProject

type ProjectUpdateRequestProject struct {
	DefaultEndpointSettings *DefaultEndpointSettings `json:"default_endpoint_settings,omitempty"`
	// HistoryRetentionSeconds The number of seconds to retain the shared history for all branches in this project.
	// The default is 1 day (604800 seconds).
	HistoryRetentionSeconds *int32 `json:"history_retention_seconds,omitempty"`
	// Name The project name
	Name     *string              `json:"name,omitempty"`
	Settings *ProjectSettingsData `json:"settings,omitempty"`
}

type ProjectsApplicationsMapResponse added in v0.6.1

type ProjectsApplicationsMapResponse struct {
	Applications ProjectsApplicationsMapResponseApplications `json:"applications"`
}

ProjectsApplicationsMapResponse A map where key is a project ID and a value is a list of installed applications.

type ProjectsApplicationsMapResponseApplications added in v0.6.1

type ProjectsApplicationsMapResponseApplications struct{}

type ProjectsIntegrationsMapResponse added in v0.9.0

type ProjectsIntegrationsMapResponse struct {
	Integrations ProjectsIntegrationsMapResponseIntegrations `json:"integrations"`
}

ProjectsIntegrationsMapResponse A map where key is a project ID and a value is a list of installed integrations.

type ProjectsIntegrationsMapResponseIntegrations added in v0.9.0

type ProjectsIntegrationsMapResponseIntegrations struct{}

type ProjectsResponse

type ProjectsResponse struct {
	Projects []ProjectListItem `json:"projects"`
	// UnavailableProjectIDs A list of project IDs indicating which projects are known to exist, but whose details could not
	// be fetched within the requested (or implicit) time limit
	UnavailableProjectIDs *[]string `json:"unavailable_project_ids,omitempty"`
}

type Provisioner added in v0.2.0

type Provisioner string

Provisioner The Neon compute provisioner. Specify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.

Provisioner can be one of the following values: * k8s-pod * k8s-neonvm

Clients must expect, that any string value that is not documented in the description above should be treated as a error. UNKNOWN value if safe to treat as an error too.

type RegionResponse added in v0.8.0

type RegionResponse struct {
	// Default Whether this region is used by default in new projects.
	Default bool `json:"default"`
	// GeoLat The geographical latitude (approximate) for the region. Empty if unknown.
	GeoLat string `json:"geo_lat"`
	// GeoLong The geographical longitude (approximate) for the region. Empty if unknown.
	GeoLong string `json:"geo_long"`
	// Name A short description of the region.
	Name string `json:"name"`
	// RegionID The region ID as used in other API endpoints
	RegionID string `json:"region_id"`
}

type RestoreSnapshotReqObj added in v0.14.0

type RestoreSnapshotReqObj struct {
	FinalizeRestore *bool   `json:"finalize_restore,omitempty"`
	Name            *string `json:"name,omitempty"`
	TargetBranchID  *string `json:"target_branch_id,omitempty"`
}

type RestoredSnapshot added in v0.14.0

type Role

type Role struct {
	// BranchID The ID of the branch to which the role belongs
	BranchID string `json:"branch_id"`
	// CreatedAt A timestamp indicating when the role was created
	CreatedAt time.Time `json:"created_at"`
	// Name The role name
	Name string `json:"name"`
	// Password The role password
	Password *string `json:"password,omitempty"`
	// Protected Whether or not the role is system-protected
	Protected *bool `json:"protected,omitempty"`
	// UpdatedAt A timestamp indicating when the role was last updated
	UpdatedAt time.Time `json:"updated_at"`
}

type RoleCreateRequest

type RoleCreateRequest struct {
	Role RoleCreateRequestRole `json:"role"`
}

type RoleCreateRequestRole

type RoleCreateRequestRole struct {
	// Name The role name. Cannot exceed 63 bytes in length.
	Name string `json:"name"`
	// NoLogin Whether to create a role that cannot login.
	NoLogin *bool `json:"no_login,omitempty"`
}

type RoleOperations

type RoleOperations struct {
	OperationsResponse
	RoleResponse
}

type RolePasswordResponse added in v0.2.0

type RolePasswordResponse struct {
	// Password The role password
	Password string `json:"password"`
}

type RoleResponse

type RoleResponse struct {
	Role Role `json:"role"`
}

type RolesResponse

type RolesResponse struct {
	Roles []Role `json:"roles"`
}

type Snapshot added in v0.14.0

type Snapshot struct {
	CreatedAt      string  `json:"created_at"`
	ExpiresAt      *string `json:"expires_at,omitempty"`
	ID             string  `json:"id"`
	Lsn            *string `json:"lsn,omitempty"`
	Manual         *bool   `json:"manual,omitempty"`
	Name           string  `json:"name"`
	SourceBranchID *string `json:"source_branch_id,omitempty"`
	Timestamp      *string `json:"timestamp,omitempty"`
}

type SnapshotUpdateRequest added in v0.14.0

type SnapshotUpdateRequest struct {
	Snapshot SnapshotUpdateRequestSnapshot `json:"snapshot"`
}

type SnapshotUpdateRequestSnapshot added in v0.14.0

type SnapshotUpdateRequestSnapshot struct {
	Name *string `json:"name,omitempty"`
}

type SuspendTimeoutSeconds added in v0.2.0

type SuspendTimeoutSeconds int64

SuspendTimeoutSeconds Duration of inactivity in seconds after which the compute endpoint is automatically suspended. The value `0` means use the default value. The value `-1` means never suspend. The default value is `300` seconds (5 minutes). The minimum value is `60` seconds (1 minute). The maximum value is `604800` seconds (1 week). For more information, see [Scale to zero configuration](https://neon.tech/docs/manage/endpoints#scale-to-zero-configuration).

type TransferProjectsToOrganizationRequest added in v0.6.0

type TransferProjectsToOrganizationRequest struct {
	// DestinationOrgID The destination organization identifier
	DestinationOrgID string `json:"destination_org_id"`
	// ProjectIDs The list of projects ids to transfer. Maximum of 400 project ids
	ProjectIDs []string `json:"project_ids"`
}

type UpdateProjectRespObj added in v0.2.5

type UpdateProjectRespObj struct {
	OperationsResponse
	ProjectResponse
}

type UpdateSnapshotRespObj added in v0.14.0

type UpdateSnapshotRespObj struct {
	Snapshot
}

type VPCEndpoint added in v0.12.0

type VPCEndpoint struct {
	// Label A descriptive label for the VPC endpoint
	Label string `json:"label"`
	// VpcEndpointID The VPC endpoint ID
	VpcEndpointID string `json:"vpc_endpoint_id"`
}

type VPCEndpointAssignment added in v0.12.0

type VPCEndpointAssignment struct {
	Label string `json:"label"`
}

type VPCEndpointDetails added in v0.12.0

type VPCEndpointDetails struct {
	// ExampleRestrictedProjects A list of example projects that are restricted to use this VPC endpoint.
	// There are at most 3 projects in the list, even if more projects are restricted.
	ExampleRestrictedProjects []string `json:"example_restricted_projects"`
	// Label A descriptive label for the VPC endpoint
	Label string `json:"label"`
	// NumRestrictedProjects The number of projects that are restricted to use this VPC endpoint.
	NumRestrictedProjects int `json:"num_restricted_projects"`
	// State The current state of the VPC endpoint. Possible values are
	// `new` (just configured, pending acceptance) or `accepted`
	// (VPC connection was accepted by Neon).
	State string `json:"state"`
	// VpcEndpointID The VPC endpoint ID
	VpcEndpointID string `json:"vpc_endpoint_id"`
}

type VPCEndpointWithRegion added in v0.14.0

type VPCEndpointWithRegion struct {
	VPCEndpoint
}

type VPCEndpointsResponse added in v0.12.0

type VPCEndpointsResponse struct {
	Endpoints []VPCEndpoint `json:"endpoints"`
}

type VPCEndpointsWithRegionResponse added in v0.14.0

type VPCEndpointsWithRegionResponse struct {
	Endpoints []VPCEndpointWithRegion `json:"endpoints"`
}

Directories

Path Synopsis
e2e-example module
generator module

Jump to

Keyboard shortcuts

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