sdk

package module
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 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 codecov 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 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 The roles the JWKS should be mapped to
	RoleNames []string `json:"role_names"`
}

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 map[string]interface{}

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 map[string]interface{}

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 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"`
	// 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"
	BillingSubscriptionTypeFreeV2         BillingSubscriptionType = "free_v2"
	BillingSubscriptionTypeLaunch         BillingSubscriptionType = "launch"
	BillingSubscriptionTypeScale          BillingSubscriptionType = "scale"
	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"`
	// 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"`
	// 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
	ParentLsn *string `json:"parent_lsn,omitempty"`
	// ParentTimestamp The point in time on the parent branch from which this branch was created
	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"`
	// StateChangedAt A UTC timestamp indicating when the `current_state` began
	StateChangedAt time.Time `json:"state_changed_at"`
	// 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"`
	// 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"`
	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 BranchSchemaCompareResponse added in v0.12.0

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

type BranchSchemaResponse added in v0.5.0

type BranchSchemaResponse struct {
	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.
  • '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 {
	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) 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. 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) 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. A project is the top-level object in the Neon object hierarchy. 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. The default behavior is to create a branch from the project's default branch with no compute endpoint, and the branch name is auto-generated. There is a maximum of one read-write endpoint per branch. A branch can have multiple read-only endpoints. For related information, see [Manage branches](https://neon.tech/docs/manage/branches/).

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) CreateProjectIdentityAuthProviderSDKKeys added in v0.13.0

func (c Client) CreateProjectIdentityAuthProviderSDKKeys(cfg IdentityCreateAuthProviderSDKKeysRequest) (IdentityCreateIntegrationResponse, error)

CreateProjectIdentityAuthProviderSDKKeys 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) CreateProjectIdentityIntegration added in v0.13.0

func (c Client) CreateProjectIdentityIntegration(cfg IdentityCreateIntegrationRequest) (IdentityCreateIntegrationResponse, error)

CreateProjectIdentityIntegration 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) 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.

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) 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) DeleteProjectIdentityIntegration added in v0.13.0

func (c Client) DeleteProjectIdentityIntegration(projectID string, authProvider IdentitySupportedAuthProvider) error

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) GetActiveRegions added in v0.8.0

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

GetActiveRegions Lists supported Neon regions

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) (ConsumptionHistoryPerAccountResponse, error)

GetConsumptionHistoryPerAccount Retrieves consumption metrics for Scale, Business, and Enterprise plan accounts. History begins at the time of upgrade.

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) (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.

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) 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. A project is the top-level object in the Neon object hierarchy. You can obtain a `project_id` by listing the projects for your Neon account.

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) 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) (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) 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) 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) ListProjectIdentityIntegrations added in v0.13.0

func (c Client) ListProjectIdentityIntegrations(projectID string) (ListProjectIdentityIntegrationsResponse, error)

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.

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 the Neon account. A project is the top-level object in the Neon object hierarchy. 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 shared projects for the Neon account. A project is the top-level object in the Neon object hierarchy. For more information, see [Manage projects](https://neon.tech/docs/manage/projects/).

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) 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) TransferProjectIdentityAuthProviderProject added in v0.13.0

func (c Client) TransferProjectIdentityAuthProviderProject(cfg IdentityTransferAuthProviderProjectRequest) (IdentityTransferAuthProviderProjectResponse, error)

TransferProjectIdentityAuthProviderProject 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(orgID 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) 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.

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"`
	// 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 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"`
	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 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            *PgSettingsData        `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 EmptyResponse added in v0.6.0

type EmptyResponse map[string]interface{}

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. However, the compute endpoint is periodically
	// enabled by check_availability operations.
	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"`
	// 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"`
	SuspendTimeoutSeconds SuspendTimeoutSeconds `json:"suspend_timeout_seconds"`
	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"`
	// 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        *PgSettingsData        `json:"pg_settings,omitempty"`
	PgbouncerSettings *PgbouncerSettingsData `json:"pgbouncer_settings,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"`
	// 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 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 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 IdentityAuthProviderProjectOwnedBy added in v0.13.0

type IdentityAuthProviderProjectOwnedBy string
const (
	IdentityAuthProviderProjectOwnedByNeon IdentityAuthProviderProjectOwnedBy = "neon"
	IdentityAuthProviderProjectOwnedByUser IdentityAuthProviderProjectOwnedBy = "user"
)

type IdentityAuthProviderProjectTransferStatus added in v0.13.0

type IdentityAuthProviderProjectTransferStatus string
const (
	IdentityAuthProviderProjectTransferStatusFinished  IdentityAuthProviderProjectTransferStatus = "finished"
	IdentityAuthProviderProjectTransferStatusInitiated IdentityAuthProviderProjectTransferStatus = "initiated"
)

type IdentityCreateAuthProviderSDKKeysRequest added in v0.13.0

type IdentityCreateAuthProviderSDKKeysRequest struct {
	AuthProvider IdentitySupportedAuthProvider `json:"auth_provider"`
	ProjectID    string                        `json:"project_id"`
}

type IdentityCreateIntegrationRequest added in v0.13.0

type IdentityCreateIntegrationRequest struct {
	AuthProvider IdentitySupportedAuthProvider `json:"auth_provider"`
	BranchID     string                        `json:"branch_id"`
	DatabaseName string                        `json:"database_name"`
	ProjectID    string                        `json:"project_id"`
	RoleName     string                        `json:"role_name"`
}

type IdentityCreateIntegrationResponse added in v0.13.0

type IdentityCreateIntegrationResponse struct {
	AuthProvider          IdentitySupportedAuthProvider `json:"auth_provider"`
	AuthProviderProjectID string                        `json:"auth_provider_project_id"`
	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 IdentityIntegration added in v0.13.0

type IdentityIntegration struct {
	AuthProvider          string                                     `json:"auth_provider"`
	AuthProviderProjectID string                                     `json:"auth_provider_project_id"`
	BranchID              string                                     `json:"branch_id"`
	CreatedAt             time.Time                                  `json:"created_at"`
	DbName                string                                     `json:"db_name"`
	JwksURL               string                                     `json:"jwks_url"`
	OwnedBy               IdentityAuthProviderProjectOwnedBy         `json:"owned_by"`
	TransferStatus        *IdentityAuthProviderProjectTransferStatus `json:"transfer_status,omitempty"`
}

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"
	IdentityProviderIdTest        IdentityProviderId = "test"
	IdentityProviderIdVercelmp    IdentityProviderId = "vercelmp"
)

type IdentitySupportedAuthProvider added in v0.13.0

type IdentitySupportedAuthProvider string
const (
	IdentitySupportedAuthProviderMock  IdentitySupportedAuthProvider = "mock"
	IdentitySupportedAuthProviderStack IdentitySupportedAuthProvider = "stack"
)

type IdentityTransferAuthProviderProjectRequest added in v0.13.0

type IdentityTransferAuthProviderProjectRequest struct {
	AuthProvider IdentitySupportedAuthProvider `json:"auth_provider"`
	ProjectID    string                        `json:"project_id"`
}

type IdentityTransferAuthProviderProjectResponse added in v0.13.0

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

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"`
	// 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 ListOperations

type ListOperations struct {
	OperationsResponse
	PaginationResponse
}

type ListProjectBranchesRespObj added in v0.6.0

type ListProjectBranchesRespObj struct {
	AnnotationsMapResponse
	BranchesResponse
	CursorPaginationResponse
}

type ListProjectIdentityIntegrationsResponse added in v0.13.0

type ListProjectIdentityIntegrationsResponse struct {
	Data []IdentityIntegration `json:"data"`
}

type ListSharedProjectsRespObj added in v0.4.2

type ListSharedProjectsRespObj struct {
	PaginationResponse
	ProjectsResponse
}

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 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"
	OperationActionReplaceSafekeeper          OperationAction = "replace_safekeeper"
	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"
	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
}

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 {
	// 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 PgSettingsData

type PgSettingsData map[string]interface{}

PgSettingsData A raw representation of Postgres settings

type PgVersion

type PgVersion int

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

type PgbouncerSettingsData added in v0.4.2

type PgbouncerSettingsData map[string]interface{}

PgbouncerSettingsData A raw representation of PgBouncer settings

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"`
	// HistoryRetentionSeconds The number of seconds to retain the shared history for all branches in this project. The default for all plans is 1 day (86400 seconds).
	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 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 {
	// 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"`
	// 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 a project belongs to 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"`
	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.
	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 quota. If the quota is exceeded, all active computes are automatically suspended and it will not be possible to start them with an API method call or incoming proxy connections. The only exception is `logical_size_bytes`, which is applied on per-branch basis, i.e., only the compute on the branch that exceeds the `logical_size` quota will be suspended.

Quotas are enforced based on per-project consumption metrics with the same names, which are reset at the end of each billing period (the first day of the month). Logical size is also an exception in this case, as it represents the total size of data stored in a branch, so it is 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"`
	// 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"`
	MaintenanceWindow        *MaintenanceWindow `json:"maintenance_window,omitempty"`
	Quota                    *ProjectQuota      `json:"quota,omitempty"`
}

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 map[string]interface{}

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 map[string]interface{}

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 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 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 {
	// OrgID The source organization identifier
	OrgID string `json:"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 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 VPCEndpointsResponse added in v0.12.0

type VPCEndpointsResponse struct {
	Endpoints []VPCEndpoint `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