azure_mgmt_compute 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +3 -0
- data/.travis.yml +3 -0
- data/Gemfile +17 -0
- data/LICENSE.txt +21 -0
- data/README.md +139 -0
- data/Rakefile +5 -0
- data/azure_mgmt_compute.gemspec +39 -0
- data/lib/azure_mgmt_compute.rb +103 -0
- data/lib/azure_mgmt_compute/Models/additional_unattend_content.rb +108 -0
- data/lib/azure_mgmt_compute/Models/api_error.rb +121 -0
- data/lib/azure_mgmt_compute/Models/api_error_base.rb +76 -0
- data/lib/azure_mgmt_compute/Models/availability_set.rb +94 -0
- data/lib/azure_mgmt_compute/Models/availability_set_list_result.rb +79 -0
- data/lib/azure_mgmt_compute/Models/availability_set_properties.rb +130 -0
- data/lib/azure_mgmt_compute/Models/caching_types.rb +17 -0
- data/lib/azure_mgmt_compute/Models/component_names.rb +15 -0
- data/lib/azure_mgmt_compute/Models/compute_long_running_operation_properties.rb +58 -0
- data/lib/azure_mgmt_compute/Models/compute_long_running_operation_result.rb +126 -0
- data/lib/azure_mgmt_compute/Models/compute_operation_status.rb +18 -0
- data/lib/azure_mgmt_compute/Models/data_disk.rb +142 -0
- data/lib/azure_mgmt_compute/Models/data_disk_image.rb +62 -0
- data/lib/azure_mgmt_compute/Models/delete_operation_result.rb +109 -0
- data/lib/azure_mgmt_compute/Models/disk_create_option_types.rb +17 -0
- data/lib/azure_mgmt_compute/Models/disk_instance_view.rb +88 -0
- data/lib/azure_mgmt_compute/Models/hardware_profile.rb +67 -0
- data/lib/azure_mgmt_compute/Models/image_reference.rb +87 -0
- data/lib/azure_mgmt_compute/Models/inner_error.rb +68 -0
- data/lib/azure_mgmt_compute/Models/instance_view_status.rb +102 -0
- data/lib/azure_mgmt_compute/Models/linux_configuration.rb +75 -0
- data/lib/azure_mgmt_compute/Models/list_usages_result.rb +78 -0
- data/lib/azure_mgmt_compute/Models/network_interface_reference.rb +70 -0
- data/lib/azure_mgmt_compute/Models/network_interface_reference_properties.rb +59 -0
- data/lib/azure_mgmt_compute/Models/network_profile.rb +79 -0
- data/lib/azure_mgmt_compute/Models/operating_system_types.rb +16 -0
- data/lib/azure_mgmt_compute/Models/operation_status.rb +17 -0
- data/lib/azure_mgmt_compute/Models/osdisk.rb +135 -0
- data/lib/azure_mgmt_compute/Models/osdisk_image.rb +63 -0
- data/lib/azure_mgmt_compute/Models/osprofile.rb +149 -0
- data/lib/azure_mgmt_compute/Models/pass_names.rb +15 -0
- data/lib/azure_mgmt_compute/Models/plan.rb +85 -0
- data/lib/azure_mgmt_compute/Models/protocol_types.rb +16 -0
- data/lib/azure_mgmt_compute/Models/purchase_plan.rb +77 -0
- data/lib/azure_mgmt_compute/Models/setting_names.rb +16 -0
- data/lib/azure_mgmt_compute/Models/ssh_configuration.rb +79 -0
- data/lib/azure_mgmt_compute/Models/ssh_public_key.rb +72 -0
- data/lib/azure_mgmt_compute/Models/status_level_types.rb +17 -0
- data/lib/azure_mgmt_compute/Models/storage_profile.rb +110 -0
- data/lib/azure_mgmt_compute/Models/usage.rb +98 -0
- data/lib/azure_mgmt_compute/Models/usage_name.rb +68 -0
- data/lib/azure_mgmt_compute/Models/usage_unit.rb +15 -0
- data/lib/azure_mgmt_compute/Models/vault_certificate.rb +70 -0
- data/lib/azure_mgmt_compute/Models/vault_secret_group.rb +96 -0
- data/lib/azure_mgmt_compute/Models/virtual_hard_disk.rb +59 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine.rb +142 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine_agent_instance_view.rb +119 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine_capture_parameters.rb +78 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine_extension.rb +94 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine_extension_handler_instance_view.rb +85 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine_extension_image.rb +99 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine_extension_image_properties.rb +102 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine_extension_instance_view.rb +139 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine_extension_properties.rb +133 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine_image.rb +99 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine_image_properties.rb +110 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine_image_resource.rb +83 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine_instance_view.rb +188 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine_list_result.rb +89 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine_properties.rb +156 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine_size.rb +111 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine_size_list_result.rb +79 -0
- data/lib/azure_mgmt_compute/Models/virtual_machine_size_types.rb +34 -0
- data/lib/azure_mgmt_compute/Models/win_rmconfiguration.rb +79 -0
- data/lib/azure_mgmt_compute/Models/win_rmlistener.rb +73 -0
- data/lib/azure_mgmt_compute/Models/windows_configuration.rb +126 -0
- data/lib/azure_mgmt_compute/availability_sets.rb +473 -0
- data/lib/azure_mgmt_compute/compute_management_client.rb +85 -0
- data/lib/azure_mgmt_compute/module_definition.rb +6 -0
- data/lib/azure_mgmt_compute/usage_operations.rb +113 -0
- data/lib/azure_mgmt_compute/version.rb +6 -0
- data/lib/azure_mgmt_compute/virtual_machine_extension_images.rb +325 -0
- data/lib/azure_mgmt_compute/virtual_machine_extensions.rb +384 -0
- data/lib/azure_mgmt_compute/virtual_machine_images.rb +525 -0
- data/lib/azure_mgmt_compute/virtual_machine_sizes.rb +114 -0
- data/lib/azure_mgmt_compute/virtual_machines.rb +1412 -0
- metadata +303 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.11.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
|
+
# Describes Windows Remote Management configuration of the VM
|
10
|
+
#
|
11
|
+
class WinRMConfiguration
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [Array<WinRMListener>] Gets or sets the list of Windows Remote
|
16
|
+
# Management listeners
|
17
|
+
attr_accessor :listeners
|
18
|
+
|
19
|
+
#
|
20
|
+
# Validate the object. Throws ValidationError if validation fails.
|
21
|
+
#
|
22
|
+
def validate
|
23
|
+
@listeners.each{ |e| e.validate if e.respond_to?(:validate) } unless @listeners.nil?
|
24
|
+
end
|
25
|
+
|
26
|
+
#
|
27
|
+
# Serializes given Model object into Ruby Hash.
|
28
|
+
# @param object Model object to serialize.
|
29
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
30
|
+
#
|
31
|
+
def self.serialize_object(object)
|
32
|
+
object.validate
|
33
|
+
output_object = {}
|
34
|
+
|
35
|
+
serialized_property = object.listeners
|
36
|
+
unless serialized_property.nil?
|
37
|
+
serializedArray = []
|
38
|
+
serialized_property.each do |element|
|
39
|
+
unless element.nil?
|
40
|
+
element = WinRMListener.serialize_object(element)
|
41
|
+
end
|
42
|
+
serializedArray.push(element)
|
43
|
+
end
|
44
|
+
serialized_property = serializedArray
|
45
|
+
end
|
46
|
+
output_object['listeners'] = serialized_property unless serialized_property.nil?
|
47
|
+
|
48
|
+
output_object
|
49
|
+
end
|
50
|
+
|
51
|
+
#
|
52
|
+
# Deserializes given Ruby Hash into Model object.
|
53
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
54
|
+
# @return [WinRMConfiguration] Deserialized object.
|
55
|
+
#
|
56
|
+
def self.deserialize_object(object)
|
57
|
+
return if object.nil?
|
58
|
+
output_object = WinRMConfiguration.new
|
59
|
+
|
60
|
+
deserialized_property = object['listeners']
|
61
|
+
unless deserialized_property.nil?
|
62
|
+
deserializedArray = [];
|
63
|
+
deserialized_property.each do |element1|
|
64
|
+
unless element1.nil?
|
65
|
+
element1 = WinRMListener.deserialize_object(element1)
|
66
|
+
end
|
67
|
+
deserializedArray.push(element1);
|
68
|
+
end
|
69
|
+
deserialized_property = deserializedArray;
|
70
|
+
end
|
71
|
+
output_object.listeners = deserialized_property
|
72
|
+
|
73
|
+
output_object.validate
|
74
|
+
|
75
|
+
output_object
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.11.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
|
+
# Describes Protocol and thumbprint of Windows Remote Management listener
|
10
|
+
#
|
11
|
+
class WinRMListener
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [ProtocolTypes] Gets or sets the Protocol used by WinRM
|
16
|
+
# listener. Currently only Http and Https are supported. Possible
|
17
|
+
# values for this property include: 'Http', 'Https'.
|
18
|
+
attr_accessor :protocol
|
19
|
+
|
20
|
+
# @return [String] Gets or sets the Certificate URL in KMS for Https
|
21
|
+
# listeners. Should be null for Http listeners.
|
22
|
+
attr_accessor :certificate_url
|
23
|
+
|
24
|
+
#
|
25
|
+
# Validate the object. Throws ValidationError if validation fails.
|
26
|
+
#
|
27
|
+
def 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.protocol
|
40
|
+
output_object['protocol'] = serialized_property unless serialized_property.nil?
|
41
|
+
|
42
|
+
serialized_property = object.certificate_url
|
43
|
+
output_object['certificateUrl'] = 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 [WinRMListener] Deserialized object.
|
52
|
+
#
|
53
|
+
def self.deserialize_object(object)
|
54
|
+
return if object.nil?
|
55
|
+
output_object = WinRMListener.new
|
56
|
+
|
57
|
+
deserialized_property = object['protocol']
|
58
|
+
if (!deserialized_property.nil? && !deserialized_property.empty?)
|
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
|
61
|
+
end
|
62
|
+
output_object.protocol = deserialized_property
|
63
|
+
|
64
|
+
deserialized_property = object['certificateUrl']
|
65
|
+
output_object.certificate_url = deserialized_property
|
66
|
+
|
67
|
+
output_object.validate
|
68
|
+
|
69
|
+
output_object
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.11.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
|
+
# Describes Windows Configuration of the OS Profile.
|
10
|
+
#
|
11
|
+
class WindowsConfiguration
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [Boolean] Gets or sets whether VM Agent should be provisioned
|
16
|
+
# on the Virtual Machine.
|
17
|
+
attr_accessor :provision_vmagent
|
18
|
+
|
19
|
+
# @return [Boolean] Gets or sets whether Windows updates are
|
20
|
+
# automatically installed on the VM
|
21
|
+
attr_accessor :enable_automatic_updates
|
22
|
+
|
23
|
+
# @return [String] Gets or sets the Time Zone of the VM
|
24
|
+
attr_accessor :time_zone
|
25
|
+
|
26
|
+
# @return [Array<AdditionalUnattendContent>] Gets or sets the additional
|
27
|
+
# base-64 encoded XML formatted information that can be included in the
|
28
|
+
# Unattend.xml file.
|
29
|
+
attr_accessor :additional_unattend_content
|
30
|
+
|
31
|
+
# @return [WinRMConfiguration] Gets or sets the Windows Remote
|
32
|
+
# Management configuration of the VM
|
33
|
+
attr_accessor :win_rm
|
34
|
+
|
35
|
+
#
|
36
|
+
# Validate the object. Throws ValidationError if validation fails.
|
37
|
+
#
|
38
|
+
def validate
|
39
|
+
@additional_unattend_content.each{ |e| e.validate if e.respond_to?(:validate) } unless @additional_unattend_content.nil?
|
40
|
+
@win_rm.validate unless @win_rm.nil?
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# Serializes given Model object into Ruby Hash.
|
45
|
+
# @param object Model object to serialize.
|
46
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
47
|
+
#
|
48
|
+
def self.serialize_object(object)
|
49
|
+
object.validate
|
50
|
+
output_object = {}
|
51
|
+
|
52
|
+
serialized_property = object.provision_vmagent
|
53
|
+
output_object['provisionVMAgent'] = serialized_property unless serialized_property.nil?
|
54
|
+
|
55
|
+
serialized_property = object.enable_automatic_updates
|
56
|
+
output_object['enableAutomaticUpdates'] = serialized_property unless serialized_property.nil?
|
57
|
+
|
58
|
+
serialized_property = object.time_zone
|
59
|
+
output_object['timeZone'] = serialized_property unless serialized_property.nil?
|
60
|
+
|
61
|
+
serialized_property = object.additional_unattend_content
|
62
|
+
unless serialized_property.nil?
|
63
|
+
serializedArray = []
|
64
|
+
serialized_property.each do |element|
|
65
|
+
unless element.nil?
|
66
|
+
element = AdditionalUnattendContent.serialize_object(element)
|
67
|
+
end
|
68
|
+
serializedArray.push(element)
|
69
|
+
end
|
70
|
+
serialized_property = serializedArray
|
71
|
+
end
|
72
|
+
output_object['additionalUnattendContent'] = serialized_property unless serialized_property.nil?
|
73
|
+
|
74
|
+
serialized_property = object.win_rm
|
75
|
+
unless serialized_property.nil?
|
76
|
+
serialized_property = WinRMConfiguration.serialize_object(serialized_property)
|
77
|
+
end
|
78
|
+
output_object['winRM'] = serialized_property unless serialized_property.nil?
|
79
|
+
|
80
|
+
output_object
|
81
|
+
end
|
82
|
+
|
83
|
+
#
|
84
|
+
# Deserializes given Ruby Hash into Model object.
|
85
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
86
|
+
# @return [WindowsConfiguration] Deserialized object.
|
87
|
+
#
|
88
|
+
def self.deserialize_object(object)
|
89
|
+
return if object.nil?
|
90
|
+
output_object = WindowsConfiguration.new
|
91
|
+
|
92
|
+
deserialized_property = object['provisionVMAgent']
|
93
|
+
output_object.provision_vmagent = deserialized_property
|
94
|
+
|
95
|
+
deserialized_property = object['enableAutomaticUpdates']
|
96
|
+
output_object.enable_automatic_updates = deserialized_property
|
97
|
+
|
98
|
+
deserialized_property = object['timeZone']
|
99
|
+
output_object.time_zone = deserialized_property
|
100
|
+
|
101
|
+
deserialized_property = object['additionalUnattendContent']
|
102
|
+
unless deserialized_property.nil?
|
103
|
+
deserializedArray = [];
|
104
|
+
deserialized_property.each do |element1|
|
105
|
+
unless element1.nil?
|
106
|
+
element1 = AdditionalUnattendContent.deserialize_object(element1)
|
107
|
+
end
|
108
|
+
deserializedArray.push(element1);
|
109
|
+
end
|
110
|
+
deserialized_property = deserializedArray;
|
111
|
+
end
|
112
|
+
output_object.additional_unattend_content = deserialized_property
|
113
|
+
|
114
|
+
deserialized_property = object['winRM']
|
115
|
+
unless deserialized_property.nil?
|
116
|
+
deserialized_property = WinRMConfiguration.deserialize_object(deserialized_property)
|
117
|
+
end
|
118
|
+
output_object.win_rm = deserialized_property
|
119
|
+
|
120
|
+
output_object.validate
|
121
|
+
|
122
|
+
output_object
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -0,0 +1,473 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.11.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
|
+
#
|
8
|
+
# AvailabilitySets
|
9
|
+
#
|
10
|
+
class AvailabilitySets
|
11
|
+
include Azure::ARM::Compute::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the AvailabilitySets class.
|
16
|
+
# @param client service class for accessing basic functionality.
|
17
|
+
#
|
18
|
+
def initialize(client)
|
19
|
+
@client = client
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return reference to the ComputeManagementClient
|
23
|
+
attr_reader :client
|
24
|
+
|
25
|
+
#
|
26
|
+
# The operation to delete the availability set.
|
27
|
+
# @param resource_group_name [String] The name of the resource group.
|
28
|
+
# @param availability_set_name [String] The name of the availability set.
|
29
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
30
|
+
# applied to HTTP request.
|
31
|
+
#
|
32
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
33
|
+
# response.
|
34
|
+
#
|
35
|
+
def delete(resource_group_name, availability_set_name, custom_headers = nil)
|
36
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
37
|
+
fail ArgumentError, 'availability_set_name is nil' if availability_set_name.nil?
|
38
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
39
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
40
|
+
# Construct URL
|
41
|
+
path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"
|
42
|
+
path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
|
43
|
+
path['{availabilitySetName}'] = ERB::Util.url_encode(availability_set_name) if path.include?('{availabilitySetName}')
|
44
|
+
path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
|
45
|
+
url = URI.join(@client.base_url, path)
|
46
|
+
properties = {}
|
47
|
+
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
48
|
+
unless url.query.nil?
|
49
|
+
url.query.split('&').each do |url_item|
|
50
|
+
url_items_parts = url_item.split('=')
|
51
|
+
properties[url_items_parts[0]] = url_items_parts[1]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
properties.reject!{ |key, value| value.nil? }
|
55
|
+
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
56
|
+
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
57
|
+
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
58
|
+
url = URI.parse(corrected_url)
|
59
|
+
|
60
|
+
connection = Faraday.new(:url => url) do |faraday|
|
61
|
+
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
62
|
+
faraday.use :cookie_jar
|
63
|
+
faraday.adapter Faraday.default_adapter
|
64
|
+
end
|
65
|
+
request_headers = Hash.new
|
66
|
+
|
67
|
+
# Set Headers
|
68
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
69
|
+
request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
|
70
|
+
|
71
|
+
unless custom_headers.nil?
|
72
|
+
custom_headers.each do |key, value|
|
73
|
+
request_headers[key] = value
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Send Request
|
78
|
+
promise = Concurrent::Promise.new do
|
79
|
+
connection.delete do |request|
|
80
|
+
request.headers = request_headers
|
81
|
+
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
promise = promise.then do |http_response|
|
86
|
+
status_code = http_response.status
|
87
|
+
response_content = http_response.body
|
88
|
+
unless (status_code == 200 || status_code == 204)
|
89
|
+
fail MsRestAzure::AzureOperationError.new(connection, http_response)
|
90
|
+
end
|
91
|
+
|
92
|
+
# Create Result
|
93
|
+
result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
|
94
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
95
|
+
|
96
|
+
result
|
97
|
+
end
|
98
|
+
|
99
|
+
promise.execute
|
100
|
+
end
|
101
|
+
|
102
|
+
#
|
103
|
+
# The operation to get the availability set.
|
104
|
+
# @param resource_group_name [String] The name of the resource group.
|
105
|
+
# @param availability_set_name [String] The name of the availability set.
|
106
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
107
|
+
# applied to HTTP request.
|
108
|
+
#
|
109
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
110
|
+
# response.
|
111
|
+
#
|
112
|
+
def get(resource_group_name, availability_set_name, custom_headers = nil)
|
113
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
114
|
+
fail ArgumentError, 'availability_set_name is nil' if availability_set_name.nil?
|
115
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
116
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
117
|
+
# Construct URL
|
118
|
+
path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"
|
119
|
+
path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
|
120
|
+
path['{availabilitySetName}'] = ERB::Util.url_encode(availability_set_name) if path.include?('{availabilitySetName}')
|
121
|
+
path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
|
122
|
+
url = URI.join(@client.base_url, path)
|
123
|
+
properties = {}
|
124
|
+
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
125
|
+
unless url.query.nil?
|
126
|
+
url.query.split('&').each do |url_item|
|
127
|
+
url_items_parts = url_item.split('=')
|
128
|
+
properties[url_items_parts[0]] = url_items_parts[1]
|
129
|
+
end
|
130
|
+
end
|
131
|
+
properties.reject!{ |key, value| value.nil? }
|
132
|
+
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
133
|
+
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
134
|
+
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
135
|
+
url = URI.parse(corrected_url)
|
136
|
+
|
137
|
+
connection = Faraday.new(:url => url) do |faraday|
|
138
|
+
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
139
|
+
faraday.use :cookie_jar
|
140
|
+
faraday.adapter Faraday.default_adapter
|
141
|
+
end
|
142
|
+
request_headers = Hash.new
|
143
|
+
|
144
|
+
# Set Headers
|
145
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
146
|
+
request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
|
147
|
+
|
148
|
+
unless custom_headers.nil?
|
149
|
+
custom_headers.each do |key, value|
|
150
|
+
request_headers[key] = value
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
# Send Request
|
155
|
+
promise = Concurrent::Promise.new do
|
156
|
+
connection.get do |request|
|
157
|
+
request.headers = request_headers
|
158
|
+
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
promise = promise.then do |http_response|
|
163
|
+
status_code = http_response.status
|
164
|
+
response_content = http_response.body
|
165
|
+
unless (status_code == 200)
|
166
|
+
error_model = JSON.load(response_content)
|
167
|
+
fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
|
168
|
+
end
|
169
|
+
|
170
|
+
# Create Result
|
171
|
+
result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
|
172
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
173
|
+
# Deserialize Response
|
174
|
+
if status_code == 200
|
175
|
+
begin
|
176
|
+
parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
|
177
|
+
unless parsed_response.nil?
|
178
|
+
parsed_response = AvailabilitySet.deserialize_object(parsed_response)
|
179
|
+
end
|
180
|
+
result.body = parsed_response
|
181
|
+
rescue Exception => e
|
182
|
+
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
result
|
187
|
+
end
|
188
|
+
|
189
|
+
promise.execute
|
190
|
+
end
|
191
|
+
|
192
|
+
#
|
193
|
+
# The operation to list the availability sets.
|
194
|
+
# @param resource_group_name [String] The name of the resource group.
|
195
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
196
|
+
# applied to HTTP request.
|
197
|
+
#
|
198
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
199
|
+
# response.
|
200
|
+
#
|
201
|
+
def list(resource_group_name, custom_headers = nil)
|
202
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
203
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
204
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
205
|
+
# Construct URL
|
206
|
+
path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets"
|
207
|
+
path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
|
208
|
+
path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
|
209
|
+
url = URI.join(@client.base_url, path)
|
210
|
+
properties = {}
|
211
|
+
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
212
|
+
unless url.query.nil?
|
213
|
+
url.query.split('&').each do |url_item|
|
214
|
+
url_items_parts = url_item.split('=')
|
215
|
+
properties[url_items_parts[0]] = url_items_parts[1]
|
216
|
+
end
|
217
|
+
end
|
218
|
+
properties.reject!{ |key, value| value.nil? }
|
219
|
+
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
220
|
+
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
221
|
+
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
222
|
+
url = URI.parse(corrected_url)
|
223
|
+
|
224
|
+
connection = Faraday.new(:url => url) do |faraday|
|
225
|
+
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
226
|
+
faraday.use :cookie_jar
|
227
|
+
faraday.adapter Faraday.default_adapter
|
228
|
+
end
|
229
|
+
request_headers = Hash.new
|
230
|
+
|
231
|
+
# Set Headers
|
232
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
233
|
+
request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
|
234
|
+
|
235
|
+
unless custom_headers.nil?
|
236
|
+
custom_headers.each do |key, value|
|
237
|
+
request_headers[key] = value
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
# Send Request
|
242
|
+
promise = Concurrent::Promise.new do
|
243
|
+
connection.get do |request|
|
244
|
+
request.headers = request_headers
|
245
|
+
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
promise = promise.then do |http_response|
|
250
|
+
status_code = http_response.status
|
251
|
+
response_content = http_response.body
|
252
|
+
unless (status_code == 200)
|
253
|
+
error_model = JSON.load(response_content)
|
254
|
+
fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
|
255
|
+
end
|
256
|
+
|
257
|
+
# Create Result
|
258
|
+
result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
|
259
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
260
|
+
# Deserialize Response
|
261
|
+
if status_code == 200
|
262
|
+
begin
|
263
|
+
parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
|
264
|
+
unless parsed_response.nil?
|
265
|
+
parsed_response = AvailabilitySetListResult.deserialize_object(parsed_response)
|
266
|
+
end
|
267
|
+
result.body = parsed_response
|
268
|
+
rescue Exception => e
|
269
|
+
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
result
|
274
|
+
end
|
275
|
+
|
276
|
+
promise.execute
|
277
|
+
end
|
278
|
+
|
279
|
+
#
|
280
|
+
# Lists virtual-machine-sizes available to be used for an availability set.
|
281
|
+
# @param resource_group_name [String] The name of the resource group.
|
282
|
+
# @param availability_set_name [String] The name of the availability set.
|
283
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
284
|
+
# applied to HTTP request.
|
285
|
+
#
|
286
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
287
|
+
# response.
|
288
|
+
#
|
289
|
+
def list_available_sizes(resource_group_name, availability_set_name, custom_headers = nil)
|
290
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
291
|
+
fail ArgumentError, 'availability_set_name is nil' if availability_set_name.nil?
|
292
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
293
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
294
|
+
# Construct URL
|
295
|
+
path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes"
|
296
|
+
path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
|
297
|
+
path['{availabilitySetName}'] = ERB::Util.url_encode(availability_set_name) if path.include?('{availabilitySetName}')
|
298
|
+
path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
|
299
|
+
url = URI.join(@client.base_url, path)
|
300
|
+
properties = {}
|
301
|
+
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
302
|
+
unless url.query.nil?
|
303
|
+
url.query.split('&').each do |url_item|
|
304
|
+
url_items_parts = url_item.split('=')
|
305
|
+
properties[url_items_parts[0]] = url_items_parts[1]
|
306
|
+
end
|
307
|
+
end
|
308
|
+
properties.reject!{ |key, value| value.nil? }
|
309
|
+
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
310
|
+
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
311
|
+
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
312
|
+
url = URI.parse(corrected_url)
|
313
|
+
|
314
|
+
connection = Faraday.new(:url => url) do |faraday|
|
315
|
+
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
316
|
+
faraday.use :cookie_jar
|
317
|
+
faraday.adapter Faraday.default_adapter
|
318
|
+
end
|
319
|
+
request_headers = Hash.new
|
320
|
+
|
321
|
+
# Set Headers
|
322
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
323
|
+
request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
|
324
|
+
|
325
|
+
unless custom_headers.nil?
|
326
|
+
custom_headers.each do |key, value|
|
327
|
+
request_headers[key] = value
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
# Send Request
|
332
|
+
promise = Concurrent::Promise.new do
|
333
|
+
connection.get do |request|
|
334
|
+
request.headers = request_headers
|
335
|
+
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
promise = promise.then do |http_response|
|
340
|
+
status_code = http_response.status
|
341
|
+
response_content = http_response.body
|
342
|
+
unless (status_code == 200)
|
343
|
+
error_model = JSON.load(response_content)
|
344
|
+
fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
|
345
|
+
end
|
346
|
+
|
347
|
+
# Create Result
|
348
|
+
result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
|
349
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
350
|
+
# Deserialize Response
|
351
|
+
if status_code == 200
|
352
|
+
begin
|
353
|
+
parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
|
354
|
+
unless parsed_response.nil?
|
355
|
+
parsed_response = VirtualMachineSizeListResult.deserialize_object(parsed_response)
|
356
|
+
end
|
357
|
+
result.body = parsed_response
|
358
|
+
rescue Exception => e
|
359
|
+
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
result
|
364
|
+
end
|
365
|
+
|
366
|
+
promise.execute
|
367
|
+
end
|
368
|
+
|
369
|
+
#
|
370
|
+
# The operation to create or update the availability set.
|
371
|
+
# @param resource_group_name [String] The name of the resource group.
|
372
|
+
# @param name [String] Parameters supplied to the Create Availability Set
|
373
|
+
# operation.
|
374
|
+
# @param parameters [AvailabilitySet] Parameters supplied to the Create
|
375
|
+
# Availability Set operation.
|
376
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
377
|
+
# applied to HTTP request.
|
378
|
+
#
|
379
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
380
|
+
# response.
|
381
|
+
#
|
382
|
+
def create_or_update(resource_group_name, name, parameters, custom_headers = nil)
|
383
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
384
|
+
fail ArgumentError, 'name is nil' if name.nil?
|
385
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
386
|
+
parameters.validate unless parameters.nil?
|
387
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
388
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
389
|
+
# Construct URL
|
390
|
+
path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{name}"
|
391
|
+
path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
|
392
|
+
path['{name}'] = ERB::Util.url_encode(name) if path.include?('{name}')
|
393
|
+
path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
|
394
|
+
url = URI.join(@client.base_url, path)
|
395
|
+
properties = {}
|
396
|
+
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
397
|
+
unless url.query.nil?
|
398
|
+
url.query.split('&').each do |url_item|
|
399
|
+
url_items_parts = url_item.split('=')
|
400
|
+
properties[url_items_parts[0]] = url_items_parts[1]
|
401
|
+
end
|
402
|
+
end
|
403
|
+
properties.reject!{ |key, value| value.nil? }
|
404
|
+
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
405
|
+
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
406
|
+
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
407
|
+
url = URI.parse(corrected_url)
|
408
|
+
|
409
|
+
connection = Faraday.new(:url => url) do |faraday|
|
410
|
+
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
411
|
+
faraday.use :cookie_jar
|
412
|
+
faraday.adapter Faraday.default_adapter
|
413
|
+
end
|
414
|
+
request_headers = Hash.new
|
415
|
+
|
416
|
+
# Set Headers
|
417
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
418
|
+
request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
|
419
|
+
|
420
|
+
unless custom_headers.nil?
|
421
|
+
custom_headers.each do |key, value|
|
422
|
+
request_headers[key] = value
|
423
|
+
end
|
424
|
+
end
|
425
|
+
|
426
|
+
# Serialize Request
|
427
|
+
request_headers['Content-Type'] = 'application/json'
|
428
|
+
unless parameters.nil?
|
429
|
+
parameters = AvailabilitySet.serialize_object(parameters)
|
430
|
+
end
|
431
|
+
request_content = JSON.generate(parameters, quirks_mode: true)
|
432
|
+
|
433
|
+
# Send Request
|
434
|
+
promise = Concurrent::Promise.new do
|
435
|
+
connection.put do |request|
|
436
|
+
request.headers = request_headers
|
437
|
+
request.body = request_content
|
438
|
+
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
439
|
+
end
|
440
|
+
end
|
441
|
+
|
442
|
+
promise = promise.then do |http_response|
|
443
|
+
status_code = http_response.status
|
444
|
+
response_content = http_response.body
|
445
|
+
unless (status_code == 200)
|
446
|
+
error_model = JSON.load(response_content)
|
447
|
+
fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
|
448
|
+
end
|
449
|
+
|
450
|
+
# Create Result
|
451
|
+
result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
|
452
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
453
|
+
# Deserialize Response
|
454
|
+
if status_code == 200
|
455
|
+
begin
|
456
|
+
parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
|
457
|
+
unless parsed_response.nil?
|
458
|
+
parsed_response = AvailabilitySet.deserialize_object(parsed_response)
|
459
|
+
end
|
460
|
+
result.body = parsed_response
|
461
|
+
rescue Exception => e
|
462
|
+
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
|
463
|
+
end
|
464
|
+
end
|
465
|
+
|
466
|
+
result
|
467
|
+
end
|
468
|
+
|
469
|
+
promise.execute
|
470
|
+
end
|
471
|
+
|
472
|
+
end
|
473
|
+
end
|