Class: OCI::Streaming::Models::CreateGroupCursorDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/streaming/models/create_group_cursor_details.rb

Overview

Object used to create a group cursor.

Constant Summary collapse

TYPE_ENUM =
[
  TYPE_AT_TIME = 'AT_TIME'.freeze,
  TYPE_LATEST = 'LATEST'.freeze,
  TYPE_TRIM_HORIZON = 'TRIM_HORIZON'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CreateGroupCursorDetails

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :type (String)

    The value to assign to the #type property

  • :time (DateTime)

    The value to assign to the #time property

  • :group_name (String)

    The value to assign to the #group_name property

  • :instance_name (String)

    The value to assign to the #instance_name property

  • :timeout_in_ms (Integer)

    The value to assign to the #timeout_in_ms property

  • :commit_on_get (BOOLEAN)

    The value to assign to the #commit_on_get property



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
# File 'lib/oci/streaming/models/create_group_cursor_details.rb', line 83

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.type = attributes[:'type'] if attributes[:'type']

  self.time = attributes[:'time'] if attributes[:'time']

  self.group_name = attributes[:'groupName'] if attributes[:'groupName']

  raise 'You cannot provide both :groupName and :group_name' if attributes.key?(:'groupName') && attributes.key?(:'group_name')

  self.group_name = attributes[:'group_name'] if attributes[:'group_name']

  self.instance_name = attributes[:'instanceName'] if attributes[:'instanceName']

  raise 'You cannot provide both :instanceName and :instance_name' if attributes.key?(:'instanceName') && attributes.key?(:'instance_name')

  self.instance_name = attributes[:'instance_name'] if attributes[:'instance_name']

  self.timeout_in_ms = attributes[:'timeoutInMs'] if attributes[:'timeoutInMs']
  self.timeout_in_ms = 30000 if timeout_in_ms.nil? && !attributes.key?(:'timeoutInMs') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :timeoutInMs and :timeout_in_ms' if attributes.key?(:'timeoutInMs') && attributes.key?(:'timeout_in_ms')

  self.timeout_in_ms = attributes[:'timeout_in_ms'] if attributes[:'timeout_in_ms']
  self.timeout_in_ms = 30000 if timeout_in_ms.nil? && !attributes.key?(:'timeoutInMs') && !attributes.key?(:'timeout_in_ms') # rubocop:disable Style/StringLiterals

  self.commit_on_get = attributes[:'commitOnGet'] unless attributes[:'commitOnGet'].nil?
  self.commit_on_get = true if commit_on_get.nil? && !attributes.key?(:'commitOnGet') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :commitOnGet and :commit_on_get' if attributes.key?(:'commitOnGet') && attributes.key?(:'commit_on_get')

  self.commit_on_get = attributes[:'commit_on_get'] unless attributes[:'commit_on_get'].nil?
  self.commit_on_get = true if commit_on_get.nil? && !attributes.key?(:'commitOnGet') && !attributes.key?(:'commit_on_get') # rubocop:disable Style/StringLiterals
end

Instance Attribute Details

#commit_on_getBOOLEAN

When using consumer-groups, the default commit-on-get behaviour can be overriden by setting this value to false. If disabled, a consumer must manually commit their cursors.

Returns:

  • (BOOLEAN)


41
42
43
# File 'lib/oci/streaming/models/create_group_cursor_details.rb', line 41

def commit_on_get
  @commit_on_get
end

#group_nameString

[Required] Name of the consumer group.

Returns:

  • (String)


27
28
29
# File 'lib/oci/streaming/models/create_group_cursor_details.rb', line 27

def group_name
  @group_name
end

#instance_nameString

A unique identifier for the instance joining the consumer group. If an instanceName is not provided, a UUID will be generated and used.

Returns:

  • (String)


31
32
33
# File 'lib/oci/streaming/models/create_group_cursor_details.rb', line 31

def instance_name
  @instance_name
end

#timeDateTime

The time to consume from if type is AT_TIME.

Returns:

  • (DateTime)


23
24
25
# File 'lib/oci/streaming/models/create_group_cursor_details.rb', line 23

def time
  @time
end

#timeout_in_msInteger

The amount of a consumer instance inactivity time, before partition reservations are released.

Returns:

  • (Integer)


35
36
37
# File 'lib/oci/streaming/models/create_group_cursor_details.rb', line 35

def timeout_in_ms
  @timeout_in_ms
end

#typeString

[Required] The type of the cursor. This value is only used when the group is created.

Returns:

  • (String)


19
20
21
# File 'lib/oci/streaming/models/create_group_cursor_details.rb', line 19

def type
  @type
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/oci/streaming/models/create_group_cursor_details.rb', line 44

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'type': :'type',
    'time': :'time',
    'group_name': :'groupName',
    'instance_name': :'instanceName',
    'timeout_in_ms': :'timeoutInMs',
    'commit_on_get': :'commitOnGet'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/oci/streaming/models/create_group_cursor_details.rb', line 58

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'type': :'String',
    'time': :'DateTime',
    'group_name': :'String',
    'instance_name': :'String',
    'timeout_in_ms': :'Integer',
    'commit_on_get': :'BOOLEAN'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



137
138
139
140
141
142
143
144
145
146
147
# File 'lib/oci/streaming/models/create_group_cursor_details.rb', line 137

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    type == other.type &&
    time == other.time &&
    group_name == other.group_name &&
    instance_name == other.instance_name &&
    timeout_in_ms == other.timeout_in_ms &&
    commit_on_get == other.commit_on_get
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/oci/streaming/models/create_group_cursor_details.rb', line 172

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


152
153
154
# File 'lib/oci/streaming/models/create_group_cursor_details.rb', line 152

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



161
162
163
# File 'lib/oci/streaming/models/create_group_cursor_details.rb', line 161

def hash
  [type, time, group_name, instance_name, timeout_in_ms, commit_on_get].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



205
206
207
208
209
210
211
212
213
214
# File 'lib/oci/streaming/models/create_group_cursor_details.rb', line 205

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



199
200
201
# File 'lib/oci/streaming/models/create_group_cursor_details.rb', line 199

def to_s
  to_hash.to_s
end