Skip to content

Commit f2a0faa

Browse files
committed
Add Ballerina language support
1 parent 748d5ca commit f2a0faa

35 files changed

+4616
-13432
lines changed

package-lock.json

Lines changed: 16 additions & 13425 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,7 @@
854854
"PowerShell",
855855
"Python",
856856
"TypeScript",
857+
"Ballerina",
857858
"Custom"
858859
],
859860
"description": "%azureFunctions.projectLanguage%",
@@ -867,6 +868,7 @@
867868
"",
868869
"",
869870
"",
871+
"",
870872
""
871873
]
872874
},

resources/backupTemplates/ballerina/1.json

Lines changed: 571 additions & 0 deletions
Large diffs are not rendered by default.

resources/backupTemplates/ballerina/bindings/bindings.json

Lines changed: 345 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"en": {
3+
"temp_category_api": "API & Webhooks",
4+
"temp_category_core": "Core",
5+
"temp_category_dataProcessing": "Data Processing",
6+
"HttpTrigger_description": "A function that will be run whenever it receives an HTTP request, responding based on data in the body or query string",
7+
"BlobTrigger_description": "A function that will be run whenever a blob is added to a specified container",
8+
"CosmosDBTrigger_description": "A function that will be run whenever documents change in a document collection",
9+
"QueueTrigger_description": "A function that will be run whenever a message is added to a specified Azure Storage queue",
10+
"TimerTrigger_description": "A function that will be run on a specified schedule",
11+
"variables_storageConnStringLabel": "Storage account connection",
12+
"variables_appSettingsHelp": "The name of the app setting containing your storage account connection string.",
13+
"variables_selectConnection": "Click select to choose a connection",
14+
"variables_parameterName": "The parameter name must be an alphanumeric string of any number of characters and cannot start with a number.",
15+
"timerTrigger_displayName": "Timer",
16+
"timerTrigger_name_help": "The name used to identify this trigger in your code",
17+
"timerTrigger_name_label": "Timestamp parameter name",
18+
"timerTrigger_schedule_help": "Enter a cron expression of the format '{second} {minute} {hour} {day} {month} {day of week}' to specify the schedule.",
19+
"timerTrigger_schedule_label": "Schedule",
20+
"queueTrigger_displayName": "Azure Queue Storage",
21+
"queueTrigger_queueName_help": "Name of the queue from which the message will be read",
22+
"queueTrigger_name_label": "Message parameter name",
23+
"queueTrigger_queueName_errorText": "Queue name must start and end with a letter or number, and it can contain only lowercase letters, numbers, and the hyphen. The name must be 3 to 63 characters.",
24+
"queueTrigger_name_help": "The name used to identify this trigger in your code",
25+
"queueTrigger_queueName_label": "Queue name",
26+
"blobTrigger_displayName": "Azure Blob Storage",
27+
"blobTrigger_name_label": "Blob parameter name",
28+
"blobTrigger_name_help": "The name used to identify this trigger in your code",
29+
"blobTrigger_path_label": "Path",
30+
"blobTrigger_path_help": "The path within your storage account that the trigger will monitor.",
31+
"blobTrigger_path_errorText": "Your blob path must be a container name of 3 to 63 characters, followed by a blob name of 1 to 1,024 characters. The blob name can be any combination of characters and can contain a maximum of 254 path segments, which are separated by the forward slash (/).",
32+
"httpTrigger_displayName": "HTTP",
33+
"httpTrigger_name_label": "Request parameter name",
34+
"httpTrigger_name_help": "The name used to identify this trigger in your code",
35+
"httpTrigger_authLevel_label": "Authorization level",
36+
"httpTrigger_authLevel_help": "Authorization level controls whether the function requires an API key and which key to use; Function uses a function key; Admin uses your master key. The function and master keys are found in the 'keys' management panel on the portal, when your function is selected. For user-based authentication, go to Function App Settings.",
37+
"httpTrigger_methods_label": "Selected HTTP methods",
38+
"httpTrigger_methods_help": "These are the only methods to which this function will respond.",
39+
"httpTrigger_methodRule_label": "Allowed HTTP methods",
40+
"httpTrigger_route_label": "Route template",
41+
"httpTrigger_route_help": "The route template setting allows you to change the URI that triggers this function. The values should be a relative path. Path segments may be treated as parameters by surrounding them with curly braces. For example: customer/{customerId}",
42+
"httpTrigger_methodRule_help": "HttpTrigger can respond to any HTTP method. If you wish to restrict support to specific methods, choose the 'Selected methods' option.",
43+
"httpTrigger_mode_label": "Mode",
44+
"httpTrigger_mode_help": "The mode of the trigger. \"Standard\" means that the request will be standard HTTP with no additional semantics. \"Webhook\" means that the request will be processed according to a specified webhook type.",
45+
"cosmosDB_trigger_displayName": "Azure Cosmos DB",
46+
"cosmosDBIn_collectionName_help": "Name of the collection to be monitored.",
47+
"cosmosDBIn_collectionName_label": "Collection name",
48+
"cosmosDBIn_connection_help": "The name of the App Setting containing the connection string to the service that contains the collection to be monitored.",
49+
"cosmosDBIn_connection_label": "Cosmos DB account connection",
50+
"cosmosDBIn_databaseName_help": "Name of the Cosmos DB database that includes the collection to be monitored.",
51+
"cosmosDBIn_databaseName_label": "Database name",
52+
"cosmosDBIn_leaseCollectionName_help": "Name of the collection to store the leases.",
53+
"cosmosDBIn_leaseCollectionName_label": "Collection name for leases",
54+
"cosmosDBIn_leaseDatabaseName_help": "Name of the database that includes the collection to store the leases.",
55+
"cosmosDBIn_leaseDatabaseName_label": "Database name for leases",
56+
"cosmosDBIn_name_help": "The name used to identify this binding in your code",
57+
"cosmosDBIn_name_label": "Document collection parameter name",
58+
"cosmosDBIn_createIfNotExists_help": "Checks for existence and automatically creates the leases collection.",
59+
"cosmosDBIn_createIfNotExists_label": "Create lease collection if it does not exist"
60+
}
61+
}
336 KB
Binary file not shown.
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
[
2+
{
3+
"id": "HttpTrigger-Ballerina",
4+
"runtime": "2",
5+
"files": {
6+
"%functionName%.bal": "import ballerinax/azure_functions as af;\n\n// This function gets triggered by an HTTP call with the name query parameter and returns a processed HTTP output to the caller.\n@af:HttpTrigger{\n authLevel: \"%authLevel%\"\n}\nlistener af:HttpListener httpListener = new af:HttpListener();\nservice /%functionName% on httpListener {\n resource function get .(string name) returns string {\n return \"Hello, \" + name + \"!\";\n }\n}\n"
7+
},
8+
"metadata": {
9+
"defaultFunctionName": "httpTrigger",
10+
"description": "$HttpTrigger_description",
11+
"name": "HTTP trigger",
12+
"language": "Ballerina",
13+
"triggerType": "httpTrigger",
14+
"category": [
15+
"$temp_category_core",
16+
"$temp_category_api"
17+
],
18+
"categoryStyle": "http",
19+
"enabledInTryMode": true,
20+
"userPrompt": [
21+
"authLevel"
22+
]
23+
}
24+
},
25+
{
26+
"id": "BlobTrigger-Ballerina",
27+
"runtime": "2",
28+
"files": {
29+
"%functionName%.bal": "import ballerinax/azure_functions as af;\nimport ballerina/log;\n\n// The following Function will be invoked when a new blob added to the specified blob storage.\n@af:BlobTrigger {\n path: \"%path%\",\n connection: \"%connection%\"\n}\nlistener af:BlobListener blobListener = new af:BlobListener();\n\nservice \"%functionName%\" on blobListener {\n remote function onUpdate(byte[] blobIn) {\n log:printInfo(\"Blob Store updated with file of \" + blobIn.length().toString() + \" bytes\");\n }\n}\n"
30+
},
31+
"metadata": {
32+
"defaultFunctionName": "blobTrigger",
33+
"description": "$BlobTrigger_description",
34+
"name": "Blob trigger",
35+
"language": "Ballerina",
36+
"triggerType": "blobTrigger",
37+
"category": [
38+
"$temp_category_core",
39+
"$temp_category_dataProcessing"
40+
],
41+
"categoryStyle": "blob",
42+
"enabledInTryMode": true,
43+
"userPrompt": [
44+
"connection",
45+
"path"
46+
]
47+
}
48+
},
49+
{
50+
"id": "CosmosDBTrigger-Ballerina",
51+
"runtime": "2",
52+
"files": {
53+
"%functionName%.bal": "import ballerina/log;\nimport ballerinax/azure_functions as af;\n\n// The following Function will be invoked when an entry is added to CosmosDB collection.\n@af:CosmosDBTrigger {connectionStringSetting: \"%connectionStringSetting%\", databaseName: \"%databaseName%\", collectionName: \"%collectionName%\"}\nlistener af:CosmosDBListener cosmosEp = new ();\n\ntype Users record {\n string id;\n string name;\n};\n\nservice \"%functionName%\" on cosmosEp {\n remote function onUpdate(Users[] users) {\n log:printInfo(users.toJsonString());\n }\n}\n"
54+
},
55+
"metadata": {
56+
"defaultFunctionName": "cosmosTrigger",
57+
"description": "$CosmosDBTrigger_description",
58+
"name": "CosmosDB trigger",
59+
"language": "Ballerina",
60+
"triggerType": "cosmosDBTrigger",
61+
"category": [
62+
"$temp_category_core",
63+
"$temp_category_dataProcessing"
64+
],
65+
"categoryStyle": "cosmosDB",
66+
"enabledInTryMode": true,
67+
"userPrompt": [
68+
"connectionStringSetting",
69+
"databaseName",
70+
"collectionName"
71+
]
72+
}
73+
},
74+
{
75+
"id": "QueueTrigger-Ballerina",
76+
"runtime": "2",
77+
"files": {
78+
"%functionName%.bal": "import ballerina/log;\nimport ballerinax/azure_functions as af;\n\n\n// The following Function will be executed when a message is added to the queue storage.\n@af:QueueTrigger {\n queueName: \"%queueName%\",\n connection: \"%connection%\"\n}\nlistener af:QueueListener queueListener = new af:QueueListener();\n\nservice \"%functionName%\" on queueListener {\n remote function onMessage(string message) {\n log:printInfo(\"Queue message received: \" + message);\n }\n}\n"
79+
},
80+
"metadata": {
81+
"defaultFunctionName": "queueTrigger",
82+
"description": "$QueueTrigger_description",
83+
"name": "Queue trigger",
84+
"language": "Ballerina",
85+
"triggerType": "queueTrigger",
86+
"category": [
87+
"$temp_category_core",
88+
"$temp_category_dataProcessing"
89+
],
90+
"categoryStyle": "queue",
91+
"enabledInTryMode": true,
92+
"userPrompt": [
93+
"connection",
94+
"queueName"
95+
]
96+
}
97+
},
98+
{
99+
"id": "TimerTrigger-Ballerina",
100+
"runtime": "2",
101+
"files": {
102+
"%functionName%.bal": "import ballerina/time;\nimport ballerina/log;\nimport ballerinax/azure_functions as af;\n\n// The following function will be invoked periodically according to the schedule given.\n@af:TimerTrigger {schedule: \"%schedule%\"}\nlistener af:TimerListener timerEp = new ();\n\nservice \"%functionName%\" on timerEp {\n remote function onTrigger(af:TimerMetadata metadata) {\n log:printInfo(\"Function Executed at \" + time:utcToString(time:utcNow()));\n }\n}\n"
103+
},
104+
"metadata": {
105+
"defaultFunctionName": "timerTrigger",
106+
"description": "$TimerTrigger_description",
107+
"name": "Timer trigger",
108+
"language": "Ballerina",
109+
"triggerType": "timerTrigger",
110+
"category": [
111+
"$temp_category_core",
112+
"$temp_category_dataProcessing"
113+
],
114+
"categoryStyle": "timer",
115+
"enabledInTryMode": true,
116+
"userPrompt": [
117+
"schedule"
118+
]
119+
}
120+
}
121+
]

0 commit comments

Comments
 (0)