sshkey

package
v0.5.16 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package sshkey manages SSH keys for organizations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*otfhttp.Client
}

Client is an HTTP client for the SSH key API, used by agent runners.

func (*Client) GetPrivateKey

func (c *Client) GetPrivateKey(ctx context.Context, id resource.TfeID) ([]byte, error)

type CreateOptions

type CreateOptions struct {
	Organization organization.Name `schema:"organization_name"`
	Name         string
	PrivateKey   string `schema:"private-key"`
}

CreateOptions are the options for creating a new SSH key.

type Options

type Options struct {
	*sql.DB
	*tfeapi.Responder
	logr.Logger

	Authorizer *authz.Authorizer
}

type SSHKey

type SSHKey struct {
	ID           resource.TfeID    `db:"ssh_key_id"`
	Name         string            `db:"name"`
	Organization organization.Name `db:"organization_name"`
}

SSHKey is an SSH key belonging to an organization.

func New

func New(opts CreateOptions) (*SSHKey, []byte, error)

func (*SSHKey) LogValue

func (key *SSHKey) LogValue() slog.Value

LogValue implements slog.LogValuer.

type Service

type Service struct {
	logr.Logger
	*authz.Authorizer
	// contains filtered or unexported fields
}

func NewService

func NewService(opts Options) *Service

func (*Service) AddHandlers

func (s *Service) AddHandlers(r *mux.Router)

func (*Service) Create

func (s *Service) Create(ctx context.Context, opts CreateOptions) (*SSHKey, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id resource.TfeID) (*SSHKey, error)

func (*Service) Get

func (s *Service) Get(ctx context.Context, id resource.TfeID) (*SSHKey, error)

func (*Service) GetPrivateKey

func (s *Service) GetPrivateKey(ctx context.Context, id resource.TfeID) ([]byte, error)

func (*Service) List

func (s *Service) List(ctx context.Context, org organization.Name) ([]*SSHKey, error)

func (*Service) Update

func (s *Service) Update(ctx context.Context, id resource.TfeID, opts UpdateOptions) (*SSHKey, error)

type TFESSHKey

type TFESSHKey struct {
	ID        resource.TfeID `jsonapi:"primary,ssh-keys"`
	CreatedAt time.Time      `jsonapi:"attribute" json:"created-at"`
	UpdatedAt time.Time      `jsonapi:"attribute" json:"updated-at"`
	Name      string         `jsonapi:"attribute" json:"name"`
}

TFESSHKey represents an SSH key in the TFE API.

type UpdateOptions

type UpdateOptions struct {
	Name *string
}

UpdateOptions are the options for updating an SSH key.

Jump to

Keyboard shortcuts

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