azure_mgmt_network 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. checksums.yaml +4 -4
  2. data/azure_mgmt_network.gemspec +4 -9
  3. data/lib/azure_mgmt_network.rb +100 -39
  4. data/lib/azure_mgmt_network/application_gateways.rb +175 -401
  5. data/lib/azure_mgmt_network/express_route_circuit_authorizations.rb +429 -0
  6. data/lib/azure_mgmt_network/express_route_circuit_peerings.rb +427 -0
  7. data/lib/azure_mgmt_network/express_route_circuits.rb +911 -0
  8. data/lib/azure_mgmt_network/express_route_service_providers.rb +149 -0
  9. data/lib/azure_mgmt_network/load_balancers.rb +139 -314
  10. data/lib/azure_mgmt_network/local_network_gateways.rb +102 -228
  11. data/lib/azure_mgmt_network/models/address_space.rb +1 -3
  12. data/lib/azure_mgmt_network/models/application_gateway.rb +7 -9
  13. data/lib/azure_mgmt_network/models/application_gateway_backend_address.rb +1 -3
  14. data/lib/azure_mgmt_network/models/application_gateway_backend_address_pool.rb +1 -3
  15. data/lib/azure_mgmt_network/models/application_gateway_backend_address_pool_properties_format.rb +16 -18
  16. data/lib/azure_mgmt_network/models/application_gateway_backend_http_settings.rb +1 -3
  17. data/lib/azure_mgmt_network/models/application_gateway_backend_http_settings_properties_format.rb +32 -8
  18. data/lib/azure_mgmt_network/models/application_gateway_cookie_based_affinity.rb +1 -1
  19. data/lib/azure_mgmt_network/models/{application_gateway_frontend_ip_configuration.rb → application_gateway_frontend_ipconfiguration.rb} +7 -9
  20. data/lib/azure_mgmt_network/models/{application_gateway_frontend_ip_configuration_properties_format.rb → application_gateway_frontend_ipconfiguration_properties_format.rb} +12 -15
  21. data/lib/azure_mgmt_network/models/application_gateway_frontend_port.rb +1 -3
  22. data/lib/azure_mgmt_network/models/application_gateway_frontend_port_properties_format.rb +1 -3
  23. data/lib/azure_mgmt_network/models/application_gateway_http_listener.rb +1 -3
  24. data/lib/azure_mgmt_network/models/application_gateway_http_listener_properties_format.rb +34 -17
  25. data/lib/azure_mgmt_network/models/{application_gateway_ip_configuration.rb → application_gateway_ipconfiguration.rb} +7 -9
  26. data/lib/azure_mgmt_network/models/{application_gateway_ip_configuration_properties_format.rb → application_gateway_ipconfiguration_properties_format.rb} +6 -8
  27. data/lib/azure_mgmt_network/models/application_gateway_list_result.rb +4 -6
  28. data/lib/azure_mgmt_network/models/application_gateway_operational_state.rb +1 -1
  29. data/lib/azure_mgmt_network/models/application_gateway_path_rule.rb +88 -0
  30. data/lib/azure_mgmt_network/models/application_gateway_path_rule_properties_format.rb +101 -0
  31. data/lib/azure_mgmt_network/models/application_gateway_probe.rb +88 -0
  32. data/lib/azure_mgmt_network/models/application_gateway_probe_properties_format.rb +118 -0
  33. data/lib/azure_mgmt_network/models/application_gateway_properties_format.rb +151 -81
  34. data/lib/azure_mgmt_network/models/application_gateway_protocol.rb +1 -1
  35. data/lib/azure_mgmt_network/models/application_gateway_request_routing_rule.rb +1 -3
  36. data/lib/azure_mgmt_network/models/application_gateway_request_routing_rule_properties_format.rb +26 -11
  37. data/lib/azure_mgmt_network/models/application_gateway_request_routing_rule_type.rb +2 -1
  38. data/lib/azure_mgmt_network/models/application_gateway_sku.rb +6 -8
  39. data/lib/azure_mgmt_network/models/application_gateway_sku_name.rb +1 -1
  40. data/lib/azure_mgmt_network/models/application_gateway_ssl_certificate.rb +1 -3
  41. data/lib/azure_mgmt_network/models/application_gateway_ssl_certificate_properties_format.rb +1 -3
  42. data/lib/azure_mgmt_network/models/application_gateway_tier.rb +1 -1
  43. data/lib/azure_mgmt_network/models/application_gateway_url_path_map.rb +88 -0
  44. data/lib/azure_mgmt_network/models/application_gateway_url_path_map_properties_format.rb +122 -0
  45. data/lib/azure_mgmt_network/models/authorization_list_result.rb +87 -0
  46. data/lib/azure_mgmt_network/models/authorization_properties_format.rb +79 -0
  47. data/lib/azure_mgmt_network/models/authorization_use_status.rb +16 -0
  48. data/lib/azure_mgmt_network/models/azure_async_operation_result.rb +5 -7
  49. data/lib/azure_mgmt_network/models/backend_address_pool.rb +1 -3
  50. data/lib/azure_mgmt_network/models/backend_address_pool_properties_format.rb +30 -15
  51. data/lib/azure_mgmt_network/models/connection_reset_shared_key.rb +10 -16
  52. data/lib/azure_mgmt_network/models/connection_shared_key.rb +1 -3
  53. data/lib/azure_mgmt_network/models/{connection_reset_shared_key_properties_format.rb → connection_shared_key_result.rb} +11 -15
  54. data/lib/azure_mgmt_network/models/dhcp_options.rb +1 -3
  55. data/lib/azure_mgmt_network/models/dns_name_availability_result.rb +1 -3
  56. data/lib/azure_mgmt_network/models/error.rb +4 -6
  57. data/lib/azure_mgmt_network/models/error_details.rb +1 -3
  58. data/lib/azure_mgmt_network/models/express_route_circuit.rb +118 -0
  59. data/lib/azure_mgmt_network/models/express_route_circuit_arp_table.rb +65 -0
  60. data/lib/azure_mgmt_network/models/express_route_circuit_authorization.rb +88 -0
  61. data/lib/azure_mgmt_network/models/express_route_circuit_list_result.rb +86 -0
  62. data/lib/azure_mgmt_network/models/express_route_circuit_peering.rb +88 -0
  63. data/lib/azure_mgmt_network/models/express_route_circuit_peering_advertised_public_prefix_state.rb +18 -0
  64. data/lib/azure_mgmt_network/models/express_route_circuit_peering_config.rb +92 -0
  65. data/lib/azure_mgmt_network/models/express_route_circuit_peering_list_result.rb +87 -0
  66. data/lib/azure_mgmt_network/models/express_route_circuit_peering_properties_format.rb +194 -0
  67. data/lib/azure_mgmt_network/models/express_route_circuit_peering_state.rb +16 -0
  68. data/lib/azure_mgmt_network/models/express_route_circuit_peering_type.rb +17 -0
  69. data/lib/azure_mgmt_network/models/express_route_circuit_properties_format.rb +179 -0
  70. data/lib/azure_mgmt_network/models/express_route_circuit_routes_table.rb +89 -0
  71. data/lib/azure_mgmt_network/models/express_route_circuit_service_provider_properties.rb +76 -0
  72. data/lib/azure_mgmt_network/models/express_route_circuit_sku.rb +83 -0
  73. data/lib/azure_mgmt_network/models/express_route_circuit_sku_family.rb +16 -0
  74. data/lib/azure_mgmt_network/models/express_route_circuit_sku_tier.rb +16 -0
  75. data/lib/azure_mgmt_network/models/express_route_circuit_stats.rb +67 -0
  76. data/lib/azure_mgmt_network/models/express_route_circuits_arp_table_list_result.rb +85 -0
  77. data/lib/azure_mgmt_network/models/express_route_circuits_routes_table_list_result.rb +88 -0
  78. data/lib/azure_mgmt_network/models/express_route_circuits_stats_list_result.rb +85 -0
  79. data/lib/azure_mgmt_network/models/express_route_service_provider.rb +92 -0
  80. data/lib/azure_mgmt_network/models/express_route_service_provider_bandwidths_offered.rb +67 -0
  81. data/lib/azure_mgmt_network/models/express_route_service_provider_list_result.rb +86 -0
  82. data/lib/azure_mgmt_network/models/express_route_service_provider_properties_format.rb +97 -0
  83. data/lib/azure_mgmt_network/models/{frontend_ip_configuration.rb → frontend_ipconfiguration.rb} +7 -9
  84. data/lib/azure_mgmt_network/models/{frontend_ip_configuration_properties_format.rb → frontend_ipconfiguration_properties_format.rb} +133 -77
  85. data/lib/azure_mgmt_network/models/inbound_nat_pool.rb +88 -0
  86. data/lib/azure_mgmt_network/models/inbound_nat_pool_properties_format.rb +134 -0
  87. data/lib/azure_mgmt_network/models/inbound_nat_rule.rb +1 -3
  88. data/lib/azure_mgmt_network/models/inbound_nat_rule_properties_format.rb +11 -12
  89. data/lib/azure_mgmt_network/models/{ip_allocation_method.rb → ipallocation_method.rb} +3 -3
  90. data/lib/azure_mgmt_network/models/ipconfiguration.rb +88 -0
  91. data/lib/azure_mgmt_network/models/ipconfiguration_properties_format.rb +113 -0
  92. data/lib/azure_mgmt_network/models/load_balancer.rb +7 -9
  93. data/lib/azure_mgmt_network/models/load_balancer_list_result.rb +4 -6
  94. data/lib/azure_mgmt_network/models/load_balancer_properties_format.rb +103 -35
  95. data/lib/azure_mgmt_network/models/load_balancing_rule.rb +1 -3
  96. data/lib/azure_mgmt_network/models/load_balancing_rule_properties_format.rb +30 -30
  97. data/lib/azure_mgmt_network/models/load_distribution.rb +1 -1
  98. data/lib/azure_mgmt_network/models/local_network_gateway.rb +7 -9
  99. data/lib/azure_mgmt_network/models/local_network_gateway_list_result.rb +4 -6
  100. data/lib/azure_mgmt_network/models/local_network_gateway_properties_format.rb +11 -3
  101. data/lib/azure_mgmt_network/models/network_interface.rb +7 -9
  102. data/lib/azure_mgmt_network/models/network_interface_dns_settings.rb +1 -3
  103. data/lib/azure_mgmt_network/models/{network_interface_ip_configuration.rb → network_interface_ipconfiguration.rb} +7 -9
  104. data/lib/azure_mgmt_network/models/{network_interface_ip_configuration_properties_format.rb → network_interface_ipconfiguration_properties_format.rb} +70 -76
  105. data/lib/azure_mgmt_network/models/network_interface_list_result.rb +4 -6
  106. data/lib/azure_mgmt_network/models/network_interface_properties_format.rb +32 -14
  107. data/lib/azure_mgmt_network/models/{operation_status.rb → network_operation_status.rb} +3 -3
  108. data/lib/azure_mgmt_network/models/network_security_group.rb +7 -9
  109. data/lib/azure_mgmt_network/models/network_security_group_list_result.rb +4 -6
  110. data/lib/azure_mgmt_network/models/network_security_group_properties_format.rb +30 -22
  111. data/lib/azure_mgmt_network/models/outbound_nat_rule.rb +88 -0
  112. data/lib/azure_mgmt_network/models/outbound_nat_rule_properties_format.rb +117 -0
  113. data/lib/azure_mgmt_network/models/probe.rb +1 -3
  114. data/lib/azure_mgmt_network/models/probe_properties_format.rb +25 -26
  115. data/lib/azure_mgmt_network/models/probe_protocol.rb +1 -1
  116. data/lib/azure_mgmt_network/models/processor_architecture.rb +16 -0
  117. data/lib/azure_mgmt_network/models/{public_ip_address.rb → public_ipaddress.rb} +13 -15
  118. data/lib/azure_mgmt_network/models/{public_ip_address_dns_settings.rb → public_ipaddress_dns_settings.rb} +4 -6
  119. data/lib/azure_mgmt_network/models/{public_ip_address_list_result.rb → public_ipaddress_list_result.rb} +10 -12
  120. data/lib/azure_mgmt_network/models/{public_ip_address_properties_format.rb → public_ipaddress_properties_format.rb} +25 -19
  121. data/lib/azure_mgmt_network/models/route.rb +88 -0
  122. data/lib/azure_mgmt_network/models/route_list_result.rb +85 -0
  123. data/lib/azure_mgmt_network/models/route_next_hop_type.rb +19 -0
  124. data/lib/azure_mgmt_network/models/route_properties_format.rb +94 -0
  125. data/lib/azure_mgmt_network/models/route_table.rb +102 -0
  126. data/lib/azure_mgmt_network/models/route_table_list_result.rb +86 -0
  127. data/lib/azure_mgmt_network/models/route_table_properties_format.rb +116 -0
  128. data/lib/azure_mgmt_network/models/security_rule.rb +1 -3
  129. data/lib/azure_mgmt_network/models/security_rule_access.rb +1 -1
  130. data/lib/azure_mgmt_network/models/security_rule_direction.rb +1 -1
  131. data/lib/azure_mgmt_network/models/security_rule_list_result.rb +4 -6
  132. data/lib/azure_mgmt_network/models/security_rule_properties_format.rb +50 -48
  133. data/lib/azure_mgmt_network/models/security_rule_protocol.rb +1 -1
  134. data/lib/azure_mgmt_network/models/service_provider_provisioning_state.rb +18 -0
  135. data/lib/azure_mgmt_network/models/subnet.rb +1 -3
  136. data/lib/azure_mgmt_network/models/subnet_list_result.rb +4 -6
  137. data/lib/azure_mgmt_network/models/subnet_properties_format.rb +28 -13
  138. data/lib/azure_mgmt_network/models/transport_protocol.rb +1 -1
  139. data/lib/azure_mgmt_network/models/usage.rb +7 -5
  140. data/lib/azure_mgmt_network/models/usage_name.rb +1 -3
  141. data/lib/azure_mgmt_network/models/usage_unit.rb +1 -1
  142. data/lib/azure_mgmt_network/models/usages_list_result.rb +4 -6
  143. data/lib/azure_mgmt_network/models/virtual_network.rb +7 -9
  144. data/lib/azure_mgmt_network/models/virtual_network_gateway.rb +7 -9
  145. data/lib/azure_mgmt_network/models/virtual_network_gateway_connection.rb +7 -9
  146. data/lib/azure_mgmt_network/models/virtual_network_gateway_connection_list_result.rb +4 -6
  147. data/lib/azure_mgmt_network/models/virtual_network_gateway_connection_properties_format.rb +74 -6
  148. data/lib/azure_mgmt_network/models/virtual_network_gateway_connection_status.rb +18 -0
  149. data/lib/azure_mgmt_network/models/virtual_network_gateway_connection_type.rb +1 -1
  150. data/lib/azure_mgmt_network/models/{virtual_network_gateway_ip_configuration.rb → virtual_network_gateway_ipconfiguration.rb} +7 -9
  151. data/lib/azure_mgmt_network/models/{virtual_network_gateway_ip_configuration_properties_format.rb → virtual_network_gateway_ipconfiguration_properties_format.rb} +14 -17
  152. data/lib/azure_mgmt_network/models/virtual_network_gateway_list_result.rb +4 -6
  153. data/lib/azure_mgmt_network/models/virtual_network_gateway_properties_format.rb +76 -13
  154. data/lib/azure_mgmt_network/models/virtual_network_gateway_sku.rb +86 -0
  155. data/lib/azure_mgmt_network/models/virtual_network_gateway_sku_name.rb +17 -0
  156. data/lib/azure_mgmt_network/models/virtual_network_gateway_sku_tier.rb +17 -0
  157. data/lib/azure_mgmt_network/models/virtual_network_gateway_type.rb +2 -1
  158. data/lib/azure_mgmt_network/models/virtual_network_list_result.rb +4 -6
  159. data/lib/azure_mgmt_network/models/virtual_network_properties_format.rb +14 -6
  160. data/lib/azure_mgmt_network/models/vpn_client_configuration.rb +125 -0
  161. data/lib/azure_mgmt_network/models/vpn_client_parameters.rb +60 -0
  162. data/lib/azure_mgmt_network/models/vpn_client_revoked_certificate.rb +88 -0
  163. data/lib/azure_mgmt_network/models/vpn_client_revoked_certificate_properties_format.rb +69 -0
  164. data/lib/azure_mgmt_network/models/vpn_client_root_certificate.rb +88 -0
  165. data/lib/azure_mgmt_network/models/vpn_client_root_certificate_properties_format.rb +66 -0
  166. data/lib/azure_mgmt_network/models/vpn_type.rb +1 -1
  167. data/lib/azure_mgmt_network/module_definition.rb +5 -3
  168. data/lib/azure_mgmt_network/network_interfaces.rb +451 -304
  169. data/lib/azure_mgmt_network/{network_resource_provider_client.rb → network_management_client.rb} +61 -57
  170. data/lib/azure_mgmt_network/network_security_groups.rb +139 -314
  171. data/lib/azure_mgmt_network/public_ipaddresses.rb +536 -0
  172. data/lib/azure_mgmt_network/route_tables.rb +532 -0
  173. data/lib/azure_mgmt_network/routes.rb +423 -0
  174. data/lib/azure_mgmt_network/security_rules.rb +102 -232
  175. data/lib/azure_mgmt_network/subnets.rb +104 -233
  176. data/lib/azure_mgmt_network/usages.rb +79 -43
  177. data/lib/azure_mgmt_network/version.rb +5 -3
  178. data/lib/azure_mgmt_network/virtual_network_gateway_connections.rb +262 -467
  179. data/lib/azure_mgmt_network/virtual_network_gateways.rb +204 -280
  180. data/lib/azure_mgmt_network/virtual_networks.rb +139 -314
  181. metadata +92 -106
  182. data/.gitignore +0 -10
  183. data/.travis.yml +0 -3
  184. data/Gemfile +0 -15
  185. data/lib/azure_mgmt_network/public_ip_addresses.rb +0 -711
@@ -0,0 +1,429 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Network
7
+ #
8
+ # The Microsoft Azure Network management API provides a RESTful set of web
9
+ # services that interact with Microsoft Azure Networks service to manage
10
+ # your network resrources. The API has entities that capture the
11
+ # relationship between an end user and the Microsoft Azure Networks service.
12
+ #
13
+ class ExpressRouteCircuitAuthorizations
14
+ include Azure::ARM::Network::Models
15
+ include MsRestAzure
16
+
17
+ #
18
+ # Creates and initializes a new instance of the ExpressRouteCircuitAuthorizations class.
19
+ # @param client service class for accessing basic functionality.
20
+ #
21
+ def initialize(client)
22
+ @client = client
23
+ end
24
+
25
+ # @return reference to the NetworkManagementClient
26
+ attr_reader :client
27
+
28
+ #
29
+ # The delete authorization operation deletes the specified authorization from
30
+ # the specified ExpressRouteCircuit.
31
+ #
32
+ # @param resource_group_name [String] The name of the resource group.
33
+ # @param circuit_name [String] The name of the express route circuit.
34
+ # @param authorization_name [String] The name of the authorization.
35
+ # @return [Concurrent::Promise] promise which provides async access to http
36
+ # response.
37
+ #
38
+ def delete(resource_group_name, circuit_name, authorization_name, custom_headers = nil)
39
+ # Send request
40
+ promise = begin_delete(resource_group_name, circuit_name, authorization_name, custom_headers)
41
+
42
+ promise = promise.then do |response|
43
+ # Defining deserialization method.
44
+ deserialize_method = lambda do |parsed_response|
45
+ end
46
+
47
+ # Waiting for response.
48
+ @client.get_post_or_delete_operation_result(response, deserialize_method)
49
+ end
50
+
51
+ promise
52
+ end
53
+
54
+ #
55
+ # The delete authorization operation deletes the specified authorization from
56
+ # the specified ExpressRouteCircuit.
57
+ #
58
+ # @param resource_group_name [String] The name of the resource group.
59
+ # @param circuit_name [String] The name of the express route circuit.
60
+ # @param authorization_name [String] The name of the authorization.
61
+ # @param [Hash{String => String}] The hash of custom headers need to be
62
+ # applied to HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
65
+ # response.
66
+ #
67
+ def begin_delete(resource_group_name, circuit_name, authorization_name, custom_headers = nil)
68
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
69
+ fail ArgumentError, 'circuit_name is nil' if circuit_name.nil?
70
+ fail ArgumentError, 'authorization_name is nil' if authorization_name.nil?
71
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
72
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
73
+ request_headers = {}
74
+
75
+ # Set Headers
76
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
77
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
78
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}'
79
+ options = {
80
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
81
+ path_params: {'resourceGroupName' => resource_group_name,'circuitName' => circuit_name,'authorizationName' => authorization_name,'subscriptionId' => @client.subscription_id},
82
+ query_params: {'api-version' => @client.api_version},
83
+ headers: request_headers.merge(custom_headers || {})
84
+ }
85
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
86
+ promise = request.run_promise do |req|
87
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
88
+ end
89
+
90
+ promise = promise.then do |http_response|
91
+ status_code = http_response.status
92
+ response_content = http_response.body
93
+ unless status_code == 202 || status_code == 200 || status_code == 204
94
+ error_model = JSON.load(response_content)
95
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
96
+ end
97
+
98
+ # Create Result
99
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
100
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
101
+
102
+ result
103
+ end
104
+
105
+ promise.execute
106
+ end
107
+
108
+ #
109
+ # The GET authorization operation retrieves the specified authorization from
110
+ # the specified ExpressRouteCircuit.
111
+ #
112
+ # @param resource_group_name [String] The name of the resource group.
113
+ # @param circuit_name [String] The name of the express route circuit.
114
+ # @param authorization_name [String] The name of the authorization.
115
+ # @param [Hash{String => String}] The hash of custom headers need to be
116
+ # applied to HTTP request.
117
+ #
118
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
119
+ # response.
120
+ #
121
+ def get(resource_group_name, circuit_name, authorization_name, custom_headers = nil)
122
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
123
+ fail ArgumentError, 'circuit_name is nil' if circuit_name.nil?
124
+ fail ArgumentError, 'authorization_name is nil' if authorization_name.nil?
125
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
126
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
127
+ request_headers = {}
128
+
129
+ # Set Headers
130
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
131
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
132
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}'
133
+ options = {
134
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
135
+ path_params: {'resourceGroupName' => resource_group_name,'circuitName' => circuit_name,'authorizationName' => authorization_name,'subscriptionId' => @client.subscription_id},
136
+ query_params: {'api-version' => @client.api_version},
137
+ headers: request_headers.merge(custom_headers || {})
138
+ }
139
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
140
+ promise = request.run_promise do |req|
141
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
142
+ end
143
+
144
+ promise = promise.then do |http_response|
145
+ status_code = http_response.status
146
+ response_content = http_response.body
147
+ unless status_code == 200
148
+ error_model = JSON.load(response_content)
149
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
150
+ end
151
+
152
+ # Create Result
153
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
154
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
155
+ # Deserialize Response
156
+ if status_code == 200
157
+ begin
158
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
159
+ unless parsed_response.nil?
160
+ parsed_response = ExpressRouteCircuitAuthorization.deserialize_object(parsed_response)
161
+ end
162
+ result.body = parsed_response
163
+ rescue Exception => e
164
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
165
+ end
166
+ end
167
+
168
+ result
169
+ end
170
+
171
+ promise.execute
172
+ end
173
+
174
+ #
175
+ # The Put Authorization operation creates/updates an authorization in
176
+ # thespecified ExpressRouteCircuits
177
+ #
178
+ # @param resource_group_name [String] The name of the resource group.
179
+ # @param circuit_name [String] The name of the express route circuit.
180
+ # @param authorization_name [String] The name of the authorization.
181
+ # @param authorization_parameters [ExpressRouteCircuitAuthorization]
182
+ # Parameters supplied to the create/update ExpressRouteCircuitAuthorization
183
+ # operation
184
+ # @param @client.api_version [String] Client Api Version.
185
+ # @param @client.subscription_id [String] Gets subscription credentials which
186
+ # uniquely identify Microsoft Azure subscription. The subscription ID forms
187
+ # part of the URI for every service call.
188
+ # @param @client.accept_language [String] Gets or sets the preferred language
189
+ # for the response.
190
+ #
191
+ # @return [Concurrent::Promise] promise which provides async access to http
192
+ # response.
193
+ #
194
+ def create_or_update(resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers = nil)
195
+ # Send request
196
+ promise = begin_create_or_update(resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers)
197
+
198
+ promise = promise.then do |response|
199
+ # Defining deserialization method.
200
+ deserialize_method = lambda do |parsed_response|
201
+ unless parsed_response.nil?
202
+ parsed_response = ExpressRouteCircuitAuthorization.deserialize_object(parsed_response)
203
+ end
204
+ end
205
+
206
+ # Waiting for response.
207
+ @client.get_put_operation_result(response, deserialize_method)
208
+ end
209
+
210
+ promise
211
+ end
212
+
213
+ #
214
+ # The Put Authorization operation creates/updates an authorization in
215
+ # thespecified ExpressRouteCircuits
216
+ #
217
+ # @param resource_group_name [String] The name of the resource group.
218
+ # @param circuit_name [String] The name of the express route circuit.
219
+ # @param authorization_name [String] The name of the authorization.
220
+ # @param authorization_parameters [ExpressRouteCircuitAuthorization]
221
+ # Parameters supplied to the create/update ExpressRouteCircuitAuthorization
222
+ # operation
223
+ # @param [Hash{String => String}] The hash of custom headers need to be
224
+ # applied to HTTP request.
225
+ #
226
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
227
+ # response.
228
+ #
229
+ def begin_create_or_update(resource_group_name, circuit_name, authorization_name, authorization_parameters, custom_headers = nil)
230
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
231
+ fail ArgumentError, 'circuit_name is nil' if circuit_name.nil?
232
+ fail ArgumentError, 'authorization_name is nil' if authorization_name.nil?
233
+ fail ArgumentError, 'authorization_parameters is nil' if authorization_parameters.nil?
234
+ authorization_parameters.validate unless authorization_parameters.nil?
235
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
236
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
237
+ request_headers = {}
238
+
239
+ # Set Headers
240
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
241
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
242
+
243
+ # Serialize Request
244
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
245
+ unless authorization_parameters.nil?
246
+ authorization_parameters = ExpressRouteCircuitAuthorization.serialize_object(authorization_parameters)
247
+ end
248
+ request_content = JSON.generate(authorization_parameters, quirks_mode: true)
249
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}'
250
+ options = {
251
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
252
+ path_params: {'resourceGroupName' => resource_group_name,'circuitName' => circuit_name,'authorizationName' => authorization_name,'subscriptionId' => @client.subscription_id},
253
+ query_params: {'api-version' => @client.api_version},
254
+ body: request_content,
255
+ headers: request_headers.merge(custom_headers || {})
256
+ }
257
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
258
+ promise = request.run_promise do |req|
259
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
260
+ end
261
+
262
+ promise = promise.then do |http_response|
263
+ status_code = http_response.status
264
+ response_content = http_response.body
265
+ unless status_code == 201 || status_code == 200
266
+ error_model = JSON.load(response_content)
267
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
268
+ end
269
+
270
+ # Create Result
271
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
272
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
273
+ # Deserialize Response
274
+ if status_code == 201
275
+ begin
276
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
277
+ unless parsed_response.nil?
278
+ parsed_response = ExpressRouteCircuitAuthorization.deserialize_object(parsed_response)
279
+ end
280
+ result.body = parsed_response
281
+ rescue Exception => e
282
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
283
+ end
284
+ end
285
+ # Deserialize Response
286
+ if status_code == 200
287
+ begin
288
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
289
+ unless parsed_response.nil?
290
+ parsed_response = ExpressRouteCircuitAuthorization.deserialize_object(parsed_response)
291
+ end
292
+ result.body = parsed_response
293
+ rescue Exception => e
294
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
295
+ end
296
+ end
297
+
298
+ result
299
+ end
300
+
301
+ promise.execute
302
+ end
303
+
304
+ #
305
+ # The List authorization operation retrieves all the authorizations in an
306
+ # ExpressRouteCircuit.
307
+ #
308
+ # @param resource_group_name [String] The name of the resource group.
309
+ # @param circuit_name [String] The name of the curcuit.
310
+ # @param [Hash{String => String}] The hash of custom headers need to be
311
+ # applied to HTTP request.
312
+ #
313
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
314
+ # response.
315
+ #
316
+ def list(resource_group_name, circuit_name, custom_headers = nil)
317
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
318
+ fail ArgumentError, 'circuit_name is nil' if circuit_name.nil?
319
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
320
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
321
+ request_headers = {}
322
+
323
+ # Set Headers
324
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
325
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
326
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations'
327
+ options = {
328
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
329
+ path_params: {'resourceGroupName' => resource_group_name,'circuitName' => circuit_name,'subscriptionId' => @client.subscription_id},
330
+ query_params: {'api-version' => @client.api_version},
331
+ headers: request_headers.merge(custom_headers || {})
332
+ }
333
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
334
+ promise = request.run_promise do |req|
335
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
336
+ end
337
+
338
+ promise = promise.then do |http_response|
339
+ status_code = http_response.status
340
+ response_content = http_response.body
341
+ unless status_code == 200
342
+ error_model = JSON.load(response_content)
343
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
344
+ end
345
+
346
+ # Create Result
347
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
348
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
349
+ # Deserialize Response
350
+ if status_code == 200
351
+ begin
352
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
353
+ unless parsed_response.nil?
354
+ parsed_response = AuthorizationListResult.deserialize_object(parsed_response)
355
+ end
356
+ result.body = parsed_response
357
+ rescue Exception => e
358
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
359
+ end
360
+ end
361
+
362
+ result
363
+ end
364
+
365
+ promise.execute
366
+ end
367
+
368
+ #
369
+ # The List authorization operation retrieves all the authorizations in an
370
+ # ExpressRouteCircuit.
371
+ #
372
+ # @param next_page_link [String] The NextLink from the previous successful
373
+ # call to List operation.
374
+ # @param [Hash{String => String}] The hash of custom headers need to be
375
+ # applied to HTTP request.
376
+ #
377
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
378
+ # response.
379
+ #
380
+ def list_next(next_page_link, custom_headers = nil)
381
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
382
+ request_headers = {}
383
+
384
+ # Set Headers
385
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
386
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
387
+ path_template = '{nextLink}'
388
+ options = {
389
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
390
+ skip_encoding_path_params: {'nextLink' => next_page_link},
391
+ headers: request_headers.merge(custom_headers || {})
392
+ }
393
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
394
+ promise = request.run_promise do |req|
395
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
396
+ end
397
+
398
+ promise = promise.then do |http_response|
399
+ status_code = http_response.status
400
+ response_content = http_response.body
401
+ unless status_code == 200
402
+ error_model = JSON.load(response_content)
403
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
404
+ end
405
+
406
+ # Create Result
407
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
408
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
409
+ # Deserialize Response
410
+ if status_code == 200
411
+ begin
412
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
413
+ unless parsed_response.nil?
414
+ parsed_response = AuthorizationListResult.deserialize_object(parsed_response)
415
+ end
416
+ result.body = parsed_response
417
+ rescue Exception => e
418
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
419
+ end
420
+ end
421
+
422
+ result
423
+ end
424
+
425
+ promise.execute
426
+ end
427
+
428
+ end
429
+ end
@@ -0,0 +1,427 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Network
7
+ #
8
+ # The Microsoft Azure Network management API provides a RESTful set of web
9
+ # services that interact with Microsoft Azure Networks service to manage
10
+ # your network resrources. The API has entities that capture the
11
+ # relationship between an end user and the Microsoft Azure Networks service.
12
+ #
13
+ class ExpressRouteCircuitPeerings
14
+ include Azure::ARM::Network::Models
15
+ include MsRestAzure
16
+
17
+ #
18
+ # Creates and initializes a new instance of the ExpressRouteCircuitPeerings class.
19
+ # @param client service class for accessing basic functionality.
20
+ #
21
+ def initialize(client)
22
+ @client = client
23
+ end
24
+
25
+ # @return reference to the NetworkManagementClient
26
+ attr_reader :client
27
+
28
+ #
29
+ # The delete peering operation deletes the specified peering from the
30
+ # ExpressRouteCircuit.
31
+ #
32
+ # @param resource_group_name [String] The name of the resource group.
33
+ # @param circuit_name [String] The name of the express route circuit.
34
+ # @param peering_name [String] The name of the peering.
35
+ # @return [Concurrent::Promise] promise which provides async access to http
36
+ # response.
37
+ #
38
+ def delete(resource_group_name, circuit_name, peering_name, custom_headers = nil)
39
+ # Send request
40
+ promise = begin_delete(resource_group_name, circuit_name, peering_name, custom_headers)
41
+
42
+ promise = promise.then do |response|
43
+ # Defining deserialization method.
44
+ deserialize_method = lambda do |parsed_response|
45
+ end
46
+
47
+ # Waiting for response.
48
+ @client.get_post_or_delete_operation_result(response, deserialize_method)
49
+ end
50
+
51
+ promise
52
+ end
53
+
54
+ #
55
+ # The delete peering operation deletes the specified peering from the
56
+ # ExpressRouteCircuit.
57
+ #
58
+ # @param resource_group_name [String] The name of the resource group.
59
+ # @param circuit_name [String] The name of the express route circuit.
60
+ # @param peering_name [String] The name of the peering.
61
+ # @param [Hash{String => String}] The hash of custom headers need to be
62
+ # applied to HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
65
+ # response.
66
+ #
67
+ def begin_delete(resource_group_name, circuit_name, peering_name, custom_headers = nil)
68
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
69
+ fail ArgumentError, 'circuit_name is nil' if circuit_name.nil?
70
+ fail ArgumentError, 'peering_name is nil' if peering_name.nil?
71
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
72
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
73
+ request_headers = {}
74
+
75
+ # Set Headers
76
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
77
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
78
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}'
79
+ options = {
80
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
81
+ path_params: {'resourceGroupName' => resource_group_name,'circuitName' => circuit_name,'peeringName' => peering_name,'subscriptionId' => @client.subscription_id},
82
+ query_params: {'api-version' => @client.api_version},
83
+ headers: request_headers.merge(custom_headers || {})
84
+ }
85
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
86
+ promise = request.run_promise do |req|
87
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
88
+ end
89
+
90
+ promise = promise.then do |http_response|
91
+ status_code = http_response.status
92
+ response_content = http_response.body
93
+ unless status_code == 200 || status_code == 202 || status_code == 204
94
+ error_model = JSON.load(response_content)
95
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
96
+ end
97
+
98
+ # Create Result
99
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
100
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
101
+
102
+ result
103
+ end
104
+
105
+ promise.execute
106
+ end
107
+
108
+ #
109
+ # The GET peering operation retrieves the specified authorization from the
110
+ # ExpressRouteCircuit.
111
+ #
112
+ # @param resource_group_name [String] The name of the resource group.
113
+ # @param circuit_name [String] The name of the express route circuit.
114
+ # @param peering_name [String] The name of the peering.
115
+ # @param [Hash{String => String}] The hash of custom headers need to be
116
+ # applied to HTTP request.
117
+ #
118
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
119
+ # response.
120
+ #
121
+ def get(resource_group_name, circuit_name, peering_name, custom_headers = nil)
122
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
123
+ fail ArgumentError, 'circuit_name is nil' if circuit_name.nil?
124
+ fail ArgumentError, 'peering_name is nil' if peering_name.nil?
125
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
126
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
127
+ request_headers = {}
128
+
129
+ # Set Headers
130
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
131
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
132
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}'
133
+ options = {
134
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
135
+ path_params: {'resourceGroupName' => resource_group_name,'circuitName' => circuit_name,'peeringName' => peering_name,'subscriptionId' => @client.subscription_id},
136
+ query_params: {'api-version' => @client.api_version},
137
+ headers: request_headers.merge(custom_headers || {})
138
+ }
139
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
140
+ promise = request.run_promise do |req|
141
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
142
+ end
143
+
144
+ promise = promise.then do |http_response|
145
+ status_code = http_response.status
146
+ response_content = http_response.body
147
+ unless status_code == 200
148
+ error_model = JSON.load(response_content)
149
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
150
+ end
151
+
152
+ # Create Result
153
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
154
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
155
+ # Deserialize Response
156
+ if status_code == 200
157
+ begin
158
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
159
+ unless parsed_response.nil?
160
+ parsed_response = ExpressRouteCircuitPeering.deserialize_object(parsed_response)
161
+ end
162
+ result.body = parsed_response
163
+ rescue Exception => e
164
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
165
+ end
166
+ end
167
+
168
+ result
169
+ end
170
+
171
+ promise.execute
172
+ end
173
+
174
+ #
175
+ # The Put Pering operation creates/updates an peering in the specified
176
+ # ExpressRouteCircuits
177
+ #
178
+ # @param resource_group_name [String] The name of the resource group.
179
+ # @param circuit_name [String] The name of the express route circuit.
180
+ # @param peering_name [String] The name of the peering.
181
+ # @param peering_parameters [ExpressRouteCircuitPeering] Parameters supplied
182
+ # to the create/update ExpressRouteCircuit Peering operation
183
+ # @param @client.api_version [String] Client Api Version.
184
+ # @param @client.subscription_id [String] Gets subscription credentials which
185
+ # uniquely identify Microsoft Azure subscription. The subscription ID forms
186
+ # part of the URI for every service call.
187
+ # @param @client.accept_language [String] Gets or sets the preferred language
188
+ # for the response.
189
+ #
190
+ # @return [Concurrent::Promise] promise which provides async access to http
191
+ # response.
192
+ #
193
+ def create_or_update(resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers = nil)
194
+ # Send request
195
+ promise = begin_create_or_update(resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers)
196
+
197
+ promise = promise.then do |response|
198
+ # Defining deserialization method.
199
+ deserialize_method = lambda do |parsed_response|
200
+ unless parsed_response.nil?
201
+ parsed_response = ExpressRouteCircuitPeering.deserialize_object(parsed_response)
202
+ end
203
+ end
204
+
205
+ # Waiting for response.
206
+ @client.get_put_operation_result(response, deserialize_method)
207
+ end
208
+
209
+ promise
210
+ end
211
+
212
+ #
213
+ # The Put Pering operation creates/updates an peering in the specified
214
+ # ExpressRouteCircuits
215
+ #
216
+ # @param resource_group_name [String] The name of the resource group.
217
+ # @param circuit_name [String] The name of the express route circuit.
218
+ # @param peering_name [String] The name of the peering.
219
+ # @param peering_parameters [ExpressRouteCircuitPeering] Parameters supplied
220
+ # to the create/update ExpressRouteCircuit Peering operation
221
+ # @param [Hash{String => String}] The hash of custom headers need to be
222
+ # applied to HTTP request.
223
+ #
224
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
225
+ # response.
226
+ #
227
+ def begin_create_or_update(resource_group_name, circuit_name, peering_name, peering_parameters, custom_headers = nil)
228
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
229
+ fail ArgumentError, 'circuit_name is nil' if circuit_name.nil?
230
+ fail ArgumentError, 'peering_name is nil' if peering_name.nil?
231
+ fail ArgumentError, 'peering_parameters is nil' if peering_parameters.nil?
232
+ peering_parameters.validate unless peering_parameters.nil?
233
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
234
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
235
+ request_headers = {}
236
+
237
+ # Set Headers
238
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
239
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
240
+
241
+ # Serialize Request
242
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
243
+ unless peering_parameters.nil?
244
+ peering_parameters = ExpressRouteCircuitPeering.serialize_object(peering_parameters)
245
+ end
246
+ request_content = JSON.generate(peering_parameters, quirks_mode: true)
247
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}'
248
+ options = {
249
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
250
+ path_params: {'resourceGroupName' => resource_group_name,'circuitName' => circuit_name,'peeringName' => peering_name,'subscriptionId' => @client.subscription_id},
251
+ query_params: {'api-version' => @client.api_version},
252
+ body: request_content,
253
+ headers: request_headers.merge(custom_headers || {})
254
+ }
255
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
256
+ promise = request.run_promise do |req|
257
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
258
+ end
259
+
260
+ promise = promise.then do |http_response|
261
+ status_code = http_response.status
262
+ response_content = http_response.body
263
+ unless status_code == 200 || status_code == 201
264
+ error_model = JSON.load(response_content)
265
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
266
+ end
267
+
268
+ # Create Result
269
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
270
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
271
+ # Deserialize Response
272
+ if status_code == 200
273
+ begin
274
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
275
+ unless parsed_response.nil?
276
+ parsed_response = ExpressRouteCircuitPeering.deserialize_object(parsed_response)
277
+ end
278
+ result.body = parsed_response
279
+ rescue Exception => e
280
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
281
+ end
282
+ end
283
+ # Deserialize Response
284
+ if status_code == 201
285
+ begin
286
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
287
+ unless parsed_response.nil?
288
+ parsed_response = ExpressRouteCircuitPeering.deserialize_object(parsed_response)
289
+ end
290
+ result.body = parsed_response
291
+ rescue Exception => e
292
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
293
+ end
294
+ end
295
+
296
+ result
297
+ end
298
+
299
+ promise.execute
300
+ end
301
+
302
+ #
303
+ # The List peering operation retrieves all the peerings in an
304
+ # ExpressRouteCircuit.
305
+ #
306
+ # @param resource_group_name [String] The name of the resource group.
307
+ # @param circuit_name [String] The name of the curcuit.
308
+ # @param [Hash{String => String}] The hash of custom headers need to be
309
+ # applied to HTTP request.
310
+ #
311
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
312
+ # response.
313
+ #
314
+ def list(resource_group_name, circuit_name, custom_headers = nil)
315
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
316
+ fail ArgumentError, 'circuit_name is nil' if circuit_name.nil?
317
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
318
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
319
+ request_headers = {}
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
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings'
325
+ options = {
326
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
327
+ path_params: {'resourceGroupName' => resource_group_name,'circuitName' => circuit_name,'subscriptionId' => @client.subscription_id},
328
+ query_params: {'api-version' => @client.api_version},
329
+ headers: request_headers.merge(custom_headers || {})
330
+ }
331
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
332
+ promise = request.run_promise do |req|
333
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
334
+ end
335
+
336
+ promise = promise.then do |http_response|
337
+ status_code = http_response.status
338
+ response_content = http_response.body
339
+ unless status_code == 200
340
+ error_model = JSON.load(response_content)
341
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
342
+ end
343
+
344
+ # Create Result
345
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
346
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
347
+ # Deserialize Response
348
+ if status_code == 200
349
+ begin
350
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
351
+ unless parsed_response.nil?
352
+ parsed_response = ExpressRouteCircuitPeeringListResult.deserialize_object(parsed_response)
353
+ end
354
+ result.body = parsed_response
355
+ rescue Exception => e
356
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
357
+ end
358
+ end
359
+
360
+ result
361
+ end
362
+
363
+ promise.execute
364
+ end
365
+
366
+ #
367
+ # The List peering operation retrieves all the peerings in an
368
+ # ExpressRouteCircuit.
369
+ #
370
+ # @param next_page_link [String] The NextLink from the previous successful
371
+ # call to List operation.
372
+ # @param [Hash{String => String}] The hash of custom headers need to be
373
+ # applied to HTTP request.
374
+ #
375
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
376
+ # response.
377
+ #
378
+ def list_next(next_page_link, custom_headers = nil)
379
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
380
+ request_headers = {}
381
+
382
+ # Set Headers
383
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
384
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
385
+ path_template = '{nextLink}'
386
+ options = {
387
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
388
+ skip_encoding_path_params: {'nextLink' => next_page_link},
389
+ headers: request_headers.merge(custom_headers || {})
390
+ }
391
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
392
+ promise = request.run_promise do |req|
393
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
394
+ end
395
+
396
+ promise = promise.then do |http_response|
397
+ status_code = http_response.status
398
+ response_content = http_response.body
399
+ unless status_code == 200
400
+ error_model = JSON.load(response_content)
401
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
402
+ end
403
+
404
+ # Create Result
405
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
406
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
407
+ # Deserialize Response
408
+ if status_code == 200
409
+ begin
410
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
411
+ unless parsed_response.nil?
412
+ parsed_response = ExpressRouteCircuitPeeringListResult.deserialize_object(parsed_response)
413
+ end
414
+ result.body = parsed_response
415
+ rescue Exception => e
416
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
417
+ end
418
+ end
419
+
420
+ result
421
+ end
422
+
423
+ promise.execute
424
+ end
425
+
426
+ end
427
+ end