azure_cognitiveservices_qnamaker 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker.rb +63 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/alterations.rb +189 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/endpoint_keys.rb +194 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/knowledgebase.rb +721 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/alterations_dto.rb +54 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/create_kb_dto.rb +111 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/create_kb_input_dto.rb +95 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/delete_kb_contents_dto.rb +74 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/endpoint_keys_dto.rb +79 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/environment_type.rb +16 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/error.rb +108 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/error_code_type.rb +28 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/error_response.rb +48 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/error_response_error.rb +85 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/file_dto.rb +62 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/inner_error_model.rb +62 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/knowledgebase_dto.rb +155 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/knowledgebase_environment_type.rb +16 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/knowledgebases_dto.rb +55 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/metadata_dto.rb +65 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/operation.rb +115 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/operation_state_type.rb +18 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/qn_adocuments_dto.rb +55 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/qn_adto.rb +116 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/replace_kb_dto.rb +57 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_kb_contents_dto.rb +87 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_kb_operation_dto.rb +74 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_kb_operation_dtoadd.rb +85 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_kb_operation_dtodelete.rb +67 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_kb_operation_dtoupdate.rb +76 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_metadata_dto.rb +77 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_qna_dto.rb +102 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_qna_dtometadata.rb +69 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_qna_dtoquestions.rb +67 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_questions_dto.rb +74 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/word_alterations_dto.rb +55 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/module_definition.rb +9 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/operations.rb +112 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamaker/qnamaker_client.rb +143 -0
- data/lib/azure_cognitiveservices_qnamaker.rb +6 -0
- data/lib/module_definition.rb +7 -0
- data/lib/profiles/latest/modules/qnamaker_profile_module.rb +193 -0
- data/lib/profiles/latest/qnamaker_latest_profile_client.rb +38 -0
- data/lib/profiles/latest/qnamaker_module_definition.rb +8 -0
- data/lib/version.rb +7 -0
- metadata +165 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dba26fcab45e5bd93abdfe02e6849e69a82c1558
|
4
|
+
data.tar.gz: ed6a0b826ad1bc51b9edfad550ba1b6b83ddeb81
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 209639068f4ed10d1fefe3df522b5bb501b7ed9ffb6947e54dd1e4c25d281feb64117851685679e7531147301fefde1c7cf6db3e0b1446084535ee4357cb0c85
|
7
|
+
data.tar.gz: 261965b47f77bbea471287c798378831964abed27b979f5f55ecbdb992e3b9a3a003962fb17213c1949a7deeff73cd15de4f024b1746308c5b19149f8e38960d
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Microsoft Corporation
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
@@ -0,0 +1,63 @@
|
|
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
|
+
require 'uri'
|
7
|
+
require 'cgi'
|
8
|
+
require 'date'
|
9
|
+
require 'json'
|
10
|
+
require 'base64'
|
11
|
+
require 'erb'
|
12
|
+
require 'securerandom'
|
13
|
+
require 'time'
|
14
|
+
require 'timeliness'
|
15
|
+
require 'faraday'
|
16
|
+
require 'faraday-cookie_jar'
|
17
|
+
require 'concurrent'
|
18
|
+
require 'ms_rest'
|
19
|
+
require '4.0/generated/azure_cognitiveservices_qnamaker/module_definition'
|
20
|
+
require 'ms_rest_azure'
|
21
|
+
|
22
|
+
module Azure::CognitiveServices::Qnamaker::V4_0
|
23
|
+
autoload :EndpointKeys, '4.0/generated/azure_cognitiveservices_qnamaker/endpoint_keys.rb'
|
24
|
+
autoload :Alterations, '4.0/generated/azure_cognitiveservices_qnamaker/alterations.rb'
|
25
|
+
autoload :Knowledgebase, '4.0/generated/azure_cognitiveservices_qnamaker/knowledgebase.rb'
|
26
|
+
autoload :Operations, '4.0/generated/azure_cognitiveservices_qnamaker/operations.rb'
|
27
|
+
autoload :QnamakerClient, '4.0/generated/azure_cognitiveservices_qnamaker/qnamaker_client.rb'
|
28
|
+
|
29
|
+
module Models
|
30
|
+
autoload :CreateKbInputDTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/create_kb_input_dto.rb'
|
31
|
+
autoload :DeleteKbContentsDTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/delete_kb_contents_dto.rb'
|
32
|
+
autoload :QnADTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/qn_adto.rb'
|
33
|
+
autoload :EndpointKeysDTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/endpoint_keys_dto.rb'
|
34
|
+
autoload :FileDTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/file_dto.rb'
|
35
|
+
autoload :WordAlterationsDTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/word_alterations_dto.rb'
|
36
|
+
autoload :KnowledgebasesDTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/knowledgebases_dto.rb'
|
37
|
+
autoload :UpdateQnaDTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/update_qna_dto.rb'
|
38
|
+
autoload :QnADocumentsDTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/qn_adocuments_dto.rb'
|
39
|
+
autoload :UpdateQuestionsDTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/update_questions_dto.rb'
|
40
|
+
autoload :CreateKbDTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/create_kb_dto.rb'
|
41
|
+
autoload :UpdateMetadataDTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/update_metadata_dto.rb'
|
42
|
+
autoload :ReplaceKbDTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/replace_kb_dto.rb'
|
43
|
+
autoload :UpdateKbOperationDTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/update_kb_operation_dto.rb'
|
44
|
+
autoload :KnowledgebaseDTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/knowledgebase_dto.rb'
|
45
|
+
autoload :UpdateKbContentsDTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/update_kb_contents_dto.rb'
|
46
|
+
autoload :ErrorResponse, '4.0/generated/azure_cognitiveservices_qnamaker/models/error_response.rb'
|
47
|
+
autoload :InnerErrorModel, '4.0/generated/azure_cognitiveservices_qnamaker/models/inner_error_model.rb'
|
48
|
+
autoload :MetadataDTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/metadata_dto.rb'
|
49
|
+
autoload :Error, '4.0/generated/azure_cognitiveservices_qnamaker/models/error.rb'
|
50
|
+
autoload :AlterationsDTO, '4.0/generated/azure_cognitiveservices_qnamaker/models/alterations_dto.rb'
|
51
|
+
autoload :Operation, '4.0/generated/azure_cognitiveservices_qnamaker/models/operation.rb'
|
52
|
+
autoload :UpdateKbOperationDTOAdd, '4.0/generated/azure_cognitiveservices_qnamaker/models/update_kb_operation_dtoadd.rb'
|
53
|
+
autoload :UpdateKbOperationDTODelete, '4.0/generated/azure_cognitiveservices_qnamaker/models/update_kb_operation_dtodelete.rb'
|
54
|
+
autoload :UpdateKbOperationDTOUpdate, '4.0/generated/azure_cognitiveservices_qnamaker/models/update_kb_operation_dtoupdate.rb'
|
55
|
+
autoload :UpdateQnaDTOQuestions, '4.0/generated/azure_cognitiveservices_qnamaker/models/update_qna_dtoquestions.rb'
|
56
|
+
autoload :UpdateQnaDTOMetadata, '4.0/generated/azure_cognitiveservices_qnamaker/models/update_qna_dtometadata.rb'
|
57
|
+
autoload :ErrorResponseError, '4.0/generated/azure_cognitiveservices_qnamaker/models/error_response_error.rb'
|
58
|
+
autoload :KnowledgebaseEnvironmentType, '4.0/generated/azure_cognitiveservices_qnamaker/models/knowledgebase_environment_type.rb'
|
59
|
+
autoload :ErrorCodeType, '4.0/generated/azure_cognitiveservices_qnamaker/models/error_code_type.rb'
|
60
|
+
autoload :OperationStateType, '4.0/generated/azure_cognitiveservices_qnamaker/models/operation_state_type.rb'
|
61
|
+
autoload :EnvironmentType, '4.0/generated/azure_cognitiveservices_qnamaker/models/environment_type.rb'
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,189 @@
|
|
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::CognitiveServices::Qnamaker::V4_0
|
7
|
+
#
|
8
|
+
# An API for QnAMaker Service
|
9
|
+
#
|
10
|
+
class Alterations
|
11
|
+
include MsRestAzure
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the Alterations class.
|
15
|
+
# @param client service class for accessing basic functionality.
|
16
|
+
#
|
17
|
+
def initialize(client)
|
18
|
+
@client = client
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [QnamakerClient] reference to the QnamakerClient
|
22
|
+
attr_reader :client
|
23
|
+
|
24
|
+
#
|
25
|
+
# Download alterations from runtime.
|
26
|
+
#
|
27
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
28
|
+
# will be added to the HTTP request.
|
29
|
+
#
|
30
|
+
# @return [WordAlterationsDTO] operation results.
|
31
|
+
#
|
32
|
+
def get(custom_headers:nil)
|
33
|
+
response = get_async(custom_headers:custom_headers).value!
|
34
|
+
response.body unless response.nil?
|
35
|
+
end
|
36
|
+
|
37
|
+
#
|
38
|
+
# Download alterations from runtime.
|
39
|
+
#
|
40
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
41
|
+
# will be added to the HTTP request.
|
42
|
+
#
|
43
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
44
|
+
#
|
45
|
+
def get_with_http_info(custom_headers:nil)
|
46
|
+
get_async(custom_headers:custom_headers).value!
|
47
|
+
end
|
48
|
+
|
49
|
+
#
|
50
|
+
# Download alterations from runtime.
|
51
|
+
#
|
52
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
53
|
+
# to the HTTP request.
|
54
|
+
#
|
55
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
56
|
+
#
|
57
|
+
def get_async(custom_headers:nil)
|
58
|
+
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
|
59
|
+
|
60
|
+
|
61
|
+
request_headers = {}
|
62
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
63
|
+
|
64
|
+
# Set Headers
|
65
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
66
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
67
|
+
path_template = 'alterations'
|
68
|
+
|
69
|
+
request_url = @base_url || @client.base_url
|
70
|
+
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
|
71
|
+
|
72
|
+
options = {
|
73
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
74
|
+
headers: request_headers.merge(custom_headers || {}),
|
75
|
+
base_url: request_url
|
76
|
+
}
|
77
|
+
promise = @client.make_request_async(:get, path_template, options)
|
78
|
+
|
79
|
+
promise = promise.then do |result|
|
80
|
+
http_response = result.response
|
81
|
+
status_code = http_response.status
|
82
|
+
response_content = http_response.body
|
83
|
+
unless status_code == 200
|
84
|
+
error_model = JSON.load(response_content)
|
85
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
86
|
+
end
|
87
|
+
|
88
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
89
|
+
# Deserialize Response
|
90
|
+
if status_code == 200
|
91
|
+
begin
|
92
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
93
|
+
result_mapper = Azure::CognitiveServices::Qnamaker::V4_0::Models::WordAlterationsDTO.mapper()
|
94
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
95
|
+
rescue Exception => e
|
96
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
result
|
101
|
+
end
|
102
|
+
|
103
|
+
promise.execute
|
104
|
+
end
|
105
|
+
|
106
|
+
#
|
107
|
+
# Replace alterations data.
|
108
|
+
#
|
109
|
+
# @param word_alterations [WordAlterationsDTO] New alterations data.
|
110
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
111
|
+
# will be added to the HTTP request.
|
112
|
+
#
|
113
|
+
#
|
114
|
+
def replace(word_alterations, custom_headers:nil)
|
115
|
+
response = replace_async(word_alterations, custom_headers:custom_headers).value!
|
116
|
+
nil
|
117
|
+
end
|
118
|
+
|
119
|
+
#
|
120
|
+
# Replace alterations data.
|
121
|
+
#
|
122
|
+
# @param word_alterations [WordAlterationsDTO] New alterations data.
|
123
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
124
|
+
# will be added to the HTTP request.
|
125
|
+
#
|
126
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
127
|
+
#
|
128
|
+
def replace_with_http_info(word_alterations, custom_headers:nil)
|
129
|
+
replace_async(word_alterations, custom_headers:custom_headers).value!
|
130
|
+
end
|
131
|
+
|
132
|
+
#
|
133
|
+
# Replace alterations data.
|
134
|
+
#
|
135
|
+
# @param word_alterations [WordAlterationsDTO] New alterations data.
|
136
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
137
|
+
# to the HTTP request.
|
138
|
+
#
|
139
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
140
|
+
#
|
141
|
+
def replace_async(word_alterations, custom_headers:nil)
|
142
|
+
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
|
143
|
+
fail ArgumentError, 'word_alterations is nil' if word_alterations.nil?
|
144
|
+
|
145
|
+
|
146
|
+
request_headers = {}
|
147
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
148
|
+
|
149
|
+
# Set Headers
|
150
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
151
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
152
|
+
|
153
|
+
# Serialize Request
|
154
|
+
request_mapper = Azure::CognitiveServices::Qnamaker::V4_0::Models::WordAlterationsDTO.mapper()
|
155
|
+
request_content = @client.serialize(request_mapper, word_alterations)
|
156
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
157
|
+
|
158
|
+
path_template = 'alterations'
|
159
|
+
|
160
|
+
request_url = @base_url || @client.base_url
|
161
|
+
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
|
162
|
+
|
163
|
+
options = {
|
164
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
165
|
+
body: request_content,
|
166
|
+
headers: request_headers.merge(custom_headers || {}),
|
167
|
+
base_url: request_url
|
168
|
+
}
|
169
|
+
promise = @client.make_request_async(:put, path_template, options)
|
170
|
+
|
171
|
+
promise = promise.then do |result|
|
172
|
+
http_response = result.response
|
173
|
+
status_code = http_response.status
|
174
|
+
response_content = http_response.body
|
175
|
+
unless status_code == 204
|
176
|
+
error_model = JSON.load(response_content)
|
177
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
178
|
+
end
|
179
|
+
|
180
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
181
|
+
|
182
|
+
result
|
183
|
+
end
|
184
|
+
|
185
|
+
promise.execute
|
186
|
+
end
|
187
|
+
|
188
|
+
end
|
189
|
+
end
|
@@ -0,0 +1,194 @@
|
|
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::CognitiveServices::Qnamaker::V4_0
|
7
|
+
#
|
8
|
+
# An API for QnAMaker Service
|
9
|
+
#
|
10
|
+
class EndpointKeys
|
11
|
+
include MsRestAzure
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the EndpointKeys class.
|
15
|
+
# @param client service class for accessing basic functionality.
|
16
|
+
#
|
17
|
+
def initialize(client)
|
18
|
+
@client = client
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [QnamakerClient] reference to the QnamakerClient
|
22
|
+
attr_reader :client
|
23
|
+
|
24
|
+
#
|
25
|
+
# Gets endpoint keys for an endpoint
|
26
|
+
#
|
27
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
28
|
+
# will be added to the HTTP request.
|
29
|
+
#
|
30
|
+
# @return [EndpointKeysDTO] operation results.
|
31
|
+
#
|
32
|
+
def get_keys(custom_headers:nil)
|
33
|
+
response = get_keys_async(custom_headers:custom_headers).value!
|
34
|
+
response.body unless response.nil?
|
35
|
+
end
|
36
|
+
|
37
|
+
#
|
38
|
+
# Gets endpoint keys for an endpoint
|
39
|
+
#
|
40
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
41
|
+
# will be added to the HTTP request.
|
42
|
+
#
|
43
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
44
|
+
#
|
45
|
+
def get_keys_with_http_info(custom_headers:nil)
|
46
|
+
get_keys_async(custom_headers:custom_headers).value!
|
47
|
+
end
|
48
|
+
|
49
|
+
#
|
50
|
+
# Gets endpoint keys for an endpoint
|
51
|
+
#
|
52
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
53
|
+
# to the HTTP request.
|
54
|
+
#
|
55
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
56
|
+
#
|
57
|
+
def get_keys_async(custom_headers:nil)
|
58
|
+
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
|
59
|
+
|
60
|
+
|
61
|
+
request_headers = {}
|
62
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
63
|
+
|
64
|
+
# Set Headers
|
65
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
66
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
67
|
+
path_template = 'endpointkeys'
|
68
|
+
|
69
|
+
request_url = @base_url || @client.base_url
|
70
|
+
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
|
71
|
+
|
72
|
+
options = {
|
73
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
74
|
+
headers: request_headers.merge(custom_headers || {}),
|
75
|
+
base_url: request_url
|
76
|
+
}
|
77
|
+
promise = @client.make_request_async(:get, path_template, options)
|
78
|
+
|
79
|
+
promise = promise.then do |result|
|
80
|
+
http_response = result.response
|
81
|
+
status_code = http_response.status
|
82
|
+
response_content = http_response.body
|
83
|
+
unless status_code == 200
|
84
|
+
error_model = JSON.load(response_content)
|
85
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
86
|
+
end
|
87
|
+
|
88
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
89
|
+
# Deserialize Response
|
90
|
+
if status_code == 200
|
91
|
+
begin
|
92
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
93
|
+
result_mapper = Azure::CognitiveServices::Qnamaker::V4_0::Models::EndpointKeysDTO.mapper()
|
94
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
95
|
+
rescue Exception => e
|
96
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
result
|
101
|
+
end
|
102
|
+
|
103
|
+
promise.execute
|
104
|
+
end
|
105
|
+
|
106
|
+
#
|
107
|
+
# Re-generates an endpoint key.
|
108
|
+
#
|
109
|
+
# @param key_type [String] Type of Key
|
110
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
111
|
+
# will be added to the HTTP request.
|
112
|
+
#
|
113
|
+
# @return [EndpointKeysDTO] operation results.
|
114
|
+
#
|
115
|
+
def refresh_keys(key_type, custom_headers:nil)
|
116
|
+
response = refresh_keys_async(key_type, custom_headers:custom_headers).value!
|
117
|
+
response.body unless response.nil?
|
118
|
+
end
|
119
|
+
|
120
|
+
#
|
121
|
+
# Re-generates an endpoint key.
|
122
|
+
#
|
123
|
+
# @param key_type [String] Type of Key
|
124
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
125
|
+
# will be added to the HTTP request.
|
126
|
+
#
|
127
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
128
|
+
#
|
129
|
+
def refresh_keys_with_http_info(key_type, custom_headers:nil)
|
130
|
+
refresh_keys_async(key_type, custom_headers:custom_headers).value!
|
131
|
+
end
|
132
|
+
|
133
|
+
#
|
134
|
+
# Re-generates an endpoint key.
|
135
|
+
#
|
136
|
+
# @param key_type [String] Type of Key
|
137
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
138
|
+
# to the HTTP request.
|
139
|
+
#
|
140
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
141
|
+
#
|
142
|
+
def refresh_keys_async(key_type, custom_headers:nil)
|
143
|
+
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
|
144
|
+
fail ArgumentError, 'key_type is nil' if key_type.nil?
|
145
|
+
|
146
|
+
|
147
|
+
request_headers = {}
|
148
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
149
|
+
|
150
|
+
# Set Headers
|
151
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
152
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
153
|
+
path_template = 'endpointkeys/{keyType}'
|
154
|
+
|
155
|
+
request_url = @base_url || @client.base_url
|
156
|
+
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
|
157
|
+
|
158
|
+
options = {
|
159
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
160
|
+
path_params: {'keyType' => key_type},
|
161
|
+
headers: request_headers.merge(custom_headers || {}),
|
162
|
+
base_url: request_url
|
163
|
+
}
|
164
|
+
promise = @client.make_request_async(:patch, path_template, options)
|
165
|
+
|
166
|
+
promise = promise.then do |result|
|
167
|
+
http_response = result.response
|
168
|
+
status_code = http_response.status
|
169
|
+
response_content = http_response.body
|
170
|
+
unless status_code == 200
|
171
|
+
error_model = JSON.load(response_content)
|
172
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
173
|
+
end
|
174
|
+
|
175
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
176
|
+
# Deserialize Response
|
177
|
+
if status_code == 200
|
178
|
+
begin
|
179
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
180
|
+
result_mapper = Azure::CognitiveServices::Qnamaker::V4_0::Models::EndpointKeysDTO.mapper()
|
181
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
182
|
+
rescue Exception => e
|
183
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
result
|
188
|
+
end
|
189
|
+
|
190
|
+
promise.execute
|
191
|
+
end
|
192
|
+
|
193
|
+
end
|
194
|
+
end
|