sfrest 0.0.32 → 0.0.36
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 +1 -0
- data/lib/sfrest/group.rb +8 -0
- data/lib/sfrest/profile.rb +68 -0
- data/lib/sfrest/site.rb +9 -9
- data/lib/sfrest/stage.rb +5 -2
- data/lib/sfrest/version.rb +1 -1
- data/lib/sfrest.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22fe3070d6203957aa5361a2583ec43dc1f63f29c5bd8a08335e07c176d082d6
|
4
|
+
data.tar.gz: 4e0c7a0f06eaa5b72a215fcc1028f90eb9faf6a92394ad2b79a26728a1043af0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9e8de406c5b8439f21974b2975f07898eed6789c33c1d8643f8a0d955a8eadb8b9b3768d59eb21834b3f247df4a4ba5dad2c5621737c6c16499a486c6d7a1cc
|
7
|
+
data.tar.gz: 91afd11ef8f8bb8cf8c219aeca3082542d5f66cf1e51a332e6dd8aa63661feafcc9b4f8e437d74d4468dab250d12fd7189fb6e95ea58db7f3a05fae520d494ad
|
data/lib/sfrest/connection.rb
CHANGED
data/lib/sfrest/group.rb
CHANGED
@@ -159,5 +159,13 @@ module SFRest
|
|
159
159
|
end
|
160
160
|
nil
|
161
161
|
end
|
162
|
+
|
163
|
+
# Returns sites belonging to a specified group id.
|
164
|
+
# @param [Integer] group_id Id of the group to fetch
|
165
|
+
# @return [Hash] {'count' => count, 'sites' => Hash }
|
166
|
+
def sites(group_id = 0)
|
167
|
+
current_path = "/api/v1/groups/#{group_id}/sites"
|
168
|
+
@conn.get(current_path)
|
169
|
+
end
|
162
170
|
end
|
163
171
|
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SFRest
|
4
|
+
# Work with installation profiles.
|
5
|
+
class Profile
|
6
|
+
# @param [SFRest::Connection] conn
|
7
|
+
def initialize(conn)
|
8
|
+
@conn = conn
|
9
|
+
end
|
10
|
+
|
11
|
+
# Gets a list of installation profiles.
|
12
|
+
#
|
13
|
+
# @param [Hash] params Given as URL parameters.
|
14
|
+
# @option params [Integer] :stack_id A stack id to filter by.
|
15
|
+
# @option params [Boolean] :is_enabled True to filter by enabled profiles. False
|
16
|
+
# to filter by disabled profiles.
|
17
|
+
# @return [Hash] Profile info formatted like so: {
|
18
|
+
# 'profiles' => [{
|
19
|
+
# 'name' => 'testing',
|
20
|
+
# 'description' => 'Some description',
|
21
|
+
# 'stack_id' => 1,
|
22
|
+
# 'rest_api_default' => false,
|
23
|
+
# 'enabled' => true
|
24
|
+
# }],
|
25
|
+
# 'count' => 1,
|
26
|
+
# 'time' => '2021-03-12T02:26:34+00:00'
|
27
|
+
# }
|
28
|
+
def profile_list(**params)
|
29
|
+
target_url = '/api/v1/profiles'
|
30
|
+
# Generate a string like "stack_id=3&is_enabled=true"
|
31
|
+
url_params = params.each.map { |k, v| "#{k}=#{v}" }.join('&')
|
32
|
+
target_url += "?#{url_params}" unless url_params.empty?
|
33
|
+
|
34
|
+
# Output is already well-formed, so return it.
|
35
|
+
@conn.get(target_url)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Enables an installation profile.
|
39
|
+
#
|
40
|
+
# @param [String] name
|
41
|
+
# @param [Integer] stack_id Required if the factory is multistack.
|
42
|
+
def enable(name, stack_id: nil)
|
43
|
+
target_url = "/api/v1/profiles/#{name}/enable"
|
44
|
+
target_url += "?stack_id=#{stack_id}" unless stack_id.nil?
|
45
|
+
@conn.post(target_url, '{}')
|
46
|
+
end
|
47
|
+
|
48
|
+
# Disables an installation profile.
|
49
|
+
#
|
50
|
+
# @param [String] name
|
51
|
+
# @param [Integer] stack_id Required if the factory is multistack.
|
52
|
+
def disable(name, stack_id: nil)
|
53
|
+
target_url = "/api/v1/profiles/#{name}/disable"
|
54
|
+
target_url += "?stack_id=#{stack_id}" unless stack_id.nil?
|
55
|
+
@conn.post(target_url, '{}')
|
56
|
+
end
|
57
|
+
|
58
|
+
# Sets the default installation profile for use with other REST endpoints.
|
59
|
+
#
|
60
|
+
# @param [String] name
|
61
|
+
# @param [Integer] stack_id Required if the factory is multistack.
|
62
|
+
def set_default(name, stack_id: nil)
|
63
|
+
target_url = "/api/v1/profiles/#{name}/set_default"
|
64
|
+
target_url += "?stack_id=#{stack_id}" unless stack_id.nil?
|
65
|
+
@conn.post(target_url, '{}')
|
66
|
+
end
|
67
|
+
end
|
68
|
+
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
|
-
#
|
60
|
-
#
|
61
|
-
#
|
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
|
-
|
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
|
-
|
71
|
-
current_path
|
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.
|
data/lib/sfrest/stage.rb
CHANGED
@@ -33,6 +33,7 @@ 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
|
36
37
|
#
|
37
38
|
# @return [Integer] Id of the staging task created.
|
38
39
|
# rubocop:disable Metrics/ParameterLists
|
@@ -41,14 +42,16 @@ module SFRest
|
|
41
42
|
email_site_status: false,
|
42
43
|
wipe_target_environment: false,
|
43
44
|
synchronize_all_users: true,
|
44
|
-
wipe_stacks: []
|
45
|
+
wipe_stacks: [],
|
46
|
+
skip_site_files: false)
|
45
47
|
raise InvalidApiVersion, staging_versions unless staging_versions.include? 2
|
46
48
|
|
47
49
|
payload = { 'to_env' => env, 'sites' => sites,
|
48
50
|
'detailed_status' => email_site_status,
|
49
51
|
'wipe_target_environment' => wipe_target_environment,
|
50
52
|
'synchronize_all_users' => synchronize_all_users,
|
51
|
-
'wipe_stacks' => wipe_stacks
|
53
|
+
'wipe_stacks' => wipe_stacks,
|
54
|
+
'skip_site_files' => skip_site_files }.to_json
|
52
55
|
@conn.post('/api/v2/stage', payload)
|
53
56
|
end
|
54
57
|
# rubocop:enable Metrics/ParameterLists
|
data/lib/sfrest/version.rb
CHANGED
data/lib/sfrest.rb
CHANGED
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.36
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ACSF Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- lib/sfrest/group.rb
|
112
112
|
- lib/sfrest/info.rb
|
113
113
|
- lib/sfrest/pathbuilder.rb
|
114
|
+
- lib/sfrest/profile.rb
|
114
115
|
- lib/sfrest/role.rb
|
115
116
|
- lib/sfrest/site.rb
|
116
117
|
- lib/sfrest/stage.rb
|
@@ -140,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
141
|
- !ruby/object:Gem::Version
|
141
142
|
version: '0'
|
142
143
|
requirements: []
|
143
|
-
rubygems_version: 3.
|
144
|
+
rubygems_version: 3.2.17
|
144
145
|
signing_key:
|
145
146
|
specification_version: 4
|
146
147
|
summary: Acquia Site Factory Rest API.
|