dbaas

package module
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

README

dbaas-go: Go SDK for Selectel DBaaS

Go.dev reference Go Report Card

Package dbaas-go provides Go SDK to work with Selectel DBaaS

Documentation

The Go library documentation is available at go.dev.

What this library is capable of

You can use this library to work with the following objects of the Selectel Managed Databases Service:

  • acl
  • available extension
  • configuration parameter
  • database
  • datastore
  • datastore type
  • extension
  • flavor
  • grant
  • logical replication slots
  • prometheus metrics tokens
  • topic
  • user

Getting started

Instalation

You can install dbaas-go package via go get command:

go get github.com/selectel/dbaas-go
Authentication

To work with the Selectel Managed Databases Service API you first need to:

Endpoints

Selectel Managed Databases Service currently has the following API endpoint:

URL Region
https://ru-1.dbaas.selcloud.ru/v1 ru-1
https://ru-2.dbaas.selcloud.ru/v1 ru-2
https://ru-3.dbaas.selcloud.ru/v1 ru-3
https://ru-7.dbaas.selcloud.ru/v1 ru-7
https://ru-8.dbaas.selcloud.ru/v1 ru-8
https://ru-9.dbaas.selcloud.ru/v1 ru-9
https://uz-1.dbaas.selcloud.ru/v1 uz-1
https://kz-1.dbaas.selcloud.ru/v1 kz-1

You can also retrieve all available API endpoints from the Identity catalog.

Usage example
package main

import (
    "context"
    "log"
    "fmt"

    "github.com/gophercloud/gophercloud"
    "github.com/gophercloud/gophercloud/openstack"
    "github.com/gophercloud/gophercloud/openstack/networking/v2/subnets"
    "github.com/selectel/dbaas-go"
)

func main() {
    // Token to work with Selectel Cloud project.
    token := "TOKEN"

    // DBaaS endpoint to work with.
    endpoint := "https://ru-2.dbaas.selcloud.ru/v1"

    openstackEndpoint := "https://api.selvpc.ru/identity/v3/"

    openstackRegion := "ru-2"

    // Initialize the DBaaS v1 client.
    dbaasClient, err := dbaas.NewDBAASClient(token, endpoint)
    if err != nil {
        log.Fatal(err)
    }

    // Prepare empty context.
    ctx := context.Background()

    // Get available datastore types.
    datastoreTypes, err := dbaasClient.DatastoreTypes(ctx)
    if err != nil {
        log.Fatal(err)
    }

    // Auth options for openstack to get all subnets.
    devopts := gophercloud.AuthOptions{
        IdentityEndpoint: openstackEndpoint,
        TokenID:          token,
    }

    provider, err := openstack.AuthenticatedClient(devopts)
    if err != nil {
        log.Fatal(err)
    }

    // Create a new network client.
    networkClient, err := openstack.NewNetworkV2(provider, gophercloud.EndpointOpts{Region: openstackRegion})
    if err != nil {
        log.Fatal(err)
    }

    // Get a list of available subnets.
    listOpts := subnets.ListOpts{
        IPVersion: 4,
    }
    allPages, err := subnets.List(networkClient, listOpts).AllPages()
    if err != nil {
        log.Fatal(err)
    }
    allSubnets, err := subnets.ExtractSubnets(allPages)
    if err != nil {
        log.Fatal(err)
    }

    // Create options for a new datastore.
    datastoreCreateOpts := dbaas.DatastoreCreateOpts{
        Name:      "go_cluster",
        TypeID:    datastoreTypes[0].ID,
        NodeCount: 1,
        SubnetID:  allSubnets[0].ID,
        Flavor:    &dbaas.Flavor{Vcpus: 2, RAM: 4096, Disk: 32},
    }

    // Create a new datastore.
    newDatastore, err := dbaasClient.CreateDatastore(ctx, datastoreCreateOpts)
    if err != nil {
        log.Fatal(err)
    }

    // Print datastores fields.
    fmt.Printf("Created datastore: %+v\n", newDatastore)
}

Documentation

Overview

Package dbaas implements the Selectel DBaaS v1 API

Index

Constants

View Source
const (
	ErrorNotFoundTitle   = "Not Found"
	ErrorBadRequestTitle = "Bad Request"
)

Error titles.

View Source
const ACLsURI = "/acls"
View Source
const AvailableExtensionsURI = "/available-extensions"
View Source
const ConfigurationParametersURI = "/configuration-parameters"
View Source
const DatabasesURI = "/databases"
View Source
const DatastoreTypesURI = "/datastore-types"
View Source
const DatastoresURI = "/datastores"
View Source
const ExtensionsURI = "/extensions"
View Source
const FlavorsURI = "/flavors"
View Source
const FloatingIPsURI = "/floating-ips"
View Source
const GrantsURI = "/grants"
View Source
const LogicalReplicationSlotsURI = "/logical-replication-slots"
View Source
const NotFoundEntityID = "0721fd40-77e9-4012-8f4d-6bb3bd9ea1fa"
View Source
const PrometheusMetricsTokensURI = "/prometheus-metrics-tokens"
View Source
const TopicsURI = "/topics"
View Source
const UsersURI = "/users"

Variables

This section is empty.

Functions

This section is empty.

Types

type ACL added in v0.10.0

type ACL struct {
	ID          string `json:"id"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
	ProjectID   string `json:"project_id"`
	DatastoreID string `json:"datastore_id"`
	Pattern     string `json:"pattern"`
	PatternType string `json:"pattern_type"`
	UserID      string `json:"user_id"`
	Status      Status `json:"status"`
	AllowRead   bool   `json:"allow_read"`
	AllowWrite  bool   `json:"allow_write"`
}

ACL is the API response for the acls.

type ACLCreateOpts added in v0.10.0

type ACLCreateOpts struct {
	DatastoreID string `json:"datastore_id"`
	Pattern     string `json:"pattern,omitempty"`
	PatternType string `json:"pattern_type"`
	UserID      string `json:"user_id"`
	AllowRead   bool   `json:"allow_read"`
	AllowWrite  bool   `json:"allow_write"`
}

ACLCreateOpts represents options for the acl Create request.

type ACLQueryParams added in v0.10.0

type ACLQueryParams struct {
	ID          string `json:"id,omitempty"`
	ProjectID   string `json:"project_id,omitempty"`
	DatastoreID string `json:"datastore_id,omitempty"`
	Pattern     string `json:"pattern,omitempty"`
	PatternType string `json:"pattern_type,omitempty"`
	UserID      string `json:"user_id,omitempty"`
	Status      Status `json:"status,omitempty"`
}

ACLQueryParams represents available query parameters for the acl.

type ACLUpdateOpts added in v0.10.0

type ACLUpdateOpts struct {
	AllowRead  bool `json:"allow_read"`
	AllowWrite bool `json:"allow_write"`
}

ACLUpdateOpts represents options for the acl Update request.

type API

type API struct {
	HTTPClient *http.Client
	Token      string
	Endpoint   string
	UserAgent  string
}

API stores details that are needed to work with Selectel DBaaS API.

func NewDBAASClient

func NewDBAASClient(token, endpoint string) (*API, error)

NewDBAASClient initializes a new DBaaS client for the V1 API.

func NewDBAASClientV1WithCustomHTTP

func NewDBAASClientV1WithCustomHTTP(customHTTPClient *http.Client, token, endpoint string) (*API, error)

NewDBAASClientV1WithCustomHTTP initializes a new DBaaS client for the V1 API using custom HTTP client. If custom HTTP client is nil - default HTTP client will be used.

func NewDBAASClientV1WithOpenstackCredentials

func NewDBAASClientV1WithOpenstackCredentials(token, identityEndpoint, region, serviceType string) (*API, error)

NewDBAASClientV1WithOpenstackCredentials initializes a new DBaaS client for the V1 API using openstack credentials. You need to provide identityEndpoint, region and serviceType to get correct service endpoint.

func (*API) ACL added in v0.10.0

func (api *API) ACL(ctx context.Context, aclID string) (ACL, error)

ACL returns an ACL based on the ID.

func (*API) ACLs added in v0.10.0

func (api *API) ACLs(ctx context.Context, params *ACLQueryParams) ([]ACL, error)

ACLs returns all ACLs.

func (*API) AvailableExtension

func (api *API) AvailableExtension(ctx context.Context, availableExtensionID string) (AvailableExtension, error)

AvailableExtension returns an available extension based on the ID.

func (*API) AvailableExtensions

func (api *API) AvailableExtensions(ctx context.Context) ([]AvailableExtension, error)

AvailableExtensions returns all available extensions.

func (*API) BackupsDatastore added in v0.9.0

func (api *API) BackupsDatastore(ctx context.Context, datastoreID string, opts DatastoreBackupsOpts) (Datastore, error)

BackupsDatastore updates backups parameters of an existing datastore.

func (*API) ConfigDatastore added in v0.2.0

func (api *API) ConfigDatastore(ctx context.Context, datastoreID string, opts DatastoreConfigOpts) (Datastore, error)

ConfigDatastore updates configuration parameters rules of an existing datastore.

func (*API) ConfigurationParameter added in v0.2.0

func (api *API) ConfigurationParameter(
	ctx context.Context,
	configurationParameterID string,
) (ConfigurationParameter, error)

ConfigurationParameter returns a configuration parameter based on the ID.

func (*API) ConfigurationParameters added in v0.2.0

func (api *API) ConfigurationParameters(ctx context.Context) ([]ConfigurationParameter, error)

ConfigurationParameters returns all configuration parameters.

func (*API) CreateACL added in v0.10.0

func (api *API) CreateACL(ctx context.Context, opts ACLCreateOpts) (ACL, error)

CreateACL creates a new acl.

func (*API) CreateDatabase

func (api *API) CreateDatabase(ctx context.Context, opts DatabaseCreateOpts) (Database, error)

CreateDatabase creates a new database.

func (*API) CreateDatastore

func (api *API) CreateDatastore(ctx context.Context, opts DatastoreCreateOpts) (Datastore, error)

CreateDatastore creates a new datastore.

func (*API) CreateExtension

func (api *API) CreateExtension(ctx context.Context, opts ExtensionCreateOpts) (Extension, error)

CreateExtension creates a new extension.

func (*API) CreateFloatingIP added in v0.12.0

func (api *API) CreateFloatingIP(ctx context.Context, opts FloatingIPsOpts) error

CreateFloatingIP creates FloatingIP for provided instance of an existing datastore.

func (*API) CreateGrant

func (api *API) CreateGrant(ctx context.Context, opts GrantCreateOpts) (Grant, error)

CreateGrant creates a new grant.

func (*API) CreateLogicalReplicationSlot added in v0.8.0

func (api *API) CreateLogicalReplicationSlot(
	ctx context.Context,
	opts LogicalReplicationSlotCreateOpts,
) (LogicalReplicationSlot, error)

CreateLogicalReplicationSlot creates a new slot.

func (*API) CreatePrometheusMetricToken added in v0.3.0

func (api *API) CreatePrometheusMetricToken(
	ctx context.Context,
	opts PrometheusMetricTokenCreateOpts,
) (PrometheusMetricToken, error)

CreatePrometheusMetricToken creates a new token.

func (*API) CreateTopic added in v0.10.0

func (api *API) CreateTopic(ctx context.Context, opts TopicCreateOpts) (Topic, error)

CreateTopic creates a new topic.

func (*API) CreateUser

func (api *API) CreateUser(ctx context.Context, opts UserCreateOpts) (User, error)

CreateUser creates a new user.

func (*API) Database

func (api *API) Database(ctx context.Context, databaseID string) (Database, error)

Database returns a database based on the ID.

func (*API) Databases

func (api *API) Databases(ctx context.Context, params *DatabaseQueryParams) ([]Database, error)

Databases returns all databases.

func (*API) Datastore

func (api *API) Datastore(ctx context.Context, datastoreID string) (Datastore, error)

Datastore returns a datastore based on the ID.

func (*API) DatastoreType

func (api *API) DatastoreType(ctx context.Context, datastoreTypeID string) (DatastoreType, error)

DatastoreType returns a datastore type based on the ID.

func (*API) DatastoreTypes

func (api *API) DatastoreTypes(ctx context.Context) ([]DatastoreType, error)

DatastoreTypes returns all datastore types.

func (*API) Datastores

func (api *API) Datastores(ctx context.Context, params *DatastoreQueryParams) ([]Datastore, error)

Datastores returns all datastores.

func (*API) DeleteACL added in v0.10.0

func (api *API) DeleteACL(ctx context.Context, aclID string) error

DeleteACL deletes an existing acl.

func (*API) DeleteDatabase

func (api *API) DeleteDatabase(ctx context.Context, databaseID string) error

DeleteDatabase deletes an existing database.

func (*API) DeleteDatastore

func (api *API) DeleteDatastore(ctx context.Context, datastoreID string) error

DeleteDatastore deletes an existing datastore.

func (*API) DeleteExtension

func (api *API) DeleteExtension(ctx context.Context, extensionID string) error

DeleteExtension deletes an existing extension.

func (*API) DeleteFloatingIP added in v0.12.0

func (api *API) DeleteFloatingIP(ctx context.Context, opts FloatingIPsOpts) error

DeleteFloatingIP deletes FloatingIP from provided instance of an existing datastore.

func (*API) DeleteGrant

func (api *API) DeleteGrant(ctx context.Context, grantID string) error

DeleteGrant deletes an existing grant.

func (*API) DeleteLogicalReplicationSlot added in v0.8.0

func (api *API) DeleteLogicalReplicationSlot(ctx context.Context, slotID string) error

DeleteLogicalReplicationSlot deletes an existing slot.

func (*API) DeletePrometheusMetricToken added in v0.3.0

func (api *API) DeletePrometheusMetricToken(ctx context.Context, prometheusMetricTokenID string) error

DeletePrometheusMetricToken deletes an existing token.

func (*API) DeleteTopic added in v0.10.0

func (api *API) DeleteTopic(ctx context.Context, topicID string) error

DeleteTopic deletes an existing topic.

func (*API) DeleteUser

func (api *API) DeleteUser(ctx context.Context, userID string) error

DeleteUser deletes an existing user.

func (*API) Extension

func (api *API) Extension(ctx context.Context, extensionID string) (Extension, error)

Extension returns a extension based on the ID.

func (*API) Extensions

func (api *API) Extensions(ctx context.Context, params *ExtensionQueryParams) ([]Extension, error)

Extensions returns all extensions.

func (*API) FirewallDatastore

func (api *API) FirewallDatastore(ctx context.Context, datastoreID string, opts DatastoreFirewallOpts) (Datastore, error)

FirewallDatastore updates firewall rules of an existing datastore.

func (*API) Flavor

func (api *API) Flavor(ctx context.Context, flavorID string) (FlavorResponse, error)

Flavor returns a flavor based on the ID.

func (*API) Flavors

func (api *API) Flavors(ctx context.Context) ([]FlavorResponse, error)

Flavors returns all flavors.

func (*API) Grant

func (api *API) Grant(ctx context.Context, grantID string) (Grant, error)

Grant returns a grant based on the ID.

func (*API) Grants

func (api *API) Grants(ctx context.Context) ([]Grant, error)

Grants returns all grants.

func (*API) LogicalReplicationSlot added in v0.8.0

func (api *API) LogicalReplicationSlot(ctx context.Context, slotID string) (LogicalReplicationSlot, error)

LogicalReplicationSlot returns a slot based on the ID.

func (*API) LogicalReplicationSlots added in v0.8.0

func (api *API) LogicalReplicationSlots(
	ctx context.Context,
	params *LogicalReplicationSlotQueryParams,
) ([]LogicalReplicationSlot, error)

LogicalReplicationSlots returns all slots.

func (*API) PasswordDatastore added in v0.4.0

func (api *API) PasswordDatastore(ctx context.Context, datastoreID string, opts DatastorePasswordOpts) (Datastore, error)

PasswordDatastore updates password of an existing Redis datastore.

func (*API) PoolerDatastore

func (api *API) PoolerDatastore(ctx context.Context, datastoreID string, opts DatastorePoolerOpts) (Datastore, error)

PoolerDatastore updates pooler parameters of an existing datastore.

func (*API) PrometheusMetricToken added in v0.3.0

func (api *API) PrometheusMetricToken(
	ctx context.Context,
	prometheusMetricTokenID string,
) (PrometheusMetricToken, error)

PrometheusMetricToken returns a token based on the ID.

func (*API) PrometheusMetricTokens added in v0.3.0

func (api *API) PrometheusMetricTokens(ctx context.Context) ([]PrometheusMetricToken, error)

PrometheusMetricTokens returns all tokens.

func (*API) ResizeDatastore

func (api *API) ResizeDatastore(ctx context.Context, datastoreID string, opts DatastoreResizeOpts) (Datastore, error)

ResizeDatastore resizes an existing datastore.

func (*API) Topic added in v0.10.0

func (api *API) Topic(ctx context.Context, topicID string) (Topic, error)

Topic returns a topic based on the ID.

func (*API) Topics added in v0.10.0

func (api *API) Topics(ctx context.Context, params *TopicQueryParams) ([]Topic, error)

Topics returns all topics.

func (*API) UpdateACL added in v0.10.0

func (api *API) UpdateACL(ctx context.Context, aclID string, opts ACLUpdateOpts) (ACL, error)

UpdateACL updates an existing acl.

func (*API) UpdateDatabase

func (api *API) UpdateDatabase(ctx context.Context, databaseID string, opts DatabaseUpdateOpts) (Database, error)

UpdateDatabase updates an existing database.

func (*API) UpdateDatastore

func (api *API) UpdateDatastore(ctx context.Context, datastoreID string, opts DatastoreUpdateOpts) (Datastore, error)

UpdateDatastore updates an existing datastore.

func (*API) UpdatePrometheusMetricToken added in v0.3.0

func (api *API) UpdatePrometheusMetricToken(
	ctx context.Context,
	prometheusMetricTokenID string,
	opts PrometheusMetricTokenUpdateOpts,
) (PrometheusMetricToken, error)

UpdatePrometheusMetricToken updates an existing token.

func (*API) UpdateTopic added in v0.10.0

func (api *API) UpdateTopic(ctx context.Context, topicID string, opts TopicUpdateOpts) (Topic, error)

UpdateTopic updates an existing topic.

func (*API) UpdateUser

func (api *API) UpdateUser(ctx context.Context, userID string, opts UserUpdateOpts) (User, error)

UpdateUser updates an existing user.

func (*API) User

func (api *API) User(ctx context.Context, userID string) (User, error)

User returns a user based on the ID.

func (*API) Users

func (api *API) Users(ctx context.Context) ([]User, error)

Users returns all users.

type AvailableExtension

type AvailableExtension struct {
	ID               string   `json:"id"`
	Name             string   `json:"name"`
	DatastoreTypeIDs []string `json:"datastore_type_ids"`
	DependencyIDs    []string `json:"dependency_ids"`
}

AvailableExtension is the API response for the available extensions.

type ConfigurationParameter added in v0.2.0

type ConfigurationParameter struct {
	ID                string        `json:"id"`
	DatastoreTypeID   string        `json:"datastore_type_id"`
	Name              string        `json:"name"`
	Type              string        `json:"type"`
	Unit              string        `json:"unit"`
	Min               interface{}   `json:"min"`
	Max               interface{}   `json:"max"`
	DefaultValue      interface{}   `json:"default_value"`
	Choices           []interface{} `json:"choices"`
	InvalidValues     []interface{} `json:"invalid_values"`
	IsRestartRequired bool          `json:"is_restart_required"`
	IsChangeable      bool          `json:"is_changeable"`
}

ConfigurationParameter is the API response for the configuration parameters.

type DBaaSAPIError

type DBaaSAPIError struct {
	APIError struct {
		Message string `json:"message"`
		Title   string `json:"title"`
		Code    int    `json:"code"`
	} `json:"error"`
}

DBaaSAPIError is a type of an error raised by API calls made by this library.

func (DBaaSAPIError) Error

func (e DBaaSAPIError) Error() string

Error returns string representation of the error.

func (DBaaSAPIError) StatusCode

func (e DBaaSAPIError) StatusCode() int

StatusCode returns the HTTP status from the error response.

type Database

type Database struct {
	ID          string `json:"id"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
	ProjectID   string `json:"project_id"`
	Name        string `json:"name"`
	OwnerID     string `json:"owner_id"`
	LcCollate   string `json:"lc_collate"`
	LcCtype     string `json:"lc_ctype"`
	DatastoreID string `json:"datastore_id"`
	Status      Status `json:"status"`
}

Database is the API response for the databases.

type DatabaseCreateOpts

type DatabaseCreateOpts struct {
	DatastoreID string `json:"datastore_id"`
	Name        string `json:"name"`
	OwnerID     string `json:"owner_id,omitempty"`
	LcCollate   string `json:"lc_collate,omitempty"`
	LcCtype     string `json:"lc_ctype,omitempty"`
}

DatabaseCreateOpts represents options for the database Create request.

type DatabaseQueryParams

type DatabaseQueryParams struct {
	ID          string `json:"id,omitempty"`
	ProjectID   string `json:"project_id,omitempty"`
	Name        string `json:"name,omitempty"`
	DatastoreID string `json:"datastore_id,omitempty"`
	Status      Status `json:"status,omitempty"`
}

DatabaseQueryParams represents available query parameters for database.

type DatabaseUpdateOpts

type DatabaseUpdateOpts struct {
	OwnerID string `json:"owner_id"`
}

DatabaseUpdateOpts represents options for the database Update request.

type Datastore

type Datastore struct {
	ID                  string                 `json:"id"`
	CreatedAt           string                 `json:"created_at"`
	UpdatedAt           string                 `json:"updated_at"`
	ProjectID           string                 `json:"project_id"`
	Name                string                 `json:"name"`
	TypeID              string                 `json:"type_id"`
	SubnetID            string                 `json:"subnet_id"`
	FlavorID            string                 `json:"flavor_id"`
	Status              Status                 `json:"status"`
	Connection          map[string]string      `json:"connection"`
	Firewall            []Firewall             `json:"firewall"`
	Instances           []Instances            `json:"instances"`
	Config              map[string]interface{} `json:"config"`
	Pooler              Pooler                 `json:"pooler"`
	Flavor              Flavor                 `json:"flavor"`
	NodeCount           int                    `json:"node_count"`
	Enabled             bool                   `json:"enabled"`
	AllowRestore        bool                   `json:"allow_restore"`
	IsMaintenance       bool                   `json:"is_maintenance"`
	IsProtected         bool                   `json:"is_protected"`
	BackupRetentionDays int                    `json:"backup_retention_days"`
}

Datastore is the API response for the datastores.

type DatastoreBackupsOpts added in v0.9.0

type DatastoreBackupsOpts struct {
	BackupRetentionDays int `json:"backup_retention_days"`
}

DatastoreBackupsOpts represents update options for the Datastore backups.

type DatastoreConfigOpts added in v0.2.0

type DatastoreConfigOpts struct {
	Config map[string]interface{} `json:"config"`
}

DatastoreConfigOpts represents options for the datastore's configuration parameters Update request.

type DatastoreCreateOpts

type DatastoreCreateOpts struct {
	Flavor              *Flavor                `json:"flavor,omitempty"`
	Restore             *Restore               `json:"restore,omitempty"`
	Pooler              *Pooler                `json:"pooler,omitempty"`
	FloatingIPs         *FloatingIPs           `json:"floating_ips,omitempty"`
	Config              map[string]interface{} `json:"config,omitempty"`
	Name                string                 `json:"name"`
	TypeID              string                 `json:"type_id"`
	SubnetID            string                 `json:"subnet_id"`
	FlavorID            string                 `json:"flavor_id,omitempty"`
	RedisPassword       string                 `json:"redis_password,omitempty"`
	NodeCount           int                    `json:"node_count"`
	BackupRetentionDays int                    `json:"backup_retention_days,omitempty"`
}

DatastoreCreateOpts represents options for the datastore Create request.

type DatastoreFirewallOpts

type DatastoreFirewallOpts struct {
	IPs []string `json:"ips"`
}

DatastoreFirewallOpts represents options for the datastore's firewall rules Update request.

type DatastorePasswordOpts added in v0.4.0

type DatastorePasswordOpts struct {
	RedisPassword string `json:"redis_password"`
}

DatastorePasswordOpts represents options for the Redis datastore's password Update request.

type DatastorePoolerOpts

type DatastorePoolerOpts struct {
	Mode string `json:"mode,omitempty"`
	Size int    `json:"size,omitempty"`
}

DatastorePoolerOpts represents options for the datastore's pooler Update request.

type DatastoreQueryParams

type DatastoreQueryParams struct {
	ID            string `json:"id,omitempty"`
	ProjectID     string `json:"project_id,omitempty"`
	Name          string `json:"name,omitempty"`
	Status        Status `json:"status,omitempty"`
	Enabled       string `json:"enabled,omitempty"`
	TypeID        string `json:"type_id,omitempty"`
	FlavorID      string `json:"flavor_id,omitempty"`
	SubnetID      string `json:"subnet_id,omitempty"`
	AllowRestore  bool   `json:"allow_restore,omitempty"`
	IsMaintenance bool   `json:"is_maintenance,omitempty"`
	IsProtected   bool   `json:"is_protected,omitempty"`
	Deleted       bool   `json:"deleted,omitempty"`
}

DatastoreQueryParams represents available query parameters for datastore.

type DatastoreResizeOpts

type DatastoreResizeOpts struct {
	Flavor    *Flavor `json:"flavor,omitempty"`
	FlavorID  string  `json:"flavor_id,omitempty"`
	NodeCount int     `json:"node_count,omitempty"`
}

DatastoreResizeOpts represents options for the datastore Resize request.

type DatastoreType

type DatastoreType struct {
	ID      string `json:"id"`
	Engine  string `json:"engine"`
	Version string `json:"version"`
}

DatastoreType is the API response for the datastore types.

type DatastoreUpdateOpts

type DatastoreUpdateOpts struct {
	Name string `json:"name"`
}

DatastoreUpdateOpts represents options for the datastore Update request.

type Extension

type Extension struct {
	ID                   string `json:"id"`
	ProjectID            string `json:"project_id"`
	AvailableExtensionID string `json:"available_extension_id"`
	CreatedAt            string `json:"created_at"`
	UpdatedAt            string `json:"updated_at"`
	DatastoreID          string `json:"datastore_id"`
	DatabaseID           string `json:"database_id"`
	Status               Status `json:"status"`
}

Extension is the API response for the extension.

type ExtensionCreateOpts

type ExtensionCreateOpts struct {
	AvailableExtensionID string `json:"available_extension_id"`
	DatastoreID          string `json:"datastore_id"`
	DatabaseID           string `json:"database_id"`
}

ExtensionCreateOpts represents options for the extension Create request.

type ExtensionQueryParams

type ExtensionQueryParams struct {
	ID                   string `json:"id,omitempty"`
	ProjectID            string `json:"project_id,omitempty"`
	AvailableExtensionID string `json:"available_extension_id,omitempty"`
	DatastoreID          string `json:"datastore_id,omitempty"`
	DatabaseID           string `json:"database_id,omitempty"`
	Status               Status `json:"status,omitempty"`
}

ExtensionQueryParams represents available query parameters for extension.

type Firewall

type Firewall struct {
	IP string `json:"ip"`
}

Firewall represents firewall rules parameters for datastore.

type Flavor

type Flavor struct {
	Vcpus int `json:"vcpus"`
	RAM   int `json:"ram"`
	Disk  int `json:"disk"`
}

Flavor represents datastore's flavor.

type FlavorResponse

type FlavorResponse struct {
	ID               string   `json:"id"`
	Name             string   `json:"name"`
	Description      string   `json:"description"`
	FlSize           string   `json:"fl_size"`
	DatastoreTypeIDs []string `json:"datastore_type_ids"`
	Vcpus            int      `json:"vcpus"`
	RAM              int      `json:"ram"`
	Disk             int      `json:"disk"`
}

FlavorResponse is the API response for the flavors.

type FloatingIPs added in v0.11.0

type FloatingIPs struct {
	Master  int `json:"master"`
	Replica int `json:"replica"`
}

FloatingIPs represents floating IPs creation schema.

type FloatingIPsOpts added in v0.12.0

type FloatingIPsOpts struct {
	InstanceID string `json:"instance_id"`
}

FloatingIPsOpts represents create|delete options for creating|deleting Floating IP in|from existed cluster.

type Grant

type Grant struct {
	ID          string `json:"id"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
	ProjectID   string `json:"project_id"`
	DatastoreID string `json:"datastore_id"`
	DatabaseID  string `json:"database_id"`
	UserID      string `json:"user_id"`
	Status      Status `json:"status"`
}

Grant is the API response for the grants.

type GrantCreateOpts

type GrantCreateOpts struct {
	DatastoreID string `json:"datastore_id"`
	DatabaseID  string `json:"database_id"`
	UserID      string `json:"user_id"`
}

GrantCreateOpts represents options for the grant Create request.

type Instances

type Instances struct {
	ID         string `json:"id"`
	IP         string `json:"ip"`
	FloatingIP string `json:"floating_ip"`
	Role       string `json:"role"`
	Status     Status `json:"status"`
	Hostname   string `json:"hostname"`
}

Instances represents datastore's instances.

type LogicalReplicationSlot added in v0.8.0

type LogicalReplicationSlot struct {
	ID          string `json:"id"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
	ProjectID   string `json:"project_id"`
	Name        string `json:"name"`
	DatastoreID string `json:"datastore_id"`
	DatabaseID  string `json:"database_id"`
	Status      Status `json:"status"`
}

LogicalReplicationSlot is the API response for the logical replication slot.

type LogicalReplicationSlotCreateOpts added in v0.8.0

type LogicalReplicationSlotCreateOpts struct {
	Name        string `json:"name"`
	DatastoreID string `json:"datastore_id"`
	DatabaseID  string `json:"database_id"`
}

type LogicalReplicationSlotQueryParams added in v0.8.0

type LogicalReplicationSlotQueryParams struct {
	ID          string `json:"id,omitempty"`
	ProjectID   string `json:"project_id,omitempty"`
	Name        string `json:"name,omitempty"`
	DatastoreID string `json:"datastore_id,omitempty"`
	DatabaseID  string `json:"database_id,omitempty"`
	Status      Status `json:"status,omitempty"`
}

type Pooler

type Pooler struct {
	Mode string `json:"mode,omitempty"`
	Size int    `json:"size,omitempty"`
}

Pooler represents pooler parameters for datastore.

type PrometheusMetricToken added in v0.3.0

type PrometheusMetricToken struct {
	ID        string `json:"id"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
	ProjectID string `json:"project_id"`
	Name      string `json:"name"`
	Value     string `json:"value"`
}

PrometheusMetricToken is the API response for the prometheus metrics tokens.

type PrometheusMetricTokenCreateOpts added in v0.3.0

type PrometheusMetricTokenCreateOpts struct {
	Name string `json:"name"`
}

PrometheusMetricTokenCreateOpts represents options for the prometheus metrics token Create request.

type PrometheusMetricTokenUpdateOpts added in v0.3.0

type PrometheusMetricTokenUpdateOpts struct {
	Name string `json:"name"`
}

PrometheusMetricTokenUpdateOpts represents options for the prometheus metrics token Update request.

type Restore

type Restore struct {
	DatastoreID string `json:"datastore_id,omitempty"`
	TargetTime  string `json:"target_time,omitempty"`
}

Restore represents restore parameters for datastore.

type Status

type Status string

Status represents custom type for various DBaaS objects statuses.

const (
	StatusActive        Status = "ACTIVE"
	StatusDeleted       Status = "DELETED"
	StatusDegraded      Status = "DEGRADED"
	StatusDiskFull      Status = "DISK_FULL"
	StatusError         Status = "ERROR"
	StatusPendingCreate Status = "PENDING_CREATE"
	StatusPendingUpdate Status = "PENDING_UPDATE"
	StatusPendingDelete Status = "PENDING_DELETE"
	StatusDown          Status = "DOWN"
	StatusResizing      Status = "RESIZING"
)

type Topic added in v0.10.0

type Topic struct {
	ID          string `json:"id"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
	ProjectID   string `json:"project_id"`
	DatastoreID string `json:"datastore_id"`
	Name        string `json:"name"`
	Status      Status `json:"status"`
	Partitions  uint16 `json:"partitions"`
}

Topic is the API response for the topics.

type TopicCreateOpts added in v0.10.0

type TopicCreateOpts struct {
	DatastoreID string `json:"datastore_id"`
	Name        string `json:"name"`
	Partitions  uint16 `json:"partitions"`
}

TopicCreateOpts represents options for the topic Create request.

type TopicQueryParams added in v0.10.0

type TopicQueryParams struct {
	ID          string `json:"id,omitempty"`
	ProjectID   string `json:"project_id,omitempty"`
	DatastoreID string `json:"datastore_id,omitempty"`
	Name        string `json:"name,omitempty"`
	Status      Status `json:"status,omitempty"`
}

TopicQueryParams represents available query parameters for the topic.

type TopicUpdateOpts added in v0.10.0

type TopicUpdateOpts struct {
	Partitions uint16 `json:"partitions"`
}

TopicUpdateOpts represents options for the topic Update request.

type User

type User struct {
	ID          string `json:"id"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
	ProjectID   string `json:"project_id"`
	DatastoreID string `json:"datastore_id"`
	Name        string `json:"name"`
	Status      Status `json:"status"`
}

User is the API response for the users.

type UserCreateOpts

type UserCreateOpts struct {
	Name        string `json:"name"`
	Password    string `json:"password"`
	DatastoreID string `json:"datastore_id"`
}

UserCreateOpts represents options for the user Create request.

type UserUpdateOpts

type UserUpdateOpts struct {
	Password string `json:"password"`
}

UserUpdateOpts represents options for the user Update request.

Jump to

Keyboard shortcuts

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