azure_mgmt_vmware_cloudsimple 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple.rb +82 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/dedicated_cloud_nodes.rb +945 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/dedicated_cloud_services.rb +932 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/aggregation_type.rb +16 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/available_operation.rb +99 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/available_operation_display.rb +79 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/available_operation_display_property_service_specification_metrics_item.rb +94 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/available_operation_display_property_service_specification_metrics_list.rb +60 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/available_operations_list_response.rb +99 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/csrperror.rb +47 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/csrperror_body.rb +91 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/dedicated_cloud_node.rb +293 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/dedicated_cloud_node_list_response.rb +99 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/dedicated_cloud_service.rb +154 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/dedicated_cloud_service_list_response.rb +99 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/disk_independence_mode.rb +17 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/guest_ostype.rb +17 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/nictype.rb +20 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/node_status.rb +16 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/onboarding_status.rb +18 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/operation_error.rb +57 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/operation_origin.rb +17 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/operation_resource.rb +107 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/patch_payload.rb +54 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/private_cloud.rb +382 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/private_cloud_list.rb +98 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/private_cloud_resource_type.rb +15 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/resource_pool.rb +106 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/resource_pools_list_response.rb +98 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/sku.rb +93 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/sku_availability.rb +124 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/sku_availability_list_response.rb +99 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/stop_mode.rb +18 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/usage.rb +87 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/usage_count.rb +20 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/usage_list_response.rb +99 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/usage_name.rb +58 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_disk.rb +94 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_disk_controller.rb +84 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_machine.rb +388 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_machine_list_response.rb +98 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_machine_status.rb +20 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_machine_stop_mode.rb +49 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_machine_template.rb +283 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_machine_template_list_response.rb +98 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_network.rb +106 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_network_list_response.rb +98 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_nic.rb +124 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/module_definition.rb +9 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/operations.rb +335 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/private_clouds.rb +340 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/resource_pools.rb +349 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/skus_availability.rb +248 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/usages.rb +248 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/virtual_machine_templates.rb +361 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/virtual_machines.rb +1326 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/virtual_networks.rb +358 -0
- data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/vmware_cloud_simple_client.rb +170 -0
- data/lib/azure_mgmt_vmware_cloudsimple.rb +6 -0
- data/lib/module_definition.rb +7 -0
- data/lib/profiles/latest/modules/vmwarecloudsimple_profile_module.rb +259 -0
- data/lib/profiles/latest/vmwarecloudsimple_latest_profile_client.rb +40 -0
- data/lib/profiles/latest/vmwarecloudsimple_module_definition.rb +8 -0
- data/lib/version.rb +7 -0
- metadata +182 -0
|
@@ -0,0 +1,248 @@
|
|
|
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::VMwareCloudSimple::Mgmt::V2019_04_01
|
|
7
|
+
#
|
|
8
|
+
# Description of the new service
|
|
9
|
+
#
|
|
10
|
+
class SkusAvailability
|
|
11
|
+
include MsRestAzure
|
|
12
|
+
|
|
13
|
+
#
|
|
14
|
+
# Creates and initializes a new instance of the SkusAvailability class.
|
|
15
|
+
# @param client service class for accessing basic functionality.
|
|
16
|
+
#
|
|
17
|
+
def initialize(client)
|
|
18
|
+
@client = client
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# @return [VMwareCloudSimpleClient] reference to the VMwareCloudSimpleClient
|
|
22
|
+
attr_reader :client
|
|
23
|
+
|
|
24
|
+
#
|
|
25
|
+
# Implements SkuAvailability List method
|
|
26
|
+
#
|
|
27
|
+
# Returns list of available resources in region
|
|
28
|
+
#
|
|
29
|
+
# @param region_id [String] The region Id (westus, eastus)
|
|
30
|
+
# @param sku_id [String] sku id, if no sku is passed availability for all skus
|
|
31
|
+
# will be returned
|
|
32
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
33
|
+
# will be added to the HTTP request.
|
|
34
|
+
#
|
|
35
|
+
# @return [Array<SkuAvailability>] operation results.
|
|
36
|
+
#
|
|
37
|
+
def list(region_id, sku_id:nil, custom_headers:nil)
|
|
38
|
+
first_page = list_as_lazy(region_id, sku_id:sku_id, custom_headers:custom_headers)
|
|
39
|
+
first_page.get_all_items
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
#
|
|
43
|
+
# Implements SkuAvailability List method
|
|
44
|
+
#
|
|
45
|
+
# Returns list of available resources in region
|
|
46
|
+
#
|
|
47
|
+
# @param region_id [String] The region Id (westus, eastus)
|
|
48
|
+
# @param sku_id [String] sku id, if no sku is passed availability for all skus
|
|
49
|
+
# will be returned
|
|
50
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
51
|
+
# will be added to the HTTP request.
|
|
52
|
+
#
|
|
53
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
54
|
+
#
|
|
55
|
+
def list_with_http_info(region_id, sku_id:nil, custom_headers:nil)
|
|
56
|
+
list_async(region_id, sku_id:sku_id, custom_headers:custom_headers).value!
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
#
|
|
60
|
+
# Implements SkuAvailability List method
|
|
61
|
+
#
|
|
62
|
+
# Returns list of available resources in region
|
|
63
|
+
#
|
|
64
|
+
# @param region_id [String] The region Id (westus, eastus)
|
|
65
|
+
# @param sku_id [String] sku id, if no sku is passed availability for all skus
|
|
66
|
+
# will be returned
|
|
67
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
68
|
+
# to the HTTP request.
|
|
69
|
+
#
|
|
70
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
71
|
+
#
|
|
72
|
+
def list_async(region_id, sku_id:nil, custom_headers:nil)
|
|
73
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
74
|
+
fail ArgumentError, 'region_id is nil' if region_id.nil?
|
|
75
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
request_headers = {}
|
|
79
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
80
|
+
|
|
81
|
+
# Set Headers
|
|
82
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
83
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
84
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/availabilities'
|
|
85
|
+
|
|
86
|
+
request_url = @base_url || @client.base_url
|
|
87
|
+
|
|
88
|
+
options = {
|
|
89
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
90
|
+
path_params: {'subscriptionId' => @client.subscription_id,'regionId' => region_id},
|
|
91
|
+
query_params: {'skuId' => sku_id,'api-version' => @client.api_version},
|
|
92
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
93
|
+
base_url: request_url
|
|
94
|
+
}
|
|
95
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
96
|
+
|
|
97
|
+
promise = promise.then do |result|
|
|
98
|
+
http_response = result.response
|
|
99
|
+
status_code = http_response.status
|
|
100
|
+
response_content = http_response.body
|
|
101
|
+
unless status_code == 200
|
|
102
|
+
error_model = JSON.load(response_content)
|
|
103
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
107
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
|
108
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
|
109
|
+
# Deserialize Response
|
|
110
|
+
if status_code == 200
|
|
111
|
+
begin
|
|
112
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
113
|
+
result_mapper = Azure::VMwareCloudSimple::Mgmt::V2019_04_01::Models::SkuAvailabilityListResponse.mapper()
|
|
114
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
115
|
+
rescue Exception => e
|
|
116
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
result
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
promise.execute
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
#
|
|
127
|
+
# Implements SkuAvailability List method
|
|
128
|
+
#
|
|
129
|
+
# Returns list of available resources in region
|
|
130
|
+
#
|
|
131
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
|
132
|
+
# to List operation.
|
|
133
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
134
|
+
# will be added to the HTTP request.
|
|
135
|
+
#
|
|
136
|
+
# @return [SkuAvailabilityListResponse] operation results.
|
|
137
|
+
#
|
|
138
|
+
def list_next(next_page_link, custom_headers:nil)
|
|
139
|
+
response = list_next_async(next_page_link, custom_headers:custom_headers).value!
|
|
140
|
+
response.body unless response.nil?
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
#
|
|
144
|
+
# Implements SkuAvailability List method
|
|
145
|
+
#
|
|
146
|
+
# Returns list of available resources in region
|
|
147
|
+
#
|
|
148
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
|
149
|
+
# to List operation.
|
|
150
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
151
|
+
# will be added to the HTTP request.
|
|
152
|
+
#
|
|
153
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
154
|
+
#
|
|
155
|
+
def list_next_with_http_info(next_page_link, custom_headers:nil)
|
|
156
|
+
list_next_async(next_page_link, custom_headers:custom_headers).value!
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
#
|
|
160
|
+
# Implements SkuAvailability List method
|
|
161
|
+
#
|
|
162
|
+
# Returns list of available resources in region
|
|
163
|
+
#
|
|
164
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
|
165
|
+
# to List operation.
|
|
166
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
167
|
+
# to the HTTP request.
|
|
168
|
+
#
|
|
169
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
170
|
+
#
|
|
171
|
+
def list_next_async(next_page_link, custom_headers:nil)
|
|
172
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
request_headers = {}
|
|
176
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
177
|
+
|
|
178
|
+
# Set Headers
|
|
179
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
180
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
181
|
+
path_template = '{nextLink}'
|
|
182
|
+
|
|
183
|
+
request_url = @base_url || @client.base_url
|
|
184
|
+
|
|
185
|
+
options = {
|
|
186
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
187
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
|
188
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
189
|
+
base_url: request_url
|
|
190
|
+
}
|
|
191
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
192
|
+
|
|
193
|
+
promise = promise.then do |result|
|
|
194
|
+
http_response = result.response
|
|
195
|
+
status_code = http_response.status
|
|
196
|
+
response_content = http_response.body
|
|
197
|
+
unless status_code == 200
|
|
198
|
+
error_model = JSON.load(response_content)
|
|
199
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
203
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
|
204
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
|
205
|
+
# Deserialize Response
|
|
206
|
+
if status_code == 200
|
|
207
|
+
begin
|
|
208
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
209
|
+
result_mapper = Azure::VMwareCloudSimple::Mgmt::V2019_04_01::Models::SkuAvailabilityListResponse.mapper()
|
|
210
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
211
|
+
rescue Exception => e
|
|
212
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
result
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
promise.execute
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
#
|
|
223
|
+
# Implements SkuAvailability List method
|
|
224
|
+
#
|
|
225
|
+
# Returns list of available resources in region
|
|
226
|
+
#
|
|
227
|
+
# @param region_id [String] The region Id (westus, eastus)
|
|
228
|
+
# @param sku_id [String] sku id, if no sku is passed availability for all skus
|
|
229
|
+
# will be returned
|
|
230
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
231
|
+
# will be added to the HTTP request.
|
|
232
|
+
#
|
|
233
|
+
# @return [SkuAvailabilityListResponse] which provide lazy access to pages of
|
|
234
|
+
# the response.
|
|
235
|
+
#
|
|
236
|
+
def list_as_lazy(region_id, sku_id:nil, custom_headers:nil)
|
|
237
|
+
response = list_async(region_id, sku_id:sku_id, custom_headers:custom_headers).value!
|
|
238
|
+
unless response.nil?
|
|
239
|
+
page = response.body
|
|
240
|
+
page.next_method = Proc.new do |next_page_link|
|
|
241
|
+
list_next_async(next_page_link, custom_headers:custom_headers)
|
|
242
|
+
end
|
|
243
|
+
page
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
end
|
|
248
|
+
end
|
|
@@ -0,0 +1,248 @@
|
|
|
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::VMwareCloudSimple::Mgmt::V2019_04_01
|
|
7
|
+
#
|
|
8
|
+
# Description of the new service
|
|
9
|
+
#
|
|
10
|
+
class Usages
|
|
11
|
+
include MsRestAzure
|
|
12
|
+
|
|
13
|
+
#
|
|
14
|
+
# Creates and initializes a new instance of the Usages class.
|
|
15
|
+
# @param client service class for accessing basic functionality.
|
|
16
|
+
#
|
|
17
|
+
def initialize(client)
|
|
18
|
+
@client = client
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# @return [VMwareCloudSimpleClient] reference to the VMwareCloudSimpleClient
|
|
22
|
+
attr_reader :client
|
|
23
|
+
|
|
24
|
+
#
|
|
25
|
+
# Implements Usages List method
|
|
26
|
+
#
|
|
27
|
+
# Returns list of usage in region
|
|
28
|
+
#
|
|
29
|
+
# @param region_id [String] The region Id (westus, eastus)
|
|
30
|
+
# @param filter [String] The filter to apply on the list operation. only
|
|
31
|
+
# name.value is allowed here as a filter e.g. $filter=name.value eq 'xxxx'
|
|
32
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
33
|
+
# will be added to the HTTP request.
|
|
34
|
+
#
|
|
35
|
+
# @return [Array<Usage>] operation results.
|
|
36
|
+
#
|
|
37
|
+
def list(region_id, filter:nil, custom_headers:nil)
|
|
38
|
+
first_page = list_as_lazy(region_id, filter:filter, custom_headers:custom_headers)
|
|
39
|
+
first_page.get_all_items
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
#
|
|
43
|
+
# Implements Usages List method
|
|
44
|
+
#
|
|
45
|
+
# Returns list of usage in region
|
|
46
|
+
#
|
|
47
|
+
# @param region_id [String] The region Id (westus, eastus)
|
|
48
|
+
# @param filter [String] The filter to apply on the list operation. only
|
|
49
|
+
# name.value is allowed here as a filter e.g. $filter=name.value eq 'xxxx'
|
|
50
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
51
|
+
# will be added to the HTTP request.
|
|
52
|
+
#
|
|
53
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
54
|
+
#
|
|
55
|
+
def list_with_http_info(region_id, filter:nil, custom_headers:nil)
|
|
56
|
+
list_async(region_id, filter:filter, custom_headers:custom_headers).value!
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
#
|
|
60
|
+
# Implements Usages List method
|
|
61
|
+
#
|
|
62
|
+
# Returns list of usage in region
|
|
63
|
+
#
|
|
64
|
+
# @param region_id [String] The region Id (westus, eastus)
|
|
65
|
+
# @param filter [String] The filter to apply on the list operation. only
|
|
66
|
+
# name.value is allowed here as a filter e.g. $filter=name.value eq 'xxxx'
|
|
67
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
68
|
+
# to the HTTP request.
|
|
69
|
+
#
|
|
70
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
71
|
+
#
|
|
72
|
+
def list_async(region_id, filter:nil, custom_headers:nil)
|
|
73
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
74
|
+
fail ArgumentError, 'region_id is nil' if region_id.nil?
|
|
75
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
request_headers = {}
|
|
79
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
80
|
+
|
|
81
|
+
# Set Headers
|
|
82
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
83
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
84
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/usages'
|
|
85
|
+
|
|
86
|
+
request_url = @base_url || @client.base_url
|
|
87
|
+
|
|
88
|
+
options = {
|
|
89
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
90
|
+
path_params: {'subscriptionId' => @client.subscription_id,'regionId' => region_id},
|
|
91
|
+
query_params: {'$filter' => filter,'api-version' => @client.api_version},
|
|
92
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
93
|
+
base_url: request_url
|
|
94
|
+
}
|
|
95
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
96
|
+
|
|
97
|
+
promise = promise.then do |result|
|
|
98
|
+
http_response = result.response
|
|
99
|
+
status_code = http_response.status
|
|
100
|
+
response_content = http_response.body
|
|
101
|
+
unless status_code == 200
|
|
102
|
+
error_model = JSON.load(response_content)
|
|
103
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
107
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
|
108
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
|
109
|
+
# Deserialize Response
|
|
110
|
+
if status_code == 200
|
|
111
|
+
begin
|
|
112
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
113
|
+
result_mapper = Azure::VMwareCloudSimple::Mgmt::V2019_04_01::Models::UsageListResponse.mapper()
|
|
114
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
115
|
+
rescue Exception => e
|
|
116
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
result
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
promise.execute
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
#
|
|
127
|
+
# Implements Usages List method
|
|
128
|
+
#
|
|
129
|
+
# Returns list of usage in region
|
|
130
|
+
#
|
|
131
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
|
132
|
+
# to List operation.
|
|
133
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
134
|
+
# will be added to the HTTP request.
|
|
135
|
+
#
|
|
136
|
+
# @return [UsageListResponse] operation results.
|
|
137
|
+
#
|
|
138
|
+
def list_next(next_page_link, custom_headers:nil)
|
|
139
|
+
response = list_next_async(next_page_link, custom_headers:custom_headers).value!
|
|
140
|
+
response.body unless response.nil?
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
#
|
|
144
|
+
# Implements Usages List method
|
|
145
|
+
#
|
|
146
|
+
# Returns list of usage in region
|
|
147
|
+
#
|
|
148
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
|
149
|
+
# to List operation.
|
|
150
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
151
|
+
# will be added to the HTTP request.
|
|
152
|
+
#
|
|
153
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
154
|
+
#
|
|
155
|
+
def list_next_with_http_info(next_page_link, custom_headers:nil)
|
|
156
|
+
list_next_async(next_page_link, custom_headers:custom_headers).value!
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
#
|
|
160
|
+
# Implements Usages List method
|
|
161
|
+
#
|
|
162
|
+
# Returns list of usage in region
|
|
163
|
+
#
|
|
164
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
|
165
|
+
# to List operation.
|
|
166
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
167
|
+
# to the HTTP request.
|
|
168
|
+
#
|
|
169
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
170
|
+
#
|
|
171
|
+
def list_next_async(next_page_link, custom_headers:nil)
|
|
172
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
request_headers = {}
|
|
176
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
177
|
+
|
|
178
|
+
# Set Headers
|
|
179
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
180
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
181
|
+
path_template = '{nextLink}'
|
|
182
|
+
|
|
183
|
+
request_url = @base_url || @client.base_url
|
|
184
|
+
|
|
185
|
+
options = {
|
|
186
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
187
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
|
188
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
189
|
+
base_url: request_url
|
|
190
|
+
}
|
|
191
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
192
|
+
|
|
193
|
+
promise = promise.then do |result|
|
|
194
|
+
http_response = result.response
|
|
195
|
+
status_code = http_response.status
|
|
196
|
+
response_content = http_response.body
|
|
197
|
+
unless status_code == 200
|
|
198
|
+
error_model = JSON.load(response_content)
|
|
199
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
203
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
|
204
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
|
205
|
+
# Deserialize Response
|
|
206
|
+
if status_code == 200
|
|
207
|
+
begin
|
|
208
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
209
|
+
result_mapper = Azure::VMwareCloudSimple::Mgmt::V2019_04_01::Models::UsageListResponse.mapper()
|
|
210
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
211
|
+
rescue Exception => e
|
|
212
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
result
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
promise.execute
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
#
|
|
223
|
+
# Implements Usages List method
|
|
224
|
+
#
|
|
225
|
+
# Returns list of usage in region
|
|
226
|
+
#
|
|
227
|
+
# @param region_id [String] The region Id (westus, eastus)
|
|
228
|
+
# @param filter [String] The filter to apply on the list operation. only
|
|
229
|
+
# name.value is allowed here as a filter e.g. $filter=name.value eq 'xxxx'
|
|
230
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
231
|
+
# will be added to the HTTP request.
|
|
232
|
+
#
|
|
233
|
+
# @return [UsageListResponse] which provide lazy access to pages of the
|
|
234
|
+
# response.
|
|
235
|
+
#
|
|
236
|
+
def list_as_lazy(region_id, filter:nil, custom_headers:nil)
|
|
237
|
+
response = list_async(region_id, filter:filter, custom_headers:custom_headers).value!
|
|
238
|
+
unless response.nil?
|
|
239
|
+
page = response.body
|
|
240
|
+
page.next_method = Proc.new do |next_page_link|
|
|
241
|
+
list_next_async(next_page_link, custom_headers:custom_headers)
|
|
242
|
+
end
|
|
243
|
+
page
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
end
|
|
248
|
+
end
|