apiv1

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RepositoryRegex = "^(artifacts/ostree/[a-z0-9]+(?:[/._-][a-z0-9]+)*)$"
	URLPath         = "/artifacts/ostree/api/v1"
)

Variables

This section is empty.

Functions

func MakeEndpointOfAddRemote

func MakeEndpointOfAddRemote(s OSTree) endpoint.Endpoint

MakeEndpointOfAddRemote creates the endpoint for s.AddRemote.

func MakeEndpointOfCreateRepository

func MakeEndpointOfCreateRepository(s OSTree) endpoint.Endpoint

MakeEndpointOfCreateRepository creates the endpoint for s.CreateRepository.

func MakeEndpointOfDeleteRemote added in v0.0.22

func MakeEndpointOfDeleteRemote(s OSTree) endpoint.Endpoint

MakeEndpointOfDeleteRemote creates the endpoint for s.DeleteRemote.

func MakeEndpointOfDeleteRepository

func MakeEndpointOfDeleteRepository(s OSTree) endpoint.Endpoint

MakeEndpointOfDeleteRepository creates the endpoint for s.DeleteRepository.

func MakeEndpointOfGetRepositorySyncStatus

func MakeEndpointOfGetRepositorySyncStatus(s OSTree) endpoint.Endpoint

MakeEndpointOfGetRepositorySyncStatus creates the endpoint for s.GetRepositorySyncStatus.

func MakeEndpointOfListRepositoryRefs added in v0.0.25

func MakeEndpointOfListRepositoryRefs(s OSTree) endpoint.Endpoint

MakeEndpointOfListRepositoryRefs creates the endpoint for s.ListRepositoryRefs.

func MakeEndpointOfSyncRepository

func MakeEndpointOfSyncRepository(s OSTree) endpoint.Endpoint

MakeEndpointOfSyncRepository creates the endpoint for s.SyncRepository.

func MakeEndpointOfUpdateRemote added in v0.0.22

func MakeEndpointOfUpdateRemote(s OSTree) endpoint.Endpoint

MakeEndpointOfUpdateRemote creates the endpoint for s.UpdateRemote.

func NewHTTPRouter

func NewHTTPRouter(svc OSTree, codecs httpcodec.Codecs, opts ...httpoption.Option) chi.Router

func OASv2APIDoc

func OASv2APIDoc(schema oas2.Schema) string

func RepositoryMatch

func RepositoryMatch(repository string) bool

func ValidateAddRemoteRequest

func ValidateAddRemoteRequest(newSchema func(*AddRemoteRequest) validating.Schema) httpoption.Validator

ValidateAddRemoteRequest creates a validator for AddRemoteRequest.

func ValidateCreateRepositoryRequest

func ValidateCreateRepositoryRequest(newSchema func(*CreateRepositoryRequest) validating.Schema) httpoption.Validator

ValidateCreateRepositoryRequest creates a validator for CreateRepositoryRequest.

func ValidateDeleteRemoteRequest added in v0.0.22

func ValidateDeleteRemoteRequest(newSchema func(*DeleteRemoteRequest) validating.Schema) httpoption.Validator

ValidateDeleteRemoteRequest creates a validator for DeleteRemoteRequest.

func ValidateDeleteRepositoryRequest

func ValidateDeleteRepositoryRequest(newSchema func(*DeleteRepositoryRequest) validating.Schema) httpoption.Validator

ValidateDeleteRepositoryRequest creates a validator for DeleteRepositoryRequest.

func ValidateGetRepositorySyncStatusRequest

func ValidateGetRepositorySyncStatusRequest(newSchema func(*GetRepositorySyncStatusRequest) validating.Schema) httpoption.Validator

ValidateGetRepositorySyncStatusRequest creates a validator for GetRepositorySyncStatusRequest.

func ValidateListRepositoryRefsRequest added in v0.0.25

func ValidateListRepositoryRefsRequest(newSchema func(*ListRepositoryRefsRequest) validating.Schema) httpoption.Validator

ValidateListRepositoryRefsRequest creates a validator for ListRepositoryRefsRequest.

func ValidateSyncRepositoryRequest

func ValidateSyncRepositoryRequest(newSchema func(*SyncRepositoryRequest) validating.Schema) httpoption.Validator

ValidateSyncRepositoryRequest creates a validator for SyncRepositoryRequest.

func ValidateUpdateRemoteRequest added in v0.0.22

func ValidateUpdateRemoteRequest(newSchema func(*UpdateRemoteRequest) validating.Schema) httpoption.Validator

ValidateUpdateRemoteRequest creates a validator for UpdateRemoteRequest.

Types

type AddRemoteRequest

type AddRemoteRequest struct {
	Repository string                  `json:"repository"`
	Properties *OSTreeRemoteProperties `json:"properties"`
}

type AddRemoteResponse

type AddRemoteResponse struct {
	Err error `json:"-"`
}

func (*AddRemoteResponse) Body

func (r *AddRemoteResponse) Body() interface{}

func (*AddRemoteResponse) Failed

func (r *AddRemoteResponse) Failed() error

Failed implements endpoint.Failer.

type CreateRepositoryRequest

type CreateRepositoryRequest struct {
	Repository string                      `json:"repository"`
	Properties *OSTreeRepositoryProperties `json:"properties"`
}

type CreateRepositoryResponse

type CreateRepositoryResponse struct {
	Err error `json:"-"`
}

func (*CreateRepositoryResponse) Body

func (r *CreateRepositoryResponse) Body() interface{}

func (*CreateRepositoryResponse) Failed

func (r *CreateRepositoryResponse) Failed() error

Failed implements endpoint.Failer.

type DeleteRemoteRequest added in v0.0.22

type DeleteRemoteRequest struct {
	Repository string `json:"repository"`
	RemoteName string `json:"remote_name"`
}

type DeleteRemoteResponse added in v0.0.22

type DeleteRemoteResponse struct {
	Err error `json:"-"`
}

func (*DeleteRemoteResponse) Body added in v0.0.22

func (r *DeleteRemoteResponse) Body() interface{}

func (*DeleteRemoteResponse) Failed added in v0.0.22

func (r *DeleteRemoteResponse) Failed() error

Failed implements endpoint.Failer.

type DeleteRepositoryRequest

type DeleteRepositoryRequest struct {
	Repository string `json:"repository"`
}

type DeleteRepositoryResponse

type DeleteRepositoryResponse struct {
	Err error `json:"-"`
}

func (*DeleteRepositoryResponse) Body

func (r *DeleteRepositoryResponse) Body() interface{}

func (*DeleteRepositoryResponse) Failed

func (r *DeleteRepositoryResponse) Failed() error

Failed implements endpoint.Failer.

type GetRepositorySyncStatusRequest

type GetRepositorySyncStatusRequest struct {
	Repository string `json:"repository"`
}

type GetRepositorySyncStatusResponse

type GetRepositorySyncStatusResponse struct {
	SyncStatus *SyncStatus `json:"sync_status"`
	Err        error       `json:"-"`
}

func (*GetRepositorySyncStatusResponse) Body

func (r *GetRepositorySyncStatusResponse) Body() interface{}

func (*GetRepositorySyncStatusResponse) Failed

Failed implements endpoint.Failer.

type HTTPClient

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

func NewHTTPClient

func NewHTTPClient(codecs httpcodec.Codecs, httpClient *http.Client, baseURL string) (*HTTPClient, error)

func (*HTTPClient) AddRemote

func (c *HTTPClient) AddRemote(ctx context.Context, repository string, properties *OSTreeRemoteProperties) (err error)

func (*HTTPClient) CreateRepository

func (c *HTTPClient) CreateRepository(ctx context.Context, repository string, properties *OSTreeRepositoryProperties) (err error)

func (*HTTPClient) DeleteRemote added in v0.0.22

func (c *HTTPClient) DeleteRemote(ctx context.Context, repository string, remoteName string) (err error)

func (*HTTPClient) DeleteRepository

func (c *HTTPClient) DeleteRepository(ctx context.Context, repository string) (err error)

func (*HTTPClient) GetRepositorySyncStatus

func (c *HTTPClient) GetRepositorySyncStatus(ctx context.Context, repository string) (syncStatus *SyncStatus, err error)

func (*HTTPClient) ListRepositoryRefs added in v0.0.25

func (c *HTTPClient) ListRepositoryRefs(ctx context.Context, repository string) (refs []OSTreeRef, err error)

func (*HTTPClient) SyncRepository

func (c *HTTPClient) SyncRepository(ctx context.Context, repository string, properties *OSTreeRepositorySyncRequest) (err error)

func (*HTTPClient) UpdateRemote added in v0.0.22

func (c *HTTPClient) UpdateRemote(ctx context.Context, repository string, remoteName string, properties *OSTreeRemoteProperties) (err error)

type ListRepositoryRefsRequest added in v0.0.25

type ListRepositoryRefsRequest struct {
	Repository string `json:"repository"`
}

type ListRepositoryRefsResponse added in v0.0.25

type ListRepositoryRefsResponse struct {
	Refs []OSTreeRef `json:"refs"`
	Err  error       `json:"-"`
}

func (*ListRepositoryRefsResponse) Body added in v0.0.25

func (r *ListRepositoryRefsResponse) Body() interface{}

func (*ListRepositoryRefsResponse) Failed added in v0.0.25

func (r *ListRepositoryRefsResponse) Failed() error

Failed implements endpoint.Failer.

type OSTree

type OSTree interface {
	// Create an OSTree repository.
	//kun:op POST /repository
	//kun:success statusCode=200
	CreateRepository(ctx context.Context, repository string, properties *OSTreeRepositoryProperties) (err error)

	// Delete a OSTree repository.
	//kun:op DELETE /repository
	//kun:success statusCode=202
	DeleteRepository(ctx context.Context, repository string) (err error)

	// List OSTree repository refs (A.K.A. Branches).
	//kun:op GET /repository/refs
	//kun:success statusCode=200
	ListRepositoryRefs(ctx context.Context, repository string) (refs []OSTreeRef, err error)

	// Add a new remote to the OSTree repository.
	//kun:op POST /repository/remote
	//kun:success statusCode=200
	AddRemote(ctx context.Context, repository string, properties *OSTreeRemoteProperties) (err error)

	// Updates a remote in the OSTree repository. If it doesn't exist it will be created.
	//kun:op PUT /repository/remote
	//kun:success statusCode=200
	UpdateRemote(ctx context.Context, repository string, remoteName string, properties *OSTreeRemoteProperties) (err error)

	// Delete an existing remote to the OSTree repository.
	//kun:op DELETE /repository/remote
	//kun:success statusCode=200
	DeleteRemote(ctx context.Context, repository string, remoteName string) (err error)

	// Sync an ostree repository with one of the configured remotes.
	//kun:op POST /repository/sync
	//kun:success statusCode=202
	SyncRepository(ctx context.Context, repository string, properties *OSTreeRepositorySyncRequest) (err error)

	// Get OSTree repository sync status.
	//kun:op GET /repository/sync
	//kun:success statusCode=200
	GetRepositorySyncStatus(ctx context.Context, repository string) (syncStatus *SyncStatus, err error)
}

OSTree is used for managing ostree repositories. This is the API documentation of OSTree.

type OSTreeRef added in v0.0.25

type OSTreeRef struct {
	// Name - The name of the ref.
	Name string `json:"name"`

	// Commit - The commit hash of the ref.
	Commit string `json:"commit"`
}

type OSTreeRemoteProperties

type OSTreeRemoteProperties struct {
	// Name - The name of the remote repository.
	Name string `json:"name"`

	// RemoteURL - The http url of the remote repository.
	RemoteURL string `json:"remote_url"`

	// GPGVerify - Whether to verify the GPG signature of the repository.
	NoGPGVerify bool `json:"no_gpg_verify"`
}

type OSTreeRepositoryProperties

type OSTreeRepositoryProperties struct {
	// Remotes - The remote repositories to mirror.
	Remotes []OSTreeRemoteProperties `json:"remotes"`
}

type OSTreeRepositorySyncRequest

type OSTreeRepositorySyncRequest struct {
	// Remote - The name of the remote to sync.
	// Remote and EphemeralRemote are mutually exclusive. EphemeralRemote takes precedence.
	Remote string `json:"remote"`

	// EphemeralRemote - A remote to add to the repository in Beskar for the duration of the sync.
	// Remote and EphemeralRemote are mutually exclusive. EphemeralRemote takes precedence.
	EphemeralRemote *OSTreeRemoteProperties `json:"ephemeral_remote"`

	// Refs - The branches/refs to mirror. Leave empty to mirror all branches/refs.
	Refs []string `json:"refs"`

	// Depth - The depth of the mirror. Defaults is 0, -1 means infinite.
	Depth int `json:"depth"`

	// Timeout - The timeout for the sync in seconds. Default is 1 hour.
	Timeout *durationpb.Duration `json:"timeout"`
}

type Page

type Page struct {
	Size  int
	Token string
}

type SyncRepositoryRequest

type SyncRepositoryRequest struct {
	Repository string                       `json:"repository"`
	Properties *OSTreeRepositorySyncRequest `json:"properties"`
}

type SyncRepositoryResponse

type SyncRepositoryResponse struct {
	Err error `json:"-"`
}

func (*SyncRepositoryResponse) Body

func (r *SyncRepositoryResponse) Body() interface{}

func (*SyncRepositoryResponse) Failed

func (r *SyncRepositoryResponse) Failed() error

Failed implements endpoint.Failer.

type SyncStatus

type SyncStatus struct {
	Syncing    bool        `json:"syncing"`
	StartTime  string      `json:"start_time"`
	EndTime    string      `json:"end_time"`
	SyncError  string      `json:"sync_error"`
	SyncedRefs []OSTreeRef `json:"synced_refs"`
}

Mirror sync status.

type UpdateRemoteRequest added in v0.0.22

type UpdateRemoteRequest struct {
	Repository string                  `json:"repository"`
	RemoteName string                  `json:"remote_name"`
	Properties *OSTreeRemoteProperties `json:"properties"`
}

type UpdateRemoteResponse added in v0.0.22

type UpdateRemoteResponse struct {
	Err error `json:"-"`
}

func (*UpdateRemoteResponse) Body added in v0.0.22

func (r *UpdateRemoteResponse) Body() interface{}

func (*UpdateRemoteResponse) Failed added in v0.0.22

func (r *UpdateRemoteResponse) Failed() error

Failed implements endpoint.Failer.

Jump to

Keyboard shortcuts

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