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,223 @@
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 AgentRegistrationInformation
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the AgentRegistrationInformation 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 automation agent registration information.
26
+ #
27
+ # @param resource_group_name [String] The resource group name.
28
+ # @param automation_account_name [String] The automation account name.
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [AgentRegistration] operation results.
33
+ #
34
+ def get(resource_group_name, automation_account_name, custom_headers = nil)
35
+ response = get_async(resource_group_name, automation_account_name, custom_headers).value!
36
+ response.body unless response.nil?
37
+ end
38
+
39
+ #
40
+ # Retrieve the automation agent registration information.
41
+ #
42
+ # @param resource_group_name [String] The resource group name.
43
+ # @param automation_account_name [String] The automation account name.
44
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
45
+ # will be added to the HTTP request.
46
+ #
47
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
48
+ #
49
+ def get_with_http_info(resource_group_name, automation_account_name, custom_headers = nil)
50
+ get_async(resource_group_name, automation_account_name, custom_headers).value!
51
+ end
52
+
53
+ #
54
+ # Retrieve the automation agent registration information.
55
+ #
56
+ # @param resource_group_name [String] The resource group name.
57
+ # @param automation_account_name [String] The automation account name.
58
+ # @param [Hash{String => String}] A hash of custom headers that will be added
59
+ # to the HTTP request.
60
+ #
61
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
62
+ #
63
+ def get_async(resource_group_name, automation_account_name, custom_headers = nil)
64
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
65
+ fail ArgumentError, 'automation_account_name is nil' if automation_account_name.nil?
66
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
67
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
68
+
69
+
70
+ request_headers = {}
71
+
72
+ # Set Headers
73
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
74
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
75
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation'
76
+
77
+ request_url = @base_url || @client.base_url
78
+
79
+ options = {
80
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
81
+ path_params: {'resourceGroupName' => resource_group_name,'automationAccountName' => automation_account_name,'subscriptionId' => @client.subscription_id},
82
+ query_params: {'api-version' => @client.api_version},
83
+ headers: request_headers.merge(custom_headers || {}),
84
+ base_url: request_url
85
+ }
86
+ promise = @client.make_request_async(:get, path_template, options)
87
+
88
+ promise = promise.then do |result|
89
+ http_response = result.response
90
+ status_code = http_response.status
91
+ response_content = http_response.body
92
+ unless status_code == 200
93
+ error_model = JSON.load(response_content)
94
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
95
+ end
96
+
97
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
98
+ # Deserialize Response
99
+ if status_code == 200
100
+ begin
101
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
102
+ result_mapper = Azure::ARM::Automation::Models::AgentRegistration.mapper()
103
+ result.body = @client.deserialize(result_mapper, parsed_response)
104
+ rescue Exception => e
105
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
106
+ end
107
+ end
108
+
109
+ result
110
+ end
111
+
112
+ promise.execute
113
+ end
114
+
115
+ #
116
+ # Regenerate a primary or secondary agent registration key
117
+ #
118
+ # @param resource_group_name [String] The resource group name.
119
+ # @param automation_account_name [String] The automation account name.
120
+ # @param parameters [AgentRegistrationRegenerateKeyParameter] The name of the
121
+ # agent registration key to be regenerated
122
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
123
+ # will be added to the HTTP request.
124
+ #
125
+ # @return [AgentRegistration] operation results.
126
+ #
127
+ def regenerate_key(resource_group_name, automation_account_name, parameters, custom_headers = nil)
128
+ response = regenerate_key_async(resource_group_name, automation_account_name, parameters, custom_headers).value!
129
+ response.body unless response.nil?
130
+ end
131
+
132
+ #
133
+ # Regenerate a primary or secondary agent registration key
134
+ #
135
+ # @param resource_group_name [String] The resource group name.
136
+ # @param automation_account_name [String] The automation account name.
137
+ # @param parameters [AgentRegistrationRegenerateKeyParameter] The name of the
138
+ # agent registration key to be regenerated
139
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
140
+ # will be added to the HTTP request.
141
+ #
142
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
143
+ #
144
+ def regenerate_key_with_http_info(resource_group_name, automation_account_name, parameters, custom_headers = nil)
145
+ regenerate_key_async(resource_group_name, automation_account_name, parameters, custom_headers).value!
146
+ end
147
+
148
+ #
149
+ # Regenerate a primary or secondary agent registration key
150
+ #
151
+ # @param resource_group_name [String] The resource group name.
152
+ # @param automation_account_name [String] The automation account name.
153
+ # @param parameters [AgentRegistrationRegenerateKeyParameter] The name of the
154
+ # agent registration key to be regenerated
155
+ # @param [Hash{String => String}] A hash of custom headers that will be added
156
+ # to the HTTP request.
157
+ #
158
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
159
+ #
160
+ def regenerate_key_async(resource_group_name, automation_account_name, parameters, custom_headers = nil)
161
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
162
+ fail ArgumentError, 'automation_account_name is nil' if automation_account_name.nil?
163
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
164
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
165
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
166
+
167
+
168
+ request_headers = {}
169
+
170
+ # Set Headers
171
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
172
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
173
+
174
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
175
+
176
+ # Serialize Request
177
+ request_mapper = Azure::ARM::Automation::Models::AgentRegistrationRegenerateKeyParameter.mapper()
178
+ request_content = @client.serialize(request_mapper, parameters)
179
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
180
+
181
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation/regenerateKey'
182
+
183
+ request_url = @base_url || @client.base_url
184
+
185
+ options = {
186
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
187
+ path_params: {'resourceGroupName' => resource_group_name,'automationAccountName' => automation_account_name,'subscriptionId' => @client.subscription_id},
188
+ query_params: {'api-version' => @client.api_version},
189
+ body: request_content,
190
+ headers: request_headers.merge(custom_headers || {}),
191
+ base_url: request_url
192
+ }
193
+ promise = @client.make_request_async(:post, path_template, options)
194
+
195
+ promise = promise.then do |result|
196
+ http_response = result.response
197
+ status_code = http_response.status
198
+ response_content = http_response.body
199
+ unless status_code == 200
200
+ error_model = JSON.load(response_content)
201
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
202
+ end
203
+
204
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
205
+ # Deserialize Response
206
+ if status_code == 200
207
+ begin
208
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
209
+ result_mapper = Azure::ARM::Automation::Models::AgentRegistration.mapper()
210
+ result.body = @client.deserialize(result_mapper, parsed_response)
211
+ rescue Exception => e
212
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
213
+ end
214
+ end
215
+
216
+ result
217
+ end
218
+
219
+ promise.execute
220
+ end
221
+
222
+ end
223
+ end
@@ -0,0 +1,822 @@
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 AutomationAccountOperations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the AutomationAccountOperations 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
+ # Update an automation account.
26
+ #
27
+ # @param resource_group_name [String] The resource group name.
28
+ # @param automation_account_name [String] Automation account name.
29
+ # @param parameters [AutomationAccountUpdateParameters] Parameters supplied to
30
+ # the update automation account.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [AutomationAccount] operation results.
35
+ #
36
+ def update(resource_group_name, automation_account_name, parameters, custom_headers = nil)
37
+ response = update_async(resource_group_name, automation_account_name, parameters, custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Update an automation account.
43
+ #
44
+ # @param resource_group_name [String] The resource group name.
45
+ # @param automation_account_name [String] Automation account name.
46
+ # @param parameters [AutomationAccountUpdateParameters] Parameters supplied to
47
+ # the update automation account.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
52
+ #
53
+ def update_with_http_info(resource_group_name, automation_account_name, parameters, custom_headers = nil)
54
+ update_async(resource_group_name, automation_account_name, parameters, custom_headers).value!
55
+ end
56
+
57
+ #
58
+ # Update an automation account.
59
+ #
60
+ # @param resource_group_name [String] The resource group name.
61
+ # @param automation_account_name [String] Automation account name.
62
+ # @param parameters [AutomationAccountUpdateParameters] Parameters supplied to
63
+ # the update automation account.
64
+ # @param [Hash{String => String}] A hash of custom headers that will be added
65
+ # to the HTTP request.
66
+ #
67
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
68
+ #
69
+ def update_async(resource_group_name, automation_account_name, parameters, custom_headers = nil)
70
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
71
+ fail ArgumentError, 'automation_account_name is nil' if automation_account_name.nil?
72
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
73
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
74
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
75
+
76
+
77
+ request_headers = {}
78
+
79
+ # Set Headers
80
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
81
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
82
+
83
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
84
+
85
+ # Serialize Request
86
+ request_mapper = Azure::ARM::Automation::Models::AutomationAccountUpdateParameters.mapper()
87
+ request_content = @client.serialize(request_mapper, parameters)
88
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
89
+
90
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}'
91
+
92
+ request_url = @base_url || @client.base_url
93
+
94
+ options = {
95
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
96
+ path_params: {'resourceGroupName' => resource_group_name,'automationAccountName' => automation_account_name,'subscriptionId' => @client.subscription_id},
97
+ query_params: {'api-version' => @client.api_version},
98
+ body: request_content,
99
+ headers: request_headers.merge(custom_headers || {}),
100
+ base_url: request_url
101
+ }
102
+ promise = @client.make_request_async(:patch, path_template, options)
103
+
104
+ promise = promise.then do |result|
105
+ http_response = result.response
106
+ status_code = http_response.status
107
+ response_content = http_response.body
108
+ unless status_code == 200
109
+ error_model = JSON.load(response_content)
110
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
111
+ end
112
+
113
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
114
+ # Deserialize Response
115
+ if status_code == 200
116
+ begin
117
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
118
+ result_mapper = Azure::ARM::Automation::Models::AutomationAccount.mapper()
119
+ result.body = @client.deserialize(result_mapper, parsed_response)
120
+ rescue Exception => e
121
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
122
+ end
123
+ end
124
+
125
+ result
126
+ end
127
+
128
+ promise.execute
129
+ end
130
+
131
+ #
132
+ # Create or update automation account.
133
+ #
134
+ # @param resource_group_name [String] The resource group name.
135
+ # @param automation_account_name [String] Parameters supplied to the create or
136
+ # update automation account.
137
+ # @param parameters [AutomationAccountCreateOrUpdateParameters] Parameters
138
+ # supplied to the create or update automation account.
139
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
140
+ # will be added to the HTTP request.
141
+ #
142
+ # @return [AutomationAccount] operation results.
143
+ #
144
+ def create_or_update(resource_group_name, automation_account_name, parameters, custom_headers = nil)
145
+ response = create_or_update_async(resource_group_name, automation_account_name, parameters, custom_headers).value!
146
+ response.body unless response.nil?
147
+ end
148
+
149
+ #
150
+ # Create or update automation account.
151
+ #
152
+ # @param resource_group_name [String] The resource group name.
153
+ # @param automation_account_name [String] Parameters supplied to the create or
154
+ # update automation account.
155
+ # @param parameters [AutomationAccountCreateOrUpdateParameters] Parameters
156
+ # supplied to the create or update automation account.
157
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
158
+ # will be added to the HTTP request.
159
+ #
160
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
161
+ #
162
+ def create_or_update_with_http_info(resource_group_name, automation_account_name, parameters, custom_headers = nil)
163
+ create_or_update_async(resource_group_name, automation_account_name, parameters, custom_headers).value!
164
+ end
165
+
166
+ #
167
+ # Create or update automation account.
168
+ #
169
+ # @param resource_group_name [String] The resource group name.
170
+ # @param automation_account_name [String] Parameters supplied to the create or
171
+ # update automation account.
172
+ # @param parameters [AutomationAccountCreateOrUpdateParameters] Parameters
173
+ # supplied to the create or update automation account.
174
+ # @param [Hash{String => String}] A hash of custom headers that will be added
175
+ # to the HTTP request.
176
+ #
177
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
178
+ #
179
+ def create_or_update_async(resource_group_name, automation_account_name, parameters, custom_headers = nil)
180
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
181
+ fail ArgumentError, 'automation_account_name is nil' if automation_account_name.nil?
182
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
183
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
184
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
185
+
186
+
187
+ request_headers = {}
188
+
189
+ # Set Headers
190
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
191
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
192
+
193
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
194
+
195
+ # Serialize Request
196
+ request_mapper = Azure::ARM::Automation::Models::AutomationAccountCreateOrUpdateParameters.mapper()
197
+ request_content = @client.serialize(request_mapper, parameters)
198
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
199
+
200
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}'
201
+
202
+ request_url = @base_url || @client.base_url
203
+
204
+ options = {
205
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
206
+ path_params: {'resourceGroupName' => resource_group_name,'automationAccountName' => automation_account_name,'subscriptionId' => @client.subscription_id},
207
+ query_params: {'api-version' => @client.api_version},
208
+ body: request_content,
209
+ headers: request_headers.merge(custom_headers || {}),
210
+ base_url: request_url
211
+ }
212
+ promise = @client.make_request_async(:put, path_template, options)
213
+
214
+ promise = promise.then do |result|
215
+ http_response = result.response
216
+ status_code = http_response.status
217
+ response_content = http_response.body
218
+ unless status_code == 201 || status_code == 200
219
+ error_model = JSON.load(response_content)
220
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
221
+ end
222
+
223
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
224
+ # Deserialize Response
225
+ if status_code == 201
226
+ begin
227
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
228
+ result_mapper = Azure::ARM::Automation::Models::AutomationAccount.mapper()
229
+ result.body = @client.deserialize(result_mapper, parsed_response)
230
+ rescue Exception => e
231
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
232
+ end
233
+ end
234
+ # Deserialize Response
235
+ if status_code == 200
236
+ begin
237
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
238
+ result_mapper = Azure::ARM::Automation::Models::AutomationAccount.mapper()
239
+ result.body = @client.deserialize(result_mapper, parsed_response)
240
+ rescue Exception => e
241
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
242
+ end
243
+ end
244
+
245
+ result
246
+ end
247
+
248
+ promise.execute
249
+ end
250
+
251
+ #
252
+ # Delete an automation account.
253
+ #
254
+ # @param resource_group_name [String] The resource group name.
255
+ # @param automation_account_name [String] Automation account name.
256
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
257
+ # will be added to the HTTP request.
258
+ #
259
+ #
260
+ def delete(resource_group_name, automation_account_name, custom_headers = nil)
261
+ response = delete_async(resource_group_name, automation_account_name, custom_headers).value!
262
+ nil
263
+ end
264
+
265
+ #
266
+ # Delete an automation account.
267
+ #
268
+ # @param resource_group_name [String] The resource group name.
269
+ # @param automation_account_name [String] Automation account name.
270
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
271
+ # will be added to the HTTP request.
272
+ #
273
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
274
+ #
275
+ def delete_with_http_info(resource_group_name, automation_account_name, custom_headers = nil)
276
+ delete_async(resource_group_name, automation_account_name, custom_headers).value!
277
+ end
278
+
279
+ #
280
+ # Delete an automation account.
281
+ #
282
+ # @param resource_group_name [String] The resource group name.
283
+ # @param automation_account_name [String] Automation account name.
284
+ # @param [Hash{String => String}] A hash of custom headers that will be added
285
+ # to the HTTP request.
286
+ #
287
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
288
+ #
289
+ def delete_async(resource_group_name, automation_account_name, custom_headers = nil)
290
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
291
+ fail ArgumentError, 'automation_account_name is nil' if automation_account_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}'
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,'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(:delete, 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 || status_code == 204
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
+
325
+ result
326
+ end
327
+
328
+ promise.execute
329
+ end
330
+
331
+ #
332
+ # Get information about an Automation Account.
333
+ #
334
+ # @param resource_group_name [String] The resource group name.
335
+ # @param automation_account_name [String] The automation account name.
336
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
337
+ # will be added to the HTTP request.
338
+ #
339
+ # @return [AutomationAccount] operation results.
340
+ #
341
+ def get(resource_group_name, automation_account_name, custom_headers = nil)
342
+ response = get_async(resource_group_name, automation_account_name, custom_headers).value!
343
+ response.body unless response.nil?
344
+ end
345
+
346
+ #
347
+ # Get information about an Automation Account.
348
+ #
349
+ # @param resource_group_name [String] The resource group name.
350
+ # @param automation_account_name [String] The automation account name.
351
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
352
+ # will be added to the HTTP request.
353
+ #
354
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
355
+ #
356
+ def get_with_http_info(resource_group_name, automation_account_name, custom_headers = nil)
357
+ get_async(resource_group_name, automation_account_name, custom_headers).value!
358
+ end
359
+
360
+ #
361
+ # Get information about an Automation Account.
362
+ #
363
+ # @param resource_group_name [String] The resource group name.
364
+ # @param automation_account_name [String] The automation account name.
365
+ # @param [Hash{String => String}] A hash of custom headers that will be added
366
+ # to the HTTP request.
367
+ #
368
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
369
+ #
370
+ def get_async(resource_group_name, automation_account_name, custom_headers = nil)
371
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
372
+ fail ArgumentError, 'automation_account_name is nil' if automation_account_name.nil?
373
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
374
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
375
+
376
+
377
+ request_headers = {}
378
+
379
+ # Set Headers
380
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
381
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
382
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}'
383
+
384
+ request_url = @base_url || @client.base_url
385
+
386
+ options = {
387
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
388
+ path_params: {'resourceGroupName' => resource_group_name,'automationAccountName' => automation_account_name,'subscriptionId' => @client.subscription_id},
389
+ query_params: {'api-version' => @client.api_version},
390
+ headers: request_headers.merge(custom_headers || {}),
391
+ base_url: request_url
392
+ }
393
+ promise = @client.make_request_async(:get, path_template, options)
394
+
395
+ promise = promise.then do |result|
396
+ http_response = result.response
397
+ status_code = http_response.status
398
+ response_content = http_response.body
399
+ unless status_code == 200
400
+ error_model = JSON.load(response_content)
401
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
402
+ end
403
+
404
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
405
+ # Deserialize Response
406
+ if status_code == 200
407
+ begin
408
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
409
+ result_mapper = Azure::ARM::Automation::Models::AutomationAccount.mapper()
410
+ result.body = @client.deserialize(result_mapper, parsed_response)
411
+ rescue Exception => e
412
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
413
+ end
414
+ end
415
+
416
+ result
417
+ end
418
+
419
+ promise.execute
420
+ end
421
+
422
+ #
423
+ # Retrieve a list of accounts within a given resource group.
424
+ #
425
+ # @param resource_group_name [String] The resource group name.
426
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
427
+ # will be added to the HTTP request.
428
+ #
429
+ # @return [Array<AutomationAccount>] operation results.
430
+ #
431
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
432
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers)
433
+ first_page.get_all_items
434
+ end
435
+
436
+ #
437
+ # Retrieve a list of accounts within a given resource group.
438
+ #
439
+ # @param resource_group_name [String] The resource group name.
440
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
441
+ # will be added to the HTTP request.
442
+ #
443
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
444
+ #
445
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
446
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
447
+ end
448
+
449
+ #
450
+ # Retrieve a list of accounts within a given resource group.
451
+ #
452
+ # @param resource_group_name [String] The resource group name.
453
+ # @param [Hash{String => String}] A hash of custom headers that will be added
454
+ # to the HTTP request.
455
+ #
456
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
457
+ #
458
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
459
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
460
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
461
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
462
+
463
+
464
+ request_headers = {}
465
+
466
+ # Set Headers
467
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
468
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
469
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts'
470
+
471
+ request_url = @base_url || @client.base_url
472
+
473
+ options = {
474
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
475
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
476
+ query_params: {'api-version' => @client.api_version},
477
+ headers: request_headers.merge(custom_headers || {}),
478
+ base_url: request_url
479
+ }
480
+ promise = @client.make_request_async(:get, path_template, options)
481
+
482
+ promise = promise.then do |result|
483
+ http_response = result.response
484
+ status_code = http_response.status
485
+ response_content = http_response.body
486
+ unless status_code == 200
487
+ error_model = JSON.load(response_content)
488
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
489
+ end
490
+
491
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
492
+ # Deserialize Response
493
+ if status_code == 200
494
+ begin
495
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
496
+ result_mapper = Azure::ARM::Automation::Models::AutomationAccountListResult.mapper()
497
+ result.body = @client.deserialize(result_mapper, parsed_response)
498
+ rescue Exception => e
499
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
500
+ end
501
+ end
502
+
503
+ result
504
+ end
505
+
506
+ promise.execute
507
+ end
508
+
509
+ #
510
+ # Lists the Automation Accounts within an Azure subscription.
511
+ #
512
+ # Retrieve a list of accounts within a given subscription.
513
+ #
514
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
515
+ # will be added to the HTTP request.
516
+ #
517
+ # @return [Array<AutomationAccount>] operation results.
518
+ #
519
+ def list(custom_headers = nil)
520
+ first_page = list_as_lazy(custom_headers)
521
+ first_page.get_all_items
522
+ end
523
+
524
+ #
525
+ # Lists the Automation Accounts within an Azure subscription.
526
+ #
527
+ # Retrieve a list of accounts within a given subscription.
528
+ #
529
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
530
+ # will be added to the HTTP request.
531
+ #
532
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
533
+ #
534
+ def list_with_http_info(custom_headers = nil)
535
+ list_async(custom_headers).value!
536
+ end
537
+
538
+ #
539
+ # Lists the Automation Accounts within an Azure subscription.
540
+ #
541
+ # Retrieve a list of accounts within a given subscription.
542
+ #
543
+ # @param [Hash{String => String}] A hash of custom headers that will be added
544
+ # to the HTTP request.
545
+ #
546
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
547
+ #
548
+ def list_async(custom_headers = nil)
549
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
550
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
551
+
552
+
553
+ request_headers = {}
554
+
555
+ # Set Headers
556
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
557
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
558
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts'
559
+
560
+ request_url = @base_url || @client.base_url
561
+
562
+ options = {
563
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
564
+ path_params: {'subscriptionId' => @client.subscription_id},
565
+ query_params: {'api-version' => @client.api_version},
566
+ headers: request_headers.merge(custom_headers || {}),
567
+ base_url: request_url
568
+ }
569
+ promise = @client.make_request_async(:get, path_template, options)
570
+
571
+ promise = promise.then do |result|
572
+ http_response = result.response
573
+ status_code = http_response.status
574
+ response_content = http_response.body
575
+ unless status_code == 200
576
+ error_model = JSON.load(response_content)
577
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
578
+ end
579
+
580
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
581
+ # Deserialize Response
582
+ if status_code == 200
583
+ begin
584
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
585
+ result_mapper = Azure::ARM::Automation::Models::AutomationAccountListResult.mapper()
586
+ result.body = @client.deserialize(result_mapper, parsed_response)
587
+ rescue Exception => e
588
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
589
+ end
590
+ end
591
+
592
+ result
593
+ end
594
+
595
+ promise.execute
596
+ end
597
+
598
+ #
599
+ # Retrieve a list of accounts within a given resource group.
600
+ #
601
+ # @param next_page_link [String] The NextLink from the previous successful call
602
+ # to List operation.
603
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
604
+ # will be added to the HTTP request.
605
+ #
606
+ # @return [AutomationAccountListResult] operation results.
607
+ #
608
+ def list_by_resource_group_next(next_page_link, custom_headers = nil)
609
+ response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
610
+ response.body unless response.nil?
611
+ end
612
+
613
+ #
614
+ # Retrieve a list of accounts within a given resource group.
615
+ #
616
+ # @param next_page_link [String] The NextLink from the previous successful call
617
+ # to List operation.
618
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
619
+ # will be added to the HTTP request.
620
+ #
621
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
622
+ #
623
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
624
+ list_by_resource_group_next_async(next_page_link, custom_headers).value!
625
+ end
626
+
627
+ #
628
+ # Retrieve a list of accounts within a given resource group.
629
+ #
630
+ # @param next_page_link [String] The NextLink from the previous successful call
631
+ # to List operation.
632
+ # @param [Hash{String => String}] A hash of custom headers that will be added
633
+ # to the HTTP request.
634
+ #
635
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
636
+ #
637
+ def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
638
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
639
+
640
+
641
+ request_headers = {}
642
+
643
+ # Set Headers
644
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
645
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
646
+ path_template = '{nextLink}'
647
+
648
+ request_url = @base_url || @client.base_url
649
+
650
+ options = {
651
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
652
+ skip_encoding_path_params: {'nextLink' => next_page_link},
653
+ headers: request_headers.merge(custom_headers || {}),
654
+ base_url: request_url
655
+ }
656
+ promise = @client.make_request_async(:get, path_template, options)
657
+
658
+ promise = promise.then do |result|
659
+ http_response = result.response
660
+ status_code = http_response.status
661
+ response_content = http_response.body
662
+ unless status_code == 200
663
+ error_model = JSON.load(response_content)
664
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
665
+ end
666
+
667
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
668
+ # Deserialize Response
669
+ if status_code == 200
670
+ begin
671
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
672
+ result_mapper = Azure::ARM::Automation::Models::AutomationAccountListResult.mapper()
673
+ result.body = @client.deserialize(result_mapper, parsed_response)
674
+ rescue Exception => e
675
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
676
+ end
677
+ end
678
+
679
+ result
680
+ end
681
+
682
+ promise.execute
683
+ end
684
+
685
+ #
686
+ # Lists the Automation Accounts within an Azure subscription.
687
+ #
688
+ # Retrieve a list of accounts within a given subscription.
689
+ #
690
+ # @param next_page_link [String] The NextLink from the previous successful call
691
+ # to List operation.
692
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
693
+ # will be added to the HTTP request.
694
+ #
695
+ # @return [AutomationAccountListResult] operation results.
696
+ #
697
+ def list_next(next_page_link, custom_headers = nil)
698
+ response = list_next_async(next_page_link, custom_headers).value!
699
+ response.body unless response.nil?
700
+ end
701
+
702
+ #
703
+ # Lists the Automation Accounts within an Azure subscription.
704
+ #
705
+ # Retrieve a list of accounts within a given subscription.
706
+ #
707
+ # @param next_page_link [String] The NextLink from the previous successful call
708
+ # to List operation.
709
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
710
+ # will be added to the HTTP request.
711
+ #
712
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
713
+ #
714
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
715
+ list_next_async(next_page_link, custom_headers).value!
716
+ end
717
+
718
+ #
719
+ # Lists the Automation Accounts within an Azure subscription.
720
+ #
721
+ # Retrieve a list of accounts within a given subscription.
722
+ #
723
+ # @param next_page_link [String] The NextLink from the previous successful call
724
+ # to List operation.
725
+ # @param [Hash{String => String}] A hash of custom headers that will be added
726
+ # to the HTTP request.
727
+ #
728
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
729
+ #
730
+ def list_next_async(next_page_link, custom_headers = nil)
731
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
732
+
733
+
734
+ request_headers = {}
735
+
736
+ # Set Headers
737
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
738
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
739
+ path_template = '{nextLink}'
740
+
741
+ request_url = @base_url || @client.base_url
742
+
743
+ options = {
744
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
745
+ skip_encoding_path_params: {'nextLink' => next_page_link},
746
+ headers: request_headers.merge(custom_headers || {}),
747
+ base_url: request_url
748
+ }
749
+ promise = @client.make_request_async(:get, path_template, options)
750
+
751
+ promise = promise.then do |result|
752
+ http_response = result.response
753
+ status_code = http_response.status
754
+ response_content = http_response.body
755
+ unless status_code == 200
756
+ error_model = JSON.load(response_content)
757
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
758
+ end
759
+
760
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
761
+ # Deserialize Response
762
+ if status_code == 200
763
+ begin
764
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
765
+ result_mapper = Azure::ARM::Automation::Models::AutomationAccountListResult.mapper()
766
+ result.body = @client.deserialize(result_mapper, parsed_response)
767
+ rescue Exception => e
768
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
769
+ end
770
+ end
771
+
772
+ result
773
+ end
774
+
775
+ promise.execute
776
+ end
777
+
778
+ #
779
+ # Retrieve a list of accounts within a given resource group.
780
+ #
781
+ # @param resource_group_name [String] The resource group name.
782
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
783
+ # will be added to the HTTP request.
784
+ #
785
+ # @return [AutomationAccountListResult] which provide lazy access to pages of
786
+ # the response.
787
+ #
788
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
789
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
790
+ unless response.nil?
791
+ page = response.body
792
+ page.next_method = Proc.new do |next_page_link|
793
+ list_by_resource_group_next_async(next_page_link, custom_headers)
794
+ end
795
+ page
796
+ end
797
+ end
798
+
799
+ #
800
+ # Lists the Automation Accounts within an Azure subscription.
801
+ #
802
+ # Retrieve a list of accounts within a given subscription.
803
+ #
804
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
805
+ # will be added to the HTTP request.
806
+ #
807
+ # @return [AutomationAccountListResult] which provide lazy access to pages of
808
+ # the response.
809
+ #
810
+ def list_as_lazy(custom_headers = nil)
811
+ response = list_async(custom_headers).value!
812
+ unless response.nil?
813
+ page = response.body
814
+ page.next_method = Proc.new do |next_page_link|
815
+ list_next_async(next_page_link, custom_headers)
816
+ end
817
+ page
818
+ end
819
+ end
820
+
821
+ end
822
+ end