azure_mgmt_automation 0.14.0

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 (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,719 @@
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 RunbookOperations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the RunbookOperations 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
+ # Retrieve the content of runbook identified by runbook name.
26
+ #
27
+ # @param resource_group_name [String] The resource group name.
28
+ # @param automation_account_name [String] The automation account name.
29
+ # @param runbook_name [String] The runbook name.
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [NOT_IMPLEMENTED] operation results.
34
+ #
35
+ def get_content(resource_group_name, automation_account_name, runbook_name, custom_headers = nil)
36
+ response = get_content_async(resource_group_name, automation_account_name, runbook_name, custom_headers).value!
37
+ response.body unless response.nil?
38
+ end
39
+
40
+ #
41
+ # Retrieve the content of runbook identified by runbook name.
42
+ #
43
+ # @param resource_group_name [String] The resource group name.
44
+ # @param automation_account_name [String] The automation account name.
45
+ # @param runbook_name [String] The runbook name.
46
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
47
+ # will be added to the HTTP request.
48
+ #
49
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
50
+ #
51
+ def get_content_with_http_info(resource_group_name, automation_account_name, runbook_name, custom_headers = nil)
52
+ get_content_async(resource_group_name, automation_account_name, runbook_name, custom_headers).value!
53
+ end
54
+
55
+ #
56
+ # Retrieve the content of runbook identified by runbook name.
57
+ #
58
+ # @param resource_group_name [String] The resource group name.
59
+ # @param automation_account_name [String] The automation account name.
60
+ # @param runbook_name [String] The runbook name.
61
+ # @param [Hash{String => String}] A hash of custom headers that will be added
62
+ # to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
+ #
66
+ def get_content_async(resource_group_name, automation_account_name, runbook_name, custom_headers = nil)
67
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
68
+ fail ArgumentError, 'automation_account_name is nil' if automation_account_name.nil?
69
+ fail ArgumentError, 'runbook_name is nil' if runbook_name.nil?
70
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
71
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
72
+
73
+
74
+ request_headers = {}
75
+
76
+ # Set Headers
77
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
78
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
79
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/content'
80
+
81
+ request_url = @base_url || @client.base_url
82
+
83
+ options = {
84
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
85
+ path_params: {'resourceGroupName' => resource_group_name,'automationAccountName' => automation_account_name,'runbookName' => runbook_name,'subscriptionId' => @client.subscription_id},
86
+ query_params: {'api-version' => @client.api_version},
87
+ headers: request_headers.merge(custom_headers || {}),
88
+ base_url: request_url
89
+ }
90
+ promise = @client.make_request_async(:get, path_template, options)
91
+
92
+ promise = promise.then do |result|
93
+ http_response = result.response
94
+ status_code = http_response.status
95
+ response_content = http_response.body
96
+ unless status_code == 200
97
+ error_model = JSON.load(response_content)
98
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
99
+ end
100
+
101
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
102
+ # Deserialize Response
103
+ if status_code == 200
104
+ begin
105
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
106
+ result_mapper = {
107
+ required: false,
108
+ serialized_name: 'parsed_response',
109
+ type: {
110
+ name: 'Stream'
111
+ }
112
+ }
113
+ result.body = @client.deserialize(result_mapper, parsed_response)
114
+ rescue Exception => e
115
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
116
+ end
117
+ end
118
+
119
+ result
120
+ end
121
+
122
+ promise.execute
123
+ end
124
+
125
+ #
126
+ # Retrieve the runbook identified by runbook name.
127
+ #
128
+ # @param resource_group_name [String] The resource group name.
129
+ # @param automation_account_name [String] The automation account name.
130
+ # @param runbook_name [String] The runbook name.
131
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
132
+ # will be added to the HTTP request.
133
+ #
134
+ # @return [Runbook] operation results.
135
+ #
136
+ def get(resource_group_name, automation_account_name, runbook_name, custom_headers = nil)
137
+ response = get_async(resource_group_name, automation_account_name, runbook_name, custom_headers).value!
138
+ response.body unless response.nil?
139
+ end
140
+
141
+ #
142
+ # Retrieve the runbook identified by runbook name.
143
+ #
144
+ # @param resource_group_name [String] The resource group name.
145
+ # @param automation_account_name [String] The automation account name.
146
+ # @param runbook_name [String] The runbook name.
147
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
148
+ # will be added to the HTTP request.
149
+ #
150
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
151
+ #
152
+ def get_with_http_info(resource_group_name, automation_account_name, runbook_name, custom_headers = nil)
153
+ get_async(resource_group_name, automation_account_name, runbook_name, custom_headers).value!
154
+ end
155
+
156
+ #
157
+ # Retrieve the runbook identified by runbook name.
158
+ #
159
+ # @param resource_group_name [String] The resource group name.
160
+ # @param automation_account_name [String] The automation account name.
161
+ # @param runbook_name [String] The runbook name.
162
+ # @param [Hash{String => String}] A hash of custom headers that will be added
163
+ # to the HTTP request.
164
+ #
165
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
166
+ #
167
+ def get_async(resource_group_name, automation_account_name, runbook_name, custom_headers = nil)
168
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
169
+ fail ArgumentError, 'automation_account_name is nil' if automation_account_name.nil?
170
+ fail ArgumentError, 'runbook_name is nil' if runbook_name.nil?
171
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
172
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
173
+
174
+
175
+ request_headers = {}
176
+
177
+ # Set Headers
178
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
179
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
180
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}'
181
+
182
+ request_url = @base_url || @client.base_url
183
+
184
+ options = {
185
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
186
+ path_params: {'resourceGroupName' => resource_group_name,'automationAccountName' => automation_account_name,'runbookName' => runbook_name,'subscriptionId' => @client.subscription_id},
187
+ query_params: {'api-version' => @client.api_version},
188
+ headers: request_headers.merge(custom_headers || {}),
189
+ base_url: request_url
190
+ }
191
+ promise = @client.make_request_async(:get, path_template, options)
192
+
193
+ promise = promise.then do |result|
194
+ http_response = result.response
195
+ status_code = http_response.status
196
+ response_content = http_response.body
197
+ unless status_code == 200
198
+ error_model = JSON.load(response_content)
199
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
200
+ end
201
+
202
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
203
+ # Deserialize Response
204
+ if status_code == 200
205
+ begin
206
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
207
+ result_mapper = Azure::ARM::Automation::Models::Runbook.mapper()
208
+ result.body = @client.deserialize(result_mapper, parsed_response)
209
+ rescue Exception => e
210
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
211
+ end
212
+ end
213
+
214
+ result
215
+ end
216
+
217
+ promise.execute
218
+ end
219
+
220
+ #
221
+ # Create the runbook identified by runbook name.
222
+ #
223
+ # @param resource_group_name [String] The resource group name.
224
+ # @param automation_account_name [String] The automation account name.
225
+ # @param runbook_name [String] The runbook name.
226
+ # @param parameters [RunbookCreateOrUpdateParameters] The create or update
227
+ # parameters for runbook. Provide either content link for a published runbook
228
+ # or draft, not both.
229
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
230
+ # will be added to the HTTP request.
231
+ #
232
+ #
233
+ def create_or_update(resource_group_name, automation_account_name, runbook_name, parameters, custom_headers = nil)
234
+ response = create_or_update_async(resource_group_name, automation_account_name, runbook_name, parameters, custom_headers).value!
235
+ nil
236
+ end
237
+
238
+ #
239
+ # Create the runbook identified by runbook name.
240
+ #
241
+ # @param resource_group_name [String] The resource group name.
242
+ # @param automation_account_name [String] The automation account name.
243
+ # @param runbook_name [String] The runbook name.
244
+ # @param parameters [RunbookCreateOrUpdateParameters] The create or update
245
+ # parameters for runbook. Provide either content link for a published runbook
246
+ # or draft, not both.
247
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
248
+ # will be added to the HTTP request.
249
+ #
250
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
251
+ #
252
+ def create_or_update_with_http_info(resource_group_name, automation_account_name, runbook_name, parameters, custom_headers = nil)
253
+ create_or_update_async(resource_group_name, automation_account_name, runbook_name, parameters, custom_headers).value!
254
+ end
255
+
256
+ #
257
+ # Create the runbook identified by runbook name.
258
+ #
259
+ # @param resource_group_name [String] The resource group name.
260
+ # @param automation_account_name [String] The automation account name.
261
+ # @param runbook_name [String] The runbook name.
262
+ # @param parameters [RunbookCreateOrUpdateParameters] The create or update
263
+ # parameters for runbook. Provide either content link for a published runbook
264
+ # or draft, not both.
265
+ # @param [Hash{String => String}] A hash of custom headers that will be added
266
+ # to the HTTP request.
267
+ #
268
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
269
+ #
270
+ def create_or_update_async(resource_group_name, automation_account_name, runbook_name, parameters, custom_headers = nil)
271
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
272
+ fail ArgumentError, 'automation_account_name is nil' if automation_account_name.nil?
273
+ fail ArgumentError, 'runbook_name is nil' if runbook_name.nil?
274
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
275
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
276
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
277
+
278
+
279
+ request_headers = {}
280
+
281
+ # Set Headers
282
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
283
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
284
+
285
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
286
+
287
+ # Serialize Request
288
+ request_mapper = Azure::ARM::Automation::Models::RunbookCreateOrUpdateParameters.mapper()
289
+ request_content = @client.serialize(request_mapper, parameters)
290
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
291
+
292
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}'
293
+
294
+ request_url = @base_url || @client.base_url
295
+
296
+ options = {
297
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
298
+ path_params: {'resourceGroupName' => resource_group_name,'automationAccountName' => automation_account_name,'runbookName' => runbook_name,'subscriptionId' => @client.subscription_id},
299
+ query_params: {'api-version' => @client.api_version},
300
+ body: request_content,
301
+ headers: request_headers.merge(custom_headers || {}),
302
+ base_url: request_url
303
+ }
304
+ promise = @client.make_request_async(:put, path_template, options)
305
+
306
+ promise = promise.then do |result|
307
+ http_response = result.response
308
+ status_code = http_response.status
309
+ response_content = http_response.body
310
+ unless status_code == 200 || status_code == 201 || status_code == 400
311
+ error_model = JSON.load(response_content)
312
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
313
+ end
314
+
315
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
316
+
317
+ result
318
+ end
319
+
320
+ promise.execute
321
+ end
322
+
323
+ #
324
+ # Update the runbook identified by runbook name.
325
+ #
326
+ # @param resource_group_name [String] The resource group name.
327
+ # @param automation_account_name [String] The automation account name.
328
+ # @param runbook_name [String] The runbook name.
329
+ # @param parameters [RunbookUpdateParameters] The update parameters for
330
+ # runbook.
331
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
332
+ # will be added to the HTTP request.
333
+ #
334
+ # @return [Runbook] operation results.
335
+ #
336
+ def update(resource_group_name, automation_account_name, runbook_name, parameters, custom_headers = nil)
337
+ response = update_async(resource_group_name, automation_account_name, runbook_name, parameters, custom_headers).value!
338
+ response.body unless response.nil?
339
+ end
340
+
341
+ #
342
+ # Update the runbook identified by runbook name.
343
+ #
344
+ # @param resource_group_name [String] The resource group name.
345
+ # @param automation_account_name [String] The automation account name.
346
+ # @param runbook_name [String] The runbook name.
347
+ # @param parameters [RunbookUpdateParameters] The update parameters for
348
+ # runbook.
349
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
350
+ # will be added to the HTTP request.
351
+ #
352
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
353
+ #
354
+ def update_with_http_info(resource_group_name, automation_account_name, runbook_name, parameters, custom_headers = nil)
355
+ update_async(resource_group_name, automation_account_name, runbook_name, parameters, custom_headers).value!
356
+ end
357
+
358
+ #
359
+ # Update the runbook identified by runbook name.
360
+ #
361
+ # @param resource_group_name [String] The resource group name.
362
+ # @param automation_account_name [String] The automation account name.
363
+ # @param runbook_name [String] The runbook name.
364
+ # @param parameters [RunbookUpdateParameters] The update parameters for
365
+ # runbook.
366
+ # @param [Hash{String => String}] A hash of custom headers that will be added
367
+ # to the HTTP request.
368
+ #
369
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
370
+ #
371
+ def update_async(resource_group_name, automation_account_name, runbook_name, parameters, custom_headers = nil)
372
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
373
+ fail ArgumentError, 'automation_account_name is nil' if automation_account_name.nil?
374
+ fail ArgumentError, 'runbook_name is nil' if runbook_name.nil?
375
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
376
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
377
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
378
+
379
+
380
+ request_headers = {}
381
+
382
+ # Set Headers
383
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
384
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
385
+
386
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
387
+
388
+ # Serialize Request
389
+ request_mapper = Azure::ARM::Automation::Models::RunbookUpdateParameters.mapper()
390
+ request_content = @client.serialize(request_mapper, parameters)
391
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
392
+
393
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}'
394
+
395
+ request_url = @base_url || @client.base_url
396
+
397
+ options = {
398
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
399
+ path_params: {'resourceGroupName' => resource_group_name,'automationAccountName' => automation_account_name,'runbookName' => runbook_name,'subscriptionId' => @client.subscription_id},
400
+ query_params: {'api-version' => @client.api_version},
401
+ body: request_content,
402
+ headers: request_headers.merge(custom_headers || {}),
403
+ base_url: request_url
404
+ }
405
+ promise = @client.make_request_async(:patch, path_template, options)
406
+
407
+ promise = promise.then do |result|
408
+ http_response = result.response
409
+ status_code = http_response.status
410
+ response_content = http_response.body
411
+ unless status_code == 200
412
+ error_model = JSON.load(response_content)
413
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
414
+ end
415
+
416
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
417
+ # Deserialize Response
418
+ if status_code == 200
419
+ begin
420
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
421
+ result_mapper = Azure::ARM::Automation::Models::Runbook.mapper()
422
+ result.body = @client.deserialize(result_mapper, parsed_response)
423
+ rescue Exception => e
424
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
425
+ end
426
+ end
427
+
428
+ result
429
+ end
430
+
431
+ promise.execute
432
+ end
433
+
434
+ #
435
+ # Delete the runbook by name.
436
+ #
437
+ # @param resource_group_name [String] The resource group name.
438
+ # @param automation_account_name [String] The automation account name.
439
+ # @param runbook_name [String] The runbook name.
440
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
441
+ # will be added to the HTTP request.
442
+ #
443
+ #
444
+ def delete(resource_group_name, automation_account_name, runbook_name, custom_headers = nil)
445
+ response = delete_async(resource_group_name, automation_account_name, runbook_name, custom_headers).value!
446
+ nil
447
+ end
448
+
449
+ #
450
+ # Delete the runbook by name.
451
+ #
452
+ # @param resource_group_name [String] The resource group name.
453
+ # @param automation_account_name [String] The automation account name.
454
+ # @param runbook_name [String] The runbook name.
455
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
456
+ # will be added to the HTTP request.
457
+ #
458
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
459
+ #
460
+ def delete_with_http_info(resource_group_name, automation_account_name, runbook_name, custom_headers = nil)
461
+ delete_async(resource_group_name, automation_account_name, runbook_name, custom_headers).value!
462
+ end
463
+
464
+ #
465
+ # Delete the runbook by name.
466
+ #
467
+ # @param resource_group_name [String] The resource group name.
468
+ # @param automation_account_name [String] The automation account name.
469
+ # @param runbook_name [String] The runbook name.
470
+ # @param [Hash{String => String}] A hash of custom headers that will be added
471
+ # to the HTTP request.
472
+ #
473
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
474
+ #
475
+ def delete_async(resource_group_name, automation_account_name, runbook_name, custom_headers = nil)
476
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
477
+ fail ArgumentError, 'automation_account_name is nil' if automation_account_name.nil?
478
+ fail ArgumentError, 'runbook_name is nil' if runbook_name.nil?
479
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
480
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
481
+
482
+
483
+ request_headers = {}
484
+
485
+ # Set Headers
486
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
487
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
488
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}'
489
+
490
+ request_url = @base_url || @client.base_url
491
+
492
+ options = {
493
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
494
+ path_params: {'resourceGroupName' => resource_group_name,'automationAccountName' => automation_account_name,'runbookName' => runbook_name,'subscriptionId' => @client.subscription_id},
495
+ query_params: {'api-version' => @client.api_version},
496
+ headers: request_headers.merge(custom_headers || {}),
497
+ base_url: request_url
498
+ }
499
+ promise = @client.make_request_async(:delete, path_template, options)
500
+
501
+ promise = promise.then do |result|
502
+ http_response = result.response
503
+ status_code = http_response.status
504
+ response_content = http_response.body
505
+ unless status_code == 200
506
+ error_model = JSON.load(response_content)
507
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
508
+ end
509
+
510
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
511
+
512
+ result
513
+ end
514
+
515
+ promise.execute
516
+ end
517
+
518
+ #
519
+ # Retrieve a list of runbooks.
520
+ #
521
+ # @param resource_group_name [String] The resource group name.
522
+ # @param automation_account_name [String] The automation account name.
523
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
524
+ # will be added to the HTTP request.
525
+ #
526
+ # @return [Array<Runbook>] operation results.
527
+ #
528
+ def list_by_automation_account(resource_group_name, automation_account_name, custom_headers = nil)
529
+ first_page = list_by_automation_account_as_lazy(resource_group_name, automation_account_name, custom_headers)
530
+ first_page.get_all_items
531
+ end
532
+
533
+ #
534
+ # Retrieve a list of runbooks.
535
+ #
536
+ # @param resource_group_name [String] The resource group name.
537
+ # @param automation_account_name [String] The automation account name.
538
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
539
+ # will be added to the HTTP request.
540
+ #
541
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
542
+ #
543
+ def list_by_automation_account_with_http_info(resource_group_name, automation_account_name, custom_headers = nil)
544
+ list_by_automation_account_async(resource_group_name, automation_account_name, custom_headers).value!
545
+ end
546
+
547
+ #
548
+ # Retrieve a list of runbooks.
549
+ #
550
+ # @param resource_group_name [String] The resource group name.
551
+ # @param automation_account_name [String] The automation account name.
552
+ # @param [Hash{String => String}] A hash of custom headers that will be added
553
+ # to the HTTP request.
554
+ #
555
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
556
+ #
557
+ def list_by_automation_account_async(resource_group_name, automation_account_name, custom_headers = nil)
558
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
559
+ fail ArgumentError, 'automation_account_name is nil' if automation_account_name.nil?
560
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
561
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
562
+
563
+
564
+ request_headers = {}
565
+
566
+ # Set Headers
567
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
568
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
569
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks'
570
+
571
+ request_url = @base_url || @client.base_url
572
+
573
+ options = {
574
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
575
+ path_params: {'resourceGroupName' => resource_group_name,'automationAccountName' => automation_account_name,'subscriptionId' => @client.subscription_id},
576
+ query_params: {'api-version' => @client.api_version},
577
+ headers: request_headers.merge(custom_headers || {}),
578
+ base_url: request_url
579
+ }
580
+ promise = @client.make_request_async(:get, path_template, options)
581
+
582
+ promise = promise.then do |result|
583
+ http_response = result.response
584
+ status_code = http_response.status
585
+ response_content = http_response.body
586
+ unless status_code == 200
587
+ error_model = JSON.load(response_content)
588
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
589
+ end
590
+
591
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
592
+ # Deserialize Response
593
+ if status_code == 200
594
+ begin
595
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
596
+ result_mapper = Azure::ARM::Automation::Models::RunbookListResult.mapper()
597
+ result.body = @client.deserialize(result_mapper, parsed_response)
598
+ rescue Exception => e
599
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
600
+ end
601
+ end
602
+
603
+ result
604
+ end
605
+
606
+ promise.execute
607
+ end
608
+
609
+ #
610
+ # Retrieve a list of runbooks.
611
+ #
612
+ # @param next_page_link [String] The NextLink from the previous successful call
613
+ # to List operation.
614
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
615
+ # will be added to the HTTP request.
616
+ #
617
+ # @return [RunbookListResult] operation results.
618
+ #
619
+ def list_by_automation_account_next(next_page_link, custom_headers = nil)
620
+ response = list_by_automation_account_next_async(next_page_link, custom_headers).value!
621
+ response.body unless response.nil?
622
+ end
623
+
624
+ #
625
+ # Retrieve a list of runbooks.
626
+ #
627
+ # @param next_page_link [String] The NextLink from the previous successful call
628
+ # to List operation.
629
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
630
+ # will be added to the HTTP request.
631
+ #
632
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
633
+ #
634
+ def list_by_automation_account_next_with_http_info(next_page_link, custom_headers = nil)
635
+ list_by_automation_account_next_async(next_page_link, custom_headers).value!
636
+ end
637
+
638
+ #
639
+ # Retrieve a list of runbooks.
640
+ #
641
+ # @param next_page_link [String] The NextLink from the previous successful call
642
+ # to List operation.
643
+ # @param [Hash{String => String}] A hash of custom headers that will be added
644
+ # to the HTTP request.
645
+ #
646
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
647
+ #
648
+ def list_by_automation_account_next_async(next_page_link, custom_headers = nil)
649
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
650
+
651
+
652
+ request_headers = {}
653
+
654
+ # Set Headers
655
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
656
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
657
+ path_template = '{nextLink}'
658
+
659
+ request_url = @base_url || @client.base_url
660
+
661
+ options = {
662
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
663
+ skip_encoding_path_params: {'nextLink' => next_page_link},
664
+ headers: request_headers.merge(custom_headers || {}),
665
+ base_url: request_url
666
+ }
667
+ promise = @client.make_request_async(:get, path_template, options)
668
+
669
+ promise = promise.then do |result|
670
+ http_response = result.response
671
+ status_code = http_response.status
672
+ response_content = http_response.body
673
+ unless status_code == 200
674
+ error_model = JSON.load(response_content)
675
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
676
+ end
677
+
678
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
679
+ # Deserialize Response
680
+ if status_code == 200
681
+ begin
682
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
683
+ result_mapper = Azure::ARM::Automation::Models::RunbookListResult.mapper()
684
+ result.body = @client.deserialize(result_mapper, parsed_response)
685
+ rescue Exception => e
686
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
687
+ end
688
+ end
689
+
690
+ result
691
+ end
692
+
693
+ promise.execute
694
+ end
695
+
696
+ #
697
+ # Retrieve a list of runbooks.
698
+ #
699
+ # @param resource_group_name [String] The resource group name.
700
+ # @param automation_account_name [String] The automation account name.
701
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
702
+ # will be added to the HTTP request.
703
+ #
704
+ # @return [RunbookListResult] which provide lazy access to pages of the
705
+ # response.
706
+ #
707
+ def list_by_automation_account_as_lazy(resource_group_name, automation_account_name, custom_headers = nil)
708
+ response = list_by_automation_account_async(resource_group_name, automation_account_name, custom_headers).value!
709
+ unless response.nil?
710
+ page = response.body
711
+ page.next_method = Proc.new do |next_page_link|
712
+ list_by_automation_account_next_async(next_page_link, custom_headers)
713
+ end
714
+ page
715
+ end
716
+ end
717
+
718
+ end
719
+ end