Class: Comet::S3DestinationLocation

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

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeS3DestinationLocation

Returns a new instance of S3DestinationLocation.



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

def initialize
  clear
end

Instance Attribute Details

#s3access_keyObject

Returns the value of attribute s3access_key.



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

def s3access_key
  @s3access_key
end

#s3bucket_nameObject

Returns the value of attribute s3bucket_name.



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

def s3bucket_name
  @s3bucket_name
end

#s3custom_regionObject

Returns the value of attribute s3custom_region.



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

def s3custom_region
  @s3custom_region
end

#s3object_lock_daysObject

Returns the value of attribute s3object_lock_days.



47
48
49
# File 'lib/comet/models/s3destination_location.rb', line 47

def s3object_lock_days
  @s3object_lock_days
end

#s3object_lock_modeObject

Returns the value of attribute s3object_lock_mode.



44
45
46
# File 'lib/comet/models/s3destination_location.rb', line 44

def s3object_lock_mode
  @s3object_lock_mode
end

#s3remove_deletedObject

Returns the value of attribute s3remove_deleted.



41
42
43
# File 'lib/comet/models/s3destination_location.rb', line 41

def s3remove_deleted
  @s3remove_deleted
end

#s3secret_keyObject

Returns the value of attribute s3secret_key.



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

def s3secret_key
  @s3secret_key
end

#s3serverObject

Returns the value of attribute s3server.



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

def s3server
  @s3server
end

#s3subdirObject

Returns the value of attribute s3subdir.



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

def s3subdir
  @s3subdir
end

#s3uses_tlsObject

Returns the value of attribute s3uses_tls.



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

def s3uses_tls
  @s3uses_tls
end

#s3uses_v2signingObject

If true, use legacy v2 signing. If false (default), use modern v4 signing



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

def s3uses_v2signing
  @s3uses_v2signing
end

#unknown_json_fieldsObject

Returns the value of attribute unknown_json_fields.



50
51
52
# File 'lib/comet/models/s3destination_location.rb', line 50

def unknown_json_fields
  @unknown_json_fields
end

Instance Method Details

#clearObject



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/comet/models/s3destination_location.rb', line 56

def clear
  @s3server = ''
  @s3access_key = ''
  @s3secret_key = ''
  @s3bucket_name = ''
  @s3subdir = ''
  @s3custom_region = ''
  @s3object_lock_mode = 0
  @s3object_lock_days = 0
  @unknown_json_fields = {}
end

#from_hash(obj) ⇒ Object

Parameters:

  • obj (Hash)

    The complete object as a Ruby hash

Raises:

  • (TypeError)


76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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
# File 'lib/comet/models/s3destination_location.rb', line 76

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 'S3Server'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @s3server = v
    when 'S3UsesTLS'
      @s3uses_tls = v
    when 'S3AccessKey'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

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

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

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

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

      @s3custom_region = v
    when 'S3UsesV2Signing'
      @s3uses_v2signing = v
    when 'S3RemoveDeleted'
      @s3remove_deleted = v
    when 'S3ObjectLockMode'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @s3object_lock_mode = v
    when 'S3ObjectLockDays'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @s3object_lock_days = 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)


69
70
71
72
73
# File 'lib/comet/models/s3destination_location.rb', line 69

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



146
147
148
# File 'lib/comet/models/s3destination_location.rb', line 146

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



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/comet/models/s3destination_location.rb', line 126

def to_hash
  ret = {}
  ret['S3Server'] = @s3server
  ret['S3UsesTLS'] = @s3uses_tls
  ret['S3AccessKey'] = @s3access_key
  ret['S3SecretKey'] = @s3secret_key
  ret['S3BucketName'] = @s3bucket_name
  ret['S3Subdir'] = @s3subdir
  ret['S3CustomRegion'] = @s3custom_region
  ret['S3UsesV2Signing'] = @s3uses_v2signing
  ret['S3RemoveDeleted'] = @s3remove_deleted
  ret['S3ObjectLockMode'] = @s3object_lock_mode
  ret['S3ObjectLockDays'] = @s3object_lock_days
  @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



151
152
153
# File 'lib/comet/models/s3destination_location.rb', line 151

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