This change brings back component outputs to the overall system again. In doing so, it generally overhauls the way we do resource RPCs a bit: * Instead of RegisterResource and CompleteResource, we call these BeginRegisterResource and EndRegisterResource, which begins to model these as effectively "asynchronous" resource requests. This should also help with parallelism (https://github.com/pulumi/pulumi/issues/106). * Flip the CLI/engine a little on its head. Rather than it driving the planning and deployment process, we move more to a model where it simply observes it. This is done by implementing an event handler interface with three events: OnResourceStepPre, OnResourceStepPost, and OnResourceComplete. The first two are invoked immediately before and after any step operation, and the latter is invoked whenever a EndRegisterResource comes in. The reason for the asymmetry here is that the checkpointing logic in the deployment engine is largely untouched (intentionally, as this is a sensitive part of the system), and so the "begin"/"end" nature doesn't flow through faithfully. * Also make the engine more event-oriented in its terminology and the way it handles the incoming BeginRegisterResource and EndRegisterResource events from the language host. This is the first step down a long road of incrementally refactoring the engine to work this way, a necessary prerequisite for parallelism.
46 lines
2.5 KiB
Protocol Buffer
46 lines
2.5 KiB
Protocol Buffer
// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
|
|
|
|
syntax = "proto3";
|
|
|
|
import "google/protobuf/struct.proto";
|
|
import "provider.proto";
|
|
|
|
package pulumirpc;
|
|
|
|
// ResourceMonitor is the interface a source uses to talk back to the planning monitor orchestrating the execution.
|
|
service ResourceMonitor {
|
|
rpc Invoke(InvokeRequest) returns (InvokeResponse) {}
|
|
rpc BeginRegisterResource(BeginRegisterResourceRequest) returns (BeginRegisterResourceResponse) {}
|
|
rpc EndRegisterResource(EndRegisterResourceRequest) returns (EndRegisterResourceResponse) {}
|
|
}
|
|
|
|
// BeginRegisterResourceRequest contains information about a resource object that was newly allocated.
|
|
message BeginRegisterResourceRequest {
|
|
string type = 1; // the type of the object allocated.
|
|
string name = 2; // the name, for URN purposes, of the object.
|
|
string parent = 3; // an optional parent URN that this child resource belongs to.
|
|
bool custom = 4; // true if the resource is a custom, managed by a plugin's CRUD operations.
|
|
google.protobuf.Struct object = 5; // an object produced by the interpreter/source.
|
|
}
|
|
|
|
// BeginRegisterResourceResponse reflects back the properties initialized during creation, if applicable.
|
|
message BeginRegisterResourceResponse {
|
|
string urn = 1; // the URN assigned by the fabric.
|
|
}
|
|
|
|
// EndRegisterResourceRequest completes the registration of a resource, and optionally adds extra derived output
|
|
// properties to an existing resource that is in flight. It must be called once per registration.
|
|
message EndRegisterResourceRequest {
|
|
string urn = 1; // the URN for the resource to attach output properties to.
|
|
google.protobuf.Struct extras = 2; // optional additional output properties to add to the existing resource.
|
|
}
|
|
|
|
// EndRegisterResourceResponse is returned by the engine after a resource is completed. It includes any state
|
|
// that was populated by the resource provider so that the language engine can blit it into the resource objects.
|
|
message EndRegisterResourceResponse {
|
|
string id = 1; // the unique ID assigned by the provider.
|
|
google.protobuf.Struct object = 2; // the resulting object properties, including provider defaults.
|
|
bool stable = 3; // if true, the object's state is stable and may be trusted not to change.
|
|
repeated string stables = 4; // an optional list of guaranteed-stable properties.
|
|
}
|