@@ -20,12 +20,25 @@ type AssetNoContent = record {
2020 version : opt nat64;
2121};
2222type AssetsUpgradeOptions = record { clear_existing_assets : opt bool };
23+ type AuthenticateAutomationArgs = variant {
24+ OpenId : OpenIdPrepareAutomationArgs;
25+ };
26+ type AuthenticateAutomationResultResponse = variant {
27+ Ok : record { principal; AutomationController };
28+ Err : AuthenticationAutomationError;
29+ };
2330type AuthenticateResultResponse = variant {
2431 Ok : Authentication;
2532 Err : AuthenticationError;
2633};
2734type Authentication = record { doc : Doc; delegation : PreparedDelegation };
2835type AuthenticationArgs = variant { OpenId : OpenIdPrepareDelegationArgs };
36+ type AuthenticationAutomationError = variant {
37+ PrepareAutomation : PrepareAutomationError;
38+ RegisterController : text;
39+ SaveWorkflowMetadata : text;
40+ SaveUniqueJtiToken : text;
41+ };
2942type AuthenticationConfig = record {
3043 updated_at : opt nat64;
3144 openid : opt AuthenticationConfigOpenId;
@@ -40,13 +53,31 @@ type AuthenticationConfigInternetIdentity = record {
4053};
4154type AuthenticationConfigOpenId = record {
4255 observatory_id : opt principal;
43- providers : vec record { OpenIdProvider; OpenIdProviderConfig };
56+ providers : vec record { OpenIdDelegationProvider; OpenIdAuthProviderConfig };
4457};
4558type AuthenticationError = variant {
4659 PrepareDelegation : PrepareDelegationError;
4760 RegisterUser : text;
4861};
4962type AuthenticationRules = record { allowed_callers : vec principal };
63+ type AutomationConfig = record {
64+ updated_at : opt nat64;
65+ openid : opt AutomationConfigOpenId;
66+ created_at : opt nat64;
67+ version : opt nat64;
68+ };
69+ type AutomationConfigOpenId = record {
70+ observatory_id : opt principal;
71+ providers : vec record {
72+ OpenIdAutomationProvider;
73+ OpenIdAutomationProviderConfig;
74+ };
75+ };
76+ type AutomationController = record {
77+ scope : AutomationScope;
78+ expires_at : nat64;
79+ };
80+ type AutomationScope = variant { Write; Submit };
5081type CollectionType = variant { Db; Storage };
5182type CommitBatch = record {
5283 batch_id : nat;
@@ -58,15 +89,18 @@ type Config = record {
5889 db : opt DbConfig;
5990 authentication : opt AuthenticationConfig;
6091 storage : StorageConfig;
92+ automation : opt AutomationConfig;
6193};
6294type ConfigMaxMemorySize = record { stable : opt nat64; heap : opt nat64 };
6395type Controller = record {
6496 updated_at : nat64;
6597 metadata : vec record { text; text };
98+ kind : opt ControllerKind;
6699 created_at : nat64;
67100 scope : ControllerScope;
68101 expires_at : opt nat64;
69102};
103+ type ControllerKind = variant { Emulator; Automation };
70104type ControllerScope = variant { Write; Admin; Submit };
71105type CustomDomain = record {
72106 updated_at : nat64;
@@ -106,6 +140,7 @@ type GetDelegationError = variant {
106140 JwtVerify : JwtVerifyError;
107141 GetOrFetchJwks : GetOrRefreshJwksError;
108142 DeriveSeedFailed : text;
143+ InvalidObservatoryId : text;
109144};
110145type GetDelegationResultResponse = variant {
111146 Ok : SignedDelegation;
@@ -210,33 +245,55 @@ type ListRulesResults = record {
210245};
211246type Memory = variant { Heap; Stable };
212247type MemorySize = record { stable : nat64; heap : nat64 };
248+ type OpenIdAuthProviderConfig = record {
249+ delegation : opt OpenIdAuthProviderDelegationConfig;
250+ client_id : text;
251+ };
252+ type OpenIdAuthProviderDelegationConfig = record {
253+ targets : opt vec principal;
254+ max_time_to_live : opt nat64;
255+ };
256+ type OpenIdAutomationProvider = variant { GitHub };
257+ type OpenIdAutomationProviderConfig = record {
258+ controller : opt OpenIdAutomationProviderControllerConfig;
259+ repositories : vec record { RepositoryKey; OpenIdAutomationRepositoryConfig };
260+ };
261+ type OpenIdAutomationProviderControllerConfig = record {
262+ scope : opt AutomationScope;
263+ max_time_to_live : opt nat64;
264+ };
265+ type OpenIdAutomationRepositoryConfig = record { refs : opt vec text };
266+ type OpenIdDelegationProvider = variant { GitHub; Google };
213267type OpenIdGetDelegationArgs = record {
214268 jwt : text;
215269 session_key : blob;
216270 salt : blob;
217271 expiration : nat64;
218272};
273+ type OpenIdPrepareAutomationArgs = record { jwt : text; salt : blob };
219274type OpenIdPrepareDelegationArgs = record {
220275 jwt : text;
221276 session_key : blob;
222277 salt : blob;
223278};
224- type OpenIdProvider = variant { Google };
225- type OpenIdProviderConfig = record {
226- delegation : opt OpenIdProviderDelegationConfig;
227- client_id : text;
228- };
229- type OpenIdProviderDelegationConfig = record {
230- targets : opt vec principal;
231- max_time_to_live : opt nat64;
232- };
233279type Permission = variant { Controllers; Private; Public; Managed };
280+ type PrepareAutomationError = variant {
281+ JwtFindProvider : JwtFindProviderError;
282+ InvalidController : text;
283+ GetCachedJwks;
284+ JwtVerify : JwtVerifyError;
285+ GetOrFetchJwks : GetOrRefreshJwksError;
286+ ControllerAlreadyExists;
287+ InvalidObservatoryId : text;
288+ TooManyControllers : text;
289+ };
234290type PrepareDelegationError = variant {
235291 JwtFindProvider : JwtFindProviderError;
236292 GetCachedJwks;
237293 JwtVerify : JwtVerifyError;
238294 GetOrFetchJwks : GetOrRefreshJwksError;
239295 DeriveSeedFailed : text;
296+ InvalidObservatoryId : text;
240297};
241298type PreparedDelegation = record { user_key : blob; expiration : nat64 };
242299type Proposal = record {
@@ -263,6 +320,7 @@ type ProposalType = variant {
263320 SegmentsDeployment : SegmentsDeploymentOptions;
264321};
265322type RateConfig = record { max_tokens : nat64; time_per_token_ns : nat64 };
323+ type RepositoryKey = record { owner : text; name : text };
266324type Rule = record {
267325 max_capacity : opt nat32;
268326 memory : opt Memory;
@@ -287,8 +345,13 @@ type SetAuthenticationConfig = record {
287345 internet_identity : opt AuthenticationConfigInternetIdentity;
288346 rules : opt AuthenticationRules;
289347};
348+ type SetAutomationConfig = record {
349+ openid : opt AutomationConfigOpenId;
350+ version : opt nat64;
351+ };
290352type SetController = record {
291353 metadata : vec record { text; text };
354+ kind : opt ControllerKind;
292355 scope : ControllerScope;
293356 expires_at : opt nat64;
294357};
@@ -373,6 +436,9 @@ type UploadChunk = record {
373436type UploadChunkResult = record { chunk_id : nat };
374437service : (InitSatelliteArgs) -> {
375438 authenticate : (AuthenticationArgs) -> (AuthenticateResultResponse);
439+ authenticate_automation : (AuthenticateAutomationArgs) -> (
440+ AuthenticateAutomationResultResponse,
441+ );
376442 commit_asset_upload : (CommitBatch) -> ();
377443 commit_proposal : (CommitProposal) -> (null);
378444 commit_proposal_asset_upload : (CommitBatch) -> ();
@@ -384,6 +450,7 @@ service : (InitSatelliteArgs) -> {
384450 count_proposals : () -> (nat64) query;
385451 del_asset : (text, text) -> ();
386452 del_assets : (text) -> ();
453+ del_controller_self : () -> ();
387454 del_controllers : (DeleteControllersArgs) -> (
388455 vec record { principal; Controller },
389456 );
@@ -399,6 +466,7 @@ service : (InitSatelliteArgs) -> {
399466 deposit_cycles : (DepositCyclesArgs) -> ();
400467 get_asset : (text, text) -> (opt AssetNoContent) query;
401468 get_auth_config : () -> (opt AuthenticationConfig) query;
469+ get_automation_config : () -> (opt AutomationConfig) query;
402470 get_config : () -> (Config);
403471 get_db_config : () -> (opt DbConfig) query;
404472 get_delegation : (GetDelegationArgs) -> (GetDelegationResultResponse) query;
@@ -432,6 +500,7 @@ service : (InitSatelliteArgs) -> {
432500 reject_proposal : (CommitProposal) -> (null);
433501 set_asset_token : (text, text, opt text) -> ();
434502 set_auth_config : (SetAuthenticationConfig) -> (AuthenticationConfig);
503+ set_automation_config : (SetAutomationConfig) -> (AutomationConfig);
435504 set_controllers : (SetControllersArgs) -> (
436505 vec record { principal; Controller },
437506 );
0 commit comments