azure_mgmt_scheduler 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/LICENSE.txt +21 -0
  4. data/Rakefile +5 -0
  5. data/azure_mgmt_scheduler.gemspec +35 -0
  6. data/lib/azure_mgmt_scheduler.rb +73 -0
  7. data/lib/azure_mgmt_scheduler/job_collections.rb +642 -0
  8. data/lib/azure_mgmt_scheduler/jobs.rb +616 -0
  9. data/lib/azure_mgmt_scheduler/models/basic_authentication.rb +75 -0
  10. data/lib/azure_mgmt_scheduler/models/client_cert_authentication.rb +104 -0
  11. data/lib/azure_mgmt_scheduler/models/day_of_week.rb +21 -0
  12. data/lib/azure_mgmt_scheduler/models/http_authentication.rb +61 -0
  13. data/lib/azure_mgmt_scheduler/models/http_authentication_type.rb +18 -0
  14. data/lib/azure_mgmt_scheduler/models/http_request.rb +99 -0
  15. data/lib/azure_mgmt_scheduler/models/job_action.rb +159 -0
  16. data/lib/azure_mgmt_scheduler/models/job_action_type.rb +19 -0
  17. data/lib/azure_mgmt_scheduler/models/job_collection_definition.rb +109 -0
  18. data/lib/azure_mgmt_scheduler/models/job_collection_list_result.rb +86 -0
  19. data/lib/azure_mgmt_scheduler/models/job_collection_properties.rb +92 -0
  20. data/lib/azure_mgmt_scheduler/models/job_collection_quota.rb +82 -0
  21. data/lib/azure_mgmt_scheduler/models/job_collection_state.rb +18 -0
  22. data/lib/azure_mgmt_scheduler/models/job_definition.rb +89 -0
  23. data/lib/azure_mgmt_scheduler/models/job_error_action.rb +143 -0
  24. data/lib/azure_mgmt_scheduler/models/job_execution_status.rb +17 -0
  25. data/lib/azure_mgmt_scheduler/models/job_history_action_name.rb +16 -0
  26. data/lib/azure_mgmt_scheduler/models/job_history_definition.rb +90 -0
  27. data/lib/azure_mgmt_scheduler/models/job_history_definition_properties.rb +136 -0
  28. data/lib/azure_mgmt_scheduler/models/job_history_filter.rb +60 -0
  29. data/lib/azure_mgmt_scheduler/models/job_history_list_result.rb +87 -0
  30. data/lib/azure_mgmt_scheduler/models/job_list_result.rb +86 -0
  31. data/lib/azure_mgmt_scheduler/models/job_max_recurrence.rb +71 -0
  32. data/lib/azure_mgmt_scheduler/models/job_properties.rb +119 -0
  33. data/lib/azure_mgmt_scheduler/models/job_recurrence.rb +110 -0
  34. data/lib/azure_mgmt_scheduler/models/job_recurrence_schedule.rb +156 -0
  35. data/lib/azure_mgmt_scheduler/models/job_recurrence_schedule_monthly_occurrence.rb +73 -0
  36. data/lib/azure_mgmt_scheduler/models/job_schedule_day.rb +21 -0
  37. data/lib/azure_mgmt_scheduler/models/job_state.rb +18 -0
  38. data/lib/azure_mgmt_scheduler/models/job_state_filter.rb +60 -0
  39. data/lib/azure_mgmt_scheduler/models/job_status.rb +103 -0
  40. data/lib/azure_mgmt_scheduler/models/oauth_authentication.rb +93 -0
  41. data/lib/azure_mgmt_scheduler/models/recurrence_frequency.rb +19 -0
  42. data/lib/azure_mgmt_scheduler/models/retry_policy.rb +80 -0
  43. data/lib/azure_mgmt_scheduler/models/retry_type.rb +16 -0
  44. data/lib/azure_mgmt_scheduler/models/service_bus_authentication.rb +78 -0
  45. data/lib/azure_mgmt_scheduler/models/service_bus_authentication_type.rb +16 -0
  46. data/lib/azure_mgmt_scheduler/models/service_bus_brokered_message_properties.rb +168 -0
  47. data/lib/azure_mgmt_scheduler/models/service_bus_message.rb +122 -0
  48. data/lib/azure_mgmt_scheduler/models/service_bus_queue_message.rb +108 -0
  49. data/lib/azure_mgmt_scheduler/models/service_bus_topic_message.rb +108 -0
  50. data/lib/azure_mgmt_scheduler/models/service_bus_transport_type.rb +17 -0
  51. data/lib/azure_mgmt_scheduler/models/sku.rb +60 -0
  52. data/lib/azure_mgmt_scheduler/models/sku_definition.rb +17 -0
  53. data/lib/azure_mgmt_scheduler/models/storage_queue_message.rb +83 -0
  54. data/lib/azure_mgmt_scheduler/module_definition.rb +8 -0
  55. data/lib/azure_mgmt_scheduler/scheduler_management_client.rb +70 -0
  56. data/lib/azure_mgmt_scheduler/version.rb +8 -0
  57. metadata +183 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4a2b6ea9c9a7d6014af70abb7b516f2c08666e18
4
+ data.tar.gz: dc21cec9003de2651571922df342d1676fd7a5a0
5
+ SHA512:
6
+ metadata.gz: e8ece010fe1d012c65cb63b3fa9e0a1d28da95e599691e4cbd62194281a0c88aef3c05986b033135a40fee1b81b0f0b32fb477a1d677d547901a77af6bcba31e
7
+ data.tar.gz: 0b38109d8937de21a06679deb5877396dcab89ee71b696ce6af2ed2d1b80db11bc129c44adf3294f9b6474e3a3dce8ad29c4fb9aa0cb2bb6214b5583c77bccb1
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --color
3
+ --format documentation
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ require "bundler/gem_tasks"
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ lib = File.expand_path('../lib', __FILE__)
6
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
+
8
+ require 'azure_mgmt_scheduler/module_definition'
9
+ require 'azure_mgmt_scheduler/version'
10
+
11
+ Gem::Specification.new do |spec|
12
+ spec.name = 'azure_mgmt_scheduler'
13
+ spec.version = Azure::ARM::Scheduler::VERSION
14
+ spec.authors = 'Microsoft Corporation'
15
+ spec.email = 'azrubyteam@microsoft.com'
16
+ spec.description = 'Microsoft Azure Scheduler Management Client Library for Ruby'
17
+ spec.summary = 'Official Ruby client library to consume Microsoft Azure Scheduler Management services.'
18
+ spec.homepage = 'http://github.com/azure/azure-sdk-for-ruby'
19
+ spec.license = 'MIT'
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ spec.bindir = 'bin'
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
25
+
26
+ spec.required_ruby_version = '>= 1.9.3'
27
+
28
+ spec.add_development_dependency 'bundler', '~> 1.9'
29
+ spec.add_development_dependency 'rake', '~> 10'
30
+ spec.add_development_dependency 'rspec', '~> 3'
31
+ spec.add_development_dependency 'dotenv', '~> 2'
32
+ spec.add_development_dependency 'azure_mgmt_resources', '~> 0.2'
33
+
34
+ spec.add_runtime_dependency 'ms_rest_azure', '~> 0.2.0'
35
+ end
@@ -0,0 +1,73 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require 'ms_rest_azure'
20
+
21
+ module Azure::ARM::Scheduler
22
+ autoload :JobCollections, 'azure_mgmt_scheduler/job_collections.rb'
23
+ autoload :Jobs, 'azure_mgmt_scheduler/jobs.rb'
24
+ autoload :SchedulerManagementClient, 'azure_mgmt_scheduler/scheduler_management_client.rb'
25
+
26
+ module Models
27
+ autoload :JobCollectionListResult, 'azure_mgmt_scheduler/models/job_collection_list_result.rb'
28
+ autoload :JobCollectionDefinition, 'azure_mgmt_scheduler/models/job_collection_definition.rb'
29
+ autoload :JobCollectionProperties, 'azure_mgmt_scheduler/models/job_collection_properties.rb'
30
+ autoload :Sku, 'azure_mgmt_scheduler/models/sku.rb'
31
+ autoload :JobCollectionQuota, 'azure_mgmt_scheduler/models/job_collection_quota.rb'
32
+ autoload :JobMaxRecurrence, 'azure_mgmt_scheduler/models/job_max_recurrence.rb'
33
+ autoload :JobListResult, 'azure_mgmt_scheduler/models/job_list_result.rb'
34
+ autoload :JobDefinition, 'azure_mgmt_scheduler/models/job_definition.rb'
35
+ autoload :JobProperties, 'azure_mgmt_scheduler/models/job_properties.rb'
36
+ autoload :JobAction, 'azure_mgmt_scheduler/models/job_action.rb'
37
+ autoload :HttpRequest, 'azure_mgmt_scheduler/models/http_request.rb'
38
+ autoload :HttpAuthentication, 'azure_mgmt_scheduler/models/http_authentication.rb'
39
+ autoload :StorageQueueMessage, 'azure_mgmt_scheduler/models/storage_queue_message.rb'
40
+ autoload :RetryPolicy, 'azure_mgmt_scheduler/models/retry_policy.rb'
41
+ autoload :JobErrorAction, 'azure_mgmt_scheduler/models/job_error_action.rb'
42
+ autoload :JobRecurrence, 'azure_mgmt_scheduler/models/job_recurrence.rb'
43
+ autoload :JobRecurrenceSchedule, 'azure_mgmt_scheduler/models/job_recurrence_schedule.rb'
44
+ autoload :JobRecurrenceScheduleMonthlyOccurrence, 'azure_mgmt_scheduler/models/job_recurrence_schedule_monthly_occurrence.rb'
45
+ autoload :JobStatus, 'azure_mgmt_scheduler/models/job_status.rb'
46
+ autoload :JobHistoryListResult, 'azure_mgmt_scheduler/models/job_history_list_result.rb'
47
+ autoload :JobHistoryDefinition, 'azure_mgmt_scheduler/models/job_history_definition.rb'
48
+ autoload :JobHistoryDefinitionProperties, 'azure_mgmt_scheduler/models/job_history_definition_properties.rb'
49
+ autoload :ServiceBusMessage, 'azure_mgmt_scheduler/models/service_bus_message.rb'
50
+ autoload :ServiceBusAuthentication, 'azure_mgmt_scheduler/models/service_bus_authentication.rb'
51
+ autoload :ServiceBusBrokeredMessageProperties, 'azure_mgmt_scheduler/models/service_bus_brokered_message_properties.rb'
52
+ autoload :JobStateFilter, 'azure_mgmt_scheduler/models/job_state_filter.rb'
53
+ autoload :JobHistoryFilter, 'azure_mgmt_scheduler/models/job_history_filter.rb'
54
+ autoload :ServiceBusQueueMessage, 'azure_mgmt_scheduler/models/service_bus_queue_message.rb'
55
+ autoload :ServiceBusTopicMessage, 'azure_mgmt_scheduler/models/service_bus_topic_message.rb'
56
+ autoload :ClientCertAuthentication, 'azure_mgmt_scheduler/models/client_cert_authentication.rb'
57
+ autoload :BasicAuthentication, 'azure_mgmt_scheduler/models/basic_authentication.rb'
58
+ autoload :OAuthAuthentication, 'azure_mgmt_scheduler/models/oauth_authentication.rb'
59
+ autoload :SkuDefinition, 'azure_mgmt_scheduler/models/sku_definition.rb'
60
+ autoload :JobCollectionState, 'azure_mgmt_scheduler/models/job_collection_state.rb'
61
+ autoload :RecurrenceFrequency, 'azure_mgmt_scheduler/models/recurrence_frequency.rb'
62
+ autoload :JobActionType, 'azure_mgmt_scheduler/models/job_action_type.rb'
63
+ autoload :HttpAuthenticationType, 'azure_mgmt_scheduler/models/http_authentication_type.rb'
64
+ autoload :RetryType, 'azure_mgmt_scheduler/models/retry_type.rb'
65
+ autoload :DayOfWeek, 'azure_mgmt_scheduler/models/day_of_week.rb'
66
+ autoload :JobScheduleDay, 'azure_mgmt_scheduler/models/job_schedule_day.rb'
67
+ autoload :JobState, 'azure_mgmt_scheduler/models/job_state.rb'
68
+ autoload :JobHistoryActionName, 'azure_mgmt_scheduler/models/job_history_action_name.rb'
69
+ autoload :JobExecutionStatus, 'azure_mgmt_scheduler/models/job_execution_status.rb'
70
+ autoload :ServiceBusAuthenticationType, 'azure_mgmt_scheduler/models/service_bus_authentication_type.rb'
71
+ autoload :ServiceBusTransportType, 'azure_mgmt_scheduler/models/service_bus_transport_type.rb'
72
+ end
73
+ end
@@ -0,0 +1,642 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Scheduler
7
+ #
8
+ # JobCollections
9
+ #
10
+ class JobCollections
11
+ include Azure::ARM::Scheduler::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the JobCollections class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return reference to the SchedulerManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Gets all job collections under specified subscription.
27
+ #
28
+ # @param [Hash{String => String}] The hash of custom headers need to be
29
+ # applied to HTTP request.
30
+ #
31
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
32
+ # response.
33
+ #
34
+ def list_by_subscription(custom_headers = nil)
35
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
36
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
37
+ request_headers = {}
38
+
39
+ # Set Headers
40
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
41
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
42
+ path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Scheduler/jobCollections'
43
+ options = {
44
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
45
+ path_params: {'subscriptionId' => @client.subscription_id},
46
+ query_params: {'api-version' => @client.api_version},
47
+ headers: request_headers.merge(custom_headers || {})
48
+ }
49
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
50
+ promise = request.run_promise do |req|
51
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
52
+ end
53
+
54
+ promise = promise.then do |http_response|
55
+ status_code = http_response.status
56
+ response_content = http_response.body
57
+ unless status_code == 200
58
+ error_model = JSON.load(response_content)
59
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
60
+ end
61
+
62
+ # Create Result
63
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
64
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
65
+ # Deserialize Response
66
+ if status_code == 200
67
+ begin
68
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
69
+ unless parsed_response.nil?
70
+ parsed_response = JobCollectionListResult.deserialize_object(parsed_response)
71
+ end
72
+ result.body = parsed_response
73
+ rescue Exception => e
74
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
75
+ end
76
+ end
77
+
78
+ result
79
+ end
80
+
81
+ promise.execute
82
+ end
83
+
84
+ #
85
+ # Gets all job collections under specified resource group.
86
+ #
87
+ # @param resource_group_name [String] The resource group name.
88
+ # @param [Hash{String => String}] The hash of custom headers need to be
89
+ # applied to HTTP request.
90
+ #
91
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
92
+ # response.
93
+ #
94
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
95
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
96
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
97
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
98
+ request_headers = {}
99
+
100
+ # Set Headers
101
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
102
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
103
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections'
104
+ options = {
105
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
106
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
107
+ query_params: {'api-version' => @client.api_version},
108
+ headers: request_headers.merge(custom_headers || {})
109
+ }
110
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
111
+ promise = request.run_promise do |req|
112
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
113
+ end
114
+
115
+ promise = promise.then do |http_response|
116
+ status_code = http_response.status
117
+ response_content = http_response.body
118
+ unless status_code == 200
119
+ error_model = JSON.load(response_content)
120
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
121
+ end
122
+
123
+ # Create Result
124
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
125
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
126
+ # Deserialize Response
127
+ if status_code == 200
128
+ begin
129
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
130
+ unless parsed_response.nil?
131
+ parsed_response = JobCollectionListResult.deserialize_object(parsed_response)
132
+ end
133
+ result.body = parsed_response
134
+ rescue Exception => e
135
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
136
+ end
137
+ end
138
+
139
+ result
140
+ end
141
+
142
+ promise.execute
143
+ end
144
+
145
+ #
146
+ # Gets a job collection.
147
+ #
148
+ # @param resource_group_name [String] The resource group name.
149
+ # @param job_collection_name [String] The job collection name.
150
+ # @param [Hash{String => String}] The hash of custom headers need to be
151
+ # applied to HTTP request.
152
+ #
153
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
154
+ # response.
155
+ #
156
+ def get(resource_group_name, job_collection_name, custom_headers = nil)
157
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
158
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
159
+ fail ArgumentError, 'job_collection_name is nil' if job_collection_name.nil?
160
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
161
+ request_headers = {}
162
+
163
+ # Set Headers
164
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
165
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
166
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}'
167
+ options = {
168
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
169
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name},
170
+ query_params: {'api-version' => @client.api_version},
171
+ headers: request_headers.merge(custom_headers || {})
172
+ }
173
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
174
+ promise = request.run_promise do |req|
175
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
176
+ end
177
+
178
+ promise = promise.then do |http_response|
179
+ status_code = http_response.status
180
+ response_content = http_response.body
181
+ unless status_code == 200
182
+ error_model = JSON.load(response_content)
183
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
184
+ end
185
+
186
+ # Create Result
187
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
188
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
189
+ # Deserialize Response
190
+ if status_code == 200
191
+ begin
192
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
193
+ unless parsed_response.nil?
194
+ parsed_response = JobCollectionDefinition.deserialize_object(parsed_response)
195
+ end
196
+ result.body = parsed_response
197
+ rescue Exception => e
198
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
199
+ end
200
+ end
201
+
202
+ result
203
+ end
204
+
205
+ promise.execute
206
+ end
207
+
208
+ #
209
+ # Provisions a new job collection or updates an existing job collection.
210
+ #
211
+ # @param resource_group_name [String] The resource group name.
212
+ # @param job_collection_name [String] The job collection name.
213
+ # @param job_collection [JobCollectionDefinition] The job collection
214
+ # definition.
215
+ # @param [Hash{String => String}] The hash of custom headers need to be
216
+ # applied to HTTP request.
217
+ #
218
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
219
+ # response.
220
+ #
221
+ def create_or_update(resource_group_name, job_collection_name, job_collection, custom_headers = nil)
222
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
223
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
224
+ fail ArgumentError, 'job_collection_name is nil' if job_collection_name.nil?
225
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
226
+ fail ArgumentError, 'job_collection is nil' if job_collection.nil?
227
+ job_collection.validate unless job_collection.nil?
228
+ request_headers = {}
229
+
230
+ # Set Headers
231
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
232
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
233
+
234
+ # Serialize Request
235
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
236
+ unless job_collection.nil?
237
+ job_collection = JobCollectionDefinition.serialize_object(job_collection)
238
+ end
239
+ request_content = JSON.generate(job_collection, quirks_mode: true)
240
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}'
241
+ options = {
242
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
243
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name},
244
+ query_params: {'api-version' => @client.api_version},
245
+ body: request_content,
246
+ headers: request_headers.merge(custom_headers || {})
247
+ }
248
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
249
+ promise = request.run_promise do |req|
250
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
251
+ end
252
+
253
+ promise = promise.then do |http_response|
254
+ status_code = http_response.status
255
+ response_content = http_response.body
256
+ unless status_code == 200 || status_code == 201
257
+ error_model = JSON.load(response_content)
258
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
259
+ end
260
+
261
+ # Create Result
262
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
263
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
264
+ # Deserialize Response
265
+ if status_code == 200
266
+ begin
267
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
268
+ unless parsed_response.nil?
269
+ parsed_response = JobCollectionDefinition.deserialize_object(parsed_response)
270
+ end
271
+ result.body = parsed_response
272
+ rescue Exception => e
273
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
274
+ end
275
+ end
276
+ # Deserialize Response
277
+ if status_code == 201
278
+ begin
279
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
280
+ unless parsed_response.nil?
281
+ parsed_response = JobCollectionDefinition.deserialize_object(parsed_response)
282
+ end
283
+ result.body = parsed_response
284
+ rescue Exception => e
285
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
286
+ end
287
+ end
288
+
289
+ result
290
+ end
291
+
292
+ promise.execute
293
+ end
294
+
295
+ #
296
+ # Patches an existing job collection.
297
+ #
298
+ # @param resource_group_name [String] The resource group name.
299
+ # @param job_collection_name [String] The job collection name.
300
+ # @param job_collection [JobCollectionDefinition] The job collection
301
+ # definition.
302
+ # @param [Hash{String => String}] The hash of custom headers need to be
303
+ # applied to HTTP request.
304
+ #
305
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
306
+ # response.
307
+ #
308
+ def patch(resource_group_name, job_collection_name, job_collection, custom_headers = nil)
309
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
310
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
311
+ fail ArgumentError, 'job_collection_name is nil' if job_collection_name.nil?
312
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
313
+ fail ArgumentError, 'job_collection is nil' if job_collection.nil?
314
+ job_collection.validate unless job_collection.nil?
315
+ request_headers = {}
316
+
317
+ # Set Headers
318
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
319
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
320
+
321
+ # Serialize Request
322
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
323
+ unless job_collection.nil?
324
+ job_collection = JobCollectionDefinition.serialize_object(job_collection)
325
+ end
326
+ request_content = JSON.generate(job_collection, quirks_mode: true)
327
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}'
328
+ options = {
329
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
330
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name},
331
+ query_params: {'api-version' => @client.api_version},
332
+ body: request_content,
333
+ headers: request_headers.merge(custom_headers || {})
334
+ }
335
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :patch, options)
336
+ promise = request.run_promise do |req|
337
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
338
+ end
339
+
340
+ promise = promise.then do |http_response|
341
+ status_code = http_response.status
342
+ response_content = http_response.body
343
+ unless status_code == 200
344
+ error_model = JSON.load(response_content)
345
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
346
+ end
347
+
348
+ # Create Result
349
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
350
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
351
+ # Deserialize Response
352
+ if status_code == 200
353
+ begin
354
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
355
+ unless parsed_response.nil?
356
+ parsed_response = JobCollectionDefinition.deserialize_object(parsed_response)
357
+ end
358
+ result.body = parsed_response
359
+ rescue Exception => e
360
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
361
+ end
362
+ end
363
+
364
+ result
365
+ end
366
+
367
+ promise.execute
368
+ end
369
+
370
+ #
371
+ # Deletes a job collection.
372
+ #
373
+ # @param resource_group_name [String] The resource group name.
374
+ # @param job_collection_name [String] The job collection name.
375
+ # @param [Hash{String => String}] The hash of custom headers need to be
376
+ # applied to HTTP request.
377
+ #
378
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
379
+ # response.
380
+ #
381
+ def delete(resource_group_name, job_collection_name, custom_headers = nil)
382
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
383
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
384
+ fail ArgumentError, 'job_collection_name is nil' if job_collection_name.nil?
385
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
386
+ request_headers = {}
387
+
388
+ # Set Headers
389
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
390
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
391
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}'
392
+ options = {
393
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
394
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name},
395
+ query_params: {'api-version' => @client.api_version},
396
+ headers: request_headers.merge(custom_headers || {})
397
+ }
398
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
399
+ promise = request.run_promise do |req|
400
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
401
+ end
402
+
403
+ promise = promise.then do |http_response|
404
+ status_code = http_response.status
405
+ response_content = http_response.body
406
+ unless status_code == 200
407
+ error_model = JSON.load(response_content)
408
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
409
+ end
410
+
411
+ # Create Result
412
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
413
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
414
+
415
+ result
416
+ end
417
+
418
+ promise.execute
419
+ end
420
+
421
+ #
422
+ # Enables all of the jobs in the job collection.
423
+ #
424
+ # @param resource_group_name [String] The resource group name.
425
+ # @param job_collection_name [String] The job collection name.
426
+ # @param [Hash{String => String}] The hash of custom headers need to be
427
+ # applied to HTTP request.
428
+ #
429
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
430
+ # response.
431
+ #
432
+ def enable(resource_group_name, job_collection_name, custom_headers = nil)
433
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
434
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
435
+ fail ArgumentError, 'job_collection_name is nil' if job_collection_name.nil?
436
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
437
+ request_headers = {}
438
+
439
+ # Set Headers
440
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
441
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
442
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/enable'
443
+ options = {
444
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
445
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name},
446
+ query_params: {'api-version' => @client.api_version},
447
+ headers: request_headers.merge(custom_headers || {})
448
+ }
449
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
450
+ promise = request.run_promise do |req|
451
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
452
+ end
453
+
454
+ promise = promise.then do |http_response|
455
+ status_code = http_response.status
456
+ response_content = http_response.body
457
+ unless status_code == 200
458
+ error_model = JSON.load(response_content)
459
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
460
+ end
461
+
462
+ # Create Result
463
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
464
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
465
+
466
+ result
467
+ end
468
+
469
+ promise.execute
470
+ end
471
+
472
+ #
473
+ # Disables all of the jobs in the job collection.
474
+ #
475
+ # @param resource_group_name [String] The resource group name.
476
+ # @param job_collection_name [String] The job collection name.
477
+ # @param [Hash{String => String}] The hash of custom headers need to be
478
+ # applied to HTTP request.
479
+ #
480
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
481
+ # response.
482
+ #
483
+ def disable(resource_group_name, job_collection_name, custom_headers = nil)
484
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
485
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
486
+ fail ArgumentError, 'job_collection_name is nil' if job_collection_name.nil?
487
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
488
+ request_headers = {}
489
+
490
+ # Set Headers
491
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
492
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
493
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/disable'
494
+ options = {
495
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
496
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobCollectionName' => job_collection_name},
497
+ query_params: {'api-version' => @client.api_version},
498
+ headers: request_headers.merge(custom_headers || {})
499
+ }
500
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
501
+ promise = request.run_promise do |req|
502
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
503
+ end
504
+
505
+ promise = promise.then do |http_response|
506
+ status_code = http_response.status
507
+ response_content = http_response.body
508
+ unless status_code == 200
509
+ error_model = JSON.load(response_content)
510
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
511
+ end
512
+
513
+ # Create Result
514
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
515
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
516
+
517
+ result
518
+ end
519
+
520
+ promise.execute
521
+ end
522
+
523
+ #
524
+ # Gets all job collections under specified subscription.
525
+ #
526
+ # @param next_page_link [String] The NextLink from the previous successful
527
+ # call to List operation.
528
+ # @param [Hash{String => String}] The hash of custom headers need to be
529
+ # applied to HTTP request.
530
+ #
531
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
532
+ # response.
533
+ #
534
+ def list_by_subscription_next(next_page_link, custom_headers = nil)
535
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
536
+ request_headers = {}
537
+
538
+ # Set Headers
539
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
540
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
541
+ path_template = '{nextLink}'
542
+ options = {
543
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
544
+ skip_encoding_path_params: {'nextLink' => next_page_link},
545
+ headers: request_headers.merge(custom_headers || {})
546
+ }
547
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
548
+ promise = request.run_promise do |req|
549
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
550
+ end
551
+
552
+ promise = promise.then do |http_response|
553
+ status_code = http_response.status
554
+ response_content = http_response.body
555
+ unless status_code == 200
556
+ error_model = JSON.load(response_content)
557
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
558
+ end
559
+
560
+ # Create Result
561
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
562
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
563
+ # Deserialize Response
564
+ if status_code == 200
565
+ begin
566
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
567
+ unless parsed_response.nil?
568
+ parsed_response = JobCollectionListResult.deserialize_object(parsed_response)
569
+ end
570
+ result.body = parsed_response
571
+ rescue Exception => e
572
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
573
+ end
574
+ end
575
+
576
+ result
577
+ end
578
+
579
+ promise.execute
580
+ end
581
+
582
+ #
583
+ # Gets all job collections under specified resource group.
584
+ #
585
+ # @param next_page_link [String] The NextLink from the previous successful
586
+ # call to List operation.
587
+ # @param [Hash{String => String}] The hash of custom headers need to be
588
+ # applied to HTTP request.
589
+ #
590
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
591
+ # response.
592
+ #
593
+ def list_by_resource_group_next(next_page_link, custom_headers = nil)
594
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
595
+ request_headers = {}
596
+
597
+ # Set Headers
598
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
599
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
600
+ path_template = '{nextLink}'
601
+ options = {
602
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
603
+ skip_encoding_path_params: {'nextLink' => next_page_link},
604
+ headers: request_headers.merge(custom_headers || {})
605
+ }
606
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
607
+ promise = request.run_promise do |req|
608
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
609
+ end
610
+
611
+ promise = promise.then do |http_response|
612
+ status_code = http_response.status
613
+ response_content = http_response.body
614
+ unless status_code == 200
615
+ error_model = JSON.load(response_content)
616
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
617
+ end
618
+
619
+ # Create Result
620
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
621
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
622
+ # Deserialize Response
623
+ if status_code == 200
624
+ begin
625
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
626
+ unless parsed_response.nil?
627
+ parsed_response = JobCollectionListResult.deserialize_object(parsed_response)
628
+ end
629
+ result.body = parsed_response
630
+ rescue Exception => e
631
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
632
+ end
633
+ end
634
+
635
+ result
636
+ end
637
+
638
+ promise.execute
639
+ end
640
+
641
+ end
642
+ end