Operation 類別

記錄以追蹤長時間執行的作業。

繼承
Operation

建構函式

Operation(*, operation_state=None, created_timestamp: str = None, last_action_timestamp: str = None, resource_location: str = None, user_id: str = None, operation_id: str = None, error_response=None, **kwargs)

參數

operation_state
strOperationStateType
必要

作業狀態。 可能的值包括:'Failed'、'NotStarted'、'Running'、'Succeeded'

created_timestamp
str
必要

建立作業時的時間戳記。

last_action_timestamp
str
必要

輸入目前狀態時的時間戳記。

resource_location
str
必要

已完成資源的目標資源位置相對 URI。

user_id
str
必要

使用者識別碼

operation_id
str
必要

作業識別碼。

error_response
ErrorResponse
必要

發生失敗時的錯誤詳細資料。

方法

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

JSON 預設會設定 application/xml if 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

JSON 預設會設定 application/xml if 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()

傳回

驗證錯誤清單

傳回類型