Partager via


RepairTask Class

Represents a repair task, which includes information about what kind of repair was requested, what its progress is, and what its final result was. This type supports the Service Fabric platform; it is not meant to be used directly from your code.

All required parameters must be populated in order to send to Azure.

Constructor

RepairTask(*, task_id: str, state, action: str, version: str = None, description: str = None, flags: int = None, target=None, executor: str = None, executor_data: str = None, impact=None, result_status=None, result_code: int = None, result_details: str = None, history=None, preparing_health_check_state=None, restoring_health_check_state=None, perform_preparing_health_check: bool = None, perform_restoring_health_check: bool = None, **kwargs)

Parameters

Name Description
task_id
Required
str

Required. The ID of the repair task.

version
Required
str

The version of the repair task. When creating a new repair task, the version must be set to zero. When updating a repair task, the version is used for optimistic concurrency checks. If the version is set to zero, the update will not check for write conflicts. If the version is set to a non-zero value, then the update will only succeed if the actual current version of the repair task matches this value.

description
Required
str

A description of the purpose of the repair task, or other informational details. May be set when the repair task is created, and is immutable once set.

state
Required
str or State

Required. The workflow state of the repair task. Valid initial states are Created, Claimed, and Preparing. Possible values include: 'Invalid', 'Created', 'Claimed', 'Preparing', 'Approved', 'Executing', 'Restoring', 'Completed'

flags
Required
int

A bitwise-OR of the following values, which gives additional details about the status of the repair task.

  • 1 - Cancellation of the repair has been requested
  • 2 - Abort of the repair has been requested
  • 4 - Approval of the repair was forced via client request
action
Required
str

Required. The requested repair action. Must be specified when the repair task is created, and is immutable once set.

target
Required

The target object determines what actions the system will take to prepare for the impact of the repair, prior to approving execution of the repair. May be set when the repair task is created, and is immutable once set.

executor
Required
str

The name of the repair executor. Must be specified in Claimed and later states, and is immutable once set.

executor_data
Required
str

A data string that the repair executor can use to store its internal state.

impact
Required

The impact object determines what actions the system will take to prepare for the impact of the repair, prior to approving execution of the repair. Impact must be specified by the repair executor when transitioning to the Preparing state, and is immutable once set.

result_status
Required

A value describing the overall result of the repair task execution. Must be specified in the Restoring and later states, and is immutable once set. Possible values include: 'Invalid', 'Succeeded', 'Cancelled', 'Interrupted', 'Failed', 'Pending'

result_code
Required
int

A numeric value providing additional details about the result of the repair task execution. May be specified in the Restoring and later states, and is immutable once set.

result_details
Required
str

A string providing additional details about the result of the repair task execution. May be specified in the Restoring and later states, and is immutable once set.

history
Required

An object that contains timestamps of the repair task's state transitions. These timestamps are updated by the system, and cannot be directly modified.

preparing_health_check_state
Required

The workflow state of the health check when the repair task is in the Preparing state. Possible values include: 'NotStarted', 'InProgress', 'Succeeded', 'Skipped', 'TimedOut'

restoring_health_check_state
Required

The workflow state of the health check when the repair task is in the Restoring state. Possible values include: 'NotStarted', 'InProgress', 'Succeeded', 'Skipped', 'TimedOut'

perform_preparing_health_check
Required

A value to determine if health checks will be performed when the repair task enters the Preparing state.

perform_restoring_health_check
Required

A value to determine if health checks will be performed when the repair task enters the Restoring state.

Keyword-Only Parameters

Name Description
task_id
Required
state
Required
action
Required
version
Default value: None
description
Default value: None
flags
Default value: None
target
Default value: None
executor
Default value: None
executor_data
Default value: None
impact
Default value: None
result_status
Default value: None
result_code
Default value: None
result_details
Default value: None
history
Default value: None
preparing_health_check_state
Default value: None
restoring_health_check_state
Default value: None
perform_preparing_health_check
Default value: None
perform_restoring_health_check
Default value: None

Methods

as_dict

Return a dict that can be JSONify using json.dump.

Advanced usage might optionally use a callback as parameter:

Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains 'type' with the msrest type and 'key' with the RestAPI encoded key. Value is the current value in this object.

The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.

See the three examples in this file:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

If you want XML serialization, you can pass the kwargs is_xml=True.

deserialize

Parse a str using the RestAPI syntax and return a model.

enable_additional_properties_sending
from_dict

Parse a dict using given key extractor return a model.

By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)

is_xml_model
serialize

Return the JSON that would be sent to azure from this model.

This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).

If you want XML serialization, you can pass the kwargs is_xml=True.

validate

Validate this model recursively and return a list of ValidationError.

as_dict

Return a dict that can be JSONify using json.dump.

Advanced usage might optionally use a callback as parameter:

Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains 'type' with the msrest type and 'key' with the RestAPI encoded key. Value is the current value in this object.

The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.

See the three examples in this file:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

If you want XML serialization, you can pass the kwargs is_xml=True.

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

Parameters

Name Description
key_transformer
<xref:function>

A key transformer function.

keep_readonly
Default value: True

Returns

Type Description

A dict JSON compatible object

deserialize

Parse a str using the RestAPI syntax and return a model.

deserialize(data, content_type=None)

Parameters

Name Description
data
Required
str

A str using RestAPI structure. JSON by default.

content_type
str

JSON by default, set application/xml if XML.

Default value: None

Returns

Type Description

An instance of this model

Exceptions

Type Description
DeserializationError if something went wrong

enable_additional_properties_sending

enable_additional_properties_sending()

from_dict

Parse a dict using given key extractor return a model.

By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)

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

Parameters

Name Description
data
Required

A dict using RestAPI structure

content_type
str

JSON by default, set application/xml if XML.

Default value: None
key_extractors
Default value: None

Returns

Type Description

An instance of this model

Exceptions

Type Description
DeserializationError if something went wrong

is_xml_model

is_xml_model()

serialize

Return the JSON that would be sent to azure from this model.

This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).

If you want XML serialization, you can pass the kwargs is_xml=True.

serialize(keep_readonly=False, **kwargs)

Parameters

Name Description
keep_readonly

If you want to serialize the readonly attributes

Default value: False

Returns

Type Description

A dict JSON compatible object

validate

Validate this model recursively and return a list of ValidationError.

validate()

Returns

Type Description

A list of validation error