Skip to content

Commit

Permalink
Fix change for klog v2
Browse files Browse the repository at this point in the history
V(x).Enabled() instead of a raw V(x)

Signed-off-by: Davanum Srinivas <[email protected]>
  • Loading branch information
bowei authored and dims committed Apr 15, 2020
1 parent 531e910 commit 5bc0e11
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
12 changes: 6 additions & 6 deletions pkg/cloud/gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,9 @@ func (g *{{.GCEWrapType}}) List(ctx context.Context, zone string, fl *filter.F)
return nil, err
}
if klog.V(4) {
if klog.V(4).Enabled() {
klog.V(4).Infof("{{.GCEWrapType}}.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil)
} else if klog.V(5) {
} else if klog.V(5).Enabled() {
var asStr []string
for _, o := range all {
asStr = append(asStr, fmt.Sprintf("%+v", o))
Expand Down Expand Up @@ -876,9 +876,9 @@ func (g *{{.GCEWrapType}}) AggregatedList(ctx context.Context, fl *filter.F) (ma
klog.V(4).Infof("{{.GCEWrapType}}.AggregatedList(%v, %v) = %v, %v", ctx, fl, nil, err)
return nil, err
}
if klog.V(4) {
if klog.V(4).Enabled() {
klog.V(4).Infof("{{.GCEWrapType}}.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(all), nil)
} else if klog.V(5) {
} else if klog.V(5).Enabled() {
var asStr []string
for _, o := range all {
asStr = append(asStr, fmt.Sprintf("%+v", o))
Expand Down Expand Up @@ -957,9 +957,9 @@ func (g *{{.GCEWrapType}}) {{.FcnArgs}} {
klog.V(4).Infof("{{.GCEWrapType}}.{{.Name}}(%v, %v, ...) = %v, %v", ctx, key, nil, err)
return nil, err
}
if klog.V(4) {
if klog.V(4).Enabled() {
klog.V(4).Infof("{{.GCEWrapType}}.{{.Name}}(%v, %v, ...) = [%v items], %v", ctx, key, len(all), nil)
} else if klog.V(5) {
} else if klog.V(5).Enabled() {
var asStr []string
for _, o := range all {
asStr = append(asStr, fmt.Sprintf("%+v", o))
Expand Down
24 changes: 23 additions & 1 deletion pkg/cloud/meta/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,28 @@ var AllServices = []*ServiceInfo{
"Resize",
},
},
{
Object: "Firewall",
Service: "Firewalls",
Resource: "firewalls",
version: VersionAlpha,
keyType: Global,
serviceType: reflect.TypeOf(&alpha.FirewallsService{}),
additionalMethods: []string{
"Update",
},
},
{
Object: "Firewall",
Service: "Firewalls",
Resource: "firewalls",
version: VersionBeta,
keyType: Global,
serviceType: reflect.TypeOf(&beta.FirewallsService{}),
additionalMethods: []string{
"Update",
},
},
{
Object: "Firewall",
Service: "Firewalls",
Expand Down Expand Up @@ -566,7 +588,7 @@ var AllServices = []*ServiceInfo{
Resource: "sslPolicies",
keyType: Global,
serviceType: reflect.TypeOf(&ga.SslPoliciesService{}),
options: NoList, // List() naming convention is different in GCE API for this resource
options: NoList, // List() naming convention is different in GCE API for this resource
},
{
Object: "Subnetwork",
Expand Down

0 comments on commit 5bc0e11

Please sign in to comment.