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.
- checksums.yaml +4 -4
- data/lib/2016-02-03/generated/azure_mgmt_iot_hub/iot_hub_client.rb +7 -6
- data/lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_client.rb +7 -6
- data/lib/2017-07-01/generated/azure_mgmt_iot_hub/iot_hub_client.rb +7 -6
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub.rb +89 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/certificates.rb +711 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_client.rb +139 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/iot_hub_resource.rb +3242 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/access_rights.rb +29 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/capabilities.rb +16 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/certificate_body_description.rb +47 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/certificate_description.rb +95 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/certificate_list_description.rb +56 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/certificate_properties.rb +107 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/certificate_properties_with_nonce.rb +121 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/certificate_verification_description.rb +47 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/certificate_with_nonce_description.rb +95 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/cloud_to_device_properties.rb +77 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/error_details.rb +83 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/event_hub_consumer_group_info.rb +102 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/event_hub_consumer_groups_list_result.rb +101 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/event_hub_properties.rb +107 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/export_devices_request.rb +59 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/fallback_route_properties.rb +114 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/feedback_properties.rb +77 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/import_devices_request.rb +58 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_capacity.rb +89 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_description.rb +126 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_description_list_result.rb +100 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_name_availability_info.rb +73 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_name_unavailability_reason.rb +16 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_properties.rb +252 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_quota_metric_info.rb +71 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_quota_metric_info_list_result.rb +101 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_scale_type.rb +17 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_sku.rb +18 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_sku_description.rb +71 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_sku_description_list_result.rb +101 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_sku_info.rb +73 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/iot_hub_sku_tier.rb +16 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/ip_filter_action_type.rb +16 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/ip_filter_rule.rb +71 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/job_response.rb +137 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/job_response_list_result.rb +99 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/job_status.rb +20 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/job_type.rb +24 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/messaging_endpoint_properties.rb +77 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/operation.rb +60 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/operation_display.rb +71 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/operation_inputs.rb +46 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/operation_list_result.rb +103 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/operation_monitoring_level.rb +18 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/operations_monitoring_properties.rb +58 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/registry_statistics.rb +73 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/resource.rb +104 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/route_properties.rb +116 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/routing_endpoints.rb +126 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/routing_event_hub_properties.rb +87 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/routing_properties.rb +88 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/routing_service_bus_queue_endpoint_properties.rb +90 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/routing_service_bus_topic_endpoint_properties.rb +90 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/routing_source.rb +18 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/routing_storage_container_properties.rb +156 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule.rb +89 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule_list_result.rb +103 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/storage_endpoint_properties.rb +73 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/models/tags_resource.rb +55 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/module_definition.rb +9 -0
- data/lib/2018-01-22/generated/azure_mgmt_iot_hub/operations.rb +215 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub.rb +108 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/certificates.rb +711 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/iot_hub_client.rb +143 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/iot_hub_resource.rb +3676 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/access_rights.rb +29 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/capabilities.rb +16 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/certificate_body_description.rb +47 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/certificate_description.rb +95 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/certificate_list_description.rb +56 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/certificate_properties.rb +118 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/certificate_properties_with_nonce.rb +133 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/certificate_verification_description.rb +47 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/certificate_with_nonce_description.rb +95 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/cloud_to_device_properties.rb +77 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/endpoint_health_data.rb +58 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/endpoint_health_data_list_result.rb +100 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/endpoint_health_status.rb +18 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/error_details.rb +83 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/event_hub_consumer_group_info.rb +102 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/event_hub_consumer_groups_list_result.rb +101 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/event_hub_properties.rb +107 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/export_devices_request.rb +59 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/fallback_route_properties.rb +114 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/feedback_properties.rb +77 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/import_devices_request.rb +58 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_capacity.rb +89 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_description.rb +126 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_description_list_result.rb +100 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_name_availability_info.rb +73 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_name_unavailability_reason.rb +16 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_properties.rb +252 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_quota_metric_info.rb +71 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_quota_metric_info_list_result.rb +101 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_scale_type.rb +17 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_sku.rb +21 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_sku_description.rb +71 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_sku_description_list_result.rb +101 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_sku_info.rb +73 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/iot_hub_sku_tier.rb +17 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/ip_filter_action_type.rb +16 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/ip_filter_rule.rb +71 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/job_response.rb +137 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/job_response_list_result.rb +99 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/job_status.rb +20 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/job_type.rb +24 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/matched_route.rb +47 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/messaging_endpoint_properties.rb +77 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/name.rb +57 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/operation.rb +60 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/operation_display.rb +71 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/operation_inputs.rb +46 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/operation_list_result.rb +103 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/operation_monitoring_level.rb +18 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/operations_monitoring_properties.rb +58 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/registry_statistics.rb +73 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/resource.rb +104 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/route_compilation_error.rb +70 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/route_error_position.rb +57 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/route_error_range.rb +59 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/route_error_severity.rb +16 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/route_properties.rb +116 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/routing_endpoints.rb +126 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/routing_event_hub_properties.rb +87 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/routing_message.rb +84 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/routing_properties.rb +88 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/routing_service_bus_queue_endpoint_properties.rb +90 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/routing_service_bus_topic_endpoint_properties.rb +90 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/routing_source.rb +19 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/routing_storage_container_properties.rb +156 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule.rb +89 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/shared_access_signature_authorization_rule_list_result.rb +103 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/storage_endpoint_properties.rb +73 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/tags_resource.rb +55 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/test_all_routes_input.rb +60 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/test_all_routes_result.rb +55 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/test_result_status.rb +17 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/test_route_input.rb +59 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/test_route_result.rb +59 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/test_route_result_details.rb +56 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/user_subscription_quota.rb +102 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/models/user_subscription_quota_list_result.rb +67 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/module_definition.rb +9 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/operations.rb +215 -0
- data/lib/2018-04-01/generated/azure_mgmt_iot_hub/resource_provider_common.rb +115 -0
- data/lib/azure_mgmt_iot_hub.rb +3 -1
- data/lib/profiles/latest/modules/iothub_profile_module.rb +240 -162
- data/lib/version.rb +1 -1
- metadata +154 -5
@@ -0,0 +1,711 @@
|
|
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_04_01
|
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: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: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
|
+
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}/certificates'
|
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_04_01::Models::CertificateListDescription.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
|
+
# Get the certificate.
|
127
|
+
#
|
128
|
+
# Returns the certificate.
|
129
|
+
#
|
130
|
+
# @param resource_group_name [String] The name of the resource group that
|
131
|
+
# contains the IoT hub.
|
132
|
+
# @param resource_name [String] The name of the IoT hub.
|
133
|
+
# @param certificate_name [String] The name of the certificate
|
134
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
135
|
+
# will be added to the HTTP request.
|
136
|
+
#
|
137
|
+
# @return [CertificateDescription] operation results.
|
138
|
+
#
|
139
|
+
def get(resource_group_name, resource_name, certificate_name, custom_headers:nil)
|
140
|
+
response = get_async(resource_group_name, resource_name, certificate_name, custom_headers:custom_headers).value!
|
141
|
+
response.body unless response.nil?
|
142
|
+
end
|
143
|
+
|
144
|
+
#
|
145
|
+
# Get the certificate.
|
146
|
+
#
|
147
|
+
# Returns the certificate.
|
148
|
+
#
|
149
|
+
# @param resource_group_name [String] The name of the resource group that
|
150
|
+
# contains the IoT hub.
|
151
|
+
# @param resource_name [String] The name of the IoT hub.
|
152
|
+
# @param certificate_name [String] The name of the certificate
|
153
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
154
|
+
# will be added to the HTTP request.
|
155
|
+
#
|
156
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
157
|
+
#
|
158
|
+
def get_with_http_info(resource_group_name, resource_name, certificate_name, custom_headers:nil)
|
159
|
+
get_async(resource_group_name, resource_name, certificate_name, custom_headers:custom_headers).value!
|
160
|
+
end
|
161
|
+
|
162
|
+
#
|
163
|
+
# Get the certificate.
|
164
|
+
#
|
165
|
+
# Returns the certificate.
|
166
|
+
#
|
167
|
+
# @param resource_group_name [String] The name of the resource group that
|
168
|
+
# contains the IoT hub.
|
169
|
+
# @param resource_name [String] The name of the IoT hub.
|
170
|
+
# @param certificate_name [String] The name of the certificate
|
171
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
172
|
+
# to the HTTP request.
|
173
|
+
#
|
174
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
175
|
+
#
|
176
|
+
def get_async(resource_group_name, resource_name, certificate_name, custom_headers:nil)
|
177
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
178
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
179
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
180
|
+
fail ArgumentError, 'resource_name is nil' if resource_name.nil?
|
181
|
+
fail ArgumentError, 'certificate_name is nil' if certificate_name.nil?
|
182
|
+
fail ArgumentError, "'certificate_name' should satisfy the constraint - 'Pattern': '^[A-Za-z0-9-._]{1,64}$'" if !certificate_name.nil? && certificate_name.match(Regexp.new('^^[A-Za-z0-9-._]{1,64}$$')).nil?
|
183
|
+
|
184
|
+
|
185
|
+
request_headers = {}
|
186
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
187
|
+
|
188
|
+
# Set Headers
|
189
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
190
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
191
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'
|
192
|
+
|
193
|
+
request_url = @base_url || @client.base_url
|
194
|
+
|
195
|
+
options = {
|
196
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
197
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'certificateName' => certificate_name},
|
198
|
+
query_params: {'api-version' => @client.api_version},
|
199
|
+
headers: request_headers.merge(custom_headers || {}),
|
200
|
+
base_url: request_url
|
201
|
+
}
|
202
|
+
promise = @client.make_request_async(:get, path_template, options)
|
203
|
+
|
204
|
+
promise = promise.then do |result|
|
205
|
+
http_response = result.response
|
206
|
+
status_code = http_response.status
|
207
|
+
response_content = http_response.body
|
208
|
+
unless status_code == 200
|
209
|
+
error_model = JSON.load(response_content)
|
210
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
211
|
+
end
|
212
|
+
|
213
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
214
|
+
# Deserialize Response
|
215
|
+
if status_code == 200
|
216
|
+
begin
|
217
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
218
|
+
result_mapper = Azure::IotHub::Mgmt::V2018_04_01::Models::CertificateDescription.mapper()
|
219
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
220
|
+
rescue Exception => e
|
221
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
result
|
226
|
+
end
|
227
|
+
|
228
|
+
promise.execute
|
229
|
+
end
|
230
|
+
|
231
|
+
#
|
232
|
+
# Upload the certificate to the IoT hub.
|
233
|
+
#
|
234
|
+
# Adds new or replaces existing certificate.
|
235
|
+
#
|
236
|
+
# @param resource_group_name [String] The name of the resource group that
|
237
|
+
# contains the IoT hub.
|
238
|
+
# @param resource_name [String] The name of the IoT hub.
|
239
|
+
# @param certificate_name [String] The name of the certificate
|
240
|
+
# @param certificate_description [CertificateBodyDescription] The certificate
|
241
|
+
# body.
|
242
|
+
# @param if_match [String] ETag of the Certificate. Do not specify for creating
|
243
|
+
# a brand new certificate. Required to update an existing certificate.
|
244
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
245
|
+
# will be added to the HTTP request.
|
246
|
+
#
|
247
|
+
# @return [CertificateDescription] operation results.
|
248
|
+
#
|
249
|
+
def create_or_update(resource_group_name, resource_name, certificate_name, certificate_description, if_match:nil, custom_headers:nil)
|
250
|
+
response = create_or_update_async(resource_group_name, resource_name, certificate_name, certificate_description, if_match:if_match, custom_headers:custom_headers).value!
|
251
|
+
response.body unless response.nil?
|
252
|
+
end
|
253
|
+
|
254
|
+
#
|
255
|
+
# Upload the certificate to the IoT hub.
|
256
|
+
#
|
257
|
+
# Adds new or replaces existing certificate.
|
258
|
+
#
|
259
|
+
# @param resource_group_name [String] The name of the resource group that
|
260
|
+
# contains the IoT hub.
|
261
|
+
# @param resource_name [String] The name of the IoT hub.
|
262
|
+
# @param certificate_name [String] The name of the certificate
|
263
|
+
# @param certificate_description [CertificateBodyDescription] The certificate
|
264
|
+
# body.
|
265
|
+
# @param if_match [String] ETag of the Certificate. Do not specify for creating
|
266
|
+
# a brand new certificate. Required to update an existing certificate.
|
267
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
268
|
+
# will be added to the HTTP request.
|
269
|
+
#
|
270
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
271
|
+
#
|
272
|
+
def create_or_update_with_http_info(resource_group_name, resource_name, certificate_name, certificate_description, if_match:nil, custom_headers:nil)
|
273
|
+
create_or_update_async(resource_group_name, resource_name, certificate_name, certificate_description, if_match:if_match, custom_headers:custom_headers).value!
|
274
|
+
end
|
275
|
+
|
276
|
+
#
|
277
|
+
# Upload the certificate to the IoT hub.
|
278
|
+
#
|
279
|
+
# Adds new or replaces existing certificate.
|
280
|
+
#
|
281
|
+
# @param resource_group_name [String] The name of the resource group that
|
282
|
+
# contains the IoT hub.
|
283
|
+
# @param resource_name [String] The name of the IoT hub.
|
284
|
+
# @param certificate_name [String] The name of the certificate
|
285
|
+
# @param certificate_description [CertificateBodyDescription] The certificate
|
286
|
+
# body.
|
287
|
+
# @param if_match [String] ETag of the Certificate. Do not specify for creating
|
288
|
+
# a brand new certificate. Required to update an existing certificate.
|
289
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
290
|
+
# to the HTTP request.
|
291
|
+
#
|
292
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
293
|
+
#
|
294
|
+
def create_or_update_async(resource_group_name, resource_name, certificate_name, certificate_description, if_match:nil, custom_headers:nil)
|
295
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
296
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
297
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
298
|
+
fail ArgumentError, 'resource_name is nil' if resource_name.nil?
|
299
|
+
fail ArgumentError, 'certificate_name is nil' if certificate_name.nil?
|
300
|
+
fail ArgumentError, "'certificate_name' should satisfy the constraint - 'Pattern': '^[A-Za-z0-9-._]{1,64}$'" if !certificate_name.nil? && certificate_name.match(Regexp.new('^^[A-Za-z0-9-._]{1,64}$$')).nil?
|
301
|
+
fail ArgumentError, 'certificate_description is nil' if certificate_description.nil?
|
302
|
+
|
303
|
+
|
304
|
+
request_headers = {}
|
305
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
306
|
+
|
307
|
+
# Set Headers
|
308
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
309
|
+
request_headers['If-Match'] = if_match unless if_match.nil?
|
310
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
311
|
+
|
312
|
+
# Serialize Request
|
313
|
+
request_mapper = Azure::IotHub::Mgmt::V2018_04_01::Models::CertificateBodyDescription.mapper()
|
314
|
+
request_content = @client.serialize(request_mapper, certificate_description)
|
315
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
316
|
+
|
317
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'
|
318
|
+
|
319
|
+
request_url = @base_url || @client.base_url
|
320
|
+
|
321
|
+
options = {
|
322
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
323
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'certificateName' => certificate_name},
|
324
|
+
query_params: {'api-version' => @client.api_version},
|
325
|
+
body: request_content,
|
326
|
+
headers: request_headers.merge(custom_headers || {}),
|
327
|
+
base_url: request_url
|
328
|
+
}
|
329
|
+
promise = @client.make_request_async(:put, path_template, options)
|
330
|
+
|
331
|
+
promise = promise.then do |result|
|
332
|
+
http_response = result.response
|
333
|
+
status_code = http_response.status
|
334
|
+
response_content = http_response.body
|
335
|
+
unless status_code == 201 || status_code == 200
|
336
|
+
error_model = JSON.load(response_content)
|
337
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
338
|
+
end
|
339
|
+
|
340
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
341
|
+
# Deserialize Response
|
342
|
+
if status_code == 201
|
343
|
+
begin
|
344
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
345
|
+
result_mapper = Azure::IotHub::Mgmt::V2018_04_01::Models::CertificateDescription.mapper()
|
346
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
347
|
+
rescue Exception => e
|
348
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
349
|
+
end
|
350
|
+
end
|
351
|
+
# Deserialize Response
|
352
|
+
if status_code == 200
|
353
|
+
begin
|
354
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
355
|
+
result_mapper = Azure::IotHub::Mgmt::V2018_04_01::Models::CertificateDescription.mapper()
|
356
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
357
|
+
rescue Exception => e
|
358
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
result
|
363
|
+
end
|
364
|
+
|
365
|
+
promise.execute
|
366
|
+
end
|
367
|
+
|
368
|
+
#
|
369
|
+
# Delete an X509 certificate.
|
370
|
+
#
|
371
|
+
# Deletes an existing X509 certificate or does nothing if it does not exist.
|
372
|
+
#
|
373
|
+
# @param resource_group_name [String] The name of the resource group that
|
374
|
+
# contains the IoT hub.
|
375
|
+
# @param resource_name [String] The name of the IoT hub.
|
376
|
+
# @param certificate_name [String] The name of the certificate
|
377
|
+
# @param if_match [String] ETag of the Certificate.
|
378
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
379
|
+
# will be added to the HTTP request.
|
380
|
+
#
|
381
|
+
#
|
382
|
+
def delete(resource_group_name, resource_name, certificate_name, if_match, custom_headers:nil)
|
383
|
+
response = delete_async(resource_group_name, resource_name, certificate_name, if_match, custom_headers:custom_headers).value!
|
384
|
+
nil
|
385
|
+
end
|
386
|
+
|
387
|
+
#
|
388
|
+
# Delete an X509 certificate.
|
389
|
+
#
|
390
|
+
# Deletes an existing X509 certificate or does nothing if it does not exist.
|
391
|
+
#
|
392
|
+
# @param resource_group_name [String] The name of the resource group that
|
393
|
+
# contains the IoT hub.
|
394
|
+
# @param resource_name [String] The name of the IoT hub.
|
395
|
+
# @param certificate_name [String] The name of the certificate
|
396
|
+
# @param if_match [String] ETag of the Certificate.
|
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 delete_with_http_info(resource_group_name, resource_name, certificate_name, if_match, custom_headers:nil)
|
403
|
+
delete_async(resource_group_name, resource_name, certificate_name, if_match, custom_headers:custom_headers).value!
|
404
|
+
end
|
405
|
+
|
406
|
+
#
|
407
|
+
# Delete an X509 certificate.
|
408
|
+
#
|
409
|
+
# Deletes an existing X509 certificate or does nothing if it does not exist.
|
410
|
+
#
|
411
|
+
# @param resource_group_name [String] The name of the resource group that
|
412
|
+
# contains the IoT hub.
|
413
|
+
# @param resource_name [String] The name of the IoT hub.
|
414
|
+
# @param certificate_name [String] The name of the certificate
|
415
|
+
# @param if_match [String] ETag of the Certificate.
|
416
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
417
|
+
# to the HTTP request.
|
418
|
+
#
|
419
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
420
|
+
#
|
421
|
+
def delete_async(resource_group_name, resource_name, certificate_name, if_match, custom_headers:nil)
|
422
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
423
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
424
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
425
|
+
fail ArgumentError, 'resource_name is nil' if resource_name.nil?
|
426
|
+
fail ArgumentError, 'certificate_name is nil' if certificate_name.nil?
|
427
|
+
fail ArgumentError, "'certificate_name' should satisfy the constraint - 'Pattern': '^[A-Za-z0-9-._]{1,64}$'" if !certificate_name.nil? && certificate_name.match(Regexp.new('^^[A-Za-z0-9-._]{1,64}$$')).nil?
|
428
|
+
fail ArgumentError, 'if_match is nil' if if_match.nil?
|
429
|
+
|
430
|
+
|
431
|
+
request_headers = {}
|
432
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
433
|
+
|
434
|
+
# Set Headers
|
435
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
436
|
+
request_headers['If-Match'] = if_match unless if_match.nil?
|
437
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
438
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'
|
439
|
+
|
440
|
+
request_url = @base_url || @client.base_url
|
441
|
+
|
442
|
+
options = {
|
443
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
444
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'certificateName' => certificate_name},
|
445
|
+
query_params: {'api-version' => @client.api_version},
|
446
|
+
headers: request_headers.merge(custom_headers || {}),
|
447
|
+
base_url: request_url
|
448
|
+
}
|
449
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
450
|
+
|
451
|
+
promise = promise.then do |result|
|
452
|
+
http_response = result.response
|
453
|
+
status_code = http_response.status
|
454
|
+
response_content = http_response.body
|
455
|
+
unless status_code == 200 || status_code == 204
|
456
|
+
error_model = JSON.load(response_content)
|
457
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
458
|
+
end
|
459
|
+
|
460
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
461
|
+
|
462
|
+
result
|
463
|
+
end
|
464
|
+
|
465
|
+
promise.execute
|
466
|
+
end
|
467
|
+
|
468
|
+
#
|
469
|
+
# Generate verification code for proof of possession flow.
|
470
|
+
#
|
471
|
+
# Generates verification code for proof of possession flow. The verification
|
472
|
+
# code will be used to generate a leaf certificate.
|
473
|
+
#
|
474
|
+
# @param resource_group_name [String] The name of the resource group that
|
475
|
+
# contains the IoT hub.
|
476
|
+
# @param resource_name [String] The name of the IoT hub.
|
477
|
+
# @param certificate_name [String] The name of the certificate
|
478
|
+
# @param if_match [String] ETag of the Certificate.
|
479
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
480
|
+
# will be added to the HTTP request.
|
481
|
+
#
|
482
|
+
# @return [CertificateWithNonceDescription] operation results.
|
483
|
+
#
|
484
|
+
def generate_verification_code(resource_group_name, resource_name, certificate_name, if_match, custom_headers:nil)
|
485
|
+
response = generate_verification_code_async(resource_group_name, resource_name, certificate_name, if_match, custom_headers:custom_headers).value!
|
486
|
+
response.body unless response.nil?
|
487
|
+
end
|
488
|
+
|
489
|
+
#
|
490
|
+
# Generate verification code for proof of possession flow.
|
491
|
+
#
|
492
|
+
# Generates verification code for proof of possession flow. The verification
|
493
|
+
# code will be used to generate a leaf certificate.
|
494
|
+
#
|
495
|
+
# @param resource_group_name [String] The name of the resource group that
|
496
|
+
# contains the IoT hub.
|
497
|
+
# @param resource_name [String] The name of the IoT hub.
|
498
|
+
# @param certificate_name [String] The name of the certificate
|
499
|
+
# @param if_match [String] ETag of the Certificate.
|
500
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
501
|
+
# will be added to the HTTP request.
|
502
|
+
#
|
503
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
504
|
+
#
|
505
|
+
def generate_verification_code_with_http_info(resource_group_name, resource_name, certificate_name, if_match, custom_headers:nil)
|
506
|
+
generate_verification_code_async(resource_group_name, resource_name, certificate_name, if_match, custom_headers:custom_headers).value!
|
507
|
+
end
|
508
|
+
|
509
|
+
#
|
510
|
+
# Generate verification code for proof of possession flow.
|
511
|
+
#
|
512
|
+
# Generates verification code for proof of possession flow. The verification
|
513
|
+
# code will be used to generate a leaf certificate.
|
514
|
+
#
|
515
|
+
# @param resource_group_name [String] The name of the resource group that
|
516
|
+
# contains the IoT hub.
|
517
|
+
# @param resource_name [String] The name of the IoT hub.
|
518
|
+
# @param certificate_name [String] The name of the certificate
|
519
|
+
# @param if_match [String] ETag of the Certificate.
|
520
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
521
|
+
# to the HTTP request.
|
522
|
+
#
|
523
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
524
|
+
#
|
525
|
+
def generate_verification_code_async(resource_group_name, resource_name, certificate_name, if_match, custom_headers:nil)
|
526
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
527
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
528
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
529
|
+
fail ArgumentError, 'resource_name is nil' if resource_name.nil?
|
530
|
+
fail ArgumentError, 'certificate_name is nil' if certificate_name.nil?
|
531
|
+
fail ArgumentError, "'certificate_name' should satisfy the constraint - 'Pattern': '^[A-Za-z0-9-._]{1,64}$'" if !certificate_name.nil? && certificate_name.match(Regexp.new('^^[A-Za-z0-9-._]{1,64}$$')).nil?
|
532
|
+
fail ArgumentError, 'if_match is nil' if if_match.nil?
|
533
|
+
|
534
|
+
|
535
|
+
request_headers = {}
|
536
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
537
|
+
|
538
|
+
# Set Headers
|
539
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
540
|
+
request_headers['If-Match'] = if_match unless if_match.nil?
|
541
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
542
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode'
|
543
|
+
|
544
|
+
request_url = @base_url || @client.base_url
|
545
|
+
|
546
|
+
options = {
|
547
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
548
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'certificateName' => certificate_name},
|
549
|
+
query_params: {'api-version' => @client.api_version},
|
550
|
+
headers: request_headers.merge(custom_headers || {}),
|
551
|
+
base_url: request_url
|
552
|
+
}
|
553
|
+
promise = @client.make_request_async(:post, path_template, options)
|
554
|
+
|
555
|
+
promise = promise.then do |result|
|
556
|
+
http_response = result.response
|
557
|
+
status_code = http_response.status
|
558
|
+
response_content = http_response.body
|
559
|
+
unless status_code == 200
|
560
|
+
error_model = JSON.load(response_content)
|
561
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
562
|
+
end
|
563
|
+
|
564
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
565
|
+
# Deserialize Response
|
566
|
+
if status_code == 200
|
567
|
+
begin
|
568
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
569
|
+
result_mapper = Azure::IotHub::Mgmt::V2018_04_01::Models::CertificateWithNonceDescription.mapper()
|
570
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
571
|
+
rescue Exception => e
|
572
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
573
|
+
end
|
574
|
+
end
|
575
|
+
|
576
|
+
result
|
577
|
+
end
|
578
|
+
|
579
|
+
promise.execute
|
580
|
+
end
|
581
|
+
|
582
|
+
#
|
583
|
+
# Verify certificate's private key possession.
|
584
|
+
#
|
585
|
+
# Verifies the certificate's private key possession by providing the leaf cert
|
586
|
+
# issued by the verifying pre uploaded certificate.
|
587
|
+
#
|
588
|
+
# @param resource_group_name [String] The name of the resource group that
|
589
|
+
# contains the IoT hub.
|
590
|
+
# @param resource_name [String] The name of the IoT hub.
|
591
|
+
# @param certificate_name [String] The name of the certificate
|
592
|
+
# @param certificate_verification_body [CertificateVerificationDescription] The
|
593
|
+
# name of the certificate
|
594
|
+
# @param if_match [String] ETag of the Certificate.
|
595
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
596
|
+
# will be added to the HTTP request.
|
597
|
+
#
|
598
|
+
# @return [CertificateDescription] operation results.
|
599
|
+
#
|
600
|
+
def verify(resource_group_name, resource_name, certificate_name, certificate_verification_body, if_match, custom_headers:nil)
|
601
|
+
response = verify_async(resource_group_name, resource_name, certificate_name, certificate_verification_body, if_match, custom_headers:custom_headers).value!
|
602
|
+
response.body unless response.nil?
|
603
|
+
end
|
604
|
+
|
605
|
+
#
|
606
|
+
# Verify certificate's private key possession.
|
607
|
+
#
|
608
|
+
# Verifies the certificate's private key possession by providing the leaf cert
|
609
|
+
# issued by the verifying pre uploaded certificate.
|
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 certificate_name [String] The name of the certificate
|
615
|
+
# @param certificate_verification_body [CertificateVerificationDescription] The
|
616
|
+
# name of the certificate
|
617
|
+
# @param if_match [String] ETag of the Certificate.
|
618
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
619
|
+
# will be added to the HTTP request.
|
620
|
+
#
|
621
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
622
|
+
#
|
623
|
+
def verify_with_http_info(resource_group_name, resource_name, certificate_name, certificate_verification_body, if_match, custom_headers:nil)
|
624
|
+
verify_async(resource_group_name, resource_name, certificate_name, certificate_verification_body, if_match, custom_headers:custom_headers).value!
|
625
|
+
end
|
626
|
+
|
627
|
+
#
|
628
|
+
# Verify certificate's private key possession.
|
629
|
+
#
|
630
|
+
# Verifies the certificate's private key possession by providing the leaf cert
|
631
|
+
# issued by the verifying pre uploaded certificate.
|
632
|
+
#
|
633
|
+
# @param resource_group_name [String] The name of the resource group that
|
634
|
+
# contains the IoT hub.
|
635
|
+
# @param resource_name [String] The name of the IoT hub.
|
636
|
+
# @param certificate_name [String] The name of the certificate
|
637
|
+
# @param certificate_verification_body [CertificateVerificationDescription] The
|
638
|
+
# name of the certificate
|
639
|
+
# @param if_match [String] ETag of the Certificate.
|
640
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
641
|
+
# to the HTTP request.
|
642
|
+
#
|
643
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
644
|
+
#
|
645
|
+
def verify_async(resource_group_name, resource_name, certificate_name, certificate_verification_body, if_match, custom_headers:nil)
|
646
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
647
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
648
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
649
|
+
fail ArgumentError, 'resource_name is nil' if resource_name.nil?
|
650
|
+
fail ArgumentError, 'certificate_name is nil' if certificate_name.nil?
|
651
|
+
fail ArgumentError, "'certificate_name' should satisfy the constraint - 'Pattern': '^[A-Za-z0-9-._]{1,64}$'" if !certificate_name.nil? && certificate_name.match(Regexp.new('^^[A-Za-z0-9-._]{1,64}$$')).nil?
|
652
|
+
fail ArgumentError, 'certificate_verification_body is nil' if certificate_verification_body.nil?
|
653
|
+
fail ArgumentError, 'if_match is nil' if if_match.nil?
|
654
|
+
|
655
|
+
|
656
|
+
request_headers = {}
|
657
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
658
|
+
|
659
|
+
# Set Headers
|
660
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
661
|
+
request_headers['If-Match'] = if_match unless if_match.nil?
|
662
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
663
|
+
|
664
|
+
# Serialize Request
|
665
|
+
request_mapper = Azure::IotHub::Mgmt::V2018_04_01::Models::CertificateVerificationDescription.mapper()
|
666
|
+
request_content = @client.serialize(request_mapper, certificate_verification_body)
|
667
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
668
|
+
|
669
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify'
|
670
|
+
|
671
|
+
request_url = @base_url || @client.base_url
|
672
|
+
|
673
|
+
options = {
|
674
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
675
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'certificateName' => certificate_name},
|
676
|
+
query_params: {'api-version' => @client.api_version},
|
677
|
+
body: request_content,
|
678
|
+
headers: request_headers.merge(custom_headers || {}),
|
679
|
+
base_url: request_url
|
680
|
+
}
|
681
|
+
promise = @client.make_request_async(:post, path_template, options)
|
682
|
+
|
683
|
+
promise = promise.then do |result|
|
684
|
+
http_response = result.response
|
685
|
+
status_code = http_response.status
|
686
|
+
response_content = http_response.body
|
687
|
+
unless status_code == 200
|
688
|
+
error_model = JSON.load(response_content)
|
689
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
690
|
+
end
|
691
|
+
|
692
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
693
|
+
# Deserialize Response
|
694
|
+
if status_code == 200
|
695
|
+
begin
|
696
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
697
|
+
result_mapper = Azure::IotHub::Mgmt::V2018_04_01::Models::CertificateDescription.mapper()
|
698
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
699
|
+
rescue Exception => e
|
700
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
701
|
+
end
|
702
|
+
end
|
703
|
+
|
704
|
+
result
|
705
|
+
end
|
706
|
+
|
707
|
+
promise.execute
|
708
|
+
end
|
709
|
+
|
710
|
+
end
|
711
|
+
end
|