通过 Ruby 创建用于启动 Azure VM 的存储配置文件
Create storage profile for launching Azure VM via Ruby
我正在尝试 create/delete Azure 云中的虚拟机使用 azure-sdk-for-ruby. I'm following the example in the compute API。
有一处看不懂:
# create_storage_profile is hypothetical helper method which creates storage
# profile by means of ARM Storage SDK.
params.storage_profile = create_storage_profile
我将如何为新 VM 创建配置文件?
我已经查看了 storage API,但我没有找到任何东西。
有一个官方 sample code 用于使用 Azure SDK 为 Ruby 创建 Azure VM,您可以通过以下方式找到您想要的关于 create_storage_profile
和 create_network_profile
的代码关键字 storage_profile
、storage_account
、network_profile
和 create_vm
.
希望对您有所帮助。
诚然,RubyDocs 不是很好,但仅在 ruby storage_profile
上搜索就更有帮助了。
create_storage_profile
的 def
可以在 virtual_machines_spec.rb
中找到
def create_storage_profile
storage_profile = StorageProfile.new
storage_profile.image_reference = get_image_reference
storage = create_storage_account
os_disk = OSDisk.new
os_disk.caching = 'None'
os_disk.create_option = 'fromImage'
os_disk.name = 'Test'
virtual_hard_disk = VirtualHardDisk.new
virtual_hard_disk.uri = generate_os_vhd_uri storage.name
os_disk.vhd = virtual_hard_disk
storage_profile.os_disk = os_disk
storage_profile
end
如代码片段所述,您不一定需要它,它是一个假设的 辅助方法。它只需要一个 return 一个 StorageProfile
实例的方法。
我正在尝试 create/delete Azure 云中的虚拟机使用 azure-sdk-for-ruby. I'm following the example in the compute API。
有一处看不懂:
# create_storage_profile is hypothetical helper method which creates storage
# profile by means of ARM Storage SDK.
params.storage_profile = create_storage_profile
我将如何为新 VM 创建配置文件?
我已经查看了 storage API,但我没有找到任何东西。
有一个官方 sample code 用于使用 Azure SDK 为 Ruby 创建 Azure VM,您可以通过以下方式找到您想要的关于 create_storage_profile
和 create_network_profile
的代码关键字 storage_profile
、storage_account
、network_profile
和 create_vm
.
希望对您有所帮助。
诚然,RubyDocs 不是很好,但仅在 ruby storage_profile
上搜索就更有帮助了。
create_storage_profile
的 def
可以在 virtual_machines_spec.rb
def create_storage_profile
storage_profile = StorageProfile.new
storage_profile.image_reference = get_image_reference
storage = create_storage_account
os_disk = OSDisk.new
os_disk.caching = 'None'
os_disk.create_option = 'fromImage'
os_disk.name = 'Test'
virtual_hard_disk = VirtualHardDisk.new
virtual_hard_disk.uri = generate_os_vhd_uri storage.name
os_disk.vhd = virtual_hard_disk
storage_profile.os_disk = os_disk
storage_profile
end
如代码片段所述,您不一定需要它,它是一个假设的 辅助方法。它只需要一个 return 一个 StorageProfile
实例的方法。