=begin #ORY Oathkeeper #ORY Oathkeeper is a reverse proxy that checks the HTTP Authorization for validity against a set of rules. This service uses Hydra to validate access tokens and policies. The version of the OpenAPI document: v0.0.0-alpha.51 Contact: hi@ory.am Generated by: https://openapi-generator.tech OpenAPI Generator version: 5.2.1 =end require 'cgi' module OryOathkeeperClient class ApiApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Access Control Decision API # > This endpoint works with all HTTP Methods (GET, POST, PUT, ...) and matches every path prefixed with /decision. This endpoint mirrors the proxy capability of ORY Oathkeeper's proxy functionality but instead of forwarding the request to the upstream server, returns 200 (request should be allowed), 401 (unauthorized), or 403 (forbidden) status codes. This endpoint can be used to integrate with other API Proxies like Ambassador, Kong, Envoy, and many more. # @param [Hash] opts the optional parameters # @return [nil] def decisions(opts = {}) decisions_with_http_info(opts) nil end # Access Control Decision API # > This endpoint works with all HTTP Methods (GET, POST, PUT, ...) and matches every path prefixed with /decision. This endpoint mirrors the proxy capability of ORY Oathkeeper's proxy functionality but instead of forwarding the request to the upstream server, returns 200 (request should be allowed), 401 (unauthorized), or 403 (forbidden) status codes. This endpoint can be used to integrate with other API Proxies like Ambassador, Kong, Envoy, and many more. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def decisions_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ApiApi.decisions ...' end # resource path local_var_path = '/decisions' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"ApiApi.decisions", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ApiApi#decisions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a rule # Use this method to retrieve a rule from the storage. If it does not exist you will receive a 404 error. # @param id [String] # @param [Hash] opts the optional parameters # @return [Rule] def get_rule(id, opts = {}) data, _status_code, _headers = get_rule_with_http_info(id, opts) data end # Retrieve a rule # Use this method to retrieve a rule from the storage. If it does not exist you will receive a 404 error. # @param id [String] # @param [Hash] opts the optional parameters # @return [Array<(Rule, Integer, Hash)>] Rule data, response status code and response headers def get_rule_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ApiApi.get_rule ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling ApiApi.get_rule" end # resource path local_var_path = '/rules/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Rule' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"ApiApi.get_rule", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ApiApi#get_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get service version # This endpoint returns the service version typically notated using semantic versioning. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance. # @param [Hash] opts the optional parameters # @return [Version] def get_version(opts = {}) data, _status_code, _headers = get_version_with_http_info(opts) data end # Get service version # This endpoint returns the service version typically notated using semantic versioning. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance. # @param [Hash] opts the optional parameters # @return [Array<(Version, Integer, Hash)>] Version data, response status code and response headers def get_version_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ApiApi.get_version ...' end # resource path local_var_path = '/version' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Version' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"ApiApi.get_version", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ApiApi#get_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Lists cryptographic keys # This endpoint returns cryptographic keys that are required to, for example, verify signatures of ID Tokens. # @param [Hash] opts the optional parameters # @return [JsonWebKeySet] def get_well_known_json_web_keys(opts = {}) data, _status_code, _headers = get_well_known_json_web_keys_with_http_info(opts) data end # Lists cryptographic keys # This endpoint returns cryptographic keys that are required to, for example, verify signatures of ID Tokens. # @param [Hash] opts the optional parameters # @return [Array<(JsonWebKeySet, Integer, Hash)>] JsonWebKeySet data, response status code and response headers def get_well_known_json_web_keys_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ApiApi.get_well_known_json_web_keys ...' end # resource path local_var_path = '/.well-known/jwks.json' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'JsonWebKeySet' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"ApiApi.get_well_known_json_web_keys", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ApiApi#get_well_known_json_web_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Check alive status # This endpoint returns a 200 status code when the HTTP server is up running. This status does currently not include checks whether the database connection is working. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance. # @param [Hash] opts the optional parameters # @return [HealthStatus] def is_instance_alive(opts = {}) data, _status_code, _headers = is_instance_alive_with_http_info(opts) data end # Check alive status # This endpoint returns a 200 status code when the HTTP server is up running. This status does currently not include checks whether the database connection is working. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance. # @param [Hash] opts the optional parameters # @return [Array<(HealthStatus, Integer, Hash)>] HealthStatus data, response status code and response headers def is_instance_alive_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ApiApi.is_instance_alive ...' end # resource path local_var_path = '/health/alive' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'HealthStatus' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"ApiApi.is_instance_alive", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ApiApi#is_instance_alive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Check readiness status # This endpoint returns a 200 status code when the HTTP server is up running and the environment dependencies (e.g. the database) are responsive as well. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance. # @param [Hash] opts the optional parameters # @return [HealthStatus] def is_instance_ready(opts = {}) data, _status_code, _headers = is_instance_ready_with_http_info(opts) data end # Check readiness status # This endpoint returns a 200 status code when the HTTP server is up running and the environment dependencies (e.g. the database) are responsive as well. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance. # @param [Hash] opts the optional parameters # @return [Array<(HealthStatus, Integer, Hash)>] HealthStatus data, response status code and response headers def is_instance_ready_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ApiApi.is_instance_ready ...' end # resource path local_var_path = '/health/ready' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'HealthStatus' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"ApiApi.is_instance_ready", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ApiApi#is_instance_ready\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List all rules # This method returns an array of all rules that are stored in the backend. This is useful if you want to get a full view of what rules you have currently in place. # @param [Hash] opts the optional parameters # @option opts [Integer] :limit The maximum amount of rules returned. # @option opts [Integer] :offset The offset from where to start looking. # @return [Array] def list_rules(opts = {}) data, _status_code, _headers = list_rules_with_http_info(opts) data end # List all rules # This method returns an array of all rules that are stored in the backend. This is useful if you want to get a full view of what rules you have currently in place. # @param [Hash] opts the optional parameters # @option opts [Integer] :limit The maximum amount of rules returned. # @option opts [Integer] :offset The offset from where to start looking. # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers def list_rules_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ApiApi.list_rules ...' end # resource path local_var_path = '/rules' # query parameters query_params = opts[:query_params] || {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Array' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"ApiApi.list_rules", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ApiApi#list_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end