require 'date' module HelixWebServices # The client workspace specification and its view.\n\nFor more information see the [command reference](https://www.perforce.com/perforce/doc.current/manuals/cmdref/p4_client.html). class ClientCommand # The client workspace name, as specified in the `P4CLIENT` environment variable or its equivalents. attr_accessor :client # The name of the user who owns the workspace.\nThe default is the user who created the workspace.\n\nThe specified owner does not have to be a Perforce user.\nYou 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 :owner # The time the workspace specification was last modified. attr_accessor :update # The date and time that the workspace was last used in any way.\n(Note: Reloading a workspace with p4 reload does not affect the access time.) attr_accessor :access # The name of the workstation on which this workspace resides.\nIf included, operations on this client workspace can be run only from this host.\nIf not set, access is allowed from any host.\n\nThe hostname must be provided exactly as it appears in the output of p4 info when run from that host.\n\nThis field is meant to prevent accidental misuse of client workspaces on the wrong machine.\nProviding a host name does not guarantee security, because the actual value of the host name can be overridden with the -H option to any p4 command, or with the P4HOST environment variable.\nFor a similar mechanism that does provide security, use the IP address restriction feature of p4 protect. attr_accessor :host # A textual description of the workspace. The default text is Created by owner. attr_accessor :description # The directory (on the local host) relative to which all the files in the `View:` are specified.\nThe default is the current working directory.\nThe path must be specified in local file system syntax.\n\nIf you change this setting, you must physically relocate any files that currently reside there.\nOn Windows client machines, you can specify the root as null to enable you to map files to multiple drives. attr_accessor :root # Up to two optional alternate client workspace roots.\n\nPerforce applications use the first of the main and alternate roots that match the application’s current working directory.\nUse the p4 info command to display the root being used.\n\nThis enables users to use the same Perforce client workspace specification on multiple platforms, even those with different directory naming conventions.\n\nIf you are using multiple or alternate workspace roots (the AltRoots: field), you can always tell which root is in effect by looking at the Client root: reported by p4 info.\n\nIf you are using a Windows directory in any of your workspace roots, you must specify the Windows directory as your main workspace root and specify your other workspace roots in the AltRoots: field. attr_accessor :alt_roots # A set of seven switches that control particular workspace options.\n\nSee [Usage Notes](https://www.perforce.com/perforce/doc.current/manuals/cmdref/p4_client.html#p4_client.usage) for a listing of these options. attr_accessor :options # Options to govern the default behavior of p4 submit.\n\n* submitunchanged\n+\nAll open files (with or without changes) are submitted to the depot. This is the default behavior of Perforce.\n\n* submitunchanged+reopen\n+\nAll open files (with or without changes) are submitted to the depot, and all files are automatically reopened in the default changelist.\n\n* revertunchanged\n+\nOnly those files with content, type, or resolved changes are submitted to the depot. Unchanged files are reverted.\n\n* revertunchanged+reopen\n+\nOnly those files with content, type, or resolved changes are submitted to the depot and reopened in the default changelist. Unchanged files are reverted and not reopened in the default changelist.\n\n* leaveunchanged\n+\nOnly those files with content, type, or resolved changes are submitted to the depot. Any unchanged files are moved to the default changelist.\n\n* leaveunchanged+reopen\n+\nOnly those files with content, type, or resolved changes are submitted to the depot. Unchanged files are moved to the default changelist, and changed files are reopened in the default changelist. This option is similar to submitunchanged+reopen, except that no unchanged files are submitted to the depot. attr_accessor :submit_options # Configure carriage-return/linefeed (CR/LF) conversion.\n\nSee [Usage Notes](https://www.perforce.com/perforce/doc.current/manuals/cmdref/p4_client.html#p4_client.usage) for a listing of these options. attr_accessor :line_end # Associates the workspace with the specified stream.\n\nPerforce generates the view for stream-associated workspaces: you cannot modify it manually. attr_accessor :stream # A changelist number that sets a back-in-time view of a stream.\n\nWhen StreamAtChange is set, running p4 sync (when called with no arguments) updates the workspace to files at this changelist revision, instead of the head revision.\nYou cannot submit changes (p4 submit returns an error) when StreamAtChange is set, because the workspace view no longer reflects the current stream inheritance.\n\nThis field is ignored unless the Stream field is also set to a valid stream. attr_accessor :stream_at_change # If set, restricts usage of the workspace to the named server.\nIf unset, use is allowed on master server and on any replicas of the master other than Edge servers. attr_accessor :server_id # Specifies the mappings between files in the depot and files in the workspace.\nA new view takes effect on the next p4 sync operation. attr_accessor :view # Restricts access to depot paths to a particular point in time.\nFiles specified for the ChangeView field are read-only: they may be opened but not submitted.\nFor example: `//depot/path/...@1000`\n\nRevisions of the files in the specified path will not be visible if they were submitted after the specified changelist number.\nFiles matching a ChangeView path may not be submitted. attr_accessor :change_view # By default clients are writeable.\nSpecify readonly for short lived clients used in build automation scripts.\nSuch clients cannot edit or submit files, but this should not be an issue in build scripts.\n\nUsing writeable clients in build automation scripts can lead to db.have table fragmentation, which is used to track what files a client has synced.\nIf you are experiencing such issues, use a read-only client instead.\nA readonly client is assigned its own personal db.have database table.\nThe location of this table must first be specified by an administrator with the client.readonly.dir configurable. attr_accessor :type # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'client' => :'client', :'owner' => :'owner', :'update' => :'update', :'access' => :'access', :'host' => :'host', :'description' => :'description', :'root' => :'root', :'alt_roots' => :'altRoots', :'options' => :'options', :'submit_options' => :'submitOptions', :'line_end' => :'lineEnd', :'stream' => :'stream', :'stream_at_change' => :'streamAtChange', :'server_id' => :'serverID', :'view' => :'view', :'change_view' => :'changeView', :'type' => :'type' } end # Attribute type mapping. def self.swagger_types { :'client' => :'String', :'owner' => :'String', :'update' => :'DateTime', :'access' => :'DateTime', :'host' => :'String', :'description' => :'String', :'root' => :'String', :'alt_roots' => :'Array', :'options' => :'String', :'submit_options' => :'String', :'line_end' => :'String', :'stream' => :'String', :'stream_at_change' => :'String', :'server_id' => :'String', :'view' => :'Array', :'change_view' => :'Array', :'type' => :'String' } 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[:'client'] self.client = attributes[:'client'] end if attributes[:'owner'] self.owner = attributes[:'owner'] end if attributes[:'update'] self.update = attributes[:'update'] end if attributes[:'access'] self.access = attributes[:'access'] end if attributes[:'host'] self.host = attributes[:'host'] end if attributes[:'description'] self.description = attributes[:'description'] end if attributes[:'root'] self.root = attributes[:'root'] end if attributes[:'altRoots'] if (value = attributes[:'altRoots']).is_a?(Array) self.alt_roots = value end end if attributes[:'options'] self.options = attributes[:'options'] end if attributes[:'submitOptions'] self.submit_options = attributes[:'submitOptions'] end if attributes[:'lineEnd'] self.line_end = attributes[:'lineEnd'] end if attributes[:'stream'] self.stream = attributes[:'stream'] end if attributes[:'streamAtChange'] self.stream_at_change = attributes[:'streamAtChange'] end if attributes[:'serverID'] self.server_id = attributes[:'serverID'] end if attributes[:'view'] if (value = attributes[:'view']).is_a?(Array) self.view = value end end if attributes[:'changeView'] if (value = attributes[:'changeView']).is_a?(Array) self.change_view = value end end if attributes[:'type'] self.type = attributes[:'type'] end end # Check equality by comparing each attribute. def ==(o) return true if self.equal?(o) self.class == o.class && client == o.client && owner == o.owner && update == o.update && access == o.access && host == o.host && description == o.description && root == o.root && alt_roots == o.alt_roots && options == o.options && submit_options == o.submit_options && line_end == o.line_end && stream == o.stream && stream_at_change == o.stream_at_change && server_id == o.server_id && view == o.view && change_view == o.change_view && type == o.type end # @see the `==` method def eql?(o) self == o end # Calculate hash code according to all attributes. def hash [client, owner, update, access, host, description, root, alt_roots, options, submit_options, line_end, stream, stream_at_change, server_id, view, change_view, type].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