forked from hashicorp/terraform-provider-google
-
Notifications
You must be signed in to change notification settings - Fork 0
/
disk_type.go
26 lines (23 loc) · 860 Bytes
/
disk_type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package google
import (
computeBeta "google.golang.org/api/compute/v0.beta"
"google.golang.org/api/compute/v1"
)
// readDiskType finds the disk type with the given name.
func readDiskType(c *Config, zone *compute.Zone, project, name string) (*compute.DiskType, error) {
diskType, err := c.clientCompute.DiskTypes.Get(project, zone.Name, name).Do()
if err == nil && diskType != nil && diskType.SelfLink != "" {
return diskType, nil
} else {
return nil, err
}
}
// readRegionDiskType finds the disk type with the given name.
func readRegionDiskType(c *Config, region *compute.Region, project, name string) (*computeBeta.DiskType, error) {
diskType, err := c.clientComputeBeta.RegionDiskTypes.Get(project, region.Name, name).Do()
if err == nil && diskType != nil && diskType.SelfLink != "" {
return diskType, nil
} else {
return nil, err
}
}