db

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package db provides access to the `/cloud/db` API endpoint.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddRequest

type AddRequest struct {
	ServerName string `url:"server_name"`
	MySQLHost  string `url:"mysql_host"`
	Database   string `url:"database"`
	Container  string `url:"container"`
}

AddRequest adds/creates a new database on the given cloud server.

type AddResponse

type AddResponse struct {
	Return struct {
		JobID string `json:"job_id"`
	} `json:"return"`
	models.APIResponse
}

AddResponse is the return for adding a cloud database.

type Client

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

Client is a Service to work with API Jobs.

func New

func New(c *api.Client) *Client

New is an initialisation function.

func (*Client) Add

func (s *Client) Add(ctx context.Context, request AddRequest) (response AddResponse, err error)

Add creates a new cloud database.

func (*Client) Delete

func (s *Client) Delete(ctx context.Context, request DeleteRequest) (response DeleteResponse, err error)

Delete deletes a cloud database.

func (*Client) Get

func (s *Client) Get(ctx context.Context, request GetRequest) (response GetResponse, err error)

Get fetches a cloud db.

func (*Client) List

func (s *Client) List(ctx context.Context, opt ListOptions) (response ListResponse, err error)

List returns a list of cloud databases, specific to the customer.

func (*Client) Update

func (s *Client) Update(ctx context.Context, request UpdateRequest) (response UpdateResponse, err error)

Update updates the database's backup location.

type DeleteRequest

type DeleteRequest struct {
	ServerName string `url:"server_name"`
	MySQLHost  string `url:"mysql_host"`
	Database   string `url:"database"`
}

DeleteRequest a request to delete the database.

type DeleteResponse

type DeleteResponse struct {
	Return struct {
		JobID string `json:"job_id"`
	} `json:"return"`
	models.APIResponse
}

DeleteResponse is the return from deleting.

type GetRequest

type GetRequest struct {
	ServerName string `json:"server_name"`
	MySQLHost  string `json:"mysql_host"`
	Database   string `json:"database"`
}

GetRequest is for getting a single database.

type GetResponse

type GetResponse struct {
	Database models.Database `json:"return"`
	models.APIResponse
}

GetResponse is the return value from a get request.

type ListOptions

type ListOptions struct {
	ServerName string `url:"filters[server_name],omitempty"`
	MySQLHost  string `url:"filters[mysql_host],omitempty"`
	Database   string `url:"filters[db_name],omitempty"`

	models.Filtering
}

ListOptions are options for filtering/listing databases.

type ListResponse

type ListResponse struct {
	Return struct {
		Databases []models.Database `json:"data"`
		models.Pagination
	} `json:"return"`
	models.APIResponse
}

ListResponse is the returned response from the List endpoint.

type UpdateRequest

type UpdateRequest struct {
	ServerName string `url:"server_name"`
	MySQLHost  string `url:"mysql_host"`
	Database   string `url:"database"`
	Container  string `url:"params[container]'"`
}

UpdateRequest is a request to the update endpoint, it only changes the backup container.

type UpdateResponse

type UpdateResponse struct {
	models.APIResponse
}

UpdateResponse is the response from updating a database.

Directories

Path Synopsis
Package grant is used for interacting with the SiteHost `/cloud/db/grant` API endpoint.
Package grant is used for interacting with the SiteHost `/cloud/db/grant` API endpoint.
Package user represents the SiteHost `/cloud/db/user` API endpoint.
Package user represents the SiteHost `/cloud/db/user` API endpoint.

Jump to

Keyboard shortcuts

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