sfrest 0.0.40 → 0.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef1480dd089e071458111ef6c8f2ea4e0e4aa7ff7bfc509e2c150f33167f0e69
4
- data.tar.gz: f90b9028fbf5e4b117d8856144d271516c5f4af6e9ae04800d55c1f1cc2c48db
3
+ metadata.gz: 072b940e3399ceb72f13d948ea766039eb4452c62925b1c2a1492072c5fb8557
4
+ data.tar.gz: 23e9bee2aefc2abce1b9aa86c0c99fee8fb3d7c4ca716b8957923f75ca0e0c5c
5
5
  SHA512:
6
- metadata.gz: e940d9ece6a6ad534a9d3025e3dfe2aa56ef3026f74d7efbdaa84fe9add7d9b62831d68d87a0bf12b7e2ccb5d91ba19eeb6b3822ce23e82b992c15d7d531a166
7
- data.tar.gz: b488d33656b6ebc149f35f488da4963c34994fe762482a08717ae78f783db9d9354663803b7a9eedc5773afeeb69ed153c54a4efe1f7c66d5b38fb715d15f25b
6
+ metadata.gz: f07d0676a52f33daf4d63564066fd3318ab25a11032d464444bc4111716b364618c71febb5ec948c073af6fc4b429baccc8ee7d3b3b01b0a67c165b08872e555
7
+ data.tar.gz: 5be39a40373a247f71142b07d942644a3c9469e312e1460e3dd4e449e346da69276a401c28dee62446bf46d69048391fa62848542311c9d5f3e5969085f13184
@@ -174,12 +174,14 @@ module SFRest
174
174
  info
175
175
  profile
176
176
  role
177
+ security_settings
177
178
  site
178
179
  site_guard
179
180
  site_ownership
180
181
  site_update_priority
181
182
  stage
182
183
  task
184
+ task_log_settings
183
185
  theme
184
186
  update
185
187
  usage
data/lib/sfrest/cron.rb CHANGED
@@ -24,5 +24,58 @@ module SFRest
24
24
  def get_cron_job(nid)
25
25
  @conn.get("/api/v1/cronjobs/#{nid}")
26
26
  end
27
+
28
+ # Creates a new cron job
29
+ # @param [string] cron job name
30
+ # @param [string] cron job command
31
+ # @param [string] A unix cron expression
32
+ # @param [string] Sites affected by cron
33
+ # @param [int] if the cron should be enabled
34
+ # @param [int] The percentage of cron threads that should be used for this cron
35
+ # @param [array] An array of stack ids for which the cron should be enabled
36
+ # rubocop: disable Metrics/ParameterLists
37
+ def create_cron_job(name, command, interval, scope, enabled, thread_percentage, stacks)
38
+ # rubocop: enable Metrics/ParameterLists
39
+ payload = {
40
+ 'name' => name,
41
+ 'command' => command,
42
+ 'interval' => interval,
43
+ 'sites_affected' => scope,
44
+ 'enabled' => enabled,
45
+ 'thread_percentage' => thread_percentage,
46
+ 'stacks' => stacks
47
+ }.to_json
48
+ @conn.post('/api/v1/cronjobs', payload)
49
+ end
50
+
51
+ # Edits a cron job by its node id
52
+ # @param [int] cron job nid
53
+ # @param [string] cron job name
54
+ # @param [string] cron job command
55
+ # @param [string] A unix cron expression
56
+ # @param [string] Sites affected by cron
57
+ # @param [int] if the cron should be enabled
58
+ # @param [int] The percentage of cron threads that should be used for this cron
59
+ # @param [array] An array of stack ids for which the cron should be enabled
60
+ # rubocop: disable Metrics/ParameterLists
61
+ def edit_cron_job(nid, name, command, interval, scope, enabled, thread_percentage, stacks)
62
+ # rubocop: enable Metrics/ParameterLists
63
+ payload = {
64
+ 'name' => name,
65
+ 'command' => command,
66
+ 'interval' => interval,
67
+ 'sites_affected' => scope,
68
+ 'enabled' => enabled,
69
+ 'thread_percentage' => thread_percentage,
70
+ 'stacks' => stacks
71
+ }.to_json
72
+ @conn.put("/api/v1/cronjobs/#{nid}", payload)
73
+ end
74
+
75
+ # Deletes a cron job by its node id
76
+ # @param [int] cron job nid
77
+ def delete_cron_job(nid)
78
+ @conn.delete("/api/v1/cronjobs/#{nid}")
79
+ end
27
80
  end
28
81
  end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SFRest
4
+ # We need to keep this naming due to the way connection.rb autoloads things.
5
+ # rubocop: disable Naming/ClassAndModuleCamelCase
6
+ # Manage the factory security settings.
7
+ class Security_settings
8
+ # rubocop: enable Naming/ClassAndModuleCamelCase
9
+
10
+ # @param [SFRest::Connection] conn
11
+ def initialize(conn)
12
+ @conn = conn
13
+ end
14
+
15
+ # Get current security settings.
16
+ #
17
+ # @return [Array] an array containing current security settings.
18
+ def current_security_settings
19
+ @conn.get('/api/v1/security')
20
+ end
21
+
22
+ # Change security settings.
23
+ #
24
+ # @param [Hash] data Options to the security settings
25
+ # @option data [Integer] 'minimum_password_length'
26
+ # @option data [String] 'minimum_required_password_strength'
27
+ # @option data [Boolean] 'two_step_verification'
28
+ # @option data [Boolean] 'sign_out_inactive_user_accounts'
29
+ # @option data [Integer] 'sign_out_inactivity_time'
30
+ # @option data [Boolean] 'automatically_disable_accounts'
31
+ # @option data [Integer] 'automatically_disable_accounts_after_days'
32
+ #
33
+ # @return [Array] an array containing the message given by the server.
34
+ def change_security_settings(data)
35
+ @conn.put('/api/v1/security', data.to_json)
36
+ end
37
+
38
+ # Reset current security settings.
39
+ #
40
+ # @return [Array] an array containing the message given by the server.
41
+ def reset_security_settings
42
+ @conn.delete('/api/v1/security')
43
+ end
44
+ end
45
+ end
@@ -37,5 +37,35 @@ module SFRest
37
37
  def remove_default_owner
38
38
  @conn.delete('/api/v1/site-ownership')
39
39
  end
40
+
41
+ # Transfers site ownership using recipients username.
42
+ # @param [Integer] site id.
43
+ # @param [String] username.
44
+ # @param [Boolean] force_transfer.
45
+ #
46
+ # @return [Array] an array containing the message given by the server.
47
+ def transfer_site_ownership_using_username(site_id, username, force_transfer)
48
+ payload = {
49
+ 'username' => username,
50
+ 'force_transfer' => force_transfer
51
+ }
52
+
53
+ @conn.post("/api/v1/site-ownership/#{site_id}", payload.to_json)
54
+ end
55
+
56
+ # Transfers site ownership using recipients email.
57
+ # @param [Integer] site id.
58
+ # @param [String] email.
59
+ # @param [Boolean] force_transfer.
60
+ #
61
+ # @return [Array] an array containing the message given by the server.
62
+ def transfer_site_ownership_using_email(site_id, email, force_transfer)
63
+ payload = {
64
+ 'email' => email,
65
+ 'force_transfer' => force_transfer
66
+ }
67
+
68
+ @conn.post("/api/v1/site-ownership/#{site_id}", payload.to_json)
69
+ end
40
70
  end
41
71
  end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SFRest
4
+ # We need to keep this naming due to the way connection.rb autoloads things.
5
+ # rubocop: disable Naming/ClassAndModuleCamelCase
6
+ # Manage the site default ownership feature.
7
+ class Task_log_settings
8
+ # rubocop: enable Naming/ClassAndModuleCamelCase
9
+
10
+ # @param [SFRest::Connection] conn
11
+ def initialize(conn)
12
+ @conn = conn
13
+ end
14
+
15
+ # Get current task log settings.
16
+ #
17
+ # @return [Array] an array containing current settings.
18
+ def current_task_log_settings
19
+ @conn.get('/api/v1/task-log-settings')
20
+ end
21
+
22
+ # Set the site ownership settings.
23
+ # @param [String] The maximum log level that will be written to the log.
24
+ # @param [String] Level of Wip log messages to keep on successful completion.
25
+ #
26
+ # @return [Array] an array containing the message given by the server.
27
+ def edit_task_log_settings(wip_log_maximum_level, wip_log_level)
28
+ payload = {
29
+ 'wip_log_maximum_level' => wip_log_maximum_level,
30
+ 'wip_log_level' => wip_log_level
31
+ }
32
+
33
+ @conn.put('/api/v1/task-log-settings', payload.to_json)
34
+ end
35
+
36
+ # Reset current task log settings.
37
+ #
38
+ # @return [Array] an array containing the message given by the server.
39
+ def reset_task_log_settings
40
+ @conn.delete('/api/v1/task-log-settings')
41
+ end
42
+ end
43
+ end
data/lib/sfrest/update.rb CHANGED
@@ -100,6 +100,22 @@ module SFRest
100
100
  @multi_stack ||= @conn.codebase.list['stacks'].size > 1
101
101
  end
102
102
 
103
+ # Terminates an updater.
104
+ def terminate_updater(update_id)
105
+ current_path = "/api/v1/update/#{update_id}"
106
+ @conn.delete(current_path)
107
+ end
108
+
109
+ # Changes the updater start time.
110
+ def change_updater_start_time(updater_id, new_update_time)
111
+ current_path = '/api/v1/update/change_time'
112
+ payload = {
113
+ 'updater_id' => updater_id,
114
+ 'new_update_time' => new_update_time
115
+ }.to_json
116
+ @conn.post(current_path, payload)
117
+ end
118
+
103
119
  # Determines if the v2 endpoint exists.
104
120
  # A factory with the endpoint will raise an SFRest::BadRequestError
105
121
  # A factory without the endpoint will raise SFRest::InvalidResponse
@@ -2,5 +2,5 @@
2
2
 
3
3
  module SFRest
4
4
  # Just tracks the version of sfrest.
5
- VERSION = '0.0.40'
5
+ VERSION = '0.0.43'
6
6
  end
data/lib/sfrest.rb CHANGED
@@ -23,12 +23,14 @@ require 'sfrest/info'
23
23
  require 'sfrest/profile'
24
24
  require 'sfrest/pathbuilder'
25
25
  require 'sfrest/role'
26
+ require 'sfrest/security_settings'
26
27
  require 'sfrest/site'
27
28
  require 'sfrest/site_guard'
28
29
  require 'sfrest/site_ownership'
29
30
  require 'sfrest/site_update_priority'
30
31
  require 'sfrest/stage'
31
32
  require 'sfrest/task'
33
+ require 'sfrest/task_log_settings'
32
34
  require 'sfrest/theme'
33
35
  require 'sfrest/update'
34
36
  require 'sfrest/usage'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sfrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.40
4
+ version: 0.0.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - ACSF Engineering
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-08 00:00:00.000000000 Z
11
+ date: 2022-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -116,12 +116,14 @@ files:
116
116
  - lib/sfrest/pathbuilder.rb
117
117
  - lib/sfrest/profile.rb
118
118
  - lib/sfrest/role.rb
119
+ - lib/sfrest/security_settings.rb
119
120
  - lib/sfrest/site.rb
120
121
  - lib/sfrest/site_guard.rb
121
122
  - lib/sfrest/site_ownership.rb
122
123
  - lib/sfrest/site_update_priority.rb
123
124
  - lib/sfrest/stage.rb
124
125
  - lib/sfrest/task.rb
126
+ - lib/sfrest/task_log_settings.rb
125
127
  - lib/sfrest/theme.rb
126
128
  - lib/sfrest/update.rb
127
129
  - lib/sfrest/usage.rb
@@ -147,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
149
  - !ruby/object:Gem::Version
148
150
  version: '0'
149
151
  requirements: []
150
- rubygems_version: 3.2.17
152
+ rubygems_version: 3.3.12
151
153
  signing_key:
152
154
  specification_version: 4
153
155
  summary: Acquia Site Factory Rest API.