Rename resource provider methods

This change renames two provider methods:

    * Read becomes Get.

    * UpdateImpact becomes PreviewUpdate.

These just read a whole lot nicer than the old names.
This commit is contained in:
joeduffy 2017-04-20 14:09:00 -07:00
parent 94e072c653
commit 0b6e262b46
17 changed files with 362 additions and 361 deletions

View file

@ -33,7 +33,7 @@ type instanceProvider struct {
// Check validates that the given property bag is valid for a resource of the given type.
func (p *instanceProvider) Check(ctx context.Context, req *cocorpc.CheckRequest) (*cocorpc.CheckResponse, error) {
// Read in the properties, deserialize them, and verify them; return the resulting failures if any.
// Get in the properties, deserialize them, and verify them; return the resulting failures if any.
contract.Assert(req.GetType() == string(Instance))
var instance instance
@ -71,7 +71,7 @@ func (p *instanceProvider) Create(ctx context.Context, req *cocorpc.CreateReques
contract.Assert(req.GetType() == string(Instance))
props := resource.UnmarshalProperties(req.GetProperties())
// Read in the properties given by the request, validating as we go; if any fail, reject the request.
// Get in the properties given by the request, validating as we go; if any fail, reject the request.
var instance instance
if err := mapper.MapIU(props.Mappable(), &instance); err != nil {
// TODO: this is a good example of a "benign" (StateOK) error; handle it accordingly.
@ -115,22 +115,15 @@ func (p *instanceProvider) Create(ctx context.Context, req *cocorpc.CreateReques
return &cocorpc.CreateResponse{Id: *id}, err
}
// Read reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *instanceProvider) Read(ctx context.Context, req *cocorpc.ReadRequest) (*cocorpc.ReadResponse, error) {
// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *instanceProvider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocorpc.GetResponse, error) {
contract.Assert(req.GetType() == string(Instance))
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 *instanceProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*pbempty.Empty, error) {
contract.Assert(req.GetType() == string(Instance))
return nil, errors.New("No known updatable instance properties")
}
// UpdateImpact checks what impacts a hypothetical update will have on the resource's properties.
func (p *instanceProvider) UpdateImpact(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.UpdateImpactResponse, error) {
// PreviewUpdate checks what impacts a hypothetical update will have on the resource's properties.
func (p *instanceProvider) PreviewUpdate(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.PreviewUpdateResponse, error) {
contract.Assert(req.GetType() == string(Instance))
// Unmarshal properties and check the diff for updates to any fields (none of them are updateable).
@ -153,7 +146,14 @@ func (p *instanceProvider) UpdateImpact(
replaces = append(replaces, instanceSecurityGroups)
}
return &cocorpc.UpdateImpactResponse{Replaces: replaces}, nil
return &cocorpc.PreviewUpdateResponse{Replaces: replaces}, nil
}
// 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 *instanceProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*pbempty.Empty, error) {
contract.Assert(req.GetType() == string(Instance))
return nil, errors.New("No known updatable instance properties")
}
// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.

View file

@ -36,7 +36,7 @@ type sgProvider struct {
// Check validates that the given property bag is valid for a resource of the given type.
func (p *sgProvider) Check(ctx context.Context, req *cocorpc.CheckRequest) (*cocorpc.CheckResponse, error) {
// Read in the properties, create and validate a new group, and return the failures (if any).
// Get in the properties, create and validate a new group, and return the failures (if any).
contract.Assert(req.GetType() == string(SecurityGroup))
_, _, result := unmarshalSecurityGroup(req.GetProperties())
return resource.NewCheckResponse(result), nil
@ -54,7 +54,7 @@ func (p *sgProvider) Name(ctx context.Context, req *cocorpc.NameRequest) (*cocor
func (p *sgProvider) Create(ctx context.Context, req *cocorpc.CreateRequest) (*cocorpc.CreateResponse, error) {
contract.Assert(req.GetType() == string(SecurityGroup))
// Read in the properties given by the request, validating as we go; if any fail, reject the request.
// Get in the properties given by the request, validating as we go; if any fail, reject the request.
secgrp, _, decerr := unmarshalSecurityGroup(req.GetProperties())
if decerr != nil {
// TODO: this is a good example of a "benign" (StateOK) error; handle it accordingly.
@ -111,12 +111,27 @@ func (p *sgProvider) Create(ctx context.Context, req *cocorpc.CreateRequest) (*c
}, nil
}
// Read reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *sgProvider) Read(ctx context.Context, req *cocorpc.ReadRequest) (*cocorpc.ReadResponse, error) {
// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *sgProvider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocorpc.GetResponse, error) {
contract.Assert(req.GetType() == string(SecurityGroup))
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, req *cocorpc.UpdateRequest) (*cocorpc.PreviewUpdateResponse, error) {
contract.Assert(req.GetType() == string(SecurityGroup))
// First unmarshal and validate the properties.
_, _, _, replaces, err := unmarshalSecurityGroupChange(req.GetOlds(), req.GetNews())
if err != nil {
return nil, err
}
return &cocorpc.PreviewUpdateResponse{
Replaces: replaces,
// TODO: serialize the other properties that will be updated.
}, nil
}
// 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 *sgProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*pbempty.Empty, error) {
@ -129,7 +144,7 @@ func (p *sgProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*p
return nil, err
}
// If this was a replacement, the UpdateImpact routine should have rejected it.
// If this was a replacement, the PreviewUpdate routine should have rejected it.
if len(replaces) > 0 {
return nil, errors.New("this update requires a resource replacement")
}
@ -225,21 +240,6 @@ func (p *sgProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*p
return &pbempty.Empty{}, nil
}
// UpdateImpact checks what impacts a hypothetical update will have on the resource's properties.
func (p *sgProvider) UpdateImpact(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.UpdateImpactResponse, error) {
contract.Assert(req.GetType() == string(SecurityGroup))
// First unmarshal and validate the properties.
_, _, _, replaces, err := unmarshalSecurityGroupChange(req.GetOlds(), req.GetNews())
if err != nil {
return nil, err
}
return &cocorpc.UpdateImpactResponse{
Replaces: replaces,
// TODO: serialize the other properties that will be updated.
}, nil
}
// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
func (p *sgProvider) Delete(ctx context.Context, req *cocorpc.DeleteRequest) (*pbempty.Empty, error) {
contract.Assert(req.GetType() == string(SecurityGroup))

View file

@ -37,7 +37,7 @@ type roleProvider struct {
// Check validates that the given property bag is valid for a resource of the given type.
func (p *roleProvider) Check(ctx context.Context, req *cocorpc.CheckRequest) (*cocorpc.CheckResponse, error) {
// Read in the properties, create and validate a new group, and return the failures (if any).
// Get in the properties, create and validate a new group, and return the failures (if any).
contract.Assert(req.GetType() == string(Role))
_, _, result := unmarshalRole(req.GetProperties())
return resource.NewCheckResponse(result), nil
@ -55,7 +55,7 @@ func (p *roleProvider) Name(ctx context.Context, req *cocorpc.NameRequest) (*coc
func (p *roleProvider) Create(ctx context.Context, req *cocorpc.CreateRequest) (*cocorpc.CreateResponse, error) {
contract.Assert(req.GetType() == string(Role))
// Read in the properties given by the request, validating as we go; if any fail, reject the request.
// Get in the properties given by the request, validating as we go; if any fail, reject the request.
r, _, decerr := unmarshalRole(req.GetProperties())
if decerr != nil {
// TODO: this is a good example of a "benign" (StateOK) error; handle it accordingly.
@ -100,8 +100,15 @@ func (p *roleProvider) Create(ctx context.Context, req *cocorpc.CreateRequest) (
return &cocorpc.CreateResponse{Id: id}, nil
}
// Read reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *roleProvider) Read(ctx context.Context, req *cocorpc.ReadRequest) (*cocorpc.ReadResponse, error) {
// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *roleProvider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocorpc.GetResponse, error) {
contract.Assert(req.GetType() == string(Role))
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) {
contract.Assert(req.GetType() == string(Role))
return nil, errors.New("Not yet implemented")
}
@ -113,13 +120,6 @@ func (p *roleProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (
return nil, errors.New("Not yet implemented")
}
// UpdateImpact checks what impacts a hypothetical update will have on the resource's properties.
func (p *roleProvider) UpdateImpact(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.UpdateImpactResponse, error) {
contract.Assert(req.GetType() == string(Role))
return nil, errors.New("Not yet implemented")
}
// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
func (p *roleProvider) Delete(ctx context.Context, req *cocorpc.DeleteRequest) (*pbempty.Empty, error) {
contract.Assert(req.GetType() == string(Role))

View file

@ -174,7 +174,14 @@ func (p *funcProvider) Create(ctx context.Context, req *cocorpc.CreateRequest) (
}
// Read reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *funcProvider) Read(ctx context.Context, req *cocorpc.ReadRequest) (*cocorpc.ReadResponse, error) {
func (p *funcProvider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocorpc.GetResponse, error) {
contract.Assert(req.GetType() == string(Function))
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) {
contract.Assert(req.GetType() == string(Function))
return nil, errors.New("Not yet implemented")
}
@ -186,13 +193,6 @@ func (p *funcProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (
return nil, errors.New("Not yet implemented")
}
// UpdateImpact checks what impacts a hypothetical update will have on the resource's properties.
func (p *funcProvider) UpdateImpact(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.UpdateImpactResponse, error) {
contract.Assert(req.GetType() == string(Function))
return nil, errors.New("Not yet implemented")
}
// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
func (p *funcProvider) Delete(ctx context.Context, req *cocorpc.DeleteRequest) (*pbempty.Empty, error) {
contract.Assert(req.GetType() == string(Function))

View file

@ -92,13 +92,23 @@ func (p *Provider) Create(ctx context.Context, req *cocorpc.CreateRequest) (*coc
return nil, fmt.Errorf("Unrecognized resource type (Create): %v", t)
}
// Read reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *Provider) Read(ctx context.Context, req *cocorpc.ReadRequest) (*cocorpc.ReadResponse, error) {
// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *Provider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocorpc.GetResponse, error) {
t := tokens.Type(req.GetType())
if prov, has := p.impls[t]; has {
return prov.Read(ctx, req)
return prov.Get(ctx, req)
}
return nil, fmt.Errorf("Unrecognized resource type (Read): %v", t)
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) {
t := tokens.Type(req.GetType())
if prov, has := p.impls[t]; has {
return prov.PreviewUpdate(ctx, req)
}
return nil, fmt.Errorf("Unrecognized resource type (PreviewUpdate): %v", t)
}
// Update updates an existing resource with new values. Only those values in the provided property bag are updated
@ -111,16 +121,6 @@ func (p *Provider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*pbe
return nil, fmt.Errorf("Unrecognized resource type (Update): %v", t)
}
// UpdateImpact checks what impacts a hypothetical update will have on the resource's properties.
func (p *Provider) UpdateImpact(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.UpdateImpactResponse, error) {
t := tokens.Type(req.GetType())
if prov, has := p.impls[t]; has {
return prov.UpdateImpact(ctx, req)
}
return nil, fmt.Errorf("Unrecognized resource type (UpdateImpact): %v", t)
}
// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
func (p *Provider) Delete(ctx context.Context, req *cocorpc.DeleteRequest) (*pbempty.Empty, error) {
t := tokens.Type(req.GetType())

View file

@ -36,7 +36,7 @@ type buckProvider struct {
// Check validates that the given property bag is valid for a resource of the given type.
func (p *buckProvider) Check(ctx context.Context, req *cocorpc.CheckRequest) (*cocorpc.CheckResponse, error) {
// Read in the properties, create and validate a new group, and return the failures (if any).
// Get in the properties, create and validate a new group, and return the failures (if any).
contract.Assert(req.GetType() == string(Bucket))
_, _, result := unmarshalBucket(req.GetProperties())
return resource.NewCheckResponse(result), nil
@ -54,7 +54,7 @@ func (p *buckProvider) Name(ctx context.Context, req *cocorpc.NameRequest) (*coc
func (p *buckProvider) Create(ctx context.Context, req *cocorpc.CreateRequest) (*cocorpc.CreateResponse, error) {
contract.Assert(req.GetType() == string(Bucket))
// Read in the properties given by the request, validating as we go; if any fail, reject the request.
// Get in the properties given by the request, validating as we go; if any fail, reject the request.
buck, _, decerr := unmarshalBucket(req.GetProperties())
if decerr != nil {
// TODO: this is a good example of a "benign" (StateOK) error; handle it accordingly.
@ -91,8 +91,15 @@ func (p *buckProvider) Create(ctx context.Context, req *cocorpc.CreateRequest) (
return &cocorpc.CreateResponse{Id: id}, nil
}
// Read reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *buckProvider) Read(ctx context.Context, req *cocorpc.ReadRequest) (*cocorpc.ReadResponse, error) {
// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *buckProvider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocorpc.GetResponse, error) {
contract.Assert(req.GetType() == string(Bucket))
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) {
contract.Assert(req.GetType() == string(Bucket))
return nil, errors.New("Not yet implemented")
}
@ -104,13 +111,6 @@ func (p *buckProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (
return nil, errors.New("Not yet implemented")
}
// UpdateImpact checks what impacts a hypothetical update will have on the resource's properties.
func (p *buckProvider) UpdateImpact(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.UpdateImpactResponse, error) {
contract.Assert(req.GetType() == string(Bucket))
return nil, errors.New("Not yet implemented")
}
// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
func (p *buckProvider) Delete(ctx context.Context, req *cocorpc.DeleteRequest) (*pbempty.Empty, error) {
contract.Assert(req.GetType() == string(Bucket))

View file

@ -40,7 +40,7 @@ type objProvider struct {
// Check validates that the given property bag is valid for a resource of the given type.
func (p *objProvider) Check(ctx context.Context, req *cocorpc.CheckRequest) (*cocorpc.CheckResponse, error) {
// Read in the properties, create and validate a new group, and return the failures (if any).
// Get in the properties, create and validate a new group, and return the failures (if any).
contract.Assert(req.GetType() == string(Object))
_, _, result := unmarshalObject(req.GetProperties())
return resource.NewCheckResponse(result), nil
@ -68,7 +68,7 @@ func (p *objProvider) Name(ctx context.Context, req *cocorpc.NameRequest) (*coco
func (p *objProvider) Create(ctx context.Context, req *cocorpc.CreateRequest) (*cocorpc.CreateResponse, error) {
contract.Assert(req.GetType() == string(Object))
// Read in the properties given by the request, validating as we go; if any fail, reject the request.
// Get in the properties given by the request, validating as we go; if any fail, reject the request.
obj, _, decerr := unmarshalObject(req.GetProperties())
if decerr != nil {
// TODO: this is a good example of a "benign" (StateOK) error; handle it accordingly.
@ -102,8 +102,15 @@ func (p *objProvider) Create(ctx context.Context, req *cocorpc.CreateRequest) (*
return &cocorpc.CreateResponse{Id: obj.Bucket + ObjectIDDelim + obj.Key}, nil
}
// Read reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *objProvider) Read(ctx context.Context, req *cocorpc.ReadRequest) (*cocorpc.ReadResponse, error) {
// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *objProvider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocorpc.GetResponse, error) {
contract.Assert(req.GetType() == string(Object))
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) {
contract.Assert(req.GetType() == string(Object))
return nil, errors.New("Not yet implemented")
}
@ -115,13 +122,6 @@ func (p *objProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*
return nil, errors.New("Not yet implemented")
}
// UpdateImpact checks what impacts a hypothetical update will have on the resource's properties.
func (p *objProvider) UpdateImpact(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.UpdateImpactResponse, error) {
contract.Assert(req.GetType() == string(Object))
return nil, errors.New("Not yet implemented")
}
// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
func (p *objProvider) Delete(ctx context.Context, req *cocorpc.DeleteRequest) (*pbempty.Empty, error) {
contract.Assert(req.GetType() == string(Object))

View file

@ -30,7 +30,7 @@ type envProvider struct {
// Check validates that the given property bag is valid for a resource of the given type.
func (p *envProvider) Check(ctx context.Context, req *cocorpc.CheckRequest) (*cocorpc.CheckResponse, error) {
// Read in the properties, create and validate a new group, and return the failures (if any).
// Get in the properties, create and validate a new group, and return the failures (if any).
contract.Assert(req.GetType() == string(Environment))
_, _, result := unmarshalEnvironment(req.GetProperties())
return resource.NewCheckResponse(result), nil
@ -49,7 +49,7 @@ func (p *envProvider) Name(ctx context.Context, req *cocorpc.NameRequest) (*coco
func (p *envProvider) Create(ctx context.Context, req *cocorpc.CreateRequest) (*cocorpc.CreateResponse, error) {
contract.Assert(req.GetType() == string(Environment))
// Read in the properties given by the request, validating as we go; if any fail, reject the request.
// Get in the properties given by the request, validating as we go; if any fail, reject the request.
env, _, decerr := unmarshalEnvironment(req.GetProperties())
if decerr != nil {
return nil, decerr
@ -65,8 +65,15 @@ func (p *envProvider) Create(ctx context.Context, req *cocorpc.CreateRequest) (*
return &cocorpc.CreateResponse{Id: meta.Name}, nil
}
// Read reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *envProvider) Read(ctx context.Context, req *cocorpc.ReadRequest) (*cocorpc.ReadResponse, error) {
// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *envProvider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocorpc.GetResponse, error) {
contract.Assert(req.GetType() == string(Environment))
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) {
contract.Assert(req.GetType() == string(Environment))
return nil, errors.New("Not yet implemented")
}
@ -78,13 +85,6 @@ func (p *envProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*
return nil, errors.New("Not yet implemented")
}
// UpdateImpact checks what impacts a hypothetical update will have on the resource's properties.
func (p *envProvider) UpdateImpact(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.UpdateImpactResponse, error) {
contract.Assert(req.GetType() == string(Environment))
return nil, errors.New("Not yet implemented")
}
// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
func (p *envProvider) Delete(ctx context.Context, req *cocorpc.DeleteRequest) (*pbempty.Empty, error) {
contract.Assert(req.GetType() == string(Environment))

View file

@ -31,7 +31,7 @@ type funcProvider struct {
// Check validates that the given property bag is valid for a resource of the given type.
func (p *funcProvider) Check(ctx context.Context, req *cocorpc.CheckRequest) (*cocorpc.CheckResponse, error) {
// Read in the properties, create and validate a new group, and return the failures (if any).
// Get in the properties, create and validate a new group, and return the failures (if any).
contract.Assert(req.GetType() == string(Function))
_, _, result := unmarshalFunction(req.GetProperties())
return resource.NewCheckResponse(result), nil
@ -50,7 +50,7 @@ func (p *funcProvider) Name(ctx context.Context, req *cocorpc.NameRequest) (*coc
func (p *funcProvider) Create(ctx context.Context, req *cocorpc.CreateRequest) (*cocorpc.CreateResponse, error) {
contract.Assert(req.GetType() == string(Function))
// Read in the properties given by the request, validating as we go; if any fail, reject the request.
// Get in the properties given by the request, validating as we go; if any fail, reject the request.
fun, _, decerr := unmarshalFunction(req.GetProperties())
if decerr != nil {
return nil, decerr
@ -85,8 +85,15 @@ func (p *funcProvider) Create(ctx context.Context, req *cocorpc.CreateRequest) (
return &cocorpc.CreateResponse{Id: meta.Name}, nil
}
// Read reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *funcProvider) Read(ctx context.Context, req *cocorpc.ReadRequest) (*cocorpc.ReadResponse, error) {
// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *funcProvider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocorpc.GetResponse, error) {
contract.Assert(req.GetType() == string(Function))
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) {
contract.Assert(req.GetType() == string(Function))
return nil, errors.New("Not yet implemented")
}
@ -98,13 +105,6 @@ func (p *funcProvider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (
return nil, errors.New("Not yet implemented")
}
// UpdateImpact checks what impacts a hypothetical update will have on the resource's properties.
func (p *funcProvider) UpdateImpact(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.UpdateImpactResponse, error) {
contract.Assert(req.GetType() == string(Function))
return nil, errors.New("Not yet implemented")
}
// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
func (p *funcProvider) Delete(ctx context.Context, req *cocorpc.DeleteRequest) (*pbempty.Empty, error) {
contract.Assert(req.GetType() == string(Function))

View file

@ -83,13 +83,23 @@ func (p *Provider) Create(ctx context.Context, req *cocorpc.CreateRequest) (*coc
return nil, fmt.Errorf("Unrecognized resource type (Create): %v", t)
}
// Read reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *Provider) Read(ctx context.Context, req *cocorpc.ReadRequest) (*cocorpc.ReadResponse, error) {
// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *Provider) Get(ctx context.Context, req *cocorpc.GetRequest) (*cocorpc.GetResponse, error) {
t := tokens.Type(req.GetType())
if prov, has := p.impls[t]; has {
return prov.Read(ctx, req)
return prov.Get(ctx, req)
}
return nil, fmt.Errorf("Unrecognized resource type (Read): %v", t)
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) {
t := tokens.Type(req.GetType())
if prov, has := p.impls[t]; has {
return prov.PreviewUpdate(ctx, req)
}
return nil, fmt.Errorf("Unrecognized resource type (PreviewUpdate): %v", t)
}
// Update updates an existing resource with new values. Only those values in the provided property bag are updated
@ -102,16 +112,6 @@ func (p *Provider) Update(ctx context.Context, req *cocorpc.UpdateRequest) (*pbe
return nil, fmt.Errorf("Unrecognized resource type (Update): %v", t)
}
// UpdateImpact checks what impacts a hypothetical update will have on the resource's properties.
func (p *Provider) UpdateImpact(
ctx context.Context, req *cocorpc.UpdateRequest) (*cocorpc.UpdateImpactResponse, error) {
t := tokens.Type(req.GetType())
if prov, has := p.impls[t]; has {
return prov.UpdateImpact(ctx, req)
}
return nil, fmt.Errorf("Unrecognized resource type (UpdateImpact): %v", t)
}
// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
func (p *Provider) Delete(ctx context.Context, req *cocorpc.DeleteRequest) (*pbempty.Empty, error) {
t := tokens.Type(req.GetType())

View file

@ -358,7 +358,7 @@ func newPlan(ctx *Context, old Snapshot, new Snapshot, analyzers []tokens.QName)
if err != nil {
return nil, err
}
replaces, _, err := prov.UpdateImpact(old.ID(), old.Type(), old.Properties(), computed)
replaces, _, err := prov.PreviewUpdate(old.ID(), old.Type(), old.Properties(), computed)
if err != nil {
return nil, err
}

View file

@ -31,12 +31,12 @@ type Provider interface {
Name(t tokens.Type, props PropertyMap) (tokens.QName, error)
// Create allocates a new instance of the provided resource and returns its unique ID afterwards.
Create(t tokens.Type, props PropertyMap) (ID, State, error)
// Read reads the instance state identified by id/t, and returns a bag of properties.
Read(id ID, t tokens.Type) (PropertyMap, 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)
// Update updates an existing resource with new values.
Update(id ID, t tokens.Type, olds PropertyMap, news PropertyMap) (State, error)
// UpdateImpact checks what impacts a hypothetical update will have on the resource's properties.
UpdateImpact(id ID, t tokens.Type, olds PropertyMap, news PropertyMap) ([]string, PropertyMap, error)
// Delete tears down an existing resource.
Delete(id ID, t tokens.Type) (State, error)
}

View file

@ -124,25 +124,57 @@ func (p *provider) Create(t tokens.Type, props PropertyMap) (ID, State, error) {
return id, StateOK, nil
}
// Read reads the instance state identified by id/t, and returns a bag of properties.
func (p *provider) Read(id ID, t tokens.Type) (PropertyMap, error) {
glog.V(7).Infof("resource[%v].Read(id=%v,t=%v) executing", p.pkg, id, t)
req := &cocorpc.ReadRequest{
// Get reads the instance state identified by id/t, and returns a bag of properties.
func (p *provider) Get(id ID, t tokens.Type) (PropertyMap, error) {
glog.V(7).Infof("resource[%v].Get(id=%v,t=%v) executing", p.pkg, id, t)
req := &cocorpc.GetRequest{
Id: string(id),
Type: string(t),
}
resp, err := p.client.Read(p.ctx.Request(), req)
resp, err := p.client.Get(p.ctx.Request(), req)
if err != nil {
glog.V(7).Infof("resource[%v].Read(id=%v,t=%v) failed: err=%v", p.pkg, id, t, err)
glog.V(7).Infof("resource[%v].Get(id=%v,t=%v) failed: err=%v", p.pkg, id, t, err)
return nil, err
}
props := UnmarshalProperties(resp.GetProperties())
glog.V(7).Infof("resource[%v].Read(id=%v,t=%v) success: #props=%v", p.pkg, t, id, len(props))
glog.V(7).Infof("resource[%v].Get(id=%v,t=%v) success: #props=%v", p.pkg, t, id, len(props))
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,
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",
p.pkg, id, t, len(olds), len(news))
req := &cocorpc.UpdateRequest{
Id: string(id),
Type: string(t),
Olds: MarshalProperties(p.ctx, olds, MarshalOptions{
RawURNs: true, // often used during URN creation; IDs won't be ready.
}),
News: MarshalProperties(p.ctx, news, MarshalOptions{
RawURNs: true, // often used during URN creation; IDs won't be ready.
}),
}
resp, err := p.client.PreviewUpdate(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)
return nil, nil, err
}
replaces := resp.GetReplaces()
changes := UnmarshalProperties(resp.GetChanges())
glog.V(7).Infof("resource[%v].Update(id=%v,t=%v,...) success: #replaces=%v #changes=%v",
p.pkg, id, t, len(replaces), len(changes))
return replaces, changes, nil
}
// Update updates an existing resource with new values.
func (p *provider) Update(id ID, t tokens.Type, olds PropertyMap, news PropertyMap) (State, error) {
contract.Requiref(id != "", "id", "not empty")
@ -169,38 +201,6 @@ func (p *provider) Update(id ID, t tokens.Type, olds PropertyMap, news PropertyM
return StateOK, nil
}
// UpdateImpact checks what impacts a hypothetical update will have on the resource's properties.
func (p *provider) UpdateImpact(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].UpdateImpact(id=%v,t=%v,#olds=%v,#news=%v) executing",
p.pkg, id, t, len(olds), len(news))
req := &cocorpc.UpdateRequest{
Id: string(id),
Type: string(t),
Olds: MarshalProperties(p.ctx, olds, MarshalOptions{
RawURNs: true, // often used during URN creation; IDs won't be ready.
}),
News: MarshalProperties(p.ctx, news, MarshalOptions{
RawURNs: true, // often used during URN creation; IDs won't be ready.
}),
}
resp, err := p.client.UpdateImpact(p.ctx.Request(), req)
if err != nil {
glog.V(7).Infof("resource[%v].UpdateImpact(id=%v,t=%v,...) failed: %v", p.pkg, id, t, err)
return nil, nil, err
}
replaces := resp.GetReplaces()
changes := UnmarshalProperties(resp.GetChanges())
glog.V(7).Infof("resource[%v].Update(id=%v,t=%v,...) success: #replaces=%v #changes=%v",
p.pkg, id, t, len(replaces), len(changes))
return replaces, changes, nil
}
// Delete tears down an existing resource.
func (p *provider) Delete(id ID, t tokens.Type) (State, error) {
contract.Requiref(id != "", "id", "not empty")

View file

@ -25,10 +25,10 @@ It has these top-level messages:
NameResponse
CreateRequest
CreateResponse
ReadRequest
ReadResponse
GetRequest
GetResponse
UpdateRequest
UpdateImpactResponse
PreviewUpdateResponse
DeleteRequest
*/
package cocorpc

View file

@ -164,40 +164,40 @@ func (m *CreateResponse) GetId() string {
return ""
}
type ReadRequest struct {
type GetRequest struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Type string `protobuf:"bytes,2,opt,name=type" json:"type,omitempty"`
}
func (m *ReadRequest) Reset() { *m = ReadRequest{} }
func (m *ReadRequest) String() string { return proto.CompactTextString(m) }
func (*ReadRequest) ProtoMessage() {}
func (*ReadRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{7} }
func (m *GetRequest) Reset() { *m = GetRequest{} }
func (m *GetRequest) String() string { return proto.CompactTextString(m) }
func (*GetRequest) ProtoMessage() {}
func (*GetRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{7} }
func (m *ReadRequest) GetId() string {
func (m *GetRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *ReadRequest) GetType() string {
func (m *GetRequest) GetType() string {
if m != nil {
return m.Type
}
return ""
}
type ReadResponse struct {
type GetResponse struct {
Properties *google_protobuf.Struct `protobuf:"bytes,1,opt,name=properties" json:"properties,omitempty"`
}
func (m *ReadResponse) Reset() { *m = ReadResponse{} }
func (m *ReadResponse) String() string { return proto.CompactTextString(m) }
func (*ReadResponse) ProtoMessage() {}
func (*ReadResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{8} }
func (m *GetResponse) Reset() { *m = GetResponse{} }
func (m *GetResponse) String() string { return proto.CompactTextString(m) }
func (*GetResponse) ProtoMessage() {}
func (*GetResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{8} }
func (m *ReadResponse) GetProperties() *google_protobuf.Struct {
func (m *GetResponse) GetProperties() *google_protobuf.Struct {
if m != nil {
return m.Properties
}
@ -244,24 +244,24 @@ func (m *UpdateRequest) GetNews() *google_protobuf.Struct {
return nil
}
type UpdateImpactResponse struct {
type PreviewUpdateResponse 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 *UpdateImpactResponse) Reset() { *m = UpdateImpactResponse{} }
func (m *UpdateImpactResponse) String() string { return proto.CompactTextString(m) }
func (*UpdateImpactResponse) ProtoMessage() {}
func (*UpdateImpactResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{10} }
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 *UpdateImpactResponse) GetReplaces() []string {
func (m *PreviewUpdateResponse) GetReplaces() []string {
if m != nil {
return m.Replaces
}
return nil
}
func (m *UpdateImpactResponse) GetChanges() *google_protobuf.Struct {
func (m *PreviewUpdateResponse) GetChanges() *google_protobuf.Struct {
if m != nil {
return m.Changes
}
@ -300,10 +300,10 @@ func init() {
proto.RegisterType((*NameResponse)(nil), "cocorpc.NameResponse")
proto.RegisterType((*CreateRequest)(nil), "cocorpc.CreateRequest")
proto.RegisterType((*CreateResponse)(nil), "cocorpc.CreateResponse")
proto.RegisterType((*ReadRequest)(nil), "cocorpc.ReadRequest")
proto.RegisterType((*ReadResponse)(nil), "cocorpc.ReadResponse")
proto.RegisterType((*GetRequest)(nil), "cocorpc.GetRequest")
proto.RegisterType((*GetResponse)(nil), "cocorpc.GetResponse")
proto.RegisterType((*UpdateRequest)(nil), "cocorpc.UpdateRequest")
proto.RegisterType((*UpdateImpactResponse)(nil), "cocorpc.UpdateImpactResponse")
proto.RegisterType((*PreviewUpdateResponse)(nil), "cocorpc.PreviewUpdateResponse")
proto.RegisterType((*DeleteRequest)(nil), "cocorpc.DeleteRequest")
}
@ -327,12 +327,12 @@ type ResourceProviderClient interface {
// 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").
Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
// Read reads the instance state identified by ID, returning a populated resource object, or an error if not found.
Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, 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)
// Update updates an existing resource with new values.
Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
// UpdateImpact checks what impacts a hypothetical update will have on the resource's properties.
UpdateImpact(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*UpdateImpactResponse, 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)
}
@ -372,9 +372,18 @@ func (c *resourceProviderClient) Create(ctx context.Context, in *CreateRequest,
return out, nil
}
func (c *resourceProviderClient) Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error) {
out := new(ReadResponse)
err := grpc.Invoke(ctx, "/cocorpc.ResourceProvider/Read", in, out, c.cc, opts...)
func (c *resourceProviderClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) {
out := new(GetResponse)
err := grpc.Invoke(ctx, "/cocorpc.ResourceProvider/Get", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
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...)
if err != nil {
return nil, err
}
@ -390,15 +399,6 @@ func (c *resourceProviderClient) Update(ctx context.Context, in *UpdateRequest,
return out, nil
}
func (c *resourceProviderClient) UpdateImpact(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*UpdateImpactResponse, error) {
out := new(UpdateImpactResponse)
err := grpc.Invoke(ctx, "/cocorpc.ResourceProvider/UpdateImpact", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *resourceProviderClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) {
out := new(google_protobuf1.Empty)
err := grpc.Invoke(ctx, "/cocorpc.ResourceProvider/Delete", in, out, c.cc, opts...)
@ -420,12 +420,12 @@ type ResourceProviderServer interface {
// 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").
Create(context.Context, *CreateRequest) (*CreateResponse, error)
// Read reads the instance state identified by ID, returning a populated resource object, or an error if not found.
Read(context.Context, *ReadRequest) (*ReadResponse, 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)
// Update updates an existing resource with new values.
Update(context.Context, *UpdateRequest) (*google_protobuf1.Empty, error)
// UpdateImpact checks what impacts a hypothetical update will have on the resource's properties.
UpdateImpact(context.Context, *UpdateRequest) (*UpdateImpactResponse, 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)
}
@ -488,20 +488,38 @@ func _ResourceProvider_Create_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
func _ResourceProvider_Read_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReadRequest)
func _ResourceProvider_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ResourceProviderServer).Read(ctx, in)
return srv.(ResourceProviderServer).Get(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cocorpc.ResourceProvider/Read",
FullMethod: "/cocorpc.ResourceProvider/Get",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ResourceProviderServer).Read(ctx, req.(*ReadRequest))
return srv.(ResourceProviderServer).Get(ctx, req.(*GetRequest))
}
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)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ResourceProviderServer).PreviewUpdate(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cocorpc.ResourceProvider/PreviewUpdate",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ResourceProviderServer).PreviewUpdate(ctx, req.(*UpdateRequest))
}
return interceptor(ctx, in, info, handler)
}
@ -524,24 +542,6 @@ func _ResourceProvider_Update_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
func _ResourceProvider_UpdateImpact_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ResourceProviderServer).UpdateImpact(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cocorpc.ResourceProvider/UpdateImpact",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ResourceProviderServer).UpdateImpact(ctx, req.(*UpdateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ResourceProvider_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteRequest)
if err := dec(in); err != nil {
@ -577,17 +577,17 @@ var _ResourceProvider_serviceDesc = grpc.ServiceDesc{
Handler: _ResourceProvider_Create_Handler,
},
{
MethodName: "Read",
Handler: _ResourceProvider_Read_Handler,
MethodName: "Get",
Handler: _ResourceProvider_Get_Handler,
},
{
MethodName: "PreviewUpdate",
Handler: _ResourceProvider_PreviewUpdate_Handler,
},
{
MethodName: "Update",
Handler: _ResourceProvider_Update_Handler,
},
{
MethodName: "UpdateImpact",
Handler: _ResourceProvider_UpdateImpact_Handler,
},
{
MethodName: "Delete",
Handler: _ResourceProvider_Delete_Handler,
@ -600,37 +600,38 @@ var _ResourceProvider_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("provider.proto", fileDescriptor2) }
var fileDescriptor2 = []byte{
// 511 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x54, 0x5d, 0x6f, 0xd3, 0x30,
0x14, 0x5d, 0xda, 0xd0, 0xb5, 0xb7, 0x1f, 0x42, 0xd6, 0xd6, 0x45, 0x01, 0xa4, 0xca, 0x4f, 0x95,
0x90, 0x32, 0xb5, 0x13, 0x02, 0xc1, 0xdb, 0x06, 0x4c, 0xbc, 0x20, 0x14, 0xc4, 0x0b, 0xf0, 0x92,
0x39, 0x77, 0x5d, 0x44, 0x1a, 0x1b, 0xdb, 0x01, 0xf5, 0x47, 0xf0, 0x7f, 0xf8, 0x79, 0x28, 0xb1,
0x1b, 0xdc, 0x4c, 0x63, 0xe3, 0x61, 0x6f, 0xf1, 0xbd, 0xc7, 0xe7, 0x9c, 0xdb, 0x7b, 0x5c, 0x98,
0x08, 0xc9, 0x7f, 0x64, 0x29, 0xca, 0x48, 0x48, 0xae, 0x39, 0xd9, 0x67, 0x9c, 0x71, 0x29, 0x58,
0xf8, 0x68, 0xc5, 0xf9, 0x2a, 0xc7, 0xe3, 0xba, 0x7c, 0x51, 0x5e, 0x1e, 0xe3, 0x5a, 0xe8, 0x8d,
0x41, 0x85, 0x8f, 0xdb, 0x4d, 0xa5, 0x65, 0xc9, 0xb4, 0xe9, 0xd2, 0x2f, 0x30, 0x3a, 0xbb, 0x42,
0xf6, 0x2d, 0xc6, 0xef, 0x25, 0x2a, 0x4d, 0x08, 0xf8, 0x7a, 0x23, 0x30, 0xf0, 0x66, 0xde, 0x7c,
0x10, 0xd7, 0xdf, 0xe4, 0x39, 0x80, 0x90, 0x5c, 0xa0, 0xd4, 0x19, 0xaa, 0xa0, 0x33, 0xf3, 0xe6,
0xc3, 0xe5, 0x51, 0x64, 0x68, 0xa3, 0x2d, 0x6d, 0xf4, 0xb1, 0xa6, 0x8d, 0x1d, 0x28, 0x3d, 0x85,
0xb1, 0x25, 0x57, 0x82, 0x17, 0x0a, 0xc9, 0x02, 0xfa, 0x97, 0x49, 0x96, 0x97, 0x12, 0x55, 0xe0,
0xcd, 0xba, 0xf3, 0xe1, 0xf2, 0x30, 0xb2, 0x43, 0x44, 0x35, 0xf2, 0xad, 0xe9, 0xc6, 0x0d, 0x8c,
0x9e, 0x5a, 0x83, 0xb6, 0x43, 0x42, 0xe8, 0x5b, 0x85, 0x8d, 0x35, 0xd9, 0x9c, 0xc9, 0x14, 0x7a,
0x12, 0x13, 0xc5, 0x8b, 0xda, 0xe4, 0x20, 0xb6, 0x27, 0xfa, 0x19, 0x86, 0xef, 0x93, 0x35, 0xde,
0xcb, 0x8c, 0x14, 0x46, 0x86, 0xdb, 0x8e, 0x48, 0xc0, 0x2f, 0x92, 0x75, 0x43, 0x5e, 0x7d, 0xd3,
0xaf, 0x30, 0x3e, 0x93, 0x98, 0xe8, 0xfb, 0x71, 0x30, 0x83, 0xc9, 0x96, 0xdd, 0x7a, 0x98, 0x40,
0x27, 0x4b, 0x2d, 0x79, 0x27, 0x4b, 0xe9, 0x02, 0x86, 0x31, 0x26, 0xe9, 0x56, 0xbd, 0xd5, 0x6e,
0xdc, 0x74, 0xfe, 0xba, 0xa1, 0xe7, 0x30, 0x32, 0x57, 0x2c, 0xe5, 0xae, 0x3b, 0xef, 0xee, 0xee,
0x7e, 0x79, 0x30, 0xfe, 0x24, 0x52, 0x67, 0xf8, 0x3b, 0xc8, 0x93, 0xa7, 0xe0, 0xf3, 0x3c, 0x55,
0x41, 0xf7, 0xdf, 0x42, 0x35, 0xa8, 0x02, 0x17, 0xf8, 0x53, 0x05, 0xfe, 0x2d, 0xe0, 0x0a, 0x44,
0x11, 0x0e, 0x8c, 0x9d, 0x77, 0x6b, 0x91, 0x30, 0xdd, 0x0c, 0x18, 0x42, 0x5f, 0xa2, 0xc8, 0x13,
0x66, 0xa3, 0x39, 0x88, 0x9b, 0x33, 0x59, 0xc0, 0x3e, 0xbb, 0x4a, 0x8a, 0xd5, 0xed, 0x7b, 0xd9,
0xe2, 0xe8, 0x09, 0x8c, 0x5f, 0x63, 0x8e, 0xff, 0x35, 0xf5, 0xf2, 0x77, 0x17, 0x1e, 0xc6, 0xa8,
0x78, 0x29, 0x19, 0x7e, 0xb0, 0x6f, 0x9d, 0xbc, 0x80, 0x07, 0xf5, 0x03, 0x20, 0xad, 0xa7, 0x62,
0x89, 0xc3, 0x69, 0xbb, 0x6c, 0x06, 0xa2, 0x7b, 0xe4, 0x19, 0xf8, 0x55, 0x34, 0xc9, 0x41, 0x83,
0x70, 0x5e, 0x41, 0x78, 0xd8, 0xaa, 0x36, 0xd7, 0x5e, 0x41, 0xcf, 0xe4, 0x89, 0x38, 0xd4, 0x6e,
0x7c, 0xc3, 0xa3, 0x6b, 0x75, 0x57, 0xb3, 0xca, 0x8d, 0xa3, 0xe9, 0x24, 0xcf, 0xd1, 0x74, 0xc3,
0x45, 0xf7, 0xc8, 0x4b, 0xe8, 0x99, 0xad, 0x38, 0x9a, 0x3b, 0xa9, 0x09, 0xa7, 0xd7, 0x7e, 0xf2,
0x37, 0xd5, 0x9f, 0x1c, 0xdd, 0x23, 0xe7, 0x30, 0x72, 0x37, 0x7a, 0x23, 0xc3, 0x93, 0x56, 0x7d,
0x37, 0x00, 0xc6, 0x84, 0xd9, 0x99, 0x43, 0xb1, 0xb3, 0xc4, 0x9b, 0x4d, 0x5c, 0xf4, 0xea, 0xca,
0xc9, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf5, 0xfa, 0xad, 0x34, 0xa4, 0x05, 0x00, 0x00,
// 513 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x54, 0x41, 0x6f, 0xd3, 0x4c,
0x10, 0xad, 0x93, 0x7c, 0x69, 0x32, 0xa9, 0xa3, 0x4f, 0x4b, 0x93, 0x5a, 0x06, 0xa1, 0x68, 0x4f,
0x91, 0x90, 0x5c, 0x9a, 0x0a, 0x81, 0xe0, 0xd6, 0x42, 0x2b, 0x2e, 0xa8, 0x32, 0xe2, 0x02, 0x5c,
0x5c, 0x7b, 0x92, 0x5a, 0x38, 0xde, 0x65, 0x77, 0xdd, 0x2a, 0x3f, 0x82, 0xdf, 0xc3, 0xdf, 0x43,
0xb6, 0xd7, 0x5b, 0xdb, 0x05, 0x52, 0x0e, 0xbd, 0x79, 0x67, 0xde, 0xbc, 0x79, 0xa3, 0x79, 0x63,
0x18, 0x73, 0xc1, 0xae, 0xe3, 0x08, 0x85, 0xc7, 0x05, 0x53, 0x8c, 0xec, 0x86, 0x2c, 0x64, 0x82,
0x87, 0xee, 0xe3, 0x15, 0x63, 0xab, 0x04, 0x0f, 0x8b, 0xf0, 0x65, 0xb6, 0x3c, 0xc4, 0x35, 0x57,
0x9b, 0x12, 0xe5, 0x3e, 0x69, 0x27, 0xa5, 0x12, 0x59, 0xa8, 0xca, 0x2c, 0xfd, 0x02, 0x7b, 0xa7,
0x57, 0x18, 0x7e, 0xf3, 0xf1, 0x7b, 0x86, 0x52, 0x11, 0x02, 0x3d, 0xb5, 0xe1, 0xe8, 0x58, 0x33,
0x6b, 0x3e, 0xf4, 0x8b, 0x6f, 0xf2, 0x12, 0x80, 0x0b, 0xc6, 0x51, 0xa8, 0x18, 0xa5, 0xd3, 0x99,
0x59, 0xf3, 0xd1, 0xe2, 0xc0, 0x2b, 0x69, 0xbd, 0x8a, 0xd6, 0xfb, 0x58, 0xd0, 0xfa, 0x35, 0x28,
0x3d, 0x01, 0x5b, 0x93, 0x4b, 0xce, 0x52, 0x89, 0xe4, 0x08, 0x06, 0xcb, 0x20, 0x4e, 0x32, 0x81,
0xd2, 0xb1, 0x66, 0xdd, 0xf9, 0x68, 0x31, 0xf1, 0xf4, 0x10, 0x5e, 0x81, 0x3c, 0x2b, 0xb3, 0xbe,
0x81, 0xd1, 0x13, 0x2d, 0x50, 0x67, 0x88, 0x0b, 0x03, 0xdd, 0x61, 0xa3, 0x45, 0x9a, 0x37, 0x99,
0x42, 0x5f, 0x60, 0x20, 0x59, 0x5a, 0x88, 0x1c, 0xfa, 0xfa, 0x45, 0x3f, 0xc3, 0xe8, 0x43, 0xb0,
0xc6, 0x07, 0x99, 0x91, 0xc2, 0x5e, 0xc9, 0xad, 0x47, 0x24, 0xd0, 0x4b, 0x83, 0xb5, 0x21, 0xcf,
0xbf, 0xe9, 0x57, 0xb0, 0x4f, 0x05, 0x06, 0xea, 0x61, 0x14, 0xcc, 0x60, 0x5c, 0xb1, 0x6b, 0x0d,
0x63, 0xe8, 0xc4, 0x91, 0x26, 0xef, 0xc4, 0x11, 0x7d, 0x0e, 0x70, 0x8e, 0xaa, 0x6a, 0xde, 0xca,
0x1a, 0x31, 0x9d, 0x5b, 0x31, 0xf4, 0x0c, 0x46, 0x45, 0x85, 0x26, 0x6c, 0x6a, 0xb3, 0xee, 0xaf,
0xed, 0x87, 0x05, 0xf6, 0x27, 0x1e, 0xd5, 0x46, 0xbf, 0x47, 0x77, 0xf2, 0x0c, 0x7a, 0x2c, 0x89,
0xa4, 0xd3, 0xfd, 0x7b, 0xa3, 0x02, 0x94, 0x83, 0x53, 0xbc, 0x91, 0x4e, 0x6f, 0x0b, 0x38, 0x07,
0xd1, 0x25, 0x4c, 0x2e, 0x04, 0x5e, 0xc7, 0x78, 0x53, 0xa9, 0xd2, 0x13, 0xba, 0x30, 0x10, 0xc8,
0x93, 0x20, 0xd4, 0xce, 0x1c, 0xfa, 0xe6, 0x4d, 0x8e, 0x60, 0x37, 0xbc, 0x0a, 0xd2, 0xd5, 0xf6,
0xb5, 0x54, 0x38, 0x7a, 0x0c, 0xf6, 0x5b, 0x4c, 0xf0, 0x9f, 0xc6, 0x5e, 0xfc, 0xec, 0xc2, 0xff,
0x3e, 0x4a, 0x96, 0x89, 0x10, 0x2f, 0xf4, 0xa9, 0x93, 0x57, 0xf0, 0x5f, 0xe1, 0x7f, 0xd2, 0xba,
0x14, 0x4d, 0xec, 0x4e, 0xdb, 0xe1, 0x72, 0x20, 0xba, 0x43, 0x5e, 0x40, 0x2f, 0x77, 0x26, 0xd9,
0x37, 0x88, 0xda, 0x11, 0xb8, 0x93, 0x56, 0xd4, 0x94, 0xbd, 0x81, 0x7e, 0x69, 0x27, 0x52, 0xa3,
0xae, 0xbb, 0xd7, 0x3d, 0xb8, 0x13, 0x37, 0xc5, 0x0b, 0xe8, 0x9e, 0xa3, 0x22, 0x8f, 0x0c, 0xe2,
0xd6, 0x77, 0xee, 0x7e, 0x33, 0x68, 0x6a, 0xde, 0x83, 0xdd, 0xd8, 0x49, 0xad, 0x6f, 0xc3, 0x3a,
0xee, 0x53, 0x13, 0xff, 0xed, 0x0e, 0xe9, 0x0e, 0x79, 0x0d, 0xfd, 0x2d, 0x1c, 0xd3, 0x3b, 0xab,
0x7b, 0x97, 0xff, 0x2b, 0xcb, 0xda, 0x72, 0x65, 0xb5, 0xda, 0xc6, 0x0e, 0xff, 0x5c, 0x7b, 0xd9,
0x2f, 0x22, 0xc7, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x0f, 0xcc, 0x6d, 0xae, 0xa2, 0x05, 0x00,
0x00,
}

View file

@ -17,11 +17,11 @@ goog.exportSymbol('proto.cocorpc.CheckResponse', null, global);
goog.exportSymbol('proto.cocorpc.CreateRequest', null, global);
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.NameRequest', null, global);
goog.exportSymbol('proto.cocorpc.NameResponse', null, global);
goog.exportSymbol('proto.cocorpc.ReadRequest', null, global);
goog.exportSymbol('proto.cocorpc.ReadResponse', null, global);
goog.exportSymbol('proto.cocorpc.UpdateImpactResponse', null, global);
goog.exportSymbol('proto.cocorpc.PreviewUpdateResponse', null, global);
goog.exportSymbol('proto.cocorpc.UpdateRequest', null, global);
/**
@ -1201,12 +1201,12 @@ proto.cocorpc.CreateResponse.prototype.setId = function(value) {
* @extends {jspb.Message}
* @constructor
*/
proto.cocorpc.ReadRequest = function(opt_data) {
proto.cocorpc.GetRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.cocorpc.ReadRequest, jspb.Message);
goog.inherits(proto.cocorpc.GetRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.cocorpc.ReadRequest.displayName = 'proto.cocorpc.ReadRequest';
proto.cocorpc.GetRequest.displayName = 'proto.cocorpc.GetRequest';
}
@ -1221,8 +1221,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) {
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.cocorpc.ReadRequest.prototype.toObject = function(opt_includeInstance) {
return proto.cocorpc.ReadRequest.toObject(opt_includeInstance, this);
proto.cocorpc.GetRequest.prototype.toObject = function(opt_includeInstance) {
return proto.cocorpc.GetRequest.toObject(opt_includeInstance, this);
};
@ -1231,10 +1231,10 @@ proto.cocorpc.ReadRequest.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.ReadRequest} msg The msg instance to transform.
* @param {!proto.cocorpc.GetRequest} msg The msg instance to transform.
* @return {!Object}
*/
proto.cocorpc.ReadRequest.toObject = function(includeInstance, msg) {
proto.cocorpc.GetRequest.toObject = function(includeInstance, msg) {
var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, ""),
type: jspb.Message.getFieldWithDefault(msg, 2, "")
@ -1251,23 +1251,23 @@ proto.cocorpc.ReadRequest.toObject = function(includeInstance, msg) {
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.cocorpc.ReadRequest}
* @return {!proto.cocorpc.GetRequest}
*/
proto.cocorpc.ReadRequest.deserializeBinary = function(bytes) {
proto.cocorpc.GetRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cocorpc.ReadRequest;
return proto.cocorpc.ReadRequest.deserializeBinaryFromReader(msg, reader);
var msg = new proto.cocorpc.GetRequest;
return proto.cocorpc.GetRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.cocorpc.ReadRequest} msg The message object to deserialize into.
* @param {!proto.cocorpc.GetRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cocorpc.ReadRequest}
* @return {!proto.cocorpc.GetRequest}
*/
proto.cocorpc.ReadRequest.deserializeBinaryFromReader = function(msg, reader) {
proto.cocorpc.GetRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
@ -1295,9 +1295,9 @@ proto.cocorpc.ReadRequest.deserializeBinaryFromReader = function(msg, reader) {
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cocorpc.ReadRequest.prototype.serializeBinary = function() {
proto.cocorpc.GetRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cocorpc.ReadRequest.serializeBinaryToWriter(this, writer);
proto.cocorpc.GetRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
@ -1305,10 +1305,10 @@ proto.cocorpc.ReadRequest.prototype.serializeBinary = function() {
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.cocorpc.ReadRequest} message
* @param {!proto.cocorpc.GetRequest} message
* @param {!jspb.BinaryWriter} writer
*/
proto.cocorpc.ReadRequest.serializeBinaryToWriter = function(message, writer) {
proto.cocorpc.GetRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getId();
if (f.length > 0) {
@ -1331,13 +1331,13 @@ proto.cocorpc.ReadRequest.serializeBinaryToWriter = function(message, writer) {
* optional string id = 1;
* @return {string}
*/
proto.cocorpc.ReadRequest.prototype.getId = function() {
proto.cocorpc.GetRequest.prototype.getId = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/** @param {string} value */
proto.cocorpc.ReadRequest.prototype.setId = function(value) {
proto.cocorpc.GetRequest.prototype.setId = function(value) {
jspb.Message.setField(this, 1, value);
};
@ -1346,13 +1346,13 @@ proto.cocorpc.ReadRequest.prototype.setId = function(value) {
* optional string type = 2;
* @return {string}
*/
proto.cocorpc.ReadRequest.prototype.getType = function() {
proto.cocorpc.GetRequest.prototype.getType = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/** @param {string} value */
proto.cocorpc.ReadRequest.prototype.setType = function(value) {
proto.cocorpc.GetRequest.prototype.setType = function(value) {
jspb.Message.setField(this, 2, value);
};
@ -1368,12 +1368,12 @@ proto.cocorpc.ReadRequest.prototype.setType = function(value) {
* @extends {jspb.Message}
* @constructor
*/
proto.cocorpc.ReadResponse = function(opt_data) {
proto.cocorpc.GetResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.cocorpc.ReadResponse, jspb.Message);
goog.inherits(proto.cocorpc.GetResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.cocorpc.ReadResponse.displayName = 'proto.cocorpc.ReadResponse';
proto.cocorpc.GetResponse.displayName = 'proto.cocorpc.GetResponse';
}
@ -1388,8 +1388,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) {
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.cocorpc.ReadResponse.prototype.toObject = function(opt_includeInstance) {
return proto.cocorpc.ReadResponse.toObject(opt_includeInstance, this);
proto.cocorpc.GetResponse.prototype.toObject = function(opt_includeInstance) {
return proto.cocorpc.GetResponse.toObject(opt_includeInstance, this);
};
@ -1398,10 +1398,10 @@ proto.cocorpc.ReadResponse.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.ReadResponse} msg The msg instance to transform.
* @param {!proto.cocorpc.GetResponse} msg The msg instance to transform.
* @return {!Object}
*/
proto.cocorpc.ReadResponse.toObject = function(includeInstance, msg) {
proto.cocorpc.GetResponse.toObject = function(includeInstance, msg) {
var f, obj = {
properties: (f = msg.getProperties()) && google_protobuf_struct_pb.Struct.toObject(includeInstance, f)
};
@ -1417,23 +1417,23 @@ proto.cocorpc.ReadResponse.toObject = function(includeInstance, msg) {
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.cocorpc.ReadResponse}
* @return {!proto.cocorpc.GetResponse}
*/
proto.cocorpc.ReadResponse.deserializeBinary = function(bytes) {
proto.cocorpc.GetResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cocorpc.ReadResponse;
return proto.cocorpc.ReadResponse.deserializeBinaryFromReader(msg, reader);
var msg = new proto.cocorpc.GetResponse;
return proto.cocorpc.GetResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.cocorpc.ReadResponse} msg The message object to deserialize into.
* @param {!proto.cocorpc.GetResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cocorpc.ReadResponse}
* @return {!proto.cocorpc.GetResponse}
*/
proto.cocorpc.ReadResponse.deserializeBinaryFromReader = function(msg, reader) {
proto.cocorpc.GetResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
@ -1458,9 +1458,9 @@ proto.cocorpc.ReadResponse.deserializeBinaryFromReader = function(msg, reader) {
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cocorpc.ReadResponse.prototype.serializeBinary = function() {
proto.cocorpc.GetResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cocorpc.ReadResponse.serializeBinaryToWriter(this, writer);
proto.cocorpc.GetResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
@ -1468,10 +1468,10 @@ proto.cocorpc.ReadResponse.prototype.serializeBinary = function() {
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.cocorpc.ReadResponse} message
* @param {!proto.cocorpc.GetResponse} message
* @param {!jspb.BinaryWriter} writer
*/
proto.cocorpc.ReadResponse.serializeBinaryToWriter = function(message, writer) {
proto.cocorpc.GetResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getProperties();
if (f != null) {
@ -1488,19 +1488,19 @@ proto.cocorpc.ReadResponse.serializeBinaryToWriter = function(message, writer) {
* optional google.protobuf.Struct properties = 1;
* @return {?proto.google.protobuf.Struct}
*/
proto.cocorpc.ReadResponse.prototype.getProperties = function() {
proto.cocorpc.GetResponse.prototype.getProperties = function() {
return /** @type{?proto.google.protobuf.Struct} */ (
jspb.Message.getWrapperField(this, google_protobuf_struct_pb.Struct, 1));
};
/** @param {?proto.google.protobuf.Struct|undefined} value */
proto.cocorpc.ReadResponse.prototype.setProperties = function(value) {
proto.cocorpc.GetResponse.prototype.setProperties = function(value) {
jspb.Message.setWrapperField(this, 1, value);
};
proto.cocorpc.ReadResponse.prototype.clearProperties = function() {
proto.cocorpc.GetResponse.prototype.clearProperties = function() {
this.setProperties(undefined);
};
@ -1509,7 +1509,7 @@ proto.cocorpc.ReadResponse.prototype.clearProperties = function() {
* Returns whether this field is set.
* @return {!boolean}
*/
proto.cocorpc.ReadResponse.prototype.hasProperties = function() {
proto.cocorpc.GetResponse.prototype.hasProperties = function() {
return jspb.Message.getField(this, 1) != null;
};
@ -1780,19 +1780,19 @@ proto.cocorpc.UpdateRequest.prototype.hasNews = function() {
* @extends {jspb.Message}
* @constructor
*/
proto.cocorpc.UpdateImpactResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.cocorpc.UpdateImpactResponse.repeatedFields_, null);
proto.cocorpc.PreviewUpdateResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.cocorpc.PreviewUpdateResponse.repeatedFields_, null);
};
goog.inherits(proto.cocorpc.UpdateImpactResponse, jspb.Message);
goog.inherits(proto.cocorpc.PreviewUpdateResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.cocorpc.UpdateImpactResponse.displayName = 'proto.cocorpc.UpdateImpactResponse';
proto.cocorpc.PreviewUpdateResponse.displayName = 'proto.cocorpc.PreviewUpdateResponse';
}
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.cocorpc.UpdateImpactResponse.repeatedFields_ = [1];
proto.cocorpc.PreviewUpdateResponse.repeatedFields_ = [1];
@ -1807,8 +1807,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) {
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.cocorpc.UpdateImpactResponse.prototype.toObject = function(opt_includeInstance) {
return proto.cocorpc.UpdateImpactResponse.toObject(opt_includeInstance, this);
proto.cocorpc.PreviewUpdateResponse.prototype.toObject = function(opt_includeInstance) {
return proto.cocorpc.PreviewUpdateResponse.toObject(opt_includeInstance, this);
};
@ -1817,10 +1817,10 @@ proto.cocorpc.UpdateImpactResponse.prototype.toObject = function(opt_includeInst
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.cocorpc.UpdateImpactResponse} msg The msg instance to transform.
* @param {!proto.cocorpc.PreviewUpdateResponse} msg The msg instance to transform.
* @return {!Object}
*/
proto.cocorpc.UpdateImpactResponse.toObject = function(includeInstance, msg) {
proto.cocorpc.PreviewUpdateResponse.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)
@ -1837,23 +1837,23 @@ proto.cocorpc.UpdateImpactResponse.toObject = function(includeInstance, msg) {
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.cocorpc.UpdateImpactResponse}
* @return {!proto.cocorpc.PreviewUpdateResponse}
*/
proto.cocorpc.UpdateImpactResponse.deserializeBinary = function(bytes) {
proto.cocorpc.PreviewUpdateResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cocorpc.UpdateImpactResponse;
return proto.cocorpc.UpdateImpactResponse.deserializeBinaryFromReader(msg, reader);
var msg = new proto.cocorpc.PreviewUpdateResponse;
return proto.cocorpc.PreviewUpdateResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.cocorpc.UpdateImpactResponse} msg The message object to deserialize into.
* @param {!proto.cocorpc.PreviewUpdateResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cocorpc.UpdateImpactResponse}
* @return {!proto.cocorpc.PreviewUpdateResponse}
*/
proto.cocorpc.UpdateImpactResponse.deserializeBinaryFromReader = function(msg, reader) {
proto.cocorpc.PreviewUpdateResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
@ -1882,9 +1882,9 @@ proto.cocorpc.UpdateImpactResponse.deserializeBinaryFromReader = function(msg, r
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cocorpc.UpdateImpactResponse.prototype.serializeBinary = function() {
proto.cocorpc.PreviewUpdateResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cocorpc.UpdateImpactResponse.serializeBinaryToWriter(this, writer);
proto.cocorpc.PreviewUpdateResponse.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
@ -1892,10 +1892,10 @@ proto.cocorpc.UpdateImpactResponse.prototype.serializeBinary = function() {
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.cocorpc.UpdateImpactResponse} message
* @param {!proto.cocorpc.PreviewUpdateResponse} message
* @param {!jspb.BinaryWriter} writer
*/
proto.cocorpc.UpdateImpactResponse.serializeBinaryToWriter = function(message, writer) {
proto.cocorpc.PreviewUpdateResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getReplacesList();
if (f.length > 0) {
@ -1921,13 +1921,13 @@ proto.cocorpc.UpdateImpactResponse.serializeBinaryToWriter = function(message, w
* replace the array itself, then you must call the setter to update it.
* @return {!Array.<string>}
*/
proto.cocorpc.UpdateImpactResponse.prototype.getReplacesList = function() {
proto.cocorpc.PreviewUpdateResponse.prototype.getReplacesList = function() {
return /** @type {!Array.<string>} */ (jspb.Message.getField(this, 1));
};
/** @param {!Array.<string>} value */
proto.cocorpc.UpdateImpactResponse.prototype.setReplacesList = function(value) {
proto.cocorpc.PreviewUpdateResponse.prototype.setReplacesList = function(value) {
jspb.Message.setField(this, 1, value || []);
};
@ -1936,12 +1936,12 @@ proto.cocorpc.UpdateImpactResponse.prototype.setReplacesList = function(value) {
* @param {!string} value
* @param {number=} opt_index
*/
proto.cocorpc.UpdateImpactResponse.prototype.addReplaces = function(value, opt_index) {
proto.cocorpc.PreviewUpdateResponse.prototype.addReplaces = function(value, opt_index) {
jspb.Message.addToRepeatedField(this, 1, value, opt_index);
};
proto.cocorpc.UpdateImpactResponse.prototype.clearReplacesList = function() {
proto.cocorpc.PreviewUpdateResponse.prototype.clearReplacesList = function() {
this.setReplacesList([]);
};
@ -1950,19 +1950,19 @@ proto.cocorpc.UpdateImpactResponse.prototype.clearReplacesList = function() {
* optional google.protobuf.Struct changes = 2;
* @return {?proto.google.protobuf.Struct}
*/
proto.cocorpc.UpdateImpactResponse.prototype.getChanges = function() {
proto.cocorpc.PreviewUpdateResponse.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.UpdateImpactResponse.prototype.setChanges = function(value) {
proto.cocorpc.PreviewUpdateResponse.prototype.setChanges = function(value) {
jspb.Message.setWrapperField(this, 2, value);
};
proto.cocorpc.UpdateImpactResponse.prototype.clearChanges = function() {
proto.cocorpc.PreviewUpdateResponse.prototype.clearChanges = function() {
this.setChanges(undefined);
};
@ -1971,7 +1971,7 @@ proto.cocorpc.UpdateImpactResponse.prototype.clearChanges = function() {
* Returns whether this field is set.
* @return {!boolean}
*/
proto.cocorpc.UpdateImpactResponse.prototype.hasChanges = function() {
proto.cocorpc.PreviewUpdateResponse.prototype.hasChanges = function() {
return jspb.Message.getField(this, 2) != null;
};

View file

@ -21,12 +21,12 @@ 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 reads the instance state identified by ID, returning a populated resource object, or an error if not found.
rpc Read(ReadRequest) returns (ReadResponse) {}
// 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) {}
// Update updates an existing resource with new values.
rpc Update(UpdateRequest) returns (google.protobuf.Empty) {}
// UpdateImpact checks what impacts a hypothetical update will have on the resource's properties.
rpc UpdateImpact(UpdateRequest) returns (UpdateImpactResponse) {}
// 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) {}
}
@ -63,12 +63,12 @@ message CreateResponse {
string id = 1; // the ID of the resource created.
}
message ReadRequest {
message GetRequest {
string id = 1; // the ID of the resource to read.
string type = 2; // the type token of the resource.
}
message ReadResponse {
message GetResponse {
google.protobuf.Struct properties = 1; // the properties read from the resource.
}
@ -79,8 +79,8 @@ message UpdateRequest {
google.protobuf.Struct news = 4; // the new values of properties to update.
}
message UpdateImpactResponse {
repeated string replaces = 1; // if this update requires a replacement, the set of properties triggering it.
message PreviewUpdateResponse {
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).
}