* Protobuf changes to record dependencies for read resources * Add a number of tests for read resources, especially around replacement * Place read resources in the snapshot with "external" bit set Fixes pulumi/pulumi#1521. This commit introduces two new step ops: Read and ReadReplacement. The engine generates Read and ReadReplacement steps when servicing ReadResource RPC calls from the language host. * Fix an omission of OpReadReplace from the step list * Rebase against master * Transition to use V2 Resources by default * Add a semantic "relinquish" operation to the engine If the engine observes that a resource is read and also that the resource exists in the snapshot as a non-external resource, it will not delete the resource if the IDs of the old and new resources match. * Typo fix * CR: add missing comments, DeserializeDeployment -> DeserializeDeploymentV2, ID check
72 lines
4 KiB
Protocol Buffer
72 lines
4 KiB
Protocol Buffer
// Copyright 2016-2018, Pulumi Corporation.
|
|
//
|
|
// 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";
|
|
|
|
import "google/protobuf/empty.proto";
|
|
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 ReadResource(ReadResourceRequest) returns (ReadResourceResponse) {}
|
|
rpc RegisterResource(RegisterResourceRequest) returns (RegisterResourceResponse) {}
|
|
rpc RegisterResourceOutputs(RegisterResourceOutputsRequest) returns (google.protobuf.Empty) {}
|
|
}
|
|
|
|
// ReadResourceRequest contains enough information to uniquely qualify and read a resource's state.
|
|
message ReadResourceRequest {
|
|
string id = 1; // the ID of the resource to read.
|
|
string type = 2; // the type of the resource object.
|
|
string name = 3; // the name, for URN purposes, of the object.
|
|
string parent = 4; // an optional parent URN that this child resource belongs to.
|
|
google.protobuf.Struct properties = 5; // optional state sufficient to uniquely identify the resource.
|
|
repeated string dependencies = 6; // a list of URNs that this read depends on, as observed by the language host.
|
|
}
|
|
|
|
// ReadResourceResponse contains the result of reading a resource's state.
|
|
message ReadResourceResponse {
|
|
string urn = 1; // the URN for this resource.
|
|
google.protobuf.Struct properties = 2; // the state of the resource read from the live environment.
|
|
}
|
|
|
|
// RegisterResourceRequest contains information about a resource object that was newly allocated.
|
|
message RegisterResourceRequest {
|
|
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.
|
|
bool protect = 6; // true if the resource should be marked protected.
|
|
repeated string dependencies = 7; // a list of URNs that this resource depends on, as observed by the language host.
|
|
}
|
|
|
|
// RegisterResourceResponse is returned by the engine after a resource has finished being initialized. It includes the
|
|
// auto-assigned URN, the provider-assigned ID, and any other properties initialized by the engine.
|
|
message RegisterResourceResponse {
|
|
string urn = 1; // the URN assigned by the engine.
|
|
string id = 2; // the unique ID assigned by the provider.
|
|
google.protobuf.Struct object = 3; // the resulting object properties, including provider defaults.
|
|
bool stable = 4; // if true, the object's state is stable and may be trusted not to change.
|
|
repeated string stables = 5; // an optional list of guaranteed-stable properties.
|
|
}
|
|
|
|
// RegisterResourceOutputsRequest adds extra resource outputs created by the program after registration has occurred.
|
|
message RegisterResourceOutputsRequest {
|
|
string urn = 1; // the URN for the resource to attach output properties to.
|
|
google.protobuf.Struct outputs = 2; // additional output properties to add to the existing resource.
|
|
}
|