Rename PreviewUpdate (again)

Unfortunately, this wasn't a great name.  The old one stunk, but the
new one was misleading at best.  The thing is, this isn't about performing
an update -- it's about NOT doing an update, depending on its return value.
Further, it's not just previewing the changes, it is actively making a
decision on what to do in response to them.  InspectUpdate seems to convey
this and I've unified the InspectUpdate and Update routines to take a
ChangeRequest, instead of UpdateRequest, to help imply the desired behavior.
This commit is contained in:
joeduffy 2017-04-27 11:18:49 -07:00
parent 617ac91c92
commit 47ef3f673b
19 changed files with 200 additions and 200 deletions

View file

@ -123,8 +123,8 @@ func (p *instanceProvider) Get(ctx context.Context, id string) (*rpc.Instance, e
return nil, errors.New("Not yet implemented")
}
// PreviewUpdate checks what impacts a hypothetical update will have on the resource's properties.
func (p *instanceProvider) PreviewUpdate(ctx context.Context, id string,
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
func (p *instanceProvider) InspectChange(ctx context.Context, id string,
old *rpc.Instance, new *rpc.Instance, diff *resource.ObjectDiff) ([]string, error) {
// TODO: we should permit changes to security groups for non-EC2-classic VMs that are in VPCs.
return nil, nil

View file

@ -112,8 +112,8 @@ func (p *sgProvider) Get(ctx context.Context, id string) (*rpc.SecurityGroup, er
return nil, errors.New("Not yet implemented")
}
// PreviewUpdate checks what impacts a hypothetical update will have on the resource's properties.
func (p *sgProvider) PreviewUpdate(ctx context.Context, id string,
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
func (p *sgProvider) InspectChange(ctx context.Context, id string,
old *rpc.SecurityGroup, new *rpc.SecurityGroup, diff *resource.ObjectDiff) ([]string, error) {
return nil, nil
}

View file

@ -117,16 +117,16 @@ func (p *roleProvider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocor
return nil, errors.New("Not yet implemented")
}
// PreviewUpdate checks what impacts a hypothetical update will have on the resource's properties.
func (p *roleProvider) PreviewUpdate(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.PreviewUpdateResponse, error) {
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
func (p *roleProvider) InspectChange(
ctx context.Context, req *cocorpc.ChangeRequest) (*cocorpc.InspectChangeResponse, error) {
contract.Assert(req.GetType() == string(Role))
return nil, errors.New("Not yet implemented")
}
// 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.
func (p *roleProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*pbempty.Empty, error) {
func (p *roleProvider) Update(ctx context.Context, req *cocorpc.ChangeRequest) (*pbempty.Empty, error) {
contract.Assert(req.GetType() == string(Role))
return nil, errors.New("Not yet implemented")
}

View file

@ -193,16 +193,16 @@ func (p *funcProvider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocor
return nil, errors.New("Not yet implemented")
}
// PreviewUpdate checks what impacts a hypothetical update will have on the resource's properties.
func (p *funcProvider) PreviewUpdate(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.PreviewUpdateResponse, error) {
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
func (p *funcProvider) InspectChange(
ctx context.Context, req *cocorpc.ChangeRequest) (*cocorpc.InspectChangeResponse, error) {
contract.Assert(req.GetType() == string(Function))
return nil, errors.New("Not yet implemented")
}
// 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.
func (p *funcProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*pbempty.Empty, error) {
func (p *funcProvider) Update(ctx context.Context, req *cocorpc.ChangeRequest) (*pbempty.Empty, error) {
contract.Assert(req.GetType() == string(Function))
return nil, errors.New("Not yet implemented")
}

View file

@ -102,19 +102,19 @@ func (p *Provider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocorpc.G
return nil, fmt.Errorf("Unrecognized resource type (Get): %v", t)
}
// PreviewUpdate checks what impacts a hypothetical update will have on the resource's properties.
func (p *Provider) PreviewUpdate(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.PreviewUpdateResponse, error) {
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
func (p *Provider) InspectChange(
ctx context.Context, req *cocorpc.ChangeRequest) (*cocorpc.InspectChangeResponse, error) {
t := tokens.Type(req.GetType())
if prov, has := p.impls[t]; has {
return prov.PreviewUpdate(ctx, req)
return prov.InspectChange(ctx, req)
}
return nil, fmt.Errorf("Unrecognized resource type (PreviewUpdate): %v", t)
return nil, fmt.Errorf("Unrecognized resource type (InspectChange): %v", t)
}
// 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.
func (p *Provider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*pbempty.Empty, error) {
func (p *Provider) Update(ctx context.Context, req *cocorpc.ChangeRequest) (*pbempty.Empty, error) {
t := tokens.Type(req.GetType())
if prov, has := p.impls[t]; has {
return prov.Update(ctx, req)

View file

@ -97,16 +97,16 @@ func (p *buckProvider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocor
return nil, errors.New("Not yet implemented")
}
// PreviewUpdate checks what impacts a hypothetical update will have on the resource's properties.
func (p *buckProvider) PreviewUpdate(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.PreviewUpdateResponse, error) {
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
func (p *buckProvider) InspectChange(
ctx context.Context, req *cocorpc.ChangeRequest) (*cocorpc.InspectChangeResponse, error) {
contract.Assert(req.GetType() == string(Bucket))
return nil, errors.New("Not yet implemented")
}
// 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.
func (p *buckProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*pbempty.Empty, error) {
func (p *buckProvider) Update(ctx context.Context, req *cocorpc.ChangeRequest) (*pbempty.Empty, error) {
contract.Assert(req.GetType() == string(Bucket))
return nil, errors.New("Not yet implemented")
}

View file

@ -108,16 +108,16 @@ func (p *objProvider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocorp
return nil, errors.New("Not yet implemented")
}
// PreviewUpdate checks what impacts a hypothetical update will have on the resource's properties.
func (p *objProvider) PreviewUpdate(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.PreviewUpdateResponse, error) {
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
func (p *objProvider) InspectChange(
ctx context.Context, req *cocorpc.ChangeRequest) (*cocorpc.InspectChangeResponse, error) {
contract.Assert(req.GetType() == string(Object))
return nil, errors.New("Not yet implemented")
}
// 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.
func (p *objProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*pbempty.Empty, error) {
func (p *objProvider) Update(ctx context.Context, req *cocorpc.ChangeRequest) (*pbempty.Empty, error) {
contract.Assert(req.GetType() == string(Object))
return nil, errors.New("Not yet implemented")
}

View file

@ -71,16 +71,16 @@ func (p *envProvider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocorp
return nil, errors.New("Not yet implemented")
}
// PreviewUpdate checks what impacts a hypothetical update will have on the resource's properties.
func (p *envProvider) PreviewUpdate(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.PreviewUpdateResponse, error) {
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
func (p *envProvider) InspectChange(
ctx context.Context, req *cocorpc.ChangeRequest) (*cocorpc.InspectChangeResponse, error) {
contract.Assert(req.GetType() == string(Environment))
return nil, errors.New("Not yet implemented")
}
// 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.
func (p *envProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*pbempty.Empty, error) {
func (p *envProvider) Update(ctx context.Context, req *cocorpc.ChangeRequest) (*pbempty.Empty, error) {
contract.Assert(req.GetType() == string(Environment))
return nil, errors.New("Not yet implemented")
}

View file

@ -91,16 +91,16 @@ func (p *funcProvider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocor
return nil, errors.New("Not yet implemented")
}
// PreviewUpdate checks what impacts a hypothetical update will have on the resource's properties.
func (p *funcProvider) PreviewUpdate(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.PreviewUpdateResponse, error) {
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
func (p *funcProvider) InspectChange(
ctx context.Context, req *cocorpc.ChangeRequest) (*cocorpc.InspectChangeResponse, error) {
contract.Assert(req.GetType() == string(Function))
return nil, errors.New("Not yet implemented")
}
// 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.
func (p *funcProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*pbempty.Empty, error) {
func (p *funcProvider) Update(ctx context.Context, req *cocorpc.ChangeRequest) (*pbempty.Empty, error) {
contract.Assert(req.GetType() == string(Function))
return nil, errors.New("Not yet implemented")
}

View file

@ -71,16 +71,16 @@ func (p *httProvider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocorp
return nil, errors.New("Not yet implemented")
}
// PreviewUpdate checks what impacts a hypothetical update will have on the resource's properties.
func (p *httProvider) PreviewUpdate(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.PreviewUpdateResponse, error) {
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
func (p *httProvider) InspectChange(
ctx context.Context, req *cocorpc.ChangeRequest) (*cocorpc.InspectChangeResponse, error) {
contract.Assert(req.GetType() == string(HTTPTrigger))
return nil, errors.New("Not yet implemented")
}
// 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.
func (p *httProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*pbempty.Empty, error) {
func (p *httProvider) Update(ctx context.Context, req *cocorpc.ChangeRequest) (*pbempty.Empty, error) {
contract.Assert(req.GetType() == string(HTTPTrigger))
return nil, errors.New("Not yet implemented")
}

View file

@ -93,19 +93,19 @@ func (p *Provider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocorpc.G
return nil, fmt.Errorf("Unrecognized resource type (Get): %v", t)
}
// PreviewUpdate checks what impacts a hypothetical update will have on the resource's properties.
func (p *Provider) PreviewUpdate(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.PreviewUpdateResponse, error) {
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
func (p *Provider) InspectChange(
ctx context.Context, req *cocorpc.ChangeRequest) (*cocorpc.InspectChangeResponse, error) {
t := tokens.Type(req.GetType())
if prov, has := p.impls[t]; has {
return prov.PreviewUpdate(ctx, req)
return prov.InspectChange(ctx, req)
}
return nil, fmt.Errorf("Unrecognized resource type (PreviewUpdate): %v", t)
return nil, fmt.Errorf("Unrecognized resource type (InspectChange): %v", t)
}
// 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.
func (p *Provider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*pbempty.Empty, error) {
func (p *Provider) Update(ctx context.Context, req *cocorpc.ChangeRequest) (*pbempty.Empty, error) {
t := tokens.Type(req.GetType())
if prov, has := p.impls[t]; has {
return prov.Update(ctx, req)

View file

@ -358,13 +358,13 @@ func newPlan(ctx *Context, old Snapshot, new Snapshot, analyzers []tokens.QName)
if err != nil {
return nil, err
}
replaces, _, err := prov.PreviewUpdate(old.ID(), old.Type(), old.Properties(), computed)
replacements, _, err := prov.InspectChange(old.ID(), old.Type(), old.Properties(), computed)
if err != nil {
return nil, err
}
// Now create a step and vertex of the right kind.
if len(replaces) > 0 {
if len(replacements) > 0 {
// To perform a replacement, create a creation, deletion, and add the appropriate edges. Namely:
//
// - Replacement depends on creation
@ -373,8 +373,8 @@ func newPlan(ctx *Context, old Snapshot, new Snapshot, analyzers []tokens.QName)
// - Deletion depends on updating all existing dependencies (ensured through usual update logic)
//
// This ensures the right sequencing, with the replacement node acting as a juncture in the graph.
replkeys := make([]PropertyKey, len(replaces))
for i, repl := range replaces {
replkeys := make([]PropertyKey, len(replacements))
for i, repl := range replacements {
replkeys[i] = PropertyKey(repl)
}
pb.Replaces[m] = replkeys

View file

@ -33,8 +33,8 @@ type Provider interface {
Create(t tokens.Type, props PropertyMap) (ID, PropertyMap, State, error)
// Get reads the instance state identified by id/t, and returns a bag of properties.
Get(id ID, t tokens.Type) (PropertyMap, error)
// PreviewUpdate checks what impacts a hypothetical update will have on the resource's properties.
PreviewUpdate(id ID, t tokens.Type, olds PropertyMap, news PropertyMap) ([]string, PropertyMap, error)
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
InspectChange(id ID, t tokens.Type, olds PropertyMap, news PropertyMap) ([]string, PropertyMap, error)
// Update updates an existing resource with new values.
Update(id ID, t tokens.Type, olds PropertyMap, news PropertyMap) (State, error)
// Delete tears down an existing resource.

View file

@ -144,15 +144,15 @@ func (p *provider) Get(id ID, t tokens.Type) (PropertyMap, error) {
return props, nil
}
// PreviewUpdate checks what impacts a hypothetical update will have on the resource's properties.
func (p *provider) PreviewUpdate(id ID, t tokens.Type,
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
func (p *provider) InspectChange(id ID, t tokens.Type,
olds PropertyMap, news PropertyMap) ([]string, PropertyMap, error) {
contract.Requiref(id != "", "id", "not empty")
contract.Requiref(t != "", "t", "not empty")
glog.V(7).Infof("resource[%v].PreviewUpdate(id=%v,t=%v,#olds=%v,#news=%v) executing",
glog.V(7).Infof("resource[%v].InspectChange(id=%v,t=%v,#olds=%v,#news=%v) executing",
p.pkg, id, t, len(olds), len(news))
req := &cocorpc.UpdateRequest{
req := &cocorpc.ChangeRequest{
Id: string(id),
Type: string(t),
Olds: MarshalProperties(p.ctx, olds, MarshalOptions{
@ -163,9 +163,9 @@ func (p *provider) PreviewUpdate(id ID, t tokens.Type,
}),
}
resp, err := p.client.PreviewUpdate(p.ctx.Request(), req)
resp, err := p.client.InspectChange(p.ctx.Request(), req)
if err != nil {
glog.V(7).Infof("resource[%v].PreviewUpdate(id=%v,t=%v,...) failed: %v", p.pkg, id, t, err)
glog.V(7).Infof("resource[%v].InspectChange(id=%v,t=%v,...) failed: %v", p.pkg, id, t, err)
return nil, nil, err
}
@ -183,7 +183,7 @@ func (p *provider) Update(id ID, t tokens.Type, olds PropertyMap, news PropertyM
glog.V(7).Infof("resource[%v].Update(id=%v,t=%v,#olds=%v,#news=%v) executing",
p.pkg, id, t, len(olds), len(news))
req := &cocorpc.UpdateRequest{
req := &cocorpc.ChangeRequest{
Id: string(id),
Type: string(t),
Olds: MarshalProperties(p.ctx, olds, MarshalOptions{

View file

@ -166,7 +166,7 @@ func (g *RPCGenerator) EmitResource(w *bufio.Writer, module tokens.Module, pkg *
}
writefmtln(w, "error)")
writefmtln(w, " Get(ctx context.Context, id string) (*%v, error)", name)
writefmtln(w, " PreviewUpdate(ctx context.Context,")
writefmtln(w, " InspectChange(ctx context.Context,")
writefmtln(w, " id string, old *%[1]v, new *%[1]v, diff *resource.ObjectDiff) ([]string, error)", name)
writefmtln(w, " Update(ctx context.Context,")
writefmtln(w, " id string, old *%[1]v, new *%[1]v, diff *resource.ObjectDiff) error", name)
@ -262,8 +262,8 @@ func (g *RPCGenerator) EmitResource(w *bufio.Writer, module tokens.Module, pkg *
writefmtln(w, " }, nil")
writefmtln(w, "}")
writefmtln(w, "")
writefmtln(w, "func (p *%vProvider) PreviewUpdate(", name)
writefmtln(w, " ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.PreviewUpdateResponse, error) {")
writefmtln(w, "func (p *%vProvider) InspectChange(", name)
writefmtln(w, " ctx context.Context, req *cocorpc.ChangeRequest) (*cocorpc.InspectChangeResponse, error) {")
writefmtln(w, " contract.Assert(req.GetType() == string(%vToken))", name)
writefmtln(w, " old, oldprops, decerr := p.Unmarshal(req.GetOlds())")
writefmtln(w, " if decerr != nil {")
@ -282,17 +282,17 @@ func (g *RPCGenerator) EmitResource(w *bufio.Writer, module tokens.Module, pkg *
writefmtln(w, " }")
}
}
writefmtln(w, " more, err := p.ops.PreviewUpdate(ctx, req.GetId(), old, new, diff)")
writefmtln(w, " more, err := p.ops.InspectChange(ctx, req.GetId(), old, new, diff)")
writefmtln(w, " if err != nil {")
writefmtln(w, " return nil, err")
writefmtln(w, " }")
writefmtln(w, " return &cocorpc.PreviewUpdateResponse{")
writefmtln(w, " return &cocorpc.InspectChangeResponse{")
writefmtln(w, " Replaces: append(replaces, more...),")
writefmtln(w, " }, err")
writefmtln(w, "}")
writefmtln(w, "")
writefmtln(w, "func (p *%vProvider) Update(", name)
writefmtln(w, " ctx context.Context, req *cocorpc.UpdateRequest) (*pbempty.Empty, error) {")
writefmtln(w, " ctx context.Context, req *cocorpc.ChangeRequest) (*pbempty.Empty, error) {")
writefmtln(w, " contract.Assert(req.GetType() == string(%vToken))", name)
writefmtln(w, " old, oldprops, err := p.Unmarshal(req.GetOlds())")
writefmtln(w, " if err != nil {")

View file

@ -27,8 +27,8 @@ It has these top-level messages:
CreateResponse
GetRequest
GetResponse
UpdateRequest
PreviewUpdateResponse
ChangeRequest
InspectChangeResponse
DeleteRequest
*/
package cocorpc

View file

@ -212,64 +212,64 @@ func (m *GetResponse) GetProperties() *google_protobuf.Struct {
return nil
}
type UpdateRequest struct {
type ChangeRequest struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Type string `protobuf:"bytes,2,opt,name=type" json:"type,omitempty"`
Olds *google_protobuf.Struct `protobuf:"bytes,3,opt,name=olds" json:"olds,omitempty"`
News *google_protobuf.Struct `protobuf:"bytes,4,opt,name=news" json:"news,omitempty"`
}
func (m *UpdateRequest) Reset() { *m = UpdateRequest{} }
func (m *UpdateRequest) String() string { return proto.CompactTextString(m) }
func (*UpdateRequest) ProtoMessage() {}
func (*UpdateRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{9} }
func (m *ChangeRequest) Reset() { *m = ChangeRequest{} }
func (m *ChangeRequest) String() string { return proto.CompactTextString(m) }
func (*ChangeRequest) ProtoMessage() {}
func (*ChangeRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{9} }
func (m *UpdateRequest) GetId() string {
func (m *ChangeRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *UpdateRequest) GetType() string {
func (m *ChangeRequest) GetType() string {
if m != nil {
return m.Type
}
return ""
}
func (m *UpdateRequest) GetOlds() *google_protobuf.Struct {
func (m *ChangeRequest) GetOlds() *google_protobuf.Struct {
if m != nil {
return m.Olds
}
return nil
}
func (m *UpdateRequest) GetNews() *google_protobuf.Struct {
func (m *ChangeRequest) GetNews() *google_protobuf.Struct {
if m != nil {
return m.News
}
return nil
}
type PreviewUpdateResponse struct {
type InspectChangeResponse struct {
Replaces []string `protobuf:"bytes,1,rep,name=replaces" json:"replaces,omitempty"`
Changes *google_protobuf.Struct `protobuf:"bytes,2,opt,name=changes" json:"changes,omitempty"`
}
func (m *PreviewUpdateResponse) Reset() { *m = PreviewUpdateResponse{} }
func (m *PreviewUpdateResponse) String() string { return proto.CompactTextString(m) }
func (*PreviewUpdateResponse) ProtoMessage() {}
func (*PreviewUpdateResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{10} }
func (m *InspectChangeResponse) Reset() { *m = InspectChangeResponse{} }
func (m *InspectChangeResponse) String() string { return proto.CompactTextString(m) }
func (*InspectChangeResponse) ProtoMessage() {}
func (*InspectChangeResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{10} }
func (m *PreviewUpdateResponse) GetReplaces() []string {
func (m *InspectChangeResponse) GetReplaces() []string {
if m != nil {
return m.Replaces
}
return nil
}
func (m *PreviewUpdateResponse) GetChanges() *google_protobuf.Struct {
func (m *InspectChangeResponse) GetChanges() *google_protobuf.Struct {
if m != nil {
return m.Changes
}
@ -310,8 +310,8 @@ func init() {
proto.RegisterType((*CreateResponse)(nil), "cocorpc.CreateResponse")
proto.RegisterType((*GetRequest)(nil), "cocorpc.GetRequest")
proto.RegisterType((*GetResponse)(nil), "cocorpc.GetResponse")
proto.RegisterType((*UpdateRequest)(nil), "cocorpc.UpdateRequest")
proto.RegisterType((*PreviewUpdateResponse)(nil), "cocorpc.PreviewUpdateResponse")
proto.RegisterType((*ChangeRequest)(nil), "cocorpc.ChangeRequest")
proto.RegisterType((*InspectChangeResponse)(nil), "cocorpc.InspectChangeResponse")
proto.RegisterType((*DeleteRequest)(nil), "cocorpc.DeleteRequest")
}
@ -337,10 +337,10 @@ type ResourceProviderClient interface {
Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found.
Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
// PreviewUpdate checks what impacts a hypothetical update will have on the resource's properties.
PreviewUpdate(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*PreviewUpdateResponse, error)
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
InspectChange(ctx context.Context, in *ChangeRequest, opts ...grpc.CallOption) (*InspectChangeResponse, error)
// Update updates an existing resource with new values.
Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
Update(ctx context.Context, in *ChangeRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
}
@ -389,16 +389,16 @@ func (c *resourceProviderClient) Get(ctx context.Context, in *GetRequest, opts .
return out, nil
}
func (c *resourceProviderClient) PreviewUpdate(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*PreviewUpdateResponse, error) {
out := new(PreviewUpdateResponse)
err := grpc.Invoke(ctx, "/cocorpc.ResourceProvider/PreviewUpdate", in, out, c.cc, opts...)
func (c *resourceProviderClient) InspectChange(ctx context.Context, in *ChangeRequest, opts ...grpc.CallOption) (*InspectChangeResponse, error) {
out := new(InspectChangeResponse)
err := grpc.Invoke(ctx, "/cocorpc.ResourceProvider/InspectChange", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *resourceProviderClient) Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) {
func (c *resourceProviderClient) Update(ctx context.Context, in *ChangeRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) {
out := new(google_protobuf1.Empty)
err := grpc.Invoke(ctx, "/cocorpc.ResourceProvider/Update", in, out, c.cc, opts...)
if err != nil {
@ -430,10 +430,10 @@ type ResourceProviderServer interface {
Create(context.Context, *CreateRequest) (*CreateResponse, error)
// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found.
Get(context.Context, *GetRequest) (*GetResponse, error)
// PreviewUpdate checks what impacts a hypothetical update will have on the resource's properties.
PreviewUpdate(context.Context, *UpdateRequest) (*PreviewUpdateResponse, error)
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
InspectChange(context.Context, *ChangeRequest) (*InspectChangeResponse, error)
// Update updates an existing resource with new values.
Update(context.Context, *UpdateRequest) (*google_protobuf1.Empty, error)
Update(context.Context, *ChangeRequest) (*google_protobuf1.Empty, error)
// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
Delete(context.Context, *DeleteRequest) (*google_protobuf1.Empty, error)
}
@ -514,26 +514,26 @@ func _ResourceProvider_Get_Handler(srv interface{}, ctx context.Context, dec fun
return interceptor(ctx, in, info, handler)
}
func _ResourceProvider_PreviewUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateRequest)
func _ResourceProvider_InspectChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ChangeRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ResourceProviderServer).PreviewUpdate(ctx, in)
return srv.(ResourceProviderServer).InspectChange(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cocorpc.ResourceProvider/PreviewUpdate",
FullMethod: "/cocorpc.ResourceProvider/InspectChange",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ResourceProviderServer).PreviewUpdate(ctx, req.(*UpdateRequest))
return srv.(ResourceProviderServer).InspectChange(ctx, req.(*ChangeRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ResourceProvider_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateRequest)
in := new(ChangeRequest)
if err := dec(in); err != nil {
return nil, err
}
@ -545,7 +545,7 @@ func _ResourceProvider_Update_Handler(srv interface{}, ctx context.Context, dec
FullMethod: "/cocorpc.ResourceProvider/Update",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ResourceProviderServer).Update(ctx, req.(*UpdateRequest))
return srv.(ResourceProviderServer).Update(ctx, req.(*ChangeRequest))
}
return interceptor(ctx, in, info, handler)
}
@ -589,8 +589,8 @@ var _ResourceProvider_serviceDesc = grpc.ServiceDesc{
Handler: _ResourceProvider_Get_Handler,
},
{
MethodName: "PreviewUpdate",
Handler: _ResourceProvider_PreviewUpdate_Handler,
MethodName: "InspectChange",
Handler: _ResourceProvider_InspectChange_Handler,
},
{
MethodName: "Update",
@ -608,38 +608,38 @@ var _ResourceProvider_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("provider.proto", fileDescriptor2) }
var fileDescriptor2 = []byte{
// 523 bytes of a gzipped FileDescriptorProto
// 525 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x54, 0xc1, 0x6e, 0xd3, 0x40,
0x10, 0xad, 0x93, 0x90, 0x36, 0x93, 0x3a, 0x42, 0x4b, 0x93, 0x5a, 0x06, 0xa1, 0x68, 0x4f, 0x91,
0x90, 0x5c, 0x9a, 0x0a, 0x81, 0xe0, 0xd6, 0x42, 0x2b, 0x2e, 0xa8, 0x72, 0xc5, 0x05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0c, 0x6b, 0x33, 0xa9, 0xf6, 0xad, 0xae, 0x8e, 0xfb, 0xd4, 0xc6, 0xff, 0x3a, 0x43, 0xba, 0x43,
0x5e, 0x43, 0xf7, 0x23, 0x8f, 0x1a, 0xda, 0x6b, 0x1c, 0x93, 0x1b, 0xa3, 0x7b, 0x97, 0x3f, 0xaf,
0x45, 0x6d, 0x31, 0xb2, 0x4a, 0x6d, 0x6d, 0x86, 0xff, 0xae, 0xbd, 0xea, 0xea, 0xc8, 0xf1, 0x9f,
0x00, 0x00, 0x00, 0xff, 0xff, 0xe6, 0x6f, 0xc6, 0xd6, 0xd5, 0x05, 0x00, 0x00,
}

View file

@ -11,6 +11,7 @@ var global = Function('return this')();
var google_protobuf_empty_pb = require('google-protobuf/google/protobuf/empty_pb.js');
var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js');
goog.exportSymbol('proto.cocorpc.ChangeRequest', null, global);
goog.exportSymbol('proto.cocorpc.CheckFailure', null, global);
goog.exportSymbol('proto.cocorpc.CheckRequest', null, global);
goog.exportSymbol('proto.cocorpc.CheckResponse', null, global);
@ -19,10 +20,9 @@ goog.exportSymbol('proto.cocorpc.CreateResponse', null, global);
goog.exportSymbol('proto.cocorpc.DeleteRequest', null, global);
goog.exportSymbol('proto.cocorpc.GetRequest', null, global);
goog.exportSymbol('proto.cocorpc.GetResponse', null, global);
goog.exportSymbol('proto.cocorpc.InspectChangeResponse', null, global);
goog.exportSymbol('proto.cocorpc.NameRequest', null, global);
goog.exportSymbol('proto.cocorpc.NameResponse', null, global);
goog.exportSymbol('proto.cocorpc.PreviewUpdateResponse', null, global);
goog.exportSymbol('proto.cocorpc.UpdateRequest', null, global);
/**
* Generated by JsPbCodeGenerator.
@ -1569,12 +1569,12 @@ proto.cocorpc.GetResponse.prototype.hasProperties = function() {
* @extends {jspb.Message}
* @constructor
*/
proto.cocorpc.UpdateRequest = function(opt_data) {
proto.cocorpc.ChangeRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.cocorpc.UpdateRequest, jspb.Message);
goog.inherits(proto.cocorpc.ChangeRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.cocorpc.UpdateRequest.displayName = 'proto.cocorpc.UpdateRequest';
proto.cocorpc.ChangeRequest.displayName = 'proto.cocorpc.ChangeRequest';
}
@ -1589,8 +1589,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) {
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.cocorpc.UpdateRequest.prototype.toObject = function(opt_includeInstance) {
return proto.cocorpc.UpdateRequest.toObject(opt_includeInstance, this);
proto.cocorpc.ChangeRequest.prototype.toObject = function(opt_includeInstance) {
return proto.cocorpc.ChangeRequest.toObject(opt_includeInstance, this);
};
@ -1599,10 +1599,10 @@ proto.cocorpc.UpdateRequest.prototype.toObject = function(opt_includeInstance) {
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.cocorpc.UpdateRequest} msg The msg instance to transform.
* @param {!proto.cocorpc.ChangeRequest} msg The msg instance to transform.
* @return {!Object}
*/
proto.cocorpc.UpdateRequest.toObject = function(includeInstance, msg) {
proto.cocorpc.ChangeRequest.toObject = function(includeInstance, msg) {
var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, ""),
type: jspb.Message.getFieldWithDefault(msg, 2, ""),
@ -1621,23 +1621,23 @@ proto.cocorpc.UpdateRequest.toObject = function(includeInstance, msg) {
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.cocorpc.UpdateRequest}
* @return {!proto.cocorpc.ChangeRequest}
*/
proto.cocorpc.UpdateRequest.deserializeBinary = function(bytes) {
proto.cocorpc.ChangeRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cocorpc.UpdateRequest;
return proto.cocorpc.UpdateRequest.deserializeBinaryFromReader(msg, reader);
var msg = new proto.cocorpc.ChangeRequest;
return proto.cocorpc.ChangeRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.cocorpc.UpdateRequest} msg The message object to deserialize into.
* @param {!proto.cocorpc.ChangeRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cocorpc.UpdateRequest}
* @return {!proto.cocorpc.ChangeRequest}
*/
proto.cocorpc.UpdateRequest.deserializeBinaryFromReader = function(msg, reader) {
proto.cocorpc.ChangeRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
@ -1675,9 +1675,9 @@ proto.cocorpc.UpdateRequest.deserializeBinaryFromReader = function(msg, reader)
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cocorpc.UpdateRequest.prototype.serializeBinary = function() {
proto.cocorpc.ChangeRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cocorpc.UpdateRequest.serializeBinaryToWriter(this, writer);
proto.cocorpc.ChangeRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
@ -1685,10 +1685,10 @@ proto.cocorpc.UpdateRequest.prototype.serializeBinary = function() {
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.cocorpc.UpdateRequest} message
* @param {!proto.cocorpc.ChangeRequest} message
* @param {!jspb.BinaryWriter} writer
*/
proto.cocorpc.UpdateRequest.serializeBinaryToWriter = function(message, writer) {
proto.cocorpc.ChangeRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getId();
if (f.length > 0) {
@ -1727,13 +1727,13 @@ proto.cocorpc.UpdateRequest.serializeBinaryToWriter = function(message, writer)
* optional string id = 1;
* @return {string}
*/
proto.cocorpc.UpdateRequest.prototype.getId = function() {
proto.cocorpc.ChangeRequest.prototype.getId = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/** @param {string} value */
proto.cocorpc.UpdateRequest.prototype.setId = function(value) {
proto.cocorpc.ChangeRequest.prototype.setId = function(value) {
jspb.Message.setField(this, 1, value);
};
@ -1742,13 +1742,13 @@ proto.cocorpc.UpdateRequest.prototype.setId = function(value) {
* optional string type = 2;
* @return {string}
*/
proto.cocorpc.UpdateRequest.prototype.getType = function() {
proto.cocorpc.ChangeRequest.prototype.getType = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/** @param {string} value */
proto.cocorpc.UpdateRequest.prototype.setType = function(value) {
proto.cocorpc.ChangeRequest.prototype.setType = function(value) {
jspb.Message.setField(this, 2, value);
};
@ -1757,19 +1757,19 @@ proto.cocorpc.UpdateRequest.prototype.setType = function(value) {
* optional google.protobuf.Struct olds = 3;
* @return {?proto.google.protobuf.Struct}
*/
proto.cocorpc.UpdateRequest.prototype.getOlds = function() {
proto.cocorpc.ChangeRequest.prototype.getOlds = function() {
return /** @type{?proto.google.protobuf.Struct} */ (
jspb.Message.getWrapperField(this, google_protobuf_struct_pb.Struct, 3));
};
/** @param {?proto.google.protobuf.Struct|undefined} value */
proto.cocorpc.UpdateRequest.prototype.setOlds = function(value) {
proto.cocorpc.ChangeRequest.prototype.setOlds = function(value) {
jspb.Message.setWrapperField(this, 3, value);
};
proto.cocorpc.UpdateRequest.prototype.clearOlds = function() {
proto.cocorpc.ChangeRequest.prototype.clearOlds = function() {
this.setOlds(undefined);
};
@ -1778,7 +1778,7 @@ proto.cocorpc.UpdateRequest.prototype.clearOlds = function() {
* Returns whether this field is set.
* @return {!boolean}
*/
proto.cocorpc.UpdateRequest.prototype.hasOlds = function() {
proto.cocorpc.ChangeRequest.prototype.hasOlds = function() {
return jspb.Message.getField(this, 3) != null;
};
@ -1787,19 +1787,19 @@ proto.cocorpc.UpdateRequest.prototype.hasOlds = function() {
* optional google.protobuf.Struct news = 4;
* @return {?proto.google.protobuf.Struct}
*/
proto.cocorpc.UpdateRequest.prototype.getNews = function() {
proto.cocorpc.ChangeRequest.prototype.getNews = function() {
return /** @type{?proto.google.protobuf.Struct} */ (
jspb.Message.getWrapperField(this, google_protobuf_struct_pb.Struct, 4));
};
/** @param {?proto.google.protobuf.Struct|undefined} value */
proto.cocorpc.UpdateRequest.prototype.setNews = function(value) {
proto.cocorpc.ChangeRequest.prototype.setNews = function(value) {
jspb.Message.setWrapperField(this, 4, value);
};
proto.cocorpc.UpdateRequest.prototype.clearNews = function() {
proto.cocorpc.ChangeRequest.prototype.clearNews = function() {
this.setNews(undefined);
};
@ -1808,7 +1808,7 @@ proto.cocorpc.UpdateRequest.prototype.clearNews = function() {
* Returns whether this field is set.
* @return {!boolean}
*/
proto.cocorpc.UpdateRequest.prototype.hasNews = function() {
proto.cocorpc.ChangeRequest.prototype.hasNews = function() {
return jspb.Message.getField(this, 4) != null;
};
@ -1824,19 +1824,19 @@ proto.cocorpc.UpdateRequest.prototype.hasNews = function() {
* @extends {jspb.Message}
* @constructor
*/
proto.cocorpc.PreviewUpdateResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.cocorpc.PreviewUpdateResponse.repeatedFields_, null);
proto.cocorpc.InspectChangeResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.cocorpc.InspectChangeResponse.repeatedFields_, null);
};
goog.inherits(proto.cocorpc.PreviewUpdateResponse, jspb.Message);
goog.inherits(proto.cocorpc.InspectChangeResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.cocorpc.PreviewUpdateResponse.displayName = 'proto.cocorpc.PreviewUpdateResponse';
proto.cocorpc.InspectChangeResponse.displayName = 'proto.cocorpc.InspectChangeResponse';
}
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.cocorpc.PreviewUpdateResponse.repeatedFields_ = [1];
proto.cocorpc.InspectChangeResponse.repeatedFields_ = [1];
@ -1851,8 +1851,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) {
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.cocorpc.PreviewUpdateResponse.prototype.toObject = function(opt_includeInstance) {
return proto.cocorpc.PreviewUpdateResponse.toObject(opt_includeInstance, this);
proto.cocorpc.InspectChangeResponse.prototype.toObject = function(opt_includeInstance) {
return proto.cocorpc.InspectChangeResponse.toObject(opt_includeInstance, this);
};
@ -1861,10 +1861,10 @@ proto.cocorpc.PreviewUpdateResponse.prototype.toObject = function(opt_includeIns
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.cocorpc.PreviewUpdateResponse} msg The msg instance to transform.
* @param {!proto.cocorpc.InspectChangeResponse} msg The msg instance to transform.
* @return {!Object}
*/
proto.cocorpc.PreviewUpdateResponse.toObject = function(includeInstance, msg) {
proto.cocorpc.InspectChangeResponse.toObject = function(includeInstance, msg) {
var f, obj = {
replacesList: jspb.Message.getField(msg, 1),
changes: (f = msg.getChanges()) && google_protobuf_struct_pb.Struct.toObject(includeInstance, f)
@ -1881,23 +1881,23 @@ proto.cocorpc.PreviewUpdateResponse.toObject = function(includeInstance, msg) {
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.cocorpc.PreviewUpdateResponse}
* @return {!proto.cocorpc.InspectChangeResponse}
*/
proto.cocorpc.PreviewUpdateResponse.deserializeBinary = function(bytes) {
proto.cocorpc.InspectChangeResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cocorpc.PreviewUpdateResponse;
return proto.cocorpc.PreviewUpdateResponse.deserializeBinaryFromReader(msg, reader);
var msg = new proto.cocorpc.InspectChangeResponse;
return proto.cocorpc.InspectChangeResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.cocorpc.PreviewUpdateResponse} msg The message object to deserialize into.
* @param {!proto.cocorpc.InspectChangeResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cocorpc.PreviewUpdateResponse}
* @return {!proto.cocorpc.InspectChangeResponse}
*/
proto.cocorpc.PreviewUpdateResponse.deserializeBinaryFromReader = function(msg, reader) {
proto.cocorpc.InspectChangeResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
@ -1926,9 +1926,9 @@ proto.cocorpc.PreviewUpdateResponse.deserializeBinaryFromReader = function(msg,
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cocorpc.PreviewUpdateResponse.prototype.serializeBinary = function() {
proto.cocorpc.InspectChangeResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cocorpc.PreviewUpdateResponse.serializeBinaryToWriter(this, writer);
proto.cocorpc.InspectChangeResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
@ -1936,10 +1936,10 @@ proto.cocorpc.PreviewUpdateResponse.prototype.serializeBinary = function() {
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.cocorpc.PreviewUpdateResponse} message
* @param {!proto.cocorpc.InspectChangeResponse} message
* @param {!jspb.BinaryWriter} writer
*/
proto.cocorpc.PreviewUpdateResponse.serializeBinaryToWriter = function(message, writer) {
proto.cocorpc.InspectChangeResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getReplacesList();
if (f.length > 0) {
@ -1965,13 +1965,13 @@ proto.cocorpc.PreviewUpdateResponse.serializeBinaryToWriter = function(message,
* replace the array itself, then you must call the setter to update it.
* @return {!Array.<string>}
*/
proto.cocorpc.PreviewUpdateResponse.prototype.getReplacesList = function() {
proto.cocorpc.InspectChangeResponse.prototype.getReplacesList = function() {
return /** @type {!Array.<string>} */ (jspb.Message.getField(this, 1));
};
/** @param {!Array.<string>} value */
proto.cocorpc.PreviewUpdateResponse.prototype.setReplacesList = function(value) {
proto.cocorpc.InspectChangeResponse.prototype.setReplacesList = function(value) {
jspb.Message.setField(this, 1, value || []);
};
@ -1980,12 +1980,12 @@ proto.cocorpc.PreviewUpdateResponse.prototype.setReplacesList = function(value)
* @param {!string} value
* @param {number=} opt_index
*/
proto.cocorpc.PreviewUpdateResponse.prototype.addReplaces = function(value, opt_index) {
proto.cocorpc.InspectChangeResponse.prototype.addReplaces = function(value, opt_index) {
jspb.Message.addToRepeatedField(this, 1, value, opt_index);
};
proto.cocorpc.PreviewUpdateResponse.prototype.clearReplacesList = function() {
proto.cocorpc.InspectChangeResponse.prototype.clearReplacesList = function() {
this.setReplacesList([]);
};
@ -1994,19 +1994,19 @@ proto.cocorpc.PreviewUpdateResponse.prototype.clearReplacesList = function() {
* optional google.protobuf.Struct changes = 2;
* @return {?proto.google.protobuf.Struct}
*/
proto.cocorpc.PreviewUpdateResponse.prototype.getChanges = function() {
proto.cocorpc.InspectChangeResponse.prototype.getChanges = function() {
return /** @type{?proto.google.protobuf.Struct} */ (
jspb.Message.getWrapperField(this, google_protobuf_struct_pb.Struct, 2));
};
/** @param {?proto.google.protobuf.Struct|undefined} value */
proto.cocorpc.PreviewUpdateResponse.prototype.setChanges = function(value) {
proto.cocorpc.InspectChangeResponse.prototype.setChanges = function(value) {
jspb.Message.setWrapperField(this, 2, value);
};
proto.cocorpc.PreviewUpdateResponse.prototype.clearChanges = function() {
proto.cocorpc.InspectChangeResponse.prototype.clearChanges = function() {
this.setChanges(undefined);
};
@ -2015,7 +2015,7 @@ proto.cocorpc.PreviewUpdateResponse.prototype.clearChanges = function() {
* Returns whether this field is set.
* @return {!boolean}
*/
proto.cocorpc.PreviewUpdateResponse.prototype.hasChanges = function() {
proto.cocorpc.InspectChangeResponse.prototype.hasChanges = function() {
return jspb.Message.getField(this, 2) != null;
};

View file

@ -23,10 +23,10 @@ service ResourceProvider {
rpc Create(CreateRequest) returns (CreateResponse) {}
// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found.
rpc Get(GetRequest) returns (GetResponse) {}
// PreviewUpdate checks what impacts a hypothetical update will have on the resource's properties.
rpc PreviewUpdate(UpdateRequest) returns (PreviewUpdateResponse) {}
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
rpc InspectChange(ChangeRequest) returns (InspectChangeResponse) {}
// Update updates an existing resource with new values.
rpc Update(UpdateRequest) returns (google.protobuf.Empty) {}
rpc Update(ChangeRequest) returns (google.protobuf.Empty) {}
// 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) {}
}
@ -73,14 +73,14 @@ message GetResponse {
google.protobuf.Struct properties = 1; // the properties read from the resource.
}
message UpdateRequest {
message ChangeRequest {
string id = 1; // the ID of the resource to update.
string type = 2; // the type token of the resource to update.
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 PreviewUpdateResponse {
message InspectChangeResponse {
repeated string replaces = 1; // if this update requires a replacement, the set of properties triggering it.
google.protobuf.Struct changes = 2; // the set of properties that will be changed (but don't require a replacement).
}