ruby_aem 3.3.0 → 3.9.0

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
  SHA1:
3
- metadata.gz: 46d97b74d2f3cfd1c5702001a169427c5be4865a
4
- data.tar.gz: 75ae679a7fc78f70e39bf31734575f1c05e1badd
3
+ metadata.gz: b2ed1677a7b7238645bdef9c119ec97633a878a4
4
+ data.tar.gz: f45bd3492b51cdaecfc4d5bac3a653d024629f9e
5
5
  SHA512:
6
- metadata.gz: ec8453f2b50fc61619725a79ed8faddb3412181d96e248422cbb39434ed8a84b84f3f1cfaea43ffb0615509004f1ae993e982b689cc717b60339cc9380f633ea
7
- data.tar.gz: c4abdc405b9b96cc34f99c5355f577df0d272560624854294b2ac0b2bb3e28250b9b88f72bad9a9310a77f19e4568f2b86ed36297921d875e25c09f816e125bb
6
+ metadata.gz: 3b98cf357bedb502071301b796274c8f299a85d23b484aefbb46cb6ba1203ce65998b4598d74ffe02db88a3e3eda0a62284f41b0c54d52221086f47044f12282
7
+ data.tar.gz: 9499e464235a2712ad434c7100bec694057e90b532f6ea42ebfd8e3fe128f603919b6b0a54992f374eb98ef401a8694810f53c0ea14c942fb16d51a8a3c6df12
@@ -1 +1 @@
1
- version: 3.3.0
1
+ version: 3.9.0
@@ -417,7 +417,7 @@ group:
417
417
  authorizable_id: '%{name}'
418
418
  intermediate_path: '%{path}'
419
419
  optional:
420
- create_group: ''
420
+ create_group: 'true'
421
421
  profilegiven_name: '%{name}'
422
422
  responses:
423
423
  201:
@@ -447,7 +447,7 @@ group:
447
447
  path: '%{path}'
448
448
  name: '%{authorizable_id}'
449
449
  optional:
450
- delete_authorizable: ''
450
+ delete_authorizable: '%{name}'
451
451
  responses:
452
452
  200:
453
453
  handler: simple
@@ -721,6 +721,21 @@ path:
721
721
  message: 'Path %{path} deleted'
722
722
  configproperty:
723
723
  actions:
724
+ create:
725
+ api: sling
726
+ operation: postConfigProperty
727
+ params:
728
+ required:
729
+ config_node_name: '%{config_node_name}'
730
+ optional:
731
+ - query_params
732
+ responses:
733
+ 200:
734
+ handler: simple
735
+ message: 'Set %{config_node_name} config %{type} property %{name}=%{value}'
736
+ 201:
737
+ handler: simple
738
+ message: 'Set %{config_node_name} config %{type} property %{name}=%{value}'
724
739
  createapachefelixjettybasedhttpservice:
725
740
  api: sling
726
741
  operation: postConfigApacheFelixJettyBasedHttpService
@@ -1277,7 +1292,7 @@ truststore:
1277
1292
  operation: postNode
1278
1293
  params:
1279
1294
  required:
1280
- path: /etc/truststore/
1295
+ path: etc/truststore
1281
1296
  name: truststore.p12
1282
1297
  optional:
1283
1298
  operation: delete
@@ -1326,7 +1341,7 @@ user:
1326
1341
  authorizable_id: '%{name}'
1327
1342
  intermediate_path: '%{path}'
1328
1343
  optional:
1329
- create_user: ''
1344
+ create_user: 'true'
1330
1345
  reppassword: '%{password}'
1331
1346
  responses:
1332
1347
  201:
@@ -1356,7 +1371,7 @@ user:
1356
1371
  path: '%{path}'
1357
1372
  name: '%{authorizable_id}'
1358
1373
  optional:
1359
- delete_authorizable: ''
1374
+ delete_authorizable: '%{name}'
1360
1375
  responses:
1361
1376
  200:
1362
1377
  handler: simple
@@ -1407,3 +1422,44 @@ user:
1407
1422
  200:
1408
1423
  handler: html_change_password
1409
1424
  message: 'User %{user}''s password has been changed'
1425
+ ssl:
1426
+ actions:
1427
+ enable:
1428
+ api: granite
1429
+ operation: sslSetup
1430
+ params:
1431
+ required:
1432
+ keystore_password: '%{keystore_password}'
1433
+ keystore_passwordConfirm: '%{keystore_passwordConfirm}'
1434
+ truststore_password: '%{truststore_password}'
1435
+ truststore_passwordConfirm: '%{truststore_passwordConfirm}'
1436
+ https_hostname: '%{https_hostname}'
1437
+ https_port: '%{https_port}'
1438
+ optional:
1439
+ privatekey_file: __FILE_PRIVATE_KEY__
1440
+ certificate_file: __FILE_CERTIFICATE__
1441
+ responses:
1442
+ 200:
1443
+ handler: simple
1444
+ message: 'HTTPS has been configured on port %{https_port}'
1445
+ get:
1446
+ api: configmgr
1447
+ operation: comAdobeGraniteJettySslInternalGraniteSslConnectorFactory
1448
+ params:
1449
+ optional:
1450
+ post: true
1451
+ responses:
1452
+ 200:
1453
+ handler: simple
1454
+ message: 'HTTPS Configuration found'
1455
+ disable:
1456
+ api: configmgr
1457
+ operation: comAdobeGraniteJettySslInternalGraniteSslConnectorFactory
1458
+ params:
1459
+ optional:
1460
+ apply: true
1461
+ delete: true
1462
+ responses:
1463
+ 200:
1464
+ handler: simple
1465
+ message: 'HTTPS has been disabled'
@@ -29,6 +29,7 @@ require 'ruby_aem/resources/replication_agent'
29
29
  require 'ruby_aem/resources/outbox_replication_agent'
30
30
  require 'ruby_aem/resources/reverse_replication_agent'
31
31
  require 'ruby_aem/resources/saml'
32
+ require 'ruby_aem/resources/ssl'
32
33
  require 'ruby_aem/resources/repository'
33
34
  require 'ruby_aem/resources/truststore'
34
35
  require 'ruby_aem/resources/user'
@@ -87,7 +88,8 @@ module RubyAem
87
88
  custom: SwaggerAemClient::CustomApi.new,
88
89
  cq: SwaggerAemClient::CqApi.new,
89
90
  crx: SwaggerAemClient::CrxApi.new,
90
- sling: SwaggerAemClient::SlingApi.new
91
+ sling: SwaggerAemClient::SlingApi.new,
92
+ granite: SwaggerAemClient::GraniteApi.new
91
93
  }
92
94
 
93
95
  spec = YAML.load_file(File.expand_path('../../conf/spec.yaml', __FILE__))
@@ -254,6 +256,13 @@ module RubyAem
254
256
  RubyAem::Resources::Saml.new(@client)
255
257
  end
256
258
 
259
+ # Create a SSL instance.
260
+ #
261
+ # @return new RubyAem::Resources::Saml instance
262
+ def ssl
263
+ RubyAem::Resources::Ssl.new(@client)
264
+ end
265
+
257
266
  # Create a Truststore instance.
258
267
  #
259
268
  # @return new RubyAem::Resources::Truststore instance
@@ -29,8 +29,11 @@ module RubyAem
29
29
  @call_params = {
30
30
  name: name,
31
31
  type: type,
32
- value: value
32
+ value: value,
33
+ query_params: {}
33
34
  }
35
+ @call_params[:query_params][@call_params[:name]] = @call_params[:value]
36
+ @call_params[:query_params]["#{@call_params[:name]}@TypeHint"] = @call_params[:type]
34
37
  end
35
38
 
36
39
  # Create a new config property.
@@ -38,15 +41,8 @@ module RubyAem
38
41
  # @param config_node_name the node name of a given OSGI config
39
42
  # @return RubyAem::Result
40
43
  def create(config_node_name)
41
- name = RubyAem::Swagger.property_to_parameter(@call_params[:name])
42
- type_hint_prefix = name.gsub(/^_/, '')
43
-
44
44
  @call_params[:config_node_name] = config_node_name
45
- @call_params[name.to_sym] = @call_params[:value]
46
- @call_params["#{type_hint_prefix}_type_hint".to_sym] = @call_params[:type]
47
-
48
- config_name = Swagger.config_node_name_to_config_name(config_node_name)
49
- @client.call(self.class, __callee__.to_s.concat(config_name.downcase.gsub(/\s+/, '')), @call_params)
45
+ @client.call(self.class, __callee__.to_s, @call_params)
50
46
  end
51
47
  end
52
48
  end
@@ -0,0 +1,148 @@
1
+ # Copyright 2016-2018 Shine Solutions
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'ruby_aem/error'
16
+
17
+ module RubyAem
18
+ module Resources
19
+ # AEM class contains API calls related to managing SSL via Granite.
20
+ class Ssl
21
+ # Initialise Ssl resource.
22
+ #
23
+ # @param client RubyAem::Client
24
+ # @return new RubyAem::Resources::Ssl instance
25
+ def initialize(client)
26
+ @client = client
27
+ @call_params = {
28
+ }
29
+ end
30
+
31
+ # Disable SSL
32
+ #
33
+ # @return RubyAem::Result
34
+ def disable
35
+ @client.call(self.class, __callee__.to_s, @call_params)
36
+ end
37
+
38
+ # Enable SSL
39
+ #
40
+ # @param opts hash of the following values:
41
+ # - keystore_password: Authorizable Keystore password for system-user ssl-service. keystore will be created if it doesn't exist.
42
+ # - truststore_password: AEM Global Truststore password. Truststore will be created if it doesn't exist.
43
+ # - https_hostname: Hostname for enabling HTTPS listener matching the certificate's common name.
44
+ # - https_port: Port to listen on for HTTPS requests.
45
+ # - certificate_file_path: Path to the HTTPS public certificate file.
46
+ # - privatekey_file_path: Path to the HTTPS Private Key file.
47
+ # @return RubyAem::Result
48
+ def enable(opts = {
49
+ keystore_password: nil,
50
+ truststore_password: nil,
51
+ https_hostname: nil,
52
+ https_port: nil,
53
+ certificate_file_path: nil,
54
+ privatekey_file_path: nil
55
+ })
56
+ @call_params[:keystore_password] = opts[:keystore_password]
57
+ @call_params[:keystore_passwordConfirm] = opts[:keystore_password]
58
+ @call_params[:truststore_password] = opts[:truststore_password]
59
+ @call_params[:truststore_passwordConfirm] = opts[:truststore_password]
60
+ @call_params[:https_hostname] = opts[:https_hostname]
61
+ @call_params[:https_port] = opts[:https_port]
62
+ @call_params[:file_path_certificate] = opts[:certificate_file_path]
63
+ @call_params[:file_path_private_key] = opts[:privatekey_file_path]
64
+
65
+ @client.call(self.class, __callee__.to_s, @call_params)
66
+ end
67
+
68
+ # Get SSL Granite configuration
69
+ #
70
+ # @return RubyAem::Result
71
+ def get
72
+ @client.call(self.class, __callee__.to_s, @call_params)
73
+ end
74
+
75
+ # Check if SSL is enabled via Granite
76
+ #
77
+ # @return RubyAem::Result
78
+ def is_enabled
79
+ get_ssl = get
80
+
81
+ response = get_ssl.response
82
+ ssl_properties = response.body.properties
83
+ ssl_enabled = ssl_properties.com_adobe_granite_jetty_ssl_port.is_set
84
+ ssl_port = ssl_properties.com_adobe_granite_jetty_ssl_port.value
85
+
86
+ message = if ssl_enabled.eql?(true)
87
+ "HTTPS has been configured on port #{ssl_port}"
88
+ else
89
+ 'HTTPS is not configured'
90
+ end
91
+
92
+ result = RubyAem::Result.new(message, response)
93
+ result.data = ssl_enabled
94
+
95
+ result
96
+ end
97
+
98
+ # Enable SSL via granite and wait until SSL was enabled
99
+ #
100
+ # @param opts hash of the following values:
101
+ # - keystore_password: Authorizable Keystore password for system-user ssl-service. keystore will be created if it doesn't exist.
102
+ # - truststore_password: AEM Global Truststore password. Truststore will be created if it doesn't exist.
103
+ # - https_hostname: Hostname for enabling HTTPS listener matching the certificate's common name.
104
+ # - https_port: Port to listen on for HTTPS requests.
105
+ # - certificate_file_path: Path to the HTTPS public certificate file.
106
+ # - privatekey_file_path: Path to the HTTPS Private Key file.
107
+ # - _retries: retries library's options (http://www.rubydoc.info/gems/retries/0.0.5#Usage), restricted to max_tries, base_sleep_seconds, max_sleep_seconds
108
+ # @return RubyAem::Result
109
+ def enable_wait_until_ready(
110
+ opts = {
111
+ force: true,
112
+ _retries: {
113
+ max_tries: 30,
114
+ base_sleep_seconds: 2,
115
+ max_sleep_seconds: 2
116
+ }
117
+ }
118
+ )
119
+ opts[:_retries] ||= {}
120
+ opts[:_retries][:max_tries] ||= 30
121
+ opts[:_retries][:base_sleep_seconds] ||= 2
122
+ opts[:_retries][:max_sleep_seconds] ||= 2
123
+
124
+ # ensure integer retries setting (Puppet 3 passes numeric string)
125
+ opts[:_retries][:max_tries] = opts[:_retries][:max_tries].to_i
126
+ opts[:_retries][:base_sleep_seconds] = opts[:_retries][:base_sleep_seconds].to_i
127
+ opts[:_retries][:max_sleep_seconds] = opts[:_retries][:max_sleep_seconds].to_i
128
+
129
+ # The AEM Granite API to enable SSl is unstable and in some cases it response with response code 0.
130
+ # This is because the HTTP service is getting restarted during the process of enabling SSL via Granite.
131
+ # To not end with an error we have to rescue this behaviour and verify afterwards if SSL was enabled.
132
+ begin
133
+ result = enable(**opts)
134
+ rescue RubyAem::Error => e
135
+ raise StandardError.new(result) unless e.result.response.status_code.zero?
136
+
137
+ with_retries(max_tries: opts[:_retries][:max_tries], base_sleep_seconds: opts[:_retries][:base_sleep_seconds], max_sleep_seconds: opts[:_retries][:max_sleep_seconds]) { |retries_count|
138
+ result = is_enabled
139
+ message = 'SSL could not be configured or connection timeout please try again.'
140
+ puts format('SSL Enable check #%<retries_count>d: %<check_result_data>s - %<check_result_message>s', retries_count: retries_count, check_result_data: result.data, check_result_message: result.message)
141
+ raise StandardError.new(message) if result.data == false
142
+ }
143
+ end
144
+ result
145
+ end
146
+ end
147
+ end
148
+ end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_aem
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shine Solutions
8
8
  - Cliffano Subagio
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-08-22 00:00:00.000000000 Z
12
+ date: 2020-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: retries
@@ -31,14 +31,28 @@ dependencies:
31
31
  requirements:
32
32
  - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: 3.1.0
34
+ version: 3.4.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 3.1.0
41
+ version: 3.4.0
42
+ - !ruby/object:Gem::Dependency
43
+ name: swagger_aem_osgi
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '='
47
+ - !ruby/object:Gem::Version
48
+ version: 1.0.0
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '='
54
+ - !ruby/object:Gem::Version
55
+ version: 1.0.0
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: rspec
44
58
  requirement: !ruby/object:Gem::Requirement
@@ -103,6 +117,7 @@ files:
103
117
  - lib/ruby_aem/resources/repository.rb
104
118
  - lib/ruby_aem/resources/reverse_replication_agent.rb
105
119
  - lib/ruby_aem/resources/saml.rb
120
+ - lib/ruby_aem/resources/ssl.rb
106
121
  - lib/ruby_aem/resources/truststore.rb
107
122
  - lib/ruby_aem/resources/user.rb
108
123
  - lib/ruby_aem/response.rb
@@ -112,7 +127,7 @@ homepage: https://github.com/shinesolutions/ruby_aem
112
127
  licenses:
113
128
  - Apache-2.0
114
129
  metadata: {}
115
- post_install_message:
130
+ post_install_message:
116
131
  rdoc_options: []
117
132
  require_paths:
118
133
  - lib
@@ -127,9 +142,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
142
  - !ruby/object:Gem::Version
128
143
  version: '0'
129
144
  requirements: []
130
- rubyforge_project:
145
+ rubyforge_project:
131
146
  rubygems_version: 2.6.14.4
132
- signing_key:
147
+ signing_key:
133
148
  specification_version: 4
134
149
  summary: AEM API Ruby client
135
150
  test_files: []