| 
									
										
										
										
											2024-07-03 01:31:37 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * To generate alerting k8s APIs, run: | 
					
						
							|  |  |  |  * `npx rtk-query-codegen-openapi ./scripts/generate-alerting-rtk-apis.ts` | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import { ConfigFile } from '@rtk-query/codegen-openapi'; | 
					
						
							|  |  |  | import { accessSync } from 'fs'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const schemaFile = '../data/alerting/openapi.json'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | try { | 
					
						
							|  |  |  |   // Check we have the OpenAPI before generating alerting RTK APIs,
 | 
					
						
							|  |  |  |   // as this is currently a manual process
 | 
					
						
							|  |  |  |   accessSync(schemaFile); | 
					
						
							|  |  |  | } catch (e) { | 
					
						
							|  |  |  |   console.error('\nCould not find OpenAPI definition.\n'); | 
					
						
							|  |  |  |   console.error( | 
					
						
							|  |  |  |     'Please visit /openapi/v3/apis/notifications.alerting.grafana.app/v0alpha1 and save the OpenAPI definition to data/alerting/openapi.json\n' | 
					
						
							|  |  |  |   ); | 
					
						
							|  |  |  |   throw e; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const config: ConfigFile = { | 
					
						
							|  |  |  |   schemaFile, | 
					
						
							|  |  |  |   apiFile: '', | 
					
						
							|  |  |  |   tag: true, | 
					
						
							|  |  |  |   outputFiles: { | 
					
						
							|  |  |  |     '../public/app/features/alerting/unified/openapi/timeIntervalsApi.gen.ts': { | 
					
						
							|  |  |  |       apiFile: '../public/app/features/alerting/unified/api/alertingApi.ts', | 
					
						
							|  |  |  |       apiImport: 'alertingApi', | 
					
						
							| 
									
										
										
										
											2024-07-31 21:59:15 +08:00
										 |  |  |       filterEndpoints: [ | 
					
						
							|  |  |  |         'listNamespacedTimeInterval', | 
					
						
							|  |  |  |         'createNamespacedTimeInterval', | 
					
						
							|  |  |  |         'deleteNamespacedTimeInterval', | 
					
						
							|  |  |  |         'replaceNamespacedTimeInterval', | 
					
						
							|  |  |  |       ], | 
					
						
							| 
									
										
										
										
											2024-07-03 01:31:37 +08:00
										 |  |  |       exportName: 'generatedTimeIntervalsApi', | 
					
						
							|  |  |  |       flattenArg: false, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2024-08-01 21:41:40 +08:00
										 |  |  |     '../public/app/features/alerting/unified/openapi/receiversApi.gen.ts': { | 
					
						
							|  |  |  |       apiFile: '../public/app/features/alerting/unified/api/alertingApi.ts', | 
					
						
							|  |  |  |       apiImport: 'alertingApi', | 
					
						
							| 
									
										
										
										
											2024-08-30 19:10:30 +08:00
										 |  |  |       filterEndpoints: [ | 
					
						
							|  |  |  |         'listNamespacedReceiver', | 
					
						
							|  |  |  |         'createNamespacedReceiver', | 
					
						
							|  |  |  |         'readNamespacedReceiver', | 
					
						
							|  |  |  |         'deleteNamespacedReceiver', | 
					
						
							|  |  |  |         'replaceNamespacedReceiver', | 
					
						
							|  |  |  |       ], | 
					
						
							| 
									
										
										
										
											2024-08-01 21:41:40 +08:00
										 |  |  |       exportName: 'generatedReceiversApi', | 
					
						
							|  |  |  |       flattenArg: false, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2024-10-02 23:14:54 +08:00
										 |  |  |     '../public/app/features/alerting/unified/openapi/templatesApi.gen.ts': { | 
					
						
							|  |  |  |       apiFile: '../public/app/features/alerting/unified/api/alertingApi.ts', | 
					
						
							|  |  |  |       apiImport: 'alertingApi', | 
					
						
							|  |  |  |       filterEndpoints: [ | 
					
						
							|  |  |  |         'listNamespacedTemplateGroup', | 
					
						
							|  |  |  |         'createNamespacedTemplateGroup', | 
					
						
							|  |  |  |         'readNamespacedTemplateGroup', | 
					
						
							|  |  |  |         'replaceNamespacedTemplateGroup', | 
					
						
							|  |  |  |         'deleteNamespacedTemplateGroup', | 
					
						
							|  |  |  |       ], | 
					
						
							|  |  |  |       exportName: 'generatedTemplatesApi', | 
					
						
							| 
									
										
										
										
											2024-11-26 21:46:39 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     '../public/app/features/alerting/unified/openapi/routesApi.gen.ts': { | 
					
						
							|  |  |  |       apiFile: '../public/app/features/alerting/unified/api/alertingApi.ts', | 
					
						
							|  |  |  |       apiImport: 'alertingApi', | 
					
						
							|  |  |  |       filterEndpoints: [ | 
					
						
							|  |  |  |         'listNamespacedRoutingTree', | 
					
						
							|  |  |  |         'replaceNamespacedRoutingTree', | 
					
						
							|  |  |  |         'deleteCollectionNamespacedRoutingTree', | 
					
						
							|  |  |  |       ], | 
					
						
							|  |  |  |       exportName: 'generatedRoutesApi', | 
					
						
							| 
									
										
										
										
											2024-10-02 23:14:54 +08:00
										 |  |  |       flattenArg: false, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2024-07-03 01:31:37 +08:00
										 |  |  |   }, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default config; |