|
1 | 1 | # datadog-api-client-python
|
2 | 2 |
|
3 |
| -Collection of all of the Datadog public endpoints. For the official documentation, see the [Datadog API Reference](https://docs.datadoghq.com/api/). |
| 3 | +This repository contains a Python API client for the [Datadog API](https://docs.datadoghq.com/api/). |
| 4 | +The code is generated using [openapi-generator](https://github.com/OpenAPITools/openapi-generator) |
| 5 | +and [apigentools](https://github.com/DataDog/apigentools). |
4 | 6 |
|
5 |
| -This python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project. |
| 7 | +Datadog API Collection |
6 | 8 |
|
7 |
| -Need help? Reach out to our awesome [support team](https://www.datadoghq.com/support/). |
| 9 | +- API version: 1.0 |
| 10 | + |
| 11 | +Collection of all Datadog Public endpoints. |
| 12 | + |
| 13 | + For more information, please visit [https://www.datadoghq.com/support/](https://www.datadoghq.com/support/) |
| 14 | + |
| 15 | +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* |
| 16 | + |
| 17 | +## Requirements |
| 18 | + |
| 19 | +Building and using the API client library requires: |
| 20 | + |
| 21 | +1. Python 3.6+ |
| 22 | + |
| 23 | +## Installation |
| 24 | + |
| 25 | +To install the API client library, simply execute: |
| 26 | + |
| 27 | +```shell |
| 28 | +pip install datadog-api-client |
| 29 | +``` |
| 30 | + |
| 31 | +## Getting Started |
| 32 | + |
| 33 | +Please follow the [installation](#installation) instruction and execute the following Python code: |
| 34 | + |
| 35 | +```python |
| 36 | +import os |
| 37 | +from dateutil.parser import parse as dateutil_parser |
| 38 | +import datadog_api_client.v1 |
| 39 | +from datadog_api_client.v1.api import aws_integration_api |
| 40 | +from datadog_api_client.v1.models import * |
| 41 | +from pprint import pprint |
| 42 | + |
| 43 | +# Defining the host is optional and defaults to https://api.datadoghq.com |
| 44 | +# See configuration.py for a list of all supported configuration parameters. |
| 45 | +configuration = datadog_api_client.v1.Configuration( |
| 46 | + host = "https://api.datadoghq.com" |
| 47 | +) |
| 48 | + |
| 49 | +# The client must configure the authentication and authorization parameters |
| 50 | +# in accordance with the API server security policy. |
| 51 | +# Examples for each auth method are provided below, use the example that |
| 52 | +# satisfies your auth use case. |
| 53 | + |
| 54 | +# Configure API key authorization: apiKeyAuth |
| 55 | +configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY') |
| 56 | + |
| 57 | +# Configure API key authorization: appKeyAuth |
| 58 | +configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY') |
| 59 | + |
| 60 | +# Enter a context with an instance of the API client |
| 61 | +with datadog_api_client.v1.ApiClient(configuration) as api_client: |
| 62 | + # Create an instance of the API class |
| 63 | + api_instance = aws_integration_api.AWSIntegrationApi(api_client) |
| 64 | + body = AWSAccount( |
| 65 | + access_key_id="access_key_id_example", |
| 66 | + account_id="1234567", |
| 67 | + account_specific_namespace_rules={ |
| 68 | + "key": True, |
| 69 | + }, |
| 70 | + excluded_regions=["us-east-1","us-west-2"], |
| 71 | + filter_tags=["<KEY>:<VALUE>"], |
| 72 | + host_tags=["<KEY>:<VALUE>"], |
| 73 | + role_name="DatadogAWSIntegrationRole", |
| 74 | + secret_access_key="secret_access_key_example", |
| 75 | + ) # AWSAccount | AWS Request Object |
| 76 | + |
| 77 | + # example passing only required values which don't have defaults set |
| 78 | + try: |
| 79 | + # Create an AWS integration |
| 80 | + api_response = api_instance.create_aws_account(body) |
| 81 | + pprint(api_response) |
| 82 | + except datadog_api_client.v1.ApiException as e: |
| 83 | + print("Exception when calling AWSIntegrationApi->create_aws_account: %s\n" % e) |
| 84 | +``` |
| 85 | + |
| 86 | +### Unstable Endpoints |
| 87 | + |
| 88 | +This client includes access to Datadog API endpoints while they are in an unstable state and may undergo breaking changes. An extra configuration step is required to enable these endpoints: |
| 89 | + |
| 90 | +```python |
| 91 | +configuration.unstable_operations["<OperationName>"] = True |
| 92 | +``` |
| 93 | + |
| 94 | +where `<OperationName>` is the name of the method used to interact with that endpoint. For example: `list_log_indexes`, or `get_logs_index` |
| 95 | + |
| 96 | +## Documentation for API Endpoints and Models |
| 97 | + |
| 98 | +Documentation for API endpoints and models can be found under the [`docs`](/docs) directory. |
| 99 | + |
| 100 | +## Documentation for Authorization |
| 101 | + |
| 102 | +Authenticate with the API by providing your API and Application keys in the configuration: |
| 103 | + |
| 104 | +```python |
| 105 | +configuration.api_key["apiKeyAuth"] = "YOUR_API_KEY" |
| 106 | +configuration.api_key["appKeyAuth"] = "YOUR_APPLICATION_KEY" |
| 107 | +``` |
8 | 108 |
|
9 | 109 | ## Author
|
10 | 110 |
|
11 | 111 |
|
| 112 | + |
0 commit comments