limits

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package limits package

Index

Constants

View Source
const (
	// ResourceLimitTimePeriod is the time period used for time-based resource limits.
	// Only resources created within the last time period will account towards the limit.
	ResourceLimitTimePeriod = 24 * time.Hour
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LimitChecker

type LimitChecker interface {
	CheckLimit(ctx context.Context, name ResourceLimitName, toCheck int32) error
}

LimitChecker implements functionality related to resource limits.

func NewLimitChecker

func NewLimitChecker(
	dbClient *db.Client,
) LimitChecker

NewLimitChecker creates an instance of LimitChecker

type MockLimitChecker

type MockLimitChecker struct {
	mock.Mock
}

MockLimitChecker is an autogenerated mock type for the LimitChecker type

func NewMockLimitChecker

func NewMockLimitChecker(t mockConstructorTestingTNewMockLimitChecker) *MockLimitChecker

NewMockLimitChecker creates a new instance of MockLimitChecker. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockLimitChecker) CheckLimit

func (_m *MockLimitChecker) CheckLimit(ctx context.Context, name ResourceLimitName, toCheck int32) error

CheckLimit provides a mock function with given fields: ctx, name, toCheck

type ResourceLimitName

type ResourceLimitName string

ResourceLimitName is an enum for the names that will be used as keys when doing the checks.

const (
	ResourceLimitTotalRoles                                     ResourceLimitName = "TotalRoles"
	ResourceLimitPipelineTemplatesPerProjectPerTimePeriod       ResourceLimitName = "PipelineTemplatesPerProjectPerTimePeriod"
	ResourceLimitPipelinesPerProjectPerTimePeriod               ResourceLimitName = "PipelinesPerProjectPerTimePeriod"
	ResourceLimitAgentsPerOrganization                          ResourceLimitName = "AgentsPerOrganization"
	ResourceLimitEnvironmentsPerProject                         ResourceLimitName = "EnvironmentsPerProject"
	ResourceLimitServiceAccountsPerOrganization                 ResourceLimitName = "ServiceAccountsPerOrganization"
	ResourceLimitServiceAccountsPerProject                      ResourceLimitName = "ServiceAccountsPerProject"
	ResourceLimitLifecycleTemplatesPerOrganizationPerTimePeriod ResourceLimitName = "LifecycleTemplatesPerOrganizationPerTimePeriod"
	ResourceLimitLifecycleTemplatesPerProjectPerTimePeriod      ResourceLimitName = "LifecycleTemplatesPerProjectPerTimePeriod"
	ResourceLimitReleaseLifecyclesPerOrganization               ResourceLimitName = "ReleaseLifecyclesPerOrganization"
	ResourceLimitReleaseLifecyclesPerProject                    ResourceLimitName = "ReleaseLifecyclesPerProject"
	ResourceLimitApprovalRulesPerOrganization                   ResourceLimitName = "ApprovalRulesPerOrganization"
	ResourceLimitApprovalRulesPerProject                        ResourceLimitName = "ApprovalRulesPerProject"
	ResourceLimitVariableSetsPerProject                         ResourceLimitName = "VariableSetsPerProject"
	ResourceLimitReleasesPerProjectPerTimePeriod                ResourceLimitName = "ReleasesPerProjectPerTimePeriod"
	ResourceLimitSessionsPerAgent                               ResourceLimitName = "SessionsPerAgent"
	ResourceLimitThreadsPerPipeline                             ResourceLimitName = "ThreadsPerPipeline"
	ResourceLimitThreadsPerRelease                              ResourceLimitName = "ThreadsPerRelease"
	ResourceLimitCommentsPerThread                              ResourceLimitName = "CommentsPerThread"
	ResourceLimitPluginsPerOrganization                         ResourceLimitName = "PluginsPerOrganization"
	ResourceLimitVersionsPerPlugin                              ResourceLimitName = "VersionsPerPlugin"
	ResourceLimitPlatformsPerPluginVersion                      ResourceLimitName = "PlatformsPerPluginVersion"
	ResourceLimitVCSProvidersPerOrganization                    ResourceLimitName = "VCSProvidersPerOrganization"     // Only applies to Org VCS providers type.
	ResourceLimitVCSProvidersPerProject                         ResourceLimitName = "VCSProvidersPerProject"          // Only applies to Project VCS providers type.
	ResourceLimitEnvironmentRulesPerOrganization                ResourceLimitName = "EnvironmentRulesPerOrganization" // Only applies to Org environment protection rules.
)

ResourceLimitName constants

Jump to

Keyboard shortcuts

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