kinetic_sdk 0.1.1 → 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 +5 -5
- data/.yardoc-includes/yard-helpers.rb +14 -0
- data/.yardopts +7 -0
- data/CHANGELOG.md +41 -0
- data/GettingStarted.md +6 -12
- data/README.md +85 -37
- data/Rakefile +13 -0
- data/kinetic_sdk.gemspec +33 -0
- data/lib/kinetic_sdk/agent/agent-sdk.rb +90 -0
- data/lib/kinetic_sdk/agent/lib/bridges.rb +92 -0
- data/lib/kinetic_sdk/agent/lib/filestores.rb +91 -0
- data/lib/kinetic_sdk/agent/lib/handler.rb +91 -0
- data/lib/kinetic_sdk/bridgehub/bridgehub-sdk.rb +11 -3
- data/lib/kinetic_sdk/bridgehub/lib/access_keys.rb +5 -5
- data/lib/kinetic_sdk/bridgehub/lib/bridge.rb +5 -5
- data/lib/kinetic_sdk/{request_ce/request-ce-sdk.rb → core/core-sdk.rb} +30 -16
- data/lib/kinetic_sdk/core/lib/attribute_definitions.rb +500 -0
- data/lib/kinetic_sdk/core/lib/bridges.rb +141 -0
- data/lib/kinetic_sdk/{request_ce → core}/lib/categories.rb +3 -3
- data/lib/kinetic_sdk/{request_ce → core}/lib/datastore_form.rb +8 -8
- data/lib/kinetic_sdk/{request_ce → core}/lib/datastore_submissions.rb +20 -9
- data/lib/kinetic_sdk/{request_ce → core}/lib/form.rb +7 -7
- data/lib/kinetic_sdk/{request_ce → core}/lib/form_types.rb +4 -4
- data/lib/kinetic_sdk/{request_ce → core}/lib/jwt.rb +4 -4
- data/lib/kinetic_sdk/{request_ce → core}/lib/kapp.rb +7 -7
- data/lib/kinetic_sdk/{request_ce → core}/lib/meta.rb +3 -3
- data/lib/kinetic_sdk/{request_ce → core}/lib/oauth.rb +4 -4
- data/lib/kinetic_sdk/{request_ce → core}/lib/security_policy_definitions.rb +11 -11
- data/lib/kinetic_sdk/core/lib/space.rb +156 -0
- data/lib/kinetic_sdk/{request_ce → core}/lib/submissions.rb +11 -11
- data/lib/kinetic_sdk/{request_ce → core}/lib/system_api.rb +19 -7
- data/lib/kinetic_sdk/{request_ce → core}/lib/teams.rb +9 -9
- data/lib/kinetic_sdk/{request_ce → core}/lib/users.rb +15 -15
- data/lib/kinetic_sdk/{request_ce → core}/lib/webhook_jobs.rb +5 -5
- data/lib/kinetic_sdk/{request_ce → core}/lib/webhooks.rb +9 -9
- data/lib/kinetic_sdk/discussions/discussions-sdk.rb +12 -4
- data/lib/kinetic_sdk/discussions/lib/discussions.rb +8 -8
- data/lib/kinetic_sdk/discussions/lib/invitations.rb +9 -9
- data/lib/kinetic_sdk/discussions/lib/messages.rb +8 -8
- data/lib/kinetic_sdk/discussions/lib/meta.rb +1 -1
- data/lib/kinetic_sdk/discussions/lib/participants.rb +5 -5
- data/lib/kinetic_sdk/discussions/lib/related_items.rb +4 -4
- data/lib/kinetic_sdk/discussions/lib/websockets.rb +9 -9
- data/lib/kinetic_sdk/filehub/filehub-sdk.rb +11 -3
- data/lib/kinetic_sdk/filehub/lib/access_keys.rb +5 -5
- data/lib/kinetic_sdk/filehub/lib/filestores.rb +5 -5
- data/lib/kinetic_sdk/task/lib/access_keys.rb +35 -7
- data/lib/kinetic_sdk/task/lib/categories.rb +30 -17
- data/lib/kinetic_sdk/task/lib/config.rb +14 -14
- data/lib/kinetic_sdk/task/lib/engine.rb +1 -1
- data/lib/kinetic_sdk/task/lib/errors.rb +10 -10
- data/lib/kinetic_sdk/task/lib/export.rb +32 -0
- data/lib/kinetic_sdk/task/lib/groups.rb +23 -10
- data/lib/kinetic_sdk/task/lib/handlers.rb +27 -11
- data/lib/kinetic_sdk/task/lib/health.rb +11 -3
- data/lib/kinetic_sdk/task/lib/license.rb +4 -4
- data/lib/kinetic_sdk/task/lib/policy_rules.rb +25 -12
- data/lib/kinetic_sdk/task/lib/runs.rb +43 -0
- data/lib/kinetic_sdk/task/lib/setup.rb +2 -2
- data/lib/kinetic_sdk/task/lib/sources.rb +39 -8
- data/lib/kinetic_sdk/task/lib/tasks.rb +1 -1
- data/lib/kinetic_sdk/task/lib/trees.rb +84 -28
- data/lib/kinetic_sdk/task/lib/users.rb +6 -6
- data/lib/kinetic_sdk/task/task-sdk.rb +16 -4
- data/lib/kinetic_sdk/utils/kinetic-export-utils.rb +157 -0
- data/lib/kinetic_sdk/utils/kinetic-http.rb +388 -98
- data/lib/kinetic_sdk/utils/logger.rb +82 -46
- data/lib/kinetic_sdk/utils/prettier-xml-formatter.rb +60 -0
- data/lib/kinetic_sdk/version.rb +1 -1
- data/lib/kinetic_sdk.rb +5 -2
- metadata +41 -27
- data/lib/kinetic_sdk/request_ce/lib/attribute_definitions.rb +0 -153
- data/lib/kinetic_sdk/request_ce/lib/bridges.rb +0 -66
- data/lib/kinetic_sdk/request_ce/lib/space.rb +0 -89
@@ -1,5 +1,5 @@
|
|
1
1
|
module KineticSdk
|
2
|
-
class
|
2
|
+
class Core
|
3
3
|
|
4
4
|
# Add a Datastore Form
|
5
5
|
#
|
@@ -20,7 +20,7 @@ module KineticSdk
|
|
20
20
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
21
21
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
22
22
|
def add_datastore_form(form_properties={}, headers=default_headers)
|
23
|
-
info("Adding the \"#{form_properties['name']}\" Form.")
|
23
|
+
@logger.info("Adding the \"#{form_properties['name']}\" Form.")
|
24
24
|
post("#{@api_url}/datastore/forms", form_properties, headers)
|
25
25
|
end
|
26
26
|
|
@@ -30,7 +30,7 @@ module KineticSdk
|
|
30
30
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
31
31
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
32
32
|
def delete_datastore_form(form_slug, headers=default_headers)
|
33
|
-
info("Deleting the \"#{form_slug}\" Datastore Form")
|
33
|
+
@logger.info("Deleting the \"#{form_slug}\" Datastore Form")
|
34
34
|
delete("#{@api_url}/datastore/forms/#{form_slug}", headers)
|
35
35
|
end
|
36
36
|
|
@@ -40,7 +40,7 @@ module KineticSdk
|
|
40
40
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
41
41
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
42
42
|
def export_datastore_form(form_slug, headers=default_headers)
|
43
|
-
info("Exporting the \"#{form_slug}\" Datastore Form.")
|
43
|
+
@logger.info("Exporting the \"#{form_slug}\" Datastore Form.")
|
44
44
|
get("#{@api_url}/datastore/forms/#{form_slug}", { 'export' => true }, headers)
|
45
45
|
end
|
46
46
|
|
@@ -50,7 +50,7 @@ module KineticSdk
|
|
50
50
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
51
51
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
52
52
|
def find_datastore_forms(params={}, headers=default_headers)
|
53
|
-
info("Finding Forms.")
|
53
|
+
@logger.info("Finding Forms.")
|
54
54
|
get("#{@api_url}/datastore/forms", params, headers)
|
55
55
|
end
|
56
56
|
|
@@ -61,7 +61,7 @@ module KineticSdk
|
|
61
61
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
62
62
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
63
63
|
def find_datastore_form(form_slug, params={}, headers=default_headers)
|
64
|
-
info("Finding the \"#{form_slug}\" Datastore Form")
|
64
|
+
@logger.info("Finding the \"#{form_slug}\" Datastore Form")
|
65
65
|
get("#{@api_url}/datastore/forms/#{form_slug}", params, headers)
|
66
66
|
end
|
67
67
|
|
@@ -85,7 +85,7 @@ module KineticSdk
|
|
85
85
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
86
86
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
87
87
|
def update_datastore_form(form_slug, properties={}, headers=default_headers)
|
88
|
-
info("Updating the \"#{form_slug}\" Datastore Form.")
|
88
|
+
@logger.info("Updating the \"#{form_slug}\" Datastore Form.")
|
89
89
|
put("#{@api_url}/datastore/forms/#{form_slug}", properties, headers)
|
90
90
|
end
|
91
91
|
|
@@ -102,7 +102,7 @@ module KineticSdk
|
|
102
102
|
"indexes" => indexes
|
103
103
|
}
|
104
104
|
}
|
105
|
-
info("Building indexes for the \"#{form_slug}\" Datastore Form.")
|
105
|
+
@logger.info("Building indexes for the \"#{form_slug}\" Datastore Form.")
|
106
106
|
post("#{@api_url}/datastore/forms/#{form_slug}/backgroundJobs", payload, headers)
|
107
107
|
end
|
108
108
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module KineticSdk
|
2
|
-
class
|
2
|
+
class Core
|
3
3
|
|
4
4
|
# Add a Datastore Submission
|
5
5
|
#
|
@@ -18,7 +18,7 @@ module KineticSdk
|
|
18
18
|
# set parent hash if parent was passed as a string
|
19
19
|
payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
|
20
20
|
# Create the submission
|
21
|
-
info("Adding a submission in the \"#{form_slug}\" Datastore Form.")
|
21
|
+
@logger.info("Adding a submission in the \"#{form_slug}\" Datastore Form.")
|
22
22
|
post("#{@api_url}/datastore/forms/#{form_slug}/submissions", payload, headers)
|
23
23
|
end
|
24
24
|
|
@@ -40,7 +40,7 @@ module KineticSdk
|
|
40
40
|
# set parent hash if parent was passed as a string
|
41
41
|
payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
|
42
42
|
# Create the submission
|
43
|
-
info("Adding a submission page in the \"#{form_slug}\" Datastore Form.")
|
43
|
+
@logger.info("Adding a submission page in the \"#{form_slug}\" Datastore Form.")
|
44
44
|
post("#{@api_url}/datastore/forms/#{form_slug}/submissions?page=#{encode(page_name)}", payload, headers)
|
45
45
|
end
|
46
46
|
|
@@ -63,7 +63,7 @@ module KineticSdk
|
|
63
63
|
# set parent hash if parent was passed as a string
|
64
64
|
payload["parent"] = { "id" => payload["parent"] } if payload["parent"].is_a? String
|
65
65
|
# Create the submission
|
66
|
-
info("Patching a submission in the \"#{form_slug}\" Form.")
|
66
|
+
@logger.info("Patching a submission in the \"#{form_slug}\" Form.")
|
67
67
|
patch("#{@api_url}/datastore/forms/#{form_slug}/submissions", payload, headers)
|
68
68
|
end
|
69
69
|
|
@@ -80,7 +80,7 @@ module KineticSdk
|
|
80
80
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
81
81
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
82
82
|
def find_all_form_datastore_submissions(form_slug, params={}, headers=default_headers)
|
83
|
-
info("Finding submissions for the \"#{form_slug}\" Datastore Form.")
|
83
|
+
@logger.info("Finding submissions for the \"#{form_slug}\" Datastore Form.")
|
84
84
|
# Make the initial request of pages submissions
|
85
85
|
response = find_form_datastore_submissions(form_slug, params, headers)
|
86
86
|
# Build the Messages Array
|
@@ -119,9 +119,9 @@ module KineticSdk
|
|
119
119
|
# Get next page token
|
120
120
|
token = params["pageToken"]
|
121
121
|
if token.nil?
|
122
|
-
info("Finding first page of submissions for the \"#{form_slug}\" Datastore.")
|
122
|
+
@logger.info("Finding first page of submissions for the \"#{form_slug}\" Datastore.")
|
123
123
|
else
|
124
|
-
info("Finding page of submissions starting with token \"#{token}\" for the \"#{form_slug}\" Form.")
|
124
|
+
@logger.info("Finding page of submissions starting with token \"#{token}\" for the \"#{form_slug}\" Form.")
|
125
125
|
end
|
126
126
|
|
127
127
|
# Build Submission URL
|
@@ -130,6 +130,17 @@ module KineticSdk
|
|
130
130
|
get(url, params, headers)
|
131
131
|
end
|
132
132
|
|
133
|
+
# Find a Datastore submission
|
134
|
+
#
|
135
|
+
# @param submission_id [String] String value of the Submission Id (UUID)
|
136
|
+
# @param params [Hash] Query parameters that are added to the URL, such as +include+
|
137
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
138
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
139
|
+
def find_datastore_submission(submission_id, params={}, headers=default_headers)
|
140
|
+
@logger.info("Finding Datastore Submission \"#{submission_id}\"")
|
141
|
+
get("#{@api_url}/datastore/submissions/#{encode(submission_id)}", params, headers)
|
142
|
+
end
|
143
|
+
|
133
144
|
|
134
145
|
# Update a Datastore submission
|
135
146
|
#
|
@@ -138,7 +149,7 @@ module KineticSdk
|
|
138
149
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
139
150
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
140
151
|
def update_datastore_submission(submission_id, body={}, headers=default_headers)
|
141
|
-
info("Updating Datastore Submission \"#{submission_id}\"")
|
152
|
+
@logger.info("Updating Datastore Submission \"#{submission_id}\"")
|
142
153
|
put("#{@api_url}/datastore/submissions/#{encode(submission_id)}", body, headers)
|
143
154
|
end
|
144
155
|
|
@@ -149,7 +160,7 @@ module KineticSdk
|
|
149
160
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
150
161
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
151
162
|
def delete_datastore_submission(submission_id, headers=default_headers)
|
152
|
-
info("Deleting Datastore Submission \"#{submission_id}\"")
|
163
|
+
@logger.info("Deleting Datastore Submission \"#{submission_id}\"")
|
153
164
|
delete("#{@api_url}/datastore/submissions/#{encode(submission_id)}", headers)
|
154
165
|
end
|
155
166
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module KineticSdk
|
2
|
-
class
|
2
|
+
class Core
|
3
3
|
|
4
4
|
# Add a Form
|
5
5
|
#
|
@@ -21,7 +21,7 @@ module KineticSdk
|
|
21
21
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
22
22
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
23
23
|
def add_form(kapp_slug, form_properties={}, headers=default_headers)
|
24
|
-
info("Adding the \"#{form_properties['name']}\" Form.")
|
24
|
+
@logger.info("Adding the \"#{form_properties['name']}\" Form.")
|
25
25
|
post("#{@api_url}/kapps/#{kapp_slug}/forms", form_properties, headers)
|
26
26
|
end
|
27
27
|
|
@@ -32,7 +32,7 @@ module KineticSdk
|
|
32
32
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
33
33
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
34
34
|
def delete_form(kapp_slug, form_slug, headers=default_headers)
|
35
|
-
info("Deleting the \"#{form_slug}\" Form in the \"#{kapp_slug}\" Kapp.")
|
35
|
+
@logger.info("Deleting the \"#{form_slug}\" Form in the \"#{kapp_slug}\" Kapp.")
|
36
36
|
delete("#{@api_url}/kapps/#{kapp_slug}/forms/#{form_slug}", headers)
|
37
37
|
end
|
38
38
|
|
@@ -43,7 +43,7 @@ module KineticSdk
|
|
43
43
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
44
44
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
45
45
|
def export_form(kapp_slug, form_slug, headers=default_headers)
|
46
|
-
info("Exporting the \"#{form_slug}\" Form in the \"#{kapp_slug}\" Kapp.")
|
46
|
+
@logger.info("Exporting the \"#{form_slug}\" Form in the \"#{kapp_slug}\" Kapp.")
|
47
47
|
get("#{@api_url}/kapps/#{kapp_slug}/forms/#{form_slug}", { 'export' => true }, headers)
|
48
48
|
end
|
49
49
|
|
@@ -54,7 +54,7 @@ module KineticSdk
|
|
54
54
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
55
55
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
56
56
|
def find_forms(kapp_slug, params={}, headers=default_headers)
|
57
|
-
info("Finding Forms.")
|
57
|
+
@logger.info("Finding Forms.")
|
58
58
|
get("#{@api_url}/kapps/#{kapp_slug}/forms", params, headers)
|
59
59
|
end
|
60
60
|
|
@@ -66,7 +66,7 @@ module KineticSdk
|
|
66
66
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
67
67
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
68
68
|
def find_form(kapp_slug, form_slug, params={}, headers=default_headers)
|
69
|
-
info("Finding the \"#{form_slug}\" Form in the \"#{kapp_slug}\" Kapp.")
|
69
|
+
@logger.info("Finding the \"#{form_slug}\" Form in the \"#{kapp_slug}\" Kapp.")
|
70
70
|
get("#{@api_url}/kapps/#{kapp_slug}/forms/#{form_slug}", params, headers)
|
71
71
|
end
|
72
72
|
|
@@ -91,7 +91,7 @@ module KineticSdk
|
|
91
91
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
92
92
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
93
93
|
def update_form(kapp_slug, form_slug, properties={}, headers=default_headers)
|
94
|
-
info("Updating the \"#{form_slug}\" Form in the \"#{kapp_slug}\" Kapp.")
|
94
|
+
@logger.info("Updating the \"#{form_slug}\" Form in the \"#{kapp_slug}\" Kapp.")
|
95
95
|
put("#{@api_url}/kapps/#{kapp_slug}/forms/#{form_slug}", properties, headers)
|
96
96
|
end
|
97
97
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module KineticSdk
|
2
|
-
class
|
2
|
+
class Core
|
3
3
|
|
4
4
|
# Add a form type on a Kapp
|
5
5
|
#
|
@@ -10,7 +10,7 @@ module KineticSdk
|
|
10
10
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
11
11
|
def add_form_type_on_kapp(kapp_slug, body, headers=default_headers)
|
12
12
|
raise StandardError.new "Form Type properties is not valid, must be a Hash." unless body.is_a? Hash
|
13
|
-
info("Adding Form Type \"#{body['name']}\" for \"#{kapp_slug}\" kapp")
|
13
|
+
@logger.info("Adding Form Type \"#{body['name']}\" for \"#{kapp_slug}\" kapp")
|
14
14
|
post("#{@api_url}/kapps/#{kapp_slug}/formTypes", body, headers)
|
15
15
|
end
|
16
16
|
|
@@ -21,7 +21,7 @@ module KineticSdk
|
|
21
21
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
22
22
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
23
23
|
def delete_form_type(kapp_slug, name, headers=default_headers)
|
24
|
-
info("Deleting form type \"#{name}\" from \"#{kapp_slug}\" kapp")
|
24
|
+
@logger.info("Deleting form type \"#{name}\" from \"#{kapp_slug}\" kapp")
|
25
25
|
delete("#{@api_url}/kapps/#{kapp_slug}/formTypes/#{encode(name)}", headers)
|
26
26
|
end
|
27
27
|
|
@@ -43,7 +43,7 @@ module KineticSdk
|
|
43
43
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
44
44
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
45
45
|
def find_form_types_on_kapp(kapp_slug, params={}, headers=default_headers)
|
46
|
-
info("Finding Form Types for \"#{kapp_slug}\" kapp")
|
46
|
+
@logger.info("Finding Form Types for \"#{kapp_slug}\" kapp")
|
47
47
|
get("#{@api_url}/kapps/#{kapp_slug}/formTypes", params, headers)
|
48
48
|
end
|
49
49
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module KineticSdk
|
2
|
-
class
|
2
|
+
class Core
|
3
3
|
|
4
|
-
# Gets an authentication
|
4
|
+
# Gets an authentication token
|
5
5
|
#
|
6
6
|
# @param client_id [String] the oauth client id
|
7
7
|
# @param client_secret [String] the oauth client secret
|
@@ -11,7 +11,7 @@ module KineticSdk
|
|
11
11
|
# retrieve the jwt code
|
12
12
|
jwt_code = jwt_code(client_id, headers)
|
13
13
|
# retrieve the jwt token
|
14
|
-
info("Retrieving JWT authorization token")
|
14
|
+
@logger.info("Retrieving JWT authorization token")
|
15
15
|
url = "#{@server}/app/oauth/token?grant_type=authorization_code&response_type=token&client_id=#{client_id}&code=#{jwt_code}"
|
16
16
|
token_headers = header_accept_json.merge(header_basic_auth(client_id, client_secret))
|
17
17
|
response = post(url, {}, token_headers, 0)
|
@@ -33,7 +33,7 @@ module KineticSdk
|
|
33
33
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
34
34
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
35
35
|
def jwt_code(client_id, headers=default_headers)
|
36
|
-
info("Retrieving JWT authorization code")
|
36
|
+
@logger.info("Retrieving JWT authorization code")
|
37
37
|
url = "#{@server}/app/oauth/authorize?grant_type=authorization_code&response_type=code&client_id=#{client_id}"
|
38
38
|
response = post(url, {}, headers, -1)
|
39
39
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module KineticSdk
|
2
|
-
class
|
2
|
+
class Core
|
3
3
|
|
4
4
|
# Add a Kapp
|
5
5
|
#
|
@@ -22,7 +22,7 @@ module KineticSdk
|
|
22
22
|
"name" => kapp_name,
|
23
23
|
"slug" => kapp_slug
|
24
24
|
})
|
25
|
-
info("Adding the \"#{kapp_name}\" Kapp.")
|
25
|
+
@logger.info("Adding the \"#{kapp_name}\" Kapp.")
|
26
26
|
post("#{@api_url}/kapps", properties, headers)
|
27
27
|
end
|
28
28
|
|
@@ -32,7 +32,7 @@ module KineticSdk
|
|
32
32
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
33
33
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
34
34
|
def delete_kapp(kapp_slug, headers=default_headers)
|
35
|
-
info("Deleting the \"#{kapp_slug}\" Kapp.")
|
35
|
+
@logger.info("Deleting the \"#{kapp_slug}\" Kapp.")
|
36
36
|
delete("#{@api_url}/kapps/#{kapp_slug}", headers)
|
37
37
|
end
|
38
38
|
|
@@ -42,7 +42,7 @@ module KineticSdk
|
|
42
42
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
43
43
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
44
44
|
def export_kapp(kapp_slug, headers=default_headers)
|
45
|
-
info("Exporting the \"#{kapp_slug}\" Kapp.")
|
45
|
+
@logger.info("Exporting the \"#{kapp_slug}\" Kapp.")
|
46
46
|
get("#{@api_url}/kapps/#{kapp_slug}", { 'export' => true }, headers)
|
47
47
|
end
|
48
48
|
|
@@ -52,7 +52,7 @@ module KineticSdk
|
|
52
52
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
53
53
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
54
54
|
def find_kapps(params={}, headers=default_headers)
|
55
|
-
info("Finding Kapps.")
|
55
|
+
@logger.info("Finding Kapps.")
|
56
56
|
get("#{@api_url}/kapps", params, headers)
|
57
57
|
end
|
58
58
|
|
@@ -63,7 +63,7 @@ module KineticSdk
|
|
63
63
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
64
64
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
65
65
|
def find_kapp(kapp_slug, params={}, headers=default_headers)
|
66
|
-
info("Finding Kapp \"#{kapp_slug}\"")
|
66
|
+
@logger.info("Finding Kapp \"#{kapp_slug}\"")
|
67
67
|
get("#{@api_url}/kapps/#{kapp_slug}", params, headers)
|
68
68
|
end
|
69
69
|
|
@@ -85,7 +85,7 @@ module KineticSdk
|
|
85
85
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
86
86
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
87
87
|
def update_kapp(kapp_slug, properties={}, headers=default_headers)
|
88
|
-
info("Updating the \"#{kapp_slug}\" Kapp.")
|
88
|
+
@logger.info("Updating the \"#{kapp_slug}\" Kapp.")
|
89
89
|
put("#{@api_url}/kapps/#{kapp_slug}", properties, headers)
|
90
90
|
end
|
91
91
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module KineticSdk
|
2
|
-
class
|
2
|
+
class Core
|
3
3
|
|
4
|
-
# Retrieve
|
4
|
+
# Retrieve Core application version
|
5
5
|
#
|
6
6
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
7
7
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
8
8
|
def app_version(headers=default_headers)
|
9
|
-
info("Retrieving
|
9
|
+
@logger.info("Retrieving Core application version.")
|
10
10
|
get("#{@api_url}/version", {}, headers)
|
11
11
|
end
|
12
12
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module KineticSdk
|
2
|
-
class
|
2
|
+
class Core
|
3
3
|
|
4
4
|
# Add an OAuth client
|
5
5
|
#
|
@@ -7,7 +7,7 @@ module KineticSdk
|
|
7
7
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
8
8
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
9
9
|
def add_oauth_client(options, headers=default_headers)
|
10
|
-
info("Adding the \"#{options['clientId']}\" OAuth client")
|
10
|
+
@logger.info("Adding the \"#{options['clientId']}\" OAuth client")
|
11
11
|
post("#{@api_url}/oauthClients", options, headers)
|
12
12
|
end
|
13
13
|
|
@@ -18,7 +18,7 @@ module KineticSdk
|
|
18
18
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
19
19
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
20
20
|
def find_oauth_client(client_id, params={}, headers=default_headers)
|
21
|
-
info("Finding OAuth Client \"#{client_id}\"")
|
21
|
+
@logger.info("Finding OAuth Client \"#{client_id}\"")
|
22
22
|
get("#{@api_url}/oauthClients/#{encode(client_id)}", params, headers)
|
23
23
|
end
|
24
24
|
|
@@ -29,7 +29,7 @@ module KineticSdk
|
|
29
29
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
30
30
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
31
31
|
def update_oauth_client(client_id, options, headers=default_headers)
|
32
|
-
info("Updating the \"#{client_id}\" OAuth client")
|
32
|
+
@logger.info("Updating the \"#{client_id}\" OAuth client")
|
33
33
|
put("#{@api_url}/oauthClients/#{encode(client_id)}", options, headers)
|
34
34
|
end
|
35
35
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module KineticSdk
|
2
|
-
class
|
2
|
+
class Core
|
3
3
|
|
4
4
|
# Add a Space security policy definition
|
5
5
|
#
|
@@ -11,7 +11,7 @@ module KineticSdk
|
|
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_space_security_policy_definition(body, headers=default_headers)
|
14
|
-
info("Adding Space Security Policy Definition \"#{body['name']}\".")
|
14
|
+
@logger.info("Adding Space Security Policy Definition \"#{body['name']}\".")
|
15
15
|
# Create the space security policy definition
|
16
16
|
post("#{@api_url}/securityPolicyDefinitions", body, headers)
|
17
17
|
end
|
@@ -22,7 +22,7 @@ module KineticSdk
|
|
22
22
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
23
23
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
24
24
|
def delete_space_security_policy_definition(name, headers=default_headers)
|
25
|
-
info("Deleting Space Security Policy Definition \"#{name}\".")
|
25
|
+
@logger.info("Deleting Space Security Policy Definition \"#{name}\".")
|
26
26
|
# Delete the space security policy definition
|
27
27
|
delete("#{@api_url}/securityPolicyDefinitions/#{encode(name)}", headers)
|
28
28
|
end
|
@@ -43,7 +43,7 @@ module KineticSdk
|
|
43
43
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
44
44
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
45
45
|
def find_space_security_policy_definitions(params={}, headers=default_headers)
|
46
|
-
info("Finding Space Security Policy Definitions.")
|
46
|
+
@logger.info("Finding Space Security Policy Definitions.")
|
47
47
|
get("#{@api_url}/securityPolicyDefinitions", params, headers)
|
48
48
|
end
|
49
49
|
|
@@ -54,7 +54,7 @@ module KineticSdk
|
|
54
54
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
55
55
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
56
56
|
def find_space_security_policy_definition(name, params={}, headers=default_headers)
|
57
|
-
info("Finding Space Security Policy Definition \"#{name}\"")
|
57
|
+
@logger.info("Finding Space Security Policy Definition \"#{name}\"")
|
58
58
|
get("#{@api_url}/securityPolicyDefinitions/#{encode(name)}", params, headers)
|
59
59
|
end
|
60
60
|
|
@@ -69,7 +69,7 @@ module KineticSdk
|
|
69
69
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
70
70
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
71
71
|
def update_space_security_policy_definition(name, body, headers=default_headers)
|
72
|
-
info("Updating Space Security Policy Definition \"#{name}\"")
|
72
|
+
@logger.info("Updating Space Security Policy Definition \"#{name}\"")
|
73
73
|
put("#{@api_url}/securityPolicyDefinitions/#{encode(name)}", body, headers)
|
74
74
|
end
|
75
75
|
|
@@ -86,7 +86,7 @@ module KineticSdk
|
|
86
86
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
87
87
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
88
88
|
def add_security_policy_definition(kapp_slug, body, headers=default_headers)
|
89
|
-
info("Adding Security Policy Definition \"#{body['name']}\" to the \"#{kapp_slug}\" kapp.")
|
89
|
+
@logger.info("Adding Security Policy Definition \"#{body['name']}\" to the \"#{kapp_slug}\" kapp.")
|
90
90
|
# Create the kapp security policy definition
|
91
91
|
post("#{@api_url}/kapps/#{kapp_slug}/securityPolicyDefinitions", body, headers)
|
92
92
|
end
|
@@ -98,7 +98,7 @@ module KineticSdk
|
|
98
98
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
99
99
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
100
100
|
def delete_security_policy_definition(kapp_slug, name, headers=default_headers)
|
101
|
-
info("Deleting Security Policy Definition \"#{name}\" from the \"#{kapp_slug}\" kapp.")
|
101
|
+
@logger.info("Deleting Security Policy Definition \"#{name}\" from the \"#{kapp_slug}\" kapp.")
|
102
102
|
# Delete the kapp security policy definition
|
103
103
|
delete("#{@api_url}/kapps/#{kapp_slug}/securityPolicyDefinitions/#{encode(name)}", headers)
|
104
104
|
end
|
@@ -121,7 +121,7 @@ module KineticSdk
|
|
121
121
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
122
122
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
123
123
|
def find_security_policy_definitions(kapp_slug, params={}, headers=default_headers)
|
124
|
-
info("Listing Security Policy Definitions on the \"#{kapp_slug}\" kapp.")
|
124
|
+
@logger.info("Listing Security Policy Definitions on the \"#{kapp_slug}\" kapp.")
|
125
125
|
get("#{@api_url}/kapps/#{kapp_slug}/securityPolicyDefinitions", params, headers)
|
126
126
|
end
|
127
127
|
|
@@ -133,7 +133,7 @@ module KineticSdk
|
|
133
133
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
134
134
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
135
135
|
def find_security_policy_definition(kapp_slug, name, params={}, headers=default_headers)
|
136
|
-
info("Finding Security Policy Definition \"#{name}\" on the \"#{kapp_slug}\" kapp.")
|
136
|
+
@logger.info("Finding Security Policy Definition \"#{name}\" on the \"#{kapp_slug}\" kapp.")
|
137
137
|
get("#{@api_url}/kapps/#{kapp_slug}/securityPolicyDefinitions/#{encode(name)}", params, headers)
|
138
138
|
end
|
139
139
|
|
@@ -149,7 +149,7 @@ module KineticSdk
|
|
149
149
|
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
150
150
|
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
151
151
|
def update_security_policy_definition(kapp_slug, name, body, headers=default_headers)
|
152
|
-
info("Updating Security Policy Definition \"#{name}\" on the \"#{kapp_slug}\" kapp.")
|
152
|
+
@logger.info("Updating Security Policy Definition \"#{name}\" on the \"#{kapp_slug}\" kapp.")
|
153
153
|
put("#{@api_url}/kapps/#{kapp_slug}/securityPolicyDefinitions/#{encode(name)}", body, headers)
|
154
154
|
end
|
155
155
|
|
@@ -0,0 +1,156 @@
|
|
1
|
+
module KineticSdk
|
2
|
+
class Core
|
3
|
+
|
4
|
+
# Add an attribute value to the space, or update an attribute if it already exists
|
5
|
+
#
|
6
|
+
# @param attribute_name [String] name of the attribute
|
7
|
+
# @param attribute_value [String] value of the attribute
|
8
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
9
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
10
|
+
def add_space_attribute(attribute_name, attribute_value, headers=default_headers)
|
11
|
+
# first find the space
|
12
|
+
response = find_space({ "include" => "attributes"}, headers)
|
13
|
+
# hack to try a second time if space isn't found
|
14
|
+
if response.status == 404
|
15
|
+
sleep 2
|
16
|
+
response = find_space({ "include" => "attributes"}, headers)
|
17
|
+
end
|
18
|
+
space = response.content["space"]
|
19
|
+
attributes = space["attributes"]
|
20
|
+
# either add or update the attribute value
|
21
|
+
exists = false
|
22
|
+
attributes.each do |attribute|
|
23
|
+
@logger.info("Attribute: #{attribute.inspect}")
|
24
|
+
# if the attribute already exists, update it
|
25
|
+
if attribute["name"] == attribute_name
|
26
|
+
attribute["values"] = [ attribute_value ]
|
27
|
+
exists = true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
# add the attribute if it didn't exist
|
31
|
+
attributes.push({
|
32
|
+
"name" => attribute_name,
|
33
|
+
"values" => [ attribute_value ]
|
34
|
+
}) unless exists
|
35
|
+
|
36
|
+
# set the updated attributes list
|
37
|
+
body = { "attributes" => attributes }
|
38
|
+
if exists
|
39
|
+
@logger.info("Updating attribute \"#{attribute_name}\" = \"#{attribute_value}\" in the \"#{space_slug}\" space.")
|
40
|
+
else
|
41
|
+
@logger.info("Adding attribute \"#{attribute_name}\" = \"#{attribute_value}\" to the \"#{space_slug}\" space.")
|
42
|
+
end
|
43
|
+
# Update the space
|
44
|
+
put("#{@api_url}/space", body, headers)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Update a space
|
48
|
+
#
|
49
|
+
# @param body [Hash] properties for the Space
|
50
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
51
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
52
|
+
def update_space(body={}, headers=default_headers)
|
53
|
+
@logger.info("Updating Space \"#{@space_slug}\"")
|
54
|
+
put("#{@api_url}/space", body, headers)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Export a space to the export_directory
|
58
|
+
#
|
59
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
60
|
+
# @return nil
|
61
|
+
def export_space(headers=default_headers)
|
62
|
+
raise StandardError.new "An export directory must be defined to export space." if @options[:export_directory].nil?
|
63
|
+
@logger.info("Exporting space definition to #{@options[:export_directory]}.")
|
64
|
+
# Build up the tree of how files should be written
|
65
|
+
export_shape = prepare_shape(
|
66
|
+
"space.bridges.{name}",
|
67
|
+
"space.datastore.forms.{slug}",
|
68
|
+
"space.kapps.{slug}.categories",
|
69
|
+
"space.kapps.{slug}.categoryAttributeDefinitions",
|
70
|
+
"space.kapps.{slug}.forms.{slug}",
|
71
|
+
"space.kapps.{slug}.formAttributeDefinitions",
|
72
|
+
"space.kapps.{slug}.formsTypes",
|
73
|
+
"space.kapps.{slug}.kappAttributeDefinitions",
|
74
|
+
"space.kapps.{slug}.securityPolicyDefinitions",
|
75
|
+
"space.kapps.{slug}.webhooks.{name}",
|
76
|
+
"space.models.{name}",
|
77
|
+
"space.teams.{name}",
|
78
|
+
"space.datastoreFormAttributeDefinitions",
|
79
|
+
"space.securityPolicyDefinitions",
|
80
|
+
"space.spaceAttributeDefinitions",
|
81
|
+
"space.teamAttributeDefinitions",
|
82
|
+
"space.userAttributeDefinitions",
|
83
|
+
"space.userProfileAttributeDefinitions",
|
84
|
+
"space.webhooks.{name}",
|
85
|
+
)
|
86
|
+
core_data = get("#{@api_url}/space", { 'export' => true}, headers).content
|
87
|
+
process_export(@options[:export_directory], export_shape, core_data)
|
88
|
+
@logger.info("Finished exporting space definition to #{@options[:export_directory]}.")
|
89
|
+
end
|
90
|
+
|
91
|
+
# Find the space
|
92
|
+
#
|
93
|
+
# @param params [Hash] Query parameters that are added to the URL, such as +include+
|
94
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
95
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
96
|
+
def find_space(params={}, headers=default_headers)
|
97
|
+
@logger.info("Finding Space \"#{@space_slug}\"")
|
98
|
+
get("#{@api_url}/space", params, headers)
|
99
|
+
end
|
100
|
+
|
101
|
+
# Imports a full space definition from the export_directory
|
102
|
+
#
|
103
|
+
# @param slug [String] the slug of the space that is being imported
|
104
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
105
|
+
# @return nil
|
106
|
+
def import_space(slug, headers=default_headers)
|
107
|
+
raise StandardError.new "An export directory must be defined to import space." if @options[:export_directory].nil?
|
108
|
+
@logger.info("Importing space definition from #{@options[:export_directory]}.")
|
109
|
+
|
110
|
+
# Loop over all provided files sorting files before folders
|
111
|
+
Dir["#{@options[:export_directory]}/**/*.json"].map { |file| [file.count("/"), file] }.sort.map { |file| file[1] }.each do |file|
|
112
|
+
rel_path = file.gsub("#{@options[:export_directory]}/", '')
|
113
|
+
body = JSON.parse(File.read(file))
|
114
|
+
if rel_path == "space.json"
|
115
|
+
api_path = "/space"
|
116
|
+
@logger.info("Importing #{rel_path} to #{api_path}.")
|
117
|
+
body['slug'] = slug
|
118
|
+
resp = put("#{@api_url}#{api_path}", body, headers)
|
119
|
+
elsif body.is_a?(Array)
|
120
|
+
api_path = "/#{rel_path.sub(/^space\//,'').sub(/\.json$/,'')}"
|
121
|
+
body.each do |part|
|
122
|
+
@logger.info("Importing #{rel_path} to #{api_path}.")
|
123
|
+
resp = post("#{@api_url}#{api_path}", part, headers)
|
124
|
+
end
|
125
|
+
else
|
126
|
+
api_path = "/#{rel_path.sub(/^space\//,'').sub(/\/[^\/]+$/,'')}"
|
127
|
+
# TODO: Remove this block when core API is updated to not export Key
|
128
|
+
if api_path == "/bridges" && body.has_key?("key")
|
129
|
+
body.delete("key")
|
130
|
+
end
|
131
|
+
@logger.info("Importing #{rel_path} to #{api_path}.")
|
132
|
+
resp = post("#{@api_url}#{api_path}", body, headers)
|
133
|
+
# TODO: Remove this block when core API is updated to not pre-create SPDs
|
134
|
+
if api_path == "/kapps"
|
135
|
+
kapp_slug = resp.content["kapp"]["slug"]
|
136
|
+
delete_security_policy_definitions(kapp_slug)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
@logger.info("Finished importing space definition to #{@options[:export_directory]}.")
|
141
|
+
end
|
142
|
+
|
143
|
+
# Checks if the space exists
|
144
|
+
#
|
145
|
+
# @param slug [String] slug of the space
|
146
|
+
# @param params [Hash] Query parameters that are added to the URL, such as +include+
|
147
|
+
# @param headers [Hash] hash of headers to send, default is basic authentication and accept JSON content type
|
148
|
+
# @return [KineticSdk::Utils::KineticHttpResponse] object, with +code+, +message+, +content_string+, and +content+ properties
|
149
|
+
def space_exists?(slug, params={}, headers=default_headers)
|
150
|
+
@logger.info("Checking if the \"#{slug}\" space exists")
|
151
|
+
response = get("#{@api_url}/spaces/#{slug}", params, headers)
|
152
|
+
response.status == 200
|
153
|
+
end
|
154
|
+
|
155
|
+
end
|
156
|
+
end
|