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