user

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: 7 Imported by: 0

Documentation

Overview

Package user provides access to the `/cloud/ssh/user` 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"`
	Username       string   `url:"username"`
	Password       string   `url:"password,omitempty"`
	Containers     []string `url:"containers[],omitempty"`
	SSHKeys        []string `url:"ssh_keys[],omitempty"`
	ReadOnlyConfig bool     `url:"read_only_config,omitempty"`
	Volumes        []string `url:"read_only_config,omitempty"`
}

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 an ssh/sftp user.

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 UpdateResponse, err error)

Add creates a new SSH user.

func (*Client) Delete

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

Delete an existing SSH user.

func (*Client) Get

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

Get fetches a cloud image.

func (*Client) List

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

List a list of all SSH users.

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"`
	Username   string `url:"username"`
}

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 for deleting a ssh/sftp user.

type GetRequest

type GetRequest struct {
	ServerName string `url:"server_name"`
	Username   string `url:"username"`
}

GetRequest a request to delete the database.

type GetResponse

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

GetResponse represents the return from the /cloud/ssh/user/get.json endpoint.

type ListOptions

type ListOptions struct {
	ServerName string `url:"filters[server_name],omitempty"`
	Username   string `url:"filters[username],omitempty"`
	Container  string `url:"filters[container],omitempty"`
	models.Filtering
}

ListOptions are options for filtering/listing users.

type ListResponse

type ListResponse struct {
	Return struct {
		models.Pagination
		Users []models.User `json:"data"`
	}
	models.APIResponse
}

ListResponse represents the return from the /cloud/ssh/user/list_all.json endpoint.

type UpdateRequest

type UpdateRequest struct {
	ServerName     string   `url:"server_name"`
	Username       string   `url:"username"`
	Password       string   `url:"params[password],omitempty"`
	Containers     []string `url:"params[containers][],omitempty"`
	Volumes        []string `url:"params[volumes][],omitempty"`
	SSHKeys        []string `url:"params[ssh_keys][],omitempty"`
	ReadOnlyConfig bool     `url:"params[read_only_config],omitempty"`
}

UpdateRequest is a request to the update endpoint.

type UpdateResponse

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

UpdateResponse is the return for updating an ssh/sftp user.

Jump to

Keyboard shortcuts

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