sfrest 0.0.36 → 0.0.39
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 +4 -4
- data/lib/sfrest/centralized_role_management.rb +42 -0
- data/lib/sfrest/connection.rb +4 -0
- data/lib/sfrest/cron.rb +28 -0
- data/lib/sfrest/factory_standard_domain.rb +49 -0
- data/lib/sfrest/site_ownership.rb +41 -0
- data/lib/sfrest/stage.rb +5 -2
- data/lib/sfrest/version.rb +1 -1
- data/lib/sfrest.rb +4 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e2e8fc07cf9577be1a4a1ccca84a3049b992e27e318a8b1d6d7fcd575f82fee
|
4
|
+
data.tar.gz: 4c234cc4ce912626b82c1899a139026c02c214176a83018118e57d0714ef2dc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60dc925219e31dce103270055b1dbf73285f4b6ee4a08d18f697603a4d85c17eeb04aeaf7c82c0155ceed9514867cb2a7830955632f7d08217070d4db2c0878b
|
7
|
+
data.tar.gz: 65076385c8d487c6adc87d1981bf8a39005f9208056b0733ec2a322d80949d2f46808833bd762309e0280f3b760c45c8898bf93d40e50c1fcca4b3b51eac896c
|
@@ -0,0 +1,42 @@
|
|
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 centralized role management feature.
|
7
|
+
class Centralized_role_management
|
8
|
+
# rubocop: enable Naming/ClassAndModuleCamelCase
|
9
|
+
|
10
|
+
# @param [SFRest::Connection] conn
|
11
|
+
def initialize(conn)
|
12
|
+
@conn = conn
|
13
|
+
end
|
14
|
+
|
15
|
+
# Get current centralized role management settings
|
16
|
+
#
|
17
|
+
# @return [Array] an array of roles with their associated settings.
|
18
|
+
def centralized_role_mapping
|
19
|
+
@conn.get('/api/v1/centralized-role-management')
|
20
|
+
end
|
21
|
+
|
22
|
+
# Enable the centralized role management settings for a given role.
|
23
|
+
# @param [String] factory_role the site factory role.
|
24
|
+
# @param [String] site_role the corresponding role on the site.
|
25
|
+
#
|
26
|
+
# @return [Array] an array of roles with their associated settings.
|
27
|
+
def enable_role_mapping(factory_role, site_role = '')
|
28
|
+
payload = {
|
29
|
+
'site_role' => site_role
|
30
|
+
}.to_json
|
31
|
+
@conn.put("/api/v1/centralized-role-management/#{factory_role}", payload)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Disable the centralized role management settings for a given role.
|
35
|
+
# @param [String] factory_role the site factory role.
|
36
|
+
#
|
37
|
+
# @return [Array] an array of roles with their associated settings.
|
38
|
+
def disable_role_mapping(factory_role)
|
39
|
+
@conn.delete("/api/v1/centralized-role-management/#{factory_role}")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/sfrest/connection.rb
CHANGED
@@ -164,14 +164,18 @@ module SFRest
|
|
164
164
|
# NOTE: accessor == Class_name.to_lower
|
165
165
|
REST_METHODS = %w[audit
|
166
166
|
backup
|
167
|
+
centralized_role_management
|
167
168
|
codebase
|
168
169
|
collection
|
170
|
+
cron
|
169
171
|
domains
|
172
|
+
factory_standard_domain
|
170
173
|
group
|
171
174
|
info
|
172
175
|
profile
|
173
176
|
role
|
174
177
|
site
|
178
|
+
site_ownership
|
175
179
|
stage
|
176
180
|
task
|
177
181
|
theme
|
data/lib/sfrest/cron.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SFRest
|
4
|
+
# Manipulates SF cron jobs.
|
5
|
+
class Cron
|
6
|
+
# @param [SFRest::Connection] conn
|
7
|
+
def initialize(conn)
|
8
|
+
@conn = conn
|
9
|
+
end
|
10
|
+
|
11
|
+
# Gets a list of cron jobs
|
12
|
+
# @param [Integer] page
|
13
|
+
# @param [Integer] items per page
|
14
|
+
def get_cron_jobs(page = nil, limit = nil)
|
15
|
+
args = {}
|
16
|
+
args['page'] = page unless page.nil?
|
17
|
+
args['limit'] = limit unless limit.nil?
|
18
|
+
url = "/api/v1/cronjobs?#{args.map { |k, v| "#{k}=#{v}" }.join('&')}"
|
19
|
+
@conn.get(url)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Gets a cron job by its node id
|
23
|
+
# @param [Integer] cron job nid
|
24
|
+
def get_cron_job(nid)
|
25
|
+
@conn.get("/api/v1/cronjobs/#{nid}")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
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,41 @@
|
|
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 Site_ownership
|
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 ownership settings.
|
16
|
+
#
|
17
|
+
# @return [Array] an array containing current settings.
|
18
|
+
def default_ownership
|
19
|
+
@conn.get('/api/v1/site-ownership')
|
20
|
+
end
|
21
|
+
|
22
|
+
# Set the site ownership settings.
|
23
|
+
# @param [String] The default owner username. The user has to have the "Platform admin" role.
|
24
|
+
#
|
25
|
+
# @return [Array] an array containing the message given by the server.
|
26
|
+
def make_default_owner(username)
|
27
|
+
payload = {
|
28
|
+
'username' => username
|
29
|
+
}
|
30
|
+
|
31
|
+
@conn.put('/api/v1/site-ownership', payload.to_json)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Removes the default site owner.
|
35
|
+
#
|
36
|
+
# @return [Array] an array containing the message given by the server.
|
37
|
+
def remove_default_owner
|
38
|
+
@conn.delete('/api/v1/site-ownership')
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/sfrest/stage.rb
CHANGED
@@ -34,6 +34,7 @@ module SFRest
|
|
34
34
|
# @param [synchronize_all_users] only stage the user accounts required for the related collections and groups
|
35
35
|
# @param [Array] Stacks Array of stack ids to wipe
|
36
36
|
# @param [Boolean] skip_site_files site skip file transfer during staging
|
37
|
+
# @param [Array] skip_site_files_overwrite list of files to skip during staging
|
37
38
|
#
|
38
39
|
# @return [Integer] Id of the staging task created.
|
39
40
|
# rubocop:disable Metrics/ParameterLists
|
@@ -43,7 +44,8 @@ module SFRest
|
|
43
44
|
wipe_target_environment: false,
|
44
45
|
synchronize_all_users: true,
|
45
46
|
wipe_stacks: [],
|
46
|
-
skip_site_files: false
|
47
|
+
skip_site_files: false,
|
48
|
+
skip_site_files_overwrite: [])
|
47
49
|
raise InvalidApiVersion, staging_versions unless staging_versions.include? 2
|
48
50
|
|
49
51
|
payload = { 'to_env' => env, 'sites' => sites,
|
@@ -51,7 +53,8 @@ module SFRest
|
|
51
53
|
'wipe_target_environment' => wipe_target_environment,
|
52
54
|
'synchronize_all_users' => synchronize_all_users,
|
53
55
|
'wipe_stacks' => wipe_stacks,
|
54
|
-
'skip_site_files' => skip_site_files
|
56
|
+
'skip_site_files' => skip_site_files,
|
57
|
+
'skip_site_files_overwrite' => skip_site_files_overwrite }.to_json
|
55
58
|
@conn.post('/api/v2/stage', payload)
|
56
59
|
end
|
57
60
|
# rubocop:enable Metrics/ParameterLists
|
data/lib/sfrest/version.rb
CHANGED
data/lib/sfrest.rb
CHANGED
@@ -10,17 +10,21 @@ require 'json'
|
|
10
10
|
|
11
11
|
require 'sfrest/audit'
|
12
12
|
require 'sfrest/backup'
|
13
|
+
require 'sfrest/centralized_role_management'
|
13
14
|
require 'sfrest/codebase'
|
14
15
|
require 'sfrest/collection'
|
15
16
|
require 'sfrest/connection'
|
17
|
+
require 'sfrest/cron'
|
16
18
|
require 'sfrest/domains'
|
17
19
|
require 'sfrest/error'
|
20
|
+
require 'sfrest/factory_standard_domain'
|
18
21
|
require 'sfrest/group'
|
19
22
|
require 'sfrest/info'
|
20
23
|
require 'sfrest/profile'
|
21
24
|
require 'sfrest/pathbuilder'
|
22
25
|
require 'sfrest/role'
|
23
26
|
require 'sfrest/site'
|
27
|
+
require 'sfrest/site_ownership'
|
24
28
|
require 'sfrest/stage'
|
25
29
|
require 'sfrest/task'
|
26
30
|
require 'sfrest/theme'
|
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.39
|
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-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -103,17 +103,21 @@ files:
|
|
103
103
|
- lib/sfrest.rb
|
104
104
|
- lib/sfrest/audit.rb
|
105
105
|
- lib/sfrest/backup.rb
|
106
|
+
- lib/sfrest/centralized_role_management.rb
|
106
107
|
- lib/sfrest/codebase.rb
|
107
108
|
- lib/sfrest/collection.rb
|
108
109
|
- lib/sfrest/connection.rb
|
110
|
+
- lib/sfrest/cron.rb
|
109
111
|
- lib/sfrest/domains.rb
|
110
112
|
- lib/sfrest/error.rb
|
113
|
+
- lib/sfrest/factory_standard_domain.rb
|
111
114
|
- lib/sfrest/group.rb
|
112
115
|
- lib/sfrest/info.rb
|
113
116
|
- lib/sfrest/pathbuilder.rb
|
114
117
|
- lib/sfrest/profile.rb
|
115
118
|
- lib/sfrest/role.rb
|
116
119
|
- lib/sfrest/site.rb
|
120
|
+
- lib/sfrest/site_ownership.rb
|
117
121
|
- lib/sfrest/stage.rb
|
118
122
|
- lib/sfrest/task.rb
|
119
123
|
- lib/sfrest/theme.rb
|