azure_mgmt_batch 0.15.2 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-12-01/generated/azure_mgmt_batch/application_operations.rb +39 -37
  3. data/lib/2015-12-01/generated/azure_mgmt_batch/application_package_operations.rb +24 -22
  4. data/lib/2015-12-01/generated/azure_mgmt_batch/batch_account_operations.rb +80 -75
  5. data/lib/2015-12-01/generated/azure_mgmt_batch/batch_management_client.rb +4 -1
  6. data/lib/2015-12-01/generated/azure_mgmt_batch/location.rb +6 -5
  7. data/lib/2017-01-01/generated/azure_mgmt_batch.rb +52 -0
  8. data/lib/2017-01-01/generated/azure_mgmt_batch/application_operations.rb +657 -0
  9. data/lib/2017-01-01/generated/azure_mgmt_batch/application_package_operations.rb +445 -0
  10. data/lib/2017-01-01/generated/azure_mgmt_batch/batch_account_operations.rb +1281 -0
  11. data/lib/2017-01-01/generated/azure_mgmt_batch/batch_management_client.rb +143 -0
  12. data/lib/2017-01-01/generated/azure_mgmt_batch/location.rb +116 -0
  13. data/lib/2017-01-01/generated/azure_mgmt_batch/models/account_key_type.rb +16 -0
  14. data/lib/2017-01-01/generated/azure_mgmt_batch/models/activate_application_package_parameters.rb +47 -0
  15. data/lib/2017-01-01/generated/azure_mgmt_batch/models/add_application_parameters.rb +58 -0
  16. data/lib/2017-01-01/generated/azure_mgmt_batch/models/application.rb +103 -0
  17. data/lib/2017-01-01/generated/azure_mgmt_batch/models/application_package.rb +125 -0
  18. data/lib/2017-01-01/generated/azure_mgmt_batch/models/auto_storage_base_properties.rb +47 -0
  19. data/lib/2017-01-01/generated/azure_mgmt_batch/models/auto_storage_properties.rb +60 -0
  20. data/lib/2017-01-01/generated/azure_mgmt_batch/models/batch_account.rb +196 -0
  21. data/lib/2017-01-01/generated/azure_mgmt_batch/models/batch_account_create_parameters.rb +110 -0
  22. data/lib/2017-01-01/generated/azure_mgmt_batch/models/batch_account_keys.rb +59 -0
  23. data/lib/2017-01-01/generated/azure_mgmt_batch/models/batch_account_list_result.rb +99 -0
  24. data/lib/2017-01-01/generated/azure_mgmt_batch/models/batch_account_regenerate_key_parameters.rb +48 -0
  25. data/lib/2017-01-01/generated/azure_mgmt_batch/models/batch_account_update_parameters.rb +68 -0
  26. data/lib/2017-01-01/generated/azure_mgmt_batch/models/batch_location_quota.rb +48 -0
  27. data/lib/2017-01-01/generated/azure_mgmt_batch/models/key_vault_reference.rb +59 -0
  28. data/lib/2017-01-01/generated/azure_mgmt_batch/models/list_applications_result.rb +98 -0
  29. data/lib/2017-01-01/generated/azure_mgmt_batch/models/package_state.rb +17 -0
  30. data/lib/2017-01-01/generated/azure_mgmt_batch/models/pool_allocation_mode.rb +16 -0
  31. data/lib/2017-01-01/generated/azure_mgmt_batch/models/provisioning_state.rb +20 -0
  32. data/lib/2017-01-01/generated/azure_mgmt_batch/models/resource.rb +103 -0
  33. data/lib/2017-01-01/generated/azure_mgmt_batch/models/update_application_parameters.rb +70 -0
  34. data/lib/2017-01-01/generated/azure_mgmt_batch/module_definition.rb +9 -0
  35. data/lib/2017-05-01/generated/azure_mgmt_batch/application_operations.rb +39 -37
  36. data/lib/2017-05-01/generated/azure_mgmt_batch/application_package_operations.rb +24 -22
  37. data/lib/2017-05-01/generated/azure_mgmt_batch/batch_account_operations.rb +80 -75
  38. data/lib/2017-05-01/generated/azure_mgmt_batch/batch_management_client.rb +4 -1
  39. data/lib/2017-05-01/generated/azure_mgmt_batch/location.rb +12 -12
  40. data/lib/2017-05-01/generated/azure_mgmt_batch/operations.rb +15 -13
  41. data/lib/2017-09-01/generated/azure_mgmt_batch.rb +113 -0
  42. data/lib/2017-09-01/generated/azure_mgmt_batch/application_operations.rb +655 -0
  43. data/lib/2017-09-01/generated/azure_mgmt_batch/application_package_operations.rb +441 -0
  44. data/lib/2017-09-01/generated/azure_mgmt_batch/batch_account_operations.rb +1273 -0
  45. data/lib/2017-09-01/generated/azure_mgmt_batch/batch_management_client.rb +155 -0
  46. data/lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb +1009 -0
  47. data/lib/2017-09-01/generated/azure_mgmt_batch/location.rb +221 -0
  48. data/lib/2017-09-01/generated/azure_mgmt_batch/models/account_key_type.rb +16 -0
  49. data/lib/2017-09-01/generated/azure_mgmt_batch/models/activate_application_package_parameters.rb +46 -0
  50. data/lib/2017-09-01/generated/azure_mgmt_batch/models/allocation_state.rb +17 -0
  51. data/lib/2017-09-01/generated/azure_mgmt_batch/models/application.rb +103 -0
  52. data/lib/2017-09-01/generated/azure_mgmt_batch/models/application_create_parameters.rb +58 -0
  53. data/lib/2017-09-01/generated/azure_mgmt_batch/models/application_package.rb +125 -0
  54. data/lib/2017-09-01/generated/azure_mgmt_batch/models/application_package_reference.rb +64 -0
  55. data/lib/2017-09-01/generated/azure_mgmt_batch/models/application_update_parameters.rb +70 -0
  56. data/lib/2017-09-01/generated/azure_mgmt_batch/models/auto_scale_run.rb +74 -0
  57. data/lib/2017-09-01/generated/azure_mgmt_batch/models/auto_scale_run_error.rb +80 -0
  58. data/lib/2017-09-01/generated/azure_mgmt_batch/models/auto_scale_settings.rb +61 -0
  59. data/lib/2017-09-01/generated/azure_mgmt_batch/models/auto_storage_base_properties.rb +47 -0
  60. data/lib/2017-09-01/generated/azure_mgmt_batch/models/auto_storage_properties.rb +56 -0
  61. data/lib/2017-09-01/generated/azure_mgmt_batch/models/auto_user_scope.rb +16 -0
  62. data/lib/2017-09-01/generated/azure_mgmt_batch/models/auto_user_specification.rb +69 -0
  63. data/lib/2017-09-01/generated/azure_mgmt_batch/models/batch_account.rb +208 -0
  64. data/lib/2017-09-01/generated/azure_mgmt_batch/models/batch_account_create_parameters.rb +110 -0
  65. data/lib/2017-09-01/generated/azure_mgmt_batch/models/batch_account_keys.rb +71 -0
  66. data/lib/2017-09-01/generated/azure_mgmt_batch/models/batch_account_list_result.rb +99 -0
  67. data/lib/2017-09-01/generated/azure_mgmt_batch/models/batch_account_regenerate_key_parameters.rb +48 -0
  68. data/lib/2017-09-01/generated/azure_mgmt_batch/models/batch_account_update_parameters.rb +68 -0
  69. data/lib/2017-09-01/generated/azure_mgmt_batch/models/batch_location_quota.rb +48 -0
  70. data/lib/2017-09-01/generated/azure_mgmt_batch/models/caching_type.rb +17 -0
  71. data/lib/2017-09-01/generated/azure_mgmt_batch/models/certificate.rb +205 -0
  72. data/lib/2017-09-01/generated/azure_mgmt_batch/models/certificate_base_properties.rb +75 -0
  73. data/lib/2017-09-01/generated/azure_mgmt_batch/models/certificate_create_or_update_parameters.rb +135 -0
  74. data/lib/2017-09-01/generated/azure_mgmt_batch/models/certificate_format.rb +16 -0
  75. data/lib/2017-09-01/generated/azure_mgmt_batch/models/certificate_provisioning_state.rb +17 -0
  76. data/lib/2017-09-01/generated/azure_mgmt_batch/models/certificate_reference.rb +120 -0
  77. data/lib/2017-09-01/generated/azure_mgmt_batch/models/certificate_store_location.rb +16 -0
  78. data/lib/2017-09-01/generated/azure_mgmt_batch/models/certificate_visibility.rb +17 -0
  79. data/lib/2017-09-01/generated/azure_mgmt_batch/models/check_name_availability_parameters.rb +61 -0
  80. data/lib/2017-09-01/generated/azure_mgmt_batch/models/check_name_availability_result.rb +78 -0
  81. data/lib/2017-09-01/generated/azure_mgmt_batch/models/cloud_service_configuration.rb +83 -0
  82. data/lib/2017-09-01/generated/azure_mgmt_batch/models/compute_node_deallocation_option.rb +18 -0
  83. data/lib/2017-09-01/generated/azure_mgmt_batch/models/compute_node_fill_type.rb +16 -0
  84. data/lib/2017-09-01/generated/azure_mgmt_batch/models/data_disk.rb +101 -0
  85. data/lib/2017-09-01/generated/azure_mgmt_batch/models/delete_certificate_error.rb +92 -0
  86. data/lib/2017-09-01/generated/azure_mgmt_batch/models/deployment_configuration.rb +66 -0
  87. data/lib/2017-09-01/generated/azure_mgmt_batch/models/elevation_level.rb +16 -0
  88. data/lib/2017-09-01/generated/azure_mgmt_batch/models/environment_setting.rb +58 -0
  89. data/lib/2017-09-01/generated/azure_mgmt_batch/models/fixed_scale_settings.rb +93 -0
  90. data/lib/2017-09-01/generated/azure_mgmt_batch/models/image_reference.rb +108 -0
  91. data/lib/2017-09-01/generated/azure_mgmt_batch/models/inbound_endpoint_protocol.rb +16 -0
  92. data/lib/2017-09-01/generated/azure_mgmt_batch/models/inbound_nat_pool.rb +141 -0
  93. data/lib/2017-09-01/generated/azure_mgmt_batch/models/inter_node_communication_state.rb +16 -0
  94. data/lib/2017-09-01/generated/azure_mgmt_batch/models/key_vault_reference.rb +59 -0
  95. data/lib/2017-09-01/generated/azure_mgmt_batch/models/linux_user_configuration.rb +81 -0
  96. data/lib/2017-09-01/generated/azure_mgmt_batch/models/list_applications_result.rb +98 -0
  97. data/lib/2017-09-01/generated/azure_mgmt_batch/models/list_certificates_result.rb +98 -0
  98. data/lib/2017-09-01/generated/azure_mgmt_batch/models/list_pools_result.rb +98 -0
  99. data/lib/2017-09-01/generated/azure_mgmt_batch/models/metadata_item.rb +60 -0
  100. data/lib/2017-09-01/generated/azure_mgmt_batch/models/name_availability_reason.rb +16 -0
  101. data/lib/2017-09-01/generated/azure_mgmt_batch/models/network_configuration.rb +86 -0
  102. data/lib/2017-09-01/generated/azure_mgmt_batch/models/network_security_group_rule.rb +82 -0
  103. data/lib/2017-09-01/generated/azure_mgmt_batch/models/network_security_group_rule_access.rb +16 -0
  104. data/lib/2017-09-01/generated/azure_mgmt_batch/models/operation.rb +82 -0
  105. data/lib/2017-09-01/generated/azure_mgmt_batch/models/operation_display.rb +81 -0
  106. data/lib/2017-09-01/generated/azure_mgmt_batch/models/operation_list_result.rb +98 -0
  107. data/lib/2017-09-01/generated/azure_mgmt_batch/models/osdisk.rb +52 -0
  108. data/lib/2017-09-01/generated/azure_mgmt_batch/models/package_state.rb +17 -0
  109. data/lib/2017-09-01/generated/azure_mgmt_batch/models/pool.rb +474 -0
  110. data/lib/2017-09-01/generated/azure_mgmt_batch/models/pool_allocation_mode.rb +16 -0
  111. data/lib/2017-09-01/generated/azure_mgmt_batch/models/pool_endpoint_configuration.rb +60 -0
  112. data/lib/2017-09-01/generated/azure_mgmt_batch/models/pool_provisioning_state.rb +16 -0
  113. data/lib/2017-09-01/generated/azure_mgmt_batch/models/provisioning_state.rb +20 -0
  114. data/lib/2017-09-01/generated/azure_mgmt_batch/models/proxy_resource.rb +84 -0
  115. data/lib/2017-09-01/generated/azure_mgmt_batch/models/resize_error.rb +80 -0
  116. data/lib/2017-09-01/generated/azure_mgmt_batch/models/resize_operation_status.rb +127 -0
  117. data/lib/2017-09-01/generated/azure_mgmt_batch/models/resource.rb +103 -0
  118. data/lib/2017-09-01/generated/azure_mgmt_batch/models/resource_file.rb +79 -0
  119. data/lib/2017-09-01/generated/azure_mgmt_batch/models/scale_settings.rb +69 -0
  120. data/lib/2017-09-01/generated/azure_mgmt_batch/models/start_task.rb +151 -0
  121. data/lib/2017-09-01/generated/azure_mgmt_batch/models/storage_account_type.rb +16 -0
  122. data/lib/2017-09-01/generated/azure_mgmt_batch/models/task_scheduling_policy.rb +49 -0
  123. data/lib/2017-09-01/generated/azure_mgmt_batch/models/user_account.rb +89 -0
  124. data/lib/2017-09-01/generated/azure_mgmt_batch/models/user_identity.rb +64 -0
  125. data/lib/2017-09-01/generated/azure_mgmt_batch/models/virtual_machine_configuration.rb +138 -0
  126. data/lib/2017-09-01/generated/azure_mgmt_batch/models/windows_configuration.rb +48 -0
  127. data/lib/2017-09-01/generated/azure_mgmt_batch/module_definition.rb +9 -0
  128. data/lib/2017-09-01/generated/azure_mgmt_batch/operations.rb +215 -0
  129. data/lib/2017-09-01/generated/azure_mgmt_batch/pool_operations.rb +1132 -0
  130. data/lib/azure_mgmt_batch.rb +2 -0
  131. data/lib/profiles/latest/batch_latest_profile_client.rb +28 -9
  132. data/lib/profiles/latest/batch_module_definition.rb +0 -1
  133. data/lib/profiles/latest/modules/batch_profile_module.rb +357 -126
  134. data/lib/version.rb +1 -1
  135. metadata +119 -2
@@ -0,0 +1,1132 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Batch::Mgmt::V2017_09_01
7
+ #
8
+ # PoolOperations
9
+ #
10
+ class PoolOperations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the PoolOperations class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [BatchManagementClient] reference to the BatchManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Lists all of the pools in the specified account.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group that
28
+ # contains the Batch account.
29
+ # @param account_name [String] The name of the Batch account.
30
+ # @param maxresults [Integer] The maximum number of items to return in the
31
+ # response.
32
+ # @param select [String] Comma separated list of properties that should be
33
+ # returned. e.g. "properties/provisioningState". Only top level properties
34
+ # under properties/ are valid for selection.
35
+ # @param filter [String] OData filter expression. Valid properties for
36
+ # filtering are:
37
+ #
38
+ # name
39
+ # properties/allocationState
40
+ # properties/allocationStateTransitionTime
41
+ # properties/creationTime
42
+ # properties/provisioningState
43
+ # properties/provisioningStateTransitionTime
44
+ # properties/lastModified
45
+ # properties/vmSize
46
+ # properties/interNodeCommunication
47
+ # properties/scaleSettings/autoScale
48
+ # properties/scaleSettings/fixedScale
49
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
50
+ # will be added to the HTTP request.
51
+ #
52
+ # @return [Array<Pool>] operation results.
53
+ #
54
+ def list_by_batch_account(resource_group_name, account_name, maxresults:nil, select:nil, filter:nil, custom_headers:nil)
55
+ first_page = list_by_batch_account_as_lazy(resource_group_name, account_name, maxresults:maxresults, select:select, filter:filter, custom_headers:custom_headers)
56
+ first_page.get_all_items
57
+ end
58
+
59
+ #
60
+ # Lists all of the pools in the specified account.
61
+ #
62
+ # @param resource_group_name [String] The name of the resource group that
63
+ # contains the Batch account.
64
+ # @param account_name [String] The name of the Batch account.
65
+ # @param maxresults [Integer] The maximum number of items to return in the
66
+ # response.
67
+ # @param select [String] Comma separated list of properties that should be
68
+ # returned. e.g. "properties/provisioningState". Only top level properties
69
+ # under properties/ are valid for selection.
70
+ # @param filter [String] OData filter expression. Valid properties for
71
+ # filtering are:
72
+ #
73
+ # name
74
+ # properties/allocationState
75
+ # properties/allocationStateTransitionTime
76
+ # properties/creationTime
77
+ # properties/provisioningState
78
+ # properties/provisioningStateTransitionTime
79
+ # properties/lastModified
80
+ # properties/vmSize
81
+ # properties/interNodeCommunication
82
+ # properties/scaleSettings/autoScale
83
+ # properties/scaleSettings/fixedScale
84
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
85
+ # will be added to the HTTP request.
86
+ #
87
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
88
+ #
89
+ def list_by_batch_account_with_http_info(resource_group_name, account_name, maxresults:nil, select:nil, filter:nil, custom_headers:nil)
90
+ list_by_batch_account_async(resource_group_name, account_name, maxresults:maxresults, select:select, filter:filter, custom_headers:custom_headers).value!
91
+ end
92
+
93
+ #
94
+ # Lists all of the pools in the specified account.
95
+ #
96
+ # @param resource_group_name [String] The name of the resource group that
97
+ # contains the Batch account.
98
+ # @param account_name [String] The name of the Batch account.
99
+ # @param maxresults [Integer] The maximum number of items to return in the
100
+ # response.
101
+ # @param select [String] Comma separated list of properties that should be
102
+ # returned. e.g. "properties/provisioningState". Only top level properties
103
+ # under properties/ are valid for selection.
104
+ # @param filter [String] OData filter expression. Valid properties for
105
+ # filtering are:
106
+ #
107
+ # name
108
+ # properties/allocationState
109
+ # properties/allocationStateTransitionTime
110
+ # properties/creationTime
111
+ # properties/provisioningState
112
+ # properties/provisioningStateTransitionTime
113
+ # properties/lastModified
114
+ # properties/vmSize
115
+ # properties/interNodeCommunication
116
+ # properties/scaleSettings/autoScale
117
+ # properties/scaleSettings/fixedScale
118
+ # @param [Hash{String => String}] A hash of custom headers that will be added
119
+ # to the HTTP request.
120
+ #
121
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
122
+ #
123
+ def list_by_batch_account_async(resource_group_name, account_name, maxresults:nil, select:nil, filter:nil, custom_headers:nil)
124
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
125
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
126
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
127
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
128
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !account_name.nil? && account_name.match(Regexp.new('^^[-\w\._]+$$')).nil?
129
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
130
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
131
+
132
+
133
+ request_headers = {}
134
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
135
+
136
+ # Set Headers
137
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
138
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
139
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools'
140
+
141
+ request_url = @base_url || @client.base_url
142
+
143
+ options = {
144
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
145
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
146
+ query_params: {'maxresults' => maxresults,'$select' => select,'$filter' => filter,'api-version' => @client.api_version},
147
+ headers: request_headers.merge(custom_headers || {}),
148
+ base_url: request_url
149
+ }
150
+ promise = @client.make_request_async(:get, path_template, options)
151
+
152
+ promise = promise.then do |result|
153
+ http_response = result.response
154
+ status_code = http_response.status
155
+ response_content = http_response.body
156
+ unless status_code == 200
157
+ error_model = JSON.load(response_content)
158
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
159
+ end
160
+
161
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
162
+ # Deserialize Response
163
+ if status_code == 200
164
+ begin
165
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
166
+ result_mapper = Azure::Batch::Mgmt::V2017_09_01::Models::ListPoolsResult.mapper()
167
+ result.body = @client.deserialize(result_mapper, parsed_response)
168
+ rescue Exception => e
169
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
170
+ end
171
+ end
172
+
173
+ result
174
+ end
175
+
176
+ promise.execute
177
+ end
178
+
179
+ #
180
+ # Creates a new pool inside the specified account.
181
+ #
182
+ # @param resource_group_name [String] The name of the resource group that
183
+ # contains the Batch account.
184
+ # @param account_name [String] The name of the Batch account.
185
+ # @param pool_name [String] The pool name. This must be unique within the
186
+ # account.
187
+ # @param parameters [Pool] Additional parameters for pool creation.
188
+ # @param if_match [String] The entity state (ETag) version of the pool to
189
+ # update. A value of "*" can be used to apply the operation only if the pool
190
+ # already exists. If omitted, this operation will always be applied.
191
+ # @param if_none_match [String] Set to '*' to allow a new pool to be created,
192
+ # but to prevent updating an existing pool. Other values will be ignored.
193
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
194
+ # will be added to the HTTP request.
195
+ #
196
+ # @return [Pool] operation results.
197
+ #
198
+ def create(resource_group_name, account_name, pool_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil)
199
+ response = create_async(resource_group_name, account_name, pool_name, parameters, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers).value!
200
+ response.body unless response.nil?
201
+ end
202
+
203
+ #
204
+ # @param resource_group_name [String] The name of the resource group that
205
+ # contains the Batch account.
206
+ # @param account_name [String] The name of the Batch account.
207
+ # @param pool_name [String] The pool name. This must be unique within the
208
+ # account.
209
+ # @param parameters [Pool] Additional parameters for pool creation.
210
+ # @param if_match [String] The entity state (ETag) version of the pool to
211
+ # update. A value of "*" can be used to apply the operation only if the pool
212
+ # already exists. If omitted, this operation will always be applied.
213
+ # @param if_none_match [String] Set to '*' to allow a new pool to be created,
214
+ # but to prevent updating an existing pool. Other values will be ignored.
215
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
216
+ # will be added to the HTTP request.
217
+ #
218
+ # @return [Concurrent::Promise] promise which provides async access to http
219
+ # response.
220
+ #
221
+ def create_async(resource_group_name, account_name, pool_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil)
222
+ # Send request
223
+ promise = begin_create_async(resource_group_name, account_name, pool_name, parameters, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers)
224
+
225
+ promise = promise.then do |response|
226
+ # Defining deserialization method.
227
+ deserialize_method = lambda do |parsed_response|
228
+ result_mapper = Azure::Batch::Mgmt::V2017_09_01::Models::Pool.mapper()
229
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
230
+ end
231
+
232
+ # Waiting for response.
233
+ @client.get_long_running_operation_result(response, deserialize_method)
234
+ end
235
+
236
+ promise
237
+ end
238
+
239
+ #
240
+ # Updates the properties of an existing pool.
241
+ #
242
+ # @param resource_group_name [String] The name of the resource group that
243
+ # contains the Batch account.
244
+ # @param account_name [String] The name of the Batch account.
245
+ # @param pool_name [String] The pool name. This must be unique within the
246
+ # account.
247
+ # @param parameters [Pool] Pool properties that should be updated. Properties
248
+ # that are supplied will be updated, any property not supplied will be
249
+ # unchanged.
250
+ # @param if_match [String] The entity state (ETag) version of the pool to
251
+ # update. This value can be omitted or set to "*" to apply the operation
252
+ # unconditionally.
253
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
254
+ # will be added to the HTTP request.
255
+ #
256
+ # @return [Pool] operation results.
257
+ #
258
+ def update(resource_group_name, account_name, pool_name, parameters, if_match:nil, custom_headers:nil)
259
+ response = update_async(resource_group_name, account_name, pool_name, parameters, if_match:if_match, custom_headers:custom_headers).value!
260
+ response.body unless response.nil?
261
+ end
262
+
263
+ #
264
+ # Updates the properties of an existing pool.
265
+ #
266
+ # @param resource_group_name [String] The name of the resource group that
267
+ # contains the Batch account.
268
+ # @param account_name [String] The name of the Batch account.
269
+ # @param pool_name [String] The pool name. This must be unique within the
270
+ # account.
271
+ # @param parameters [Pool] Pool properties that should be updated. Properties
272
+ # that are supplied will be updated, any property not supplied will be
273
+ # unchanged.
274
+ # @param if_match [String] The entity state (ETag) version of the pool to
275
+ # update. This value can be omitted or set to "*" to apply the operation
276
+ # unconditionally.
277
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
278
+ # will be added to the HTTP request.
279
+ #
280
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
281
+ #
282
+ def update_with_http_info(resource_group_name, account_name, pool_name, parameters, if_match:nil, custom_headers:nil)
283
+ update_async(resource_group_name, account_name, pool_name, parameters, if_match:if_match, custom_headers:custom_headers).value!
284
+ end
285
+
286
+ #
287
+ # Updates the properties of an existing pool.
288
+ #
289
+ # @param resource_group_name [String] The name of the resource group that
290
+ # contains the Batch account.
291
+ # @param account_name [String] The name of the Batch account.
292
+ # @param pool_name [String] The pool name. This must be unique within the
293
+ # account.
294
+ # @param parameters [Pool] Pool properties that should be updated. Properties
295
+ # that are supplied will be updated, any property not supplied will be
296
+ # unchanged.
297
+ # @param if_match [String] The entity state (ETag) version of the pool to
298
+ # update. This value can be omitted or set to "*" to apply the operation
299
+ # unconditionally.
300
+ # @param [Hash{String => String}] A hash of custom headers that will be added
301
+ # to the HTTP request.
302
+ #
303
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
304
+ #
305
+ def update_async(resource_group_name, account_name, pool_name, parameters, if_match:nil, custom_headers:nil)
306
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
307
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
308
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
309
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
310
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !account_name.nil? && account_name.match(Regexp.new('^^[-\w\._]+$$')).nil?
311
+ fail ArgumentError, 'pool_name is nil' if pool_name.nil?
312
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'MaxLength': '64'" if !pool_name.nil? && pool_name.length > 64
313
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'MinLength': '1'" if !pool_name.nil? && pool_name.length < 1
314
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9_-]+$'" if !pool_name.nil? && pool_name.match(Regexp.new('^^[a-zA-Z0-9_-]+$$')).nil?
315
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
316
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
317
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
318
+
319
+
320
+ request_headers = {}
321
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
322
+
323
+ # Set Headers
324
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
325
+ request_headers['If-Match'] = if_match unless if_match.nil?
326
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
327
+
328
+ # Serialize Request
329
+ request_mapper = Azure::Batch::Mgmt::V2017_09_01::Models::Pool.mapper()
330
+ request_content = @client.serialize(request_mapper, parameters)
331
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
332
+
333
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'
334
+
335
+ request_url = @base_url || @client.base_url
336
+
337
+ options = {
338
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
339
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'poolName' => pool_name,'subscriptionId' => @client.subscription_id},
340
+ query_params: {'api-version' => @client.api_version},
341
+ body: request_content,
342
+ headers: request_headers.merge(custom_headers || {}),
343
+ base_url: request_url
344
+ }
345
+ promise = @client.make_request_async(:patch, path_template, options)
346
+
347
+ promise = promise.then do |result|
348
+ http_response = result.response
349
+ status_code = http_response.status
350
+ response_content = http_response.body
351
+ unless status_code == 200
352
+ error_model = JSON.load(response_content)
353
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
354
+ end
355
+
356
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
357
+ # Deserialize Response
358
+ if status_code == 200
359
+ begin
360
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
361
+ result_mapper = Azure::Batch::Mgmt::V2017_09_01::Models::Pool.mapper()
362
+ result.body = @client.deserialize(result_mapper, parsed_response)
363
+ rescue Exception => e
364
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
365
+ end
366
+ end
367
+
368
+ result
369
+ end
370
+
371
+ promise.execute
372
+ end
373
+
374
+ #
375
+ # Deletes the specified pool.
376
+ #
377
+ # @param resource_group_name [String] The name of the resource group that
378
+ # contains the Batch account.
379
+ # @param account_name [String] The name of the Batch account.
380
+ # @param pool_name [String] The pool name. This must be unique within the
381
+ # account.
382
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
383
+ # will be added to the HTTP request.
384
+ #
385
+ def delete(resource_group_name, account_name, pool_name, custom_headers:nil)
386
+ response = delete_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value!
387
+ nil
388
+ end
389
+
390
+ #
391
+ # @param resource_group_name [String] The name of the resource group that
392
+ # contains the Batch account.
393
+ # @param account_name [String] The name of the Batch account.
394
+ # @param pool_name [String] The pool name. This must be unique within the
395
+ # account.
396
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
397
+ # will be added to the HTTP request.
398
+ #
399
+ # @return [Concurrent::Promise] promise which provides async access to http
400
+ # response.
401
+ #
402
+ def delete_async(resource_group_name, account_name, pool_name, custom_headers:nil)
403
+ # Send request
404
+ promise = begin_delete_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers)
405
+
406
+ promise = promise.then do |response|
407
+ # Defining deserialization method.
408
+ deserialize_method = lambda do |parsed_response|
409
+ end
410
+
411
+ # Waiting for response.
412
+ @client.get_long_running_operation_result(response, deserialize_method)
413
+ end
414
+
415
+ promise
416
+ end
417
+
418
+ #
419
+ # Gets information about the specified pool.
420
+ #
421
+ # @param resource_group_name [String] The name of the resource group that
422
+ # contains the Batch account.
423
+ # @param account_name [String] The name of the Batch account.
424
+ # @param pool_name [String] The pool name. This must be unique within the
425
+ # account.
426
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
427
+ # will be added to the HTTP request.
428
+ #
429
+ # @return [Pool] operation results.
430
+ #
431
+ def get(resource_group_name, account_name, pool_name, custom_headers:nil)
432
+ response = get_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value!
433
+ response.body unless response.nil?
434
+ end
435
+
436
+ #
437
+ # Gets information about the specified pool.
438
+ #
439
+ # @param resource_group_name [String] The name of the resource group that
440
+ # contains the Batch account.
441
+ # @param account_name [String] The name of the Batch account.
442
+ # @param pool_name [String] The pool name. This must be unique within the
443
+ # account.
444
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
445
+ # will be added to the HTTP request.
446
+ #
447
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
448
+ #
449
+ def get_with_http_info(resource_group_name, account_name, pool_name, custom_headers:nil)
450
+ get_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value!
451
+ end
452
+
453
+ #
454
+ # Gets information about the specified pool.
455
+ #
456
+ # @param resource_group_name [String] The name of the resource group that
457
+ # contains the Batch account.
458
+ # @param account_name [String] The name of the Batch account.
459
+ # @param pool_name [String] The pool name. This must be unique within the
460
+ # account.
461
+ # @param [Hash{String => String}] A hash of custom headers that will be added
462
+ # to the HTTP request.
463
+ #
464
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
465
+ #
466
+ def get_async(resource_group_name, account_name, pool_name, custom_headers:nil)
467
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
468
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
469
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
470
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
471
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !account_name.nil? && account_name.match(Regexp.new('^^[-\w\._]+$$')).nil?
472
+ fail ArgumentError, 'pool_name is nil' if pool_name.nil?
473
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'MaxLength': '64'" if !pool_name.nil? && pool_name.length > 64
474
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'MinLength': '1'" if !pool_name.nil? && pool_name.length < 1
475
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9_-]+$'" if !pool_name.nil? && pool_name.match(Regexp.new('^^[a-zA-Z0-9_-]+$$')).nil?
476
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
477
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
478
+
479
+
480
+ request_headers = {}
481
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
482
+
483
+ # Set Headers
484
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
485
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
486
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'
487
+
488
+ request_url = @base_url || @client.base_url
489
+
490
+ options = {
491
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
492
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'poolName' => pool_name,'subscriptionId' => @client.subscription_id},
493
+ query_params: {'api-version' => @client.api_version},
494
+ headers: request_headers.merge(custom_headers || {}),
495
+ base_url: request_url
496
+ }
497
+ promise = @client.make_request_async(:get, path_template, options)
498
+
499
+ promise = promise.then do |result|
500
+ http_response = result.response
501
+ status_code = http_response.status
502
+ response_content = http_response.body
503
+ unless status_code == 200
504
+ error_model = JSON.load(response_content)
505
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
506
+ end
507
+
508
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
509
+ # Deserialize Response
510
+ if status_code == 200
511
+ begin
512
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
513
+ result_mapper = Azure::Batch::Mgmt::V2017_09_01::Models::Pool.mapper()
514
+ result.body = @client.deserialize(result_mapper, parsed_response)
515
+ rescue Exception => e
516
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
517
+ end
518
+ end
519
+
520
+ result
521
+ end
522
+
523
+ promise.execute
524
+ end
525
+
526
+ #
527
+ # Disables automatic scaling for a pool.
528
+ #
529
+ # @param resource_group_name [String] The name of the resource group that
530
+ # contains the Batch account.
531
+ # @param account_name [String] The name of the Batch account.
532
+ # @param pool_name [String] The pool name. This must be unique within the
533
+ # account.
534
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
535
+ # will be added to the HTTP request.
536
+ #
537
+ # @return [Pool] operation results.
538
+ #
539
+ def disable_auto_scale(resource_group_name, account_name, pool_name, custom_headers:nil)
540
+ response = disable_auto_scale_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value!
541
+ response.body unless response.nil?
542
+ end
543
+
544
+ #
545
+ # Disables automatic scaling for a pool.
546
+ #
547
+ # @param resource_group_name [String] The name of the resource group that
548
+ # contains the Batch account.
549
+ # @param account_name [String] The name of the Batch account.
550
+ # @param pool_name [String] The pool name. This must be unique within the
551
+ # account.
552
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
553
+ # will be added to the HTTP request.
554
+ #
555
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
556
+ #
557
+ def disable_auto_scale_with_http_info(resource_group_name, account_name, pool_name, custom_headers:nil)
558
+ disable_auto_scale_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value!
559
+ end
560
+
561
+ #
562
+ # Disables automatic scaling for a pool.
563
+ #
564
+ # @param resource_group_name [String] The name of the resource group that
565
+ # contains the Batch account.
566
+ # @param account_name [String] The name of the Batch account.
567
+ # @param pool_name [String] The pool name. This must be unique within the
568
+ # account.
569
+ # @param [Hash{String => String}] A hash of custom headers that will be added
570
+ # to the HTTP request.
571
+ #
572
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
573
+ #
574
+ def disable_auto_scale_async(resource_group_name, account_name, pool_name, custom_headers:nil)
575
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
576
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
577
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
578
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
579
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !account_name.nil? && account_name.match(Regexp.new('^^[-\w\._]+$$')).nil?
580
+ fail ArgumentError, 'pool_name is nil' if pool_name.nil?
581
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'MaxLength': '64'" if !pool_name.nil? && pool_name.length > 64
582
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'MinLength': '1'" if !pool_name.nil? && pool_name.length < 1
583
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9_-]+$'" if !pool_name.nil? && pool_name.match(Regexp.new('^^[a-zA-Z0-9_-]+$$')).nil?
584
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
585
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
586
+
587
+
588
+ request_headers = {}
589
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
590
+
591
+ # Set Headers
592
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
593
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
594
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale'
595
+
596
+ request_url = @base_url || @client.base_url
597
+
598
+ options = {
599
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
600
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'poolName' => pool_name,'subscriptionId' => @client.subscription_id},
601
+ query_params: {'api-version' => @client.api_version},
602
+ headers: request_headers.merge(custom_headers || {}),
603
+ base_url: request_url
604
+ }
605
+ promise = @client.make_request_async(:post, path_template, options)
606
+
607
+ promise = promise.then do |result|
608
+ http_response = result.response
609
+ status_code = http_response.status
610
+ response_content = http_response.body
611
+ unless status_code == 200
612
+ error_model = JSON.load(response_content)
613
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
614
+ end
615
+
616
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
617
+ # Deserialize Response
618
+ if status_code == 200
619
+ begin
620
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
621
+ result_mapper = Azure::Batch::Mgmt::V2017_09_01::Models::Pool.mapper()
622
+ result.body = @client.deserialize(result_mapper, parsed_response)
623
+ rescue Exception => e
624
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
625
+ end
626
+ end
627
+
628
+ result
629
+ end
630
+
631
+ promise.execute
632
+ end
633
+
634
+ #
635
+ # Stops an ongoing resize operation on the pool.
636
+ #
637
+ # This does not restore the pool to its previous state before the resize
638
+ # operation: it only stops any further changes being made, and the pool
639
+ # maintains its current state. After stopping, the pool stabilizes at the
640
+ # number of nodes it was at when the stop operation was done. During the stop
641
+ # operation, the pool allocation state changes first to stopping and then to
642
+ # steady. A resize operation need not be an explicit resize pool request; this
643
+ # API can also be used to halt the initial sizing of the pool when it is
644
+ # created.
645
+ #
646
+ # @param resource_group_name [String] The name of the resource group that
647
+ # contains the Batch account.
648
+ # @param account_name [String] The name of the Batch account.
649
+ # @param pool_name [String] The pool name. This must be unique within the
650
+ # account.
651
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
652
+ # will be added to the HTTP request.
653
+ #
654
+ # @return [Pool] operation results.
655
+ #
656
+ def stop_resize(resource_group_name, account_name, pool_name, custom_headers:nil)
657
+ response = stop_resize_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value!
658
+ response.body unless response.nil?
659
+ end
660
+
661
+ #
662
+ # Stops an ongoing resize operation on the pool.
663
+ #
664
+ # This does not restore the pool to its previous state before the resize
665
+ # operation: it only stops any further changes being made, and the pool
666
+ # maintains its current state. After stopping, the pool stabilizes at the
667
+ # number of nodes it was at when the stop operation was done. During the stop
668
+ # operation, the pool allocation state changes first to stopping and then to
669
+ # steady. A resize operation need not be an explicit resize pool request; this
670
+ # API can also be used to halt the initial sizing of the pool when it is
671
+ # created.
672
+ #
673
+ # @param resource_group_name [String] The name of the resource group that
674
+ # contains the Batch account.
675
+ # @param account_name [String] The name of the Batch account.
676
+ # @param pool_name [String] The pool name. This must be unique within the
677
+ # account.
678
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
679
+ # will be added to the HTTP request.
680
+ #
681
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
682
+ #
683
+ def stop_resize_with_http_info(resource_group_name, account_name, pool_name, custom_headers:nil)
684
+ stop_resize_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value!
685
+ end
686
+
687
+ #
688
+ # Stops an ongoing resize operation on the pool.
689
+ #
690
+ # This does not restore the pool to its previous state before the resize
691
+ # operation: it only stops any further changes being made, and the pool
692
+ # maintains its current state. After stopping, the pool stabilizes at the
693
+ # number of nodes it was at when the stop operation was done. During the stop
694
+ # operation, the pool allocation state changes first to stopping and then to
695
+ # steady. A resize operation need not be an explicit resize pool request; this
696
+ # API can also be used to halt the initial sizing of the pool when it is
697
+ # created.
698
+ #
699
+ # @param resource_group_name [String] The name of the resource group that
700
+ # contains the Batch account.
701
+ # @param account_name [String] The name of the Batch account.
702
+ # @param pool_name [String] The pool name. This must be unique within the
703
+ # account.
704
+ # @param [Hash{String => String}] A hash of custom headers that will be added
705
+ # to the HTTP request.
706
+ #
707
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
708
+ #
709
+ def stop_resize_async(resource_group_name, account_name, pool_name, custom_headers:nil)
710
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
711
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
712
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
713
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
714
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !account_name.nil? && account_name.match(Regexp.new('^^[-\w\._]+$$')).nil?
715
+ fail ArgumentError, 'pool_name is nil' if pool_name.nil?
716
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'MaxLength': '64'" if !pool_name.nil? && pool_name.length > 64
717
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'MinLength': '1'" if !pool_name.nil? && pool_name.length < 1
718
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9_-]+$'" if !pool_name.nil? && pool_name.match(Regexp.new('^^[a-zA-Z0-9_-]+$$')).nil?
719
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
720
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
721
+
722
+
723
+ request_headers = {}
724
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
725
+
726
+ # Set Headers
727
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
728
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
729
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize'
730
+
731
+ request_url = @base_url || @client.base_url
732
+
733
+ options = {
734
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
735
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'poolName' => pool_name,'subscriptionId' => @client.subscription_id},
736
+ query_params: {'api-version' => @client.api_version},
737
+ headers: request_headers.merge(custom_headers || {}),
738
+ base_url: request_url
739
+ }
740
+ promise = @client.make_request_async(:post, path_template, options)
741
+
742
+ promise = promise.then do |result|
743
+ http_response = result.response
744
+ status_code = http_response.status
745
+ response_content = http_response.body
746
+ unless status_code == 200
747
+ error_model = JSON.load(response_content)
748
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
749
+ end
750
+
751
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
752
+ # Deserialize Response
753
+ if status_code == 200
754
+ begin
755
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
756
+ result_mapper = Azure::Batch::Mgmt::V2017_09_01::Models::Pool.mapper()
757
+ result.body = @client.deserialize(result_mapper, parsed_response)
758
+ rescue Exception => e
759
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
760
+ end
761
+ end
762
+
763
+ result
764
+ end
765
+
766
+ promise.execute
767
+ end
768
+
769
+ #
770
+ # Creates a new pool inside the specified account.
771
+ #
772
+ # @param resource_group_name [String] The name of the resource group that
773
+ # contains the Batch account.
774
+ # @param account_name [String] The name of the Batch account.
775
+ # @param pool_name [String] The pool name. This must be unique within the
776
+ # account.
777
+ # @param parameters [Pool] Additional parameters for pool creation.
778
+ # @param if_match [String] The entity state (ETag) version of the pool to
779
+ # update. A value of "*" can be used to apply the operation only if the pool
780
+ # already exists. If omitted, this operation will always be applied.
781
+ # @param if_none_match [String] Set to '*' to allow a new pool to be created,
782
+ # but to prevent updating an existing pool. Other values will be ignored.
783
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
784
+ # will be added to the HTTP request.
785
+ #
786
+ # @return [Pool] operation results.
787
+ #
788
+ def begin_create(resource_group_name, account_name, pool_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil)
789
+ response = begin_create_async(resource_group_name, account_name, pool_name, parameters, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers).value!
790
+ response.body unless response.nil?
791
+ end
792
+
793
+ #
794
+ # Creates a new pool inside the specified account.
795
+ #
796
+ # @param resource_group_name [String] The name of the resource group that
797
+ # contains the Batch account.
798
+ # @param account_name [String] The name of the Batch account.
799
+ # @param pool_name [String] The pool name. This must be unique within the
800
+ # account.
801
+ # @param parameters [Pool] Additional parameters for pool creation.
802
+ # @param if_match [String] The entity state (ETag) version of the pool to
803
+ # update. A value of "*" can be used to apply the operation only if the pool
804
+ # already exists. If omitted, this operation will always be applied.
805
+ # @param if_none_match [String] Set to '*' to allow a new pool to be created,
806
+ # but to prevent updating an existing pool. Other values will be ignored.
807
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
808
+ # will be added to the HTTP request.
809
+ #
810
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
811
+ #
812
+ def begin_create_with_http_info(resource_group_name, account_name, pool_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil)
813
+ begin_create_async(resource_group_name, account_name, pool_name, parameters, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers).value!
814
+ end
815
+
816
+ #
817
+ # Creates a new pool inside the specified account.
818
+ #
819
+ # @param resource_group_name [String] The name of the resource group that
820
+ # contains the Batch account.
821
+ # @param account_name [String] The name of the Batch account.
822
+ # @param pool_name [String] The pool name. This must be unique within the
823
+ # account.
824
+ # @param parameters [Pool] Additional parameters for pool creation.
825
+ # @param if_match [String] The entity state (ETag) version of the pool to
826
+ # update. A value of "*" can be used to apply the operation only if the pool
827
+ # already exists. If omitted, this operation will always be applied.
828
+ # @param if_none_match [String] Set to '*' to allow a new pool to be created,
829
+ # but to prevent updating an existing pool. Other values will be ignored.
830
+ # @param [Hash{String => String}] A hash of custom headers that will be added
831
+ # to the HTTP request.
832
+ #
833
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
834
+ #
835
+ def begin_create_async(resource_group_name, account_name, pool_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil)
836
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
837
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
838
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
839
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
840
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !account_name.nil? && account_name.match(Regexp.new('^^[-\w\._]+$$')).nil?
841
+ fail ArgumentError, 'pool_name is nil' if pool_name.nil?
842
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'MaxLength': '64'" if !pool_name.nil? && pool_name.length > 64
843
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'MinLength': '1'" if !pool_name.nil? && pool_name.length < 1
844
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9_-]+$'" if !pool_name.nil? && pool_name.match(Regexp.new('^^[a-zA-Z0-9_-]+$$')).nil?
845
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
846
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
847
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
848
+
849
+
850
+ request_headers = {}
851
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
852
+
853
+ # Set Headers
854
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
855
+ request_headers['If-Match'] = if_match unless if_match.nil?
856
+ request_headers['If-None-Match'] = if_none_match unless if_none_match.nil?
857
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
858
+
859
+ # Serialize Request
860
+ request_mapper = Azure::Batch::Mgmt::V2017_09_01::Models::Pool.mapper()
861
+ request_content = @client.serialize(request_mapper, parameters)
862
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
863
+
864
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'
865
+
866
+ request_url = @base_url || @client.base_url
867
+
868
+ options = {
869
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
870
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'poolName' => pool_name,'subscriptionId' => @client.subscription_id},
871
+ query_params: {'api-version' => @client.api_version},
872
+ body: request_content,
873
+ headers: request_headers.merge(custom_headers || {}),
874
+ base_url: request_url
875
+ }
876
+ promise = @client.make_request_async(:put, path_template, options)
877
+
878
+ promise = promise.then do |result|
879
+ http_response = result.response
880
+ status_code = http_response.status
881
+ response_content = http_response.body
882
+ unless status_code == 200
883
+ error_model = JSON.load(response_content)
884
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
885
+ end
886
+
887
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
888
+ # Deserialize Response
889
+ if status_code == 200
890
+ begin
891
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
892
+ result_mapper = Azure::Batch::Mgmt::V2017_09_01::Models::Pool.mapper()
893
+ result.body = @client.deserialize(result_mapper, parsed_response)
894
+ rescue Exception => e
895
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
896
+ end
897
+ end
898
+
899
+ result
900
+ end
901
+
902
+ promise.execute
903
+ end
904
+
905
+ #
906
+ # Deletes the specified pool.
907
+ #
908
+ # @param resource_group_name [String] The name of the resource group that
909
+ # contains the Batch account.
910
+ # @param account_name [String] The name of the Batch account.
911
+ # @param pool_name [String] The pool name. This must be unique within the
912
+ # account.
913
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
914
+ # will be added to the HTTP request.
915
+ #
916
+ #
917
+ def begin_delete(resource_group_name, account_name, pool_name, custom_headers:nil)
918
+ response = begin_delete_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value!
919
+ nil
920
+ end
921
+
922
+ #
923
+ # Deletes the specified pool.
924
+ #
925
+ # @param resource_group_name [String] The name of the resource group that
926
+ # contains the Batch account.
927
+ # @param account_name [String] The name of the Batch account.
928
+ # @param pool_name [String] The pool name. This must be unique within the
929
+ # account.
930
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
931
+ # will be added to the HTTP request.
932
+ #
933
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
934
+ #
935
+ def begin_delete_with_http_info(resource_group_name, account_name, pool_name, custom_headers:nil)
936
+ begin_delete_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value!
937
+ end
938
+
939
+ #
940
+ # Deletes the specified pool.
941
+ #
942
+ # @param resource_group_name [String] The name of the resource group that
943
+ # contains the Batch account.
944
+ # @param account_name [String] The name of the Batch account.
945
+ # @param pool_name [String] The pool name. This must be unique within the
946
+ # account.
947
+ # @param [Hash{String => String}] A hash of custom headers that will be added
948
+ # to the HTTP request.
949
+ #
950
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
951
+ #
952
+ def begin_delete_async(resource_group_name, account_name, pool_name, custom_headers:nil)
953
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
954
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
955
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
956
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
957
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !account_name.nil? && account_name.match(Regexp.new('^^[-\w\._]+$$')).nil?
958
+ fail ArgumentError, 'pool_name is nil' if pool_name.nil?
959
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'MaxLength': '64'" if !pool_name.nil? && pool_name.length > 64
960
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'MinLength': '1'" if !pool_name.nil? && pool_name.length < 1
961
+ fail ArgumentError, "'pool_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9_-]+$'" if !pool_name.nil? && pool_name.match(Regexp.new('^^[a-zA-Z0-9_-]+$$')).nil?
962
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
963
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
964
+
965
+
966
+ request_headers = {}
967
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
968
+
969
+ # Set Headers
970
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
971
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
972
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}'
973
+
974
+ request_url = @base_url || @client.base_url
975
+
976
+ options = {
977
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
978
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'poolName' => pool_name,'subscriptionId' => @client.subscription_id},
979
+ query_params: {'api-version' => @client.api_version},
980
+ headers: request_headers.merge(custom_headers || {}),
981
+ base_url: request_url
982
+ }
983
+ promise = @client.make_request_async(:delete, path_template, options)
984
+
985
+ promise = promise.then do |result|
986
+ http_response = result.response
987
+ status_code = http_response.status
988
+ response_content = http_response.body
989
+ unless status_code == 200 || status_code == 204 || status_code == 202
990
+ error_model = JSON.load(response_content)
991
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
992
+ end
993
+
994
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
995
+
996
+ result
997
+ end
998
+
999
+ promise.execute
1000
+ end
1001
+
1002
+ #
1003
+ # Lists all of the pools in the specified account.
1004
+ #
1005
+ # @param next_page_link [String] The NextLink from the previous successful call
1006
+ # to List operation.
1007
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1008
+ # will be added to the HTTP request.
1009
+ #
1010
+ # @return [ListPoolsResult] operation results.
1011
+ #
1012
+ def list_by_batch_account_next(next_page_link, custom_headers:nil)
1013
+ response = list_by_batch_account_next_async(next_page_link, custom_headers:custom_headers).value!
1014
+ response.body unless response.nil?
1015
+ end
1016
+
1017
+ #
1018
+ # Lists all of the pools in the specified account.
1019
+ #
1020
+ # @param next_page_link [String] The NextLink from the previous successful call
1021
+ # to List operation.
1022
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1023
+ # will be added to the HTTP request.
1024
+ #
1025
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1026
+ #
1027
+ def list_by_batch_account_next_with_http_info(next_page_link, custom_headers:nil)
1028
+ list_by_batch_account_next_async(next_page_link, custom_headers:custom_headers).value!
1029
+ end
1030
+
1031
+ #
1032
+ # Lists all of the pools in the specified account.
1033
+ #
1034
+ # @param next_page_link [String] The NextLink from the previous successful call
1035
+ # to List operation.
1036
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1037
+ # to the HTTP request.
1038
+ #
1039
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1040
+ #
1041
+ def list_by_batch_account_next_async(next_page_link, custom_headers:nil)
1042
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1043
+
1044
+
1045
+ request_headers = {}
1046
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1047
+
1048
+ # Set Headers
1049
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1050
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1051
+ path_template = '{nextLink}'
1052
+
1053
+ request_url = @base_url || @client.base_url
1054
+
1055
+ options = {
1056
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1057
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1058
+ headers: request_headers.merge(custom_headers || {}),
1059
+ base_url: request_url
1060
+ }
1061
+ promise = @client.make_request_async(:get, path_template, options)
1062
+
1063
+ promise = promise.then do |result|
1064
+ http_response = result.response
1065
+ status_code = http_response.status
1066
+ response_content = http_response.body
1067
+ unless status_code == 200
1068
+ error_model = JSON.load(response_content)
1069
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1070
+ end
1071
+
1072
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1073
+ # Deserialize Response
1074
+ if status_code == 200
1075
+ begin
1076
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1077
+ result_mapper = Azure::Batch::Mgmt::V2017_09_01::Models::ListPoolsResult.mapper()
1078
+ result.body = @client.deserialize(result_mapper, parsed_response)
1079
+ rescue Exception => e
1080
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1081
+ end
1082
+ end
1083
+
1084
+ result
1085
+ end
1086
+
1087
+ promise.execute
1088
+ end
1089
+
1090
+ #
1091
+ # Lists all of the pools in the specified account.
1092
+ #
1093
+ # @param resource_group_name [String] The name of the resource group that
1094
+ # contains the Batch account.
1095
+ # @param account_name [String] The name of the Batch account.
1096
+ # @param maxresults [Integer] The maximum number of items to return in the
1097
+ # response.
1098
+ # @param select [String] Comma separated list of properties that should be
1099
+ # returned. e.g. "properties/provisioningState". Only top level properties
1100
+ # under properties/ are valid for selection.
1101
+ # @param filter [String] OData filter expression. Valid properties for
1102
+ # filtering are:
1103
+ #
1104
+ # name
1105
+ # properties/allocationState
1106
+ # properties/allocationStateTransitionTime
1107
+ # properties/creationTime
1108
+ # properties/provisioningState
1109
+ # properties/provisioningStateTransitionTime
1110
+ # properties/lastModified
1111
+ # properties/vmSize
1112
+ # properties/interNodeCommunication
1113
+ # properties/scaleSettings/autoScale
1114
+ # properties/scaleSettings/fixedScale
1115
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1116
+ # will be added to the HTTP request.
1117
+ #
1118
+ # @return [ListPoolsResult] which provide lazy access to pages of the response.
1119
+ #
1120
+ def list_by_batch_account_as_lazy(resource_group_name, account_name, maxresults:nil, select:nil, filter:nil, custom_headers:nil)
1121
+ response = list_by_batch_account_async(resource_group_name, account_name, maxresults:maxresults, select:select, filter:filter, custom_headers:custom_headers).value!
1122
+ unless response.nil?
1123
+ page = response.body
1124
+ page.next_method = Proc.new do |next_page_link|
1125
+ list_by_batch_account_next_async(next_page_link, custom_headers:custom_headers)
1126
+ end
1127
+ page
1128
+ end
1129
+ end
1130
+
1131
+ end
1132
+ end