class Provider::ProviderClient
A service client - single point of access to the REST API.
Attributes
@return [String] the base URI of the service.
@return Subscription credentials which uniquely identify client subscription.
Public Class Methods
Creates initializes a new instance of the ProviderClient
class. @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. @param base_url
[String] the base URI of the service. @param options [Array] filters to be applied to the HTTP requests.
# File lib/generated/provider/provider_client.rb, line 26 def initialize(credentials = nil, base_url = nil, options = nil) super(credentials, options) @base_url = base_url || 'https://api.trinsic.id/provider/v1' fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil? @credentials = credentials add_telemetry end
Public Instance Methods
Upload asset
Upload a new asset to be used as an image for a tenant tile.
@param uploaded_files Asset files to be uploaded @param filename [String] Filename to be uploaded @param content_type [String] Content type of files to be uploaded @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [AssetContract] operation results.
# File lib/generated/provider/provider_client.rb, line 347 def add_asset(uploaded_files, filename:nil, content_type:nil, custom_headers:nil) response = add_asset_async(uploaded_files, filename:filename, content_type:content_type, custom_headers:custom_headers).value! response.body unless response.nil? end
Upload asset
Upload a new asset to be used as an image for a tenant tile.
@param uploaded_files Asset files to be uploaded @param filename [String] Filename to be uploaded @param content_type [String] Content type of files to be uploaded @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/generated/provider/provider_client.rb, line 382 def add_asset_async(uploaded_files, filename:nil, content_type:nil, custom_headers:nil) fail ArgumentError, 'uploaded_files is nil' if uploaded_files.nil? request_headers = {} request_headers['Content-Type'] = 'multipart/form-data' # Set Form Data form_data = {} form_data['uploadedFiles'] = uploaded_files.to_s unless uploaded_files.to_s.nil? form_data['filename'] = filename unless filename.nil? form_data['contentType'] = content_type unless content_type.nil? path_template = 'assets' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], headers: request_headers.merge(custom_headers || {}), body: URI.encode_www_form(form_data), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Provider::Models::AssetContract.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Upload asset
Upload a new asset to be used as an image for a tenant tile.
@param uploaded_files Asset files to be uploaded @param filename [String] Filename to be uploaded @param content_type [String] Content type of files to be uploaded @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRest::HttpOperationResponse] HTTP response information.
# File lib/generated/provider/provider_client.rb, line 365 def add_asset_with_http_info(uploaded_files, filename:nil, content_type:nil, custom_headers:nil) add_asset_async(uploaded_files, filename:filename, content_type:content_type, custom_headers:custom_headers).value! end
Update tenant keys
Update the authorization keys for a tenant in the current authorization context.
@param tenant_id [String] The tenant identifier @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [TenantKeysContract] operation results.
# File lib/generated/provider/provider_client.rb, line 1169 def change_tenant_keys(tenant_id, custom_headers:nil) response = change_tenant_keys_async(tenant_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Update tenant keys
Update the authorization keys for a tenant in the current authorization context.
@param tenant_id [String] The tenant identifier @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/generated/provider/provider_client.rb, line 1202 def change_tenant_keys_async(tenant_id, custom_headers:nil) fail ArgumentError, 'tenant_id is nil' if tenant_id.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'tenants/{tenantId}/keys' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'tenantId' => tenant_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:patch, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Provider::Models::TenantKeysContract.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Update tenant keys
Update the authorization keys for a tenant in the current authorization context.
@param tenant_id [String] The tenant identifier @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRest::HttpOperationResponse] HTTP response information.
# File lib/generated/provider/provider_client.rb, line 1186 def change_tenant_keys_with_http_info(tenant_id, custom_headers:nil) change_tenant_keys_async(tenant_id, custom_headers:custom_headers).value! end
Create tenant
Create a tenant and setup a unique agency endpoint. The agency will be set as an issuer.
@param body [TenantParameters] Configuration options for creating new tenant @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [TenantContract] operation results.
# File lib/generated/provider/provider_client.rb, line 732 def create_tenant(body, custom_headers:nil) response = create_tenant_async(body, custom_headers:custom_headers).value! response.body unless response.nil? end
Create tenant
Create a tenant and setup a unique agency endpoint. The agency will be set as an issuer.
@param body [TenantParameters] Configuration options for creating new tenant @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/generated/provider/provider_client.rb, line 765 def create_tenant_async(body, custom_headers:nil) fail ArgumentError, 'body is nil' if body.nil? request_headers = {} request_headers['Content-Type'] = 'application/json;odata.metadata=minimal;odata.streaming=true; charset=utf-8' # Serialize Request request_mapper = Provider::Models::TenantParameters.mapper() request_content = self.serialize(request_mapper, body) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'tenants' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Provider::Models::TenantContract.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Create tenant
Create a tenant and setup a unique agency endpoint. The agency will be set as an issuer.
@param body [TenantParameters] Configuration options for creating new tenant @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRest::HttpOperationResponse] HTTP response information.
# File lib/generated/provider/provider_client.rb, line 749 def create_tenant_with_http_info(body, custom_headers:nil) create_tenant_async(body, custom_headers:custom_headers).value! end
Delete tenant
Permanently delete a tenant, including their wallet, endpoint registrations and all data. All definitions, connections and credentials issued will be deleted. This action cannot be reverted.
@param tenant_id [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/generated/provider/provider_client.rb, line 1000 def delete_tenant(tenant_id, custom_headers:nil) response = delete_tenant_async(tenant_id, custom_headers:custom_headers).value! nil end
Delete tenant
Permanently delete a tenant, including their wallet, endpoint registrations and all data. All definitions, connections and credentials issued will be deleted. This action cannot be reverted.
@param tenant_id [String] @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/generated/provider/provider_client.rb, line 1037 def delete_tenant_async(tenant_id, custom_headers:nil) fail ArgumentError, 'tenant_id is nil' if tenant_id.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'tenants/{tenantId}' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'tenantId' => tenant_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:delete, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result end promise.execute end
Delete tenant
Permanently delete a tenant, including their wallet, endpoint registrations and all data. All definitions, connections and credentials issued will be deleted. This action cannot be reverted.
@param tenant_id [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRest::HttpOperationResponse] HTTP response information.
# File lib/generated/provider/provider_client.rb, line 1019 def delete_tenant_with_http_info(tenant_id, custom_headers:nil) delete_tenant_async(tenant_id, custom_headers:custom_headers).value! end
Get a count of total cloud wallets created on this account
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [CloudWalletAnalyticsContract] operation results.
# File lib/generated/provider/provider_client.rb, line 101 def get_cloud_wallet_count(custom_headers:nil) response = get_cloud_wallet_count_async(custom_headers:custom_headers).value! response.body unless response.nil? end
Get a count of total cloud wallets created on this account
@param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/generated/provider/provider_client.rb, line 126 def get_cloud_wallet_count_async(custom_headers:nil) request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'analytics/cloudWallets' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Provider::Models::CloudWalletAnalyticsContract.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get a count of total cloud wallets created on this account
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRest::HttpOperationResponse] HTTP response information.
# File lib/generated/provider/provider_client.rb, line 114 def get_cloud_wallet_count_with_http_info(custom_headers:nil) get_cloud_wallet_count_async(custom_headers:custom_headers).value! end
Get the usage for the currently active period
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [UsageContract] operation results.
# File lib/generated/provider/provider_client.rb, line 176 def get_current_usage(custom_headers:nil) response = get_current_usage_async(custom_headers:custom_headers).value! response.body unless response.nil? end
Get the usage for the currently active period
@param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/generated/provider/provider_client.rb, line 201 def get_current_usage_async(custom_headers:nil) request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'analytics/usage/current' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Provider::Models::UsageContract.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get the usage for the currently active period
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRest::HttpOperationResponse] HTTP response information.
# File lib/generated/provider/provider_client.rb, line 189 def get_current_usage_with_http_info(custom_headers:nil) get_current_usage_async(custom_headers:custom_headers).value! end
Get available regions
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Hash] operation results.
# File lib/generated/provider/provider_client.rb, line 541 def get_regions(custom_headers:nil) response = get_regions_async(custom_headers:custom_headers).value! response.body unless response.nil? end
Get available regions
@param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/generated/provider/provider_client.rb, line 566 def get_regions_async(custom_headers:nil) request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'regions' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Dictionary', value: { client_side_validation: true, required: false, serialized_name: 'StringElementType', type: { name: 'String' } } } } result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get available regions
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRest::HttpOperationResponse] HTTP response information.
# File lib/generated/provider/provider_client.rb, line 554 def get_regions_with_http_info(custom_headers:nil) get_regions_async(custom_headers:custom_headers).value! end
Get tenant
Get the specified tenant.
@param tenant_id [String] The tenant identifier @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [TenantContract] operation results.
# File lib/generated/provider/provider_client.rb, line 826 def get_tenant(tenant_id, custom_headers:nil) response = get_tenant_async(tenant_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Get tenant
Get the specified tenant.
@param tenant_id [String] The tenant identifier @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/generated/provider/provider_client.rb, line 857 def get_tenant_async(tenant_id, custom_headers:nil) fail ArgumentError, 'tenant_id is nil' if tenant_id.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'tenants/{tenantId}' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'tenantId' => tenant_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Provider::Models::TenantContract.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get tenant keys
Get the authorization keys for a tenant in the current authorization context.
@param tenant_id [String] The tenant identifier @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [TenantKeysContract] operation results.
# File lib/generated/provider/provider_client.rb, line 1082 def get_tenant_keys(tenant_id, custom_headers:nil) response = get_tenant_keys_async(tenant_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Get tenant keys
Get the authorization keys for a tenant in the current authorization context.
@param tenant_id [String] The tenant identifier @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/generated/provider/provider_client.rb, line 1113 def get_tenant_keys_async(tenant_id, custom_headers:nil) fail ArgumentError, 'tenant_id is nil' if tenant_id.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'tenants/{tenantId}/keys' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'tenantId' => tenant_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Provider::Models::TenantKeysContract.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get tenant keys
Get the authorization keys for a tenant in the current authorization context.
@param tenant_id [String] The tenant identifier @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRest::HttpOperationResponse] HTTP response information.
# File lib/generated/provider/provider_client.rb, line 1098 def get_tenant_keys_with_http_info(tenant_id, custom_headers:nil) get_tenant_keys_async(tenant_id, custom_headers:custom_headers).value! end
Get tenant
Get the specified tenant.
@param tenant_id [String] The tenant identifier @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRest::HttpOperationResponse] HTTP response information.
# File lib/generated/provider/provider_client.rb, line 842 def get_tenant_with_http_info(tenant_id, custom_headers:nil) get_tenant_async(tenant_id, custom_headers:custom_headers).value! end
Health check
Check the health of the API.
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/generated/provider/provider_client.rb, line 1255 def health(custom_headers:nil) response = health_async(custom_headers:custom_headers).value! nil end
Health check
Check the health of the API.
@param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/generated/provider/provider_client.rb, line 1284 def health_async(custom_headers:nil) request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'health' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result end promise.execute end
Health check
Check the health of the API.
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRest::HttpOperationResponse] HTTP response information.
# File lib/generated/provider/provider_client.rb, line 1270 def health_with_http_info(custom_headers:nil) health_async(custom_headers:custom_headers).value! end
List all ledger networks
List all available ledger networks. Some networks are not available based on your subscription.
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array] operation results.
# File lib/generated/provider/provider_client.rb, line 444 def list_networks(custom_headers:nil) response = list_networks_async(custom_headers:custom_headers).value! response.body unless response.nil? end
List all ledger networks
List all available ledger networks. Some networks are not available based on your subscription.
@param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/generated/provider/provider_client.rb, line 475 def list_networks_async(custom_headers:nil) request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'networks' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'NetworkContractElementType', type: { name: 'Composite', class_name: 'NetworkContract' } } } } result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List all ledger networks
List all available ledger networks. Some networks are not available based on your subscription.
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRest::HttpOperationResponse] HTTP response information.
# File lib/generated/provider/provider_client.rb, line 460 def list_networks_with_http_info(custom_headers:nil) list_networks_async(custom_headers:custom_headers).value! end
List all tenants
List all available tenants for the current authorization context.
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array] operation results.
# File lib/generated/provider/provider_client.rb, line 633 def list_tenants(custom_headers:nil) response = list_tenants_async(custom_headers:custom_headers).value! response.body unless response.nil? end
List all tenants
List all available tenants for the current authorization context.
@param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/generated/provider/provider_client.rb, line 662 def list_tenants_async(custom_headers:nil) request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'tenants' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'TenantContractElementType', type: { name: 'Composite', class_name: 'TenantContract' } } } } result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List all tenants
List all available tenants for the current authorization context.
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRest::HttpOperationResponse] HTTP response information.
# File lib/generated/provider/provider_client.rb, line 648 def list_tenants_with_http_info(custom_headers:nil) list_tenants_async(custom_headers:custom_headers).value! end
Makes a request and returns the body of the response. @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. @param path [String] the path, relative to {base_url}. @param options [Hash{String=>String}] specifying any request options like :body. @return [Hash{String=>String}] containing the body of the response. Example:
request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}" path = "/path" options = { body: request_content, query_params: {'api-version' => '2016-02-01'} } result = @client.make_request(:put, path, options)
# File lib/generated/provider/provider_client.rb, line 52 def make_request(method, path, options = {}) result = make_request_with_http_info(method, path, options) result.body unless result.nil? end
Makes a request asynchronously. @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. @param path [String] the path, relative to {base_url}. @param options [Hash{String=>String}] specifying any request options like :body. @return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/generated/provider/provider_client.rb, line 77 def make_request_async(method, path, options = {}) fail ArgumentError, 'method is nil' if method.nil? fail ArgumentError, 'path is nil' if path.nil? request_url = options[:base_url] || @base_url if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?) @request_headers['Content-Type'] = options[:headers]['Content-Type'] end request_headers = @request_headers options.merge!({headers: request_headers.merge(options[:headers] || {})}) options.merge!({credentials: @credentials}) unless @credentials.nil? super(request_url, method, path, options) end
Makes a request and returns the operation response. @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. @param path [String] the path, relative to {base_url}. @param options [Hash{String=>String}] specifying any request options like :body. @return [MsRest::HttpOperationResponse] Operation response containing the request, response and status.
# File lib/generated/provider/provider_client.rb, line 64 def make_request_with_http_info(method, path, options = {}) result = make_request_async(method, path, options).value! result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body) result end
Experimental endpoint using OData
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array] operation results.
# File lib/generated/provider/provider_client.rb, line 251 def search_usage(custom_headers:nil) response = search_usage_async(custom_headers:custom_headers).value! response.body unless response.nil? end
Experimental endpoint using OData
@param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/generated/provider/provider_client.rb, line 276 def search_usage_async(custom_headers:nil) request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' path_template = 'analytics/usage' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'UsageContractElementType', type: { name: 'Composite', class_name: 'UsageContract' } } } } result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Experimental endpoint using OData
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRest::HttpOperationResponse] HTTP response information.
# File lib/generated/provider/provider_client.rb, line 264 def search_usage_with_http_info(custom_headers:nil) search_usage_async(custom_headers:custom_headers).value! end
Update tenant
Update the specified tenant with the specified new configuration.
@param tenant_id [String] The tenant identifier @param body [TenantUpdateParameters] The tenant parameters @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/generated/provider/provider_client.rb, line 912 def update_tenant(tenant_id, body, custom_headers:nil) response = update_tenant_async(tenant_id, body, custom_headers:custom_headers).value! nil end
Update tenant
Update the specified tenant with the specified new configuration.
@param tenant_id [String] The tenant identifier @param body [TenantUpdateParameters] The tenant parameters @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/generated/provider/provider_client.rb, line 945 def update_tenant_async(tenant_id, body, custom_headers:nil) fail ArgumentError, 'tenant_id is nil' if tenant_id.nil? fail ArgumentError, 'body is nil' if body.nil? request_headers = {} request_headers['Content-Type'] = 'application/json;odata.metadata=minimal;odata.streaming=true; charset=utf-8' # Serialize Request request_mapper = Provider::Models::TenantUpdateParameters.mapper() request_content = self.serialize(request_mapper, body) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'tenants/{tenantId}' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'tenantId' => tenant_id}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:put, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result end promise.execute end
Update tenant
Update the specified tenant with the specified new configuration.
@param tenant_id [String] The tenant identifier @param body [TenantUpdateParameters] The tenant parameters @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRest::HttpOperationResponse] HTTP response information.
# File lib/generated/provider/provider_client.rb, line 929 def update_tenant_with_http_info(tenant_id, body, custom_headers:nil) update_tenant_async(tenant_id, body, custom_headers:custom_headers).value! end
Private Instance Methods
Adds telemetry information.
# File lib/generated/provider/provider_client.rb, line 1321 def add_telemetry sdk_information = 'provider' sdk_information = "#{sdk_information}/1.1.5018" add_user_agent_information(sdk_information) end