AuthN Mappings

AuthN Mappings API is used to automatically map group of users to roles in Datadog using attributes sent from Identity Providers.

GET https://api.datadoghq.eu/api/v2/authn_mappings/{authn_mapping_id}https://api.ddog-gov.com/api/v2/authn_mappings/{authn_mapping_id}https://api.datadoghq.com/api/v2/authn_mappings/{authn_mapping_id}https://api.us3.datadoghq.com/api/v2/authn_mappings/{authn_mapping_id}https://api.us5.datadoghq.com/api/v2/authn_mappings/{authn_mapping_id}

概要

Get an AuthN Mapping specified by the AuthN Mapping UUID.

引数

パスパラメーター

名前

種類

説明

authn_mapping_id [required]

string

The UUID of the AuthN Mapping.

応答

OK

AuthN Mapping response from the API.

Expand All

フィールド

種類

説明

data

object

The AuthN Mapping object returned by API.

attributes

object

Attributes of AuthN Mapping.

attribute_key

string

Key portion of a key/value pair of the attribute sent from the Identity Provider.

attribute_value

string

Value portion of a key/value pair of the attribute sent from the Identity Provider.

created_at

date-time

Creation time of the AuthN Mapping.

modified_at

date-time

Time of last AuthN Mapping modification.

saml_assertion_attribute_id

string

The ID of the SAML assertion attribute.

id [required]

string

ID of the AuthN Mapping.

relationships

object

All relationships associated with AuthN Mapping.

role

object

Relationship to role.

data

object

Relationship to role object.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

saml_assertion_attribute

object

AuthN Mapping relationship to SAML Assertion Attribute.

data [required]

object

Data of AuthN Mapping relationship to SAML Assertion Attribute.

id [required]

string

The ID of the SAML assertion attribute.

type [required]

enum

SAML assertion attributes resource type. Allowed enum values: saml_assertion_attributes

type [required]

enum

AuthN Mappings resource type. Allowed enum values: authn_mappings

included

[object <oneOf>]

Included data in the AuthN Mapping response.

Option 1

object

SAML assertion attribute.

attributes

object

Key/Value pair of attributes used in SAML assertion attributes.

attribute_key

string

Key portion of a key/value pair of the attribute sent from the Identity Provider.

attribute_value

string

Value portion of a key/value pair of the attribute sent from the Identity Provider.

id [required]

string

The ID of the SAML assertion attribute.

type [required]

enum

SAML assertion attributes resource type. Allowed enum values: saml_assertion_attributes

Option 2

object

Role object returned by the API.

attributes

object

Attributes of the role.

created_at

date-time

Creation time of the role.

modified_at

date-time

Time of last role modification.

name

string

The name of the role. The name is neither unique nor a stable identifier of the role.

user_count

int64

Number of users with that role.

id

string

The unique identifier of the role.

relationships

object

Relationships of the role object returned by the API.

permissions

object

Relationship to multiple permissions objects.

data

[object]

Relationships to permission objects.

id

string

ID of the permission.

type

enum

Permissions resource type. Allowed enum values: permissions

type [required]

enum

Roles type. Allowed enum values: roles

{
  "data": {
    "attributes": {
      "attribute_key": "member-of",
      "attribute_value": "Development",
      "created_at": "2019-09-19T10:00:00.000Z",
      "modified_at": "2019-09-19T10:00:00.000Z",
      "saml_assertion_attribute_id": "0"
    },
    "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
    "relationships": {
      "role": {
        "data": {
          "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
          "type": "roles"
        }
      },
      "saml_assertion_attribute": {
        "data": {
          "id": "0",
          "type": "saml_assertion_attributes"
        }
      }
    },
    "type": "authn_mappings"
  },
  "included": [
    {
      "attributes": {
        "attribute_key": "member-of",
        "attribute_value": "Development"
      },
      "id": "0",
      "type": "saml_assertion_attributes"
    }
  ]
}

Authentication Error

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 authn_mapping_id="CHANGE_ME"
# Curl command curl -X GET "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/authn_mappings/${authn_mapping_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
// Get an AuthN Mapping by UUID returns "OK" response

package main

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

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

func main() {
	// there is a valid "authn_mapping" in the system
	AuthnMappingDataID := os.Getenv("AUTHN_MAPPING_DATA_ID")

	ctx := common.NewDefaultContext(context.Background())
	configuration := common.NewConfiguration()
	apiClient := common.NewAPIClient(configuration)
	api := datadog.NewAuthNMappingsApi(apiClient)
	resp, r, err := api.GetAuthNMapping(ctx, AuthnMappingDataID)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `AuthNMappingsApi.GetAuthNMapping`:\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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get an AuthN Mapping by UUID returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.AuthNMappingsApi;
import com.datadog.api.client.v2.model.AuthNMappingResponse;

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

    // there is a valid "authn_mapping" in the system
    String AUTHN_MAPPING_DATA_ID = System.getenv("AUTHN_MAPPING_DATA_ID");

    try {
      AuthNMappingResponse result = apiInstance.getAuthNMapping(AUTHN_MAPPING_DATA_ID);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AuthNMappingsApi#getAuthNMapping");
      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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Get an AuthN Mapping by UUID returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.authn_mappings_api import AuthNMappingsApi

# there is a valid "authn_mapping" in the system
AUTHN_MAPPING_DATA_ID = environ["AUTHN_MAPPING_DATA_ID"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = AuthNMappingsApi(api_client)
    response = api_instance.get_authn_mapping(
        authn_mapping_id=AUTHN_MAPPING_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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get an AuthN Mapping by UUID returns "OK" response

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

# there is a valid "authn_mapping" in the system
AUTHN_MAPPING_DATA_ID = ENV["AUTHN_MAPPING_DATA_ID"]
p api_instance.get_authn_mapping(AUTHN_MAPPING_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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * Get an AuthN Mapping by UUID returns "OK" response
 */

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

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

// there is a valid "authn_mapping" in the system
const AUTHN_MAPPING_DATA_ID = process.env.AUTHN_MAPPING_DATA_ID as string;

const params: v2.AuthNMappingsApiGetAuthNMappingRequest = {
  authnMappingId: AUTHN_MAPPING_DATA_ID,
};

apiInstance
  .getAuthNMapping(params)
  .then((data: v2.AuthNMappingResponse) => {
    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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

PATCH https://api.datadoghq.eu/api/v2/authn_mappings/{authn_mapping_id}https://api.ddog-gov.com/api/v2/authn_mappings/{authn_mapping_id}https://api.datadoghq.com/api/v2/authn_mappings/{authn_mapping_id}https://api.us3.datadoghq.com/api/v2/authn_mappings/{authn_mapping_id}https://api.us5.datadoghq.com/api/v2/authn_mappings/{authn_mapping_id}

概要

Edit an AuthN Mapping. This endpoint requires the user_access_manage authorization scope.

引数

パスパラメーター

名前

種類

説明

authn_mapping_id [required]

string

The UUID of the AuthN Mapping.

リクエスト

Body Data (required)

Expand All

フィールド

種類

説明

data [required]

object

Data for updating an AuthN Mapping.

attributes

object

Key/Value pair of attributes used for update request.

attribute_key

string

Key portion of a key/value pair of the attribute sent from the Identity Provider.

attribute_value

string

Value portion of a key/value pair of the attribute sent from the Identity Provider.

id [required]

string

ID of the AuthN Mapping.

relationships

object

Relationship of AuthN Mapping update object to Role.

role

object

Relationship to role.

data

object

Relationship to role object.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

type [required]

enum

AuthN Mappings resource type. Allowed enum values: authn_mappings

{
  "data": {
    "attributes": {
      "attribute_key": "member-of",
      "attribute_value": "Development"
    },
    "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
    "relationships": {
      "role": {
        "data": {
          "id": "string",
          "type": "roles"
        }
      }
    },
    "type": "authn_mappings"
  }
}

応答

OK

AuthN Mapping response from the API.

Expand All

フィールド

種類

説明

data

object

The AuthN Mapping object returned by API.

attributes

object

Attributes of AuthN Mapping.

attribute_key

string

Key portion of a key/value pair of the attribute sent from the Identity Provider.

attribute_value

string

Value portion of a key/value pair of the attribute sent from the Identity Provider.

created_at

date-time

Creation time of the AuthN Mapping.

modified_at

date-time

Time of last AuthN Mapping modification.

saml_assertion_attribute_id

string

The ID of the SAML assertion attribute.

id [required]

string

ID of the AuthN Mapping.

relationships

object

All relationships associated with AuthN Mapping.

role

object

Relationship to role.

data

object

Relationship to role object.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

saml_assertion_attribute

object

AuthN Mapping relationship to SAML Assertion Attribute.

data [required]

object

Data of AuthN Mapping relationship to SAML Assertion Attribute.

id [required]

string

The ID of the SAML assertion attribute.

type [required]

enum

SAML assertion attributes resource type. Allowed enum values: saml_assertion_attributes

type [required]

enum

AuthN Mappings resource type. Allowed enum values: authn_mappings

included

[object <oneOf>]

Included data in the AuthN Mapping response.

Option 1

object

SAML assertion attribute.

attributes

object

Key/Value pair of attributes used in SAML assertion attributes.

attribute_key

string

Key portion of a key/value pair of the attribute sent from the Identity Provider.

attribute_value

string

Value portion of a key/value pair of the attribute sent from the Identity Provider.

id [required]

string

The ID of the SAML assertion attribute.

type [required]

enum

SAML assertion attributes resource type. Allowed enum values: saml_assertion_attributes

Option 2

object

Role object returned by the API.

attributes

object

Attributes of the role.

created_at

date-time

Creation time of the role.

modified_at

date-time

Time of last role modification.

name

string

The name of the role. The name is neither unique nor a stable identifier of the role.

user_count

int64

Number of users with that role.

id

string

The unique identifier of the role.

relationships

object

Relationships of the role object returned by the API.

permissions

object

Relationship to multiple permissions objects.

data

[object]

Relationships to permission objects.

id

string

ID of the permission.

type

enum

Permissions resource type. Allowed enum values: permissions

type [required]

enum

Roles type. Allowed enum values: roles

{
  "data": {
    "attributes": {
      "attribute_key": "member-of",
      "attribute_value": "Development",
      "created_at": "2019-09-19T10:00:00.000Z",
      "modified_at": "2019-09-19T10:00:00.000Z",
      "saml_assertion_attribute_id": "0"
    },
    "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
    "relationships": {
      "role": {
        "data": {
          "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
          "type": "roles"
        }
      },
      "saml_assertion_attribute": {
        "data": {
          "id": "0",
          "type": "saml_assertion_attributes"
        }
      }
    },
    "type": "authn_mappings"
  },
  "included": [
    {
      "attributes": {
        "attribute_key": "member-of",
        "attribute_value": "Development"
      },
      "id": "0",
      "type": "saml_assertion_attributes"
    }
  ]
}

Bad Request

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Authentication Error

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"
  ]
}

Conflict

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Unprocessable Entity

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 authn_mapping_id="CHANGE_ME"
# Curl command curl -X PATCH "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/authn_mappings/${authn_mapping_id}" \ -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": { "attribute_key": "member-of", "attribute_value": "Development" }, "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "relationships": { "role": { "data": { "id": "string", "type": "roles" } } }, "type": "authn_mappings" } } EOF
// Edit an AuthN Mapping returns "OK" response

package main

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

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

func main() {
	// there is a valid "authn_mapping" in the system
	AuthnMappingDataID := os.Getenv("AUTHN_MAPPING_DATA_ID")

	// there is a valid "role" in the system
	RoleDataID := os.Getenv("ROLE_DATA_ID")

	body := datadog.AuthNMappingUpdateRequest{
		Data: datadog.AuthNMappingUpdateData{
			Attributes: &datadog.AuthNMappingUpdateAttributes{
				AttributeKey:   common.PtrString("member-of"),
				AttributeValue: common.PtrString("Development"),
			},
			Id: AuthnMappingDataID,
			Relationships: &datadog.AuthNMappingUpdateRelationships{
				Role: &datadog.RelationshipToRole{
					Data: &datadog.RelationshipToRoleData{
						Id:   common.PtrString(RoleDataID),
						Type: datadog.ROLESTYPE_ROLES.Ptr(),
					},
				},
			},
			Type: datadog.AUTHNMAPPINGSTYPE_AUTHN_MAPPINGS,
		},
	}
	ctx := common.NewDefaultContext(context.Background())
	configuration := common.NewConfiguration()
	apiClient := common.NewAPIClient(configuration)
	api := datadog.NewAuthNMappingsApi(apiClient)
	resp, r, err := api.UpdateAuthNMapping(ctx, AuthnMappingDataID, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `AuthNMappingsApi.UpdateAuthNMapping`:\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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Edit an AuthN Mapping returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.AuthNMappingsApi;
import com.datadog.api.client.v2.model.AuthNMappingResponse;
import com.datadog.api.client.v2.model.AuthNMappingUpdateAttributes;
import com.datadog.api.client.v2.model.AuthNMappingUpdateData;
import com.datadog.api.client.v2.model.AuthNMappingUpdateRelationships;
import com.datadog.api.client.v2.model.AuthNMappingUpdateRequest;
import com.datadog.api.client.v2.model.AuthNMappingsType;
import com.datadog.api.client.v2.model.RelationshipToRole;
import com.datadog.api.client.v2.model.RelationshipToRoleData;
import com.datadog.api.client.v2.model.RolesType;

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

    // there is a valid "authn_mapping" in the system
    String AUTHN_MAPPING_DATA_ID = System.getenv("AUTHN_MAPPING_DATA_ID");

    // there is a valid "role" in the system
    String ROLE_DATA_ID = System.getenv("ROLE_DATA_ID");

    AuthNMappingUpdateRequest body =
        new AuthNMappingUpdateRequest()
            .data(
                new AuthNMappingUpdateData()
                    .attributes(
                        new AuthNMappingUpdateAttributes()
                            .attributeKey("member-of")
                            .attributeValue("Development"))
                    .id(AUTHN_MAPPING_DATA_ID)
                    .relationships(
                        new AuthNMappingUpdateRelationships()
                            .role(
                                new RelationshipToRole()
                                    .data(
                                        new RelationshipToRoleData()
                                            .id(ROLE_DATA_ID)
                                            .type(RolesType.ROLES))))
                    .type(AuthNMappingsType.AUTHN_MAPPINGS));

    try {
      AuthNMappingResponse result = apiInstance.updateAuthNMapping(AUTHN_MAPPING_DATA_ID, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AuthNMappingsApi#updateAuthNMapping");
      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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Edit an AuthN Mapping returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.authn_mappings_api import AuthNMappingsApi
from datadog_api_client.v2.model.authn_mapping_update_attributes import AuthNMappingUpdateAttributes
from datadog_api_client.v2.model.authn_mapping_update_data import AuthNMappingUpdateData
from datadog_api_client.v2.model.authn_mapping_update_relationships import AuthNMappingUpdateRelationships
from datadog_api_client.v2.model.authn_mapping_update_request import AuthNMappingUpdateRequest
from datadog_api_client.v2.model.authn_mappings_type import AuthNMappingsType
from datadog_api_client.v2.model.relationship_to_role import RelationshipToRole
from datadog_api_client.v2.model.relationship_to_role_data import RelationshipToRoleData
from datadog_api_client.v2.model.roles_type import RolesType

# there is a valid "authn_mapping" in the system
AUTHN_MAPPING_DATA_ID = environ["AUTHN_MAPPING_DATA_ID"]

# there is a valid "role" in the system
ROLE_DATA_ID = environ["ROLE_DATA_ID"]

body = AuthNMappingUpdateRequest(
    data=AuthNMappingUpdateData(
        attributes=AuthNMappingUpdateAttributes(
            attribute_key="member-of",
            attribute_value="Development",
        ),
        id=AUTHN_MAPPING_DATA_ID,
        relationships=AuthNMappingUpdateRelationships(
            role=RelationshipToRole(
                data=RelationshipToRoleData(
                    id=ROLE_DATA_ID,
                    type=RolesType("roles"),
                ),
            ),
        ),
        type=AuthNMappingsType("authn_mappings"),
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = AuthNMappingsApi(api_client)
    response = api_instance.update_authn_mapping(authn_mapping_id=AUTHN_MAPPING_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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Edit an AuthN Mapping returns "OK" response

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

# there is a valid "authn_mapping" in the system
AUTHN_MAPPING_DATA_ID = ENV["AUTHN_MAPPING_DATA_ID"]

# there is a valid "role" in the system
ROLE_DATA_ID = ENV["ROLE_DATA_ID"]

body = DatadogAPIClient::V2::AuthNMappingUpdateRequest.new({
  data: DatadogAPIClient::V2::AuthNMappingUpdateData.new({
    attributes: DatadogAPIClient::V2::AuthNMappingUpdateAttributes.new({
      attribute_key: "member-of",
      attribute_value: "Development",
    }),
    id: AUTHN_MAPPING_DATA_ID,
    relationships: DatadogAPIClient::V2::AuthNMappingUpdateRelationships.new({
      role: DatadogAPIClient::V2::RelationshipToRole.new({
        data: DatadogAPIClient::V2::RelationshipToRoleData.new({
          id: ROLE_DATA_ID,
          type: DatadogAPIClient::V2::RolesType::ROLES,
        }),
      }),
    }),
    type: DatadogAPIClient::V2::AuthNMappingsType::AUTHN_MAPPINGS,
  }),
})
p api_instance.update_authn_mapping(AUTHN_MAPPING_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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * Edit an AuthN Mapping returns "OK" response
 */

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

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

// there is a valid "authn_mapping" in the system
const AUTHN_MAPPING_DATA_ID = process.env.AUTHN_MAPPING_DATA_ID as string;

// there is a valid "role" in the system
const ROLE_DATA_ID = process.env.ROLE_DATA_ID as string;

const params: v2.AuthNMappingsApiUpdateAuthNMappingRequest = {
  body: {
    data: {
      attributes: {
        attributeKey: "member-of",
        attributeValue: "Development",
      },
      id: AUTHN_MAPPING_DATA_ID,
      relationships: {
        role: {
          data: {
            id: ROLE_DATA_ID,
            type: "roles",
          },
        },
      },
      type: "authn_mappings",
    },
  },
  authnMappingId: AUTHN_MAPPING_DATA_ID,
};

apiInstance
  .updateAuthNMapping(params)
  .then((data: v2.AuthNMappingResponse) => {
    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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

DELETE https://api.datadoghq.eu/api/v2/authn_mappings/{authn_mapping_id}https://api.ddog-gov.com/api/v2/authn_mappings/{authn_mapping_id}https://api.datadoghq.com/api/v2/authn_mappings/{authn_mapping_id}https://api.us3.datadoghq.com/api/v2/authn_mappings/{authn_mapping_id}https://api.us5.datadoghq.com/api/v2/authn_mappings/{authn_mapping_id}

概要

Delete an AuthN Mapping specified by AuthN Mapping UUID. This endpoint requires the user_access_manage authorization scope.

引数

パスパラメーター

名前

種類

説明

authn_mapping_id [required]

string

The UUID of the AuthN Mapping.

応答

OK

Authentication Error

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 authn_mapping_id="CHANGE_ME"
# Curl command curl -X DELETE "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/authn_mappings/${authn_mapping_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
// Delete an AuthN Mapping returns "OK" response

package main

import (
	"context"
	"fmt"
	"os"

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

func main() {
	// there is a valid "authn_mapping" in the system
	AuthnMappingDataID := os.Getenv("AUTHN_MAPPING_DATA_ID")

	ctx := common.NewDefaultContext(context.Background())
	configuration := common.NewConfiguration()
	apiClient := common.NewAPIClient(configuration)
	api := datadog.NewAuthNMappingsApi(apiClient)
	r, err := api.DeleteAuthNMapping(ctx, AuthnMappingDataID)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `AuthNMappingsApi.DeleteAuthNMapping`: %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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Delete an AuthN Mapping returns "OK" response

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

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

    // there is a valid "authn_mapping" in the system
    String AUTHN_MAPPING_DATA_ID = System.getenv("AUTHN_MAPPING_DATA_ID");

    try {
      apiInstance.deleteAuthNMapping(AUTHN_MAPPING_DATA_ID);
    } catch (ApiException e) {
      System.err.println("Exception when calling AuthNMappingsApi#deleteAuthNMapping");
      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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Delete an AuthN Mapping returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.authn_mappings_api import AuthNMappingsApi

# there is a valid "authn_mapping" in the system
AUTHN_MAPPING_DATA_ID = environ["AUTHN_MAPPING_DATA_ID"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = AuthNMappingsApi(api_client)
    api_instance.delete_authn_mapping(
        authn_mapping_id=AUTHN_MAPPING_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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Delete an AuthN Mapping returns "OK" response

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

# there is a valid "authn_mapping" in the system
AUTHN_MAPPING_DATA_ID = ENV["AUTHN_MAPPING_DATA_ID"]
api_instance.delete_authn_mapping(AUTHN_MAPPING_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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * Delete an AuthN Mapping returns "OK" response
 */

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

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

// there is a valid "authn_mapping" in the system
const AUTHN_MAPPING_DATA_ID = process.env.AUTHN_MAPPING_DATA_ID as string;

const params: v2.AuthNMappingsApiDeleteAuthNMappingRequest = {
  authnMappingId: AUTHN_MAPPING_DATA_ID,
};

apiInstance
  .deleteAuthNMapping(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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

GET https://api.datadoghq.eu/api/v2/authn_mappingshttps://api.ddog-gov.com/api/v2/authn_mappingshttps://api.datadoghq.com/api/v2/authn_mappingshttps://api.us3.datadoghq.com/api/v2/authn_mappingshttps://api.us5.datadoghq.com/api/v2/authn_mappings

概要

List all AuthN Mappings in the org.

引数

クエリ文字列

名前

種類

説明

page[size]

integer

Size for a given page.

page[number]

integer

Specific page number to return.

sort

enum

Sort AuthN Mappings depending on the given field.
Allowed enum values: created_at, -created_at, role_id, -role_id, saml_assertion_attribute_id, -saml_assertion_attribute_id, role.name, -role.name, saml_assertion_attribute.attribute_key, -saml_assertion_attribute.attribute_key, saml_assertion_attribute.attribute_value, -saml_assertion_attribute.attribute_value

filter

string

Filter all mappings by the given string.

応答

OK

Array of AuthN Mappings response.

Expand All

フィールド

種類

説明

data

[object]

Array of returned AuthN Mappings.

attributes

object

Attributes of AuthN Mapping.

attribute_key

string

Key portion of a key/value pair of the attribute sent from the Identity Provider.

attribute_value

string

Value portion of a key/value pair of the attribute sent from the Identity Provider.

created_at

date-time

Creation time of the AuthN Mapping.

modified_at

date-time

Time of last AuthN Mapping modification.

saml_assertion_attribute_id

string

The ID of the SAML assertion attribute.

id [required]

string

ID of the AuthN Mapping.

relationships

object

All relationships associated with AuthN Mapping.

role

object

Relationship to role.

data

object

Relationship to role object.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

saml_assertion_attribute

object

AuthN Mapping relationship to SAML Assertion Attribute.

data [required]

object

Data of AuthN Mapping relationship to SAML Assertion Attribute.

id [required]

string

The ID of the SAML assertion attribute.

type [required]

enum

SAML assertion attributes resource type. Allowed enum values: saml_assertion_attributes

type [required]

enum

AuthN Mappings resource type. Allowed enum values: authn_mappings

included

[object <oneOf>]

Included data in the AuthN Mapping response.

Option 1

object

SAML assertion attribute.

attributes

object

Key/Value pair of attributes used in SAML assertion attributes.

attribute_key

string

Key portion of a key/value pair of the attribute sent from the Identity Provider.

attribute_value

string

Value portion of a key/value pair of the attribute sent from the Identity Provider.

id [required]

string

The ID of the SAML assertion attribute.

type [required]

enum

SAML assertion attributes resource type. Allowed enum values: saml_assertion_attributes

Option 2

object

Role object returned by the API.

attributes

object

Attributes of the role.

created_at

date-time

Creation time of the role.

modified_at

date-time

Time of last role modification.

name

string

The name of the role. The name is neither unique nor a stable identifier of the role.

user_count

int64

Number of users with that role.

id

string

The unique identifier of the role.

relationships

object

Relationships of the role object returned by the API.

permissions

object

Relationship to multiple permissions objects.

data

[object]

Relationships to permission objects.

id

string

ID of the permission.

type

enum

Permissions resource type. Allowed enum values: permissions

type [required]

enum

Roles type. Allowed enum values: roles

meta

object

Object describing meta attributes of response.

page

object

Pagination object.

total_count

int64

Total count.

total_filtered_count

int64

Total count of elements matched by the filter.

{
  "data": [
    {
      "attributes": {
        "attribute_key": "member-of",
        "attribute_value": "Development",
        "created_at": "2019-09-19T10:00:00.000Z",
        "modified_at": "2019-09-19T10:00:00.000Z",
        "saml_assertion_attribute_id": "0"
      },
      "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
      "relationships": {
        "role": {
          "data": {
            "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
            "type": "roles"
          }
        },
        "saml_assertion_attribute": {
          "data": {
            "id": "0",
            "type": "saml_assertion_attributes"
          }
        }
      },
      "type": "authn_mappings"
    }
  ],
  "included": [
    {
      "attributes": {
        "attribute_key": "member-of",
        "attribute_value": "Development"
      },
      "id": "0",
      "type": "saml_assertion_attributes"
    }
  ],
  "meta": {
    "page": {
      "total_count": "integer",
      "total_filtered_count": "integer"
    }
  }
}

Authentication Error

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.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/authn_mappings" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
// List all AuthN Mappings returns "OK" response

package main

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

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

func main() {
	ctx := common.NewDefaultContext(context.Background())
	configuration := common.NewConfiguration()
	apiClient := common.NewAPIClient(configuration)
	api := datadog.NewAuthNMappingsApi(apiClient)
	resp, r, err := api.ListAuthNMappings(ctx, *datadog.NewListAuthNMappingsOptionalParameters())

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `AuthNMappingsApi.ListAuthNMappings`:\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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// List all AuthN Mappings returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.AuthNMappingsApi;
import com.datadog.api.client.v2.model.AuthNMappingsResponse;

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

    try {
      AuthNMappingsResponse result = apiInstance.listAuthNMappings();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AuthNMappingsApi#listAuthNMappings");
      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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
List all AuthN Mappings returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.authn_mappings_api import AuthNMappingsApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = AuthNMappingsApi(api_client)
    response = api_instance.list_authn_mappings()

    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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# List all AuthN Mappings returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::AuthNMappingsAPI.new
p api_instance.list_authn_mappings()

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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * List all AuthN Mappings returns "OK" response
 */

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

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

apiInstance
  .listAuthNMappings()
  .then((data: v2.AuthNMappingsResponse) => {
    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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

POST https://api.datadoghq.eu/api/v2/authn_mappingshttps://api.ddog-gov.com/api/v2/authn_mappingshttps://api.datadoghq.com/api/v2/authn_mappingshttps://api.us3.datadoghq.com/api/v2/authn_mappingshttps://api.us5.datadoghq.com/api/v2/authn_mappings

概要

Create an AuthN Mapping. This endpoint requires the user_access_manage authorization scope.

リクエスト

Body Data (required)

Expand All

フィールド

種類

説明

data [required]

object

Data for creating an AuthN Mapping.

attributes

object

Key/Value pair of attributes used for create request.

attribute_key

string

Key portion of a key/value pair of the attribute sent from the Identity Provider.

attribute_value

string

Value portion of a key/value pair of the attribute sent from the Identity Provider.

relationships

object

Relationship of AuthN Mapping create object to Role.

role

object

Relationship to role.

data

object

Relationship to role object.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

type [required]

enum

AuthN Mappings resource type. Allowed enum values: authn_mappings

{
  "data": {
    "attributes": {
      "attribute_key": "examplecreateanauthnmappingreturnsokresponse",
      "attribute_value": "Example-Create_an_AuthN_Mapping_returns_OK_response"
    },
    "relationships": {
      "role": {
        "data": {
          "id": "string",
          "type": "roles"
        }
      }
    },
    "type": "authn_mappings"
  }
}

応答

OK

AuthN Mapping response from the API.

Expand All

フィールド

種類

説明

data

object

The AuthN Mapping object returned by API.

attributes

object

Attributes of AuthN Mapping.

attribute_key

string

Key portion of a key/value pair of the attribute sent from the Identity Provider.

attribute_value

string

Value portion of a key/value pair of the attribute sent from the Identity Provider.

created_at

date-time

Creation time of the AuthN Mapping.

modified_at

date-time

Time of last AuthN Mapping modification.

saml_assertion_attribute_id

string

The ID of the SAML assertion attribute.

id [required]

string

ID of the AuthN Mapping.

relationships

object

All relationships associated with AuthN Mapping.

role

object

Relationship to role.

data

object

Relationship to role object.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

saml_assertion_attribute

object

AuthN Mapping relationship to SAML Assertion Attribute.

data [required]

object

Data of AuthN Mapping relationship to SAML Assertion Attribute.

id [required]

string

The ID of the SAML assertion attribute.

type [required]

enum

SAML assertion attributes resource type. Allowed enum values: saml_assertion_attributes

type [required]

enum

AuthN Mappings resource type. Allowed enum values: authn_mappings

included

[object <oneOf>]

Included data in the AuthN Mapping response.

Option 1

object

SAML assertion attribute.

attributes

object

Key/Value pair of attributes used in SAML assertion attributes.

attribute_key

string

Key portion of a key/value pair of the attribute sent from the Identity Provider.

attribute_value

string

Value portion of a key/value pair of the attribute sent from the Identity Provider.

id [required]

string

The ID of the SAML assertion attribute.

type [required]

enum

SAML assertion attributes resource type. Allowed enum values: saml_assertion_attributes

Option 2

object

Role object returned by the API.

attributes

object

Attributes of the role.

created_at

date-time

Creation time of the role.

modified_at

date-time

Time of last role modification.

name

string

The name of the role. The name is neither unique nor a stable identifier of the role.

user_count

int64

Number of users with that role.

id

string

The unique identifier of the role.

relationships

object

Relationships of the role object returned by the API.

permissions

object

Relationship to multiple permissions objects.

data

[object]

Relationships to permission objects.

id

string

ID of the permission.

type

enum

Permissions resource type. Allowed enum values: permissions

type [required]

enum

Roles type. Allowed enum values: roles

{
  "data": {
    "attributes": {
      "attribute_key": "member-of",
      "attribute_value": "Development",
      "created_at": "2019-09-19T10:00:00.000Z",
      "modified_at": "2019-09-19T10:00:00.000Z",
      "saml_assertion_attribute_id": "0"
    },
    "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
    "relationships": {
      "role": {
        "data": {
          "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
          "type": "roles"
        }
      },
      "saml_assertion_attribute": {
        "data": {
          "id": "0",
          "type": "saml_assertion_attributes"
        }
      }
    },
    "type": "authn_mappings"
  },
  "included": [
    {
      "attributes": {
        "attribute_key": "member-of",
        "attribute_value": "Development"
      },
      "id": "0",
      "type": "saml_assertion_attributes"
    }
  ]
}

Bad Request

API error response.

Expand All

フィールド

種類

説明

errors [required]

[string]

A list of errors.

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

Authentication Error

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"
  ]
}

コード例

  
  # Curl command
curl -X POST "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/authn_mappings" \
-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": {
      "attribute_key": "examplecreateanauthnmappingreturnsokresponse",
      "attribute_value": "Example-Create_an_AuthN_Mapping_returns_OK_response"
    },
    "relationships": {
      "role": {
        "data": {
          "id": "string",
          "type": "roles"
        }
      }
    },
    "type": "authn_mappings"
  }
}
EOF
// Create an AuthN Mapping returns "OK" response

package main

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

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

func main() {
	// there is a valid "role" in the system
	RoleDataID := os.Getenv("ROLE_DATA_ID")

	body := datadog.AuthNMappingCreateRequest{
		Data: datadog.AuthNMappingCreateData{
			Attributes: &datadog.AuthNMappingCreateAttributes{
				AttributeKey:   common.PtrString("examplecreateanauthnmappingreturnsokresponse"),
				AttributeValue: common.PtrString("Example-Create_an_AuthN_Mapping_returns_OK_response"),
			},
			Relationships: &datadog.AuthNMappingCreateRelationships{
				Role: &datadog.RelationshipToRole{
					Data: &datadog.RelationshipToRoleData{
						Id:   common.PtrString(RoleDataID),
						Type: datadog.ROLESTYPE_ROLES.Ptr(),
					},
				},
			},
			Type: datadog.AUTHNMAPPINGSTYPE_AUTHN_MAPPINGS,
		},
	}
	ctx := common.NewDefaultContext(context.Background())
	configuration := common.NewConfiguration()
	apiClient := common.NewAPIClient(configuration)
	api := datadog.NewAuthNMappingsApi(apiClient)
	resp, r, err := api.CreateAuthNMapping(ctx, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `AuthNMappingsApi.CreateAuthNMapping`:\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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Create an AuthN Mapping returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.AuthNMappingsApi;
import com.datadog.api.client.v2.model.AuthNMappingCreateAttributes;
import com.datadog.api.client.v2.model.AuthNMappingCreateData;
import com.datadog.api.client.v2.model.AuthNMappingCreateRelationships;
import com.datadog.api.client.v2.model.AuthNMappingCreateRequest;
import com.datadog.api.client.v2.model.AuthNMappingResponse;
import com.datadog.api.client.v2.model.AuthNMappingsType;
import com.datadog.api.client.v2.model.RelationshipToRole;
import com.datadog.api.client.v2.model.RelationshipToRoleData;
import com.datadog.api.client.v2.model.RolesType;

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

    // there is a valid "role" in the system
    String ROLE_DATA_ID = System.getenv("ROLE_DATA_ID");

    AuthNMappingCreateRequest body =
        new AuthNMappingCreateRequest()
            .data(
                new AuthNMappingCreateData()
                    .attributes(
                        new AuthNMappingCreateAttributes()
                            .attributeKey("examplecreateanauthnmappingreturnsokresponse")
                            .attributeValue("Example-Create_an_AuthN_Mapping_returns_OK_response"))
                    .relationships(
                        new AuthNMappingCreateRelationships()
                            .role(
                                new RelationshipToRole()
                                    .data(
                                        new RelationshipToRoleData()
                                            .id(ROLE_DATA_ID)
                                            .type(RolesType.ROLES))))
                    .type(AuthNMappingsType.AUTHN_MAPPINGS));

    try {
      AuthNMappingResponse result = apiInstance.createAuthNMapping(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AuthNMappingsApi#createAuthNMapping");
      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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Create an AuthN Mapping returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.authn_mappings_api import AuthNMappingsApi
from datadog_api_client.v2.model.authn_mapping_create_attributes import AuthNMappingCreateAttributes
from datadog_api_client.v2.model.authn_mapping_create_data import AuthNMappingCreateData
from datadog_api_client.v2.model.authn_mapping_create_relationships import AuthNMappingCreateRelationships
from datadog_api_client.v2.model.authn_mapping_create_request import AuthNMappingCreateRequest
from datadog_api_client.v2.model.authn_mappings_type import AuthNMappingsType
from datadog_api_client.v2.model.relationship_to_role import RelationshipToRole
from datadog_api_client.v2.model.relationship_to_role_data import RelationshipToRoleData
from datadog_api_client.v2.model.roles_type import RolesType

# there is a valid "role" in the system
ROLE_DATA_ID = environ["ROLE_DATA_ID"]

body = AuthNMappingCreateRequest(
    data=AuthNMappingCreateData(
        attributes=AuthNMappingCreateAttributes(
            attribute_key="examplecreateanauthnmappingreturnsokresponse",
            attribute_value="Example-Create_an_AuthN_Mapping_returns_OK_response",
        ),
        relationships=AuthNMappingCreateRelationships(
            role=RelationshipToRole(
                data=RelationshipToRoleData(
                    id=ROLE_DATA_ID,
                    type=RolesType("roles"),
                ),
            ),
        ),
        type=AuthNMappingsType("authn_mappings"),
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = AuthNMappingsApi(api_client)
    response = api_instance.create_authn_mapping(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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Create an AuthN Mapping returns "OK" response

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

# there is a valid "role" in the system
ROLE_DATA_ID = ENV["ROLE_DATA_ID"]

body = DatadogAPIClient::V2::AuthNMappingCreateRequest.new({
  data: DatadogAPIClient::V2::AuthNMappingCreateData.new({
    attributes: DatadogAPIClient::V2::AuthNMappingCreateAttributes.new({
      attribute_key: "examplecreateanauthnmappingreturnsokresponse",
      attribute_value: "Example-Create_an_AuthN_Mapping_returns_OK_response",
    }),
    relationships: DatadogAPIClient::V2::AuthNMappingCreateRelationships.new({
      role: DatadogAPIClient::V2::RelationshipToRole.new({
        data: DatadogAPIClient::V2::RelationshipToRoleData.new({
          id: ROLE_DATA_ID,
          type: DatadogAPIClient::V2::RolesType::ROLES,
        }),
      }),
    }),
    type: DatadogAPIClient::V2::AuthNMappingsType::AUTHN_MAPPINGS,
  }),
})
p api_instance.create_authn_mapping(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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * Create an AuthN Mapping returns "OK" response
 */

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

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

// there is a valid "role" in the system
const ROLE_DATA_ID = process.env.ROLE_DATA_ID as string;

const params: v2.AuthNMappingsApiCreateAuthNMappingRequest = {
  body: {
    data: {
      attributes: {
        attributeKey: "examplecreateanauthnmappingreturnsokresponse",
        attributeValue: "Example-Create_an_AuthN_Mapping_returns_OK_response",
      },
      relationships: {
        role: {
          data: {
            id: ROLE_DATA_ID,
            type: "roles",
          },
        },
      },
      type: "authn_mappings",
    },
  },
};

apiInstance
  .createAuthNMapping(params)
  .then((data: v2.AuthNMappingResponse) => {
    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.euddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"