azure_mgmt_iot_hub 0.13.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generated/azure_mgmt_iot_hub.rb +27 -18
  3. data/lib/generated/azure_mgmt_iot_hub/certificates.rb +704 -0
  4. data/lib/generated/azure_mgmt_iot_hub/iot_hub_client.rb +4 -0
  5. data/lib/generated/azure_mgmt_iot_hub/iot_hub_resource.rb +34 -23
  6. data/lib/generated/azure_mgmt_iot_hub/models/certificate_body_description.rb +45 -0
  7. data/lib/generated/azure_mgmt_iot_hub/models/certificate_description.rb +89 -0
  8. data/lib/generated/azure_mgmt_iot_hub/models/certificate_list_description.rb +53 -0
  9. data/lib/generated/azure_mgmt_iot_hub/models/certificate_properties.rb +100 -0
  10. data/lib/generated/azure_mgmt_iot_hub/models/certificate_properties_with_nonce.rb +113 -0
  11. data/lib/generated/azure_mgmt_iot_hub/models/certificate_verification_description.rb +45 -0
  12. data/lib/generated/azure_mgmt_iot_hub/models/certificate_with_nonce_description.rb +89 -0
  13. data/lib/generated/azure_mgmt_iot_hub/models/cloud_to_device_properties.rb +0 -1
  14. data/lib/generated/azure_mgmt_iot_hub/models/error_details.rb +0 -1
  15. data/lib/generated/azure_mgmt_iot_hub/models/event_hub_consumer_group_info.rb +0 -1
  16. data/lib/generated/azure_mgmt_iot_hub/models/event_hub_properties.rb +2 -3
  17. data/lib/generated/azure_mgmt_iot_hub/models/export_devices_request.rb +0 -1
  18. data/lib/generated/azure_mgmt_iot_hub/models/fallback_route_properties.rb +0 -1
  19. data/lib/generated/azure_mgmt_iot_hub/models/feedback_properties.rb +0 -1
  20. data/lib/generated/azure_mgmt_iot_hub/models/import_devices_request.rb +0 -1
  21. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_capacity.rb +0 -1
  22. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_description.rb +1 -2
  23. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_name_availability_info.rb +0 -1
  24. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_properties.rb +0 -1
  25. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_quota_metric_info.rb +0 -1
  26. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_sku_description.rb +0 -1
  27. data/lib/generated/azure_mgmt_iot_hub/models/iot_hub_sku_info.rb +0 -1
  28. data/lib/generated/azure_mgmt_iot_hub/models/ip_filter_rule.rb +0 -1
  29. data/lib/generated/azure_mgmt_iot_hub/models/job_response.rb +0 -1
  30. data/lib/generated/azure_mgmt_iot_hub/models/messaging_endpoint_properties.rb +0 -1
  31. data/lib/generated/azure_mgmt_iot_hub/models/operation.rb +0 -1
  32. data/lib/generated/azure_mgmt_iot_hub/models/operation_display.rb +0 -1
  33. data/lib/generated/azure_mgmt_iot_hub/models/operation_inputs.rb +0 -1
  34. data/lib/generated/azure_mgmt_iot_hub/models/operations_monitoring_properties.rb +0 -1
  35. data/lib/generated/azure_mgmt_iot_hub/models/registry_statistics.rb +0 -1
  36. data/lib/generated/azure_mgmt_iot_hub/models/resource.rb +97 -0
  37. data/lib/generated/azure_mgmt_iot_hub/models/route_properties.rb +0 -1
  38. data/lib/generated/azure_mgmt_iot_hub/models/routing_endpoints.rb +0 -1
  39. data/lib/generated/azure_mgmt_iot_hub/models/routing_event_hub_properties.rb +0 -1
  40. data/lib/generated/azure_mgmt_iot_hub/models/routing_properties.rb +0 -1
  41. data/lib/generated/azure_mgmt_iot_hub/models/routing_service_bus_queue_endpoint_properties.rb +0 -1
  42. data/lib/generated/azure_mgmt_iot_hub/models/routing_service_bus_topic_endpoint_properties.rb +0 -1
  43. data/lib/generated/azure_mgmt_iot_hub/models/routing_storage_container_properties.rb +0 -1
  44. data/lib/generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule.rb +0 -1
  45. data/lib/generated/azure_mgmt_iot_hub/models/storage_endpoint_properties.rb +0 -1
  46. data/lib/generated/azure_mgmt_iot_hub/version.rb +1 -1
  47. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc9f49c4003b80d8dd27b66dab1b116be0874782
4
- data.tar.gz: 961d6a6cd4e1457893badc88b29c3fd2f5eb7d45
3
+ metadata.gz: ebf90ef0d386a9dab5d0cabe3480a35431357d5d
4
+ data.tar.gz: 2baa00a2bac57fd6172d1c70b9ab5a6f2a759eee
5
5
  SHA512:
6
- metadata.gz: f3bd5b08921bbafa85f06fb0fe39e7ce1013383adacf698dcd5b6eea137f27a066e2ac5b5d3d14cfd58de071d34c032b20b1dd198b1cee61075b0c77d75522bd
7
- data.tar.gz: 08b270bd56f6054e63f2a140483fa1434b9a56ef4e1d402213d8bc09d92e41df30cb19119bb1fae3d87679729524821819277a44414b48017d50af2170c7f8a7
6
+ metadata.gz: 1d9236e248f75482b97428bf441aa03854aab57248a7a8f3edfafa8bf56c16896b46e2cbc54e244bbd053b90d959cf6601c447fbb765ce0f4fc12b0d827c88ab
7
+ data.tar.gz: 5a2a2cea4c7c3505b82d0d460fa4e3619b3ea39ad9014590299099a5a65b52a400f966e561273c6d080d1d16fdba98372f267608b9909d0f1e388e3ffe6a8d24
@@ -22,46 +22,55 @@ require 'ms_rest_azure'
22
22
  module Azure::ARM::IotHub
23
23
  autoload :Operations, 'generated/azure_mgmt_iot_hub/operations.rb'
24
24
  autoload :IotHubResource, 'generated/azure_mgmt_iot_hub/iot_hub_resource.rb'
25
+ autoload :Certificates, 'generated/azure_mgmt_iot_hub/certificates.rb'
25
26
  autoload :IotHubClient, 'generated/azure_mgmt_iot_hub/iot_hub_client.rb'
26
27
 
27
28
  module Models
29
+ autoload :IotHubProperties, 'generated/azure_mgmt_iot_hub/models/iot_hub_properties.rb'
30
+ autoload :IotHubSkuInfo, 'generated/azure_mgmt_iot_hub/models/iot_hub_sku_info.rb'
31
+ autoload :CertificateBodyDescription, 'generated/azure_mgmt_iot_hub/models/certificate_body_description.rb'
32
+ autoload :CertificateProperties, 'generated/azure_mgmt_iot_hub/models/certificate_properties.rb'
33
+ autoload :CertificateListDescription, 'generated/azure_mgmt_iot_hub/models/certificate_list_description.rb'
34
+ autoload :Resource, 'generated/azure_mgmt_iot_hub/models/resource.rb'
35
+ autoload :CertificateWithNonceDescription, 'generated/azure_mgmt_iot_hub/models/certificate_with_nonce_description.rb'
28
36
  autoload :SharedAccessSignatureAuthorizationRuleListResult, 'generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule_list_result.rb'
29
- autoload :SharedAccessSignatureAuthorizationRule, 'generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule.rb'
37
+ autoload :IpFilterRule, 'generated/azure_mgmt_iot_hub/models/ip_filter_rule.rb'
30
38
  autoload :OperationDisplay, 'generated/azure_mgmt_iot_hub/models/operation_display.rb'
31
- autoload :EventHubProperties, 'generated/azure_mgmt_iot_hub/models/event_hub_properties.rb'
39
+ autoload :RoutingServiceBusQueueEndpointProperties, 'generated/azure_mgmt_iot_hub/models/routing_service_bus_queue_endpoint_properties.rb'
32
40
  autoload :Operation, 'generated/azure_mgmt_iot_hub/models/operation.rb'
33
- autoload :RoutingServiceBusTopicEndpointProperties, 'generated/azure_mgmt_iot_hub/models/routing_service_bus_topic_endpoint_properties.rb'
41
+ autoload :RoutingEventHubProperties, 'generated/azure_mgmt_iot_hub/models/routing_event_hub_properties.rb'
34
42
  autoload :OperationListResult, 'generated/azure_mgmt_iot_hub/models/operation_list_result.rb'
35
- autoload :RoutingStorageContainerProperties, 'generated/azure_mgmt_iot_hub/models/routing_storage_container_properties.rb'
43
+ autoload :RoutingEndpoints, 'generated/azure_mgmt_iot_hub/models/routing_endpoints.rb'
36
44
  autoload :ErrorDetails, 'generated/azure_mgmt_iot_hub/models/error_details.rb'
37
- autoload :RouteProperties, 'generated/azure_mgmt_iot_hub/models/route_properties.rb'
45
+ autoload :FallbackRouteProperties, 'generated/azure_mgmt_iot_hub/models/fallback_route_properties.rb'
38
46
  autoload :IotHubQuotaMetricInfo, 'generated/azure_mgmt_iot_hub/models/iot_hub_quota_metric_info.rb'
39
- autoload :RoutingProperties, 'generated/azure_mgmt_iot_hub/models/routing_properties.rb'
47
+ autoload :StorageEndpointProperties, 'generated/azure_mgmt_iot_hub/models/storage_endpoint_properties.rb'
40
48
  autoload :IotHubQuotaMetricInfoListResult, 'generated/azure_mgmt_iot_hub/models/iot_hub_quota_metric_info_list_result.rb'
41
- autoload :MessagingEndpointProperties, 'generated/azure_mgmt_iot_hub/models/messaging_endpoint_properties.rb'
49
+ autoload :FeedbackProperties, 'generated/azure_mgmt_iot_hub/models/feedback_properties.rb'
42
50
  autoload :RegistryStatistics, 'generated/azure_mgmt_iot_hub/models/registry_statistics.rb'
43
- autoload :CloudToDeviceProperties, 'generated/azure_mgmt_iot_hub/models/cloud_to_device_properties.rb'
51
+ autoload :OperationsMonitoringProperties, 'generated/azure_mgmt_iot_hub/models/operations_monitoring_properties.rb'
44
52
  autoload :JobResponse, 'generated/azure_mgmt_iot_hub/models/job_response.rb'
45
- autoload :IotHubProperties, 'generated/azure_mgmt_iot_hub/models/iot_hub_properties.rb'
53
+ autoload :CertificateDescription, 'generated/azure_mgmt_iot_hub/models/certificate_description.rb'
46
54
  autoload :JobResponseListResult, 'generated/azure_mgmt_iot_hub/models/job_response_list_result.rb'
55
+ autoload :SharedAccessSignatureAuthorizationRule, 'generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule.rb'
47
56
  autoload :IotHubCapacity, 'generated/azure_mgmt_iot_hub/models/iot_hub_capacity.rb'
48
- autoload :RoutingServiceBusQueueEndpointProperties, 'generated/azure_mgmt_iot_hub/models/routing_service_bus_queue_endpoint_properties.rb'
57
+ autoload :RoutingServiceBusTopicEndpointProperties, 'generated/azure_mgmt_iot_hub/models/routing_service_bus_topic_endpoint_properties.rb'
49
58
  autoload :IotHubSkuDescription, 'generated/azure_mgmt_iot_hub/models/iot_hub_sku_description.rb'
50
- autoload :RoutingEndpoints, 'generated/azure_mgmt_iot_hub/models/routing_endpoints.rb'
59
+ autoload :RouteProperties, 'generated/azure_mgmt_iot_hub/models/route_properties.rb'
51
60
  autoload :EventHubConsumerGroupsListResult, 'generated/azure_mgmt_iot_hub/models/event_hub_consumer_groups_list_result.rb'
52
- autoload :StorageEndpointProperties, 'generated/azure_mgmt_iot_hub/models/storage_endpoint_properties.rb'
61
+ autoload :MessagingEndpointProperties, 'generated/azure_mgmt_iot_hub/models/messaging_endpoint_properties.rb'
53
62
  autoload :EventHubConsumerGroupInfo, 'generated/azure_mgmt_iot_hub/models/event_hub_consumer_group_info.rb'
54
- autoload :OperationsMonitoringProperties, 'generated/azure_mgmt_iot_hub/models/operations_monitoring_properties.rb'
63
+ autoload :CertificateVerificationDescription, 'generated/azure_mgmt_iot_hub/models/certificate_verification_description.rb'
55
64
  autoload :IotHubSkuDescriptionListResult, 'generated/azure_mgmt_iot_hub/models/iot_hub_sku_description_list_result.rb'
56
- autoload :IpFilterRule, 'generated/azure_mgmt_iot_hub/models/ip_filter_rule.rb'
65
+ autoload :EventHubProperties, 'generated/azure_mgmt_iot_hub/models/event_hub_properties.rb'
57
66
  autoload :IotHubDescriptionListResult, 'generated/azure_mgmt_iot_hub/models/iot_hub_description_list_result.rb'
58
- autoload :FallbackRouteProperties, 'generated/azure_mgmt_iot_hub/models/fallback_route_properties.rb'
67
+ autoload :RoutingProperties, 'generated/azure_mgmt_iot_hub/models/routing_properties.rb'
59
68
  autoload :OperationInputs, 'generated/azure_mgmt_iot_hub/models/operation_inputs.rb'
60
- autoload :IotHubSkuInfo, 'generated/azure_mgmt_iot_hub/models/iot_hub_sku_info.rb'
69
+ autoload :CertificatePropertiesWithNonce, 'generated/azure_mgmt_iot_hub/models/certificate_properties_with_nonce.rb'
61
70
  autoload :IotHubNameAvailabilityInfo, 'generated/azure_mgmt_iot_hub/models/iot_hub_name_availability_info.rb'
62
- autoload :FeedbackProperties, 'generated/azure_mgmt_iot_hub/models/feedback_properties.rb'
71
+ autoload :CloudToDeviceProperties, 'generated/azure_mgmt_iot_hub/models/cloud_to_device_properties.rb'
63
72
  autoload :ExportDevicesRequest, 'generated/azure_mgmt_iot_hub/models/export_devices_request.rb'
64
- autoload :RoutingEventHubProperties, 'generated/azure_mgmt_iot_hub/models/routing_event_hub_properties.rb'
73
+ autoload :RoutingStorageContainerProperties, 'generated/azure_mgmt_iot_hub/models/routing_storage_container_properties.rb'
65
74
  autoload :ImportDevicesRequest, 'generated/azure_mgmt_iot_hub/models/import_devices_request.rb'
66
75
  autoload :IotHubDescription, 'generated/azure_mgmt_iot_hub/models/iot_hub_description.rb'
67
76
  autoload :AccessRights, 'generated/azure_mgmt_iot_hub/models/access_rights.rb'
@@ -0,0 +1,704 @@
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::ARM::IotHub
7
+ #
8
+ # Use this API to manage the IoT hubs in your Azure subscription.
9
+ #
10
+ class Certificates
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Certificates 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 certificate list.
26
+ #
27
+ # Returns the list of certificates.
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 [CertificateListDescription] operation results.
36
+ #
37
+ def list_by_iot_hub(resource_group_name, resource_name, custom_headers = nil)
38
+ response = list_by_iot_hub_async(resource_group_name, resource_name, custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # Get the certificate list.
44
+ #
45
+ # Returns the list of certificates.
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 list_by_iot_hub_with_http_info(resource_group_name, resource_name, custom_headers = nil)
56
+ list_by_iot_hub_async(resource_group_name, resource_name, custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # Get the certificate list.
61
+ #
62
+ # Returns the list of certificates.
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 list_by_iot_hub_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
+
81
+ # Set Headers
82
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
83
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
84
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates'
85
+
86
+ request_url = @base_url || @client.base_url
87
+
88
+ options = {
89
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
90
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
91
+ query_params: {'api-version' => @client.api_version},
92
+ headers: request_headers.merge(custom_headers || {}),
93
+ base_url: request_url
94
+ }
95
+ promise = @client.make_request_async(:get, path_template, options)
96
+
97
+ promise = promise.then do |result|
98
+ http_response = result.response
99
+ status_code = http_response.status
100
+ response_content = http_response.body
101
+ unless status_code == 200
102
+ error_model = JSON.load(response_content)
103
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
104
+ end
105
+
106
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
107
+ # Deserialize Response
108
+ if status_code == 200
109
+ begin
110
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
111
+ result_mapper = Azure::ARM::IotHub::Models::CertificateListDescription.mapper()
112
+ result.body = @client.deserialize(result_mapper, parsed_response)
113
+ rescue Exception => e
114
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
115
+ end
116
+ end
117
+
118
+ result
119
+ end
120
+
121
+ promise.execute
122
+ end
123
+
124
+ #
125
+ # Get the certificate.
126
+ #
127
+ # Returns the certificate.
128
+ #
129
+ # @param resource_group_name [String] The name of the resource group that
130
+ # contains the IoT hub.
131
+ # @param resource_name [String] The name of the IoT hub.
132
+ # @param certificate_name [String] The name of the certificate
133
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
134
+ # will be added to the HTTP request.
135
+ #
136
+ # @return [CertificateDescription] operation results.
137
+ #
138
+ def get(resource_group_name, resource_name, certificate_name, custom_headers = nil)
139
+ response = get_async(resource_group_name, resource_name, certificate_name, custom_headers).value!
140
+ response.body unless response.nil?
141
+ end
142
+
143
+ #
144
+ # Get the certificate.
145
+ #
146
+ # Returns the certificate.
147
+ #
148
+ # @param resource_group_name [String] The name of the resource group that
149
+ # contains the IoT hub.
150
+ # @param resource_name [String] The name of the IoT hub.
151
+ # @param certificate_name [String] The name of the certificate
152
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
153
+ # will be added to the HTTP request.
154
+ #
155
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
156
+ #
157
+ def get_with_http_info(resource_group_name, resource_name, certificate_name, custom_headers = nil)
158
+ get_async(resource_group_name, resource_name, certificate_name, custom_headers).value!
159
+ end
160
+
161
+ #
162
+ # Get the certificate.
163
+ #
164
+ # Returns the certificate.
165
+ #
166
+ # @param resource_group_name [String] The name of the resource group that
167
+ # contains the IoT hub.
168
+ # @param resource_name [String] The name of the IoT hub.
169
+ # @param certificate_name [String] The name of the certificate
170
+ # @param [Hash{String => String}] A hash of custom headers that will be added
171
+ # to the HTTP request.
172
+ #
173
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
174
+ #
175
+ def get_async(resource_group_name, resource_name, certificate_name, custom_headers = nil)
176
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
177
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
178
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
179
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
180
+ fail ArgumentError, 'certificate_name is nil' if certificate_name.nil?
181
+
182
+
183
+ request_headers = {}
184
+
185
+ # Set Headers
186
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
187
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
188
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'
189
+
190
+ request_url = @base_url || @client.base_url
191
+
192
+ options = {
193
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
194
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'certificateName' => certificate_name},
195
+ query_params: {'api-version' => @client.api_version},
196
+ headers: request_headers.merge(custom_headers || {}),
197
+ base_url: request_url
198
+ }
199
+ promise = @client.make_request_async(:get, path_template, options)
200
+
201
+ promise = promise.then do |result|
202
+ http_response = result.response
203
+ status_code = http_response.status
204
+ response_content = http_response.body
205
+ unless status_code == 200
206
+ error_model = JSON.load(response_content)
207
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
208
+ end
209
+
210
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
211
+ # Deserialize Response
212
+ if status_code == 200
213
+ begin
214
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
215
+ result_mapper = Azure::ARM::IotHub::Models::CertificateDescription.mapper()
216
+ result.body = @client.deserialize(result_mapper, parsed_response)
217
+ rescue Exception => e
218
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
219
+ end
220
+ end
221
+
222
+ result
223
+ end
224
+
225
+ promise.execute
226
+ end
227
+
228
+ #
229
+ # Upload the certificate to the IoT hub.
230
+ #
231
+ # Adds new or replaces existing certificate.
232
+ #
233
+ # @param resource_group_name [String] The name of the resource group that
234
+ # contains the IoT hub.
235
+ # @param resource_name [String] The name of the IoT hub.
236
+ # @param certificate_name [String] The name of the certificate
237
+ # @param certificate_description [CertificateBodyDescription] The certificate
238
+ # body.
239
+ # @param if_match [String] ETag of the Certificate. Do not specify for creating
240
+ # a brand new certificate. Required to update an existing certificate.
241
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
242
+ # will be added to the HTTP request.
243
+ #
244
+ # @return [CertificateDescription] operation results.
245
+ #
246
+ def create_or_update(resource_group_name, resource_name, certificate_name, certificate_description, if_match = nil, custom_headers = nil)
247
+ response = create_or_update_async(resource_group_name, resource_name, certificate_name, certificate_description, if_match, custom_headers).value!
248
+ response.body unless response.nil?
249
+ end
250
+
251
+ #
252
+ # Upload the certificate to the IoT hub.
253
+ #
254
+ # Adds new or replaces existing certificate.
255
+ #
256
+ # @param resource_group_name [String] The name of the resource group that
257
+ # contains the IoT hub.
258
+ # @param resource_name [String] The name of the IoT hub.
259
+ # @param certificate_name [String] The name of the certificate
260
+ # @param certificate_description [CertificateBodyDescription] The certificate
261
+ # body.
262
+ # @param if_match [String] ETag of the Certificate. Do not specify for creating
263
+ # a brand new certificate. Required to update an existing certificate.
264
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
265
+ # will be added to the HTTP request.
266
+ #
267
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
268
+ #
269
+ def create_or_update_with_http_info(resource_group_name, resource_name, certificate_name, certificate_description, if_match = nil, custom_headers = nil)
270
+ create_or_update_async(resource_group_name, resource_name, certificate_name, certificate_description, if_match, custom_headers).value!
271
+ end
272
+
273
+ #
274
+ # Upload the certificate to the IoT hub.
275
+ #
276
+ # Adds new or replaces existing certificate.
277
+ #
278
+ # @param resource_group_name [String] The name of the resource group that
279
+ # contains the IoT hub.
280
+ # @param resource_name [String] The name of the IoT hub.
281
+ # @param certificate_name [String] The name of the certificate
282
+ # @param certificate_description [CertificateBodyDescription] The certificate
283
+ # body.
284
+ # @param if_match [String] ETag of the Certificate. Do not specify for creating
285
+ # a brand new certificate. Required to update an existing certificate.
286
+ # @param [Hash{String => String}] A hash of custom headers that will be added
287
+ # to the HTTP request.
288
+ #
289
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
290
+ #
291
+ def create_or_update_async(resource_group_name, resource_name, certificate_name, certificate_description, if_match = nil, custom_headers = nil)
292
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
293
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
294
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
295
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
296
+ fail ArgumentError, 'certificate_name is nil' if certificate_name.nil?
297
+ fail ArgumentError, 'certificate_description is nil' if certificate_description.nil?
298
+
299
+
300
+ request_headers = {}
301
+
302
+ # Set Headers
303
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
304
+ request_headers['If-Match'] = if_match unless if_match.nil?
305
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
306
+
307
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
308
+
309
+ # Serialize Request
310
+ request_mapper = Azure::ARM::IotHub::Models::CertificateBodyDescription.mapper()
311
+ request_content = @client.serialize(request_mapper, certificate_description)
312
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
313
+
314
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'
315
+
316
+ request_url = @base_url || @client.base_url
317
+
318
+ options = {
319
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
320
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'certificateName' => certificate_name},
321
+ query_params: {'api-version' => @client.api_version},
322
+ body: request_content,
323
+ headers: request_headers.merge(custom_headers || {}),
324
+ base_url: request_url
325
+ }
326
+ promise = @client.make_request_async(:put, path_template, options)
327
+
328
+ promise = promise.then do |result|
329
+ http_response = result.response
330
+ status_code = http_response.status
331
+ response_content = http_response.body
332
+ unless status_code == 201 || status_code == 200
333
+ error_model = JSON.load(response_content)
334
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
335
+ end
336
+
337
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
338
+ # Deserialize Response
339
+ if status_code == 201
340
+ begin
341
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
342
+ result_mapper = Azure::ARM::IotHub::Models::CertificateDescription.mapper()
343
+ result.body = @client.deserialize(result_mapper, parsed_response)
344
+ rescue Exception => e
345
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
346
+ end
347
+ end
348
+ # Deserialize Response
349
+ if status_code == 200
350
+ begin
351
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
352
+ result_mapper = Azure::ARM::IotHub::Models::CertificateDescription.mapper()
353
+ result.body = @client.deserialize(result_mapper, parsed_response)
354
+ rescue Exception => e
355
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
356
+ end
357
+ end
358
+
359
+ result
360
+ end
361
+
362
+ promise.execute
363
+ end
364
+
365
+ #
366
+ # Delete an X509 certificate.
367
+ #
368
+ # Deletes an existing X509 certificate or does nothing if it does not exist.
369
+ #
370
+ # @param resource_group_name [String] The name of the resource group that
371
+ # contains the IoT hub.
372
+ # @param resource_name [String] The name of the IoT hub.
373
+ # @param certificate_name [String] The name of the certificate
374
+ # @param if_match [String] ETag of the Certificate.
375
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
376
+ # will be added to the HTTP request.
377
+ #
378
+ #
379
+ def delete(resource_group_name, resource_name, certificate_name, if_match, custom_headers = nil)
380
+ response = delete_async(resource_group_name, resource_name, certificate_name, if_match, custom_headers).value!
381
+ nil
382
+ end
383
+
384
+ #
385
+ # Delete an X509 certificate.
386
+ #
387
+ # Deletes an existing X509 certificate or does nothing if it does not exist.
388
+ #
389
+ # @param resource_group_name [String] The name of the resource group that
390
+ # contains the IoT hub.
391
+ # @param resource_name [String] The name of the IoT hub.
392
+ # @param certificate_name [String] The name of the certificate
393
+ # @param if_match [String] ETag of the Certificate.
394
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
395
+ # will be added to the HTTP request.
396
+ #
397
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
398
+ #
399
+ def delete_with_http_info(resource_group_name, resource_name, certificate_name, if_match, custom_headers = nil)
400
+ delete_async(resource_group_name, resource_name, certificate_name, if_match, custom_headers).value!
401
+ end
402
+
403
+ #
404
+ # Delete an X509 certificate.
405
+ #
406
+ # Deletes an existing X509 certificate or does nothing if it does not exist.
407
+ #
408
+ # @param resource_group_name [String] The name of the resource group that
409
+ # contains the IoT hub.
410
+ # @param resource_name [String] The name of the IoT hub.
411
+ # @param certificate_name [String] The name of the certificate
412
+ # @param if_match [String] ETag of the Certificate.
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 delete_async(resource_group_name, resource_name, certificate_name, if_match, 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
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
423
+ fail ArgumentError, 'certificate_name is nil' if certificate_name.nil?
424
+ fail ArgumentError, 'if_match is nil' if if_match.nil?
425
+
426
+
427
+ request_headers = {}
428
+
429
+ # Set Headers
430
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
431
+ request_headers['If-Match'] = if_match unless if_match.nil?
432
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
433
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'
434
+
435
+ request_url = @base_url || @client.base_url
436
+
437
+ options = {
438
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
439
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'certificateName' => certificate_name},
440
+ query_params: {'api-version' => @client.api_version},
441
+ headers: request_headers.merge(custom_headers || {}),
442
+ base_url: request_url
443
+ }
444
+ promise = @client.make_request_async(:delete, path_template, options)
445
+
446
+ promise = promise.then do |result|
447
+ http_response = result.response
448
+ status_code = http_response.status
449
+ response_content = http_response.body
450
+ unless status_code == 200 || status_code == 204
451
+ error_model = JSON.load(response_content)
452
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
453
+ end
454
+
455
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
456
+
457
+ result
458
+ end
459
+
460
+ promise.execute
461
+ end
462
+
463
+ #
464
+ # Generate verification code for proof of possession flow.
465
+ #
466
+ # Generates verification code for proof of possession flow. The verification
467
+ # code will be used to generate a leaf certificate.
468
+ #
469
+ # @param resource_group_name [String] The name of the resource group that
470
+ # contains the IoT hub.
471
+ # @param resource_name [String] The name of the IoT hub.
472
+ # @param certificate_name [String] The name of the certificate
473
+ # @param if_match [String] ETag of the Certificate.
474
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
475
+ # will be added to the HTTP request.
476
+ #
477
+ # @return [CertificateWithNonceDescription] operation results.
478
+ #
479
+ def generate_verification_code(resource_group_name, resource_name, certificate_name, if_match, custom_headers = nil)
480
+ response = generate_verification_code_async(resource_group_name, resource_name, certificate_name, if_match, custom_headers).value!
481
+ response.body unless response.nil?
482
+ end
483
+
484
+ #
485
+ # Generate verification code for proof of possession flow.
486
+ #
487
+ # Generates verification code for proof of possession flow. The verification
488
+ # code will be used to generate a leaf certificate.
489
+ #
490
+ # @param resource_group_name [String] The name of the resource group that
491
+ # contains the IoT hub.
492
+ # @param resource_name [String] The name of the IoT hub.
493
+ # @param certificate_name [String] The name of the certificate
494
+ # @param if_match [String] ETag of the Certificate.
495
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
496
+ # will be added to the HTTP request.
497
+ #
498
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
499
+ #
500
+ def generate_verification_code_with_http_info(resource_group_name, resource_name, certificate_name, if_match, custom_headers = nil)
501
+ generate_verification_code_async(resource_group_name, resource_name, certificate_name, if_match, custom_headers).value!
502
+ end
503
+
504
+ #
505
+ # Generate verification code for proof of possession flow.
506
+ #
507
+ # Generates verification code for proof of possession flow. The verification
508
+ # code will be used to generate a leaf certificate.
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 certificate_name [String] The name of the certificate
514
+ # @param if_match [String] ETag of the Certificate.
515
+ # @param [Hash{String => String}] A hash of custom headers that will be added
516
+ # to the HTTP request.
517
+ #
518
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
519
+ #
520
+ def generate_verification_code_async(resource_group_name, resource_name, certificate_name, if_match, custom_headers = nil)
521
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
522
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
523
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
524
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
525
+ fail ArgumentError, 'certificate_name is nil' if certificate_name.nil?
526
+ fail ArgumentError, 'if_match is nil' if if_match.nil?
527
+
528
+
529
+ request_headers = {}
530
+
531
+ # Set Headers
532
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
533
+ request_headers['If-Match'] = if_match unless if_match.nil?
534
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
535
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode'
536
+
537
+ request_url = @base_url || @client.base_url
538
+
539
+ options = {
540
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
541
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'certificateName' => certificate_name},
542
+ query_params: {'api-version' => @client.api_version},
543
+ headers: request_headers.merge(custom_headers || {}),
544
+ base_url: request_url
545
+ }
546
+ promise = @client.make_request_async(:post, path_template, options)
547
+
548
+ promise = promise.then do |result|
549
+ http_response = result.response
550
+ status_code = http_response.status
551
+ response_content = http_response.body
552
+ unless status_code == 200
553
+ error_model = JSON.load(response_content)
554
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
555
+ end
556
+
557
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
558
+ # Deserialize Response
559
+ if status_code == 200
560
+ begin
561
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
562
+ result_mapper = Azure::ARM::IotHub::Models::CertificateWithNonceDescription.mapper()
563
+ result.body = @client.deserialize(result_mapper, parsed_response)
564
+ rescue Exception => e
565
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
566
+ end
567
+ end
568
+
569
+ result
570
+ end
571
+
572
+ promise.execute
573
+ end
574
+
575
+ #
576
+ # Verify certificate's private key possession.
577
+ #
578
+ # Verifies the certificate's private key possession by providing the leaf cert
579
+ # issued by the verifying pre uploaded certificate.
580
+ #
581
+ # @param resource_group_name [String] The name of the resource group that
582
+ # contains the IoT hub.
583
+ # @param resource_name [String] The name of the IoT hub.
584
+ # @param certificate_name [String] The name of the certificate
585
+ # @param certificate_verification_body [CertificateVerificationDescription] The
586
+ # name of the certificate
587
+ # @param if_match [String] ETag of the Certificate.
588
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
589
+ # will be added to the HTTP request.
590
+ #
591
+ # @return [CertificateDescription] operation results.
592
+ #
593
+ def verify(resource_group_name, resource_name, certificate_name, certificate_verification_body, if_match, custom_headers = nil)
594
+ response = verify_async(resource_group_name, resource_name, certificate_name, certificate_verification_body, if_match, custom_headers).value!
595
+ response.body unless response.nil?
596
+ end
597
+
598
+ #
599
+ # Verify certificate's private key possession.
600
+ #
601
+ # Verifies the certificate's private key possession by providing the leaf cert
602
+ # issued by the verifying pre uploaded certificate.
603
+ #
604
+ # @param resource_group_name [String] The name of the resource group that
605
+ # contains the IoT hub.
606
+ # @param resource_name [String] The name of the IoT hub.
607
+ # @param certificate_name [String] The name of the certificate
608
+ # @param certificate_verification_body [CertificateVerificationDescription] The
609
+ # name of the certificate
610
+ # @param if_match [String] ETag of the Certificate.
611
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
612
+ # will be added to the HTTP request.
613
+ #
614
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
615
+ #
616
+ def verify_with_http_info(resource_group_name, resource_name, certificate_name, certificate_verification_body, if_match, custom_headers = nil)
617
+ verify_async(resource_group_name, resource_name, certificate_name, certificate_verification_body, if_match, custom_headers).value!
618
+ end
619
+
620
+ #
621
+ # Verify certificate's private key possession.
622
+ #
623
+ # Verifies the certificate's private key possession by providing the leaf cert
624
+ # issued by the verifying pre uploaded certificate.
625
+ #
626
+ # @param resource_group_name [String] The name of the resource group that
627
+ # contains the IoT hub.
628
+ # @param resource_name [String] The name of the IoT hub.
629
+ # @param certificate_name [String] The name of the certificate
630
+ # @param certificate_verification_body [CertificateVerificationDescription] The
631
+ # name of the certificate
632
+ # @param if_match [String] ETag of the Certificate.
633
+ # @param [Hash{String => String}] A hash of custom headers that will be added
634
+ # to the HTTP request.
635
+ #
636
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
637
+ #
638
+ def verify_async(resource_group_name, resource_name, certificate_name, certificate_verification_body, if_match, custom_headers = nil)
639
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
640
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
641
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
642
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
643
+ fail ArgumentError, 'certificate_name is nil' if certificate_name.nil?
644
+ fail ArgumentError, 'certificate_verification_body is nil' if certificate_verification_body.nil?
645
+ fail ArgumentError, 'if_match is nil' if if_match.nil?
646
+
647
+
648
+ request_headers = {}
649
+
650
+ # Set Headers
651
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
652
+ request_headers['If-Match'] = if_match unless if_match.nil?
653
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
654
+
655
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
656
+
657
+ # Serialize Request
658
+ request_mapper = Azure::ARM::IotHub::Models::CertificateVerificationDescription.mapper()
659
+ request_content = @client.serialize(request_mapper, certificate_verification_body)
660
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
661
+
662
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify'
663
+
664
+ request_url = @base_url || @client.base_url
665
+
666
+ options = {
667
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
668
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'certificateName' => certificate_name},
669
+ query_params: {'api-version' => @client.api_version},
670
+ body: request_content,
671
+ headers: request_headers.merge(custom_headers || {}),
672
+ base_url: request_url
673
+ }
674
+ promise = @client.make_request_async(:post, path_template, options)
675
+
676
+ promise = promise.then do |result|
677
+ http_response = result.response
678
+ status_code = http_response.status
679
+ response_content = http_response.body
680
+ unless status_code == 200
681
+ error_model = JSON.load(response_content)
682
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
683
+ end
684
+
685
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
686
+ # Deserialize Response
687
+ if status_code == 200
688
+ begin
689
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
690
+ result_mapper = Azure::ARM::IotHub::Models::CertificateDescription.mapper()
691
+ result.body = @client.deserialize(result_mapper, parsed_response)
692
+ rescue Exception => e
693
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
694
+ end
695
+ end
696
+
697
+ result
698
+ end
699
+
700
+ promise.execute
701
+ end
702
+
703
+ end
704
+ end