ruby_aem 0.9.0 → 1.0.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 +4 -4
- data/conf/spec.yaml +47 -70
- data/lib/ruby_aem/client.rb +35 -28
- data/lib/ruby_aem/error.rb +28 -0
- data/lib/ruby_aem/handlers/file.rb +8 -10
- data/lib/ruby_aem/handlers/html.rb +8 -11
- data/lib/ruby_aem/handlers/json.rb +25 -28
- data/lib/ruby_aem/handlers/simple.rb +51 -8
- data/lib/ruby_aem/handlers/xml.rb +7 -9
- data/lib/ruby_aem/resources/bundle.rb +50 -0
- data/lib/ruby_aem/resources/config_property.rb +55 -0
- data/lib/ruby_aem/resources/flush_agent.rb +75 -0
- data/lib/ruby_aem/resources/group.rb +102 -0
- data/lib/ruby_aem/resources/node.rb +65 -0
- data/lib/ruby_aem/resources/package.rb +190 -0
- data/lib/ruby_aem/resources/path.rb +48 -0
- data/lib/ruby_aem/resources/replication_agent.rb +79 -0
- data/lib/ruby_aem/resources/repository.rb +47 -0
- data/lib/ruby_aem/resources/user.rb +113 -0
- data/lib/ruby_aem/{repository.rb → response.rb} +14 -21
- data/lib/ruby_aem/result.rb +12 -36
- data/lib/ruby_aem.rb +30 -30
- metadata +17 -15
- data/lib/ruby_aem/bundle.rb +0 -48
- data/lib/ruby_aem/config_property.rb +0 -53
- data/lib/ruby_aem/flush_agent.rb +0 -65
- data/lib/ruby_aem/group.rb +0 -101
- data/lib/ruby_aem/node.rb +0 -63
- data/lib/ruby_aem/package.rb +0 -187
- data/lib/ruby_aem/path.rb +0 -46
- data/lib/ruby_aem/replication_agent.rb +0 -65
- data/lib/ruby_aem/user.rb +0 -110
data/lib/ruby_aem.rb
CHANGED
|
@@ -14,17 +14,17 @@ See the License for the specific language governing permissions and
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
=end
|
|
16
16
|
|
|
17
|
-
require 'ruby_aem/bundle'
|
|
18
17
|
require 'ruby_aem/client'
|
|
19
|
-
require 'ruby_aem/
|
|
20
|
-
require 'ruby_aem/
|
|
21
|
-
require 'ruby_aem/
|
|
22
|
-
require 'ruby_aem/
|
|
23
|
-
require 'ruby_aem/
|
|
24
|
-
require 'ruby_aem/
|
|
25
|
-
require 'ruby_aem/
|
|
26
|
-
require 'ruby_aem/
|
|
27
|
-
require 'ruby_aem/
|
|
18
|
+
require 'ruby_aem/resources/bundle'
|
|
19
|
+
require 'ruby_aem/resources/config_property'
|
|
20
|
+
require 'ruby_aem/resources/flush_agent'
|
|
21
|
+
require 'ruby_aem/resources/group'
|
|
22
|
+
require 'ruby_aem/resources/node'
|
|
23
|
+
require 'ruby_aem/resources/package'
|
|
24
|
+
require 'ruby_aem/resources/path'
|
|
25
|
+
require 'ruby_aem/resources/replication_agent'
|
|
26
|
+
require 'ruby_aem/resources/repository'
|
|
27
|
+
require 'ruby_aem/resources/user'
|
|
28
28
|
require 'swagger_aem'
|
|
29
29
|
require 'yaml'
|
|
30
30
|
|
|
@@ -74,17 +74,17 @@ module RubyAem
|
|
|
74
74
|
# Create a bundle instance.
|
|
75
75
|
#
|
|
76
76
|
# @param name the bundle's name, e.g. com.adobe.cq.social.cq-social-forum
|
|
77
|
-
# @return new RubyAem::Bundle instance
|
|
77
|
+
# @return new RubyAem::Resources::Bundle instance
|
|
78
78
|
def bundle(name)
|
|
79
|
-
RubyAem::Bundle.new(@client, name)
|
|
79
|
+
RubyAem::Resources::Bundle.new(@client, name)
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
# Create a path instance.
|
|
83
83
|
#
|
|
84
84
|
# @param name the name of the path, e.g. /etc/designs
|
|
85
|
-
# @return new RubyAem::Path instance
|
|
85
|
+
# @return new RubyAem::Resources::Path instance
|
|
86
86
|
def path(name)
|
|
87
|
-
RubyAem::Path.new(@client, name)
|
|
87
|
+
RubyAem::Resources::Path.new(@client, name)
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
# Create a config property instance.
|
|
@@ -92,36 +92,36 @@ module RubyAem
|
|
|
92
92
|
# @param name the property's name
|
|
93
93
|
# @param type the property's type, e.g. Boolean
|
|
94
94
|
# @param value the property's value, e.g. true
|
|
95
|
-
# @return new RubyAem::ConfigProperty instance
|
|
95
|
+
# @return new RubyAem::Resources::ConfigProperty instance
|
|
96
96
|
def config_property(name, type, value)
|
|
97
|
-
RubyAem::ConfigProperty.new(@client, name, type, value)
|
|
97
|
+
RubyAem::Resources::ConfigProperty.new(@client, name, type, value)
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
# Create a flush agent instance.
|
|
101
101
|
#
|
|
102
102
|
# @param run_mode AEM run mode: author or publish
|
|
103
103
|
# @param name the flush agent's name, e.g. some-flush-agent
|
|
104
|
-
# @return new RubyAem::FlushAgent instance
|
|
104
|
+
# @return new RubyAem::Resources::FlushAgent instance
|
|
105
105
|
def flush_agent(name, run_mode)
|
|
106
|
-
RubyAem::FlushAgent.new(@client, name, run_mode)
|
|
106
|
+
RubyAem::Resources::FlushAgent.new(@client, name, run_mode)
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
# Create a group instance.
|
|
110
110
|
#
|
|
111
111
|
# @param path the path to group node, e.g. /home/groups/s/
|
|
112
112
|
# @param name the name of the AEM group, e.g. somegroup
|
|
113
|
-
# @return new RubyAem::Group instance
|
|
113
|
+
# @return new RubyAem::Resources::Group instance
|
|
114
114
|
def group(path, name)
|
|
115
|
-
RubyAem::Group.new(@client, path, name)
|
|
115
|
+
RubyAem::Resources::Group.new(@client, path, name)
|
|
116
116
|
end
|
|
117
117
|
|
|
118
118
|
# Create a node instance.
|
|
119
119
|
#
|
|
120
120
|
# @param path the path to the node, e.g. /apps/system/
|
|
121
121
|
# @param name the node name, e.g. somenode
|
|
122
|
-
# @return new RubyAem::Node instance
|
|
122
|
+
# @return new RubyAem::Resources::Node instance
|
|
123
123
|
def node(path, name)
|
|
124
|
-
RubyAem::Node.new(@client, path, name)
|
|
124
|
+
RubyAem::Resources::Node.new(@client, path, name)
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
# Create a package instance.
|
|
@@ -129,34 +129,34 @@ module RubyAem
|
|
|
129
129
|
# @param group_name the group name of the package, e.g. somepackagegroup
|
|
130
130
|
# @param package_name the name of the package, e.g. somepackage
|
|
131
131
|
# @param package_version the version of the package, e.g. 1.2.3
|
|
132
|
-
# @return new RubyAem::Package instance
|
|
132
|
+
# @return new RubyAem::Resources::Package instance
|
|
133
133
|
def package(group_name, package_name, package_version)
|
|
134
|
-
RubyAem::Package.new(@client, group_name, package_name, package_version)
|
|
134
|
+
RubyAem::Resources::Package.new(@client, group_name, package_name, package_version)
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
# Create a replication agent instance.
|
|
138
138
|
#
|
|
139
139
|
# @param run_mode AEM run mode: author or publish
|
|
140
140
|
# @param name the replication agent's name, e.g. some-replication-agent
|
|
141
|
-
# @return new RubyAem::ReplicationAgent instance
|
|
141
|
+
# @return new RubyAem::Resources::ReplicationAgent instance
|
|
142
142
|
def replication_agent(name, run_mode)
|
|
143
|
-
RubyAem::ReplicationAgent.new(@client, name, run_mode)
|
|
143
|
+
RubyAem::Resources::ReplicationAgent.new(@client, name, run_mode)
|
|
144
144
|
end
|
|
145
145
|
|
|
146
146
|
# Create a repository instance.
|
|
147
147
|
#
|
|
148
|
-
# @return new RubyAem::Repository instance
|
|
148
|
+
# @return new RubyAem::Resources::Repository instance
|
|
149
149
|
def repository
|
|
150
|
-
RubyAem::Repository.new(@client)
|
|
150
|
+
RubyAem::Resources::Repository.new(@client)
|
|
151
151
|
end
|
|
152
152
|
|
|
153
153
|
# Create a user instance.
|
|
154
154
|
#
|
|
155
155
|
# @param path the path to user node, e.g. /home/users/s/
|
|
156
156
|
# @param name the username of the AEM user, e.g. someuser, admin, johncitizen
|
|
157
|
-
# @return new RubyAem::User instance
|
|
157
|
+
# @return new RubyAem::Resources::User instance
|
|
158
158
|
def user(path, name)
|
|
159
|
-
RubyAem::User.new(@client, path, name)
|
|
159
|
+
RubyAem::Resources::User.new(@client, path, name)
|
|
160
160
|
end
|
|
161
161
|
|
|
162
162
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby_aem
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shine Solutions
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2016-
|
|
12
|
+
date: 2016-11-20 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: nokogiri
|
|
@@ -40,7 +40,7 @@ dependencies:
|
|
|
40
40
|
version: '0.9'
|
|
41
41
|
- - ">="
|
|
42
42
|
- !ruby/object:Gem::Version
|
|
43
|
-
version: 0.9.
|
|
43
|
+
version: 0.9.2
|
|
44
44
|
type: :runtime
|
|
45
45
|
prerelease: false
|
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -50,7 +50,7 @@ dependencies:
|
|
|
50
50
|
version: '0.9'
|
|
51
51
|
- - ">="
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 0.9.
|
|
53
|
+
version: 0.9.2
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: rspec
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -102,24 +102,26 @@ extra_rdoc_files: []
|
|
|
102
102
|
files:
|
|
103
103
|
- conf/spec.yaml
|
|
104
104
|
- lib/ruby_aem.rb
|
|
105
|
-
- lib/ruby_aem/bundle.rb
|
|
106
105
|
- lib/ruby_aem/client.rb
|
|
107
|
-
- lib/ruby_aem/
|
|
108
|
-
- lib/ruby_aem/flush_agent.rb
|
|
109
|
-
- lib/ruby_aem/group.rb
|
|
106
|
+
- lib/ruby_aem/error.rb
|
|
110
107
|
- lib/ruby_aem/handlers/file.rb
|
|
111
108
|
- lib/ruby_aem/handlers/html.rb
|
|
112
109
|
- lib/ruby_aem/handlers/json.rb
|
|
113
110
|
- lib/ruby_aem/handlers/simple.rb
|
|
114
111
|
- lib/ruby_aem/handlers/xml.rb
|
|
115
|
-
- lib/ruby_aem/
|
|
116
|
-
- lib/ruby_aem/
|
|
117
|
-
- lib/ruby_aem/
|
|
118
|
-
- lib/ruby_aem/
|
|
119
|
-
- lib/ruby_aem/
|
|
112
|
+
- lib/ruby_aem/resources/bundle.rb
|
|
113
|
+
- lib/ruby_aem/resources/config_property.rb
|
|
114
|
+
- lib/ruby_aem/resources/flush_agent.rb
|
|
115
|
+
- lib/ruby_aem/resources/group.rb
|
|
116
|
+
- lib/ruby_aem/resources/node.rb
|
|
117
|
+
- lib/ruby_aem/resources/package.rb
|
|
118
|
+
- lib/ruby_aem/resources/path.rb
|
|
119
|
+
- lib/ruby_aem/resources/replication_agent.rb
|
|
120
|
+
- lib/ruby_aem/resources/repository.rb
|
|
121
|
+
- lib/ruby_aem/resources/user.rb
|
|
122
|
+
- lib/ruby_aem/response.rb
|
|
120
123
|
- lib/ruby_aem/result.rb
|
|
121
124
|
- lib/ruby_aem/swagger.rb
|
|
122
|
-
- lib/ruby_aem/user.rb
|
|
123
125
|
homepage: https://github.com/shinesolutions/ruby_aem
|
|
124
126
|
licenses:
|
|
125
127
|
- Apache 2.0
|
|
@@ -140,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
140
142
|
version: '0'
|
|
141
143
|
requirements: []
|
|
142
144
|
rubyforge_project:
|
|
143
|
-
rubygems_version: 2.
|
|
145
|
+
rubygems_version: 2.4.8
|
|
144
146
|
signing_key:
|
|
145
147
|
specification_version: 4
|
|
146
148
|
summary: AEM API Ruby client
|
data/lib/ruby_aem/bundle.rb
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
Copyright 2016 Shine Solutions
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
=end
|
|
16
|
-
|
|
17
|
-
module RubyAem
|
|
18
|
-
# Bundle class contains API calls related to managing an AEM bundle.
|
|
19
|
-
class Bundle
|
|
20
|
-
|
|
21
|
-
# Initialise a bundle.
|
|
22
|
-
#
|
|
23
|
-
# @param client RubyAem::Client
|
|
24
|
-
# @param name the bundle's name, e.g. com.adobe.cq.social.cq-social-forum
|
|
25
|
-
# @return new RubyAem::Bundle instance
|
|
26
|
-
def initialize(client, name)
|
|
27
|
-
@client = client
|
|
28
|
-
@info = {
|
|
29
|
-
name: name
|
|
30
|
-
}
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# Start a bundle.
|
|
34
|
-
#
|
|
35
|
-
# @return RubyAem::Result
|
|
36
|
-
def start
|
|
37
|
-
@client.call(self.class, __callee__.to_s, @info)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# Stop a bundle.
|
|
41
|
-
#
|
|
42
|
-
# @return RubyAem::Result
|
|
43
|
-
def stop
|
|
44
|
-
@client.call(self.class, __callee__.to_s, @info)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
end
|
|
48
|
-
end
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
Copyright 2016 Shine Solutions
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
=end
|
|
16
|
-
|
|
17
|
-
module RubyAem
|
|
18
|
-
# ConfigProperty class contains API calls related to managing an AEM config property.
|
|
19
|
-
class ConfigProperty
|
|
20
|
-
|
|
21
|
-
# Initialise a config property
|
|
22
|
-
#
|
|
23
|
-
# @param client RubyAem::Client
|
|
24
|
-
# @param name the property's name
|
|
25
|
-
# @param type the property's type, e.g. Boolean
|
|
26
|
-
# @param value the property's value, e.g. true
|
|
27
|
-
# @return new RubyAem::ConfigProperty instance
|
|
28
|
-
def initialize(client, name, type, value)
|
|
29
|
-
@client = client
|
|
30
|
-
@info = {
|
|
31
|
-
name: name,
|
|
32
|
-
type: type,
|
|
33
|
-
value: value
|
|
34
|
-
}
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# Create a new config property.
|
|
38
|
-
#
|
|
39
|
-
# @param run_mode AEM run mode: author or publish
|
|
40
|
-
# @return RubyAem::Result
|
|
41
|
-
def create(run_mode)
|
|
42
|
-
|
|
43
|
-
name = RubyAem::Swagger.property_to_parameter(@info[:name])
|
|
44
|
-
|
|
45
|
-
@info[:run_mode] = run_mode
|
|
46
|
-
@info["#{name}".to_sym] = @info[:value]
|
|
47
|
-
@info["#{name}_type_hint".to_sym] = @info[:type]
|
|
48
|
-
|
|
49
|
-
@client.call(self.class, __callee__.to_s, @info)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
end
|
|
53
|
-
end
|
data/lib/ruby_aem/flush_agent.rb
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
Copyright 2016 Shine Solutions
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
=end
|
|
16
|
-
|
|
17
|
-
module RubyAem
|
|
18
|
-
# FlushAgent class contains API calls related to managing an AEM flush agent.
|
|
19
|
-
class FlushAgent
|
|
20
|
-
|
|
21
|
-
# Initialise a flush agent.
|
|
22
|
-
#
|
|
23
|
-
# @param client RubyAem::Client
|
|
24
|
-
# @param run_mode AEM run mode: author or publish
|
|
25
|
-
# @param name the flush agent's name, e.g. some-flush-agent
|
|
26
|
-
# @return new RubyAem::FlushAgent instance
|
|
27
|
-
def initialize(client, run_mode, name)
|
|
28
|
-
@client = client
|
|
29
|
-
@info = {
|
|
30
|
-
run_mode: run_mode,
|
|
31
|
-
name: name
|
|
32
|
-
}
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Create or update a flush agent.
|
|
36
|
-
#
|
|
37
|
-
# @param title flush agent title
|
|
38
|
-
# @param description flush agent description
|
|
39
|
-
# @param dest_base_url base URL of the agent target destination, e.g. http://somedispatcher:8080
|
|
40
|
-
# @return RubyAem::Result
|
|
41
|
-
def create_update(title, description, dest_base_url)
|
|
42
|
-
@info[:title] = title
|
|
43
|
-
@info[:description] = description
|
|
44
|
-
@info[:dest_base_url] = dest_base_url
|
|
45
|
-
@client.call(self.class, __callee__.to_s, @info)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# Delete the flush agent.
|
|
49
|
-
#
|
|
50
|
-
# @return RubyAem::Result
|
|
51
|
-
def delete()
|
|
52
|
-
@client.call(self.class, __callee__.to_s, @info)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
# Check whether the flush agent exists or not.
|
|
56
|
-
# If the flush agent exists, this method returns a success result.
|
|
57
|
-
# Otherwise it returns a failure result.
|
|
58
|
-
#
|
|
59
|
-
# @return RubyAem::Result
|
|
60
|
-
def exists()
|
|
61
|
-
@client.call(self.class, __callee__.to_s, @info)
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
end
|
|
65
|
-
end
|
data/lib/ruby_aem/group.rb
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
Copyright 2016 Shine Solutions
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
=end
|
|
16
|
-
|
|
17
|
-
module RubyAem
|
|
18
|
-
# Group class contains API calls related to managing an AEM group.
|
|
19
|
-
class Group
|
|
20
|
-
|
|
21
|
-
# Initialise a group.
|
|
22
|
-
#
|
|
23
|
-
# @param client RubyAem::Client
|
|
24
|
-
# @param path the path to group node, e.g. /home/groups/s/
|
|
25
|
-
# @param name the name of the AEM group, e.g. somegroup
|
|
26
|
-
# @return new RubyAem::Group instance
|
|
27
|
-
def initialize(client, path, name)
|
|
28
|
-
@client = client
|
|
29
|
-
@info = {
|
|
30
|
-
path: path,
|
|
31
|
-
name: name
|
|
32
|
-
}
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Create a new group.
|
|
36
|
-
#
|
|
37
|
-
# @return RubyAem::Result
|
|
38
|
-
def create()
|
|
39
|
-
if !@info[:path].match(/^\//)
|
|
40
|
-
@info[:path] = "/#{@info[:path]}"
|
|
41
|
-
end
|
|
42
|
-
@client.call(self.class, __callee__.to_s, @info)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# Delete the group.
|
|
46
|
-
#
|
|
47
|
-
# @return RubyAem::Result
|
|
48
|
-
def delete()
|
|
49
|
-
result = find_authorizable_id
|
|
50
|
-
if result.data
|
|
51
|
-
@info[:path] = RubyAem::Swagger.path(@info[:path])
|
|
52
|
-
@client.call(self.class, __callee__.to_s, @info)
|
|
53
|
-
else
|
|
54
|
-
result
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
# Check whether the group exists or not.
|
|
59
|
-
# If the group exists, this method returns a success result.
|
|
60
|
-
# Otherwise it returns a failure result.
|
|
61
|
-
#
|
|
62
|
-
# @return RubyAem::Result
|
|
63
|
-
def exists()
|
|
64
|
-
@info[:path] = RubyAem::Swagger.path(@info[:path])
|
|
65
|
-
@client.call(self.class, __callee__.to_s, @info)
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
# Set the group's permission.
|
|
69
|
-
#
|
|
70
|
-
# @param permission_path the path that the group's permission is to be set against, e.g. /etc/replication
|
|
71
|
-
# @param permission_csv comma-separated-values of the group's permission, e.g. read:true,modify:true
|
|
72
|
-
# @return RubyAem::Result
|
|
73
|
-
def set_permission(permission_path, permission_csv)
|
|
74
|
-
@info[:permission_path] = permission_path
|
|
75
|
-
@info[:permission_csv] = permission_csv
|
|
76
|
-
@client.call(self.class, __callee__.to_s, @info)
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
# Add another group as a member of this group.
|
|
80
|
-
#
|
|
81
|
-
# @param member the name of the member group to be added
|
|
82
|
-
# @return RubyAem::Result
|
|
83
|
-
def add_member(member)
|
|
84
|
-
result = find_authorizable_id
|
|
85
|
-
if result.data
|
|
86
|
-
@info[:member] = member
|
|
87
|
-
@client.call(self.class, __callee__.to_s, @info)
|
|
88
|
-
else
|
|
89
|
-
result
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
# Find the group's authorizable ID.
|
|
94
|
-
#
|
|
95
|
-
# @return RubyAem::Result
|
|
96
|
-
def find_authorizable_id()
|
|
97
|
-
@client.call(self.class, __callee__.to_s, @info)
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
end
|
|
101
|
-
end
|
data/lib/ruby_aem/node.rb
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
Copyright 2016 Shine Solutions
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
=end
|
|
16
|
-
|
|
17
|
-
module RubyAem
|
|
18
|
-
# Node class contains API calls related to managing an AEM node.
|
|
19
|
-
class Node
|
|
20
|
-
|
|
21
|
-
# Initialise a node.
|
|
22
|
-
#
|
|
23
|
-
# @param client RubyAem::Client
|
|
24
|
-
# @param path the path to the node, e.g. /apps/system/
|
|
25
|
-
# @param name the node name, e.g. somenode
|
|
26
|
-
# @return new RubyAem::Node instance
|
|
27
|
-
def initialize(client, path, name)
|
|
28
|
-
@client = client
|
|
29
|
-
@info = {
|
|
30
|
-
path: path,
|
|
31
|
-
name: name
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@info[:path] = RubyAem::Swagger.path(@info[:path])
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# Create a new node.
|
|
38
|
-
#
|
|
39
|
-
# @param type the node type, e.g. sling:Folder
|
|
40
|
-
# @return RubyAem::Result
|
|
41
|
-
def create(type)
|
|
42
|
-
@info[:type] = type
|
|
43
|
-
@client.call(self.class, __callee__.to_s, @info)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
# Delete the node.
|
|
47
|
-
#
|
|
48
|
-
# @return RubyAem::Result
|
|
49
|
-
def delete()
|
|
50
|
-
@client.call(self.class, __callee__.to_s, @info)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# Check whether the node exists or not.
|
|
54
|
-
# If the node exists, this method returns a success result.
|
|
55
|
-
# Otherwise it returns a failure result.
|
|
56
|
-
#
|
|
57
|
-
# @return RubyAem::Result
|
|
58
|
-
def exists()
|
|
59
|
-
@client.call(self.class, __callee__.to_s, @info)
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
end
|
|
63
|
-
end
|