batchly_api 0.6.6 → 0.6.7

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.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +44 -0
  3. data/lib/batchly_api.rb +21 -11
  4. data/lib/batchly_api/api_exception.rb +5 -11
  5. data/lib/batchly_api/api_helper.rb +1 -1
  6. data/lib/batchly_api/configuration.rb +1 -1
  7. data/lib/batchly_api/controllers/{account_controller.rb → accounts_controller.rb} +38 -37
  8. data/lib/batchly_api/controllers/{data_source_controller.rb → data_sources_controller.rb} +5 -5
  9. data/lib/batchly_api/controllers/{job_controller.rb → jobs_controller.rb} +62 -14
  10. data/lib/batchly_api/controllers/processors_controller.rb +225 -0
  11. data/lib/batchly_api/controllers/{project_controller.rb → projects_controller.rb} +46 -46
  12. data/lib/batchly_api/controllers/{run_controller.rb → runs_controller.rb} +23 -59
  13. data/lib/batchly_api/models/add_aws_account_request.rb +1 -1
  14. data/lib/batchly_api/models/add_parameter_group_request.rb +34 -0
  15. data/lib/batchly_api/models/add_processor_request.rb +74 -0
  16. data/lib/batchly_api/models/add_s_3_data_source_request.rb +1 -1
  17. data/lib/batchly_api/models/base_string_enum.rb +25 -0
  18. data/lib/batchly_api/models/create_job_request.rb +6 -11
  19. data/lib/batchly_api/models/create_project_request.rb +1 -1
  20. data/lib/batchly_api/models/custom_image.rb +39 -0
  21. data/lib/batchly_api/models/execute_job_request.rb +8 -8
  22. data/lib/batchly_api/models/key_value_pair_string_string.rb +34 -0
  23. data/lib/batchly_api/models/language_enum.rb +30 -0
  24. data/lib/batchly_api/models/operating_system_enum.rb +24 -0
  25. data/lib/batchly_api/models/parameter.rb +29 -0
  26. data/lib/batchly_api/models/request_type_enum.rb +24 -0
  27. data/lib/batchly_api/models/response_type_enum.rb +21 -0
  28. data/lib/batchly_api/models/update_project_request.rb +1 -1
  29. data/lib/batchly_api/models/vpc_details.rb +1 -1
  30. metadata +22 -12
  31. data/lib/batchly_api/models/job_schedule.rb +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7baaa65b46f69edcb1633296304b085b90f7c033
4
- data.tar.gz: 5321d2b9ac9b2c236e1fa2af9096d97e37f5fc55
3
+ metadata.gz: aab2cec960422d708b58ecb4ac1b75224d945c06
4
+ data.tar.gz: 9392e58f33f28fc44f356f82b9891d826ef6e2f3
5
5
  SHA512:
6
- metadata.gz: 5436ebb13e4fb5c026ea6b79154e4767dbf17cc708b05506ccbd910d071eb35647958312d80f549441448a53684818d737ab96ba0bc00c291305ebd00ceaf741
7
- data.tar.gz: 17716513f3200fe7f8921d19cc98160ab821d6691f51601cce8af61d0296482bad7120cc7fd61f0f8883ba1df34c3ce14f1294a8f180134ce182a01d0b6c3e82
6
+ metadata.gz: b2c37529bcf0163a239a4da549d7217d752fc7c70f7144729392b93cc9bc34e9f4ce9a96179898877b4972f6fba048bc9b19a21f33631ac7f3177b9ec86b35ab
7
+ data.tar.gz: 65e33373da0d9b30bdd00934bd7239016b8da520416842df81bc3b4e1ed4e2b48d4f91838fa340ecb21501c5f0d3f556bde33b4628bd8d8799c38f366aea9349
@@ -0,0 +1,44 @@
1
+ BatchlyApi
2
+ =================
3
+ This API SDK can be used to connect to the Batchly rest endpoint. To generate the access key and secret key for authentication,
4
+ please use the batchly web console.
5
+
6
+ How To Configure:
7
+ =================
8
+ The generated code might need to be configured with your API credentials. To do that,
9
+ provide the credentials and configuration values as a constructor parameters for the controllers
10
+
11
+ How To Build:
12
+ =============
13
+ The generated code uses a Ruby gem namely 'unirest'. The reference to this gem is
14
+ already added in the gemspec. Therefore, you will need internet access to resolve
15
+ this dependency.
16
+
17
+ How To Use:
18
+ ===========
19
+ The generated code can be used to build gem, which can then be distributed online.
20
+ Otherwise, you can include the generated code in your project to use directly.
21
+
22
+ Use the following steps to build a gem and use locally
23
+
24
+ 1. Run the build command
25
+ ```
26
+ gem build batchly_api.gemspec
27
+ ```
28
+
29
+ 2. Run the install command
30
+ ```
31
+ gem install ./batchly_api-1.0.1.gem
32
+ ```
33
+
34
+ 3. In your Gemfile add this line
35
+ ```
36
+ gem 'batchly_api', '~> 1.0.1'
37
+ ```
38
+
39
+ 4. Now create an instance and use the instance methods, like following.
40
+
41
+ ```
42
+ ctl = BatchlyApi::AccountsController.new params
43
+ ctl.get_list_projects params
44
+ ```
@@ -1,4 +1,4 @@
1
- # This file was automatically generated for support.batchly.net by APIMATIC BETA v2.0 on 11/26/2015
1
+ # This file was automatically generated for support.batchly.net by APIMATIC BETA v2.0 on 12/05/2015
2
2
  require 'openssl'
3
3
  require 'json'
4
4
  require 'unirest'
@@ -10,20 +10,30 @@ require 'batchly_api/configuration.rb'
10
10
  require 'batchly_api/custom_auth_utility.rb'
11
11
 
12
12
  # Controllers
13
- require 'batchly_api/controllers/account_controller.rb'
14
- require 'batchly_api/controllers/data_source_controller.rb'
15
- require 'batchly_api/controllers/job_controller.rb'
16
- require 'batchly_api/controllers/project_controller.rb'
17
- require 'batchly_api/controllers/run_controller.rb'
13
+ require 'batchly_api/controllers/accounts_controller.rb'
14
+ require 'batchly_api/controllers/data_sources_controller.rb'
15
+ require 'batchly_api/controllers/jobs_controller.rb'
16
+ require 'batchly_api/controllers/processors_controller.rb'
17
+ require 'batchly_api/controllers/projects_controller.rb'
18
+ require 'batchly_api/controllers/runs_controller.rb'
18
19
 
19
20
  # Models
21
+ require 'batchly_api/models/add_aws_account_request.rb'
20
22
  require 'batchly_api/models/add_s_3_data_source_request.rb'
21
- require 'batchly_api/models/job_schedule.rb'
23
+ require 'batchly_api/models/execute_job_request.rb'
24
+ require 'batchly_api/models/create_job_request.rb'
25
+ require 'batchly_api/models/request_type_enum.rb'
26
+ require 'batchly_api/models/response_type_enum.rb'
27
+ require 'batchly_api/models/add_processor_request.rb'
28
+ require 'batchly_api/models/operating_system_enum.rb'
29
+ require 'batchly_api/models/language_enum.rb'
30
+ require 'batchly_api/models/custom_image.rb'
22
31
  require 'batchly_api/models/create_project_request.rb'
23
32
  require 'batchly_api/models/vpc_details.rb'
24
33
  require 'batchly_api/models/update_project_request.rb'
25
- require 'batchly_api/models/execute_job_request.rb'
26
- require 'batchly_api/models/add_aws_account_request.rb'
27
- require 'batchly_api/models/create_job_request.rb'
34
+ require 'batchly_api/models/add_parameter_group_request.rb'
35
+ require 'batchly_api/models/key_value_pair_string_string.rb'
36
+ require 'batchly_api/models/parameter.rb'
37
+ require 'batchly_api/models/base_string_enum.rb'
28
38
 
29
- Unirest.timeout(60)
39
+ Unirest.timeout(180)
@@ -1,4 +1,4 @@
1
- # This file was automatically generated for support.batchly.net by APIMATIC BETA v2.0 on 11/26/2015
1
+ # This file was automatically generated for support.batchly.net by APIMATIC BETA v2.0 on 12/05/2015
2
2
 
3
3
  module BatchlyApi
4
4
  class APIException < StandardError
@@ -14,16 +14,10 @@ module BatchlyApi
14
14
  # @param [Numeric] the HTTP response code from the API request
15
15
  # @param [Object] the HTTP unprased response from the API request
16
16
  def initialize(reason, response_code, response_body)
17
- super(reason)
18
- @response_code = response_code
19
- @response_body = response_body
20
-
21
- if $DEBUG
22
- puts reason
23
- puts response_code
24
- puts response_body
25
- end
17
+ super(reason)
18
+ @response_code = response_code
19
+ @response_body = response_body
26
20
  end
27
21
 
28
22
  end
29
- end
23
+ end
@@ -1,4 +1,4 @@
1
- # This file was automatically generated for support.batchly.net by APIMATIC BETA v2.0 on 11/26/2015
1
+ # This file was automatically generated for support.batchly.net by APIMATIC BETA v2.0 on 12/05/2015
2
2
 
3
3
  module BatchlyApi
4
4
  class APIHelper
@@ -4,7 +4,7 @@ module BatchlyApi
4
4
  class Configuration
5
5
 
6
6
  # The base Uri for API calls
7
- @BASE_URI = "http://api.corrs.batchly.net"
7
+ @BASE_URI = "http://corrs.batchly.net"
8
8
 
9
9
  # The access key for batchly
10
10
  @API_KEY = "UPDATE YOUR GENERATED API KEY HERE"
@@ -1,9 +1,9 @@
1
- # This file was automatically generated for support.batchly.net by APIMATIC BETA v2.0 on 11/26/2015
1
+ # This file was automatically generated for support.batchly.net by APIMATIC BETA v2.0 on 12/05/2015
2
2
 
3
3
  module BatchlyApi
4
- class AccountController
4
+ class AccountsController
5
5
 
6
- # Lists all active projects in the given account identifier.
6
+ # Returns a Lists of all the projects for the given account identifier.
7
7
  # @param [String] id Required parameter: Account ID
8
8
  # @return Array<ProjectModel> response from the API call
9
9
  def list_projects id
@@ -11,7 +11,7 @@ module BatchlyApi
11
11
  query_builder = Configuration.BASE_URI.dup
12
12
 
13
13
  # prepare query string for API call
14
- query_builder << "/api/account/{id}/Projects"
14
+ query_builder << "/api/Accounts/{id}/Projects"
15
15
 
16
16
  # process optional query parameters
17
17
  query_builder = APIHelper.append_url_with_template_parameters query_builder, {
@@ -23,7 +23,7 @@ module BatchlyApi
23
23
 
24
24
  # prepare headers
25
25
  headers = {
26
- "user-agent" => "batchly/0.5.3",
26
+ "user-agent" => "batchly/1.0.1",
27
27
  "accept" => "application/json"
28
28
  }
29
29
 
@@ -41,58 +41,58 @@ module BatchlyApi
41
41
  response.body
42
42
  end
43
43
 
44
- # Deactivates the account and all associated jobs.
45
- # @param [String] id Required parameter: Account Identifier.
46
- # @return void response from the API call
47
- def delete id
44
+ # Adds a new AWS account to batchly. AWS Accesskey and Secretkey should have 'IAMFullAccess' Permissions.
45
+ # Shared AWS keys are not stored in our servers. Keys are used to create a new role and then discarded.
46
+ # @param [AddAWSAccountRequest] model Required parameter: Request model for adding AWS account
47
+ # @return AccountModel response from the API call
48
+ def add_aws_cloud_account model
48
49
  # the base uri for api requests
49
50
  query_builder = Configuration.BASE_URI.dup
50
51
 
51
52
  # prepare query string for API call
52
- query_builder << "/api/Account/{id}"
53
-
54
- # process optional query parameters
55
- query_builder = APIHelper.append_url_with_template_parameters query_builder, {
56
- "id" => id,
57
- }
53
+ query_builder << "/api/Accounts/AWS"
58
54
 
59
55
  # validate and preprocess url
60
56
  query_url = APIHelper.clean_url query_builder
61
57
 
62
58
  # prepare headers
63
59
  headers = {
64
- "user-agent" => "batchly/0.5.3"
60
+ "user-agent" => "batchly/1.0.1",
61
+ "accept" => "application/json",
62
+ "content-type" => "application/json; charset=utf-8"
65
63
  }
66
64
 
67
65
  # append custom auth authorization
68
- CustomAuthUtility.append_custom_auth_params query_url, "DELETE", headers
66
+ CustomAuthUtility.append_custom_auth_params query_url, "POST", headers
69
67
 
70
68
  # invoke the API call request to fetch the response
71
- response = Unirest.delete query_url, headers:headers
69
+ response = Unirest.post query_url, headers:headers, parameters:model.to_json
72
70
 
73
71
  # Error handling using HTTP status codes
74
- if response.code == 404
75
- raise APIException.new "NotFound", 404, response.raw_body
72
+ if response.code == 400
73
+ raise APIException.new "BadRequest", 400, response.raw_body
76
74
  elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK
77
75
  raise APIException.new "HTTP Response Not OK", response.code, response.raw_body
78
76
  end
77
+
78
+ response.body
79
79
  end
80
80
 
81
- # Lists all active accounts associated with the batchly account
81
+ # Returns a Lists of all the active accounts in batchly.
82
82
  # @return Array<AccountModel> response from the API call
83
83
  def list_accounts
84
84
  # the base uri for api requests
85
85
  query_builder = Configuration.BASE_URI.dup
86
86
 
87
87
  # prepare query string for API call
88
- query_builder << "/api/Account"
88
+ query_builder << "/api/Accounts"
89
89
 
90
90
  # validate and preprocess url
91
91
  query_url = APIHelper.clean_url query_builder
92
92
 
93
93
  # prepare headers
94
94
  headers = {
95
- "user-agent" => "batchly/0.5.3",
95
+ "user-agent" => "batchly/1.0.1",
96
96
  "accept" => "application/json"
97
97
  }
98
98
 
@@ -110,40 +110,41 @@ module BatchlyApi
110
110
  response.body
111
111
  end
112
112
 
113
- # Add a new AWS account. The credentials should have IAMFullAccess Permissions. The keys are used to only create a new Batchly role in AWS IAM. The keys are not saved in batchly servers. Future calls are made using the newly created Batchly Role.
114
- # @param [AddAWSAccountRequest] model Required parameter: Request model for adding AWS account
115
- # @return AccountModel response from the API call
116
- def add_aws_cloud_account model
113
+ # Deletes the specified account. All projects, jobs, processors associated with the account are made inactive.
114
+ # @param [String] id Required parameter: Account Identifier.
115
+ # @return void response from the API call
116
+ def delete id
117
117
  # the base uri for api requests
118
118
  query_builder = Configuration.BASE_URI.dup
119
119
 
120
120
  # prepare query string for API call
121
- query_builder << "/api/account/AWS"
121
+ query_builder << "/api/Accounts/{id}"
122
+
123
+ # process optional query parameters
124
+ query_builder = APIHelper.append_url_with_template_parameters query_builder, {
125
+ "id" => id,
126
+ }
122
127
 
123
128
  # validate and preprocess url
124
129
  query_url = APIHelper.clean_url query_builder
125
130
 
126
131
  # prepare headers
127
132
  headers = {
128
- "user-agent" => "batchly/0.5.3",
129
- "accept" => "application/json",
130
- "content-type" => "application/json; charset=utf-8"
133
+ "user-agent" => "batchly/1.0.1"
131
134
  }
132
135
 
133
136
  # append custom auth authorization
134
- CustomAuthUtility.append_custom_auth_params query_url, "POST", headers
137
+ CustomAuthUtility.append_custom_auth_params query_url, "DELETE", headers
135
138
 
136
139
  # invoke the API call request to fetch the response
137
- response = Unirest.post query_url, headers:headers, parameters:model.to_json
140
+ response = Unirest.delete query_url, headers:headers
138
141
 
139
142
  # Error handling using HTTP status codes
140
- if response.code == 400
141
- raise APIException.new "BadRequest", 400, response.raw_body
143
+ if response.code == 404
144
+ raise APIException.new "NotFound", 404, response.raw_body
142
145
  elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK
143
146
  raise APIException.new "HTTP Response Not OK", response.code, response.raw_body
144
147
  end
145
-
146
- response.body
147
148
  end
148
149
 
149
150
  end
@@ -1,9 +1,9 @@
1
- # This file was automatically generated for support.batchly.net by APIMATIC BETA v2.0 on 11/26/2015
1
+ # This file was automatically generated for support.batchly.net by APIMATIC BETA v2.0 on 12/05/2015
2
2
 
3
3
  module BatchlyApi
4
- class DataSourceController
4
+ class DataSourcesController
5
5
 
6
- # Registers a new s3 endpoint with batchly. This endpoint can be used as either a source or destination for your job.
6
+ # Adds a new S3 datasource to batchly.
7
7
  # @param [AddS3DataSourceRequest] model Required parameter: Add S3 DataSource request
8
8
  # @return String response from the API call
9
9
  def add_s_3 model
@@ -11,14 +11,14 @@ module BatchlyApi
11
11
  query_builder = Configuration.BASE_URI.dup
12
12
 
13
13
  # prepare query string for API call
14
- query_builder << "/api/datasources/S3"
14
+ query_builder << "/api/DataSources/S3"
15
15
 
16
16
  # validate and preprocess url
17
17
  query_url = APIHelper.clean_url query_builder
18
18
 
19
19
  # prepare headers
20
20
  headers = {
21
- "user-agent" => "batchly/0.5.3",
21
+ "user-agent" => "batchly/1.0.1",
22
22
  "content-type" => "application/json; charset=utf-8"
23
23
  }
24
24
 
@@ -1,23 +1,67 @@
1
- # This file was automatically generated for support.batchly.net by APIMATIC BETA v2.0 on 11/26/2015
1
+ # This file was automatically generated for support.batchly.net by APIMATIC BETA v2.0 on 12/05/2015
2
2
 
3
3
  module BatchlyApi
4
- class JobController
4
+ class JobsController
5
5
 
6
- # Lists all active jobs in batchly
6
+ # Creates a run for the submitted job identifier. The run is started if the job is not scheduled. Only one run for a job can be active. Returns conflict response if a job is already executing.
7
+ # @param [String] id Required parameter: Job Id that needs to be executed
8
+ # @param [ExecuteJobRequest] request Optional parameter: Request parameters can be null if default parameters can be used for execution. If present, Request values will be considered instead of defaults
9
+ # @return RunModel response from the API call
10
+ def execute_job id, request: nil
11
+ # the base uri for api requests
12
+ query_builder = Configuration.BASE_URI.dup
13
+
14
+ # prepare query string for API call
15
+ query_builder << "/api/Jobs/{id}/Execute"
16
+
17
+ # process optional query parameters
18
+ query_builder = APIHelper.append_url_with_template_parameters query_builder, {
19
+ "id" => id,
20
+ }
21
+
22
+ # validate and preprocess url
23
+ query_url = APIHelper.clean_url query_builder
24
+
25
+ # prepare headers
26
+ headers = {
27
+ "user-agent" => "batchly/1.0.1",
28
+ "accept" => "application/json",
29
+ "content-type" => "application/json; charset=utf-8"
30
+ }
31
+
32
+ # append custom auth authorization
33
+ CustomAuthUtility.append_custom_auth_params query_url, "POST", headers
34
+
35
+ # invoke the API call request to fetch the response
36
+ response = Unirest.post query_url, headers:headers, parameters:request.to_json
37
+
38
+ # Error handling using HTTP status codes
39
+ if response.code == 400
40
+ raise APIException.new "BadRequest", 400, response.raw_body
41
+ elsif response.code == 409
42
+ raise APIException.new "Conflict", 409, response.raw_body
43
+ elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK
44
+ raise APIException.new "HTTP Response Not OK", response.code, response.raw_body
45
+ end
46
+
47
+ response.body
48
+ end
49
+
50
+ # Returns a List of all active jobs in batchly
7
51
  # @return Array<JobModel> response from the API call
8
52
  def list_jobs
9
53
  # the base uri for api requests
10
54
  query_builder = Configuration.BASE_URI.dup
11
55
 
12
56
  # prepare query string for API call
13
- query_builder << "/api/Job"
57
+ query_builder << "/api/Jobs"
14
58
 
15
59
  # validate and preprocess url
16
60
  query_url = APIHelper.clean_url query_builder
17
61
 
18
62
  # prepare headers
19
63
  headers = {
20
- "user-agent" => "batchly/0.5.3",
64
+ "user-agent" => "batchly/1.0.1",
21
65
  "accept" => "application/json"
22
66
  }
23
67
 
@@ -35,7 +79,11 @@ module BatchlyApi
35
79
  response.body
36
80
  end
37
81
 
38
- # Adds a new job. Job can be created after registering source and destination as data sources and uploading new processor. Job brings your processors and data endpoints together.
82
+ # Adds a new job to batchly. The following steps are involved when creating a new job
83
+ # -&gt; Get a list of projects. If needed, create a new project.
84
+ # -&gt; Add datasources for source and destination
85
+ # -&gt; Get a list of processors. If needed, create a new processor
86
+ # -&gt; Create a job with source, destination, project and processor identifier
39
87
  # @param [CreateJobRequest] request Required parameter: Create Job Request
40
88
  # @return JobModel response from the API call
41
89
  def add_job request
@@ -43,14 +91,14 @@ module BatchlyApi
43
91
  query_builder = Configuration.BASE_URI.dup
44
92
 
45
93
  # prepare query string for API call
46
- query_builder << "/api/Job"
94
+ query_builder << "/api/Jobs"
47
95
 
48
96
  # validate and preprocess url
49
97
  query_url = APIHelper.clean_url query_builder
50
98
 
51
99
  # prepare headers
52
100
  headers = {
53
- "user-agent" => "batchly/0.5.3",
101
+ "user-agent" => "batchly/1.0.1",
54
102
  "accept" => "application/json",
55
103
  "content-type" => "application/json; charset=utf-8"
56
104
  }
@@ -71,7 +119,7 @@ module BatchlyApi
71
119
  response.body
72
120
  end
73
121
 
74
- # Describes the Job
122
+ # Describes in detail the job
75
123
  # @param [String] id Required parameter: Job Identifier
76
124
  # @return JobModel response from the API call
77
125
  def describe_job id
@@ -79,7 +127,7 @@ module BatchlyApi
79
127
  query_builder = Configuration.BASE_URI.dup
80
128
 
81
129
  # prepare query string for API call
82
- query_builder << "/api/Job/{id}"
130
+ query_builder << "/api/Jobs/{id}"
83
131
 
84
132
  # process optional query parameters
85
133
  query_builder = APIHelper.append_url_with_template_parameters query_builder, {
@@ -91,7 +139,7 @@ module BatchlyApi
91
139
 
92
140
  # prepare headers
93
141
  headers = {
94
- "user-agent" => "batchly/0.5.3",
142
+ "user-agent" => "batchly/1.0.1",
95
143
  "accept" => "application/json"
96
144
  }
97
145
 
@@ -111,7 +159,7 @@ module BatchlyApi
111
159
  response.body
112
160
  end
113
161
 
114
- # Deletes the jobs and removes all schedules
162
+ # Deletes the job and deactivates any scheduler associated with the job.
115
163
  # @param [String] id Required parameter: Job Identifier
116
164
  # @return void response from the API call
117
165
  def delete_job id
@@ -119,7 +167,7 @@ module BatchlyApi
119
167
  query_builder = Configuration.BASE_URI.dup
120
168
 
121
169
  # prepare query string for API call
122
- query_builder << "/api/Job/{id}"
170
+ query_builder << "/api/Jobs/{id}"
123
171
 
124
172
  # process optional query parameters
125
173
  query_builder = APIHelper.append_url_with_template_parameters query_builder, {
@@ -131,7 +179,7 @@ module BatchlyApi
131
179
 
132
180
  # prepare headers
133
181
  headers = {
134
- "user-agent" => "batchly/0.5.3"
182
+ "user-agent" => "batchly/1.0.1"
135
183
  }
136
184
 
137
185
  # append custom auth authorization