azure_mgmt_iot_hub 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2016-02-03/generated/azure_mgmt_iot_hub/iot_hub_client.rb +7 -6
  3. data/lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_client.rb +7 -6
  4. data/lib/2017-07-01/generated/azure_mgmt_iot_hub/iot_hub_client.rb +7 -6
  5. data/lib/2018-01-22/generated/azure_mgmt_iot_hub.rb +89 -0
  6. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/certificates.rb +711 -0
  7. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_client.rb +139 -0
  8. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb +3242 -0
  9. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/access_rights.rb +29 -0
  10. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/capabilities.rb +16 -0
  11. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/certificate_body_description.rb +47 -0
  12. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/certificate_description.rb +95 -0
  13. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/certificate_list_description.rb +56 -0
  14. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/certificate_properties.rb +107 -0
  15. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/certificate_properties_with_nonce.rb +121 -0
  16. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/certificate_verification_description.rb +47 -0
  17. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/certificate_with_nonce_description.rb +95 -0
  18. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/cloud_to_device_properties.rb +77 -0
  19. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/error_details.rb +83 -0
  20. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/event_hub_consumer_group_info.rb +102 -0
  21. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/event_hub_consumer_groups_list_result.rb +101 -0
  22. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/event_hub_properties.rb +107 -0
  23. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/export_devices_request.rb +59 -0
  24. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/fallback_route_properties.rb +114 -0
  25. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/feedback_properties.rb +77 -0
  26. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/import_devices_request.rb +58 -0
  27. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_capacity.rb +89 -0
  28. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_description.rb +126 -0
  29. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_description_list_result.rb +100 -0
  30. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_name_availability_info.rb +73 -0
  31. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_name_unavailability_reason.rb +16 -0
  32. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_properties.rb +252 -0
  33. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_quota_metric_info.rb +71 -0
  34. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_quota_metric_info_list_result.rb +101 -0
  35. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_scale_type.rb +17 -0
  36. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_sku.rb +18 -0
  37. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_sku_description.rb +71 -0
  38. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_sku_description_list_result.rb +101 -0
  39. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_sku_info.rb +73 -0
  40. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_sku_tier.rb +16 -0
  41. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/ip_filter_action_type.rb +16 -0
  42. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/ip_filter_rule.rb +71 -0
  43. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/job_response.rb +137 -0
  44. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/job_response_list_result.rb +99 -0
  45. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/job_status.rb +20 -0
  46. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/job_type.rb +24 -0
  47. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/messaging_endpoint_properties.rb +77 -0
  48. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/operation.rb +60 -0
  49. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/operation_display.rb +71 -0
  50. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/operation_inputs.rb +46 -0
  51. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/operation_list_result.rb +103 -0
  52. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/operation_monitoring_level.rb +18 -0
  53. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/operations_monitoring_properties.rb +58 -0
  54. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/registry_statistics.rb +73 -0
  55. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/resource.rb +104 -0
  56. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/route_properties.rb +116 -0
  57. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/routing_endpoints.rb +126 -0
  58. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/routing_event_hub_properties.rb +87 -0
  59. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/routing_properties.rb +88 -0
  60. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/routing_service_bus_queue_endpoint_properties.rb +90 -0
  61. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/routing_service_bus_topic_endpoint_properties.rb +90 -0
  62. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/routing_source.rb +18 -0
  63. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/routing_storage_container_properties.rb +156 -0
  64. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule.rb +89 -0
  65. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule_list_result.rb +103 -0
  66. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/storage_endpoint_properties.rb +73 -0
  67. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/tags_resource.rb +55 -0
  68. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/module_definition.rb +9 -0
  69. data/lib/2018-01-22/generated/azure_mgmt_iot_hub/operations.rb +215 -0
  70. data/lib/2018-04-01/generated/azure_mgmt_iot_hub.rb +108 -0
  71. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/certificates.rb +711 -0
  72. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/iot_hub_client.rb +143 -0
  73. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/iot_hub_resource.rb +3676 -0
  74. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/access_rights.rb +29 -0
  75. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/capabilities.rb +16 -0
  76. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/certificate_body_description.rb +47 -0
  77. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/certificate_description.rb +95 -0
  78. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/certificate_list_description.rb +56 -0
  79. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/certificate_properties.rb +118 -0
  80. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/certificate_properties_with_nonce.rb +133 -0
  81. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/certificate_verification_description.rb +47 -0
  82. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/certificate_with_nonce_description.rb +95 -0
  83. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/cloud_to_device_properties.rb +77 -0
  84. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/endpoint_health_data.rb +58 -0
  85. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/endpoint_health_data_list_result.rb +100 -0
  86. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/endpoint_health_status.rb +18 -0
  87. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/error_details.rb +83 -0
  88. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/event_hub_consumer_group_info.rb +102 -0
  89. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/event_hub_consumer_groups_list_result.rb +101 -0
  90. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/event_hub_properties.rb +107 -0
  91. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/export_devices_request.rb +59 -0
  92. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/fallback_route_properties.rb +114 -0
  93. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/feedback_properties.rb +77 -0
  94. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/import_devices_request.rb +58 -0
  95. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_capacity.rb +89 -0
  96. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_description.rb +126 -0
  97. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_description_list_result.rb +100 -0
  98. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_name_availability_info.rb +73 -0
  99. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_name_unavailability_reason.rb +16 -0
  100. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_properties.rb +252 -0
  101. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_quota_metric_info.rb +71 -0
  102. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_quota_metric_info_list_result.rb +101 -0
  103. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_scale_type.rb +17 -0
  104. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_sku.rb +21 -0
  105. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_sku_description.rb +71 -0
  106. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_sku_description_list_result.rb +101 -0
  107. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_sku_info.rb +73 -0
  108. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_sku_tier.rb +17 -0
  109. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/ip_filter_action_type.rb +16 -0
  110. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/ip_filter_rule.rb +71 -0
  111. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/job_response.rb +137 -0
  112. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/job_response_list_result.rb +99 -0
  113. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/job_status.rb +20 -0
  114. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/job_type.rb +24 -0
  115. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/matched_route.rb +47 -0
  116. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/messaging_endpoint_properties.rb +77 -0
  117. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/name.rb +57 -0
  118. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/operation.rb +60 -0
  119. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/operation_display.rb +71 -0
  120. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/operation_inputs.rb +46 -0
  121. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/operation_list_result.rb +103 -0
  122. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/operation_monitoring_level.rb +18 -0
  123. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/operations_monitoring_properties.rb +58 -0
  124. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/registry_statistics.rb +73 -0
  125. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/resource.rb +104 -0
  126. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/route_compilation_error.rb +70 -0
  127. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/route_error_position.rb +57 -0
  128. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/route_error_range.rb +59 -0
  129. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/route_error_severity.rb +16 -0
  130. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/route_properties.rb +116 -0
  131. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/routing_endpoints.rb +126 -0
  132. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/routing_event_hub_properties.rb +87 -0
  133. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/routing_message.rb +84 -0
  134. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/routing_properties.rb +88 -0
  135. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/routing_service_bus_queue_endpoint_properties.rb +90 -0
  136. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/routing_service_bus_topic_endpoint_properties.rb +90 -0
  137. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/routing_source.rb +19 -0
  138. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/routing_storage_container_properties.rb +156 -0
  139. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule.rb +89 -0
  140. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule_list_result.rb +103 -0
  141. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/storage_endpoint_properties.rb +73 -0
  142. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/tags_resource.rb +55 -0
  143. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/test_all_routes_input.rb +60 -0
  144. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/test_all_routes_result.rb +55 -0
  145. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/test_result_status.rb +17 -0
  146. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/test_route_input.rb +59 -0
  147. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/test_route_result.rb +59 -0
  148. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/test_route_result_details.rb +56 -0
  149. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/user_subscription_quota.rb +102 -0
  150. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/user_subscription_quota_list_result.rb +67 -0
  151. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/module_definition.rb +9 -0
  152. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/operations.rb +215 -0
  153. data/lib/2018-04-01/generated/azure_mgmt_iot_hub/resource_provider_common.rb +115 -0
  154. data/lib/azure_mgmt_iot_hub.rb +3 -1
  155. data/lib/profiles/latest/modules/iothub_profile_module.rb +240 -162
  156. data/lib/version.rb +1 -1
  157. metadata +154 -5
@@ -0,0 +1,139 @@
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::IotHub::Mgmt::V2018_01_22
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class IotHubClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] The subscription identifier.
21
+ attr_accessor :subscription_id
22
+
23
+ # @return [String] The version of the API.
24
+ attr_reader :api_version
25
+
26
+ # @return [String] The preferred language for the response.
27
+ attr_accessor :accept_language
28
+
29
+ # @return [Integer] The retry timeout in seconds for Long Running
30
+ # Operations. Default value is 30.
31
+ attr_accessor :long_running_operation_retry_timeout
32
+
33
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
34
+ # generated. When set to true a unique x-ms-client-request-id value is
35
+ # generated and included in each request. Default is true.
36
+ attr_accessor :generate_client_request_id
37
+
38
+ # @return [Operations] operations
39
+ attr_reader :operations
40
+
41
+ # @return [IotHubResource] iot_hub_resource
42
+ attr_reader :iot_hub_resource
43
+
44
+ # @return [Certificates] certificates
45
+ attr_reader :certificates
46
+
47
+ #
48
+ # Creates initializes a new instance of the IotHubClient class.
49
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
50
+ # @param base_url [String] the base URI of the service.
51
+ # @param options [Array] filters to be applied to the HTTP requests.
52
+ #
53
+ def initialize(credentials = nil, base_url = nil, options = nil)
54
+ super(credentials, options)
55
+ @base_url = base_url || 'https://management.azure.com'
56
+
57
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
58
+ @credentials = credentials
59
+
60
+ @operations = Operations.new(self)
61
+ @iot_hub_resource = IotHubResource.new(self)
62
+ @certificates = Certificates.new(self)
63
+ @api_version = '2018-01-22'
64
+ @accept_language = 'en-US'
65
+ @long_running_operation_retry_timeout = 30
66
+ @generate_client_request_id = true
67
+ add_telemetry
68
+ end
69
+
70
+ #
71
+ # Makes a request and returns the body of the response.
72
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
73
+ # @param path [String] the path, relative to {base_url}.
74
+ # @param options [Hash{String=>String}] specifying any request options like :body.
75
+ # @return [Hash{String=>String}] containing the body of the response.
76
+ # Example:
77
+ #
78
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
79
+ # path = "/path"
80
+ # options = {
81
+ # body: request_content,
82
+ # query_params: {'api-version' => '2016-02-01'}
83
+ # }
84
+ # result = @client.make_request(:put, path, options)
85
+ #
86
+ def make_request(method, path, options = {})
87
+ result = make_request_with_http_info(method, path, options)
88
+ result.body unless result.nil?
89
+ end
90
+
91
+ #
92
+ # Makes a request and returns the operation response.
93
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
94
+ # @param path [String] the path, relative to {base_url}.
95
+ # @param options [Hash{String=>String}] specifying any request options like :body.
96
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
97
+ #
98
+ def make_request_with_http_info(method, path, options = {})
99
+ result = make_request_async(method, path, options).value!
100
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
101
+ result
102
+ end
103
+
104
+ #
105
+ # Makes a request asynchronously.
106
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
107
+ # @param path [String] the path, relative to {base_url}.
108
+ # @param options [Hash{String=>String}] specifying any request options like :body.
109
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
110
+ #
111
+ def make_request_async(method, path, options = {})
112
+ fail ArgumentError, 'method is nil' if method.nil?
113
+ fail ArgumentError, 'path is nil' if path.nil?
114
+
115
+ request_url = options[:base_url] || @base_url
116
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
117
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
118
+ end
119
+
120
+ request_headers = @request_headers
121
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
122
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
123
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
124
+
125
+ super(request_url, method, path, options)
126
+ end
127
+
128
+
129
+ private
130
+ #
131
+ # Adds telemetry information.
132
+ #
133
+ def add_telemetry
134
+ sdk_information = 'azure_mgmt_iot_hub'
135
+ sdk_information = "#{sdk_information}/0.17.0"
136
+ add_user_agent_information(sdk_information)
137
+ end
138
+ end
139
+ end
@@ -0,0 +1,3242 @@
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::IotHub::Mgmt::V2018_01_22
7
+ #
8
+ # Use this API to manage the IoT hubs in your Azure subscription.
9
+ #
10
+ class IotHubResource
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the IotHubResource class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [IotHubClient] reference to the IotHubClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Get the non-security related metadata of an IoT hub.
26
+ #
27
+ # Get the non-security related metadata of an IoT hub.
28
+ #
29
+ # @param resource_group_name [String] The name of the resource group that
30
+ # contains the IoT hub.
31
+ # @param resource_name [String] The name of the IoT hub.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [IotHubDescription] operation results.
36
+ #
37
+ def get(resource_group_name, resource_name, custom_headers:nil)
38
+ response = get_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # Get the non-security related metadata of an IoT hub.
44
+ #
45
+ # Get the non-security related metadata of an IoT hub.
46
+ #
47
+ # @param resource_group_name [String] The name of the resource group that
48
+ # contains the IoT hub.
49
+ # @param resource_name [String] The name of the IoT hub.
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
54
+ #
55
+ def get_with_http_info(resource_group_name, resource_name, custom_headers:nil)
56
+ get_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # Get the non-security related metadata of an IoT hub.
61
+ #
62
+ # Get the non-security related metadata of an IoT hub.
63
+ #
64
+ # @param resource_group_name [String] The name of the resource group that
65
+ # contains the IoT hub.
66
+ # @param resource_name [String] The name of the IoT hub.
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def get_async(resource_group_name, resource_name, custom_headers:nil)
73
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
74
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
75
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
76
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
77
+
78
+
79
+ request_headers = {}
80
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
81
+
82
+ # Set Headers
83
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
84
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
85
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'
86
+
87
+ request_url = @base_url || @client.base_url
88
+
89
+ options = {
90
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
91
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
92
+ query_params: {'api-version' => @client.api_version},
93
+ headers: request_headers.merge(custom_headers || {}),
94
+ base_url: request_url
95
+ }
96
+ promise = @client.make_request_async(:get, path_template, options)
97
+
98
+ promise = promise.then do |result|
99
+ http_response = result.response
100
+ status_code = http_response.status
101
+ response_content = http_response.body
102
+ unless status_code == 200
103
+ error_model = JSON.load(response_content)
104
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
105
+ end
106
+
107
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
108
+ # Deserialize Response
109
+ if status_code == 200
110
+ begin
111
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
112
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubDescription.mapper()
113
+ result.body = @client.deserialize(result_mapper, parsed_response)
114
+ rescue Exception => e
115
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
116
+ end
117
+ end
118
+
119
+ result
120
+ end
121
+
122
+ promise.execute
123
+ end
124
+
125
+ #
126
+ # Create or update the metadata of an IoT hub.
127
+ #
128
+ # Create or update the metadata of an Iot hub. The usual pattern to modify a
129
+ # property is to retrieve the IoT hub metadata and security metadata, and then
130
+ # combine them with the modified values in a new body to update the IoT hub.
131
+ #
132
+ # @param resource_group_name [String] The name of the resource group that
133
+ # contains the IoT hub.
134
+ # @param resource_name [String] The name of the IoT hub.
135
+ # @param iot_hub_description [IotHubDescription] The IoT hub metadata and
136
+ # security metadata.
137
+ # @param if_match [String] ETag of the IoT Hub. Do not specify for creating a
138
+ # brand new IoT Hub. Required to update an existing IoT Hub.
139
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
140
+ # will be added to the HTTP request.
141
+ #
142
+ # @return [IotHubDescription] operation results.
143
+ #
144
+ def create_or_update(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil)
145
+ response = create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:if_match, custom_headers:custom_headers).value!
146
+ response.body unless response.nil?
147
+ end
148
+
149
+ #
150
+ # @param resource_group_name [String] The name of the resource group that
151
+ # contains the IoT hub.
152
+ # @param resource_name [String] The name of the IoT hub.
153
+ # @param iot_hub_description [IotHubDescription] The IoT hub metadata and
154
+ # security metadata.
155
+ # @param if_match [String] ETag of the IoT Hub. Do not specify for creating a
156
+ # brand new IoT Hub. Required to update an existing IoT Hub.
157
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
158
+ # will be added to the HTTP request.
159
+ #
160
+ # @return [Concurrent::Promise] promise which provides async access to http
161
+ # response.
162
+ #
163
+ def create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil)
164
+ # Send request
165
+ promise = begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:if_match, custom_headers:custom_headers)
166
+
167
+ promise = promise.then do |response|
168
+ # Defining deserialization method.
169
+ deserialize_method = lambda do |parsed_response|
170
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubDescription.mapper()
171
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
172
+ end
173
+
174
+ # Waiting for response.
175
+ @client.get_long_running_operation_result(response, deserialize_method)
176
+ end
177
+
178
+ promise
179
+ end
180
+
181
+ #
182
+ # Update an existing IoT Hubs tags.
183
+ #
184
+ # Update an existing IoT Hub tags. to update other fields use the
185
+ # CreateOrUpdate method
186
+ #
187
+ # @param resource_group_name [String] Resource group identifier.
188
+ # @param resource_name [String] Name of iot hub to update.
189
+ # @param iot_hub_tags [TagsResource] Updated tag information to set into the
190
+ # iot hub instance.
191
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
192
+ # will be added to the HTTP request.
193
+ #
194
+ # @return [IotHubDescription] operation results.
195
+ #
196
+ def update(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
197
+ response = update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:custom_headers).value!
198
+ response.body unless response.nil?
199
+ end
200
+
201
+ #
202
+ # @param resource_group_name [String] Resource group identifier.
203
+ # @param resource_name [String] Name of iot hub to update.
204
+ # @param iot_hub_tags [TagsResource] Updated tag information to set into the
205
+ # iot hub instance.
206
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
207
+ # will be added to the HTTP request.
208
+ #
209
+ # @return [Concurrent::Promise] promise which provides async access to http
210
+ # response.
211
+ #
212
+ def update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
213
+ # Send request
214
+ promise = begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:custom_headers)
215
+
216
+ promise = promise.then do |response|
217
+ # Defining deserialization method.
218
+ deserialize_method = lambda do |parsed_response|
219
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubDescription.mapper()
220
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
221
+ end
222
+
223
+ # Waiting for response.
224
+ @client.get_long_running_operation_result(response, deserialize_method)
225
+ end
226
+
227
+ promise
228
+ end
229
+
230
+ #
231
+ # Delete an IoT hub.
232
+ #
233
+ # Delete an IoT hub.
234
+ #
235
+ # @param resource_group_name [String] The name of the resource group that
236
+ # contains the IoT hub.
237
+ # @param resource_name [String] The name of the IoT hub.
238
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
239
+ # will be added to the HTTP request.
240
+ #
241
+ # @return [Object] operation results.
242
+ #
243
+ def delete(resource_group_name, resource_name, custom_headers:nil)
244
+ response = delete_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
245
+ response.body unless response.nil?
246
+ end
247
+
248
+ #
249
+ # @param resource_group_name [String] The name of the resource group that
250
+ # contains the IoT hub.
251
+ # @param resource_name [String] The name of the IoT hub.
252
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
253
+ # will be added to the HTTP request.
254
+ #
255
+ # @return [Concurrent::Promise] promise which provides async access to http
256
+ # response.
257
+ #
258
+ def delete_async(resource_group_name, resource_name, custom_headers:nil)
259
+ # Send request
260
+ promise = begin_delete_async(resource_group_name, resource_name, custom_headers:custom_headers)
261
+
262
+ promise = promise.then do |response|
263
+ # Defining deserialization method.
264
+ deserialize_method = lambda do |parsed_response|
265
+ result_mapper = {
266
+ client_side_validation: true,
267
+ required: false,
268
+ serialized_name: 'parsed_response',
269
+ type: {
270
+ name: 'Object'
271
+ }
272
+ }
273
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
274
+ end
275
+
276
+ # Waiting for response.
277
+ @client.get_long_running_operation_result(response, deserialize_method)
278
+ end
279
+
280
+ promise
281
+ end
282
+
283
+ #
284
+ # Get all the IoT hubs in a subscription.
285
+ #
286
+ # Get all the IoT hubs in a subscription.
287
+ #
288
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
289
+ # will be added to the HTTP request.
290
+ #
291
+ # @return [Array<IotHubDescription>] operation results.
292
+ #
293
+ def list_by_subscription(custom_headers:nil)
294
+ first_page = list_by_subscription_as_lazy(custom_headers:custom_headers)
295
+ first_page.get_all_items
296
+ end
297
+
298
+ #
299
+ # Get all the IoT hubs in a subscription.
300
+ #
301
+ # Get all the IoT hubs in a subscription.
302
+ #
303
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
304
+ # will be added to the HTTP request.
305
+ #
306
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
307
+ #
308
+ def list_by_subscription_with_http_info(custom_headers:nil)
309
+ list_by_subscription_async(custom_headers:custom_headers).value!
310
+ end
311
+
312
+ #
313
+ # Get all the IoT hubs in a subscription.
314
+ #
315
+ # Get all the IoT hubs in a subscription.
316
+ #
317
+ # @param [Hash{String => String}] A hash of custom headers that will be added
318
+ # to the HTTP request.
319
+ #
320
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
321
+ #
322
+ def list_by_subscription_async(custom_headers:nil)
323
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
324
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
325
+
326
+
327
+ request_headers = {}
328
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
329
+
330
+ # Set Headers
331
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
332
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
333
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs'
334
+
335
+ request_url = @base_url || @client.base_url
336
+
337
+ options = {
338
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
339
+ path_params: {'subscriptionId' => @client.subscription_id},
340
+ query_params: {'api-version' => @client.api_version},
341
+ headers: request_headers.merge(custom_headers || {}),
342
+ base_url: request_url
343
+ }
344
+ promise = @client.make_request_async(:get, path_template, options)
345
+
346
+ promise = promise.then do |result|
347
+ http_response = result.response
348
+ status_code = http_response.status
349
+ response_content = http_response.body
350
+ unless status_code == 200
351
+ error_model = JSON.load(response_content)
352
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
353
+ end
354
+
355
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
356
+ # Deserialize Response
357
+ if status_code == 200
358
+ begin
359
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
360
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubDescriptionListResult.mapper()
361
+ result.body = @client.deserialize(result_mapper, parsed_response)
362
+ rescue Exception => e
363
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
364
+ end
365
+ end
366
+
367
+ result
368
+ end
369
+
370
+ promise.execute
371
+ end
372
+
373
+ #
374
+ # Get all the IoT hubs in a resource group.
375
+ #
376
+ # Get all the IoT hubs in a resource group.
377
+ #
378
+ # @param resource_group_name [String] The name of the resource group that
379
+ # contains the IoT hub.
380
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
381
+ # will be added to the HTTP request.
382
+ #
383
+ # @return [Array<IotHubDescription>] operation results.
384
+ #
385
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
386
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
387
+ first_page.get_all_items
388
+ end
389
+
390
+ #
391
+ # Get all the IoT hubs in a resource group.
392
+ #
393
+ # Get all the IoT hubs in a resource group.
394
+ #
395
+ # @param resource_group_name [String] The name of the resource group that
396
+ # contains the IoT hub.
397
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
398
+ # will be added to the HTTP request.
399
+ #
400
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
401
+ #
402
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
403
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
404
+ end
405
+
406
+ #
407
+ # Get all the IoT hubs in a resource group.
408
+ #
409
+ # Get all the IoT hubs in a resource group.
410
+ #
411
+ # @param resource_group_name [String] The name of the resource group that
412
+ # contains the IoT hub.
413
+ # @param [Hash{String => String}] A hash of custom headers that will be added
414
+ # to the HTTP request.
415
+ #
416
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
417
+ #
418
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
419
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
420
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
421
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
422
+
423
+
424
+ request_headers = {}
425
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
426
+
427
+ # Set Headers
428
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
429
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
430
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs'
431
+
432
+ request_url = @base_url || @client.base_url
433
+
434
+ options = {
435
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
436
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
437
+ query_params: {'api-version' => @client.api_version},
438
+ headers: request_headers.merge(custom_headers || {}),
439
+ base_url: request_url
440
+ }
441
+ promise = @client.make_request_async(:get, path_template, options)
442
+
443
+ promise = promise.then do |result|
444
+ http_response = result.response
445
+ status_code = http_response.status
446
+ response_content = http_response.body
447
+ unless status_code == 200
448
+ error_model = JSON.load(response_content)
449
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
450
+ end
451
+
452
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
453
+ # Deserialize Response
454
+ if status_code == 200
455
+ begin
456
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
457
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubDescriptionListResult.mapper()
458
+ result.body = @client.deserialize(result_mapper, parsed_response)
459
+ rescue Exception => e
460
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
461
+ end
462
+ end
463
+
464
+ result
465
+ end
466
+
467
+ promise.execute
468
+ end
469
+
470
+ #
471
+ # Get the statistics from an IoT hub.
472
+ #
473
+ # Get the statistics from an IoT hub.
474
+ #
475
+ # @param resource_group_name [String] The name of the resource group that
476
+ # contains the IoT hub.
477
+ # @param resource_name [String] The name of the IoT hub.
478
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
479
+ # will be added to the HTTP request.
480
+ #
481
+ # @return [RegistryStatistics] operation results.
482
+ #
483
+ def get_stats(resource_group_name, resource_name, custom_headers:nil)
484
+ response = get_stats_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
485
+ response.body unless response.nil?
486
+ end
487
+
488
+ #
489
+ # Get the statistics from an IoT hub.
490
+ #
491
+ # Get the statistics from an IoT hub.
492
+ #
493
+ # @param resource_group_name [String] The name of the resource group that
494
+ # contains the IoT hub.
495
+ # @param resource_name [String] The name of the IoT hub.
496
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
497
+ # will be added to the HTTP request.
498
+ #
499
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
500
+ #
501
+ def get_stats_with_http_info(resource_group_name, resource_name, custom_headers:nil)
502
+ get_stats_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
503
+ end
504
+
505
+ #
506
+ # Get the statistics from an IoT hub.
507
+ #
508
+ # Get the statistics from an IoT hub.
509
+ #
510
+ # @param resource_group_name [String] The name of the resource group that
511
+ # contains the IoT hub.
512
+ # @param resource_name [String] The name of the IoT hub.
513
+ # @param [Hash{String => String}] A hash of custom headers that will be added
514
+ # to the HTTP request.
515
+ #
516
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
517
+ #
518
+ def get_stats_async(resource_group_name, resource_name, custom_headers:nil)
519
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
520
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
521
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
522
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
523
+
524
+
525
+ request_headers = {}
526
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
527
+
528
+ # Set Headers
529
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
530
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
531
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats'
532
+
533
+ request_url = @base_url || @client.base_url
534
+
535
+ options = {
536
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
537
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
538
+ query_params: {'api-version' => @client.api_version},
539
+ headers: request_headers.merge(custom_headers || {}),
540
+ base_url: request_url
541
+ }
542
+ promise = @client.make_request_async(:get, path_template, options)
543
+
544
+ promise = promise.then do |result|
545
+ http_response = result.response
546
+ status_code = http_response.status
547
+ response_content = http_response.body
548
+ unless status_code == 200
549
+ error_model = JSON.load(response_content)
550
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
551
+ end
552
+
553
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
554
+ # Deserialize Response
555
+ if status_code == 200
556
+ begin
557
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
558
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::RegistryStatistics.mapper()
559
+ result.body = @client.deserialize(result_mapper, parsed_response)
560
+ rescue Exception => e
561
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
562
+ end
563
+ end
564
+
565
+ result
566
+ end
567
+
568
+ promise.execute
569
+ end
570
+
571
+ #
572
+ # Get the list of valid SKUs for an IoT hub.
573
+ #
574
+ # Get the list of valid SKUs for an IoT hub.
575
+ #
576
+ # @param resource_group_name [String] The name of the resource group that
577
+ # contains the IoT hub.
578
+ # @param resource_name [String] The name of the IoT hub.
579
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
580
+ # will be added to the HTTP request.
581
+ #
582
+ # @return [Array<IotHubSkuDescription>] operation results.
583
+ #
584
+ def get_valid_skus(resource_group_name, resource_name, custom_headers:nil)
585
+ first_page = get_valid_skus_as_lazy(resource_group_name, resource_name, custom_headers:custom_headers)
586
+ first_page.get_all_items
587
+ end
588
+
589
+ #
590
+ # Get the list of valid SKUs for an IoT hub.
591
+ #
592
+ # Get the list of valid SKUs for an IoT hub.
593
+ #
594
+ # @param resource_group_name [String] The name of the resource group that
595
+ # contains the IoT hub.
596
+ # @param resource_name [String] The name of the IoT hub.
597
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
598
+ # will be added to the HTTP request.
599
+ #
600
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
601
+ #
602
+ def get_valid_skus_with_http_info(resource_group_name, resource_name, custom_headers:nil)
603
+ get_valid_skus_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
604
+ end
605
+
606
+ #
607
+ # Get the list of valid SKUs for an IoT hub.
608
+ #
609
+ # Get the list of valid SKUs for an IoT hub.
610
+ #
611
+ # @param resource_group_name [String] The name of the resource group that
612
+ # contains the IoT hub.
613
+ # @param resource_name [String] The name of the IoT hub.
614
+ # @param [Hash{String => String}] A hash of custom headers that will be added
615
+ # to the HTTP request.
616
+ #
617
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
618
+ #
619
+ def get_valid_skus_async(resource_group_name, resource_name, custom_headers:nil)
620
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
621
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
622
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
623
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
624
+
625
+
626
+ request_headers = {}
627
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
628
+
629
+ # Set Headers
630
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
631
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
632
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus'
633
+
634
+ request_url = @base_url || @client.base_url
635
+
636
+ options = {
637
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
638
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
639
+ query_params: {'api-version' => @client.api_version},
640
+ headers: request_headers.merge(custom_headers || {}),
641
+ base_url: request_url
642
+ }
643
+ promise = @client.make_request_async(:get, path_template, options)
644
+
645
+ promise = promise.then do |result|
646
+ http_response = result.response
647
+ status_code = http_response.status
648
+ response_content = http_response.body
649
+ unless status_code == 200
650
+ error_model = JSON.load(response_content)
651
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
652
+ end
653
+
654
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
655
+ # Deserialize Response
656
+ if status_code == 200
657
+ begin
658
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
659
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubSkuDescriptionListResult.mapper()
660
+ result.body = @client.deserialize(result_mapper, parsed_response)
661
+ rescue Exception => e
662
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
663
+ end
664
+ end
665
+
666
+ result
667
+ end
668
+
669
+ promise.execute
670
+ end
671
+
672
+ #
673
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
674
+ # endpoint in an IoT hub.
675
+ #
676
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
677
+ # endpoint in an IoT hub.
678
+ #
679
+ # @param resource_group_name [String] The name of the resource group that
680
+ # contains the IoT hub.
681
+ # @param resource_name [String] The name of the IoT hub.
682
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
683
+ # endpoint.
684
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
685
+ # will be added to the HTTP request.
686
+ #
687
+ # @return [Array<EventHubConsumerGroupInfo>] operation results.
688
+ #
689
+ def list_event_hub_consumer_groups(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:nil)
690
+ first_page = list_event_hub_consumer_groups_as_lazy(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:custom_headers)
691
+ first_page.get_all_items
692
+ end
693
+
694
+ #
695
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
696
+ # endpoint in an IoT hub.
697
+ #
698
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
699
+ # endpoint in an IoT hub.
700
+ #
701
+ # @param resource_group_name [String] The name of the resource group that
702
+ # contains the IoT hub.
703
+ # @param resource_name [String] The name of the IoT hub.
704
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
705
+ # endpoint.
706
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
707
+ # will be added to the HTTP request.
708
+ #
709
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
710
+ #
711
+ def list_event_hub_consumer_groups_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:nil)
712
+ list_event_hub_consumer_groups_async(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:custom_headers).value!
713
+ end
714
+
715
+ #
716
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
717
+ # endpoint in an IoT hub.
718
+ #
719
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
720
+ # endpoint in an IoT hub.
721
+ #
722
+ # @param resource_group_name [String] The name of the resource group that
723
+ # contains the IoT hub.
724
+ # @param resource_name [String] The name of the IoT hub.
725
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
726
+ # endpoint.
727
+ # @param [Hash{String => String}] A hash of custom headers that will be added
728
+ # to the HTTP request.
729
+ #
730
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
731
+ #
732
+ def list_event_hub_consumer_groups_async(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:nil)
733
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
734
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
735
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
736
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
737
+ fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
738
+
739
+
740
+ request_headers = {}
741
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
742
+
743
+ # Set Headers
744
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
745
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
746
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups'
747
+
748
+ request_url = @base_url || @client.base_url
749
+
750
+ options = {
751
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
752
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'eventHubEndpointName' => event_hub_endpoint_name},
753
+ query_params: {'api-version' => @client.api_version},
754
+ headers: request_headers.merge(custom_headers || {}),
755
+ base_url: request_url
756
+ }
757
+ promise = @client.make_request_async(:get, path_template, options)
758
+
759
+ promise = promise.then do |result|
760
+ http_response = result.response
761
+ status_code = http_response.status
762
+ response_content = http_response.body
763
+ unless status_code == 200
764
+ error_model = JSON.load(response_content)
765
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
766
+ end
767
+
768
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
769
+ # Deserialize Response
770
+ if status_code == 200
771
+ begin
772
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
773
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::EventHubConsumerGroupsListResult.mapper()
774
+ result.body = @client.deserialize(result_mapper, parsed_response)
775
+ rescue Exception => e
776
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
777
+ end
778
+ end
779
+
780
+ result
781
+ end
782
+
783
+ promise.execute
784
+ end
785
+
786
+ #
787
+ # Get a consumer group from the Event Hub-compatible device-to-cloud endpoint
788
+ # for an IoT hub.
789
+ #
790
+ # Get a consumer group from the Event Hub-compatible device-to-cloud endpoint
791
+ # for an IoT hub.
792
+ #
793
+ # @param resource_group_name [String] The name of the resource group that
794
+ # contains the IoT hub.
795
+ # @param resource_name [String] The name of the IoT hub.
796
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
797
+ # endpoint in the IoT hub.
798
+ # @param name [String] The name of the consumer group to retrieve.
799
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
800
+ # will be added to the HTTP request.
801
+ #
802
+ # @return [EventHubConsumerGroupInfo] operation results.
803
+ #
804
+ def get_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
805
+ response = get_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
806
+ response.body unless response.nil?
807
+ end
808
+
809
+ #
810
+ # Get a consumer group from the Event Hub-compatible device-to-cloud endpoint
811
+ # for an IoT hub.
812
+ #
813
+ # Get a consumer group from the Event Hub-compatible device-to-cloud endpoint
814
+ # for an IoT hub.
815
+ #
816
+ # @param resource_group_name [String] The name of the resource group that
817
+ # contains the IoT hub.
818
+ # @param resource_name [String] The name of the IoT hub.
819
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
820
+ # endpoint in the IoT hub.
821
+ # @param name [String] The name of the consumer group to retrieve.
822
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
823
+ # will be added to the HTTP request.
824
+ #
825
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
826
+ #
827
+ def get_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
828
+ get_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
829
+ end
830
+
831
+ #
832
+ # Get a consumer group from the Event Hub-compatible device-to-cloud endpoint
833
+ # for an IoT hub.
834
+ #
835
+ # Get a consumer group from the Event Hub-compatible device-to-cloud endpoint
836
+ # for an IoT hub.
837
+ #
838
+ # @param resource_group_name [String] The name of the resource group that
839
+ # contains the IoT hub.
840
+ # @param resource_name [String] The name of the IoT hub.
841
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
842
+ # endpoint in the IoT hub.
843
+ # @param name [String] The name of the consumer group to retrieve.
844
+ # @param [Hash{String => String}] A hash of custom headers that will be added
845
+ # to the HTTP request.
846
+ #
847
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
848
+ #
849
+ def get_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
850
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
851
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
852
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
853
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
854
+ fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
855
+ fail ArgumentError, 'name is nil' if name.nil?
856
+
857
+
858
+ request_headers = {}
859
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
860
+
861
+ # Set Headers
862
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
863
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
864
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'
865
+
866
+ request_url = @base_url || @client.base_url
867
+
868
+ options = {
869
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
870
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'eventHubEndpointName' => event_hub_endpoint_name,'name' => name},
871
+ query_params: {'api-version' => @client.api_version},
872
+ headers: request_headers.merge(custom_headers || {}),
873
+ base_url: request_url
874
+ }
875
+ promise = @client.make_request_async(:get, path_template, options)
876
+
877
+ promise = promise.then do |result|
878
+ http_response = result.response
879
+ status_code = http_response.status
880
+ response_content = http_response.body
881
+ unless status_code == 200
882
+ error_model = JSON.load(response_content)
883
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
884
+ end
885
+
886
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
887
+ # Deserialize Response
888
+ if status_code == 200
889
+ begin
890
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
891
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::EventHubConsumerGroupInfo.mapper()
892
+ result.body = @client.deserialize(result_mapper, parsed_response)
893
+ rescue Exception => e
894
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
895
+ end
896
+ end
897
+
898
+ result
899
+ end
900
+
901
+ promise.execute
902
+ end
903
+
904
+ #
905
+ # Add a consumer group to an Event Hub-compatible endpoint in an IoT hub.
906
+ #
907
+ # Add a consumer group to an Event Hub-compatible endpoint in an IoT hub.
908
+ #
909
+ # @param resource_group_name [String] The name of the resource group that
910
+ # contains the IoT hub.
911
+ # @param resource_name [String] The name of the IoT hub.
912
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
913
+ # endpoint in the IoT hub.
914
+ # @param name [String] The name of the consumer group to add.
915
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
916
+ # will be added to the HTTP request.
917
+ #
918
+ # @return [EventHubConsumerGroupInfo] operation results.
919
+ #
920
+ def create_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
921
+ response = create_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
922
+ response.body unless response.nil?
923
+ end
924
+
925
+ #
926
+ # Add a consumer group to an Event Hub-compatible endpoint in an IoT hub.
927
+ #
928
+ # Add a consumer group to an Event Hub-compatible endpoint in an IoT hub.
929
+ #
930
+ # @param resource_group_name [String] The name of the resource group that
931
+ # contains the IoT hub.
932
+ # @param resource_name [String] The name of the IoT hub.
933
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
934
+ # endpoint in the IoT hub.
935
+ # @param name [String] The name of the consumer group to add.
936
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
937
+ # will be added to the HTTP request.
938
+ #
939
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
940
+ #
941
+ def create_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
942
+ create_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
943
+ end
944
+
945
+ #
946
+ # Add a consumer group to an Event Hub-compatible endpoint in an IoT hub.
947
+ #
948
+ # Add a consumer group to an Event Hub-compatible endpoint in an IoT hub.
949
+ #
950
+ # @param resource_group_name [String] The name of the resource group that
951
+ # contains the IoT hub.
952
+ # @param resource_name [String] The name of the IoT hub.
953
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
954
+ # endpoint in the IoT hub.
955
+ # @param name [String] The name of the consumer group to add.
956
+ # @param [Hash{String => String}] A hash of custom headers that will be added
957
+ # to the HTTP request.
958
+ #
959
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
960
+ #
961
+ def create_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
962
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
963
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
964
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
965
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
966
+ fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
967
+ fail ArgumentError, 'name is nil' if name.nil?
968
+
969
+
970
+ request_headers = {}
971
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
972
+
973
+ # Set Headers
974
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
975
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
976
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'
977
+
978
+ request_url = @base_url || @client.base_url
979
+
980
+ options = {
981
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
982
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'eventHubEndpointName' => event_hub_endpoint_name,'name' => name},
983
+ query_params: {'api-version' => @client.api_version},
984
+ headers: request_headers.merge(custom_headers || {}),
985
+ base_url: request_url
986
+ }
987
+ promise = @client.make_request_async(:put, path_template, options)
988
+
989
+ promise = promise.then do |result|
990
+ http_response = result.response
991
+ status_code = http_response.status
992
+ response_content = http_response.body
993
+ unless status_code == 200
994
+ error_model = JSON.load(response_content)
995
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
996
+ end
997
+
998
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
999
+ # Deserialize Response
1000
+ if status_code == 200
1001
+ begin
1002
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1003
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::EventHubConsumerGroupInfo.mapper()
1004
+ result.body = @client.deserialize(result_mapper, parsed_response)
1005
+ rescue Exception => e
1006
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1007
+ end
1008
+ end
1009
+
1010
+ result
1011
+ end
1012
+
1013
+ promise.execute
1014
+ end
1015
+
1016
+ #
1017
+ # Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub.
1018
+ #
1019
+ # Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub.
1020
+ #
1021
+ # @param resource_group_name [String] The name of the resource group that
1022
+ # contains the IoT hub.
1023
+ # @param resource_name [String] The name of the IoT hub.
1024
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
1025
+ # endpoint in the IoT hub.
1026
+ # @param name [String] The name of the consumer group to delete.
1027
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1028
+ # will be added to the HTTP request.
1029
+ #
1030
+ #
1031
+ def delete_event_hub_consumer_group(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
1032
+ response = delete_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
1033
+ nil
1034
+ end
1035
+
1036
+ #
1037
+ # Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub.
1038
+ #
1039
+ # Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub.
1040
+ #
1041
+ # @param resource_group_name [String] The name of the resource group that
1042
+ # contains the IoT hub.
1043
+ # @param resource_name [String] The name of the IoT hub.
1044
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
1045
+ # endpoint in the IoT hub.
1046
+ # @param name [String] The name of the consumer group to delete.
1047
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1048
+ # will be added to the HTTP request.
1049
+ #
1050
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1051
+ #
1052
+ def delete_event_hub_consumer_group_with_http_info(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
1053
+ delete_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:custom_headers).value!
1054
+ end
1055
+
1056
+ #
1057
+ # Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub.
1058
+ #
1059
+ # Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub.
1060
+ #
1061
+ # @param resource_group_name [String] The name of the resource group that
1062
+ # contains the IoT hub.
1063
+ # @param resource_name [String] The name of the IoT hub.
1064
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
1065
+ # endpoint in the IoT hub.
1066
+ # @param name [String] The name of the consumer group to delete.
1067
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1068
+ # to the HTTP request.
1069
+ #
1070
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1071
+ #
1072
+ def delete_event_hub_consumer_group_async(resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers:nil)
1073
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1074
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1075
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1076
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1077
+ fail ArgumentError, 'event_hub_endpoint_name is nil' if event_hub_endpoint_name.nil?
1078
+ fail ArgumentError, 'name is nil' if name.nil?
1079
+
1080
+
1081
+ request_headers = {}
1082
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1083
+
1084
+ # Set Headers
1085
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1086
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1087
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'
1088
+
1089
+ request_url = @base_url || @client.base_url
1090
+
1091
+ options = {
1092
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1093
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'eventHubEndpointName' => event_hub_endpoint_name,'name' => name},
1094
+ query_params: {'api-version' => @client.api_version},
1095
+ headers: request_headers.merge(custom_headers || {}),
1096
+ base_url: request_url
1097
+ }
1098
+ promise = @client.make_request_async(:delete, path_template, options)
1099
+
1100
+ promise = promise.then do |result|
1101
+ http_response = result.response
1102
+ status_code = http_response.status
1103
+ response_content = http_response.body
1104
+ unless status_code == 200
1105
+ error_model = JSON.load(response_content)
1106
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1107
+ end
1108
+
1109
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1110
+
1111
+ result
1112
+ end
1113
+
1114
+ promise.execute
1115
+ end
1116
+
1117
+ #
1118
+ # Get a list of all the jobs in an IoT hub. For more information, see:
1119
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1120
+ #
1121
+ # Get a list of all the jobs in an IoT hub. For more information, see:
1122
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1123
+ #
1124
+ # @param resource_group_name [String] The name of the resource group that
1125
+ # contains the IoT hub.
1126
+ # @param resource_name [String] The name of the IoT hub.
1127
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1128
+ # will be added to the HTTP request.
1129
+ #
1130
+ # @return [Array<JobResponse>] operation results.
1131
+ #
1132
+ def list_jobs(resource_group_name, resource_name, custom_headers:nil)
1133
+ first_page = list_jobs_as_lazy(resource_group_name, resource_name, custom_headers:custom_headers)
1134
+ first_page.get_all_items
1135
+ end
1136
+
1137
+ #
1138
+ # Get a list of all the jobs in an IoT hub. For more information, see:
1139
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1140
+ #
1141
+ # Get a list of all the jobs in an IoT hub. For more information, see:
1142
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1143
+ #
1144
+ # @param resource_group_name [String] The name of the resource group that
1145
+ # contains the IoT hub.
1146
+ # @param resource_name [String] The name of the IoT hub.
1147
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1148
+ # will be added to the HTTP request.
1149
+ #
1150
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1151
+ #
1152
+ def list_jobs_with_http_info(resource_group_name, resource_name, custom_headers:nil)
1153
+ list_jobs_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
1154
+ end
1155
+
1156
+ #
1157
+ # Get a list of all the jobs in an IoT hub. For more information, see:
1158
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1159
+ #
1160
+ # Get a list of all the jobs in an IoT hub. For more information, see:
1161
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1162
+ #
1163
+ # @param resource_group_name [String] The name of the resource group that
1164
+ # contains the IoT hub.
1165
+ # @param resource_name [String] The name of the IoT hub.
1166
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1167
+ # to the HTTP request.
1168
+ #
1169
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1170
+ #
1171
+ def list_jobs_async(resource_group_name, resource_name, custom_headers:nil)
1172
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1173
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1174
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1175
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1176
+
1177
+
1178
+ request_headers = {}
1179
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1180
+
1181
+ # Set Headers
1182
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1183
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1184
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs'
1185
+
1186
+ request_url = @base_url || @client.base_url
1187
+
1188
+ options = {
1189
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1190
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
1191
+ query_params: {'api-version' => @client.api_version},
1192
+ headers: request_headers.merge(custom_headers || {}),
1193
+ base_url: request_url
1194
+ }
1195
+ promise = @client.make_request_async(:get, path_template, options)
1196
+
1197
+ promise = promise.then do |result|
1198
+ http_response = result.response
1199
+ status_code = http_response.status
1200
+ response_content = http_response.body
1201
+ unless status_code == 200
1202
+ error_model = JSON.load(response_content)
1203
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1204
+ end
1205
+
1206
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1207
+ # Deserialize Response
1208
+ if status_code == 200
1209
+ begin
1210
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1211
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::JobResponseListResult.mapper()
1212
+ result.body = @client.deserialize(result_mapper, parsed_response)
1213
+ rescue Exception => e
1214
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1215
+ end
1216
+ end
1217
+
1218
+ result
1219
+ end
1220
+
1221
+ promise.execute
1222
+ end
1223
+
1224
+ #
1225
+ # Get the details of a job from an IoT hub. For more information, see:
1226
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1227
+ #
1228
+ # Get the details of a job from an IoT hub. For more information, see:
1229
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1230
+ #
1231
+ # @param resource_group_name [String] The name of the resource group that
1232
+ # contains the IoT hub.
1233
+ # @param resource_name [String] The name of the IoT hub.
1234
+ # @param job_id [String] The job identifier.
1235
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1236
+ # will be added to the HTTP request.
1237
+ #
1238
+ # @return [JobResponse] operation results.
1239
+ #
1240
+ def get_job(resource_group_name, resource_name, job_id, custom_headers:nil)
1241
+ response = get_job_async(resource_group_name, resource_name, job_id, custom_headers:custom_headers).value!
1242
+ response.body unless response.nil?
1243
+ end
1244
+
1245
+ #
1246
+ # Get the details of a job from an IoT hub. For more information, see:
1247
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1248
+ #
1249
+ # Get the details of a job from an IoT hub. For more information, see:
1250
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1251
+ #
1252
+ # @param resource_group_name [String] The name of the resource group that
1253
+ # contains the IoT hub.
1254
+ # @param resource_name [String] The name of the IoT hub.
1255
+ # @param job_id [String] The job identifier.
1256
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1257
+ # will be added to the HTTP request.
1258
+ #
1259
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1260
+ #
1261
+ def get_job_with_http_info(resource_group_name, resource_name, job_id, custom_headers:nil)
1262
+ get_job_async(resource_group_name, resource_name, job_id, custom_headers:custom_headers).value!
1263
+ end
1264
+
1265
+ #
1266
+ # Get the details of a job from an IoT hub. For more information, see:
1267
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1268
+ #
1269
+ # Get the details of a job from an IoT hub. For more information, see:
1270
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
1271
+ #
1272
+ # @param resource_group_name [String] The name of the resource group that
1273
+ # contains the IoT hub.
1274
+ # @param resource_name [String] The name of the IoT hub.
1275
+ # @param job_id [String] The job identifier.
1276
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1277
+ # to the HTTP request.
1278
+ #
1279
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1280
+ #
1281
+ def get_job_async(resource_group_name, resource_name, job_id, custom_headers:nil)
1282
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1283
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1284
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1285
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1286
+ fail ArgumentError, 'job_id is nil' if job_id.nil?
1287
+
1288
+
1289
+ request_headers = {}
1290
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1291
+
1292
+ # Set Headers
1293
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1294
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1295
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}'
1296
+
1297
+ request_url = @base_url || @client.base_url
1298
+
1299
+ options = {
1300
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1301
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'jobId' => job_id},
1302
+ query_params: {'api-version' => @client.api_version},
1303
+ headers: request_headers.merge(custom_headers || {}),
1304
+ base_url: request_url
1305
+ }
1306
+ promise = @client.make_request_async(:get, path_template, options)
1307
+
1308
+ promise = promise.then do |result|
1309
+ http_response = result.response
1310
+ status_code = http_response.status
1311
+ response_content = http_response.body
1312
+ unless status_code == 200
1313
+ error_model = JSON.load(response_content)
1314
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1315
+ end
1316
+
1317
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1318
+ # Deserialize Response
1319
+ if status_code == 200
1320
+ begin
1321
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1322
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::JobResponse.mapper()
1323
+ result.body = @client.deserialize(result_mapper, parsed_response)
1324
+ rescue Exception => e
1325
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1326
+ end
1327
+ end
1328
+
1329
+ result
1330
+ end
1331
+
1332
+ promise.execute
1333
+ end
1334
+
1335
+ #
1336
+ # Get the quota metrics for an IoT hub.
1337
+ #
1338
+ # Get the quota metrics for an IoT hub.
1339
+ #
1340
+ # @param resource_group_name [String] The name of the resource group that
1341
+ # contains the IoT hub.
1342
+ # @param resource_name [String] The name of the IoT hub.
1343
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1344
+ # will be added to the HTTP request.
1345
+ #
1346
+ # @return [Array<IotHubQuotaMetricInfo>] operation results.
1347
+ #
1348
+ def get_quota_metrics(resource_group_name, resource_name, custom_headers:nil)
1349
+ first_page = get_quota_metrics_as_lazy(resource_group_name, resource_name, custom_headers:custom_headers)
1350
+ first_page.get_all_items
1351
+ end
1352
+
1353
+ #
1354
+ # Get the quota metrics for an IoT hub.
1355
+ #
1356
+ # Get the quota metrics for an IoT hub.
1357
+ #
1358
+ # @param resource_group_name [String] The name of the resource group that
1359
+ # contains the IoT hub.
1360
+ # @param resource_name [String] The name of the IoT hub.
1361
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1362
+ # will be added to the HTTP request.
1363
+ #
1364
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1365
+ #
1366
+ def get_quota_metrics_with_http_info(resource_group_name, resource_name, custom_headers:nil)
1367
+ get_quota_metrics_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
1368
+ end
1369
+
1370
+ #
1371
+ # Get the quota metrics for an IoT hub.
1372
+ #
1373
+ # Get the quota metrics for an IoT hub.
1374
+ #
1375
+ # @param resource_group_name [String] The name of the resource group that
1376
+ # contains the IoT hub.
1377
+ # @param resource_name [String] The name of the IoT hub.
1378
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1379
+ # to the HTTP request.
1380
+ #
1381
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1382
+ #
1383
+ def get_quota_metrics_async(resource_group_name, resource_name, custom_headers:nil)
1384
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1385
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1386
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1387
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1388
+
1389
+
1390
+ request_headers = {}
1391
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1392
+
1393
+ # Set Headers
1394
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1395
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1396
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics'
1397
+
1398
+ request_url = @base_url || @client.base_url
1399
+
1400
+ options = {
1401
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1402
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
1403
+ query_params: {'api-version' => @client.api_version},
1404
+ headers: request_headers.merge(custom_headers || {}),
1405
+ base_url: request_url
1406
+ }
1407
+ promise = @client.make_request_async(:get, path_template, options)
1408
+
1409
+ promise = promise.then do |result|
1410
+ http_response = result.response
1411
+ status_code = http_response.status
1412
+ response_content = http_response.body
1413
+ unless status_code == 200
1414
+ error_model = JSON.load(response_content)
1415
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1416
+ end
1417
+
1418
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1419
+ # Deserialize Response
1420
+ if status_code == 200
1421
+ begin
1422
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1423
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubQuotaMetricInfoListResult.mapper()
1424
+ result.body = @client.deserialize(result_mapper, parsed_response)
1425
+ rescue Exception => e
1426
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1427
+ end
1428
+ end
1429
+
1430
+ result
1431
+ end
1432
+
1433
+ promise.execute
1434
+ end
1435
+
1436
+ #
1437
+ # Check if an IoT hub name is available.
1438
+ #
1439
+ # Check if an IoT hub name is available.
1440
+ #
1441
+ # @param operation_inputs [OperationInputs] Set the name parameter in the
1442
+ # OperationInputs structure to the name of the IoT hub to check.
1443
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1444
+ # will be added to the HTTP request.
1445
+ #
1446
+ # @return [IotHubNameAvailabilityInfo] operation results.
1447
+ #
1448
+ def check_name_availability(operation_inputs, custom_headers:nil)
1449
+ response = check_name_availability_async(operation_inputs, custom_headers:custom_headers).value!
1450
+ response.body unless response.nil?
1451
+ end
1452
+
1453
+ #
1454
+ # Check if an IoT hub name is available.
1455
+ #
1456
+ # Check if an IoT hub name is available.
1457
+ #
1458
+ # @param operation_inputs [OperationInputs] Set the name parameter in the
1459
+ # OperationInputs structure to the name of the IoT hub to check.
1460
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1461
+ # will be added to the HTTP request.
1462
+ #
1463
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1464
+ #
1465
+ def check_name_availability_with_http_info(operation_inputs, custom_headers:nil)
1466
+ check_name_availability_async(operation_inputs, custom_headers:custom_headers).value!
1467
+ end
1468
+
1469
+ #
1470
+ # Check if an IoT hub name is available.
1471
+ #
1472
+ # Check if an IoT hub name is available.
1473
+ #
1474
+ # @param operation_inputs [OperationInputs] Set the name parameter in the
1475
+ # OperationInputs structure to the name of the IoT hub to check.
1476
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1477
+ # to the HTTP request.
1478
+ #
1479
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1480
+ #
1481
+ def check_name_availability_async(operation_inputs, custom_headers:nil)
1482
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1483
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1484
+ fail ArgumentError, 'operation_inputs is nil' if operation_inputs.nil?
1485
+
1486
+
1487
+ request_headers = {}
1488
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1489
+
1490
+ # Set Headers
1491
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1492
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1493
+
1494
+ # Serialize Request
1495
+ request_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::OperationInputs.mapper()
1496
+ request_content = @client.serialize(request_mapper, operation_inputs)
1497
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1498
+
1499
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'
1500
+
1501
+ request_url = @base_url || @client.base_url
1502
+
1503
+ options = {
1504
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1505
+ path_params: {'subscriptionId' => @client.subscription_id},
1506
+ query_params: {'api-version' => @client.api_version},
1507
+ body: request_content,
1508
+ headers: request_headers.merge(custom_headers || {}),
1509
+ base_url: request_url
1510
+ }
1511
+ promise = @client.make_request_async(:post, path_template, options)
1512
+
1513
+ promise = promise.then do |result|
1514
+ http_response = result.response
1515
+ status_code = http_response.status
1516
+ response_content = http_response.body
1517
+ unless status_code == 200
1518
+ error_model = JSON.load(response_content)
1519
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1520
+ end
1521
+
1522
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1523
+ # Deserialize Response
1524
+ if status_code == 200
1525
+ begin
1526
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1527
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubNameAvailabilityInfo.mapper()
1528
+ result.body = @client.deserialize(result_mapper, parsed_response)
1529
+ rescue Exception => e
1530
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1531
+ end
1532
+ end
1533
+
1534
+ result
1535
+ end
1536
+
1537
+ promise.execute
1538
+ end
1539
+
1540
+ #
1541
+ # Get the security metadata for an IoT hub. For more information, see:
1542
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
1543
+ #
1544
+ # Get the security metadata for an IoT hub. For more information, see:
1545
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
1546
+ #
1547
+ # @param resource_group_name [String] The name of the resource group that
1548
+ # contains the IoT hub.
1549
+ # @param resource_name [String] The name of the IoT hub.
1550
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1551
+ # will be added to the HTTP request.
1552
+ #
1553
+ # @return [Array<SharedAccessSignatureAuthorizationRule>] operation results.
1554
+ #
1555
+ def list_keys(resource_group_name, resource_name, custom_headers:nil)
1556
+ first_page = list_keys_as_lazy(resource_group_name, resource_name, custom_headers:custom_headers)
1557
+ first_page.get_all_items
1558
+ end
1559
+
1560
+ #
1561
+ # Get the security metadata for an IoT hub. For more information, see:
1562
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
1563
+ #
1564
+ # Get the security metadata for an IoT hub. For more information, see:
1565
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
1566
+ #
1567
+ # @param resource_group_name [String] The name of the resource group that
1568
+ # contains the IoT hub.
1569
+ # @param resource_name [String] The name of the IoT hub.
1570
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1571
+ # will be added to the HTTP request.
1572
+ #
1573
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1574
+ #
1575
+ def list_keys_with_http_info(resource_group_name, resource_name, custom_headers:nil)
1576
+ list_keys_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
1577
+ end
1578
+
1579
+ #
1580
+ # Get the security metadata for an IoT hub. For more information, see:
1581
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
1582
+ #
1583
+ # Get the security metadata for an IoT hub. For more information, see:
1584
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
1585
+ #
1586
+ # @param resource_group_name [String] The name of the resource group that
1587
+ # contains the IoT hub.
1588
+ # @param resource_name [String] The name of the IoT hub.
1589
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1590
+ # to the HTTP request.
1591
+ #
1592
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1593
+ #
1594
+ def list_keys_async(resource_group_name, resource_name, custom_headers:nil)
1595
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1596
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1597
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1598
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1599
+
1600
+
1601
+ request_headers = {}
1602
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1603
+
1604
+ # Set Headers
1605
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1606
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1607
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys'
1608
+
1609
+ request_url = @base_url || @client.base_url
1610
+
1611
+ options = {
1612
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1613
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
1614
+ query_params: {'api-version' => @client.api_version},
1615
+ headers: request_headers.merge(custom_headers || {}),
1616
+ base_url: request_url
1617
+ }
1618
+ promise = @client.make_request_async(:post, path_template, options)
1619
+
1620
+ promise = promise.then do |result|
1621
+ http_response = result.response
1622
+ status_code = http_response.status
1623
+ response_content = http_response.body
1624
+ unless status_code == 200
1625
+ error_model = JSON.load(response_content)
1626
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1627
+ end
1628
+
1629
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1630
+ # Deserialize Response
1631
+ if status_code == 200
1632
+ begin
1633
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1634
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::SharedAccessSignatureAuthorizationRuleListResult.mapper()
1635
+ result.body = @client.deserialize(result_mapper, parsed_response)
1636
+ rescue Exception => e
1637
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1638
+ end
1639
+ end
1640
+
1641
+ result
1642
+ end
1643
+
1644
+ promise.execute
1645
+ end
1646
+
1647
+ #
1648
+ # Get a shared access policy by name from an IoT hub. For more information,
1649
+ # see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
1650
+ #
1651
+ # Get a shared access policy by name from an IoT hub. For more information,
1652
+ # see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
1653
+ #
1654
+ # @param resource_group_name [String] The name of the resource group that
1655
+ # contains the IoT hub.
1656
+ # @param resource_name [String] The name of the IoT hub.
1657
+ # @param key_name [String] The name of the shared access policy.
1658
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1659
+ # will be added to the HTTP request.
1660
+ #
1661
+ # @return [SharedAccessSignatureAuthorizationRule] operation results.
1662
+ #
1663
+ def get_keys_for_key_name(resource_group_name, resource_name, key_name, custom_headers:nil)
1664
+ response = get_keys_for_key_name_async(resource_group_name, resource_name, key_name, custom_headers:custom_headers).value!
1665
+ response.body unless response.nil?
1666
+ end
1667
+
1668
+ #
1669
+ # Get a shared access policy by name from an IoT hub. For more information,
1670
+ # see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
1671
+ #
1672
+ # Get a shared access policy by name from an IoT hub. For more information,
1673
+ # see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
1674
+ #
1675
+ # @param resource_group_name [String] The name of the resource group that
1676
+ # contains the IoT hub.
1677
+ # @param resource_name [String] The name of the IoT hub.
1678
+ # @param key_name [String] The name of the shared access policy.
1679
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1680
+ # will be added to the HTTP request.
1681
+ #
1682
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1683
+ #
1684
+ def get_keys_for_key_name_with_http_info(resource_group_name, resource_name, key_name, custom_headers:nil)
1685
+ get_keys_for_key_name_async(resource_group_name, resource_name, key_name, custom_headers:custom_headers).value!
1686
+ end
1687
+
1688
+ #
1689
+ # Get a shared access policy by name from an IoT hub. For more information,
1690
+ # see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
1691
+ #
1692
+ # Get a shared access policy by name from an IoT hub. For more information,
1693
+ # see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
1694
+ #
1695
+ # @param resource_group_name [String] The name of the resource group that
1696
+ # contains the IoT hub.
1697
+ # @param resource_name [String] The name of the IoT hub.
1698
+ # @param key_name [String] The name of the shared access policy.
1699
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1700
+ # to the HTTP request.
1701
+ #
1702
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1703
+ #
1704
+ def get_keys_for_key_name_async(resource_group_name, resource_name, key_name, custom_headers:nil)
1705
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1706
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1707
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1708
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1709
+ fail ArgumentError, 'key_name is nil' if key_name.nil?
1710
+
1711
+
1712
+ request_headers = {}
1713
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1714
+
1715
+ # Set Headers
1716
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1717
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1718
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys'
1719
+
1720
+ request_url = @base_url || @client.base_url
1721
+
1722
+ options = {
1723
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1724
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'keyName' => key_name},
1725
+ query_params: {'api-version' => @client.api_version},
1726
+ headers: request_headers.merge(custom_headers || {}),
1727
+ base_url: request_url
1728
+ }
1729
+ promise = @client.make_request_async(:post, path_template, options)
1730
+
1731
+ promise = promise.then do |result|
1732
+ http_response = result.response
1733
+ status_code = http_response.status
1734
+ response_content = http_response.body
1735
+ unless status_code == 200
1736
+ error_model = JSON.load(response_content)
1737
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1738
+ end
1739
+
1740
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1741
+ # Deserialize Response
1742
+ if status_code == 200
1743
+ begin
1744
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1745
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::SharedAccessSignatureAuthorizationRule.mapper()
1746
+ result.body = @client.deserialize(result_mapper, parsed_response)
1747
+ rescue Exception => e
1748
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1749
+ end
1750
+ end
1751
+
1752
+ result
1753
+ end
1754
+
1755
+ promise.execute
1756
+ end
1757
+
1758
+ #
1759
+ # Exports all the device identities in the IoT hub identity registry to an
1760
+ # Azure Storage blob container. For more information, see:
1761
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
1762
+ #
1763
+ # Exports all the device identities in the IoT hub identity registry to an
1764
+ # Azure Storage blob container. For more information, see:
1765
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
1766
+ #
1767
+ # @param resource_group_name [String] The name of the resource group that
1768
+ # contains the IoT hub.
1769
+ # @param resource_name [String] The name of the IoT hub.
1770
+ # @param export_devices_parameters [ExportDevicesRequest] The parameters that
1771
+ # specify the export devices operation.
1772
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1773
+ # will be added to the HTTP request.
1774
+ #
1775
+ # @return [JobResponse] operation results.
1776
+ #
1777
+ def export_devices(resource_group_name, resource_name, export_devices_parameters, custom_headers:nil)
1778
+ response = export_devices_async(resource_group_name, resource_name, export_devices_parameters, custom_headers:custom_headers).value!
1779
+ response.body unless response.nil?
1780
+ end
1781
+
1782
+ #
1783
+ # Exports all the device identities in the IoT hub identity registry to an
1784
+ # Azure Storage blob container. For more information, see:
1785
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
1786
+ #
1787
+ # Exports all the device identities in the IoT hub identity registry to an
1788
+ # Azure Storage blob container. For more information, see:
1789
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
1790
+ #
1791
+ # @param resource_group_name [String] The name of the resource group that
1792
+ # contains the IoT hub.
1793
+ # @param resource_name [String] The name of the IoT hub.
1794
+ # @param export_devices_parameters [ExportDevicesRequest] The parameters that
1795
+ # specify the export devices operation.
1796
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1797
+ # will be added to the HTTP request.
1798
+ #
1799
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1800
+ #
1801
+ def export_devices_with_http_info(resource_group_name, resource_name, export_devices_parameters, custom_headers:nil)
1802
+ export_devices_async(resource_group_name, resource_name, export_devices_parameters, custom_headers:custom_headers).value!
1803
+ end
1804
+
1805
+ #
1806
+ # Exports all the device identities in the IoT hub identity registry to an
1807
+ # Azure Storage blob container. For more information, see:
1808
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
1809
+ #
1810
+ # Exports all the device identities in the IoT hub identity registry to an
1811
+ # Azure Storage blob container. For more information, see:
1812
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
1813
+ #
1814
+ # @param resource_group_name [String] The name of the resource group that
1815
+ # contains the IoT hub.
1816
+ # @param resource_name [String] The name of the IoT hub.
1817
+ # @param export_devices_parameters [ExportDevicesRequest] The parameters that
1818
+ # specify the export devices operation.
1819
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1820
+ # to the HTTP request.
1821
+ #
1822
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1823
+ #
1824
+ def export_devices_async(resource_group_name, resource_name, export_devices_parameters, custom_headers:nil)
1825
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1826
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1827
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1828
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1829
+ fail ArgumentError, 'export_devices_parameters is nil' if export_devices_parameters.nil?
1830
+
1831
+
1832
+ request_headers = {}
1833
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1834
+
1835
+ # Set Headers
1836
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1837
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1838
+
1839
+ # Serialize Request
1840
+ request_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::ExportDevicesRequest.mapper()
1841
+ request_content = @client.serialize(request_mapper, export_devices_parameters)
1842
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1843
+
1844
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices'
1845
+
1846
+ request_url = @base_url || @client.base_url
1847
+
1848
+ options = {
1849
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1850
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
1851
+ query_params: {'api-version' => @client.api_version},
1852
+ body: request_content,
1853
+ headers: request_headers.merge(custom_headers || {}),
1854
+ base_url: request_url
1855
+ }
1856
+ promise = @client.make_request_async(:post, path_template, options)
1857
+
1858
+ promise = promise.then do |result|
1859
+ http_response = result.response
1860
+ status_code = http_response.status
1861
+ response_content = http_response.body
1862
+ unless status_code == 200
1863
+ error_model = JSON.load(response_content)
1864
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1865
+ end
1866
+
1867
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1868
+ # Deserialize Response
1869
+ if status_code == 200
1870
+ begin
1871
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1872
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::JobResponse.mapper()
1873
+ result.body = @client.deserialize(result_mapper, parsed_response)
1874
+ rescue Exception => e
1875
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1876
+ end
1877
+ end
1878
+
1879
+ result
1880
+ end
1881
+
1882
+ promise.execute
1883
+ end
1884
+
1885
+ #
1886
+ # Import, update, or delete device identities in the IoT hub identity registry
1887
+ # from a blob. For more information, see:
1888
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
1889
+ #
1890
+ # Import, update, or delete device identities in the IoT hub identity registry
1891
+ # from a blob. For more information, see:
1892
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
1893
+ #
1894
+ # @param resource_group_name [String] The name of the resource group that
1895
+ # contains the IoT hub.
1896
+ # @param resource_name [String] The name of the IoT hub.
1897
+ # @param import_devices_parameters [ImportDevicesRequest] The parameters that
1898
+ # specify the import devices operation.
1899
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1900
+ # will be added to the HTTP request.
1901
+ #
1902
+ # @return [JobResponse] operation results.
1903
+ #
1904
+ def import_devices(resource_group_name, resource_name, import_devices_parameters, custom_headers:nil)
1905
+ response = import_devices_async(resource_group_name, resource_name, import_devices_parameters, custom_headers:custom_headers).value!
1906
+ response.body unless response.nil?
1907
+ end
1908
+
1909
+ #
1910
+ # Import, update, or delete device identities in the IoT hub identity registry
1911
+ # from a blob. For more information, see:
1912
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
1913
+ #
1914
+ # Import, update, or delete device identities in the IoT hub identity registry
1915
+ # from a blob. For more information, see:
1916
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
1917
+ #
1918
+ # @param resource_group_name [String] The name of the resource group that
1919
+ # contains the IoT hub.
1920
+ # @param resource_name [String] The name of the IoT hub.
1921
+ # @param import_devices_parameters [ImportDevicesRequest] The parameters that
1922
+ # specify the import devices operation.
1923
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1924
+ # will be added to the HTTP request.
1925
+ #
1926
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1927
+ #
1928
+ def import_devices_with_http_info(resource_group_name, resource_name, import_devices_parameters, custom_headers:nil)
1929
+ import_devices_async(resource_group_name, resource_name, import_devices_parameters, custom_headers:custom_headers).value!
1930
+ end
1931
+
1932
+ #
1933
+ # Import, update, or delete device identities in the IoT hub identity registry
1934
+ # from a blob. For more information, see:
1935
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
1936
+ #
1937
+ # Import, update, or delete device identities in the IoT hub identity registry
1938
+ # from a blob. For more information, see:
1939
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
1940
+ #
1941
+ # @param resource_group_name [String] The name of the resource group that
1942
+ # contains the IoT hub.
1943
+ # @param resource_name [String] The name of the IoT hub.
1944
+ # @param import_devices_parameters [ImportDevicesRequest] The parameters that
1945
+ # specify the import devices operation.
1946
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1947
+ # to the HTTP request.
1948
+ #
1949
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1950
+ #
1951
+ def import_devices_async(resource_group_name, resource_name, import_devices_parameters, custom_headers:nil)
1952
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1953
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1954
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1955
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
1956
+ fail ArgumentError, 'import_devices_parameters is nil' if import_devices_parameters.nil?
1957
+
1958
+
1959
+ request_headers = {}
1960
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1961
+
1962
+ # Set Headers
1963
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1964
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1965
+
1966
+ # Serialize Request
1967
+ request_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::ImportDevicesRequest.mapper()
1968
+ request_content = @client.serialize(request_mapper, import_devices_parameters)
1969
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1970
+
1971
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices'
1972
+
1973
+ request_url = @base_url || @client.base_url
1974
+
1975
+ options = {
1976
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1977
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
1978
+ query_params: {'api-version' => @client.api_version},
1979
+ body: request_content,
1980
+ headers: request_headers.merge(custom_headers || {}),
1981
+ base_url: request_url
1982
+ }
1983
+ promise = @client.make_request_async(:post, path_template, options)
1984
+
1985
+ promise = promise.then do |result|
1986
+ http_response = result.response
1987
+ status_code = http_response.status
1988
+ response_content = http_response.body
1989
+ unless status_code == 200
1990
+ error_model = JSON.load(response_content)
1991
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1992
+ end
1993
+
1994
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1995
+ # Deserialize Response
1996
+ if status_code == 200
1997
+ begin
1998
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1999
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::JobResponse.mapper()
2000
+ result.body = @client.deserialize(result_mapper, parsed_response)
2001
+ rescue Exception => e
2002
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2003
+ end
2004
+ end
2005
+
2006
+ result
2007
+ end
2008
+
2009
+ promise.execute
2010
+ end
2011
+
2012
+ #
2013
+ # Create or update the metadata of an IoT hub.
2014
+ #
2015
+ # Create or update the metadata of an Iot hub. The usual pattern to modify a
2016
+ # property is to retrieve the IoT hub metadata and security metadata, and then
2017
+ # combine them with the modified values in a new body to update the IoT hub.
2018
+ #
2019
+ # @param resource_group_name [String] The name of the resource group that
2020
+ # contains the IoT hub.
2021
+ # @param resource_name [String] The name of the IoT hub.
2022
+ # @param iot_hub_description [IotHubDescription] The IoT hub metadata and
2023
+ # security metadata.
2024
+ # @param if_match [String] ETag of the IoT Hub. Do not specify for creating a
2025
+ # brand new IoT Hub. Required to update an existing IoT Hub.
2026
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2027
+ # will be added to the HTTP request.
2028
+ #
2029
+ # @return [IotHubDescription] operation results.
2030
+ #
2031
+ def begin_create_or_update(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil)
2032
+ response = begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:if_match, custom_headers:custom_headers).value!
2033
+ response.body unless response.nil?
2034
+ end
2035
+
2036
+ #
2037
+ # Create or update the metadata of an IoT hub.
2038
+ #
2039
+ # Create or update the metadata of an Iot hub. The usual pattern to modify a
2040
+ # property is to retrieve the IoT hub metadata and security metadata, and then
2041
+ # combine them with the modified values in a new body to update the IoT hub.
2042
+ #
2043
+ # @param resource_group_name [String] The name of the resource group that
2044
+ # contains the IoT hub.
2045
+ # @param resource_name [String] The name of the IoT hub.
2046
+ # @param iot_hub_description [IotHubDescription] The IoT hub metadata and
2047
+ # security metadata.
2048
+ # @param if_match [String] ETag of the IoT Hub. Do not specify for creating a
2049
+ # brand new IoT Hub. Required to update an existing IoT Hub.
2050
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2051
+ # will be added to the HTTP request.
2052
+ #
2053
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2054
+ #
2055
+ def begin_create_or_update_with_http_info(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil)
2056
+ begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:if_match, custom_headers:custom_headers).value!
2057
+ end
2058
+
2059
+ #
2060
+ # Create or update the metadata of an IoT hub.
2061
+ #
2062
+ # Create or update the metadata of an Iot hub. The usual pattern to modify a
2063
+ # property is to retrieve the IoT hub metadata and security metadata, and then
2064
+ # combine them with the modified values in a new body to update the IoT hub.
2065
+ #
2066
+ # @param resource_group_name [String] The name of the resource group that
2067
+ # contains the IoT hub.
2068
+ # @param resource_name [String] The name of the IoT hub.
2069
+ # @param iot_hub_description [IotHubDescription] The IoT hub metadata and
2070
+ # security metadata.
2071
+ # @param if_match [String] ETag of the IoT Hub. Do not specify for creating a
2072
+ # brand new IoT Hub. Required to update an existing IoT Hub.
2073
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2074
+ # to the HTTP request.
2075
+ #
2076
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2077
+ #
2078
+ def begin_create_or_update_async(resource_group_name, resource_name, iot_hub_description, if_match:nil, custom_headers:nil)
2079
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2080
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2081
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2082
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
2083
+ fail ArgumentError, 'iot_hub_description is nil' if iot_hub_description.nil?
2084
+
2085
+
2086
+ request_headers = {}
2087
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2088
+
2089
+ # Set Headers
2090
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2091
+ request_headers['If-Match'] = if_match unless if_match.nil?
2092
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2093
+
2094
+ # Serialize Request
2095
+ request_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubDescription.mapper()
2096
+ request_content = @client.serialize(request_mapper, iot_hub_description)
2097
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2098
+
2099
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'
2100
+
2101
+ request_url = @base_url || @client.base_url
2102
+
2103
+ options = {
2104
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2105
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
2106
+ query_params: {'api-version' => @client.api_version},
2107
+ body: request_content,
2108
+ headers: request_headers.merge(custom_headers || {}),
2109
+ base_url: request_url
2110
+ }
2111
+ promise = @client.make_request_async(:put, path_template, options)
2112
+
2113
+ promise = promise.then do |result|
2114
+ http_response = result.response
2115
+ status_code = http_response.status
2116
+ response_content = http_response.body
2117
+ unless status_code == 201 || status_code == 200
2118
+ error_model = JSON.load(response_content)
2119
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2120
+ end
2121
+
2122
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2123
+ # Deserialize Response
2124
+ if status_code == 201
2125
+ begin
2126
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2127
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubDescription.mapper()
2128
+ result.body = @client.deserialize(result_mapper, parsed_response)
2129
+ rescue Exception => e
2130
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2131
+ end
2132
+ end
2133
+ # Deserialize Response
2134
+ if status_code == 200
2135
+ begin
2136
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2137
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubDescription.mapper()
2138
+ result.body = @client.deserialize(result_mapper, parsed_response)
2139
+ rescue Exception => e
2140
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2141
+ end
2142
+ end
2143
+
2144
+ result
2145
+ end
2146
+
2147
+ promise.execute
2148
+ end
2149
+
2150
+ #
2151
+ # Update an existing IoT Hubs tags.
2152
+ #
2153
+ # Update an existing IoT Hub tags. to update other fields use the
2154
+ # CreateOrUpdate method
2155
+ #
2156
+ # @param resource_group_name [String] Resource group identifier.
2157
+ # @param resource_name [String] Name of iot hub to update.
2158
+ # @param iot_hub_tags [TagsResource] Updated tag information to set into the
2159
+ # iot hub instance.
2160
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2161
+ # will be added to the HTTP request.
2162
+ #
2163
+ # @return [IotHubDescription] operation results.
2164
+ #
2165
+ def begin_update(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
2166
+ response = begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:custom_headers).value!
2167
+ response.body unless response.nil?
2168
+ end
2169
+
2170
+ #
2171
+ # Update an existing IoT Hubs tags.
2172
+ #
2173
+ # Update an existing IoT Hub tags. to update other fields use the
2174
+ # CreateOrUpdate method
2175
+ #
2176
+ # @param resource_group_name [String] Resource group identifier.
2177
+ # @param resource_name [String] Name of iot hub to update.
2178
+ # @param iot_hub_tags [TagsResource] Updated tag information to set into the
2179
+ # iot hub instance.
2180
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2181
+ # will be added to the HTTP request.
2182
+ #
2183
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2184
+ #
2185
+ def begin_update_with_http_info(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
2186
+ begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:custom_headers).value!
2187
+ end
2188
+
2189
+ #
2190
+ # Update an existing IoT Hubs tags.
2191
+ #
2192
+ # Update an existing IoT Hub tags. to update other fields use the
2193
+ # CreateOrUpdate method
2194
+ #
2195
+ # @param resource_group_name [String] Resource group identifier.
2196
+ # @param resource_name [String] Name of iot hub to update.
2197
+ # @param iot_hub_tags [TagsResource] Updated tag information to set into the
2198
+ # iot hub instance.
2199
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2200
+ # to the HTTP request.
2201
+ #
2202
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2203
+ #
2204
+ def begin_update_async(resource_group_name, resource_name, iot_hub_tags, custom_headers:nil)
2205
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2206
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2207
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
2208
+ fail ArgumentError, 'iot_hub_tags is nil' if iot_hub_tags.nil?
2209
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2210
+
2211
+
2212
+ request_headers = {}
2213
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2214
+
2215
+ # Set Headers
2216
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2217
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2218
+
2219
+ # Serialize Request
2220
+ request_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::TagsResource.mapper()
2221
+ request_content = @client.serialize(request_mapper, iot_hub_tags)
2222
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2223
+
2224
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'
2225
+
2226
+ request_url = @base_url || @client.base_url
2227
+
2228
+ options = {
2229
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2230
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
2231
+ query_params: {'api-version' => @client.api_version},
2232
+ body: request_content,
2233
+ headers: request_headers.merge(custom_headers || {}),
2234
+ base_url: request_url
2235
+ }
2236
+ promise = @client.make_request_async(:patch, path_template, options)
2237
+
2238
+ promise = promise.then do |result|
2239
+ http_response = result.response
2240
+ status_code = http_response.status
2241
+ response_content = http_response.body
2242
+ unless status_code == 200
2243
+ error_model = JSON.load(response_content)
2244
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2245
+ end
2246
+
2247
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2248
+ # Deserialize Response
2249
+ if status_code == 200
2250
+ begin
2251
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2252
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubDescription.mapper()
2253
+ result.body = @client.deserialize(result_mapper, parsed_response)
2254
+ rescue Exception => e
2255
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2256
+ end
2257
+ end
2258
+
2259
+ result
2260
+ end
2261
+
2262
+ promise.execute
2263
+ end
2264
+
2265
+ #
2266
+ # Delete an IoT hub.
2267
+ #
2268
+ # Delete an IoT hub.
2269
+ #
2270
+ # @param resource_group_name [String] The name of the resource group that
2271
+ # contains the IoT hub.
2272
+ # @param resource_name [String] The name of the IoT hub.
2273
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2274
+ # will be added to the HTTP request.
2275
+ #
2276
+ # @return [Object] operation results.
2277
+ #
2278
+ def begin_delete(resource_group_name, resource_name, custom_headers:nil)
2279
+ response = begin_delete_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
2280
+ response.body unless response.nil?
2281
+ end
2282
+
2283
+ #
2284
+ # Delete an IoT hub.
2285
+ #
2286
+ # Delete an IoT hub.
2287
+ #
2288
+ # @param resource_group_name [String] The name of the resource group that
2289
+ # contains the IoT hub.
2290
+ # @param resource_name [String] The name of the IoT hub.
2291
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2292
+ # will be added to the HTTP request.
2293
+ #
2294
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2295
+ #
2296
+ def begin_delete_with_http_info(resource_group_name, resource_name, custom_headers:nil)
2297
+ begin_delete_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
2298
+ end
2299
+
2300
+ #
2301
+ # Delete an IoT hub.
2302
+ #
2303
+ # Delete an IoT hub.
2304
+ #
2305
+ # @param resource_group_name [String] The name of the resource group that
2306
+ # contains the IoT hub.
2307
+ # @param resource_name [String] The name of the IoT hub.
2308
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2309
+ # to the HTTP request.
2310
+ #
2311
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2312
+ #
2313
+ def begin_delete_async(resource_group_name, resource_name, custom_headers:nil)
2314
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2315
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2316
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2317
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
2318
+
2319
+
2320
+ request_headers = {}
2321
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2322
+
2323
+ # Set Headers
2324
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2325
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2326
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'
2327
+
2328
+ request_url = @base_url || @client.base_url
2329
+
2330
+ options = {
2331
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2332
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
2333
+ query_params: {'api-version' => @client.api_version},
2334
+ headers: request_headers.merge(custom_headers || {}),
2335
+ base_url: request_url
2336
+ }
2337
+ promise = @client.make_request_async(:delete, path_template, options)
2338
+
2339
+ promise = promise.then do |result|
2340
+ http_response = result.response
2341
+ status_code = http_response.status
2342
+ response_content = http_response.body
2343
+ unless status_code == 202 || status_code == 200 || status_code == 204 || status_code == 404
2344
+ error_model = JSON.load(response_content)
2345
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2346
+ end
2347
+
2348
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2349
+ # Deserialize Response
2350
+ if status_code == 202
2351
+ begin
2352
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2353
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubDescription.mapper()
2354
+ result.body = @client.deserialize(result_mapper, parsed_response)
2355
+ rescue Exception => e
2356
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2357
+ end
2358
+ end
2359
+ # Deserialize Response
2360
+ if status_code == 200
2361
+ begin
2362
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2363
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubDescription.mapper()
2364
+ result.body = @client.deserialize(result_mapper, parsed_response)
2365
+ rescue Exception => e
2366
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2367
+ end
2368
+ end
2369
+ # Deserialize Response
2370
+ if status_code == 404
2371
+ begin
2372
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2373
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::ErrorDetails.mapper()
2374
+ result.body = @client.deserialize(result_mapper, parsed_response)
2375
+ rescue Exception => e
2376
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2377
+ end
2378
+ end
2379
+
2380
+ result
2381
+ end
2382
+
2383
+ promise.execute
2384
+ end
2385
+
2386
+ #
2387
+ # Get all the IoT hubs in a subscription.
2388
+ #
2389
+ # Get all the IoT hubs in a subscription.
2390
+ #
2391
+ # @param next_page_link [String] The NextLink from the previous successful call
2392
+ # to List operation.
2393
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2394
+ # will be added to the HTTP request.
2395
+ #
2396
+ # @return [IotHubDescriptionListResult] operation results.
2397
+ #
2398
+ def list_by_subscription_next(next_page_link, custom_headers:nil)
2399
+ response = list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
2400
+ response.body unless response.nil?
2401
+ end
2402
+
2403
+ #
2404
+ # Get all the IoT hubs in a subscription.
2405
+ #
2406
+ # Get all the IoT hubs in a subscription.
2407
+ #
2408
+ # @param next_page_link [String] The NextLink from the previous successful call
2409
+ # to List operation.
2410
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2411
+ # will be added to the HTTP request.
2412
+ #
2413
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2414
+ #
2415
+ def list_by_subscription_next_with_http_info(next_page_link, custom_headers:nil)
2416
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
2417
+ end
2418
+
2419
+ #
2420
+ # Get all the IoT hubs in a subscription.
2421
+ #
2422
+ # Get all the IoT hubs in a subscription.
2423
+ #
2424
+ # @param next_page_link [String] The NextLink from the previous successful call
2425
+ # to List operation.
2426
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2427
+ # to the HTTP request.
2428
+ #
2429
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2430
+ #
2431
+ def list_by_subscription_next_async(next_page_link, custom_headers:nil)
2432
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2433
+
2434
+
2435
+ request_headers = {}
2436
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2437
+
2438
+ # Set Headers
2439
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2440
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2441
+ path_template = '{nextLink}'
2442
+
2443
+ request_url = @base_url || @client.base_url
2444
+
2445
+ options = {
2446
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2447
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2448
+ headers: request_headers.merge(custom_headers || {}),
2449
+ base_url: request_url
2450
+ }
2451
+ promise = @client.make_request_async(:get, path_template, options)
2452
+
2453
+ promise = promise.then do |result|
2454
+ http_response = result.response
2455
+ status_code = http_response.status
2456
+ response_content = http_response.body
2457
+ unless status_code == 200
2458
+ error_model = JSON.load(response_content)
2459
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2460
+ end
2461
+
2462
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2463
+ # Deserialize Response
2464
+ if status_code == 200
2465
+ begin
2466
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2467
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubDescriptionListResult.mapper()
2468
+ result.body = @client.deserialize(result_mapper, parsed_response)
2469
+ rescue Exception => e
2470
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2471
+ end
2472
+ end
2473
+
2474
+ result
2475
+ end
2476
+
2477
+ promise.execute
2478
+ end
2479
+
2480
+ #
2481
+ # Get all the IoT hubs in a resource group.
2482
+ #
2483
+ # Get all the IoT hubs in a resource group.
2484
+ #
2485
+ # @param next_page_link [String] The NextLink from the previous successful call
2486
+ # to List operation.
2487
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2488
+ # will be added to the HTTP request.
2489
+ #
2490
+ # @return [IotHubDescriptionListResult] operation results.
2491
+ #
2492
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
2493
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
2494
+ response.body unless response.nil?
2495
+ end
2496
+
2497
+ #
2498
+ # Get all the IoT hubs in a resource group.
2499
+ #
2500
+ # Get all the IoT hubs in a resource group.
2501
+ #
2502
+ # @param next_page_link [String] The NextLink from the previous successful call
2503
+ # to List operation.
2504
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2505
+ # will be added to the HTTP request.
2506
+ #
2507
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2508
+ #
2509
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
2510
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
2511
+ end
2512
+
2513
+ #
2514
+ # Get all the IoT hubs in a resource group.
2515
+ #
2516
+ # Get all the IoT hubs in a resource group.
2517
+ #
2518
+ # @param next_page_link [String] The NextLink from the previous successful call
2519
+ # to List operation.
2520
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2521
+ # to the HTTP request.
2522
+ #
2523
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2524
+ #
2525
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
2526
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2527
+
2528
+
2529
+ request_headers = {}
2530
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2531
+
2532
+ # Set Headers
2533
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2534
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2535
+ path_template = '{nextLink}'
2536
+
2537
+ request_url = @base_url || @client.base_url
2538
+
2539
+ options = {
2540
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2541
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2542
+ headers: request_headers.merge(custom_headers || {}),
2543
+ base_url: request_url
2544
+ }
2545
+ promise = @client.make_request_async(:get, path_template, options)
2546
+
2547
+ promise = promise.then do |result|
2548
+ http_response = result.response
2549
+ status_code = http_response.status
2550
+ response_content = http_response.body
2551
+ unless status_code == 200
2552
+ error_model = JSON.load(response_content)
2553
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2554
+ end
2555
+
2556
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2557
+ # Deserialize Response
2558
+ if status_code == 200
2559
+ begin
2560
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2561
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubDescriptionListResult.mapper()
2562
+ result.body = @client.deserialize(result_mapper, parsed_response)
2563
+ rescue Exception => e
2564
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2565
+ end
2566
+ end
2567
+
2568
+ result
2569
+ end
2570
+
2571
+ promise.execute
2572
+ end
2573
+
2574
+ #
2575
+ # Get the list of valid SKUs for an IoT hub.
2576
+ #
2577
+ # Get the list of valid SKUs for an IoT hub.
2578
+ #
2579
+ # @param next_page_link [String] The NextLink from the previous successful call
2580
+ # to List operation.
2581
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2582
+ # will be added to the HTTP request.
2583
+ #
2584
+ # @return [IotHubSkuDescriptionListResult] operation results.
2585
+ #
2586
+ def get_valid_skus_next(next_page_link, custom_headers:nil)
2587
+ response = get_valid_skus_next_async(next_page_link, custom_headers:custom_headers).value!
2588
+ response.body unless response.nil?
2589
+ end
2590
+
2591
+ #
2592
+ # Get the list of valid SKUs for an IoT hub.
2593
+ #
2594
+ # Get the list of valid SKUs for an IoT hub.
2595
+ #
2596
+ # @param next_page_link [String] The NextLink from the previous successful call
2597
+ # to List operation.
2598
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2599
+ # will be added to the HTTP request.
2600
+ #
2601
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2602
+ #
2603
+ def get_valid_skus_next_with_http_info(next_page_link, custom_headers:nil)
2604
+ get_valid_skus_next_async(next_page_link, custom_headers:custom_headers).value!
2605
+ end
2606
+
2607
+ #
2608
+ # Get the list of valid SKUs for an IoT hub.
2609
+ #
2610
+ # Get the list of valid SKUs for an IoT hub.
2611
+ #
2612
+ # @param next_page_link [String] The NextLink from the previous successful call
2613
+ # to List operation.
2614
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2615
+ # to the HTTP request.
2616
+ #
2617
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2618
+ #
2619
+ def get_valid_skus_next_async(next_page_link, custom_headers:nil)
2620
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2621
+
2622
+
2623
+ request_headers = {}
2624
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2625
+
2626
+ # Set Headers
2627
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2628
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2629
+ path_template = '{nextLink}'
2630
+
2631
+ request_url = @base_url || @client.base_url
2632
+
2633
+ options = {
2634
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2635
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2636
+ headers: request_headers.merge(custom_headers || {}),
2637
+ base_url: request_url
2638
+ }
2639
+ promise = @client.make_request_async(:get, path_template, options)
2640
+
2641
+ promise = promise.then do |result|
2642
+ http_response = result.response
2643
+ status_code = http_response.status
2644
+ response_content = http_response.body
2645
+ unless status_code == 200
2646
+ error_model = JSON.load(response_content)
2647
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2648
+ end
2649
+
2650
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2651
+ # Deserialize Response
2652
+ if status_code == 200
2653
+ begin
2654
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2655
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubSkuDescriptionListResult.mapper()
2656
+ result.body = @client.deserialize(result_mapper, parsed_response)
2657
+ rescue Exception => e
2658
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2659
+ end
2660
+ end
2661
+
2662
+ result
2663
+ end
2664
+
2665
+ promise.execute
2666
+ end
2667
+
2668
+ #
2669
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
2670
+ # endpoint in an IoT hub.
2671
+ #
2672
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
2673
+ # endpoint in an IoT hub.
2674
+ #
2675
+ # @param next_page_link [String] The NextLink from the previous successful call
2676
+ # to List operation.
2677
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2678
+ # will be added to the HTTP request.
2679
+ #
2680
+ # @return [EventHubConsumerGroupsListResult] operation results.
2681
+ #
2682
+ def list_event_hub_consumer_groups_next(next_page_link, custom_headers:nil)
2683
+ response = list_event_hub_consumer_groups_next_async(next_page_link, custom_headers:custom_headers).value!
2684
+ response.body unless response.nil?
2685
+ end
2686
+
2687
+ #
2688
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
2689
+ # endpoint in an IoT hub.
2690
+ #
2691
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
2692
+ # endpoint in an IoT hub.
2693
+ #
2694
+ # @param next_page_link [String] The NextLink from the previous successful call
2695
+ # to List operation.
2696
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2697
+ # will be added to the HTTP request.
2698
+ #
2699
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2700
+ #
2701
+ def list_event_hub_consumer_groups_next_with_http_info(next_page_link, custom_headers:nil)
2702
+ list_event_hub_consumer_groups_next_async(next_page_link, custom_headers:custom_headers).value!
2703
+ end
2704
+
2705
+ #
2706
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
2707
+ # endpoint in an IoT hub.
2708
+ #
2709
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
2710
+ # endpoint in an IoT hub.
2711
+ #
2712
+ # @param next_page_link [String] The NextLink from the previous successful call
2713
+ # to List operation.
2714
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2715
+ # to the HTTP request.
2716
+ #
2717
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2718
+ #
2719
+ def list_event_hub_consumer_groups_next_async(next_page_link, custom_headers:nil)
2720
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2721
+
2722
+
2723
+ request_headers = {}
2724
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2725
+
2726
+ # Set Headers
2727
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2728
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2729
+ path_template = '{nextLink}'
2730
+
2731
+ request_url = @base_url || @client.base_url
2732
+
2733
+ options = {
2734
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2735
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2736
+ headers: request_headers.merge(custom_headers || {}),
2737
+ base_url: request_url
2738
+ }
2739
+ promise = @client.make_request_async(:get, path_template, options)
2740
+
2741
+ promise = promise.then do |result|
2742
+ http_response = result.response
2743
+ status_code = http_response.status
2744
+ response_content = http_response.body
2745
+ unless status_code == 200
2746
+ error_model = JSON.load(response_content)
2747
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2748
+ end
2749
+
2750
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2751
+ # Deserialize Response
2752
+ if status_code == 200
2753
+ begin
2754
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2755
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::EventHubConsumerGroupsListResult.mapper()
2756
+ result.body = @client.deserialize(result_mapper, parsed_response)
2757
+ rescue Exception => e
2758
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2759
+ end
2760
+ end
2761
+
2762
+ result
2763
+ end
2764
+
2765
+ promise.execute
2766
+ end
2767
+
2768
+ #
2769
+ # Get a list of all the jobs in an IoT hub. For more information, see:
2770
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
2771
+ #
2772
+ # Get a list of all the jobs in an IoT hub. For more information, see:
2773
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
2774
+ #
2775
+ # @param next_page_link [String] The NextLink from the previous successful call
2776
+ # to List operation.
2777
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2778
+ # will be added to the HTTP request.
2779
+ #
2780
+ # @return [JobResponseListResult] operation results.
2781
+ #
2782
+ def list_jobs_next(next_page_link, custom_headers:nil)
2783
+ response = list_jobs_next_async(next_page_link, custom_headers:custom_headers).value!
2784
+ response.body unless response.nil?
2785
+ end
2786
+
2787
+ #
2788
+ # Get a list of all the jobs in an IoT hub. For more information, see:
2789
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
2790
+ #
2791
+ # Get a list of all the jobs in an IoT hub. For more information, see:
2792
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
2793
+ #
2794
+ # @param next_page_link [String] The NextLink from the previous successful call
2795
+ # to List operation.
2796
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2797
+ # will be added to the HTTP request.
2798
+ #
2799
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2800
+ #
2801
+ def list_jobs_next_with_http_info(next_page_link, custom_headers:nil)
2802
+ list_jobs_next_async(next_page_link, custom_headers:custom_headers).value!
2803
+ end
2804
+
2805
+ #
2806
+ # Get a list of all the jobs in an IoT hub. For more information, see:
2807
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
2808
+ #
2809
+ # Get a list of all the jobs in an IoT hub. For more information, see:
2810
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
2811
+ #
2812
+ # @param next_page_link [String] The NextLink from the previous successful call
2813
+ # to List operation.
2814
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2815
+ # to the HTTP request.
2816
+ #
2817
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2818
+ #
2819
+ def list_jobs_next_async(next_page_link, custom_headers:nil)
2820
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2821
+
2822
+
2823
+ request_headers = {}
2824
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2825
+
2826
+ # Set Headers
2827
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2828
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2829
+ path_template = '{nextLink}'
2830
+
2831
+ request_url = @base_url || @client.base_url
2832
+
2833
+ options = {
2834
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2835
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2836
+ headers: request_headers.merge(custom_headers || {}),
2837
+ base_url: request_url
2838
+ }
2839
+ promise = @client.make_request_async(:get, path_template, options)
2840
+
2841
+ promise = promise.then do |result|
2842
+ http_response = result.response
2843
+ status_code = http_response.status
2844
+ response_content = http_response.body
2845
+ unless status_code == 200
2846
+ error_model = JSON.load(response_content)
2847
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2848
+ end
2849
+
2850
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2851
+ # Deserialize Response
2852
+ if status_code == 200
2853
+ begin
2854
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2855
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::JobResponseListResult.mapper()
2856
+ result.body = @client.deserialize(result_mapper, parsed_response)
2857
+ rescue Exception => e
2858
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2859
+ end
2860
+ end
2861
+
2862
+ result
2863
+ end
2864
+
2865
+ promise.execute
2866
+ end
2867
+
2868
+ #
2869
+ # Get the quota metrics for an IoT hub.
2870
+ #
2871
+ # Get the quota metrics for an IoT hub.
2872
+ #
2873
+ # @param next_page_link [String] The NextLink from the previous successful call
2874
+ # to List operation.
2875
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2876
+ # will be added to the HTTP request.
2877
+ #
2878
+ # @return [IotHubQuotaMetricInfoListResult] operation results.
2879
+ #
2880
+ def get_quota_metrics_next(next_page_link, custom_headers:nil)
2881
+ response = get_quota_metrics_next_async(next_page_link, custom_headers:custom_headers).value!
2882
+ response.body unless response.nil?
2883
+ end
2884
+
2885
+ #
2886
+ # Get the quota metrics for an IoT hub.
2887
+ #
2888
+ # Get the quota metrics for an IoT hub.
2889
+ #
2890
+ # @param next_page_link [String] The NextLink from the previous successful call
2891
+ # to List operation.
2892
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2893
+ # will be added to the HTTP request.
2894
+ #
2895
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2896
+ #
2897
+ def get_quota_metrics_next_with_http_info(next_page_link, custom_headers:nil)
2898
+ get_quota_metrics_next_async(next_page_link, custom_headers:custom_headers).value!
2899
+ end
2900
+
2901
+ #
2902
+ # Get the quota metrics for an IoT hub.
2903
+ #
2904
+ # Get the quota metrics for an IoT hub.
2905
+ #
2906
+ # @param next_page_link [String] The NextLink from the previous successful call
2907
+ # to List operation.
2908
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2909
+ # to the HTTP request.
2910
+ #
2911
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2912
+ #
2913
+ def get_quota_metrics_next_async(next_page_link, custom_headers:nil)
2914
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2915
+
2916
+
2917
+ request_headers = {}
2918
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2919
+
2920
+ # Set Headers
2921
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2922
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2923
+ path_template = '{nextLink}'
2924
+
2925
+ request_url = @base_url || @client.base_url
2926
+
2927
+ options = {
2928
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2929
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2930
+ headers: request_headers.merge(custom_headers || {}),
2931
+ base_url: request_url
2932
+ }
2933
+ promise = @client.make_request_async(:get, path_template, options)
2934
+
2935
+ promise = promise.then do |result|
2936
+ http_response = result.response
2937
+ status_code = http_response.status
2938
+ response_content = http_response.body
2939
+ unless status_code == 200
2940
+ error_model = JSON.load(response_content)
2941
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2942
+ end
2943
+
2944
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2945
+ # Deserialize Response
2946
+ if status_code == 200
2947
+ begin
2948
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2949
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::IotHubQuotaMetricInfoListResult.mapper()
2950
+ result.body = @client.deserialize(result_mapper, parsed_response)
2951
+ rescue Exception => e
2952
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2953
+ end
2954
+ end
2955
+
2956
+ result
2957
+ end
2958
+
2959
+ promise.execute
2960
+ end
2961
+
2962
+ #
2963
+ # Get the security metadata for an IoT hub. For more information, see:
2964
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
2965
+ #
2966
+ # Get the security metadata for an IoT hub. For more information, see:
2967
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
2968
+ #
2969
+ # @param next_page_link [String] The NextLink from the previous successful call
2970
+ # to List operation.
2971
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2972
+ # will be added to the HTTP request.
2973
+ #
2974
+ # @return [SharedAccessSignatureAuthorizationRuleListResult] operation results.
2975
+ #
2976
+ def list_keys_next(next_page_link, custom_headers:nil)
2977
+ response = list_keys_next_async(next_page_link, custom_headers:custom_headers).value!
2978
+ response.body unless response.nil?
2979
+ end
2980
+
2981
+ #
2982
+ # Get the security metadata for an IoT hub. For more information, see:
2983
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
2984
+ #
2985
+ # Get the security metadata for an IoT hub. For more information, see:
2986
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
2987
+ #
2988
+ # @param next_page_link [String] The NextLink from the previous successful call
2989
+ # to List operation.
2990
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2991
+ # will be added to the HTTP request.
2992
+ #
2993
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2994
+ #
2995
+ def list_keys_next_with_http_info(next_page_link, custom_headers:nil)
2996
+ list_keys_next_async(next_page_link, custom_headers:custom_headers).value!
2997
+ end
2998
+
2999
+ #
3000
+ # Get the security metadata for an IoT hub. For more information, see:
3001
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
3002
+ #
3003
+ # Get the security metadata for an IoT hub. For more information, see:
3004
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
3005
+ #
3006
+ # @param next_page_link [String] The NextLink from the previous successful call
3007
+ # to List operation.
3008
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3009
+ # to the HTTP request.
3010
+ #
3011
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3012
+ #
3013
+ def list_keys_next_async(next_page_link, custom_headers:nil)
3014
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
3015
+
3016
+
3017
+ request_headers = {}
3018
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3019
+
3020
+ # Set Headers
3021
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3022
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
3023
+ path_template = '{nextLink}'
3024
+
3025
+ request_url = @base_url || @client.base_url
3026
+
3027
+ options = {
3028
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3029
+ skip_encoding_path_params: {'nextLink' => next_page_link},
3030
+ headers: request_headers.merge(custom_headers || {}),
3031
+ base_url: request_url
3032
+ }
3033
+ promise = @client.make_request_async(:post, path_template, options)
3034
+
3035
+ promise = promise.then do |result|
3036
+ http_response = result.response
3037
+ status_code = http_response.status
3038
+ response_content = http_response.body
3039
+ unless status_code == 200
3040
+ error_model = JSON.load(response_content)
3041
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3042
+ end
3043
+
3044
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3045
+ # Deserialize Response
3046
+ if status_code == 200
3047
+ begin
3048
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3049
+ result_mapper = Azure::IotHub::Mgmt::V2018_01_22::Models::SharedAccessSignatureAuthorizationRuleListResult.mapper()
3050
+ result.body = @client.deserialize(result_mapper, parsed_response)
3051
+ rescue Exception => e
3052
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3053
+ end
3054
+ end
3055
+
3056
+ result
3057
+ end
3058
+
3059
+ promise.execute
3060
+ end
3061
+
3062
+ #
3063
+ # Get all the IoT hubs in a subscription.
3064
+ #
3065
+ # Get all the IoT hubs in a subscription.
3066
+ #
3067
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3068
+ # will be added to the HTTP request.
3069
+ #
3070
+ # @return [IotHubDescriptionListResult] which provide lazy access to pages of
3071
+ # the response.
3072
+ #
3073
+ def list_by_subscription_as_lazy(custom_headers:nil)
3074
+ response = list_by_subscription_async(custom_headers:custom_headers).value!
3075
+ unless response.nil?
3076
+ page = response.body
3077
+ page.next_method = Proc.new do |next_page_link|
3078
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers)
3079
+ end
3080
+ page
3081
+ end
3082
+ end
3083
+
3084
+ #
3085
+ # Get all the IoT hubs in a resource group.
3086
+ #
3087
+ # Get all the IoT hubs in a resource group.
3088
+ #
3089
+ # @param resource_group_name [String] The name of the resource group that
3090
+ # contains the IoT hub.
3091
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3092
+ # will be added to the HTTP request.
3093
+ #
3094
+ # @return [IotHubDescriptionListResult] which provide lazy access to pages of
3095
+ # the response.
3096
+ #
3097
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
3098
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
3099
+ unless response.nil?
3100
+ page = response.body
3101
+ page.next_method = Proc.new do |next_page_link|
3102
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
3103
+ end
3104
+ page
3105
+ end
3106
+ end
3107
+
3108
+ #
3109
+ # Get the list of valid SKUs for an IoT hub.
3110
+ #
3111
+ # Get the list of valid SKUs for an IoT hub.
3112
+ #
3113
+ # @param resource_group_name [String] The name of the resource group that
3114
+ # contains the IoT hub.
3115
+ # @param resource_name [String] The name of the IoT hub.
3116
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3117
+ # will be added to the HTTP request.
3118
+ #
3119
+ # @return [IotHubSkuDescriptionListResult] which provide lazy access to pages
3120
+ # of the response.
3121
+ #
3122
+ def get_valid_skus_as_lazy(resource_group_name, resource_name, custom_headers:nil)
3123
+ response = get_valid_skus_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
3124
+ unless response.nil?
3125
+ page = response.body
3126
+ page.next_method = Proc.new do |next_page_link|
3127
+ get_valid_skus_next_async(next_page_link, custom_headers:custom_headers)
3128
+ end
3129
+ page
3130
+ end
3131
+ end
3132
+
3133
+ #
3134
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
3135
+ # endpoint in an IoT hub.
3136
+ #
3137
+ # Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
3138
+ # endpoint in an IoT hub.
3139
+ #
3140
+ # @param resource_group_name [String] The name of the resource group that
3141
+ # contains the IoT hub.
3142
+ # @param resource_name [String] The name of the IoT hub.
3143
+ # @param event_hub_endpoint_name [String] The name of the Event Hub-compatible
3144
+ # endpoint.
3145
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3146
+ # will be added to the HTTP request.
3147
+ #
3148
+ # @return [EventHubConsumerGroupsListResult] which provide lazy access to pages
3149
+ # of the response.
3150
+ #
3151
+ def list_event_hub_consumer_groups_as_lazy(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:nil)
3152
+ response = list_event_hub_consumer_groups_async(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:custom_headers).value!
3153
+ unless response.nil?
3154
+ page = response.body
3155
+ page.next_method = Proc.new do |next_page_link|
3156
+ list_event_hub_consumer_groups_next_async(next_page_link, custom_headers:custom_headers)
3157
+ end
3158
+ page
3159
+ end
3160
+ end
3161
+
3162
+ #
3163
+ # Get a list of all the jobs in an IoT hub. For more information, see:
3164
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
3165
+ #
3166
+ # Get a list of all the jobs in an IoT hub. For more information, see:
3167
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
3168
+ #
3169
+ # @param resource_group_name [String] The name of the resource group that
3170
+ # contains the IoT hub.
3171
+ # @param resource_name [String] The name of the IoT hub.
3172
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3173
+ # will be added to the HTTP request.
3174
+ #
3175
+ # @return [JobResponseListResult] which provide lazy access to pages of the
3176
+ # response.
3177
+ #
3178
+ def list_jobs_as_lazy(resource_group_name, resource_name, custom_headers:nil)
3179
+ response = list_jobs_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
3180
+ unless response.nil?
3181
+ page = response.body
3182
+ page.next_method = Proc.new do |next_page_link|
3183
+ list_jobs_next_async(next_page_link, custom_headers:custom_headers)
3184
+ end
3185
+ page
3186
+ end
3187
+ end
3188
+
3189
+ #
3190
+ # Get the quota metrics for an IoT hub.
3191
+ #
3192
+ # Get the quota metrics for an IoT hub.
3193
+ #
3194
+ # @param resource_group_name [String] The name of the resource group that
3195
+ # contains the IoT hub.
3196
+ # @param resource_name [String] The name of the IoT hub.
3197
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3198
+ # will be added to the HTTP request.
3199
+ #
3200
+ # @return [IotHubQuotaMetricInfoListResult] which provide lazy access to pages
3201
+ # of the response.
3202
+ #
3203
+ def get_quota_metrics_as_lazy(resource_group_name, resource_name, custom_headers:nil)
3204
+ response = get_quota_metrics_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
3205
+ unless response.nil?
3206
+ page = response.body
3207
+ page.next_method = Proc.new do |next_page_link|
3208
+ get_quota_metrics_next_async(next_page_link, custom_headers:custom_headers)
3209
+ end
3210
+ page
3211
+ end
3212
+ end
3213
+
3214
+ #
3215
+ # Get the security metadata for an IoT hub. For more information, see:
3216
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
3217
+ #
3218
+ # Get the security metadata for an IoT hub. For more information, see:
3219
+ # https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
3220
+ #
3221
+ # @param resource_group_name [String] The name of the resource group that
3222
+ # contains the IoT hub.
3223
+ # @param resource_name [String] The name of the IoT hub.
3224
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3225
+ # will be added to the HTTP request.
3226
+ #
3227
+ # @return [SharedAccessSignatureAuthorizationRuleListResult] which provide lazy
3228
+ # access to pages of the response.
3229
+ #
3230
+ def list_keys_as_lazy(resource_group_name, resource_name, custom_headers:nil)
3231
+ response = list_keys_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
3232
+ unless response.nil?
3233
+ page = response.body
3234
+ page.next_method = Proc.new do |next_page_link|
3235
+ list_keys_next_async(next_page_link, custom_headers:custom_headers)
3236
+ end
3237
+ page
3238
+ end
3239
+ end
3240
+
3241
+ end
3242
+ end