server

package
v1.16.6 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

README

Server

Purpose

pkg/handler/server handles compute-server lifecycle.

It contains both deprecated v1 paths and the preferred v2 model, but the package is worth documenting separately because server handling is richer than basic CRUD:

  • create/update/delete
  • power operations
  • console access
  • snapshot creation
  • stronger validation of referenced resources

In v2, server context is primarily inferred from the selected network and related dependencies rather than from nested path scope.

Distinctive Behaviour

  • v1 servers are nested more explicitly under identity paths
  • v2 servers are network-linked resources with direct ID-based access
  • create/update validate referenced image existence through the provider layer
  • create/update can validate and bind an SSH certificate authority
  • snapshot creation bridges server lifecycle into image provenance semantics
  • snapshot creation is also a cross-resource permission bridge: the caller must already be able to see the server and also be allowed to create images in the owning organization
  • the package exposes operational verbs:
    • start
    • stop
    • soft reboot
    • hard reboot
    • console output/session
  • server-name uniqueness is enforced per network to avoid aliasing cloud-side host identity

Invariants And Guard Rails

  • v2 is the intended model; v1 is compatibility surface only.
  • direct v2 object access is gated to resources labeled with ResourceAPIVersionLabel=2.
  • A Server v2 is owned by its network for cascading deletion.
  • User data and SSH certificate authority combinations are validated together to avoid unsupported managed-userdata states.
  • Power-operation errors are translated carefully from provider conflict/not-found states into user-facing API semantics.

Caveats

  • This package is partly CRUD handler and partly operational façade over the provider compute API.
  • Snapshot behaviour is coupled to image provenance and ownership semantics, so server is not fully self-contained as a lifecycle concept.
  • Some semantics, such as managed user-data validation for SSH CA use, are important but narrow enough that they should stay local to this package.

TODO

  • Delete the deprecated v1 handler surface once migration is complete.

Cross-Package Context

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	common.ClientArgs
}

Client provides a restful API for identities.

func NewClient

func NewClient(clientArgs common.ClientArgs) *Client

New creates a new client.

func (*Client) Create

func (c *Client) Create(ctx context.Context, organizationID, projectID, identityID string, request *openapi.ServerWrite) (*openapi.ServerRead, error)

Create instantiates a new resource.

func (*Client) CreateConsoleSession added in v1.8.0

func (c *Client) CreateConsoleSession(ctx context.Context, organizationID, projectID, identityID, serverID string) (*openapi.ConsoleSessionResponse, error)

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, organizationID, projectID, serverID string) error

Delete a resource.

func (*Client) Get

func (c *Client) Get(ctx context.Context, organizationID, projectID, serverID string) (*openapi.ServerRead, error)

Get a resource.

func (*Client) GetConsoleOutput added in v1.8.0

func (*Client) List

List returns an ordered list of all resources in scope.

func (*Client) Reboot added in v1.7.0

func (c *Client) Reboot(ctx context.Context, organizationID, projectID, identityID, serverID string, hard bool) error

func (*Client) Start added in v1.7.0

func (c *Client) Start(ctx context.Context, organizationID, projectID, identityID, serverID string) error

func (*Client) Stop added in v1.7.0

func (c *Client) Stop(ctx context.Context, organizationID, projectID, identityID, serverID string) error

func (*Client) Update added in v1.2.0

func (c *Client) Update(ctx context.Context, organizationID, projectID, identityID, serverID string, request *openapi.ServerWrite) (*openapi.ServerRead, error)

Update a resource.

type ClientV2 added in v1.13.0

type ClientV2 struct {
	*Client
}

func NewClientV2 added in v1.13.0

func NewClientV2(clientArgs common.ClientArgs) *ClientV2

func (*ClientV2) ConsoleOutputV2 added in v1.13.0

func (*ClientV2) ConsoleSessionV2 added in v1.13.0

func (c *ClientV2) ConsoleSessionV2(ctx context.Context, serverID string) (*openapi.ConsoleSessionResponse, error)

func (*ClientV2) CreateV2 added in v1.13.0

func (c *ClientV2) CreateV2(ctx context.Context, request *openapi.ServerV2Create) (*openapi.ServerV2Read, error)

func (*ClientV2) CreateV2Snapshot added in v1.13.0

func (c *ClientV2) CreateV2Snapshot(ctx context.Context, serverID string, request *openapi.SnapshotCreate) (*openapi.ImageResponse, error)

func (*ClientV2) DeleteV2 added in v1.13.0

func (c *ClientV2) DeleteV2(ctx context.Context, serverID string) error

func (*ClientV2) GetV2 added in v1.13.0

func (c *ClientV2) GetV2(ctx context.Context, serverID string) (*openapi.ServerV2Read, error)

func (*ClientV2) GetV2Raw added in v1.13.0

func (c *ClientV2) GetV2Raw(ctx context.Context, serverID string) (*regionv1.Server, error)

func (*ClientV2) ListV2 added in v1.13.0

func (*ClientV2) RebootV2 added in v1.13.0

func (c *ClientV2) RebootV2(ctx context.Context, serverID string, hard bool) error

func (*ClientV2) SSHKey added in v1.13.0

func (c *ClientV2) SSHKey(ctx context.Context, serverID string) (*openapi.SshKey, error)

func (*ClientV2) StartV2 added in v1.13.0

func (c *ClientV2) StartV2(ctx context.Context, serverID string) error

func (*ClientV2) StopV2 added in v1.13.0

func (c *ClientV2) StopV2(ctx context.Context, serverID string) error

func (*ClientV2) UpdateV2 added in v1.13.0

func (c *ClientV2) UpdateV2(ctx context.Context, serverID string, request *openapi.ServerV2Update) (*openapi.ServerV2Read, error)

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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