azure_mgmt_compute 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/azure_mgmt_compute.gemspec +3 -11
  3. data/lib/azure_mgmt_compute/availability_sets.rb +226 -241
  4. data/lib/azure_mgmt_compute/compute_management_client.rb +26 -11
  5. data/lib/azure_mgmt_compute/models/additional_unattend_content.rb +8 -11
  6. data/lib/azure_mgmt_compute/models/api_entity_reference.rb +58 -0
  7. data/lib/azure_mgmt_compute/models/api_error.rb +4 -6
  8. data/lib/azure_mgmt_compute/models/api_error_base.rb +1 -3
  9. data/lib/azure_mgmt_compute/models/availability_set.rb +1 -3
  10. data/lib/azure_mgmt_compute/models/availability_set_list_result.rb +4 -6
  11. data/lib/azure_mgmt_compute/models/availability_set_properties.rb +9 -11
  12. data/lib/azure_mgmt_compute/models/boot_diagnostics.rb +67 -0
  13. data/lib/azure_mgmt_compute/models/boot_diagnostics_instance_view.rb +65 -0
  14. data/lib/azure_mgmt_compute/models/caching_types.rb +1 -1
  15. data/lib/azure_mgmt_compute/models/component_names.rb +1 -1
  16. data/lib/azure_mgmt_compute/models/compute_long_running_operation_properties.rb +1 -3
  17. data/lib/azure_mgmt_compute/models/compute_long_running_operation_result.rb +3 -6
  18. data/lib/azure_mgmt_compute/models/compute_operation_status.rb +1 -1
  19. data/lib/azure_mgmt_compute/models/data_disk.rb +27 -26
  20. data/lib/azure_mgmt_compute/models/data_disk_image.rb +1 -3
  21. data/lib/azure_mgmt_compute/models/delete_operation_result.rb +6 -5
  22. data/lib/azure_mgmt_compute/models/diagnostics_profile.rb +62 -0
  23. data/lib/azure_mgmt_compute/models/disk_create_option_types.rb +1 -1
  24. data/lib/azure_mgmt_compute/models/disk_encryption_settings.rb +81 -0
  25. data/lib/azure_mgmt_compute/models/disk_instance_view.rb +4 -6
  26. data/lib/azure_mgmt_compute/models/hardware_profile.rb +15 -9
  27. data/lib/azure_mgmt_compute/models/image_reference.rb +1 -3
  28. data/lib/azure_mgmt_compute/models/inner_error.rb +1 -3
  29. data/lib/azure_mgmt_compute/models/instance_view_status.rb +3 -5
  30. data/lib/azure_mgmt_compute/models/key_vault_key_reference.rb +74 -0
  31. data/lib/azure_mgmt_compute/models/key_vault_secret_reference.rb +75 -0
  32. data/lib/azure_mgmt_compute/models/linux_configuration.rb +1 -3
  33. data/lib/azure_mgmt_compute/models/list_usages_result.rb +4 -6
  34. data/lib/azure_mgmt_compute/models/network_interface_reference.rb +1 -3
  35. data/lib/azure_mgmt_compute/models/network_interface_reference_properties.rb +1 -3
  36. data/lib/azure_mgmt_compute/models/network_profile.rb +4 -6
  37. data/lib/azure_mgmt_compute/models/operating_system_types.rb +1 -1
  38. data/lib/azure_mgmt_compute/models/operation_status.rb +1 -1
  39. data/lib/azure_mgmt_compute/models/osdisk.rb +54 -26
  40. data/lib/azure_mgmt_compute/models/osdisk_image.rb +4 -6
  41. data/lib/azure_mgmt_compute/models/osprofile.rb +4 -6
  42. data/lib/azure_mgmt_compute/models/pass_names.rb +1 -1
  43. data/lib/azure_mgmt_compute/models/plan.rb +1 -3
  44. data/lib/azure_mgmt_compute/models/protocol_types.rb +1 -1
  45. data/lib/azure_mgmt_compute/models/purchase_plan.rb +4 -4
  46. data/lib/azure_mgmt_compute/models/setting_names.rb +1 -1
  47. data/lib/azure_mgmt_compute/models/sku.rb +75 -0
  48. data/lib/azure_mgmt_compute/models/ssh_configuration.rb +4 -6
  49. data/lib/azure_mgmt_compute/models/ssh_public_key.rb +1 -3
  50. data/lib/azure_mgmt_compute/models/status_level_types.rb +1 -1
  51. data/lib/azure_mgmt_compute/models/storage_profile.rb +4 -6
  52. data/lib/azure_mgmt_compute/models/{usage_unit.rb → upgrade_mode.rb} +5 -4
  53. data/lib/azure_mgmt_compute/models/upgrade_policy.rb +60 -0
  54. data/lib/azure_mgmt_compute/models/usage.rb +7 -9
  55. data/lib/azure_mgmt_compute/models/usage_name.rb +1 -3
  56. data/lib/azure_mgmt_compute/models/vault_certificate.rb +1 -3
  57. data/lib/azure_mgmt_compute/models/vault_secret_group.rb +6 -8
  58. data/lib/azure_mgmt_compute/models/virtual_hard_disk.rb +1 -3
  59. data/lib/azure_mgmt_compute/models/virtual_machine.rb +4 -6
  60. data/lib/azure_mgmt_compute/models/virtual_machine_agent_instance_view.rb +7 -9
  61. data/lib/azure_mgmt_compute/models/virtual_machine_capture_parameters.rb +4 -4
  62. data/lib/azure_mgmt_compute/models/virtual_machine_capture_result.rb +68 -0
  63. data/lib/azure_mgmt_compute/models/virtual_machine_capture_result_properties.rb +56 -0
  64. data/lib/azure_mgmt_compute/models/virtual_machine_extension.rb +1 -3
  65. data/lib/azure_mgmt_compute/models/virtual_machine_extension_handler_instance_view.rb +1 -3
  66. data/lib/azure_mgmt_compute/models/virtual_machine_extension_image.rb +15 -15
  67. data/lib/azure_mgmt_compute/models/virtual_machine_extension_image_properties.rb +4 -4
  68. data/lib/azure_mgmt_compute/models/virtual_machine_extension_instance_view.rb +7 -9
  69. data/lib/azure_mgmt_compute/models/virtual_machine_extension_properties.rb +11 -3
  70. data/lib/azure_mgmt_compute/models/virtual_machine_image.rb +15 -15
  71. data/lib/azure_mgmt_compute/models/virtual_machine_image_properties.rb +4 -6
  72. data/lib/azure_mgmt_compute/models/virtual_machine_image_resource.rb +9 -9
  73. data/lib/azure_mgmt_compute/models/virtual_machine_instance_view.rb +28 -14
  74. data/lib/azure_mgmt_compute/models/virtual_machine_list_result.rb +4 -6
  75. data/lib/azure_mgmt_compute/models/virtual_machine_properties.rb +29 -5
  76. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set.rb +108 -0
  77. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_extension.rb +77 -0
  78. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_extension_profile.rb +77 -0
  79. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_extension_properties.rb +116 -0
  80. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_instance_view.rb +125 -0
  81. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_instance_view_statuses_summary.rb +79 -0
  82. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_ipconfiguration.rb +78 -0
  83. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_ipconfiguration_properties.rb +127 -0
  84. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_list_result.rb +77 -0
  85. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_list_skus_result.rb +77 -0
  86. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_list_with_link_result.rb +88 -0
  87. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_network_configuration.rb +80 -0
  88. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_network_configuration_properties.rb +89 -0
  89. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_network_profile.rb +77 -0
  90. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_osdisk.rb +129 -0
  91. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_osprofile.rb +147 -0
  92. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_properties.rb +89 -0
  93. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_sku.rb +88 -0
  94. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_sku_capacity.rb +90 -0
  95. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_sku_scale_type.rb +16 -0
  96. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_storage_profile.rb +78 -0
  97. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vm.rb +165 -0
  98. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vmextensions_summary.rb +87 -0
  99. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_ids.rb +57 -0
  100. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_required_ids.rb +59 -0
  101. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_view.rb +202 -0
  102. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vmlist_result.rb +77 -0
  103. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vmprofile.rb +114 -0
  104. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vmproperties.rb +190 -0
  105. data/lib/azure_mgmt_compute/models/virtual_machine_size.rb +1 -3
  106. data/lib/azure_mgmt_compute/models/virtual_machine_size_list_result.rb +4 -6
  107. data/lib/azure_mgmt_compute/models/virtual_machine_size_types.rb +53 -45
  108. data/lib/azure_mgmt_compute/models/virtual_machine_status_code_count.rb +68 -0
  109. data/lib/azure_mgmt_compute/models/win_rmconfiguration.rb +4 -6
  110. data/lib/azure_mgmt_compute/models/win_rmlistener.rb +3 -5
  111. data/lib/azure_mgmt_compute/models/windows_configuration.rb +4 -6
  112. data/lib/azure_mgmt_compute/module_definition.rb +5 -3
  113. data/lib/azure_mgmt_compute/usage_operations.rb +75 -42
  114. data/lib/azure_mgmt_compute/version.rb +5 -3
  115. data/lib/azure_mgmt_compute/virtual_machine_extension_images.rb +71 -158
  116. data/lib/azure_mgmt_compute/virtual_machine_extensions.rb +66 -149
  117. data/lib/azure_mgmt_compute/virtual_machine_images.rb +121 -264
  118. data/lib/azure_mgmt_compute/virtual_machine_scale_set_vms.rb +750 -0
  119. data/lib/azure_mgmt_compute/virtual_machine_scale_sets.rb +1327 -0
  120. data/lib/azure_mgmt_compute/virtual_machine_sizes.rb +75 -42
  121. data/lib/azure_mgmt_compute/virtual_machines.rb +397 -623
  122. data/lib/azure_mgmt_compute.rb +57 -18
  123. metadata +50 -128
  124. data/.gitignore +0 -10
  125. data/.travis.yml +0 -3
  126. data/Gemfile +0 -17
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -9,50 +9,58 @@ module Azure::ARM::Compute
9
9
  # Defines values for VirtualMachineSizeTypes
10
10
  #
11
11
  module VirtualMachineSizeTypes
12
- BasicA0 = 'Basic_A0'
13
- BasicA1 = 'Basic_A1'
14
- BasicA2 = 'Basic_A2'
15
- BasicA3 = 'Basic_A3'
16
- BasicA4 = 'Basic_A4'
17
- StandardA0 = 'Standard_A0'
18
- StandardA1 = 'Standard_A1'
19
- StandardA2 = 'Standard_A2'
20
- StandardA3 = 'Standard_A3'
21
- StandardA4 = 'Standard_A4'
22
- StandardA5 = 'Standard_A5'
23
- StandardA6 = 'Standard_A6'
24
- StandardA7 = 'Standard_A7'
25
- StandardA8 = 'Standard_A8'
26
- StandardA9 = 'Standard_A9'
27
- StandardA10 = 'Standard_A10'
28
- StandardA11 = 'Standard_A11'
29
- StandardD1 = 'Standard_D1'
30
- StandardD2 = 'Standard_D2'
31
- StandardD3 = 'Standard_D3'
32
- StandardD4 = 'Standard_D4'
33
- StandardDS1 = 'Standard_DS1'
34
- StandardDS2 = 'Standard_DS2'
35
- StandardDS3 = 'Standard_DS3'
36
- StandardDS4 = 'Standard_DS4'
37
- StandardD11 = 'Standard_D11'
38
- StandardD12 = 'Standard_D12'
39
- StandardD13 = 'Standard_D13'
40
- StandardD14 = 'Standard_D14'
41
- StandardDS11 = 'Standard_DS11'
42
- StandardDS12 = 'Standard_DS12'
43
- StandardDS13 = 'Standard_DS13'
44
- StandardDS14 = 'Standard_DS14'
45
- StandardG1 = 'Standard_G1'
46
- StandardG2 = 'Standard_G2'
47
- StandardG3 = 'Standard_G3'
48
- StandardG4 = 'Standard_G4'
49
- StandardG5 = 'Standard_G5'
50
- StandardGS1 = 'Standard_GS1'
51
- StandardGS2 = 'Standard_GS2'
52
- StandardGS3 = 'Standard_GS3'
53
- StandardGS4 = 'Standard_GS4'
54
- StandardGS5 = 'Standard_GS5'
55
-
12
+ BasicA0 = "Basic_A0"
13
+ BasicA1 = "Basic_A1"
14
+ BasicA2 = "Basic_A2"
15
+ BasicA3 = "Basic_A3"
16
+ BasicA4 = "Basic_A4"
17
+ StandardA0 = "Standard_A0"
18
+ StandardA1 = "Standard_A1"
19
+ StandardA2 = "Standard_A2"
20
+ StandardA3 = "Standard_A3"
21
+ StandardA4 = "Standard_A4"
22
+ StandardA5 = "Standard_A5"
23
+ StandardA6 = "Standard_A6"
24
+ StandardA7 = "Standard_A7"
25
+ StandardA8 = "Standard_A8"
26
+ StandardA9 = "Standard_A9"
27
+ StandardA10 = "Standard_A10"
28
+ StandardA11 = "Standard_A11"
29
+ StandardD1 = "Standard_D1"
30
+ StandardD2 = "Standard_D2"
31
+ StandardD3 = "Standard_D3"
32
+ StandardD4 = "Standard_D4"
33
+ StandardD11 = "Standard_D11"
34
+ StandardD12 = "Standard_D12"
35
+ StandardD13 = "Standard_D13"
36
+ StandardD14 = "Standard_D14"
37
+ StandardD1V2 = "Standard_D1_v2"
38
+ StandardD2V2 = "Standard_D2_v2"
39
+ StandardD3V2 = "Standard_D3_v2"
40
+ StandardD4V2 = "Standard_D4_v2"
41
+ StandardD5V2 = "Standard_D5_v2"
42
+ StandardD11V2 = "Standard_D11_v2"
43
+ StandardD12V2 = "Standard_D12_v2"
44
+ StandardD13V2 = "Standard_D13_v2"
45
+ StandardD14V2 = "Standard_D14_v2"
46
+ StandardDS1 = "Standard_DS1"
47
+ StandardDS2 = "Standard_DS2"
48
+ StandardDS3 = "Standard_DS3"
49
+ StandardDS4 = "Standard_DS4"
50
+ StandardDS11 = "Standard_DS11"
51
+ StandardDS12 = "Standard_DS12"
52
+ StandardDS13 = "Standard_DS13"
53
+ StandardDS14 = "Standard_DS14"
54
+ StandardG1 = "Standard_G1"
55
+ StandardG2 = "Standard_G2"
56
+ StandardG3 = "Standard_G3"
57
+ StandardG4 = "Standard_G4"
58
+ StandardG5 = "Standard_G5"
59
+ StandardGS1 = "Standard_GS1"
60
+ StandardGS2 = "Standard_GS2"
61
+ StandardGS3 = "Standard_GS3"
62
+ StandardGS4 = "Standard_GS4"
63
+ StandardGS5 = "Standard_GS5"
56
64
  end
57
65
  end
58
66
  end
@@ -0,0 +1,68 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Compute
7
+ module Models
8
+ #
9
+ # The status code and count of the virtual machine scale set instance view
10
+ # status summary.
11
+ #
12
+ class VirtualMachineStatusCodeCount
13
+
14
+ include MsRestAzure
15
+
16
+ # @return [String] Gets the instance view status code.
17
+ attr_accessor :code
18
+
19
+ # @return [Integer] Gets the number of instances having a particular
20
+ # status code.
21
+ attr_accessor :count
22
+
23
+ #
24
+ # Validate the object. Throws ValidationError if validation fails.
25
+ #
26
+ def validate
27
+ # Nothing to validate
28
+ end
29
+
30
+ #
31
+ # Serializes given Model object into Ruby Hash.
32
+ # @param object Model object to serialize.
33
+ # @return [Hash] Serialized object in form of Ruby Hash.
34
+ #
35
+ def self.serialize_object(object)
36
+ object.validate
37
+ output_object = {}
38
+
39
+ serialized_property = object.code
40
+ output_object['code'] = serialized_property unless serialized_property.nil?
41
+
42
+ serialized_property = object.count
43
+ output_object['count'] = serialized_property unless serialized_property.nil?
44
+
45
+ output_object
46
+ end
47
+
48
+ #
49
+ # Deserializes given Ruby Hash into Model object.
50
+ # @param object [Hash] Ruby Hash object to deserialize.
51
+ # @return [VirtualMachineStatusCodeCount] Deserialized object.
52
+ #
53
+ def self.deserialize_object(object)
54
+ return if object.nil?
55
+ output_object = VirtualMachineStatusCodeCount.new
56
+
57
+ deserialized_property = object['code']
58
+ output_object.code = deserialized_property
59
+
60
+ deserialized_property = object['count']
61
+ deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty?
62
+ output_object.count = deserialized_property
63
+
64
+ output_object
65
+ end
66
+ end
67
+ end
68
+ end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -59,19 +59,17 @@ module Azure::ARM::Compute
59
59
 
60
60
  deserialized_property = object['listeners']
61
61
  unless deserialized_property.nil?
62
- deserializedArray = [];
62
+ deserialized_array = []
63
63
  deserialized_property.each do |element1|
64
64
  unless element1.nil?
65
65
  element1 = WinRMListener.deserialize_object(element1)
66
66
  end
67
- deserializedArray.push(element1);
67
+ deserialized_array.push(element1)
68
68
  end
69
- deserialized_property = deserializedArray;
69
+ deserialized_property = deserialized_array
70
70
  end
71
71
  output_object.listeners = deserialized_property
72
72
 
73
- output_object.validate
74
-
75
73
  output_object
76
74
  end
77
75
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -14,7 +14,7 @@ module Azure::ARM::Compute
14
14
 
15
15
  # @return [ProtocolTypes] Gets or sets the Protocol used by WinRM
16
16
  # listener. Currently only Http and Https are supported. Possible
17
- # values for this property include: 'Http', 'Https'.
17
+ # values include: 'Http', 'Https'
18
18
  attr_accessor :protocol
19
19
 
20
20
  # @return [String] Gets or sets the Certificate URL in KMS for Https
@@ -57,15 +57,13 @@ module Azure::ARM::Compute
57
57
  deserialized_property = object['protocol']
58
58
  if (!deserialized_property.nil? && !deserialized_property.empty?)
59
59
  enum_is_valid = ProtocolTypes.constants.any? { |e| ProtocolTypes.const_get(e).to_s.downcase == deserialized_property.downcase }
60
- fail MsRest::DeserializationError.new('Error occured while deserializing the enum', nil, nil, nil) unless enum_is_valid
60
+ warn 'Enum ProtocolTypes does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid
61
61
  end
62
62
  output_object.protocol = deserialized_property
63
63
 
64
64
  deserialized_property = object['certificateUrl']
65
65
  output_object.certificate_url = deserialized_property
66
66
 
67
- output_object.validate
68
-
69
67
  output_object
70
68
  end
71
69
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -100,14 +100,14 @@ module Azure::ARM::Compute
100
100
 
101
101
  deserialized_property = object['additionalUnattendContent']
102
102
  unless deserialized_property.nil?
103
- deserializedArray = [];
103
+ deserialized_array = []
104
104
  deserialized_property.each do |element1|
105
105
  unless element1.nil?
106
106
  element1 = AdditionalUnattendContent.deserialize_object(element1)
107
107
  end
108
- deserializedArray.push(element1);
108
+ deserialized_array.push(element1)
109
109
  end
110
- deserialized_property = deserializedArray;
110
+ deserialized_property = deserialized_array
111
111
  end
112
112
  output_object.additional_unattend_content = deserialized_property
113
113
 
@@ -117,8 +117,6 @@ module Azure::ARM::Compute
117
117
  end
118
118
  output_object.win_rm = deserialized_property
119
119
 
120
- output_object.validate
121
-
122
120
  output_object
123
121
  end
124
122
  end
@@ -1,6 +1,8 @@
1
- # Copyright (c) Microsoft Corporation. All rights reserved.
2
- # Licensed under the MIT License. See License.txt in the project root for license information.
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
3
5
 
4
6
  module Azure end
5
7
  module Azure::ARM end
6
- module Azure::ARM::Compute end
8
+ module Azure::ARM::Compute end
@@ -1,11 +1,11 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
6
6
  module Azure::ARM::Compute
7
7
  #
8
- # UsageOperations
8
+ # The Compute Management Client.
9
9
  #
10
10
  class UsageOperations
11
11
  include Azure::ARM::Compute::Models
@@ -24,6 +24,7 @@ module Azure::ARM::Compute
24
24
 
25
25
  #
26
26
  # Lists compute usages for a subscription.
27
+ #
27
28
  # @param location [String] The location upon which resource usage is queried.
28
29
  # @param [Hash{String => String}] The hash of custom headers need to be
29
30
  # applied to HTTP request.
@@ -35,71 +36,103 @@ module Azure::ARM::Compute
35
36
  fail ArgumentError, 'location is nil' if location.nil?
36
37
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
37
38
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
38
- # Construct URL
39
- path = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages"
40
- path['{location}'] = ERB::Util.url_encode(location) if path.include?('{location}')
41
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
42
- url = URI.join(@client.base_url, path)
43
- properties = {}
44
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
45
- unless url.query.nil?
46
- url.query.split('&').each do |url_item|
47
- url_items_parts = url_item.split('=')
48
- properties[url_items_parts[0]] = url_items_parts[1]
49
- end
50
- end
51
- properties.reject!{ |key, value| value.nil? }
52
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
53
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
54
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
55
- url = URI.parse(corrected_url)
56
-
57
- connection = Faraday.new(:url => url) do |faraday|
58
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
59
- faraday.use :cookie_jar
60
- faraday.adapter Faraday.default_adapter
61
- end
62
- request_headers = Hash.new
39
+ request_headers = {}
63
40
 
64
41
  # Set Headers
65
42
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
66
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
43
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
44
+ path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages'
45
+ options = {
46
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
47
+ path_params: {'location' => location,'subscriptionId' => @client.subscription_id},
48
+ query_params: {'api-version' => @client.api_version},
49
+ headers: request_headers.merge(custom_headers || {})
50
+ }
51
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
52
+ promise = request.run_promise do |req|
53
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
54
+ end
67
55
 
68
- unless custom_headers.nil?
69
- custom_headers.each do |key, value|
70
- request_headers[key] = value
56
+ promise = promise.then do |http_response|
57
+ status_code = http_response.status
58
+ response_content = http_response.body
59
+ unless status_code == 200
60
+ error_model = JSON.load(response_content)
61
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
71
62
  end
72
- end
73
63
 
74
- # Send Request
75
- promise = Concurrent::Promise.new do
76
- connection.get do |request|
77
- request.headers = request_headers
78
- @client.credentials.sign_request(request) unless @client.credentials.nil?
64
+ # Create Result
65
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
66
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
67
+ # Deserialize Response
68
+ if status_code == 200
69
+ begin
70
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
71
+ unless parsed_response.nil?
72
+ parsed_response = ListUsagesResult.deserialize_object(parsed_response)
73
+ end
74
+ result.body = parsed_response
75
+ rescue Exception => e
76
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
77
+ end
79
78
  end
79
+
80
+ result
81
+ end
82
+
83
+ promise.execute
84
+ end
85
+
86
+ #
87
+ # Lists compute usages for a subscription.
88
+ #
89
+ # @param next_page_link [String] The NextLink from the previous successful
90
+ # call to List operation.
91
+ # @param [Hash{String => String}] The hash of custom headers need to be
92
+ # applied to HTTP request.
93
+ #
94
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
95
+ # response.
96
+ #
97
+ def list_next(next_page_link, custom_headers = nil)
98
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
99
+ request_headers = {}
100
+
101
+ # Set Headers
102
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
103
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
104
+ path_template = '{nextLink}'
105
+ options = {
106
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
107
+ skip_encoding_path_params: {'nextLink' => next_page_link},
108
+ headers: request_headers.merge(custom_headers || {})
109
+ }
110
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
111
+ promise = request.run_promise do |req|
112
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
80
113
  end
81
114
 
82
115
  promise = promise.then do |http_response|
83
116
  status_code = http_response.status
84
117
  response_content = http_response.body
85
- unless (status_code == 200)
118
+ unless status_code == 200
86
119
  error_model = JSON.load(response_content)
87
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
120
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
88
121
  end
89
122
 
90
123
  # Create Result
91
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
124
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
92
125
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
93
126
  # Deserialize Response
94
127
  if status_code == 200
95
128
  begin
96
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
129
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
97
130
  unless parsed_response.nil?
98
131
  parsed_response = ListUsagesResult.deserialize_object(parsed_response)
99
132
  end
100
133
  result.body = parsed_response
101
134
  rescue Exception => e
102
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
135
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
103
136
  end
104
137
  end
105
138
 
@@ -1,6 +1,8 @@
1
- # Copyright (c) Microsoft Corporation. All rights reserved.
2
- # Licensed under the MIT License. See License.txt in the project root for license information.
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
3
5
 
4
6
  module Azure::ARM::Compute
5
- VERSION = '0.1.2'
7
+ VERSION = '0.2.0'
6
8
  end