Documentation
¶
Index ¶
- Constants
- func EmitMIMOMetrics(ctx context.Context, log *logrus.Entry, ...)
- func EmitOpenShiftClustersMetrics(ctx context.Context, log *logrus.Entry, dbOpenShiftClusters OpenShiftClusters, ...)
- func NewDatabaseClient(log *logrus.Entry, _env env.Core, authorizer cosmosdb.Authorizer, ...) (cosmosdb.DatabaseClient, error)
- func NewDatabaseClientFromEnv(ctx context.Context, _env env.Core, m metrics.Emitter, aead encryption.AEAD) (cosmosdb.DatabaseClient, error)
- func NewJSONHandle(aead encryption.AEAD) (*codec.JsonHandle, error)
- func NewTokenAuthorizer(ctx context.Context, log *logrus.Entry, cred azcore.TokenCredential, ...) (cosmosdb.Authorizer, error)
- type AsyncOperations
- type Billing
- type DatabaseGroup
- type DatabaseGroupWithAsyncOperations
- type DatabaseGroupWithBilling
- type DatabaseGroupWithMaintenanceManifests
- type DatabaseGroupWithMaintenanceSchedules
- type DatabaseGroupWithMonitors
- type DatabaseGroupWithOpenShiftClusters
- type DatabaseGroupWithOpenShiftVersions
- type DatabaseGroupWithPlatformWorkloadIdentityRoleSets
- type DatabaseGroupWithPortal
- type DatabaseGroupWithSubscriptions
- type DocumentIterator
- type Gateway
- type MaintenanceManifestDocumentMutator
- type MaintenanceManifests
- type MaintenanceScheduleDocumentMutator
- type MaintenanceSchedules
- type Monitors
- type OpenShiftClusterDocumentMutator
- type OpenShiftClusters
- type OpenShiftVersions
- type PlatformWorkloadIdentityRoleSets
- func NewPlatformWorkloadIdentityRoleSets(ctx context.Context, dbc cosmosdb.DatabaseClient, dbName string) (PlatformWorkloadIdentityRoleSets, error)
- func NewPlatformWorkloadIdentityRoleSetsWithProvidedClient(client cosmosdb.PlatformWorkloadIdentityRoleSetDocumentClient, ...) PlatformWorkloadIdentityRoleSets
- type Portal
- type Subscriptions
Constants ¶
const ( MaintenanceManifestDequeueQueryForCluster = "SELECT * FROM MaintenanceManifests doc WHERE " + manifestPendingFragment + " AND doc.clusterResourceID = @clusterResourceID AND " + manifestExpiryFragment + " AND " + manifestFetchOnlyRunAfterFragment MaintenanceManifestQueryForCluster = "SELECT * FROM MaintenanceManifests doc WHERE doc.clusterResourceID = @clusterResourceID" MaintenanceManifestQueueOverallQuery = "SELECT * FROM MaintenanceManifests doc WHERE " + manifestPendingFragment + " AND " + manifestExpiryFragment MaintenanceManifestQueueLengthQuery = "SELECT VALUE COUNT(1) FROM MaintenanceManifests doc WHERE " + manifestPendingFragment + " AND " + manifestExpiryFragment + " AND " + manifestFetchOnlyRunAfterFragment )
const ( OpenShiftClustersDequeueQuery = `` /* 207-byte string literal not displayed */ OpenShiftClustersQueueLengthQuery = `` /* 220-byte string literal not displayed */ OpenShiftClustersGetQuery = `SELECT * FROM OpenShiftClusters doc WHERE doc.key = @key` OpenshiftClustersPrefixQuery = `SELECT * FROM OpenShiftClusters doc WHERE STARTSWITH(doc.key, @prefix)` OpenshiftClustersClientIdQuery = `SELECT * FROM OpenShiftClusters doc WHERE doc.clientIdKey = @clientID` OpenshiftClustersResourceGroupQuery = `SELECT * FROM OpenShiftClusters doc WHERE doc.clusterResourceGroupIdKey = @resourceGroupID` OpenshiftClustersClusterResourceIDOnlyQuery = `` /* 149-byte string literal not displayed */ )
const (
MaintenanceScheduleQueryValid = `SELECT * FROM MaintenanceSchedules doc WHERE doc.maintenanceSchedule.state IN ("Enabled", "Processing")`
)
const (
SubscriptionsDequeueQuery string = `SELECT * FROM Subscriptions doc WHERE (doc.deleting ?? false) AND (doc.leaseExpires ?? 0) < GetCurrentTimestamp() / 1000`
)
Variables ¶
This section is empty.
Functions ¶
func EmitMIMOMetrics ¶
func NewDatabaseClient ¶
func NewDatabaseClient(log *logrus.Entry, _env env.Core, authorizer cosmosdb.Authorizer, m metrics.Emitter, aead encryption.AEAD, databaseAccountName string) (cosmosdb.DatabaseClient, error)
func NewDatabaseClientFromEnv ¶
func NewDatabaseClientFromEnv(ctx context.Context, _env env.Core, m metrics.Emitter, aead encryption.AEAD) (cosmosdb.DatabaseClient, error)
NewDatabaseClient creates a CosmosDB database client from the environment configuration.
func NewJSONHandle ¶
func NewJSONHandle(aead encryption.AEAD) (*codec.JsonHandle, error)
func NewTokenAuthorizer ¶
Types ¶
type AsyncOperations ¶
type AsyncOperations interface {
Create(context.Context, *api.AsyncOperationDocument) (*api.AsyncOperationDocument, error)
Get(context.Context, string) (*api.AsyncOperationDocument, error)
Patch(context.Context, string, func(*api.AsyncOperationDocument) error) (*api.AsyncOperationDocument, error)
NewUUID() string
}
AsyncOperations is the database interface for AsyncOperationDocuments
func NewAsyncOperations ¶
func NewAsyncOperations(ctx context.Context, isLocalDevelopmentMode bool, dbc cosmosdb.DatabaseClient, dbName string) (AsyncOperations, error)
NewAsyncOperations returns a new AsyncOperations
func NewAsyncOperationsWithProvidedClient ¶
func NewAsyncOperationsWithProvidedClient(client cosmosdb.AsyncOperationDocumentClient, uuidGenerator uuid.Generator) AsyncOperations
type Billing ¶
type Billing interface {
Create(context.Context, *api.BillingDocument) (*api.BillingDocument, error)
Get(context.Context, string) (*api.BillingDocument, error)
MarkForDeletion(context.Context, string) (*api.BillingDocument, error)
UpdateLastBillingTimestamp(context.Context, string, int) (*api.BillingDocument, error)
List(string) cosmosdb.BillingDocumentIterator
ListAll(context.Context) (*api.BillingDocuments, error)
Delete(context.Context, *api.BillingDocument) error
}
Billing is the database interface for BillingDocuments
func NewBilling ¶
NewBilling returns a new Billing
func NewBillingWithProvidedClient ¶
func NewBillingWithProvidedClient(client cosmosdb.BillingDocumentClient) Billing
type DatabaseGroup ¶
type DatabaseGroup interface {
DatabaseGroupWithOpenShiftClusters
DatabaseGroupWithSubscriptions
DatabaseGroupWithMonitors
DatabaseGroupWithOpenShiftVersions
DatabaseGroupWithPlatformWorkloadIdentityRoleSets
DatabaseGroupWithAsyncOperations
DatabaseGroupWithBilling
DatabaseGroupWithPortal
DatabaseGroupWithMaintenanceManifests
DatabaseGroupWithMaintenanceSchedules
WithOpenShiftClusters(db OpenShiftClusters) DatabaseGroup
WithSubscriptions(db Subscriptions) DatabaseGroup
WithMonitors(db Monitors) DatabaseGroup
WithOpenShiftVersions(db OpenShiftVersions) DatabaseGroup
WithPlatformWorkloadIdentityRoleSets(db PlatformWorkloadIdentityRoleSets) DatabaseGroup
WithAsyncOperations(db AsyncOperations) DatabaseGroup
WithBilling(db Billing) DatabaseGroup
WithPortal(db Portal) DatabaseGroup
WithMaintenanceManifests(db MaintenanceManifests) DatabaseGroup
WithMaintenanceSchedules(db MaintenanceSchedules) DatabaseGroup
}
func NewDBGroup ¶
func NewDBGroup() DatabaseGroup
type DatabaseGroupWithAsyncOperations ¶
type DatabaseGroupWithAsyncOperations interface {
AsyncOperations() (AsyncOperations, error)
}
type DatabaseGroupWithMaintenanceManifests ¶
type DatabaseGroupWithMaintenanceManifests interface {
MaintenanceManifests() (MaintenanceManifests, error)
}
type DatabaseGroupWithMaintenanceSchedules ¶
type DatabaseGroupWithMaintenanceSchedules interface {
MaintenanceSchedules() (MaintenanceSchedules, error)
}
type DatabaseGroupWithOpenShiftClusters ¶
type DatabaseGroupWithOpenShiftClusters interface {
OpenShiftClusters() (OpenShiftClusters, error)
}
type DatabaseGroupWithOpenShiftVersions ¶
type DatabaseGroupWithOpenShiftVersions interface {
OpenShiftVersions() (OpenShiftVersions, error)
}
type DatabaseGroupWithPlatformWorkloadIdentityRoleSets ¶
type DatabaseGroupWithPlatformWorkloadIdentityRoleSets interface {
PlatformWorkloadIdentityRoleSets() (PlatformWorkloadIdentityRoleSets, error)
}
type DatabaseGroupWithPortal ¶
type DatabaseGroupWithSubscriptions ¶
type DatabaseGroupWithSubscriptions interface {
Subscriptions() (Subscriptions, error)
}
type DocumentIterator ¶
type DocumentIterator[E any, D api.DocumentList[E]] interface { Next(context.Context, int) (D, error) }
Generic interface of document iterators from pkg/database/cosmosdb/, used in changefeeds.
type Gateway ¶
type Gateway interface {
ChangeFeed() cosmosdb.GatewayDocumentIterator
Create(context.Context, *api.GatewayDocument) (*api.GatewayDocument, error)
Delete(context.Context, *api.GatewayDocument) error
Get(context.Context, string) (*api.GatewayDocument, error)
Patch(context.Context, string, func(*api.GatewayDocument) error) (*api.GatewayDocument, error)
NewUUID() string
}
func NewGateway ¶
func NewGatewayWithProvidedClient ¶
func NewGatewayWithProvidedClient(client cosmosdb.GatewayDocumentClient, uuidGenerator uuid.Generator) Gateway
type MaintenanceManifestDocumentMutator ¶
type MaintenanceManifestDocumentMutator func(*api.MaintenanceManifestDocument) error
type MaintenanceManifests ¶
type MaintenanceManifests interface {
Create(context.Context, *api.MaintenanceManifestDocument) (*api.MaintenanceManifestDocument, error)
GetByClusterResourceID(ctx context.Context, clusterResourceID string, continuation string) (cosmosdb.MaintenanceManifestDocumentIterator, error)
GetQueuedByClusterResourceID(ctx context.Context, clusterResourceID string, continuation string) (cosmosdb.MaintenanceManifestDocumentIterator, error)
Patch(context.Context, string, string, MaintenanceManifestDocumentMutator) (*api.MaintenanceManifestDocument, error)
PatchWithLease(context.Context, string, string, MaintenanceManifestDocumentMutator) (*api.MaintenanceManifestDocument, error)
Lease(ctx context.Context, clusterResourceID string, id string) (*api.MaintenanceManifestDocument, error)
EndLease(context.Context, string, string, api.MaintenanceManifestState, *string) (*api.MaintenanceManifestDocument, error)
Get(context.Context, string, string) (*api.MaintenanceManifestDocument, error)
Delete(context.Context, string, string) error
QueueLength(context.Context) (int, error)
Queued(ctx context.Context, continuation string) (cosmosdb.MaintenanceManifestDocumentIterator, error)
NewUUID() string
}
func NewMaintenanceManifests ¶
func NewMaintenanceManifests(ctx context.Context, dbc cosmosdb.DatabaseClient, dbName string) (MaintenanceManifests, error)
func NewMaintenanceManifestsWithProvidedClient ¶
func NewMaintenanceManifestsWithProvidedClient(client cosmosdb.MaintenanceManifestDocumentClient, collectionClient cosmosdb.CollectionClient, uuid string, uuidGenerator uuid.Generator) MaintenanceManifests
type MaintenanceScheduleDocumentMutator ¶
type MaintenanceScheduleDocumentMutator func(*api.MaintenanceScheduleDocument) error
type MaintenanceSchedules ¶
type MaintenanceSchedules interface {
GetValid(context.Context, string) (cosmosdb.MaintenanceScheduleDocumentIterator, error)
Create(context.Context, *api.MaintenanceScheduleDocument) (*api.MaintenanceScheduleDocument, error)
Update(context.Context, *api.MaintenanceScheduleDocument) (*api.MaintenanceScheduleDocument, error)
Patch(context.Context, string, MaintenanceScheduleDocumentMutator) (*api.MaintenanceScheduleDocument, error)
List(string) cosmosdb.MaintenanceScheduleDocumentIterator
Get(context.Context, string) (*api.MaintenanceScheduleDocument, error)
Delete(context.Context, string) error
NewUUID() string
}
func NewMaintenanceSchedules ¶
func NewMaintenanceSchedules(ctx context.Context, dbc cosmosdb.DatabaseClient, dbName string) (MaintenanceSchedules, error)
func NewMaintenanceSchedulesWithProvidedClient ¶
func NewMaintenanceSchedulesWithProvidedClient(client cosmosdb.MaintenanceScheduleDocumentClient, collectionClient cosmosdb.CollectionClient, uuid string, uuidGenerator uuid.Generator) MaintenanceSchedules
type Monitors ¶
type Monitors interface {
Create(context.Context, *api.MonitorDocument) (*api.MonitorDocument, error)
PatchWithLease(context.Context, string, func(*api.MonitorDocument) error) (*api.MonitorDocument, error)
TryLease(context.Context) (*api.MonitorDocument, error)
ListBuckets(context.Context) ([]int, error)
ListMonitors(context.Context) (*api.MonitorDocuments, error)
MonitorHeartbeat(context.Context) error
}
Monitors is the database interface for MonitorDocuments
func NewMonitors ¶
NewMonitors returns a new Monitors
func NewMonitorsWithProvidedClient ¶
func NewMonitorsWithProvidedClient(client cosmosdb.MonitorDocumentClient, uuid string) Monitors
type OpenShiftClusterDocumentMutator ¶
type OpenShiftClusterDocumentMutator func(*api.OpenShiftClusterDocument) error
type OpenShiftClusters ¶
type OpenShiftClusters interface {
Create(context.Context, *api.OpenShiftClusterDocument) (*api.OpenShiftClusterDocument, error)
Get(context.Context, string) (*api.OpenShiftClusterDocument, error)
QueueLength(context.Context, string) (int, error)
Patch(context.Context, string, OpenShiftClusterDocumentMutator) (*api.OpenShiftClusterDocument, error)
PatchWithLease(context.Context, string, OpenShiftClusterDocumentMutator) (*api.OpenShiftClusterDocument, error)
Update(context.Context, *api.OpenShiftClusterDocument) (*api.OpenShiftClusterDocument, error)
Delete(context.Context, *api.OpenShiftClusterDocument) error
ChangeFeed() cosmosdb.OpenShiftClusterDocumentIterator
List(string) cosmosdb.OpenShiftClusterDocumentIterator
ListAll(context.Context) (*api.OpenShiftClusterDocuments, error)
ListByPrefix(string, string, string) (cosmosdb.OpenShiftClusterDocumentIterator, error)
Dequeue(context.Context) (*api.OpenShiftClusterDocument, error)
Lease(context.Context, string) (*api.OpenShiftClusterDocument, error)
EndLease(context.Context, string, api.ProvisioningState, api.ProvisioningState, *string) (*api.OpenShiftClusterDocument, error)
GetByClientID(ctx context.Context, partitionKey, clientID string) (*api.OpenShiftClusterDocuments, error)
GetByClusterResourceGroupID(ctx context.Context, partitionKey, resourceGroupID string) (*api.OpenShiftClusterDocuments, error)
GetAllResourceIDs(ctx context.Context, continuation string) (cosmosdb.OpenShiftClusterDocumentIterator, error)
DoDequeue(ctx context.Context, doc *api.OpenShiftClusterDocument) (*api.OpenShiftClusterDocument, error)
NewUUID() string
}
OpenShiftClusters is the database interface for OpenShiftClusterDocuments
func NewOpenShiftClusters ¶
func NewOpenShiftClusters(ctx context.Context, dbc cosmosdb.DatabaseClient, dbName string) (OpenShiftClusters, error)
NewOpenShiftClusters returns a new OpenShiftClusters
func NewOpenShiftClustersWithProvidedClient ¶
func NewOpenShiftClustersWithProvidedClient(client cosmosdb.OpenShiftClusterDocumentClient, collectionClient cosmosdb.CollectionClient, uuid string, uuidGenerator uuid.Generator) OpenShiftClusters
type OpenShiftVersions ¶
type OpenShiftVersions interface {
ChangeFeed() cosmosdb.OpenShiftVersionDocumentIterator
Create(context.Context, *api.OpenShiftVersionDocument) (*api.OpenShiftVersionDocument, error)
Delete(context.Context, *api.OpenShiftVersionDocument) error
Get(context.Context, string) (*api.OpenShiftVersionDocument, error)
Update(context.Context, *api.OpenShiftVersionDocument) (*api.OpenShiftVersionDocument, error)
Patch(context.Context, string, func(*api.OpenShiftVersionDocument) error) (*api.OpenShiftVersionDocument, error)
ListAll(context.Context) (*api.OpenShiftVersionDocuments, error)
NewUUID() string
}
func NewOpenShiftVersions ¶
func NewOpenShiftVersions(ctx context.Context, dbc cosmosdb.DatabaseClient, dbName string) (OpenShiftVersions, error)
func NewOpenShiftVersionsWithProvidedClient ¶
func NewOpenShiftVersionsWithProvidedClient(client cosmosdb.OpenShiftVersionDocumentClient, uuid uuid.Generator) OpenShiftVersions
type PlatformWorkloadIdentityRoleSets ¶
type PlatformWorkloadIdentityRoleSets interface {
ChangeFeed() cosmosdb.PlatformWorkloadIdentityRoleSetDocumentIterator
Create(context.Context, *api.PlatformWorkloadIdentityRoleSetDocument) (*api.PlatformWorkloadIdentityRoleSetDocument, error)
Delete(context.Context, *api.PlatformWorkloadIdentityRoleSetDocument) error
Get(context.Context, string) (*api.PlatformWorkloadIdentityRoleSetDocument, error)
Update(context.Context, *api.PlatformWorkloadIdentityRoleSetDocument) (*api.PlatformWorkloadIdentityRoleSetDocument, error)
Patch(context.Context, string, func(*api.PlatformWorkloadIdentityRoleSetDocument) error) (*api.PlatformWorkloadIdentityRoleSetDocument, error)
ListAll(context.Context) (*api.PlatformWorkloadIdentityRoleSetDocuments, error)
NewUUID() string
}
func NewPlatformWorkloadIdentityRoleSets ¶
func NewPlatformWorkloadIdentityRoleSets(ctx context.Context, dbc cosmosdb.DatabaseClient, dbName string) (PlatformWorkloadIdentityRoleSets, error)
func NewPlatformWorkloadIdentityRoleSetsWithProvidedClient ¶
func NewPlatformWorkloadIdentityRoleSetsWithProvidedClient(client cosmosdb.PlatformWorkloadIdentityRoleSetDocumentClient, uuid uuid.Generator) PlatformWorkloadIdentityRoleSets
type Portal ¶
type Portal interface {
Create(context.Context, *api.PortalDocument) (*api.PortalDocument, error)
Get(context.Context, string) (*api.PortalDocument, error)
Patch(context.Context, string, func(*api.PortalDocument) error) (*api.PortalDocument, error)
NewUUID() string
}
Portal is the database interface for PortalDocuments
func NewPortalWithProvidedClient ¶
func NewPortalWithProvidedClient(client cosmosdb.PortalDocumentClient, uuidGenerator uuid.Generator) Portal
type Subscriptions ¶
type Subscriptions interface {
Create(context.Context, *api.SubscriptionDocument) (*api.SubscriptionDocument, error)
Get(context.Context, string) (*api.SubscriptionDocument, error)
Update(context.Context, *api.SubscriptionDocument) (*api.SubscriptionDocument, error)
ChangeFeed() cosmosdb.SubscriptionDocumentIterator
Dequeue(context.Context) (*api.SubscriptionDocument, error)
Lease(context.Context, string) (*api.SubscriptionDocument, error)
EndLease(context.Context, string, bool, bool) (*api.SubscriptionDocument, error)
}
Subscriptions is the database interface for SubscriptionDocuments
func NewSubscriptions ¶
func NewSubscriptions(ctx context.Context, dbc cosmosdb.DatabaseClient, dbName string) (Subscriptions, error)
NewSubscriptions returns a new Subscriptions
func NewSubscriptionsWithProvidedClient ¶
func NewSubscriptionsWithProvidedClient(client cosmosdb.SubscriptionDocumentClient, uuid string) Subscriptions