本文整理汇总了Golang中github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume.SourceType函数的典型用法代码示例。如果您正苦于以下问题:Golang SourceType函数的具体用法?Golang SourceType怎么用?Golang SourceType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SourceType函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: resourceInstanceBlockDeviceV2
func resourceInstanceBlockDeviceV2(d *schema.ResourceData, bd map[string]interface{}) []bootfromvolume.BlockDevice {
sourceType := bootfromvolume.SourceType(bd["source_type"].(string))
bfvOpts := []bootfromvolume.BlockDevice{
bootfromvolume.BlockDevice{
UUID: bd["uuid"].(string),
SourceType: sourceType,
VolumeSize: bd["volume_size"].(int),
DestinationType: bd["destination_type"].(string),
BootIndex: bd["boot_index"].(int),
},
}
return bfvOpts
}
示例2: resourceInstanceBlockDevicesV2
func resourceInstanceBlockDevicesV2(d *schema.ResourceData, bds []interface{}) []bootfromvolume.BlockDevice {
blockDeviceOpts := make([]bootfromvolume.BlockDevice, len(bds))
for i, bd := range bds {
bdM := bd.(map[string]interface{})
sourceType := bootfromvolume.SourceType(bdM["source_type"].(string))
blockDeviceOpts[i] = bootfromvolume.BlockDevice{
UUID: bdM["uuid"].(string),
SourceType: sourceType,
VolumeSize: bdM["volume_size"].(int),
DestinationType: bdM["destination_type"].(string),
BootIndex: bdM["boot_index"].(int),
DeleteOnTermination: bdM["delete_on_termination"].(bool),
GuestFormat: bdM["guest_format"].(string),
}
}
log.Printf("[DEBUG] Block Device Options: %+v", blockDeviceOpts)
return blockDeviceOpts
}