lib/dkron-rb/models/job.rb in dkron-rb-0.9.2 vs lib/dkron-rb/models/job.rb in dkron-rb-0.10.0

- old
+ new

@@ -1,26 +1,15 @@ =begin #Dkron REST API #You can communicate with Dkron using a RESTful JSON API over HTTP. Dkron nodes usually listen on port `8080` for API requests. All examples in this section assume that you've found a running leader at `localhost:8080`. Dkron implements a RESTful JSON API over HTTP to communicate with software clients. Dkron listens in port `8080` by default. All examples in this section assume that you're using the default port. Default API responses are unformatted JSON add the `pretty=true` param to format the response. -OpenAPI spec version: 0.9.2 +OpenAPI spec version: 0.10.0 Generated by: https://github.com/swagger-api/swagger-codegen.git +Swagger Codegen version: 2.3.1 -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - =end require 'date' module Dkron @@ -30,16 +19,13 @@ attr_accessor :name # Cron expression for the job. attr_accessor :schedule - # Command to run. - attr_accessor :command + # Timezone where the job will be executed. By default and when field is set to empty string, the job will run in local time. + attr_accessor :timezone - # Use shell to run the command - attr_accessor :shell - # Owner of the job attr_accessor :owner # Email of the owner attr_accessor :owner_email @@ -69,24 +55,27 @@ attr_accessor :parent_job # Array containing the jobs that depends on this one attr_accessor :dependent_jobs - # Processor plugins used to process executions results of this job attr_accessor :processors # Concurrency policy for the job allow/forbid attr_accessor :concurrency + # Executor plugin used to run the job + attr_accessor :executor + attr_accessor :executor_config + + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'name' => :'name', :'schedule' => :'schedule', - :'command' => :'command', - :'shell' => :'shell', + :'timezone' => :'timezone', :'owner' => :'owner', :'owner_email' => :'owner_email', :'success_count' => :'success_count', :'error_count' => :'error_count', :'last_success' => :'last_success', @@ -95,34 +84,37 @@ :'tags' => :'tags', :'retries' => :'retries', :'parent_job' => :'parent_job', :'dependent_jobs' => :'dependent_jobs', :'processors' => :'processors', - :'concurrency' => :'concurrency' + :'concurrency' => :'concurrency', + :'executor' => :'executor', + :'executor_config' => :'executor_config' } end # Attribute type mapping. def self.swagger_types { :'name' => :'String', :'schedule' => :'String', - :'command' => :'String', - :'shell' => :'BOOLEAN', + :'timezone' => :'String', :'owner' => :'String', :'owner_email' => :'String', :'success_count' => :'Integer', :'error_count' => :'Integer', :'last_success' => :'DateTime', :'last_error' => :'DateTime', :'disabled' => :'BOOLEAN', :'tags' => :'Hash<String, String>', :'retries' => :'Integer', :'parent_job' => :'String', - :'dependent_jobs' => :'Array<null>', - :'processors' => :'Hash<String, String>', - :'concurrency' => :'String' + :'dependent_jobs' => :'Array<String>', + :'processors' => :'Processors', + :'concurrency' => :'String', + :'executor' => :'String', + :'executor_config' => :'ExecutorConfig' } end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash @@ -138,18 +130,14 @@ if attributes.has_key?(:'schedule') self.schedule = attributes[:'schedule'] end - if attributes.has_key?(:'command') - self.command = attributes[:'command'] + if attributes.has_key?(:'timezone') + self.timezone = attributes[:'timezone'] end - if attributes.has_key?(:'shell') - self.shell = attributes[:'shell'] - end - if attributes.has_key?(:'owner') self.owner = attributes[:'owner'] end if attributes.has_key?(:'owner_email') @@ -175,11 +163,11 @@ if attributes.has_key?(:'disabled') self.disabled = attributes[:'disabled'] end if attributes.has_key?(:'tags') - if (value = attributes[:'tags']).is_a?(Array) + if (value = attributes[:'tags']).is_a?(Hash) self.tags = value end end if attributes.has_key?(:'retries') @@ -195,46 +183,58 @@ self.dependent_jobs = value end end if attributes.has_key?(:'processors') - if (value = attributes[:'processors']).is_a?(Array) - self.processors = value - end + self.processors = attributes[:'processors'] end if attributes.has_key?(:'concurrency') self.concurrency = attributes[:'concurrency'] end + if attributes.has_key?(:'executor') + self.executor = attributes[:'executor'] + end + + if attributes.has_key?(:'executor_config') + self.executor_config = attributes[:'executor_config'] + end + end # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properies with the reasons + # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new + if @name.nil? + invalid_properties.push("invalid value for 'name', name cannot be nil.") + end + + if @schedule.nil? + invalid_properties.push("invalid value for 'schedule', schedule cannot be nil.") + end + return invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? return false if @name.nil? return false if @schedule.nil? - return false if @command.nil? return true end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && name == o.name && schedule == o.schedule && - command == o.command && - shell == o.shell && + timezone == o.timezone && owner == o.owner && owner_email == o.owner_email && success_count == o.success_count && error_count == o.error_count && last_success == o.last_success && @@ -243,11 +243,13 @@ tags == o.tags && retries == o.retries && parent_job == o.parent_job && dependent_jobs == o.dependent_jobs && processors == o.processors && - concurrency == o.concurrency + concurrency == o.concurrency && + executor == o.executor && + executor_config == o.executor_config end # @see the `==` method # @param [Object] Object to be compared def eql?(o) @@ -255,20 +257,20 @@ end # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash - [name, schedule, command, shell, owner, owner_email, success_count, error_count, last_success, last_error, disabled, tags, retries, parent_job, dependent_jobs, processors, concurrency].hash + [name, schedule, timezone, owner, owner_email, success_count, error_count, last_success, last_error, disabled, tags, retries, parent_job, dependent_jobs, processors, concurrency, executor, executor_config].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself 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 type =~ /\AArray<(.*)>/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) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) end @@ -295,21 +297,21 @@ when :Integer value.to_i when :Float value.to_f when :BOOLEAN - if value.to_s =~ /^(true|t|yes|y|1)$/i + if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/ + when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\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)