Update the protobuf subtree from 'Azure/azure-functions-language-worker-protobuf'. Branch: dev. Commit: f786ef (#147)

Also update `New-gRPCAutoGenCode` accordingly.
This commit is contained in:
Dongbo Wang 2019-02-19 17:50:09 -08:00 коммит произвёл GitHub
Родитель 9ebf44f942
Коммит 4072ecde23
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 67 добавлений и 7 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -70,6 +70,7 @@ src/Modules
protobuf/*
FunctionRpc.cs
FunctionRpcGrpc.cs
ClaimsIdentityRpc.cs
# pulled in for tests
Azure.Functions.Cli

Просмотреть файл

@ -24,7 +24,7 @@ From within the Azure Functions language worker repo:
From within the Azure Functions language worker repo:
1. Define remote branch for cleaner git commands
- `git remote add proto-file https://github.com/mhoeger/azure-functions-language-worker-protobuf.git`
- `git remote add proto-file https://github.com/azure/azure-functions-language-worker-protobuf.git`
- `git fetch proto-file`
2. Merge updates
- `git merge -s subtree proto-file/<version branch> --squash --allow-unrelated-histories`

Просмотреть файл

@ -10,6 +10,7 @@ option go_package ="github.com/Azure/azure-functions-go-worker/internal/rpc";
package AzureFunctionsRpcMessages;
import "google/protobuf/duration.proto";
import "identity/ClaimsIdentityRpc.proto";
// Interface exported by the server.
service FunctionRpc {
@ -65,6 +66,10 @@ message StreamingMessage {
// Worker logs a message back to the host
RpcLog rpc_log = 2;
FunctionEnvironmentReloadRequest function_environment_reload_request = 25;
FunctionEnvironmentReloadResponse function_environment_reload_response = 26;
}
}
@ -180,6 +185,16 @@ message WorkerStatusRequest{
message WorkerStatusResponse {
}
message FunctionEnvironmentReloadRequest {
// Environment variables from the current process
map<string, string> environment_variables = 1;
}
message FunctionEnvironmentReloadResponse {
// Status of the response
StatusResult result = 3;
}
// Host tells the worker to load a Function
message FunctionLoadRequest {
// unique function identifier (avoid name collisions, facilitate reload case)
@ -287,11 +302,21 @@ message BindingInfo {
inout = 2;
}
// Indicates the type of the data for the binding
enum DataType {
undefined = 0;
string = 1;
binary = 2;
stream = 3;
}
// Type of binding (e.g. HttpTrigger)
string type = 2;
// Direction of the given binding
Direction direction = 3;
DataType data_type = 4;
}
// Used to send logs back to the Host
@ -355,4 +380,5 @@ message RpcHttp {
map<string,string> query = 15;
bool enable_content_negotiation= 16;
TypedData rawBody = 17;
repeated RpcClaimsIdentity identities = 18;
}

Просмотреть файл

@ -0,0 +1,22 @@
syntax = "proto3";
// protobuf vscode extension: https://marketplace.visualstudio.com/items?itemName=zxh404.vscode-proto3
// Light-weight representation of a .NET System.Security.Claims.ClaimsIdentity object.
// This is the same serialization as found in EasyAuth, and needs to be kept in sync with
// its ClaimsIdentitySlim definition, as seen in the WebJobs extension:
// https://github.com/Azure/azure-webjobs-sdk-extensions/blob/dev/src/WebJobs.Extensions.Http/ClaimsIdentitySlim.cs
message RpcClaimsIdentity {
string authentication_type = 1;
string name_claim_type = 2;
string role_claim_type = 3;
repeated RpcClaim claims = 4;
}
// Light-weight representation of a .NET System.Security.Claims.Claim object.
// This is the same serialization as found in EasyAuth, and needs to be kept in sync with
// its ClaimSlim definition, as seen in the WebJobs extension:
// https://github.com/Azure/azure-webjobs-sdk-extensions/blob/dev/src/WebJobs.Extensions.Http/ClaimSlim.cs
message RpcClaim {
string value = 1;
string type = 2;
}

Просмотреть файл

@ -99,11 +99,20 @@ function New-gRPCAutoGenCode
$outputDir = "$RepoRoot/src/Messaging"
Remove-Item "$outputDir/FunctionRpc*.cs" -Force -ErrorAction SilentlyContinue
& $Script:protoc_Path $Script:protobuf_file_Path --csharp_out $outputDir `
& $Script:protoc_Path $Script:claimsIdentityRpc_proto_file_Path `
--csharp_out $outputDir `
--grpc_out=$outputDir `
--plugin=protoc-gen-grpc=$Script:grpc_csharp_plugin_Path `
--proto_path=$Script:identity_dir_Path `
--proto_path=$Script:google_protobuf_tools_Path
& $Script:protoc_Path $Script:functionRpc_proto_file_Path `
--csharp_out $outputDir `
--grpc_out=$outputDir `
--plugin=protoc-gen-grpc=$Script:grpc_csharp_plugin_Path `
--proto_path=$Script:protobuf_dir_Path `
--proto_path=$Script:google_protobuf_tools_Path
if ($LASTEXITCODE -ne 0) {
throw "Failed to generate the CSharp code for gRPC communication."
}
@ -164,7 +173,9 @@ function Resolve-ProtoBufToolPath
}
$Script:protobuf_dir_Path = "$RepoRoot/protobuf/src/proto"
$Script:protobuf_file_Path = "$Script:protobuf_dir_Path/FunctionRpc.proto"
$Script:functionRpc_proto_file_Path = "$Script:protobuf_dir_Path/FunctionRpc.proto"
$Script:identity_dir_Path = "$RepoRoot/protobuf/src/proto/identity"
$Script:claimsIdentityRpc_proto_file_Path = "$Script:identity_dir_Path/ClaimsIdentityRpc.proto"
}
}