Class: Google::Cloud::Dns::Change
- Inherits:
-
Object
- Object
- Google::Cloud::Dns::Change
- Defined in:
- lib/google/cloud/dns/change.rb,
lib/google/cloud/dns/change/list.rb
Overview
DNS Change
Represents a request containing additions or deletions or records. Additions and deletions can be done in bulk, in a single atomic transaction, and take effect at the same time in each authoritative DNS server.
Defined Under Namespace
Classes: List
Instance Method Summary collapse
-
#additions ⇒ Object
The records added in this change request.
-
#deletions ⇒ Object
The records removed in this change request.
-
#done? ⇒ Boolean
Checks if the status is
"done"
. -
#id ⇒ Object
Unique identifier for the resource; defined by the server.
-
#pending? ⇒ Boolean
Checks if the status is
"pending"
. -
#reload! ⇒ Object
(also: #refresh!)
Reloads the change with updated status from the DNS service.
-
#started_at ⇒ Object
The time that this operation was started by the server.
-
#status ⇒ Object
Status of the operation.
-
#wait_until_done! ⇒ Object
Refreshes the change until the status is
done
.
Instance Method Details
#additions ⇒ Object
The records added in this change request.
67 68 69 |
# File 'lib/google/cloud/dns/change.rb', line 67 def additions Array(@gapi.additions).map { |gapi| Record.from_gapi gapi } end |
#deletions ⇒ Object
The records removed in this change request.
74 75 76 |
# File 'lib/google/cloud/dns/change.rb', line 74 def deletions Array(@gapi.deletions).map { |gapi| Record.from_gapi gapi } end |
#done? ⇒ Boolean
Checks if the status is "done"
.
87 88 89 90 |
# File 'lib/google/cloud/dns/change.rb', line 87 def done? return false if status.nil? "done".casecmp(status).zero? end |
#id ⇒ Object
Unique identifier for the resource; defined by the server.
60 61 62 |
# File 'lib/google/cloud/dns/change.rb', line 60 def id @gapi.id end |
#pending? ⇒ Boolean
Checks if the status is "pending"
.
94 95 96 97 |
# File 'lib/google/cloud/dns/change.rb', line 94 def pending? return false if status.nil? "pending".casecmp(status).zero? end |
#reload! ⇒ Object Also known as: refresh!
Reloads the change with updated status from the DNS service.
110 111 112 113 |
# File 'lib/google/cloud/dns/change.rb', line 110 def reload! ensure_service! @gapi = zone.service.get_change @zone.id, id end |
#started_at ⇒ Object
The time that this operation was started by the server.
102 103 104 105 106 |
# File 'lib/google/cloud/dns/change.rb', line 102 def started_at Time.parse @gapi.start_time rescue nil end |
#status ⇒ Object
Status of the operation. Values are "done"
and "pending"
.
81 82 83 |
# File 'lib/google/cloud/dns/change.rb', line 81 def status @gapi.status end |
#wait_until_done! ⇒ Object
Refreshes the change until the status is done
.
The delay between refreshes will incrementally increase.
131 132 133 134 135 136 137 138 139 |
# File 'lib/google/cloud/dns/change.rb', line 131 def wait_until_done! backoff = ->(retries) { sleep 2 * retries + 5 } retries = 0 until done? backoff.call retries retries += 1 reload! end end |