sfrest 0.0.38 → 0.0.41
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sfrest/connection.rb +4 -0
- data/lib/sfrest/cron.rb +53 -0
- data/lib/sfrest/factory_standard_domain.rb +49 -0
- data/lib/sfrest/site_guard.rb +45 -0
- data/lib/sfrest/site_ownership.rb +30 -0
- data/lib/sfrest/site_update_priority.rb +40 -0
- data/lib/sfrest/task_log_settings.rb +43 -0
- data/lib/sfrest/version.rb +1 -1
- data/lib/sfrest.rb +4 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56ae7ea4f4d053d0263ad970320261fb9e2cea437d24b6785ddb5661d8b9a41a
|
4
|
+
data.tar.gz: 6c9eae93565ffa04bd0ba347838e51b2a33d7c4bececd1819265ea26d31a4d88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4677baf9be68f2c5d00b86d223ff79721eaae9d52446b0683bd55bc08cedfba094c6594a4b5cbf84bd44a90751851252c76b190d01341a60ee48f2d328db04c
|
7
|
+
data.tar.gz: d5feaaa64b0be6c1267b9eb5ec9d4d94690ab33c5a9e5d31f7c68ddc7c4300d7c766dbd5681527b2ccea255298d7580a3c79b7784ed66a5274f910e70f6a458d
|
data/lib/sfrest/connection.rb
CHANGED
@@ -169,14 +169,18 @@ module SFRest
|
|
169
169
|
collection
|
170
170
|
cron
|
171
171
|
domains
|
172
|
+
factory_standard_domain
|
172
173
|
group
|
173
174
|
info
|
174
175
|
profile
|
175
176
|
role
|
176
177
|
site
|
178
|
+
site_guard
|
177
179
|
site_ownership
|
180
|
+
site_update_priority
|
178
181
|
stage
|
179
182
|
task
|
183
|
+
task_log_settings
|
180
184
|
theme
|
181
185
|
update
|
182
186
|
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,49 @@
|
|
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 standard domain feature.
|
7
|
+
class Factory_standard_domain
|
8
|
+
# rubocop: enable Naming/ClassAndModuleCamelCase
|
9
|
+
|
10
|
+
# @param [SFRest::Connection] conn
|
11
|
+
def initialize(conn)
|
12
|
+
@conn = conn
|
13
|
+
end
|
14
|
+
|
15
|
+
# Get current factory standard domains settings
|
16
|
+
#
|
17
|
+
# @return [Array] an array of factory standard domains with their associated settings.
|
18
|
+
def factory_standard_domain_mapping
|
19
|
+
@conn.get('/api/v1/factory-standard-domains')
|
20
|
+
end
|
21
|
+
|
22
|
+
# Enable the factory standard domains settings for a given template name.
|
23
|
+
# @param [String] domain_template_name the domain template name.
|
24
|
+
# @param [Array] new_template the templates to be used.
|
25
|
+
#
|
26
|
+
# @return [Array] an array of factory standard domains with their associated settings.
|
27
|
+
def enable_factory_standard_domain_template(domain_template_name, new_template = [])
|
28
|
+
payload = {
|
29
|
+
'new_template' => new_template
|
30
|
+
}.to_json
|
31
|
+
@conn.put("/api/v1/factory-standard-domains/#{domain_template_name}", payload)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Disable the centralized role management settings for a given role.
|
35
|
+
# @param [String] domain_template_name the domain template name.
|
36
|
+
#
|
37
|
+
# @return [Array] an array of factory standard domains with their associated settings.
|
38
|
+
def disable_factory_standard_domain_template(domain_template_name)
|
39
|
+
@conn.delete("/api/v1/factory-standard-domains/#{domain_template_name}")
|
40
|
+
end
|
41
|
+
|
42
|
+
# Backfills the factory standard domains using the templates defined.
|
43
|
+
#
|
44
|
+
# @return [Array] an array containing the message and task_id for that operation.
|
45
|
+
def backfill_domains
|
46
|
+
@conn.post('/api/v1/factory-standard-domains', {}.to_json)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
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 site guard feature.
|
7
|
+
class Site_guard
|
8
|
+
# rubocop: enable Naming/ClassAndModuleCamelCase
|
9
|
+
|
10
|
+
# @param [SFRest::Connection] conn
|
11
|
+
def initialize(conn)
|
12
|
+
@conn = conn
|
13
|
+
end
|
14
|
+
|
15
|
+
# Get current site guard settings.
|
16
|
+
#
|
17
|
+
# @return [Array] an array containing current settings.
|
18
|
+
def current_settings
|
19
|
+
@conn.get('/api/v1/site-guard')
|
20
|
+
end
|
21
|
+
|
22
|
+
# Set and enables the site guard settings.
|
23
|
+
# @param [String] The message which will be displayed by the site guard.
|
24
|
+
# @param [String] The username which will be required by the site guard.
|
25
|
+
# @param [String] The password which will be required by the site guard.
|
26
|
+
#
|
27
|
+
# @return [Array] an array containing the message given by the server.
|
28
|
+
def enable_site_guard(message, username, password)
|
29
|
+
payload = {
|
30
|
+
'message' => message,
|
31
|
+
'username' => username,
|
32
|
+
'password' => password
|
33
|
+
}
|
34
|
+
|
35
|
+
@conn.put('/api/v1/site-guard', payload.to_json)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Removes and disableds the site guard settings.
|
39
|
+
#
|
40
|
+
# @return [Array] an array containing the message given by the server.
|
41
|
+
def disable_site_guard
|
42
|
+
@conn.delete('/api/v1/site-guard')
|
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,40 @@
|
|
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 update priority feature.
|
7
|
+
class Site_update_priority
|
8
|
+
# rubocop: enable Naming/ClassAndModuleCamelCase
|
9
|
+
|
10
|
+
# @param [SFRest::Connection] conn
|
11
|
+
def initialize(conn)
|
12
|
+
@conn = conn
|
13
|
+
end
|
14
|
+
|
15
|
+
# Get current site update priority.
|
16
|
+
#
|
17
|
+
# @return [Array] an array of the current site update priority.
|
18
|
+
def current_update_priority
|
19
|
+
@conn.get('/api/v1/site-update-priority')
|
20
|
+
end
|
21
|
+
|
22
|
+
# Set the site update priority list.
|
23
|
+
# @param [Array] site node ids in the desired update order.
|
24
|
+
#
|
25
|
+
# @return [Array] an array containing the message given by the server.
|
26
|
+
def change_update_priority(priority)
|
27
|
+
payload = {
|
28
|
+
'priority' => priority
|
29
|
+
}.to_json
|
30
|
+
@conn.put('/api/v1/site-update-priority', payload)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Reset the site update priority to the default.
|
34
|
+
#
|
35
|
+
# @return [Array] an array containing the message given by the server.
|
36
|
+
def reset_update_priority
|
37
|
+
@conn.delete('/api/v1/site-update-priority')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
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/version.rb
CHANGED
data/lib/sfrest.rb
CHANGED
@@ -17,15 +17,19 @@ require 'sfrest/connection'
|
|
17
17
|
require 'sfrest/cron'
|
18
18
|
require 'sfrest/domains'
|
19
19
|
require 'sfrest/error'
|
20
|
+
require 'sfrest/factory_standard_domain'
|
20
21
|
require 'sfrest/group'
|
21
22
|
require 'sfrest/info'
|
22
23
|
require 'sfrest/profile'
|
23
24
|
require 'sfrest/pathbuilder'
|
24
25
|
require 'sfrest/role'
|
25
26
|
require 'sfrest/site'
|
27
|
+
require 'sfrest/site_guard'
|
26
28
|
require 'sfrest/site_ownership'
|
29
|
+
require 'sfrest/site_update_priority'
|
27
30
|
require 'sfrest/stage'
|
28
31
|
require 'sfrest/task'
|
32
|
+
require 'sfrest/task_log_settings'
|
29
33
|
require 'sfrest/theme'
|
30
34
|
require 'sfrest/update'
|
31
35
|
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.
|
4
|
+
version: 0.0.41
|
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-
|
11
|
+
date: 2022-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -110,15 +110,19 @@ files:
|
|
110
110
|
- lib/sfrest/cron.rb
|
111
111
|
- lib/sfrest/domains.rb
|
112
112
|
- lib/sfrest/error.rb
|
113
|
+
- lib/sfrest/factory_standard_domain.rb
|
113
114
|
- lib/sfrest/group.rb
|
114
115
|
- lib/sfrest/info.rb
|
115
116
|
- lib/sfrest/pathbuilder.rb
|
116
117
|
- lib/sfrest/profile.rb
|
117
118
|
- lib/sfrest/role.rb
|
118
119
|
- lib/sfrest/site.rb
|
120
|
+
- lib/sfrest/site_guard.rb
|
119
121
|
- lib/sfrest/site_ownership.rb
|
122
|
+
- lib/sfrest/site_update_priority.rb
|
120
123
|
- lib/sfrest/stage.rb
|
121
124
|
- lib/sfrest/task.rb
|
125
|
+
- lib/sfrest/task_log_settings.rb
|
122
126
|
- lib/sfrest/theme.rb
|
123
127
|
- lib/sfrest/update.rb
|
124
128
|
- lib/sfrest/usage.rb
|
@@ -144,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
148
|
- !ruby/object:Gem::Version
|
145
149
|
version: '0'
|
146
150
|
requirements: []
|
147
|
-
rubygems_version: 3.
|
151
|
+
rubygems_version: 3.3.12
|
148
152
|
signing_key:
|
149
153
|
specification_version: 4
|
150
154
|
summary: Acquia Site Factory Rest API.
|