ruby_aem 3.4.0 → 3.10.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: 4b50953a40c2de256ed5b551153fe19e96134158
4
- data.tar.gz: 39e9a84b3ae045c80c43b97dd8595febc446eeae
3
+ metadata.gz: 3fccdc3dca65ca5b7d5fc9188e44c1d8a2537d17
4
+ data.tar.gz: 60a6568259bbdde645a13336d41e493c36e27f5c
5
5
  SHA512:
6
- metadata.gz: ab7cb66bf16222d34d4e4e046eb9085b32e93e1e41175596e0b2429a8c56689f8945e1518357fd30c409836bc19f0215f0db731b36dcba9743710b6e27879fef
7
- data.tar.gz: bd5c36253c07c193dfce171aeacabb57aa54e038b30cdf6f442ea5ee142efc9fa1afc6d2d96d7b95bba8e8d20efdbf90b34cfbc8166b2a38190672c1b85a0d96
6
+ metadata.gz: 65c5c0901204d30aa395c5e18d14e9e82d53ebf9c0610683e344ea5dd6989401c556311d458a4bbf64fb5e69ca2afa20272c029ccb3f90989cc62d5c49cd10cf
7
+ data.tar.gz: dd83f17799a685ff080308502607ccf5b5ea347deefb020f57b4bbac713aa6c800c5db19e186ff6d6e0140b45ec5347044da72f98f8db3e439f91025f0b8c33e
@@ -1 +1 @@
1
- version: 3.4.0
1
+ version: 3.10.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
@@ -33,6 +33,8 @@ module RubyAem
33
33
  intermediate_path: intermediate_path,
34
34
  authorizable_id: authorizable_id
35
35
  }
36
+
37
+ @call_params[:intermediate_path] = RubyAem::Swagger.path(@call_params[:intermediate_path])
36
38
  end
37
39
 
38
40
  # Create AEM Authorizable Keystore.
@@ -38,6 +38,8 @@ module RubyAem
38
38
  keystore_intermediate_path: keystore_intermediate_path,
39
39
  keystore_authorizable_id: keystore_authorizable_id
40
40
  }
41
+
42
+ @call_params[:keystore_intermediate_path] = RubyAem::Swagger.path(@call_params[:keystore_intermediate_path])
41
43
  end
42
44
 
43
45
  # Create is an alias to import.
@@ -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.4.0
4
+ version: 3.10.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-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: retries
@@ -31,14 +31,14 @@ 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
42
  - !ruby/object:Gem::Dependency
43
43
  name: swagger_aem_osgi
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -117,6 +117,7 @@ files:
117
117
  - lib/ruby_aem/resources/repository.rb
118
118
  - lib/ruby_aem/resources/reverse_replication_agent.rb
119
119
  - lib/ruby_aem/resources/saml.rb
120
+ - lib/ruby_aem/resources/ssl.rb
120
121
  - lib/ruby_aem/resources/truststore.rb
121
122
  - lib/ruby_aem/resources/user.rb
122
123
  - lib/ruby_aem/response.rb
@@ -126,7 +127,7 @@ homepage: https://github.com/shinesolutions/ruby_aem
126
127
  licenses:
127
128
  - Apache-2.0
128
129
  metadata: {}
129
- post_install_message:
130
+ post_install_message:
130
131
  rdoc_options: []
131
132
  require_paths:
132
133
  - lib
@@ -141,9 +142,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
142
  - !ruby/object:Gem::Version
142
143
  version: '0'
143
144
  requirements: []
144
- rubyforge_project:
145
+ rubyforge_project:
145
146
  rubygems_version: 2.6.14.4
146
- signing_key:
147
+ signing_key:
147
148
  specification_version: 4
148
149
  summary: AEM API Ruby client
149
150
  test_files: []