你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

DataDisk 类

与池中的计算节点关联的数据磁盘将使用的设置。 使用附加的数据磁盘时,需要从 VM 中装载和格式化磁盘,才能使用它们。

必须填充所有必需的参数才能发送到 Azure。

继承
DataDisk

构造函数

DataDisk(*, lun: int, disk_size_gb: int, caching=None, storage_account_type=None, **kwargs)

参数

lun
int
必需

必需。 逻辑单元号。 lun 用于唯一标识每个数据磁盘。 如果附加多个磁盘,则每个磁盘应具有不同的 lun。 该值必须介于 0 和 63 之间(包括 0 到 63)。

caching
strCachingType
必需

要为数据磁盘启用的缓存类型。 缓存的默认值为 readwrite。 有关缓存选项的信息,请参阅: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/。 可能的值包括:“none”、“readOnly”、“readWrite”

disk_size_gb
int
必需

必需。 初始磁盘大小(以 GB 为单位)。

storage_account_type
strStorageAccountType
必需

要用于数据磁盘的存储帐户类型。 如果省略,则默认值为“standard_lrs”。 可能的值包括:“StandardLRS”、“PremiumLRS”

方法

as_dict

使用 json.dump 返回可以是 JSONify 的 dict。

高级用法可以选择使用回调作为参数:

Key 是 Python 中使用的属性名称。 Attr_desc是元数据的一个听写。 当前包含具有 msrest 类型的“type”和包含 RestAPI 编码密钥的“key”。 Value 是此 对象中的当前值。

返回的字符串将用于序列化密钥。 如果返回类型是列表,则这被视为分层结果 dict。

请参阅此文件中的三个示例:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

如果需要 XML 序列化,可以传递 kwargs is_xml=True。

deserialize

使用 RestAPI 语法分析 str 并返回模型。

enable_additional_properties_sending
from_dict

使用给定的键提取程序分析 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 的 dict。

高级用法可以选择使用回调作为参数:

Key 是 Python 中使用的属性名称。 Attr_desc是元数据的一个听写。 当前包含具有 msrest 类型的“type”和包含 RestAPI 编码密钥的“key”。 Value 是此 对象中的当前值。

返回的字符串将用于序列化密钥。 如果返回类型是列表,则这被视为分层结果 dict。

请参阅此文件中的三个示例:

  • 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

返回

与 dict 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

使用给定的键提取程序分析 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 结构的 dict

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

如果要序列化只读属性

返回

与 dict JSON 兼容的对象

返回类型

validate

以递归方式验证此模型,并返回 ValidationError 列表。

validate()

返回

验证错误列表

返回类型