azure_mgmt_network 0.1.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.
Files changed (123) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +3 -0
  5. data/Gemfile +15 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +131 -0
  8. data/Rakefile +5 -0
  9. data/azure_mgmt_network.gemspec +39 -0
  10. data/lib/azure_mgmt_network.rb +139 -0
  11. data/lib/azure_mgmt_network/Models/address_space.rb +60 -0
  12. data/lib/azure_mgmt_network/Models/application_gateway.rb +104 -0
  13. data/lib/azure_mgmt_network/Models/application_gateway_backend_address.rb +67 -0
  14. data/lib/azure_mgmt_network/Models/application_gateway_backend_address_pool.rb +90 -0
  15. data/lib/azure_mgmt_network/Models/application_gateway_backend_address_pool_properties_format.rb +121 -0
  16. data/lib/azure_mgmt_network/Models/application_gateway_backend_http_settings.rb +90 -0
  17. data/lib/azure_mgmt_network/Models/application_gateway_backend_http_settings_properties_format.rb +98 -0
  18. data/lib/azure_mgmt_network/Models/application_gateway_cookie_based_affinity.rb +16 -0
  19. data/lib/azure_mgmt_network/Models/application_gateway_frontend_ip_configuration.rb +91 -0
  20. data/lib/azure_mgmt_network/Models/application_gateway_frontend_ip_configuration_properties_format.rb +117 -0
  21. data/lib/azure_mgmt_network/Models/application_gateway_frontend_port.rb +90 -0
  22. data/lib/azure_mgmt_network/Models/application_gateway_frontend_port_properties_format.rb +70 -0
  23. data/lib/azure_mgmt_network/Models/application_gateway_http_listener.rb +90 -0
  24. data/lib/azure_mgmt_network/Models/application_gateway_http_listener_properties_format.rb +124 -0
  25. data/lib/azure_mgmt_network/Models/application_gateway_ip_configuration.rb +90 -0
  26. data/lib/azure_mgmt_network/Models/application_gateway_ip_configuration_properties_format.rb +77 -0
  27. data/lib/azure_mgmt_network/Models/application_gateway_list_result.rb +88 -0
  28. data/lib/azure_mgmt_network/Models/application_gateway_operational_state.rb +18 -0
  29. data/lib/azure_mgmt_network/Models/application_gateway_properties_format.rb +338 -0
  30. data/lib/azure_mgmt_network/Models/application_gateway_protocol.rb +16 -0
  31. data/lib/azure_mgmt_network/Models/application_gateway_request_routing_rule.rb +90 -0
  32. data/lib/azure_mgmt_network/Models/application_gateway_request_routing_rule_properties_format.rb +124 -0
  33. data/lib/azure_mgmt_network/Models/application_gateway_request_routing_rule_type.rb +15 -0
  34. data/lib/azure_mgmt_network/Models/application_gateway_sku.rb +88 -0
  35. data/lib/azure_mgmt_network/Models/application_gateway_sku_name.rb +17 -0
  36. data/lib/azure_mgmt_network/Models/application_gateway_ssl_certificate.rb +90 -0
  37. data/lib/azure_mgmt_network/Models/application_gateway_ssl_certificate_properties_format.rb +87 -0
  38. data/lib/azure_mgmt_network/Models/application_gateway_tier.rb +15 -0
  39. data/lib/azure_mgmt_network/Models/azure_async_operation_result.rb +85 -0
  40. data/lib/azure_mgmt_network/Models/backend_address_pool.rb +90 -0
  41. data/lib/azure_mgmt_network/Models/backend_address_pool_properties_format.rb +120 -0
  42. data/lib/azure_mgmt_network/Models/connection_reset_shared_key.rb +64 -0
  43. data/lib/azure_mgmt_network/Models/connection_reset_shared_key_properties_format.rb +60 -0
  44. data/lib/azure_mgmt_network/Models/connection_shared_key.rb +58 -0
  45. data/lib/azure_mgmt_network/Models/dhcp_options.rb +60 -0
  46. data/lib/azure_mgmt_network/Models/dns_name_availability_result.rb +58 -0
  47. data/lib/azure_mgmt_network/Models/error.rb +114 -0
  48. data/lib/azure_mgmt_network/Models/error_details.rb +76 -0
  49. data/lib/azure_mgmt_network/Models/frontend_ip_configuration.rb +90 -0
  50. data/lib/azure_mgmt_network/Models/frontend_ip_configuration_properties_format.rb +181 -0
  51. data/lib/azure_mgmt_network/Models/inbound_nat_rule.rb +90 -0
  52. data/lib/azure_mgmt_network/Models/inbound_nat_rule_properties_format.rb +163 -0
  53. data/lib/azure_mgmt_network/Models/ip_allocation_method.rb +16 -0
  54. data/lib/azure_mgmt_network/Models/load_balancer.rb +104 -0
  55. data/lib/azure_mgmt_network/Models/load_balancer_list_result.rb +88 -0
  56. data/lib/azure_mgmt_network/Models/load_balancer_properties_format.rb +210 -0
  57. data/lib/azure_mgmt_network/Models/load_balancing_rule.rb +90 -0
  58. data/lib/azure_mgmt_network/Models/load_balancing_rule_properties_format.rb +195 -0
  59. data/lib/azure_mgmt_network/Models/load_distribution.rb +17 -0
  60. data/lib/azure_mgmt_network/Models/local_network_gateway.rb +104 -0
  61. data/lib/azure_mgmt_network/Models/local_network_gateway_list_result.rb +88 -0
  62. data/lib/azure_mgmt_network/Models/local_network_gateway_properties_format.rb +83 -0
  63. data/lib/azure_mgmt_network/Models/network_interface.rb +104 -0
  64. data/lib/azure_mgmt_network/Models/network_interface_dns_settings.rb +89 -0
  65. data/lib/azure_mgmt_network/Models/network_interface_ip_configuration.rb +90 -0
  66. data/lib/azure_mgmt_network/Models/network_interface_ip_configuration_properties_format.rb +179 -0
  67. data/lib/azure_mgmt_network/Models/network_interface_list_result.rb +88 -0
  68. data/lib/azure_mgmt_network/Models/network_interface_properties_format.rb +158 -0
  69. data/lib/azure_mgmt_network/Models/network_security_group.rb +104 -0
  70. data/lib/azure_mgmt_network/Models/network_security_group_list_result.rb +88 -0
  71. data/lib/azure_mgmt_network/Models/network_security_group_properties_format.rb +181 -0
  72. data/lib/azure_mgmt_network/Models/operation_status.rb +17 -0
  73. data/lib/azure_mgmt_network/Models/probe.rb +90 -0
  74. data/lib/azure_mgmt_network/Models/probe_properties_format.rb +157 -0
  75. data/lib/azure_mgmt_network/Models/probe_protocol.rb +16 -0
  76. data/lib/azure_mgmt_network/Models/public_ip_address.rb +104 -0
  77. data/lib/azure_mgmt_network/Models/public_ip_address_dns_settings.rb +85 -0
  78. data/lib/azure_mgmt_network/Models/public_ip_address_list_result.rb +88 -0
  79. data/lib/azure_mgmt_network/Models/public_ip_address_properties_format.rb +126 -0
  80. data/lib/azure_mgmt_network/Models/security_rule.rb +90 -0
  81. data/lib/azure_mgmt_network/Models/security_rule_access.rb +16 -0
  82. data/lib/azure_mgmt_network/Models/security_rule_direction.rb +16 -0
  83. data/lib/azure_mgmt_network/Models/security_rule_list_result.rb +89 -0
  84. data/lib/azure_mgmt_network/Models/security_rule_properties_format.rb +174 -0
  85. data/lib/azure_mgmt_network/Models/security_rule_protocol.rb +17 -0
  86. data/lib/azure_mgmt_network/Models/subnet.rb +90 -0
  87. data/lib/azure_mgmt_network/Models/subnet_list_result.rb +88 -0
  88. data/lib/azure_mgmt_network/Models/subnet_properties_format.rb +115 -0
  89. data/lib/azure_mgmt_network/Models/transport_protocol.rb +16 -0
  90. data/lib/azure_mgmt_network/Models/usage.rb +98 -0
  91. data/lib/azure_mgmt_network/Models/usage_name.rb +68 -0
  92. data/lib/azure_mgmt_network/Models/usage_unit.rb +15 -0
  93. data/lib/azure_mgmt_network/Models/usages_list_result.rb +78 -0
  94. data/lib/azure_mgmt_network/Models/virtual_network.rb +104 -0
  95. data/lib/azure_mgmt_network/Models/virtual_network_gateway.rb +104 -0
  96. data/lib/azure_mgmt_network/Models/virtual_network_gateway_connection.rb +104 -0
  97. data/lib/azure_mgmt_network/Models/virtual_network_gateway_connection_list_result.rb +89 -0
  98. data/lib/azure_mgmt_network/Models/virtual_network_gateway_connection_properties_format.rb +141 -0
  99. data/lib/azure_mgmt_network/Models/virtual_network_gateway_connection_type.rb +18 -0
  100. data/lib/azure_mgmt_network/Models/virtual_network_gateway_ip_configuration.rb +90 -0
  101. data/lib/azure_mgmt_network/Models/virtual_network_gateway_ip_configuration_properties_format.rb +117 -0
  102. data/lib/azure_mgmt_network/Models/virtual_network_gateway_list_result.rb +88 -0
  103. data/lib/azure_mgmt_network/Models/virtual_network_gateway_properties_format.rb +126 -0
  104. data/lib/azure_mgmt_network/Models/virtual_network_gateway_type.rb +15 -0
  105. data/lib/azure_mgmt_network/Models/virtual_network_list_result.rb +88 -0
  106. data/lib/azure_mgmt_network/Models/virtual_network_properties_format.rb +123 -0
  107. data/lib/azure_mgmt_network/Models/vpn_type.rb +16 -0
  108. data/lib/azure_mgmt_network/application_gateways.rb +915 -0
  109. data/lib/azure_mgmt_network/load_balancers.rb +709 -0
  110. data/lib/azure_mgmt_network/local_network_gateways.rb +550 -0
  111. data/lib/azure_mgmt_network/module_definition.rb +6 -0
  112. data/lib/azure_mgmt_network/network_interfaces.rb +709 -0
  113. data/lib/azure_mgmt_network/network_resource_provider_client.rb +195 -0
  114. data/lib/azure_mgmt_network/network_security_groups.rb +718 -0
  115. data/lib/azure_mgmt_network/public_ip_addresses.rb +711 -0
  116. data/lib/azure_mgmt_network/security_rules.rb +563 -0
  117. data/lib/azure_mgmt_network/subnets.rb +552 -0
  118. data/lib/azure_mgmt_network/usages.rb +113 -0
  119. data/lib/azure_mgmt_network/version.rb +6 -0
  120. data/lib/azure_mgmt_network/virtual_network_gateway_connections.rb +945 -0
  121. data/lib/azure_mgmt_network/virtual_network_gateways.rb +686 -0
  122. data/lib/azure_mgmt_network/virtual_networks.rb +707 -0
  123. metadata +311 -0
@@ -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::Network
7
+ module Models
8
+ #
9
+ # VirtualNeworkGateay properties
10
+ #
11
+ class VirtualNetworkGatewayPropertiesFormat
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Array<VirtualNetworkGatewayIpConfiguration>] IpConfigurations
16
+ # for Virtual network gateway.
17
+ attr_accessor :ip_configurations
18
+
19
+ # @return [VirtualNetworkGatewayType] The type of this virtual network
20
+ # gateway. Possible values for this property include: 'Vpn'.
21
+ attr_accessor :gateway_type
22
+
23
+ # @return [VpnType] The type of this virtual network gateway. Possible
24
+ # values for this property include: 'PolicyBased', 'RouteBased'.
25
+ attr_accessor :vpn_type
26
+
27
+ # @return [Boolean] EnableBgp Flag
28
+ attr_accessor :enable_bgp
29
+
30
+ # @return [String] Gets or sets Provisioning state of the
31
+ # VirtualNetworkGateway resource Updating/Deleting/Failed
32
+ attr_accessor :provisioning_state
33
+
34
+ #
35
+ # Validate the object. Throws ValidationError if validation fails.
36
+ #
37
+ def validate
38
+ @ip_configurations.each{ |e| e.validate if e.respond_to?(:validate) } unless @ip_configurations.nil?
39
+ end
40
+
41
+ #
42
+ # Serializes given Model object into Ruby Hash.
43
+ # @param object Model object to serialize.
44
+ # @return [Hash] Serialized object in form of Ruby Hash.
45
+ #
46
+ def self.serialize_object(object)
47
+ object.validate
48
+ output_object = {}
49
+
50
+ serialized_property = object.ip_configurations
51
+ unless serialized_property.nil?
52
+ serializedArray = []
53
+ serialized_property.each do |element|
54
+ unless element.nil?
55
+ element = VirtualNetworkGatewayIpConfiguration.serialize_object(element)
56
+ end
57
+ serializedArray.push(element)
58
+ end
59
+ serialized_property = serializedArray
60
+ end
61
+ output_object['ipConfigurations'] = serialized_property unless serialized_property.nil?
62
+
63
+ serialized_property = object.gateway_type
64
+ output_object['gatewayType'] = serialized_property unless serialized_property.nil?
65
+
66
+ serialized_property = object.vpn_type
67
+ output_object['vpnType'] = serialized_property unless serialized_property.nil?
68
+
69
+ serialized_property = object.enable_bgp
70
+ output_object['enableBgp'] = serialized_property unless serialized_property.nil?
71
+
72
+ serialized_property = object.provisioning_state
73
+ output_object['provisioningState'] = serialized_property unless serialized_property.nil?
74
+
75
+ output_object
76
+ end
77
+
78
+ #
79
+ # Deserializes given Ruby Hash into Model object.
80
+ # @param object [Hash] Ruby Hash object to deserialize.
81
+ # @return [VirtualNetworkGatewayPropertiesFormat] Deserialized object.
82
+ #
83
+ def self.deserialize_object(object)
84
+ return if object.nil?
85
+ output_object = VirtualNetworkGatewayPropertiesFormat.new
86
+
87
+ deserialized_property = object['ipConfigurations']
88
+ unless deserialized_property.nil?
89
+ deserializedArray = [];
90
+ deserialized_property.each do |element1|
91
+ unless element1.nil?
92
+ element1 = VirtualNetworkGatewayIpConfiguration.deserialize_object(element1)
93
+ end
94
+ deserializedArray.push(element1);
95
+ end
96
+ deserialized_property = deserializedArray;
97
+ end
98
+ output_object.ip_configurations = deserialized_property
99
+
100
+ deserialized_property = object['gatewayType']
101
+ if (!deserialized_property.nil? && !deserialized_property.empty?)
102
+ enum_is_valid = VirtualNetworkGatewayType.constants.any? { |e| VirtualNetworkGatewayType.const_get(e).to_s.downcase == deserialized_property.downcase }
103
+ fail MsRest::DeserializationError.new('Error occured while deserializing the enum', nil, nil, nil) unless enum_is_valid
104
+ end
105
+ output_object.gateway_type = deserialized_property
106
+
107
+ deserialized_property = object['vpnType']
108
+ if (!deserialized_property.nil? && !deserialized_property.empty?)
109
+ enum_is_valid = VpnType.constants.any? { |e| VpnType.const_get(e).to_s.downcase == deserialized_property.downcase }
110
+ fail MsRest::DeserializationError.new('Error occured while deserializing the enum', nil, nil, nil) unless enum_is_valid
111
+ end
112
+ output_object.vpn_type = deserialized_property
113
+
114
+ deserialized_property = object['enableBgp']
115
+ output_object.enable_bgp = deserialized_property
116
+
117
+ deserialized_property = object['provisioningState']
118
+ output_object.provisioning_state = deserialized_property
119
+
120
+ output_object.validate
121
+
122
+ output_object
123
+ end
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,15 @@
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::Network
7
+ module Models
8
+ #
9
+ # Defines values for VirtualNetworkGatewayType
10
+ #
11
+ module VirtualNetworkGatewayType
12
+ Vpn = "Vpn"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,88 @@
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::Network
7
+ module Models
8
+ #
9
+ # Response for ListVirtualNetworks Api servive call
10
+ #
11
+ class VirtualNetworkListResult
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Array<VirtualNetwork>] Gets list of VirtualNetworks in a
16
+ # resource group
17
+ attr_accessor :value
18
+
19
+ # @return [String] Gets the URL to get the next set of results.
20
+ attr_accessor :next_link
21
+
22
+ #
23
+ # Validate the object. Throws ValidationError if validation fails.
24
+ #
25
+ def validate
26
+ @value.each{ |e| e.validate if e.respond_to?(:validate) } unless @value.nil?
27
+ end
28
+
29
+ #
30
+ # Serializes given Model object into Ruby Hash.
31
+ # @param object Model object to serialize.
32
+ # @return [Hash] Serialized object in form of Ruby Hash.
33
+ #
34
+ def self.serialize_object(object)
35
+ object.validate
36
+ output_object = {}
37
+
38
+ serialized_property = object.value
39
+ unless serialized_property.nil?
40
+ serializedArray = []
41
+ serialized_property.each do |element|
42
+ unless element.nil?
43
+ element = VirtualNetwork.serialize_object(element)
44
+ end
45
+ serializedArray.push(element)
46
+ end
47
+ serialized_property = serializedArray
48
+ end
49
+ output_object['value'] = serialized_property unless serialized_property.nil?
50
+
51
+ serialized_property = object.next_link
52
+ output_object['nextLink'] = serialized_property unless serialized_property.nil?
53
+
54
+ output_object
55
+ end
56
+
57
+ #
58
+ # Deserializes given Ruby Hash into Model object.
59
+ # @param object [Hash] Ruby Hash object to deserialize.
60
+ # @return [VirtualNetworkListResult] Deserialized object.
61
+ #
62
+ def self.deserialize_object(object)
63
+ return if object.nil?
64
+ output_object = VirtualNetworkListResult.new
65
+
66
+ deserialized_property = object['value']
67
+ unless deserialized_property.nil?
68
+ deserializedArray = [];
69
+ deserialized_property.each do |element1|
70
+ unless element1.nil?
71
+ element1 = VirtualNetwork.deserialize_object(element1)
72
+ end
73
+ deserializedArray.push(element1);
74
+ end
75
+ deserialized_property = deserializedArray;
76
+ end
77
+ output_object.value = deserialized_property
78
+
79
+ deserialized_property = object['nextLink']
80
+ output_object.next_link = deserialized_property
81
+
82
+ output_object.validate
83
+
84
+ output_object
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,123 @@
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::Network
7
+ module Models
8
+ #
9
+ # Model object.
10
+ #
11
+ class VirtualNetworkPropertiesFormat
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [AddressSpace] Gets or sets AddressSpace that contains an
16
+ # array of IP address ranges that can be used by subnets
17
+ attr_accessor :address_space
18
+
19
+ # @return [DhcpOptions] Gets or sets DHCPOptions that contains an array
20
+ # of DNS servers available to VMs deployed in the virtual network
21
+ attr_accessor :dhcp_options
22
+
23
+ # @return [Array<Subnet>] Gets or sets List of subnets in a
24
+ # VirtualNetwork
25
+ attr_accessor :subnets
26
+
27
+ # @return [String] Gets or sets Provisioning state of the PublicIP
28
+ # resource Updating/Deleting/Failed
29
+ attr_accessor :provisioning_state
30
+
31
+ #
32
+ # Validate the object. Throws ValidationError if validation fails.
33
+ #
34
+ def validate
35
+ @address_space.validate unless @address_space.nil?
36
+ @dhcp_options.validate unless @dhcp_options.nil?
37
+ @subnets.each{ |e| e.validate if e.respond_to?(:validate) } unless @subnets.nil?
38
+ end
39
+
40
+ #
41
+ # Serializes given Model object into Ruby Hash.
42
+ # @param object Model object to serialize.
43
+ # @return [Hash] Serialized object in form of Ruby Hash.
44
+ #
45
+ def self.serialize_object(object)
46
+ object.validate
47
+ output_object = {}
48
+
49
+ serialized_property = object.address_space
50
+ unless serialized_property.nil?
51
+ serialized_property = AddressSpace.serialize_object(serialized_property)
52
+ end
53
+ output_object['addressSpace'] = serialized_property unless serialized_property.nil?
54
+
55
+ serialized_property = object.dhcp_options
56
+ unless serialized_property.nil?
57
+ serialized_property = DhcpOptions.serialize_object(serialized_property)
58
+ end
59
+ output_object['dhcpOptions'] = serialized_property unless serialized_property.nil?
60
+
61
+ serialized_property = object.subnets
62
+ unless serialized_property.nil?
63
+ serializedArray = []
64
+ serialized_property.each do |element|
65
+ unless element.nil?
66
+ element = Subnet.serialize_object(element)
67
+ end
68
+ serializedArray.push(element)
69
+ end
70
+ serialized_property = serializedArray
71
+ end
72
+ output_object['subnets'] = serialized_property unless serialized_property.nil?
73
+
74
+ serialized_property = object.provisioning_state
75
+ output_object['provisioningState'] = serialized_property unless serialized_property.nil?
76
+
77
+ output_object
78
+ end
79
+
80
+ #
81
+ # Deserializes given Ruby Hash into Model object.
82
+ # @param object [Hash] Ruby Hash object to deserialize.
83
+ # @return [VirtualNetworkPropertiesFormat] Deserialized object.
84
+ #
85
+ def self.deserialize_object(object)
86
+ return if object.nil?
87
+ output_object = VirtualNetworkPropertiesFormat.new
88
+
89
+ deserialized_property = object['addressSpace']
90
+ unless deserialized_property.nil?
91
+ deserialized_property = AddressSpace.deserialize_object(deserialized_property)
92
+ end
93
+ output_object.address_space = deserialized_property
94
+
95
+ deserialized_property = object['dhcpOptions']
96
+ unless deserialized_property.nil?
97
+ deserialized_property = DhcpOptions.deserialize_object(deserialized_property)
98
+ end
99
+ output_object.dhcp_options = deserialized_property
100
+
101
+ deserialized_property = object['subnets']
102
+ unless deserialized_property.nil?
103
+ deserializedArray = [];
104
+ deserialized_property.each do |element1|
105
+ unless element1.nil?
106
+ element1 = Subnet.deserialize_object(element1)
107
+ end
108
+ deserializedArray.push(element1);
109
+ end
110
+ deserialized_property = deserializedArray;
111
+ end
112
+ output_object.subnets = deserialized_property
113
+
114
+ deserialized_property = object['provisioningState']
115
+ output_object.provisioning_state = deserialized_property
116
+
117
+ output_object.validate
118
+
119
+ output_object
120
+ end
121
+ end
122
+ end
123
+ end
@@ -0,0 +1,16 @@
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::Network
7
+ module Models
8
+ #
9
+ # Defines values for VpnType
10
+ #
11
+ module VpnType
12
+ PolicyBased = "PolicyBased"
13
+ RouteBased = "RouteBased"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,915 @@
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::Network
7
+ #
8
+ # ApplicationGateways
9
+ #
10
+ class ApplicationGateways
11
+ include Azure::ARM::Network::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the ApplicationGateways 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 NetworkResourceProviderClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # The delete applicationgateway operation deletes the specified
27
+ # applicationgateway.
28
+ # @param resource_group_name [String] The name of the resource group.
29
+ # @param application_gateway_name [String] The name of the applicationgateway.
30
+ # @return [Concurrent::Promise] promise which provides async access to http
31
+ # response.
32
+ #
33
+ def delete(resource_group_name, application_gateway_name, custom_headers = nil)
34
+ # Send request
35
+ promise = begin_delete(resource_group_name, application_gateway_name, custom_headers)
36
+
37
+ promise = promise.then do |response|
38
+ # Defining deserialization method.
39
+ deserialize_method = lambda do |parsed_response|
40
+ end
41
+
42
+ # Waiting for response.
43
+ @client.get_post_or_delete_operation_result(response, nil, deserialize_method)
44
+ end
45
+
46
+ promise
47
+ end
48
+
49
+ #
50
+ # The delete applicationgateway operation deletes the specified
51
+ # applicationgateway.
52
+ # @param resource_group_name [String] The name of the resource group.
53
+ # @param application_gateway_name [String] The name of the applicationgateway.
54
+ # @param [Hash{String => String}] The hash of custom headers need to be
55
+ # applied to HTTP request.
56
+ #
57
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
58
+ # response.
59
+ #
60
+ def begin_delete(resource_group_name, application_gateway_name, custom_headers = nil)
61
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
62
+ fail ArgumentError, 'application_gateway_name is nil' if application_gateway_name.nil?
63
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
64
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
65
+ # Construct URL
66
+ path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}"
67
+ path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
68
+ path['{applicationGatewayName}'] = ERB::Util.url_encode(application_gateway_name) if path.include?('{applicationGatewayName}')
69
+ path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
70
+ url = URI.join(@client.base_url, path)
71
+ properties = {}
72
+ properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
73
+ unless url.query.nil?
74
+ url.query.split('&').each do |url_item|
75
+ url_items_parts = url_item.split('=')
76
+ properties[url_items_parts[0]] = url_items_parts[1]
77
+ end
78
+ end
79
+ properties.reject!{ |key, value| value.nil? }
80
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
81
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
82
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
83
+ url = URI.parse(corrected_url)
84
+
85
+ connection = Faraday.new(:url => url) do |faraday|
86
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
87
+ faraday.use :cookie_jar
88
+ faraday.adapter Faraday.default_adapter
89
+ end
90
+ request_headers = Hash.new
91
+
92
+ # Set Headers
93
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
94
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
95
+
96
+ unless custom_headers.nil?
97
+ custom_headers.each do |key, value|
98
+ request_headers[key] = value
99
+ end
100
+ end
101
+
102
+ # Send Request
103
+ promise = Concurrent::Promise.new do
104
+ connection.delete do |request|
105
+ request.headers = request_headers
106
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
107
+ end
108
+ end
109
+
110
+ promise = promise.then do |http_response|
111
+ status_code = http_response.status
112
+ response_content = http_response.body
113
+ unless (status_code == 204 || status_code == 202 || status_code == 200)
114
+ fail MsRestAzure::AzureOperationError.new(connection, http_response)
115
+ end
116
+
117
+ # Create Result
118
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
119
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
120
+
121
+ result
122
+ end
123
+
124
+ promise.execute
125
+ end
126
+
127
+ #
128
+ # The Get applicationgateway operation retreives information about the
129
+ # specified applicationgateway.
130
+ # @param resource_group_name [String] The name of the resource group.
131
+ # @param application_gateway_name [String] The name of the applicationgateway.
132
+ # @param [Hash{String => String}] The hash of custom headers need to be
133
+ # applied to HTTP request.
134
+ #
135
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
136
+ # response.
137
+ #
138
+ def get(resource_group_name, application_gateway_name, custom_headers = nil)
139
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
140
+ fail ArgumentError, 'application_gateway_name is nil' if application_gateway_name.nil?
141
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
142
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
143
+ # Construct URL
144
+ path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}"
145
+ path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
146
+ path['{applicationGatewayName}'] = ERB::Util.url_encode(application_gateway_name) if path.include?('{applicationGatewayName}')
147
+ path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
148
+ url = URI.join(@client.base_url, path)
149
+ properties = {}
150
+ properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
151
+ unless url.query.nil?
152
+ url.query.split('&').each do |url_item|
153
+ url_items_parts = url_item.split('=')
154
+ properties[url_items_parts[0]] = url_items_parts[1]
155
+ end
156
+ end
157
+ properties.reject!{ |key, value| value.nil? }
158
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
159
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
160
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
161
+ url = URI.parse(corrected_url)
162
+
163
+ connection = Faraday.new(:url => url) do |faraday|
164
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
165
+ faraday.use :cookie_jar
166
+ faraday.adapter Faraday.default_adapter
167
+ end
168
+ request_headers = Hash.new
169
+
170
+ # Set Headers
171
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
172
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
173
+
174
+ unless custom_headers.nil?
175
+ custom_headers.each do |key, value|
176
+ request_headers[key] = value
177
+ end
178
+ end
179
+
180
+ # Send Request
181
+ promise = Concurrent::Promise.new do
182
+ connection.get do |request|
183
+ request.headers = request_headers
184
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
185
+ end
186
+ end
187
+
188
+ promise = promise.then do |http_response|
189
+ status_code = http_response.status
190
+ response_content = http_response.body
191
+ unless (status_code == 200)
192
+ error_model = JSON.load(response_content)
193
+ fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
194
+ end
195
+
196
+ # Create Result
197
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
198
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
199
+ # Deserialize Response
200
+ if status_code == 200
201
+ begin
202
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
203
+ unless parsed_response.nil?
204
+ parsed_response = ApplicationGateway.deserialize_object(parsed_response)
205
+ end
206
+ result.body = parsed_response
207
+ rescue Exception => e
208
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
209
+ end
210
+ end
211
+
212
+ result
213
+ end
214
+
215
+ promise.execute
216
+ end
217
+
218
+ #
219
+ # The Put ApplicationGateway operation creates/updates a ApplicationGateway
220
+ # @param resource_group_name [String] The name of the resource group.
221
+ # @param application_gateway_name [String] The name of the ApplicationGateway.
222
+ # @param parameters [ApplicationGateway] Parameters supplied to the
223
+ # create/delete ApplicationGateway operation
224
+ # @param @client.api_version [String] Client Api Version.
225
+ # @param @client.subscription_id [String] Gets subscription credentials which
226
+ # uniquely identify Microsoft Azure subscription. The subscription ID forms
227
+ # part of the URI for every service call.
228
+ # @param @client.accept_language [String] Gets or sets the preferred language
229
+ # for the response.
230
+ #
231
+ # @return [Concurrent::Promise] promise which provides async access to http
232
+ # response.
233
+ #
234
+ def create_or_update(resource_group_name, application_gateway_name, parameters, custom_headers = nil)
235
+ # Send request
236
+ promise = begin_create_or_update(resource_group_name, application_gateway_name, parameters, custom_headers)
237
+
238
+ promise = promise.then do |response|
239
+ # Defining deserialization method.
240
+ deserialize_method = lambda do |parsed_response|
241
+ unless parsed_response.nil?
242
+ parsed_response = ApplicationGateway.deserialize_object(parsed_response)
243
+ end
244
+ end
245
+
246
+ # Waiting for response.
247
+ @client.get_put_operation_result(response, custom_headers, deserialize_method)
248
+ end
249
+
250
+ promise
251
+ end
252
+
253
+ #
254
+ # The Put ApplicationGateway operation creates/updates a ApplicationGateway
255
+ # @param resource_group_name [String] The name of the resource group.
256
+ # @param application_gateway_name [String] The name of the ApplicationGateway.
257
+ # @param parameters [ApplicationGateway] Parameters supplied to the
258
+ # create/delete ApplicationGateway operation
259
+ # @param [Hash{String => String}] The hash of custom headers need to be
260
+ # applied to HTTP request.
261
+ #
262
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
263
+ # response.
264
+ #
265
+ def begin_create_or_update(resource_group_name, application_gateway_name, parameters, custom_headers = nil)
266
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
267
+ fail ArgumentError, 'application_gateway_name is nil' if application_gateway_name.nil?
268
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
269
+ parameters.validate unless parameters.nil?
270
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
271
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
272
+ # Construct URL
273
+ path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}"
274
+ path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
275
+ path['{applicationGatewayName}'] = ERB::Util.url_encode(application_gateway_name) if path.include?('{applicationGatewayName}')
276
+ path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
277
+ url = URI.join(@client.base_url, path)
278
+ properties = {}
279
+ properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
280
+ unless url.query.nil?
281
+ url.query.split('&').each do |url_item|
282
+ url_items_parts = url_item.split('=')
283
+ properties[url_items_parts[0]] = url_items_parts[1]
284
+ end
285
+ end
286
+ properties.reject!{ |key, value| value.nil? }
287
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
288
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
289
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
290
+ url = URI.parse(corrected_url)
291
+
292
+ connection = Faraday.new(:url => url) do |faraday|
293
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
294
+ faraday.use :cookie_jar
295
+ faraday.adapter Faraday.default_adapter
296
+ end
297
+ request_headers = Hash.new
298
+
299
+ # Set Headers
300
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
301
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
302
+
303
+ unless custom_headers.nil?
304
+ custom_headers.each do |key, value|
305
+ request_headers[key] = value
306
+ end
307
+ end
308
+
309
+ # Serialize Request
310
+ request_headers['Content-Type'] = 'application/json'
311
+ unless parameters.nil?
312
+ parameters = ApplicationGateway.serialize_object(parameters)
313
+ end
314
+ request_content = JSON.generate(parameters, quirks_mode: true)
315
+
316
+ # Send Request
317
+ promise = Concurrent::Promise.new do
318
+ connection.put do |request|
319
+ request.headers = request_headers
320
+ request.body = request_content
321
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
322
+ end
323
+ end
324
+
325
+ promise = promise.then do |http_response|
326
+ status_code = http_response.status
327
+ response_content = http_response.body
328
+ unless (status_code == 201 || status_code == 200)
329
+ error_model = JSON.load(response_content)
330
+ fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
331
+ end
332
+
333
+ # Create Result
334
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
335
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
336
+ # Deserialize Response
337
+ if status_code == 201
338
+ begin
339
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
340
+ unless parsed_response.nil?
341
+ parsed_response = ApplicationGateway.deserialize_object(parsed_response)
342
+ end
343
+ result.body = parsed_response
344
+ rescue Exception => e
345
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
346
+ end
347
+ end
348
+ # Deserialize Response
349
+ if status_code == 200
350
+ begin
351
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
352
+ unless parsed_response.nil?
353
+ parsed_response = ApplicationGateway.deserialize_object(parsed_response)
354
+ end
355
+ result.body = parsed_response
356
+ rescue Exception => e
357
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
358
+ end
359
+ end
360
+
361
+ result
362
+ end
363
+
364
+ promise.execute
365
+ end
366
+
367
+ #
368
+ # The List ApplicationGateway opertion retrieves all the applicationgateways
369
+ # in a resource group.
370
+ # @param resource_group_name [String] The name of the resource group.
371
+ # @param [Hash{String => String}] The hash of custom headers need to be
372
+ # applied to HTTP request.
373
+ #
374
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
375
+ # response.
376
+ #
377
+ def list(resource_group_name, custom_headers = nil)
378
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
379
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
380
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
381
+ # Construct URL
382
+ path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways"
383
+ path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
384
+ path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
385
+ url = URI.join(@client.base_url, path)
386
+ properties = {}
387
+ properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
388
+ unless url.query.nil?
389
+ url.query.split('&').each do |url_item|
390
+ url_items_parts = url_item.split('=')
391
+ properties[url_items_parts[0]] = url_items_parts[1]
392
+ end
393
+ end
394
+ properties.reject!{ |key, value| value.nil? }
395
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
396
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
397
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
398
+ url = URI.parse(corrected_url)
399
+
400
+ connection = Faraday.new(:url => url) do |faraday|
401
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
402
+ faraday.use :cookie_jar
403
+ faraday.adapter Faraday.default_adapter
404
+ end
405
+ request_headers = Hash.new
406
+
407
+ # Set Headers
408
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
409
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
410
+
411
+ unless custom_headers.nil?
412
+ custom_headers.each do |key, value|
413
+ request_headers[key] = value
414
+ end
415
+ end
416
+
417
+ # Send Request
418
+ promise = Concurrent::Promise.new do
419
+ connection.get do |request|
420
+ request.headers = request_headers
421
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
422
+ end
423
+ end
424
+
425
+ promise = promise.then do |http_response|
426
+ status_code = http_response.status
427
+ response_content = http_response.body
428
+ unless (status_code == 200)
429
+ error_model = JSON.load(response_content)
430
+ fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
431
+ end
432
+
433
+ # Create Result
434
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
435
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
436
+ # Deserialize Response
437
+ if status_code == 200
438
+ begin
439
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
440
+ unless parsed_response.nil?
441
+ parsed_response = ApplicationGatewayListResult.deserialize_object(parsed_response)
442
+ end
443
+ result.body = parsed_response
444
+ rescue Exception => e
445
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
446
+ end
447
+ end
448
+
449
+ result
450
+ end
451
+
452
+ promise.execute
453
+ end
454
+
455
+ #
456
+ # The List applicationgateway opertion retrieves all the applicationgateways
457
+ # in a subscription.
458
+ # @param [Hash{String => String}] The hash of custom headers need to be
459
+ # applied to HTTP request.
460
+ #
461
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
462
+ # response.
463
+ #
464
+ def list_all(custom_headers = nil)
465
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
466
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
467
+ # Construct URL
468
+ path = "/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways"
469
+ path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
470
+ url = URI.join(@client.base_url, path)
471
+ properties = {}
472
+ properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
473
+ unless url.query.nil?
474
+ url.query.split('&').each do |url_item|
475
+ url_items_parts = url_item.split('=')
476
+ properties[url_items_parts[0]] = url_items_parts[1]
477
+ end
478
+ end
479
+ properties.reject!{ |key, value| value.nil? }
480
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
481
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
482
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
483
+ url = URI.parse(corrected_url)
484
+
485
+ connection = Faraday.new(:url => url) do |faraday|
486
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
487
+ faraday.use :cookie_jar
488
+ faraday.adapter Faraday.default_adapter
489
+ end
490
+ request_headers = Hash.new
491
+
492
+ # Set Headers
493
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
494
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
495
+
496
+ unless custom_headers.nil?
497
+ custom_headers.each do |key, value|
498
+ request_headers[key] = value
499
+ end
500
+ end
501
+
502
+ # Send Request
503
+ promise = Concurrent::Promise.new do
504
+ connection.get do |request|
505
+ request.headers = request_headers
506
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
507
+ end
508
+ end
509
+
510
+ promise = promise.then do |http_response|
511
+ status_code = http_response.status
512
+ response_content = http_response.body
513
+ unless (status_code == 200)
514
+ error_model = JSON.load(response_content)
515
+ fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
516
+ end
517
+
518
+ # Create Result
519
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
520
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
521
+ # Deserialize Response
522
+ if status_code == 200
523
+ begin
524
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
525
+ unless parsed_response.nil?
526
+ parsed_response = ApplicationGatewayListResult.deserialize_object(parsed_response)
527
+ end
528
+ result.body = parsed_response
529
+ rescue Exception => e
530
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
531
+ end
532
+ end
533
+
534
+ result
535
+ end
536
+
537
+ promise.execute
538
+ end
539
+
540
+ #
541
+ # The Start ApplicationGateway operation starts application gatewayin the
542
+ # specified resource group through Network resource provider.
543
+ # @param resource_group_name [String] The name of the resource group.
544
+ # @param application_gateway_name [String] The name of the application gateway.
545
+ # @return [Concurrent::Promise] promise which provides async access to http
546
+ # response.
547
+ #
548
+ def start(resource_group_name, application_gateway_name, custom_headers = nil)
549
+ # Send request
550
+ promise = begin_start(resource_group_name, application_gateway_name, custom_headers)
551
+
552
+ promise = promise.then do |response|
553
+ # Defining deserialization method.
554
+ deserialize_method = lambda do |parsed_response|
555
+ end
556
+
557
+ # Waiting for response.
558
+ @client.get_post_or_delete_operation_result(response, nil, deserialize_method)
559
+ end
560
+
561
+ promise
562
+ end
563
+
564
+ #
565
+ # The Start ApplicationGateway operation starts application gatewayin the
566
+ # specified resource group through Network resource provider.
567
+ # @param resource_group_name [String] The name of the resource group.
568
+ # @param application_gateway_name [String] The name of the application gateway.
569
+ # @param [Hash{String => String}] The hash of custom headers need to be
570
+ # applied to HTTP request.
571
+ #
572
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
573
+ # response.
574
+ #
575
+ def begin_start(resource_group_name, application_gateway_name, custom_headers = nil)
576
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
577
+ fail ArgumentError, 'application_gateway_name is nil' if application_gateway_name.nil?
578
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
579
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
580
+ # Construct URL
581
+ path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start"
582
+ path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
583
+ path['{applicationGatewayName}'] = ERB::Util.url_encode(application_gateway_name) if path.include?('{applicationGatewayName}')
584
+ path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
585
+ url = URI.join(@client.base_url, path)
586
+ properties = {}
587
+ properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
588
+ unless url.query.nil?
589
+ url.query.split('&').each do |url_item|
590
+ url_items_parts = url_item.split('=')
591
+ properties[url_items_parts[0]] = url_items_parts[1]
592
+ end
593
+ end
594
+ properties.reject!{ |key, value| value.nil? }
595
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
596
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
597
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
598
+ url = URI.parse(corrected_url)
599
+
600
+ connection = Faraday.new(:url => url) do |faraday|
601
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
602
+ faraday.use :cookie_jar
603
+ faraday.adapter Faraday.default_adapter
604
+ end
605
+ request_headers = Hash.new
606
+
607
+ # Set Headers
608
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
609
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
610
+
611
+ unless custom_headers.nil?
612
+ custom_headers.each do |key, value|
613
+ request_headers[key] = value
614
+ end
615
+ end
616
+
617
+ # Send Request
618
+ promise = Concurrent::Promise.new do
619
+ connection.post do |request|
620
+ request.headers = request_headers
621
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
622
+ end
623
+ end
624
+
625
+ promise = promise.then do |http_response|
626
+ status_code = http_response.status
627
+ response_content = http_response.body
628
+ unless (status_code == 202)
629
+ fail MsRestAzure::AzureOperationError.new(connection, http_response)
630
+ end
631
+
632
+ # Create Result
633
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
634
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
635
+
636
+ result
637
+ end
638
+
639
+ promise.execute
640
+ end
641
+
642
+ #
643
+ # The STOP ApplicationGateway operation stops application gatewayin the
644
+ # specified resource group through Network resource provider.
645
+ # @param resource_group_name [String] The name of the resource group.
646
+ # @param application_gateway_name [String] The name of the application gateway.
647
+ # @return [Concurrent::Promise] promise which provides async access to http
648
+ # response.
649
+ #
650
+ def stop(resource_group_name, application_gateway_name, custom_headers = nil)
651
+ # Send request
652
+ promise = begin_stop(resource_group_name, application_gateway_name, custom_headers)
653
+
654
+ promise = promise.then do |response|
655
+ # Defining deserialization method.
656
+ deserialize_method = lambda do |parsed_response|
657
+ end
658
+
659
+ # Waiting for response.
660
+ @client.get_post_or_delete_operation_result(response, nil, deserialize_method)
661
+ end
662
+
663
+ promise
664
+ end
665
+
666
+ #
667
+ # The STOP ApplicationGateway operation stops application gatewayin the
668
+ # specified resource group through Network resource provider.
669
+ # @param resource_group_name [String] The name of the resource group.
670
+ # @param application_gateway_name [String] The name of the application gateway.
671
+ # @param [Hash{String => String}] The hash of custom headers need to be
672
+ # applied to HTTP request.
673
+ #
674
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
675
+ # response.
676
+ #
677
+ def begin_stop(resource_group_name, application_gateway_name, custom_headers = nil)
678
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
679
+ fail ArgumentError, 'application_gateway_name is nil' if application_gateway_name.nil?
680
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
681
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
682
+ # Construct URL
683
+ path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop"
684
+ path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
685
+ path['{applicationGatewayName}'] = ERB::Util.url_encode(application_gateway_name) if path.include?('{applicationGatewayName}')
686
+ path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
687
+ url = URI.join(@client.base_url, path)
688
+ properties = {}
689
+ properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
690
+ unless url.query.nil?
691
+ url.query.split('&').each do |url_item|
692
+ url_items_parts = url_item.split('=')
693
+ properties[url_items_parts[0]] = url_items_parts[1]
694
+ end
695
+ end
696
+ properties.reject!{ |key, value| value.nil? }
697
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
698
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
699
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
700
+ url = URI.parse(corrected_url)
701
+
702
+ connection = Faraday.new(:url => url) do |faraday|
703
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
704
+ faraday.use :cookie_jar
705
+ faraday.adapter Faraday.default_adapter
706
+ end
707
+ request_headers = Hash.new
708
+
709
+ # Set Headers
710
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
711
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
712
+
713
+ unless custom_headers.nil?
714
+ custom_headers.each do |key, value|
715
+ request_headers[key] = value
716
+ end
717
+ end
718
+
719
+ # Send Request
720
+ promise = Concurrent::Promise.new do
721
+ connection.post do |request|
722
+ request.headers = request_headers
723
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
724
+ end
725
+ end
726
+
727
+ promise = promise.then do |http_response|
728
+ status_code = http_response.status
729
+ response_content = http_response.body
730
+ unless (status_code == 202 || status_code == 200)
731
+ fail MsRestAzure::AzureOperationError.new(connection, http_response)
732
+ end
733
+
734
+ # Create Result
735
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
736
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
737
+
738
+ result
739
+ end
740
+
741
+ promise.execute
742
+ end
743
+
744
+ #
745
+ # The List ApplicationGateway opertion retrieves all the applicationgateways
746
+ # in a resource group.
747
+ # @param next_page_link [String] The NextLink from the previous successful
748
+ # call to List operation.
749
+ # @param [Hash{String => String}] The hash of custom headers need to be
750
+ # applied to HTTP request.
751
+ #
752
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
753
+ # response.
754
+ #
755
+ def list_next(next_page_link, custom_headers = nil)
756
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
757
+ # Construct URL
758
+ path = "{nextLink}"
759
+ path['{nextLink}'] = next_page_link if path.include?('{nextLink}')
760
+ url = URI.parse(path)
761
+ properties = {}
762
+ unless url.query.nil?
763
+ url.query.split('&').each do |url_item|
764
+ url_items_parts = url_item.split('=')
765
+ properties[url_items_parts[0]] = url_items_parts[1]
766
+ end
767
+ end
768
+ properties.reject!{ |key, value| value.nil? }
769
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
770
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
771
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
772
+ url = URI.parse(corrected_url)
773
+
774
+ connection = Faraday.new(:url => url) do |faraday|
775
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
776
+ faraday.use :cookie_jar
777
+ faraday.adapter Faraday.default_adapter
778
+ end
779
+ request_headers = Hash.new
780
+
781
+ # Set Headers
782
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
783
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
784
+
785
+ unless custom_headers.nil?
786
+ custom_headers.each do |key, value|
787
+ request_headers[key] = value
788
+ end
789
+ end
790
+
791
+ # Send Request
792
+ promise = Concurrent::Promise.new do
793
+ connection.get do |request|
794
+ request.headers = request_headers
795
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
796
+ end
797
+ end
798
+
799
+ promise = promise.then do |http_response|
800
+ status_code = http_response.status
801
+ response_content = http_response.body
802
+ unless (status_code == 200)
803
+ error_model = JSON.load(response_content)
804
+ fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
805
+ end
806
+
807
+ # Create Result
808
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
809
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
810
+ # Deserialize Response
811
+ if status_code == 200
812
+ begin
813
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
814
+ unless parsed_response.nil?
815
+ parsed_response = ApplicationGatewayListResult.deserialize_object(parsed_response)
816
+ end
817
+ result.body = parsed_response
818
+ rescue Exception => e
819
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
820
+ end
821
+ end
822
+
823
+ result
824
+ end
825
+
826
+ promise.execute
827
+ end
828
+
829
+ #
830
+ # The List applicationgateway opertion retrieves all the applicationgateways
831
+ # in a subscription.
832
+ # @param next_page_link [String] The NextLink from the previous successful
833
+ # call to List operation.
834
+ # @param [Hash{String => String}] The hash of custom headers need to be
835
+ # applied to HTTP request.
836
+ #
837
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
838
+ # response.
839
+ #
840
+ def list_all_next(next_page_link, custom_headers = nil)
841
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
842
+ # Construct URL
843
+ path = "{nextLink}"
844
+ path['{nextLink}'] = next_page_link if path.include?('{nextLink}')
845
+ url = URI.parse(path)
846
+ properties = {}
847
+ unless url.query.nil?
848
+ url.query.split('&').each do |url_item|
849
+ url_items_parts = url_item.split('=')
850
+ properties[url_items_parts[0]] = url_items_parts[1]
851
+ end
852
+ end
853
+ properties.reject!{ |key, value| value.nil? }
854
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
855
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
856
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
857
+ url = URI.parse(corrected_url)
858
+
859
+ connection = Faraday.new(:url => url) do |faraday|
860
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
861
+ faraday.use :cookie_jar
862
+ faraday.adapter Faraday.default_adapter
863
+ end
864
+ request_headers = Hash.new
865
+
866
+ # Set Headers
867
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
868
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
869
+
870
+ unless custom_headers.nil?
871
+ custom_headers.each do |key, value|
872
+ request_headers[key] = value
873
+ end
874
+ end
875
+
876
+ # Send Request
877
+ promise = Concurrent::Promise.new do
878
+ connection.get do |request|
879
+ request.headers = request_headers
880
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
881
+ end
882
+ end
883
+
884
+ promise = promise.then do |http_response|
885
+ status_code = http_response.status
886
+ response_content = http_response.body
887
+ unless (status_code == 200)
888
+ error_model = JSON.load(response_content)
889
+ fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
890
+ end
891
+
892
+ # Create Result
893
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
894
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
895
+ # Deserialize Response
896
+ if status_code == 200
897
+ begin
898
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
899
+ unless parsed_response.nil?
900
+ parsed_response = ApplicationGatewayListResult.deserialize_object(parsed_response)
901
+ end
902
+ result.body = parsed_response
903
+ rescue Exception => e
904
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
905
+ end
906
+ end
907
+
908
+ result
909
+ end
910
+
911
+ promise.execute
912
+ end
913
+
914
+ end
915
+ end