azure_mgmt_edgegateway 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2019-03-01/generated/azure_mgmt_edgegateway.rb +137 -0
  4. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/alerts.rb +322 -0
  5. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/bandwidth_schedules.rb +611 -0
  6. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/data_box_edge_management_client.rb +175 -0
  7. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/devices.rb +1879 -0
  8. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/jobs.rb +121 -0
  9. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/account_type.rb +16 -0
  10. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/address.rb +112 -0
  11. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/alert.rb +156 -0
  12. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/alert_error_details.rb +71 -0
  13. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/alert_list.rb +100 -0
  14. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/alert_severity.rb +17 -0
  15. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/armbase_model.rb +71 -0
  16. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/asymmetric_encrypted_secret.rb +70 -0
  17. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/authentication.rb +47 -0
  18. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/authentication_type.rb +16 -0
  19. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/azure_container_data_format.rb +17 -0
  20. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/azure_container_info.rb +72 -0
  21. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/bandwidth_schedule.rb +115 -0
  22. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/bandwidth_schedules_list.rb +100 -0
  23. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/client_access_right.rb +59 -0
  24. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/client_permission_type.rb +17 -0
  25. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/contact_details.rb +87 -0
  26. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/data_box_edge_device.rb +287 -0
  27. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/data_box_edge_device_extended_info.rb +108 -0
  28. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/data_box_edge_device_list.rb +101 -0
  29. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/data_box_edge_device_patch.rb +55 -0
  30. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/data_box_edge_device_status.rb +20 -0
  31. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/data_policy.rb +16 -0
  32. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/day_of_week.rb +21 -0
  33. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/device_type.rb +15 -0
  34. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/download_phase.rb +18 -0
  35. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/encryption_algorithm.rb +17 -0
  36. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/file_event_trigger.rb +115 -0
  37. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/file_source_info.rb +46 -0
  38. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/install_reboot_behavior.rb +17 -0
  39. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/io_tdevice_info.rb +69 -0
  40. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/io_trole.rb +147 -0
  41. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/ipv4config.rb +71 -0
  42. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/ipv6config.rb +71 -0
  43. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/job.rb +242 -0
  44. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/job_error_details.rb +80 -0
  45. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/job_error_item.rb +79 -0
  46. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/job_status.rb +21 -0
  47. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/job_type.rb +19 -0
  48. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/metric_aggregation_type.rb +21 -0
  49. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/metric_category.rb +16 -0
  50. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/metric_dimension_v1.rb +68 -0
  51. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/metric_specification_v1.rb +187 -0
  52. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/metric_unit.rb +22 -0
  53. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/monitoring_status.rb +16 -0
  54. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/mount_point_map.rb +83 -0
  55. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/network_adapter.rb +229 -0
  56. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/network_adapter_dhcpstatus.rb +16 -0
  57. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/network_adapter_position.rb +60 -0
  58. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/network_adapter_rdmastatus.rb +16 -0
  59. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/network_adapter_status.rb +16 -0
  60. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/network_group.rb +17 -0
  61. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/network_settings.rb +83 -0
  62. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/operation.rb +81 -0
  63. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/operation_display.rb +80 -0
  64. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/operations_list.rb +99 -0
  65. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/order.rb +177 -0
  66. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/order_list.rb +100 -0
  67. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/order_state.rb +28 -0
  68. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/order_status.rb +74 -0
  69. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/periodic_timer_event_trigger.rb +115 -0
  70. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/periodic_timer_source_info.rb +71 -0
  71. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/platform_type.rb +16 -0
  72. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/refresh_details.rb +87 -0
  73. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/role.rb +71 -0
  74. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/role_list.rb +102 -0
  75. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/role_sink_info.rb +46 -0
  76. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/role_status.rb +16 -0
  77. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/role_types.rb +18 -0
  78. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/security_settings.rb +78 -0
  79. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/service_specification.rb +56 -0
  80. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/share.rb +208 -0
  81. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/share_access_protocol.rb +16 -0
  82. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/share_access_right.rb +59 -0
  83. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/share_access_type.rb +17 -0
  84. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/share_list.rb +100 -0
  85. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/share_status.rb +16 -0
  86. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/sku.rb +58 -0
  87. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/sku_name.rb +16 -0
  88. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/sku_tier.rb +15 -0
  89. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/sslstatus.rb +16 -0
  90. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/storage_account_credential.rb +143 -0
  91. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/storage_account_credential_list.rb +100 -0
  92. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/symmetric_key.rb +48 -0
  93. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/time_grain.rb +22 -0
  94. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/tracking_info.rb +79 -0
  95. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/trigger.rb +71 -0
  96. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/trigger_list.rb +102 -0
  97. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/update_download_progress.rb +108 -0
  98. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/update_install_progress.rb +71 -0
  99. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/update_operation.rb +18 -0
  100. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/update_operation_stage.rb +31 -0
  101. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/update_summary.rb +281 -0
  102. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/upload_certificate_request.rb +58 -0
  103. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/upload_certificate_response.rb +113 -0
  104. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/user.rb +96 -0
  105. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/user_access_right.rb +59 -0
  106. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/models/user_list.rb +100 -0
  107. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/module_definition.rb +9 -0
  108. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/operations.rb +214 -0
  109. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/operations_status.rb +121 -0
  110. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/orders.rb +584 -0
  111. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/roles.rb +600 -0
  112. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/shares.rb +725 -0
  113. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/storage_account_credentials.rb +606 -0
  114. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/triggers.rb +600 -0
  115. data/lib/2019-03-01/generated/azure_mgmt_edgegateway/users.rb +604 -0
  116. data/lib/azure_mgmt_edgegateway.rb +6 -0
  117. data/lib/module_definition.rb +8 -0
  118. data/lib/profiles/latest/edgegateway_latest_profile_client.rb +40 -0
  119. data/lib/profiles/latest/edgegateway_module_definition.rb +8 -0
  120. data/lib/profiles/latest/modules/edgegateway_profile_module.rb +475 -0
  121. data/lib/version.rb +7 -0
  122. metadata +238 -0
@@ -0,0 +1,600 @@
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::EdgeGateway::Mgmt::V2019_03_01
7
+ #
8
+ # Triggers
9
+ #
10
+ class Triggers
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Triggers class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [DataBoxEdgeManagementClient] reference to the DataBoxEdgeManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Lists all the triggers configured in the device.
26
+ #
27
+ # @param device_name [String] The device name.
28
+ # @param resource_group_name [String] The resource group name.
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<Trigger>] operation results.
33
+ #
34
+ def list_by_data_box_edge_device(device_name, resource_group_name, custom_headers:nil)
35
+ first_page = list_by_data_box_edge_device_as_lazy(device_name, resource_group_name, custom_headers:custom_headers)
36
+ first_page.get_all_items
37
+ end
38
+
39
+ #
40
+ # Lists all the triggers configured in the device.
41
+ #
42
+ # @param device_name [String] The device name.
43
+ # @param resource_group_name [String] The resource group name.
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_by_data_box_edge_device_with_http_info(device_name, resource_group_name, custom_headers:nil)
50
+ list_by_data_box_edge_device_async(device_name, resource_group_name, custom_headers:custom_headers).value!
51
+ end
52
+
53
+ #
54
+ # Lists all the triggers configured in the device.
55
+ #
56
+ # @param device_name [String] The device name.
57
+ # @param resource_group_name [String] The resource group name.
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_by_data_box_edge_device_async(device_name, resource_group_name, custom_headers:nil)
64
+ fail ArgumentError, 'device_name is nil' if device_name.nil?
65
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
66
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
67
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
68
+
69
+
70
+ request_headers = {}
71
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
72
+
73
+ # Set Headers
74
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
75
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
76
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers'
77
+
78
+ request_url = @base_url || @client.base_url
79
+
80
+ options = {
81
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
82
+ path_params: {'deviceName' => device_name,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
83
+ query_params: {'api-version' => @client.api_version},
84
+ headers: request_headers.merge(custom_headers || {}),
85
+ base_url: request_url
86
+ }
87
+ promise = @client.make_request_async(:get, path_template, options)
88
+
89
+ promise = promise.then do |result|
90
+ http_response = result.response
91
+ status_code = http_response.status
92
+ response_content = http_response.body
93
+ unless status_code == 200
94
+ error_model = JSON.load(response_content)
95
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
96
+ end
97
+
98
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
99
+ # Deserialize Response
100
+ if status_code == 200
101
+ begin
102
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
103
+ result_mapper = Azure::EdgeGateway::Mgmt::V2019_03_01::Models::TriggerList.mapper()
104
+ result.body = @client.deserialize(result_mapper, parsed_response)
105
+ rescue Exception => e
106
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
107
+ end
108
+ end
109
+
110
+ result
111
+ end
112
+
113
+ promise.execute
114
+ end
115
+
116
+ #
117
+ # Get a specific trigger by name.
118
+ #
119
+ # @param device_name [String] The device name.
120
+ # @param name [String] The trigger name.
121
+ # @param resource_group_name [String] The resource group name.
122
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
123
+ # will be added to the HTTP request.
124
+ #
125
+ # @return [Trigger] operation results.
126
+ #
127
+ def get(device_name, name, resource_group_name, custom_headers:nil)
128
+ response = get_async(device_name, name, resource_group_name, custom_headers:custom_headers).value!
129
+ response.body unless response.nil?
130
+ end
131
+
132
+ #
133
+ # Get a specific trigger by name.
134
+ #
135
+ # @param device_name [String] The device name.
136
+ # @param name [String] The trigger name.
137
+ # @param resource_group_name [String] The resource group name.
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 get_with_http_info(device_name, name, resource_group_name, custom_headers:nil)
144
+ get_async(device_name, name, resource_group_name, custom_headers:custom_headers).value!
145
+ end
146
+
147
+ #
148
+ # Get a specific trigger by name.
149
+ #
150
+ # @param device_name [String] The device name.
151
+ # @param name [String] The trigger name.
152
+ # @param resource_group_name [String] The resource group name.
153
+ # @param [Hash{String => String}] A hash of custom headers that will be added
154
+ # to the HTTP request.
155
+ #
156
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
157
+ #
158
+ def get_async(device_name, name, resource_group_name, custom_headers:nil)
159
+ fail ArgumentError, 'device_name is nil' if device_name.nil?
160
+ fail ArgumentError, 'name is nil' if name.nil?
161
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
162
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
163
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
164
+
165
+
166
+ request_headers = {}
167
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
168
+
169
+ # Set Headers
170
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
171
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
172
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'
173
+
174
+ request_url = @base_url || @client.base_url
175
+
176
+ options = {
177
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
178
+ path_params: {'deviceName' => device_name,'name' => name,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
179
+ query_params: {'api-version' => @client.api_version},
180
+ headers: request_headers.merge(custom_headers || {}),
181
+ base_url: request_url
182
+ }
183
+ promise = @client.make_request_async(:get, path_template, options)
184
+
185
+ promise = promise.then do |result|
186
+ http_response = result.response
187
+ status_code = http_response.status
188
+ response_content = http_response.body
189
+ unless status_code == 200
190
+ error_model = JSON.load(response_content)
191
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
192
+ end
193
+
194
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
195
+ # Deserialize Response
196
+ if status_code == 200
197
+ begin
198
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
199
+ result_mapper = Azure::EdgeGateway::Mgmt::V2019_03_01::Models::Trigger.mapper()
200
+ result.body = @client.deserialize(result_mapper, parsed_response)
201
+ rescue Exception => e
202
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
203
+ end
204
+ end
205
+
206
+ result
207
+ end
208
+
209
+ promise.execute
210
+ end
211
+
212
+ #
213
+ # Creates or updates a trigger.
214
+ #
215
+ # @param device_name [String] Creates or updates a trigger
216
+ # @param name [String] The trigger name.
217
+ # @param trigger [Trigger] The trigger.
218
+ # @param resource_group_name [String] The resource group name.
219
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
220
+ # will be added to the HTTP request.
221
+ #
222
+ # @return [Trigger] operation results.
223
+ #
224
+ def create_or_update(device_name, name, trigger, resource_group_name, custom_headers:nil)
225
+ response = create_or_update_async(device_name, name, trigger, resource_group_name, custom_headers:custom_headers).value!
226
+ response.body unless response.nil?
227
+ end
228
+
229
+ #
230
+ # @param device_name [String] Creates or updates a trigger
231
+ # @param name [String] The trigger name.
232
+ # @param trigger [Trigger] The trigger.
233
+ # @param resource_group_name [String] The resource group name.
234
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
235
+ # will be added to the HTTP request.
236
+ #
237
+ # @return [Concurrent::Promise] promise which provides async access to http
238
+ # response.
239
+ #
240
+ def create_or_update_async(device_name, name, trigger, resource_group_name, custom_headers:nil)
241
+ # Send request
242
+ promise = begin_create_or_update_async(device_name, name, trigger, resource_group_name, custom_headers:custom_headers)
243
+
244
+ promise = promise.then do |response|
245
+ # Defining deserialization method.
246
+ deserialize_method = lambda do |parsed_response|
247
+ result_mapper = Azure::EdgeGateway::Mgmt::V2019_03_01::Models::Trigger.mapper()
248
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
249
+ end
250
+
251
+ # Waiting for response.
252
+ @client.get_long_running_operation_result(response, deserialize_method)
253
+ end
254
+
255
+ promise
256
+ end
257
+
258
+ #
259
+ # Deletes the trigger on the gateway device.
260
+ #
261
+ # @param device_name [String] The device name.
262
+ # @param name [String] The trigger name.
263
+ # @param resource_group_name [String] The resource group name.
264
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
265
+ # will be added to the HTTP request.
266
+ #
267
+ def delete(device_name, name, resource_group_name, custom_headers:nil)
268
+ response = delete_async(device_name, name, resource_group_name, custom_headers:custom_headers).value!
269
+ nil
270
+ end
271
+
272
+ #
273
+ # @param device_name [String] The device name.
274
+ # @param name [String] The trigger name.
275
+ # @param resource_group_name [String] The resource group name.
276
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
277
+ # will be added to the HTTP request.
278
+ #
279
+ # @return [Concurrent::Promise] promise which provides async access to http
280
+ # response.
281
+ #
282
+ def delete_async(device_name, name, resource_group_name, custom_headers:nil)
283
+ # Send request
284
+ promise = begin_delete_async(device_name, name, resource_group_name, custom_headers:custom_headers)
285
+
286
+ promise = promise.then do |response|
287
+ # Defining deserialization method.
288
+ deserialize_method = lambda do |parsed_response|
289
+ end
290
+
291
+ # Waiting for response.
292
+ @client.get_long_running_operation_result(response, deserialize_method)
293
+ end
294
+
295
+ promise
296
+ end
297
+
298
+ #
299
+ # Creates or updates a trigger.
300
+ #
301
+ # @param device_name [String] Creates or updates a trigger
302
+ # @param name [String] The trigger name.
303
+ # @param trigger [Trigger] The trigger.
304
+ # @param resource_group_name [String] The resource group name.
305
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
306
+ # will be added to the HTTP request.
307
+ #
308
+ # @return [Trigger] operation results.
309
+ #
310
+ def begin_create_or_update(device_name, name, trigger, resource_group_name, custom_headers:nil)
311
+ response = begin_create_or_update_async(device_name, name, trigger, resource_group_name, custom_headers:custom_headers).value!
312
+ response.body unless response.nil?
313
+ end
314
+
315
+ #
316
+ # Creates or updates a trigger.
317
+ #
318
+ # @param device_name [String] Creates or updates a trigger
319
+ # @param name [String] The trigger name.
320
+ # @param trigger [Trigger] The trigger.
321
+ # @param resource_group_name [String] The resource group name.
322
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
323
+ # will be added to the HTTP request.
324
+ #
325
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
326
+ #
327
+ def begin_create_or_update_with_http_info(device_name, name, trigger, resource_group_name, custom_headers:nil)
328
+ begin_create_or_update_async(device_name, name, trigger, resource_group_name, custom_headers:custom_headers).value!
329
+ end
330
+
331
+ #
332
+ # Creates or updates a trigger.
333
+ #
334
+ # @param device_name [String] Creates or updates a trigger
335
+ # @param name [String] The trigger name.
336
+ # @param trigger [Trigger] The trigger.
337
+ # @param resource_group_name [String] The resource group name.
338
+ # @param [Hash{String => String}] A hash of custom headers that will be added
339
+ # to the HTTP request.
340
+ #
341
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
342
+ #
343
+ def begin_create_or_update_async(device_name, name, trigger, resource_group_name, custom_headers:nil)
344
+ fail ArgumentError, 'device_name is nil' if device_name.nil?
345
+ fail ArgumentError, 'name is nil' if name.nil?
346
+ fail ArgumentError, 'trigger is nil' if trigger.nil?
347
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
348
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
349
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
350
+
351
+
352
+ request_headers = {}
353
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
354
+
355
+ # Set Headers
356
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
357
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
358
+
359
+ # Serialize Request
360
+ request_mapper = Azure::EdgeGateway::Mgmt::V2019_03_01::Models::Trigger.mapper()
361
+ request_content = @client.serialize(request_mapper, trigger)
362
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
363
+
364
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'
365
+
366
+ request_url = @base_url || @client.base_url
367
+
368
+ options = {
369
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
370
+ path_params: {'deviceName' => device_name,'name' => name,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
371
+ query_params: {'api-version' => @client.api_version},
372
+ body: request_content,
373
+ headers: request_headers.merge(custom_headers || {}),
374
+ base_url: request_url
375
+ }
376
+ promise = @client.make_request_async(:put, path_template, options)
377
+
378
+ promise = promise.then do |result|
379
+ http_response = result.response
380
+ status_code = http_response.status
381
+ response_content = http_response.body
382
+ unless status_code == 200 || status_code == 202
383
+ error_model = JSON.load(response_content)
384
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
385
+ end
386
+
387
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
388
+ # Deserialize Response
389
+ if status_code == 200
390
+ begin
391
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
392
+ result_mapper = Azure::EdgeGateway::Mgmt::V2019_03_01::Models::Trigger.mapper()
393
+ result.body = @client.deserialize(result_mapper, parsed_response)
394
+ rescue Exception => e
395
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
396
+ end
397
+ end
398
+
399
+ result
400
+ end
401
+
402
+ promise.execute
403
+ end
404
+
405
+ #
406
+ # Deletes the trigger on the gateway device.
407
+ #
408
+ # @param device_name [String] The device name.
409
+ # @param name [String] The trigger name.
410
+ # @param resource_group_name [String] The resource group name.
411
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
412
+ # will be added to the HTTP request.
413
+ #
414
+ #
415
+ def begin_delete(device_name, name, resource_group_name, custom_headers:nil)
416
+ response = begin_delete_async(device_name, name, resource_group_name, custom_headers:custom_headers).value!
417
+ nil
418
+ end
419
+
420
+ #
421
+ # Deletes the trigger on the gateway device.
422
+ #
423
+ # @param device_name [String] The device name.
424
+ # @param name [String] The trigger name.
425
+ # @param resource_group_name [String] The resource group name.
426
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
427
+ # will be added to the HTTP request.
428
+ #
429
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
430
+ #
431
+ def begin_delete_with_http_info(device_name, name, resource_group_name, custom_headers:nil)
432
+ begin_delete_async(device_name, name, resource_group_name, custom_headers:custom_headers).value!
433
+ end
434
+
435
+ #
436
+ # Deletes the trigger on the gateway device.
437
+ #
438
+ # @param device_name [String] The device name.
439
+ # @param name [String] The trigger name.
440
+ # @param resource_group_name [String] The resource group name.
441
+ # @param [Hash{String => String}] A hash of custom headers that will be added
442
+ # to the HTTP request.
443
+ #
444
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
445
+ #
446
+ def begin_delete_async(device_name, name, resource_group_name, custom_headers:nil)
447
+ fail ArgumentError, 'device_name is nil' if device_name.nil?
448
+ fail ArgumentError, 'name is nil' if name.nil?
449
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
450
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
451
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
452
+
453
+
454
+ request_headers = {}
455
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
456
+
457
+ # Set Headers
458
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
459
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
460
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}'
461
+
462
+ request_url = @base_url || @client.base_url
463
+
464
+ options = {
465
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
466
+ path_params: {'deviceName' => device_name,'name' => name,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
467
+ query_params: {'api-version' => @client.api_version},
468
+ headers: request_headers.merge(custom_headers || {}),
469
+ base_url: request_url
470
+ }
471
+ promise = @client.make_request_async(:delete, path_template, options)
472
+
473
+ promise = promise.then do |result|
474
+ http_response = result.response
475
+ status_code = http_response.status
476
+ response_content = http_response.body
477
+ unless status_code == 200 || status_code == 202 || status_code == 204
478
+ error_model = JSON.load(response_content)
479
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
480
+ end
481
+
482
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
483
+
484
+ result
485
+ end
486
+
487
+ promise.execute
488
+ end
489
+
490
+ #
491
+ # Lists all the triggers configured in the device.
492
+ #
493
+ # @param next_page_link [String] The NextLink from the previous successful call
494
+ # to List operation.
495
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
496
+ # will be added to the HTTP request.
497
+ #
498
+ # @return [TriggerList] operation results.
499
+ #
500
+ def list_by_data_box_edge_device_next(next_page_link, custom_headers:nil)
501
+ response = list_by_data_box_edge_device_next_async(next_page_link, custom_headers:custom_headers).value!
502
+ response.body unless response.nil?
503
+ end
504
+
505
+ #
506
+ # Lists all the triggers configured in the device.
507
+ #
508
+ # @param next_page_link [String] The NextLink from the previous successful call
509
+ # to List operation.
510
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
511
+ # will be added to the HTTP request.
512
+ #
513
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
514
+ #
515
+ def list_by_data_box_edge_device_next_with_http_info(next_page_link, custom_headers:nil)
516
+ list_by_data_box_edge_device_next_async(next_page_link, custom_headers:custom_headers).value!
517
+ end
518
+
519
+ #
520
+ # Lists all the triggers configured in the device.
521
+ #
522
+ # @param next_page_link [String] The NextLink from the previous successful call
523
+ # to List operation.
524
+ # @param [Hash{String => String}] A hash of custom headers that will be added
525
+ # to the HTTP request.
526
+ #
527
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
528
+ #
529
+ def list_by_data_box_edge_device_next_async(next_page_link, custom_headers:nil)
530
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
531
+
532
+
533
+ request_headers = {}
534
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
535
+
536
+ # Set Headers
537
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
538
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
539
+ path_template = '{nextLink}'
540
+
541
+ request_url = @base_url || @client.base_url
542
+
543
+ options = {
544
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
545
+ skip_encoding_path_params: {'nextLink' => next_page_link},
546
+ headers: request_headers.merge(custom_headers || {}),
547
+ base_url: request_url
548
+ }
549
+ promise = @client.make_request_async(:get, path_template, options)
550
+
551
+ promise = promise.then do |result|
552
+ http_response = result.response
553
+ status_code = http_response.status
554
+ response_content = http_response.body
555
+ unless status_code == 200
556
+ error_model = JSON.load(response_content)
557
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
558
+ end
559
+
560
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
561
+ # Deserialize Response
562
+ if status_code == 200
563
+ begin
564
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
565
+ result_mapper = Azure::EdgeGateway::Mgmt::V2019_03_01::Models::TriggerList.mapper()
566
+ result.body = @client.deserialize(result_mapper, parsed_response)
567
+ rescue Exception => e
568
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
569
+ end
570
+ end
571
+
572
+ result
573
+ end
574
+
575
+ promise.execute
576
+ end
577
+
578
+ #
579
+ # Lists all the triggers configured in the device.
580
+ #
581
+ # @param device_name [String] The device name.
582
+ # @param resource_group_name [String] The resource group name.
583
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
584
+ # will be added to the HTTP request.
585
+ #
586
+ # @return [TriggerList] which provide lazy access to pages of the response.
587
+ #
588
+ def list_by_data_box_edge_device_as_lazy(device_name, resource_group_name, custom_headers:nil)
589
+ response = list_by_data_box_edge_device_async(device_name, resource_group_name, custom_headers:custom_headers).value!
590
+ unless response.nil?
591
+ page = response.body
592
+ page.next_method = Proc.new do |next_page_link|
593
+ list_by_data_box_edge_device_next_async(next_page_link, custom_headers:custom_headers)
594
+ end
595
+ page
596
+ end
597
+ end
598
+
599
+ end
600
+ end