Class: Files::Automation
- Inherits:
-
Object
- Object
- Files::Automation
- Defined in:
- lib/files.com/models/automation.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
- .all(params = {}, options = {}) ⇒ Object
-
.create(params = {}, options = {}) ⇒ Object
Parameters: source - string - Source path/glob.
- .delete(id, params = {}, options = {}) ⇒ Object
- .destroy(id, params = {}, options = {}) ⇒ Object
-
.find(id, params = {}, options = {}) ⇒ Object
Parameters: id (required) - int64 - Automation ID.
- .get(id, params = {}, options = {}) ⇒ Object
- .get_authoring_schema(params = {}, options = {}) ⇒ Object
-
.list(params = {}, options = {}) ⇒ Object
Parameters: cursor - string - Used for pagination.
-
.manual_run(id, params = {}, options = {}) ⇒ Object
Manually Run Automation.
-
.update(id, params = {}, options = {}) ⇒ Object
Parameters: source - string - Source path/glob.
-
.upgrade(id, params = {}, options = {}) ⇒ Object
Upgrade a legacy Automation to Automation v2.
Instance Method Summary collapse
-
#always_overwrite_size_matching_files ⇒ Object
boolean - Ordinarily, files with identical size in the source and destination will be skipped from copy operations to prevent wasted transfer.
- #always_overwrite_size_matching_files=(value) ⇒ Object
-
#always_serialize_jobs ⇒ Object
boolean - Ordinarily, we will allow automation runs to run in parallel for non-scheduled automations.
- #always_serialize_jobs=(value) ⇒ Object
-
#automation ⇒ Object
string - Automation type.
- #automation=(value) ⇒ Object
-
#definition ⇒ Object
object - Automation v2 graph definition.
- #definition=(value) ⇒ Object
- #delete(params = {}) ⇒ Object
-
#deleted ⇒ Object
boolean - Indicates if the automation has been deleted.
- #deleted=(value) ⇒ Object
-
#description ⇒ Object
string - Description for the this Automation.
- #description=(value) ⇒ Object
-
#destination_replace_from ⇒ Object
string - If set, this string in the destination path will be replaced with the value in
destination_replace_to. - #destination_replace_from=(value) ⇒ Object
-
#destination_replace_to ⇒ Object
string - If set, this string will replace the value
destination_replace_fromin the destination filename. - #destination_replace_to=(value) ⇒ Object
-
#destinations ⇒ Object
array(string) - Destination Paths.
- #destinations=(value) ⇒ Object
- #destroy(params = {}) ⇒ Object
-
#disabled ⇒ Object
boolean - If true, this automation will not run.
- #disabled=(value) ⇒ Object
-
#exclude_pattern ⇒ Object
string - If set, this glob pattern will exclude files from the automation.
- #exclude_pattern=(value) ⇒ Object
-
#flatten_destination_structure ⇒ Object
boolean - Normally copy and move automations that use globs will implicitly preserve the source folder structure in the destination.
- #flatten_destination_structure=(value) ⇒ Object
-
#group_ids ⇒ Object
array(int64) - IDs of Groups for the Automation (i.e. who to Request File from).
- #group_ids=(value) ⇒ Object
-
#holiday_region ⇒ Object
string - Skip automation if there is a formal, observed holiday for this region.
- #holiday_region=(value) ⇒ Object
-
#human_readable_schedule ⇒ Object
string - If trigger is
custom_scheduleordailywith times, Human readable schedule description for when the automation should be run. - #human_readable_schedule=(value) ⇒ Object
-
#id ⇒ Object
int64 - Automation ID.
- #id=(value) ⇒ Object
-
#ignore_locked_folders ⇒ Object
boolean - If true, the Lock Folders behavior will be disregarded for automated actions.
- #ignore_locked_folders=(value) ⇒ Object
-
#import_urls ⇒ Object
array(object) - List of URLs to be imported and names to be used.
- #import_urls=(value) ⇒ Object
-
#inbound_email_address ⇒ Object
string - If trigger is
email, this is the address that triggers the Automation. - #inbound_email_address=(value) ⇒ Object
-
#initialize(attributes = {}, options = {}) ⇒ Automation
constructor
A new instance of Automation.
-
#interval ⇒ Object
string - If trigger is
daily, this specifies how often to run this automation. - #interval=(value) ⇒ Object
-
#last_modified_at ⇒ Object
date-time - Time when automation was last modified.
- #last_modified_at=(value) ⇒ Object
-
#legacy_folder_matching ⇒ Object
boolean - If
true, use the legacy behavior for this automation, where it can operate on folders in addition to just files. - #legacy_folder_matching=(value) ⇒ Object
-
#legacy_sync_ids ⇒ Object
array(int64) - IDs of remote sync folder behaviors to run by this Automation.
- #legacy_sync_ids=(value) ⇒ Object
-
#manual_run(params = {}) ⇒ Object
Manually Run Automation.
-
#name ⇒ Object
string - Name for this automation.
- #name=(value) ⇒ Object
-
#overwrite_files ⇒ Object
boolean - If true, existing files will be overwritten with new files on Move/Copy automations.
- #overwrite_files=(value) ⇒ Object
-
#path ⇒ Object
string - Path on which this Automation runs.
- #path=(value) ⇒ Object
-
#path_time_zone ⇒ Object
string - Timezone to use when rendering timestamps in paths.
- #path_time_zone=(value) ⇒ Object
-
#recurring_day ⇒ Object
int64 - If trigger type is
daily, this specifies a day number to run in one of the supported intervals:week,month,quarter,year. - #recurring_day=(value) ⇒ Object
-
#retry_on_failure_interval_in_minutes ⇒ Object
int64 - If the Automation fails, retry at this interval (in minutes).
- #retry_on_failure_interval_in_minutes=(value) ⇒ Object
-
#retry_on_failure_number_of_attempts ⇒ Object
int64 - If the Automation fails, retry at most this many times.
- #retry_on_failure_number_of_attempts=(value) ⇒ Object
- #save ⇒ Object
-
#schedule ⇒ Object
object - If trigger is
custom_schedule, Custom schedule description for when the automation should be run in json format. - #schedule=(value) ⇒ Object
-
#schedule_days_of_week ⇒ Object
array(int64) - If trigger is
custom_schedule, Custom schedule description for when the automation should be run. - #schedule_days_of_week=(value) ⇒ Object
-
#schedule_time_zone ⇒ Object
string - Time zone for scheduled times.
- #schedule_time_zone=(value) ⇒ Object
-
#schedule_times_of_day ⇒ Object
array(string) - Times of day to run in HH:MM format (24-hour).
- #schedule_times_of_day=(value) ⇒ Object
-
#source ⇒ Object
string - Source path/glob.
- #source=(value) ⇒ Object
-
#sync_ids ⇒ Object
array(int64) - IDs of syncs to run by this Automation.
- #sync_ids=(value) ⇒ Object
-
#trigger ⇒ Object
string - How this automation is triggered to run.
- #trigger=(value) ⇒ Object
-
#trigger_actions ⇒ Object
array(string) - If trigger is
action, this is the list of action types on which to trigger the automation. - #trigger_actions=(value) ⇒ Object
-
#update(params = {}) ⇒ Object
Parameters: source - string - Source path/glob.
-
#upgrade(params = {}) ⇒ Object
Upgrade a legacy Automation to Automation v2.
-
#user_id ⇒ Object
int64 - User ID of the Automation's creator.
- #user_id=(value) ⇒ Object
-
#user_ids ⇒ Object
array(int64) - IDs of Users for the Automation (i.e. who to Request File from).
- #user_ids=(value) ⇒ Object
-
#value ⇒ Object
object - A Hash of attributes specific to the automation type.
- #value=(value) ⇒ Object
-
#version ⇒ Object
int64 - Current Automation v2 definition version.
- #version=(value) ⇒ Object
-
#webhook_url ⇒ Object
string - If trigger is
webhook, this is the URL of the webhook to trigger the Automation. - #webhook_url=(value) ⇒ Object
-
#workspace_id ⇒ Object
int64 - Workspace ID.
- #workspace_id=(value) ⇒ Object
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ Automation
Returns a new instance of Automation.
7 8 9 10 |
# File 'lib/files.com/models/automation.rb', line 7 def initialize(attributes = {}, = {}) @attributes = attributes || {} @options = || {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/files.com/models/automation.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/automation.rb', line 5 def @options end |
Class Method Details
.all(params = {}, options = {}) ⇒ Object
553 554 555 |
# File 'lib/files.com/models/automation.rb', line 553 def self.all(params = {}, = {}) list(params, ) end |
.create(params = {}, options = {}) ⇒ Object
Parameters:
source - string - Source path/glob. See Automation docs for exact description, but this is used to filter for files in the `path` to find files to operate on. Supports globs, except on remote mounts.
destinations - array(string) - A list of destination paths. Use a trailing slash for folder destinations and omit it for file destinations.
destination_replace_from - string - If set, this string in the destination path will be replaced with the value in `destination_replace_to`.
destination_replace_to - string - If set, this string will replace the value `destination_replace_from` in the destination filename. You can use special patterns here.
interval - string - How often to run this automation? One of: `day`, `week`, `week_end`, `month`, `month_end`, `quarter`, `quarter_end`, `year`, `year_end`
path - string - Path on which this Automation runs. Supports globs, except on remote mounts.
legacy_sync_ids - string - A list of legacy sync IDs the automation is associated with. If sent as a string, it should be comma-delimited.
sync_ids - string - A list of sync IDs the automation is associated with. If sent as a string, it should be comma-delimited.
user_ids - string - A list of user IDs the automation is associated with. If sent as a string, it should be comma-delimited.
group_ids - string - A list of group IDs the automation is associated with. If sent as a string, it should be comma-delimited.
schedule_days_of_week - array(int64) - If trigger is `custom_schedule`. A list of days of the week to run this automation. 0 is Sunday, 1 is Monday, etc.
schedule_times_of_day - array(string) - Times of day to run in HH:MM format (24-hour). Required for `custom_schedule` triggers. Optional for `daily` triggers - if not set, runs at midnight UTC.
schedule_time_zone - string - Time zone for scheduled times. Optional for both `custom_schedule` and `daily` triggers. If not set, times are interpreted as UTC.
holiday_region - string - Skip automation on holidays in this region. Optional for both `custom_schedule` and `daily` triggers.
always_overwrite_size_matching_files - boolean - Ordinarily, files with identical size in the source and destination will be skipped from copy operations to prevent wasted transfer. If this flag is `true` we will overwrite the destination file always. Note that this may cause large amounts of wasted transfer usage. This setting has no effect unless `overwrite_files` is also set to `true`.
always_serialize_jobs - boolean - Ordinarily, we will allow automation runs to run in parallel for non-scheduled automations. If this flag is `true` we will force automation runs to be serialized (run one at a time, one after another). This can resolve some issues with race conditions on remote systems at the cost of some performance.
description - string - Description for the this Automation.
disabled - boolean - If true, this automation will not run.
exclude_pattern - string - If set, this glob pattern will exclude files from the automation. Supports globs, except on remote mounts.
import_urls - array(object) - List of URLs to be imported and names to be used.
flatten_destination_structure - boolean - Normally copy and move automations that use globs will implicitly preserve the source folder structure in the destination. If this flag is `true`, the source folder structure will be flattened in the destination. This is useful for copying or moving files from multiple folders into a single destination folder.
ignore_locked_folders - boolean - If true, the Lock Folders behavior will be disregarded for automated actions.
legacy_folder_matching - boolean - DEPRECATED: If `true`, use the legacy behavior for this automation, where it can operate on folders in addition to just files. This behavior no longer works and should not be used.
name - string - Name for this automation.
overwrite_files - boolean - If true, existing files will be overwritten with new files on Move/Copy automations. Note: by default files will not be overwritten on Copy automations if they appear to be the same file size as the newly incoming file. Use the `always_overwrite_size_matching_files` option in conjunction with `overwrite_files` to override this behavior and overwrite files no matter what.
path_time_zone - string - Timezone to use when rendering timestamps in paths.
retry_on_failure_interval_in_minutes - int64 - If the Automation fails, retry at this interval (in minutes). Acceptable values are 5 through 1440 (one day). Set to null to disable.
retry_on_failure_number_of_attempts - int64 - If the Automation fails, retry at most this many times. Maximum allowed value: 10. Set to null to disable.
trigger - string - How this automation is triggered to run.
trigger_actions - array(string) - If trigger is `action`, this is the list of action types on which to trigger the automation. Valid actions are create, copy, move, archived_delete, update, read, destroy
value - object - A Hash of attributes specific to the automation type.
recurring_day - int64 - If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
automation (required) - string - Automation type
workspace_id - int64 - Workspace ID
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 |
# File 'lib/files.com/models/automation.rb', line 613 def self.create(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: source must be an String") if params[:source] and !params[:source].is_a?(String) raise InvalidParameterError.new("Bad parameter: destinations must be an Array") if params[:destinations] and !params[:destinations].is_a?(Array) raise InvalidParameterError.new("Bad parameter: destination_replace_from must be an String") if params[:destination_replace_from] and !params[:destination_replace_from].is_a?(String) raise InvalidParameterError.new("Bad parameter: destination_replace_to must be an String") if params[:destination_replace_to] and !params[:destination_replace_to].is_a?(String) raise InvalidParameterError.new("Bad parameter: interval must be an String") if params[:interval] and !params[:interval].is_a?(String) raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String) raise InvalidParameterError.new("Bad parameter: legacy_sync_ids must be an String") if params[:legacy_sync_ids] and !params[:legacy_sync_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: sync_ids must be an String") if params[:sync_ids] and !params[:sync_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params[:user_ids] and !params[:user_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: group_ids must be an String") if params[:group_ids] and !params[:group_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: schedule_days_of_week must be an Array") if params[:schedule_days_of_week] and !params[:schedule_days_of_week].is_a?(Array) raise InvalidParameterError.new("Bad parameter: schedule_times_of_day must be an Array") if params[:schedule_times_of_day] and !params[:schedule_times_of_day].is_a?(Array) raise InvalidParameterError.new("Bad parameter: schedule_time_zone must be an String") if params[:schedule_time_zone] and !params[:schedule_time_zone].is_a?(String) raise InvalidParameterError.new("Bad parameter: holiday_region must be an String") if params[:holiday_region] and !params[:holiday_region].is_a?(String) raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String) raise InvalidParameterError.new("Bad parameter: exclude_pattern must be an String") if params[:exclude_pattern] and !params[:exclude_pattern].is_a?(String) raise InvalidParameterError.new("Bad parameter: import_urls must be an Array") if params[:import_urls] and !params[:import_urls].is_a?(Array) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise InvalidParameterError.new("Bad parameter: path_time_zone must be an String") if params[:path_time_zone] and !params[:path_time_zone].is_a?(String) raise InvalidParameterError.new("Bad parameter: retry_on_failure_interval_in_minutes must be an Integer") if params[:retry_on_failure_interval_in_minutes] and !params[:retry_on_failure_interval_in_minutes].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: retry_on_failure_number_of_attempts must be an Integer") if params[:retry_on_failure_number_of_attempts] and !params[:retry_on_failure_number_of_attempts].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: trigger must be an String") if params[:trigger] and !params[:trigger].is_a?(String) raise InvalidParameterError.new("Bad parameter: trigger_actions must be an Array") if params[:trigger_actions] and !params[:trigger_actions].is_a?(Array) raise InvalidParameterError.new("Bad parameter: value must be an Hash") if params[:value] and !params[:value].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: recurring_day must be an Integer") if params[:recurring_day] and !params[:recurring_day].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: automation must be an String") if params[:automation] and !params[:automation].is_a?(String) raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: automation") unless params[:automation] response, = Api.send_request("/automations", :post, params, ) Automation.new(response.data, ) end |
.delete(id, params = {}, options = {}) ⇒ Object
743 744 745 746 747 748 749 750 751 |
# File 'lib/files.com/models/automation.rb', line 743 def self.delete(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/automations/#{params[:id]}", :delete, params, ) nil end |
.destroy(id, params = {}, options = {}) ⇒ Object
753 754 755 756 |
# File 'lib/files.com/models/automation.rb', line 753 def self.destroy(id, params = {}, = {}) delete(id, params, ) nil end |
.find(id, params = {}, options = {}) ⇒ Object
Parameters:
id (required) - int64 - Automation ID.
559 560 561 562 563 564 565 566 567 |
# File 'lib/files.com/models/automation.rb', line 559 def self.find(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] response, = Api.send_request("/automations/#{params[:id]}", :get, params, ) Automation.new(response.data, ) end |
.get(id, params = {}, options = {}) ⇒ Object
569 570 571 |
# File 'lib/files.com/models/automation.rb', line 569 def self.get(id, params = {}, = {}) find(id, params, ) end |
.get_authoring_schema(params = {}, options = {}) ⇒ Object
573 574 575 576 |
# File 'lib/files.com/models/automation.rb', line 573 def self.(params = {}, = {}) response, = Api.send_request("/automations/authoring_schema", :get, params, ) AutomationAuthoringSchema.new(response.data, ) end |
.list(params = {}, options = {}) ⇒ Object
Parameters:
cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
per_page - int64 - Number of records to show per page. (Max: 10000, 1,000 or less is recommended).
sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `workspace_id`, `name`, `automation`, `last_modified_at` or `disabled`.
filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `disabled`, `last_modified_at`, `workspace_id` or `automation`. Valid field combinations are `[ disabled, last_modified_at ]`, `[ workspace_id, disabled ]`, `[ disabled, automation ]`, `[ workspace_id, last_modified_at ]`, `[ automation, last_modified_at ]`, `[ workspace_id, automation ]`, `[ workspace_id, disabled, last_modified_at ]`, `[ disabled, automation, last_modified_at ]`, `[ workspace_id, disabled, automation ]`, `[ workspace_id, automation, last_modified_at ]` or `[ workspace_id, disabled, automation, last_modified_at ]`.
filter_gt - object - If set, return records where the specified field is greater than the supplied value. Valid fields are `last_modified_at`.
filter_gteq - object - If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `last_modified_at`.
filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `last_modified_at`.
filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `last_modified_at`.
538 539 540 541 542 543 544 545 546 547 548 549 550 551 |
# File 'lib/files.com/models/automation.rb', line 538 def self.list(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String) raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter_gt must be an Hash") if params[:filter_gt] and !params[:filter_gt].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter_gteq must be an Hash") if params[:filter_gteq] and !params[:filter_gteq].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params[:filter_lt] and !params[:filter_lt].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params[:filter_lteq] and !params[:filter_lteq].is_a?(Hash) List.new(Automation, params) do Api.send_request("/automations", :get, params, ) end end |
.manual_run(id, params = {}, options = {}) ⇒ Object
Manually Run Automation. v2 Automations require Site or Workspace Admin permission
Parameters:
items - array(object) - Initial items for a v2 manual trigger. Each item contains exactly one `file` path or `data` object.
662 663 664 665 666 667 668 669 670 671 |
# File 'lib/files.com/models/automation.rb', line 662 def self.manual_run(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: items must be an Array") if params[:items] and !params[:items].is_a?(Array) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/automations/#{params[:id]}/manual_run", :post, params, ) nil end |
.update(id, params = {}, options = {}) ⇒ Object
Parameters:
source - string - Source path/glob. See Automation docs for exact description, but this is used to filter for files in the `path` to find files to operate on. Supports globs, except on remote mounts.
destinations - array(string) - A list of destination paths. Use a trailing slash for folder destinations and omit it for file destinations.
destination_replace_from - string - If set, this string in the destination path will be replaced with the value in `destination_replace_to`.
destination_replace_to - string - If set, this string will replace the value `destination_replace_from` in the destination filename. You can use special patterns here.
interval - string - How often to run this automation? One of: `day`, `week`, `week_end`, `month`, `month_end`, `quarter`, `quarter_end`, `year`, `year_end`
path - string - Path on which this Automation runs. Supports globs, except on remote mounts.
legacy_sync_ids - string - A list of legacy sync IDs the automation is associated with. If sent as a string, it should be comma-delimited.
sync_ids - string - A list of sync IDs the automation is associated with. If sent as a string, it should be comma-delimited.
user_ids - string - A list of user IDs the automation is associated with. If sent as a string, it should be comma-delimited.
group_ids - string - A list of group IDs the automation is associated with. If sent as a string, it should be comma-delimited.
schedule_days_of_week - array(int64) - If trigger is `custom_schedule`. A list of days of the week to run this automation. 0 is Sunday, 1 is Monday, etc.
schedule_times_of_day - array(string) - Times of day to run in HH:MM format (24-hour). Required for `custom_schedule` triggers. Optional for `daily` triggers - if not set, runs at midnight UTC.
schedule_time_zone - string - Time zone for scheduled times. Optional for both `custom_schedule` and `daily` triggers. If not set, times are interpreted as UTC.
holiday_region - string - Skip automation on holidays in this region. Optional for both `custom_schedule` and `daily` triggers.
always_overwrite_size_matching_files - boolean - Ordinarily, files with identical size in the source and destination will be skipped from copy operations to prevent wasted transfer. If this flag is `true` we will overwrite the destination file always. Note that this may cause large amounts of wasted transfer usage. This setting has no effect unless `overwrite_files` is also set to `true`.
always_serialize_jobs - boolean - Ordinarily, we will allow automation runs to run in parallel for non-scheduled automations. If this flag is `true` we will force automation runs to be serialized (run one at a time, one after another). This can resolve some issues with race conditions on remote systems at the cost of some performance.
description - string - Description for the this Automation.
disabled - boolean - If true, this automation will not run.
exclude_pattern - string - If set, this glob pattern will exclude files from the automation. Supports globs, except on remote mounts.
import_urls - array(object) - List of URLs to be imported and names to be used.
flatten_destination_structure - boolean - Normally copy and move automations that use globs will implicitly preserve the source folder structure in the destination. If this flag is `true`, the source folder structure will be flattened in the destination. This is useful for copying or moving files from multiple folders into a single destination folder.
ignore_locked_folders - boolean - If true, the Lock Folders behavior will be disregarded for automated actions.
legacy_folder_matching - boolean - DEPRECATED: If `true`, use the legacy behavior for this automation, where it can operate on folders in addition to just files. This behavior no longer works and should not be used.
name - string - Name for this automation.
overwrite_files - boolean - If true, existing files will be overwritten with new files on Move/Copy automations. Note: by default files will not be overwritten on Copy automations if they appear to be the same file size as the newly incoming file. Use the `always_overwrite_size_matching_files` option in conjunction with `overwrite_files` to override this behavior and overwrite files no matter what.
path_time_zone - string - Timezone to use when rendering timestamps in paths.
retry_on_failure_interval_in_minutes - int64 - If the Automation fails, retry at this interval (in minutes). Acceptable values are 5 through 1440 (one day). Set to null to disable.
retry_on_failure_number_of_attempts - int64 - If the Automation fails, retry at most this many times. Maximum allowed value: 10. Set to null to disable.
trigger - string - How this automation is triggered to run.
trigger_actions - array(string) - If trigger is `action`, this is the list of action types on which to trigger the automation. Valid actions are create, copy, move, archived_delete, update, read, destroy
value - object - A Hash of attributes specific to the automation type.
recurring_day - int64 - If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
automation - string - Automation type
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 |
# File 'lib/files.com/models/automation.rb', line 707 def self.update(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: source must be an String") if params[:source] and !params[:source].is_a?(String) raise InvalidParameterError.new("Bad parameter: destinations must be an Array") if params[:destinations] and !params[:destinations].is_a?(Array) raise InvalidParameterError.new("Bad parameter: destination_replace_from must be an String") if params[:destination_replace_from] and !params[:destination_replace_from].is_a?(String) raise InvalidParameterError.new("Bad parameter: destination_replace_to must be an String") if params[:destination_replace_to] and !params[:destination_replace_to].is_a?(String) raise InvalidParameterError.new("Bad parameter: interval must be an String") if params[:interval] and !params[:interval].is_a?(String) raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String) raise InvalidParameterError.new("Bad parameter: legacy_sync_ids must be an String") if params[:legacy_sync_ids] and !params[:legacy_sync_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: sync_ids must be an String") if params[:sync_ids] and !params[:sync_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params[:user_ids] and !params[:user_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: group_ids must be an String") if params[:group_ids] and !params[:group_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: schedule_days_of_week must be an Array") if params[:schedule_days_of_week] and !params[:schedule_days_of_week].is_a?(Array) raise InvalidParameterError.new("Bad parameter: schedule_times_of_day must be an Array") if params[:schedule_times_of_day] and !params[:schedule_times_of_day].is_a?(Array) raise InvalidParameterError.new("Bad parameter: schedule_time_zone must be an String") if params[:schedule_time_zone] and !params[:schedule_time_zone].is_a?(String) raise InvalidParameterError.new("Bad parameter: holiday_region must be an String") if params[:holiday_region] and !params[:holiday_region].is_a?(String) raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String) raise InvalidParameterError.new("Bad parameter: exclude_pattern must be an String") if params[:exclude_pattern] and !params[:exclude_pattern].is_a?(String) raise InvalidParameterError.new("Bad parameter: import_urls must be an Array") if params[:import_urls] and !params[:import_urls].is_a?(Array) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise InvalidParameterError.new("Bad parameter: path_time_zone must be an String") if params[:path_time_zone] and !params[:path_time_zone].is_a?(String) raise InvalidParameterError.new("Bad parameter: retry_on_failure_interval_in_minutes must be an Integer") if params[:retry_on_failure_interval_in_minutes] and !params[:retry_on_failure_interval_in_minutes].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: retry_on_failure_number_of_attempts must be an Integer") if params[:retry_on_failure_number_of_attempts] and !params[:retry_on_failure_number_of_attempts].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: trigger must be an String") if params[:trigger] and !params[:trigger].is_a?(String) raise InvalidParameterError.new("Bad parameter: trigger_actions must be an Array") if params[:trigger_actions] and !params[:trigger_actions].is_a?(Array) raise InvalidParameterError.new("Bad parameter: value must be an Hash") if params[:value] and !params[:value].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: recurring_day must be an Integer") if params[:recurring_day] and !params[:recurring_day].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: automation must be an String") if params[:automation] and !params[:automation].is_a?(String) raise MissingParameterError.new("Parameter missing: id") unless params[:id] response, = Api.send_request("/automations/#{params[:id]}", :patch, params, ) Automation.new(response.data, ) end |
.upgrade(id, params = {}, options = {}) ⇒ Object
Upgrade a legacy Automation to Automation v2
648 649 650 651 652 653 654 655 656 |
# File 'lib/files.com/models/automation.rb', line 648 def self.upgrade(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] response, = Api.send_request("/automations/#{params[:id]}/upgrade", :post, params, ) Automation.new(response.data, ) end |
Instance Method Details
#always_overwrite_size_matching_files ⇒ Object
boolean - Ordinarily, files with identical size in the source and destination will be skipped from copy operations to prevent wasted transfer. If this flag is true we will overwrite the destination file always. Note that this may cause large amounts of wasted transfer usage. This setting has no effect unless overwrite_files is also set to true.
40 41 42 |
# File 'lib/files.com/models/automation.rb', line 40 def always_overwrite_size_matching_files @attributes[:always_overwrite_size_matching_files] end |
#always_overwrite_size_matching_files=(value) ⇒ Object
44 45 46 |
# File 'lib/files.com/models/automation.rb', line 44 def always_overwrite_size_matching_files=(value) @attributes[:always_overwrite_size_matching_files] = value end |
#always_serialize_jobs ⇒ Object
boolean - Ordinarily, we will allow automation runs to run in parallel for non-scheduled automations. If this flag is true we will force automation runs to be serialized (run one at a time, one after another). This can resolve some issues with race conditions on remote systems at the cost of some performance.
31 32 33 |
# File 'lib/files.com/models/automation.rb', line 31 def always_serialize_jobs @attributes[:always_serialize_jobs] end |
#always_serialize_jobs=(value) ⇒ Object
35 36 37 |
# File 'lib/files.com/models/automation.rb', line 35 def always_serialize_jobs=(value) @attributes[:always_serialize_jobs] = value end |
#automation ⇒ Object
string - Automation type
49 50 51 |
# File 'lib/files.com/models/automation.rb', line 49 def automation @attributes[:automation] end |
#automation=(value) ⇒ Object
53 54 55 |
# File 'lib/files.com/models/automation.rb', line 53 def automation=(value) @attributes[:automation] = value end |
#definition ⇒ Object
object - Automation v2 graph definition.
76 77 78 |
# File 'lib/files.com/models/automation.rb', line 76 def definition @attributes[:definition] end |
#definition=(value) ⇒ Object
80 81 82 |
# File 'lib/files.com/models/automation.rb', line 80 def definition=(value) @attributes[:definition] = value end |
#delete(params = {}) ⇒ Object
503 504 505 506 507 508 509 510 511 |
# File 'lib/files.com/models/automation.rb', line 503 def delete(params = {}) params ||= {} params[:id] = @attributes[:id] raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id] raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/automations/#{@attributes[:id]}", :delete, params, @options) end |
#deleted ⇒ Object
boolean - Indicates if the automation has been deleted.
58 59 60 |
# File 'lib/files.com/models/automation.rb', line 58 def deleted @attributes[:deleted] end |
#deleted=(value) ⇒ Object
62 63 64 |
# File 'lib/files.com/models/automation.rb', line 62 def deleted=(value) @attributes[:deleted] = value end |
#description ⇒ Object
string - Description for the this Automation.
67 68 69 |
# File 'lib/files.com/models/automation.rb', line 67 def description @attributes[:description] end |
#description=(value) ⇒ Object
71 72 73 |
# File 'lib/files.com/models/automation.rb', line 71 def description=(value) @attributes[:description] = value end |
#destination_replace_from ⇒ Object
string - If set, this string in the destination path will be replaced with the value in destination_replace_to.
85 86 87 |
# File 'lib/files.com/models/automation.rb', line 85 def destination_replace_from @attributes[:destination_replace_from] end |
#destination_replace_from=(value) ⇒ Object
89 90 91 |
# File 'lib/files.com/models/automation.rb', line 89 def destination_replace_from=(value) @attributes[:destination_replace_from] = value end |
#destination_replace_to ⇒ Object
string - If set, this string will replace the value destination_replace_from in the destination filename. You can use special patterns here.
94 95 96 |
# File 'lib/files.com/models/automation.rb', line 94 def destination_replace_to @attributes[:destination_replace_to] end |
#destination_replace_to=(value) ⇒ Object
98 99 100 |
# File 'lib/files.com/models/automation.rb', line 98 def destination_replace_to=(value) @attributes[:destination_replace_to] = value end |
#destinations ⇒ Object
array(string) - Destination Paths
103 104 105 |
# File 'lib/files.com/models/automation.rb', line 103 def destinations @attributes[:destinations] end |
#destinations=(value) ⇒ Object
107 108 109 |
# File 'lib/files.com/models/automation.rb', line 107 def destinations=(value) @attributes[:destinations] = value end |
#destroy(params = {}) ⇒ Object
513 514 515 516 |
# File 'lib/files.com/models/automation.rb', line 513 def destroy(params = {}) delete(params) nil end |
#disabled ⇒ Object
boolean - If true, this automation will not run.
112 113 114 |
# File 'lib/files.com/models/automation.rb', line 112 def disabled @attributes[:disabled] end |
#disabled=(value) ⇒ Object
116 117 118 |
# File 'lib/files.com/models/automation.rb', line 116 def disabled=(value) @attributes[:disabled] = value end |
#exclude_pattern ⇒ Object
string - If set, this glob pattern will exclude files from the automation. Supports globs, except on remote mounts.
121 122 123 |
# File 'lib/files.com/models/automation.rb', line 121 def exclude_pattern @attributes[:exclude_pattern] end |
#exclude_pattern=(value) ⇒ Object
125 126 127 |
# File 'lib/files.com/models/automation.rb', line 125 def exclude_pattern=(value) @attributes[:exclude_pattern] = value end |
#flatten_destination_structure ⇒ Object
boolean - Normally copy and move automations that use globs will implicitly preserve the source folder structure in the destination. If this flag is true, the source folder structure will be flattened in the destination. This is useful for copying or moving files from multiple folders into a single destination folder.
148 149 150 |
# File 'lib/files.com/models/automation.rb', line 148 def flatten_destination_structure @attributes[:flatten_destination_structure] end |
#flatten_destination_structure=(value) ⇒ Object
152 153 154 |
# File 'lib/files.com/models/automation.rb', line 152 def flatten_destination_structure=(value) @attributes[:flatten_destination_structure] = value end |
#group_ids ⇒ Object
array(int64) - IDs of Groups for the Automation (i.e. who to Request File from)
157 158 159 |
# File 'lib/files.com/models/automation.rb', line 157 def group_ids @attributes[:group_ids] end |
#group_ids=(value) ⇒ Object
161 162 163 |
# File 'lib/files.com/models/automation.rb', line 161 def group_ids=(value) @attributes[:group_ids] = value end |
#holiday_region ⇒ Object
string - Skip automation if there is a formal, observed holiday for this region.
400 401 402 |
# File 'lib/files.com/models/automation.rb', line 400 def holiday_region @attributes[:holiday_region] end |
#holiday_region=(value) ⇒ Object
404 405 406 |
# File 'lib/files.com/models/automation.rb', line 404 def holiday_region=(value) @attributes[:holiday_region] = value end |
#human_readable_schedule ⇒ Object
string - If trigger is custom_schedule or daily with times, Human readable schedule description for when the automation should be run.
283 284 285 |
# File 'lib/files.com/models/automation.rb', line 283 def human_readable_schedule @attributes[:human_readable_schedule] end |
#human_readable_schedule=(value) ⇒ Object
287 288 289 |
# File 'lib/files.com/models/automation.rb', line 287 def human_readable_schedule=(value) @attributes[:human_readable_schedule] = value end |
#id ⇒ Object
int64 - Automation ID
13 14 15 |
# File 'lib/files.com/models/automation.rb', line 13 def id @attributes[:id] end |
#id=(value) ⇒ Object
17 18 19 |
# File 'lib/files.com/models/automation.rb', line 17 def id=(value) @attributes[:id] = value end |
#ignore_locked_folders ⇒ Object
boolean - If true, the Lock Folders behavior will be disregarded for automated actions.
166 167 168 |
# File 'lib/files.com/models/automation.rb', line 166 def ignore_locked_folders @attributes[:ignore_locked_folders] end |
#ignore_locked_folders=(value) ⇒ Object
170 171 172 |
# File 'lib/files.com/models/automation.rb', line 170 def ignore_locked_folders=(value) @attributes[:ignore_locked_folders] = value end |
#import_urls ⇒ Object
array(object) - List of URLs to be imported and names to be used.
130 131 132 |
# File 'lib/files.com/models/automation.rb', line 130 def import_urls @attributes[:import_urls] end |
#import_urls=(value) ⇒ Object
134 135 136 |
# File 'lib/files.com/models/automation.rb', line 134 def import_urls=(value) @attributes[:import_urls] = value end |
#inbound_email_address ⇒ Object
string - If trigger is email, this is the address that triggers the Automation.
139 140 141 |
# File 'lib/files.com/models/automation.rb', line 139 def inbound_email_address @attributes[:inbound_email_address] end |
#inbound_email_address=(value) ⇒ Object
143 144 145 |
# File 'lib/files.com/models/automation.rb', line 143 def inbound_email_address=(value) @attributes[:inbound_email_address] = value end |
#interval ⇒ Object
string - If trigger is daily, this specifies how often to run this automation. One of: day, week, week_end, month, month_end, quarter, quarter_end, year, year_end
175 176 177 |
# File 'lib/files.com/models/automation.rb', line 175 def interval @attributes[:interval] end |
#interval=(value) ⇒ Object
179 180 181 |
# File 'lib/files.com/models/automation.rb', line 179 def interval=(value) @attributes[:interval] = value end |
#last_modified_at ⇒ Object
date-time - Time when automation was last modified. Does not change for name or description updates.
184 185 186 |
# File 'lib/files.com/models/automation.rb', line 184 def last_modified_at @attributes[:last_modified_at] end |
#last_modified_at=(value) ⇒ Object
188 189 190 |
# File 'lib/files.com/models/automation.rb', line 188 def last_modified_at=(value) @attributes[:last_modified_at] = value end |
#legacy_folder_matching ⇒ Object
boolean - If true, use the legacy behavior for this automation, where it can operate on folders in addition to just files. This behavior no longer works and should not be used.
193 194 195 |
# File 'lib/files.com/models/automation.rb', line 193 def legacy_folder_matching @attributes[:legacy_folder_matching] end |
#legacy_folder_matching=(value) ⇒ Object
197 198 199 |
# File 'lib/files.com/models/automation.rb', line 197 def legacy_folder_matching=(value) @attributes[:legacy_folder_matching] = value end |
#legacy_sync_ids ⇒ Object
array(int64) - IDs of remote sync folder behaviors to run by this Automation
328 329 330 |
# File 'lib/files.com/models/automation.rb', line 328 def legacy_sync_ids @attributes[:legacy_sync_ids] end |
#legacy_sync_ids=(value) ⇒ Object
332 333 334 |
# File 'lib/files.com/models/automation.rb', line 332 def legacy_sync_ids=(value) @attributes[:legacy_sync_ids] = value end |
#manual_run(params = {}) ⇒ Object
Manually Run Automation. v2 Automations require Site or Workspace Admin permission
Parameters:
items - array(object) - Initial items for a v2 manual trigger. Each item contains exactly one `file` path or `data` object.
423 424 425 426 427 428 429 430 431 432 |
# File 'lib/files.com/models/automation.rb', line 423 def manual_run(params = {}) params ||= {} params[:id] = @attributes[:id] raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id] raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: items must be an Array") if params[:items] and !params[:items].is_a?(Array) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/automations/#{@attributes[:id]}/manual_run", :post, params, @options) end |
#name ⇒ Object
string - Name for this automation.
202 203 204 |
# File 'lib/files.com/models/automation.rb', line 202 def name @attributes[:name] end |
#name=(value) ⇒ Object
206 207 208 |
# File 'lib/files.com/models/automation.rb', line 206 def name=(value) @attributes[:name] = value end |
#overwrite_files ⇒ Object
boolean - If true, existing files will be overwritten with new files on Move/Copy automations. Note: by default files will not be overwritten on Copy automations if they appear to be the same file size as the newly incoming file. Use the always_overwrite_size_matching_files option in conjunction with overwrite_files to override this behavior and overwrite files no matter what.
211 212 213 |
# File 'lib/files.com/models/automation.rb', line 211 def overwrite_files @attributes[:overwrite_files] end |
#overwrite_files=(value) ⇒ Object
215 216 217 |
# File 'lib/files.com/models/automation.rb', line 215 def overwrite_files=(value) @attributes[:overwrite_files] = value end |
#path ⇒ Object
string - Path on which this Automation runs. Supports globs, except on remote mounts. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
220 221 222 |
# File 'lib/files.com/models/automation.rb', line 220 def path @attributes[:path] end |
#path=(value) ⇒ Object
224 225 226 |
# File 'lib/files.com/models/automation.rb', line 224 def path=(value) @attributes[:path] = value end |
#path_time_zone ⇒ Object
string - Timezone to use when rendering timestamps in paths.
229 230 231 |
# File 'lib/files.com/models/automation.rb', line 229 def path_time_zone @attributes[:path_time_zone] end |
#path_time_zone=(value) ⇒ Object
233 234 235 |
# File 'lib/files.com/models/automation.rb', line 233 def path_time_zone=(value) @attributes[:path_time_zone] = value end |
#recurring_day ⇒ Object
int64 - If trigger type is daily, this specifies a day number to run in one of the supported intervals: week, month, quarter, year.
247 248 249 |
# File 'lib/files.com/models/automation.rb', line 247 def recurring_day @attributes[:recurring_day] end |
#recurring_day=(value) ⇒ Object
251 252 253 |
# File 'lib/files.com/models/automation.rb', line 251 def recurring_day=(value) @attributes[:recurring_day] = value end |
#retry_on_failure_interval_in_minutes ⇒ Object
int64 - If the Automation fails, retry at this interval (in minutes). Acceptable values are 5 through 1440 (one day). Set to null to disable.
256 257 258 |
# File 'lib/files.com/models/automation.rb', line 256 def retry_on_failure_interval_in_minutes @attributes[:retry_on_failure_interval_in_minutes] end |
#retry_on_failure_interval_in_minutes=(value) ⇒ Object
260 261 262 |
# File 'lib/files.com/models/automation.rb', line 260 def retry_on_failure_interval_in_minutes=(value) @attributes[:retry_on_failure_interval_in_minutes] = value end |
#retry_on_failure_number_of_attempts ⇒ Object
int64 - If the Automation fails, retry at most this many times. Maximum allowed value: 10. Set to null to disable.
265 266 267 |
# File 'lib/files.com/models/automation.rb', line 265 def retry_on_failure_number_of_attempts @attributes[:retry_on_failure_number_of_attempts] end |
#retry_on_failure_number_of_attempts=(value) ⇒ Object
269 270 271 |
# File 'lib/files.com/models/automation.rb', line 269 def retry_on_failure_number_of_attempts=(value) @attributes[:retry_on_failure_number_of_attempts] = value end |
#save ⇒ Object
518 519 520 521 522 523 524 525 526 527 |
# File 'lib/files.com/models/automation.rb', line 518 def save if @attributes[:id] new_obj = update(@attributes) else new_obj = Automation.create(@attributes, @options) end @attributes = new_obj.attributes true end |
#schedule ⇒ Object
object - If trigger is custom_schedule, Custom schedule description for when the automation should be run in json format.
274 275 276 |
# File 'lib/files.com/models/automation.rb', line 274 def schedule @attributes[:schedule] end |
#schedule=(value) ⇒ Object
278 279 280 |
# File 'lib/files.com/models/automation.rb', line 278 def schedule=(value) @attributes[:schedule] = value end |
#schedule_days_of_week ⇒ Object
array(int64) - If trigger is custom_schedule, Custom schedule description for when the automation should be run. 0-based days of the week. 0 is Sunday, 1 is Monday, etc.
292 293 294 |
# File 'lib/files.com/models/automation.rb', line 292 def schedule_days_of_week @attributes[:schedule_days_of_week] end |
#schedule_days_of_week=(value) ⇒ Object
296 297 298 |
# File 'lib/files.com/models/automation.rb', line 296 def schedule_days_of_week=(value) @attributes[:schedule_days_of_week] = value end |
#schedule_time_zone ⇒ Object
string - Time zone for scheduled times. If not set, times are interpreted as UTC.
310 311 312 |
# File 'lib/files.com/models/automation.rb', line 310 def schedule_time_zone @attributes[:schedule_time_zone] end |
#schedule_time_zone=(value) ⇒ Object
314 315 316 |
# File 'lib/files.com/models/automation.rb', line 314 def schedule_time_zone=(value) @attributes[:schedule_time_zone] = value end |
#schedule_times_of_day ⇒ Object
array(string) - Times of day to run in HH:MM format (24-hour). For custom_schedule, run at these times on specified days of week. For daily, run at these times on the scheduled interval date.
301 302 303 |
# File 'lib/files.com/models/automation.rb', line 301 def schedule_times_of_day @attributes[:schedule_times_of_day] end |
#schedule_times_of_day=(value) ⇒ Object
305 306 307 |
# File 'lib/files.com/models/automation.rb', line 305 def schedule_times_of_day=(value) @attributes[:schedule_times_of_day] = value end |
#source ⇒ Object
string - Source path/glob. See Automation docs for exact description, but this is used to filter for files in the path to find files to operate on. Supports globs, except on remote mounts.
319 320 321 |
# File 'lib/files.com/models/automation.rb', line 319 def source @attributes[:source] end |
#source=(value) ⇒ Object
323 324 325 |
# File 'lib/files.com/models/automation.rb', line 323 def source=(value) @attributes[:source] = value end |
#sync_ids ⇒ Object
array(int64) - IDs of syncs to run by this Automation. This is the new way to specify syncs, and it is recommended to use this instead of legacy_sync_ids.
337 338 339 |
# File 'lib/files.com/models/automation.rb', line 337 def sync_ids @attributes[:sync_ids] end |
#sync_ids=(value) ⇒ Object
341 342 343 |
# File 'lib/files.com/models/automation.rb', line 341 def sync_ids=(value) @attributes[:sync_ids] = value end |
#trigger ⇒ Object
string - How this automation is triggered to run.
355 356 357 |
# File 'lib/files.com/models/automation.rb', line 355 def trigger @attributes[:trigger] end |
#trigger=(value) ⇒ Object
359 360 361 |
# File 'lib/files.com/models/automation.rb', line 359 def trigger=(value) @attributes[:trigger] = value end |
#trigger_actions ⇒ Object
array(string) - If trigger is action, this is the list of action types on which to trigger the automation. Valid actions are create, copy, move, archived_delete, update, read, destroy
346 347 348 |
# File 'lib/files.com/models/automation.rb', line 346 def trigger_actions @attributes[:trigger_actions] end |
#trigger_actions=(value) ⇒ Object
350 351 352 |
# File 'lib/files.com/models/automation.rb', line 350 def trigger_actions=(value) @attributes[:trigger_actions] = value end |
#update(params = {}) ⇒ Object
Parameters:
source - string - Source path/glob. See Automation docs for exact description, but this is used to filter for files in the `path` to find files to operate on. Supports globs, except on remote mounts.
destinations - array(string) - A list of destination paths. Use a trailing slash for folder destinations and omit it for file destinations.
destination_replace_from - string - If set, this string in the destination path will be replaced with the value in `destination_replace_to`.
destination_replace_to - string - If set, this string will replace the value `destination_replace_from` in the destination filename. You can use special patterns here.
interval - string - How often to run this automation? One of: `day`, `week`, `week_end`, `month`, `month_end`, `quarter`, `quarter_end`, `year`, `year_end`
path - string - Path on which this Automation runs. Supports globs, except on remote mounts.
legacy_sync_ids - string - A list of legacy sync IDs the automation is associated with. If sent as a string, it should be comma-delimited.
sync_ids - string - A list of sync IDs the automation is associated with. If sent as a string, it should be comma-delimited.
user_ids - string - A list of user IDs the automation is associated with. If sent as a string, it should be comma-delimited.
group_ids - string - A list of group IDs the automation is associated with. If sent as a string, it should be comma-delimited.
schedule_days_of_week - array(int64) - If trigger is `custom_schedule`. A list of days of the week to run this automation. 0 is Sunday, 1 is Monday, etc.
schedule_times_of_day - array(string) - Times of day to run in HH:MM format (24-hour). Required for `custom_schedule` triggers. Optional for `daily` triggers - if not set, runs at midnight UTC.
schedule_time_zone - string - Time zone for scheduled times. Optional for both `custom_schedule` and `daily` triggers. If not set, times are interpreted as UTC.
holiday_region - string - Skip automation on holidays in this region. Optional for both `custom_schedule` and `daily` triggers.
always_overwrite_size_matching_files - boolean - Ordinarily, files with identical size in the source and destination will be skipped from copy operations to prevent wasted transfer. If this flag is `true` we will overwrite the destination file always. Note that this may cause large amounts of wasted transfer usage. This setting has no effect unless `overwrite_files` is also set to `true`.
always_serialize_jobs - boolean - Ordinarily, we will allow automation runs to run in parallel for non-scheduled automations. If this flag is `true` we will force automation runs to be serialized (run one at a time, one after another). This can resolve some issues with race conditions on remote systems at the cost of some performance.
description - string - Description for the this Automation.
disabled - boolean - If true, this automation will not run.
exclude_pattern - string - If set, this glob pattern will exclude files from the automation. Supports globs, except on remote mounts.
import_urls - array(object) - List of URLs to be imported and names to be used.
flatten_destination_structure - boolean - Normally copy and move automations that use globs will implicitly preserve the source folder structure in the destination. If this flag is `true`, the source folder structure will be flattened in the destination. This is useful for copying or moving files from multiple folders into a single destination folder.
ignore_locked_folders - boolean - If true, the Lock Folders behavior will be disregarded for automated actions.
legacy_folder_matching - boolean - DEPRECATED: If `true`, use the legacy behavior for this automation, where it can operate on folders in addition to just files. This behavior no longer works and should not be used.
name - string - Name for this automation.
overwrite_files - boolean - If true, existing files will be overwritten with new files on Move/Copy automations. Note: by default files will not be overwritten on Copy automations if they appear to be the same file size as the newly incoming file. Use the `always_overwrite_size_matching_files` option in conjunction with `overwrite_files` to override this behavior and overwrite files no matter what.
path_time_zone - string - Timezone to use when rendering timestamps in paths.
retry_on_failure_interval_in_minutes - int64 - If the Automation fails, retry at this interval (in minutes). Acceptable values are 5 through 1440 (one day). Set to null to disable.
retry_on_failure_number_of_attempts - int64 - If the Automation fails, retry at most this many times. Maximum allowed value: 10. Set to null to disable.
trigger - string - How this automation is triggered to run.
trigger_actions - array(string) - If trigger is `action`, this is the list of action types on which to trigger the automation. Valid actions are create, copy, move, archived_delete, update, read, destroy
value - object - A Hash of attributes specific to the automation type.
recurring_day - int64 - If trigger type is `daily`, this specifies a day number to run in one of the supported intervals: `week`, `month`, `quarter`, `year`.
automation - string - Automation type
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 |
# File 'lib/files.com/models/automation.rb', line 468 def update(params = {}) params ||= {} params[:id] = @attributes[:id] raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id] raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: source must be an String") if params[:source] and !params[:source].is_a?(String) raise InvalidParameterError.new("Bad parameter: destinations must be an Array") if params[:destinations] and !params[:destinations].is_a?(Array) raise InvalidParameterError.new("Bad parameter: destination_replace_from must be an String") if params[:destination_replace_from] and !params[:destination_replace_from].is_a?(String) raise InvalidParameterError.new("Bad parameter: destination_replace_to must be an String") if params[:destination_replace_to] and !params[:destination_replace_to].is_a?(String) raise InvalidParameterError.new("Bad parameter: interval must be an String") if params[:interval] and !params[:interval].is_a?(String) raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String) raise InvalidParameterError.new("Bad parameter: legacy_sync_ids must be an String") if params[:legacy_sync_ids] and !params[:legacy_sync_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: sync_ids must be an String") if params[:sync_ids] and !params[:sync_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params[:user_ids] and !params[:user_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: group_ids must be an String") if params[:group_ids] and !params[:group_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: schedule_days_of_week must be an Array") if params[:schedule_days_of_week] and !params[:schedule_days_of_week].is_a?(Array) raise InvalidParameterError.new("Bad parameter: schedule_times_of_day must be an Array") if params[:schedule_times_of_day] and !params[:schedule_times_of_day].is_a?(Array) raise InvalidParameterError.new("Bad parameter: schedule_time_zone must be an String") if params[:schedule_time_zone] and !params[:schedule_time_zone].is_a?(String) raise InvalidParameterError.new("Bad parameter: holiday_region must be an String") if params[:holiday_region] and !params[:holiday_region].is_a?(String) raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String) raise InvalidParameterError.new("Bad parameter: exclude_pattern must be an String") if params[:exclude_pattern] and !params[:exclude_pattern].is_a?(String) raise InvalidParameterError.new("Bad parameter: import_urls must be an Array") if params[:import_urls] and !params[:import_urls].is_a?(Array) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise InvalidParameterError.new("Bad parameter: path_time_zone must be an String") if params[:path_time_zone] and !params[:path_time_zone].is_a?(String) raise InvalidParameterError.new("Bad parameter: retry_on_failure_interval_in_minutes must be an Integer") if params[:retry_on_failure_interval_in_minutes] and !params[:retry_on_failure_interval_in_minutes].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: retry_on_failure_number_of_attempts must be an Integer") if params[:retry_on_failure_number_of_attempts] and !params[:retry_on_failure_number_of_attempts].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: trigger must be an String") if params[:trigger] and !params[:trigger].is_a?(String) raise InvalidParameterError.new("Bad parameter: trigger_actions must be an Array") if params[:trigger_actions] and !params[:trigger_actions].is_a?(Array) raise InvalidParameterError.new("Bad parameter: recurring_day must be an Integer") if params[:recurring_day] and !params[:recurring_day].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: automation must be an String") if params[:automation] and !params[:automation].is_a?(String) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/automations/#{@attributes[:id]}", :patch, params, @options) end |
#upgrade(params = {}) ⇒ Object
Upgrade a legacy Automation to Automation v2
409 410 411 412 413 414 415 416 417 |
# File 'lib/files.com/models/automation.rb', line 409 def upgrade(params = {}) params ||= {} params[:id] = @attributes[:id] raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id] raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/automations/#{@attributes[:id]}/upgrade", :post, params, @options) end |
#user_id ⇒ Object
int64 - User ID of the Automation's creator.
364 365 366 |
# File 'lib/files.com/models/automation.rb', line 364 def user_id @attributes[:user_id] end |
#user_id=(value) ⇒ Object
368 369 370 |
# File 'lib/files.com/models/automation.rb', line 368 def user_id=(value) @attributes[:user_id] = value end |
#user_ids ⇒ Object
array(int64) - IDs of Users for the Automation (i.e. who to Request File from)
373 374 375 |
# File 'lib/files.com/models/automation.rb', line 373 def user_ids @attributes[:user_ids] end |
#user_ids=(value) ⇒ Object
377 378 379 |
# File 'lib/files.com/models/automation.rb', line 377 def user_ids=(value) @attributes[:user_ids] = value end |
#value ⇒ Object
object - A Hash of attributes specific to the automation type.
382 383 384 |
# File 'lib/files.com/models/automation.rb', line 382 def value @attributes[:value] end |
#value=(value) ⇒ Object
386 387 388 |
# File 'lib/files.com/models/automation.rb', line 386 def value=(value) @attributes[:value] = value end |
#version ⇒ Object
int64 - Current Automation v2 definition version.
238 239 240 |
# File 'lib/files.com/models/automation.rb', line 238 def version @attributes[:version] end |
#version=(value) ⇒ Object
242 243 244 |
# File 'lib/files.com/models/automation.rb', line 242 def version=(value) @attributes[:version] = value end |
#webhook_url ⇒ Object
string - If trigger is webhook, this is the URL of the webhook to trigger the Automation.
391 392 393 |
# File 'lib/files.com/models/automation.rb', line 391 def webhook_url @attributes[:webhook_url] end |
#webhook_url=(value) ⇒ Object
395 396 397 |
# File 'lib/files.com/models/automation.rb', line 395 def webhook_url=(value) @attributes[:webhook_url] = value end |
#workspace_id ⇒ Object
int64 - Workspace ID
22 23 24 |
# File 'lib/files.com/models/automation.rb', line 22 def workspace_id @attributes[:workspace_id] end |
#workspace_id=(value) ⇒ Object
26 27 28 |
# File 'lib/files.com/models/automation.rb', line 26 def workspace_id=(value) @attributes[:workspace_id] = value end |