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.



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

def initialize
  clear
end

Instance Attribute Details

#archive_formatObject

Returns the value of attribute archive_format.



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

def archive_format
  @archive_format
end

#dest_is_original_locationObject

Returns the value of attribute dest_is_original_location.



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

def dest_is_original_location
  @dest_is_original_location
end

#dest_pathObject

Returns the value of attribute dest_path.



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

def dest_path
  @dest_path
end

#exact_dest_pathsObject

Returns the value of attribute exact_dest_paths.



31
32
33
# File 'lib/comet/models/restore_job_advanced_options.rb', line 31

def exact_dest_paths
  @exact_dest_paths
end

#hostObject

Returns the value of attribute host.



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

def host
  @host
end

#office_365credentialObject

Returns the value of attribute office_365credential.



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

def office_365credential
  @office_365credential
end

#overwrite_existing_filesObject

Returns the value of attribute overwrite_existing_files.



19
20
21
# File 'lib/comet/models/restore_job_advanced_options.rb', line 19

def overwrite_existing_files
  @overwrite_existing_files
end

#overwrite_if_newerObject

Returns the value of attribute overwrite_if_newer.



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

def overwrite_if_newer
  @overwrite_if_newer
end

#passwordObject

Returns the value of attribute password.



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

def password
  @password
end

#portObject

Returns the value of attribute port.



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

def port
  @port
end

#ssl_allow_invalidObject

Returns the value of attribute ssl_allow_invalid.



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

def ssl_allow_invalid
  @ssl_allow_invalid
end

#ssl_ca_fileObject

Returns the value of attribute ssl_ca_file.



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

def ssl_ca_file
  @ssl_ca_file
end

#ssl_crt_fileObject

Returns the value of attribute ssl_crt_file.



61
62
63
# File 'lib/comet/models/restore_job_advanced_options.rb', line 61

def ssl_crt_file
  @ssl_crt_file
end

#ssl_key_fileObject

Returns the value of attribute ssl_key_file.



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

def ssl_key_file
  @ssl_key_file
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

#unknown_json_fieldsObject

Returns the value of attribute unknown_json_fields.



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

def unknown_json_fields
  @unknown_json_fields
end

#use_sslObject

Returns the value of attribute use_ssl.



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

def use_ssl
  @use_ssl
end

#usernameObject

Returns the value of attribute username.



40
41
42
# File 'lib/comet/models/restore_job_advanced_options.rb', line 40

def username
  @username
end

Instance Method Details

#clearObject



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/comet/models/restore_job_advanced_options.rb', line 73

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 = ''
  @unknown_json_fields = {}
end

#from_hash(obj) ⇒ Object

Parameters:

  • obj (Hash)

    The complete object as a Ruby hash

Raises:

  • (TypeError)


97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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
# File 'lib/comet/models/restore_job_advanced_options.rb', line 97

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 '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
    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)


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

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



201
202
203
# File 'lib/comet/models/restore_job_advanced_options.rb', line 201

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



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
# File 'lib/comet/models/restore_job_advanced_options.rb', line 173

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



206
207
208
# File 'lib/comet/models/restore_job_advanced_options.rb', line 206

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