Class: MsRestAzure::AsyncOperationStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/ms_rest_azure/async_operation_status.rb

Overview

Defines values for AsyncOperationStatus enum.

Constant Summary collapse

IN_PROGRESS_STATUS =
"InProgress"
SUCCESS_STATUS =
"Succeeded"
FAILED_STATUS =
"Failed"
CANCELED_STATUS =
"Canceled"
ALL_STATUSES =
[FAILED_STATUS, CANCELED_STATUS, SUCCESS_STATUS, IN_PROGRESS_STATUS]
FAILED_STATUSES =
[FAILED_STATUS, CANCELED_STATUS]
TERMINAL_STATUSES =
[FAILED_STATUS, CANCELED_STATUS, SUCCESS_STATUS]
DEFAULT_DELAY =
30

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#errorMsRestAzure::CloudErrorData

Returns error information about async operation.

Returns:



25
26
27
# File 'lib/ms_rest_azure/async_operation_status.rb', line 25

def error
  @error
end

#retry_afterInteger

Returns delay in seconds which should be used for polling for result of async operation.

Returns:

  • (Integer)

    delay in seconds which should be used for polling for result of async operation.



22
23
24
# File 'lib/ms_rest_azure/async_operation_status.rb', line 22

def retry_after
  @retry_after
end

#statusStirng

Returns status of polling.

Returns:

  • (Stirng)

    status of polling.



28
29
30
# File 'lib/ms_rest_azure/async_operation_status.rb', line 28

def status
  @status
end

Class Method Details

.deserialize_object(object) ⇒ AsyncOperationStatus

Deserializes given hash into AsyncOperationStatus object.

Parameters:

  • object (Hash)

    object to deserialize.

Returns:



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/ms_rest_azure/async_operation_status.rb', line 62

def self.deserialize_object(object)
  return if object.nil?
  output_object = AsyncOperationStatus.new

  fail AzureOperationError, 'Invalid status was recieved during polling' unless ALL_STATUSES.include?(object['status'])
  output_object.status = object['status']

  output_object.error = CloudErrorData.deserialize_object(object['error'])

  output_object.retry_after = Integer(object['retryAfter']) unless object['retryAfter'].nil?

  output_object
end

.is_failed_status(status) ⇒ Boolean

Checks if given status is failed one.

Parameters:

  • status (String)

    status to verify

Returns:

  • (Boolean)

    True if given status is failed one, false otherwise.



44
45
46
# File 'lib/ms_rest_azure/async_operation_status.rb', line 44

def self.is_failed_status(status)
  FAILED_STATUSES.any? { |st| st == status }
end

.is_successful_status(status) ⇒ Boolean

Checks if given status is successful one.

Parameters:

  • status (String)

    status to verify

Returns:

  • (Boolean)

    True if given status is successful one, false otherwise.



53
54
55
# File 'lib/ms_rest_azure/async_operation_status.rb', line 53

def self.is_successful_status(status)
  return status == SUCCESS_STATUS
end

.is_terminal_status(status) ⇒ Boolean

Checks if given status is terminal one.

Parameters:

  • status (String)

    status to verify

Returns:

  • (Boolean)

    True if given status is terminal one, false otherwise.



35
36
37
# File 'lib/ms_rest_azure/async_operation_status.rb', line 35

def self.is_terminal_status(status)
  TERMINAL_STATUSES.any? { |st| st == status }
end