Skip to content

Commit e19b7c5

Browse files
migmartriclaude
andcommitted
feat(sdk): add Singleton property to integration definitions
Allow integrations to declare whether multiple registrations per organization are supported. This enables enforcement of single-instance integrations like AI providers. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent d2534c3 commit e19b7c5

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

app/controlplane/plugins/sdk/v1/fanout.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2023 The Chainloop Authors.
2+
// Copyright 2023-2026 The Chainloop Authors.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -138,7 +138,12 @@ type NewParams struct {
138138
func NewFanOut(p *NewParams, opts ...NewOpt) (*FanOutIntegration, error) {
139139
base, err := NewIntegrationBase(
140140
&IntegrationBaseOptions{
141-
p.ID, p.Name, p.Version, p.Description, []string{IntegrationKindFanOut}, p.InputSchema,
141+
ID: p.ID,
142+
Name: p.Name,
143+
Version: p.Version,
144+
Description: p.Description,
145+
Kinds: []string{IntegrationKindFanOut},
146+
Schema: p.InputSchema,
142147
},
143148
)
144149
if err != nil {

app/controlplane/plugins/sdk/v1/integrations.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2025 The Chainloop Authors.
2+
// Copyright 2025-2026 The Chainloop Authors.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -55,6 +55,8 @@ type IntegrationBase struct {
5555
Description string
5656
// kinds of integration (e.g. "notification", "task-manager", "fanout", etc.)
5757
Kinds []string
58+
// Whether only one registration per organization is allowed
59+
Singleton bool
5860

5961
// Rendered schema definitions
6062
// Generated from the schema definitions using https://github.com/invopop/jsonschema
@@ -73,6 +75,8 @@ type IntegrationBaseOptions struct {
7375
Description string
7476
Kinds []string
7577
Schema *InputSchema
78+
// Whether only one registration per organization is allowed
79+
Singleton bool
7680
}
7781

7882
// NewIntegrationBase helper to create a new IntegrationBase
@@ -119,6 +123,7 @@ func NewIntegrationBase(opts *IntegrationBaseOptions) (*IntegrationBase, error)
119123
Version: opts.Version,
120124
Description: opts.Description,
121125
Kinds: opts.Kinds,
126+
Singleton: opts.Singleton,
122127
registrationJSONSchema: registrationJSONSchema,
123128
attachmentJSONSchema: attachmentJSONSchema,
124129
}, nil
@@ -131,6 +136,7 @@ func (i *IntegrationBase) Describe() *IntegrationInfo {
131136
Version: i.Version,
132137
Description: i.Description,
133138
Kinds: i.Kinds,
139+
Singleton: i.Singleton,
134140
RegistrationJSONSchema: i.registrationJSONSchema,
135141
AttachmentJSONSchema: i.attachmentJSONSchema,
136142
}
@@ -147,6 +153,8 @@ type IntegrationInfo struct {
147153
Description string
148154
// Kinds of integration (e.g. "notification", "task-manager", "fanout", etc.)
149155
Kinds []string
156+
// Whether only one registration per organization is allowed
157+
Singleton bool
150158
// Schemas in JSON schema format
151159
RegistrationJSONSchema, AttachmentJSONSchema []byte
152160
}

0 commit comments

Comments
 (0)