Commit aaa3dfd6 authored by Bowei Du's avatar Bowei Du

GCE: Check that the key is valid for each call

parent a2b222c9
...@@ -1240,6 +1240,9 @@ func (m *MockAddresses) Get(ctx context.Context, key *meta.Key) (*ga.Address, er ...@@ -1240,6 +1240,9 @@ func (m *MockAddresses) Get(ctx context.Context, key *meta.Key) (*ga.Address, er
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -1304,6 +1307,9 @@ func (m *MockAddresses) Insert(ctx context.Context, key *meta.Key, obj *ga.Addre ...@@ -1304,6 +1307,9 @@ func (m *MockAddresses) Insert(ctx context.Context, key *meta.Key, obj *ga.Addre
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -1339,6 +1345,9 @@ func (m *MockAddresses) Delete(ctx context.Context, key *meta.Key) error { ...@@ -1339,6 +1345,9 @@ func (m *MockAddresses) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -1373,6 +1382,9 @@ type GCEAddresses struct { ...@@ -1373,6 +1382,9 @@ type GCEAddresses struct {
// Get the Address named by key. // Get the Address named by key.
func (g *GCEAddresses) Get(ctx context.Context, key *meta.Key) (*ga.Address, error) { func (g *GCEAddresses) Get(ctx context.Context, key *meta.Key) (*ga.Address, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Addresses") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Addresses")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -1417,6 +1429,9 @@ func (g *GCEAddresses) List(ctx context.Context, region string, fl *filter.F) ([ ...@@ -1417,6 +1429,9 @@ func (g *GCEAddresses) List(ctx context.Context, region string, fl *filter.F) ([
// Insert Address with key of value obj. // Insert Address with key of value obj.
func (g *GCEAddresses) Insert(ctx context.Context, key *meta.Key, obj *ga.Address) error { func (g *GCEAddresses) Insert(ctx context.Context, key *meta.Key, obj *ga.Address) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Addresses") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Addresses")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -1440,6 +1455,9 @@ func (g *GCEAddresses) Insert(ctx context.Context, key *meta.Key, obj *ga.Addres ...@@ -1440,6 +1455,9 @@ func (g *GCEAddresses) Insert(ctx context.Context, key *meta.Key, obj *ga.Addres
// Delete the Address referenced by key. // Delete the Address referenced by key.
func (g *GCEAddresses) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEAddresses) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Addresses") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Addresses")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -1515,6 +1533,9 @@ func (m *MockAlphaAddresses) Get(ctx context.Context, key *meta.Key) (*alpha.Add ...@@ -1515,6 +1533,9 @@ func (m *MockAlphaAddresses) Get(ctx context.Context, key *meta.Key) (*alpha.Add
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -1579,6 +1600,9 @@ func (m *MockAlphaAddresses) Insert(ctx context.Context, key *meta.Key, obj *alp ...@@ -1579,6 +1600,9 @@ func (m *MockAlphaAddresses) Insert(ctx context.Context, key *meta.Key, obj *alp
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -1614,6 +1638,9 @@ func (m *MockAlphaAddresses) Delete(ctx context.Context, key *meta.Key) error { ...@@ -1614,6 +1638,9 @@ func (m *MockAlphaAddresses) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -1648,6 +1675,9 @@ type GCEAlphaAddresses struct { ...@@ -1648,6 +1675,9 @@ type GCEAlphaAddresses struct {
// Get the Address named by key. // Get the Address named by key.
func (g *GCEAlphaAddresses) Get(ctx context.Context, key *meta.Key) (*alpha.Address, error) { func (g *GCEAlphaAddresses) Get(ctx context.Context, key *meta.Key) (*alpha.Address, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Addresses") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Addresses")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -1692,6 +1722,9 @@ func (g *GCEAlphaAddresses) List(ctx context.Context, region string, fl *filter. ...@@ -1692,6 +1722,9 @@ func (g *GCEAlphaAddresses) List(ctx context.Context, region string, fl *filter.
// Insert Address with key of value obj. // Insert Address with key of value obj.
func (g *GCEAlphaAddresses) Insert(ctx context.Context, key *meta.Key, obj *alpha.Address) error { func (g *GCEAlphaAddresses) Insert(ctx context.Context, key *meta.Key, obj *alpha.Address) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Addresses") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Addresses")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -1715,6 +1748,9 @@ func (g *GCEAlphaAddresses) Insert(ctx context.Context, key *meta.Key, obj *alph ...@@ -1715,6 +1748,9 @@ func (g *GCEAlphaAddresses) Insert(ctx context.Context, key *meta.Key, obj *alph
// Delete the Address referenced by key. // Delete the Address referenced by key.
func (g *GCEAlphaAddresses) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEAlphaAddresses) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Addresses") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Addresses")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -1790,6 +1826,9 @@ func (m *MockBetaAddresses) Get(ctx context.Context, key *meta.Key) (*beta.Addre ...@@ -1790,6 +1826,9 @@ func (m *MockBetaAddresses) Get(ctx context.Context, key *meta.Key) (*beta.Addre
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -1854,6 +1893,9 @@ func (m *MockBetaAddresses) Insert(ctx context.Context, key *meta.Key, obj *beta ...@@ -1854,6 +1893,9 @@ func (m *MockBetaAddresses) Insert(ctx context.Context, key *meta.Key, obj *beta
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -1889,6 +1931,9 @@ func (m *MockBetaAddresses) Delete(ctx context.Context, key *meta.Key) error { ...@@ -1889,6 +1931,9 @@ func (m *MockBetaAddresses) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -1923,6 +1968,9 @@ type GCEBetaAddresses struct { ...@@ -1923,6 +1968,9 @@ type GCEBetaAddresses struct {
// Get the Address named by key. // Get the Address named by key.
func (g *GCEBetaAddresses) Get(ctx context.Context, key *meta.Key) (*beta.Address, error) { func (g *GCEBetaAddresses) Get(ctx context.Context, key *meta.Key) (*beta.Address, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "beta", "Addresses") projectID := g.s.ProjectRouter.ProjectID(ctx, "beta", "Addresses")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -1967,6 +2015,9 @@ func (g *GCEBetaAddresses) List(ctx context.Context, region string, fl *filter.F ...@@ -1967,6 +2015,9 @@ func (g *GCEBetaAddresses) List(ctx context.Context, region string, fl *filter.F
// Insert Address with key of value obj. // Insert Address with key of value obj.
func (g *GCEBetaAddresses) Insert(ctx context.Context, key *meta.Key, obj *beta.Address) error { func (g *GCEBetaAddresses) Insert(ctx context.Context, key *meta.Key, obj *beta.Address) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "beta", "Addresses") projectID := g.s.ProjectRouter.ProjectID(ctx, "beta", "Addresses")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -1990,6 +2041,9 @@ func (g *GCEBetaAddresses) Insert(ctx context.Context, key *meta.Key, obj *beta. ...@@ -1990,6 +2041,9 @@ func (g *GCEBetaAddresses) Insert(ctx context.Context, key *meta.Key, obj *beta.
// Delete the Address referenced by key. // Delete the Address referenced by key.
func (g *GCEBetaAddresses) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEBetaAddresses) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "beta", "Addresses") projectID := g.s.ProjectRouter.ProjectID(ctx, "beta", "Addresses")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -2065,6 +2119,9 @@ func (m *MockGlobalAddresses) Get(ctx context.Context, key *meta.Key) (*ga.Addre ...@@ -2065,6 +2119,9 @@ func (m *MockGlobalAddresses) Get(ctx context.Context, key *meta.Key) (*ga.Addre
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -2126,6 +2183,9 @@ func (m *MockGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj *ga ...@@ -2126,6 +2183,9 @@ func (m *MockGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj *ga
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -2161,6 +2221,9 @@ func (m *MockGlobalAddresses) Delete(ctx context.Context, key *meta.Key) error { ...@@ -2161,6 +2221,9 @@ func (m *MockGlobalAddresses) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -2195,6 +2258,9 @@ type GCEGlobalAddresses struct { ...@@ -2195,6 +2258,9 @@ type GCEGlobalAddresses struct {
// Get the Address named by key. // Get the Address named by key.
func (g *GCEGlobalAddresses) Get(ctx context.Context, key *meta.Key) (*ga.Address, error) { func (g *GCEGlobalAddresses) Get(ctx context.Context, key *meta.Key) (*ga.Address, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "GlobalAddresses") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "GlobalAddresses")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -2239,6 +2305,9 @@ func (g *GCEGlobalAddresses) List(ctx context.Context, fl *filter.F) ([]*ga.Addr ...@@ -2239,6 +2305,9 @@ func (g *GCEGlobalAddresses) List(ctx context.Context, fl *filter.F) ([]*ga.Addr
// Insert Address with key of value obj. // Insert Address with key of value obj.
func (g *GCEGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj *ga.Address) error { func (g *GCEGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj *ga.Address) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "GlobalAddresses") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "GlobalAddresses")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -2262,6 +2331,9 @@ func (g *GCEGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj *ga. ...@@ -2262,6 +2331,9 @@ func (g *GCEGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj *ga.
// Delete the Address referenced by key. // Delete the Address referenced by key.
func (g *GCEGlobalAddresses) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEGlobalAddresses) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "GlobalAddresses") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "GlobalAddresses")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -2342,6 +2414,9 @@ func (m *MockBackendServices) Get(ctx context.Context, key *meta.Key) (*ga.Backe ...@@ -2342,6 +2414,9 @@ func (m *MockBackendServices) Get(ctx context.Context, key *meta.Key) (*ga.Backe
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -2403,6 +2478,9 @@ func (m *MockBackendServices) Insert(ctx context.Context, key *meta.Key, obj *ga ...@@ -2403,6 +2478,9 @@ func (m *MockBackendServices) Insert(ctx context.Context, key *meta.Key, obj *ga
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -2438,6 +2516,9 @@ func (m *MockBackendServices) Delete(ctx context.Context, key *meta.Key) error { ...@@ -2438,6 +2516,9 @@ func (m *MockBackendServices) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -2488,6 +2569,9 @@ type GCEBackendServices struct { ...@@ -2488,6 +2569,9 @@ type GCEBackendServices struct {
// Get the BackendService named by key. // Get the BackendService named by key.
func (g *GCEBackendServices) Get(ctx context.Context, key *meta.Key) (*ga.BackendService, error) { func (g *GCEBackendServices) Get(ctx context.Context, key *meta.Key) (*ga.BackendService, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "BackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "BackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -2532,6 +2616,9 @@ func (g *GCEBackendServices) List(ctx context.Context, fl *filter.F) ([]*ga.Back ...@@ -2532,6 +2616,9 @@ func (g *GCEBackendServices) List(ctx context.Context, fl *filter.F) ([]*ga.Back
// Insert BackendService with key of value obj. // Insert BackendService with key of value obj.
func (g *GCEBackendServices) Insert(ctx context.Context, key *meta.Key, obj *ga.BackendService) error { func (g *GCEBackendServices) Insert(ctx context.Context, key *meta.Key, obj *ga.BackendService) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "BackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "BackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -2555,6 +2642,9 @@ func (g *GCEBackendServices) Insert(ctx context.Context, key *meta.Key, obj *ga. ...@@ -2555,6 +2642,9 @@ func (g *GCEBackendServices) Insert(ctx context.Context, key *meta.Key, obj *ga.
// Delete the BackendService referenced by key. // Delete the BackendService referenced by key.
func (g *GCEBackendServices) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEBackendServices) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "BackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "BackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -2578,6 +2668,9 @@ func (g *GCEBackendServices) Delete(ctx context.Context, key *meta.Key) error { ...@@ -2578,6 +2668,9 @@ func (g *GCEBackendServices) Delete(ctx context.Context, key *meta.Key) error {
// GetHealth is a method on GCEBackendServices. // GetHealth is a method on GCEBackendServices.
func (g *GCEBackendServices) GetHealth(ctx context.Context, key *meta.Key, arg0 *ga.ResourceGroupReference) (*ga.BackendServiceGroupHealth, error) { func (g *GCEBackendServices) GetHealth(ctx context.Context, key *meta.Key, arg0 *ga.ResourceGroupReference) (*ga.BackendServiceGroupHealth, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "BackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "BackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -2595,6 +2688,9 @@ func (g *GCEBackendServices) GetHealth(ctx context.Context, key *meta.Key, arg0 ...@@ -2595,6 +2688,9 @@ func (g *GCEBackendServices) GetHealth(ctx context.Context, key *meta.Key, arg0
// Update is a method on GCEBackendServices. // Update is a method on GCEBackendServices.
func (g *GCEBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *ga.BackendService) error { func (g *GCEBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *ga.BackendService) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "BackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "BackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -2671,6 +2767,9 @@ func (m *MockAlphaBackendServices) Get(ctx context.Context, key *meta.Key) (*alp ...@@ -2671,6 +2767,9 @@ func (m *MockAlphaBackendServices) Get(ctx context.Context, key *meta.Key) (*alp
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -2732,6 +2831,9 @@ func (m *MockAlphaBackendServices) Insert(ctx context.Context, key *meta.Key, ob ...@@ -2732,6 +2831,9 @@ func (m *MockAlphaBackendServices) Insert(ctx context.Context, key *meta.Key, ob
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -2767,6 +2869,9 @@ func (m *MockAlphaBackendServices) Delete(ctx context.Context, key *meta.Key) er ...@@ -2767,6 +2869,9 @@ func (m *MockAlphaBackendServices) Delete(ctx context.Context, key *meta.Key) er
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -2809,6 +2914,9 @@ type GCEAlphaBackendServices struct { ...@@ -2809,6 +2914,9 @@ type GCEAlphaBackendServices struct {
// Get the BackendService named by key. // Get the BackendService named by key.
func (g *GCEAlphaBackendServices) Get(ctx context.Context, key *meta.Key) (*alpha.BackendService, error) { func (g *GCEAlphaBackendServices) Get(ctx context.Context, key *meta.Key) (*alpha.BackendService, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "BackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "BackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -2853,6 +2961,9 @@ func (g *GCEAlphaBackendServices) List(ctx context.Context, fl *filter.F) ([]*al ...@@ -2853,6 +2961,9 @@ func (g *GCEAlphaBackendServices) List(ctx context.Context, fl *filter.F) ([]*al
// Insert BackendService with key of value obj. // Insert BackendService with key of value obj.
func (g *GCEAlphaBackendServices) Insert(ctx context.Context, key *meta.Key, obj *alpha.BackendService) error { func (g *GCEAlphaBackendServices) Insert(ctx context.Context, key *meta.Key, obj *alpha.BackendService) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "BackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "BackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -2876,6 +2987,9 @@ func (g *GCEAlphaBackendServices) Insert(ctx context.Context, key *meta.Key, obj ...@@ -2876,6 +2987,9 @@ func (g *GCEAlphaBackendServices) Insert(ctx context.Context, key *meta.Key, obj
// Delete the BackendService referenced by key. // Delete the BackendService referenced by key.
func (g *GCEAlphaBackendServices) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEAlphaBackendServices) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "BackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "BackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -2899,6 +3013,9 @@ func (g *GCEAlphaBackendServices) Delete(ctx context.Context, key *meta.Key) err ...@@ -2899,6 +3013,9 @@ func (g *GCEAlphaBackendServices) Delete(ctx context.Context, key *meta.Key) err
// Update is a method on GCEAlphaBackendServices. // Update is a method on GCEAlphaBackendServices.
func (g *GCEAlphaBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *alpha.BackendService) error { func (g *GCEAlphaBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *alpha.BackendService) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "BackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "BackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -2977,6 +3094,9 @@ func (m *MockRegionBackendServices) Get(ctx context.Context, key *meta.Key) (*ga ...@@ -2977,6 +3094,9 @@ func (m *MockRegionBackendServices) Get(ctx context.Context, key *meta.Key) (*ga
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -3041,6 +3161,9 @@ func (m *MockRegionBackendServices) Insert(ctx context.Context, key *meta.Key, o ...@@ -3041,6 +3161,9 @@ func (m *MockRegionBackendServices) Insert(ctx context.Context, key *meta.Key, o
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -3076,6 +3199,9 @@ func (m *MockRegionBackendServices) Delete(ctx context.Context, key *meta.Key) e ...@@ -3076,6 +3199,9 @@ func (m *MockRegionBackendServices) Delete(ctx context.Context, key *meta.Key) e
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -3126,6 +3252,9 @@ type GCERegionBackendServices struct { ...@@ -3126,6 +3252,9 @@ type GCERegionBackendServices struct {
// Get the BackendService named by key. // Get the BackendService named by key.
func (g *GCERegionBackendServices) Get(ctx context.Context, key *meta.Key) (*ga.BackendService, error) { func (g *GCERegionBackendServices) Get(ctx context.Context, key *meta.Key) (*ga.BackendService, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "RegionBackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "RegionBackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -3170,6 +3299,9 @@ func (g *GCERegionBackendServices) List(ctx context.Context, region string, fl * ...@@ -3170,6 +3299,9 @@ func (g *GCERegionBackendServices) List(ctx context.Context, region string, fl *
// Insert BackendService with key of value obj. // Insert BackendService with key of value obj.
func (g *GCERegionBackendServices) Insert(ctx context.Context, key *meta.Key, obj *ga.BackendService) error { func (g *GCERegionBackendServices) Insert(ctx context.Context, key *meta.Key, obj *ga.BackendService) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "RegionBackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "RegionBackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -3193,6 +3325,9 @@ func (g *GCERegionBackendServices) Insert(ctx context.Context, key *meta.Key, ob ...@@ -3193,6 +3325,9 @@ func (g *GCERegionBackendServices) Insert(ctx context.Context, key *meta.Key, ob
// Delete the BackendService referenced by key. // Delete the BackendService referenced by key.
func (g *GCERegionBackendServices) Delete(ctx context.Context, key *meta.Key) error { func (g *GCERegionBackendServices) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "RegionBackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "RegionBackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -3215,6 +3350,9 @@ func (g *GCERegionBackendServices) Delete(ctx context.Context, key *meta.Key) er ...@@ -3215,6 +3350,9 @@ func (g *GCERegionBackendServices) Delete(ctx context.Context, key *meta.Key) er
// GetHealth is a method on GCERegionBackendServices. // GetHealth is a method on GCERegionBackendServices.
func (g *GCERegionBackendServices) GetHealth(ctx context.Context, key *meta.Key, arg0 *ga.ResourceGroupReference) (*ga.BackendServiceGroupHealth, error) { func (g *GCERegionBackendServices) GetHealth(ctx context.Context, key *meta.Key, arg0 *ga.ResourceGroupReference) (*ga.BackendServiceGroupHealth, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "RegionBackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "RegionBackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -3232,6 +3370,9 @@ func (g *GCERegionBackendServices) GetHealth(ctx context.Context, key *meta.Key, ...@@ -3232,6 +3370,9 @@ func (g *GCERegionBackendServices) GetHealth(ctx context.Context, key *meta.Key,
// Update is a method on GCERegionBackendServices. // Update is a method on GCERegionBackendServices.
func (g *GCERegionBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *ga.BackendService) error { func (g *GCERegionBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *ga.BackendService) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "RegionBackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "RegionBackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -3310,6 +3451,9 @@ func (m *MockAlphaRegionBackendServices) Get(ctx context.Context, key *meta.Key) ...@@ -3310,6 +3451,9 @@ func (m *MockAlphaRegionBackendServices) Get(ctx context.Context, key *meta.Key)
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -3374,6 +3518,9 @@ func (m *MockAlphaRegionBackendServices) Insert(ctx context.Context, key *meta.K ...@@ -3374,6 +3518,9 @@ func (m *MockAlphaRegionBackendServices) Insert(ctx context.Context, key *meta.K
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -3409,6 +3556,9 @@ func (m *MockAlphaRegionBackendServices) Delete(ctx context.Context, key *meta.K ...@@ -3409,6 +3556,9 @@ func (m *MockAlphaRegionBackendServices) Delete(ctx context.Context, key *meta.K
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -3459,6 +3609,9 @@ type GCEAlphaRegionBackendServices struct { ...@@ -3459,6 +3609,9 @@ type GCEAlphaRegionBackendServices struct {
// Get the BackendService named by key. // Get the BackendService named by key.
func (g *GCEAlphaRegionBackendServices) Get(ctx context.Context, key *meta.Key) (*alpha.BackendService, error) { func (g *GCEAlphaRegionBackendServices) Get(ctx context.Context, key *meta.Key) (*alpha.BackendService, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "RegionBackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "RegionBackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -3503,6 +3656,9 @@ func (g *GCEAlphaRegionBackendServices) List(ctx context.Context, region string, ...@@ -3503,6 +3656,9 @@ func (g *GCEAlphaRegionBackendServices) List(ctx context.Context, region string,
// Insert BackendService with key of value obj. // Insert BackendService with key of value obj.
func (g *GCEAlphaRegionBackendServices) Insert(ctx context.Context, key *meta.Key, obj *alpha.BackendService) error { func (g *GCEAlphaRegionBackendServices) Insert(ctx context.Context, key *meta.Key, obj *alpha.BackendService) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "RegionBackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "RegionBackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -3526,6 +3682,9 @@ func (g *GCEAlphaRegionBackendServices) Insert(ctx context.Context, key *meta.Ke ...@@ -3526,6 +3682,9 @@ func (g *GCEAlphaRegionBackendServices) Insert(ctx context.Context, key *meta.Ke
// Delete the BackendService referenced by key. // Delete the BackendService referenced by key.
func (g *GCEAlphaRegionBackendServices) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEAlphaRegionBackendServices) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "RegionBackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "RegionBackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -3548,6 +3707,9 @@ func (g *GCEAlphaRegionBackendServices) Delete(ctx context.Context, key *meta.Ke ...@@ -3548,6 +3707,9 @@ func (g *GCEAlphaRegionBackendServices) Delete(ctx context.Context, key *meta.Ke
// GetHealth is a method on GCEAlphaRegionBackendServices. // GetHealth is a method on GCEAlphaRegionBackendServices.
func (g *GCEAlphaRegionBackendServices) GetHealth(ctx context.Context, key *meta.Key, arg0 *alpha.ResourceGroupReference) (*alpha.BackendServiceGroupHealth, error) { func (g *GCEAlphaRegionBackendServices) GetHealth(ctx context.Context, key *meta.Key, arg0 *alpha.ResourceGroupReference) (*alpha.BackendServiceGroupHealth, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "RegionBackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "RegionBackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -3565,6 +3727,9 @@ func (g *GCEAlphaRegionBackendServices) GetHealth(ctx context.Context, key *meta ...@@ -3565,6 +3727,9 @@ func (g *GCEAlphaRegionBackendServices) GetHealth(ctx context.Context, key *meta
// Update is a method on GCEAlphaRegionBackendServices. // Update is a method on GCEAlphaRegionBackendServices.
func (g *GCEAlphaRegionBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *alpha.BackendService) error { func (g *GCEAlphaRegionBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *alpha.BackendService) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "RegionBackendServices") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "RegionBackendServices")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -3639,6 +3804,9 @@ func (m *MockDisks) Get(ctx context.Context, key *meta.Key) (*ga.Disk, error) { ...@@ -3639,6 +3804,9 @@ func (m *MockDisks) Get(ctx context.Context, key *meta.Key) (*ga.Disk, error) {
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -3703,6 +3871,9 @@ func (m *MockDisks) Insert(ctx context.Context, key *meta.Key, obj *ga.Disk) err ...@@ -3703,6 +3871,9 @@ func (m *MockDisks) Insert(ctx context.Context, key *meta.Key, obj *ga.Disk) err
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -3738,6 +3909,9 @@ func (m *MockDisks) Delete(ctx context.Context, key *meta.Key) error { ...@@ -3738,6 +3909,9 @@ func (m *MockDisks) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -3772,6 +3946,9 @@ type GCEDisks struct { ...@@ -3772,6 +3946,9 @@ type GCEDisks struct {
// Get the Disk named by key. // Get the Disk named by key.
func (g *GCEDisks) Get(ctx context.Context, key *meta.Key) (*ga.Disk, error) { func (g *GCEDisks) Get(ctx context.Context, key *meta.Key) (*ga.Disk, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Disks") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Disks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -3816,6 +3993,9 @@ func (g *GCEDisks) List(ctx context.Context, zone string, fl *filter.F) ([]*ga.D ...@@ -3816,6 +3993,9 @@ func (g *GCEDisks) List(ctx context.Context, zone string, fl *filter.F) ([]*ga.D
// Insert Disk with key of value obj. // Insert Disk with key of value obj.
func (g *GCEDisks) Insert(ctx context.Context, key *meta.Key, obj *ga.Disk) error { func (g *GCEDisks) Insert(ctx context.Context, key *meta.Key, obj *ga.Disk) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Disks") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Disks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -3839,6 +4019,9 @@ func (g *GCEDisks) Insert(ctx context.Context, key *meta.Key, obj *ga.Disk) erro ...@@ -3839,6 +4019,9 @@ func (g *GCEDisks) Insert(ctx context.Context, key *meta.Key, obj *ga.Disk) erro
// Delete the Disk referenced by key. // Delete the Disk referenced by key.
func (g *GCEDisks) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEDisks) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Disks") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Disks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -3914,6 +4097,9 @@ func (m *MockAlphaDisks) Get(ctx context.Context, key *meta.Key) (*alpha.Disk, e ...@@ -3914,6 +4097,9 @@ func (m *MockAlphaDisks) Get(ctx context.Context, key *meta.Key) (*alpha.Disk, e
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -3978,6 +4164,9 @@ func (m *MockAlphaDisks) Insert(ctx context.Context, key *meta.Key, obj *alpha.D ...@@ -3978,6 +4164,9 @@ func (m *MockAlphaDisks) Insert(ctx context.Context, key *meta.Key, obj *alpha.D
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -4013,6 +4202,9 @@ func (m *MockAlphaDisks) Delete(ctx context.Context, key *meta.Key) error { ...@@ -4013,6 +4202,9 @@ func (m *MockAlphaDisks) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -4047,6 +4239,9 @@ type GCEAlphaDisks struct { ...@@ -4047,6 +4239,9 @@ type GCEAlphaDisks struct {
// Get the Disk named by key. // Get the Disk named by key.
func (g *GCEAlphaDisks) Get(ctx context.Context, key *meta.Key) (*alpha.Disk, error) { func (g *GCEAlphaDisks) Get(ctx context.Context, key *meta.Key) (*alpha.Disk, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Disks") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Disks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -4091,6 +4286,9 @@ func (g *GCEAlphaDisks) List(ctx context.Context, zone string, fl *filter.F) ([] ...@@ -4091,6 +4286,9 @@ func (g *GCEAlphaDisks) List(ctx context.Context, zone string, fl *filter.F) ([]
// Insert Disk with key of value obj. // Insert Disk with key of value obj.
func (g *GCEAlphaDisks) Insert(ctx context.Context, key *meta.Key, obj *alpha.Disk) error { func (g *GCEAlphaDisks) Insert(ctx context.Context, key *meta.Key, obj *alpha.Disk) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Disks") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Disks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -4114,6 +4312,9 @@ func (g *GCEAlphaDisks) Insert(ctx context.Context, key *meta.Key, obj *alpha.Di ...@@ -4114,6 +4312,9 @@ func (g *GCEAlphaDisks) Insert(ctx context.Context, key *meta.Key, obj *alpha.Di
// Delete the Disk referenced by key. // Delete the Disk referenced by key.
func (g *GCEAlphaDisks) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEAlphaDisks) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Disks") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Disks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -4189,6 +4390,9 @@ func (m *MockAlphaRegionDisks) Get(ctx context.Context, key *meta.Key) (*alpha.D ...@@ -4189,6 +4390,9 @@ func (m *MockAlphaRegionDisks) Get(ctx context.Context, key *meta.Key) (*alpha.D
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -4253,6 +4457,9 @@ func (m *MockAlphaRegionDisks) Insert(ctx context.Context, key *meta.Key, obj *a ...@@ -4253,6 +4457,9 @@ func (m *MockAlphaRegionDisks) Insert(ctx context.Context, key *meta.Key, obj *a
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -4288,6 +4495,9 @@ func (m *MockAlphaRegionDisks) Delete(ctx context.Context, key *meta.Key) error ...@@ -4288,6 +4495,9 @@ func (m *MockAlphaRegionDisks) Delete(ctx context.Context, key *meta.Key) error
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -4322,6 +4532,9 @@ type GCEAlphaRegionDisks struct { ...@@ -4322,6 +4532,9 @@ type GCEAlphaRegionDisks struct {
// Get the Disk named by key. // Get the Disk named by key.
func (g *GCEAlphaRegionDisks) Get(ctx context.Context, key *meta.Key) (*alpha.Disk, error) { func (g *GCEAlphaRegionDisks) Get(ctx context.Context, key *meta.Key) (*alpha.Disk, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "RegionDisks") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "RegionDisks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -4366,6 +4579,9 @@ func (g *GCEAlphaRegionDisks) List(ctx context.Context, region string, fl *filte ...@@ -4366,6 +4579,9 @@ func (g *GCEAlphaRegionDisks) List(ctx context.Context, region string, fl *filte
// Insert Disk with key of value obj. // Insert Disk with key of value obj.
func (g *GCEAlphaRegionDisks) Insert(ctx context.Context, key *meta.Key, obj *alpha.Disk) error { func (g *GCEAlphaRegionDisks) Insert(ctx context.Context, key *meta.Key, obj *alpha.Disk) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "RegionDisks") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "RegionDisks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -4389,6 +4605,9 @@ func (g *GCEAlphaRegionDisks) Insert(ctx context.Context, key *meta.Key, obj *al ...@@ -4389,6 +4605,9 @@ func (g *GCEAlphaRegionDisks) Insert(ctx context.Context, key *meta.Key, obj *al
// Delete the Disk referenced by key. // Delete the Disk referenced by key.
func (g *GCEAlphaRegionDisks) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEAlphaRegionDisks) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "RegionDisks") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "RegionDisks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -4466,6 +4685,9 @@ func (m *MockFirewalls) Get(ctx context.Context, key *meta.Key) (*ga.Firewall, e ...@@ -4466,6 +4685,9 @@ func (m *MockFirewalls) Get(ctx context.Context, key *meta.Key) (*ga.Firewall, e
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -4527,6 +4749,9 @@ func (m *MockFirewalls) Insert(ctx context.Context, key *meta.Key, obj *ga.Firew ...@@ -4527,6 +4749,9 @@ func (m *MockFirewalls) Insert(ctx context.Context, key *meta.Key, obj *ga.Firew
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -4562,6 +4787,9 @@ func (m *MockFirewalls) Delete(ctx context.Context, key *meta.Key) error { ...@@ -4562,6 +4787,9 @@ func (m *MockFirewalls) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -4604,6 +4832,9 @@ type GCEFirewalls struct { ...@@ -4604,6 +4832,9 @@ type GCEFirewalls struct {
// Get the Firewall named by key. // Get the Firewall named by key.
func (g *GCEFirewalls) Get(ctx context.Context, key *meta.Key) (*ga.Firewall, error) { func (g *GCEFirewalls) Get(ctx context.Context, key *meta.Key) (*ga.Firewall, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Firewalls") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Firewalls")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -4648,6 +4879,9 @@ func (g *GCEFirewalls) List(ctx context.Context, fl *filter.F) ([]*ga.Firewall, ...@@ -4648,6 +4879,9 @@ func (g *GCEFirewalls) List(ctx context.Context, fl *filter.F) ([]*ga.Firewall,
// Insert Firewall with key of value obj. // Insert Firewall with key of value obj.
func (g *GCEFirewalls) Insert(ctx context.Context, key *meta.Key, obj *ga.Firewall) error { func (g *GCEFirewalls) Insert(ctx context.Context, key *meta.Key, obj *ga.Firewall) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Firewalls") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Firewalls")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -4671,6 +4905,9 @@ func (g *GCEFirewalls) Insert(ctx context.Context, key *meta.Key, obj *ga.Firewa ...@@ -4671,6 +4905,9 @@ func (g *GCEFirewalls) Insert(ctx context.Context, key *meta.Key, obj *ga.Firewa
// Delete the Firewall referenced by key. // Delete the Firewall referenced by key.
func (g *GCEFirewalls) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEFirewalls) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Firewalls") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Firewalls")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -4694,6 +4931,9 @@ func (g *GCEFirewalls) Delete(ctx context.Context, key *meta.Key) error { ...@@ -4694,6 +4931,9 @@ func (g *GCEFirewalls) Delete(ctx context.Context, key *meta.Key) error {
// Update is a method on GCEFirewalls. // Update is a method on GCEFirewalls.
func (g *GCEFirewalls) Update(ctx context.Context, key *meta.Key, arg0 *ga.Firewall) error { func (g *GCEFirewalls) Update(ctx context.Context, key *meta.Key, arg0 *ga.Firewall) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Firewalls") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Firewalls")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -4768,6 +5008,9 @@ func (m *MockForwardingRules) Get(ctx context.Context, key *meta.Key) (*ga.Forwa ...@@ -4768,6 +5008,9 @@ func (m *MockForwardingRules) Get(ctx context.Context, key *meta.Key) (*ga.Forwa
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -4832,6 +5075,9 @@ func (m *MockForwardingRules) Insert(ctx context.Context, key *meta.Key, obj *ga ...@@ -4832,6 +5075,9 @@ func (m *MockForwardingRules) Insert(ctx context.Context, key *meta.Key, obj *ga
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -4867,6 +5113,9 @@ func (m *MockForwardingRules) Delete(ctx context.Context, key *meta.Key) error { ...@@ -4867,6 +5113,9 @@ func (m *MockForwardingRules) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -4901,6 +5150,9 @@ type GCEForwardingRules struct { ...@@ -4901,6 +5150,9 @@ type GCEForwardingRules struct {
// Get the ForwardingRule named by key. // Get the ForwardingRule named by key.
func (g *GCEForwardingRules) Get(ctx context.Context, key *meta.Key) (*ga.ForwardingRule, error) { func (g *GCEForwardingRules) Get(ctx context.Context, key *meta.Key) (*ga.ForwardingRule, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "ForwardingRules") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "ForwardingRules")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -4945,6 +5197,9 @@ func (g *GCEForwardingRules) List(ctx context.Context, region string, fl *filter ...@@ -4945,6 +5197,9 @@ func (g *GCEForwardingRules) List(ctx context.Context, region string, fl *filter
// Insert ForwardingRule with key of value obj. // Insert ForwardingRule with key of value obj.
func (g *GCEForwardingRules) Insert(ctx context.Context, key *meta.Key, obj *ga.ForwardingRule) error { func (g *GCEForwardingRules) Insert(ctx context.Context, key *meta.Key, obj *ga.ForwardingRule) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "ForwardingRules") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "ForwardingRules")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -4968,6 +5223,9 @@ func (g *GCEForwardingRules) Insert(ctx context.Context, key *meta.Key, obj *ga. ...@@ -4968,6 +5223,9 @@ func (g *GCEForwardingRules) Insert(ctx context.Context, key *meta.Key, obj *ga.
// Delete the ForwardingRule referenced by key. // Delete the ForwardingRule referenced by key.
func (g *GCEForwardingRules) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEForwardingRules) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "ForwardingRules") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "ForwardingRules")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -5043,6 +5301,9 @@ func (m *MockAlphaForwardingRules) Get(ctx context.Context, key *meta.Key) (*alp ...@@ -5043,6 +5301,9 @@ func (m *MockAlphaForwardingRules) Get(ctx context.Context, key *meta.Key) (*alp
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -5107,6 +5368,9 @@ func (m *MockAlphaForwardingRules) Insert(ctx context.Context, key *meta.Key, ob ...@@ -5107,6 +5368,9 @@ func (m *MockAlphaForwardingRules) Insert(ctx context.Context, key *meta.Key, ob
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -5142,6 +5406,9 @@ func (m *MockAlphaForwardingRules) Delete(ctx context.Context, key *meta.Key) er ...@@ -5142,6 +5406,9 @@ func (m *MockAlphaForwardingRules) Delete(ctx context.Context, key *meta.Key) er
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -5176,6 +5443,9 @@ type GCEAlphaForwardingRules struct { ...@@ -5176,6 +5443,9 @@ type GCEAlphaForwardingRules struct {
// Get the ForwardingRule named by key. // Get the ForwardingRule named by key.
func (g *GCEAlphaForwardingRules) Get(ctx context.Context, key *meta.Key) (*alpha.ForwardingRule, error) { func (g *GCEAlphaForwardingRules) Get(ctx context.Context, key *meta.Key) (*alpha.ForwardingRule, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "ForwardingRules") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "ForwardingRules")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -5220,6 +5490,9 @@ func (g *GCEAlphaForwardingRules) List(ctx context.Context, region string, fl *f ...@@ -5220,6 +5490,9 @@ func (g *GCEAlphaForwardingRules) List(ctx context.Context, region string, fl *f
// Insert ForwardingRule with key of value obj. // Insert ForwardingRule with key of value obj.
func (g *GCEAlphaForwardingRules) Insert(ctx context.Context, key *meta.Key, obj *alpha.ForwardingRule) error { func (g *GCEAlphaForwardingRules) Insert(ctx context.Context, key *meta.Key, obj *alpha.ForwardingRule) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "ForwardingRules") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "ForwardingRules")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -5243,6 +5516,9 @@ func (g *GCEAlphaForwardingRules) Insert(ctx context.Context, key *meta.Key, obj ...@@ -5243,6 +5516,9 @@ func (g *GCEAlphaForwardingRules) Insert(ctx context.Context, key *meta.Key, obj
// Delete the ForwardingRule referenced by key. // Delete the ForwardingRule referenced by key.
func (g *GCEAlphaForwardingRules) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEAlphaForwardingRules) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "ForwardingRules") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "ForwardingRules")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -5320,6 +5596,9 @@ func (m *MockGlobalForwardingRules) Get(ctx context.Context, key *meta.Key) (*ga ...@@ -5320,6 +5596,9 @@ func (m *MockGlobalForwardingRules) Get(ctx context.Context, key *meta.Key) (*ga
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -5381,6 +5660,9 @@ func (m *MockGlobalForwardingRules) Insert(ctx context.Context, key *meta.Key, o ...@@ -5381,6 +5660,9 @@ func (m *MockGlobalForwardingRules) Insert(ctx context.Context, key *meta.Key, o
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -5416,6 +5698,9 @@ func (m *MockGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key) e ...@@ -5416,6 +5698,9 @@ func (m *MockGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key) e
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -5458,6 +5743,9 @@ type GCEGlobalForwardingRules struct { ...@@ -5458,6 +5743,9 @@ type GCEGlobalForwardingRules struct {
// Get the ForwardingRule named by key. // Get the ForwardingRule named by key.
func (g *GCEGlobalForwardingRules) Get(ctx context.Context, key *meta.Key) (*ga.ForwardingRule, error) { func (g *GCEGlobalForwardingRules) Get(ctx context.Context, key *meta.Key) (*ga.ForwardingRule, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "GlobalForwardingRules") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "GlobalForwardingRules")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -5502,6 +5790,9 @@ func (g *GCEGlobalForwardingRules) List(ctx context.Context, fl *filter.F) ([]*g ...@@ -5502,6 +5790,9 @@ func (g *GCEGlobalForwardingRules) List(ctx context.Context, fl *filter.F) ([]*g
// Insert ForwardingRule with key of value obj. // Insert ForwardingRule with key of value obj.
func (g *GCEGlobalForwardingRules) Insert(ctx context.Context, key *meta.Key, obj *ga.ForwardingRule) error { func (g *GCEGlobalForwardingRules) Insert(ctx context.Context, key *meta.Key, obj *ga.ForwardingRule) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "GlobalForwardingRules") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "GlobalForwardingRules")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -5525,6 +5816,9 @@ func (g *GCEGlobalForwardingRules) Insert(ctx context.Context, key *meta.Key, ob ...@@ -5525,6 +5816,9 @@ func (g *GCEGlobalForwardingRules) Insert(ctx context.Context, key *meta.Key, ob
// Delete the ForwardingRule referenced by key. // Delete the ForwardingRule referenced by key.
func (g *GCEGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "GlobalForwardingRules") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "GlobalForwardingRules")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -5548,6 +5842,9 @@ func (g *GCEGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key) er ...@@ -5548,6 +5842,9 @@ func (g *GCEGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key) er
// SetTarget is a method on GCEGlobalForwardingRules. // SetTarget is a method on GCEGlobalForwardingRules.
func (g *GCEGlobalForwardingRules) SetTarget(ctx context.Context, key *meta.Key, arg0 *ga.TargetReference) error { func (g *GCEGlobalForwardingRules) SetTarget(ctx context.Context, key *meta.Key, arg0 *ga.TargetReference) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "GlobalForwardingRules") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "GlobalForwardingRules")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -5624,6 +5921,9 @@ func (m *MockHealthChecks) Get(ctx context.Context, key *meta.Key) (*ga.HealthCh ...@@ -5624,6 +5921,9 @@ func (m *MockHealthChecks) Get(ctx context.Context, key *meta.Key) (*ga.HealthCh
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -5685,6 +5985,9 @@ func (m *MockHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *ga.He ...@@ -5685,6 +5985,9 @@ func (m *MockHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *ga.He
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -5720,6 +6023,9 @@ func (m *MockHealthChecks) Delete(ctx context.Context, key *meta.Key) error { ...@@ -5720,6 +6023,9 @@ func (m *MockHealthChecks) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -5762,6 +6068,9 @@ type GCEHealthChecks struct { ...@@ -5762,6 +6068,9 @@ type GCEHealthChecks struct {
// Get the HealthCheck named by key. // Get the HealthCheck named by key.
func (g *GCEHealthChecks) Get(ctx context.Context, key *meta.Key) (*ga.HealthCheck, error) { func (g *GCEHealthChecks) Get(ctx context.Context, key *meta.Key) (*ga.HealthCheck, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HealthChecks") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HealthChecks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -5806,6 +6115,9 @@ func (g *GCEHealthChecks) List(ctx context.Context, fl *filter.F) ([]*ga.HealthC ...@@ -5806,6 +6115,9 @@ func (g *GCEHealthChecks) List(ctx context.Context, fl *filter.F) ([]*ga.HealthC
// Insert HealthCheck with key of value obj. // Insert HealthCheck with key of value obj.
func (g *GCEHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *ga.HealthCheck) error { func (g *GCEHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *ga.HealthCheck) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HealthChecks") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HealthChecks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -5829,6 +6141,9 @@ func (g *GCEHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *ga.Hea ...@@ -5829,6 +6141,9 @@ func (g *GCEHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *ga.Hea
// Delete the HealthCheck referenced by key. // Delete the HealthCheck referenced by key.
func (g *GCEHealthChecks) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEHealthChecks) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HealthChecks") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HealthChecks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -5852,6 +6167,9 @@ func (g *GCEHealthChecks) Delete(ctx context.Context, key *meta.Key) error { ...@@ -5852,6 +6167,9 @@ func (g *GCEHealthChecks) Delete(ctx context.Context, key *meta.Key) error {
// Update is a method on GCEHealthChecks. // Update is a method on GCEHealthChecks.
func (g *GCEHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *ga.HealthCheck) error { func (g *GCEHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *ga.HealthCheck) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HealthChecks") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HealthChecks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -5928,6 +6246,9 @@ func (m *MockAlphaHealthChecks) Get(ctx context.Context, key *meta.Key) (*alpha. ...@@ -5928,6 +6246,9 @@ func (m *MockAlphaHealthChecks) Get(ctx context.Context, key *meta.Key) (*alpha.
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -5989,6 +6310,9 @@ func (m *MockAlphaHealthChecks) Insert(ctx context.Context, key *meta.Key, obj * ...@@ -5989,6 +6310,9 @@ func (m *MockAlphaHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -6024,6 +6348,9 @@ func (m *MockAlphaHealthChecks) Delete(ctx context.Context, key *meta.Key) error ...@@ -6024,6 +6348,9 @@ func (m *MockAlphaHealthChecks) Delete(ctx context.Context, key *meta.Key) error
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -6066,6 +6393,9 @@ type GCEAlphaHealthChecks struct { ...@@ -6066,6 +6393,9 @@ type GCEAlphaHealthChecks struct {
// Get the HealthCheck named by key. // Get the HealthCheck named by key.
func (g *GCEAlphaHealthChecks) Get(ctx context.Context, key *meta.Key) (*alpha.HealthCheck, error) { func (g *GCEAlphaHealthChecks) Get(ctx context.Context, key *meta.Key) (*alpha.HealthCheck, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "HealthChecks") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "HealthChecks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -6110,6 +6440,9 @@ func (g *GCEAlphaHealthChecks) List(ctx context.Context, fl *filter.F) ([]*alpha ...@@ -6110,6 +6440,9 @@ func (g *GCEAlphaHealthChecks) List(ctx context.Context, fl *filter.F) ([]*alpha
// Insert HealthCheck with key of value obj. // Insert HealthCheck with key of value obj.
func (g *GCEAlphaHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *alpha.HealthCheck) error { func (g *GCEAlphaHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *alpha.HealthCheck) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "HealthChecks") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "HealthChecks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -6133,6 +6466,9 @@ func (g *GCEAlphaHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *a ...@@ -6133,6 +6466,9 @@ func (g *GCEAlphaHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *a
// Delete the HealthCheck referenced by key. // Delete the HealthCheck referenced by key.
func (g *GCEAlphaHealthChecks) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEAlphaHealthChecks) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "HealthChecks") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "HealthChecks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -6156,6 +6492,9 @@ func (g *GCEAlphaHealthChecks) Delete(ctx context.Context, key *meta.Key) error ...@@ -6156,6 +6492,9 @@ func (g *GCEAlphaHealthChecks) Delete(ctx context.Context, key *meta.Key) error
// Update is a method on GCEAlphaHealthChecks. // Update is a method on GCEAlphaHealthChecks.
func (g *GCEAlphaHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *alpha.HealthCheck) error { func (g *GCEAlphaHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *alpha.HealthCheck) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "HealthChecks") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "HealthChecks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -6232,6 +6571,9 @@ func (m *MockHttpHealthChecks) Get(ctx context.Context, key *meta.Key) (*ga.Http ...@@ -6232,6 +6571,9 @@ func (m *MockHttpHealthChecks) Get(ctx context.Context, key *meta.Key) (*ga.Http
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -6293,6 +6635,9 @@ func (m *MockHttpHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *g ...@@ -6293,6 +6635,9 @@ func (m *MockHttpHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *g
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -6328,6 +6673,9 @@ func (m *MockHttpHealthChecks) Delete(ctx context.Context, key *meta.Key) error ...@@ -6328,6 +6673,9 @@ func (m *MockHttpHealthChecks) Delete(ctx context.Context, key *meta.Key) error
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -6370,6 +6718,9 @@ type GCEHttpHealthChecks struct { ...@@ -6370,6 +6718,9 @@ type GCEHttpHealthChecks struct {
// Get the HttpHealthCheck named by key. // Get the HttpHealthCheck named by key.
func (g *GCEHttpHealthChecks) Get(ctx context.Context, key *meta.Key) (*ga.HttpHealthCheck, error) { func (g *GCEHttpHealthChecks) Get(ctx context.Context, key *meta.Key) (*ga.HttpHealthCheck, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HttpHealthChecks") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HttpHealthChecks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -6414,6 +6765,9 @@ func (g *GCEHttpHealthChecks) List(ctx context.Context, fl *filter.F) ([]*ga.Htt ...@@ -6414,6 +6765,9 @@ func (g *GCEHttpHealthChecks) List(ctx context.Context, fl *filter.F) ([]*ga.Htt
// Insert HttpHealthCheck with key of value obj. // Insert HttpHealthCheck with key of value obj.
func (g *GCEHttpHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *ga.HttpHealthCheck) error { func (g *GCEHttpHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *ga.HttpHealthCheck) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HttpHealthChecks") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HttpHealthChecks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -6437,6 +6791,9 @@ func (g *GCEHttpHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *ga ...@@ -6437,6 +6791,9 @@ func (g *GCEHttpHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *ga
// Delete the HttpHealthCheck referenced by key. // Delete the HttpHealthCheck referenced by key.
func (g *GCEHttpHealthChecks) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEHttpHealthChecks) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HttpHealthChecks") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HttpHealthChecks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -6460,6 +6817,9 @@ func (g *GCEHttpHealthChecks) Delete(ctx context.Context, key *meta.Key) error { ...@@ -6460,6 +6817,9 @@ func (g *GCEHttpHealthChecks) Delete(ctx context.Context, key *meta.Key) error {
// Update is a method on GCEHttpHealthChecks. // Update is a method on GCEHttpHealthChecks.
func (g *GCEHttpHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *ga.HttpHealthCheck) error { func (g *GCEHttpHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *ga.HttpHealthCheck) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HttpHealthChecks") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HttpHealthChecks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -6536,6 +6896,9 @@ func (m *MockHttpsHealthChecks) Get(ctx context.Context, key *meta.Key) (*ga.Htt ...@@ -6536,6 +6896,9 @@ func (m *MockHttpsHealthChecks) Get(ctx context.Context, key *meta.Key) (*ga.Htt
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -6597,6 +6960,9 @@ func (m *MockHttpsHealthChecks) Insert(ctx context.Context, key *meta.Key, obj * ...@@ -6597,6 +6960,9 @@ func (m *MockHttpsHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -6632,6 +6998,9 @@ func (m *MockHttpsHealthChecks) Delete(ctx context.Context, key *meta.Key) error ...@@ -6632,6 +6998,9 @@ func (m *MockHttpsHealthChecks) Delete(ctx context.Context, key *meta.Key) error
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -6674,6 +7043,9 @@ type GCEHttpsHealthChecks struct { ...@@ -6674,6 +7043,9 @@ type GCEHttpsHealthChecks struct {
// Get the HttpsHealthCheck named by key. // Get the HttpsHealthCheck named by key.
func (g *GCEHttpsHealthChecks) Get(ctx context.Context, key *meta.Key) (*ga.HttpsHealthCheck, error) { func (g *GCEHttpsHealthChecks) Get(ctx context.Context, key *meta.Key) (*ga.HttpsHealthCheck, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HttpsHealthChecks") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HttpsHealthChecks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -6718,6 +7090,9 @@ func (g *GCEHttpsHealthChecks) List(ctx context.Context, fl *filter.F) ([]*ga.Ht ...@@ -6718,6 +7090,9 @@ func (g *GCEHttpsHealthChecks) List(ctx context.Context, fl *filter.F) ([]*ga.Ht
// Insert HttpsHealthCheck with key of value obj. // Insert HttpsHealthCheck with key of value obj.
func (g *GCEHttpsHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *ga.HttpsHealthCheck) error { func (g *GCEHttpsHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *ga.HttpsHealthCheck) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HttpsHealthChecks") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HttpsHealthChecks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -6741,6 +7116,9 @@ func (g *GCEHttpsHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *g ...@@ -6741,6 +7116,9 @@ func (g *GCEHttpsHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *g
// Delete the HttpsHealthCheck referenced by key. // Delete the HttpsHealthCheck referenced by key.
func (g *GCEHttpsHealthChecks) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEHttpsHealthChecks) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HttpsHealthChecks") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HttpsHealthChecks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -6764,6 +7142,9 @@ func (g *GCEHttpsHealthChecks) Delete(ctx context.Context, key *meta.Key) error ...@@ -6764,6 +7142,9 @@ func (g *GCEHttpsHealthChecks) Delete(ctx context.Context, key *meta.Key) error
// Update is a method on GCEHttpsHealthChecks. // Update is a method on GCEHttpsHealthChecks.
func (g *GCEHttpsHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *ga.HttpsHealthCheck) error { func (g *GCEHttpsHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *ga.HttpsHealthCheck) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HttpsHealthChecks") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "HttpsHealthChecks")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -6846,6 +7227,9 @@ func (m *MockInstanceGroups) Get(ctx context.Context, key *meta.Key) (*ga.Instan ...@@ -6846,6 +7227,9 @@ func (m *MockInstanceGroups) Get(ctx context.Context, key *meta.Key) (*ga.Instan
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -6910,6 +7294,9 @@ func (m *MockInstanceGroups) Insert(ctx context.Context, key *meta.Key, obj *ga. ...@@ -6910,6 +7294,9 @@ func (m *MockInstanceGroups) Insert(ctx context.Context, key *meta.Key, obj *ga.
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -6945,6 +7332,9 @@ func (m *MockInstanceGroups) Delete(ctx context.Context, key *meta.Key) error { ...@@ -6945,6 +7332,9 @@ func (m *MockInstanceGroups) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -7011,6 +7401,9 @@ type GCEInstanceGroups struct { ...@@ -7011,6 +7401,9 @@ type GCEInstanceGroups struct {
// Get the InstanceGroup named by key. // Get the InstanceGroup named by key.
func (g *GCEInstanceGroups) Get(ctx context.Context, key *meta.Key) (*ga.InstanceGroup, error) { func (g *GCEInstanceGroups) Get(ctx context.Context, key *meta.Key) (*ga.InstanceGroup, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "InstanceGroups") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "InstanceGroups")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -7055,6 +7448,9 @@ func (g *GCEInstanceGroups) List(ctx context.Context, zone string, fl *filter.F) ...@@ -7055,6 +7448,9 @@ func (g *GCEInstanceGroups) List(ctx context.Context, zone string, fl *filter.F)
// Insert InstanceGroup with key of value obj. // Insert InstanceGroup with key of value obj.
func (g *GCEInstanceGroups) Insert(ctx context.Context, key *meta.Key, obj *ga.InstanceGroup) error { func (g *GCEInstanceGroups) Insert(ctx context.Context, key *meta.Key, obj *ga.InstanceGroup) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "InstanceGroups") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "InstanceGroups")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -7078,6 +7474,9 @@ func (g *GCEInstanceGroups) Insert(ctx context.Context, key *meta.Key, obj *ga.I ...@@ -7078,6 +7474,9 @@ func (g *GCEInstanceGroups) Insert(ctx context.Context, key *meta.Key, obj *ga.I
// Delete the InstanceGroup referenced by key. // Delete the InstanceGroup referenced by key.
func (g *GCEInstanceGroups) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEInstanceGroups) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "InstanceGroups") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "InstanceGroups")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -7100,6 +7499,9 @@ func (g *GCEInstanceGroups) Delete(ctx context.Context, key *meta.Key) error { ...@@ -7100,6 +7499,9 @@ func (g *GCEInstanceGroups) Delete(ctx context.Context, key *meta.Key) error {
// AddInstances is a method on GCEInstanceGroups. // AddInstances is a method on GCEInstanceGroups.
func (g *GCEInstanceGroups) AddInstances(ctx context.Context, key *meta.Key, arg0 *ga.InstanceGroupsAddInstancesRequest) error { func (g *GCEInstanceGroups) AddInstances(ctx context.Context, key *meta.Key, arg0 *ga.InstanceGroupsAddInstancesRequest) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "InstanceGroups") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "InstanceGroups")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -7121,6 +7523,9 @@ func (g *GCEInstanceGroups) AddInstances(ctx context.Context, key *meta.Key, arg ...@@ -7121,6 +7523,9 @@ func (g *GCEInstanceGroups) AddInstances(ctx context.Context, key *meta.Key, arg
// ListInstances is a method on GCEInstanceGroups. // ListInstances is a method on GCEInstanceGroups.
func (g *GCEInstanceGroups) ListInstances(ctx context.Context, key *meta.Key, arg0 *ga.InstanceGroupsListInstancesRequest, fl *filter.F) ([]*ga.InstanceWithNamedPorts, error) { func (g *GCEInstanceGroups) ListInstances(ctx context.Context, key *meta.Key, arg0 *ga.InstanceGroupsListInstancesRequest, fl *filter.F) ([]*ga.InstanceWithNamedPorts, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "InstanceGroups") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "InstanceGroups")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -7145,6 +7550,9 @@ func (g *GCEInstanceGroups) ListInstances(ctx context.Context, key *meta.Key, ar ...@@ -7145,6 +7550,9 @@ func (g *GCEInstanceGroups) ListInstances(ctx context.Context, key *meta.Key, ar
// RemoveInstances is a method on GCEInstanceGroups. // RemoveInstances is a method on GCEInstanceGroups.
func (g *GCEInstanceGroups) RemoveInstances(ctx context.Context, key *meta.Key, arg0 *ga.InstanceGroupsRemoveInstancesRequest) error { func (g *GCEInstanceGroups) RemoveInstances(ctx context.Context, key *meta.Key, arg0 *ga.InstanceGroupsRemoveInstancesRequest) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "InstanceGroups") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "InstanceGroups")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -7166,6 +7574,9 @@ func (g *GCEInstanceGroups) RemoveInstances(ctx context.Context, key *meta.Key, ...@@ -7166,6 +7574,9 @@ func (g *GCEInstanceGroups) RemoveInstances(ctx context.Context, key *meta.Key,
// SetNamedPorts is a method on GCEInstanceGroups. // SetNamedPorts is a method on GCEInstanceGroups.
func (g *GCEInstanceGroups) SetNamedPorts(ctx context.Context, key *meta.Key, arg0 *ga.InstanceGroupsSetNamedPortsRequest) error { func (g *GCEInstanceGroups) SetNamedPorts(ctx context.Context, key *meta.Key, arg0 *ga.InstanceGroupsSetNamedPortsRequest) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "InstanceGroups") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "InstanceGroups")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -7244,6 +7655,9 @@ func (m *MockInstances) Get(ctx context.Context, key *meta.Key) (*ga.Instance, e ...@@ -7244,6 +7655,9 @@ func (m *MockInstances) Get(ctx context.Context, key *meta.Key) (*ga.Instance, e
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -7308,6 +7722,9 @@ func (m *MockInstances) Insert(ctx context.Context, key *meta.Key, obj *ga.Insta ...@@ -7308,6 +7722,9 @@ func (m *MockInstances) Insert(ctx context.Context, key *meta.Key, obj *ga.Insta
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -7343,6 +7760,9 @@ func (m *MockInstances) Delete(ctx context.Context, key *meta.Key) error { ...@@ -7343,6 +7760,9 @@ func (m *MockInstances) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -7393,6 +7813,9 @@ type GCEInstances struct { ...@@ -7393,6 +7813,9 @@ type GCEInstances struct {
// Get the Instance named by key. // Get the Instance named by key.
func (g *GCEInstances) Get(ctx context.Context, key *meta.Key) (*ga.Instance, error) { func (g *GCEInstances) Get(ctx context.Context, key *meta.Key) (*ga.Instance, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Instances") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Instances")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -7437,6 +7860,9 @@ func (g *GCEInstances) List(ctx context.Context, zone string, fl *filter.F) ([]* ...@@ -7437,6 +7860,9 @@ func (g *GCEInstances) List(ctx context.Context, zone string, fl *filter.F) ([]*
// Insert Instance with key of value obj. // Insert Instance with key of value obj.
func (g *GCEInstances) Insert(ctx context.Context, key *meta.Key, obj *ga.Instance) error { func (g *GCEInstances) Insert(ctx context.Context, key *meta.Key, obj *ga.Instance) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Instances") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Instances")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -7460,6 +7886,9 @@ func (g *GCEInstances) Insert(ctx context.Context, key *meta.Key, obj *ga.Instan ...@@ -7460,6 +7886,9 @@ func (g *GCEInstances) Insert(ctx context.Context, key *meta.Key, obj *ga.Instan
// Delete the Instance referenced by key. // Delete the Instance referenced by key.
func (g *GCEInstances) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEInstances) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Instances") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Instances")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -7482,6 +7911,9 @@ func (g *GCEInstances) Delete(ctx context.Context, key *meta.Key) error { ...@@ -7482,6 +7911,9 @@ func (g *GCEInstances) Delete(ctx context.Context, key *meta.Key) error {
// AttachDisk is a method on GCEInstances. // AttachDisk is a method on GCEInstances.
func (g *GCEInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 *ga.AttachedDisk) error { func (g *GCEInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 *ga.AttachedDisk) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Instances") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Instances")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -7503,6 +7935,9 @@ func (g *GCEInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 *ga.A ...@@ -7503,6 +7935,9 @@ func (g *GCEInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 *ga.A
// DetachDisk is a method on GCEInstances. // DetachDisk is a method on GCEInstances.
func (g *GCEInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 string) error { func (g *GCEInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 string) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Instances") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Instances")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -7581,6 +8016,9 @@ func (m *MockBetaInstances) Get(ctx context.Context, key *meta.Key) (*beta.Insta ...@@ -7581,6 +8016,9 @@ func (m *MockBetaInstances) Get(ctx context.Context, key *meta.Key) (*beta.Insta
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -7645,6 +8083,9 @@ func (m *MockBetaInstances) Insert(ctx context.Context, key *meta.Key, obj *beta ...@@ -7645,6 +8083,9 @@ func (m *MockBetaInstances) Insert(ctx context.Context, key *meta.Key, obj *beta
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -7680,6 +8121,9 @@ func (m *MockBetaInstances) Delete(ctx context.Context, key *meta.Key) error { ...@@ -7680,6 +8121,9 @@ func (m *MockBetaInstances) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -7730,6 +8174,9 @@ type GCEBetaInstances struct { ...@@ -7730,6 +8174,9 @@ type GCEBetaInstances struct {
// Get the Instance named by key. // Get the Instance named by key.
func (g *GCEBetaInstances) Get(ctx context.Context, key *meta.Key) (*beta.Instance, error) { func (g *GCEBetaInstances) Get(ctx context.Context, key *meta.Key) (*beta.Instance, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "beta", "Instances") projectID := g.s.ProjectRouter.ProjectID(ctx, "beta", "Instances")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -7774,6 +8221,9 @@ func (g *GCEBetaInstances) List(ctx context.Context, zone string, fl *filter.F) ...@@ -7774,6 +8221,9 @@ func (g *GCEBetaInstances) List(ctx context.Context, zone string, fl *filter.F)
// Insert Instance with key of value obj. // Insert Instance with key of value obj.
func (g *GCEBetaInstances) Insert(ctx context.Context, key *meta.Key, obj *beta.Instance) error { func (g *GCEBetaInstances) Insert(ctx context.Context, key *meta.Key, obj *beta.Instance) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "beta", "Instances") projectID := g.s.ProjectRouter.ProjectID(ctx, "beta", "Instances")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -7797,6 +8247,9 @@ func (g *GCEBetaInstances) Insert(ctx context.Context, key *meta.Key, obj *beta. ...@@ -7797,6 +8247,9 @@ func (g *GCEBetaInstances) Insert(ctx context.Context, key *meta.Key, obj *beta.
// Delete the Instance referenced by key. // Delete the Instance referenced by key.
func (g *GCEBetaInstances) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEBetaInstances) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "beta", "Instances") projectID := g.s.ProjectRouter.ProjectID(ctx, "beta", "Instances")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -7819,6 +8272,9 @@ func (g *GCEBetaInstances) Delete(ctx context.Context, key *meta.Key) error { ...@@ -7819,6 +8272,9 @@ func (g *GCEBetaInstances) Delete(ctx context.Context, key *meta.Key) error {
// AttachDisk is a method on GCEBetaInstances. // AttachDisk is a method on GCEBetaInstances.
func (g *GCEBetaInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 *beta.AttachedDisk) error { func (g *GCEBetaInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 *beta.AttachedDisk) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "beta", "Instances") projectID := g.s.ProjectRouter.ProjectID(ctx, "beta", "Instances")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -7840,6 +8296,9 @@ func (g *GCEBetaInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 * ...@@ -7840,6 +8296,9 @@ func (g *GCEBetaInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 *
// DetachDisk is a method on GCEBetaInstances. // DetachDisk is a method on GCEBetaInstances.
func (g *GCEBetaInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 string) error { func (g *GCEBetaInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 string) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "beta", "Instances") projectID := g.s.ProjectRouter.ProjectID(ctx, "beta", "Instances")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -7920,6 +8379,9 @@ func (m *MockAlphaInstances) Get(ctx context.Context, key *meta.Key) (*alpha.Ins ...@@ -7920,6 +8379,9 @@ func (m *MockAlphaInstances) Get(ctx context.Context, key *meta.Key) (*alpha.Ins
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -7984,6 +8446,9 @@ func (m *MockAlphaInstances) Insert(ctx context.Context, key *meta.Key, obj *alp ...@@ -7984,6 +8446,9 @@ func (m *MockAlphaInstances) Insert(ctx context.Context, key *meta.Key, obj *alp
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -8019,6 +8484,9 @@ func (m *MockAlphaInstances) Delete(ctx context.Context, key *meta.Key) error { ...@@ -8019,6 +8484,9 @@ func (m *MockAlphaInstances) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -8077,6 +8545,9 @@ type GCEAlphaInstances struct { ...@@ -8077,6 +8545,9 @@ type GCEAlphaInstances struct {
// Get the Instance named by key. // Get the Instance named by key.
func (g *GCEAlphaInstances) Get(ctx context.Context, key *meta.Key) (*alpha.Instance, error) { func (g *GCEAlphaInstances) Get(ctx context.Context, key *meta.Key) (*alpha.Instance, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Instances") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Instances")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -8121,6 +8592,9 @@ func (g *GCEAlphaInstances) List(ctx context.Context, zone string, fl *filter.F) ...@@ -8121,6 +8592,9 @@ func (g *GCEAlphaInstances) List(ctx context.Context, zone string, fl *filter.F)
// Insert Instance with key of value obj. // Insert Instance with key of value obj.
func (g *GCEAlphaInstances) Insert(ctx context.Context, key *meta.Key, obj *alpha.Instance) error { func (g *GCEAlphaInstances) Insert(ctx context.Context, key *meta.Key, obj *alpha.Instance) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Instances") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Instances")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -8144,6 +8618,9 @@ func (g *GCEAlphaInstances) Insert(ctx context.Context, key *meta.Key, obj *alph ...@@ -8144,6 +8618,9 @@ func (g *GCEAlphaInstances) Insert(ctx context.Context, key *meta.Key, obj *alph
// Delete the Instance referenced by key. // Delete the Instance referenced by key.
func (g *GCEAlphaInstances) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEAlphaInstances) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Instances") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Instances")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -8166,6 +8643,9 @@ func (g *GCEAlphaInstances) Delete(ctx context.Context, key *meta.Key) error { ...@@ -8166,6 +8643,9 @@ func (g *GCEAlphaInstances) Delete(ctx context.Context, key *meta.Key) error {
// AttachDisk is a method on GCEAlphaInstances. // AttachDisk is a method on GCEAlphaInstances.
func (g *GCEAlphaInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 *alpha.AttachedDisk) error { func (g *GCEAlphaInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 *alpha.AttachedDisk) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Instances") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Instances")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -8187,6 +8667,9 @@ func (g *GCEAlphaInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 ...@@ -8187,6 +8667,9 @@ func (g *GCEAlphaInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0
// DetachDisk is a method on GCEAlphaInstances. // DetachDisk is a method on GCEAlphaInstances.
func (g *GCEAlphaInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 string) error { func (g *GCEAlphaInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 string) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Instances") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Instances")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -8208,6 +8691,9 @@ func (g *GCEAlphaInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 ...@@ -8208,6 +8691,9 @@ func (g *GCEAlphaInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0
// UpdateNetworkInterface is a method on GCEAlphaInstances. // UpdateNetworkInterface is a method on GCEAlphaInstances.
func (g *GCEAlphaInstances) UpdateNetworkInterface(ctx context.Context, key *meta.Key, arg0 string, arg1 *alpha.NetworkInterface) error { func (g *GCEAlphaInstances) UpdateNetworkInterface(ctx context.Context, key *meta.Key, arg0 string, arg1 *alpha.NetworkInterface) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Instances") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "Instances")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -8291,6 +8777,9 @@ func (m *MockAlphaNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key) ...@@ -8291,6 +8777,9 @@ func (m *MockAlphaNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key)
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -8355,6 +8844,9 @@ func (m *MockAlphaNetworkEndpointGroups) Insert(ctx context.Context, key *meta.K ...@@ -8355,6 +8844,9 @@ func (m *MockAlphaNetworkEndpointGroups) Insert(ctx context.Context, key *meta.K
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -8390,6 +8882,9 @@ func (m *MockAlphaNetworkEndpointGroups) Delete(ctx context.Context, key *meta.K ...@@ -8390,6 +8882,9 @@ func (m *MockAlphaNetworkEndpointGroups) Delete(ctx context.Context, key *meta.K
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -8483,6 +8978,9 @@ type GCEAlphaNetworkEndpointGroups struct { ...@@ -8483,6 +8978,9 @@ type GCEAlphaNetworkEndpointGroups struct {
// Get the NetworkEndpointGroup named by key. // Get the NetworkEndpointGroup named by key.
func (g *GCEAlphaNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key) (*alpha.NetworkEndpointGroup, error) { func (g *GCEAlphaNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key) (*alpha.NetworkEndpointGroup, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "NetworkEndpointGroups") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "NetworkEndpointGroups")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -8527,6 +9025,9 @@ func (g *GCEAlphaNetworkEndpointGroups) List(ctx context.Context, zone string, f ...@@ -8527,6 +9025,9 @@ func (g *GCEAlphaNetworkEndpointGroups) List(ctx context.Context, zone string, f
// Insert NetworkEndpointGroup with key of value obj. // Insert NetworkEndpointGroup with key of value obj.
func (g *GCEAlphaNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, obj *alpha.NetworkEndpointGroup) error { func (g *GCEAlphaNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, obj *alpha.NetworkEndpointGroup) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "NetworkEndpointGroups") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "NetworkEndpointGroups")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -8550,6 +9051,9 @@ func (g *GCEAlphaNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Ke ...@@ -8550,6 +9051,9 @@ func (g *GCEAlphaNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Ke
// Delete the NetworkEndpointGroup referenced by key. // Delete the NetworkEndpointGroup referenced by key.
func (g *GCEAlphaNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEAlphaNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "NetworkEndpointGroups") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "NetworkEndpointGroups")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -8604,6 +9108,9 @@ func (g *GCEAlphaNetworkEndpointGroups) AggregatedList(ctx context.Context, fl * ...@@ -8604,6 +9108,9 @@ func (g *GCEAlphaNetworkEndpointGroups) AggregatedList(ctx context.Context, fl *
// AttachNetworkEndpoints is a method on GCEAlphaNetworkEndpointGroups. // AttachNetworkEndpoints is a method on GCEAlphaNetworkEndpointGroups.
func (g *GCEAlphaNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *alpha.NetworkEndpointGroupsAttachEndpointsRequest) error { func (g *GCEAlphaNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *alpha.NetworkEndpointGroupsAttachEndpointsRequest) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "NetworkEndpointGroups") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "NetworkEndpointGroups")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -8625,6 +9132,9 @@ func (g *GCEAlphaNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Conte ...@@ -8625,6 +9132,9 @@ func (g *GCEAlphaNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Conte
// DetachNetworkEndpoints is a method on GCEAlphaNetworkEndpointGroups. // DetachNetworkEndpoints is a method on GCEAlphaNetworkEndpointGroups.
func (g *GCEAlphaNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *alpha.NetworkEndpointGroupsDetachEndpointsRequest) error { func (g *GCEAlphaNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *alpha.NetworkEndpointGroupsDetachEndpointsRequest) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "NetworkEndpointGroups") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "NetworkEndpointGroups")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -8646,6 +9156,9 @@ func (g *GCEAlphaNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Conte ...@@ -8646,6 +9156,9 @@ func (g *GCEAlphaNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Conte
// ListNetworkEndpoints is a method on GCEAlphaNetworkEndpointGroups. // ListNetworkEndpoints is a method on GCEAlphaNetworkEndpointGroups.
func (g *GCEAlphaNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *alpha.NetworkEndpointGroupsListEndpointsRequest, fl *filter.F) ([]*alpha.NetworkEndpointWithHealthStatus, error) { func (g *GCEAlphaNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *alpha.NetworkEndpointGroupsListEndpointsRequest, fl *filter.F) ([]*alpha.NetworkEndpointWithHealthStatus, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "NetworkEndpointGroups") projectID := g.s.ProjectRouter.ProjectID(ctx, "alpha", "NetworkEndpointGroups")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -8760,6 +9273,9 @@ func (m *MockRegions) Get(ctx context.Context, key *meta.Key) (*ga.Region, error ...@@ -8760,6 +9273,9 @@ func (m *MockRegions) Get(ctx context.Context, key *meta.Key) (*ga.Region, error
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -8825,6 +9341,9 @@ type GCERegions struct { ...@@ -8825,6 +9341,9 @@ type GCERegions struct {
// Get the Region named by key. // Get the Region named by key.
func (g *GCERegions) Get(ctx context.Context, key *meta.Key) (*ga.Region, error) { func (g *GCERegions) Get(ctx context.Context, key *meta.Key) (*ga.Region, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Regions") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Regions")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -8922,6 +9441,9 @@ func (m *MockRoutes) Get(ctx context.Context, key *meta.Key) (*ga.Route, error) ...@@ -8922,6 +9441,9 @@ func (m *MockRoutes) Get(ctx context.Context, key *meta.Key) (*ga.Route, error)
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -8983,6 +9505,9 @@ func (m *MockRoutes) Insert(ctx context.Context, key *meta.Key, obj *ga.Route) e ...@@ -8983,6 +9505,9 @@ func (m *MockRoutes) Insert(ctx context.Context, key *meta.Key, obj *ga.Route) e
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -9018,6 +9543,9 @@ func (m *MockRoutes) Delete(ctx context.Context, key *meta.Key) error { ...@@ -9018,6 +9543,9 @@ func (m *MockRoutes) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -9052,6 +9580,9 @@ type GCERoutes struct { ...@@ -9052,6 +9580,9 @@ type GCERoutes struct {
// Get the Route named by key. // Get the Route named by key.
func (g *GCERoutes) Get(ctx context.Context, key *meta.Key) (*ga.Route, error) { func (g *GCERoutes) Get(ctx context.Context, key *meta.Key) (*ga.Route, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Routes") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Routes")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -9096,6 +9627,9 @@ func (g *GCERoutes) List(ctx context.Context, fl *filter.F) ([]*ga.Route, error) ...@@ -9096,6 +9627,9 @@ func (g *GCERoutes) List(ctx context.Context, fl *filter.F) ([]*ga.Route, error)
// Insert Route with key of value obj. // Insert Route with key of value obj.
func (g *GCERoutes) Insert(ctx context.Context, key *meta.Key, obj *ga.Route) error { func (g *GCERoutes) Insert(ctx context.Context, key *meta.Key, obj *ga.Route) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Routes") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Routes")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -9119,6 +9653,9 @@ func (g *GCERoutes) Insert(ctx context.Context, key *meta.Key, obj *ga.Route) er ...@@ -9119,6 +9653,9 @@ func (g *GCERoutes) Insert(ctx context.Context, key *meta.Key, obj *ga.Route) er
// Delete the Route referenced by key. // Delete the Route referenced by key.
func (g *GCERoutes) Delete(ctx context.Context, key *meta.Key) error { func (g *GCERoutes) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Routes") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Routes")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -9195,6 +9732,9 @@ func (m *MockSslCertificates) Get(ctx context.Context, key *meta.Key) (*ga.SslCe ...@@ -9195,6 +9732,9 @@ func (m *MockSslCertificates) Get(ctx context.Context, key *meta.Key) (*ga.SslCe
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -9256,6 +9796,9 @@ func (m *MockSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *ga ...@@ -9256,6 +9796,9 @@ func (m *MockSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *ga
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -9291,6 +9834,9 @@ func (m *MockSslCertificates) Delete(ctx context.Context, key *meta.Key) error { ...@@ -9291,6 +9834,9 @@ func (m *MockSslCertificates) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -9325,6 +9871,9 @@ type GCESslCertificates struct { ...@@ -9325,6 +9871,9 @@ type GCESslCertificates struct {
// Get the SslCertificate named by key. // Get the SslCertificate named by key.
func (g *GCESslCertificates) Get(ctx context.Context, key *meta.Key) (*ga.SslCertificate, error) { func (g *GCESslCertificates) Get(ctx context.Context, key *meta.Key) (*ga.SslCertificate, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "SslCertificates") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "SslCertificates")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -9369,6 +9918,9 @@ func (g *GCESslCertificates) List(ctx context.Context, fl *filter.F) ([]*ga.SslC ...@@ -9369,6 +9918,9 @@ func (g *GCESslCertificates) List(ctx context.Context, fl *filter.F) ([]*ga.SslC
// Insert SslCertificate with key of value obj. // Insert SslCertificate with key of value obj.
func (g *GCESslCertificates) Insert(ctx context.Context, key *meta.Key, obj *ga.SslCertificate) error { func (g *GCESslCertificates) Insert(ctx context.Context, key *meta.Key, obj *ga.SslCertificate) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "SslCertificates") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "SslCertificates")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -9392,6 +9944,9 @@ func (g *GCESslCertificates) Insert(ctx context.Context, key *meta.Key, obj *ga. ...@@ -9392,6 +9944,9 @@ func (g *GCESslCertificates) Insert(ctx context.Context, key *meta.Key, obj *ga.
// Delete the SslCertificate referenced by key. // Delete the SslCertificate referenced by key.
func (g *GCESslCertificates) Delete(ctx context.Context, key *meta.Key) error { func (g *GCESslCertificates) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "SslCertificates") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "SslCertificates")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -9470,6 +10025,9 @@ func (m *MockTargetHttpProxies) Get(ctx context.Context, key *meta.Key) (*ga.Tar ...@@ -9470,6 +10025,9 @@ func (m *MockTargetHttpProxies) Get(ctx context.Context, key *meta.Key) (*ga.Tar
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -9531,6 +10089,9 @@ func (m *MockTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj * ...@@ -9531,6 +10089,9 @@ func (m *MockTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -9566,6 +10127,9 @@ func (m *MockTargetHttpProxies) Delete(ctx context.Context, key *meta.Key) error ...@@ -9566,6 +10127,9 @@ func (m *MockTargetHttpProxies) Delete(ctx context.Context, key *meta.Key) error
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -9608,6 +10172,9 @@ type GCETargetHttpProxies struct { ...@@ -9608,6 +10172,9 @@ type GCETargetHttpProxies struct {
// Get the TargetHttpProxy named by key. // Get the TargetHttpProxy named by key.
func (g *GCETargetHttpProxies) Get(ctx context.Context, key *meta.Key) (*ga.TargetHttpProxy, error) { func (g *GCETargetHttpProxies) Get(ctx context.Context, key *meta.Key) (*ga.TargetHttpProxy, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpProxies") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpProxies")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -9652,6 +10219,9 @@ func (g *GCETargetHttpProxies) List(ctx context.Context, fl *filter.F) ([]*ga.Ta ...@@ -9652,6 +10219,9 @@ func (g *GCETargetHttpProxies) List(ctx context.Context, fl *filter.F) ([]*ga.Ta
// Insert TargetHttpProxy with key of value obj. // Insert TargetHttpProxy with key of value obj.
func (g *GCETargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *ga.TargetHttpProxy) error { func (g *GCETargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *ga.TargetHttpProxy) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpProxies") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpProxies")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -9675,6 +10245,9 @@ func (g *GCETargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *g ...@@ -9675,6 +10245,9 @@ func (g *GCETargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *g
// Delete the TargetHttpProxy referenced by key. // Delete the TargetHttpProxy referenced by key.
func (g *GCETargetHttpProxies) Delete(ctx context.Context, key *meta.Key) error { func (g *GCETargetHttpProxies) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpProxies") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpProxies")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -9698,6 +10271,9 @@ func (g *GCETargetHttpProxies) Delete(ctx context.Context, key *meta.Key) error ...@@ -9698,6 +10271,9 @@ func (g *GCETargetHttpProxies) Delete(ctx context.Context, key *meta.Key) error
// SetUrlMap is a method on GCETargetHttpProxies. // SetUrlMap is a method on GCETargetHttpProxies.
func (g *GCETargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *ga.UrlMapReference) error { func (g *GCETargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *ga.UrlMapReference) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpProxies") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpProxies")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -9776,6 +10352,9 @@ func (m *MockTargetHttpsProxies) Get(ctx context.Context, key *meta.Key) (*ga.Ta ...@@ -9776,6 +10352,9 @@ func (m *MockTargetHttpsProxies) Get(ctx context.Context, key *meta.Key) (*ga.Ta
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -9837,6 +10416,9 @@ func (m *MockTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj ...@@ -9837,6 +10416,9 @@ func (m *MockTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -9872,6 +10454,9 @@ func (m *MockTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key) erro ...@@ -9872,6 +10454,9 @@ func (m *MockTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key) erro
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -9922,6 +10507,9 @@ type GCETargetHttpsProxies struct { ...@@ -9922,6 +10507,9 @@ type GCETargetHttpsProxies struct {
// Get the TargetHttpsProxy named by key. // Get the TargetHttpsProxy named by key.
func (g *GCETargetHttpsProxies) Get(ctx context.Context, key *meta.Key) (*ga.TargetHttpsProxy, error) { func (g *GCETargetHttpsProxies) Get(ctx context.Context, key *meta.Key) (*ga.TargetHttpsProxy, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpsProxies") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpsProxies")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -9966,6 +10554,9 @@ func (g *GCETargetHttpsProxies) List(ctx context.Context, fl *filter.F) ([]*ga.T ...@@ -9966,6 +10554,9 @@ func (g *GCETargetHttpsProxies) List(ctx context.Context, fl *filter.F) ([]*ga.T
// Insert TargetHttpsProxy with key of value obj. // Insert TargetHttpsProxy with key of value obj.
func (g *GCETargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *ga.TargetHttpsProxy) error { func (g *GCETargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *ga.TargetHttpsProxy) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpsProxies") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpsProxies")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -9989,6 +10580,9 @@ func (g *GCETargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj * ...@@ -9989,6 +10580,9 @@ func (g *GCETargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *
// Delete the TargetHttpsProxy referenced by key. // Delete the TargetHttpsProxy referenced by key.
func (g *GCETargetHttpsProxies) Delete(ctx context.Context, key *meta.Key) error { func (g *GCETargetHttpsProxies) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpsProxies") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpsProxies")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -10012,6 +10606,9 @@ func (g *GCETargetHttpsProxies) Delete(ctx context.Context, key *meta.Key) error ...@@ -10012,6 +10606,9 @@ func (g *GCETargetHttpsProxies) Delete(ctx context.Context, key *meta.Key) error
// SetSslCertificates is a method on GCETargetHttpsProxies. // SetSslCertificates is a method on GCETargetHttpsProxies.
func (g *GCETargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *ga.TargetHttpsProxiesSetSslCertificatesRequest) error { func (g *GCETargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *ga.TargetHttpsProxiesSetSslCertificatesRequest) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpsProxies") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpsProxies")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -10033,6 +10630,9 @@ func (g *GCETargetHttpsProxies) SetSslCertificates(ctx context.Context, key *met ...@@ -10033,6 +10630,9 @@ func (g *GCETargetHttpsProxies) SetSslCertificates(ctx context.Context, key *met
// SetUrlMap is a method on GCETargetHttpsProxies. // SetUrlMap is a method on GCETargetHttpsProxies.
func (g *GCETargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *ga.UrlMapReference) error { func (g *GCETargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *ga.UrlMapReference) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpsProxies") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetHttpsProxies")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -10111,6 +10711,9 @@ func (m *MockTargetPools) Get(ctx context.Context, key *meta.Key) (*ga.TargetPoo ...@@ -10111,6 +10711,9 @@ func (m *MockTargetPools) Get(ctx context.Context, key *meta.Key) (*ga.TargetPoo
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -10175,6 +10778,9 @@ func (m *MockTargetPools) Insert(ctx context.Context, key *meta.Key, obj *ga.Tar ...@@ -10175,6 +10778,9 @@ func (m *MockTargetPools) Insert(ctx context.Context, key *meta.Key, obj *ga.Tar
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -10210,6 +10816,9 @@ func (m *MockTargetPools) Delete(ctx context.Context, key *meta.Key) error { ...@@ -10210,6 +10816,9 @@ func (m *MockTargetPools) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -10260,6 +10869,9 @@ type GCETargetPools struct { ...@@ -10260,6 +10869,9 @@ type GCETargetPools struct {
// Get the TargetPool named by key. // Get the TargetPool named by key.
func (g *GCETargetPools) Get(ctx context.Context, key *meta.Key) (*ga.TargetPool, error) { func (g *GCETargetPools) Get(ctx context.Context, key *meta.Key) (*ga.TargetPool, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetPools") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetPools")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -10304,6 +10916,9 @@ func (g *GCETargetPools) List(ctx context.Context, region string, fl *filter.F) ...@@ -10304,6 +10916,9 @@ func (g *GCETargetPools) List(ctx context.Context, region string, fl *filter.F)
// Insert TargetPool with key of value obj. // Insert TargetPool with key of value obj.
func (g *GCETargetPools) Insert(ctx context.Context, key *meta.Key, obj *ga.TargetPool) error { func (g *GCETargetPools) Insert(ctx context.Context, key *meta.Key, obj *ga.TargetPool) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetPools") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetPools")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -10327,6 +10942,9 @@ func (g *GCETargetPools) Insert(ctx context.Context, key *meta.Key, obj *ga.Targ ...@@ -10327,6 +10942,9 @@ func (g *GCETargetPools) Insert(ctx context.Context, key *meta.Key, obj *ga.Targ
// Delete the TargetPool referenced by key. // Delete the TargetPool referenced by key.
func (g *GCETargetPools) Delete(ctx context.Context, key *meta.Key) error { func (g *GCETargetPools) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetPools") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetPools")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -10349,6 +10967,9 @@ func (g *GCETargetPools) Delete(ctx context.Context, key *meta.Key) error { ...@@ -10349,6 +10967,9 @@ func (g *GCETargetPools) Delete(ctx context.Context, key *meta.Key) error {
// AddInstance is a method on GCETargetPools. // AddInstance is a method on GCETargetPools.
func (g *GCETargetPools) AddInstance(ctx context.Context, key *meta.Key, arg0 *ga.TargetPoolsAddInstanceRequest) error { func (g *GCETargetPools) AddInstance(ctx context.Context, key *meta.Key, arg0 *ga.TargetPoolsAddInstanceRequest) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetPools") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetPools")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -10370,6 +10991,9 @@ func (g *GCETargetPools) AddInstance(ctx context.Context, key *meta.Key, arg0 *g ...@@ -10370,6 +10991,9 @@ func (g *GCETargetPools) AddInstance(ctx context.Context, key *meta.Key, arg0 *g
// RemoveInstance is a method on GCETargetPools. // RemoveInstance is a method on GCETargetPools.
func (g *GCETargetPools) RemoveInstance(ctx context.Context, key *meta.Key, arg0 *ga.TargetPoolsRemoveInstanceRequest) error { func (g *GCETargetPools) RemoveInstance(ctx context.Context, key *meta.Key, arg0 *ga.TargetPoolsRemoveInstanceRequest) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetPools") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "TargetPools")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -10446,6 +11070,9 @@ func (m *MockUrlMaps) Get(ctx context.Context, key *meta.Key) (*ga.UrlMap, error ...@@ -10446,6 +11070,9 @@ func (m *MockUrlMaps) Get(ctx context.Context, key *meta.Key) (*ga.UrlMap, error
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -10507,6 +11134,9 @@ func (m *MockUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *ga.UrlMap) ...@@ -10507,6 +11134,9 @@ func (m *MockUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *ga.UrlMap)
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -10542,6 +11172,9 @@ func (m *MockUrlMaps) Delete(ctx context.Context, key *meta.Key) error { ...@@ -10542,6 +11172,9 @@ func (m *MockUrlMaps) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -10584,6 +11217,9 @@ type GCEUrlMaps struct { ...@@ -10584,6 +11217,9 @@ type GCEUrlMaps struct {
// Get the UrlMap named by key. // Get the UrlMap named by key.
func (g *GCEUrlMaps) Get(ctx context.Context, key *meta.Key) (*ga.UrlMap, error) { func (g *GCEUrlMaps) Get(ctx context.Context, key *meta.Key) (*ga.UrlMap, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "UrlMaps") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "UrlMaps")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -10628,6 +11264,9 @@ func (g *GCEUrlMaps) List(ctx context.Context, fl *filter.F) ([]*ga.UrlMap, erro ...@@ -10628,6 +11264,9 @@ func (g *GCEUrlMaps) List(ctx context.Context, fl *filter.F) ([]*ga.UrlMap, erro
// Insert UrlMap with key of value obj. // Insert UrlMap with key of value obj.
func (g *GCEUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *ga.UrlMap) error { func (g *GCEUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *ga.UrlMap) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "UrlMaps") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "UrlMaps")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -10651,6 +11290,9 @@ func (g *GCEUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *ga.UrlMap) ...@@ -10651,6 +11290,9 @@ func (g *GCEUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *ga.UrlMap)
// Delete the UrlMap referenced by key. // Delete the UrlMap referenced by key.
func (g *GCEUrlMaps) Delete(ctx context.Context, key *meta.Key) error { func (g *GCEUrlMaps) Delete(ctx context.Context, key *meta.Key) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "UrlMaps") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "UrlMaps")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -10674,6 +11316,9 @@ func (g *GCEUrlMaps) Delete(ctx context.Context, key *meta.Key) error { ...@@ -10674,6 +11316,9 @@ func (g *GCEUrlMaps) Delete(ctx context.Context, key *meta.Key) error {
// Update is a method on GCEUrlMaps. // Update is a method on GCEUrlMaps.
func (g *GCEUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *ga.UrlMap) error { func (g *GCEUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *ga.UrlMap) error {
if !key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "UrlMaps") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "UrlMaps")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -10740,6 +11385,9 @@ func (m *MockZones) Get(ctx context.Context, key *meta.Key) (*ga.Zone, error) { ...@@ -10740,6 +11385,9 @@ func (m *MockZones) Get(ctx context.Context, key *meta.Key) (*ga.Zone, error) {
return obj, err return obj, err
} }
} }
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -10805,6 +11453,9 @@ type GCEZones struct { ...@@ -10805,6 +11453,9 @@ type GCEZones struct {
// Get the Zone named by key. // Get the Zone named by key.
func (g *GCEZones) Get(ctx context.Context, key *meta.Key) (*ga.Zone, error) { func (g *GCEZones) Get(ctx context.Context, key *meta.Key) (*ga.Zone, error) {
if !key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Zones") projectID := g.s.ProjectRouter.ProjectID(ctx, "ga", "Zones")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
......
...@@ -395,6 +395,9 @@ func (m *{{.MockWrapType}}) Get(ctx context.Context, key *meta.Key) (*{{.FQObjec ...@@ -395,6 +395,9 @@ func (m *{{.MockWrapType}}) Get(ctx context.Context, key *meta.Key) (*{{.FQObjec
return obj, err return obj, err
} }
} }
if ! key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -510,6 +513,9 @@ func (m *{{.MockWrapType}}) Insert(ctx context.Context, key *meta.Key, obj *{{.F ...@@ -510,6 +513,9 @@ func (m *{{.MockWrapType}}) Insert(ctx context.Context, key *meta.Key, obj *{{.F
return err return err
} }
} }
if ! key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -547,6 +553,9 @@ func (m *{{.MockWrapType}}) Delete(ctx context.Context, key *meta.Key) error { ...@@ -547,6 +553,9 @@ func (m *{{.MockWrapType}}) Delete(ctx context.Context, key *meta.Key) error {
return err return err
} }
} }
if ! key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
m.Lock.Lock() m.Lock.Lock()
defer m.Lock.Unlock() defer m.Lock.Unlock()
...@@ -648,6 +657,9 @@ type {{.GCEWrapType}} struct { ...@@ -648,6 +657,9 @@ type {{.GCEWrapType}} struct {
{{- if .GenerateGet}} {{- if .GenerateGet}}
// Get the {{.Object}} named by key. // Get the {{.Object}} named by key.
func (g *{{.GCEWrapType}}) Get(ctx context.Context, key *meta.Key) (*{{.FQObjectType}}, error) { func (g *{{.GCEWrapType}}) Get(ctx context.Context, key *meta.Key) (*{{.FQObjectType}}, error) {
if ! key.Valid() {
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "{{.Version}}", "{{.Service}}") projectID := g.s.ProjectRouter.ProjectID(ctx, "{{.Version}}", "{{.Service}}")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -720,6 +732,9 @@ rk := &RateLimitKey{ ...@@ -720,6 +732,9 @@ rk := &RateLimitKey{
{{- if .GenerateInsert}} {{- if .GenerateInsert}}
// Insert {{.Object}} with key of value obj. // Insert {{.Object}} with key of value obj.
func (g *{{.GCEWrapType}}) Insert(ctx context.Context, key *meta.Key, obj *{{.FQObjectType}}) error { func (g *{{.GCEWrapType}}) Insert(ctx context.Context, key *meta.Key, obj *{{.FQObjectType}}) error {
if ! key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "{{.Version}}", "{{.Service}}") projectID := g.s.ProjectRouter.ProjectID(ctx, "{{.Version}}", "{{.Service}}")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -753,6 +768,9 @@ func (g *{{.GCEWrapType}}) Insert(ctx context.Context, key *meta.Key, obj *{{.FQ ...@@ -753,6 +768,9 @@ func (g *{{.GCEWrapType}}) Insert(ctx context.Context, key *meta.Key, obj *{{.FQ
{{- if .GenerateDelete}} {{- if .GenerateDelete}}
// Delete the {{.Object}} referenced by key. // Delete the {{.Object}} referenced by key.
func (g *{{.GCEWrapType}}) Delete(ctx context.Context, key *meta.Key) error { func (g *{{.GCEWrapType}}) Delete(ctx context.Context, key *meta.Key) error {
if ! key.Valid() {
return fmt.Errorf("invalid GCE key (%+v)", key)
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "{{.Version}}", "{{.Service}}") projectID := g.s.ProjectRouter.ProjectID(ctx, "{{.Version}}", "{{.Service}}")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
...@@ -820,6 +838,15 @@ func (g *{{.GCEWrapType}}) AggregatedList(ctx context.Context, fl *filter.F) (ma ...@@ -820,6 +838,15 @@ func (g *{{.GCEWrapType}}) AggregatedList(ctx context.Context, fl *filter.F) (ma
{{- range .}} {{- range .}}
// {{.Name}} is a method on {{.GCEWrapType}}. // {{.Name}} is a method on {{.GCEWrapType}}.
func (g *{{.GCEWrapType}}) {{.FcnArgs}} { func (g *{{.GCEWrapType}}) {{.FcnArgs}} {
if ! key.Valid() {
{{- if .IsOperation}}
return fmt.Errorf("invalid GCE key (%+v)", key)
{{- else if .IsGet}}
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
{{- else if .IsPaged}}
return nil, fmt.Errorf("invalid GCE key (%+v)", key)
{{- end}}
}
projectID := g.s.ProjectRouter.ProjectID(ctx, "{{.Version}}", "{{.Service}}") projectID := g.s.ProjectRouter.ProjectID(ctx, "{{.Version}}", "{{.Service}}")
rk := &RateLimitKey{ rk := &RateLimitKey{
ProjectID: projectID, ProjectID: projectID,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment