sfrest 0.0.34 → 0.0.38

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c59bfb1dd3ab6cde61f5db37e267d97824ceeea04f8306d25b083eadf394988
4
- data.tar.gz: 6546e19cee41d06a5f44b2c09b6d8c3fb090730b78e8f712388dd05b039f6966
3
+ metadata.gz: 7039e02a8fd620b58a601bdbca8cb00353ac78819593e4d45612e9ec93e3bd5d
4
+ data.tar.gz: 0b62f183dabf16e48091bc6aeaffbc938c0de3d2b0171f65d4230eac8139f71d
5
5
  SHA512:
6
- metadata.gz: 8eb3c3b56c037e6ab162d8ba7dfa939be6d8a5d5fe62124acbc1eae30259eb3a5fb5db5d129248870f91983b8badd8b0e5f0d4be8d62eec1126fcbc2588fbda3
7
- data.tar.gz: d96ed66389ea837e2b293f041d68b4751ebeedd08f69e582921afac2d85b07c7c95fb1055e5fdcaa10e6c23a9e2a0951ef0ae347127d8704b0fb9fa91106f188
6
+ metadata.gz: 352329ee8101653fc4d58943724590fbe91b7b8243d0d72e9e82a62683c3276824b91c64b1fe1f4a91551cfb3659bdd516aaf090de588e35651b19a549c87abd
7
+ data.tar.gz: 46e63d0eb317bac5bd088dcf5cd0ae3bb4ffd84c8f4d3aaed07b589a3ceb76d0b40502fa9e5e49d0c4553614d69838c5f56b10fe279ffab0ba7fd8582a492536
@@ -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
@@ -164,14 +164,17 @@ 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
170
172
  group
171
173
  info
172
174
  profile
173
175
  role
174
176
  site
177
+ site_ownership
175
178
  stage
176
179
  task
177
180
  theme
@@ -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
data/lib/sfrest/site.rb CHANGED
@@ -55,20 +55,21 @@ module SFRest
55
55
  res['sites'].first['id']
56
56
  end
57
57
 
58
- # Gets the complete list of sites
59
- # Makes multiple requests to the factory to get all the sites on the factory
60
- # @param [Boolean] show_incomplete whether to include incomplete sites in
61
- # the list. The default differs from UI/SF to maintain backward compatibility.
58
+ # Gets the complete list of sites.
59
+ #
60
+ # Makes multiple requests to the factory to get all the sites on the
61
+ # factory.
62
+ #
63
+ # @param [Hash] opts query parameters to be used in this request.
62
64
  # @return [Hash{'count' => Integer, 'sites' => Hash}]
63
- # rubocop: disable Style/OptionalBooleanParameter
64
- def site_list(show_incomplete = true)
65
+ def site_list(**opts)
65
66
  page = 1
66
67
  not_done = true
67
68
  count = 0
68
69
  sites = []
69
70
  while not_done
70
- current_path = '/api/v1/sites?page='.dup << page.to_s
71
- current_path <<= '&show_incomplete=true' if show_incomplete
71
+ opts['page'] = page
72
+ current_path = "/api/v1/sites?#{URI.encode_www_form(opts)}"
72
73
  res = @conn.get(current_path)
73
74
  if res['sites'] == []
74
75
  not_done = false
@@ -86,7 +87,6 @@ module SFRest
86
87
  end
87
88
  { 'count' => count, 'sites' => sites }
88
89
  end
89
- # rubocop: enable Style/OptionalBooleanParameter
90
90
 
91
91
  # Creates a site.
92
92
  # @param [String] sitename The name of the site to create.
@@ -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
@@ -33,6 +33,8 @@ module SFRest
33
33
  # @param [Boolean] wipe_target_environment recreate the target stage wiping all data
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
+ # @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
36
38
  #
37
39
  # @return [Integer] Id of the staging task created.
38
40
  # rubocop:disable Metrics/ParameterLists
@@ -41,14 +43,18 @@ module SFRest
41
43
  email_site_status: false,
42
44
  wipe_target_environment: false,
43
45
  synchronize_all_users: true,
44
- wipe_stacks: [])
46
+ wipe_stacks: [],
47
+ skip_site_files: false,
48
+ skip_site_files_overwrite: [])
45
49
  raise InvalidApiVersion, staging_versions unless staging_versions.include? 2
46
50
 
47
51
  payload = { 'to_env' => env, 'sites' => sites,
48
52
  'detailed_status' => email_site_status,
49
53
  'wipe_target_environment' => wipe_target_environment,
50
54
  'synchronize_all_users' => synchronize_all_users,
51
- 'wipe_stacks' => wipe_stacks }.to_json
55
+ 'wipe_stacks' => wipe_stacks,
56
+ 'skip_site_files' => skip_site_files,
57
+ 'skip_site_files_overwrite' => skip_site_files_overwrite }.to_json
52
58
  @conn.post('/api/v2/stage', payload)
53
59
  end
54
60
  # rubocop:enable Metrics/ParameterLists
@@ -2,5 +2,5 @@
2
2
 
3
3
  module SFRest
4
4
  # Just tracks the version of sfrest.
5
- VERSION = '0.0.34'
5
+ VERSION = '0.0.38'
6
6
  end
data/lib/sfrest.rb CHANGED
@@ -10,9 +10,11 @@ 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'
18
20
  require 'sfrest/group'
@@ -21,6 +23,7 @@ require 'sfrest/profile'
21
23
  require 'sfrest/pathbuilder'
22
24
  require 'sfrest/role'
23
25
  require 'sfrest/site'
26
+ require 'sfrest/site_ownership'
24
27
  require 'sfrest/stage'
25
28
  require 'sfrest/task'
26
29
  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.34
4
+ version: 0.0.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - ACSF Engineering
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-26 00:00:00.000000000 Z
11
+ date: 2022-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -103,9 +103,11 @@ 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
111
113
  - lib/sfrest/group.rb
@@ -114,6 +116,7 @@ files:
114
116
  - lib/sfrest/profile.rb
115
117
  - lib/sfrest/role.rb
116
118
  - lib/sfrest/site.rb
119
+ - lib/sfrest/site_ownership.rb
117
120
  - lib/sfrest/stage.rb
118
121
  - lib/sfrest/task.rb
119
122
  - lib/sfrest/theme.rb
@@ -141,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
144
  - !ruby/object:Gem::Version
142
145
  version: '0'
143
146
  requirements: []
144
- rubygems_version: 3.0.3
147
+ rubygems_version: 3.2.17
145
148
  signing_key:
146
149
  specification_version: 4
147
150
  summary: Acquia Site Factory Rest API.