Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.4.1.dev2",
"regenerated": "2021-01-18 15:23:31.186156",
"spec_repo_commit": "64464cb"
"regenerated": "2021-01-19 08:49:33.978536",
"spec_repo_commit": "8b601c0"
},
"v2": {
"apigentools_version": "1.4.1.dev2",
"regenerated": "2021-01-18 15:23:43.682621",
"spec_repo_commit": "64464cb"
"regenerated": "2021-01-19 08:49:46.690120",
"spec_repo_commit": "8b601c0"
}
}
}
47 changes: 46 additions & 1 deletion data/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2910,6 +2910,7 @@ components:
daily_limit:
description: The number of log events you can send in this index per day
before you are rate-limited.
example: 300000000
format: int64
type: integer
exclusion_filters:
Expand All @@ -2930,20 +2931,23 @@ components:
logs than the daily limit have been sent.

Rate limit is reset every-day at 2pm UTC.'
example: false
readOnly: true
type: boolean
name:
description: The name of the index.
readOnly: true
example: main
type: string
num_retention_days:
description: 'The number of days before logs are deleted from this index.
Available values depend on

retention plans specified in your organization''s contract/subscriptions.'
example: 15
format: int64
type: integer
required:
- name
- filter
type: object
LogsIndexListResponse:
Expand Down Expand Up @@ -12856,6 +12860,47 @@ paths:
type: safe
x-unstable: '**Note**: This endpoint is in public beta.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
post:
description: Creates a new index. Returns the Index object passed in the request
body when the request is successful.
operationId: CreateLogsIndex
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/LogsIndex'
description: Object containing the new index.
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/LogsIndex'
description: OK
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/LogsAPIErrorResponse'
description: Invalid Parameter Error
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Forbidden
summary: Create an index
tags:
- Logs Indexes
x-codegen-request-body-name: body
x-undo:
operationId: TODO
parameters: []
type: unsafe
x-unstable: '**Note**: This endpoint is in public beta.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v1/logs/config/indexes/{name}:
get:
Expand Down
10 changes: 5 additions & 5 deletions docs/v1/LogsIndex.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| **exclusion_filters** | [**Array<LogsExclusion>**](LogsExclusion.md) | An array of exclusion objects. The logs are tested against the query of each filter, following the order of the array. Only the first matching active exclusion matters, others (if any) are ignored. | [optional] |
| **filter** | [**LogsFilter**](LogsFilter.md) | | |
| **is_rate_limited** | **Boolean** | A boolean stating if the index is rate limited, meaning more logs than the daily limit have been sent. Rate limit is reset every-day at 2pm UTC. | [optional][readonly] |
| **name** | **String** | The name of the index. | [optional][readonly] |
| **name** | **String** | The name of the index. | |
| **num_retention_days** | **Integer** | The number of days before logs are deleted from this index. Available values depend on retention plans specified in your organization's contract/subscriptions. | [optional] |

## Example
Expand All @@ -17,12 +17,12 @@
require 'datadog_api_client/v1'

instance = DatadogAPIClient::V1::LogsIndex.new(
daily_limit: null,
daily_limit: 300000000,
exclusion_filters: null,
filter: null,
is_rate_limited: null,
name: null,
num_retention_days: null
is_rate_limited: false,
name: main,
num_retention_days: 15
)
```

79 changes: 79 additions & 0 deletions docs/v1/LogsIndexesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,92 @@ All URIs are relative to *https://api.datadoghq.com*

| Method | HTTP request | Description |
| ------ | ------------ | ----------- |
| [**create_logs_index**](LogsIndexesApi.md#create_logs_index) | **POST** /api/v1/logs/config/indexes | Create an index |
| [**get_logs_index**](LogsIndexesApi.md#get_logs_index) | **GET** /api/v1/logs/config/indexes/{name} | Get an index |
| [**get_logs_index_order**](LogsIndexesApi.md#get_logs_index_order) | **GET** /api/v1/logs/config/index-order | Get indexes order |
| [**list_log_indexes**](LogsIndexesApi.md#list_log_indexes) | **GET** /api/v1/logs/config/indexes | Get all indexes |
| [**update_logs_index**](LogsIndexesApi.md#update_logs_index) | **PUT** /api/v1/logs/config/indexes/{name} | Update an index |
| [**update_logs_index_order**](LogsIndexesApi.md#update_logs_index_order) | **PUT** /api/v1/logs/config/index-order | Update indexes order |


## create_logs_index

> <LogsIndex> create_logs_index(body)

Create an index

Creates a new index. Returns the Index object passed in the request body when the request is successful.

### Examples

```ruby
require 'time'
require 'datadog_api_client/v1'
# setup authorization
DatadogAPIClient::V1.configure do |config|
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['apiKeyAuth'] = 'Bearer'

# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['appKeyAuth'] = 'Bearer'

config.unstable_operations[:create_logs_index] = true
end

api_instance = DatadogAPIClient::V1::LogsIndexesApi.new
body = DatadogAPIClient::V1::LogsIndex.new({filter: DatadogAPIClient::V1::LogsFilter.new, name: 'main'}) # LogsIndex | Object containing the new index.

begin
# Create an index
result = api_instance.create_logs_index(body)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling LogsIndexesApi->create_logs_index: #{e}"
end
```

#### Using the create_logs_index_with_http_info variant

This returns an Array which contains the response data, status code and headers.

> <Array(<LogsIndex>, Integer, Hash)> create_logs_index_with_http_info(body)

```ruby
begin
# Create an index
data, status_code, headers = api_instance.create_logs_index_with_http_info(body)
p status_code # => 2xx
p headers # => { ... }
p data # => <LogsIndex>
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling LogsIndexesApi->create_logs_index_with_http_info: #{e}"
end
```

### Parameters

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **body** | [**LogsIndex**](LogsIndex.md) | Object containing the new index. | |

### Return type

[**LogsIndex**](LogsIndex.md)

### Authorization

[apiKeyAuth](README.md#apiKeyAuth), [appKeyAuth](README.md#appKeyAuth)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json


## get_logs_index

> <LogsIndex> get_logs_index(name)
Expand Down
1 change: 1 addition & 0 deletions docs/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ Class | Method | HTTP request | Description
*DatadogAPIClient::V1::KeyManagementApi* | [**update_api_key**](KeyManagementApi.md#update_api_key) | **PUT** /api/v1/api_key/{key} | Edit an API key
*DatadogAPIClient::V1::KeyManagementApi* | [**update_application_key**](KeyManagementApi.md#update_application_key) | **PUT** /api/v1/application_key/{key} | Edit an application key
*DatadogAPIClient::V1::LogsApi* | [**list_logs**](LogsApi.md#list_logs) | **POST** /api/v1/logs-queries/list | Get a list of logs
*DatadogAPIClient::V1::LogsIndexesApi* | [**create_logs_index**](LogsIndexesApi.md#create_logs_index) | **POST** /api/v1/logs/config/indexes | Create an index
*DatadogAPIClient::V1::LogsIndexesApi* | [**get_logs_index**](LogsIndexesApi.md#get_logs_index) | **GET** /api/v1/logs/config/indexes/{name} | Get an index
*DatadogAPIClient::V1::LogsIndexesApi* | [**get_logs_index_order**](LogsIndexesApi.md#get_logs_index_order) | **GET** /api/v1/logs/config/index-order | Get indexes order
*DatadogAPIClient::V1::LogsIndexesApi* | [**list_log_indexes**](LogsIndexesApi.md#list_log_indexes) | **GET** /api/v1/logs/config/indexes | Get all indexes
Expand Down
16 changes: 16 additions & 0 deletions features/v1/logs_indexes.feature
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,19 @@ Feature: Logs Indexes
And body {}
When the request is sent
Then the response status is 429 Too Many Requests

@generated @skip
Scenario: Create an index returns "OK" response
Given operation "CreateLogsIndex" enabled
And new "CreateLogsIndex" request
And body {}
When the request is sent
Then the response status is 200 OK

@generated @skip
Scenario: Create an index returns "Invalid Parameter Error" response
Given operation "CreateLogsIndex" enabled
And new "CreateLogsIndex" request
And body {}
When the request is sent
Then the response status is 400 Invalid Parameter Error
8 changes: 8 additions & 0 deletions features/v1/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,14 @@
"type": "safe"
}
},
"CreateLogsIndex": {
"tag": "Logs Indexes",
"undo": {
"operationId": "TODO",
"parameters": [],
"type": "unsafe"
}
},
"GetLogsIndex": {
"tag": "Logs Indexes",
"undo": {
Expand Down
75 changes: 75 additions & 0 deletions lib/datadog_api_client/v1/api/logs_indexes_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,81 @@ class LogsIndexesApi
def initialize(api_client = ApiClient.default)
@api_client = api_client
end
# Create an index
# Creates a new index. Returns the Index object passed in the request body when the request is successful.
# @param body [LogsIndex] Object containing the new index.
# @param [Hash] opts the optional parameters
# @return [LogsIndex]
def create_logs_index(body, opts = {})
data, _status_code, _headers = create_logs_index_with_http_info(body, opts)
data
end

# Create an index
# Creates a new index. Returns the Index object passed in the request body when the request is successful.
# @param body [LogsIndex] Object containing the new index.
# @param [Hash] opts the optional parameters
# @return [Array<(LogsIndex, Integer, Hash)>] LogsIndex data, response status code and response headers
def create_logs_index_with_http_info(body, opts = {})

if @api_client.config.unstable_operations.has_key?(:create_logs_index)
unstable_enabled = @api_client.config.unstable_operations[:create_logs_index]
if unstable_enabled
@api_client.config.logger.warn format("Using unstable operation '%s'", "create_logs_index")
else
raise ApiError.new(message: format("Unstable operation '%s' is disabled", "create_logs_index"))
end
end

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: LogsIndexesApi.create_logs_index ...'
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 LogsIndexesApi.create_logs_index"
end
# resource path
local_var_path = '/api/v1/logs/config/indexes'

# 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] || 'LogsIndex'

# auth_names
auth_names = opts[:debug_auth_names] || ['apiKeyAuth', 'appKeyAuth']

new_options = opts.merge(
:operation => :"LogsIndexesApi.create_logs_index",
: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: LogsIndexesApi#create_logs_index\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end

# Get an index
# Get one log index from your organization. This endpoint takes no JSON arguments.
# @param name [String] Name of the log index.
Expand Down
1 change: 1 addition & 0 deletions lib/datadog_api_client/v1/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def initialize
@force_ending_format = false
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
@unstable_operations = {
create_logs_index: false,
get_logs_index: false,
get_logs_index_order: false,
list_log_indexes: false,
Expand Down
5 changes: 5 additions & 0 deletions lib/datadog_api_client/v1/models/logs_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,18 @@ def list_invalid_properties
invalid_properties.push('invalid value for "filter", filter cannot be nil.')
end

if @name.nil?
invalid_properties.push('invalid value for "name", name cannot be nil.')
end

invalid_properties
end

# Check to see if the all the properties in the model are valid
# @return true if the model is valid
def valid?
return false if @filter.nil?
return false if @name.nil?
true
end

Expand Down