triglav_client 0.1.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +5 -0
  3. data/Gemfile.lock +79 -0
  4. data/LICENSE +201 -0
  5. data/README.md +136 -0
  6. data/Rakefile +1 -0
  7. data/docs/AggregatedResourceEachResponse.md +11 -0
  8. data/docs/AuthApi.md +150 -0
  9. data/docs/BulkinsertResponse.md +8 -0
  10. data/docs/Credential.md +10 -0
  11. data/docs/ErrorModel.md +9 -0
  12. data/docs/JobEachResponse.md +12 -0
  13. data/docs/JobMessageEachResponse.md +11 -0
  14. data/docs/JobMessagesApi.md +117 -0
  15. data/docs/JobRequest.md +12 -0
  16. data/docs/JobResponse.md +14 -0
  17. data/docs/JobsApi.md +217 -0
  18. data/docs/LastJobMessageIdResponse.md +8 -0
  19. data/docs/LastMessageIdResponse.md +8 -0
  20. data/docs/MessageEachResponse.md +16 -0
  21. data/docs/MessageFetchRequest.md +10 -0
  22. data/docs/MessageRequest.md +13 -0
  23. data/docs/MessageResponse.md +16 -0
  24. data/docs/MessagesApi.md +170 -0
  25. data/docs/ResourceEachResponse.md +13 -0
  26. data/docs/ResourceRequest.md +15 -0
  27. data/docs/ResourceResponse.md +17 -0
  28. data/docs/ResourcesApi.md +335 -0
  29. data/docs/TokenResponse.md +9 -0
  30. data/docs/UserEachResponse.md +11 -0
  31. data/docs/UserRequest.md +13 -0
  32. data/docs/UserResponse.md +15 -0
  33. data/docs/UsersApi.md +274 -0
  34. data/example/example.rb +40 -0
  35. data/git_push.sh +67 -0
  36. data/lib/triglav_client.rb +77 -0
  37. data/lib/triglav_client/api/auth_api.rb +196 -0
  38. data/lib/triglav_client/api/job_messages_api.rb +153 -0
  39. data/lib/triglav_client/api/jobs_api.rb +257 -0
  40. data/lib/triglav_client/api/messages_api.rb +208 -0
  41. data/lib/triglav_client/api/resources_api.rb +379 -0
  42. data/lib/triglav_client/api/users_api.rb +318 -0
  43. data/lib/triglav_client/api_client.rb +379 -0
  44. data/lib/triglav_client/api_error.rb +47 -0
  45. data/lib/triglav_client/configuration.rb +214 -0
  46. data/lib/triglav_client/models/aggregated_resource_each_response.rb +230 -0
  47. data/lib/triglav_client/models/bulkinsert_response.rb +200 -0
  48. data/lib/triglav_client/models/credential.rb +252 -0
  49. data/lib/triglav_client/models/error_model.rb +212 -0
  50. data/lib/triglav_client/models/job_each_response.rb +235 -0
  51. data/lib/triglav_client/models/job_message_each_response.rb +229 -0
  52. data/lib/triglav_client/models/job_request.rb +241 -0
  53. data/lib/triglav_client/models/job_response.rb +259 -0
  54. data/lib/triglav_client/models/last_job_message_id_response.rb +200 -0
  55. data/lib/triglav_client/models/last_message_id_response.rb +200 -0
  56. data/lib/triglav_client/models/message_each_response.rb +281 -0
  57. data/lib/triglav_client/models/message_fetch_request.rb +223 -0
  58. data/lib/triglav_client/models/message_request.rb +254 -0
  59. data/lib/triglav_client/models/message_response.rb +281 -0
  60. data/lib/triglav_client/models/resource_each_response.rb +250 -0
  61. data/lib/triglav_client/models/resource_request.rb +269 -0
  62. data/lib/triglav_client/models/resource_response.rb +287 -0
  63. data/lib/triglav_client/models/token_response.rb +208 -0
  64. data/lib/triglav_client/models/user_each_response.rb +262 -0
  65. data/lib/triglav_client/models/user_request.rb +280 -0
  66. data/lib/triglav_client/models/user_response.rb +300 -0
  67. data/lib/triglav_client/version.rb +26 -0
  68. data/spec/api/auth_api_spec.rb +80 -0
  69. data/spec/api/job_messages_api_spec.rb +71 -0
  70. data/spec/api/jobs_api_spec.rb +93 -0
  71. data/spec/api/messages_api_spec.rb +74 -0
  72. data/spec/api/resources_api_spec.rb +109 -0
  73. data/spec/api/users_api_spec.rb +106 -0
  74. data/spec/api_client_spec.rb +237 -0
  75. data/spec/configuration_spec.rb +53 -0
  76. data/spec/models/aggregated_resource_each_response_spec.rb +71 -0
  77. data/spec/models/bulkinsert_response_spec.rb +53 -0
  78. data/spec/models/credential_spec.rb +69 -0
  79. data/spec/models/error_model_spec.rb +59 -0
  80. data/spec/models/job_each_response_spec.rb +77 -0
  81. data/spec/models/job_message_each_response_spec.rb +65 -0
  82. data/spec/models/job_request_spec.rb +71 -0
  83. data/spec/models/job_response_spec.rb +89 -0
  84. data/spec/models/last_job_message_id_response_spec.rb +53 -0
  85. data/spec/models/last_message_id_response_spec.rb +53 -0
  86. data/spec/models/message_each_response_spec.rb +89 -0
  87. data/spec/models/message_fetch_request_spec.rb +65 -0
  88. data/spec/models/message_request_spec.rb +59 -0
  89. data/spec/models/message_response_spec.rb +89 -0
  90. data/spec/models/resource_each_response_spec.rb +71 -0
  91. data/spec/models/resource_request_spec.rb +83 -0
  92. data/spec/models/resource_response_spec.rb +101 -0
  93. data/spec/models/token_response_spec.rb +59 -0
  94. data/spec/models/user_each_response_spec.rb +75 -0
  95. data/spec/models/user_request_spec.rb +87 -0
  96. data/spec/models/user_response_spec.rb +99 -0
  97. data/spec/spec_helper.rb +122 -0
  98. data/triglav_client.gemspec +55 -0
  99. metadata +351 -0
@@ -0,0 +1,9 @@
1
+ # TriglavClient::TokenResponse
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **access_token** | **String** | | [optional]
7
+ **expires_at** | **DateTime** | | [optional]
8
+
9
+
@@ -0,0 +1,11 @@
1
+ # TriglavClient::UserEachResponse
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **id** | **Integer** | |
7
+ **name** | **String** | |
8
+ **authenticator** | **String** | local or ldap | [optional]
9
+ **email** | **String** | | [optional]
10
+
11
+
@@ -0,0 +1,13 @@
1
+ # TriglavClient::UserRequest
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **name** | **String** | | [optional]
7
+ **description** | **String** | | [optional]
8
+ **authenticator** | **String** | local or ldap | [optional]
9
+ **groups** | **Array<String>** | | [optional]
10
+ **email** | **String** | | [optional]
11
+ **password** | **String** | | [optional]
12
+
13
+
@@ -0,0 +1,15 @@
1
+ # TriglavClient::UserResponse
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **id** | **Integer** | |
7
+ **name** | **String** | |
8
+ **description** | **String** | | [optional]
9
+ **authenticator** | **String** | local or ldap | [optional]
10
+ **groups** | **Array<String>** | | [optional]
11
+ **email** | **String** | | [optional]
12
+ **created_at** | **DateTime** | | [optional]
13
+ **updated_at** | **DateTime** | | [optional]
14
+
15
+
data/docs/UsersApi.md ADDED
@@ -0,0 +1,274 @@
1
+ # TriglavClient::UsersApi
2
+
3
+ All URIs are relative to *http://localhost/api/v1*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**create_user**](UsersApi.md#create_user) | **POST** /users |
8
+ [**delete_user**](UsersApi.md#delete_user) | **DELETE** /users/{id} |
9
+ [**get_user**](UsersApi.md#get_user) | **GET** /users/{id} |
10
+ [**list_users**](UsersApi.md#list_users) | **GET** /users |
11
+ [**update_user**](UsersApi.md#update_user) | **PATCH** /users/{id} |
12
+
13
+
14
+ # **create_user**
15
+ > UserResponse create_user(user)
16
+
17
+
18
+
19
+ Creates a new user in the store
20
+
21
+ ### Example
22
+ ```ruby
23
+ # load the gem
24
+ require 'triglav_client'
25
+ # setup authorization
26
+ TriglavClient.configure do |config|
27
+ # Configure API key authorization: api_key
28
+ config.api_key['Authorization'] = 'YOUR API KEY'
29
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
30
+ #config.api_key_prefix['Authorization'] = 'Bearer'
31
+ end
32
+
33
+ api_instance = TriglavClient::UsersApi.new
34
+
35
+ user = TriglavClient::UserRequest.new # UserRequest | User to add to the store
36
+
37
+
38
+ begin
39
+ result = api_instance.create_user(user)
40
+ p result
41
+ rescue TriglavClient::ApiError => e
42
+ puts "Exception when calling UsersApi->create_user: #{e}"
43
+ end
44
+ ```
45
+
46
+ ### Parameters
47
+
48
+ Name | Type | Description | Notes
49
+ ------------- | ------------- | ------------- | -------------
50
+ **user** | [**UserRequest**](UserRequest.md)| User to add to the store |
51
+
52
+ ### Return type
53
+
54
+ [**UserResponse**](UserResponse.md)
55
+
56
+ ### Authorization
57
+
58
+ [api_key](../README.md#api_key)
59
+
60
+ ### HTTP request headers
61
+
62
+ - **Content-Type**: application/json
63
+ - **Accept**: application/json
64
+
65
+
66
+
67
+ # **delete_user**
68
+ > delete_user(id)
69
+
70
+
71
+
72
+ Deletes single user
73
+
74
+ ### Example
75
+ ```ruby
76
+ # load the gem
77
+ require 'triglav_client'
78
+ # setup authorization
79
+ TriglavClient.configure do |config|
80
+ # Configure API key authorization: api_key
81
+ config.api_key['Authorization'] = 'YOUR API KEY'
82
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
83
+ #config.api_key_prefix['Authorization'] = 'Bearer'
84
+ end
85
+
86
+ api_instance = TriglavClient::UsersApi.new
87
+
88
+ id = 789 # Integer | ID of user to fetch
89
+
90
+
91
+ begin
92
+ api_instance.delete_user(id)
93
+ rescue TriglavClient::ApiError => e
94
+ puts "Exception when calling UsersApi->delete_user: #{e}"
95
+ end
96
+ ```
97
+
98
+ ### Parameters
99
+
100
+ Name | Type | Description | Notes
101
+ ------------- | ------------- | ------------- | -------------
102
+ **id** | **Integer**| ID of user to fetch |
103
+
104
+ ### Return type
105
+
106
+ nil (empty response body)
107
+
108
+ ### Authorization
109
+
110
+ [api_key](../README.md#api_key)
111
+
112
+ ### HTTP request headers
113
+
114
+ - **Content-Type**: application/json
115
+ - **Accept**: application/json
116
+
117
+
118
+
119
+ # **get_user**
120
+ > UserResponse get_user(id)
121
+
122
+
123
+
124
+ Returns a single user
125
+
126
+ ### Example
127
+ ```ruby
128
+ # load the gem
129
+ require 'triglav_client'
130
+ # setup authorization
131
+ TriglavClient.configure do |config|
132
+ # Configure API key authorization: api_key
133
+ config.api_key['Authorization'] = 'YOUR API KEY'
134
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
135
+ #config.api_key_prefix['Authorization'] = 'Bearer'
136
+ end
137
+
138
+ api_instance = TriglavClient::UsersApi.new
139
+
140
+ id = 789 # Integer | ID of user to fetch
141
+
142
+
143
+ begin
144
+ result = api_instance.get_user(id)
145
+ p result
146
+ rescue TriglavClient::ApiError => e
147
+ puts "Exception when calling UsersApi->get_user: #{e}"
148
+ end
149
+ ```
150
+
151
+ ### Parameters
152
+
153
+ Name | Type | Description | Notes
154
+ ------------- | ------------- | ------------- | -------------
155
+ **id** | **Integer**| ID of user to fetch |
156
+
157
+ ### Return type
158
+
159
+ [**UserResponse**](UserResponse.md)
160
+
161
+ ### Authorization
162
+
163
+ [api_key](../README.md#api_key)
164
+
165
+ ### HTTP request headers
166
+
167
+ - **Content-Type**: application/json
168
+ - **Accept**: application/json
169
+
170
+
171
+
172
+ # **list_users**
173
+ > Array<UserEachResponse> list_users
174
+
175
+
176
+
177
+ Returns all users from the system that the user has access to
178
+
179
+ ### Example
180
+ ```ruby
181
+ # load the gem
182
+ require 'triglav_client'
183
+ # setup authorization
184
+ TriglavClient.configure do |config|
185
+ # Configure API key authorization: api_key
186
+ config.api_key['Authorization'] = 'YOUR API KEY'
187
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
188
+ #config.api_key_prefix['Authorization'] = 'Bearer'
189
+ end
190
+
191
+ api_instance = TriglavClient::UsersApi.new
192
+
193
+ begin
194
+ result = api_instance.list_users
195
+ p result
196
+ rescue TriglavClient::ApiError => e
197
+ puts "Exception when calling UsersApi->list_users: #{e}"
198
+ end
199
+ ```
200
+
201
+ ### Parameters
202
+ This endpoint does not need any parameter.
203
+
204
+ ### Return type
205
+
206
+ [**Array<UserEachResponse>**](UserEachResponse.md)
207
+
208
+ ### Authorization
209
+
210
+ [api_key](../README.md#api_key)
211
+
212
+ ### HTTP request headers
213
+
214
+ - **Content-Type**: application/json
215
+ - **Accept**: application/json
216
+
217
+
218
+
219
+ # **update_user**
220
+ > UserResponse update_user(id, user)
221
+
222
+
223
+
224
+ Updates a single user
225
+
226
+ ### Example
227
+ ```ruby
228
+ # load the gem
229
+ require 'triglav_client'
230
+ # setup authorization
231
+ TriglavClient.configure do |config|
232
+ # Configure API key authorization: api_key
233
+ config.api_key['Authorization'] = 'YOUR API KEY'
234
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
235
+ #config.api_key_prefix['Authorization'] = 'Bearer'
236
+ end
237
+
238
+ api_instance = TriglavClient::UsersApi.new
239
+
240
+ id = 789 # Integer | ID of user to fetch
241
+
242
+ user = TriglavClient::UserRequest.new # UserRequest | User parameters to update
243
+
244
+
245
+ begin
246
+ result = api_instance.update_user(id, user)
247
+ p result
248
+ rescue TriglavClient::ApiError => e
249
+ puts "Exception when calling UsersApi->update_user: #{e}"
250
+ end
251
+ ```
252
+
253
+ ### Parameters
254
+
255
+ Name | Type | Description | Notes
256
+ ------------- | ------------- | ------------- | -------------
257
+ **id** | **Integer**| ID of user to fetch |
258
+ **user** | [**UserRequest**](UserRequest.md)| User parameters to update |
259
+
260
+ ### Return type
261
+
262
+ [**UserResponse**](UserResponse.md)
263
+
264
+ ### Authorization
265
+
266
+ [api_key](../README.md#api_key)
267
+
268
+ ### HTTP request headers
269
+
270
+ - **Content-Type**: application/json
271
+ - **Accept**: application/json
272
+
273
+
274
+
@@ -0,0 +1,40 @@
1
+ require 'triglav_client'
2
+
3
+ config = TriglavClient::Configuration.new do |config|
4
+ uri = URI.parse('http://localhost:3000')
5
+ config.scheme = uri.scheme
6
+ config.host = "#{uri.host}:#{uri.port}"
7
+ end
8
+ api_client = TriglavClient::ApiClient.new(config)
9
+
10
+ begin
11
+ auth_api = TriglavClient::AuthApi.new(api_client)
12
+ credential = TriglavClient::Credential.new(name: 'triglav_test', password: 'triglav_test', authenticator: 'local')
13
+ result = auth_api.create_token(credential)
14
+ if result
15
+ access_token = result.access_token
16
+ api_client.config.api_key['Authorization'] = access_token
17
+ end
18
+ puts "me: #{auth_api.me}"
19
+ rescue TriglavClient::ApiError => e
20
+ if e.code == 0
21
+ puts "Could not connect"
22
+ else
23
+ puts "Exception when calling AuthApi->create_token: #{e}"
24
+ end
25
+ end
26
+
27
+ begin
28
+ resources_api = TriglavClient::ResourcesApi.new(api_client)
29
+ cluster_name = 'vertica'
30
+ consumable = true
31
+ notifiable = true
32
+ result = resources_api.list_resources(cluster_name, consumable, notifiable)
33
+ puts "list_resources(vertica): #{result}"
34
+ rescue TriglavClient::ApiError => e
35
+ if e.code == 0
36
+ puts "Could not connect"
37
+ else
38
+ puts "Exception when calling AuthApi->create_token: #{e}"
39
+ end
40
+ end
data/git_push.sh ADDED
@@ -0,0 +1,67 @@
1
+ #!/bin/sh
2
+ #
3
+ # Generated by: https://github.com/swagger-api/swagger-codegen.git
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
18
+ #
19
+ # Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
20
+
21
+ git_user_id=$1
22
+ git_repo_id=$2
23
+ release_note=$3
24
+
25
+ if [ "$git_user_id" = "" ]; then
26
+ git_user_id="GIT_USER_ID"
27
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
28
+ fi
29
+
30
+ if [ "$git_repo_id" = "" ]; then
31
+ git_repo_id="GIT_REPO_ID"
32
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
33
+ fi
34
+
35
+ if [ "$release_note" = "" ]; then
36
+ release_note="Minor update"
37
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
38
+ fi
39
+
40
+ # Initialize the local directory as a Git repository
41
+ git init
42
+
43
+ # Adds the files in the local repository and stages them for commit.
44
+ git add .
45
+
46
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
47
+ git commit -m "$release_note"
48
+
49
+ # Sets the new remote
50
+ git_remote=`git remote`
51
+ if [ "$git_remote" = "" ]; then # git remote not defined
52
+
53
+ if [ "$GIT_TOKEN" = "" ]; then
54
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
55
+ git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
56
+ else
57
+ git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
58
+ fi
59
+
60
+ fi
61
+
62
+ git pull origin master
63
+
64
+ # Pushes (Forces) the changes in the local repository up to the remote repository
65
+ echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
66
+ git push origin master 2>&1 | grep -v 'To https'
67
+
@@ -0,0 +1,77 @@
1
+ =begin
2
+ #Triglav API
3
+
4
+ #Triglav API
5
+
6
+ OpenAPI spec version: 1.0.0
7
+ Contact: triglav_admin_my@dena.jp
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ # Common files
25
+ require 'triglav_client/api_client'
26
+ require 'triglav_client/api_error'
27
+ require 'triglav_client/version'
28
+ require 'triglav_client/configuration'
29
+
30
+ # Models
31
+ require 'triglav_client/models/aggregated_resource_each_response'
32
+ require 'triglav_client/models/bulkinsert_response'
33
+ require 'triglav_client/models/credential'
34
+ require 'triglav_client/models/error_model'
35
+ require 'triglav_client/models/job_each_response'
36
+ require 'triglav_client/models/job_message_each_response'
37
+ require 'triglav_client/models/job_request'
38
+ require 'triglav_client/models/job_response'
39
+ require 'triglav_client/models/last_job_message_id_response'
40
+ require 'triglav_client/models/last_message_id_response'
41
+ require 'triglav_client/models/message_each_response'
42
+ require 'triglav_client/models/message_fetch_request'
43
+ require 'triglav_client/models/message_request'
44
+ require 'triglav_client/models/message_response'
45
+ require 'triglav_client/models/resource_each_response'
46
+ require 'triglav_client/models/resource_request'
47
+ require 'triglav_client/models/resource_response'
48
+ require 'triglav_client/models/token_response'
49
+ require 'triglav_client/models/user_each_response'
50
+ require 'triglav_client/models/user_request'
51
+ require 'triglav_client/models/user_response'
52
+
53
+ # APIs
54
+ require 'triglav_client/api/auth_api'
55
+ require 'triglav_client/api/job_messages_api'
56
+ require 'triglav_client/api/jobs_api'
57
+ require 'triglav_client/api/messages_api'
58
+ require 'triglav_client/api/resources_api'
59
+ require 'triglav_client/api/users_api'
60
+
61
+ module TriglavClient
62
+ class << self
63
+ # Customize default settings for the SDK using block.
64
+ # TriglavClient.configure do |config|
65
+ # config.username = "xxx"
66
+ # config.password = "xxx"
67
+ # end
68
+ # If no block given, return the default Configuration object.
69
+ def configure
70
+ if block_given?
71
+ yield(Configuration.default)
72
+ else
73
+ Configuration.default
74
+ end
75
+ end
76
+ end
77
+ end