VirtualMachineConfiguration 類別

以 Azure 虛擬機器基礎結構為基礎的集區中計算節點的組態。

必須填入所有必要的參數,才能傳送至 Azure。

繼承
VirtualMachineConfiguration

建構函式

VirtualMachineConfiguration(*, image_reference, node_agent_sku_id: str, windows_configuration=None, data_disks=None, license_type: str = None, container_configuration=None, disk_encryption_configuration=None, node_placement_configuration=None, extensions=None, os_disk=None, **kwargs)

參數

image_reference
ImageReference
必要

必要。 Azure 虛擬機器 Marketplace 映射或要使用的自訂虛擬機器映射參考。

node_agent_sku_id
str
必要

必要。 Batch 計算節點代理程式是在集區中的每個計算節點上執行的程式,並提供計算節點與 Batch 服務之間的命令與控制介面。 針對不同的作業系統,計算節點代理程式有不同的實作,稱為 SKU。 您必須指定符合所選映射參考的計算節點代理程式 SKU。 To get the list of supported Compute Node agent SKUs along with their list of verified Image references, see the 'List supported Compute Node agent SKUs' operation.

windows_configuration
WindowsConfiguration
必要

虛擬機器上的 Windows 作業系統設定。 如果 imageReference 屬性指定 Linux OS 映射,則不得指定這個屬性。

data_disks
list[DataDisk]
必要

如果集區中的計算節點必須連結空的資料磁片,則必須指定這個屬性。 這無法更新。 每個計算節點都會在磁片不是檔案共用) (取得自己的磁片。 無法連結現有的磁片,每個連結的磁片都是空的。 從集區中移除計算節點時,也會刪除磁片及其相關聯的所有資料。 磁片在連接之後未格式化,必須先格式化再使用 - 如需詳細資訊,請參閱 https://docs.microsoft.com/en-us/azure/virtual-machines/linux/classic/attach-disk#initialize-a-new-data-disk-in-linuxhttps://docs.microsoft.com/en-us/azure/virtual-machines/windows/attach-disk-ps#add-an-empty-data-disk-to-a-virtual-machine

license_type
str
必要

這只適用于包含 Windows 作業系統的映射,而且只有在您保留將部署之計算節點的有效內部部署授權時才使用。 如果省略,則不會套用任何內部部署授權折扣。 值為:Windows_Server - 內部部署授權適用于 Windows Server。 Windows_Client - 內部部署授權適用于 Windows 用戶端。

container_configuration
ContainerConfiguration
必要

集區的容器組態。 如果指定,則會在集區中的每個計算節點上執行安裝程式,以允許工作在容器中執行。 此集區上執行的所有一般工作和作業管理員工作都必須指定 containerSettings 屬性,而所有其他工作都可以指定它。

disk_encryption_configuration
DiskEncryptionConfiguration
必要

集區的磁片加密組態。 如果指定,則會在節點布建期間,在集區中的每個節點上執行加密。

node_placement_configuration
NodePlacementConfiguration
必要

集區的節點放置組態。 此設定會指定集區中節點實際配置方式的規則。

extensions
list[VMExtension]
必要

如果指定,此組態中所述的擴充功能將會安裝在每個節點上。

os_disk
OSDisk
必要

虛擬機器作業系統磁片的設定。

方法

as_dict

使用 json.dump 傳回可以是 JSONify 的聽寫。

進階用法可以選擇性地使用回呼作為參數:

索引鍵是 Python 中使用的屬性名稱。 Attr_desc是中繼資料的聽寫。 目前包含具有 msrest 類型的 'type',以及具有 RestAPI 編碼金鑰的 'key'。 Value 是這個 物件中的目前值。

傳回的字串將用來序列化索引鍵。 如果傳回類型是清單,則會將此視為階層式結果聽寫。

請參閱此檔案中的三個範例:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

如果您想要 XML 序列化,您可以傳遞 kwargs is_xml=True。

deserialize

使用 RestAPI 語法剖析 str 並傳回模型。

enable_additional_properties_sending
from_dict

使用指定的索引鍵擷取器剖析聽寫會傳回模型。

根據預設,請考慮金鑰擷取器 (rest_key_case_insensitive_extractor、attribute_key_case_insensitive_extractor和last_rest_key_case_insensitive_extractor)

is_xml_model
serialize

傳回會從此模型傳送至 Azure 的 JSON。

這是as_dict (full_restapi_key_transformer的別名 ,keep_readonly=False)

如果您想要 XML 序列化,您可以傳遞 kwargs is_xml=True。

validate

以遞迴方式驗證此模型,並傳回 ValidationError 的清單。

as_dict

使用 json.dump 傳回可以是 JSONify 的聽寫。

進階用法可以選擇性地使用回呼作為參數:

索引鍵是 Python 中使用的屬性名稱。 Attr_desc是中繼資料的聽寫。 目前包含具有 msrest 類型的 'type',以及具有 RestAPI 編碼金鑰的 'key'。 Value 是這個 物件中的目前值。

傳回的字串將用來序列化索引鍵。 如果傳回類型是清單,則會將此視為階層式結果聽寫。

請參閱此檔案中的三個範例:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

如果您想要 XML 序列化,您可以傳遞 kwargs is_xml=True。

as_dict(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)

參數

key_transformer
<xref:function>

按鍵轉換程式函式。

keep_readonly
預設值: True

傳回

聽寫 JSON 相容物件

傳回類型

deserialize

使用 RestAPI 語法剖析 str 並傳回模型。

deserialize(data, content_type=None)

參數

data
str
必要

使用 RestAPI 結構的 str。 根據預設,JSON。

content_type
str
預設值: None

根據預設,如果 XML,請設定 application/xml。

傳回

此模型的實例

例外狀況

DeserializationError if something went wrong

enable_additional_properties_sending

enable_additional_properties_sending()

from_dict

使用指定的索引鍵擷取器剖析聽寫會傳回模型。

根據預設,請考慮金鑰擷取器 (rest_key_case_insensitive_extractor、attribute_key_case_insensitive_extractor和last_rest_key_case_insensitive_extractor)

from_dict(data, key_extractors=None, content_type=None)

參數

data
dict
必要

使用 RestAPI 結構的聽寫

content_type
str
預設值: None

根據預設,如果 XML,請設定 application/xml。

key_extractors
預設值: None

傳回

此模型的實例

例外狀況

DeserializationError if something went wrong

is_xml_model

is_xml_model()

serialize

傳回會從此模型傳送至 Azure 的 JSON。

這是as_dict (full_restapi_key_transformer的別名 ,keep_readonly=False)

如果您想要 XML 序列化,您可以傳遞 kwargs is_xml=True。

serialize(keep_readonly=False, **kwargs)

參數

keep_readonly
bool
預設值: False

如果您想要序列化唯讀屬性

傳回

聽寫 JSON 相容物件

傳回類型

validate

以遞迴方式驗證此模型,並傳回 ValidationError 的清單。

validate()

傳回

驗證錯誤清單

傳回類型