require 'date' module HelixWebServices # Add or delete users from a group, or set the maxresults, maxscanrows, maxlocktime, and timeout limits for the members of a group. class GroupCommand # The name of the group, as entered on the command line. attr_accessor :group # The maximum number of results that members of this group can access from the service from a single command.\nThe default value is `unset`. attr_accessor :max_results # The maximum number of rows that members of this group can scan from the service from a single command.\nThe default value is `unset`. attr_accessor :max_scan_rows # The maximum length of time (in milliseconds) that any one operation can lock any database table when scanning data.\nThe default value is `unset`. attr_accessor :max_lock_time # The maximum number of files that a member of a group can open using a single command. attr_accessor :max_open_files # The duration (in seconds) of the validity of a session ticket created by p4 login.\nThe default value is 43,200 seconds (12 hours).\nTo create a ticket that does not expire, set the Timeout: field to `unlimited`. attr_accessor :timeout # The length of time (in seconds) for which passwords for users in this group remain valid.\nTo disable password aging, use a value of unset. attr_accessor :password_timeout # The LDAP configuration to use when populating the group’s user list from an LDAP query. attr_accessor :ldap_config # The LDAP query used to identify the members of the group. attr_accessor :ldap_search_query # The LDAP attribute that represents the user’s username. attr_accessor :ldap_user_attribute # Names of other Perforce groups.\n\nTo add all users in a previously defined group to the group you’re presently working with, include the group name in the Subgroups: field of the p4 group form.\nNote that user and group names occupy separate namespaces, and thus, groups and users can have the same names.\n\nEvery member of any previously defined group you list in the Subgroups: field will be a member of the group you’re now defining. attr_accessor :subgroups # Names of other Perforce users.\n\n Group owners without super access are permitted to administer this group, provided that they use the -a option.\n\n Group owners are not necessarily members of a group; if a group owner is to be a member of the group, the userid must also be added to the Users: field.\n\n The specified owner does not have to be a Perforce user.\n You might want to use an arbitrary name if the user does not yet exist, or if you have deleted the user and need a placeholder until you can assign the spec to a new user. attr_accessor :owners # The Perforce usernames of the group members. attr_accessor :users # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'group' => :'group', :'max_results' => :'maxResults', :'max_scan_rows' => :'maxScanRows', :'max_lock_time' => :'maxLockTime', :'max_open_files' => :'maxOpenFiles', :'timeout' => :'timeout', :'password_timeout' => :'passwordTimeout', :'ldap_config' => :'ldapConfig', :'ldap_search_query' => :'ldapSearchQuery', :'ldap_user_attribute' => :'ldapUserAttribute', :'subgroups' => :'subgroups', :'owners' => :'owners', :'users' => :'users' } end # Attribute type mapping. def self.swagger_types { :'group' => :'String', :'max_results' => :'String', :'max_scan_rows' => :'String', :'max_lock_time' => :'String', :'max_open_files' => :'String', :'timeout' => :'String', :'password_timeout' => :'String', :'ldap_config' => :'String', :'ldap_search_query' => :'String', :'ldap_user_attribute' => :'String', :'subgroups' => :'Array', :'owners' => :'Array', :'users' => :'Array' } end def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} if attributes[:'group'] self.group = attributes[:'group'] end if attributes[:'maxResults'] self.max_results = attributes[:'maxResults'] end if attributes[:'maxScanRows'] self.max_scan_rows = attributes[:'maxScanRows'] end if attributes[:'maxLockTime'] self.max_lock_time = attributes[:'maxLockTime'] end if attributes[:'maxOpenFiles'] self.max_open_files = attributes[:'maxOpenFiles'] end if attributes[:'timeout'] self.timeout = attributes[:'timeout'] end if attributes[:'passwordTimeout'] self.password_timeout = attributes[:'passwordTimeout'] end if attributes[:'ldapConfig'] self.ldap_config = attributes[:'ldapConfig'] end if attributes[:'ldapSearchQuery'] self.ldap_search_query = attributes[:'ldapSearchQuery'] end if attributes[:'ldapUserAttribute'] self.ldap_user_attribute = attributes[:'ldapUserAttribute'] end if attributes[:'subgroups'] if (value = attributes[:'subgroups']).is_a?(Array) self.subgroups = value end end if attributes[:'owners'] if (value = attributes[:'owners']).is_a?(Array) self.owners = value end end if attributes[:'users'] if (value = attributes[:'users']).is_a?(Array) self.users = value end end end # Check equality by comparing each attribute. def ==(o) return true if self.equal?(o) self.class == o.class && group == o.group && max_results == o.max_results && max_scan_rows == o.max_scan_rows && max_lock_time == o.max_lock_time && max_open_files == o.max_open_files && timeout == o.timeout && password_timeout == o.password_timeout && ldap_config == o.ldap_config && ldap_search_query == o.ldap_search_query && ldap_user_attribute == o.ldap_user_attribute && subgroups == o.subgroups && owners == o.owners && users == o.users end # @see the `==` method def eql?(o) self == o end # Calculate hash code according to all attributes. def hash [group, max_results, max_scan_rows, max_lock_time, max_open_files, timeout, password_timeout, ldap_config, ldap_search_query, ldap_user_attribute, subgroups, owners, users].hash end # build the object from hash 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 if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) else #TODO show warning in debug mode end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) else # data not found in attributes(hash), not an issue as the data can be optional end end self end def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /^(true|t|yes|y|1)$/i true else false end when /\AArray<(?.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?.+), (?.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end when :Object value else # model _model = HelixWebServices.const_get(type).new _model.build_from_hash(value) end end def to_s to_hash.to_s end # to_body is an alias to to_body (backward compatibility)) def to_body to_hash end # return the object in the form of hash def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end # Method to output non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value def _to_hash(value) if value.is_a?(Array) value.compact.map{ |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end end end