azure_mgmt_devtestlabs 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generated/azure_mgmt_devtestlabs.rb +149 -55
  3. data/lib/generated/azure_mgmt_devtestlabs/arm_templates.rb +363 -0
  4. data/lib/generated/azure_mgmt_devtestlabs/{artifact_source_operations.rb → artifact_sources.rb} +85 -69
  5. data/lib/generated/azure_mgmt_devtestlabs/{artifact_operations.rb → artifacts.rb} +59 -43
  6. data/lib/generated/azure_mgmt_devtestlabs/costs.rb +244 -0
  7. data/lib/generated/azure_mgmt_devtestlabs/{custom_image_operations.rb → custom_images.rb} +81 -68
  8. data/lib/generated/azure_mgmt_devtestlabs/dev_test_labs_client.rb +73 -37
  9. data/lib/generated/azure_mgmt_devtestlabs/disks.rb +975 -0
  10. data/lib/generated/azure_mgmt_devtestlabs/environments.rb +672 -0
  11. data/lib/generated/azure_mgmt_devtestlabs/{formula_operations.rb → formulas.rb} +82 -64
  12. data/lib/generated/azure_mgmt_devtestlabs/{gallery_image_operations.rb → gallery_images.rb} +33 -26
  13. data/lib/generated/azure_mgmt_devtestlabs/global_schedules.rb +1121 -0
  14. data/lib/generated/azure_mgmt_devtestlabs/{lab_operations.rb → labs.rb} +439 -141
  15. data/lib/generated/azure_mgmt_devtestlabs/models/applicable_schedule.rb +105 -0
  16. data/lib/generated/azure_mgmt_devtestlabs/models/applicable_schedule_fragment.rb +105 -0
  17. data/lib/generated/azure_mgmt_devtestlabs/models/apply_artifacts_request.rb +2 -1
  18. data/lib/generated/azure_mgmt_devtestlabs/models/arm_template.rb +167 -0
  19. data/lib/generated/azure_mgmt_devtestlabs/models/arm_template_info.rb +2 -1
  20. data/lib/generated/azure_mgmt_devtestlabs/models/arm_template_parameter_properties.rb +55 -0
  21. data/lib/generated/azure_mgmt_devtestlabs/models/artifact.rb +70 -53
  22. data/lib/generated/azure_mgmt_devtestlabs/models/artifact_deployment_status_properties.rb +2 -1
  23. data/lib/generated/azure_mgmt_devtestlabs/models/artifact_deployment_status_properties_fragment.rb +68 -0
  24. data/lib/generated/azure_mgmt_devtestlabs/models/artifact_install_properties.rb +43 -1
  25. data/lib/generated/azure_mgmt_devtestlabs/models/artifact_install_properties_fragment.rb +105 -0
  26. data/lib/generated/azure_mgmt_devtestlabs/models/artifact_parameter_properties.rb +2 -1
  27. data/lib/generated/azure_mgmt_devtestlabs/models/artifact_parameter_properties_fragment.rb +55 -0
  28. data/lib/generated/azure_mgmt_devtestlabs/models/artifact_source.rb +75 -62
  29. data/lib/generated/azure_mgmt_devtestlabs/models/artifact_source_fragment.rb +185 -0
  30. data/lib/generated/azure_mgmt_devtestlabs/models/attach_disk_properties.rb +46 -0
  31. data/lib/generated/azure_mgmt_devtestlabs/models/attach_new_data_disk_options.rb +66 -0
  32. data/lib/generated/azure_mgmt_devtestlabs/models/bulk_creation_parameters.rb +45 -0
  33. data/lib/generated/azure_mgmt_devtestlabs/models/compute_data_disk.rb +76 -0
  34. data/lib/generated/azure_mgmt_devtestlabs/models/compute_data_disk_fragment.rb +76 -0
  35. data/lib/generated/azure_mgmt_devtestlabs/models/compute_vm_instance_view_status.rb +65 -0
  36. data/lib/generated/azure_mgmt_devtestlabs/models/compute_vm_instance_view_status_fragment.rb +65 -0
  37. data/lib/generated/azure_mgmt_devtestlabs/models/compute_vm_properties.rb +131 -0
  38. data/lib/generated/azure_mgmt_devtestlabs/models/compute_vm_properties_fragment.rb +131 -0
  39. data/lib/generated/azure_mgmt_devtestlabs/models/cost_threshold_properties.rb +92 -0
  40. data/lib/generated/azure_mgmt_devtestlabs/models/cost_threshold_status.rb +16 -0
  41. data/lib/generated/azure_mgmt_devtestlabs/models/{lab_cost_type.rb → cost_type.rb} +3 -3
  42. data/lib/generated/azure_mgmt_devtestlabs/models/custom_image.rb +58 -57
  43. data/lib/generated/azure_mgmt_devtestlabs/models/custom_image_os_type.rb +1 -1
  44. data/lib/generated/azure_mgmt_devtestlabs/models/custom_image_properties_custom.rb +5 -4
  45. data/lib/generated/azure_mgmt_devtestlabs/models/custom_image_properties_from_vm.rb +2 -1
  46. data/lib/generated/azure_mgmt_devtestlabs/models/data_disk_properties.rb +70 -0
  47. data/lib/generated/azure_mgmt_devtestlabs/models/day_details.rb +3 -2
  48. data/lib/generated/azure_mgmt_devtestlabs/models/{subscription_notification_properties.rb → day_details_fragment.rb} +11 -11
  49. data/lib/generated/azure_mgmt_devtestlabs/models/detach_data_disk_properties.rb +46 -0
  50. data/lib/generated/azure_mgmt_devtestlabs/models/detach_disk_properties.rb +46 -0
  51. data/lib/generated/azure_mgmt_devtestlabs/models/disk.rb +186 -0
  52. data/lib/generated/azure_mgmt_devtestlabs/models/dtl_environment.rb +146 -0
  53. data/lib/generated/azure_mgmt_devtestlabs/models/enable_status.rb +1 -1
  54. data/lib/generated/azure_mgmt_devtestlabs/models/environment_deployment_properties.rb +64 -0
  55. data/lib/generated/azure_mgmt_devtestlabs/models/evaluate_policies_properties.rb +2 -1
  56. data/lib/generated/azure_mgmt_devtestlabs/models/evaluate_policies_request.rb +2 -1
  57. data/lib/generated/azure_mgmt_devtestlabs/models/evaluate_policies_response.rb +2 -1
  58. data/lib/generated/azure_mgmt_devtestlabs/models/event.rb +47 -0
  59. data/lib/generated/azure_mgmt_devtestlabs/models/event_fragment.rb +47 -0
  60. data/lib/generated/azure_mgmt_devtestlabs/models/export_resource_usage_parameters.rb +58 -0
  61. data/lib/generated/azure_mgmt_devtestlabs/models/external_subnet.rb +55 -0
  62. data/lib/generated/azure_mgmt_devtestlabs/models/external_subnet_fragment.rb +55 -0
  63. data/lib/generated/azure_mgmt_devtestlabs/models/file_upload_options.rb +16 -0
  64. data/lib/generated/azure_mgmt_devtestlabs/models/formula.rb +53 -61
  65. data/lib/generated/azure_mgmt_devtestlabs/models/formula_properties_from_vm.rb +2 -1
  66. data/lib/generated/azure_mgmt_devtestlabs/models/gallery_image.rb +44 -54
  67. data/lib/generated/azure_mgmt_devtestlabs/models/gallery_image_reference.rb +2 -1
  68. data/lib/generated/azure_mgmt_devtestlabs/models/gallery_image_reference_fragment.rb +85 -0
  69. data/lib/generated/azure_mgmt_devtestlabs/models/generate_arm_template_request.rb +14 -1
  70. data/lib/generated/azure_mgmt_devtestlabs/models/generate_upload_uri_parameter.rb +2 -1
  71. data/lib/generated/azure_mgmt_devtestlabs/models/generate_upload_uri_response.rb +2 -1
  72. data/lib/generated/azure_mgmt_devtestlabs/models/host_caching_options.rb +17 -0
  73. data/lib/generated/azure_mgmt_devtestlabs/models/hour_details.rb +2 -1
  74. data/lib/generated/azure_mgmt_devtestlabs/models/hour_details_fragment.rb +45 -0
  75. data/lib/generated/azure_mgmt_devtestlabs/models/identity_properties.rb +75 -0
  76. data/lib/generated/azure_mgmt_devtestlabs/models/inbound_nat_rule.rb +70 -0
  77. data/lib/generated/azure_mgmt_devtestlabs/models/inbound_nat_rule_fragment.rb +70 -0
  78. data/lib/generated/azure_mgmt_devtestlabs/models/lab.rb +85 -54
  79. data/lib/generated/azure_mgmt_devtestlabs/models/lab_cost.rb +204 -0
  80. data/lib/generated/azure_mgmt_devtestlabs/models/{cost_per_day_properties.rb → lab_cost_details_properties.rb} +7 -6
  81. data/lib/generated/azure_mgmt_devtestlabs/models/lab_cost_summary_properties.rb +45 -0
  82. data/lib/generated/azure_mgmt_devtestlabs/models/lab_fragment.rb +127 -0
  83. data/lib/generated/azure_mgmt_devtestlabs/models/{resource_cost_properties.rb → lab_resource_cost_properties.rb} +49 -28
  84. data/lib/generated/azure_mgmt_devtestlabs/models/lab_vhd.rb +3 -2
  85. data/lib/generated/azure_mgmt_devtestlabs/models/lab_virtual_machine.rb +141 -42
  86. data/lib/generated/azure_mgmt_devtestlabs/models/lab_virtual_machine_creation_parameter.rb +412 -0
  87. data/lib/generated/azure_mgmt_devtestlabs/models/lab_virtual_machine_fragment.rb +410 -0
  88. data/lib/generated/azure_mgmt_devtestlabs/models/linux_os_info.rb +5 -3
  89. data/lib/generated/azure_mgmt_devtestlabs/models/linux_os_state.rb +1 -1
  90. data/lib/generated/azure_mgmt_devtestlabs/models/network_interface_properties.rb +130 -0
  91. data/lib/generated/azure_mgmt_devtestlabs/models/network_interface_properties_fragment.rb +130 -0
  92. data/lib/generated/azure_mgmt_devtestlabs/models/notification_channel.rb +150 -0
  93. data/lib/generated/azure_mgmt_devtestlabs/models/notification_channel_event_type.rb +16 -0
  94. data/lib/generated/azure_mgmt_devtestlabs/models/{cost.rb → notification_channel_fragment.rb} +64 -64
  95. data/lib/generated/azure_mgmt_devtestlabs/models/notification_settings.rb +69 -0
  96. data/lib/generated/azure_mgmt_devtestlabs/models/notification_settings_fragment.rb +69 -0
  97. data/lib/generated/azure_mgmt_devtestlabs/models/notification_status.rb +16 -0
  98. data/lib/generated/azure_mgmt_devtestlabs/models/notify_parameters.rb +56 -0
  99. data/lib/generated/azure_mgmt_devtestlabs/models/parameter_info.rb +5 -5
  100. data/lib/generated/azure_mgmt_devtestlabs/models/parameters_value_file_info.rb +55 -0
  101. data/lib/generated/azure_mgmt_devtestlabs/models/percentage_cost_threshold_properties.rb +45 -0
  102. data/lib/generated/azure_mgmt_devtestlabs/models/policy.rb +62 -58
  103. data/lib/generated/azure_mgmt_devtestlabs/models/policy_evaluator_type.rb +1 -1
  104. data/lib/generated/azure_mgmt_devtestlabs/models/policy_fact_name.rb +4 -1
  105. data/lib/generated/azure_mgmt_devtestlabs/models/policy_fragment.rb +168 -0
  106. data/lib/generated/azure_mgmt_devtestlabs/models/policy_set_result.rb +2 -1
  107. data/lib/generated/azure_mgmt_devtestlabs/models/policy_status.rb +1 -1
  108. data/lib/generated/azure_mgmt_devtestlabs/models/policy_violation.rb +2 -1
  109. data/lib/generated/azure_mgmt_devtestlabs/models/port.rb +56 -0
  110. data/lib/generated/azure_mgmt_devtestlabs/models/port_fragment.rb +56 -0
  111. data/lib/generated/azure_mgmt_devtestlabs/models/premium_data_disk.rb +16 -0
  112. data/lib/generated/azure_mgmt_devtestlabs/models/reporting_cycle_type.rb +16 -0
  113. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_arm_template.rb +94 -0
  114. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_artifact.rb +2 -1
  115. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_artifact_source.rb +2 -1
  116. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_custom_image.rb +2 -1
  117. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_disk.rb +94 -0
  118. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_dtl_environment.rb +95 -0
  119. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_formula.rb +2 -1
  120. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_gallery_image.rb +2 -1
  121. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_lab.rb +2 -1
  122. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_lab_vhd.rb +2 -1
  123. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_lab_virtual_machine.rb +2 -1
  124. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_notification_channel.rb +96 -0
  125. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_policy.rb +2 -1
  126. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_schedule.rb +2 -1
  127. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_secret.rb +94 -0
  128. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_service_runner.rb +94 -0
  129. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_user.rb +94 -0
  130. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_virtual_network.rb +2 -1
  131. data/lib/generated/azure_mgmt_devtestlabs/models/retarget_schedule_properties.rb +57 -0
  132. data/lib/generated/azure_mgmt_devtestlabs/models/schedule.rb +82 -57
  133. data/lib/generated/azure_mgmt_devtestlabs/models/schedule_fragment.rb +189 -0
  134. data/lib/generated/azure_mgmt_devtestlabs/models/secret.rb +110 -0
  135. data/lib/generated/azure_mgmt_devtestlabs/models/service_runner.rb +91 -0
  136. data/lib/generated/azure_mgmt_devtestlabs/models/shared_public_ip_address_configuration.rb +54 -0
  137. data/lib/generated/azure_mgmt_devtestlabs/models/shared_public_ip_address_configuration_fragment.rb +55 -0
  138. data/lib/generated/azure_mgmt_devtestlabs/models/shutdown_notification_content.rb +147 -0
  139. data/lib/generated/azure_mgmt_devtestlabs/models/source_control_type.rb +1 -1
  140. data/lib/generated/azure_mgmt_devtestlabs/models/{lab_storage_type.rb → storage_type.rb} +3 -3
  141. data/lib/generated/azure_mgmt_devtestlabs/models/subnet.rb +8 -7
  142. data/lib/generated/azure_mgmt_devtestlabs/models/subnet_fragment.rb +67 -0
  143. data/lib/generated/azure_mgmt_devtestlabs/models/subnet_override.rb +29 -6
  144. data/lib/generated/azure_mgmt_devtestlabs/models/subnet_override_fragment.rb +101 -0
  145. data/lib/generated/azure_mgmt_devtestlabs/models/subnet_shared_public_ip_address_configuration.rb +54 -0
  146. data/lib/generated/azure_mgmt_devtestlabs/models/subnet_shared_public_ip_address_configuration_fragment.rb +55 -0
  147. data/lib/generated/azure_mgmt_devtestlabs/models/target_cost_properties.rb +105 -0
  148. data/lib/generated/azure_mgmt_devtestlabs/models/target_cost_status.rb +16 -0
  149. data/lib/generated/azure_mgmt_devtestlabs/models/transport_protocol.rb +16 -0
  150. data/lib/generated/azure_mgmt_devtestlabs/models/usage_permission_type.rb +1 -1
  151. data/lib/generated/azure_mgmt_devtestlabs/models/user.rb +133 -0
  152. data/lib/generated/azure_mgmt_devtestlabs/models/user_fragment.rb +122 -0
  153. data/lib/generated/azure_mgmt_devtestlabs/models/user_identity.rb +91 -0
  154. data/lib/generated/azure_mgmt_devtestlabs/models/user_identity_fragment.rb +91 -0
  155. data/lib/generated/azure_mgmt_devtestlabs/models/user_secret_store.rb +55 -0
  156. data/lib/generated/azure_mgmt_devtestlabs/models/user_secret_store_fragment.rb +55 -0
  157. data/lib/generated/azure_mgmt_devtestlabs/models/virtual_machine_creation_source.rb +16 -0
  158. data/lib/generated/azure_mgmt_devtestlabs/models/virtual_network.rb +77 -59
  159. data/lib/generated/azure_mgmt_devtestlabs/models/virtual_network_fragment.rb +177 -0
  160. data/lib/generated/azure_mgmt_devtestlabs/models/week_details.rb +5 -3
  161. data/lib/generated/azure_mgmt_devtestlabs/models/week_details_fragment.rb +63 -0
  162. data/lib/generated/azure_mgmt_devtestlabs/models/windows_os_info.rb +4 -2
  163. data/lib/generated/azure_mgmt_devtestlabs/models/windows_os_state.rb +1 -1
  164. data/lib/generated/azure_mgmt_devtestlabs/module_definition.rb +1 -1
  165. data/lib/generated/azure_mgmt_devtestlabs/notification_channels.rb +764 -0
  166. data/lib/generated/azure_mgmt_devtestlabs/{policy_operations.rb → policies.rb} +82 -69
  167. data/lib/generated/azure_mgmt_devtestlabs/{policy_set.rb → policy_sets.rb} +18 -16
  168. data/lib/generated/azure_mgmt_devtestlabs/{virtual_machine.rb → schedules.rb} +282 -417
  169. data/lib/generated/azure_mgmt_devtestlabs/secrets.rb +573 -0
  170. data/lib/generated/azure_mgmt_devtestlabs/service_runners.rb +545 -0
  171. data/lib/generated/azure_mgmt_devtestlabs/users.rb +704 -0
  172. data/lib/generated/azure_mgmt_devtestlabs/version.rb +2 -2
  173. data/lib/generated/azure_mgmt_devtestlabs/{schedule_operations.rb → virtual_machine_schedules.rb} +132 -92
  174. data/lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb +1669 -0
  175. data/lib/generated/azure_mgmt_devtestlabs/{virtual_network_operations.rb → virtual_networks.rb} +94 -81
  176. metadata +118 -24
  177. data/lib/generated/azure_mgmt_devtestlabs/cost_operations.rb +0 -121
  178. data/lib/generated/azure_mgmt_devtestlabs/models/subscription_notification.rb +0 -68
  179. data/lib/generated/azure_mgmt_devtestlabs/models/subscription_notification_state.rb +0 -20
@@ -0,0 +1,1669 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::DevTestLabs
7
+ #
8
+ # The DevTest Labs Client.
9
+ #
10
+ class VirtualMachines
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the VirtualMachines class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [DevTestLabsClient] reference to the DevTestLabsClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # List virtual machines in a given lab.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group.
28
+ # @param lab_name [String] The name of the lab.
29
+ # @param expand [String] Specify the $expand query. Example:
30
+ # 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'
31
+ # @param filter [String] The filter to apply to the operation.
32
+ # @param top [Integer] The maximum number of resources to return from the
33
+ # operation.
34
+ # @param orderby [String] The ordering expression for the results, using OData
35
+ # notation.
36
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
37
+ # will be added to the HTTP request.
38
+ #
39
+ # @return [Array<LabVirtualMachine>] operation results.
40
+ #
41
+ def list(resource_group_name, lab_name, expand = nil, filter = nil, top = nil, orderby = nil, custom_headers = nil)
42
+ first_page = list_as_lazy(resource_group_name, lab_name, expand, filter, top, orderby, custom_headers)
43
+ first_page.get_all_items
44
+ end
45
+
46
+ #
47
+ # List virtual machines in a given lab.
48
+ #
49
+ # @param resource_group_name [String] The name of the resource group.
50
+ # @param lab_name [String] The name of the lab.
51
+ # @param expand [String] Specify the $expand query. Example:
52
+ # 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'
53
+ # @param filter [String] The filter to apply to the operation.
54
+ # @param top [Integer] The maximum number of resources to return from the
55
+ # operation.
56
+ # @param orderby [String] The ordering expression for the results, using OData
57
+ # notation.
58
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
59
+ # will be added to the HTTP request.
60
+ #
61
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
62
+ #
63
+ def list_with_http_info(resource_group_name, lab_name, expand = nil, filter = nil, top = nil, orderby = nil, custom_headers = nil)
64
+ list_async(resource_group_name, lab_name, expand, filter, top, orderby, custom_headers).value!
65
+ end
66
+
67
+ #
68
+ # List virtual machines in a given lab.
69
+ #
70
+ # @param resource_group_name [String] The name of the resource group.
71
+ # @param lab_name [String] The name of the lab.
72
+ # @param expand [String] Specify the $expand query. Example:
73
+ # 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'
74
+ # @param filter [String] The filter to apply to the operation.
75
+ # @param top [Integer] The maximum number of resources to return from the
76
+ # operation.
77
+ # @param orderby [String] The ordering expression for the results, using OData
78
+ # notation.
79
+ # @param [Hash{String => String}] A hash of custom headers that will be added
80
+ # to the HTTP request.
81
+ #
82
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
83
+ #
84
+ def list_async(resource_group_name, lab_name, expand = nil, filter = nil, top = nil, orderby = nil, custom_headers = nil)
85
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
86
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
87
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
88
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
89
+
90
+
91
+ request_headers = {}
92
+
93
+ # Set Headers
94
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
95
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
96
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines'
97
+
98
+ request_url = @base_url || @client.base_url
99
+
100
+ options = {
101
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
102
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name},
103
+ query_params: {'$expand' => expand,'$filter' => filter,'$top' => top,'$orderby' => orderby,'api-version' => @client.api_version},
104
+ headers: request_headers.merge(custom_headers || {}),
105
+ base_url: request_url
106
+ }
107
+ promise = @client.make_request_async(:get, path_template, options)
108
+
109
+ promise = promise.then do |result|
110
+ http_response = result.response
111
+ status_code = http_response.status
112
+ response_content = http_response.body
113
+ unless status_code == 200
114
+ error_model = JSON.load(response_content)
115
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
116
+ end
117
+
118
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
119
+ # Deserialize Response
120
+ if status_code == 200
121
+ begin
122
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
123
+ result_mapper = Azure::ARM::DevTestLabs::Models::ResponseWithContinuationLabVirtualMachine.mapper()
124
+ result.body = @client.deserialize(result_mapper, parsed_response)
125
+ rescue Exception => e
126
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
127
+ end
128
+ end
129
+
130
+ result
131
+ end
132
+
133
+ promise.execute
134
+ end
135
+
136
+ #
137
+ # Get virtual machine.
138
+ #
139
+ # @param resource_group_name [String] The name of the resource group.
140
+ # @param lab_name [String] The name of the lab.
141
+ # @param name [String] The name of the virtual machine.
142
+ # @param expand [String] Specify the $expand query. Example:
143
+ # 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'
144
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
145
+ # will be added to the HTTP request.
146
+ #
147
+ # @return [LabVirtualMachine] operation results.
148
+ #
149
+ def get(resource_group_name, lab_name, name, expand = nil, custom_headers = nil)
150
+ response = get_async(resource_group_name, lab_name, name, expand, custom_headers).value!
151
+ response.body unless response.nil?
152
+ end
153
+
154
+ #
155
+ # Get virtual machine.
156
+ #
157
+ # @param resource_group_name [String] The name of the resource group.
158
+ # @param lab_name [String] The name of the lab.
159
+ # @param name [String] The name of the virtual machine.
160
+ # @param expand [String] Specify the $expand query. Example:
161
+ # 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'
162
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
163
+ # will be added to the HTTP request.
164
+ #
165
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
166
+ #
167
+ def get_with_http_info(resource_group_name, lab_name, name, expand = nil, custom_headers = nil)
168
+ get_async(resource_group_name, lab_name, name, expand, custom_headers).value!
169
+ end
170
+
171
+ #
172
+ # Get virtual machine.
173
+ #
174
+ # @param resource_group_name [String] The name of the resource group.
175
+ # @param lab_name [String] The name of the lab.
176
+ # @param name [String] The name of the virtual machine.
177
+ # @param expand [String] Specify the $expand query. Example:
178
+ # 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'
179
+ # @param [Hash{String => String}] A hash of custom headers that will be added
180
+ # to the HTTP request.
181
+ #
182
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
183
+ #
184
+ def get_async(resource_group_name, lab_name, name, expand = nil, custom_headers = nil)
185
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
186
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
187
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
188
+ fail ArgumentError, 'name is nil' if name.nil?
189
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
190
+
191
+
192
+ request_headers = {}
193
+
194
+ # Set Headers
195
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
196
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
197
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}'
198
+
199
+ request_url = @base_url || @client.base_url
200
+
201
+ options = {
202
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
203
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
204
+ query_params: {'$expand' => expand,'api-version' => @client.api_version},
205
+ headers: request_headers.merge(custom_headers || {}),
206
+ base_url: request_url
207
+ }
208
+ promise = @client.make_request_async(:get, path_template, options)
209
+
210
+ promise = promise.then do |result|
211
+ http_response = result.response
212
+ status_code = http_response.status
213
+ response_content = http_response.body
214
+ unless status_code == 200
215
+ error_model = JSON.load(response_content)
216
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
217
+ end
218
+
219
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
220
+ # Deserialize Response
221
+ if status_code == 200
222
+ begin
223
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
224
+ result_mapper = Azure::ARM::DevTestLabs::Models::LabVirtualMachine.mapper()
225
+ result.body = @client.deserialize(result_mapper, parsed_response)
226
+ rescue Exception => e
227
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
228
+ end
229
+ end
230
+
231
+ result
232
+ end
233
+
234
+ promise.execute
235
+ end
236
+
237
+ #
238
+ # Create or replace an existing Virtual machine. This operation can take a
239
+ # while to complete.
240
+ #
241
+ # @param resource_group_name [String] The name of the resource group.
242
+ # @param lab_name [String] The name of the lab.
243
+ # @param name [String] The name of the virtual machine.
244
+ # @param lab_virtual_machine [LabVirtualMachine] A virtual machine.
245
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
246
+ # will be added to the HTTP request.
247
+ #
248
+ # @return [LabVirtualMachine] operation results.
249
+ #
250
+ def create_or_update(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
251
+ response = create_or_update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers).value!
252
+ response.body unless response.nil?
253
+ end
254
+
255
+ #
256
+ # @param resource_group_name [String] The name of the resource group.
257
+ # @param lab_name [String] The name of the lab.
258
+ # @param name [String] The name of the virtual machine.
259
+ # @param lab_virtual_machine [LabVirtualMachine] A virtual machine.
260
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
261
+ # will be added to the HTTP request.
262
+ #
263
+ # @return [Concurrent::Promise] promise which provides async access to http
264
+ # response.
265
+ #
266
+ def create_or_update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
267
+ # Send request
268
+ promise = begin_create_or_update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers)
269
+
270
+ promise = promise.then do |response|
271
+ # Defining deserialization method.
272
+ deserialize_method = lambda do |parsed_response|
273
+ result_mapper = Azure::ARM::DevTestLabs::Models::LabVirtualMachine.mapper()
274
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
275
+ end
276
+
277
+ # Waiting for response.
278
+ @client.get_long_running_operation_result(response, deserialize_method)
279
+ end
280
+
281
+ promise
282
+ end
283
+
284
+ #
285
+ # Delete virtual machine. This operation can take a while to complete.
286
+ #
287
+ # @param resource_group_name [String] The name of the resource group.
288
+ # @param lab_name [String] The name of the lab.
289
+ # @param name [String] The name of the virtual machine.
290
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
291
+ # will be added to the HTTP request.
292
+ #
293
+ def delete(resource_group_name, lab_name, name, custom_headers = nil)
294
+ response = delete_async(resource_group_name, lab_name, name, custom_headers).value!
295
+ nil
296
+ end
297
+
298
+ #
299
+ # @param resource_group_name [String] The name of the resource group.
300
+ # @param lab_name [String] The name of the lab.
301
+ # @param name [String] The name of the virtual machine.
302
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
303
+ # will be added to the HTTP request.
304
+ #
305
+ # @return [Concurrent::Promise] promise which provides async access to http
306
+ # response.
307
+ #
308
+ def delete_async(resource_group_name, lab_name, name, custom_headers = nil)
309
+ # Send request
310
+ promise = begin_delete_async(resource_group_name, lab_name, name, custom_headers)
311
+
312
+ promise = promise.then do |response|
313
+ # Defining deserialization method.
314
+ deserialize_method = lambda do |parsed_response|
315
+ end
316
+
317
+ # Waiting for response.
318
+ @client.get_long_running_operation_result(response, deserialize_method)
319
+ end
320
+
321
+ promise
322
+ end
323
+
324
+ #
325
+ # Modify properties of virtual machines.
326
+ #
327
+ # @param resource_group_name [String] The name of the resource group.
328
+ # @param lab_name [String] The name of the lab.
329
+ # @param name [String] The name of the virtual machine.
330
+ # @param lab_virtual_machine [LabVirtualMachineFragment] A virtual machine.
331
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
332
+ # will be added to the HTTP request.
333
+ #
334
+ # @return [LabVirtualMachine] operation results.
335
+ #
336
+ def update(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
337
+ response = update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers).value!
338
+ response.body unless response.nil?
339
+ end
340
+
341
+ #
342
+ # Modify properties of virtual machines.
343
+ #
344
+ # @param resource_group_name [String] The name of the resource group.
345
+ # @param lab_name [String] The name of the lab.
346
+ # @param name [String] The name of the virtual machine.
347
+ # @param lab_virtual_machine [LabVirtualMachineFragment] A virtual machine.
348
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
349
+ # will be added to the HTTP request.
350
+ #
351
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
352
+ #
353
+ def update_with_http_info(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
354
+ update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers).value!
355
+ end
356
+
357
+ #
358
+ # Modify properties of virtual machines.
359
+ #
360
+ # @param resource_group_name [String] The name of the resource group.
361
+ # @param lab_name [String] The name of the lab.
362
+ # @param name [String] The name of the virtual machine.
363
+ # @param lab_virtual_machine [LabVirtualMachineFragment] A virtual machine.
364
+ # @param [Hash{String => String}] A hash of custom headers that will be added
365
+ # to the HTTP request.
366
+ #
367
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
368
+ #
369
+ def update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
370
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
371
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
372
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
373
+ fail ArgumentError, 'name is nil' if name.nil?
374
+ fail ArgumentError, 'lab_virtual_machine is nil' if lab_virtual_machine.nil?
375
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
376
+
377
+
378
+ request_headers = {}
379
+
380
+ # Set Headers
381
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
382
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
383
+
384
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
385
+
386
+ # Serialize Request
387
+ request_mapper = Azure::ARM::DevTestLabs::Models::LabVirtualMachineFragment.mapper()
388
+ request_content = @client.serialize(request_mapper, lab_virtual_machine)
389
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
390
+
391
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}'
392
+
393
+ request_url = @base_url || @client.base_url
394
+
395
+ options = {
396
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
397
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
398
+ query_params: {'api-version' => @client.api_version},
399
+ body: request_content,
400
+ headers: request_headers.merge(custom_headers || {}),
401
+ base_url: request_url
402
+ }
403
+ promise = @client.make_request_async(:patch, path_template, options)
404
+
405
+ promise = promise.then do |result|
406
+ http_response = result.response
407
+ status_code = http_response.status
408
+ response_content = http_response.body
409
+ unless status_code == 200
410
+ error_model = JSON.load(response_content)
411
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
412
+ end
413
+
414
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
415
+ # Deserialize Response
416
+ if status_code == 200
417
+ begin
418
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
419
+ result_mapper = Azure::ARM::DevTestLabs::Models::LabVirtualMachine.mapper()
420
+ result.body = @client.deserialize(result_mapper, parsed_response)
421
+ rescue Exception => e
422
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
423
+ end
424
+ end
425
+
426
+ result
427
+ end
428
+
429
+ promise.execute
430
+ end
431
+
432
+ #
433
+ # Attach a new or existing data disk to virtual machine. This operation can
434
+ # take a while to complete.
435
+ #
436
+ # @param resource_group_name [String] The name of the resource group.
437
+ # @param lab_name [String] The name of the lab.
438
+ # @param name [String] The name of the virtual machine.
439
+ # @param data_disk_properties [DataDiskProperties] Request body for adding a
440
+ # new or existing data disk to a virtual machine.
441
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
442
+ # will be added to the HTTP request.
443
+ #
444
+ def add_data_disk(resource_group_name, lab_name, name, data_disk_properties, custom_headers = nil)
445
+ response = add_data_disk_async(resource_group_name, lab_name, name, data_disk_properties, custom_headers).value!
446
+ nil
447
+ end
448
+
449
+ #
450
+ # @param resource_group_name [String] The name of the resource group.
451
+ # @param lab_name [String] The name of the lab.
452
+ # @param name [String] The name of the virtual machine.
453
+ # @param data_disk_properties [DataDiskProperties] Request body for adding a
454
+ # new or existing data disk to a virtual machine.
455
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
456
+ # will be added to the HTTP request.
457
+ #
458
+ # @return [Concurrent::Promise] promise which provides async access to http
459
+ # response.
460
+ #
461
+ def add_data_disk_async(resource_group_name, lab_name, name, data_disk_properties, custom_headers = nil)
462
+ # Send request
463
+ promise = begin_add_data_disk_async(resource_group_name, lab_name, name, data_disk_properties, custom_headers)
464
+
465
+ promise = promise.then do |response|
466
+ # Defining deserialization method.
467
+ deserialize_method = lambda do |parsed_response|
468
+ end
469
+
470
+ # Waiting for response.
471
+ @client.get_long_running_operation_result(response, deserialize_method)
472
+ end
473
+
474
+ promise
475
+ end
476
+
477
+ #
478
+ # Apply artifacts to virtual machine. This operation can take a while to
479
+ # complete.
480
+ #
481
+ # @param resource_group_name [String] The name of the resource group.
482
+ # @param lab_name [String] The name of the lab.
483
+ # @param name [String] The name of the virtual machine.
484
+ # @param apply_artifacts_request [ApplyArtifactsRequest] Request body for
485
+ # applying artifacts to a virtual machine.
486
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
487
+ # will be added to the HTTP request.
488
+ #
489
+ def apply_artifacts(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil)
490
+ response = apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers).value!
491
+ nil
492
+ end
493
+
494
+ #
495
+ # @param resource_group_name [String] The name of the resource group.
496
+ # @param lab_name [String] The name of the lab.
497
+ # @param name [String] The name of the virtual machine.
498
+ # @param apply_artifacts_request [ApplyArtifactsRequest] Request body for
499
+ # applying artifacts to a virtual machine.
500
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
501
+ # will be added to the HTTP request.
502
+ #
503
+ # @return [Concurrent::Promise] promise which provides async access to http
504
+ # response.
505
+ #
506
+ def apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil)
507
+ # Send request
508
+ promise = begin_apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers)
509
+
510
+ promise = promise.then do |response|
511
+ # Defining deserialization method.
512
+ deserialize_method = lambda do |parsed_response|
513
+ end
514
+
515
+ # Waiting for response.
516
+ @client.get_long_running_operation_result(response, deserialize_method)
517
+ end
518
+
519
+ promise
520
+ end
521
+
522
+ #
523
+ # Take ownership of an existing virtual machine This operation can take a while
524
+ # to complete.
525
+ #
526
+ # @param resource_group_name [String] The name of the resource group.
527
+ # @param lab_name [String] The name of the lab.
528
+ # @param name [String] The name of the virtual machine.
529
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
530
+ # will be added to the HTTP request.
531
+ #
532
+ def claim(resource_group_name, lab_name, name, custom_headers = nil)
533
+ response = claim_async(resource_group_name, lab_name, name, custom_headers).value!
534
+ nil
535
+ end
536
+
537
+ #
538
+ # @param resource_group_name [String] The name of the resource group.
539
+ # @param lab_name [String] The name of the lab.
540
+ # @param name [String] The name of the virtual machine.
541
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
542
+ # will be added to the HTTP request.
543
+ #
544
+ # @return [Concurrent::Promise] promise which provides async access to http
545
+ # response.
546
+ #
547
+ def claim_async(resource_group_name, lab_name, name, custom_headers = nil)
548
+ # Send request
549
+ promise = begin_claim_async(resource_group_name, lab_name, name, custom_headers)
550
+
551
+ promise = promise.then do |response|
552
+ # Defining deserialization method.
553
+ deserialize_method = lambda do |parsed_response|
554
+ end
555
+
556
+ # Waiting for response.
557
+ @client.get_long_running_operation_result(response, deserialize_method)
558
+ end
559
+
560
+ promise
561
+ end
562
+
563
+ #
564
+ # Detach the specified disk from the virtual machine. This operation can take a
565
+ # while to complete.
566
+ #
567
+ # @param resource_group_name [String] The name of the resource group.
568
+ # @param lab_name [String] The name of the lab.
569
+ # @param name [String] The name of the virtual machine.
570
+ # @param detach_data_disk_properties [DetachDataDiskProperties] Request body
571
+ # for detaching data disk from a virtual machine.
572
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
573
+ # will be added to the HTTP request.
574
+ #
575
+ def detach_data_disk(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers = nil)
576
+ response = detach_data_disk_async(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers).value!
577
+ nil
578
+ end
579
+
580
+ #
581
+ # @param resource_group_name [String] The name of the resource group.
582
+ # @param lab_name [String] The name of the lab.
583
+ # @param name [String] The name of the virtual machine.
584
+ # @param detach_data_disk_properties [DetachDataDiskProperties] Request body
585
+ # for detaching data disk from a virtual machine.
586
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
587
+ # will be added to the HTTP request.
588
+ #
589
+ # @return [Concurrent::Promise] promise which provides async access to http
590
+ # response.
591
+ #
592
+ def detach_data_disk_async(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers = nil)
593
+ # Send request
594
+ promise = begin_detach_data_disk_async(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers)
595
+
596
+ promise = promise.then do |response|
597
+ # Defining deserialization method.
598
+ deserialize_method = lambda do |parsed_response|
599
+ end
600
+
601
+ # Waiting for response.
602
+ @client.get_long_running_operation_result(response, deserialize_method)
603
+ end
604
+
605
+ promise
606
+ end
607
+
608
+ #
609
+ # Lists all applicable schedules
610
+ #
611
+ # @param resource_group_name [String] The name of the resource group.
612
+ # @param lab_name [String] The name of the lab.
613
+ # @param name [String] The name of the virtual machine.
614
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
615
+ # will be added to the HTTP request.
616
+ #
617
+ # @return [ApplicableSchedule] operation results.
618
+ #
619
+ def list_applicable_schedules(resource_group_name, lab_name, name, custom_headers = nil)
620
+ response = list_applicable_schedules_async(resource_group_name, lab_name, name, custom_headers).value!
621
+ response.body unless response.nil?
622
+ end
623
+
624
+ #
625
+ # Lists all applicable schedules
626
+ #
627
+ # @param resource_group_name [String] The name of the resource group.
628
+ # @param lab_name [String] The name of the lab.
629
+ # @param name [String] The name of the virtual machine.
630
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
631
+ # will be added to the HTTP request.
632
+ #
633
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
634
+ #
635
+ def list_applicable_schedules_with_http_info(resource_group_name, lab_name, name, custom_headers = nil)
636
+ list_applicable_schedules_async(resource_group_name, lab_name, name, custom_headers).value!
637
+ end
638
+
639
+ #
640
+ # Lists all applicable schedules
641
+ #
642
+ # @param resource_group_name [String] The name of the resource group.
643
+ # @param lab_name [String] The name of the lab.
644
+ # @param name [String] The name of the virtual machine.
645
+ # @param [Hash{String => String}] A hash of custom headers that will be added
646
+ # to the HTTP request.
647
+ #
648
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
649
+ #
650
+ def list_applicable_schedules_async(resource_group_name, lab_name, name, custom_headers = nil)
651
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
652
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
653
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
654
+ fail ArgumentError, 'name is nil' if name.nil?
655
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
656
+
657
+
658
+ request_headers = {}
659
+
660
+ # Set Headers
661
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
662
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
663
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules'
664
+
665
+ request_url = @base_url || @client.base_url
666
+
667
+ options = {
668
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
669
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
670
+ query_params: {'api-version' => @client.api_version},
671
+ headers: request_headers.merge(custom_headers || {}),
672
+ base_url: request_url
673
+ }
674
+ promise = @client.make_request_async(:post, path_template, options)
675
+
676
+ promise = promise.then do |result|
677
+ http_response = result.response
678
+ status_code = http_response.status
679
+ response_content = http_response.body
680
+ unless status_code == 200
681
+ error_model = JSON.load(response_content)
682
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
683
+ end
684
+
685
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
686
+ # Deserialize Response
687
+ if status_code == 200
688
+ begin
689
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
690
+ result_mapper = Azure::ARM::DevTestLabs::Models::ApplicableSchedule.mapper()
691
+ result.body = @client.deserialize(result_mapper, parsed_response)
692
+ rescue Exception => e
693
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
694
+ end
695
+ end
696
+
697
+ result
698
+ end
699
+
700
+ promise.execute
701
+ end
702
+
703
+ #
704
+ # Start a virtual machine. This operation can take a while to complete.
705
+ #
706
+ # @param resource_group_name [String] The name of the resource group.
707
+ # @param lab_name [String] The name of the lab.
708
+ # @param name [String] The name of the virtual machine.
709
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
710
+ # will be added to the HTTP request.
711
+ #
712
+ def start(resource_group_name, lab_name, name, custom_headers = nil)
713
+ response = start_async(resource_group_name, lab_name, name, custom_headers).value!
714
+ nil
715
+ end
716
+
717
+ #
718
+ # @param resource_group_name [String] The name of the resource group.
719
+ # @param lab_name [String] The name of the lab.
720
+ # @param name [String] The name of the virtual machine.
721
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
722
+ # will be added to the HTTP request.
723
+ #
724
+ # @return [Concurrent::Promise] promise which provides async access to http
725
+ # response.
726
+ #
727
+ def start_async(resource_group_name, lab_name, name, custom_headers = nil)
728
+ # Send request
729
+ promise = begin_start_async(resource_group_name, lab_name, name, custom_headers)
730
+
731
+ promise = promise.then do |response|
732
+ # Defining deserialization method.
733
+ deserialize_method = lambda do |parsed_response|
734
+ end
735
+
736
+ # Waiting for response.
737
+ @client.get_long_running_operation_result(response, deserialize_method)
738
+ end
739
+
740
+ promise
741
+ end
742
+
743
+ #
744
+ # Stop a virtual machine This operation can take a while to complete.
745
+ #
746
+ # @param resource_group_name [String] The name of the resource group.
747
+ # @param lab_name [String] The name of the lab.
748
+ # @param name [String] The name of the virtual machine.
749
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
750
+ # will be added to the HTTP request.
751
+ #
752
+ def stop(resource_group_name, lab_name, name, custom_headers = nil)
753
+ response = stop_async(resource_group_name, lab_name, name, custom_headers).value!
754
+ nil
755
+ end
756
+
757
+ #
758
+ # @param resource_group_name [String] The name of the resource group.
759
+ # @param lab_name [String] The name of the lab.
760
+ # @param name [String] The name of the virtual machine.
761
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
762
+ # will be added to the HTTP request.
763
+ #
764
+ # @return [Concurrent::Promise] promise which provides async access to http
765
+ # response.
766
+ #
767
+ def stop_async(resource_group_name, lab_name, name, custom_headers = nil)
768
+ # Send request
769
+ promise = begin_stop_async(resource_group_name, lab_name, name, custom_headers)
770
+
771
+ promise = promise.then do |response|
772
+ # Defining deserialization method.
773
+ deserialize_method = lambda do |parsed_response|
774
+ end
775
+
776
+ # Waiting for response.
777
+ @client.get_long_running_operation_result(response, deserialize_method)
778
+ end
779
+
780
+ promise
781
+ end
782
+
783
+ #
784
+ # Create or replace an existing Virtual machine. This operation can take a
785
+ # while to complete.
786
+ #
787
+ # @param resource_group_name [String] The name of the resource group.
788
+ # @param lab_name [String] The name of the lab.
789
+ # @param name [String] The name of the virtual machine.
790
+ # @param lab_virtual_machine [LabVirtualMachine] A virtual machine.
791
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
792
+ # will be added to the HTTP request.
793
+ #
794
+ # @return [LabVirtualMachine] operation results.
795
+ #
796
+ def begin_create_or_update(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
797
+ response = begin_create_or_update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers).value!
798
+ response.body unless response.nil?
799
+ end
800
+
801
+ #
802
+ # Create or replace an existing Virtual machine. This operation can take a
803
+ # while to complete.
804
+ #
805
+ # @param resource_group_name [String] The name of the resource group.
806
+ # @param lab_name [String] The name of the lab.
807
+ # @param name [String] The name of the virtual machine.
808
+ # @param lab_virtual_machine [LabVirtualMachine] A virtual machine.
809
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
810
+ # will be added to the HTTP request.
811
+ #
812
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
813
+ #
814
+ def begin_create_or_update_with_http_info(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
815
+ begin_create_or_update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers).value!
816
+ end
817
+
818
+ #
819
+ # Create or replace an existing Virtual machine. This operation can take a
820
+ # while to complete.
821
+ #
822
+ # @param resource_group_name [String] The name of the resource group.
823
+ # @param lab_name [String] The name of the lab.
824
+ # @param name [String] The name of the virtual machine.
825
+ # @param lab_virtual_machine [LabVirtualMachine] A virtual machine.
826
+ # @param [Hash{String => String}] A hash of custom headers that will be added
827
+ # to the HTTP request.
828
+ #
829
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
830
+ #
831
+ def begin_create_or_update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
832
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
833
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
834
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
835
+ fail ArgumentError, 'name is nil' if name.nil?
836
+ fail ArgumentError, 'lab_virtual_machine is nil' if lab_virtual_machine.nil?
837
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
838
+
839
+
840
+ request_headers = {}
841
+
842
+ # Set Headers
843
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
844
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
845
+
846
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
847
+
848
+ # Serialize Request
849
+ request_mapper = Azure::ARM::DevTestLabs::Models::LabVirtualMachine.mapper()
850
+ request_content = @client.serialize(request_mapper, lab_virtual_machine)
851
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
852
+
853
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}'
854
+
855
+ request_url = @base_url || @client.base_url
856
+
857
+ options = {
858
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
859
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
860
+ query_params: {'api-version' => @client.api_version},
861
+ body: request_content,
862
+ headers: request_headers.merge(custom_headers || {}),
863
+ base_url: request_url
864
+ }
865
+ promise = @client.make_request_async(:put, path_template, options)
866
+
867
+ promise = promise.then do |result|
868
+ http_response = result.response
869
+ status_code = http_response.status
870
+ response_content = http_response.body
871
+ unless status_code == 200 || status_code == 201
872
+ error_model = JSON.load(response_content)
873
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
874
+ end
875
+
876
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
877
+ # Deserialize Response
878
+ if status_code == 200
879
+ begin
880
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
881
+ result_mapper = Azure::ARM::DevTestLabs::Models::LabVirtualMachine.mapper()
882
+ result.body = @client.deserialize(result_mapper, parsed_response)
883
+ rescue Exception => e
884
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
885
+ end
886
+ end
887
+ # Deserialize Response
888
+ if status_code == 201
889
+ begin
890
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
891
+ result_mapper = Azure::ARM::DevTestLabs::Models::LabVirtualMachine.mapper()
892
+ result.body = @client.deserialize(result_mapper, parsed_response)
893
+ rescue Exception => e
894
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
895
+ end
896
+ end
897
+
898
+ result
899
+ end
900
+
901
+ promise.execute
902
+ end
903
+
904
+ #
905
+ # Delete virtual machine. This operation can take a while to complete.
906
+ #
907
+ # @param resource_group_name [String] The name of the resource group.
908
+ # @param lab_name [String] The name of the lab.
909
+ # @param name [String] The name of the virtual machine.
910
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
911
+ # will be added to the HTTP request.
912
+ #
913
+ #
914
+ def begin_delete(resource_group_name, lab_name, name, custom_headers = nil)
915
+ response = begin_delete_async(resource_group_name, lab_name, name, custom_headers).value!
916
+ nil
917
+ end
918
+
919
+ #
920
+ # Delete virtual machine. This operation can take a while to complete.
921
+ #
922
+ # @param resource_group_name [String] The name of the resource group.
923
+ # @param lab_name [String] The name of the lab.
924
+ # @param name [String] The name of the virtual machine.
925
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
926
+ # will be added to the HTTP request.
927
+ #
928
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
929
+ #
930
+ def begin_delete_with_http_info(resource_group_name, lab_name, name, custom_headers = nil)
931
+ begin_delete_async(resource_group_name, lab_name, name, custom_headers).value!
932
+ end
933
+
934
+ #
935
+ # Delete virtual machine. This operation can take a while to complete.
936
+ #
937
+ # @param resource_group_name [String] The name of the resource group.
938
+ # @param lab_name [String] The name of the lab.
939
+ # @param name [String] The name of the virtual machine.
940
+ # @param [Hash{String => String}] A hash of custom headers that will be added
941
+ # to the HTTP request.
942
+ #
943
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
944
+ #
945
+ def begin_delete_async(resource_group_name, lab_name, name, custom_headers = nil)
946
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
947
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
948
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
949
+ fail ArgumentError, 'name is nil' if name.nil?
950
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
951
+
952
+
953
+ request_headers = {}
954
+
955
+ # Set Headers
956
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
957
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
958
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}'
959
+
960
+ request_url = @base_url || @client.base_url
961
+
962
+ options = {
963
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
964
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
965
+ query_params: {'api-version' => @client.api_version},
966
+ headers: request_headers.merge(custom_headers || {}),
967
+ base_url: request_url
968
+ }
969
+ promise = @client.make_request_async(:delete, path_template, options)
970
+
971
+ promise = promise.then do |result|
972
+ http_response = result.response
973
+ status_code = http_response.status
974
+ response_content = http_response.body
975
+ unless status_code == 202 || status_code == 204
976
+ error_model = JSON.load(response_content)
977
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
978
+ end
979
+
980
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
981
+
982
+ result
983
+ end
984
+
985
+ promise.execute
986
+ end
987
+
988
+ #
989
+ # Attach a new or existing data disk to virtual machine. This operation can
990
+ # take a while to complete.
991
+ #
992
+ # @param resource_group_name [String] The name of the resource group.
993
+ # @param lab_name [String] The name of the lab.
994
+ # @param name [String] The name of the virtual machine.
995
+ # @param data_disk_properties [DataDiskProperties] Request body for adding a
996
+ # new or existing data disk to a virtual machine.
997
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
998
+ # will be added to the HTTP request.
999
+ #
1000
+ #
1001
+ def begin_add_data_disk(resource_group_name, lab_name, name, data_disk_properties, custom_headers = nil)
1002
+ response = begin_add_data_disk_async(resource_group_name, lab_name, name, data_disk_properties, custom_headers).value!
1003
+ nil
1004
+ end
1005
+
1006
+ #
1007
+ # Attach a new or existing data disk to virtual machine. This operation can
1008
+ # take a while to complete.
1009
+ #
1010
+ # @param resource_group_name [String] The name of the resource group.
1011
+ # @param lab_name [String] The name of the lab.
1012
+ # @param name [String] The name of the virtual machine.
1013
+ # @param data_disk_properties [DataDiskProperties] Request body for adding a
1014
+ # new or existing data disk to a virtual machine.
1015
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1016
+ # will be added to the HTTP request.
1017
+ #
1018
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1019
+ #
1020
+ def begin_add_data_disk_with_http_info(resource_group_name, lab_name, name, data_disk_properties, custom_headers = nil)
1021
+ begin_add_data_disk_async(resource_group_name, lab_name, name, data_disk_properties, custom_headers).value!
1022
+ end
1023
+
1024
+ #
1025
+ # Attach a new or existing data disk to virtual machine. This operation can
1026
+ # take a while to complete.
1027
+ #
1028
+ # @param resource_group_name [String] The name of the resource group.
1029
+ # @param lab_name [String] The name of the lab.
1030
+ # @param name [String] The name of the virtual machine.
1031
+ # @param data_disk_properties [DataDiskProperties] Request body for adding a
1032
+ # new or existing data disk to a virtual machine.
1033
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1034
+ # to the HTTP request.
1035
+ #
1036
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1037
+ #
1038
+ def begin_add_data_disk_async(resource_group_name, lab_name, name, data_disk_properties, custom_headers = nil)
1039
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1040
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1041
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
1042
+ fail ArgumentError, 'name is nil' if name.nil?
1043
+ fail ArgumentError, 'data_disk_properties is nil' if data_disk_properties.nil?
1044
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1045
+
1046
+
1047
+ request_headers = {}
1048
+
1049
+ # Set Headers
1050
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1051
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1052
+
1053
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1054
+
1055
+ # Serialize Request
1056
+ request_mapper = Azure::ARM::DevTestLabs::Models::DataDiskProperties.mapper()
1057
+ request_content = @client.serialize(request_mapper, data_disk_properties)
1058
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1059
+
1060
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk'
1061
+
1062
+ request_url = @base_url || @client.base_url
1063
+
1064
+ options = {
1065
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1066
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
1067
+ query_params: {'api-version' => @client.api_version},
1068
+ body: request_content,
1069
+ headers: request_headers.merge(custom_headers || {}),
1070
+ base_url: request_url
1071
+ }
1072
+ promise = @client.make_request_async(:post, path_template, options)
1073
+
1074
+ promise = promise.then do |result|
1075
+ http_response = result.response
1076
+ status_code = http_response.status
1077
+ response_content = http_response.body
1078
+ unless status_code == 200 || status_code == 202
1079
+ error_model = JSON.load(response_content)
1080
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1081
+ end
1082
+
1083
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1084
+
1085
+ result
1086
+ end
1087
+
1088
+ promise.execute
1089
+ end
1090
+
1091
+ #
1092
+ # Apply artifacts to virtual machine. This operation can take a while to
1093
+ # complete.
1094
+ #
1095
+ # @param resource_group_name [String] The name of the resource group.
1096
+ # @param lab_name [String] The name of the lab.
1097
+ # @param name [String] The name of the virtual machine.
1098
+ # @param apply_artifacts_request [ApplyArtifactsRequest] Request body for
1099
+ # applying artifacts to a virtual machine.
1100
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1101
+ # will be added to the HTTP request.
1102
+ #
1103
+ #
1104
+ def begin_apply_artifacts(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil)
1105
+ response = begin_apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers).value!
1106
+ nil
1107
+ end
1108
+
1109
+ #
1110
+ # Apply artifacts to virtual machine. This operation can take a while to
1111
+ # complete.
1112
+ #
1113
+ # @param resource_group_name [String] The name of the resource group.
1114
+ # @param lab_name [String] The name of the lab.
1115
+ # @param name [String] The name of the virtual machine.
1116
+ # @param apply_artifacts_request [ApplyArtifactsRequest] Request body for
1117
+ # applying artifacts to a virtual machine.
1118
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1119
+ # will be added to the HTTP request.
1120
+ #
1121
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1122
+ #
1123
+ def begin_apply_artifacts_with_http_info(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil)
1124
+ begin_apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers).value!
1125
+ end
1126
+
1127
+ #
1128
+ # Apply artifacts to virtual machine. This operation can take a while to
1129
+ # complete.
1130
+ #
1131
+ # @param resource_group_name [String] The name of the resource group.
1132
+ # @param lab_name [String] The name of the lab.
1133
+ # @param name [String] The name of the virtual machine.
1134
+ # @param apply_artifacts_request [ApplyArtifactsRequest] Request body for
1135
+ # applying artifacts to a virtual machine.
1136
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1137
+ # to the HTTP request.
1138
+ #
1139
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1140
+ #
1141
+ def begin_apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil)
1142
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1143
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1144
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
1145
+ fail ArgumentError, 'name is nil' if name.nil?
1146
+ fail ArgumentError, 'apply_artifacts_request is nil' if apply_artifacts_request.nil?
1147
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1148
+
1149
+
1150
+ request_headers = {}
1151
+
1152
+ # Set Headers
1153
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1154
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1155
+
1156
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1157
+
1158
+ # Serialize Request
1159
+ request_mapper = Azure::ARM::DevTestLabs::Models::ApplyArtifactsRequest.mapper()
1160
+ request_content = @client.serialize(request_mapper, apply_artifacts_request)
1161
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1162
+
1163
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts'
1164
+
1165
+ request_url = @base_url || @client.base_url
1166
+
1167
+ options = {
1168
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1169
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
1170
+ query_params: {'api-version' => @client.api_version},
1171
+ body: request_content,
1172
+ headers: request_headers.merge(custom_headers || {}),
1173
+ base_url: request_url
1174
+ }
1175
+ promise = @client.make_request_async(:post, path_template, options)
1176
+
1177
+ promise = promise.then do |result|
1178
+ http_response = result.response
1179
+ status_code = http_response.status
1180
+ response_content = http_response.body
1181
+ unless status_code == 200 || status_code == 202
1182
+ error_model = JSON.load(response_content)
1183
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1184
+ end
1185
+
1186
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1187
+
1188
+ result
1189
+ end
1190
+
1191
+ promise.execute
1192
+ end
1193
+
1194
+ #
1195
+ # Take ownership of an existing virtual machine This operation can take a while
1196
+ # to complete.
1197
+ #
1198
+ # @param resource_group_name [String] The name of the resource group.
1199
+ # @param lab_name [String] The name of the lab.
1200
+ # @param name [String] The name of the virtual machine.
1201
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1202
+ # will be added to the HTTP request.
1203
+ #
1204
+ #
1205
+ def begin_claim(resource_group_name, lab_name, name, custom_headers = nil)
1206
+ response = begin_claim_async(resource_group_name, lab_name, name, custom_headers).value!
1207
+ nil
1208
+ end
1209
+
1210
+ #
1211
+ # Take ownership of an existing virtual machine This operation can take a while
1212
+ # to complete.
1213
+ #
1214
+ # @param resource_group_name [String] The name of the resource group.
1215
+ # @param lab_name [String] The name of the lab.
1216
+ # @param name [String] The name of the virtual machine.
1217
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1218
+ # will be added to the HTTP request.
1219
+ #
1220
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1221
+ #
1222
+ def begin_claim_with_http_info(resource_group_name, lab_name, name, custom_headers = nil)
1223
+ begin_claim_async(resource_group_name, lab_name, name, custom_headers).value!
1224
+ end
1225
+
1226
+ #
1227
+ # Take ownership of an existing virtual machine This operation can take a while
1228
+ # to complete.
1229
+ #
1230
+ # @param resource_group_name [String] The name of the resource group.
1231
+ # @param lab_name [String] The name of the lab.
1232
+ # @param name [String] The name of the virtual machine.
1233
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1234
+ # to the HTTP request.
1235
+ #
1236
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1237
+ #
1238
+ def begin_claim_async(resource_group_name, lab_name, name, custom_headers = nil)
1239
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1240
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1241
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
1242
+ fail ArgumentError, 'name is nil' if name.nil?
1243
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1244
+
1245
+
1246
+ request_headers = {}
1247
+
1248
+ # Set Headers
1249
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1250
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1251
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim'
1252
+
1253
+ request_url = @base_url || @client.base_url
1254
+
1255
+ options = {
1256
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1257
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
1258
+ query_params: {'api-version' => @client.api_version},
1259
+ headers: request_headers.merge(custom_headers || {}),
1260
+ base_url: request_url
1261
+ }
1262
+ promise = @client.make_request_async(:post, path_template, options)
1263
+
1264
+ promise = promise.then do |result|
1265
+ http_response = result.response
1266
+ status_code = http_response.status
1267
+ response_content = http_response.body
1268
+ unless status_code == 200 || status_code == 202
1269
+ error_model = JSON.load(response_content)
1270
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1271
+ end
1272
+
1273
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1274
+
1275
+ result
1276
+ end
1277
+
1278
+ promise.execute
1279
+ end
1280
+
1281
+ #
1282
+ # Detach the specified disk from the virtual machine. This operation can take a
1283
+ # while to complete.
1284
+ #
1285
+ # @param resource_group_name [String] The name of the resource group.
1286
+ # @param lab_name [String] The name of the lab.
1287
+ # @param name [String] The name of the virtual machine.
1288
+ # @param detach_data_disk_properties [DetachDataDiskProperties] Request body
1289
+ # for detaching data disk from a virtual machine.
1290
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1291
+ # will be added to the HTTP request.
1292
+ #
1293
+ #
1294
+ def begin_detach_data_disk(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers = nil)
1295
+ response = begin_detach_data_disk_async(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers).value!
1296
+ nil
1297
+ end
1298
+
1299
+ #
1300
+ # Detach the specified disk from the virtual machine. This operation can take a
1301
+ # while to complete.
1302
+ #
1303
+ # @param resource_group_name [String] The name of the resource group.
1304
+ # @param lab_name [String] The name of the lab.
1305
+ # @param name [String] The name of the virtual machine.
1306
+ # @param detach_data_disk_properties [DetachDataDiskProperties] Request body
1307
+ # for detaching data disk from a virtual machine.
1308
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1309
+ # will be added to the HTTP request.
1310
+ #
1311
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1312
+ #
1313
+ def begin_detach_data_disk_with_http_info(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers = nil)
1314
+ begin_detach_data_disk_async(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers).value!
1315
+ end
1316
+
1317
+ #
1318
+ # Detach the specified disk from the virtual machine. This operation can take a
1319
+ # while to complete.
1320
+ #
1321
+ # @param resource_group_name [String] The name of the resource group.
1322
+ # @param lab_name [String] The name of the lab.
1323
+ # @param name [String] The name of the virtual machine.
1324
+ # @param detach_data_disk_properties [DetachDataDiskProperties] Request body
1325
+ # for detaching data disk from a virtual machine.
1326
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1327
+ # to the HTTP request.
1328
+ #
1329
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1330
+ #
1331
+ def begin_detach_data_disk_async(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers = nil)
1332
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1333
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1334
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
1335
+ fail ArgumentError, 'name is nil' if name.nil?
1336
+ fail ArgumentError, 'detach_data_disk_properties is nil' if detach_data_disk_properties.nil?
1337
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1338
+
1339
+
1340
+ request_headers = {}
1341
+
1342
+ # Set Headers
1343
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1344
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1345
+
1346
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1347
+
1348
+ # Serialize Request
1349
+ request_mapper = Azure::ARM::DevTestLabs::Models::DetachDataDiskProperties.mapper()
1350
+ request_content = @client.serialize(request_mapper, detach_data_disk_properties)
1351
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1352
+
1353
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk'
1354
+
1355
+ request_url = @base_url || @client.base_url
1356
+
1357
+ options = {
1358
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1359
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
1360
+ query_params: {'api-version' => @client.api_version},
1361
+ body: request_content,
1362
+ headers: request_headers.merge(custom_headers || {}),
1363
+ base_url: request_url
1364
+ }
1365
+ promise = @client.make_request_async(:post, path_template, options)
1366
+
1367
+ promise = promise.then do |result|
1368
+ http_response = result.response
1369
+ status_code = http_response.status
1370
+ response_content = http_response.body
1371
+ unless status_code == 200 || status_code == 202
1372
+ error_model = JSON.load(response_content)
1373
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1374
+ end
1375
+
1376
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1377
+
1378
+ result
1379
+ end
1380
+
1381
+ promise.execute
1382
+ end
1383
+
1384
+ #
1385
+ # Start a virtual machine. This operation can take a while to complete.
1386
+ #
1387
+ # @param resource_group_name [String] The name of the resource group.
1388
+ # @param lab_name [String] The name of the lab.
1389
+ # @param name [String] The name of the virtual machine.
1390
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1391
+ # will be added to the HTTP request.
1392
+ #
1393
+ #
1394
+ def begin_start(resource_group_name, lab_name, name, custom_headers = nil)
1395
+ response = begin_start_async(resource_group_name, lab_name, name, custom_headers).value!
1396
+ nil
1397
+ end
1398
+
1399
+ #
1400
+ # Start a virtual machine. This operation can take a while to complete.
1401
+ #
1402
+ # @param resource_group_name [String] The name of the resource group.
1403
+ # @param lab_name [String] The name of the lab.
1404
+ # @param name [String] The name of the virtual machine.
1405
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1406
+ # will be added to the HTTP request.
1407
+ #
1408
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1409
+ #
1410
+ def begin_start_with_http_info(resource_group_name, lab_name, name, custom_headers = nil)
1411
+ begin_start_async(resource_group_name, lab_name, name, custom_headers).value!
1412
+ end
1413
+
1414
+ #
1415
+ # Start a virtual machine. This operation can take a while to complete.
1416
+ #
1417
+ # @param resource_group_name [String] The name of the resource group.
1418
+ # @param lab_name [String] The name of the lab.
1419
+ # @param name [String] The name of the virtual machine.
1420
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1421
+ # to the HTTP request.
1422
+ #
1423
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1424
+ #
1425
+ def begin_start_async(resource_group_name, lab_name, name, custom_headers = nil)
1426
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1427
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1428
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
1429
+ fail ArgumentError, 'name is nil' if name.nil?
1430
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1431
+
1432
+
1433
+ request_headers = {}
1434
+
1435
+ # Set Headers
1436
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1437
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1438
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start'
1439
+
1440
+ request_url = @base_url || @client.base_url
1441
+
1442
+ options = {
1443
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1444
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
1445
+ query_params: {'api-version' => @client.api_version},
1446
+ headers: request_headers.merge(custom_headers || {}),
1447
+ base_url: request_url
1448
+ }
1449
+ promise = @client.make_request_async(:post, path_template, options)
1450
+
1451
+ promise = promise.then do |result|
1452
+ http_response = result.response
1453
+ status_code = http_response.status
1454
+ response_content = http_response.body
1455
+ unless status_code == 200 || status_code == 202
1456
+ error_model = JSON.load(response_content)
1457
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1458
+ end
1459
+
1460
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1461
+
1462
+ result
1463
+ end
1464
+
1465
+ promise.execute
1466
+ end
1467
+
1468
+ #
1469
+ # Stop a virtual machine This operation can take a while to complete.
1470
+ #
1471
+ # @param resource_group_name [String] The name of the resource group.
1472
+ # @param lab_name [String] The name of the lab.
1473
+ # @param name [String] The name of the virtual machine.
1474
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1475
+ # will be added to the HTTP request.
1476
+ #
1477
+ #
1478
+ def begin_stop(resource_group_name, lab_name, name, custom_headers = nil)
1479
+ response = begin_stop_async(resource_group_name, lab_name, name, custom_headers).value!
1480
+ nil
1481
+ end
1482
+
1483
+ #
1484
+ # Stop a virtual machine This operation can take a while to complete.
1485
+ #
1486
+ # @param resource_group_name [String] The name of the resource group.
1487
+ # @param lab_name [String] The name of the lab.
1488
+ # @param name [String] The name of the virtual machine.
1489
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1490
+ # will be added to the HTTP request.
1491
+ #
1492
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1493
+ #
1494
+ def begin_stop_with_http_info(resource_group_name, lab_name, name, custom_headers = nil)
1495
+ begin_stop_async(resource_group_name, lab_name, name, custom_headers).value!
1496
+ end
1497
+
1498
+ #
1499
+ # Stop a virtual machine This operation can take a while to complete.
1500
+ #
1501
+ # @param resource_group_name [String] The name of the resource group.
1502
+ # @param lab_name [String] The name of the lab.
1503
+ # @param name [String] The name of the virtual machine.
1504
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1505
+ # to the HTTP request.
1506
+ #
1507
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1508
+ #
1509
+ def begin_stop_async(resource_group_name, lab_name, name, custom_headers = nil)
1510
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1511
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1512
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
1513
+ fail ArgumentError, 'name is nil' if name.nil?
1514
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1515
+
1516
+
1517
+ request_headers = {}
1518
+
1519
+ # Set Headers
1520
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1521
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1522
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop'
1523
+
1524
+ request_url = @base_url || @client.base_url
1525
+
1526
+ options = {
1527
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1528
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
1529
+ query_params: {'api-version' => @client.api_version},
1530
+ headers: request_headers.merge(custom_headers || {}),
1531
+ base_url: request_url
1532
+ }
1533
+ promise = @client.make_request_async(:post, path_template, options)
1534
+
1535
+ promise = promise.then do |result|
1536
+ http_response = result.response
1537
+ status_code = http_response.status
1538
+ response_content = http_response.body
1539
+ unless status_code == 200 || status_code == 202
1540
+ error_model = JSON.load(response_content)
1541
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1542
+ end
1543
+
1544
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1545
+
1546
+ result
1547
+ end
1548
+
1549
+ promise.execute
1550
+ end
1551
+
1552
+ #
1553
+ # List virtual machines in a given lab.
1554
+ #
1555
+ # @param next_page_link [String] The NextLink from the previous successful call
1556
+ # to List operation.
1557
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1558
+ # will be added to the HTTP request.
1559
+ #
1560
+ # @return [ResponseWithContinuationLabVirtualMachine] operation results.
1561
+ #
1562
+ def list_next(next_page_link, custom_headers = nil)
1563
+ response = list_next_async(next_page_link, custom_headers).value!
1564
+ response.body unless response.nil?
1565
+ end
1566
+
1567
+ #
1568
+ # List virtual machines in a given lab.
1569
+ #
1570
+ # @param next_page_link [String] The NextLink from the previous successful call
1571
+ # to List operation.
1572
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1573
+ # will be added to the HTTP request.
1574
+ #
1575
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1576
+ #
1577
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
1578
+ list_next_async(next_page_link, custom_headers).value!
1579
+ end
1580
+
1581
+ #
1582
+ # List virtual machines in a given lab.
1583
+ #
1584
+ # @param next_page_link [String] The NextLink from the previous successful call
1585
+ # to List operation.
1586
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1587
+ # to the HTTP request.
1588
+ #
1589
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1590
+ #
1591
+ def list_next_async(next_page_link, custom_headers = nil)
1592
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1593
+
1594
+
1595
+ request_headers = {}
1596
+
1597
+ # Set Headers
1598
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1599
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1600
+ path_template = '{nextLink}'
1601
+
1602
+ request_url = @base_url || @client.base_url
1603
+
1604
+ options = {
1605
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1606
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1607
+ headers: request_headers.merge(custom_headers || {}),
1608
+ base_url: request_url
1609
+ }
1610
+ promise = @client.make_request_async(:get, path_template, options)
1611
+
1612
+ promise = promise.then do |result|
1613
+ http_response = result.response
1614
+ status_code = http_response.status
1615
+ response_content = http_response.body
1616
+ unless status_code == 200
1617
+ error_model = JSON.load(response_content)
1618
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1619
+ end
1620
+
1621
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1622
+ # Deserialize Response
1623
+ if status_code == 200
1624
+ begin
1625
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1626
+ result_mapper = Azure::ARM::DevTestLabs::Models::ResponseWithContinuationLabVirtualMachine.mapper()
1627
+ result.body = @client.deserialize(result_mapper, parsed_response)
1628
+ rescue Exception => e
1629
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1630
+ end
1631
+ end
1632
+
1633
+ result
1634
+ end
1635
+
1636
+ promise.execute
1637
+ end
1638
+
1639
+ #
1640
+ # List virtual machines in a given lab.
1641
+ #
1642
+ # @param resource_group_name [String] The name of the resource group.
1643
+ # @param lab_name [String] The name of the lab.
1644
+ # @param expand [String] Specify the $expand query. Example:
1645
+ # 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'
1646
+ # @param filter [String] The filter to apply to the operation.
1647
+ # @param top [Integer] The maximum number of resources to return from the
1648
+ # operation.
1649
+ # @param orderby [String] The ordering expression for the results, using OData
1650
+ # notation.
1651
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1652
+ # will be added to the HTTP request.
1653
+ #
1654
+ # @return [ResponseWithContinuationLabVirtualMachine] which provide lazy access
1655
+ # to pages of the response.
1656
+ #
1657
+ def list_as_lazy(resource_group_name, lab_name, expand = nil, filter = nil, top = nil, orderby = nil, custom_headers = nil)
1658
+ response = list_async(resource_group_name, lab_name, expand, filter, top, orderby, custom_headers).value!
1659
+ unless response.nil?
1660
+ page = response.body
1661
+ page.next_method = Proc.new do |next_page_link|
1662
+ list_next_async(next_page_link, custom_headers)
1663
+ end
1664
+ page
1665
+ end
1666
+ end
1667
+
1668
+ end
1669
+ end