Class: OvirtSDK4::Domain

Inherits:
Identified show all
Defined in:
lib/ovirtsdk4/types.rb,
lib/ovirtsdk4/types.rb

Instance Method Summary collapse

Methods included from Type

#dig, #href, #href=

Constructor Details

#initialize(opts = {}) ⇒ Domain

Creates a new instance of the OvirtSDK4::Domain class.

Parameters:

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

    A hash containing the attributes of the object. The keys of the hash should be symbols corresponding to the names of the attributes. The values of the hash should be the values of the attributes.

Options Hash (opts):

  • :comment (String)

    The value of attribute comment.

  • :description (String)

    The value of attribute description.

  • :groups (Array<Group>, Array<Hash>)

    The values of attribute groups.

  • :id (String)

    The value of attribute id.

  • :name (String)

    The value of attribute name.

  • :user (User, Hash)

    The value of attribute user.

  • :users (Array<User>, Array<Hash>)

    The values of attribute users.


37223
37224
37225
37226
37227
37228
# File 'lib/ovirtsdk4/types.rb', line 37223

def initialize(opts = {})
  super(opts)
  self.groups = opts[:groups]
  self.user = opts[:user]
  self.users = opts[:users]
end

Instance Method Details

#==(other) ⇒ Object

Returns true if self and other have the same attributes and values.


37233
37234
37235
37236
37237
37238
# File 'lib/ovirtsdk4/types.rb', line 37233

def ==(other)
  super &&
  @groups == other.groups &&
  @user == other.user &&
  @users == other.users
end

#commentString

Returns the value of the comment attribute.

Returns:

  • (String)

37057
37058
37059
# File 'lib/ovirtsdk4/types.rb', line 37057

def comment
  @comment
end

#comment=(value) ⇒ Object

Sets the value of the comment attribute.

Parameters:

  • value (String)

37066
37067
37068
# File 'lib/ovirtsdk4/types.rb', line 37066

def comment=(value)
  @comment = value
end

#descriptionString

Returns the value of the description attribute.

Returns:

  • (String)

37075
37076
37077
# File 'lib/ovirtsdk4/types.rb', line 37075

def description
  @description
end

#description=(value) ⇒ Object

Sets the value of the description attribute.

Parameters:

  • value (String)

37084
37085
37086
# File 'lib/ovirtsdk4/types.rb', line 37084

def description=(value)
  @description = value
end

#groupsArray<Group>

Returns the value of the groups attribute.

Returns:


37093
37094
37095
# File 'lib/ovirtsdk4/types.rb', line 37093

def groups
  @groups
end

#groups=(list) ⇒ Object

Sets the value of the groups attribute.

Parameters:


37102
37103
37104
37105
37106
37107
37108
37109
37110
37111
37112
# File 'lib/ovirtsdk4/types.rb', line 37102

def groups=(list)
  if list.class == Array
    list = List.new(list)
    list.each_with_index do |value, index|
      if value.is_a?(Hash)
        list[index] = Group.new(value)
      end
    end
  end
  @groups = list
end

#hashObject

Generates a hash value for this object.


37243
37244
37245
37246
37247
37248
# File 'lib/ovirtsdk4/types.rb', line 37243

def hash
  super +
  @groups.hash +
  @user.hash +
  @users.hash
end

#idString

Returns the value of the id attribute.

Returns:

  • (String)

37119
37120
37121
# File 'lib/ovirtsdk4/types.rb', line 37119

def id
  @id
end

#id=(value) ⇒ Object

Sets the value of the id attribute.

Parameters:

  • value (String)

37128
37129
37130
# File 'lib/ovirtsdk4/types.rb', line 37128

def id=(value)
  @id = value
end

#nameString

Returns the value of the name attribute.

Returns:

  • (String)

37137
37138
37139
# File 'lib/ovirtsdk4/types.rb', line 37137

def name
  @name
end

#name=(value) ⇒ Object

Sets the value of the name attribute.

Parameters:

  • value (String)

37146
37147
37148
# File 'lib/ovirtsdk4/types.rb', line 37146

def name=(value)
  @name = value
end

#userUser

Returns the value of the user attribute.

Returns:


37155
37156
37157
# File 'lib/ovirtsdk4/types.rb', line 37155

def user
  @user
end

#user=(value) ⇒ Object

Sets the value of the user attribute.

The value parameter can be an instance of User or a hash. If it is a hash then a new instance will be created passing the hash as the opts parameter to the constructor.

Parameters:

  • value (User, Hash)

37168
37169
37170
37171
37172
37173
# File 'lib/ovirtsdk4/types.rb', line 37168

def user=(value)
  if value.is_a?(Hash)
    value = User.new(value)
  end
  @user = value
end

#usersArray<User>

Returns the value of the users attribute.

Returns:


37180
37181
37182
# File 'lib/ovirtsdk4/types.rb', line 37180

def users
  @users
end

#users=(list) ⇒ Object

Sets the value of the users attribute.

Parameters:

  • list (Array<User>)

37189
37190
37191
37192
37193
37194
37195
37196
37197
37198
37199
# File 'lib/ovirtsdk4/types.rb', line 37189

def users=(list)
  if list.class == Array
    list = List.new(list)
    list.each_with_index do |value, index|
      if value.is_a?(Hash)
        list[index] = User.new(value)
      end
    end
  end
  @users = list
end