// Copyright 2018 Cargill Incorporated
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
message SabrePayload {
enum Action {
ACTION_UNSET = 0;
CREATE_CONTRACT = 1;
DELETE_CONTRACT = 2;
EXECUTE_CONTRACT = 3;
CREATE_CONTRACT_REGISTRY = 4;
DELETE_CONTRACT_REGISTRY = 5;
UPDATE_CONTRACT_REGISTRY_OWNERS = 6;
CREATE_NAMESPACE_REGISTRY = 7;
DELETE_NAMESPACE_REGISTRY = 8;
UPDATE_NAMESPACE_REGISTRY_OWNERS = 9;
CREATE_NAMESPACE_REGISTRY_PERMISSION = 10;
DELETE_NAMESPACE_REGISTRY_PERMISSION = 11;
CREATE_SMART_PERMISSION = 12;
UPDATE_SMART_PERMISSION= 13;
DELETE_SMART_PERMISSION = 14;
}
Action action = 1;
CreateContractAction create_contract = 2;
DeleteContractAction delete_contract = 3;
ExecuteContractAction execute_contract = 4;
CreateContractRegistryAction create_contract_registry = 5;
DeleteContractRegistryAction delete_contract_registry = 6;
UpdateContractRegistryOwnersAction update_contract_registry_owners = 7;
CreateNamespaceRegistryAction create_namespace_registry = 8;
DeleteNamespaceRegistryAction delete_namespace_registry = 9;
UpdateNamespaceRegistryOwnersAction update_namespace_registry_owners = 10;
CreateNamespaceRegistryPermissionAction create_namespace_registry_permission = 11;
DeleteNamespaceRegistryPermissionAction delete_namespace_registry_permission = 12;
CreateSmartPermissionAction create_smart_permission = 13;
UpdateSmartPermissionAction update_smart_permission = 14;
DeleteSmartPermissionAction delete_smart_permission = 15;
}
// creates a Contract and updates ContractRegistry with a version entry
message CreateContractAction {
string name = 1;
string version = 2;
repeated string inputs = 3;
repeated string outputs = 4;
bytes contract = 5;
}
// removes a Contract and removes the version entry from ContractRegistry
message DeleteContractAction {
string name = 1;
string version = 2;
}
// executes the contract
message ExecuteContractAction {
string name = 1;
string version = 2;
repeated string inputs = 3;
repeated string outputs = 4;
bytes payload = 5;
}
// creates the ContractRegistry in state with no Versions
message CreateContractRegistryAction {
string name = 1;
repeated string owners = 2;
}
// deletes the ContractRegistry associated with 'name'
// only if it contains no versions
message DeleteContractRegistryAction {
string name = 1;
}
// updates the owners field in the ContractRegistry associated with 'name'
message UpdateContractRegistryOwnersAction {
string name = 1;
repeated string owners = 2;
}
// creates the ContractRegistry in state with no Permissions
message CreateNamespaceRegistryAction {
string namespace = 1;
repeated string owners = 2;
}
// deletes the NamespaceRegistry associated with 'namespace'
// only if it contains no permissions
message DeleteNamespaceRegistryAction {
string namespace = 1;
}
// updates the owners field in the NamespaceRegistry associated with 'namespace'
message UpdateNamespaceRegistryOwnersAction {
string namespace = 1;
repeated string owners = 2;
}
// adds a permission entry to the NamespaceRegistry associated with 'namespace'
message CreateNamespaceRegistryPermissionAction {
string namespace = 1;
string contract_name = 2;
bool read = 3;
bool write = 4;
}
// removes a permission entry to the NamespaceRegistry associated with
// 'namespace'
message DeleteNamespaceRegistryPermissionAction {
string namespace = 1;
string contract_name = 2;
}
// Creates a smart permission
message CreateSmartPermissionAction {
string name = 1;
// ID of organization that owns the smart permission
string org_id = 2;
bytes function = 3;
}
// Updates a smart permission
message UpdateSmartPermissionAction {
string name = 1;
// ID of organization that owns the smart permission
string org_id = 2;
bytes function = 3;
}
// Deletes a smart permission
message DeleteSmartPermissionAction {
string name = 1;
// ID of organization that owns the smart permission
string org_id = 2;
}
// The Setting protobuf (copied from Sawtooth) is required for setting the admin
// keys when Sabre starts
message Setting {
// Contains a setting entry (or entries, in the case of collisions).
message Entry {
string key = 1;
string value = 2;
}
// List of setting entries - more than one implies a state key collision
repeated Entry entries = 1;
}