mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 16:29:21 +00:00
Clean up documentation.
This commit is contained in:
parent
9a70885559
commit
2aaf8b47b2
@ -60,6 +60,7 @@ limitations under the License.
|
|||||||
// &ServiceInfo{
|
// &ServiceInfo{
|
||||||
// Object: "InstanceGroup", // Name of the object type.
|
// Object: "InstanceGroup", // Name of the object type.
|
||||||
// Service: "InstanceGroups", // Name of the service.
|
// Service: "InstanceGroups", // Name of the service.
|
||||||
|
// Resource: "instanceGroups", // Lowercase resource name (as appears in the URL).
|
||||||
// version: meta.VersionAlpha, // API version (one entry per version is needed).
|
// version: meta.VersionAlpha, // API version (one entry per version is needed).
|
||||||
// keyType: Zonal, // What kind of resource this is.
|
// keyType: Zonal, // What kind of resource this is.
|
||||||
// serviceType: reflect.TypeOf(&alpha.InstanceGroupsService{}), // Associated golang type.
|
// serviceType: reflect.TypeOf(&alpha.InstanceGroupsService{}), // Associated golang type.
|
||||||
|
@ -21,9 +21,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/cloudprovider/providers/gce/cloud/meta"
|
|
||||||
compute "google.golang.org/api/compute/v1"
|
compute "google.golang.org/api/compute/v1"
|
||||||
"google.golang.org/api/googleapi"
|
"google.golang.org/api/googleapi"
|
||||||
|
"k8s.io/kubernetes/pkg/cloudprovider/providers/gce/cloud/meta"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ProjectsOps is the manually implemented methods for the Projects service.
|
// ProjectsOps is the manually implemented methods for the Projects service.
|
||||||
@ -37,6 +37,7 @@ type MockProjectOpsState struct {
|
|||||||
metadata map[string]*compute.Metadata
|
metadata map[string]*compute.Metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get a project by projectID.
|
||||||
func (m *MockProjects) Get(ctx context.Context, projectID string) (*compute.Project, error) {
|
func (m *MockProjects) Get(ctx context.Context, projectID string) (*compute.Project, error) {
|
||||||
m.Lock.Lock()
|
m.Lock.Lock()
|
||||||
defer m.Lock.Unlock()
|
defer m.Lock.Unlock()
|
||||||
@ -50,6 +51,7 @@ func (m *MockProjects) Get(ctx context.Context, projectID string) (*compute.Proj
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get a project by projectID.
|
||||||
func (g *GCEProjects) Get(ctx context.Context, projectID string) (*compute.Project, error) {
|
func (g *GCEProjects) Get(ctx context.Context, projectID string) (*compute.Project, error) {
|
||||||
rk := &RateLimitKey{
|
rk := &RateLimitKey{
|
||||||
ProjectID: projectID,
|
ProjectID: projectID,
|
||||||
@ -65,6 +67,7 @@ func (g *GCEProjects) Get(ctx context.Context, projectID string) (*compute.Proje
|
|||||||
return call.Do()
|
return call.Do()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetCommonInstanceMetadata for a given project.
|
||||||
func (m *MockProjects) SetCommonInstanceMetadata(ctx context.Context, projectID string, meta *compute.Metadata) error {
|
func (m *MockProjects) SetCommonInstanceMetadata(ctx context.Context, projectID string, meta *compute.Metadata) error {
|
||||||
if m.X == nil {
|
if m.X == nil {
|
||||||
m.X = &MockProjectOpsState{metadata: map[string]*compute.Metadata{}}
|
m.X = &MockProjectOpsState{metadata: map[string]*compute.Metadata{}}
|
||||||
@ -74,6 +77,7 @@ func (m *MockProjects) SetCommonInstanceMetadata(ctx context.Context, projectID
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetCommonInstanceMetadata for a given project.
|
||||||
func (g *GCEProjects) SetCommonInstanceMetadata(ctx context.Context, projectID string, m *compute.Metadata) error {
|
func (g *GCEProjects) SetCommonInstanceMetadata(ctx context.Context, projectID string, m *compute.Metadata) error {
|
||||||
rk := &RateLimitKey{
|
rk := &RateLimitKey{
|
||||||
ProjectID: projectID,
|
ProjectID: projectID,
|
||||||
|
@ -150,99 +150,162 @@ type GCE struct {
|
|||||||
gceZones *GCEZones
|
gceZones *GCEZones
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Addresses returns the interface for the ga Addresses.
|
||||||
func (gce *GCE) Addresses() Addresses {
|
func (gce *GCE) Addresses() Addresses {
|
||||||
return gce.gceAddresses
|
return gce.gceAddresses
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaAddresses returns the interface for the alpha Addresses.
|
||||||
func (gce *GCE) AlphaAddresses() AlphaAddresses {
|
func (gce *GCE) AlphaAddresses() AlphaAddresses {
|
||||||
return gce.gceAlphaAddresses
|
return gce.gceAlphaAddresses
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BetaAddresses returns the interface for the beta Addresses.
|
||||||
func (gce *GCE) BetaAddresses() BetaAddresses {
|
func (gce *GCE) BetaAddresses() BetaAddresses {
|
||||||
return gce.gceBetaAddresses
|
return gce.gceBetaAddresses
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GlobalAddresses returns the interface for the ga GlobalAddresses.
|
||||||
func (gce *GCE) GlobalAddresses() GlobalAddresses {
|
func (gce *GCE) GlobalAddresses() GlobalAddresses {
|
||||||
return gce.gceGlobalAddresses
|
return gce.gceGlobalAddresses
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BackendServices returns the interface for the ga BackendServices.
|
||||||
func (gce *GCE) BackendServices() BackendServices {
|
func (gce *GCE) BackendServices() BackendServices {
|
||||||
return gce.gceBackendServices
|
return gce.gceBackendServices
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaBackendServices returns the interface for the alpha BackendServices.
|
||||||
func (gce *GCE) AlphaBackendServices() AlphaBackendServices {
|
func (gce *GCE) AlphaBackendServices() AlphaBackendServices {
|
||||||
return gce.gceAlphaBackendServices
|
return gce.gceAlphaBackendServices
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaRegionBackendServices returns the interface for the alpha RegionBackendServices.
|
||||||
func (gce *GCE) AlphaRegionBackendServices() AlphaRegionBackendServices {
|
func (gce *GCE) AlphaRegionBackendServices() AlphaRegionBackendServices {
|
||||||
return gce.gceAlphaRegionBackendServices
|
return gce.gceAlphaRegionBackendServices
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disks returns the interface for the ga Disks.
|
||||||
func (gce *GCE) Disks() Disks {
|
func (gce *GCE) Disks() Disks {
|
||||||
return gce.gceDisks
|
return gce.gceDisks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaDisks returns the interface for the alpha Disks.
|
||||||
func (gce *GCE) AlphaDisks() AlphaDisks {
|
func (gce *GCE) AlphaDisks() AlphaDisks {
|
||||||
return gce.gceAlphaDisks
|
return gce.gceAlphaDisks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaRegionDisks returns the interface for the alpha RegionDisks.
|
||||||
func (gce *GCE) AlphaRegionDisks() AlphaRegionDisks {
|
func (gce *GCE) AlphaRegionDisks() AlphaRegionDisks {
|
||||||
return gce.gceAlphaRegionDisks
|
return gce.gceAlphaRegionDisks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Firewalls returns the interface for the ga Firewalls.
|
||||||
func (gce *GCE) Firewalls() Firewalls {
|
func (gce *GCE) Firewalls() Firewalls {
|
||||||
return gce.gceFirewalls
|
return gce.gceFirewalls
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ForwardingRules returns the interface for the ga ForwardingRules.
|
||||||
func (gce *GCE) ForwardingRules() ForwardingRules {
|
func (gce *GCE) ForwardingRules() ForwardingRules {
|
||||||
return gce.gceForwardingRules
|
return gce.gceForwardingRules
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaForwardingRules returns the interface for the alpha ForwardingRules.
|
||||||
func (gce *GCE) AlphaForwardingRules() AlphaForwardingRules {
|
func (gce *GCE) AlphaForwardingRules() AlphaForwardingRules {
|
||||||
return gce.gceAlphaForwardingRules
|
return gce.gceAlphaForwardingRules
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GlobalForwardingRules returns the interface for the ga GlobalForwardingRules.
|
||||||
func (gce *GCE) GlobalForwardingRules() GlobalForwardingRules {
|
func (gce *GCE) GlobalForwardingRules() GlobalForwardingRules {
|
||||||
return gce.gceGlobalForwardingRules
|
return gce.gceGlobalForwardingRules
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HealthChecks returns the interface for the ga HealthChecks.
|
||||||
func (gce *GCE) HealthChecks() HealthChecks {
|
func (gce *GCE) HealthChecks() HealthChecks {
|
||||||
return gce.gceHealthChecks
|
return gce.gceHealthChecks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaHealthChecks returns the interface for the alpha HealthChecks.
|
||||||
func (gce *GCE) AlphaHealthChecks() AlphaHealthChecks {
|
func (gce *GCE) AlphaHealthChecks() AlphaHealthChecks {
|
||||||
return gce.gceAlphaHealthChecks
|
return gce.gceAlphaHealthChecks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HttpHealthChecks returns the interface for the ga HttpHealthChecks.
|
||||||
func (gce *GCE) HttpHealthChecks() HttpHealthChecks {
|
func (gce *GCE) HttpHealthChecks() HttpHealthChecks {
|
||||||
return gce.gceHttpHealthChecks
|
return gce.gceHttpHealthChecks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HttpsHealthChecks returns the interface for the ga HttpsHealthChecks.
|
||||||
func (gce *GCE) HttpsHealthChecks() HttpsHealthChecks {
|
func (gce *GCE) HttpsHealthChecks() HttpsHealthChecks {
|
||||||
return gce.gceHttpsHealthChecks
|
return gce.gceHttpsHealthChecks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InstanceGroups returns the interface for the ga InstanceGroups.
|
||||||
func (gce *GCE) InstanceGroups() InstanceGroups {
|
func (gce *GCE) InstanceGroups() InstanceGroups {
|
||||||
return gce.gceInstanceGroups
|
return gce.gceInstanceGroups
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Instances returns the interface for the ga Instances.
|
||||||
func (gce *GCE) Instances() Instances {
|
func (gce *GCE) Instances() Instances {
|
||||||
return gce.gceInstances
|
return gce.gceInstances
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BetaInstances returns the interface for the beta Instances.
|
||||||
func (gce *GCE) BetaInstances() BetaInstances {
|
func (gce *GCE) BetaInstances() BetaInstances {
|
||||||
return gce.gceBetaInstances
|
return gce.gceBetaInstances
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaInstances returns the interface for the alpha Instances.
|
||||||
func (gce *GCE) AlphaInstances() AlphaInstances {
|
func (gce *GCE) AlphaInstances() AlphaInstances {
|
||||||
return gce.gceAlphaInstances
|
return gce.gceAlphaInstances
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaNetworkEndpointGroups returns the interface for the alpha NetworkEndpointGroups.
|
||||||
func (gce *GCE) AlphaNetworkEndpointGroups() AlphaNetworkEndpointGroups {
|
func (gce *GCE) AlphaNetworkEndpointGroups() AlphaNetworkEndpointGroups {
|
||||||
return gce.gceAlphaNetworkEndpointGroups
|
return gce.gceAlphaNetworkEndpointGroups
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Projects returns the interface for the ga Projects.
|
||||||
func (gce *GCE) Projects() Projects {
|
func (gce *GCE) Projects() Projects {
|
||||||
return gce.gceProjects
|
return gce.gceProjects
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Regions returns the interface for the ga Regions.
|
||||||
func (gce *GCE) Regions() Regions {
|
func (gce *GCE) Regions() Regions {
|
||||||
return gce.gceRegions
|
return gce.gceRegions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Routes returns the interface for the ga Routes.
|
||||||
func (gce *GCE) Routes() Routes {
|
func (gce *GCE) Routes() Routes {
|
||||||
return gce.gceRoutes
|
return gce.gceRoutes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SslCertificates returns the interface for the ga SslCertificates.
|
||||||
func (gce *GCE) SslCertificates() SslCertificates {
|
func (gce *GCE) SslCertificates() SslCertificates {
|
||||||
return gce.gceSslCertificates
|
return gce.gceSslCertificates
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TargetHttpProxies returns the interface for the ga TargetHttpProxies.
|
||||||
func (gce *GCE) TargetHttpProxies() TargetHttpProxies {
|
func (gce *GCE) TargetHttpProxies() TargetHttpProxies {
|
||||||
return gce.gceTargetHttpProxies
|
return gce.gceTargetHttpProxies
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TargetHttpsProxies returns the interface for the ga TargetHttpsProxies.
|
||||||
func (gce *GCE) TargetHttpsProxies() TargetHttpsProxies {
|
func (gce *GCE) TargetHttpsProxies() TargetHttpsProxies {
|
||||||
return gce.gceTargetHttpsProxies
|
return gce.gceTargetHttpsProxies
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TargetPools returns the interface for the ga TargetPools.
|
||||||
func (gce *GCE) TargetPools() TargetPools {
|
func (gce *GCE) TargetPools() TargetPools {
|
||||||
return gce.gceTargetPools
|
return gce.gceTargetPools
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UrlMaps returns the interface for the ga UrlMaps.
|
||||||
func (gce *GCE) UrlMaps() UrlMaps {
|
func (gce *GCE) UrlMaps() UrlMaps {
|
||||||
return gce.gceUrlMaps
|
return gce.gceUrlMaps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Zones returns the interface for the ga Zones.
|
||||||
func (gce *GCE) Zones() Zones {
|
func (gce *GCE) Zones() Zones {
|
||||||
return gce.gceZones
|
return gce.gceZones
|
||||||
}
|
}
|
||||||
@ -350,130 +413,162 @@ type MockGCE struct {
|
|||||||
MockZones *MockZones
|
MockZones *MockZones
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Addresses returns the interface for the ga Addresses.
|
||||||
func (mock *MockGCE) Addresses() Addresses {
|
func (mock *MockGCE) Addresses() Addresses {
|
||||||
return mock.MockAddresses
|
return mock.MockAddresses
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaAddresses returns the interface for the alpha Addresses.
|
||||||
func (mock *MockGCE) AlphaAddresses() AlphaAddresses {
|
func (mock *MockGCE) AlphaAddresses() AlphaAddresses {
|
||||||
return mock.MockAlphaAddresses
|
return mock.MockAlphaAddresses
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BetaAddresses returns the interface for the beta Addresses.
|
||||||
func (mock *MockGCE) BetaAddresses() BetaAddresses {
|
func (mock *MockGCE) BetaAddresses() BetaAddresses {
|
||||||
return mock.MockBetaAddresses
|
return mock.MockBetaAddresses
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GlobalAddresses returns the interface for the ga GlobalAddresses.
|
||||||
func (mock *MockGCE) GlobalAddresses() GlobalAddresses {
|
func (mock *MockGCE) GlobalAddresses() GlobalAddresses {
|
||||||
return mock.MockGlobalAddresses
|
return mock.MockGlobalAddresses
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BackendServices returns the interface for the ga BackendServices.
|
||||||
func (mock *MockGCE) BackendServices() BackendServices {
|
func (mock *MockGCE) BackendServices() BackendServices {
|
||||||
return mock.MockBackendServices
|
return mock.MockBackendServices
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaBackendServices returns the interface for the alpha BackendServices.
|
||||||
func (mock *MockGCE) AlphaBackendServices() AlphaBackendServices {
|
func (mock *MockGCE) AlphaBackendServices() AlphaBackendServices {
|
||||||
return mock.MockAlphaBackendServices
|
return mock.MockAlphaBackendServices
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaRegionBackendServices returns the interface for the alpha RegionBackendServices.
|
||||||
func (mock *MockGCE) AlphaRegionBackendServices() AlphaRegionBackendServices {
|
func (mock *MockGCE) AlphaRegionBackendServices() AlphaRegionBackendServices {
|
||||||
return mock.MockAlphaRegionBackendServices
|
return mock.MockAlphaRegionBackendServices
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disks returns the interface for the ga Disks.
|
||||||
func (mock *MockGCE) Disks() Disks {
|
func (mock *MockGCE) Disks() Disks {
|
||||||
return mock.MockDisks
|
return mock.MockDisks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaDisks returns the interface for the alpha Disks.
|
||||||
func (mock *MockGCE) AlphaDisks() AlphaDisks {
|
func (mock *MockGCE) AlphaDisks() AlphaDisks {
|
||||||
return mock.MockAlphaDisks
|
return mock.MockAlphaDisks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaRegionDisks returns the interface for the alpha RegionDisks.
|
||||||
func (mock *MockGCE) AlphaRegionDisks() AlphaRegionDisks {
|
func (mock *MockGCE) AlphaRegionDisks() AlphaRegionDisks {
|
||||||
return mock.MockAlphaRegionDisks
|
return mock.MockAlphaRegionDisks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Firewalls returns the interface for the ga Firewalls.
|
||||||
func (mock *MockGCE) Firewalls() Firewalls {
|
func (mock *MockGCE) Firewalls() Firewalls {
|
||||||
return mock.MockFirewalls
|
return mock.MockFirewalls
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ForwardingRules returns the interface for the ga ForwardingRules.
|
||||||
func (mock *MockGCE) ForwardingRules() ForwardingRules {
|
func (mock *MockGCE) ForwardingRules() ForwardingRules {
|
||||||
return mock.MockForwardingRules
|
return mock.MockForwardingRules
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaForwardingRules returns the interface for the alpha ForwardingRules.
|
||||||
func (mock *MockGCE) AlphaForwardingRules() AlphaForwardingRules {
|
func (mock *MockGCE) AlphaForwardingRules() AlphaForwardingRules {
|
||||||
return mock.MockAlphaForwardingRules
|
return mock.MockAlphaForwardingRules
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GlobalForwardingRules returns the interface for the ga GlobalForwardingRules.
|
||||||
func (mock *MockGCE) GlobalForwardingRules() GlobalForwardingRules {
|
func (mock *MockGCE) GlobalForwardingRules() GlobalForwardingRules {
|
||||||
return mock.MockGlobalForwardingRules
|
return mock.MockGlobalForwardingRules
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HealthChecks returns the interface for the ga HealthChecks.
|
||||||
func (mock *MockGCE) HealthChecks() HealthChecks {
|
func (mock *MockGCE) HealthChecks() HealthChecks {
|
||||||
return mock.MockHealthChecks
|
return mock.MockHealthChecks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaHealthChecks returns the interface for the alpha HealthChecks.
|
||||||
func (mock *MockGCE) AlphaHealthChecks() AlphaHealthChecks {
|
func (mock *MockGCE) AlphaHealthChecks() AlphaHealthChecks {
|
||||||
return mock.MockAlphaHealthChecks
|
return mock.MockAlphaHealthChecks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HttpHealthChecks returns the interface for the ga HttpHealthChecks.
|
||||||
func (mock *MockGCE) HttpHealthChecks() HttpHealthChecks {
|
func (mock *MockGCE) HttpHealthChecks() HttpHealthChecks {
|
||||||
return mock.MockHttpHealthChecks
|
return mock.MockHttpHealthChecks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HttpsHealthChecks returns the interface for the ga HttpsHealthChecks.
|
||||||
func (mock *MockGCE) HttpsHealthChecks() HttpsHealthChecks {
|
func (mock *MockGCE) HttpsHealthChecks() HttpsHealthChecks {
|
||||||
return mock.MockHttpsHealthChecks
|
return mock.MockHttpsHealthChecks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InstanceGroups returns the interface for the ga InstanceGroups.
|
||||||
func (mock *MockGCE) InstanceGroups() InstanceGroups {
|
func (mock *MockGCE) InstanceGroups() InstanceGroups {
|
||||||
return mock.MockInstanceGroups
|
return mock.MockInstanceGroups
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Instances returns the interface for the ga Instances.
|
||||||
func (mock *MockGCE) Instances() Instances {
|
func (mock *MockGCE) Instances() Instances {
|
||||||
return mock.MockInstances
|
return mock.MockInstances
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BetaInstances returns the interface for the beta Instances.
|
||||||
func (mock *MockGCE) BetaInstances() BetaInstances {
|
func (mock *MockGCE) BetaInstances() BetaInstances {
|
||||||
return mock.MockBetaInstances
|
return mock.MockBetaInstances
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaInstances returns the interface for the alpha Instances.
|
||||||
func (mock *MockGCE) AlphaInstances() AlphaInstances {
|
func (mock *MockGCE) AlphaInstances() AlphaInstances {
|
||||||
return mock.MockAlphaInstances
|
return mock.MockAlphaInstances
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AlphaNetworkEndpointGroups returns the interface for the alpha NetworkEndpointGroups.
|
||||||
func (mock *MockGCE) AlphaNetworkEndpointGroups() AlphaNetworkEndpointGroups {
|
func (mock *MockGCE) AlphaNetworkEndpointGroups() AlphaNetworkEndpointGroups {
|
||||||
return mock.MockAlphaNetworkEndpointGroups
|
return mock.MockAlphaNetworkEndpointGroups
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Projects returns the interface for the ga Projects.
|
||||||
func (mock *MockGCE) Projects() Projects {
|
func (mock *MockGCE) Projects() Projects {
|
||||||
return mock.MockProjects
|
return mock.MockProjects
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Regions returns the interface for the ga Regions.
|
||||||
func (mock *MockGCE) Regions() Regions {
|
func (mock *MockGCE) Regions() Regions {
|
||||||
return mock.MockRegions
|
return mock.MockRegions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Routes returns the interface for the ga Routes.
|
||||||
func (mock *MockGCE) Routes() Routes {
|
func (mock *MockGCE) Routes() Routes {
|
||||||
return mock.MockRoutes
|
return mock.MockRoutes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SslCertificates returns the interface for the ga SslCertificates.
|
||||||
func (mock *MockGCE) SslCertificates() SslCertificates {
|
func (mock *MockGCE) SslCertificates() SslCertificates {
|
||||||
return mock.MockSslCertificates
|
return mock.MockSslCertificates
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TargetHttpProxies returns the interface for the ga TargetHttpProxies.
|
||||||
func (mock *MockGCE) TargetHttpProxies() TargetHttpProxies {
|
func (mock *MockGCE) TargetHttpProxies() TargetHttpProxies {
|
||||||
return mock.MockTargetHttpProxies
|
return mock.MockTargetHttpProxies
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TargetHttpsProxies returns the interface for the ga TargetHttpsProxies.
|
||||||
func (mock *MockGCE) TargetHttpsProxies() TargetHttpsProxies {
|
func (mock *MockGCE) TargetHttpsProxies() TargetHttpsProxies {
|
||||||
return mock.MockTargetHttpsProxies
|
return mock.MockTargetHttpsProxies
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TargetPools returns the interface for the ga TargetPools.
|
||||||
func (mock *MockGCE) TargetPools() TargetPools {
|
func (mock *MockGCE) TargetPools() TargetPools {
|
||||||
return mock.MockTargetPools
|
return mock.MockTargetPools
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UrlMaps returns the interface for the ga UrlMaps.
|
||||||
func (mock *MockGCE) UrlMaps() UrlMaps {
|
func (mock *MockGCE) UrlMaps() UrlMaps {
|
||||||
return mock.MockUrlMaps
|
return mock.MockUrlMaps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Zones returns the interface for the ga Zones.
|
||||||
func (mock *MockGCE) Zones() Zones {
|
func (mock *MockGCE) Zones() Zones {
|
||||||
return mock.MockZones
|
return mock.MockZones
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,8 @@ import (
|
|||||||
"text/template"
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/cloudprovider/providers/gce/cloud/meta"
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
|
"k8s.io/kubernetes/pkg/cloudprovider/providers/gce/cloud/meta"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -167,6 +167,7 @@ type GCE struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{{range .All}}
|
{{range .All}}
|
||||||
|
// {{.WrapType}} returns the interface for the {{.Version}} {{.Service}}.
|
||||||
func (gce *GCE) {{.WrapType}}() {{.WrapType}} {
|
func (gce *GCE) {{.WrapType}}() {{.WrapType}} {
|
||||||
return gce.{{.Field}}
|
return gce.{{.Field}}
|
||||||
}
|
}
|
||||||
@ -196,6 +197,7 @@ type MockGCE struct {
|
|||||||
{{- end}}
|
{{- end}}
|
||||||
}
|
}
|
||||||
{{range .All}}
|
{{range .All}}
|
||||||
|
// {{.WrapType}} returns the interface for the {{.Version}} {{.Service}}.
|
||||||
func (mock *MockGCE) {{.WrapType}}() {{.WrapType}} {
|
func (mock *MockGCE) {{.WrapType}}() {{.WrapType}} {
|
||||||
return mock.{{.MockField}}
|
return mock.{{.MockField}}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ func newMethod(s *ServiceInfo, m reflect.Method) *Method {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method is used to generate the calling code non-standard methods.
|
// Method is used to generate the calling code for non-standard methods.
|
||||||
type Method struct {
|
type Method struct {
|
||||||
*ServiceInfo
|
*ServiceInfo
|
||||||
m reflect.Method
|
m reflect.Method
|
||||||
@ -135,6 +135,7 @@ func (mr *Method) args(skip int, nameArgs bool, prefix []string) []string {
|
|||||||
return append(prefix, a...)
|
return append(prefix, a...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// init the method, preforming some rudimentary static checking.
|
||||||
func (mr *Method) init() {
|
func (mr *Method) init() {
|
||||||
fType := mr.m.Func.Type()
|
fType := mr.m.Func.Type()
|
||||||
if fType.NumIn() < mr.argsSkip() {
|
if fType.NumIn() < mr.argsSkip() {
|
||||||
@ -189,10 +190,14 @@ func (mr *Method) init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Name is the name of the method.
|
||||||
func (mr *Method) Name() string {
|
func (mr *Method) Name() string {
|
||||||
return mr.m.Name
|
return mr.m.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CallArgs is a list of comma separated "argN" used for calling the method.
|
||||||
|
// For example, if the method has two additional arguments, this will return
|
||||||
|
// "arg0, arg1".
|
||||||
func (mr *Method) CallArgs() string {
|
func (mr *Method) CallArgs() string {
|
||||||
var args []string
|
var args []string
|
||||||
for i := mr.argsSkip(); i < mr.m.Func.Type().NumIn(); i++ {
|
for i := mr.argsSkip(); i < mr.m.Func.Type().NumIn(); i++ {
|
||||||
@ -204,10 +209,12 @@ func (mr *Method) CallArgs() string {
|
|||||||
return fmt.Sprintf(", %s", strings.Join(args, ", "))
|
return fmt.Sprintf(", %s", strings.Join(args, ", "))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MockHookName is the name of the hook function in the mock.
|
||||||
func (mr *Method) MockHookName() string {
|
func (mr *Method) MockHookName() string {
|
||||||
return mr.m.Name + "Hook"
|
return mr.m.Name + "Hook"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MockHook is the definition of the hook function.
|
||||||
func (mr *Method) MockHook() string {
|
func (mr *Method) MockHook() string {
|
||||||
args := mr.args(mr.argsSkip(), false, []string{
|
args := mr.args(mr.argsSkip(), false, []string{
|
||||||
fmt.Sprintf("*%s", mr.MockWrapType()),
|
fmt.Sprintf("*%s", mr.MockWrapType()),
|
||||||
@ -220,6 +227,7 @@ func (mr *Method) MockHook() string {
|
|||||||
return fmt.Sprintf("%v func(%v) (*%v.%v, error)", mr.MockHookName(), strings.Join(args, ", "), mr.Version(), mr.ReturnType)
|
return fmt.Sprintf("%v func(%v) (*%v.%v, error)", mr.MockHookName(), strings.Join(args, ", "), mr.Version(), mr.ReturnType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FcnArgs is the function signature for the definition of the method.
|
||||||
func (mr *Method) FcnArgs() string {
|
func (mr *Method) FcnArgs() string {
|
||||||
args := mr.args(mr.argsSkip(), true, []string{
|
args := mr.args(mr.argsSkip(), true, []string{
|
||||||
"ctx context.Context",
|
"ctx context.Context",
|
||||||
@ -232,6 +240,7 @@ func (mr *Method) FcnArgs() string {
|
|||||||
return fmt.Sprintf("%v(%v) (*%v.%v, error)", mr.m.Name, strings.Join(args, ", "), mr.Version(), mr.ReturnType)
|
return fmt.Sprintf("%v(%v) (*%v.%v, error)", mr.m.Name, strings.Join(args, ", "), mr.Version(), mr.ReturnType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InterfaceFunc is the function declaration of the method in the interface.
|
||||||
func (mr *Method) InterfaceFunc() string {
|
func (mr *Method) InterfaceFunc() string {
|
||||||
args := mr.args(mr.argsSkip(), false, []string{"context.Context", "meta.Key"})
|
args := mr.args(mr.argsSkip(), false, []string{"context.Context", "meta.Key"})
|
||||||
if mr.ReturnType == "Operation" {
|
if mr.ReturnType == "Operation" {
|
||||||
|
@ -220,6 +220,7 @@ type ServiceGroup struct {
|
|||||||
GA *ServiceInfo
|
GA *ServiceInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Service returns any ServiceInfo object belonging to the ServiceGroup.
|
||||||
func (sg *ServiceGroup) Service() string {
|
func (sg *ServiceGroup) Service() string {
|
||||||
switch {
|
switch {
|
||||||
case sg.GA != nil:
|
case sg.GA != nil:
|
||||||
@ -233,14 +234,17 @@ func (sg *ServiceGroup) Service() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HasGA returns true if this object has a GA representation.
|
||||||
func (sg *ServiceGroup) HasGA() bool {
|
func (sg *ServiceGroup) HasGA() bool {
|
||||||
return sg.GA != nil
|
return sg.GA != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HasAlpha returns true if this object has a Alpha representation.
|
||||||
func (sg *ServiceGroup) HasAlpha() bool {
|
func (sg *ServiceGroup) HasAlpha() bool {
|
||||||
return sg.Alpha != nil
|
return sg.Alpha != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HasBeta returns true if this object has a Beta representation.
|
||||||
func (sg *ServiceGroup) HasBeta() bool {
|
func (sg *ServiceGroup) HasBeta() bool {
|
||||||
return sg.Beta != nil
|
return sg.Beta != nil
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ type SingleProjectRouter struct {
|
|||||||
ID string
|
ID string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ProjectID returns the project ID to be used for a call to the API.
|
||||||
func (r *SingleProjectRouter) ProjectID(ctx context.Context, version meta.Version, service string) string {
|
func (r *SingleProjectRouter) ProjectID(ctx context.Context, version meta.Version, service string) string {
|
||||||
return r.ID
|
return r.ID
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@ type RateLimiter interface {
|
|||||||
type NopRateLimiter struct {
|
type NopRateLimiter struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Accept the operation to be rate limited.
|
||||||
func (*NopRateLimiter) Accept(ctx context.Context, key *RateLimitKey) error {
|
func (*NopRateLimiter) Accept(ctx context.Context, key *RateLimitKey) error {
|
||||||
// Rate limit polling of the Operation status to avoid hammering GCE
|
// Rate limit polling of the Operation status to avoid hammering GCE
|
||||||
// for the status of an operation.
|
// for the status of an operation.
|
||||||
|
Loading…
Reference in New Issue
Block a user