nucleus 0.2.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/CHANGELOG.md +9 -0
  4. data/README.md +43 -72
  5. data/lib/nucleus/adapter_resolver.rb +3 -3
  6. data/lib/nucleus/adapters/base_adapter.rb +109 -109
  7. data/lib/nucleus/adapters/v1/cloud_foundry_v2/application.rb +111 -111
  8. data/lib/nucleus/adapters/v1/cloud_foundry_v2/cloud_foundry_v2.rb +141 -141
  9. data/lib/nucleus/adapters/v1/cloud_foundry_v2/data.rb +97 -97
  10. data/lib/nucleus/adapters/v1/cloud_foundry_v2/domains.rb +5 -5
  11. data/lib/nucleus/adapters/v1/cloud_foundry_v2/lifecycle.rb +41 -41
  12. data/lib/nucleus/adapters/v1/cloud_foundry_v2/logs.rb +6 -6
  13. data/lib/nucleus/adapters/v1/cloud_foundry_v2/regions.rb +33 -33
  14. data/lib/nucleus/adapters/v1/cloud_foundry_v2/services.rb +6 -6
  15. data/lib/nucleus/adapters/v1/cloud_foundry_v2/vars.rb +80 -80
  16. data/lib/nucleus/adapters/v1/heroku/app_states.rb +57 -57
  17. data/lib/nucleus/adapters/v1/heroku/data.rb +78 -78
  18. data/lib/nucleus/adapters/v1/heroku/heroku.rb +146 -146
  19. data/lib/nucleus/adapters/v1/heroku/lifecycle.rb +51 -51
  20. data/lib/nucleus/adapters/v1/heroku/logs.rb +2 -2
  21. data/lib/nucleus/adapters/v1/heroku/regions.rb +42 -42
  22. data/lib/nucleus/adapters/v1/heroku/services.rb +168 -168
  23. data/lib/nucleus/adapters/v1/heroku/vars.rb +65 -65
  24. data/lib/nucleus/adapters/v1/openshift_v2/app_states.rb +68 -68
  25. data/lib/nucleus/adapters/v1/openshift_v2/application.rb +1 -1
  26. data/lib/nucleus/adapters/v1/openshift_v2/data.rb +96 -96
  27. data/lib/nucleus/adapters/v1/openshift_v2/lifecycle.rb +60 -60
  28. data/lib/nucleus/adapters/v1/openshift_v2/logs.rb +106 -106
  29. data/lib/nucleus/adapters/v1/openshift_v2/openshift_v2.rb +125 -125
  30. data/lib/nucleus/adapters/v1/openshift_v2/regions.rb +58 -58
  31. data/lib/nucleus/adapters/v1/openshift_v2/services.rb +173 -173
  32. data/lib/nucleus/adapters/v1/openshift_v2/vars.rb +49 -49
  33. data/lib/nucleus/adapters/v1/stub_adapter.rb +464 -464
  34. data/lib/nucleus/core/adapter_extensions/auth/auth_client.rb +44 -44
  35. data/lib/nucleus/core/adapter_extensions/auth/expiring_token_auth_client.rb +53 -53
  36. data/lib/nucleus/core/adapter_extensions/auth/http_basic_auth_client.rb +3 -3
  37. data/lib/nucleus/core/adapter_extensions/auth/o_auth2_auth_client.rb +95 -95
  38. data/lib/nucleus/core/adapter_extensions/auth/token_auth_client.rb +36 -36
  39. data/lib/nucleus/core/adapter_extensions/http_client.rb +5 -5
  40. data/lib/nucleus/core/common/files/archive_extractor.rb +1 -1
  41. data/lib/nucleus/core/common/files/archiver.rb +2 -2
  42. data/lib/nucleus/core/file_handling/file_manager.rb +64 -64
  43. data/lib/nucleus/core/file_handling/git_deployer.rb +133 -133
  44. data/lib/nucleus/core/import/adapter_configuration.rb +53 -53
  45. data/lib/nucleus/scripts/initialize_config_defaults.rb +26 -26
  46. data/lib/nucleus/version.rb +1 -1
  47. data/nucleus.gemspec +2 -2
  48. data/spec/integration/api/auth_spec.rb +3 -3
  49. data/spec/spec_helper.rb +98 -98
  50. data/spec/test_suites.rake +1 -1
  51. data/spec/unit/adapters/git_deployer_spec.rb +262 -262
  52. data/spec/unit/common/helpers/auth_helper_spec.rb +1 -1
  53. data/tasks/evaluation.rake +1 -1
  54. data/wiki/adapter_tests.md +0 -7
  55. data/wiki/implement_new_adapter.md +1 -1
  56. metadata +4 -20
  57. data/config/adapters/cloud_control.yml +0 -32
  58. data/lib/nucleus/adapters/v1/cloud_control/application.rb +0 -108
  59. data/lib/nucleus/adapters/v1/cloud_control/authentication.rb +0 -27
  60. data/lib/nucleus/adapters/v1/cloud_control/buildpacks.rb +0 -23
  61. data/lib/nucleus/adapters/v1/cloud_control/cloud_control.rb +0 -153
  62. data/lib/nucleus/adapters/v1/cloud_control/data.rb +0 -76
  63. data/lib/nucleus/adapters/v1/cloud_control/domains.rb +0 -68
  64. data/lib/nucleus/adapters/v1/cloud_control/lifecycle.rb +0 -27
  65. data/lib/nucleus/adapters/v1/cloud_control/log_poller.rb +0 -71
  66. data/lib/nucleus/adapters/v1/cloud_control/logs.rb +0 -103
  67. data/lib/nucleus/adapters/v1/cloud_control/regions.rb +0 -32
  68. data/lib/nucleus/adapters/v1/cloud_control/scaling.rb +0 -17
  69. data/lib/nucleus/adapters/v1/cloud_control/semantic_errors.rb +0 -31
  70. data/lib/nucleus/adapters/v1/cloud_control/services.rb +0 -162
  71. data/lib/nucleus/adapters/v1/cloud_control/token.rb +0 -17
  72. data/lib/nucleus/adapters/v1/cloud_control/vars.rb +0 -88
@@ -1,49 +1,49 @@
1
- module Nucleus
2
- module Adapters
3
- module V1
4
- class OpenshiftV2 < Stub
5
- module Vars
6
- # @see Stub#env_vars
7
- def env_vars(application_id)
8
- all_vars = get("/application/#{app_id_by_name(application_id)}/environment-variables").body[:data]
9
- all_vars.collect { |var| to_nucleus_var(var) }
10
- end
11
-
12
- # @see Stub#env_var
13
- def env_var(application_id, env_var_key)
14
- response = get("/application/#{app_id_by_name(application_id)}/environment-variable/#{env_var_key}")
15
- to_nucleus_var(response.body[:data])
16
- end
17
-
18
- # @see Stub#create_env_var
19
- def create_env_var(application_id, env_var)
20
- to_nucleus_var(post("/application/#{app_id_by_name(application_id)}/environment-variables",
21
- body: { name: env_var[:key], value: env_var[:value] }).body[:data])
22
- end
23
-
24
- # @see Stub#update_env_var
25
- def update_env_var(application_id, env_var_key, env_var)
26
- to_nucleus_var(put("/application/#{app_id_by_name(application_id)}/environment-variable/#{env_var_key}",
27
- body: { value: env_var[:value] }).body[:data])
28
- end
29
-
30
- # @see Stub#delete_env_var
31
- def delete_env_var(application_id, env_var_key)
32
- id = app_id_by_name(application_id)
33
- # Openshift returns 204 even if the key did not exist
34
- if get("/application/#{id}/environment-variable/#{env_var_key}", expects: [200, 404]).status == 404
35
- fail Errors::AdapterResourceNotFoundError, "Env. var key '#{env_var_key}' does not exist"
36
- end
37
- delete("/application/#{id}/environment-variable/#{env_var_key}")
38
- end
39
-
40
- private
41
-
42
- def to_nucleus_var(var)
43
- { id: var[:name], key: var[:name], value: var[:value] }
44
- end
45
- end
46
- end
47
- end
48
- end
49
- end
1
+ module Nucleus
2
+ module Adapters
3
+ module V1
4
+ class OpenshiftV2 < Stub
5
+ module Vars
6
+ # @see Stub#env_vars
7
+ def env_vars(application_id)
8
+ all_vars = get("/application/#{app_id_by_name(application_id)}/environment-variables").body[:data]
9
+ all_vars.collect { |var| to_nucleus_var(var) }
10
+ end
11
+
12
+ # @see Stub#env_var
13
+ def env_var(application_id, env_var_key)
14
+ response = get("/application/#{app_id_by_name(application_id)}/environment-variable/#{env_var_key}")
15
+ to_nucleus_var(response.body[:data])
16
+ end
17
+
18
+ # @see Stub#create_env_var
19
+ def create_env_var(application_id, env_var)
20
+ to_nucleus_var(post("/application/#{app_id_by_name(application_id)}/environment-variables",
21
+ body: { name: env_var[:key], value: env_var[:value] }).body[:data])
22
+ end
23
+
24
+ # @see Stub#update_env_var
25
+ def update_env_var(application_id, env_var_key, env_var)
26
+ to_nucleus_var(put("/application/#{app_id_by_name(application_id)}/environment-variable/#{env_var_key}",
27
+ body: { value: env_var[:value] }).body[:data])
28
+ end
29
+
30
+ # @see Stub#delete_env_var
31
+ def delete_env_var(application_id, env_var_key)
32
+ id = app_id_by_name(application_id)
33
+ # Openshift returns 204 even if the key did not exist
34
+ if get("/application/#{id}/environment-variable/#{env_var_key}", expects: [200, 404]).status == 404
35
+ raise Errors::AdapterResourceNotFoundError, "Env. var key '#{env_var_key}' does not exist"
36
+ end
37
+ delete("/application/#{id}/environment-variable/#{env_var_key}")
38
+ end
39
+
40
+ private
41
+
42
+ def to_nucleus_var(var)
43
+ { id: var[:name], key: var[:name], value: var[:value] }
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -1,464 +1,464 @@
1
- module Nucleus
2
- module Adapters
3
- # Version 1, or the first release of the Nucleus API.<br>
4
- # It provides basic management functionality to handle:<br>
5
- # * applications
6
- # * domains
7
- # * environment variables
8
- # * logging
9
- # * deployment
10
- # * scaling (horizontal and vertical)
11
- module V1
12
- # Stub adapter for Nucleus API version 1.<br>
13
- # The stub provides all methods that an actual adapter should implement.<br>
14
- # It also contains the documentation that describes the expected method behaviour,
15
- # which must be matched by the adapters.<br>
16
- # <br>
17
- # Adapter methods shall raise:<br>
18
- # {Errors::EndpointAuthenticationError} == 401 if a endpoint call failed due to bad credentials<br>
19
- # {Errors::AdapterResourceNotFoundError} == 404 if a resource could not be found<br>
20
- # {Errors::SemanticAdapterRequestError} == 422 if the request could not be processed due to
21
- # common semantic errors<br>
22
- # {Errors::PlatformSpecificSemanticError} == 422 if the request could not be processed due to
23
- # semantic errors that are specific to the endpoint / platform, for instance quota restrictions.<br>
24
- # {Errors::UnknownAdapterCallError} == 500 if the endpoint API shows unexpected behavior,
25
- # not matching the implementation<br>
26
- # {Errors::AdapterMissingImplementationError} == 501 if a feature is not (yet) implemented by the adapter<br>
27
- #
28
- # If embedded in the Grape Restful API, authentication errors and bad requests are handled by Grape.<br>
29
- # If an adapter is used within the +gem+, the developer must take care of authentication handling and
30
- # missing form data.
31
- #
32
- # @abstract
33
- class Stub < BaseAdapter
34
- # Error message saying that the adapter feature has not been implemented yet.
35
- NOT_IMPLEMENTED_ERROR = Errors::AdapterMissingImplementationError.new(
36
- 'Adapter is missing an implementation to support this feature')
37
-
38
- # Build an Authentication client that can handle the authentication to the endpoint
39
- # given the username and a matching password.
40
- # @return [Nucleus::Adapters::AuthClient] authentication client
41
- def auth_client
42
- fail NOT_IMPLEMENTED_ERROR
43
- end
44
-
45
- # Return a list of all {Nucleus::API::Models::Region class} compatible objects
46
- # that are available on the current endpoint.<br>
47
- # If the platform does not offer multi-region support, one 'default' region shall be returned.
48
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
49
- # @return [Hash, Nucleus::API::Models::Regions] region entity compatible Hash of available regions
50
- def regions
51
- fail NOT_IMPLEMENTED_ERROR
52
- end
53
-
54
- # Return the {Nucleus::API::Models::Region class} compatible information
55
- # regarding the region with the given region_id.
56
- #
57
- # @param [String] region_id Id of the region object to retrieve
58
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no region matching the region_id could be found
59
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
60
- # @return [Hash, Nucleus::API::Models::Region] region entity compatible Hash with the id region_id
61
- def region(region_id)
62
- fail NOT_IMPLEMENTED_ERROR
63
- end
64
-
65
- # Get a list of all applications that are accessible to the authenticated user account.
66
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
67
- # @return [Hash, Nucleus::API::Models::Applications] application entity list compatible hash
68
- def applications
69
- fail NOT_IMPLEMENTED_ERROR
70
- end
71
-
72
- # Retrieve the application entity of the application with the given application_id.
73
- # @param [String] application_id Id of the application object to retrieve
74
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id could be found
75
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
76
- # @return [Hash, Nucleus::API::Models::Application] application entity compatible Hash with the application_id
77
- def application(application_id)
78
- fail NOT_IMPLEMENTED_ERROR
79
- end
80
-
81
- # Create a new application on the endpoint using the given application entity.
82
- # @param [Hash, Nucleus::API::Models::Application] application entity compatible Hash.
83
- # @option application [String] :name The name of the application
84
- # @option application [Array<String>] :runtimes Runtimes (buildpacks) to use with the application
85
- # @option application [String] :region Region where the application shall be deployed,
86
- # call {#regions} for a list of allowed values
87
- # @option application [Boolean] :autoscaled True if the application shall scale automatically,
88
- # false if manual scaling shall be used. WARNING: This option is currently not supported by most vendors!
89
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
90
- # @return [Hash, Nucleus::API::Models::Application] application entity compatible Hash
91
- # of the created application
92
- def create_application(application)
93
- fail NOT_IMPLEMENTED_ERROR
94
- end
95
-
96
- # Update an application on the endpoint using the given application entity.
97
- # @param [Hash, Nucleus::API::Models::Application] application application entity compatible Hash.
98
- # @option application [String] :name The updated name of the application
99
- # @option application [Array<String>] :runtimes Runtimes (buildpacks) to use with the application
100
- # @param [String] application_id Id of the application object that shall be updated
101
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id could be found
102
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
103
- # @return [Hash, Nucleus::API::Models::Application] application entity compatible Hash with the application_id
104
- def update_application(application_id, application)
105
- fail NOT_IMPLEMENTED_ERROR
106
- end
107
-
108
- # Delete the application with the given application_id on the endpoint.
109
- # @param [String] application_id Id of the application object that shall be deleted
110
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id could be found
111
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
112
- # @return [void]
113
- def delete_application(application_id)
114
- fail NOT_IMPLEMENTED_ERROR
115
- end
116
-
117
- # Get a list of all domains that are assigned to the application.
118
- # @param [String] application_id Id of the application for which the domains are to be retrieved
119
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id could be found
120
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
121
- # @return [Hash, Nucleus::API::Models::Domains] domain entity list compatible hash
122
- def domains(application_id)
123
- fail NOT_IMPLEMENTED_ERROR
124
- end
125
-
126
- # Retrieve the domain entity of the application with the given application_id and the domain with the domain_id.
127
- # @param [String] application_id Id of the application for which the domain is to be retrieved
128
- # @param [String] domain_id Id of the domain object to retrieve
129
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id,
130
- # or no domain matching the domain_id could be found
131
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
132
- # @return [Hash, Nucleus::API::Models::Domain] domain entity compatible hash of the domain with the domain_id
133
- def domain(application_id, domain_id)
134
- fail NOT_IMPLEMENTED_ERROR
135
- end
136
-
137
- # Create a new domain using the given domain entity and assign it to the application.
138
- # @param [String] application_id Id of the application for which the domain is to be created
139
- # @param [Hash, Nucleus::API::Models::Domain] domain domain entity compatible Hash.
140
- # @option application [String] :name The domain name, e.g. +myapplication.example.org+
141
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id,
142
- # or no domain matching the domain_id could be found
143
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
144
- # @return [Hash, Nucleus::API::Models::Domain] domain entity compatible hash of the created domain
145
- def create_domain(application_id, domain)
146
- fail NOT_IMPLEMENTED_ERROR
147
- end
148
-
149
- # Delete the domain of the application with the domain_id.
150
- # @param [String] application_id Id of the application for which the domain is to be deleted
151
- # @param [String] domain_id Id of the domain object to delete
152
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id,
153
- # or no domain matching the domain_id could be found
154
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
155
- # @return [void]
156
- def delete_domain(application_id, domain_id)
157
- fail NOT_IMPLEMENTED_ERROR
158
- end
159
-
160
- # Get a list of all environment variables that are assigned to the application.
161
- # @param [String] application_id Id of the application for which the env_vars are to be retrieved
162
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id could be found
163
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
164
- # @return [Hash, Nucleus::API::Models::EnvironmentVariables] environment variable entity list compatible hash
165
- def env_vars(application_id)
166
- fail NOT_IMPLEMENTED_ERROR
167
- end
168
-
169
- # Retrieve the environment variable entity of the application with the given application_id and the env. var
170
- # with the env_var_id.
171
- # @param [String] application_id Id of the application for which the env_var is to be retrieved
172
- # @param [String] env_var_id Id of the env_var object to retrieve
173
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id,
174
- # or no environment variable matching the env_var_id could be found
175
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
176
- # @return [Hash, Nucleus::API::Models::EnvironmentVariable] environment variable entity compatible hash
177
- # of the env. var with the env_var_id
178
- def env_var(application_id, env_var_id)
179
- fail NOT_IMPLEMENTED_ERROR
180
- end
181
-
182
- # Create a new environment variable using the given env. var entity and assign it to the application.
183
- # @param [String] application_id Id of the application for which the env_var is to be created
184
- # @param [Hash, Nucleus::API::Models::EnvironmentVariable] env_var env. var entity compatible Hash.
185
- # @option env_var [String] :key Key of the environment variable, e.g. +IP+
186
- # @option env_var [String] :value Value of the environment variable, e.g. +0.0.0.0+
187
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id could be found
188
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
189
- # @return [Hash, Nucleus::API::Models::EnvironmentVariable] environment variable entity compatible hash
190
- # of the created env. var
191
- def create_env_var(application_id, env_var)
192
- fail NOT_IMPLEMENTED_ERROR
193
- end
194
-
195
- # Update the environment variable of the application, using the given env. var entity.
196
- # @param [String] application_id Id of the application for which the env_var is to be updated
197
- # @param [String] env_var_id Id of the env_var object to update
198
- # @param [Hash, Nucleus::API::Models::EnvironmentVariable] env_var env. var entity compatible Hash.
199
- # @option env_var [String] :value Value of the environment variable, e.g. +0.0.0.0+
200
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id,
201
- # or no environment variable matching the env_var_id could be found
202
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
203
- # @return [Hash, Nucleus::API::Models::EnvironmentVariable] environment variable entity compatible hash
204
- # of the updated env. var
205
- def update_env_var(application_id, env_var_id, env_var)
206
- fail NOT_IMPLEMENTED_ERROR
207
- end
208
-
209
- # Delete the environment variable of the application with the env_var_id.
210
- # @param [String] application_id Id of the application for which the env_var is to be deleted
211
- # @param [String] env_var_id Id of the env_var object to delete
212
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id,
213
- # or no environment variable matching the env_var_id could be found
214
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
215
- # @return [void]
216
- def delete_env_var(application_id, env_var_id)
217
- fail NOT_IMPLEMENTED_ERROR
218
- end
219
-
220
- # Start all instances of the application with the application_id.
221
- # The state of all application instances should become +running+ when all actions are finished
222
- # (unless there are technical errors preventing the application to start).
223
- # Preconditions:<br>
224
- # * application must have been deployed
225
- # Postconditions (delayed):<br>
226
- # * state == running
227
- # @param [String] application_id Id of the application which is to be started
228
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
229
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
230
- # @raise [Nucleus::Errors::SemanticAdapterRequestError] if the application is not deployed
231
- # @return [Hash, Nucleus::API::Models::Application] application entity compatible Hash
232
- def start(application_id)
233
- fail NOT_IMPLEMENTED_ERROR
234
- end
235
-
236
- # Stop all instances of the application with the application_id.
237
- # The state of all application instances will become +stopped+ when all actions are finished.
238
- # Preconditions:<br>
239
- # * application must have been deployed
240
- # Postconditions (delayed):<br>
241
- # * state == stopped
242
- # @param [String] application_id Id of the application which is to be stopped
243
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
244
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
245
- # @raise [Nucleus::Errors::SemanticAdapterRequestError] if the application is not deployed
246
- # @return [Hash, Nucleus::API::Models::Application] application entity compatible Hash
247
- def stop(application_id)
248
- fail NOT_IMPLEMENTED_ERROR
249
- end
250
-
251
- # Restart all instances of the application with the application_id.
252
- # The state of all application instances should become +running+ when all actions are finished
253
- # (unless there are technical errors preventing the application to start).
254
- # Preconditions:<br>
255
- # * application must have been deployed
256
- # Postconditions (delayed):<br>
257
- # * state == running
258
- # @param [String] application_id Id of the application which is to be restarted
259
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
260
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
261
- # @raise [Nucleus::Errors::SemanticAdapterRequestError] if the application is not deployed
262
- # @return [Hash, Nucleus::API::Models::Application] application entity compatible Hash
263
- def restart(application_id)
264
- fail NOT_IMPLEMENTED_ERROR
265
- end
266
-
267
- # Deploy the data of the application given the compressed application archive.<br>
268
- # The application shall not be running when the deployment is finished.
269
- # Postconditions (delayed):<br>
270
- # * state == deployed
271
- # @param [String] application_id Id of the application for which the data is to be deployed
272
- # @param [Tempfile] application_archive compressed application archive that shall be deployed
273
- # @param [Symbol] compression_format archive formats, see {Nucleus::API::Enums::CompressionFormats.all}
274
- # for a list of all allowed values
275
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
276
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
277
- # @raise [Nucleus::Errors::AdapterRequestError] if the application archive that shall be deployed is no
278
- # valid application archive, or if the application_archive / compression_format are not supported
279
- # @return [void]
280
- def deploy(application_id, application_archive, compression_format)
281
- fail NOT_IMPLEMENTED_ERROR
282
- end
283
-
284
- # Rebuild the recently deployed bits of the application.<br>
285
- # The rebuild can be used to update the application to use a new version of the underlying runtime or fix a
286
- # previously failed application start after the issues have been resolved.
287
- # @param [String] application_id Id of the application which is to be rebuild
288
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
289
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
290
- # @return [Hash, Nucleus::API::Models::Application] application entity compatible Hash
291
- def rebuild(application_id)
292
- fail NOT_IMPLEMENTED_ERROR
293
- end
294
-
295
- # Download the application data that is currently deployed on the platform.
296
- # The downloaded application archive must contain at least all files that were originally deployed,
297
- # but can also contain additional files, for instance log files.
298
- # @param [String] application_id Id of the application of which the data is to be downloaded
299
- # @param [Symbol] compression_format archive formats, see {Nucleus::API::Enums::CompressionFormats.all}
300
- # for a list of all allowed values
301
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
302
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
303
- # @raise [Nucleus::Errors::AdapterRequestError] if the application archive that shall be deployed is no
304
- # valid application archive, or if the compression_format is not supported
305
- # @return [StringIO] binary application data
306
- def download(application_id, compression_format)
307
- fail NOT_IMPLEMENTED_ERROR
308
- end
309
-
310
- # TODO: Finish documentation when vertical scaling is added
311
- # Scale the application and adjust the number of instances that shall be running.
312
- # @param [String] application_id Id of the application which is to be scaled
313
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
314
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
315
- # @raise [Nucleus::Errors::SemanticAdapterRequestError] if the number of instances is disallowed on the platform
316
- # @return [Hash, Nucleus::API::Models::Application] application entity compatible Hash
317
- def scale(application_id, instances)
318
- fail NOT_IMPLEMENTED_ERROR
319
- end
320
-
321
- # Assert whether the given log_id is valid for the application_id.
322
- # @param [String] application_id Id of the application of which the log existence is to be checked
323
- # @param [String] log_id Id of the log whose existence is to be checked
324
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
325
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
326
- # @return [Boolean] returns true if there is a log for the application with the log_id,
327
- # false if it does not exist
328
- def log?(application_id, log_id)
329
- fail NOT_IMPLEMENTED_ERROR
330
- end
331
-
332
- # Get a list of all logs that are available for the application.
333
- # @param [String] application_id Id of the application of which the logs are to be listed
334
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
335
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
336
- # @return [Hash, Nucleus::API::Models::Logs] log entity list compatible hash
337
- def logs(application_id)
338
- fail NOT_IMPLEMENTED_ERROR
339
- end
340
-
341
- # Retrieve all log entries of the log.
342
- # @param [String] application_id Id of the application of which the log_entries are to be retrieved
343
- # @param [String] log_id Id of the log for which the entries are to be retrieved
344
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application or log could not be found
345
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
346
- # @return [Array<String>] array of log entries, starting with the earliest entry at pos [0]
347
- def log_entries(application_id, log_id)
348
- fail NOT_IMPLEMENTED_ERROR
349
- end
350
-
351
- # Tail the logfile of the application and send each retrieved chunk, which can be a line of a file,
352
- # a new chunk in a received http message, or a websocket message, to the stream. The deferred tailing
353
- # process shall be stoppable when the +stop+ method of the returned {Nucleus::Adapters::TailStopper TailStopper}
354
- # is called.
355
- # @param [String] application_id Id of the application of which the log is to be tailed
356
- # @param [String] log_id Id of the log that is to be tailed
357
- # @param [Nucleus::StreamCallback] stream stream callback to which messages can be sent via
358
- # the +send_message+ method
359
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application or log could not be found
360
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
361
- # @return [Nucleus::Adapters::TailStopper] callback object to stop the ongoing tail process
362
- def tail(application_id, log_id, stream)
363
- fail NOT_IMPLEMENTED_ERROR
364
- end
365
-
366
- # List all services that are available at the endpoint.
367
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
368
- # @return [Hash, Nucleus::API::Models::Services] services list compatible hash
369
- def services
370
- fail NOT_IMPLEMENTED_ERROR
371
- end
372
-
373
- # Retrieve the service entity matching the given service_id.
374
- # @param [String] service_id Id of the service that is to be retrieved
375
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the service could not be found
376
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
377
- # @return [Hash, Nucleus::API::Models::Service] service entity compatible hash
378
- def service(service_id)
379
- fail NOT_IMPLEMENTED_ERROR
380
- end
381
-
382
- # List all plans that can be chosen for the service with the service_id, ascending order on the price.
383
- # @param [String] service_id Id of the service the plans belong to
384
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the service could not be found
385
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
386
- # @return [Hash, Nucleus::API::Models::ServicePlans] service plan list compatible hash
387
- def service_plans(service_id)
388
- fail NOT_IMPLEMENTED_ERROR
389
- end
390
-
391
- # Show the plan with the plan_id that is applicable to the service with the service_id.
392
- # @param [String] service_id Id of the service the plans belongs to
393
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the service or the plan could not be found
394
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
395
- # @return [Hash, Nucleus::API::Models::ServicePlan] service plan entity compatible hash
396
- def service_plan(service_id, plan_id)
397
- fail NOT_IMPLEMENTED_ERROR
398
- end
399
-
400
- # List all services that are installed on the application with the given application_id.
401
- # @param [String] application_id Id of the application of which the services are to be listed of
402
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
403
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
404
- # @return [Hash, Nucleus::API::Models::InstalledServices] installed services list compatible hash
405
- def installed_services(application_id)
406
- fail NOT_IMPLEMENTED_ERROR
407
- end
408
-
409
- # Retrieve the installed service entity matching the given service_id that is installed
410
- # on the application with the given application_id.
411
- # @param [String] service_id Id of the installed service that is to be retrieved
412
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application or service could not be found
413
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
414
- # @return [Hash, Nucleus::API::Models::InstalledService] installed service entity compatible hash
415
- def installed_service(application_id, service_id)
416
- fail NOT_IMPLEMENTED_ERROR
417
- end
418
-
419
- # Add the service with the service_id to the application with the application_id.
420
- # @param [String] application_id Id of the application of which the service is to be added to
421
- # @param [Hash, Nucleus::API::Models::Service] service_entity service entity compatible Hash.
422
- # @option env_var [String] :id ID of the service to add to the application
423
- # @param [Hash, Nucleus::API::Models::ServicePlan] plan_entity service plan entity compatible Hash.
424
- # @option env_var [String] :id ID of the service plan that shall be applied
425
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
426
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
427
- # @raise [Nucleus::Errors::SemanticAdapterRequestError] if the service to add or the plan to use
428
- # could not be found
429
- # @return [Hash, Nucleus::API::Models::InstalledService] installed service entity compatible hash
430
- def add_service(application_id, service_entity, plan_entity)
431
- fail NOT_IMPLEMENTED_ERROR
432
- end
433
-
434
- # Change the service, e.g. the active plan, of the service with the service_id for
435
- # the application with the application_id. Use the fields of the service_entity to execute the update.
436
- # @param [String] application_id Id of the application of which the service is to be changed
437
- # @param [String] service_id Id of the installed service that is to be updated. The id must not (but can) be
438
- # identical to the id of the service the installed service is based on.
439
- # @param [Hash, Nucleus::API::Models::ServicePlan] plan_entity service plan entity compatible Hash.
440
- # @option env_var [String] :id ID of the service plan that shall be applied
441
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found or
442
- # the service was not installed on this application
443
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
444
- # @raise [Nucleus::Errors::SemanticAdapterRequestError] if the plan to use could not be found
445
- # @return [Hash, Nucleus::API::Models::InstalledService] installed service entity compatible hash
446
- def change_service(application_id, service_id, plan_entity)
447
- fail NOT_IMPLEMENTED_ERROR
448
- end
449
-
450
- # Remove the installed service with the service_id from the application with the application_id.
451
- # @param [String] application_id Id of the application of which the service is to be removed from
452
- # @param [String] service_id Id of the installed service that is to be removed from the application. The id
453
- # must not (but can) be identical to the id of the service the installed service is based on.
454
- # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found or
455
- # the service was not installed on this application
456
- # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
457
- # @return [void]
458
- def remove_service(application_id, service_id)
459
- fail NOT_IMPLEMENTED_ERROR
460
- end
461
- end
462
- end
463
- end
464
- end
1
+ module Nucleus
2
+ module Adapters
3
+ # Version 1, or the first release of the Nucleus API.<br>
4
+ # It provides basic management functionality to handle:<br>
5
+ # * applications
6
+ # * domains
7
+ # * environment variables
8
+ # * logging
9
+ # * deployment
10
+ # * scaling (horizontal and vertical)
11
+ module V1
12
+ # Stub adapter for Nucleus API version 1.<br>
13
+ # The stub provides all methods that an actual adapter should implement.<br>
14
+ # It also contains the documentation that describes the expected method behaviour,
15
+ # which must be matched by the adapters.<br>
16
+ # <br>
17
+ # Adapter methods shall raise:<br>
18
+ # {Errors::EndpointAuthenticationError} == 401 if a endpoint call failed due to bad credentials<br>
19
+ # {Errors::AdapterResourceNotFoundError} == 404 if a resource could not be found<br>
20
+ # {Errors::SemanticAdapterRequestError} == 422 if the request could not be processed due to
21
+ # common semantic errors<br>
22
+ # {Errors::PlatformSpecificSemanticError} == 422 if the request could not be processed due to
23
+ # semantic errors that are specific to the endpoint / platform, for instance quota restrictions.<br>
24
+ # {Errors::UnknownAdapterCallError} == 500 if the endpoint API shows unexpected behavior,
25
+ # not matching the implementation<br>
26
+ # {Errors::AdapterMissingImplementationError} == 501 if a feature is not (yet) implemented by the adapter<br>
27
+ #
28
+ # If embedded in the Grape Restful API, authentication errors and bad requests are handled by Grape.<br>
29
+ # If an adapter is used within the +gem+, the developer must take care of authentication handling and
30
+ # missing form data.
31
+ #
32
+ # @abstract
33
+ class Stub < BaseAdapter
34
+ # Error message saying that the adapter feature has not been implemented yet.
35
+ NOT_IMPLEMENTED_ERROR = Errors::AdapterMissingImplementationError.new(
36
+ 'Adapter is missing an implementation to support this feature')
37
+
38
+ # Build an Authentication client that can handle the authentication to the endpoint
39
+ # given the username and a matching password.
40
+ # @return [Nucleus::Adapters::AuthClient] authentication client
41
+ def auth_client
42
+ raise NOT_IMPLEMENTED_ERROR
43
+ end
44
+
45
+ # Return a list of all {Nucleus::API::Models::Region class} compatible objects
46
+ # that are available on the current endpoint.<br>
47
+ # If the platform does not offer multi-region support, one 'default' region shall be returned.
48
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
49
+ # @return [Hash, Nucleus::API::Models::Regions] region entity compatible Hash of available regions
50
+ def regions
51
+ raise NOT_IMPLEMENTED_ERROR
52
+ end
53
+
54
+ # Return the {Nucleus::API::Models::Region class} compatible information
55
+ # regarding the region with the given region_id.
56
+ #
57
+ # @param [String] region_id Id of the region object to retrieve
58
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no region matching the region_id could be found
59
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
60
+ # @return [Hash, Nucleus::API::Models::Region] region entity compatible Hash with the id region_id
61
+ def region(region_id)
62
+ raise NOT_IMPLEMENTED_ERROR
63
+ end
64
+
65
+ # Get a list of all applications that are accessible to the authenticated user account.
66
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
67
+ # @return [Hash, Nucleus::API::Models::Applications] application entity list compatible hash
68
+ def applications
69
+ raise NOT_IMPLEMENTED_ERROR
70
+ end
71
+
72
+ # Retrieve the application entity of the application with the given application_id.
73
+ # @param [String] application_id Id of the application object to retrieve
74
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id could be found
75
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
76
+ # @return [Hash, Nucleus::API::Models::Application] application entity compatible Hash with the application_id
77
+ def application(application_id)
78
+ raise NOT_IMPLEMENTED_ERROR
79
+ end
80
+
81
+ # Create a new application on the endpoint using the given application entity.
82
+ # @param [Hash, Nucleus::API::Models::Application] application entity compatible Hash.
83
+ # @option application [String] :name The name of the application
84
+ # @option application [Array<String>] :runtimes Runtimes (buildpacks) to use with the application
85
+ # @option application [String] :region Region where the application shall be deployed,
86
+ # call {#regions} for a list of allowed values
87
+ # @option application [Boolean] :autoscaled True if the application shall scale automatically,
88
+ # false if manual scaling shall be used. WARNING: This option is currently not supported by most vendors!
89
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
90
+ # @return [Hash, Nucleus::API::Models::Application] application entity compatible Hash
91
+ # of the created application
92
+ def create_application(application)
93
+ raise NOT_IMPLEMENTED_ERROR
94
+ end
95
+
96
+ # Update an application on the endpoint using the given application entity.
97
+ # @param [Hash, Nucleus::API::Models::Application] application application entity compatible Hash.
98
+ # @option application [String] :name The updated name of the application
99
+ # @option application [Array<String>] :runtimes Runtimes (buildpacks) to use with the application
100
+ # @param [String] application_id Id of the application object that shall be updated
101
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id could be found
102
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
103
+ # @return [Hash, Nucleus::API::Models::Application] application entity compatible Hash with the application_id
104
+ def update_application(application_id, application)
105
+ raise NOT_IMPLEMENTED_ERROR
106
+ end
107
+
108
+ # Delete the application with the given application_id on the endpoint.
109
+ # @param [String] application_id Id of the application object that shall be deleted
110
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id could be found
111
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
112
+ # @return [void]
113
+ def delete_application(application_id)
114
+ raise NOT_IMPLEMENTED_ERROR
115
+ end
116
+
117
+ # Get a list of all domains that are assigned to the application.
118
+ # @param [String] application_id Id of the application for which the domains are to be retrieved
119
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id could be found
120
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
121
+ # @return [Hash, Nucleus::API::Models::Domains] domain entity list compatible hash
122
+ def domains(application_id)
123
+ raise NOT_IMPLEMENTED_ERROR
124
+ end
125
+
126
+ # Retrieve the domain entity of the application with the given application_id and the domain with the domain_id.
127
+ # @param [String] application_id Id of the application for which the domain is to be retrieved
128
+ # @param [String] domain_id Id of the domain object to retrieve
129
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id,
130
+ # or no domain matching the domain_id could be found
131
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
132
+ # @return [Hash, Nucleus::API::Models::Domain] domain entity compatible hash of the domain with the domain_id
133
+ def domain(application_id, domain_id)
134
+ raise NOT_IMPLEMENTED_ERROR
135
+ end
136
+
137
+ # Create a new domain using the given domain entity and assign it to the application.
138
+ # @param [String] application_id Id of the application for which the domain is to be created
139
+ # @param [Hash, Nucleus::API::Models::Domain] domain domain entity compatible Hash.
140
+ # @option application [String] :name The domain name, e.g. +myapplication.example.org+
141
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id,
142
+ # or no domain matching the domain_id could be found
143
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
144
+ # @return [Hash, Nucleus::API::Models::Domain] domain entity compatible hash of the created domain
145
+ def create_domain(application_id, domain)
146
+ raise NOT_IMPLEMENTED_ERROR
147
+ end
148
+
149
+ # Delete the domain of the application with the domain_id.
150
+ # @param [String] application_id Id of the application for which the domain is to be deleted
151
+ # @param [String] domain_id Id of the domain object to delete
152
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id,
153
+ # or no domain matching the domain_id could be found
154
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
155
+ # @return [void]
156
+ def delete_domain(application_id, domain_id)
157
+ raise NOT_IMPLEMENTED_ERROR
158
+ end
159
+
160
+ # Get a list of all environment variables that are assigned to the application.
161
+ # @param [String] application_id Id of the application for which the env_vars are to be retrieved
162
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id could be found
163
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
164
+ # @return [Hash, Nucleus::API::Models::EnvironmentVariables] environment variable entity list compatible hash
165
+ def env_vars(application_id)
166
+ raise NOT_IMPLEMENTED_ERROR
167
+ end
168
+
169
+ # Retrieve the environment variable entity of the application with the given application_id and the env. var
170
+ # with the env_var_id.
171
+ # @param [String] application_id Id of the application for which the env_var is to be retrieved
172
+ # @param [String] env_var_id Id of the env_var object to retrieve
173
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id,
174
+ # or no environment variable matching the env_var_id could be found
175
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
176
+ # @return [Hash, Nucleus::API::Models::EnvironmentVariable] environment variable entity compatible hash
177
+ # of the env. var with the env_var_id
178
+ def env_var(application_id, env_var_id)
179
+ raise NOT_IMPLEMENTED_ERROR
180
+ end
181
+
182
+ # Create a new environment variable using the given env. var entity and assign it to the application.
183
+ # @param [String] application_id Id of the application for which the env_var is to be created
184
+ # @param [Hash, Nucleus::API::Models::EnvironmentVariable] env_var env. var entity compatible Hash.
185
+ # @option env_var [String] :key Key of the environment variable, e.g. +IP+
186
+ # @option env_var [String] :value Value of the environment variable, e.g. +0.0.0.0+
187
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id could be found
188
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
189
+ # @return [Hash, Nucleus::API::Models::EnvironmentVariable] environment variable entity compatible hash
190
+ # of the created env. var
191
+ def create_env_var(application_id, env_var)
192
+ raise NOT_IMPLEMENTED_ERROR
193
+ end
194
+
195
+ # Update the environment variable of the application, using the given env. var entity.
196
+ # @param [String] application_id Id of the application for which the env_var is to be updated
197
+ # @param [String] env_var_id Id of the env_var object to update
198
+ # @param [Hash, Nucleus::API::Models::EnvironmentVariable] env_var env. var entity compatible Hash.
199
+ # @option env_var [String] :value Value of the environment variable, e.g. +0.0.0.0+
200
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id,
201
+ # or no environment variable matching the env_var_id could be found
202
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
203
+ # @return [Hash, Nucleus::API::Models::EnvironmentVariable] environment variable entity compatible hash
204
+ # of the updated env. var
205
+ def update_env_var(application_id, env_var_id, env_var)
206
+ raise NOT_IMPLEMENTED_ERROR
207
+ end
208
+
209
+ # Delete the environment variable of the application with the env_var_id.
210
+ # @param [String] application_id Id of the application for which the env_var is to be deleted
211
+ # @param [String] env_var_id Id of the env_var object to delete
212
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if no app matching the application_id,
213
+ # or no environment variable matching the env_var_id could be found
214
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
215
+ # @return [void]
216
+ def delete_env_var(application_id, env_var_id)
217
+ raise NOT_IMPLEMENTED_ERROR
218
+ end
219
+
220
+ # Start all instances of the application with the application_id.
221
+ # The state of all application instances should become +running+ when all actions are finished
222
+ # (unless there are technical errors preventing the application to start).
223
+ # Preconditions:<br>
224
+ # * application must have been deployed
225
+ # Postconditions (delayed):<br>
226
+ # * state == running
227
+ # @param [String] application_id Id of the application which is to be started
228
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
229
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
230
+ # @raise [Nucleus::Errors::SemanticAdapterRequestError] if the application is not deployed
231
+ # @return [Hash, Nucleus::API::Models::Application] application entity compatible Hash
232
+ def start(application_id)
233
+ raise NOT_IMPLEMENTED_ERROR
234
+ end
235
+
236
+ # Stop all instances of the application with the application_id.
237
+ # The state of all application instances will become +stopped+ when all actions are finished.
238
+ # Preconditions:<br>
239
+ # * application must have been deployed
240
+ # Postconditions (delayed):<br>
241
+ # * state == stopped
242
+ # @param [String] application_id Id of the application which is to be stopped
243
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
244
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
245
+ # @raise [Nucleus::Errors::SemanticAdapterRequestError] if the application is not deployed
246
+ # @return [Hash, Nucleus::API::Models::Application] application entity compatible Hash
247
+ def stop(application_id)
248
+ raise NOT_IMPLEMENTED_ERROR
249
+ end
250
+
251
+ # Restart all instances of the application with the application_id.
252
+ # The state of all application instances should become +running+ when all actions are finished
253
+ # (unless there are technical errors preventing the application to start).
254
+ # Preconditions:<br>
255
+ # * application must have been deployed
256
+ # Postconditions (delayed):<br>
257
+ # * state == running
258
+ # @param [String] application_id Id of the application which is to be restarted
259
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
260
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
261
+ # @raise [Nucleus::Errors::SemanticAdapterRequestError] if the application is not deployed
262
+ # @return [Hash, Nucleus::API::Models::Application] application entity compatible Hash
263
+ def restart(application_id)
264
+ raise NOT_IMPLEMENTED_ERROR
265
+ end
266
+
267
+ # Deploy the data of the application given the compressed application archive.<br>
268
+ # The application shall not be running when the deployment is finished.
269
+ # Postconditions (delayed):<br>
270
+ # * state == deployed
271
+ # @param [String] application_id Id of the application for which the data is to be deployed
272
+ # @param [Tempfile] application_archive compressed application archive that shall be deployed
273
+ # @param [Symbol] compression_format archive formats, see {Nucleus::API::Enums::CompressionFormats.all}
274
+ # for a list of all allowed values
275
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
276
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
277
+ # @raise [Nucleus::Errors::AdapterRequestError] if the application archive that shall be deployed is no
278
+ # valid application archive, or if the application_archive / compression_format are not supported
279
+ # @return [void]
280
+ def deploy(application_id, application_archive, compression_format)
281
+ raise NOT_IMPLEMENTED_ERROR
282
+ end
283
+
284
+ # Rebuild the recently deployed bits of the application.<br>
285
+ # The rebuild can be used to update the application to use a new version of the underlying runtime or fix a
286
+ # previously failed application start after the issues have been resolved.
287
+ # @param [String] application_id Id of the application which is to be rebuild
288
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
289
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
290
+ # @return [Hash, Nucleus::API::Models::Application] application entity compatible Hash
291
+ def rebuild(application_id)
292
+ raise NOT_IMPLEMENTED_ERROR
293
+ end
294
+
295
+ # Download the application data that is currently deployed on the platform.
296
+ # The downloaded application archive must contain at least all files that were originally deployed,
297
+ # but can also contain additional files, for instance log files.
298
+ # @param [String] application_id Id of the application of which the data is to be downloaded
299
+ # @param [Symbol] compression_format archive formats, see {Nucleus::API::Enums::CompressionFormats.all}
300
+ # for a list of all allowed values
301
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
302
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
303
+ # @raise [Nucleus::Errors::AdapterRequestError] if the application archive that shall be deployed is no
304
+ # valid application archive, or if the compression_format is not supported
305
+ # @return [StringIO] binary application data
306
+ def download(application_id, compression_format)
307
+ raise NOT_IMPLEMENTED_ERROR
308
+ end
309
+
310
+ # TODO: Finish documentation when vertical scaling is added
311
+ # Scale the application and adjust the number of instances that shall be running.
312
+ # @param [String] application_id Id of the application which is to be scaled
313
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
314
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
315
+ # @raise [Nucleus::Errors::SemanticAdapterRequestError] if the number of instances is disallowed on the platform
316
+ # @return [Hash, Nucleus::API::Models::Application] application entity compatible Hash
317
+ def scale(application_id, instances)
318
+ raise NOT_IMPLEMENTED_ERROR
319
+ end
320
+
321
+ # Assert whether the given log_id is valid for the application_id.
322
+ # @param [String] application_id Id of the application of which the log existence is to be checked
323
+ # @param [String] log_id Id of the log whose existence is to be checked
324
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
325
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
326
+ # @return [Boolean] returns true if there is a log for the application with the log_id,
327
+ # false if it does not exist
328
+ def log?(application_id, log_id)
329
+ raise NOT_IMPLEMENTED_ERROR
330
+ end
331
+
332
+ # Get a list of all logs that are available for the application.
333
+ # @param [String] application_id Id of the application of which the logs are to be listed
334
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
335
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
336
+ # @return [Hash, Nucleus::API::Models::Logs] log entity list compatible hash
337
+ def logs(application_id)
338
+ raise NOT_IMPLEMENTED_ERROR
339
+ end
340
+
341
+ # Retrieve all log entries of the log.
342
+ # @param [String] application_id Id of the application of which the log_entries are to be retrieved
343
+ # @param [String] log_id Id of the log for which the entries are to be retrieved
344
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application or log could not be found
345
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
346
+ # @return [Array<String>] array of log entries, starting with the earliest entry at pos [0]
347
+ def log_entries(application_id, log_id)
348
+ raise NOT_IMPLEMENTED_ERROR
349
+ end
350
+
351
+ # Tail the logfile of the application and send each retrieved chunk, which can be a line of a file,
352
+ # a new chunk in a received http message, or a websocket message, to the stream. The deferred tailing
353
+ # process shall be stoppable when the +stop+ method of the returned {Nucleus::Adapters::TailStopper TailStopper}
354
+ # is called.
355
+ # @param [String] application_id Id of the application of which the log is to be tailed
356
+ # @param [String] log_id Id of the log that is to be tailed
357
+ # @param [Nucleus::StreamCallback] stream stream callback to which messages can be sent via
358
+ # the +send_message+ method
359
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application or log could not be found
360
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
361
+ # @return [Nucleus::Adapters::TailStopper] callback object to stop the ongoing tail process
362
+ def tail(application_id, log_id, stream)
363
+ raise NOT_IMPLEMENTED_ERROR
364
+ end
365
+
366
+ # List all services that are available at the endpoint.
367
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
368
+ # @return [Hash, Nucleus::API::Models::Services] services list compatible hash
369
+ def services
370
+ raise NOT_IMPLEMENTED_ERROR
371
+ end
372
+
373
+ # Retrieve the service entity matching the given service_id.
374
+ # @param [String] service_id Id of the service that is to be retrieved
375
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the service could not be found
376
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
377
+ # @return [Hash, Nucleus::API::Models::Service] service entity compatible hash
378
+ def service(service_id)
379
+ raise NOT_IMPLEMENTED_ERROR
380
+ end
381
+
382
+ # List all plans that can be chosen for the service with the service_id, ascending order on the price.
383
+ # @param [String] service_id Id of the service the plans belong to
384
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the service could not be found
385
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
386
+ # @return [Hash, Nucleus::API::Models::ServicePlans] service plan list compatible hash
387
+ def service_plans(service_id)
388
+ raise NOT_IMPLEMENTED_ERROR
389
+ end
390
+
391
+ # Show the plan with the plan_id that is applicable to the service with the service_id.
392
+ # @param [String] service_id Id of the service the plans belongs to
393
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the service or the plan could not be found
394
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
395
+ # @return [Hash, Nucleus::API::Models::ServicePlan] service plan entity compatible hash
396
+ def service_plan(service_id, plan_id)
397
+ raise NOT_IMPLEMENTED_ERROR
398
+ end
399
+
400
+ # List all services that are installed on the application with the given application_id.
401
+ # @param [String] application_id Id of the application of which the services are to be listed of
402
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
403
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
404
+ # @return [Hash, Nucleus::API::Models::InstalledServices] installed services list compatible hash
405
+ def installed_services(application_id)
406
+ raise NOT_IMPLEMENTED_ERROR
407
+ end
408
+
409
+ # Retrieve the installed service entity matching the given service_id that is installed
410
+ # on the application with the given application_id.
411
+ # @param [String] service_id Id of the installed service that is to be retrieved
412
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application or service could not be found
413
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
414
+ # @return [Hash, Nucleus::API::Models::InstalledService] installed service entity compatible hash
415
+ def installed_service(application_id, service_id)
416
+ raise NOT_IMPLEMENTED_ERROR
417
+ end
418
+
419
+ # Add the service with the service_id to the application with the application_id.
420
+ # @param [String] application_id Id of the application of which the service is to be added to
421
+ # @param [Hash, Nucleus::API::Models::Service] service_entity service entity compatible Hash.
422
+ # @option env_var [String] :id ID of the service to add to the application
423
+ # @param [Hash, Nucleus::API::Models::ServicePlan] plan_entity service plan entity compatible Hash.
424
+ # @option env_var [String] :id ID of the service plan that shall be applied
425
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found
426
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
427
+ # @raise [Nucleus::Errors::SemanticAdapterRequestError] if the service to add or the plan to use
428
+ # could not be found
429
+ # @return [Hash, Nucleus::API::Models::InstalledService] installed service entity compatible hash
430
+ def add_service(application_id, service_entity, plan_entity)
431
+ raise NOT_IMPLEMENTED_ERROR
432
+ end
433
+
434
+ # Change the service, e.g. the active plan, of the service with the service_id for
435
+ # the application with the application_id. Use the fields of the service_entity to execute the update.
436
+ # @param [String] application_id Id of the application of which the service is to be changed
437
+ # @param [String] service_id Id of the installed service that is to be updated. The id must not (but can) be
438
+ # identical to the id of the service the installed service is based on.
439
+ # @param [Hash, Nucleus::API::Models::ServicePlan] plan_entity service plan entity compatible Hash.
440
+ # @option env_var [String] :id ID of the service plan that shall be applied
441
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found or
442
+ # the service was not installed on this application
443
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
444
+ # @raise [Nucleus::Errors::SemanticAdapterRequestError] if the plan to use could not be found
445
+ # @return [Hash, Nucleus::API::Models::InstalledService] installed service entity compatible hash
446
+ def change_service(application_id, service_id, plan_entity)
447
+ raise NOT_IMPLEMENTED_ERROR
448
+ end
449
+
450
+ # Remove the installed service with the service_id from the application with the application_id.
451
+ # @param [String] application_id Id of the application of which the service is to be removed from
452
+ # @param [String] service_id Id of the installed service that is to be removed from the application. The id
453
+ # must not (but can) be identical to the id of the service the installed service is based on.
454
+ # @raise [Nucleus::Errors::AdapterResourceNotFoundError] if the application could not be found or
455
+ # the service was not installed on this application
456
+ # @raise [Nucleus::Errors::EndpointAuthenticationError] if the authentication on the endpoint failed
457
+ # @return [void]
458
+ def remove_service(application_id, service_id)
459
+ raise NOT_IMPLEMENTED_ERROR
460
+ end
461
+ end
462
+ end
463
+ end
464
+ end