|
| 1 | +=begin |
| 2 | +#Datadog API V2 Collection |
| 3 | +
|
| 4 | +#Collection of all Datadog Public endpoints. |
| 5 | +
|
| 6 | +The version of the OpenAPI document: 1.0 |
| 7 | +Contact: support@datadoghq.com |
| 8 | +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator |
| 9 | +
|
| 10 | + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. |
| 11 | + This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 12 | + Copyright 2020-Present Datadog, Inc. |
| 13 | +
|
| 14 | +=end |
| 15 | + |
| 16 | +require 'cgi' |
| 17 | + |
| 18 | +module DatadogAPIClient::V2 |
| 19 | + class DDSQLAPI |
| 20 | + attr_accessor :api_client |
| 21 | + |
| 22 | + def initialize(api_client = DatadogAPIClient::APIClient.default) |
| 23 | + @api_client = api_client |
| 24 | + end |
| 25 | + |
| 26 | + # Execute a tabular DDSQL query. |
| 27 | + # |
| 28 | + # @see #execute_ddsql_tabular_query_with_http_info |
| 29 | + def execute_ddsql_tabular_query(body, opts = {}) |
| 30 | + data, _status_code, _headers = execute_ddsql_tabular_query_with_http_info(body, opts) |
| 31 | + data |
| 32 | + end |
| 33 | + |
| 34 | + # Execute a tabular DDSQL query. |
| 35 | + # |
| 36 | + # Submit a DDSQL statement and return either a `running` state with an opaque `query_id` |
| 37 | + # for the client to poll, or a `completed` state with the column-major result set inlined |
| 38 | + # when the query finishes quickly enough to be served synchronously. |
| 39 | + # |
| 40 | + # @param body [DdsqlTabularQueryRequest] |
| 41 | + # @param opts [Hash] the optional parameters |
| 42 | + # @return [Array<(DdsqlTabularQueryResponse, Integer, Hash)>] DdsqlTabularQueryResponse data, response status code and response headers |
| 43 | + def execute_ddsql_tabular_query_with_http_info(body, opts = {}) |
| 44 | + unstable_enabled = @api_client.config.unstable_operations["v2.execute_ddsql_tabular_query".to_sym] |
| 45 | + if unstable_enabled |
| 46 | + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.execute_ddsql_tabular_query") |
| 47 | + else |
| 48 | + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.execute_ddsql_tabular_query")) |
| 49 | + end |
| 50 | + |
| 51 | + if @api_client.config.debugging |
| 52 | + @api_client.config.logger.debug 'Calling API: DDSQLAPI.execute_ddsql_tabular_query ...' |
| 53 | + end |
| 54 | + # verify the required parameter 'body' is set |
| 55 | + if @api_client.config.client_side_validation && body.nil? |
| 56 | + fail ArgumentError, "Missing the required parameter 'body' when calling DDSQLAPI.execute_ddsql_tabular_query" |
| 57 | + end |
| 58 | + # resource path |
| 59 | + local_var_path = '/api/v2/ddsql/query/tabular' |
| 60 | + |
| 61 | + # query parameters |
| 62 | + query_params = opts[:query_params] || {} |
| 63 | + |
| 64 | + # header parameters |
| 65 | + header_params = opts[:header_params] || {} |
| 66 | + # HTTP header 'Accept' (if needed) |
| 67 | + header_params['Accept'] = @api_client.select_header_accept(['application/json']) |
| 68 | + # HTTP header 'Content-Type' |
| 69 | + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) |
| 70 | + |
| 71 | + # form parameters |
| 72 | + form_params = opts[:form_params] || {} |
| 73 | + |
| 74 | + # http body (model) |
| 75 | + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) |
| 76 | + |
| 77 | + # return_type |
| 78 | + return_type = opts[:debug_return_type] || 'DdsqlTabularQueryResponse' |
| 79 | + |
| 80 | + # auth_names |
| 81 | + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] |
| 82 | + |
| 83 | + new_options = opts.merge( |
| 84 | + :operation => :execute_ddsql_tabular_query, |
| 85 | + :header_params => header_params, |
| 86 | + :query_params => query_params, |
| 87 | + :form_params => form_params, |
| 88 | + :body => post_body, |
| 89 | + :auth_names => auth_names, |
| 90 | + :return_type => return_type, |
| 91 | + :api_version => "V2" |
| 92 | + ) |
| 93 | + |
| 94 | + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) |
| 95 | + if @api_client.config.debugging |
| 96 | + @api_client.config.logger.debug "API called: DDSQLAPI#execute_ddsql_tabular_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" |
| 97 | + end |
| 98 | + return data, status_code, headers |
| 99 | + end |
| 100 | + |
| 101 | + # Fetch the result of a DDSQL query. |
| 102 | + # |
| 103 | + # @see #fetch_ddsql_tabular_query_with_http_info |
| 104 | + def fetch_ddsql_tabular_query(body, opts = {}) |
| 105 | + data, _status_code, _headers = fetch_ddsql_tabular_query_with_http_info(body, opts) |
| 106 | + data |
| 107 | + end |
| 108 | + |
| 109 | + # Fetch the result of a DDSQL query. |
| 110 | + # |
| 111 | + # Poll a previously submitted DDSQL query for results. Pass the opaque `query_id` returned |
| 112 | + # by a prior `ExecuteDdsqlTabularQuery` (or by a prior `FetchDdsqlTabularQuery` that |
| 113 | + # returned `state: running`) and the server returns either a `running` state to poll again |
| 114 | + # or a `completed` state with the column-major result set inlined. |
| 115 | + # |
| 116 | + # @param body [DdsqlTabularQueryFetchRequest] |
| 117 | + # @param opts [Hash] the optional parameters |
| 118 | + # @return [Array<(DdsqlTabularQueryResponse, Integer, Hash)>] DdsqlTabularQueryResponse data, response status code and response headers |
| 119 | + def fetch_ddsql_tabular_query_with_http_info(body, opts = {}) |
| 120 | + unstable_enabled = @api_client.config.unstable_operations["v2.fetch_ddsql_tabular_query".to_sym] |
| 121 | + if unstable_enabled |
| 122 | + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.fetch_ddsql_tabular_query") |
| 123 | + else |
| 124 | + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.fetch_ddsql_tabular_query")) |
| 125 | + end |
| 126 | + |
| 127 | + if @api_client.config.debugging |
| 128 | + @api_client.config.logger.debug 'Calling API: DDSQLAPI.fetch_ddsql_tabular_query ...' |
| 129 | + end |
| 130 | + # verify the required parameter 'body' is set |
| 131 | + if @api_client.config.client_side_validation && body.nil? |
| 132 | + fail ArgumentError, "Missing the required parameter 'body' when calling DDSQLAPI.fetch_ddsql_tabular_query" |
| 133 | + end |
| 134 | + # resource path |
| 135 | + local_var_path = '/api/v2/ddsql/query/tabular/fetch' |
| 136 | + |
| 137 | + # query parameters |
| 138 | + query_params = opts[:query_params] || {} |
| 139 | + |
| 140 | + # header parameters |
| 141 | + header_params = opts[:header_params] || {} |
| 142 | + # HTTP header 'Accept' (if needed) |
| 143 | + header_params['Accept'] = @api_client.select_header_accept(['application/json']) |
| 144 | + # HTTP header 'Content-Type' |
| 145 | + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) |
| 146 | + |
| 147 | + # form parameters |
| 148 | + form_params = opts[:form_params] || {} |
| 149 | + |
| 150 | + # http body (model) |
| 151 | + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) |
| 152 | + |
| 153 | + # return_type |
| 154 | + return_type = opts[:debug_return_type] || 'DdsqlTabularQueryResponse' |
| 155 | + |
| 156 | + # auth_names |
| 157 | + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] |
| 158 | + |
| 159 | + new_options = opts.merge( |
| 160 | + :operation => :fetch_ddsql_tabular_query, |
| 161 | + :header_params => header_params, |
| 162 | + :query_params => query_params, |
| 163 | + :form_params => form_params, |
| 164 | + :body => post_body, |
| 165 | + :auth_names => auth_names, |
| 166 | + :return_type => return_type, |
| 167 | + :api_version => "V2" |
| 168 | + ) |
| 169 | + |
| 170 | + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) |
| 171 | + if @api_client.config.debugging |
| 172 | + @api_client.config.logger.debug "API called: DDSQLAPI#fetch_ddsql_tabular_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" |
| 173 | + end |
| 174 | + return data, status_code, headers |
| 175 | + end |
| 176 | + end |
| 177 | +end |
0 commit comments