このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください

OCI Integration

Configure your Datadog-OCI integration directly through the Datadog API. For more information, see the OCI integration page.

GET https://api.ap1.datadoghq.com/api/v2/integration/oci/tenancieshttps://api.datadoghq.eu/api/v2/integration/oci/tenancieshttps://api.ddog-gov.com/api/v2/integration/oci/tenancieshttps://api.datadoghq.com/api/v2/integration/oci/tenancieshttps://api.us3.datadoghq.com/api/v2/integration/oci/tenancieshttps://api.us5.datadoghq.com/api/v2/integration/oci/tenancies

概要

List all tenancy integrations. This endpoint requires the oci_configuration_read permission.

応答

OK

The definition of TenancyConfigList object.

Expand All

フィールド

種類

説明

data [required]

[object]

The TenancyConfigList data.

attributes

object

The definition of TenancyConfigDataAttributes object.

config_version

int64

The config version. It is not recommended to add or change this value, as it is determined internally.

cost_collection_enabled

boolean

Enable or disable cost collection.

home_region

string

The home region of the tenancy to be integrated.

logs_config

object

The definition of OCILogsConfig object.

compartment_tag_filters

[string]

The compartment tag filters to apply to log collection. Each value represents a Datadog tag in the format key:value.

enabled

boolean

Enable or disable log collection. Disabled by default.

enabled_services

[string]

The list of services to enable for log collection.

metrics_config

object

The definition of OCIMetricsConfig object.

compartment_tag_filters

[string]

The compartment tag filters to apply to metric collection. Each value represents a Datadog tag in the format key:value.

enabled

boolean

Enable or disable metric collection. Enabled by default for all services.

excluded_services

[string]

The list of services to exclude from metric collection.

resource_collection_enabled

boolean

Enable or disable resource collection.

tenancy_name

string

The attribute's tenancy_name.

user_ocid

string

The OCID of the user needed to authenticate and collect data.

id

string

The OCID of the tenancy config.

type [required]

enum

OCI tenancy resource type. Allowed enum values: oci_tenancy

default: oci_tenancy

{
  "data": [
    {
      "attributes": {
        "config_version": "integer",
        "cost_collection_enabled": false,
        "home_region": "string",
        "logs_config": {
          "compartment_tag_filters": [],
          "enabled": false,
          "enabled_services": []
        },
        "metrics_config": {
          "compartment_tag_filters": [],
          "enabled": false,
          "excluded_services": []
        },
        "resource_collection_enabled": false,
        "tenancy_name": "string",
        "user_ocid": "string"
      },
      "id": "string",
      "type": "oci_tenancy"
    }
  ]
}

Forbidden

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

コード例

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/integration/oci/tenancies" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get tenancy configs returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.oci_integration_api import OCIIntegrationApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = OCIIntegrationApi(api_client)
    response = api_instance.get_tenancy_configs()

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Get tenancy configs returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::OCIIntegrationAPI.new
p api_instance.get_tenancy_configs()

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Get tenancy configs returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewOCIIntegrationApi(apiClient)
	resp, r, err := api.GetTenancyConfigs(ctx)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `OCIIntegrationApi.GetTenancyConfigs`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `OCIIntegrationApi.GetTenancyConfigs`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Get tenancy configs returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.OciIntegrationApi;
import com.datadog.api.client.v2.model.TenancyConfigList;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    OciIntegrationApi apiInstance = new OciIntegrationApi(defaultClient);

    try {
      TenancyConfigList result = apiInstance.getTenancyConfigs();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling OciIntegrationApi#getTenancyConfigs");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
// Get tenancy configs returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_oci_integration::OCIIntegrationAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = OCIIntegrationAPI::with_config(configuration);
    let resp = api.get_tenancy_configs().await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
/**
 * Get tenancy configs returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.OCIIntegrationApi(configuration);

apiInstance
  .getTenancyConfigs()
  .then((data: v2.TenancyConfigList) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v2/integration/oci/tenancies/{tenancy_ocid}https://api.datadoghq.eu/api/v2/integration/oci/tenancies/{tenancy_ocid}https://api.ddog-gov.com/api/v2/integration/oci/tenancies/{tenancy_ocid}https://api.datadoghq.com/api/v2/integration/oci/tenancies/{tenancy_ocid}https://api.us3.datadoghq.com/api/v2/integration/oci/tenancies/{tenancy_ocid}https://api.us5.datadoghq.com/api/v2/integration/oci/tenancies/{tenancy_ocid}

概要

Get a single tenancy config object. This endpoint requires the oci_configuration_read permission.

引数

パスパラメーター

名前

種類

説明

tenancy_ocid [required]

string

Unique tenancy OCID of the OCI integration config.

応答

OK

The definition of TenancyConfig object.

Expand All

フィールド

種類

説明

data

object

The definition of TenancyConfigData object.

attributes

object

The definition of TenancyConfigDataAttributes object.

config_version

int64

The config version. It is not recommended to add or change this value, as it is determined internally.

cost_collection_enabled

boolean

Enable or disable cost collection.

home_region

string

The home region of the tenancy to be integrated.

logs_config

object

The definition of OCILogsConfig object.

compartment_tag_filters

[string]

The compartment tag filters to apply to log collection. Each value represents a Datadog tag in the format key:value.

enabled

boolean

Enable or disable log collection. Disabled by default.

enabled_services

[string]

The list of services to enable for log collection.

metrics_config

object

The definition of OCIMetricsConfig object.

compartment_tag_filters

[string]

The compartment tag filters to apply to metric collection. Each value represents a Datadog tag in the format key:value.

enabled

boolean

Enable or disable metric collection. Enabled by default for all services.

excluded_services

[string]

The list of services to exclude from metric collection.

resource_collection_enabled

boolean

Enable or disable resource collection.

tenancy_name

string

The attribute's tenancy_name.

user_ocid

string

The OCID of the user needed to authenticate and collect data.

id

string

The OCID of the tenancy config.

type [required]

enum

OCI tenancy resource type. Allowed enum values: oci_tenancy

default: oci_tenancy

{
  "data": {
    "attributes": {
      "config_version": "integer",
      "cost_collection_enabled": false,
      "home_region": "string",
      "logs_config": {
        "compartment_tag_filters": [],
        "enabled": false,
        "enabled_services": []
      },
      "metrics_config": {
        "compartment_tag_filters": [],
        "enabled": false,
        "excluded_services": []
      },
      "resource_collection_enabled": false,
      "tenancy_name": "string",
      "user_ocid": "string"
    },
    "id": "string",
    "type": "oci_tenancy"
  }
}

Forbidden

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

コード例

                  # Path parameters
export tenancy_ocid="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/integration/oci/tenancies/${tenancy_ocid}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get tenancy config returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.oci_integration_api import OCIIntegrationApi

# there is a valid "oci_tenancy" resource in the system
OCI_TENANCY_DATA_ID = environ["OCI_TENANCY_DATA_ID"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = OCIIntegrationApi(api_client)
    response = api_instance.get_tenancy_config(
        tenancy_ocid=OCI_TENANCY_DATA_ID,
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Get tenancy config returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::OCIIntegrationAPI.new

# there is a valid "oci_tenancy" resource in the system
OCI_TENANCY_DATA_ID = ENV["OCI_TENANCY_DATA_ID"]
p api_instance.get_tenancy_config(OCI_TENANCY_DATA_ID)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Get tenancy config returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "oci_tenancy" resource in the system
	OciTenancyDataID := os.Getenv("OCI_TENANCY_DATA_ID")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewOCIIntegrationApi(apiClient)
	resp, r, err := api.GetTenancyConfig(ctx, OciTenancyDataID)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `OCIIntegrationApi.GetTenancyConfig`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `OCIIntegrationApi.GetTenancyConfig`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Get tenancy config returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.OciIntegrationApi;
import com.datadog.api.client.v2.model.TenancyConfig;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    OciIntegrationApi apiInstance = new OciIntegrationApi(defaultClient);

    // there is a valid "oci_tenancy" resource in the system
    String OCI_TENANCY_DATA_ID = System.getenv("OCI_TENANCY_DATA_ID");

    try {
      TenancyConfig result = apiInstance.getTenancyConfig(OCI_TENANCY_DATA_ID);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling OciIntegrationApi#getTenancyConfig");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
// Get tenancy config returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_oci_integration::OCIIntegrationAPI;

#[tokio::main]
async fn main() {
    // there is a valid "oci_tenancy" resource in the system
    let oci_tenancy_data_id = std::env::var("OCI_TENANCY_DATA_ID").unwrap();
    let configuration = datadog::Configuration::new();
    let api = OCIIntegrationAPI::with_config(configuration);
    let resp = api.get_tenancy_config(oci_tenancy_data_id.clone()).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
/**
 * Get tenancy config returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.OCIIntegrationApi(configuration);

// there is a valid "oci_tenancy" resource in the system
const OCI_TENANCY_DATA_ID = process.env.OCI_TENANCY_DATA_ID as string;

const params: v2.OCIIntegrationApiGetTenancyConfigRequest = {
  tenancyOcid: OCI_TENANCY_DATA_ID,
};

apiInstance
  .getTenancyConfig(params)
  .then((data: v2.TenancyConfig) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v2/integration/oci/tenancieshttps://api.datadoghq.eu/api/v2/integration/oci/tenancieshttps://api.ddog-gov.com/api/v2/integration/oci/tenancieshttps://api.datadoghq.com/api/v2/integration/oci/tenancieshttps://api.us3.datadoghq.com/api/v2/integration/oci/tenancieshttps://api.us5.datadoghq.com/api/v2/integration/oci/tenancies

概要

Create a new tenancy config. This endpoint requires the oci_configurations_manage permission.

リクエスト

Body Data (required)

Expand All

フィールド

種類

説明

data

object

The definition of CreateTenancyConfigData object.

attributes

object

The definition of CreateTenancyConfigDataAttributes object.

auth_credentials [required]

object

The auth credentials of the user. Consists of a public key fingerprint and private key.

fingerprint [required]

string

The public key fingerprint.

private_key [required]

string

The RSA private key in PEM format.

config_version

int64

The config version. It is not recommended to add or change this value, as it is determined internally.

home_region [required]

string

The home region of the tenancy to be integrated.

logs_config

object

The definition of OCILogsConfig object.

compartment_tag_filters

[string]

The compartment tag filters to apply to log collection. Each value represents a Datadog tag in the format key:value.

enabled

boolean

Enable or disable log collection. Disabled by default.

enabled_services

[string]

The list of services to enable for log collection.

metrics_config

object

The definition of OCIMetricsConfig object.

compartment_tag_filters

[string]

The compartment tag filters to apply to metric collection. Each value represents a Datadog tag in the format key:value.

enabled

boolean

Enable or disable metric collection. Enabled by default for all services.

excluded_services

[string]

The list of services to exclude from metric collection.

resource_collection_enabled

boolean

Enable or disable resource collection.

user_ocid [required]

string

The OCID of the user needed to authenticate and collect data.

id [required]

string

The OCID of the tenancy to be integrated.

type [required]

enum

OCI tenancy resource type. Allowed enum values: oci_tenancy

default: oci_tenancy

{
  "data": {
    "attributes": {
      "auth_credentials": {
        "fingerprint": "c8:e5:54:f2:da:a2:d7:b0:ed:f4:79:47:93:64:12:b1",
        "private_key": "----BEGIN PRIVATE KEY-----MIIEvgIBADANBgkqhkiG9w0BAQEFAA----END PRIVATE KEY-----"
      },
      "config_version": "integer",
      "home_region": "us-ashburn-1",
      "logs_config": {
        "compartment_tag_filters": [],
        "enabled": false,
        "enabled_services": []
      },
      "metrics_config": {
        "compartment_tag_filters": [],
        "enabled": false,
        "excluded_services": []
      },
      "resource_collection_enabled": false,
      "user_ocid": "ocid1.user.test"
    },
    "id": "ocid1.tenancy.test",
    "type": "oci_tenancy"
  }
}

応答

Created

The definition of TenancyConfig object.

Expand All

フィールド

種類

説明

data

object

The definition of TenancyConfigData object.

attributes

object

The definition of TenancyConfigDataAttributes object.

config_version

int64

The config version. It is not recommended to add or change this value, as it is determined internally.

cost_collection_enabled

boolean

Enable or disable cost collection.

home_region

string

The home region of the tenancy to be integrated.

logs_config

object

The definition of OCILogsConfig object.

compartment_tag_filters

[string]

The compartment tag filters to apply to log collection. Each value represents a Datadog tag in the format key:value.

enabled

boolean

Enable or disable log collection. Disabled by default.

enabled_services

[string]

The list of services to enable for log collection.

metrics_config

object

The definition of OCIMetricsConfig object.

compartment_tag_filters

[string]

The compartment tag filters to apply to metric collection. Each value represents a Datadog tag in the format key:value.

enabled

boolean

Enable or disable metric collection. Enabled by default for all services.

excluded_services

[string]

The list of services to exclude from metric collection.

resource_collection_enabled

boolean

Enable or disable resource collection.

tenancy_name

string

The attribute's tenancy_name.

user_ocid

string

The OCID of the user needed to authenticate and collect data.

id

string

The OCID of the tenancy config.

type [required]

enum

OCI tenancy resource type. Allowed enum values: oci_tenancy

default: oci_tenancy

{
  "data": {
    "attributes": {
      "config_version": "integer",
      "cost_collection_enabled": false,
      "home_region": "string",
      "logs_config": {
        "compartment_tag_filters": [],
        "enabled": false,
        "enabled_services": []
      },
      "metrics_config": {
        "compartment_tag_filters": [],
        "enabled": false,
        "excluded_services": []
      },
      "resource_collection_enabled": false,
      "tenancy_name": "string",
      "user_ocid": "string"
    },
    "id": "string",
    "type": "oci_tenancy"
  }
}

Bad Request

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Conflict

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

コード例

                  # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/integration/oci/tenancies" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "auth_credentials": { "fingerprint": "c8:e5:54:f2:da:a2:d7:b0:ed:f4:79:47:93:64:12:b1", "private_key": "----BEGIN PRIVATE KEY-----MIIEvgIBADANBgkqhkiG9w0BAQEFAA----END PRIVATE KEY-----" }, "home_region": "us-ashburn-1", "user_ocid": "ocid1.user.test" }, "id": "ocid1.tenancy.test", "type": "oci_tenancy" } } EOF
"""
Create tenancy config returns "Created" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.oci_integration_api import OCIIntegrationApi
from datadog_api_client.v2.model.auth_credentials import AuthCredentials
from datadog_api_client.v2.model.create_tenancy_config import CreateTenancyConfig
from datadog_api_client.v2.model.create_tenancy_config_data import CreateTenancyConfigData
from datadog_api_client.v2.model.create_tenancy_config_data_attributes import CreateTenancyConfigDataAttributes
from datadog_api_client.v2.model.create_tenancy_config_data_type import CreateTenancyConfigDataType
from datadog_api_client.v2.model.oci_logs_config import OCILogsConfig
from datadog_api_client.v2.model.oci_metrics_config import OCIMetricsConfig

body = CreateTenancyConfig(
    data=CreateTenancyConfigData(
        attributes=CreateTenancyConfigDataAttributes(
            auth_credentials=AuthCredentials(
                fingerprint="a7:b5:54:f2:da:a2:d7:b0:ed:f4:79:47:93:64:12:b1",
                private_key="-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCmMo2jwJXWTt0y\nk+X6biZycflZSwOAP/iNeAZPTWwhYxj9pxDvd5OfiIe+o/7eupk/3q+fRsSaztPn\nJwI/JnbQz5IT5miLi/apIozg870FFxjrgRxSGjo7BNH0dLKITc5nLDLBnOEzxR2Y\nk9+0dFaiNlcodFULlg75trqbILRSc6jn9Tp9G8C5e9cj+LYQuUu2JwIqhCJqcNcU\nt+lRL5odBJhZ85KlugKyUg6LN3VQIdOpTtPBMXYA1oBgDCbe5Rw5yzgnd0KtSFf3\nGOmLfR95gQshLfbGavLOTh9ioaOj/2hT9HrsEe1VWgX3m1WibqKiPc4OA4BGGToN\n9tzN/t89AgMBAAECggEAVFKD4JherXwX6Ih3f6cRZLGFBJP1s8VBM225LdUnTo07\n6b4w7n6p7KBV1xjXwGPGS0yNqG88YxsbEkWNc0Ltt6YJBIW7d0nNHSVFewDPX1zH\nrP01xEZAUx9v8uqehl+LoHchTXBuJlkVWgt0zdbU+bo+YG0dlSJOeM4IQZrHQqlQ\ne4PNk73rot9NSqiKQFXUroaoVPTkUHb3idpLX60K3MgIBoAm4DpJ6cMItb4hyHv5\npNZhHQbr9Eciz2tj+OhQTYKCrAd0gJgl0tC+6L3kzkmiYE3ceGphqWfI9bX52Y96\nwpgAtYi6o8wTykgRLabLc6vSQ9RegWEh7P8iSAvAlQKBgQDX5wJhYeWDdG4uPqLC\nX3EtnR3y5zYgOd7cVtMr1DIvXa4I8PSIOC4Wnb/5A1S03dJ2e8GJ/qSbl5R2fsDr\nXhjIm/KeBPI9p2dVZM8fPoWppR3SgDaHY5qxAED111DnEZuTMl5BO87QZXurTSiF\nfbGsWaVqdVieRAQ3b5DEkC9TSwKBgQDFEFgui7iyPhQaQafsjnVbWyrWF821xjTG\nb6Bo4FO97c9pw/tbkpfM+dcOU4SsZL8HjwGBUhUsDsVOX7m/sWRjZqNM5t/VR+52\n9ygIPEjNyh0b3aARgn8AQ8n+RZvl1Z2A32KCO3MFzhpVKnv2sdSc1TNHQkuJH/rq\neUAm3El6lwKBgQCK8w+jIOAXRB2NAZ66PbaXRqD5rTg2cUguwmpRsNVDiqTw+DJI\nYO+4enoMhspDROeofWlHqGzD/j/8KwN59ys4ILV6YXCNoWltmd17HD/luHCDAyUU\n6VOrSqCEF7jnnXtktmvWy+kEUevPiW7kyspIQ8GjzDXmVZvpGZIwDyOGFQKBgGtS\nl3PiDFimjnQuRbIDc86pPA8VL6dLpvpbWNVFNtY9abSEU6RvldTATGs0+RCaXZ9U\nNtGjTnyMHtCsOZE4nx+zikQbiNOzNR/9QwQZMN1Csc+3R7HBjEEsqhmc92aYjArf\nndqnXeFPee/gD1svRkeTpTWt2U146UJBfrqrRilJAoGAQp7FtEtps5I9xK92AVpD\nHj2p1JNKzLCRtWQ8j4jthKqR0iTQ9SwQyjiAvcKc7HdMaG11gmr5XbmKAzelVC+f\no9kEwoumo8yHVn5Ztp4F2cxaD6+MzSJ/I6WesPyePUD7sPeorXByg1UNOXyzqDub\n/aU4/sNo2f8epM9l7QGiCtY=\n-----END PRIVATE KEY-----",
            ),
            config_version=2,
            home_region="us-ashburn-1",
            logs_config=OCILogsConfig(
                compartment_tag_filters=[
                    "datadog:true",
                    "env:prod",
                ],
                enabled=True,
                enabled_services=[
                    "oacnativeproduction",
                ],
            ),
            metrics_config=OCIMetricsConfig(
                compartment_tag_filters=[
                    "datadog:true",
                    "env:prod",
                ],
                enabled=True,
                excluded_services=[
                    "oci_compute",
                ],
            ),
            resource_collection_enabled=True,
            user_ocid="ocid1.user.test",
        ),
        id="ocid1.tenancy.dummy_value",
        type=CreateTenancyConfigDataType.OCI_TENANCY,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = OCIIntegrationApi(api_client)
    response = api_instance.create_tenancy_config(body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Create tenancy config returns "Created" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::OCIIntegrationAPI.new

body = DatadogAPIClient::V2::CreateTenancyConfig.new({
  data: DatadogAPIClient::V2::CreateTenancyConfigData.new({
    attributes: DatadogAPIClient::V2::CreateTenancyConfigDataAttributes.new({
      auth_credentials: DatadogAPIClient::V2::AuthCredentials.new({
        fingerprint: "a7:b5:54:f2:da:a2:d7:b0:ed:f4:79:47:93:64:12:b1",
        private_key: '-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCmMo2jwJXWTt0y\nk+X6biZycflZSwOAP/iNeAZPTWwhYxj9pxDvd5OfiIe+o/7eupk/3q+fRsSaztPn\nJwI/JnbQz5IT5miLi/apIozg870FFxjrgRxSGjo7BNH0dLKITc5nLDLBnOEzxR2Y\nk9+0dFaiNlcodFULlg75trqbILRSc6jn9Tp9G8C5e9cj+LYQuUu2JwIqhCJqcNcU\nt+lRL5odBJhZ85KlugKyUg6LN3VQIdOpTtPBMXYA1oBgDCbe5Rw5yzgnd0KtSFf3\nGOmLfR95gQshLfbGavLOTh9ioaOj/2hT9HrsEe1VWgX3m1WibqKiPc4OA4BGGToN\n9tzN/t89AgMBAAECggEAVFKD4JherXwX6Ih3f6cRZLGFBJP1s8VBM225LdUnTo07\n6b4w7n6p7KBV1xjXwGPGS0yNqG88YxsbEkWNc0Ltt6YJBIW7d0nNHSVFewDPX1zH\nrP01xEZAUx9v8uqehl+LoHchTXBuJlkVWgt0zdbU+bo+YG0dlSJOeM4IQZrHQqlQ\ne4PNk73rot9NSqiKQFXUroaoVPTkUHb3idpLX60K3MgIBoAm4DpJ6cMItb4hyHv5\npNZhHQbr9Eciz2tj+OhQTYKCrAd0gJgl0tC+6L3kzkmiYE3ceGphqWfI9bX52Y96\nwpgAtYi6o8wTykgRLabLc6vSQ9RegWEh7P8iSAvAlQKBgQDX5wJhYeWDdG4uPqLC\nX3EtnR3y5zYgOd7cVtMr1DIvXa4I8PSIOC4Wnb/5A1S03dJ2e8GJ/qSbl5R2fsDr\nXhjIm/KeBPI9p2dVZM8fPoWppR3SgDaHY5qxAED111DnEZuTMl5BO87QZXurTSiF\nfbGsWaVqdVieRAQ3b5DEkC9TSwKBgQDFEFgui7iyPhQaQafsjnVbWyrWF821xjTG\nb6Bo4FO97c9pw/tbkpfM+dcOU4SsZL8HjwGBUhUsDsVOX7m/sWRjZqNM5t/VR+52\n9ygIPEjNyh0b3aARgn8AQ8n+RZvl1Z2A32KCO3MFzhpVKnv2sdSc1TNHQkuJH/rq\neUAm3El6lwKBgQCK8w+jIOAXRB2NAZ66PbaXRqD5rTg2cUguwmpRsNVDiqTw+DJI\nYO+4enoMhspDROeofWlHqGzD/j/8KwN59ys4ILV6YXCNoWltmd17HD/luHCDAyUU\n6VOrSqCEF7jnnXtktmvWy+kEUevPiW7kyspIQ8GjzDXmVZvpGZIwDyOGFQKBgGtS\nl3PiDFimjnQuRbIDc86pPA8VL6dLpvpbWNVFNtY9abSEU6RvldTATGs0+RCaXZ9U\nNtGjTnyMHtCsOZE4nx+zikQbiNOzNR/9QwQZMN1Csc+3R7HBjEEsqhmc92aYjArf\nndqnXeFPee/gD1svRkeTpTWt2U146UJBfrqrRilJAoGAQp7FtEtps5I9xK92AVpD\nHj2p1JNKzLCRtWQ8j4jthKqR0iTQ9SwQyjiAvcKc7HdMaG11gmr5XbmKAzelVC+f\no9kEwoumo8yHVn5Ztp4F2cxaD6+MzSJ/I6WesPyePUD7sPeorXByg1UNOXyzqDub\n/aU4/sNo2f8epM9l7QGiCtY=\n-----END PRIVATE KEY-----',
      }),
      config_version: 2,
      home_region: "us-ashburn-1",
      logs_config: DatadogAPIClient::V2::OCILogsConfig.new({
        compartment_tag_filters: [
          "datadog:true",
          "env:prod",
        ],
        enabled: true,
        enabled_services: [
          "oacnativeproduction",
        ],
      }),
      metrics_config: DatadogAPIClient::V2::OCIMetricsConfig.new({
        compartment_tag_filters: [
          "datadog:true",
          "env:prod",
        ],
        enabled: true,
        excluded_services: [
          "oci_compute",
        ],
      }),
      resource_collection_enabled: true,
      user_ocid: "ocid1.user.test",
    }),
    id: "ocid1.tenancy.dummy_value",
    type: DatadogAPIClient::V2::CreateTenancyConfigDataType::OCI_TENANCY,
  }),
})
p api_instance.create_tenancy_config(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Create tenancy config returns "Created" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	body := datadogV2.CreateTenancyConfig{
		Data: &datadogV2.CreateTenancyConfigData{
			Attributes: &datadogV2.CreateTenancyConfigDataAttributes{
				AuthCredentials: datadogV2.AuthCredentials{
					Fingerprint: "a7:b5:54:f2:da:a2:d7:b0:ed:f4:79:47:93:64:12:b1",
					PrivateKey: `-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCmMo2jwJXWTt0y
k+X6biZycflZSwOAP/iNeAZPTWwhYxj9pxDvd5OfiIe+o/7eupk/3q+fRsSaztPn
JwI/JnbQz5IT5miLi/apIozg870FFxjrgRxSGjo7BNH0dLKITc5nLDLBnOEzxR2Y
k9+0dFaiNlcodFULlg75trqbILRSc6jn9Tp9G8C5e9cj+LYQuUu2JwIqhCJqcNcU
t+lRL5odBJhZ85KlugKyUg6LN3VQIdOpTtPBMXYA1oBgDCbe5Rw5yzgnd0KtSFf3
GOmLfR95gQshLfbGavLOTh9ioaOj/2hT9HrsEe1VWgX3m1WibqKiPc4OA4BGGToN
9tzN/t89AgMBAAECggEAVFKD4JherXwX6Ih3f6cRZLGFBJP1s8VBM225LdUnTo07
6b4w7n6p7KBV1xjXwGPGS0yNqG88YxsbEkWNc0Ltt6YJBIW7d0nNHSVFewDPX1zH
rP01xEZAUx9v8uqehl+LoHchTXBuJlkVWgt0zdbU+bo+YG0dlSJOeM4IQZrHQqlQ
e4PNk73rot9NSqiKQFXUroaoVPTkUHb3idpLX60K3MgIBoAm4DpJ6cMItb4hyHv5
pNZhHQbr9Eciz2tj+OhQTYKCrAd0gJgl0tC+6L3kzkmiYE3ceGphqWfI9bX52Y96
wpgAtYi6o8wTykgRLabLc6vSQ9RegWEh7P8iSAvAlQKBgQDX5wJhYeWDdG4uPqLC
X3EtnR3y5zYgOd7cVtMr1DIvXa4I8PSIOC4Wnb/5A1S03dJ2e8GJ/qSbl5R2fsDr
XhjIm/KeBPI9p2dVZM8fPoWppR3SgDaHY5qxAED111DnEZuTMl5BO87QZXurTSiF
fbGsWaVqdVieRAQ3b5DEkC9TSwKBgQDFEFgui7iyPhQaQafsjnVbWyrWF821xjTG
b6Bo4FO97c9pw/tbkpfM+dcOU4SsZL8HjwGBUhUsDsVOX7m/sWRjZqNM5t/VR+52
9ygIPEjNyh0b3aARgn8AQ8n+RZvl1Z2A32KCO3MFzhpVKnv2sdSc1TNHQkuJH/rq
eUAm3El6lwKBgQCK8w+jIOAXRB2NAZ66PbaXRqD5rTg2cUguwmpRsNVDiqTw+DJI
YO+4enoMhspDROeofWlHqGzD/j/8KwN59ys4ILV6YXCNoWltmd17HD/luHCDAyUU
6VOrSqCEF7jnnXtktmvWy+kEUevPiW7kyspIQ8GjzDXmVZvpGZIwDyOGFQKBgGtS
l3PiDFimjnQuRbIDc86pPA8VL6dLpvpbWNVFNtY9abSEU6RvldTATGs0+RCaXZ9U
NtGjTnyMHtCsOZE4nx+zikQbiNOzNR/9QwQZMN1Csc+3R7HBjEEsqhmc92aYjArf
ndqnXeFPee/gD1svRkeTpTWt2U146UJBfrqrRilJAoGAQp7FtEtps5I9xK92AVpD
Hj2p1JNKzLCRtWQ8j4jthKqR0iTQ9SwQyjiAvcKc7HdMaG11gmr5XbmKAzelVC+f
o9kEwoumo8yHVn5Ztp4F2cxaD6+MzSJ/I6WesPyePUD7sPeorXByg1UNOXyzqDub
/aU4/sNo2f8epM9l7QGiCtY=
-----END PRIVATE KEY-----`,
				},
				ConfigVersion: datadog.PtrInt64(2),
				HomeRegion:    "us-ashburn-1",
				LogsConfig: &datadogV2.OCILogsConfig{
					CompartmentTagFilters: []string{
						"datadog:true",
						"env:prod",
					},
					Enabled: datadog.PtrBool(true),
					EnabledServices: []string{
						"oacnativeproduction",
					},
				},
				MetricsConfig: &datadogV2.OCIMetricsConfig{
					CompartmentTagFilters: []string{
						"datadog:true",
						"env:prod",
					},
					Enabled: datadog.PtrBool(true),
					ExcludedServices: []string{
						"oci_compute",
					},
				},
				ResourceCollectionEnabled: datadog.PtrBool(true),
				UserOcid:                  "ocid1.user.test",
			},
			Id:   "ocid1.tenancy.dummy_value",
			Type: datadogV2.CREATETENANCYCONFIGDATATYPE_OCI_TENANCY,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewOCIIntegrationApi(apiClient)
	resp, r, err := api.CreateTenancyConfig(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `OCIIntegrationApi.CreateTenancyConfig`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `OCIIntegrationApi.CreateTenancyConfig`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Create tenancy config returns "Created" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.OciIntegrationApi;
import com.datadog.api.client.v2.model.AuthCredentials;
import com.datadog.api.client.v2.model.CreateTenancyConfig;
import com.datadog.api.client.v2.model.CreateTenancyConfigData;
import com.datadog.api.client.v2.model.CreateTenancyConfigDataAttributes;
import com.datadog.api.client.v2.model.CreateTenancyConfigDataType;
import com.datadog.api.client.v2.model.OCILogsConfig;
import com.datadog.api.client.v2.model.OCIMetricsConfig;
import com.datadog.api.client.v2.model.TenancyConfig;
import java.util.Arrays;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    OciIntegrationApi apiInstance = new OciIntegrationApi(defaultClient);

    CreateTenancyConfig body =
        new CreateTenancyConfig()
            .data(
                new CreateTenancyConfigData()
                    .attributes(
                        new CreateTenancyConfigDataAttributes()
                            .authCredentials(
                                new AuthCredentials()
                                    .fingerprint("a7:b5:54:f2:da:a2:d7:b0:ed:f4:79:47:93:64:12:b1")
                                    .privateKey(
                                        """
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCmMo2jwJXWTt0y
k+X6biZycflZSwOAP/iNeAZPTWwhYxj9pxDvd5OfiIe+o/7eupk/3q+fRsSaztPn
JwI/JnbQz5IT5miLi/apIozg870FFxjrgRxSGjo7BNH0dLKITc5nLDLBnOEzxR2Y
k9+0dFaiNlcodFULlg75trqbILRSc6jn9Tp9G8C5e9cj+LYQuUu2JwIqhCJqcNcU
t+lRL5odBJhZ85KlugKyUg6LN3VQIdOpTtPBMXYA1oBgDCbe5Rw5yzgnd0KtSFf3
GOmLfR95gQshLfbGavLOTh9ioaOj/2hT9HrsEe1VWgX3m1WibqKiPc4OA4BGGToN
9tzN/t89AgMBAAECggEAVFKD4JherXwX6Ih3f6cRZLGFBJP1s8VBM225LdUnTo07
6b4w7n6p7KBV1xjXwGPGS0yNqG88YxsbEkWNc0Ltt6YJBIW7d0nNHSVFewDPX1zH
rP01xEZAUx9v8uqehl+LoHchTXBuJlkVWgt0zdbU+bo+YG0dlSJOeM4IQZrHQqlQ
e4PNk73rot9NSqiKQFXUroaoVPTkUHb3idpLX60K3MgIBoAm4DpJ6cMItb4hyHv5
pNZhHQbr9Eciz2tj+OhQTYKCrAd0gJgl0tC+6L3kzkmiYE3ceGphqWfI9bX52Y96
wpgAtYi6o8wTykgRLabLc6vSQ9RegWEh7P8iSAvAlQKBgQDX5wJhYeWDdG4uPqLC
X3EtnR3y5zYgOd7cVtMr1DIvXa4I8PSIOC4Wnb/5A1S03dJ2e8GJ/qSbl5R2fsDr
XhjIm/KeBPI9p2dVZM8fPoWppR3SgDaHY5qxAED111DnEZuTMl5BO87QZXurTSiF
fbGsWaVqdVieRAQ3b5DEkC9TSwKBgQDFEFgui7iyPhQaQafsjnVbWyrWF821xjTG
b6Bo4FO97c9pw/tbkpfM+dcOU4SsZL8HjwGBUhUsDsVOX7m/sWRjZqNM5t/VR+52
9ygIPEjNyh0b3aARgn8AQ8n+RZvl1Z2A32KCO3MFzhpVKnv2sdSc1TNHQkuJH/rq
eUAm3El6lwKBgQCK8w+jIOAXRB2NAZ66PbaXRqD5rTg2cUguwmpRsNVDiqTw+DJI
YO+4enoMhspDROeofWlHqGzD/j/8KwN59ys4ILV6YXCNoWltmd17HD/luHCDAyUU
6VOrSqCEF7jnnXtktmvWy+kEUevPiW7kyspIQ8GjzDXmVZvpGZIwDyOGFQKBgGtS
l3PiDFimjnQuRbIDc86pPA8VL6dLpvpbWNVFNtY9abSEU6RvldTATGs0+RCaXZ9U
NtGjTnyMHtCsOZE4nx+zikQbiNOzNR/9QwQZMN1Csc+3R7HBjEEsqhmc92aYjArf
ndqnXeFPee/gD1svRkeTpTWt2U146UJBfrqrRilJAoGAQp7FtEtps5I9xK92AVpD
Hj2p1JNKzLCRtWQ8j4jthKqR0iTQ9SwQyjiAvcKc7HdMaG11gmr5XbmKAzelVC+f
o9kEwoumo8yHVn5Ztp4F2cxaD6+MzSJ/I6WesPyePUD7sPeorXByg1UNOXyzqDub
/aU4/sNo2f8epM9l7QGiCtY=
-----END PRIVATE KEY-----
"""))
                            .configVersion(2L)
                            .homeRegion("us-ashburn-1")
                            .logsConfig(
                                new OCILogsConfig()
                                    .compartmentTagFilters(
                                        Arrays.asList("datadog:true", "env:prod"))
                                    .enabled(true)
                                    .enabledServices(
                                        Collections.singletonList("oacnativeproduction")))
                            .metricsConfig(
                                new OCIMetricsConfig()
                                    .compartmentTagFilters(
                                        Arrays.asList("datadog:true", "env:prod"))
                                    .enabled(true)
                                    .excludedServices(Collections.singletonList("oci_compute")))
                            .resourceCollectionEnabled(true)
                            .userOcid("ocid1.user.test"))
                    .id("ocid1.tenancy.dummy_value")
                    .type(CreateTenancyConfigDataType.OCI_TENANCY));

    try {
      TenancyConfig result = apiInstance.createTenancyConfig(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling OciIntegrationApi#createTenancyConfig");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
// Create tenancy config returns "Created" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_oci_integration::OCIIntegrationAPI;
use datadog_api_client::datadogV2::model::AuthCredentials;
use datadog_api_client::datadogV2::model::CreateTenancyConfig;
use datadog_api_client::datadogV2::model::CreateTenancyConfigData;
use datadog_api_client::datadogV2::model::CreateTenancyConfigDataAttributes;
use datadog_api_client::datadogV2::model::CreateTenancyConfigDataType;
use datadog_api_client::datadogV2::model::LogsConfig;
use datadog_api_client::datadogV2::model::MetricsConfig;

#[tokio::main]
async fn main() {
    let body = CreateTenancyConfig::new().data(
        CreateTenancyConfigData::new(
            "ocid1.tenancy.dummy_value".to_string(),
            CreateTenancyConfigDataType::OCI_TENANCY,
        )
        .attributes(
            CreateTenancyConfigDataAttributes::new(
                AuthCredentials::new(
                    "a7:b5:54:f2:da:a2:d7:b0:ed:f4:79:47:93:64:12:b1".to_string(),
                    r#"-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCmMo2jwJXWTt0y
k+X6biZycflZSwOAP/iNeAZPTWwhYxj9pxDvd5OfiIe+o/7eupk/3q+fRsSaztPn
JwI/JnbQz5IT5miLi/apIozg870FFxjrgRxSGjo7BNH0dLKITc5nLDLBnOEzxR2Y
k9+0dFaiNlcodFULlg75trqbILRSc6jn9Tp9G8C5e9cj+LYQuUu2JwIqhCJqcNcU
t+lRL5odBJhZ85KlugKyUg6LN3VQIdOpTtPBMXYA1oBgDCbe5Rw5yzgnd0KtSFf3
GOmLfR95gQshLfbGavLOTh9ioaOj/2hT9HrsEe1VWgX3m1WibqKiPc4OA4BGGToN
9tzN/t89AgMBAAECggEAVFKD4JherXwX6Ih3f6cRZLGFBJP1s8VBM225LdUnTo07
6b4w7n6p7KBV1xjXwGPGS0yNqG88YxsbEkWNc0Ltt6YJBIW7d0nNHSVFewDPX1zH
rP01xEZAUx9v8uqehl+LoHchTXBuJlkVWgt0zdbU+bo+YG0dlSJOeM4IQZrHQqlQ
e4PNk73rot9NSqiKQFXUroaoVPTkUHb3idpLX60K3MgIBoAm4DpJ6cMItb4hyHv5
pNZhHQbr9Eciz2tj+OhQTYKCrAd0gJgl0tC+6L3kzkmiYE3ceGphqWfI9bX52Y96
wpgAtYi6o8wTykgRLabLc6vSQ9RegWEh7P8iSAvAlQKBgQDX5wJhYeWDdG4uPqLC
X3EtnR3y5zYgOd7cVtMr1DIvXa4I8PSIOC4Wnb/5A1S03dJ2e8GJ/qSbl5R2fsDr
XhjIm/KeBPI9p2dVZM8fPoWppR3SgDaHY5qxAED111DnEZuTMl5BO87QZXurTSiF
fbGsWaVqdVieRAQ3b5DEkC9TSwKBgQDFEFgui7iyPhQaQafsjnVbWyrWF821xjTG
b6Bo4FO97c9pw/tbkpfM+dcOU4SsZL8HjwGBUhUsDsVOX7m/sWRjZqNM5t/VR+52
9ygIPEjNyh0b3aARgn8AQ8n+RZvl1Z2A32KCO3MFzhpVKnv2sdSc1TNHQkuJH/rq
eUAm3El6lwKBgQCK8w+jIOAXRB2NAZ66PbaXRqD5rTg2cUguwmpRsNVDiqTw+DJI
YO+4enoMhspDROeofWlHqGzD/j/8KwN59ys4ILV6YXCNoWltmd17HD/luHCDAyUU
6VOrSqCEF7jnnXtktmvWy+kEUevPiW7kyspIQ8GjzDXmVZvpGZIwDyOGFQKBgGtS
l3PiDFimjnQuRbIDc86pPA8VL6dLpvpbWNVFNtY9abSEU6RvldTATGs0+RCaXZ9U
NtGjTnyMHtCsOZE4nx+zikQbiNOzNR/9QwQZMN1Csc+3R7HBjEEsqhmc92aYjArf
ndqnXeFPee/gD1svRkeTpTWt2U146UJBfrqrRilJAoGAQp7FtEtps5I9xK92AVpD
Hj2p1JNKzLCRtWQ8j4jthKqR0iTQ9SwQyjiAvcKc7HdMaG11gmr5XbmKAzelVC+f
o9kEwoumo8yHVn5Ztp4F2cxaD6+MzSJ/I6WesPyePUD7sPeorXByg1UNOXyzqDub
/aU4/sNo2f8epM9l7QGiCtY=
-----END PRIVATE KEY-----"#
                        .to_string(),
                ),
                "us-ashburn-1".to_string(),
                "ocid1.user.test".to_string(),
            )
            .config_version(2)
            .logs_config(
                LogsConfig::new()
                    .compartment_tag_filters(vec![
                        "datadog:true".to_string(),
                        "env:prod".to_string(),
                    ])
                    .enabled(true)
                    .enabled_services(vec!["oacnativeproduction".to_string()]),
            )
            .metrics_config(
                MetricsConfig::new()
                    .compartment_tag_filters(vec![
                        "datadog:true".to_string(),
                        "env:prod".to_string(),
                    ])
                    .enabled(true)
                    .excluded_services(vec!["oci_compute".to_string()]),
            )
            .resource_collection_enabled(true),
        ),
    );
    let configuration = datadog::Configuration::new();
    let api = OCIIntegrationAPI::with_config(configuration);
    let resp = api.create_tenancy_config(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
/**
 * Create tenancy config returns "Created" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.OCIIntegrationApi(configuration);

const params: v2.OCIIntegrationApiCreateTenancyConfigRequest = {
  body: {
    data: {
      attributes: {
        authCredentials: {
          fingerprint: "a7:b5:54:f2:da:a2:d7:b0:ed:f4:79:47:93:64:12:b1",
          privateKey:
            "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCmMo2jwJXWTt0y\nk+X6biZycflZSwOAP/iNeAZPTWwhYxj9pxDvd5OfiIe+o/7eupk/3q+fRsSaztPn\nJwI/JnbQz5IT5miLi/apIozg870FFxjrgRxSGjo7BNH0dLKITc5nLDLBnOEzxR2Y\nk9+0dFaiNlcodFULlg75trqbILRSc6jn9Tp9G8C5e9cj+LYQuUu2JwIqhCJqcNcU\nt+lRL5odBJhZ85KlugKyUg6LN3VQIdOpTtPBMXYA1oBgDCbe5Rw5yzgnd0KtSFf3\nGOmLfR95gQshLfbGavLOTh9ioaOj/2hT9HrsEe1VWgX3m1WibqKiPc4OA4BGGToN\n9tzN/t89AgMBAAECggEAVFKD4JherXwX6Ih3f6cRZLGFBJP1s8VBM225LdUnTo07\n6b4w7n6p7KBV1xjXwGPGS0yNqG88YxsbEkWNc0Ltt6YJBIW7d0nNHSVFewDPX1zH\nrP01xEZAUx9v8uqehl+LoHchTXBuJlkVWgt0zdbU+bo+YG0dlSJOeM4IQZrHQqlQ\ne4PNk73rot9NSqiKQFXUroaoVPTkUHb3idpLX60K3MgIBoAm4DpJ6cMItb4hyHv5\npNZhHQbr9Eciz2tj+OhQTYKCrAd0gJgl0tC+6L3kzkmiYE3ceGphqWfI9bX52Y96\nwpgAtYi6o8wTykgRLabLc6vSQ9RegWEh7P8iSAvAlQKBgQDX5wJhYeWDdG4uPqLC\nX3EtnR3y5zYgOd7cVtMr1DIvXa4I8PSIOC4Wnb/5A1S03dJ2e8GJ/qSbl5R2fsDr\nXhjIm/KeBPI9p2dVZM8fPoWppR3SgDaHY5qxAED111DnEZuTMl5BO87QZXurTSiF\nfbGsWaVqdVieRAQ3b5DEkC9TSwKBgQDFEFgui7iyPhQaQafsjnVbWyrWF821xjTG\nb6Bo4FO97c9pw/tbkpfM+dcOU4SsZL8HjwGBUhUsDsVOX7m/sWRjZqNM5t/VR+52\n9ygIPEjNyh0b3aARgn8AQ8n+RZvl1Z2A32KCO3MFzhpVKnv2sdSc1TNHQkuJH/rq\neUAm3El6lwKBgQCK8w+jIOAXRB2NAZ66PbaXRqD5rTg2cUguwmpRsNVDiqTw+DJI\nYO+4enoMhspDROeofWlHqGzD/j/8KwN59ys4ILV6YXCNoWltmd17HD/luHCDAyUU\n6VOrSqCEF7jnnXtktmvWy+kEUevPiW7kyspIQ8GjzDXmVZvpGZIwDyOGFQKBgGtS\nl3PiDFimjnQuRbIDc86pPA8VL6dLpvpbWNVFNtY9abSEU6RvldTATGs0+RCaXZ9U\nNtGjTnyMHtCsOZE4nx+zikQbiNOzNR/9QwQZMN1Csc+3R7HBjEEsqhmc92aYjArf\nndqnXeFPee/gD1svRkeTpTWt2U146UJBfrqrRilJAoGAQp7FtEtps5I9xK92AVpD\nHj2p1JNKzLCRtWQ8j4jthKqR0iTQ9SwQyjiAvcKc7HdMaG11gmr5XbmKAzelVC+f\no9kEwoumo8yHVn5Ztp4F2cxaD6+MzSJ/I6WesPyePUD7sPeorXByg1UNOXyzqDub\n/aU4/sNo2f8epM9l7QGiCtY=\n-----END PRIVATE KEY-----",
        },
        configVersion: 2,
        homeRegion: "us-ashburn-1",
        logsConfig: {
          compartmentTagFilters: ["datadog:true", "env:prod"],
          enabled: true,
          enabledServices: ["oacnativeproduction"],
        },
        metricsConfig: {
          compartmentTagFilters: ["datadog:true", "env:prod"],
          enabled: true,
          excludedServices: ["oci_compute"],
        },
        resourceCollectionEnabled: true,
        userOcid: "ocid1.user.test",
      },
      id: "ocid1.tenancy.dummy_value",
      type: "oci_tenancy",
    },
  },
};

apiInstance
  .createTenancyConfig(params)
  .then((data: v2.TenancyConfig) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

PATCH https://api.ap1.datadoghq.com/api/v2/integration/oci/tenancies/{tenancy_ocid}https://api.datadoghq.eu/api/v2/integration/oci/tenancies/{tenancy_ocid}https://api.ddog-gov.com/api/v2/integration/oci/tenancies/{tenancy_ocid}https://api.datadoghq.com/api/v2/integration/oci/tenancies/{tenancy_ocid}https://api.us3.datadoghq.com/api/v2/integration/oci/tenancies/{tenancy_ocid}https://api.us5.datadoghq.com/api/v2/integration/oci/tenancies/{tenancy_ocid}

概要

Update an existing tenancy config. This endpoint requires the oci_configuration_edit permission.

引数

パスパラメーター

名前

種類

説明

tenancy_ocid [required]

string

Unique tenancy OCID of the OCI integration config.

リクエスト

Body Data (required)

Expand All

フィールド

種類

説明

data

object

The definition of UpdateTenancyConfigData object.

attributes

object

The definition of UpdateTenancyConfigDataAttributes object.

auth_credentials

object

The auth credentials of the user. Consists of a public key fingerprint and private key.

fingerprint [required]

string

The public key fingerprint.

private_key [required]

string

The RSA private key in PEM format.

home_region

string

The home region of the tenancy to be integrated.

logs_config

object

The definition of OCILogsConfig object.

compartment_tag_filters

[string]

The compartment tag filters to apply to log collection. Each value represents a Datadog tag in the format key:value.

enabled

boolean

Enable or disable log collection. Disabled by default.

enabled_services

[string]

The list of services to enable for log collection.

metrics_config

object

The definition of OCIMetricsConfig object.

compartment_tag_filters

[string]

The compartment tag filters to apply to metric collection. Each value represents a Datadog tag in the format key:value.

enabled

boolean

Enable or disable metric collection. Enabled by default for all services.

excluded_services

[string]

The list of services to exclude from metric collection.

resource_collection_enabled

boolean

Enable or disable resource collection.

user_ocid

string

The OCID of the user needed to authenticate and collect data.

id [required]

string

The OCID of the tenancy to be integrated.

type [required]

enum

OCI tenancy resource type. Allowed enum values: oci_tenancy

default: oci_tenancy

{
  "data": {
    "attributes": {
      "home_region": "us-sanjose-1",
      "metrics_config": {
        "compartment_tag_filters": [
          "datadog:true",
          "env:prod"
        ],
        "enabled": false,
        "excluded_services": []
      },
      "resource_collection_enabled": false,
      "user_ocid": "ocid1.user.test_updated"
    },
    "id": "string",
    "type": "oci_tenancy"
  }
}

応答

OK

The definition of TenancyConfig object.

Expand All

フィールド

種類

説明

data

object

The definition of TenancyConfigData object.

attributes

object

The definition of TenancyConfigDataAttributes object.

config_version

int64

The config version. It is not recommended to add or change this value, as it is determined internally.

cost_collection_enabled

boolean

Enable or disable cost collection.

home_region

string

The home region of the tenancy to be integrated.

logs_config

object

The definition of OCILogsConfig object.

compartment_tag_filters

[string]

The compartment tag filters to apply to log collection. Each value represents a Datadog tag in the format key:value.

enabled

boolean

Enable or disable log collection. Disabled by default.

enabled_services

[string]

The list of services to enable for log collection.

metrics_config

object

The definition of OCIMetricsConfig object.

compartment_tag_filters

[string]

The compartment tag filters to apply to metric collection. Each value represents a Datadog tag in the format key:value.

enabled

boolean

Enable or disable metric collection. Enabled by default for all services.

excluded_services

[string]

The list of services to exclude from metric collection.

resource_collection_enabled

boolean

Enable or disable resource collection.

tenancy_name

string

The attribute's tenancy_name.

user_ocid

string

The OCID of the user needed to authenticate and collect data.

id

string

The OCID of the tenancy config.

type [required]

enum

OCI tenancy resource type. Allowed enum values: oci_tenancy

default: oci_tenancy

{
  "data": {
    "attributes": {
      "config_version": "integer",
      "cost_collection_enabled": false,
      "home_region": "string",
      "logs_config": {
        "compartment_tag_filters": [],
        "enabled": false,
        "enabled_services": []
      },
      "metrics_config": {
        "compartment_tag_filters": [],
        "enabled": false,
        "excluded_services": []
      },
      "resource_collection_enabled": false,
      "tenancy_name": "string",
      "user_ocid": "string"
    },
    "id": "string",
    "type": "oci_tenancy"
  }
}

Bad Request

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

コード例

                          # Path parameters
export tenancy_ocid="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/integration/oci/tenancies/${tenancy_ocid}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "home_region": "us-sanjose-1", "metrics_config": { "compartment_tag_filters": [ "datadog:true", "env:prod" ], "enabled": false, "excluded_services": [] }, "resource_collection_enabled": false, "user_ocid": "ocid1.user.test_updated" }, "id": "string", "type": "oci_tenancy" } } EOF
// Update tenancy config returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "oci_tenancy" resource in the system
	OciTenancyDataID := os.Getenv("OCI_TENANCY_DATA_ID")

	body := datadogV2.UpdateTenancyConfig{
		Data: &datadogV2.UpdateTenancyConfigData{
			Attributes: &datadogV2.UpdateTenancyConfigDataAttributes{
				HomeRegion: datadog.PtrString("us-sanjose-1"),
				MetricsConfig: &datadogV2.OCIMetricsConfig{
					CompartmentTagFilters: []string{
						"datadog:true",
						"env:prod",
					},
					Enabled:          datadog.PtrBool(false),
					ExcludedServices: []string{},
				},
				ResourceCollectionEnabled: datadog.PtrBool(false),
				UserOcid:                  datadog.PtrString("ocid1.user.test_updated"),
			},
			Id:   OciTenancyDataID,
			Type: datadogV2.UPDATETENANCYCONFIGDATATYPE_OCI_TENANCY,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewOCIIntegrationApi(apiClient)
	resp, r, err := api.UpdateTenancyConfig(ctx, OciTenancyDataID, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `OCIIntegrationApi.UpdateTenancyConfig`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `OCIIntegrationApi.UpdateTenancyConfig`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Update tenancy config returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.OciIntegrationApi;
import com.datadog.api.client.v2.model.OCIMetricsConfig;
import com.datadog.api.client.v2.model.TenancyConfig;
import com.datadog.api.client.v2.model.UpdateTenancyConfig;
import com.datadog.api.client.v2.model.UpdateTenancyConfigData;
import com.datadog.api.client.v2.model.UpdateTenancyConfigDataAttributes;
import com.datadog.api.client.v2.model.UpdateTenancyConfigDataType;
import java.util.Arrays;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    OciIntegrationApi apiInstance = new OciIntegrationApi(defaultClient);

    // there is a valid "oci_tenancy" resource in the system
    String OCI_TENANCY_DATA_ID = System.getenv("OCI_TENANCY_DATA_ID");

    UpdateTenancyConfig body =
        new UpdateTenancyConfig()
            .data(
                new UpdateTenancyConfigData()
                    .attributes(
                        new UpdateTenancyConfigDataAttributes()
                            .homeRegion("us-sanjose-1")
                            .metricsConfig(
                                new OCIMetricsConfig()
                                    .compartmentTagFilters(
                                        Arrays.asList("datadog:true", "env:prod"))
                                    .enabled(false))
                            .resourceCollectionEnabled(false)
                            .userOcid("ocid1.user.test_updated"))
                    .id(OCI_TENANCY_DATA_ID)
                    .type(UpdateTenancyConfigDataType.OCI_TENANCY));

    try {
      TenancyConfig result = apiInstance.updateTenancyConfig(OCI_TENANCY_DATA_ID, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling OciIntegrationApi#updateTenancyConfig");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
"""
Update tenancy config returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.oci_integration_api import OCIIntegrationApi
from datadog_api_client.v2.model.oci_metrics_config import OCIMetricsConfig
from datadog_api_client.v2.model.update_tenancy_config import UpdateTenancyConfig
from datadog_api_client.v2.model.update_tenancy_config_data import UpdateTenancyConfigData
from datadog_api_client.v2.model.update_tenancy_config_data_attributes import UpdateTenancyConfigDataAttributes
from datadog_api_client.v2.model.update_tenancy_config_data_type import UpdateTenancyConfigDataType

# there is a valid "oci_tenancy" resource in the system
OCI_TENANCY_DATA_ID = environ["OCI_TENANCY_DATA_ID"]

body = UpdateTenancyConfig(
    data=UpdateTenancyConfigData(
        attributes=UpdateTenancyConfigDataAttributes(
            home_region="us-sanjose-1",
            metrics_config=OCIMetricsConfig(
                compartment_tag_filters=[
                    "datadog:true",
                    "env:prod",
                ],
                enabled=False,
                excluded_services=[],
            ),
            resource_collection_enabled=False,
            user_ocid="ocid1.user.test_updated",
        ),
        id=OCI_TENANCY_DATA_ID,
        type=UpdateTenancyConfigDataType.OCI_TENANCY,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = OCIIntegrationApi(api_client)
    response = api_instance.update_tenancy_config(tenancy_ocid=OCI_TENANCY_DATA_ID, body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Update tenancy config returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::OCIIntegrationAPI.new

# there is a valid "oci_tenancy" resource in the system
OCI_TENANCY_DATA_ID = ENV["OCI_TENANCY_DATA_ID"]

body = DatadogAPIClient::V2::UpdateTenancyConfig.new({
  data: DatadogAPIClient::V2::UpdateTenancyConfigData.new({
    attributes: DatadogAPIClient::V2::UpdateTenancyConfigDataAttributes.new({
      home_region: "us-sanjose-1",
      metrics_config: DatadogAPIClient::V2::OCIMetricsConfig.new({
        compartment_tag_filters: [
          "datadog:true",
          "env:prod",
        ],
        enabled: false,
        excluded_services: [],
      }),
      resource_collection_enabled: false,
      user_ocid: "ocid1.user.test_updated",
    }),
    id: OCI_TENANCY_DATA_ID,
    type: DatadogAPIClient::V2::UpdateTenancyConfigDataType::OCI_TENANCY,
  }),
})
p api_instance.update_tenancy_config(OCI_TENANCY_DATA_ID, body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Update tenancy config returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_oci_integration::OCIIntegrationAPI;
use datadog_api_client::datadogV2::model::MetricsConfig;
use datadog_api_client::datadogV2::model::UpdateTenancyConfig;
use datadog_api_client::datadogV2::model::UpdateTenancyConfigData;
use datadog_api_client::datadogV2::model::UpdateTenancyConfigDataAttributes;
use datadog_api_client::datadogV2::model::UpdateTenancyConfigDataType;

#[tokio::main]
async fn main() {
    // there is a valid "oci_tenancy" resource in the system
    let oci_tenancy_data_id = std::env::var("OCI_TENANCY_DATA_ID").unwrap();
    let body = UpdateTenancyConfig::new().data(
        UpdateTenancyConfigData::new(
            oci_tenancy_data_id.clone(),
            UpdateTenancyConfigDataType::OCI_TENANCY,
        )
        .attributes(
            UpdateTenancyConfigDataAttributes::new()
                .home_region("us-sanjose-1".to_string())
                .metrics_config(
                    MetricsConfig::new()
                        .compartment_tag_filters(vec![
                            "datadog:true".to_string(),
                            "env:prod".to_string(),
                        ])
                        .enabled(false)
                        .excluded_services(vec![]),
                )
                .resource_collection_enabled(false)
                .user_ocid("ocid1.user.test_updated".to_string()),
        ),
    );
    let configuration = datadog::Configuration::new();
    let api = OCIIntegrationAPI::with_config(configuration);
    let resp = api
        .update_tenancy_config(oci_tenancy_data_id.clone(), body)
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
/**
 * Update tenancy config returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.OCIIntegrationApi(configuration);

// there is a valid "oci_tenancy" resource in the system
const OCI_TENANCY_DATA_ID = process.env.OCI_TENANCY_DATA_ID as string;

const params: v2.OCIIntegrationApiUpdateTenancyConfigRequest = {
  body: {
    data: {
      attributes: {
        homeRegion: "us-sanjose-1",
        metricsConfig: {
          compartmentTagFilters: ["datadog:true", "env:prod"],
          enabled: false,
          excludedServices: [],
        },
        resourceCollectionEnabled: false,
        userOcid: "ocid1.user.test_updated",
      },
      id: OCI_TENANCY_DATA_ID,
      type: "oci_tenancy",
    },
  },
  tenancyOcid: OCI_TENANCY_DATA_ID,
};

apiInstance
  .updateTenancyConfig(params)
  .then((data: v2.TenancyConfig) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

DELETE https://api.ap1.datadoghq.com/api/v2/integration/oci/tenancies/{tenancy_ocid}https://api.datadoghq.eu/api/v2/integration/oci/tenancies/{tenancy_ocid}https://api.ddog-gov.com/api/v2/integration/oci/tenancies/{tenancy_ocid}https://api.datadoghq.com/api/v2/integration/oci/tenancies/{tenancy_ocid}https://api.us3.datadoghq.com/api/v2/integration/oci/tenancies/{tenancy_ocid}https://api.us5.datadoghq.com/api/v2/integration/oci/tenancies/{tenancy_ocid}

概要

Delete an existing tenancy config. This endpoint requires the oci_configurations_manage permission.

引数

パスパラメーター

名前

種類

説明

tenancy_ocid [required]

string

Unique tenancy OCID of the OCI integration config.

応答

No Content

Forbidden

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

コード例

                  # Path parameters
export tenancy_ocid="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/integration/oci/tenancies/${tenancy_ocid}" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Delete tenancy config returns "No Content" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.oci_integration_api import OCIIntegrationApi

# there is a valid "oci_tenancy" resource in the system
OCI_TENANCY_DATA_ID = environ["OCI_TENANCY_DATA_ID"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = OCIIntegrationApi(api_client)
    api_instance.delete_tenancy_config(
        tenancy_ocid=OCI_TENANCY_DATA_ID,
    )

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Delete tenancy config returns "No Content" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::OCIIntegrationAPI.new

# there is a valid "oci_tenancy" resource in the system
OCI_TENANCY_DATA_ID = ENV["OCI_TENANCY_DATA_ID"]
api_instance.delete_tenancy_config(OCI_TENANCY_DATA_ID)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Delete tenancy config returns "No Content" response

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "oci_tenancy" resource in the system
	OciTenancyDataID := os.Getenv("OCI_TENANCY_DATA_ID")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewOCIIntegrationApi(apiClient)
	r, err := api.DeleteTenancyConfig(ctx, OciTenancyDataID)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `OCIIntegrationApi.DeleteTenancyConfig`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Delete tenancy config returns "No Content" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.OciIntegrationApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    OciIntegrationApi apiInstance = new OciIntegrationApi(defaultClient);

    // there is a valid "oci_tenancy" resource in the system
    String OCI_TENANCY_DATA_ID = System.getenv("OCI_TENANCY_DATA_ID");

    try {
      apiInstance.deleteTenancyConfig(OCI_TENANCY_DATA_ID);
    } catch (ApiException e) {
      System.err.println("Exception when calling OciIntegrationApi#deleteTenancyConfig");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
// Delete tenancy config returns "No Content" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_oci_integration::OCIIntegrationAPI;

#[tokio::main]
async fn main() {
    // there is a valid "oci_tenancy" resource in the system
    let oci_tenancy_data_id = std::env::var("OCI_TENANCY_DATA_ID").unwrap();
    let configuration = datadog::Configuration::new();
    let api = OCIIntegrationAPI::with_config(configuration);
    let resp = api.delete_tenancy_config(oci_tenancy_data_id.clone()).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
/**
 * Delete tenancy config returns "No Content" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.OCIIntegrationApi(configuration);

// there is a valid "oci_tenancy" resource in the system
const OCI_TENANCY_DATA_ID = process.env.OCI_TENANCY_DATA_ID as string;

const params: v2.OCIIntegrationApiDeleteTenancyConfigRequest = {
  tenancyOcid: OCI_TENANCY_DATA_ID,
};

apiInstance
  .deleteTenancyConfig(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

PREVIEWING: datadog-api-spec/generated/3826