kinetic_sdk 5.0.4 → 5.0.5
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/README.md +43 -43
- data/kinetic_sdk.gemspec +1 -1
- data/lib/kinetic_sdk/core/lib/categories.rb +49 -0
- data/lib/kinetic_sdk/core/lib/space.rb +2 -0
- data/lib/kinetic_sdk/core/lib/teams.rb +27 -4
- data/lib/kinetic_sdk/core/lib/webhooks.rb +20 -0
- data/lib/kinetic_sdk/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d154c0b5265721082b7c8e54b2c21a9d0ed4f0e3600cb38c567f4784baa71050
|
4
|
+
data.tar.gz: c5f94353587b5b847308e380f0319817decdf11722915323a4e7ec2c71d5afdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a1a755cac85fe3d43cc086c575b236e05cd803763cab2c2461837b7f62b4f94d8d64d7eade8fdca2b905b7a11441bf0363bcd8c18eeb7464941ae605e6448ac
|
7
|
+
data.tar.gz: 382caaac8682ce681dcffbce0e2f811d6f1fffd03722c65cc8b134cfc829ac788eb78e1cc06402a675047103bc95194c9ac998ad58dd1cea74dd3778178544af
|
data/README.md
CHANGED
@@ -75,20 +75,21 @@ the SDK with the following code.
|
|
75
75
|
require File.join(File.expand_path(File.dirname(__FILE__)), 'vendor', 'kinetic-sdk-rb', 'kinetic-sdk')
|
76
76
|
```
|
77
77
|
|
78
|
-
### Kinetic
|
78
|
+
### Kinetic Core SDK example of a Space User
|
79
79
|
|
80
80
|
```ruby
|
81
|
-
|
82
|
-
app_server_url: "http://localhost:8080/kinetic
|
83
|
-
|
81
|
+
space_sdk = KineticSdk::Core.new({
|
82
|
+
app_server_url: "http://localhost:8080/kinetic",
|
83
|
+
space_slug: "foo",
|
84
|
+
username: "space-user-1",
|
84
85
|
password: "password",
|
85
86
|
options: {
|
86
87
|
log_level: "info",
|
87
88
|
max_redirects: 3
|
88
89
|
}
|
89
90
|
})
|
90
|
-
response =
|
91
|
-
|
91
|
+
response = space_sdk.find_kapps()
|
92
|
+
kapps = response.content['kapps']
|
92
93
|
|
93
94
|
puts response.code # String value of HTTP response code ("200", "400", "500", etc...)
|
94
95
|
puts response.status # Ruby Fixnum value of response.code (200, 400, 500, etc...)
|
@@ -96,11 +97,11 @@ puts response.content # Ruby Hash
|
|
96
97
|
puts response.content_string # JSON formatted response body
|
97
98
|
```
|
98
99
|
|
99
|
-
### Kinetic
|
100
|
+
### Kinetic Core SDK example of a System User
|
100
101
|
|
101
102
|
```ruby
|
102
|
-
|
103
|
-
app_server_url: "http://localhost:8080/kinetic
|
103
|
+
system_sdk = KineticSdk::Core.new({
|
104
|
+
app_server_url: "http://localhost:8080/kinetic",
|
104
105
|
username: "configuration-user",
|
105
106
|
password: "password",
|
106
107
|
options: {
|
@@ -108,8 +109,7 @@ bridgehub_sdk = KineticSdk::Bridgehub.new({
|
|
108
109
|
max_redirects: 3
|
109
110
|
}
|
110
111
|
})
|
111
|
-
response =
|
112
|
-
bridges = response.content['bridges']
|
112
|
+
response = system_sdk.add_space('My Company Space', 'my-company')
|
113
113
|
|
114
114
|
puts response.code # String value of HTTP response code ("200", "400", "500", etc...)
|
115
115
|
puts response.status # Ruby Fixnum value of response.code (200, 400, 500, etc...)
|
@@ -117,20 +117,23 @@ puts response.content # Ruby Hash
|
|
117
117
|
puts response.content_string # JSON formatted response body
|
118
118
|
```
|
119
119
|
|
120
|
-
### Kinetic
|
120
|
+
### Kinetic Core SDK example of a Subdomain
|
121
|
+
|
122
|
+
This example requires a proxy server configured to rewrite the space slug subdomain to the expected Core API route.
|
121
123
|
|
122
124
|
```ruby
|
123
|
-
|
124
|
-
|
125
|
-
|
125
|
+
space_sdk = KineticSdk::Core.new({
|
126
|
+
space_server_url: "https://foo.myapp.io",
|
127
|
+
space_slug: "foo",
|
128
|
+
username: "space-user-1",
|
126
129
|
password: "password",
|
127
130
|
options: {
|
128
131
|
log_level: "info",
|
129
132
|
max_redirects: 3
|
130
133
|
}
|
131
134
|
})
|
132
|
-
response =
|
133
|
-
|
135
|
+
response = space_sdk.find_kapps()
|
136
|
+
kapps = response.content['kapps']
|
134
137
|
|
135
138
|
puts response.code # String value of HTTP response code ("200", "400", "500", etc...)
|
136
139
|
puts response.status # Ruby Fixnum value of response.code (200, 400, 500, etc...)
|
@@ -138,21 +141,20 @@ puts response.content # Ruby Hash
|
|
138
141
|
puts response.content_string # JSON formatted response body
|
139
142
|
```
|
140
143
|
|
141
|
-
### Kinetic
|
144
|
+
### Kinetic Task SDK example
|
142
145
|
|
143
146
|
```ruby
|
144
|
-
|
145
|
-
app_server_url: "http://localhost:8080/kinetic",
|
146
|
-
|
147
|
-
username: "space-user-1",
|
147
|
+
task_sdk = KineticSdk::Task.new({
|
148
|
+
app_server_url: "http://localhost:8080/kinetic-task",
|
149
|
+
username: "user-1",
|
148
150
|
password: "password",
|
149
151
|
options: {
|
152
|
+
export_directory: "/opt/exports/task-server-a",
|
150
153
|
log_level: "info",
|
151
154
|
max_redirects: 3
|
152
155
|
}
|
153
156
|
})
|
154
|
-
response =
|
155
|
-
kapps = response.content['kapps']
|
157
|
+
response = task_sdk.environment()
|
156
158
|
|
157
159
|
puts response.code # String value of HTTP response code ("200", "400", "500", etc...)
|
158
160
|
puts response.status # Ruby Fixnum value of response.code (200, 400, 500, etc...)
|
@@ -160,11 +162,11 @@ puts response.content # Ruby Hash
|
|
160
162
|
puts response.content_string # JSON formatted response body
|
161
163
|
```
|
162
164
|
|
163
|
-
### Kinetic
|
165
|
+
### Kinetic Agent SDK example
|
164
166
|
|
165
167
|
```ruby
|
166
|
-
|
167
|
-
app_server_url: "http://localhost:8080/kinetic",
|
168
|
+
agent_sdk = KineticSdk::Agent.new({
|
169
|
+
app_server_url: "http://localhost:8080/kinetic-agent",
|
168
170
|
username: "configuration-user",
|
169
171
|
password: "password",
|
170
172
|
options: {
|
@@ -172,7 +174,8 @@ system_sdk = KineticSdk::Core.new({
|
|
172
174
|
max_redirects: 3
|
173
175
|
}
|
174
176
|
})
|
175
|
-
response =
|
177
|
+
response = agent_sdk.find_all_bridges()
|
178
|
+
bridges = response.content['bridges']
|
176
179
|
|
177
180
|
puts response.code # String value of HTTP response code ("200", "400", "500", etc...)
|
178
181
|
puts response.status # Ruby Fixnum value of response.code (200, 400, 500, etc...)
|
@@ -180,23 +183,20 @@ puts response.content # Ruby Hash
|
|
180
183
|
puts response.content_string # JSON formatted response body
|
181
184
|
```
|
182
185
|
|
183
|
-
### Kinetic
|
184
|
-
|
185
|
-
This example requires a proxy server configured to rewrite the space slug subdomain to the expected Core API route.
|
186
|
+
### Kinetic BridgeHub SDK example
|
186
187
|
|
187
188
|
```ruby
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
username: "space-user-1",
|
189
|
+
bridgehub_sdk = KineticSdk::Bridgehub.new({
|
190
|
+
app_server_url: "http://localhost:8080/kinetic-bridgehub",
|
191
|
+
username: "configuration-user",
|
192
192
|
password: "password",
|
193
193
|
options: {
|
194
194
|
log_level: "info",
|
195
195
|
max_redirects: 3
|
196
196
|
}
|
197
197
|
})
|
198
|
-
response =
|
199
|
-
|
198
|
+
response = bridgehub_sdk.find_bridges()
|
199
|
+
bridges = response.content['bridges']
|
200
200
|
|
201
201
|
puts response.code # String value of HTTP response code ("200", "400", "500", etc...)
|
202
202
|
puts response.status # Ruby Fixnum value of response.code (200, 400, 500, etc...)
|
@@ -204,20 +204,20 @@ puts response.content # Ruby Hash
|
|
204
204
|
puts response.content_string # JSON formatted response body
|
205
205
|
```
|
206
206
|
|
207
|
-
### Kinetic
|
207
|
+
### Kinetic FileHub SDK example
|
208
208
|
|
209
209
|
```ruby
|
210
|
-
|
211
|
-
app_server_url: "http://localhost:8080/kinetic-
|
212
|
-
username: "user
|
210
|
+
filehub_sdk = KineticSdk::Filehub.new({
|
211
|
+
app_server_url: "http://localhost:8080/kinetic-filehub",
|
212
|
+
username: "configuration-user",
|
213
213
|
password: "password",
|
214
214
|
options: {
|
215
|
-
export_directory: "/opt/exports/task-server-a",
|
216
215
|
log_level: "info",
|
217
216
|
max_redirects: 3
|
218
217
|
}
|
219
218
|
})
|
220
|
-
response =
|
219
|
+
response = filehub_sdk.find_filestores()
|
220
|
+
filestores = response.content['filestores']
|
221
221
|
|
222
222
|
puts response.code # String value of HTTP response code ("200", "400", "500", etc...)
|
223
223
|
puts response.status # Ruby Fixnum value of response.code (200, 400, 500, etc...)
|
data/kinetic_sdk.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_development_dependency "kontena-websocket-client", "0.1.1"
|
27
27
|
|
28
28
|
spec.add_development_dependency "bundler", "~> 1.16"
|
29
|
-
spec.add_development_dependency "rake", "~>
|
29
|
+
spec.add_development_dependency "rake", "~> 13.0.1"
|
30
30
|
spec.add_development_dependency "yard", "~> 0.9.20"
|
31
31
|
|
32
32
|
spec.metadata["yard.run"] = "yri"
|
@@ -1,6 +1,29 @@
|
|
1
1
|
module KineticSdk
|
2
2
|
class Core
|
3
3
|
|
4
|
+
# Retrieve a Category on a Kapp
|
5
|
+
#
|
6
|
+
# @param kapp_slug [String] slug of the Kapp the category belongs to
|
7
|
+
# @param category_slug [String] slug of the the category to find
|
8
|
+
# @param params [Hash] Query parameters that are added to the URL, such as +include+
|
9
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
10
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
11
|
+
def find_category_on_kapp(kapp_slug, category_slug, params={}, headers=default_headers)
|
12
|
+
@logger.info("Finding #{category_slug} Category on the #{kapp_slug} kapp.")
|
13
|
+
get("#{@api_url}/kapps/#{kapp_slug}/categories/#{category_slug}", params, headers)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Find Categories on a Kapp
|
17
|
+
#
|
18
|
+
# @param kapp_slug [String] slug of the Kapp the category belongs to
|
19
|
+
# @param params [Hash] Query parameters that are added to the URL, such as +include+
|
20
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
21
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
22
|
+
def find_categories(kapp_slug, params={}, headers=default_headers)
|
23
|
+
@logger.info("Finding Categories on the #{kapp_slug} kapp.")
|
24
|
+
get("#{@api_url}/kapps/#{kapp_slug}/categories", params, headers)
|
25
|
+
end
|
26
|
+
|
4
27
|
# Add a category on a Kapp
|
5
28
|
#
|
6
29
|
# @param kapp_slug [String] slug of the Kapp the category belongs to
|
@@ -29,6 +52,32 @@ module KineticSdk
|
|
29
52
|
@logger.info("Adding Categorization for \"#{kapp_slug}\" kapp")
|
30
53
|
post("#{@api_url}/kapps/#{kapp_slug}/categorizations", body, headers)
|
31
54
|
end
|
55
|
+
|
56
|
+
# Update a category on a Kapp
|
57
|
+
#
|
58
|
+
# @param kapp_slug [String] slug of the Kapp the category belongs to
|
59
|
+
# @param category_slug [String] slug of the the category to find
|
60
|
+
# @param body [Hash] category properties
|
61
|
+
# - +name+ - A descriptive name for the category
|
62
|
+
# - +other details + -
|
63
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
64
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
65
|
+
def update_category_on_kapp(kapp_slug, category_slug, body, headers=default_headers)
|
66
|
+
raise StandardError.new "Category properties is not valid, must be a Hash." unless body.is_a? Hash
|
67
|
+
@logger.info("Updating Category \"#{body['name']}\" for \"#{kapp_slug}\" kapp")
|
68
|
+
put("#{@api_url}/kapps/#{kapp_slug}/categories/#{category_slug}", body, headers)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Delete a Category
|
72
|
+
#
|
73
|
+
# @param kapp_slug [String] slug of the Kapp the category belongs to
|
74
|
+
# @param category_slug [String] slug of the the category to delete
|
75
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
76
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
77
|
+
def delete_category_on_kapp(kapp_slug, category_slug, headers=default_headers)
|
78
|
+
@logger.info("Deleting the #{category_slug} Category on the #{kapp_slug}\ kapp.")
|
79
|
+
delete("#{@api_url}/kapps/#{kapp_slug}/categories/#{category_slug}", headers)
|
80
|
+
end
|
32
81
|
|
33
82
|
end
|
34
83
|
end
|
@@ -81,6 +81,7 @@ module KineticSdk
|
|
81
81
|
"space.teamAttributeDefinitions",
|
82
82
|
"space.userAttributeDefinitions",
|
83
83
|
"space.userProfileAttributeDefinitions",
|
84
|
+
"space.webApis.{slug}",
|
84
85
|
"space.webhooks.{name}",
|
85
86
|
)
|
86
87
|
core_data = get("#{@api_url}/space", { 'export' => true}, headers).content
|
@@ -134,6 +135,7 @@ module KineticSdk
|
|
134
135
|
if api_path == "/kapps"
|
135
136
|
kapp_slug = resp.content["kapp"]["slug"]
|
136
137
|
delete_security_policy_definitions(kapp_slug)
|
138
|
+
delete_form_types_on_kapp(kapp_slug)
|
137
139
|
end
|
138
140
|
end
|
139
141
|
end
|
@@ -7,7 +7,7 @@ module KineticSdk
|
|
7
7
|
#
|
8
8
|
# @param team_name [String] the team name
|
9
9
|
# @param attribute_name [String] the attribute name
|
10
|
-
# @param attribute_value [String] the attribute value
|
10
|
+
# @param attribute_value [String|Array] the attribute value(s)
|
11
11
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
12
12
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
13
13
|
def add_team_attribute(team_name, attribute_name, attribute_value, headers=default_headers)
|
@@ -21,14 +21,14 @@ module KineticSdk
|
|
21
21
|
@logger.info("Attribute: #{attribute.inspect}")
|
22
22
|
# if the attribute already exists, update it
|
23
23
|
if attribute["name"] == attribute_name
|
24
|
-
attribute["values"] = [ attribute_value ]
|
24
|
+
attribute["values"] = attribute_value.is_a?(Array) ? attribute_value : [ attribute_value ]
|
25
25
|
exists = true
|
26
26
|
end
|
27
27
|
end
|
28
28
|
# add the attribute if it didn't exist
|
29
29
|
attributes.push({
|
30
30
|
"name" => attribute_name,
|
31
|
-
"values" => [ attribute_value ]
|
31
|
+
"values" => attribute_value.is_a?(Array) ? attribute_value : [ attribute_value ]
|
32
32
|
}) unless exists
|
33
33
|
|
34
34
|
# set the updated attributes list
|
@@ -108,6 +108,29 @@ module KineticSdk
|
|
108
108
|
@logger.info("Finding the \"#{team_name}\" (#{team_slug}) Team.")
|
109
109
|
get("#{@api_url}/teams/#{team_slug}", params, headers)
|
110
110
|
end
|
111
|
-
|
111
|
+
|
112
|
+
# Update a Team
|
113
|
+
#
|
114
|
+
# @param team_slug [String] slug of the Team to update
|
115
|
+
# @param body [Hash] category properties
|
116
|
+
# - +name+ - Name of the team to be added
|
117
|
+
# - +description+ - Description of the Team to be added
|
118
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
119
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
120
|
+
def update_team(team_slug, body, headers=default_headers)
|
121
|
+
raise StandardError.new "Team properties is not valid, must be a Hash." unless body.is_a? Hash
|
122
|
+
@logger.info("Updating Team #{team_slug}")
|
123
|
+
put("#{@api_url}/teams/#{team_slug}", body, headers)
|
124
|
+
end
|
125
|
+
|
126
|
+
# Delete a Team
|
127
|
+
#
|
128
|
+
# @param team_slug [String] slug of the the team to delete
|
129
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
130
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
131
|
+
def delete_team(team_slug, headers=default_headers)
|
132
|
+
@logger.info("Deleting the #{team_slug} Team.")
|
133
|
+
delete("#{@api_url}/teams/#{team_slug}", headers)
|
134
|
+
end
|
112
135
|
end
|
113
136
|
end
|
@@ -187,6 +187,26 @@ module KineticSdk
|
|
187
187
|
@logger.info("Updating the \"#{name}\" webhook on the Space")
|
188
188
|
put("#{@api_url}/webhooks/#{encode(name)}", webhook_properties, headers)
|
189
189
|
end
|
190
|
+
|
191
|
+
# Delete a webhook on a kapp
|
192
|
+
#
|
193
|
+
# @param kapp_slug [String] slug of the Kapp the webhook belongs to
|
194
|
+
# @param name [String] the webhook name
|
195
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
196
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
197
|
+
def delete_webhook_on_kapp(kapp_slug, name, headers=default_headers)
|
198
|
+
@logger.info("Deleting the #{name} webhook on the #{kapp_slug}\ kapp.")
|
199
|
+
delete(URI.encode("#{@api_url}/kapps/#{kapp_slug}/webhooks/#{encode(name)}"), headers)
|
200
|
+
end
|
201
|
+
|
202
|
+
# Delete a webhook on space
|
203
|
+
# @param name [String] the webhook name
|
204
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
205
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
206
|
+
def delete_webhook_on_space(name, headers=default_headers)
|
207
|
+
@logger.info("Deleting the #{name} webhook on the space.")
|
208
|
+
delete("#{@api_url}/webhooks/#{encode(name)}", headers)
|
209
|
+
end
|
190
210
|
|
191
211
|
end
|
192
212
|
end
|
data/lib/kinetic_sdk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kinetic_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kinetic Data
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slugify
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 13.0.1
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 13.0.1
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: yard
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|