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.



113
114
115
# File 'lib/comet/models/restore_job_advanced_options.rb', line 113

def initialize
  clear
end

Instance Attribute Details

#archive_formatObject

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



51
52
53
# File 'lib/comet/models/restore_job_advanced_options.rb', line 51

def archive_format
  @archive_format
end

#dest_is_original_locationObject

For RESTORETYPE_FILE. If set, DestPath must be blank



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

def dest_is_original_location
  @dest_is_original_location
end

#dest_pathObject

For RESTORETYPE_FILE or RESTORETYPE_PROCESS_xxx



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

def dest_path
  @dest_path
end

#exact_dest_pathsObject

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



46
47
48
# File 'lib/comet/models/restore_job_advanced_options.rb', line 46

def exact_dest_paths
  @exact_dest_paths
end

#hostObject

For RESTORETYPE_MYSQL



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

def host
  @host
end

#ms_sql_connectionObject

For RESTORETYPE_MSSQL.



108
109
110
# File 'lib/comet/models/restore_job_advanced_options.rb', line 108

def ms_sql_connection
  @ms_sql_connection
end

#office_365credentialObject

For RESTORETYPE_OFFICE365_CLOUD.



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

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.



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

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_force_permissionsObject

For RESTORETYPE_FILE. If set, OverwriteExistingFiles must be true. This can be set in combination with other OverwriteIf options.



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

def overwrite_force_permissions
  @overwrite_force_permissions
end

#overwrite_if_different_contentObject

For RESTORETYPE_FILE. If set, OverwriteExistingFiles must be true



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

def overwrite_if_different_content
  @overwrite_if_different_content
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



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

def password
  @password
end

#portObject

For RESTORETYPE_MYSQL



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

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.



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

def skip_unreadable_chunks
  @skip_unreadable_chunks
end

#ssl_allow_invalidObject

For RESTORETYPE_MYSQL i.e.: Self signed certs



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

def ssl_allow_invalid
  @ssl_allow_invalid
end

#ssl_ca_fileObject

For RESTORETYPE_MYSQL



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

def ssl_ca_file
  @ssl_ca_file
end

#ssl_crt_fileObject

For RESTORETYPE_MYSQL



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

def ssl_crt_file
  @ssl_crt_file
end

#ssl_key_fileObject

For RESTORETYPE_MYSQL



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

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.



111
112
113
# File 'lib/comet/models/restore_job_advanced_options.rb', line 111

def unknown_json_fields
  @unknown_json_fields
end

#use_sslObject

For RESTORETYPE_MYSQL



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

def use_ssl
  @use_ssl
end

#usernameObject

For RESTORETYPE_MYSQL



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

def username
  @username
end

Instance Method Details

#clearObject



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/comet/models/restore_job_advanced_options.rb', line 117

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)


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
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/comet/models/restore_job_advanced_options.rb', line 142

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 'OverwriteIfDifferentContent'
      @overwrite_if_different_content = v
    when 'OverwriteForcePermissions'
      @overwrite_force_permissions = 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)


135
136
137
138
139
# File 'lib/comet/models/restore_job_advanced_options.rb', line 135

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



264
265
266
# File 'lib/comet/models/restore_job_advanced_options.rb', line 264

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



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/comet/models/restore_job_advanced_options.rb', line 229

def to_hash
  ret = {}
  ret['Type'] = @type
  ret['OverwriteExistingFiles'] = @overwrite_existing_files
  ret['OverwriteIfNewer'] = @overwrite_if_newer
  ret['OverwriteIfDifferentContent'] = @overwrite_if_different_content
  ret['OverwriteForcePermissions'] = @overwrite_force_permissions
  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



269
270
271
# File 'lib/comet/models/restore_job_advanced_options.rb', line 269

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