azure_mgmt_reservations 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2017-11-01/generated/azure_mgmt_reservations.rb +53 -0
  4. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/applied_reservation_list.rb +66 -0
  5. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/applied_reservations.rb +85 -0
  6. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/catalog.rb +166 -0
  7. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/error.rb +48 -0
  8. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/extended_error_info.rb +84 -0
  9. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/extended_status_info.rb +61 -0
  10. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/kind.rb +15 -0
  11. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/merge_request.rb +56 -0
  12. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/operation_display.rb +80 -0
  13. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/operation_list.rb +98 -0
  14. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/operation_response.rb +70 -0
  15. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/patch.rb +66 -0
  16. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/reservation_list.rb +98 -0
  17. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/reservation_merge_properties.rb +70 -0
  18. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/reservation_order_list.rb +98 -0
  19. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/reservation_order_response.rb +187 -0
  20. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/reservation_properties.rb +176 -0
  21. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/reservation_response.rb +137 -0
  22. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/reservation_split_properties.rb +70 -0
  23. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/sku_capability.rb +58 -0
  24. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/sku_name.rb +47 -0
  25. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/sku_restriction.rb +79 -0
  26. data/lib/2017-11-01/generated/azure_mgmt_reservations/models/split_request.rb +69 -0
  27. data/lib/2017-11-01/generated/azure_mgmt_reservations/module_definition.rb +9 -0
  28. data/lib/2017-11-01/generated/azure_mgmt_reservations/operation.rb +232 -0
  29. data/lib/2017-11-01/generated/azure_mgmt_reservations/reservation.rb +1125 -0
  30. data/lib/2017-11-01/generated/azure_mgmt_reservations/reservation_order.rb +338 -0
  31. data/lib/2017-11-01/generated/azure_mgmt_reservations/reservations_management_client.rb +339 -0
  32. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations.rb +58 -0
  33. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/applied_reservation_list.rb +66 -0
  34. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/applied_reservations.rb +85 -0
  35. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/applied_scope_type.rb +16 -0
  36. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/catalog.rb +143 -0
  37. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/error.rb +48 -0
  38. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/error_response_code.rb +69 -0
  39. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/extended_error_info.rb +84 -0
  40. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/extended_status_info.rb +61 -0
  41. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/instance_flexibility.rb +17 -0
  42. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/merge_request.rb +56 -0
  43. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/operation_display.rb +80 -0
  44. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/operation_list.rb +98 -0
  45. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/operation_response.rb +70 -0
  46. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/patch.rb +89 -0
  47. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_list.rb +98 -0
  48. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_merge_properties.rb +70 -0
  49. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_order_list.rb +98 -0
  50. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_order_response.rb +184 -0
  51. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_properties.rb +208 -0
  52. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_response.rb +120 -0
  53. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_split_properties.rb +70 -0
  54. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_status_code.rb +23 -0
  55. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reservation_term.rb +16 -0
  56. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/reserved_resource_type.rb +19 -0
  57. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/sku_name.rb +47 -0
  58. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/sku_property.rb +58 -0
  59. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/sku_restriction.rb +79 -0
  60. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/models/split_request.rb +69 -0
  61. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/module_definition.rb +9 -0
  62. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/operation.rb +232 -0
  63. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/reservation.rb +1125 -0
  64. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/reservation_order.rb +338 -0
  65. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/reservations_management_client.rb +352 -0
  66. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations.rb +76 -0
  67. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/applied_reservation_list.rb +66 -0
  68. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/applied_reservations.rb +85 -0
  69. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/applied_scope_type.rb +16 -0
  70. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/calculate_price_response.rb +48 -0
  71. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/calculate_price_response_properties.rb +130 -0
  72. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/calculate_price_response_properties_billing_currency_total.rb +59 -0
  73. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/calculate_price_response_properties_pricing_currency_total.rb +59 -0
  74. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/catalog.rb +171 -0
  75. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/error.rb +48 -0
  76. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/error_response_code.rb +69 -0
  77. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/extended_error_info.rb +84 -0
  78. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/extended_status_info.rb +61 -0
  79. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/instance_flexibility.rb +16 -0
  80. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/merge_request.rb +56 -0
  81. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/operation_display.rb +80 -0
  82. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/operation_list.rb +98 -0
  83. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/operation_response.rb +70 -0
  84. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/patch.rb +111 -0
  85. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/patch_properties_renew_properties.rb +48 -0
  86. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/payment_detail.rb +118 -0
  87. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/payment_status.rb +18 -0
  88. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/price.rb +59 -0
  89. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/properties.rb +48 -0
  90. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/purchase_request.rb +183 -0
  91. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/purchase_request_properties_reserved_resource_properties.rb +48 -0
  92. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/renew_properties_response.rb +76 -0
  93. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/renew_properties_response_billing_currency_total.rb +59 -0
  94. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/renew_properties_response_pricing_currency_total.rb +60 -0
  95. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_billing_plan.rb +16 -0
  96. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_list.rb +98 -0
  97. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_merge_properties.rb +70 -0
  98. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_order_billing_plan_information.rb +91 -0
  99. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_order_list.rb +98 -0
  100. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_order_response.rb +207 -0
  101. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_properties.rb +290 -0
  102. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_response.rb +120 -0
  103. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_split_properties.rb +70 -0
  104. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_status_code.rb +23 -0
  105. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reservation_term.rb +16 -0
  106. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/reserved_resource_type.rb +22 -0
  107. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/scope_properties.rb +58 -0
  108. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/sku_name.rb +47 -0
  109. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/sku_property.rb +58 -0
  110. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/sku_restriction.rb +79 -0
  111. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/split_request.rb +69 -0
  112. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/models/subscription_scope_properties.rb +56 -0
  113. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/module_definition.rb +9 -0
  114. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/operation.rb +232 -0
  115. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/reservation.rb +1266 -0
  116. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/reservation_order.rb +607 -0
  117. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/reservations_management_client.rb +355 -0
  118. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations.rb +54 -0
  119. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/auto_quota_increase.rb +223 -0
  120. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/actions.rb +47 -0
  121. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/aqi_settings.rb +46 -0
  122. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/auto_quota_increase_detail.rb +119 -0
  123. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/create_generic_quota_request_parameters.rb +55 -0
  124. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/current_quota_limit.rb +71 -0
  125. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/current_quota_limit_base.rb +47 -0
  126. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/email_action.rb +46 -0
  127. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/email_actions.rb +55 -0
  128. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/exception_response.rb +47 -0
  129. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/phone_action.rb +57 -0
  130. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_limits.rb +99 -0
  131. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_limits_response.rb +68 -0
  132. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_properties.rb +120 -0
  133. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_details.rb +128 -0
  134. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_details_list.rb +99 -0
  135. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_one_resource_submit_response.rb +121 -0
  136. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_properties.rb +92 -0
  137. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_submit_response.rb +83 -0
  138. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_submit_response201.rb +96 -0
  139. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/resource_name.rb +59 -0
  140. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/service_error.rb +78 -0
  141. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/service_error_detail.rb +59 -0
  142. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/sub_request.rb +118 -0
  143. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/support_request_action.rb +142 -0
  144. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/module_definition.rb +9 -0
  145. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/quota.rb +805 -0
  146. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/quota_request_status.rb +397 -0
  147. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/reservations_management_client.rb +136 -0
  148. data/lib/azure_mgmt_reservations.rb +9 -0
  149. data/lib/module_definition.rb +7 -0
  150. data/lib/profiles/latest/modules/reservations_profile_module.rb +359 -0
  151. data/lib/profiles/latest/reservations_latest_profile_client.rb +40 -0
  152. data/lib/profiles/latest/reservations_module_definition.rb +8 -0
  153. data/lib/version.rb +7 -0
  154. metadata +269 -0
@@ -0,0 +1,79 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Reservations::Mgmt::V2017_11_01
7
+ module Models
8
+ #
9
+ # Model object.
10
+ #
11
+ #
12
+ class SkuRestriction
13
+
14
+ include MsRestAzure
15
+
16
+ # @return [String] The type of restrictions.
17
+ attr_accessor :type
18
+
19
+ # @return [Array<String>] The value of restrictions. If the restriction
20
+ # type is set to location. This would be different locations where the
21
+ # SKU is restricted.
22
+ attr_accessor :values
23
+
24
+ # @return [String] The reason for restriction.
25
+ attr_accessor :reason_code
26
+
27
+
28
+ #
29
+ # Mapper for SkuRestriction class as Ruby Hash.
30
+ # This will be used for serialization/deserialization.
31
+ #
32
+ def self.mapper()
33
+ {
34
+ client_side_validation: true,
35
+ required: false,
36
+ serialized_name: 'SkuRestriction',
37
+ type: {
38
+ name: 'Composite',
39
+ class_name: 'SkuRestriction',
40
+ model_properties: {
41
+ type: {
42
+ client_side_validation: true,
43
+ required: false,
44
+ serialized_name: 'type',
45
+ type: {
46
+ name: 'String'
47
+ }
48
+ },
49
+ values: {
50
+ client_side_validation: true,
51
+ required: false,
52
+ serialized_name: 'values',
53
+ type: {
54
+ name: 'Sequence',
55
+ element: {
56
+ client_side_validation: true,
57
+ required: false,
58
+ serialized_name: 'StringElementType',
59
+ type: {
60
+ name: 'String'
61
+ }
62
+ }
63
+ }
64
+ },
65
+ reason_code: {
66
+ client_side_validation: true,
67
+ required: false,
68
+ serialized_name: 'reasonCode',
69
+ type: {
70
+ name: 'String'
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,69 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Reservations::Mgmt::V2017_11_01
7
+ module Models
8
+ #
9
+ # Model object.
10
+ #
11
+ #
12
+ class SplitRequest
13
+
14
+ include MsRestAzure
15
+
16
+ # @return [Array<Integer>] List of the quantities in the new reservations
17
+ # to create.
18
+ attr_accessor :quantities
19
+
20
+ # @return [String] Resource id of the reservation to be split. Format of
21
+ # the resource id should be
22
+ # /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}
23
+ attr_accessor :reservation_id
24
+
25
+
26
+ #
27
+ # Mapper for SplitRequest class as Ruby Hash.
28
+ # This will be used for serialization/deserialization.
29
+ #
30
+ def self.mapper()
31
+ {
32
+ client_side_validation: true,
33
+ required: false,
34
+ serialized_name: 'SplitRequest',
35
+ type: {
36
+ name: 'Composite',
37
+ class_name: 'SplitRequest',
38
+ model_properties: {
39
+ quantities: {
40
+ client_side_validation: true,
41
+ required: false,
42
+ serialized_name: 'properties.quantities',
43
+ type: {
44
+ name: 'Sequence',
45
+ element: {
46
+ client_side_validation: true,
47
+ required: false,
48
+ serialized_name: 'NumberElementType',
49
+ type: {
50
+ name: 'Number'
51
+ }
52
+ }
53
+ }
54
+ },
55
+ reservation_id: {
56
+ client_side_validation: true,
57
+ required: false,
58
+ serialized_name: 'properties.reservationId',
59
+ type: {
60
+ name: 'String'
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure end
7
+ module Azure::Reservations end
8
+ module Azure::Reservations::Mgmt end
9
+ module Azure::Reservations::Mgmt::V2017_11_01 end
@@ -0,0 +1,232 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Reservations::Mgmt::V2017_11_01
7
+ #
8
+ # This API describe Azure Reservation
9
+ #
10
+ class Operation
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Operation class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ReservationsManagementClient] reference to the ReservationsManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Get operations.
26
+ #
27
+ # List all the operations.
28
+ #
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [Array<OperationResponse>] operation results.
33
+ #
34
+ def list(custom_headers:nil)
35
+ first_page = list_as_lazy(custom_headers:custom_headers)
36
+ first_page.get_all_items
37
+ end
38
+
39
+ #
40
+ # Get operations.
41
+ #
42
+ # List all the operations.
43
+ #
44
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
45
+ # will be added to the HTTP request.
46
+ #
47
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
48
+ #
49
+ def list_with_http_info(custom_headers:nil)
50
+ list_async(custom_headers:custom_headers).value!
51
+ end
52
+
53
+ #
54
+ # Get operations.
55
+ #
56
+ # List all the operations.
57
+ #
58
+ # @param [Hash{String => String}] A hash of custom headers that will be added
59
+ # to the HTTP request.
60
+ #
61
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
62
+ #
63
+ def list_async(custom_headers:nil)
64
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
65
+
66
+
67
+ request_headers = {}
68
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
69
+
70
+ # Set Headers
71
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
72
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
73
+ path_template = 'providers/Microsoft.Capacity/operations'
74
+
75
+ request_url = @base_url || @client.base_url
76
+
77
+ options = {
78
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
79
+ query_params: {'api-version' => @client.api_version},
80
+ headers: request_headers.merge(custom_headers || {}),
81
+ base_url: request_url
82
+ }
83
+ promise = @client.make_request_async(:get, path_template, options)
84
+
85
+ promise = promise.then do |result|
86
+ http_response = result.response
87
+ status_code = http_response.status
88
+ response_content = http_response.body
89
+ unless status_code == 200
90
+ error_model = JSON.load(response_content)
91
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
92
+ end
93
+
94
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
95
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
96
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
97
+ # Deserialize Response
98
+ if status_code == 200
99
+ begin
100
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
101
+ result_mapper = Azure::Reservations::Mgmt::V2017_11_01::Models::OperationList.mapper()
102
+ result.body = @client.deserialize(result_mapper, parsed_response)
103
+ rescue Exception => e
104
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
105
+ end
106
+ end
107
+
108
+ result
109
+ end
110
+
111
+ promise.execute
112
+ end
113
+
114
+ #
115
+ # Get operations.
116
+ #
117
+ # List all the operations.
118
+ #
119
+ # @param next_page_link [String] The NextLink from the previous successful call
120
+ # to List operation.
121
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
122
+ # will be added to the HTTP request.
123
+ #
124
+ # @return [OperationList] operation results.
125
+ #
126
+ def list_next(next_page_link, custom_headers:nil)
127
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
128
+ response.body unless response.nil?
129
+ end
130
+
131
+ #
132
+ # Get operations.
133
+ #
134
+ # List all the operations.
135
+ #
136
+ # @param next_page_link [String] The NextLink from the previous successful call
137
+ # to List operation.
138
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
139
+ # will be added to the HTTP request.
140
+ #
141
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
142
+ #
143
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
144
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
145
+ end
146
+
147
+ #
148
+ # Get operations.
149
+ #
150
+ # List all the operations.
151
+ #
152
+ # @param next_page_link [String] The NextLink from the previous successful call
153
+ # to List operation.
154
+ # @param [Hash{String => String}] A hash of custom headers that will be added
155
+ # to the HTTP request.
156
+ #
157
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
158
+ #
159
+ def list_next_async(next_page_link, custom_headers:nil)
160
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
161
+
162
+
163
+ request_headers = {}
164
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
165
+
166
+ # Set Headers
167
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
168
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
169
+ path_template = '{nextLink}'
170
+
171
+ request_url = @base_url || @client.base_url
172
+
173
+ options = {
174
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
175
+ skip_encoding_path_params: {'nextLink' => next_page_link},
176
+ headers: request_headers.merge(custom_headers || {}),
177
+ base_url: request_url
178
+ }
179
+ promise = @client.make_request_async(:get, path_template, options)
180
+
181
+ promise = promise.then do |result|
182
+ http_response = result.response
183
+ status_code = http_response.status
184
+ response_content = http_response.body
185
+ unless status_code == 200
186
+ error_model = JSON.load(response_content)
187
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
188
+ end
189
+
190
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
191
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
192
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
193
+ # Deserialize Response
194
+ if status_code == 200
195
+ begin
196
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
197
+ result_mapper = Azure::Reservations::Mgmt::V2017_11_01::Models::OperationList.mapper()
198
+ result.body = @client.deserialize(result_mapper, parsed_response)
199
+ rescue Exception => e
200
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
201
+ end
202
+ end
203
+
204
+ result
205
+ end
206
+
207
+ promise.execute
208
+ end
209
+
210
+ #
211
+ # Get operations.
212
+ #
213
+ # List all the operations.
214
+ #
215
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
216
+ # will be added to the HTTP request.
217
+ #
218
+ # @return [OperationList] which provide lazy access to pages of the response.
219
+ #
220
+ def list_as_lazy(custom_headers:nil)
221
+ response = list_async(custom_headers:custom_headers).value!
222
+ unless response.nil?
223
+ page = response.body
224
+ page.next_method = Proc.new do |next_page_link|
225
+ list_next_async(next_page_link, custom_headers:custom_headers)
226
+ end
227
+ page
228
+ end
229
+ end
230
+
231
+ end
232
+ end
@@ -0,0 +1,1125 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Reservations::Mgmt::V2017_11_01
7
+ #
8
+ # This API describe Azure Reservation
9
+ #
10
+ class Reservation
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Reservation class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ReservationsManagementClient] reference to the ReservationsManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Split the `Reservation`.
26
+ #
27
+ # Split a `Reservation` into two `Reservation`s with specified quantity
28
+ # distribution.
29
+ #
30
+ #
31
+ # @param reservation_order_id [String] Order Id of the reservation
32
+ #
33
+ # @param body [SplitRequest] Information needed to Split a reservation item
34
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
+ #
37
+ # @return [Array] operation results.
38
+ #
39
+ def split(reservation_order_id, body, custom_headers:nil)
40
+ response = split_async(reservation_order_id, body, custom_headers:custom_headers).value!
41
+ response.body unless response.nil?
42
+ end
43
+
44
+ #
45
+ # @param reservation_order_id [String] Order Id of the reservation
46
+ #
47
+ # @param body [SplitRequest] Information needed to Split a reservation item
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [Concurrent::Promise] promise which provides async access to http
52
+ # response.
53
+ #
54
+ def split_async(reservation_order_id, body, custom_headers:nil)
55
+ # Send request
56
+ promise = begin_split_async(reservation_order_id, body, custom_headers:custom_headers)
57
+
58
+ promise = promise.then do |response|
59
+ # Defining deserialization method.
60
+ deserialize_method = lambda do |parsed_response|
61
+ result_mapper = {
62
+ client_side_validation: true,
63
+ required: false,
64
+ serialized_name: 'parsed_response',
65
+ type: {
66
+ name: 'Sequence',
67
+ element: {
68
+ client_side_validation: true,
69
+ required: false,
70
+ serialized_name: 'ReservationResponseElementType',
71
+ type: {
72
+ name: 'Composite',
73
+ class_name: 'ReservationResponse'
74
+ }
75
+ }
76
+ }
77
+ }
78
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
79
+ end
80
+
81
+ # Waiting for response.
82
+ @client.get_long_running_operation_result(response, deserialize_method)
83
+ end
84
+
85
+ promise
86
+ end
87
+
88
+ #
89
+ # Merges two `Reservation`s.
90
+ #
91
+ # Merge the specified `Reservation`s into a new `Reservation`. The two
92
+ # `Reservation`s being merged must have same properties.
93
+ #
94
+ # @param reservation_order_id [String] Order Id of the reservation
95
+ #
96
+ # @param body [MergeRequest] Information needed for commercial request for a
97
+ # reservation
98
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
99
+ # will be added to the HTTP request.
100
+ #
101
+ # @return [Array] operation results.
102
+ #
103
+ def merge(reservation_order_id, body, custom_headers:nil)
104
+ response = merge_async(reservation_order_id, body, custom_headers:custom_headers).value!
105
+ response.body unless response.nil?
106
+ end
107
+
108
+ #
109
+ # @param reservation_order_id [String] Order Id of the reservation
110
+ #
111
+ # @param body [MergeRequest] Information needed for commercial request for a
112
+ # reservation
113
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
114
+ # will be added to the HTTP request.
115
+ #
116
+ # @return [Concurrent::Promise] promise which provides async access to http
117
+ # response.
118
+ #
119
+ def merge_async(reservation_order_id, body, custom_headers:nil)
120
+ # Send request
121
+ promise = begin_merge_async(reservation_order_id, body, custom_headers:custom_headers)
122
+
123
+ promise = promise.then do |response|
124
+ # Defining deserialization method.
125
+ deserialize_method = lambda do |parsed_response|
126
+ result_mapper = {
127
+ client_side_validation: true,
128
+ required: false,
129
+ serialized_name: 'parsed_response',
130
+ type: {
131
+ name: 'Sequence',
132
+ element: {
133
+ client_side_validation: true,
134
+ required: false,
135
+ serialized_name: 'ReservationResponseElementType',
136
+ type: {
137
+ name: 'Composite',
138
+ class_name: 'ReservationResponse'
139
+ }
140
+ }
141
+ }
142
+ }
143
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
144
+ end
145
+
146
+ # Waiting for response.
147
+ @client.get_long_running_operation_result(response, deserialize_method)
148
+ end
149
+
150
+ promise
151
+ end
152
+
153
+ #
154
+ # Get `Reservation`s in a given reservation Order
155
+ #
156
+ # List `Reservation`s within a single `ReservationOrder`.
157
+ #
158
+ # @param reservation_order_id [String] Order Id of the reservation
159
+ #
160
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
161
+ # will be added to the HTTP request.
162
+ #
163
+ # @return [Array<ReservationResponse>] operation results.
164
+ #
165
+ def list(reservation_order_id, custom_headers:nil)
166
+ first_page = list_as_lazy(reservation_order_id, custom_headers:custom_headers)
167
+ first_page.get_all_items
168
+ end
169
+
170
+ #
171
+ # Get `Reservation`s in a given reservation Order
172
+ #
173
+ # List `Reservation`s within a single `ReservationOrder`.
174
+ #
175
+ # @param reservation_order_id [String] Order Id of the reservation
176
+ #
177
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
178
+ # will be added to the HTTP request.
179
+ #
180
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
181
+ #
182
+ def list_with_http_info(reservation_order_id, custom_headers:nil)
183
+ list_async(reservation_order_id, custom_headers:custom_headers).value!
184
+ end
185
+
186
+ #
187
+ # Get `Reservation`s in a given reservation Order
188
+ #
189
+ # List `Reservation`s within a single `ReservationOrder`.
190
+ #
191
+ # @param reservation_order_id [String] Order Id of the reservation
192
+ #
193
+ # @param [Hash{String => String}] A hash of custom headers that will be added
194
+ # to the HTTP request.
195
+ #
196
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
197
+ #
198
+ def list_async(reservation_order_id, custom_headers:nil)
199
+ fail ArgumentError, 'reservation_order_id is nil' if reservation_order_id.nil?
200
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
201
+
202
+
203
+ request_headers = {}
204
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
205
+
206
+ # Set Headers
207
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
208
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
209
+ path_template = 'providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations'
210
+
211
+ request_url = @base_url || @client.base_url
212
+
213
+ options = {
214
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
215
+ path_params: {'reservationOrderId' => reservation_order_id},
216
+ query_params: {'api-version' => @client.api_version},
217
+ headers: request_headers.merge(custom_headers || {}),
218
+ base_url: request_url
219
+ }
220
+ promise = @client.make_request_async(:get, path_template, options)
221
+
222
+ promise = promise.then do |result|
223
+ http_response = result.response
224
+ status_code = http_response.status
225
+ response_content = http_response.body
226
+ unless status_code == 200
227
+ error_model = JSON.load(response_content)
228
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
229
+ end
230
+
231
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
232
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
233
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
234
+ # Deserialize Response
235
+ if status_code == 200
236
+ begin
237
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
238
+ result_mapper = Azure::Reservations::Mgmt::V2017_11_01::Models::ReservationList.mapper()
239
+ result.body = @client.deserialize(result_mapper, parsed_response)
240
+ rescue Exception => e
241
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
242
+ end
243
+ end
244
+
245
+ result
246
+ end
247
+
248
+ promise.execute
249
+ end
250
+
251
+ #
252
+ # Get `Reservation` details.
253
+ #
254
+ # Get specific `Reservation` details.
255
+ #
256
+ # @param reservation_id [String] Id of the Reservation Item
257
+ # @param reservation_order_id [String] Order Id of the reservation
258
+ #
259
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
260
+ # will be added to the HTTP request.
261
+ #
262
+ # @return [ReservationResponse] operation results.
263
+ #
264
+ def get(reservation_id, reservation_order_id, custom_headers:nil)
265
+ response = get_async(reservation_id, reservation_order_id, custom_headers:custom_headers).value!
266
+ response.body unless response.nil?
267
+ end
268
+
269
+ #
270
+ # Get `Reservation` details.
271
+ #
272
+ # Get specific `Reservation` details.
273
+ #
274
+ # @param reservation_id [String] Id of the Reservation Item
275
+ # @param reservation_order_id [String] Order Id of the reservation
276
+ #
277
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
278
+ # will be added to the HTTP request.
279
+ #
280
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
281
+ #
282
+ def get_with_http_info(reservation_id, reservation_order_id, custom_headers:nil)
283
+ get_async(reservation_id, reservation_order_id, custom_headers:custom_headers).value!
284
+ end
285
+
286
+ #
287
+ # Get `Reservation` details.
288
+ #
289
+ # Get specific `Reservation` details.
290
+ #
291
+ # @param reservation_id [String] Id of the Reservation Item
292
+ # @param reservation_order_id [String] Order Id of the reservation
293
+ #
294
+ # @param [Hash{String => String}] A hash of custom headers that will be added
295
+ # to the HTTP request.
296
+ #
297
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
298
+ #
299
+ def get_async(reservation_id, reservation_order_id, custom_headers:nil)
300
+ fail ArgumentError, 'reservation_id is nil' if reservation_id.nil?
301
+ fail ArgumentError, 'reservation_order_id is nil' if reservation_order_id.nil?
302
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
303
+
304
+
305
+ request_headers = {}
306
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
307
+
308
+ # Set Headers
309
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
310
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
311
+ path_template = 'providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}'
312
+
313
+ request_url = @base_url || @client.base_url
314
+
315
+ options = {
316
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
317
+ path_params: {'reservationId' => reservation_id,'reservationOrderId' => reservation_order_id},
318
+ query_params: {'api-version' => @client.api_version},
319
+ headers: request_headers.merge(custom_headers || {}),
320
+ base_url: request_url
321
+ }
322
+ promise = @client.make_request_async(:get, path_template, options)
323
+
324
+ promise = promise.then do |result|
325
+ http_response = result.response
326
+ status_code = http_response.status
327
+ response_content = http_response.body
328
+ unless status_code == 200
329
+ error_model = JSON.load(response_content)
330
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
331
+ end
332
+
333
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
334
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
335
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
336
+ # Deserialize Response
337
+ if status_code == 200
338
+ begin
339
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
340
+ result_mapper = Azure::Reservations::Mgmt::V2017_11_01::Models::ReservationResponse.mapper()
341
+ result.body = @client.deserialize(result_mapper, parsed_response)
342
+ rescue Exception => e
343
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
344
+ end
345
+ end
346
+
347
+ result
348
+ end
349
+
350
+ promise.execute
351
+ end
352
+
353
+ #
354
+ # Updates a `Reservation`.
355
+ #
356
+ # Updates the applied scopes of the `Reservation`.
357
+ #
358
+ # @param reservation_order_id [String] Order Id of the reservation
359
+ #
360
+ # @param reservation_id [String] Id of the Reservation Item
361
+ # @param parameters [Patch] Information needed to patch a reservation item
362
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
363
+ # will be added to the HTTP request.
364
+ #
365
+ # @return [ReservationResponse] operation results.
366
+ #
367
+ def update(reservation_order_id, reservation_id, parameters, custom_headers:nil)
368
+ response = update_async(reservation_order_id, reservation_id, parameters, custom_headers:custom_headers).value!
369
+ response.body unless response.nil?
370
+ end
371
+
372
+ #
373
+ # @param reservation_order_id [String] Order Id of the reservation
374
+ #
375
+ # @param reservation_id [String] Id of the Reservation Item
376
+ # @param parameters [Patch] Information needed to patch a reservation item
377
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
378
+ # will be added to the HTTP request.
379
+ #
380
+ # @return [Concurrent::Promise] promise which provides async access to http
381
+ # response.
382
+ #
383
+ def update_async(reservation_order_id, reservation_id, parameters, custom_headers:nil)
384
+ # Send request
385
+ promise = begin_update_async(reservation_order_id, reservation_id, parameters, custom_headers:custom_headers)
386
+
387
+ promise = promise.then do |response|
388
+ # Defining deserialization method.
389
+ deserialize_method = lambda do |parsed_response|
390
+ result_mapper = Azure::Reservations::Mgmt::V2017_11_01::Models::ReservationResponse.mapper()
391
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
392
+ end
393
+
394
+ # Waiting for response.
395
+ @client.get_long_running_operation_result(response, deserialize_method)
396
+ end
397
+
398
+ promise
399
+ end
400
+
401
+ #
402
+ # Get `Reservation` revisions.
403
+ #
404
+ # List of all the revisions for the `Reservation`.
405
+ #
406
+ #
407
+ # @param reservation_id [String] Id of the Reservation Item
408
+ # @param reservation_order_id [String] Order Id of the reservation
409
+ #
410
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
411
+ # will be added to the HTTP request.
412
+ #
413
+ # @return [Array<ReservationResponse>] operation results.
414
+ #
415
+ def list_revisions(reservation_id, reservation_order_id, custom_headers:nil)
416
+ first_page = list_revisions_as_lazy(reservation_id, reservation_order_id, custom_headers:custom_headers)
417
+ first_page.get_all_items
418
+ end
419
+
420
+ #
421
+ # Get `Reservation` revisions.
422
+ #
423
+ # List of all the revisions for the `Reservation`.
424
+ #
425
+ #
426
+ # @param reservation_id [String] Id of the Reservation Item
427
+ # @param reservation_order_id [String] Order Id of the reservation
428
+ #
429
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
430
+ # will be added to the HTTP request.
431
+ #
432
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
433
+ #
434
+ def list_revisions_with_http_info(reservation_id, reservation_order_id, custom_headers:nil)
435
+ list_revisions_async(reservation_id, reservation_order_id, custom_headers:custom_headers).value!
436
+ end
437
+
438
+ #
439
+ # Get `Reservation` revisions.
440
+ #
441
+ # List of all the revisions for the `Reservation`.
442
+ #
443
+ #
444
+ # @param reservation_id [String] Id of the Reservation Item
445
+ # @param reservation_order_id [String] Order Id of the reservation
446
+ #
447
+ # @param [Hash{String => String}] A hash of custom headers that will be added
448
+ # to the HTTP request.
449
+ #
450
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
451
+ #
452
+ def list_revisions_async(reservation_id, reservation_order_id, custom_headers:nil)
453
+ fail ArgumentError, 'reservation_id is nil' if reservation_id.nil?
454
+ fail ArgumentError, 'reservation_order_id is nil' if reservation_order_id.nil?
455
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
456
+
457
+
458
+ request_headers = {}
459
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
460
+
461
+ # Set Headers
462
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
463
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
464
+ path_template = 'providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/revisions'
465
+
466
+ request_url = @base_url || @client.base_url
467
+
468
+ options = {
469
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
470
+ path_params: {'reservationId' => reservation_id,'reservationOrderId' => reservation_order_id},
471
+ query_params: {'api-version' => @client.api_version},
472
+ headers: request_headers.merge(custom_headers || {}),
473
+ base_url: request_url
474
+ }
475
+ promise = @client.make_request_async(:get, path_template, options)
476
+
477
+ promise = promise.then do |result|
478
+ http_response = result.response
479
+ status_code = http_response.status
480
+ response_content = http_response.body
481
+ unless status_code == 200
482
+ error_model = JSON.load(response_content)
483
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
484
+ end
485
+
486
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
487
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
488
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
489
+ # Deserialize Response
490
+ if status_code == 200
491
+ begin
492
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
493
+ result_mapper = Azure::Reservations::Mgmt::V2017_11_01::Models::ReservationList.mapper()
494
+ result.body = @client.deserialize(result_mapper, parsed_response)
495
+ rescue Exception => e
496
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
497
+ end
498
+ end
499
+
500
+ result
501
+ end
502
+
503
+ promise.execute
504
+ end
505
+
506
+ #
507
+ # Split the `Reservation`.
508
+ #
509
+ # Split a `Reservation` into two `Reservation`s with specified quantity
510
+ # distribution.
511
+ #
512
+ #
513
+ # @param reservation_order_id [String] Order Id of the reservation
514
+ #
515
+ # @param body [SplitRequest] Information needed to Split a reservation item
516
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
517
+ # will be added to the HTTP request.
518
+ #
519
+ # @return [Array] operation results.
520
+ #
521
+ def begin_split(reservation_order_id, body, custom_headers:nil)
522
+ response = begin_split_async(reservation_order_id, body, custom_headers:custom_headers).value!
523
+ response.body unless response.nil?
524
+ end
525
+
526
+ #
527
+ # Split the `Reservation`.
528
+ #
529
+ # Split a `Reservation` into two `Reservation`s with specified quantity
530
+ # distribution.
531
+ #
532
+ #
533
+ # @param reservation_order_id [String] Order Id of the reservation
534
+ #
535
+ # @param body [SplitRequest] Information needed to Split a reservation item
536
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
537
+ # will be added to the HTTP request.
538
+ #
539
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
540
+ #
541
+ def begin_split_with_http_info(reservation_order_id, body, custom_headers:nil)
542
+ begin_split_async(reservation_order_id, body, custom_headers:custom_headers).value!
543
+ end
544
+
545
+ #
546
+ # Split the `Reservation`.
547
+ #
548
+ # Split a `Reservation` into two `Reservation`s with specified quantity
549
+ # distribution.
550
+ #
551
+ #
552
+ # @param reservation_order_id [String] Order Id of the reservation
553
+ #
554
+ # @param body [SplitRequest] Information needed to Split a reservation item
555
+ # @param [Hash{String => String}] A hash of custom headers that will be added
556
+ # to the HTTP request.
557
+ #
558
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
559
+ #
560
+ def begin_split_async(reservation_order_id, body, custom_headers:nil)
561
+ fail ArgumentError, 'reservation_order_id is nil' if reservation_order_id.nil?
562
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
563
+ fail ArgumentError, 'body is nil' if body.nil?
564
+
565
+
566
+ request_headers = {}
567
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
568
+
569
+ # Set Headers
570
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
571
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
572
+
573
+ # Serialize Request
574
+ request_mapper = Azure::Reservations::Mgmt::V2017_11_01::Models::SplitRequest.mapper()
575
+ request_content = @client.serialize(request_mapper, body)
576
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
577
+
578
+ path_template = 'providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/split'
579
+
580
+ request_url = @base_url || @client.base_url
581
+
582
+ options = {
583
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
584
+ path_params: {'reservationOrderId' => reservation_order_id},
585
+ query_params: {'api-version' => @client.api_version},
586
+ body: request_content,
587
+ headers: request_headers.merge(custom_headers || {}),
588
+ base_url: request_url
589
+ }
590
+ promise = @client.make_request_async(:post, path_template, options)
591
+
592
+ promise = promise.then do |result|
593
+ http_response = result.response
594
+ status_code = http_response.status
595
+ response_content = http_response.body
596
+ unless status_code == 200 || status_code == 202
597
+ error_model = JSON.load(response_content)
598
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
599
+ end
600
+
601
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
602
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
603
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
604
+ # Deserialize Response
605
+ if status_code == 200
606
+ begin
607
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
608
+ result_mapper = {
609
+ client_side_validation: true,
610
+ required: false,
611
+ serialized_name: 'parsed_response',
612
+ type: {
613
+ name: 'Sequence',
614
+ element: {
615
+ client_side_validation: true,
616
+ required: false,
617
+ serialized_name: 'ReservationResponseElementType',
618
+ type: {
619
+ name: 'Composite',
620
+ class_name: 'ReservationResponse'
621
+ }
622
+ }
623
+ }
624
+ }
625
+ result.body = @client.deserialize(result_mapper, parsed_response)
626
+ rescue Exception => e
627
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
628
+ end
629
+ end
630
+
631
+ result
632
+ end
633
+
634
+ promise.execute
635
+ end
636
+
637
+ #
638
+ # Merges two `Reservation`s.
639
+ #
640
+ # Merge the specified `Reservation`s into a new `Reservation`. The two
641
+ # `Reservation`s being merged must have same properties.
642
+ #
643
+ # @param reservation_order_id [String] Order Id of the reservation
644
+ #
645
+ # @param body [MergeRequest] Information needed for commercial request for a
646
+ # reservation
647
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
648
+ # will be added to the HTTP request.
649
+ #
650
+ # @return [Array] operation results.
651
+ #
652
+ def begin_merge(reservation_order_id, body, custom_headers:nil)
653
+ response = begin_merge_async(reservation_order_id, body, custom_headers:custom_headers).value!
654
+ response.body unless response.nil?
655
+ end
656
+
657
+ #
658
+ # Merges two `Reservation`s.
659
+ #
660
+ # Merge the specified `Reservation`s into a new `Reservation`. The two
661
+ # `Reservation`s being merged must have same properties.
662
+ #
663
+ # @param reservation_order_id [String] Order Id of the reservation
664
+ #
665
+ # @param body [MergeRequest] Information needed for commercial request for a
666
+ # reservation
667
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
668
+ # will be added to the HTTP request.
669
+ #
670
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
671
+ #
672
+ def begin_merge_with_http_info(reservation_order_id, body, custom_headers:nil)
673
+ begin_merge_async(reservation_order_id, body, custom_headers:custom_headers).value!
674
+ end
675
+
676
+ #
677
+ # Merges two `Reservation`s.
678
+ #
679
+ # Merge the specified `Reservation`s into a new `Reservation`. The two
680
+ # `Reservation`s being merged must have same properties.
681
+ #
682
+ # @param reservation_order_id [String] Order Id of the reservation
683
+ #
684
+ # @param body [MergeRequest] Information needed for commercial request for a
685
+ # reservation
686
+ # @param [Hash{String => String}] A hash of custom headers that will be added
687
+ # to the HTTP request.
688
+ #
689
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
690
+ #
691
+ def begin_merge_async(reservation_order_id, body, custom_headers:nil)
692
+ fail ArgumentError, 'reservation_order_id is nil' if reservation_order_id.nil?
693
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
694
+ fail ArgumentError, 'body is nil' if body.nil?
695
+
696
+
697
+ request_headers = {}
698
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
699
+
700
+ # Set Headers
701
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
702
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
703
+
704
+ # Serialize Request
705
+ request_mapper = Azure::Reservations::Mgmt::V2017_11_01::Models::MergeRequest.mapper()
706
+ request_content = @client.serialize(request_mapper, body)
707
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
708
+
709
+ path_template = 'providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/merge'
710
+
711
+ request_url = @base_url || @client.base_url
712
+
713
+ options = {
714
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
715
+ path_params: {'reservationOrderId' => reservation_order_id},
716
+ query_params: {'api-version' => @client.api_version},
717
+ body: request_content,
718
+ headers: request_headers.merge(custom_headers || {}),
719
+ base_url: request_url
720
+ }
721
+ promise = @client.make_request_async(:post, path_template, options)
722
+
723
+ promise = promise.then do |result|
724
+ http_response = result.response
725
+ status_code = http_response.status
726
+ response_content = http_response.body
727
+ unless status_code == 200 || status_code == 202
728
+ error_model = JSON.load(response_content)
729
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
730
+ end
731
+
732
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
733
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
734
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
735
+ # Deserialize Response
736
+ if status_code == 200
737
+ begin
738
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
739
+ result_mapper = {
740
+ client_side_validation: true,
741
+ required: false,
742
+ serialized_name: 'parsed_response',
743
+ type: {
744
+ name: 'Sequence',
745
+ element: {
746
+ client_side_validation: true,
747
+ required: false,
748
+ serialized_name: 'ReservationResponseElementType',
749
+ type: {
750
+ name: 'Composite',
751
+ class_name: 'ReservationResponse'
752
+ }
753
+ }
754
+ }
755
+ }
756
+ result.body = @client.deserialize(result_mapper, parsed_response)
757
+ rescue Exception => e
758
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
759
+ end
760
+ end
761
+
762
+ result
763
+ end
764
+
765
+ promise.execute
766
+ end
767
+
768
+ #
769
+ # Updates a `Reservation`.
770
+ #
771
+ # Updates the applied scopes of the `Reservation`.
772
+ #
773
+ # @param reservation_order_id [String] Order Id of the reservation
774
+ #
775
+ # @param reservation_id [String] Id of the Reservation Item
776
+ # @param parameters [Patch] Information needed to patch a reservation item
777
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
778
+ # will be added to the HTTP request.
779
+ #
780
+ # @return [ReservationResponse] operation results.
781
+ #
782
+ def begin_update(reservation_order_id, reservation_id, parameters, custom_headers:nil)
783
+ response = begin_update_async(reservation_order_id, reservation_id, parameters, custom_headers:custom_headers).value!
784
+ response.body unless response.nil?
785
+ end
786
+
787
+ #
788
+ # Updates a `Reservation`.
789
+ #
790
+ # Updates the applied scopes of the `Reservation`.
791
+ #
792
+ # @param reservation_order_id [String] Order Id of the reservation
793
+ #
794
+ # @param reservation_id [String] Id of the Reservation Item
795
+ # @param parameters [Patch] Information needed to patch a reservation item
796
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
797
+ # will be added to the HTTP request.
798
+ #
799
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
800
+ #
801
+ def begin_update_with_http_info(reservation_order_id, reservation_id, parameters, custom_headers:nil)
802
+ begin_update_async(reservation_order_id, reservation_id, parameters, custom_headers:custom_headers).value!
803
+ end
804
+
805
+ #
806
+ # Updates a `Reservation`.
807
+ #
808
+ # Updates the applied scopes of the `Reservation`.
809
+ #
810
+ # @param reservation_order_id [String] Order Id of the reservation
811
+ #
812
+ # @param reservation_id [String] Id of the Reservation Item
813
+ # @param parameters [Patch] Information needed to patch a reservation item
814
+ # @param [Hash{String => String}] A hash of custom headers that will be added
815
+ # to the HTTP request.
816
+ #
817
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
818
+ #
819
+ def begin_update_async(reservation_order_id, reservation_id, parameters, custom_headers:nil)
820
+ fail ArgumentError, 'reservation_order_id is nil' if reservation_order_id.nil?
821
+ fail ArgumentError, 'reservation_id is nil' if reservation_id.nil?
822
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
823
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
824
+
825
+
826
+ request_headers = {}
827
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
828
+
829
+ # Set Headers
830
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
831
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
832
+
833
+ # Serialize Request
834
+ request_mapper = Azure::Reservations::Mgmt::V2017_11_01::Models::Patch.mapper()
835
+ request_content = @client.serialize(request_mapper, parameters)
836
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
837
+
838
+ path_template = 'providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}'
839
+
840
+ request_url = @base_url || @client.base_url
841
+
842
+ options = {
843
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
844
+ path_params: {'reservationOrderId' => reservation_order_id,'reservationId' => reservation_id},
845
+ query_params: {'api-version' => @client.api_version},
846
+ body: request_content,
847
+ headers: request_headers.merge(custom_headers || {}),
848
+ base_url: request_url
849
+ }
850
+ promise = @client.make_request_async(:patch, path_template, options)
851
+
852
+ promise = promise.then do |result|
853
+ http_response = result.response
854
+ status_code = http_response.status
855
+ response_content = http_response.body
856
+ unless status_code == 200 || status_code == 202
857
+ error_model = JSON.load(response_content)
858
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
859
+ end
860
+
861
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
862
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
863
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
864
+ # Deserialize Response
865
+ if status_code == 200
866
+ begin
867
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
868
+ result_mapper = Azure::Reservations::Mgmt::V2017_11_01::Models::ReservationResponse.mapper()
869
+ result.body = @client.deserialize(result_mapper, parsed_response)
870
+ rescue Exception => e
871
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
872
+ end
873
+ end
874
+
875
+ result
876
+ end
877
+
878
+ promise.execute
879
+ end
880
+
881
+ #
882
+ # Get `Reservation`s in a given reservation Order
883
+ #
884
+ # List `Reservation`s within a single `ReservationOrder`.
885
+ #
886
+ # @param next_page_link [String] The NextLink from the previous successful call
887
+ # to List operation.
888
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
889
+ # will be added to the HTTP request.
890
+ #
891
+ # @return [ReservationList] operation results.
892
+ #
893
+ def list_next(next_page_link, custom_headers:nil)
894
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
895
+ response.body unless response.nil?
896
+ end
897
+
898
+ #
899
+ # Get `Reservation`s in a given reservation Order
900
+ #
901
+ # List `Reservation`s within a single `ReservationOrder`.
902
+ #
903
+ # @param next_page_link [String] The NextLink from the previous successful call
904
+ # to List operation.
905
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
906
+ # will be added to the HTTP request.
907
+ #
908
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
909
+ #
910
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
911
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
912
+ end
913
+
914
+ #
915
+ # Get `Reservation`s in a given reservation Order
916
+ #
917
+ # List `Reservation`s within a single `ReservationOrder`.
918
+ #
919
+ # @param next_page_link [String] The NextLink from the previous successful call
920
+ # to List operation.
921
+ # @param [Hash{String => String}] A hash of custom headers that will be added
922
+ # to the HTTP request.
923
+ #
924
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
925
+ #
926
+ def list_next_async(next_page_link, custom_headers:nil)
927
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
928
+
929
+
930
+ request_headers = {}
931
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
932
+
933
+ # Set Headers
934
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
935
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
936
+ path_template = '{nextLink}'
937
+
938
+ request_url = @base_url || @client.base_url
939
+
940
+ options = {
941
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
942
+ skip_encoding_path_params: {'nextLink' => next_page_link},
943
+ headers: request_headers.merge(custom_headers || {}),
944
+ base_url: request_url
945
+ }
946
+ promise = @client.make_request_async(:get, path_template, options)
947
+
948
+ promise = promise.then do |result|
949
+ http_response = result.response
950
+ status_code = http_response.status
951
+ response_content = http_response.body
952
+ unless status_code == 200
953
+ error_model = JSON.load(response_content)
954
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
955
+ end
956
+
957
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
958
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
959
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
960
+ # Deserialize Response
961
+ if status_code == 200
962
+ begin
963
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
964
+ result_mapper = Azure::Reservations::Mgmt::V2017_11_01::Models::ReservationList.mapper()
965
+ result.body = @client.deserialize(result_mapper, parsed_response)
966
+ rescue Exception => e
967
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
968
+ end
969
+ end
970
+
971
+ result
972
+ end
973
+
974
+ promise.execute
975
+ end
976
+
977
+ #
978
+ # Get `Reservation` revisions.
979
+ #
980
+ # List of all the revisions for the `Reservation`.
981
+ #
982
+ #
983
+ # @param next_page_link [String] The NextLink from the previous successful call
984
+ # to List operation.
985
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
986
+ # will be added to the HTTP request.
987
+ #
988
+ # @return [ReservationList] operation results.
989
+ #
990
+ def list_revisions_next(next_page_link, custom_headers:nil)
991
+ response = list_revisions_next_async(next_page_link, custom_headers:custom_headers).value!
992
+ response.body unless response.nil?
993
+ end
994
+
995
+ #
996
+ # Get `Reservation` revisions.
997
+ #
998
+ # List of all the revisions for the `Reservation`.
999
+ #
1000
+ #
1001
+ # @param next_page_link [String] The NextLink from the previous successful call
1002
+ # to List operation.
1003
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1004
+ # will be added to the HTTP request.
1005
+ #
1006
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1007
+ #
1008
+ def list_revisions_next_with_http_info(next_page_link, custom_headers:nil)
1009
+ list_revisions_next_async(next_page_link, custom_headers:custom_headers).value!
1010
+ end
1011
+
1012
+ #
1013
+ # Get `Reservation` revisions.
1014
+ #
1015
+ # List of all the revisions for the `Reservation`.
1016
+ #
1017
+ #
1018
+ # @param next_page_link [String] The NextLink from the previous successful call
1019
+ # to List operation.
1020
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1021
+ # to the HTTP request.
1022
+ #
1023
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1024
+ #
1025
+ def list_revisions_next_async(next_page_link, custom_headers:nil)
1026
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1027
+
1028
+
1029
+ request_headers = {}
1030
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1031
+
1032
+ # Set Headers
1033
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1034
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1035
+ path_template = '{nextLink}'
1036
+
1037
+ request_url = @base_url || @client.base_url
1038
+
1039
+ options = {
1040
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1041
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1042
+ headers: request_headers.merge(custom_headers || {}),
1043
+ base_url: request_url
1044
+ }
1045
+ promise = @client.make_request_async(:get, path_template, options)
1046
+
1047
+ promise = promise.then do |result|
1048
+ http_response = result.response
1049
+ status_code = http_response.status
1050
+ response_content = http_response.body
1051
+ unless status_code == 200
1052
+ error_model = JSON.load(response_content)
1053
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1054
+ end
1055
+
1056
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1057
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1058
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1059
+ # Deserialize Response
1060
+ if status_code == 200
1061
+ begin
1062
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1063
+ result_mapper = Azure::Reservations::Mgmt::V2017_11_01::Models::ReservationList.mapper()
1064
+ result.body = @client.deserialize(result_mapper, parsed_response)
1065
+ rescue Exception => e
1066
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1067
+ end
1068
+ end
1069
+
1070
+ result
1071
+ end
1072
+
1073
+ promise.execute
1074
+ end
1075
+
1076
+ #
1077
+ # Get `Reservation`s in a given reservation Order
1078
+ #
1079
+ # List `Reservation`s within a single `ReservationOrder`.
1080
+ #
1081
+ # @param reservation_order_id [String] Order Id of the reservation
1082
+ #
1083
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1084
+ # will be added to the HTTP request.
1085
+ #
1086
+ # @return [ReservationList] which provide lazy access to pages of the response.
1087
+ #
1088
+ def list_as_lazy(reservation_order_id, custom_headers:nil)
1089
+ response = list_async(reservation_order_id, custom_headers:custom_headers).value!
1090
+ unless response.nil?
1091
+ page = response.body
1092
+ page.next_method = Proc.new do |next_page_link|
1093
+ list_next_async(next_page_link, custom_headers:custom_headers)
1094
+ end
1095
+ page
1096
+ end
1097
+ end
1098
+
1099
+ #
1100
+ # Get `Reservation` revisions.
1101
+ #
1102
+ # List of all the revisions for the `Reservation`.
1103
+ #
1104
+ #
1105
+ # @param reservation_id [String] Id of the Reservation Item
1106
+ # @param reservation_order_id [String] Order Id of the reservation
1107
+ #
1108
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1109
+ # will be added to the HTTP request.
1110
+ #
1111
+ # @return [ReservationList] which provide lazy access to pages of the response.
1112
+ #
1113
+ def list_revisions_as_lazy(reservation_id, reservation_order_id, custom_headers:nil)
1114
+ response = list_revisions_async(reservation_id, reservation_order_id, custom_headers:custom_headers).value!
1115
+ unless response.nil?
1116
+ page = response.body
1117
+ page.next_method = Proc.new do |next_page_link|
1118
+ list_revisions_next_async(next_page_link, custom_headers:custom_headers)
1119
+ end
1120
+ page
1121
+ end
1122
+ end
1123
+
1124
+ end
1125
+ end