Class: Comet::RestoreJobAdvancedOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/comet/models/restore_job_advanced_options.rb

Overview

RestoreJobAdvancedOptions is a typed class wrapper around the underlying Comet Server API data structure.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRestoreJobAdvancedOptions

Returns a new instance of RestoreJobAdvancedOptions.



104
105
106
# File 'lib/comet/models/restore_job_advanced_options.rb', line 104

def initialize
  clear
end

Instance Attribute Details

#archive_formatObject

For RESTORETYPE_FILE_ARCHIVE or RESTORETYPE_PROCESS_ARCHIVE. Default 0 is *.tar, for backward compatibility



42
43
44
# File 'lib/comet/models/restore_job_advanced_options.rb', line 42

def archive_format
  @archive_format
end

#dest_is_original_locationObject

For RESTORETYPE_FILE. If set, DestPath must be blank



29
30
31
# File 'lib/comet/models/restore_job_advanced_options.rb', line 29

def dest_is_original_location
  @dest_is_original_location
end

#dest_pathObject

For RESTORETYPE_FILE or RESTORETYPE_PROCESS_xxx



33
34
35
# File 'lib/comet/models/restore_job_advanced_options.rb', line 33

def dest_path
  @dest_path
end

#exact_dest_pathsObject

For RESTORETYPE_WINDISK only. Must have one entry for each selected restore path



37
38
39
# File 'lib/comet/models/restore_job_advanced_options.rb', line 37

def exact_dest_paths
  @exact_dest_paths
end

#hostObject

For RESTORETYPE_MYSQL



71
72
73
# File 'lib/comet/models/restore_job_advanced_options.rb', line 71

def host
  @host
end

#ms_sql_connectionObject

For RESTORETYPE_MSSQL.



99
100
101
# File 'lib/comet/models/restore_job_advanced_options.rb', line 99

def ms_sql_connection
  @ms_sql_connection
end

#office_365credentialObject

For RESTORETYPE_OFFICE365_CLOUD.



59
60
61
# File 'lib/comet/models/restore_job_advanced_options.rb', line 59

def office_365credential
  @office_365credential
end

#on_disk_indexes_keyObject

Default disabled. Used to store the index files on disk instead of in memory. Corresponds to the “Prefer temporary files instead of RAM (slower)” option This field is available in Comet 23.6.4 and later.



55
56
57
# File 'lib/comet/models/restore_job_advanced_options.rb', line 55

def on_disk_indexes_key
  @on_disk_indexes_key
end

#overwrite_existing_filesObject

For RESTORETYPE_FILE



21
22
23
# File 'lib/comet/models/restore_job_advanced_options.rb', line 21

def overwrite_existing_files
  @overwrite_existing_files
end

#overwrite_if_newerObject

For RESTORETYPE_FILE. If set, OverwriteExistingFiles must be true



25
26
27
# File 'lib/comet/models/restore_job_advanced_options.rb', line 25

def overwrite_if_newer
  @overwrite_if_newer
end

#passwordObject

For RESTORETYPE_MYSQL



67
68
69
# File 'lib/comet/models/restore_job_advanced_options.rb', line 67

def password
  @password
end

#portObject

For RESTORETYPE_MYSQL



75
76
77
# File 'lib/comet/models/restore_job_advanced_options.rb', line 75

def port
  @port
end

#skip_unreadable_chunksObject

Default disabled. For RESTORETYPE_FILE and RESTORETYPE_WINDISK. Used to continue the restore job when unreadable data chunks are found. Corresponds to the “Allow partial file restores (zero-out unrecoverable data)” option This field is available in Comet 23.6.4 and later.



49
50
51
# File 'lib/comet/models/restore_job_advanced_options.rb', line 49

def skip_unreadable_chunks
  @skip_unreadable_chunks
end

#ssl_allow_invalidObject

For RESTORETYPE_MYSQL i.e.: Self signed certs



83
84
85
# File 'lib/comet/models/restore_job_advanced_options.rb', line 83

def ssl_allow_invalid
  @ssl_allow_invalid
end

#ssl_ca_fileObject

For RESTORETYPE_MYSQL



87
88
89
# File 'lib/comet/models/restore_job_advanced_options.rb', line 87

def ssl_ca_file
  @ssl_ca_file
end

#ssl_crt_fileObject

For RESTORETYPE_MYSQL



91
92
93
# File 'lib/comet/models/restore_job_advanced_options.rb', line 91

def ssl_crt_file
  @ssl_crt_file
end

#ssl_key_fileObject

For RESTORETYPE_MYSQL



95
96
97
# File 'lib/comet/models/restore_job_advanced_options.rb', line 95

def ssl_key_file
  @ssl_key_file
end

#typeObject

One of the RESTORETYPE_ constants



17
18
19
# File 'lib/comet/models/restore_job_advanced_options.rb', line 17

def type
  @type
end

#unknown_json_fieldsObject

Returns the value of attribute unknown_json_fields.



102
103
104
# File 'lib/comet/models/restore_job_advanced_options.rb', line 102

def unknown_json_fields
  @unknown_json_fields
end

#use_sslObject

For RESTORETYPE_MYSQL



79
80
81
# File 'lib/comet/models/restore_job_advanced_options.rb', line 79

def use_ssl
  @use_ssl
end

#usernameObject

For RESTORETYPE_MYSQL



63
64
65
# File 'lib/comet/models/restore_job_advanced_options.rb', line 63

def username
  @username
end

Instance Method Details

#clearObject



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/comet/models/restore_job_advanced_options.rb', line 108

def clear
  @type = 0
  @dest_path = ''
  @exact_dest_paths = []
  @archive_format = 0
  @office_365credential = Comet::Office365Credential.new
  @username = ''
  @password = ''
  @host = ''
  @port = ''
  @ssl_ca_file = ''
  @ssl_crt_file = ''
  @ssl_key_file = ''
  @ms_sql_connection = Comet::MSSQLLoginArgs.new
  @unknown_json_fields = {}
end

#from_hash(obj) ⇒ Object

Parameters:

  • obj (Hash)

    The complete object as a Ruby hash

Raises:

  • (TypeError)


133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/comet/models/restore_job_advanced_options.rb', line 133

def from_hash(obj)
  raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash

  obj.each do |k, v|
    case k
    when 'Type'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @type = v
    when 'OverwriteExistingFiles'
      @overwrite_existing_files = v
    when 'OverwriteIfNewer'
      @overwrite_if_newer = v
    when 'DestIsOriginalLocation'
      @dest_is_original_location = v
    when 'DestPath'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @dest_path = v
    when 'ExactDestPaths'
      if v.nil?
        @exact_dest_paths = []
      else
        @exact_dest_paths = Array.new(v.length)
        v.each_with_index do |v1, i1|
          raise TypeError, "'v1' expected String, got #{v1.class}" unless v1.is_a? String

          @exact_dest_paths[i1] = v1
        end
      end
    when 'ArchiveFormat'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @archive_format = v
    when 'SkipUnreadableChunks'
      @skip_unreadable_chunks = v
    when 'OnDiskIndexesKey'
      @on_disk_indexes_key = v
    when 'Office365Credential'
      @office_365credential = Comet::Office365Credential.new
      @office_365credential.from_hash(v)
    when 'Username'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @username = v
    when 'Password'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @password = v
    when 'Host'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @host = v
    when 'Port'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @port = v
    when 'UseSsl'
      @use_ssl = v
    when 'SslAllowInvalid'
      @ssl_allow_invalid = v
    when 'SslCaFile'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @ssl_ca_file = v
    when 'SslCrtFile'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @ssl_crt_file = v
    when 'SslKeyFile'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @ssl_key_file = v
    when 'MsSqlConnection'
      @ms_sql_connection = Comet::MSSQLLoginArgs.new
      @ms_sql_connection.from_hash(v)
    else
      @unknown_json_fields[k] = v
    end
  end
end

#from_json(json_string) ⇒ Object

Parameters:

  • json_string (String)

    The complete object in JSON format

Raises:

  • (TypeError)


126
127
128
129
130
# File 'lib/comet/models/restore_job_advanced_options.rb', line 126

def from_json(json_string)
  raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String

  from_hash(JSON.parse(json_string))
end

#to_hHash

Returns The complete object as a Ruby hash.

Returns:

  • (Hash)

    The complete object as a Ruby hash



249
250
251
# File 'lib/comet/models/restore_job_advanced_options.rb', line 249

def to_h
  to_hash
end

#to_hashHash

Returns The complete object as a Ruby hash.

Returns:

  • (Hash)

    The complete object as a Ruby hash



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/comet/models/restore_job_advanced_options.rb', line 216

def to_hash
  ret = {}
  ret['Type'] = @type
  ret['OverwriteExistingFiles'] = @overwrite_existing_files
  ret['OverwriteIfNewer'] = @overwrite_if_newer
  ret['DestIsOriginalLocation'] = @dest_is_original_location
  ret['DestPath'] = @dest_path
  ret['ExactDestPaths'] = @exact_dest_paths
  ret['ArchiveFormat'] = @archive_format
  ret['SkipUnreadableChunks'] = @skip_unreadable_chunks
  ret['OnDiskIndexesKey'] = @on_disk_indexes_key
  unless @office_365credential.nil?
    ret['Office365Credential'] = @office_365credential
  end
  ret['Username'] = @username
  ret['Password'] = @password
  ret['Host'] = @host
  ret['Port'] = @port
  ret['UseSsl'] = @use_ssl
  ret['SslAllowInvalid'] = @ssl_allow_invalid
  ret['SslCaFile'] = @ssl_ca_file
  ret['SslCrtFile'] = @ssl_crt_file
  ret['SslKeyFile'] = @ssl_key_file
  unless @ms_sql_connection.nil?
    ret['MsSqlConnection'] = @ms_sql_connection
  end
  @unknown_json_fields.each do |k, v|
    ret[k] = v
  end
  ret
end

#to_json(options = {}) ⇒ String

Returns The complete object as a JSON string.

Returns:

  • (String)

    The complete object as a JSON string



254
255
256
# File 'lib/comet/models/restore_job_advanced_options.rb', line 254

def to_json(options = {})
  to_hash.to_json(options)
end