trinsic_service_clients 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +0 -0
- data/lib/trinsic_service_clients.rb +12 -0
- data/lib/trinsic_service_clients/credentials.rb +68 -0
- data/lib/trinsic_service_clients/credentials/credentials_client.rb +4702 -0
- data/lib/trinsic_service_clients/credentials/models/agent_endpoint.rb +77 -0
- data/lib/trinsic_service_clients/credentials/models/attribute_filter.rb +111 -0
- data/lib/trinsic_service_clients/credentials/models/attribute_value.rb +55 -0
- data/lib/trinsic_service_clients/credentials/models/basic_message_contract.rb +76 -0
- data/lib/trinsic_service_clients/credentials/models/basic_message_parameters.rb +54 -0
- data/lib/trinsic_service_clients/credentials/models/basic_message_record.rb +124 -0
- data/lib/trinsic_service_clients/credentials/models/connection_contract.rb +178 -0
- data/lib/trinsic_service_clients/credentials/models/connection_invitation_parameters.rb +71 -0
- data/lib/trinsic_service_clients/credentials/models/credential_contract.rb +152 -0
- data/lib/trinsic_service_clients/credentials/models/credential_definition_contract.rb +107 -0
- data/lib/trinsic_service_clients/credentials/models/credential_definition_from_schema_parameters.rb +97 -0
- data/lib/trinsic_service_clients/credentials/models/credential_definition_parameters.rb +55 -0
- data/lib/trinsic_service_clients/credentials/models/credential_offer_parameters.rb +90 -0
- data/lib/trinsic_service_clients/credentials/models/issuer_status_contract.rb +111 -0
- data/lib/trinsic_service_clients/credentials/models/network_contract.rb +77 -0
- data/lib/trinsic_service_clients/credentials/models/network_txn_agreement_contract.rb +73 -0
- data/lib/trinsic_service_clients/credentials/models/proof_attribute_contract.rb +108 -0
- data/lib/trinsic_service_clients/credentials/models/proof_attribute_info.rb +95 -0
- data/lib/trinsic_service_clients/credentials/models/proof_predicate_info.rb +117 -0
- data/lib/trinsic_service_clients/credentials/models/proof_proposal.rb +84 -0
- data/lib/trinsic_service_clients/credentials/models/proof_request.rb +118 -0
- data/lib/trinsic_service_clients/credentials/models/proposed_attribute.rb +110 -0
- data/lib/trinsic_service_clients/credentials/models/proposed_predicate.rb +110 -0
- data/lib/trinsic_service_clients/credentials/models/revocation_interval.rb +55 -0
- data/lib/trinsic_service_clients/credentials/models/schema_parameters.rb +73 -0
- data/lib/trinsic_service_clients/credentials/models/schema_record.rb +121 -0
- data/lib/trinsic_service_clients/credentials/models/tenant_contract.rb +91 -0
- data/lib/trinsic_service_clients/credentials/models/tenant_extended_information_contract.rb +123 -0
- data/lib/trinsic_service_clients/credentials/models/tenant_parameters.rb +90 -0
- data/lib/trinsic_service_clients/credentials/models/verification_contract.rb +188 -0
- data/lib/trinsic_service_clients/credentials/models/verification_definition_contract.rb +56 -0
- data/lib/trinsic_service_clients/credentials/models/verification_parameters.rb +54 -0
- data/lib/trinsic_service_clients/credentials/models/verification_policy_attribute_contract.rb +83 -0
- data/lib/trinsic_service_clients/credentials/models/verification_policy_contract.rb +118 -0
- data/lib/trinsic_service_clients/credentials/models/verification_policy_parameters.rb +107 -0
- data/lib/trinsic_service_clients/credentials/models/verification_policy_predicate_contract.rb +97 -0
- data/lib/trinsic_service_clients/credentials/models/verification_policy_restriction.rb +111 -0
- data/lib/trinsic_service_clients/credentials/models/verification_policy_restriction_attribute.rb +55 -0
- data/lib/trinsic_service_clients/credentials/models/verification_policy_revocation_requirement.rb +44 -0
- data/lib/trinsic_service_clients/credentials/models/verification_result.rb +64 -0
- data/lib/trinsic_service_clients/credentials/models/webhook_contract.rb +78 -0
- data/lib/trinsic_service_clients/credentials/models/webhook_parameters.rb +67 -0
- data/lib/trinsic_service_clients/credentials/module_definition.rb +6 -0
- data/lib/trinsic_service_clients/credentials/version.rb +8 -0
- data/lib/trinsic_service_clients/provider.rb +35 -0
- data/lib/trinsic_service_clients/provider/models/asset_contract.rb +43 -0
- data/lib/trinsic_service_clients/provider/models/cloud_wallet_analytics_contract.rb +43 -0
- data/lib/trinsic_service_clients/provider/models/network_contract.rb +77 -0
- data/lib/trinsic_service_clients/provider/models/tenant_contract.rb +91 -0
- data/lib/trinsic_service_clients/provider/models/tenant_extended_information_contract.rb +123 -0
- data/lib/trinsic_service_clients/provider/models/tenant_keys_contract.rb +55 -0
- data/lib/trinsic_service_clients/provider/models/tenant_parameters.rb +101 -0
- data/lib/trinsic_service_clients/provider/models/tenant_update_parameters.rb +54 -0
- data/lib/trinsic_service_clients/provider/models/usage_contract.rb +87 -0
- data/lib/trinsic_service_clients/provider/module_definition.rb +6 -0
- data/lib/trinsic_service_clients/provider/provider_client.rb +826 -0
- data/lib/trinsic_service_clients/provider/version.rb +8 -0
- data/lib/trinsic_service_clients/wallet.rb +44 -0
- data/lib/trinsic_service_clients/wallet/models/agent_endpoint.rb +77 -0
- data/lib/trinsic_service_clients/wallet/models/connection_contract.rb +178 -0
- data/lib/trinsic_service_clients/wallet/models/credential_contract.rb +152 -0
- data/lib/trinsic_service_clients/wallet/models/custodian_wallet_contract.rb +54 -0
- data/lib/trinsic_service_clients/wallet/models/proof_attribute_contract.rb +108 -0
- data/lib/trinsic_service_clients/wallet/models/proof_proposal.rb +84 -0
- data/lib/trinsic_service_clients/wallet/models/proposed_attribute.rb +110 -0
- data/lib/trinsic_service_clients/wallet/models/proposed_predicate.rb +110 -0
- data/lib/trinsic_service_clients/wallet/models/verification_contract.rb +188 -0
- data/lib/trinsic_service_clients/wallet/models/verification_policy_attribute_contract.rb +83 -0
- data/lib/trinsic_service_clients/wallet/models/verification_policy_credential_contract.rb +83 -0
- data/lib/trinsic_service_clients/wallet/models/verification_policy_credential_parameters.rb +66 -0
- data/lib/trinsic_service_clients/wallet/models/verification_policy_parameters.rb +107 -0
- data/lib/trinsic_service_clients/wallet/models/verification_policy_predicate_contract.rb +97 -0
- data/lib/trinsic_service_clients/wallet/models/verification_policy_restriction.rb +111 -0
- data/lib/trinsic_service_clients/wallet/models/verification_policy_restriction_attribute.rb +55 -0
- data/lib/trinsic_service_clients/wallet/models/verification_policy_revocation_reqirement.rb +44 -0
- data/lib/trinsic_service_clients/wallet/models/wallet_parameters.rb +58 -0
- data/lib/trinsic_service_clients/wallet/module_definition.rb +6 -0
- data/lib/trinsic_service_clients/wallet/version.rb +8 -0
- data/lib/trinsic_service_clients/wallet/wallet_client.rb +2045 -0
- data/trinsic_service_clients-0.0.0.gem +0 -0
- data/trinsic_service_clients.gemspec +13 -0
- metadata +129 -0
@@ -0,0 +1,54 @@
|
|
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 Provider
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Tenant update parameters
|
10
|
+
#
|
11
|
+
class TenantUpdateParameters
|
12
|
+
# @return [String] The tenant name
|
13
|
+
attr_accessor :name
|
14
|
+
|
15
|
+
# @return [String] URL of tenant image
|
16
|
+
attr_accessor :image_url
|
17
|
+
|
18
|
+
|
19
|
+
#
|
20
|
+
# Mapper for TenantUpdateParameters class as Ruby Hash.
|
21
|
+
# This will be used for serialization/deserialization.
|
22
|
+
#
|
23
|
+
def self.mapper()
|
24
|
+
{
|
25
|
+
client_side_validation: true,
|
26
|
+
required: false,
|
27
|
+
serialized_name: 'TenantUpdateParameters',
|
28
|
+
type: {
|
29
|
+
name: 'Composite',
|
30
|
+
class_name: 'TenantUpdateParameters',
|
31
|
+
model_properties: {
|
32
|
+
name: {
|
33
|
+
client_side_validation: true,
|
34
|
+
required: true,
|
35
|
+
serialized_name: 'name',
|
36
|
+
type: {
|
37
|
+
name: 'String'
|
38
|
+
}
|
39
|
+
},
|
40
|
+
image_url: {
|
41
|
+
client_side_validation: true,
|
42
|
+
required: false,
|
43
|
+
serialized_name: 'imageUrl',
|
44
|
+
type: {
|
45
|
+
name: 'String'
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,87 @@
|
|
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 Provider
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Usage Contract
|
10
|
+
#
|
11
|
+
class UsageContract
|
12
|
+
# @return [DateTime] Period start date
|
13
|
+
attr_accessor :period_start
|
14
|
+
|
15
|
+
# @return [DateTime] Period end date
|
16
|
+
attr_accessor :period_end
|
17
|
+
|
18
|
+
# @return [Integer] Total credentials issued for the given period
|
19
|
+
attr_accessor :credential_count
|
20
|
+
|
21
|
+
# @return [Integer] Total verifications processed for the given period
|
22
|
+
attr_accessor :verification_count
|
23
|
+
|
24
|
+
# @return [String] The invoice identifier
|
25
|
+
attr_accessor :invoice_id
|
26
|
+
|
27
|
+
|
28
|
+
#
|
29
|
+
# Mapper for UsageContract class as Ruby Hash.
|
30
|
+
# This will be used for serialization/deserialization.
|
31
|
+
#
|
32
|
+
def self.mapper()
|
33
|
+
{
|
34
|
+
client_side_validation: true,
|
35
|
+
required: false,
|
36
|
+
serialized_name: 'UsageContract',
|
37
|
+
type: {
|
38
|
+
name: 'Composite',
|
39
|
+
class_name: 'UsageContract',
|
40
|
+
model_properties: {
|
41
|
+
period_start: {
|
42
|
+
client_side_validation: true,
|
43
|
+
required: false,
|
44
|
+
serialized_name: 'periodStart',
|
45
|
+
type: {
|
46
|
+
name: 'DateTime'
|
47
|
+
}
|
48
|
+
},
|
49
|
+
period_end: {
|
50
|
+
client_side_validation: true,
|
51
|
+
required: false,
|
52
|
+
serialized_name: 'periodEnd',
|
53
|
+
type: {
|
54
|
+
name: 'DateTime'
|
55
|
+
}
|
56
|
+
},
|
57
|
+
credential_count: {
|
58
|
+
client_side_validation: true,
|
59
|
+
required: false,
|
60
|
+
serialized_name: 'credentialCount',
|
61
|
+
type: {
|
62
|
+
name: 'Number'
|
63
|
+
}
|
64
|
+
},
|
65
|
+
verification_count: {
|
66
|
+
client_side_validation: true,
|
67
|
+
required: false,
|
68
|
+
serialized_name: 'verificationCount',
|
69
|
+
type: {
|
70
|
+
name: 'Number'
|
71
|
+
}
|
72
|
+
},
|
73
|
+
invoice_id: {
|
74
|
+
client_side_validation: true,
|
75
|
+
required: false,
|
76
|
+
serialized_name: 'invoiceId',
|
77
|
+
type: {
|
78
|
+
name: 'String'
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,826 @@
|
|
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 Provider
|
7
|
+
#
|
8
|
+
# A service client - single point of access to the REST API.
|
9
|
+
#
|
10
|
+
class ProviderClient < MsRest::ServiceClient
|
11
|
+
include MsRest::Serialization
|
12
|
+
|
13
|
+
# @return [String] the base URI of the service.
|
14
|
+
attr_accessor :base_url
|
15
|
+
|
16
|
+
# @return Subscription credentials which uniquely identify client
|
17
|
+
# subscription.
|
18
|
+
attr_accessor :credentials
|
19
|
+
|
20
|
+
#
|
21
|
+
# Creates initializes a new instance of the ProviderClient class.
|
22
|
+
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
23
|
+
# @param base_url [String] the base URI of the service.
|
24
|
+
# @param options [Array] filters to be applied to the HTTP requests.
|
25
|
+
#
|
26
|
+
def initialize(credentials = nil, base_url = nil, options = nil)
|
27
|
+
super(credentials, options)
|
28
|
+
@base_url = base_url || 'https://api.trinsic.id/provider/v1'
|
29
|
+
|
30
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
|
31
|
+
@credentials = credentials
|
32
|
+
|
33
|
+
add_telemetry
|
34
|
+
end
|
35
|
+
|
36
|
+
#
|
37
|
+
# Makes a request and returns the body of the response.
|
38
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
39
|
+
# @param path [String] the path, relative to {base_url}.
|
40
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
41
|
+
# @return [Hash{String=>String}] containing the body of the response.
|
42
|
+
# Example:
|
43
|
+
#
|
44
|
+
# request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
|
45
|
+
# path = "/path"
|
46
|
+
# options = {
|
47
|
+
# body: request_content,
|
48
|
+
# query_params: {'api-version' => '2016-02-01'}
|
49
|
+
# }
|
50
|
+
# result = @client.make_request(:put, path, options)
|
51
|
+
#
|
52
|
+
def make_request(method, path, options = {})
|
53
|
+
result = make_request_with_http_info(method, path, options)
|
54
|
+
result.body unless result.nil?
|
55
|
+
end
|
56
|
+
|
57
|
+
#
|
58
|
+
# Makes a request and returns the operation response.
|
59
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
60
|
+
# @param path [String] the path, relative to {base_url}.
|
61
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
62
|
+
# @return [MsRest::HttpOperationResponse] Operation response containing the request, response and status.
|
63
|
+
#
|
64
|
+
def make_request_with_http_info(method, path, options = {})
|
65
|
+
result = make_request_async(method, path, options).value!
|
66
|
+
result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
|
67
|
+
result
|
68
|
+
end
|
69
|
+
|
70
|
+
#
|
71
|
+
# Makes a request asynchronously.
|
72
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
73
|
+
# @param path [String] the path, relative to {base_url}.
|
74
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
75
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
76
|
+
#
|
77
|
+
def make_request_async(method, path, options = {})
|
78
|
+
fail ArgumentError, 'method is nil' if method.nil?
|
79
|
+
fail ArgumentError, 'path is nil' if path.nil?
|
80
|
+
|
81
|
+
request_url = options[:base_url] || @base_url
|
82
|
+
if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
|
83
|
+
@request_headers['Content-Type'] = options[:headers]['Content-Type']
|
84
|
+
end
|
85
|
+
|
86
|
+
request_headers = @request_headers
|
87
|
+
options.merge!({headers: request_headers.merge(options[:headers] || {})})
|
88
|
+
options.merge!({credentials: @credentials}) unless @credentials.nil?
|
89
|
+
|
90
|
+
super(request_url, method, path, options)
|
91
|
+
end
|
92
|
+
|
93
|
+
#
|
94
|
+
# Upload asset
|
95
|
+
#
|
96
|
+
# Upload a new asset to be used as an image for a tenant tile.
|
97
|
+
#
|
98
|
+
# @param uploaded_files Asset files to be uploaded
|
99
|
+
# @param filename [String] Filename to be uploaded
|
100
|
+
# @param content_type [String] Content type of files to be uploaded
|
101
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
102
|
+
# will be added to the HTTP request.
|
103
|
+
#
|
104
|
+
# @return [AssetContract] operation results.
|
105
|
+
#
|
106
|
+
def add_asset(uploaded_files, filename:nil, content_type:nil, custom_headers:nil)
|
107
|
+
response = add_asset_async(uploaded_files, filename:filename, content_type:content_type, custom_headers:custom_headers).value!
|
108
|
+
response.body unless response.nil?
|
109
|
+
end
|
110
|
+
|
111
|
+
#
|
112
|
+
# Upload asset
|
113
|
+
#
|
114
|
+
# Upload a new asset to be used as an image for a tenant tile.
|
115
|
+
#
|
116
|
+
# @param uploaded_files Asset files to be uploaded
|
117
|
+
# @param filename [String] Filename to be uploaded
|
118
|
+
# @param content_type [String] Content type of files to be uploaded
|
119
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
120
|
+
# will be added to the HTTP request.
|
121
|
+
#
|
122
|
+
# @return [MsRest::HttpOperationResponse] HTTP response information.
|
123
|
+
#
|
124
|
+
def add_asset_with_http_info(uploaded_files, filename:nil, content_type:nil, custom_headers:nil)
|
125
|
+
add_asset_async(uploaded_files, filename:filename, content_type:content_type, custom_headers:custom_headers).value!
|
126
|
+
end
|
127
|
+
|
128
|
+
#
|
129
|
+
# Upload asset
|
130
|
+
#
|
131
|
+
# Upload a new asset to be used as an image for a tenant tile.
|
132
|
+
#
|
133
|
+
# @param uploaded_files Asset files to be uploaded
|
134
|
+
# @param filename [String] Filename to be uploaded
|
135
|
+
# @param content_type [String] Content type of files to be uploaded
|
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 add_asset_async(uploaded_files, filename:nil, content_type:nil, custom_headers:nil)
|
142
|
+
fail ArgumentError, 'uploaded_files is nil' if uploaded_files.nil?
|
143
|
+
|
144
|
+
|
145
|
+
request_headers = {}
|
146
|
+
request_headers['Content-Type'] = 'multipart/form-data'
|
147
|
+
|
148
|
+
# Set Form Data
|
149
|
+
form_data = {}
|
150
|
+
form_data['uploadedFiles'] = uploaded_files.to_s unless uploaded_files.to_s.nil?
|
151
|
+
form_data['filename'] = filename unless filename.nil?
|
152
|
+
form_data['contentType'] = content_type unless content_type.nil?
|
153
|
+
|
154
|
+
path_template = 'assets'
|
155
|
+
|
156
|
+
request_url = @base_url || self.base_url
|
157
|
+
|
158
|
+
options = {
|
159
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
160
|
+
headers: request_headers.merge(custom_headers || {}),
|
161
|
+
body: URI.encode_www_form(form_data),
|
162
|
+
base_url: request_url
|
163
|
+
}
|
164
|
+
promise = self.make_request_async(:post, 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
|
+
# Deserialize Response
|
176
|
+
if status_code == 200
|
177
|
+
begin
|
178
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
179
|
+
result_mapper = Provider::Models::AssetContract.mapper()
|
180
|
+
result.body = self.deserialize(result_mapper, parsed_response)
|
181
|
+
rescue Exception => e
|
182
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
result
|
187
|
+
end
|
188
|
+
|
189
|
+
promise.execute
|
190
|
+
end
|
191
|
+
|
192
|
+
#
|
193
|
+
# List all tenants
|
194
|
+
#
|
195
|
+
# List all available tenants for the current authorization context.
|
196
|
+
#
|
197
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
198
|
+
# will be added to the HTTP request.
|
199
|
+
#
|
200
|
+
# @return [Array] operation results.
|
201
|
+
#
|
202
|
+
def list_tenants(custom_headers:nil)
|
203
|
+
response = list_tenants_async(custom_headers:custom_headers).value!
|
204
|
+
response.body unless response.nil?
|
205
|
+
end
|
206
|
+
|
207
|
+
#
|
208
|
+
# List all tenants
|
209
|
+
#
|
210
|
+
# List all available tenants for the current authorization context.
|
211
|
+
#
|
212
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
213
|
+
# will be added to the HTTP request.
|
214
|
+
#
|
215
|
+
# @return [MsRest::HttpOperationResponse] HTTP response information.
|
216
|
+
#
|
217
|
+
def list_tenants_with_http_info(custom_headers:nil)
|
218
|
+
list_tenants_async(custom_headers:custom_headers).value!
|
219
|
+
end
|
220
|
+
|
221
|
+
#
|
222
|
+
# List all tenants
|
223
|
+
#
|
224
|
+
# List all available tenants for the current authorization context.
|
225
|
+
#
|
226
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
227
|
+
# to the HTTP request.
|
228
|
+
#
|
229
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
230
|
+
#
|
231
|
+
def list_tenants_async(custom_headers:nil)
|
232
|
+
|
233
|
+
|
234
|
+
request_headers = {}
|
235
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
236
|
+
path_template = 'tenants'
|
237
|
+
|
238
|
+
request_url = @base_url || self.base_url
|
239
|
+
|
240
|
+
options = {
|
241
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
242
|
+
headers: request_headers.merge(custom_headers || {}),
|
243
|
+
base_url: request_url
|
244
|
+
}
|
245
|
+
promise = self.make_request_async(:get, path_template, options)
|
246
|
+
|
247
|
+
promise = promise.then do |result|
|
248
|
+
http_response = result.response
|
249
|
+
status_code = http_response.status
|
250
|
+
response_content = http_response.body
|
251
|
+
unless status_code == 200
|
252
|
+
error_model = JSON.load(response_content)
|
253
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
254
|
+
end
|
255
|
+
|
256
|
+
# Deserialize Response
|
257
|
+
if status_code == 200
|
258
|
+
begin
|
259
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
260
|
+
result_mapper = {
|
261
|
+
client_side_validation: true,
|
262
|
+
required: false,
|
263
|
+
serialized_name: 'parsed_response',
|
264
|
+
type: {
|
265
|
+
name: 'Sequence',
|
266
|
+
element: {
|
267
|
+
client_side_validation: true,
|
268
|
+
required: false,
|
269
|
+
serialized_name: 'TenantContractElementType',
|
270
|
+
type: {
|
271
|
+
name: 'Composite',
|
272
|
+
class_name: 'TenantContract'
|
273
|
+
}
|
274
|
+
}
|
275
|
+
}
|
276
|
+
}
|
277
|
+
result.body = self.deserialize(result_mapper, parsed_response)
|
278
|
+
rescue Exception => e
|
279
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
result
|
284
|
+
end
|
285
|
+
|
286
|
+
promise.execute
|
287
|
+
end
|
288
|
+
|
289
|
+
#
|
290
|
+
# Create tenant
|
291
|
+
#
|
292
|
+
# Create a tenant and setup a unique agency endpoint.
|
293
|
+
# The agency will be set as an issuer.
|
294
|
+
#
|
295
|
+
# @param body [TenantParameters] Configuration options for creating new tenant
|
296
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
297
|
+
# will be added to the HTTP request.
|
298
|
+
#
|
299
|
+
# @return [TenantContract] operation results.
|
300
|
+
#
|
301
|
+
def create_tenant(body, custom_headers:nil)
|
302
|
+
response = create_tenant_async(body, custom_headers:custom_headers).value!
|
303
|
+
response.body unless response.nil?
|
304
|
+
end
|
305
|
+
|
306
|
+
#
|
307
|
+
# Create tenant
|
308
|
+
#
|
309
|
+
# Create a tenant and setup a unique agency endpoint.
|
310
|
+
# The agency will be set as an issuer.
|
311
|
+
#
|
312
|
+
# @param body [TenantParameters] Configuration options for creating new tenant
|
313
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
314
|
+
# will be added to the HTTP request.
|
315
|
+
#
|
316
|
+
# @return [MsRest::HttpOperationResponse] HTTP response information.
|
317
|
+
#
|
318
|
+
def create_tenant_with_http_info(body, custom_headers:nil)
|
319
|
+
create_tenant_async(body, custom_headers:custom_headers).value!
|
320
|
+
end
|
321
|
+
|
322
|
+
#
|
323
|
+
# Create tenant
|
324
|
+
#
|
325
|
+
# Create a tenant and setup a unique agency endpoint.
|
326
|
+
# The agency will be set as an issuer.
|
327
|
+
#
|
328
|
+
# @param body [TenantParameters] Configuration options for creating new tenant
|
329
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
330
|
+
# to the HTTP request.
|
331
|
+
#
|
332
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
333
|
+
#
|
334
|
+
def create_tenant_async(body, custom_headers:nil)
|
335
|
+
fail ArgumentError, 'body is nil' if body.nil?
|
336
|
+
|
337
|
+
|
338
|
+
request_headers = {}
|
339
|
+
request_headers['Content-Type'] = 'application/json;odata.metadata=minimal;odata.streaming=true; charset=utf-8'
|
340
|
+
|
341
|
+
# Serialize Request
|
342
|
+
request_mapper = Provider::Models::TenantParameters.mapper()
|
343
|
+
request_content = self.serialize(request_mapper, body)
|
344
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
345
|
+
|
346
|
+
path_template = 'tenants'
|
347
|
+
|
348
|
+
request_url = @base_url || self.base_url
|
349
|
+
|
350
|
+
options = {
|
351
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
352
|
+
body: request_content,
|
353
|
+
headers: request_headers.merge(custom_headers || {}),
|
354
|
+
base_url: request_url
|
355
|
+
}
|
356
|
+
promise = self.make_request_async(:post, path_template, options)
|
357
|
+
|
358
|
+
promise = promise.then do |result|
|
359
|
+
http_response = result.response
|
360
|
+
status_code = http_response.status
|
361
|
+
response_content = http_response.body
|
362
|
+
unless status_code == 200
|
363
|
+
error_model = JSON.load(response_content)
|
364
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
365
|
+
end
|
366
|
+
|
367
|
+
# Deserialize Response
|
368
|
+
if status_code == 200
|
369
|
+
begin
|
370
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
371
|
+
result_mapper = Provider::Models::TenantContract.mapper()
|
372
|
+
result.body = self.deserialize(result_mapper, parsed_response)
|
373
|
+
rescue Exception => e
|
374
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
378
|
+
result
|
379
|
+
end
|
380
|
+
|
381
|
+
promise.execute
|
382
|
+
end
|
383
|
+
|
384
|
+
#
|
385
|
+
# Get tenant
|
386
|
+
#
|
387
|
+
# Get the specified tenant.
|
388
|
+
#
|
389
|
+
# @param tenant_id [String] The tenant identifier
|
390
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
391
|
+
# will be added to the HTTP request.
|
392
|
+
#
|
393
|
+
# @return [TenantContract] operation results.
|
394
|
+
#
|
395
|
+
def get_tenant(tenant_id, custom_headers:nil)
|
396
|
+
response = get_tenant_async(tenant_id, custom_headers:custom_headers).value!
|
397
|
+
response.body unless response.nil?
|
398
|
+
end
|
399
|
+
|
400
|
+
#
|
401
|
+
# Get tenant
|
402
|
+
#
|
403
|
+
# Get the specified tenant.
|
404
|
+
#
|
405
|
+
# @param tenant_id [String] The tenant identifier
|
406
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
407
|
+
# will be added to the HTTP request.
|
408
|
+
#
|
409
|
+
# @return [MsRest::HttpOperationResponse] HTTP response information.
|
410
|
+
#
|
411
|
+
def get_tenant_with_http_info(tenant_id, custom_headers:nil)
|
412
|
+
get_tenant_async(tenant_id, custom_headers:custom_headers).value!
|
413
|
+
end
|
414
|
+
|
415
|
+
#
|
416
|
+
# Get tenant
|
417
|
+
#
|
418
|
+
# Get the specified tenant.
|
419
|
+
#
|
420
|
+
# @param tenant_id [String] The tenant identifier
|
421
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
422
|
+
# to the HTTP request.
|
423
|
+
#
|
424
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
425
|
+
#
|
426
|
+
def get_tenant_async(tenant_id, custom_headers:nil)
|
427
|
+
fail ArgumentError, 'tenant_id is nil' if tenant_id.nil?
|
428
|
+
|
429
|
+
|
430
|
+
request_headers = {}
|
431
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
432
|
+
path_template = 'tenants/{tenantId}'
|
433
|
+
|
434
|
+
request_url = @base_url || self.base_url
|
435
|
+
|
436
|
+
options = {
|
437
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
438
|
+
path_params: {'tenantId' => tenant_id},
|
439
|
+
headers: request_headers.merge(custom_headers || {}),
|
440
|
+
base_url: request_url
|
441
|
+
}
|
442
|
+
promise = self.make_request_async(:get, path_template, options)
|
443
|
+
|
444
|
+
promise = promise.then do |result|
|
445
|
+
http_response = result.response
|
446
|
+
status_code = http_response.status
|
447
|
+
response_content = http_response.body
|
448
|
+
unless status_code == 200
|
449
|
+
error_model = JSON.load(response_content)
|
450
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
451
|
+
end
|
452
|
+
|
453
|
+
# Deserialize Response
|
454
|
+
if status_code == 200
|
455
|
+
begin
|
456
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
457
|
+
result_mapper = Provider::Models::TenantContract.mapper()
|
458
|
+
result.body = self.deserialize(result_mapper, parsed_response)
|
459
|
+
rescue Exception => e
|
460
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
461
|
+
end
|
462
|
+
end
|
463
|
+
|
464
|
+
result
|
465
|
+
end
|
466
|
+
|
467
|
+
promise.execute
|
468
|
+
end
|
469
|
+
|
470
|
+
#
|
471
|
+
# Update tenant
|
472
|
+
#
|
473
|
+
# Update the specified tenant with the specified new configuration.
|
474
|
+
#
|
475
|
+
# @param tenant_id [String] The tenant identifier
|
476
|
+
# @param body [TenantUpdateParameters] The tenant parameters
|
477
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
478
|
+
# will be added to the HTTP request.
|
479
|
+
#
|
480
|
+
#
|
481
|
+
def update_tenant(tenant_id, body, custom_headers:nil)
|
482
|
+
response = update_tenant_async(tenant_id, body, custom_headers:custom_headers).value!
|
483
|
+
nil
|
484
|
+
end
|
485
|
+
|
486
|
+
#
|
487
|
+
# Update tenant
|
488
|
+
#
|
489
|
+
# Update the specified tenant with the specified new configuration.
|
490
|
+
#
|
491
|
+
# @param tenant_id [String] The tenant identifier
|
492
|
+
# @param body [TenantUpdateParameters] The tenant parameters
|
493
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
494
|
+
# will be added to the HTTP request.
|
495
|
+
#
|
496
|
+
# @return [MsRest::HttpOperationResponse] HTTP response information.
|
497
|
+
#
|
498
|
+
def update_tenant_with_http_info(tenant_id, body, custom_headers:nil)
|
499
|
+
update_tenant_async(tenant_id, body, custom_headers:custom_headers).value!
|
500
|
+
end
|
501
|
+
|
502
|
+
#
|
503
|
+
# Update tenant
|
504
|
+
#
|
505
|
+
# Update the specified tenant with the specified new configuration.
|
506
|
+
#
|
507
|
+
# @param tenant_id [String] The tenant identifier
|
508
|
+
# @param body [TenantUpdateParameters] The tenant parameters
|
509
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
510
|
+
# to the HTTP request.
|
511
|
+
#
|
512
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
513
|
+
#
|
514
|
+
def update_tenant_async(tenant_id, body, custom_headers:nil)
|
515
|
+
fail ArgumentError, 'tenant_id is nil' if tenant_id.nil?
|
516
|
+
fail ArgumentError, 'body is nil' if body.nil?
|
517
|
+
|
518
|
+
|
519
|
+
request_headers = {}
|
520
|
+
request_headers['Content-Type'] = 'application/json;odata.metadata=minimal;odata.streaming=true; charset=utf-8'
|
521
|
+
|
522
|
+
# Serialize Request
|
523
|
+
request_mapper = Provider::Models::TenantUpdateParameters.mapper()
|
524
|
+
request_content = self.serialize(request_mapper, body)
|
525
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
526
|
+
|
527
|
+
path_template = 'tenants/{tenantId}'
|
528
|
+
|
529
|
+
request_url = @base_url || self.base_url
|
530
|
+
|
531
|
+
options = {
|
532
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
533
|
+
path_params: {'tenantId' => tenant_id},
|
534
|
+
body: request_content,
|
535
|
+
headers: request_headers.merge(custom_headers || {}),
|
536
|
+
base_url: request_url
|
537
|
+
}
|
538
|
+
promise = self.make_request_async(:put, path_template, options)
|
539
|
+
|
540
|
+
promise = promise.then do |result|
|
541
|
+
http_response = result.response
|
542
|
+
status_code = http_response.status
|
543
|
+
response_content = http_response.body
|
544
|
+
unless status_code == 200
|
545
|
+
error_model = JSON.load(response_content)
|
546
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
547
|
+
end
|
548
|
+
|
549
|
+
|
550
|
+
result
|
551
|
+
end
|
552
|
+
|
553
|
+
promise.execute
|
554
|
+
end
|
555
|
+
|
556
|
+
#
|
557
|
+
# Delete tenant
|
558
|
+
#
|
559
|
+
# Permanently delete a tenant, including their wallet, endpoint registrations
|
560
|
+
# and all data.
|
561
|
+
# All definitions, connections and credentials issued will be deleted.
|
562
|
+
# This action cannot be reverted.
|
563
|
+
#
|
564
|
+
# @param tenant_id [String]
|
565
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
566
|
+
# will be added to the HTTP request.
|
567
|
+
#
|
568
|
+
#
|
569
|
+
def delete_tenant(tenant_id, custom_headers:nil)
|
570
|
+
response = delete_tenant_async(tenant_id, custom_headers:custom_headers).value!
|
571
|
+
nil
|
572
|
+
end
|
573
|
+
|
574
|
+
#
|
575
|
+
# Delete tenant
|
576
|
+
#
|
577
|
+
# Permanently delete a tenant, including their wallet, endpoint registrations
|
578
|
+
# and all data.
|
579
|
+
# All definitions, connections and credentials issued will be deleted.
|
580
|
+
# This action cannot be reverted.
|
581
|
+
#
|
582
|
+
# @param tenant_id [String]
|
583
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
584
|
+
# will be added to the HTTP request.
|
585
|
+
#
|
586
|
+
# @return [MsRest::HttpOperationResponse] HTTP response information.
|
587
|
+
#
|
588
|
+
def delete_tenant_with_http_info(tenant_id, custom_headers:nil)
|
589
|
+
delete_tenant_async(tenant_id, custom_headers:custom_headers).value!
|
590
|
+
end
|
591
|
+
|
592
|
+
#
|
593
|
+
# Delete tenant
|
594
|
+
#
|
595
|
+
# Permanently delete a tenant, including their wallet, endpoint registrations
|
596
|
+
# and all data.
|
597
|
+
# All definitions, connections and credentials issued will be deleted.
|
598
|
+
# This action cannot be reverted.
|
599
|
+
#
|
600
|
+
# @param tenant_id [String]
|
601
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
602
|
+
# to the HTTP request.
|
603
|
+
#
|
604
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
605
|
+
#
|
606
|
+
def delete_tenant_async(tenant_id, custom_headers:nil)
|
607
|
+
fail ArgumentError, 'tenant_id is nil' if tenant_id.nil?
|
608
|
+
|
609
|
+
|
610
|
+
request_headers = {}
|
611
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
612
|
+
path_template = 'tenants/{tenantId}'
|
613
|
+
|
614
|
+
request_url = @base_url || self.base_url
|
615
|
+
|
616
|
+
options = {
|
617
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
618
|
+
path_params: {'tenantId' => tenant_id},
|
619
|
+
headers: request_headers.merge(custom_headers || {}),
|
620
|
+
base_url: request_url
|
621
|
+
}
|
622
|
+
promise = self.make_request_async(:delete, path_template, options)
|
623
|
+
|
624
|
+
promise = promise.then do |result|
|
625
|
+
http_response = result.response
|
626
|
+
status_code = http_response.status
|
627
|
+
response_content = http_response.body
|
628
|
+
unless status_code == 200
|
629
|
+
error_model = JSON.load(response_content)
|
630
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
631
|
+
end
|
632
|
+
|
633
|
+
|
634
|
+
result
|
635
|
+
end
|
636
|
+
|
637
|
+
promise.execute
|
638
|
+
end
|
639
|
+
|
640
|
+
#
|
641
|
+
# Get tenant keys
|
642
|
+
#
|
643
|
+
# Get the authorization keys for a tenant in the current authorization context.
|
644
|
+
#
|
645
|
+
# @param tenant_id [String] The tenant identifier
|
646
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
647
|
+
# will be added to the HTTP request.
|
648
|
+
#
|
649
|
+
# @return [TenantKeysContract] operation results.
|
650
|
+
#
|
651
|
+
def get_tenant_keys(tenant_id, custom_headers:nil)
|
652
|
+
response = get_tenant_keys_async(tenant_id, custom_headers:custom_headers).value!
|
653
|
+
response.body unless response.nil?
|
654
|
+
end
|
655
|
+
|
656
|
+
#
|
657
|
+
# Get tenant keys
|
658
|
+
#
|
659
|
+
# Get the authorization keys for a tenant in the current authorization context.
|
660
|
+
#
|
661
|
+
# @param tenant_id [String] The tenant identifier
|
662
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
663
|
+
# will be added to the HTTP request.
|
664
|
+
#
|
665
|
+
# @return [MsRest::HttpOperationResponse] HTTP response information.
|
666
|
+
#
|
667
|
+
def get_tenant_keys_with_http_info(tenant_id, custom_headers:nil)
|
668
|
+
get_tenant_keys_async(tenant_id, custom_headers:custom_headers).value!
|
669
|
+
end
|
670
|
+
|
671
|
+
#
|
672
|
+
# Get tenant keys
|
673
|
+
#
|
674
|
+
# Get the authorization keys for a tenant in the current authorization context.
|
675
|
+
#
|
676
|
+
# @param tenant_id [String] The tenant identifier
|
677
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
678
|
+
# to the HTTP request.
|
679
|
+
#
|
680
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
681
|
+
#
|
682
|
+
def get_tenant_keys_async(tenant_id, custom_headers:nil)
|
683
|
+
fail ArgumentError, 'tenant_id is nil' if tenant_id.nil?
|
684
|
+
|
685
|
+
|
686
|
+
request_headers = {}
|
687
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
688
|
+
path_template = 'tenants/{tenantId}/keys'
|
689
|
+
|
690
|
+
request_url = @base_url || self.base_url
|
691
|
+
|
692
|
+
options = {
|
693
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
694
|
+
path_params: {'tenantId' => tenant_id},
|
695
|
+
headers: request_headers.merge(custom_headers || {}),
|
696
|
+
base_url: request_url
|
697
|
+
}
|
698
|
+
promise = self.make_request_async(:get, path_template, options)
|
699
|
+
|
700
|
+
promise = promise.then do |result|
|
701
|
+
http_response = result.response
|
702
|
+
status_code = http_response.status
|
703
|
+
response_content = http_response.body
|
704
|
+
unless status_code == 200
|
705
|
+
error_model = JSON.load(response_content)
|
706
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
707
|
+
end
|
708
|
+
|
709
|
+
# Deserialize Response
|
710
|
+
if status_code == 200
|
711
|
+
begin
|
712
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
713
|
+
result_mapper = Provider::Models::TenantKeysContract.mapper()
|
714
|
+
result.body = self.deserialize(result_mapper, parsed_response)
|
715
|
+
rescue Exception => e
|
716
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
717
|
+
end
|
718
|
+
end
|
719
|
+
|
720
|
+
result
|
721
|
+
end
|
722
|
+
|
723
|
+
promise.execute
|
724
|
+
end
|
725
|
+
|
726
|
+
#
|
727
|
+
# Update tenant keys
|
728
|
+
#
|
729
|
+
# Update the authorization keys for a tenant in the current authorization
|
730
|
+
# context.
|
731
|
+
#
|
732
|
+
# @param tenant_id [String] The tenant identifier
|
733
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
734
|
+
# will be added to the HTTP request.
|
735
|
+
#
|
736
|
+
# @return [TenantKeysContract] operation results.
|
737
|
+
#
|
738
|
+
def change_tenant_keys(tenant_id, custom_headers:nil)
|
739
|
+
response = change_tenant_keys_async(tenant_id, custom_headers:custom_headers).value!
|
740
|
+
response.body unless response.nil?
|
741
|
+
end
|
742
|
+
|
743
|
+
#
|
744
|
+
# Update tenant keys
|
745
|
+
#
|
746
|
+
# Update the authorization keys for a tenant in the current authorization
|
747
|
+
# context.
|
748
|
+
#
|
749
|
+
# @param tenant_id [String] The tenant identifier
|
750
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
751
|
+
# will be added to the HTTP request.
|
752
|
+
#
|
753
|
+
# @return [MsRest::HttpOperationResponse] HTTP response information.
|
754
|
+
#
|
755
|
+
def change_tenant_keys_with_http_info(tenant_id, custom_headers:nil)
|
756
|
+
change_tenant_keys_async(tenant_id, custom_headers:custom_headers).value!
|
757
|
+
end
|
758
|
+
|
759
|
+
#
|
760
|
+
# Update tenant keys
|
761
|
+
#
|
762
|
+
# Update the authorization keys for a tenant in the current authorization
|
763
|
+
# context.
|
764
|
+
#
|
765
|
+
# @param tenant_id [String] The tenant identifier
|
766
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
767
|
+
# to the HTTP request.
|
768
|
+
#
|
769
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
770
|
+
#
|
771
|
+
def change_tenant_keys_async(tenant_id, custom_headers:nil)
|
772
|
+
fail ArgumentError, 'tenant_id is nil' if tenant_id.nil?
|
773
|
+
|
774
|
+
|
775
|
+
request_headers = {}
|
776
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
777
|
+
path_template = 'tenants/{tenantId}/keys'
|
778
|
+
|
779
|
+
request_url = @base_url || self.base_url
|
780
|
+
|
781
|
+
options = {
|
782
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
783
|
+
path_params: {'tenantId' => tenant_id},
|
784
|
+
headers: request_headers.merge(custom_headers || {}),
|
785
|
+
base_url: request_url
|
786
|
+
}
|
787
|
+
promise = self.make_request_async(:patch, path_template, options)
|
788
|
+
|
789
|
+
promise = promise.then do |result|
|
790
|
+
http_response = result.response
|
791
|
+
status_code = http_response.status
|
792
|
+
response_content = http_response.body
|
793
|
+
unless status_code == 200
|
794
|
+
error_model = JSON.load(response_content)
|
795
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
796
|
+
end
|
797
|
+
|
798
|
+
# Deserialize Response
|
799
|
+
if status_code == 200
|
800
|
+
begin
|
801
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
802
|
+
result_mapper = Provider::Models::TenantKeysContract.mapper()
|
803
|
+
result.body = self.deserialize(result_mapper, parsed_response)
|
804
|
+
rescue Exception => e
|
805
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
806
|
+
end
|
807
|
+
end
|
808
|
+
|
809
|
+
result
|
810
|
+
end
|
811
|
+
|
812
|
+
promise.execute
|
813
|
+
end
|
814
|
+
|
815
|
+
|
816
|
+
private
|
817
|
+
#
|
818
|
+
# Adds telemetry information.
|
819
|
+
#
|
820
|
+
def add_telemetry
|
821
|
+
sdk_information = 'provider'
|
822
|
+
sdk_information = "#{sdk_information}/1.1.4000"
|
823
|
+
add_user_agent_information(sdk_information)
|
824
|
+
end
|
825
|
+
end
|
826
|
+
end
|