forked from GoogleCloudPlatform/k8s-config-connector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request GoogleCloudPlatform#3237 from gemmahou/update-back…
…end-service test: test update backend service in ComputeTCPProxy
- Loading branch information
Showing
19 changed files
with
1,167 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,7 @@ func (s *GlobalTargetTcpProxyV1) Insert(ctx context.Context, req *pb.InsertTarge | |
obj.CreationTimestamp = PtrTo(s.nowString()) | ||
obj.Id = &id | ||
obj.Kind = PtrTo("compute#targetTcpProxy") | ||
|
||
if obj.ProxyHeader == nil { | ||
obj.ProxyHeader = PtrTo("NONE") | ||
} | ||
|
@@ -107,6 +108,36 @@ func (s *GlobalTargetTcpProxyV1) Delete(ctx context.Context, req *pb.DeleteTarge | |
}) | ||
} | ||
|
||
func (s *GlobalTargetTcpProxyV1) SetBackendService(ctx context.Context, req *pb.SetBackendServiceTargetTcpProxyRequest) (*pb.Operation, error) { | ||
reqName := "projects/" + req.GetProject() + "/global/targetTcpProxies/" + req.GetTargetTcpProxy() | ||
name, err := s.parseTargetTcpProxyName(reqName) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
fqn := name.String() | ||
|
||
obj := &pb.TargetTcpProxy{} | ||
if err := s.storage.Get(ctx, fqn, obj); err != nil { | ||
return nil, err | ||
} | ||
|
||
obj.Service = req.GetTargetTcpProxiesSetBackendServiceRequestResource().Service | ||
if err := s.storage.Update(ctx, fqn, obj); err != nil { | ||
return nil, err | ||
} | ||
|
||
op := &pb.Operation{ | ||
TargetId: obj.Id, | ||
TargetLink: obj.SelfLink, | ||
OperationType: PtrTo("TargetTcpProxySetBackendService"), | ||
User: PtrTo("[email protected]"), | ||
} | ||
return s.startGlobalLRO(ctx, name.Project.ID, op, func() (proto.Message, error) { | ||
return obj, nil | ||
}) | ||
} | ||
|
||
func (s *GlobalTargetTcpProxyV1) SetProxyHeader(ctx context.Context, req *pb.SetProxyHeaderTargetTcpProxyRequest) (*pb.Operation, error) { | ||
reqName := "projects/" + req.GetProject() + "/global/targetTcpProxies/" + req.GetTargetTcpProxy() | ||
name, err := s.parseTargetTcpProxyName(reqName) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.