@@ -131,6 +131,7 @@ type AutoscalingGceClient interface {
131
131
FetchZones (region string ) ([]string , error )
132
132
FetchAvailableCpuPlatforms () (map [string ][]string , error )
133
133
FetchAvailableDiskTypes (region string ) (map [string ][]string , error )
134
+ FetchAvailableDiskTypesInZone (zone string ) ([]string , error )
134
135
FetchReservations () ([]* gce.Reservation , error )
135
136
FetchReservationsInProject (projectId string ) ([]* gce.Reservation , error )
136
137
FetchListManagedInstancesResults (migRef GceRef ) (string , error )
@@ -782,6 +783,23 @@ func (client *autoscalingGceClientV1) FetchAvailableDiskTypes(region string) (ma
782
783
return availableDiskTypes , nil
783
784
}
784
785
786
+ // FetchAvailableDiskTypesInZone returns a list of available disk types in a given zone.
787
+ func (client * autoscalingGceClientV1 ) FetchAvailableDiskTypesInZone (zone string ) ([]string , error ) {
788
+ availableDiskTypes := []string {}
789
+
790
+ req := client .gceService .DiskTypes .List (client .projectId , zone )
791
+ if err := req .Pages (context .TODO (), func (page * gce.DiskTypeList ) error {
792
+ for _ , diskType := range page .Items {
793
+ availableDiskTypes = append (availableDiskTypes , diskType .Name )
794
+ }
795
+ return nil
796
+ }); err != nil {
797
+ return nil , err
798
+ }
799
+
800
+ return availableDiskTypes , nil
801
+ }
802
+
785
803
func (client * autoscalingGceClientV1 ) FetchMigTemplateName (migRef GceRef ) (InstanceTemplateName , error ) {
786
804
registerRequest ("instance_group_managers" , "get" )
787
805
ctx , cancel := context .WithTimeout (context .Background (), client .operationPerCallTimeout )
0 commit comments