// Copyright 2016 Marapongo, Inc. All rights reserved. syntax = "proto3"; import "google/protobuf/empty.proto"; import "google/protobuf/struct.proto"; package murpc; // TODO: figure out "transactionality" and possibly "tainting". // ResourceProvider is a service that understands how to create, read, update, or delete resources for types defined // within a single MuPackage. It is driven by the overall Mu toolchain in response to blueprints and graphs. service ResourceProvider { // Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID // must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). rpc Create(CreateRequest) returns (CreateResponse) {} // Read read the instance state identifier by ID, returning a populated resource object, or an error if not found. rpc Read(ReadRequest) returns (ReadResponse) {} // Update updates an existing resource with new values. Only those values in the provided property bag are updated // to new values. The resource ID is returned and may be different if the resource had to be recreated. rpc Update(UpdateRequest) returns (UpdateResponse) {} // Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. rpc Delete(DeleteRequest) returns (google.protobuf.Empty) {} } message CreateRequest { string type = 1; // the type token of the resource. google.protobuf.Struct properties = 2; // the properties to set during creation. } message CreateResponse { string id = 1; // the ID of the resource created. } message ReadRequest { string id = 1; // the ID of the resource to read. string type = 2; // the type token of the resource. google.protobuf.Struct properties = 3; // an optional list of properties to read (if empty, all). } message ReadResponse { google.protobuf.Struct properties = 1; // the properties read from the resource. } message UpdateRequest { string id = 1; // the ID of the resource to update. string type = 2; // the type token of the resource. google.protobuf.Struct olds = 3; // the old values of properties to update. google.protobuf.Struct news = 4; // the new values of properties to update. } message UpdateResponse { string id = 1; } message DeleteRequest { string id = 1; // the ID of the resource to delete. }