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