Skip to content

Commit

Permalink
Fix the composite types for Get/List API.
Browse files Browse the repository at this point in the history
  • Loading branch information
prameshj committed Jan 10, 2020
1 parent 691c843 commit bef81aa
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions pkg/composite/gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ func Get{{.Name}}(gceCloud *gce.Cloud, key *meta.Key, version meta.Version) (*{{
{{- if $onlyZonalKeySupported}}
klog.V(3).Infof("Getting ga zonal {{.Name}} %v", key.Name)
gceObj, err = gceCloud.Compute().{{.GetCloudProviderName}}().Get(ctx, key)
{{- else if .IsDefaultRegionalService}}{{/* In GA, only Global<ResourceName> api exists, no Region<ResourceName> */}}
{{- else}}
switch key.Type() {
case meta.Regional:
klog.V(3).Infof("Getting ga region {{.Name}} %v", key.Name)
Expand All @@ -482,9 +482,6 @@ func Get{{.Name}}(gceCloud *gce.Cloud, key *meta.Key, version meta.Version) (*{{
klog.V(3).Infof("Getting ga {{.Name}} %v", key.Name)
gceObj, err = gceCloud.Compute().{{$globalKeyFiller}}{{.GetCloudProviderName}}().Get(ctx, key)
}
{{- else}}
klog.V(3).Infof("Getting ga {{.Name}} %v", key.Name)
gceObj, err = gceCloud.Compute().{{$globalKeyFiller}}{{.GetCloudProviderName}}().Get(ctx, key)
{{- end}} {{/* $onlyZonalKeySupported*/}}
}
if err != nil {
Expand Down Expand Up @@ -555,7 +552,7 @@ func List{{.GetCloudProviderName}}(gceCloud *gce.Cloud, key *meta.Key, version m
{{- if $onlyZonalKeySupported}}
klog.V(3).Infof("Listing ga zone{{.Name}}")
gceObjs, err = gceCloud.Compute().{{.GetCloudProviderName}}().List(ctx, key.Zone, filter.None)
{{- else if .IsDefaultRegionalService}}{{/* In GA, only Global<ResourceName> api exists, no Region<ResourceName> */}}
{{- else}}
switch key.Type() {
case meta.Regional:
klog.V(3).Infof("Listing ga region {{.Name}}")
Expand All @@ -564,9 +561,6 @@ func List{{.GetCloudProviderName}}(gceCloud *gce.Cloud, key *meta.Key, version m
klog.V(3).Infof("Listing ga {{.Name}}")
gceObjs, err = gceCloud.Compute().{{$globalKeyFiller}}{{.GetCloudProviderName}}().List(ctx, filter.None)
}
{{- else}}
klog.V(3).Infof("Listing ga {{.Name}}")
gceObjs, err = gceCloud.Compute().{{$globalKeyFiller}}{{.GetCloudProviderName}}().List(ctx, filter.None)
{{- end}} {{/* $onlyZonalKeySupported*/}}
}
if err != nil {
Expand Down

0 comments on commit bef81aa

Please sign in to comment.