lib/cloudsmith-api/models/package_move.rb in cloudsmith-api-1.61.3 vs lib/cloudsmith-api/models/package_move.rb in cloudsmith-api-1.120.3

- old
+ new

@@ -213,10 +213,32 @@ attr_accessor :version_orig # attr_accessor :vulnerability_scan_results_url + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'architectures' => :'architectures', :'cdn_url' => :'cdn_url', @@ -650,10 +672,22 @@ end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + security_scan_status_validator = EnumAttributeValidator.new('String', ['Awaiting Security Scan', 'Security Scanning in Progress', 'Scan Detected Vulnerabilities', 'Scan Detected No Vulnerabilities', 'Security Scanning Disabled', 'Security Scanning Failed', 'Security Scanning Skipped', 'Security Scanning Not Supported']) + return false unless security_scan_status_validator.valid?(@security_scan_status) true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] security_scan_status Object to be assigned + def security_scan_status=(security_scan_status) + validator = EnumAttributeValidator.new('String', ['Awaiting Security Scan', 'Security Scanning in Progress', 'Scan Detected Vulnerabilities', 'Scan Detected No Vulnerabilities', 'Security Scanning Disabled', 'Security Scanning Failed', 'Security Scanning Skipped', 'Security Scanning Not Supported']) + unless validator.valid?(security_scan_status) + fail ArgumentError, 'invalid value for "security_scan_status", must be one of #{validator.allowable_values}.' + end + @security_scan_status = security_scan_status end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o)