registryv1alpha1api

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminService added in v1.0.0

type AdminService interface {
	// ForceDeleteUser forces to delete a user. Resources and organizations that are
	// solely owned by the user will also be deleted.
	ForceDeleteUser(
		ctx context.Context,
		userId string,
	) (user *v1alpha1.User, organizations []*v1alpha1.Organization, repositories []*v1alpha1.Repository, plugins []*v1alpha1.Plugin, templates []*v1alpha1.Template, err error)
}

AdminService is the Admin service.

type AuthnService

type AuthnService interface {
	// GetCurrentUser gets information associated with the current user.
	//
	// The user's ID is retrieved from the request's authentication header.
	GetCurrentUser(ctx context.Context) (user *v1alpha1.User, err error)
	// GetCurrentUserSubject gets the currently logged in users subject.
	//
	// The user's ID is retrieved from the request's authentication header.
	GetCurrentUserSubject(ctx context.Context) (subject string, err error)
}

AuthnService supplies authenication helpers.

type AuthzService

type AuthzService interface {
	// UserCanCreateOrganizationRepository returns whether the user is authorized
	// to create repositories in an organization.
	UserCanCreateOrganizationRepository(ctx context.Context, organizationId string) (authorized bool, err error)
	// UserCanSeeRepositorySettings returns whether the user is authorized
	// to see repository settings.
	UserCanSeeRepositorySettings(ctx context.Context, repositoryId string) (authorized bool, err error)
	// UserCanSeeOrganizationSettings returns whether the user is authorized
	// to see organization settings.
	UserCanSeeOrganizationSettings(ctx context.Context, organizationId string) (authorized bool, err error)
	// UserCanReadPlugin returns whether the user has read access to the specified plugin.
	UserCanReadPlugin(
		ctx context.Context,
		owner string,
		name string,
	) (authorized bool, err error)
	// UserCanCreatePluginVersion returns whether the user is authorized
	// to create a plugin version under the specified plugin.
	UserCanCreatePluginVersion(
		ctx context.Context,
		owner string,
		name string,
	) (authorized bool, err error)
	// UserCanCreateTemplateVersion returns whether the user is authorized
	// to create a template version under the specified template.
	UserCanCreateTemplateVersion(
		ctx context.Context,
		owner string,
		name string,
	) (authorized bool, err error)
	// UserCanCreateOrganizationPlugin returns whether the user is authorized to create
	// a plugin in an organization.
	UserCanCreateOrganizationPlugin(ctx context.Context, organizationId string) (authorized bool, err error)
	// UserCanCreateOrganizationPlugin returns whether the user is authorized to create
	// a template in an organization.
	UserCanCreateOrganizationTemplate(ctx context.Context, organizationId string) (authorized bool, err error)
	// UserCanSeePluginSettings returns whether the user is authorized
	// to see plugin settings.
	UserCanSeePluginSettings(
		ctx context.Context,
		owner string,
		name string,
	) (authorized bool, err error)
	// UserCanSeeTemplateSettings returns whether the user is authorized
	// to see template settings.
	UserCanSeeTemplateSettings(
		ctx context.Context,
		owner string,
		name string,
	) (authorized bool, err error)
	// UserCanAddOrganizationMember returns whether the user is authorized to add
	// any members to the organization and the list of roles they can add.
	UserCanAddOrganizationMember(ctx context.Context, organizationId string) (authorizedRoles []v1alpha1.OrganizationRole, err error)
	// UserCanUpdateOrganizationMember returns whether the user is authorized to update
	// any members' membership information in the organization and the list of roles they can update.
	UserCanUpdateOrganizationMember(ctx context.Context, organizationId string) (authorizedRoles []v1alpha1.OrganizationRole, err error)
	// UserCanRemoveOrganizationMember returns whether the user is authorized to remove
	// any members from the organization and the list of roles they can remove.
	UserCanRemoveOrganizationMember(ctx context.Context, organizationId string) (authorizedRoles []v1alpha1.OrganizationRole, err error)
	// UserCanDeleteOrganization returns whether the user is authorized
	// to delete an organization.
	UserCanDeleteOrganization(ctx context.Context, organizationId string) (authorized bool, err error)
	// UserCanDeleteRepository returns whether the user is authorized
	// to delete a repository.
	UserCanDeleteRepository(ctx context.Context, repositoryId string) (authorized bool, err error)
	// UserCanDeleteTemplate returns whether the user is authorized
	// to delete a template.
	UserCanDeleteTemplate(ctx context.Context, templateId string) (authorized bool, err error)
	// UserCanDeletePlugin returns whether the user is authorized
	// to delete a plugin.
	UserCanDeletePlugin(ctx context.Context, pluginId string) (authorized bool, err error)
	// UserCanDeleteUser returns whether the user is authorized
	// to delete a user.
	UserCanDeleteUser(ctx context.Context) (authorized bool, err error)
	// UserCanSeeServerAdminPanel returns whether the user is authorized
	// to see server admin panel.
	UserCanSeeServerAdminPanel(ctx context.Context) (authorized bool, err error)
	// UserCanManageRepositoryContributors returns whether the user is authorized to manage
	// any contributors to the repository and the list of roles they can manage.
	UserCanManageRepositoryContributors(ctx context.Context, repositoryId string) (authorizedRoles []v1alpha1.RepositoryRole, err error)
	// UserCanManagePluginContributors returns whether the user is authorized to manage
	// any contributors to the plugin and the list of roles they can manage.
	UserCanManagePluginContributors(ctx context.Context, pluginId string) (authorizedRoles []v1alpha1.PluginRole, err error)
	// UserCanManageTemplateContributors returns whether the user is authorized to manage
	// any contributors to the template and the list of roles they can manage.
	UserCanManageTemplateContributors(ctx context.Context, templateId string) (authorizedRoles []v1alpha1.TemplateRole, err error)
}

AuthzService supplies authorization helpers.

type ConvertService added in v1.1.0

type ConvertService interface {
	// Convert converts a serialized message according to
	// the provided type name using an image.
	Convert(
		ctx context.Context,
		typeName string,
		image *v1.Image,
		payload []byte,
		requestFormat v1alpha1.ConvertFormat,
		responseFormat v1alpha1.ConvertFormat,
	) (payloadResponse []byte, err error)
}

ConvertService coverts serialized messages

type DisplayService added in v1.0.0

type DisplayService interface {
	// DisplayOrganizationElements returns which organization elements should be displayed to the user.
	DisplayOrganizationElements(
		ctx context.Context,
		organizationId string,
	) (createRepository bool, createPlugin bool, createTemplate bool, settings bool, updateSettings bool, delete bool, err error)
	// DisplayRepositoryElements returns which repository elements should be displayed to the user.
	DisplayRepositoryElements(
		ctx context.Context,
		repositoryId string,
	) (settings bool, delete bool, write bool, err error)
	// DisplayPluginElements returns which plugin elements should be displayed to the user.
	DisplayPluginElements(
		ctx context.Context,
		pluginId string,
	) (createVersion bool, settings bool, delete bool, err error)
	// DisplayTemplateElements returns which template elements should be displayed to the user.
	DisplayTemplateElements(
		ctx context.Context,
		templateId string,
	) (createVersion bool, settings bool, delete bool, err error)
	// DisplayUserElements returns which user elements should be displayed to the user.
	DisplayUserElements(ctx context.Context) (delete bool, err error)
	// DisplayServerElements returns which server elements should be displayed to the user.
	DisplayServerElements(ctx context.Context) (adminPanel bool, err error)
	// ListManageableRepositoryRoles returns which roles should be displayed
	// to the user when they are managing contributors on the repository.
	ListManageableRepositoryRoles(ctx context.Context, repositoryId string) (roles []v1alpha1.RepositoryRole, err error)
	// ListManageableUserRepositoryRoles returns which roles should be displayed
	// to the user when they are managing a specific contributor on the repository.
	ListManageableUserRepositoryRoles(
		ctx context.Context,
		repositoryId string,
		userId string,
	) (roles []v1alpha1.RepositoryRole, err error)
	// ListManageablePluginRoles returns which roles should be displayed
	// to the user when they are managing contributors on the plugin.
	ListManageablePluginRoles(ctx context.Context, pluginId string) (roles []v1alpha1.PluginRole, err error)
	// ListManageableUserPluginRoles returns which roles should be displayed
	// to the user when they are managing a specific contributor on the plugin.
	ListManageableUserPluginRoles(
		ctx context.Context,
		pluginId string,
		userId string,
	) (roles []v1alpha1.PluginRole, err error)
	// ListManageableTemplateRoles returns which roles should be displayed
	// to the user when they are managing contributors on the template.
	ListManageableTemplateRoles(ctx context.Context, templateId string) (roles []v1alpha1.TemplateRole, err error)
	// ListManageableUserTemplateRoles returns which roles should be displayed
	// to the user when they are managing a specific contributor on the template.
	ListManageableUserTemplateRoles(
		ctx context.Context,
		templateId string,
		userId string,
	) (roles []v1alpha1.TemplateRole, err error)
}

DisplayService provides information regarding UI element displaying based on the users roles.

type DocService

type DocService interface {
	// GetSourceDirectoryInfo retrieves the directory and file structure for the
	// given owner, repository and reference.
	//
	// The purpose of this is to get a representation of the file tree for a given
	// module to enable exploring the module by navigating through its contents.
	GetSourceDirectoryInfo(
		ctx context.Context,
		owner string,
		repository string,
		reference string,
	) (root *v1alpha1.FileInfo, err error)
	// GetSourceFile retrieves the source contents for the given owner, repository,
	// reference, and path.
	GetSourceFile(
		ctx context.Context,
		owner string,
		repository string,
		reference string,
		path string,
	) (content []byte, err error)
	// GetModulePackages retrieves the list of packages for the module based on the given
	// owner, repository, and reference.
	GetModulePackages(
		ctx context.Context,
		owner string,
		repository string,
		reference string,
	) (name string, modulePackages []*v1alpha1.ModulePackage, err error)
	// GetModuleDocumentation retrieves the documentation for module based on the given
	// owner, repository, and reference.
	GetModuleDocumentation(
		ctx context.Context,
		owner string,
		repository string,
		reference string,
	) (moduleDocumentation *v1alpha1.ModuleDocumentation, err error)
	// GetPackageDocumentation retrieves a a slice of documentation structures
	// for the given owner, repository, reference, and package name.
	GetPackageDocumentation(
		ctx context.Context,
		owner string,
		repository string,
		reference string,
		packageName string,
	) (packageDocumentation *v1alpha1.PackageDocumentation, err error)
}

DocService defines a set of APIs that are intended for use by bufwebd only. This is not intended for general use; changes and use cases are subject to executive approval.

type DownloadService

type DownloadService interface {
	// Download downloads.
	Download(
		ctx context.Context,
		owner string,
		repository string,
		reference string,
	) (module *v1alpha1.Module, err error)
}

DownloadService is the download service.

type GenerateService

type GenerateService interface {
	// GeneratePlugins generates an array of files given the provided
	// module reference and plugin version and option tuples. No attempt
	// is made at merging insertion points.
	GeneratePlugins(
		ctx context.Context,
		image *v1.Image,
		plugins []*v1alpha1.PluginReference,
		includeImports bool,
		includeWellKnownTypes bool,
	) (responses []*pluginpb.CodeGeneratorResponse, runtimeLibraries []*v1alpha1.RuntimeLibrary, err error)
	// GenerateTemplate generates an array of files given the provided
	// module reference and template version.
	GenerateTemplate(
		ctx context.Context,
		image *v1.Image,
		templateOwner string,
		templateName string,
		templateVersion string,
		includeImports bool,
		includeWellKnownTypes bool,
	) (files []*v1alpha1.File, runtimeLibraries []*v1alpha1.RuntimeLibrary, err error)
}

GenerateService manages remote generation requests.

type GithubService added in v1.4.0

type GithubService interface {
	// GetGithubAppConfig returns a Github Application Configuration.
	GetGithubAppConfig(ctx context.Context) (appConfig *v1alpha1.GithubAppConfig, err error)
}

GithubService is the service used to interact with Github-related information

type ImageService

type ImageService interface {
	// GetImage serves a compiled image for the local module. It automatically
	// downloads dependencies if necessary.
	GetImage(
		ctx context.Context,
		owner string,
		repository string,
		reference string,
		excludeImports bool,
		excludeSourceInfo bool,
		types []string,
		includeMask []v1alpha1.ImageMask,
	) (image *v1.Image, err error)
}

ImageService serves compiled images.

type JSONSchemaService added in v1.0.0

type JSONSchemaService interface {
	// GetJSONSchema allows users to get an (approximate) json schema for a
	// protobuf type.
	GetJSONSchema(
		ctx context.Context,
		owner string,
		repository string,
		reference string,
		typeName string,
	) (jsonSchema []byte, err error)
}

JSONSchemaService serves JSONSchemas describing protobuf types in buf modules.

type LocalResolveService

type LocalResolveService interface {
	// GetLocalModulePins gets the latest pins for the specified local module references.
	// It also includes all of the modules transitive dependencies for the specified references.
	//
	// We want this for two reasons:
	//
	//  1. It makes it easy to say "we know we're looking for owner/repo on this specific remote".
	//     While we could just do this in GetModulePins by being aware of what our remote is
	//     (something we probably still need to know, DNS problems aside, which are more
	//     theoretical), this helps.
	//  2. Having a separate method makes us able to say "do not make decisions about what
	//     wins between competing pins for the same repo". This should only be done in
	//     GetModulePins, not in this function, i.e. only done at the top level.
	GetLocalModulePins(
		ctx context.Context,
		localModuleReferences []*v1alpha11.LocalModuleReference,
	) (localModuleResolveResults []*v1alpha11.LocalModuleResolveResult, dependencies []*v1alpha1.ModulePin, err error)
}

LocalResolveService is the local resolve service.

This is called by ResolveService implementations, and is enterprise.

type OrganizationService

type OrganizationService interface {
	// GetOrganization gets a organization by ID.
	GetOrganization(ctx context.Context, id string) (organization *v1alpha1.Organization, err error)
	// GetOrganizationByName gets a organization by name.
	GetOrganizationByName(ctx context.Context, name string) (organization *v1alpha1.Organization, err error)
	// ListOrganizations lists all organizations.
	ListOrganizations(
		ctx context.Context,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (organizations []*v1alpha1.Organization, nextPageToken string, err error)
	// ListUserOrganizations lists all organizations a user is member of.
	ListUserOrganizations(
		ctx context.Context,
		userId string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (organizations []*v1alpha1.OrganizationMembership, nextPageToken string, err error)
	// CreateOrganization creates a new organization.
	CreateOrganization(ctx context.Context, name string) (organization *v1alpha1.Organization, err error)
	// DeleteOrganization deletes a organization.
	DeleteOrganization(ctx context.Context, id string) (err error)
	// DeleteOrganizationByName deletes a organization by name.
	DeleteOrganizationByName(ctx context.Context, name string) (err error)
	// AddOrganizationMember add a role to an user in the organization.
	AddOrganizationMember(
		ctx context.Context,
		organizationId string,
		userId string,
		organizationRole v1alpha1.OrganizationRole,
	) (err error)
	// UpdateOrganizationMember update the user's membership information in the organization.
	UpdateOrganizationMember(
		ctx context.Context,
		organizationId string,
		userId string,
		organizationRole v1alpha1.OrganizationRole,
	) (err error)
	// RemoveOrganizationMember remove the role of an user in the organization.
	RemoveOrganizationMember(
		ctx context.Context,
		organizationId string,
		userId string,
	) (err error)
	// SetOrganizationMember sets the role of a user in the organization.
	SetOrganizationMember(
		ctx context.Context,
		organizationId string,
		userId string,
		organizationRole v1alpha1.OrganizationRole,
	) (err error)
	// GetOrganizationSettings gets the settings of an organization, including organization base roles.
	GetOrganizationSettings(
		ctx context.Context,
		organizationId string,
	) (repositoryBaseRole v1alpha1.RepositoryRole, pluginBaseRole v1alpha1.PluginRole, templateBaseRole v1alpha1.TemplateRole, membersCount uint32, err error)
	// UpdateOrganizationSettings update the organization settings including base roles.
	UpdateOrganizationSettings(
		ctx context.Context,
		organizationId string,
		repositoryBaseRole v1alpha1.RepositoryRole,
		pluginBaseRole v1alpha1.PluginRole,
		templateBaseRole v1alpha1.TemplateRole,
	) (err error)
}

OrganizationService is the Organization service.

type OwnerService

type OwnerService interface {
	// GetOwnerByName takes an owner name and returns the owner as
	// either a user or organization.
	GetOwnerByName(ctx context.Context, name string) (owner *v1alpha1.Owner, err error)
}

OwnerService is a service that provides RPCs that allow the BSR to query for owner information.

type PluginService

type PluginService interface {
	// ListPlugins returns all the plugins available to the user. This includes
	// public plugins, those uploaded to organizations the user is part of,
	// and any plugins uploaded directly by the user.
	ListPlugins(
		ctx context.Context,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (plugins []*v1alpha1.Plugin, nextPageToken string, err error)
	// ListUserPlugins lists all plugins belonging to a user.
	ListUserPlugins(
		ctx context.Context,
		owner string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (plugins []*v1alpha1.Plugin, nextPageToken string, err error)
	// ListOrganizationPlugins lists all plugins for an organization.
	ListOrganizationPlugins(
		ctx context.Context,
		organization string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (plugins []*v1alpha1.Plugin, nextPageToken string, err error)
	// GetPluginVersion returns the plugin version, if found.
	GetPluginVersion(
		ctx context.Context,
		owner string,
		name string,
		version string,
	) (pluginVersion *v1alpha1.PluginVersion, err error)
	// ListPluginVersions lists all the versions available for the specified plugin.
	ListPluginVersions(
		ctx context.Context,
		owner string,
		name string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (pluginVersions []*v1alpha1.PluginVersion, nextPageToken string, err error)
	// CreatePlugin creates a new plugin.
	CreatePlugin(
		ctx context.Context,
		owner string,
		name string,
		visibility v1alpha1.PluginVisibility,
	) (plugin *v1alpha1.Plugin, err error)
	// GetPlugin returns the plugin, if found.
	GetPlugin(
		ctx context.Context,
		owner string,
		name string,
	) (plugin *v1alpha1.Plugin, err error)
	// DeletePlugin deletes the plugin, if it exists. Note that deleting
	// a plugin may cause breaking changes for templates using that plugin,
	// and should be done with extreme care.
	DeletePlugin(
		ctx context.Context,
		owner string,
		name string,
	) (err error)
	// SetPluginContributor sets the role of a user in the plugin.
	SetPluginContributor(
		ctx context.Context,
		pluginId string,
		userId string,
		pluginRole v1alpha1.PluginRole,
	) (err error)
	// ListPluginContributors returns the list of contributors that has an explicit role against the plugin.
	// This does not include users who have implicit roles against the plugin, unless they have also been
	// assigned a role explicitly.
	ListPluginContributors(
		ctx context.Context,
		pluginId string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (users []*v1alpha1.PluginContributor, nextPageToken string, err error)
	// DeprecatePlugin deprecates the plugin, if found.
	DeprecatePlugin(
		ctx context.Context,
		owner string,
		name string,
		message string,
	) (err error)
	// UndeprecatePlugin makes the plugin not deprecated and removes any deprecation_message.
	UndeprecatePlugin(
		ctx context.Context,
		owner string,
		name string,
	) (err error)
	// GetTemplate returns the template, if found.
	GetTemplate(
		ctx context.Context,
		owner string,
		name string,
	) (template *v1alpha1.Template, err error)
	// ListTemplates returns all the templates available to the user. This includes
	// public templates, those owned by organizations the user is part of,
	// and any created directly by the user.
	ListTemplates(
		ctx context.Context,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (templates []*v1alpha1.Template, nextPageToken string, err error)
	// ListTemplatesUserCanAccess is like ListTemplates, but does not return
	// public templates.
	ListTemplatesUserCanAccess(
		ctx context.Context,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (templates []*v1alpha1.Template, nextPageToken string, err error)
	// ListUserPlugins lists all templates belonging to a user.
	ListUserTemplates(
		ctx context.Context,
		owner string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (templates []*v1alpha1.Template, nextPageToken string, err error)
	// ListOrganizationTemplates lists all templates for an organization.
	ListOrganizationTemplates(
		ctx context.Context,
		organization string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (templates []*v1alpha1.Template, nextPageToken string, err error)
	// GetTemplateVersion returns the template version, if found.
	GetTemplateVersion(
		ctx context.Context,
		owner string,
		name string,
		version string,
	) (templateVersion *v1alpha1.TemplateVersion, err error)
	// ListTemplateVersions lists all the template versions available for the specified template.
	ListTemplateVersions(
		ctx context.Context,
		owner string,
		name string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (templateVersions []*v1alpha1.TemplateVersion, nextPageToken string, err error)
	// CreateTemplate creates a new template.
	CreateTemplate(
		ctx context.Context,
		owner string,
		name string,
		visibility v1alpha1.PluginVisibility,
		pluginConfigs []*v1alpha1.PluginConfig,
	) (template *v1alpha1.Template, err error)
	// DeleteTemplate deletes the template, if it exists.
	DeleteTemplate(
		ctx context.Context,
		owner string,
		name string,
	) (err error)
	// CreateTemplateVersion creates a new template version.
	CreateTemplateVersion(
		ctx context.Context,
		name string,
		templateOwner string,
		templateName string,
		pluginVersions []*v1alpha1.PluginVersionMapping,
	) (templateVersion *v1alpha1.TemplateVersion, err error)
	// SetTemplateContributor sets the role of a user in the template.
	SetTemplateContributor(
		ctx context.Context,
		templateId string,
		userId string,
		templateRole v1alpha1.TemplateRole,
	) (err error)
	// ListTemplateContributors returns the list of contributors that has an explicit role against the template.
	// This does not include users who have implicit roles against the template, unless they have also been
	// assigned a role explicitly.
	ListTemplateContributors(
		ctx context.Context,
		templateId string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (users []*v1alpha1.TemplateContributor, nextPageToken string, err error)
	// DeprecateTemplate deprecates the template, if found.
	DeprecateTemplate(
		ctx context.Context,
		owner string,
		name string,
		message string,
	) (err error)
	// UndeprecateTemplate makes the template not deprecated and removes any deprecation_message.
	UndeprecateTemplate(
		ctx context.Context,
		owner string,
		name string,
	) (err error)
}

PluginService manages plugins.

type PushService

type PushService interface {
	// Push pushes.
	Push(
		ctx context.Context,
		owner string,
		repository string,
		branch string,
		module *v1alpha1.Module,
		tags []string,
		tracks []string,
	) (localModulePin *v1alpha11.LocalModulePin, err error)
}

PushService is the Push service.

type RecommendationService

type RecommendationService interface {
	// RecommendedRepositories returns a list of recommended repositories.
	RecommendedRepositories(ctx context.Context) (repositories []*v1alpha1.RecommendedRepository, err error)
	// RecommendedTemplates returns a list of recommended templates.
	RecommendedTemplates(ctx context.Context) (templates []*v1alpha1.RecommendedTemplate, err error)
	// ListRecommendedRepositories returns a list of recommended repositories that user have access to.
	ListRecommendedRepositories(ctx context.Context) (repositories []*v1alpha1.RecommendedRepository, err error)
	// ListRecommendedTemplates returns a list of recommended templates that user have access to.
	ListRecommendedTemplates(ctx context.Context) (templates []*v1alpha1.RecommendedTemplate, err error)
	// SetRecommendedRepositories set the list of repository recommendations in the server.
	SetRecommendedRepositories(ctx context.Context, repositories []*v1alpha1.SetRecommendedRepository) (err error)
	// SetRecommendedTemplates set the list of template recommendations in the server.
	SetRecommendedTemplates(ctx context.Context, templates []*v1alpha1.SetRecommendedTemplate) (err error)
}

RecommendationService is the recommendation service.

type ReferenceService

type ReferenceService interface {
	// GetReferenceByName takes a reference name and returns the
	// reference either as a tag, branch, track or commit.
	GetReferenceByName(
		ctx context.Context,
		name string,
		owner string,
		repositoryName string,
	) (reference *v1alpha1.Reference, err error)
}

ReferenceService is a service that provides RPCs that allow the BSR to query for reference information.

type RepositoryBranchService

type RepositoryBranchService interface {
	// CreateRepositoryBranch creates a new repository branch.
	CreateRepositoryBranch(
		ctx context.Context,
		repositoryId string,
		name string,
		parentBranch string,
	) (repositoryBranch *v1alpha1.RepositoryBranch, err error)
	// ListRepositoryBranches lists the repository branches associated with a Repository.
	ListRepositoryBranches(
		ctx context.Context,
		repositoryId string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (repositoryBranches []*v1alpha1.RepositoryBranch, nextPageToken string, err error)
}

RepositoryBranchService is the Repository branch service.

type RepositoryCommitService

type RepositoryCommitService interface {
	// ListRepositoryCommitsByBranch lists the repository commits associated
	// with a repository branch on a repository, ordered by their create time.
	ListRepositoryCommitsByBranch(
		ctx context.Context,
		repositoryOwner string,
		repositoryName string,
		repositoryBranchName string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (repositoryCommits []*v1alpha1.RepositoryCommit, nextPageToken string, err error)
	// ListRepositoryCommitsByReference returns repository commits up-to and including
	// the provided reference.
	ListRepositoryCommitsByReference(
		ctx context.Context,
		repositoryOwner string,
		repositoryName string,
		reference string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (repositoryCommits []*v1alpha1.RepositoryCommit, nextPageToken string, err error)
	// ListRepositoryCommitsOnTrack returns repository commits up-to and including
	// the provided reference.
	ListRepositoryCommitsOnTrack(
		ctx context.Context,
		repositoryOwner string,
		repositoryName string,
		repositoryTrackName string,
		reference string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (repositoryCommits []*v1alpha1.RepositoryCommit, nextPageToken string, err error)
	// GetRepositoryCommitByReference returns the repository commit matching
	// the provided reference, if it exists.
	GetRepositoryCommitByReference(
		ctx context.Context,
		repositoryOwner string,
		repositoryName string,
		reference string,
	) (repositoryCommit *v1alpha1.RepositoryCommit, err error)
	// GetRepositoryCommitBySequenceId returns the repository commit matching
	// the provided sequence ID and branch, if it exists.
	GetRepositoryCommitBySequenceId(
		ctx context.Context,
		repositoryOwner string,
		repositoryName string,
		repositoryBranchName string,
		commitSequenceId int64,
	) (repositoryCommit *v1alpha1.RepositoryCommit, err error)
}

RepositoryCommitService is the Repository commit service.

type RepositoryService

type RepositoryService interface {
	// GetRepository gets a repository by ID.
	GetRepository(
		ctx context.Context,
		id string,
	) (repository *v1alpha1.Repository, counts *v1alpha1.RepositoryCounts, err error)
	// GetRepositoryByFullName gets a repository by full name.
	GetRepositoryByFullName(
		ctx context.Context,
		fullName string,
	) (repository *v1alpha1.Repository, counts *v1alpha1.RepositoryCounts, err error)
	// ListRepositories lists all repositories.
	ListRepositories(
		ctx context.Context,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (repositories []*v1alpha1.Repository, nextPageToken string, err error)
	// ListUserRepositories lists all repositories belonging to a user.
	ListUserRepositories(
		ctx context.Context,
		userId string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (repositories []*v1alpha1.Repository, nextPageToken string, err error)
	// ListRepositoriesUserCanAccess lists all repositories a user can access.
	ListRepositoriesUserCanAccess(
		ctx context.Context,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (repositories []*v1alpha1.Repository, nextPageToken string, err error)
	// ListOrganizationRepositories lists all repositories for an organization.
	ListOrganizationRepositories(
		ctx context.Context,
		organizationId string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (repositories []*v1alpha1.Repository, nextPageToken string, err error)
	// CreateRepositoryByFullName creates a new repository by full name.
	CreateRepositoryByFullName(
		ctx context.Context,
		fullName string,
		visibility v1alpha1.Visibility,
	) (repository *v1alpha1.Repository, err error)
	// DeleteRepository deletes a repository.
	DeleteRepository(ctx context.Context, id string) (err error)
	// DeleteRepositoryByFullName deletes a repository by full name.
	DeleteRepositoryByFullName(ctx context.Context, fullName string) (err error)
	// DeprecateRepositoryByName deprecates the repository.
	DeprecateRepositoryByName(
		ctx context.Context,
		ownerName string,
		repositoryName string,
		deprecationMessage string,
	) (repository *v1alpha1.Repository, err error)
	// UndeprecateRepositoryByName makes the repository not deprecated and removes any deprecation_message.
	UndeprecateRepositoryByName(
		ctx context.Context,
		ownerName string,
		repositoryName string,
	) (repository *v1alpha1.Repository, err error)
	// GetRepositoriesByFullName gets repositories by full name. Response order is unspecified.
	// Errors if any of the repositories don't exist or the caller does not have access to any of the repositories.
	GetRepositoriesByFullName(ctx context.Context, fullNames []string) (repositories []*v1alpha1.Repository, err error)
	// SetRepositoryContributor sets the role of a user in the repository.
	SetRepositoryContributor(
		ctx context.Context,
		repositoryId string,
		userId string,
		repositoryRole v1alpha1.RepositoryRole,
	) (err error)
	// ListRepositoryContributors returns the list of contributors that has an explicit role against the repository.
	// This does not include users who have implicit roles against the repository, unless they have also been
	// assigned a role explicitly.
	ListRepositoryContributors(
		ctx context.Context,
		repositoryId string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (users []*v1alpha1.RepositoryContributor, nextPageToken string, err error)
	// GetRepositoryContributor returns the contributor information of a user in a repository.
	GetRepositoryContributor(
		ctx context.Context,
		repositoryId string,
		userId string,
	) (user *v1alpha1.RepositoryContributor, err error)
	// GetRepositorySettings gets the settings of a repository.
	GetRepositorySettings(ctx context.Context, repositoryId string) (contributorsCount uint32, err error)
	// UpdateRepositorySettingsByName updates the settings of a repository.
	UpdateRepositorySettingsByName(
		ctx context.Context,
		ownerName string,
		repositoryName string,
		visibility v1alpha1.Visibility,
	) (err error)
}

RepositoryService is the Repository service.

type RepositoryTagService

type RepositoryTagService interface {
	// CreateRepositoryTag creates a new repository tag.
	CreateRepositoryTag(
		ctx context.Context,
		repositoryId string,
		name string,
		commitName string,
	) (repositoryTag *v1alpha1.RepositoryTag, err error)
	// ListRepositoryTags lists the repository tags associated with a Repository.
	ListRepositoryTags(
		ctx context.Context,
		repositoryId string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (repositoryTags []*v1alpha1.RepositoryTag, nextPageToken string, err error)
}

RepositoryTagService is the Repository tag service.

type RepositoryTrackCommitService added in v1.0.0

type RepositoryTrackCommitService interface {
	// GetRepositoryTrackCommitByRepositoryCommit returns the RepositoryTrackCommit associated given repository_commit on
	// the given repository_track. Returns NOT_FOUND if the RepositoryTrackCommit does not exist.
	GetRepositoryTrackCommitByRepositoryCommit(
		ctx context.Context,
		repositoryTrackId string,
		repositoryCommitId string,
	) (repositoryTrackCommit *v1alpha1.RepositoryTrackCommit, err error)
	// ListRepositoryTrackCommitsByRepositoryTrack lists the RepositoryTrackCommitS associated with a repository track,
	// ordered by their sequence id.
	ListRepositoryTrackCommitsByRepositoryTrack(
		ctx context.Context,
		repositoryTrackId string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (repositoryTrackCommits []*v1alpha1.RepositoryTrackCommit, nextPageToken string, err error)
	// GetRepositoryTrackCommitByReference returns the RepositoryTrackCommit associated with the given reference.
	GetRepositoryTrackCommitByReference(
		ctx context.Context,
		repositoryOwner string,
		repositoryName string,
		track string,
		reference string,
	) (repositoryTrackCommit *v1alpha1.RepositoryTrackCommit, err error)
}

type RepositoryTrackService added in v1.0.0

type RepositoryTrackService interface {
	// CreateRepositoryTrack creates a new repository track.
	CreateRepositoryTrack(
		ctx context.Context,
		repositoryId string,
		name string,
	) (repositoryTrack *v1alpha1.RepositoryTrack, err error)
	// ListRepositoryTracks lists the repository tracks associated with a repository.
	ListRepositoryTracks(
		ctx context.Context,
		repositoryId string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (repositoryTracks []*v1alpha1.RepositoryTrack, nextPageToken string, err error)
	// DeleteRepositoryTrackByName deletes a repository track by name.
	DeleteRepositoryTrackByName(
		ctx context.Context,
		ownerName string,
		repositoryName string,
		name string,
	) (err error)
	// GetRepositoryTrackByName gets a repository track by name.
	GetRepositoryTrackByName(
		ctx context.Context,
		ownerName string,
		repositoryName string,
		name string,
	) (repositoryTrack *v1alpha1.RepositoryTrack, err error)
	// ListRepositoryTracksByRepositoryCommit lists the repository tracks associated with a repository commit.
	ListRepositoryTracksByRepositoryCommit(
		ctx context.Context,
		repositoryId string,
		commit string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (repositoryTracks []*v1alpha1.RepositoryTrack, nextPageToken string, err error)
}

type ResolveService

type ResolveService interface {
	// GetModulePins finds all the latest digests and respective dependencies of
	// the provided module references and picks a set of distinct modules pins.
	//
	// Note that module references with commits should still be passed to this function
	// to make sure this function can do dependency resolution.
	//
	// This function also deals with tiebreaking what ModulePin wins for the same repository.
	GetModulePins(
		ctx context.Context,
		moduleReferences []*v1alpha1.ModuleReference,
		currentModulePins []*v1alpha1.ModulePin,
	) (modulePins []*v1alpha1.ModulePin, err error)
}

ResolveService is the resolve service.

This is the public service.

type SearchService

type SearchService interface {
	// Search searches the BSR.
	Search(
		ctx context.Context,
		query string,
		pageSize uint32,
		pageToken uint32,
		filters []v1alpha1.SearchFilter,
	) (searchResults []*v1alpha1.SearchResult, nextPageToken uint32, err error)
}

SearchService is the search service.

type StudioService added in v1.5.0

type StudioService interface {
	// ListStudioAgentPresets returns a list of agent presets in the server.
	ListStudioAgentPresets(ctx context.Context) (agents []*v1alpha1.StudioAgentPreset, err error)
	// SetStudioAgentPresets sets the list of agent presets in the server.
	SetStudioAgentPresets(ctx context.Context, agents []*v1alpha1.StudioAgentPreset) (err error)
}

StudioService is the Studio service.

type TokenService

type TokenService interface {
	// CreateToken creates a new token suitable for machine-to-machine authentication.
	CreateToken(
		ctx context.Context,
		note string,
		expireTime *timestamppb.Timestamp,
	) (token string, err error)
	// GetToken gets the specific token for the user
	//
	// This method requires authentication.
	GetToken(ctx context.Context, tokenId string) (token *v1alpha1.Token, err error)
	// ListTokens lists the users active tokens
	//
	// This method requires authentication.
	ListTokens(
		ctx context.Context,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (tokens []*v1alpha1.Token, nextPageToken string, err error)
	// DeleteToken deletes an existing token.
	//
	// This method requires authentication.
	DeleteToken(ctx context.Context, tokenId string) (err error)
}

TokenService is the Token service.

type UserService

type UserService interface {
	// CreateUser creates a new user with the given username.
	CreateUser(ctx context.Context, username string) (user *v1alpha1.User, err error)
	// GetUser gets a user by ID.
	GetUser(ctx context.Context, id string) (user *v1alpha1.User, err error)
	// GetUserByUsername gets a user by username.
	GetUserByUsername(ctx context.Context, username string) (user *v1alpha1.User, err error)
	// ListUsers lists all users.
	ListUsers(
		ctx context.Context,
		pageSize uint32,
		pageToken string,
		reverse bool,
		userStateFilter v1alpha1.UserState,
	) (users []*v1alpha1.User, nextPageToken string, err error)
	// ListOrganizationUsers lists all users for an organization.
	// TODO: #663 move this to organization service
	ListOrganizationUsers(
		ctx context.Context,
		organizationId string,
		pageSize uint32,
		pageToken string,
		reverse bool,
	) (users []*v1alpha1.OrganizationUser, nextPageToken string, err error)
	// DeleteUser deletes a user.
	DeleteUser(ctx context.Context) (err error)
	// Deactivate user deactivates a user.
	DeactivateUser(ctx context.Context, id string) (err error)
	// UpdateUserServerRole update the role of an user in the server.
	UpdateUserServerRole(
		ctx context.Context,
		userId string,
		serverRole v1alpha1.ServerRole,
	) (err error)
	// CountUsers returns the number of users in the server by the user state provided.
	CountUsers(ctx context.Context, userStateFilter v1alpha1.UserState) (totalCount uint32, err error)
}

UserService is the User service.

type WebhookService added in v1.6.0

type WebhookService interface {
	// Create a webhook.
	CreateWebhook(
		ctx context.Context,
		webhookEvent []v1alpha1.WebhookEvent,
		ownerName string,
		repositoryName string,
		callbackUrl string,
	) (webhookSubscriptionId string, err error)
	// Delete a webhook.
	DeleteWebhook(ctx context.Context, webhookSubscriptionId string) (err error)
	// Lists the webhooks for a given repository.
	ListWebhooks(
		ctx context.Context,
		repositoryName string,
		ownerName string,
		pageToken string,
	) (subscribedWebhooks []*v1alpha1.SubscribedWebhook, nextPageToken string, err error)
}

WebhookService exposes the functionality for a caller to create/delete/list Webhooks for a given repository.

Jump to

Keyboard shortcuts

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