azure_mgmt_automation 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/azure_mgmt_automation.rb +6 -0
  4. data/lib/generated/azure_mgmt_automation.rb +183 -0
  5. data/lib/generated/azure_mgmt_automation/activity_operations.rb +332 -0
  6. data/lib/generated/azure_mgmt_automation/agent_registration_information.rb +223 -0
  7. data/lib/generated/azure_mgmt_automation/automation_account_operations.rb +822 -0
  8. data/lib/generated/azure_mgmt_automation/automation_client.rb +245 -0
  9. data/lib/generated/azure_mgmt_automation/certificate_operations.rb +642 -0
  10. data/lib/generated/azure_mgmt_automation/connection_operations.rb +653 -0
  11. data/lib/generated/azure_mgmt_automation/connection_type_operations.rb +528 -0
  12. data/lib/generated/azure_mgmt_automation/credential_operations.rb +642 -0
  13. data/lib/generated/azure_mgmt_automation/dsc_compilation_job_operations.rb +534 -0
  14. data/lib/generated/azure_mgmt_automation/dsc_configuration_operations.rb +629 -0
  15. data/lib/generated/azure_mgmt_automation/dsc_node_configuration_operations.rb +532 -0
  16. data/lib/generated/azure_mgmt_automation/dsc_node_operations.rb +530 -0
  17. data/lib/generated/azure_mgmt_automation/fields.rb +124 -0
  18. data/lib/generated/azure_mgmt_automation/hybrid_runbook_worker_group_operations.rb +524 -0
  19. data/lib/generated/azure_mgmt_automation/job_operations.rb +888 -0
  20. data/lib/generated/azure_mgmt_automation/job_schedule_operations.rb +515 -0
  21. data/lib/generated/azure_mgmt_automation/job_stream_operations.rb +333 -0
  22. data/lib/generated/azure_mgmt_automation/models/activity.rb +133 -0
  23. data/lib/generated/azure_mgmt_automation/models/activity_list_result.rb +94 -0
  24. data/lib/generated/azure_mgmt_automation/models/activity_output_type.rb +54 -0
  25. data/lib/generated/azure_mgmt_automation/models/activity_parameter.rb +129 -0
  26. data/lib/generated/azure_mgmt_automation/models/activity_parameter_set.rb +63 -0
  27. data/lib/generated/azure_mgmt_automation/models/advanced_schedule.rb +89 -0
  28. data/lib/generated/azure_mgmt_automation/models/advanced_schedule_monthly_occurrence.rb +58 -0
  29. data/lib/generated/azure_mgmt_automation/models/agent_registration.rb +76 -0
  30. data/lib/generated/azure_mgmt_automation/models/agent_registration_key_name.rb +16 -0
  31. data/lib/generated/azure_mgmt_automation/models/agent_registration_keys.rb +54 -0
  32. data/lib/generated/azure_mgmt_automation/models/agent_registration_regenerate_key_parameter.rb +84 -0
  33. data/lib/generated/azure_mgmt_automation/models/automation_account.rb +154 -0
  34. data/lib/generated/azure_mgmt_automation/models/automation_account_create_or_update_parameters.rb +85 -0
  35. data/lib/generated/azure_mgmt_automation/models/automation_account_list_result.rb +94 -0
  36. data/lib/generated/azure_mgmt_automation/models/automation_account_state.rb +17 -0
  37. data/lib/generated/azure_mgmt_automation/models/automation_account_update_parameters.rb +83 -0
  38. data/lib/generated/azure_mgmt_automation/models/certificate.rb +121 -0
  39. data/lib/generated/azure_mgmt_automation/models/certificate_create_or_update_parameters.rb +87 -0
  40. data/lib/generated/azure_mgmt_automation/models/certificate_list_result.rb +94 -0
  41. data/lib/generated/azure_mgmt_automation/models/certificate_update_parameters.rb +54 -0
  42. data/lib/generated/azure_mgmt_automation/models/connection.rb +119 -0
  43. data/lib/generated/azure_mgmt_automation/models/connection_create_or_update_parameters.rb +84 -0
  44. data/lib/generated/azure_mgmt_automation/models/connection_list_result.rb +94 -0
  45. data/lib/generated/azure_mgmt_automation/models/connection_type.rb +118 -0
  46. data/lib/generated/azure_mgmt_automation/models/connection_type_association_property.rb +44 -0
  47. data/lib/generated/azure_mgmt_automation/models/connection_type_create_or_update_parameters.rb +75 -0
  48. data/lib/generated/azure_mgmt_automation/models/connection_type_list_result.rb +95 -0
  49. data/lib/generated/azure_mgmt_automation/models/connection_update_parameters.rb +72 -0
  50. data/lib/generated/azure_mgmt_automation/models/content_hash.rb +55 -0
  51. data/lib/generated/azure_mgmt_automation/models/content_link.rb +65 -0
  52. data/lib/generated/azure_mgmt_automation/models/content_source.rb +77 -0
  53. data/lib/generated/azure_mgmt_automation/models/content_source_type.rb +16 -0
  54. data/lib/generated/azure_mgmt_automation/models/credential.rb +98 -0
  55. data/lib/generated/azure_mgmt_automation/models/credential_create_or_update_parameters.rb +74 -0
  56. data/lib/generated/azure_mgmt_automation/models/credential_list_result.rb +94 -0
  57. data/lib/generated/azure_mgmt_automation/models/credential_update_parameters.rb +74 -0
  58. data/lib/generated/azure_mgmt_automation/models/dsc_compilation_job.rb +186 -0
  59. data/lib/generated/azure_mgmt_automation/models/dsc_compilation_job_create_parameters.rb +102 -0
  60. data/lib/generated/azure_mgmt_automation/models/dsc_compilation_job_list_result.rb +95 -0
  61. data/lib/generated/azure_mgmt_automation/models/dsc_configuration.rb +193 -0
  62. data/lib/generated/azure_mgmt_automation/models/dsc_configuration_association_property.rb +44 -0
  63. data/lib/generated/azure_mgmt_automation/models/dsc_configuration_create_or_update_parameters.rb +132 -0
  64. data/lib/generated/azure_mgmt_automation/models/dsc_configuration_list_result.rb +95 -0
  65. data/lib/generated/azure_mgmt_automation/models/dsc_configuration_parameter.rb +75 -0
  66. data/lib/generated/azure_mgmt_automation/models/dsc_configuration_provisioning_state.rb +15 -0
  67. data/lib/generated/azure_mgmt_automation/models/dsc_configuration_state.rb +17 -0
  68. data/lib/generated/azure_mgmt_automation/models/dsc_meta_configuration.rb +111 -0
  69. data/lib/generated/azure_mgmt_automation/models/dsc_node.rb +161 -0
  70. data/lib/generated/azure_mgmt_automation/models/dsc_node_configuration.rb +86 -0
  71. data/lib/generated/azure_mgmt_automation/models/dsc_node_configuration_association_property.rb +44 -0
  72. data/lib/generated/azure_mgmt_automation/models/dsc_node_configuration_create_or_update_parameters.rb +69 -0
  73. data/lib/generated/azure_mgmt_automation/models/dsc_node_configuration_list_result.rb +95 -0
  74. data/lib/generated/azure_mgmt_automation/models/dsc_node_list_result.rb +94 -0
  75. data/lib/generated/azure_mgmt_automation/models/dsc_node_report.rb +265 -0
  76. data/lib/generated/azure_mgmt_automation/models/dsc_node_report_list_result.rb +94 -0
  77. data/lib/generated/azure_mgmt_automation/models/dsc_node_update_parameters.rb +56 -0
  78. data/lib/generated/azure_mgmt_automation/models/dsc_report_error.rb +95 -0
  79. data/lib/generated/azure_mgmt_automation/models/dsc_report_resource.rb +143 -0
  80. data/lib/generated/azure_mgmt_automation/models/dsc_report_resource_navigation.rb +44 -0
  81. data/lib/generated/azure_mgmt_automation/models/error_response.rb +54 -0
  82. data/lib/generated/azure_mgmt_automation/models/field_definition.rb +67 -0
  83. data/lib/generated/azure_mgmt_automation/models/http_status_code.rb +61 -0
  84. data/lib/generated/azure_mgmt_automation/models/hybrid_runbook_worker.rb +65 -0
  85. data/lib/generated/azure_mgmt_automation/models/hybrid_runbook_worker_group.rb +85 -0
  86. data/lib/generated/azure_mgmt_automation/models/hybrid_runbook_worker_group_update_parameters.rb +46 -0
  87. data/lib/generated/azure_mgmt_automation/models/hybrid_runbook_worker_groups_list_result.rb +95 -0
  88. data/lib/generated/azure_mgmt_automation/models/job.rb +188 -0
  89. data/lib/generated/azure_mgmt_automation/models/job_create_parameters.rb +112 -0
  90. data/lib/generated/azure_mgmt_automation/models/job_list_result.rb +94 -0
  91. data/lib/generated/azure_mgmt_automation/models/job_schedule.rb +105 -0
  92. data/lib/generated/azure_mgmt_automation/models/job_schedule_create_parameters.rb +84 -0
  93. data/lib/generated/azure_mgmt_automation/models/job_schedule_list_result.rb +94 -0
  94. data/lib/generated/azure_mgmt_automation/models/job_status.rb +27 -0
  95. data/lib/generated/azure_mgmt_automation/models/job_stream.rb +113 -0
  96. data/lib/generated/azure_mgmt_automation/models/job_stream_list_result.rb +94 -0
  97. data/lib/generated/azure_mgmt_automation/models/job_stream_type.rb +21 -0
  98. data/lib/generated/azure_mgmt_automation/models/module_create_or_update_parameters.rb +83 -0
  99. data/lib/generated/azure_mgmt_automation/models/module_error_info.rb +54 -0
  100. data/lib/generated/azure_mgmt_automation/models/module_list_result.rb +94 -0
  101. data/lib/generated/azure_mgmt_automation/models/module_model.rb +198 -0
  102. data/lib/generated/azure_mgmt_automation/models/module_provisioning_state.rb +30 -0
  103. data/lib/generated/azure_mgmt_automation/models/module_update_parameters.rb +83 -0
  104. data/lib/generated/azure_mgmt_automation/models/operation.rb +55 -0
  105. data/lib/generated/azure_mgmt_automation/models/operation_display.rb +65 -0
  106. data/lib/generated/azure_mgmt_automation/models/operation_list_result.rb +53 -0
  107. data/lib/generated/azure_mgmt_automation/models/resource.rb +94 -0
  108. data/lib/generated/azure_mgmt_automation/models/run_as_credential_association_property.rb +44 -0
  109. data/lib/generated/azure_mgmt_automation/models/runbook.rb +263 -0
  110. data/lib/generated/azure_mgmt_automation/models/runbook_association_property.rb +44 -0
  111. data/lib/generated/azure_mgmt_automation/models/runbook_create_or_update_draft_parameters.rb +44 -0
  112. data/lib/generated/azure_mgmt_automation/models/runbook_create_or_update_draft_properties.rb +99 -0
  113. data/lib/generated/azure_mgmt_automation/models/runbook_create_or_update_parameters.rb +147 -0
  114. data/lib/generated/azure_mgmt_automation/models/runbook_draft.rb +112 -0
  115. data/lib/generated/azure_mgmt_automation/models/runbook_draft_undo_edit_result.rb +68 -0
  116. data/lib/generated/azure_mgmt_automation/models/runbook_list_result.rb +94 -0
  117. data/lib/generated/azure_mgmt_automation/models/runbook_parameter.rb +75 -0
  118. data/lib/generated/azure_mgmt_automation/models/runbook_provisioning_state.rb +15 -0
  119. data/lib/generated/azure_mgmt_automation/models/runbook_state.rb +17 -0
  120. data/lib/generated/azure_mgmt_automation/models/runbook_type_enum.rb +20 -0
  121. data/lib/generated/azure_mgmt_automation/models/runbook_update_parameters.rb +113 -0
  122. data/lib/generated/azure_mgmt_automation/models/schedule.rb +199 -0
  123. data/lib/generated/azure_mgmt_automation/models/schedule_association_property.rb +44 -0
  124. data/lib/generated/azure_mgmt_automation/models/schedule_create_or_update_parameters.rb +116 -0
  125. data/lib/generated/azure_mgmt_automation/models/schedule_day.rb +21 -0
  126. data/lib/generated/azure_mgmt_automation/models/schedule_frequency.rb +19 -0
  127. data/lib/generated/azure_mgmt_automation/models/schedule_list_result.rb +94 -0
  128. data/lib/generated/azure_mgmt_automation/models/schedule_update_parameters.rb +65 -0
  129. data/lib/generated/azure_mgmt_automation/models/sku.rb +65 -0
  130. data/lib/generated/azure_mgmt_automation/models/sku_name_enum.rb +16 -0
  131. data/lib/generated/azure_mgmt_automation/models/statistics.rb +89 -0
  132. data/lib/generated/azure_mgmt_automation/models/statistics_list_result.rb +52 -0
  133. data/lib/generated/azure_mgmt_automation/models/sub_resource.rb +44 -0
  134. data/lib/generated/azure_mgmt_automation/models/test_job.rb +144 -0
  135. data/lib/generated/azure_mgmt_automation/models/test_job_create_parameters.rb +73 -0
  136. data/lib/generated/azure_mgmt_automation/models/type_field.rb +54 -0
  137. data/lib/generated/azure_mgmt_automation/models/type_field_list_result.rb +52 -0
  138. data/lib/generated/azure_mgmt_automation/models/usage.rb +95 -0
  139. data/lib/generated/azure_mgmt_automation/models/usage_counter_name.rb +54 -0
  140. data/lib/generated/azure_mgmt_automation/models/usage_list_result.rb +52 -0
  141. data/lib/generated/azure_mgmt_automation/models/variable.rb +104 -0
  142. data/lib/generated/azure_mgmt_automation/models/variable_create_or_update_parameters.rb +74 -0
  143. data/lib/generated/azure_mgmt_automation/models/variable_list_result.rb +94 -0
  144. data/lib/generated/azure_mgmt_automation/models/variable_update_parameters.rb +64 -0
  145. data/lib/generated/azure_mgmt_automation/models/webhook.rb +168 -0
  146. data/lib/generated/azure_mgmt_automation/models/webhook_create_or_update_parameters.rb +115 -0
  147. data/lib/generated/azure_mgmt_automation/models/webhook_list_result.rb +94 -0
  148. data/lib/generated/azure_mgmt_automation/models/webhook_update_parameters.rb +94 -0
  149. data/lib/generated/azure_mgmt_automation/module_definition.rb +8 -0
  150. data/lib/generated/azure_mgmt_automation/module_model_operations.rb +633 -0
  151. data/lib/generated/azure_mgmt_automation/node_reports.rb +438 -0
  152. data/lib/generated/azure_mgmt_automation/object_data_types.rb +219 -0
  153. data/lib/generated/azure_mgmt_automation/operations.rb +106 -0
  154. data/lib/generated/azure_mgmt_automation/runbook_draft_operations.rb +605 -0
  155. data/lib/generated/azure_mgmt_automation/runbook_operations.rb +719 -0
  156. data/lib/generated/azure_mgmt_automation/schedule_operations.rb +626 -0
  157. data/lib/generated/azure_mgmt_automation/statistics_operations.rb +119 -0
  158. data/lib/generated/azure_mgmt_automation/test_job_streams.rb +333 -0
  159. data/lib/generated/azure_mgmt_automation/test_jobs.rb +486 -0
  160. data/lib/generated/azure_mgmt_automation/usages.rb +116 -0
  161. data/lib/generated/azure_mgmt_automation/variable_operations.rb +636 -0
  162. data/lib/generated/azure_mgmt_automation/version.rb +8 -0
  163. data/lib/generated/azure_mgmt_automation/webhook_operations.rb +737 -0
  164. metadata +275 -0
@@ -0,0 +1,626 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Automation
7
+ #
8
+ # Automation Client
9
+ #
10
+ class ScheduleOperations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ScheduleOperations class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [AutomationClient] reference to the AutomationClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Create a schedule.
26
+ #
27
+ # @param resource_group_name [String] The resource group name.
28
+ # @param automation_account_name [String] The automation account name.
29
+ # @param schedule_name [String] The schedule name.
30
+ # @param parameters [ScheduleCreateOrUpdateParameters] The parameters supplied
31
+ # to the create or update schedule operation.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [Schedule] operation results.
36
+ #
37
+ def create_or_update(resource_group_name, automation_account_name, schedule_name, parameters, custom_headers = nil)
38
+ response = create_or_update_async(resource_group_name, automation_account_name, schedule_name, parameters, custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # Create a schedule.
44
+ #
45
+ # @param resource_group_name [String] The resource group name.
46
+ # @param automation_account_name [String] The automation account name.
47
+ # @param schedule_name [String] The schedule name.
48
+ # @param parameters [ScheduleCreateOrUpdateParameters] The parameters supplied
49
+ # to the create or update schedule operation.
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
54
+ #
55
+ def create_or_update_with_http_info(resource_group_name, automation_account_name, schedule_name, parameters, custom_headers = nil)
56
+ create_or_update_async(resource_group_name, automation_account_name, schedule_name, parameters, custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # Create a schedule.
61
+ #
62
+ # @param resource_group_name [String] The resource group name.
63
+ # @param automation_account_name [String] The automation account name.
64
+ # @param schedule_name [String] The schedule name.
65
+ # @param parameters [ScheduleCreateOrUpdateParameters] The parameters supplied
66
+ # to the create or update schedule operation.
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def create_or_update_async(resource_group_name, automation_account_name, schedule_name, parameters, custom_headers = nil)
73
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
74
+ fail ArgumentError, 'automation_account_name is nil' if automation_account_name.nil?
75
+ fail ArgumentError, 'schedule_name is nil' if schedule_name.nil?
76
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
77
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
78
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
79
+
80
+
81
+ request_headers = {}
82
+
83
+ # Set Headers
84
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
85
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
86
+
87
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
88
+
89
+ # Serialize Request
90
+ request_mapper = Azure::ARM::Automation::Models::ScheduleCreateOrUpdateParameters.mapper()
91
+ request_content = @client.serialize(request_mapper, parameters)
92
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
93
+
94
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}'
95
+
96
+ request_url = @base_url || @client.base_url
97
+
98
+ options = {
99
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
100
+ path_params: {'resourceGroupName' => resource_group_name,'automationAccountName' => automation_account_name,'scheduleName' => schedule_name,'subscriptionId' => @client.subscription_id},
101
+ query_params: {'api-version' => @client.api_version},
102
+ body: request_content,
103
+ headers: request_headers.merge(custom_headers || {}),
104
+ base_url: request_url
105
+ }
106
+ promise = @client.make_request_async(:put, path_template, options)
107
+
108
+ promise = promise.then do |result|
109
+ http_response = result.response
110
+ status_code = http_response.status
111
+ response_content = http_response.body
112
+ unless status_code == 201 || status_code == 409
113
+ error_model = JSON.load(response_content)
114
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
115
+ end
116
+
117
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
118
+ # Deserialize Response
119
+ if status_code == 201
120
+ begin
121
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
122
+ result_mapper = Azure::ARM::Automation::Models::Schedule.mapper()
123
+ result.body = @client.deserialize(result_mapper, parsed_response)
124
+ rescue Exception => e
125
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
126
+ end
127
+ end
128
+
129
+ result
130
+ end
131
+
132
+ promise.execute
133
+ end
134
+
135
+ #
136
+ # Update the schedule identified by schedule name.
137
+ #
138
+ # @param resource_group_name [String] The resource group name.
139
+ # @param automation_account_name [String] The automation account name.
140
+ # @param schedule_name [String] The schedule name.
141
+ # @param parameters [ScheduleUpdateParameters] The parameters supplied to the
142
+ # update schedule operation.
143
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
144
+ # will be added to the HTTP request.
145
+ #
146
+ # @return [Schedule] operation results.
147
+ #
148
+ def update(resource_group_name, automation_account_name, schedule_name, parameters, custom_headers = nil)
149
+ response = update_async(resource_group_name, automation_account_name, schedule_name, parameters, custom_headers).value!
150
+ response.body unless response.nil?
151
+ end
152
+
153
+ #
154
+ # Update the schedule identified by schedule name.
155
+ #
156
+ # @param resource_group_name [String] The resource group name.
157
+ # @param automation_account_name [String] The automation account name.
158
+ # @param schedule_name [String] The schedule name.
159
+ # @param parameters [ScheduleUpdateParameters] The parameters supplied to the
160
+ # update schedule operation.
161
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
162
+ # will be added to the HTTP request.
163
+ #
164
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
165
+ #
166
+ def update_with_http_info(resource_group_name, automation_account_name, schedule_name, parameters, custom_headers = nil)
167
+ update_async(resource_group_name, automation_account_name, schedule_name, parameters, custom_headers).value!
168
+ end
169
+
170
+ #
171
+ # Update the schedule identified by schedule name.
172
+ #
173
+ # @param resource_group_name [String] The resource group name.
174
+ # @param automation_account_name [String] The automation account name.
175
+ # @param schedule_name [String] The schedule name.
176
+ # @param parameters [ScheduleUpdateParameters] The parameters supplied to the
177
+ # update schedule operation.
178
+ # @param [Hash{String => String}] A hash of custom headers that will be added
179
+ # to the HTTP request.
180
+ #
181
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
182
+ #
183
+ def update_async(resource_group_name, automation_account_name, schedule_name, parameters, custom_headers = nil)
184
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
185
+ fail ArgumentError, 'automation_account_name is nil' if automation_account_name.nil?
186
+ fail ArgumentError, 'schedule_name is nil' if schedule_name.nil?
187
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
188
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
189
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
190
+
191
+
192
+ request_headers = {}
193
+
194
+ # Set Headers
195
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
196
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
197
+
198
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
199
+
200
+ # Serialize Request
201
+ request_mapper = Azure::ARM::Automation::Models::ScheduleUpdateParameters.mapper()
202
+ request_content = @client.serialize(request_mapper, parameters)
203
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
204
+
205
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}'
206
+
207
+ request_url = @base_url || @client.base_url
208
+
209
+ options = {
210
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
211
+ path_params: {'resourceGroupName' => resource_group_name,'automationAccountName' => automation_account_name,'scheduleName' => schedule_name,'subscriptionId' => @client.subscription_id},
212
+ query_params: {'api-version' => @client.api_version},
213
+ body: request_content,
214
+ headers: request_headers.merge(custom_headers || {}),
215
+ base_url: request_url
216
+ }
217
+ promise = @client.make_request_async(:patch, path_template, options)
218
+
219
+ promise = promise.then do |result|
220
+ http_response = result.response
221
+ status_code = http_response.status
222
+ response_content = http_response.body
223
+ unless status_code == 200
224
+ error_model = JSON.load(response_content)
225
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
226
+ end
227
+
228
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
229
+ # Deserialize Response
230
+ if status_code == 200
231
+ begin
232
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
233
+ result_mapper = Azure::ARM::Automation::Models::Schedule.mapper()
234
+ result.body = @client.deserialize(result_mapper, parsed_response)
235
+ rescue Exception => e
236
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
237
+ end
238
+ end
239
+
240
+ result
241
+ end
242
+
243
+ promise.execute
244
+ end
245
+
246
+ #
247
+ # Retrieve the schedule identified by schedule name.
248
+ #
249
+ # @param resource_group_name [String] The resource group name.
250
+ # @param automation_account_name [String] The automation account name.
251
+ # @param schedule_name [String] The schedule name.
252
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
253
+ # will be added to the HTTP request.
254
+ #
255
+ # @return [Schedule] operation results.
256
+ #
257
+ def get(resource_group_name, automation_account_name, schedule_name, custom_headers = nil)
258
+ response = get_async(resource_group_name, automation_account_name, schedule_name, custom_headers).value!
259
+ response.body unless response.nil?
260
+ end
261
+
262
+ #
263
+ # Retrieve the schedule identified by schedule name.
264
+ #
265
+ # @param resource_group_name [String] The resource group name.
266
+ # @param automation_account_name [String] The automation account name.
267
+ # @param schedule_name [String] The schedule name.
268
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
269
+ # will be added to the HTTP request.
270
+ #
271
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
272
+ #
273
+ def get_with_http_info(resource_group_name, automation_account_name, schedule_name, custom_headers = nil)
274
+ get_async(resource_group_name, automation_account_name, schedule_name, custom_headers).value!
275
+ end
276
+
277
+ #
278
+ # Retrieve the schedule identified by schedule name.
279
+ #
280
+ # @param resource_group_name [String] The resource group name.
281
+ # @param automation_account_name [String] The automation account name.
282
+ # @param schedule_name [String] The schedule name.
283
+ # @param [Hash{String => String}] A hash of custom headers that will be added
284
+ # to the HTTP request.
285
+ #
286
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
287
+ #
288
+ def get_async(resource_group_name, automation_account_name, schedule_name, custom_headers = nil)
289
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
290
+ fail ArgumentError, 'automation_account_name is nil' if automation_account_name.nil?
291
+ fail ArgumentError, 'schedule_name is nil' if schedule_name.nil?
292
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
293
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
294
+
295
+
296
+ request_headers = {}
297
+
298
+ # Set Headers
299
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
300
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
301
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}'
302
+
303
+ request_url = @base_url || @client.base_url
304
+
305
+ options = {
306
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
307
+ path_params: {'resourceGroupName' => resource_group_name,'automationAccountName' => automation_account_name,'scheduleName' => schedule_name,'subscriptionId' => @client.subscription_id},
308
+ query_params: {'api-version' => @client.api_version},
309
+ headers: request_headers.merge(custom_headers || {}),
310
+ base_url: request_url
311
+ }
312
+ promise = @client.make_request_async(:get, path_template, options)
313
+
314
+ promise = promise.then do |result|
315
+ http_response = result.response
316
+ status_code = http_response.status
317
+ response_content = http_response.body
318
+ unless status_code == 200
319
+ error_model = JSON.load(response_content)
320
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
321
+ end
322
+
323
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
324
+ # Deserialize Response
325
+ if status_code == 200
326
+ begin
327
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
328
+ result_mapper = Azure::ARM::Automation::Models::Schedule.mapper()
329
+ result.body = @client.deserialize(result_mapper, parsed_response)
330
+ rescue Exception => e
331
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
332
+ end
333
+ end
334
+
335
+ result
336
+ end
337
+
338
+ promise.execute
339
+ end
340
+
341
+ #
342
+ # Delete the schedule identified by schedule name.
343
+ #
344
+ # @param resource_group_name [String] The resource group name.
345
+ # @param automation_account_name [String] The automation account name.
346
+ # @param schedule_name [String] The schedule name.
347
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
348
+ # will be added to the HTTP request.
349
+ #
350
+ #
351
+ def delete(resource_group_name, automation_account_name, schedule_name, custom_headers = nil)
352
+ response = delete_async(resource_group_name, automation_account_name, schedule_name, custom_headers).value!
353
+ nil
354
+ end
355
+
356
+ #
357
+ # Delete the schedule identified by schedule name.
358
+ #
359
+ # @param resource_group_name [String] The resource group name.
360
+ # @param automation_account_name [String] The automation account name.
361
+ # @param schedule_name [String] The schedule name.
362
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
363
+ # will be added to the HTTP request.
364
+ #
365
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
366
+ #
367
+ def delete_with_http_info(resource_group_name, automation_account_name, schedule_name, custom_headers = nil)
368
+ delete_async(resource_group_name, automation_account_name, schedule_name, custom_headers).value!
369
+ end
370
+
371
+ #
372
+ # Delete the schedule identified by schedule name.
373
+ #
374
+ # @param resource_group_name [String] The resource group name.
375
+ # @param automation_account_name [String] The automation account name.
376
+ # @param schedule_name [String] The schedule name.
377
+ # @param [Hash{String => String}] A hash of custom headers that will be added
378
+ # to the HTTP request.
379
+ #
380
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
381
+ #
382
+ def delete_async(resource_group_name, automation_account_name, schedule_name, custom_headers = nil)
383
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
384
+ fail ArgumentError, 'automation_account_name is nil' if automation_account_name.nil?
385
+ fail ArgumentError, 'schedule_name is nil' if schedule_name.nil?
386
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
387
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
388
+
389
+
390
+ request_headers = {}
391
+
392
+ # Set Headers
393
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
394
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
395
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}'
396
+
397
+ request_url = @base_url || @client.base_url
398
+
399
+ options = {
400
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
401
+ path_params: {'resourceGroupName' => resource_group_name,'automationAccountName' => automation_account_name,'scheduleName' => schedule_name,'subscriptionId' => @client.subscription_id},
402
+ query_params: {'api-version' => @client.api_version},
403
+ headers: request_headers.merge(custom_headers || {}),
404
+ base_url: request_url
405
+ }
406
+ promise = @client.make_request_async(:delete, path_template, options)
407
+
408
+ promise = promise.then do |result|
409
+ http_response = result.response
410
+ status_code = http_response.status
411
+ response_content = http_response.body
412
+ unless status_code == 200 || status_code == 404
413
+ error_model = JSON.load(response_content)
414
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
415
+ end
416
+
417
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
418
+
419
+ result
420
+ end
421
+
422
+ promise.execute
423
+ end
424
+
425
+ #
426
+ # Retrieve a list of schedules.
427
+ #
428
+ # @param resource_group_name [String] The resource group name.
429
+ # @param automation_account_name [String] The automation account name.
430
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
431
+ # will be added to the HTTP request.
432
+ #
433
+ # @return [Array<Schedule>] operation results.
434
+ #
435
+ def list_by_automation_account(resource_group_name, automation_account_name, custom_headers = nil)
436
+ first_page = list_by_automation_account_as_lazy(resource_group_name, automation_account_name, custom_headers)
437
+ first_page.get_all_items
438
+ end
439
+
440
+ #
441
+ # Retrieve a list of schedules.
442
+ #
443
+ # @param resource_group_name [String] The resource group name.
444
+ # @param automation_account_name [String] The automation account name.
445
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
446
+ # will be added to the HTTP request.
447
+ #
448
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
449
+ #
450
+ def list_by_automation_account_with_http_info(resource_group_name, automation_account_name, custom_headers = nil)
451
+ list_by_automation_account_async(resource_group_name, automation_account_name, custom_headers).value!
452
+ end
453
+
454
+ #
455
+ # Retrieve a list of schedules.
456
+ #
457
+ # @param resource_group_name [String] The resource group name.
458
+ # @param automation_account_name [String] The automation account name.
459
+ # @param [Hash{String => String}] A hash of custom headers that will be added
460
+ # to the HTTP request.
461
+ #
462
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
463
+ #
464
+ def list_by_automation_account_async(resource_group_name, automation_account_name, custom_headers = nil)
465
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
466
+ fail ArgumentError, 'automation_account_name is nil' if automation_account_name.nil?
467
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
468
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
469
+
470
+
471
+ request_headers = {}
472
+
473
+ # Set Headers
474
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
475
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
476
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules'
477
+
478
+ request_url = @base_url || @client.base_url
479
+
480
+ options = {
481
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
482
+ path_params: {'resourceGroupName' => resource_group_name,'automationAccountName' => automation_account_name,'subscriptionId' => @client.subscription_id},
483
+ query_params: {'api-version' => @client.api_version},
484
+ headers: request_headers.merge(custom_headers || {}),
485
+ base_url: request_url
486
+ }
487
+ promise = @client.make_request_async(:get, path_template, options)
488
+
489
+ promise = promise.then do |result|
490
+ http_response = result.response
491
+ status_code = http_response.status
492
+ response_content = http_response.body
493
+ unless status_code == 200
494
+ error_model = JSON.load(response_content)
495
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
496
+ end
497
+
498
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
499
+ # Deserialize Response
500
+ if status_code == 200
501
+ begin
502
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
503
+ result_mapper = Azure::ARM::Automation::Models::ScheduleListResult.mapper()
504
+ result.body = @client.deserialize(result_mapper, parsed_response)
505
+ rescue Exception => e
506
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
507
+ end
508
+ end
509
+
510
+ result
511
+ end
512
+
513
+ promise.execute
514
+ end
515
+
516
+ #
517
+ # Retrieve a list of schedules.
518
+ #
519
+ # @param next_page_link [String] The NextLink from the previous successful call
520
+ # to List operation.
521
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
522
+ # will be added to the HTTP request.
523
+ #
524
+ # @return [ScheduleListResult] operation results.
525
+ #
526
+ def list_by_automation_account_next(next_page_link, custom_headers = nil)
527
+ response = list_by_automation_account_next_async(next_page_link, custom_headers).value!
528
+ response.body unless response.nil?
529
+ end
530
+
531
+ #
532
+ # Retrieve a list of schedules.
533
+ #
534
+ # @param next_page_link [String] The NextLink from the previous successful call
535
+ # to List operation.
536
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
537
+ # will be added to the HTTP request.
538
+ #
539
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
540
+ #
541
+ def list_by_automation_account_next_with_http_info(next_page_link, custom_headers = nil)
542
+ list_by_automation_account_next_async(next_page_link, custom_headers).value!
543
+ end
544
+
545
+ #
546
+ # Retrieve a list of schedules.
547
+ #
548
+ # @param next_page_link [String] The NextLink from the previous successful call
549
+ # to List operation.
550
+ # @param [Hash{String => String}] A hash of custom headers that will be added
551
+ # to the HTTP request.
552
+ #
553
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
554
+ #
555
+ def list_by_automation_account_next_async(next_page_link, custom_headers = nil)
556
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
557
+
558
+
559
+ request_headers = {}
560
+
561
+ # Set Headers
562
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
563
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
564
+ path_template = '{nextLink}'
565
+
566
+ request_url = @base_url || @client.base_url
567
+
568
+ options = {
569
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
570
+ skip_encoding_path_params: {'nextLink' => next_page_link},
571
+ headers: request_headers.merge(custom_headers || {}),
572
+ base_url: request_url
573
+ }
574
+ promise = @client.make_request_async(:get, path_template, options)
575
+
576
+ promise = promise.then do |result|
577
+ http_response = result.response
578
+ status_code = http_response.status
579
+ response_content = http_response.body
580
+ unless status_code == 200
581
+ error_model = JSON.load(response_content)
582
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
583
+ end
584
+
585
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
586
+ # Deserialize Response
587
+ if status_code == 200
588
+ begin
589
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
590
+ result_mapper = Azure::ARM::Automation::Models::ScheduleListResult.mapper()
591
+ result.body = @client.deserialize(result_mapper, parsed_response)
592
+ rescue Exception => e
593
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
594
+ end
595
+ end
596
+
597
+ result
598
+ end
599
+
600
+ promise.execute
601
+ end
602
+
603
+ #
604
+ # Retrieve a list of schedules.
605
+ #
606
+ # @param resource_group_name [String] The resource group name.
607
+ # @param automation_account_name [String] The automation account name.
608
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
609
+ # will be added to the HTTP request.
610
+ #
611
+ # @return [ScheduleListResult] which provide lazy access to pages of the
612
+ # response.
613
+ #
614
+ def list_by_automation_account_as_lazy(resource_group_name, automation_account_name, custom_headers = nil)
615
+ response = list_by_automation_account_async(resource_group_name, automation_account_name, custom_headers).value!
616
+ unless response.nil?
617
+ page = response.body
618
+ page.next_method = Proc.new do |next_page_link|
619
+ list_by_automation_account_next_async(next_page_link, custom_headers)
620
+ end
621
+ page
622
+ end
623
+ end
624
+
625
+ end
626
+ end