@@ -11,11 +11,12 @@ import (
1111)
1212
1313type ContainerOperationWaiter struct {
14- Service * container.Service
15- Context context.Context
16- Op * container.Operation
17- Project string
18- Location string
14+ Service * container.Service
15+ Context context.Context
16+ Op * container.Operation
17+ Project string
18+ Location string
19+ UserProjectOverride bool
1920}
2021
2122func (w * ContainerOperationWaiter ) State () string {
@@ -75,7 +76,11 @@ func (w *ContainerOperationWaiter) QueryOp() (interface{}, error) {
7576 // default must be here to keep the previous case from blocking
7677 }
7778 err := retryTimeDuration (func () (opErr error ) {
78- op , opErr = w .Service .Projects .Locations .Operations .Get (name ).Do ()
79+ opGetCall := w .Service .Projects .Locations .Operations .Get (name )
80+ if w .UserProjectOverride {
81+ opGetCall .Header ().Add ("X-Goog-User-Project" , w .Project )
82+ }
83+ op , opErr = opGetCall .Do ()
7984 return opErr
8085 }, DefaultRequestTimeout )
8186
@@ -99,11 +104,12 @@ func (w *ContainerOperationWaiter) TargetStates() []string {
99104
100105func containerOperationWait (config * Config , op * container.Operation , project , location , activity , userAgent string , timeout time.Duration ) error {
101106 w := & ContainerOperationWaiter {
102- Service : config .NewContainerBetaClient (userAgent ),
103- Context : config .context ,
104- Op : op ,
105- Project : project ,
106- Location : location ,
107+ Service : config .NewContainerBetaClient (userAgent ),
108+ Context : config .context ,
109+ Op : op ,
110+ Project : project ,
111+ Location : location ,
112+ UserProjectOverride : config .UserProjectOverride ,
107113 }
108114
109115 if err := w .SetOp (op ); err != nil {
0 commit comments