=begin #Datadog API V1 Collection #Collection of all Datadog Public endpoints. The version of the OpenAPI document: 1.0 Contact: support@datadoghq.com Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020-Present Datadog, Inc. =end require 'cgi' module DatadogAPIClient::V1 class WebhooksIntegrationAPI attr_accessor :api_client def initialize(api_client = APIClient.default) @api_client = api_client end # Create a webhooks integration # Creates an endpoint with the name ``. # @param body [WebhooksIntegration] Create a webhooks integration request body. # @param opts [Hash] the optional parameters # @return [WebhooksIntegration] def create_webhooks_integration(body, opts = {}) data, _status_code, _headers = create_webhooks_integration_with_http_info(body, opts) data end # Create a webhooks integration # Creates an endpoint with the name ``. # @param body [WebhooksIntegration] Create a webhooks integration request body. # @param opts [Hash] the optional parameters # @return [Array<(WebhooksIntegration, Integer, Hash)>] WebhooksIntegration data, response status code and response headers def create_webhooks_integration_with_http_info(body, opts = {}) if @api_client.config.unstable_operations.has_key?(:create_webhooks_integration) unstable_enabled = @api_client.config.unstable_operations[:create_webhooks_integration] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "create_webhooks_integration") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "create_webhooks_integration")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksIntegrationAPI.create_webhooks_integration ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling WebhooksIntegrationAPI.create_webhooks_integration" end # resource path local_var_path = '/api/v1/integration/webhooks/configuration/webhooks' # 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']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'WebhooksIntegration' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :create_webhooks_integration, :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(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksIntegrationAPI#create_webhooks_integration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a custom variable # Creates an endpoint with the name ``. # @param body [WebhooksIntegrationCustomVariable] Define a custom variable request body. # @param opts [Hash] the optional parameters # @return [WebhooksIntegrationCustomVariableResponse] def create_webhooks_integration_custom_variable(body, opts = {}) data, _status_code, _headers = create_webhooks_integration_custom_variable_with_http_info(body, opts) data end # Create a custom variable # Creates an endpoint with the name ``. # @param body [WebhooksIntegrationCustomVariable] Define a custom variable request body. # @param opts [Hash] the optional parameters # @return [Array<(WebhooksIntegrationCustomVariableResponse, Integer, Hash)>] WebhooksIntegrationCustomVariableResponse data, response status code and response headers def create_webhooks_integration_custom_variable_with_http_info(body, opts = {}) if @api_client.config.unstable_operations.has_key?(:create_webhooks_integration_custom_variable) unstable_enabled = @api_client.config.unstable_operations[:create_webhooks_integration_custom_variable] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "create_webhooks_integration_custom_variable") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "create_webhooks_integration_custom_variable")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksIntegrationAPI.create_webhooks_integration_custom_variable ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling WebhooksIntegrationAPI.create_webhooks_integration_custom_variable" end # resource path local_var_path = '/api/v1/integration/webhooks/configuration/custom-variables' # 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']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'WebhooksIntegrationCustomVariableResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :create_webhooks_integration_custom_variable, :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(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksIntegrationAPI#create_webhooks_integration_custom_variable\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a webhook # Deletes the endpoint with the name ``. # @param webhook_name [String] The name of the webhook. # @param opts [Hash] the optional parameters # @return [nil] def delete_webhooks_integration(webhook_name, opts = {}) delete_webhooks_integration_with_http_info(webhook_name, opts) nil end # Delete a webhook # Deletes the endpoint with the name ``. # @param webhook_name [String] The name of the webhook. # @param opts [Hash] the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_webhooks_integration_with_http_info(webhook_name, opts = {}) if @api_client.config.unstable_operations.has_key?(:delete_webhooks_integration) unstable_enabled = @api_client.config.unstable_operations[:delete_webhooks_integration] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "delete_webhooks_integration") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "delete_webhooks_integration")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksIntegrationAPI.delete_webhooks_integration ...' end # verify the required parameter 'webhook_name' is set if @api_client.config.client_side_validation && webhook_name.nil? fail ArgumentError, "Missing the required parameter 'webhook_name' when calling WebhooksIntegrationAPI.delete_webhooks_integration" end # resource path local_var_path = '/api/v1/integration/webhooks/configuration/webhooks/{webhook_name}'.sub('{webhook_name}', CGI.escape(webhook_name.to_s).gsub('%2F', '/')) # 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(['*/*']) # 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] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :delete_webhooks_integration, :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(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksIntegrationAPI#delete_webhooks_integration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a custom variable # Deletes the endpoint with the name ``. # @param custom_variable_name [String] The name of the custom variable. # @param opts [Hash] the optional parameters # @return [nil] def delete_webhooks_integration_custom_variable(custom_variable_name, opts = {}) delete_webhooks_integration_custom_variable_with_http_info(custom_variable_name, opts) nil end # Delete a custom variable # Deletes the endpoint with the name ``. # @param custom_variable_name [String] The name of the custom variable. # @param opts [Hash] the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_webhooks_integration_custom_variable_with_http_info(custom_variable_name, opts = {}) if @api_client.config.unstable_operations.has_key?(:delete_webhooks_integration_custom_variable) unstable_enabled = @api_client.config.unstable_operations[:delete_webhooks_integration_custom_variable] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "delete_webhooks_integration_custom_variable") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "delete_webhooks_integration_custom_variable")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksIntegrationAPI.delete_webhooks_integration_custom_variable ...' end # verify the required parameter 'custom_variable_name' is set if @api_client.config.client_side_validation && custom_variable_name.nil? fail ArgumentError, "Missing the required parameter 'custom_variable_name' when calling WebhooksIntegrationAPI.delete_webhooks_integration_custom_variable" end # resource path local_var_path = '/api/v1/integration/webhooks/configuration/custom-variables/{custom_variable_name}'.sub('{custom_variable_name}', CGI.escape(custom_variable_name.to_s).gsub('%2F', '/')) # 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(['*/*']) # 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] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :delete_webhooks_integration_custom_variable, :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(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksIntegrationAPI#delete_webhooks_integration_custom_variable\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a webhook integration # Gets the content of the webhook with the name ``. # @param webhook_name [String] The name of the webhook. # @param opts [Hash] the optional parameters # @return [WebhooksIntegration] def get_webhooks_integration(webhook_name, opts = {}) data, _status_code, _headers = get_webhooks_integration_with_http_info(webhook_name, opts) data end # Get a webhook integration # Gets the content of the webhook with the name ``. # @param webhook_name [String] The name of the webhook. # @param opts [Hash] the optional parameters # @return [Array<(WebhooksIntegration, Integer, Hash)>] WebhooksIntegration data, response status code and response headers def get_webhooks_integration_with_http_info(webhook_name, opts = {}) if @api_client.config.unstable_operations.has_key?(:get_webhooks_integration) unstable_enabled = @api_client.config.unstable_operations[:get_webhooks_integration] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "get_webhooks_integration") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "get_webhooks_integration")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksIntegrationAPI.get_webhooks_integration ...' end # verify the required parameter 'webhook_name' is set if @api_client.config.client_side_validation && webhook_name.nil? fail ArgumentError, "Missing the required parameter 'webhook_name' when calling WebhooksIntegrationAPI.get_webhooks_integration" end # resource path local_var_path = '/api/v1/integration/webhooks/configuration/webhooks/{webhook_name}'.sub('{webhook_name}', CGI.escape(webhook_name.to_s).gsub('%2F', '/')) # 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] || 'WebhooksIntegration' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :get_webhooks_integration, :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: WebhooksIntegrationAPI#get_webhooks_integration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a custom variable # Shows the content of the custom variable with the name ``. # # If the custom variable is secret, the value does not return in the # response payload. # @param custom_variable_name [String] The name of the custom variable. # @param opts [Hash] the optional parameters # @return [WebhooksIntegrationCustomVariableResponse] def get_webhooks_integration_custom_variable(custom_variable_name, opts = {}) data, _status_code, _headers = get_webhooks_integration_custom_variable_with_http_info(custom_variable_name, opts) data end # Get a custom variable # Shows the content of the custom variable with the name ``. # # If the custom variable is secret, the value does not return in the # response payload. # @param custom_variable_name [String] The name of the custom variable. # @param opts [Hash] the optional parameters # @return [Array<(WebhooksIntegrationCustomVariableResponse, Integer, Hash)>] WebhooksIntegrationCustomVariableResponse data, response status code and response headers def get_webhooks_integration_custom_variable_with_http_info(custom_variable_name, opts = {}) if @api_client.config.unstable_operations.has_key?(:get_webhooks_integration_custom_variable) unstable_enabled = @api_client.config.unstable_operations[:get_webhooks_integration_custom_variable] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "get_webhooks_integration_custom_variable") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "get_webhooks_integration_custom_variable")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksIntegrationAPI.get_webhooks_integration_custom_variable ...' end # verify the required parameter 'custom_variable_name' is set if @api_client.config.client_side_validation && custom_variable_name.nil? fail ArgumentError, "Missing the required parameter 'custom_variable_name' when calling WebhooksIntegrationAPI.get_webhooks_integration_custom_variable" end # resource path local_var_path = '/api/v1/integration/webhooks/configuration/custom-variables/{custom_variable_name}'.sub('{custom_variable_name}', CGI.escape(custom_variable_name.to_s).gsub('%2F', '/')) # 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] || 'WebhooksIntegrationCustomVariableResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :get_webhooks_integration_custom_variable, :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: WebhooksIntegrationAPI#get_webhooks_integration_custom_variable\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a webhook # Updates the endpoint with the name ``. # @param webhook_name [String] The name of the webhook. # @param body [WebhooksIntegrationUpdateRequest] Update an existing Datadog-Webhooks integration. # @param opts [Hash] the optional parameters # @return [WebhooksIntegration] def update_webhooks_integration(webhook_name, body, opts = {}) data, _status_code, _headers = update_webhooks_integration_with_http_info(webhook_name, body, opts) data end # Update a webhook # Updates the endpoint with the name ``. # @param webhook_name [String] The name of the webhook. # @param body [WebhooksIntegrationUpdateRequest] Update an existing Datadog-Webhooks integration. # @param opts [Hash] the optional parameters # @return [Array<(WebhooksIntegration, Integer, Hash)>] WebhooksIntegration data, response status code and response headers def update_webhooks_integration_with_http_info(webhook_name, body, opts = {}) if @api_client.config.unstable_operations.has_key?(:update_webhooks_integration) unstable_enabled = @api_client.config.unstable_operations[:update_webhooks_integration] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "update_webhooks_integration") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "update_webhooks_integration")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksIntegrationAPI.update_webhooks_integration ...' end # verify the required parameter 'webhook_name' is set if @api_client.config.client_side_validation && webhook_name.nil? fail ArgumentError, "Missing the required parameter 'webhook_name' when calling WebhooksIntegrationAPI.update_webhooks_integration" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling WebhooksIntegrationAPI.update_webhooks_integration" end # resource path local_var_path = '/api/v1/integration/webhooks/configuration/webhooks/{webhook_name}'.sub('{webhook_name}', CGI.escape(webhook_name.to_s).gsub('%2F', '/')) # 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']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'WebhooksIntegration' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :update_webhooks_integration, :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(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksIntegrationAPI#update_webhooks_integration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a custom variable # Updates the endpoint with the name ``. # @param custom_variable_name [String] The name of the custom variable. # @param body [WebhooksIntegrationCustomVariableUpdateRequest] Update an existing custom variable request body. # @param opts [Hash] the optional parameters # @return [WebhooksIntegrationCustomVariableResponse] def update_webhooks_integration_custom_variable(custom_variable_name, body, opts = {}) data, _status_code, _headers = update_webhooks_integration_custom_variable_with_http_info(custom_variable_name, body, opts) data end # Update a custom variable # Updates the endpoint with the name ``. # @param custom_variable_name [String] The name of the custom variable. # @param body [WebhooksIntegrationCustomVariableUpdateRequest] Update an existing custom variable request body. # @param opts [Hash] the optional parameters # @return [Array<(WebhooksIntegrationCustomVariableResponse, Integer, Hash)>] WebhooksIntegrationCustomVariableResponse data, response status code and response headers def update_webhooks_integration_custom_variable_with_http_info(custom_variable_name, body, opts = {}) if @api_client.config.unstable_operations.has_key?(:update_webhooks_integration_custom_variable) unstable_enabled = @api_client.config.unstable_operations[:update_webhooks_integration_custom_variable] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "update_webhooks_integration_custom_variable") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "update_webhooks_integration_custom_variable")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhooksIntegrationAPI.update_webhooks_integration_custom_variable ...' end # verify the required parameter 'custom_variable_name' is set if @api_client.config.client_side_validation && custom_variable_name.nil? fail ArgumentError, "Missing the required parameter 'custom_variable_name' when calling WebhooksIntegrationAPI.update_webhooks_integration_custom_variable" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling WebhooksIntegrationAPI.update_webhooks_integration_custom_variable" end # resource path local_var_path = '/api/v1/integration/webhooks/configuration/custom-variables/{custom_variable_name}'.sub('{custom_variable_name}', CGI.escape(custom_variable_name.to_s).gsub('%2F', '/')) # 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']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'WebhooksIntegrationCustomVariableResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :update_webhooks_integration_custom_variable, :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(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksIntegrationAPI#update_webhooks_integration_custom_variable\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end