/ mlflow / protos / webhooks.proto
webhooks.proto
  1  syntax = "proto2";
  2  
  3  package mlflow;
  4  
  5  import "databricks.proto";
  6  import "scalapb/scalapb.proto";
  7  
  8  option java_generate_equals_and_hash = true;
  9  option java_package = "org.mlflow.api.proto";
 10  option py_generic_services = true;
 11  option (scalapb.options) = {flat_package: true};
 12  
 13  // Webhook service for Model Registry
 14  service WebhookService {
 15    rpc createWebhook(CreateWebhook) returns (CreateWebhook.Response) {
 16      option (rpc) = {
 17        endpoints: [
 18          {
 19            method: "POST"
 20            path: "/mlflow/webhooks"
 21            since: {
 22              major: 2
 23              minor: 0
 24            }
 25          }
 26        ]
 27        visibility: PUBLIC
 28        rpc_doc_title: "Create Webhook"
 29      };
 30    }
 31  
 32    rpc listWebhooks(ListWebhooks) returns (ListWebhooks.Response) {
 33      option (rpc) = {
 34        endpoints: [
 35          {
 36            method: "GET"
 37            path: "/mlflow/webhooks"
 38            since: {
 39              major: 2
 40              minor: 0
 41            }
 42          }
 43        ]
 44        visibility: PUBLIC
 45        rpc_doc_title: "List Webhooks"
 46      };
 47    }
 48  
 49    rpc getWebhook(GetWebhook) returns (GetWebhook.Response) {
 50      option (rpc) = {
 51        endpoints: [
 52          {
 53            method: "GET"
 54            path: "/mlflow/webhooks/{webhook_id}"
 55            since: {
 56              major: 2
 57              minor: 0
 58            }
 59          }
 60        ]
 61        visibility: PUBLIC
 62        rpc_doc_title: "Get Webhook"
 63      };
 64    }
 65  
 66    rpc updateWebhook(UpdateWebhook) returns (UpdateWebhook.Response) {
 67      option (rpc) = {
 68        endpoints: [
 69          {
 70            method: "PATCH"
 71            path: "/mlflow/webhooks/{webhook_id}"
 72            since: {
 73              major: 2
 74              minor: 0
 75            }
 76          }
 77        ]
 78        visibility: PUBLIC
 79        rpc_doc_title: "Update Webhook"
 80      };
 81    }
 82  
 83    rpc deleteWebhook(DeleteWebhook) returns (DeleteWebhook.Response) {
 84      option (rpc) = {
 85        endpoints: [
 86          {
 87            method: "DELETE"
 88            path: "/mlflow/webhooks/{webhook_id}"
 89            since: {
 90              major: 2
 91              minor: 0
 92            }
 93          }
 94        ]
 95        visibility: PUBLIC
 96        rpc_doc_title: "Delete Webhook"
 97      };
 98    }
 99  
100    rpc testWebhook(TestWebhook) returns (TestWebhook.Response) {
101      option (rpc) = {
102        endpoints: [
103          {
104            method: "POST"
105            path: "/mlflow/webhooks/{webhook_id}/test"
106            since: {
107              major: 2
108              minor: 0
109            }
110          }
111        ]
112        visibility: PUBLIC
113        rpc_doc_title: "Test Webhook"
114      };
115    }
116  }
117  
118  // Webhook status enumeration
119  enum WebhookStatus {
120    ACTIVE = 1; // Webhook is active and receiving events
121    DISABLED = 2; // Webhook is disabled and not receiving events
122  }
123  
124  // Webhook entity types
125  enum WebhookEntity {
126    ENTITY_UNSPECIFIED = 0; // Default/unknown entity
127    REGISTERED_MODEL = 1; // Registered model entity
128    MODEL_VERSION = 2; // Model version entity
129    MODEL_VERSION_TAG = 3; // Model version tag entity
130    MODEL_VERSION_ALIAS = 4; // Model version alias entity
131    PROMPT = 5; // Prompt entity
132    PROMPT_VERSION = 6; // Prompt version entity
133    PROMPT_TAG = 7; // Prompt tag entity
134    PROMPT_VERSION_TAG = 8; // Prompt version tag entity
135    PROMPT_ALIAS = 9; // Prompt alias entity
136    BUDGET_POLICY = 10; // Budget policy entity
137  }
138  
139  // Webhook action types
140  enum WebhookAction {
141    ACTION_UNSPECIFIED = 0; // Default/unknown action
142    CREATED = 1; // Entity was created
143    UPDATED = 2; // Entity was updated
144    DELETED = 3; // Entity was deleted
145    SET = 4; // Entity was set (e.g., tag set)
146    EXCEEDED = 5; // Budget limit was exceeded
147  }
148  
149  // Webhook event definition
150  message WebhookEvent {
151    // Entity type (required)
152    optional WebhookEntity entity = 1 [(validate_required) = true];
153  
154    // Action type (required)
155    optional WebhookAction action = 2 [(validate_required) = true];
156  }
157  
158  // Webhook entity
159  message Webhook {
160    // Unique identifier for the webhook
161    optional string webhook_id = 1;
162  
163    // Name of the webhook
164    optional string name = 2;
165  
166    // Optional description for the webhook
167    optional string description = 3;
168  
169    // URL to send webhook events to
170    optional string url = 4;
171  
172    // List of events this webhook is subscribed to
173    repeated WebhookEvent events = 5;
174  
175    // Current status of the webhook
176    optional WebhookStatus status = 6;
177  
178    // Timestamp when webhook was created
179    optional int64 creation_timestamp = 7;
180  
181    // Timestamp when webhook was last updated
182    optional int64 last_updated_timestamp = 8;
183  }
184  
185  // Test webhook result
186  message WebhookTestResult {
187    // Whether the test succeeded
188    optional bool success = 1;
189  
190    // HTTP response status code if available
191    optional int32 response_status = 2;
192  
193    // Response body if available
194    optional string response_body = 3;
195  
196    // Error message if test failed
197    optional string error_message = 4;
198  }
199  
200  // Create webhook request
201  message CreateWebhook {
202    option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
203  
204    // Name of the webhook
205    optional string name = 1 [(validate_required) = true];
206  
207    // Optional description for the webhook
208    optional string description = 2;
209  
210    // URL to send webhook events to
211    optional string url = 3 [(validate_required) = true];
212  
213    // List of events to subscribe to
214    repeated WebhookEvent events = 4 [(validate_required) = true];
215  
216    // Secret key for HMAC signature verification
217    optional string secret = 5;
218  
219    // Initial status (defaults to ACTIVE if not specified)
220    optional WebhookStatus status = 6;
221  
222    message Response {
223      optional Webhook webhook = 1;
224    }
225  }
226  
227  // List webhooks request
228  message ListWebhooks {
229    option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
230  
231    // Maximum number of webhooks to return
232    optional int32 max_results = 1 [default = 100];
233  
234    // Pagination token from previous request
235    optional string page_token = 2;
236  
237    message Response {
238      // List of webhooks
239      repeated Webhook webhooks = 1;
240  
241      // Pagination token for next page
242      optional string next_page_token = 2;
243    }
244  }
245  
246  // Get webhook request
247  message GetWebhook {
248    option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
249  
250    // ID of the webhook to retrieve
251    optional string webhook_id = 1 [(validate_required) = true];
252  
253    message Response {
254      optional Webhook webhook = 1;
255    }
256  }
257  
258  // Update webhook request
259  message UpdateWebhook {
260    option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
261  
262    // ID of the webhook to update
263    optional string webhook_id = 1 [(validate_required) = true];
264  
265    // New name for the webhook
266    optional string name = 2;
267  
268    // New description for the webhook
269    optional string description = 3;
270  
271    // New URL for the webhook
272    optional string url = 4;
273  
274    // New list of events to subscribe to
275    repeated WebhookEvent events = 5;
276  
277    // New secret key for HMAC signature
278    optional string secret = 6;
279  
280    // New status for the webhook
281    optional WebhookStatus status = 7;
282  
283    message Response {
284      optional Webhook webhook = 1;
285    }
286  }
287  
288  // Delete webhook request
289  message DeleteWebhook {
290    option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
291  
292    // ID of the webhook to delete
293    optional string webhook_id = 1 [(validate_required) = true];
294  
295    message Response {
296      // Empty response
297    }
298  }
299  
300  // Test webhook request
301  message TestWebhook {
302    option (scalapb.message).extends = "com.databricks.rpc.RPC[$this.Response]";
303  
304    // ID of the webhook to test
305    optional string webhook_id = 1 [(validate_required) = true];
306  
307    // Optional event type to test. If not specified, defaults to the first event type
308    // in the webhook's subscribed events.
309    optional WebhookEvent event = 2;
310  
311    message Response {
312      optional WebhookTestResult result = 1;
313    }
314  }