For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/es/api/latest/cloud-authentication/create-a-github-cloud-auth-persona-mapping.md. A documentation index is available at /llms.txt.
Language
Datadog site

Create a GitHub cloud auth persona mapping

ADVERTENCIANote: This endpoint is in Preview and is subject to change. If you have any feedback, contact Datadog support.
POSThttps://api.datadoghq.com/api/v2/cloud_auth/github/persona_mappinghttps://api.us3.datadoghq.com/api/v2/cloud_auth/github/persona_mappinghttps://api.us5.datadoghq.com/api/v2/cloud_auth/github/persona_mappinghttps://api.datadoghq.eu/api/v2/cloud_auth/github/persona_mappinghttps://api.ap1.datadoghq.com/api/v2/cloud_auth/github/persona_mappinghttps://api.ap2.datadoghq.com/api/v2/cloud_auth/github/persona_mappinghttps://api.uk1.datadoghq.com/api/v2/cloud_auth/github/persona_mappinghttps://api.ddog-gov.com/api/v2/cloud_auth/github/persona_mappinghttps://api.us2.ddog-gov.com/api/v2/cloud_auth/github/persona_mapping

Descripción general

Create a GitHub cloud authentication persona mapping. This endpoint associates a GitHub Actions OIDC principal with a Datadog user. The mapped principal can request an impersonation token.

Solicitud

Body Data (required)

Campo
Type
Descripción
data [required]
object

Data for creating a GitHub cloud authentication persona mapping.

Respuesta

Created

Response containing a single GitHub cloud authentication persona mapping.

Campo
Type
Descripción
data [required]
object

Data for GitHub cloud authentication persona mapping response.

Ejemplo de código

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cloud_auth/github/persona_mapping" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account_identifier": "test@example.com",
      "claim_matchers": {
        "ref": "refs/heads/main",
        "repository": "test_owner/test_repo",
        "repository_owner": "test_owner",
        "sub": "repo:test_owner/test_repo:(ref:refs/heads/main|pull_request)"
      }
    },
    "type": "github_oidc_auth_config"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cloud_auth/github/persona_mapping" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account_identifier": "test@example.com",
      "claim_matchers": {
        "ref": "refs/heads/main",
        "repository": "test_owner/test_repo",
        "repository_owner": "test_owner",
        "sub": "repo:test_owner/test_repo:(ref:refs/heads/main|pull_request)"
      }
    },
    "type": "github_oidc_auth_config"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cloud_auth/github/persona_mapping" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account_identifier": "test@example.com",
      "claim_matchers": {
        "ref": "refs/heads/main",
        "repository": "test_owner/test_repo",
        "repository_owner": "test_owner",
        "sub": "repo:test_owner/test_repo:(ref:refs/heads/main|pull_request)"
      }
    },
    "type": "github_oidc_auth_config"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cloud_auth/github/persona_mapping" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account_identifier": "test@example.com",
      "claim_matchers": {
        "ref": "refs/heads/main",
        "repository": "test_owner/test_repo",
        "repository_owner": "test_owner",
        "sub": "repo:test_owner/test_repo:(ref:refs/heads/main|pull_request)"
      }
    },
    "type": "github_oidc_auth_config"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cloud_auth/github/persona_mapping" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account_identifier": "test@example.com",
      "claim_matchers": {
        "ref": "refs/heads/main",
        "repository": "test_owner/test_repo",
        "repository_owner": "test_owner",
        "sub": "repo:test_owner/test_repo:(ref:refs/heads/main|pull_request)"
      }
    },
    "type": "github_oidc_auth_config"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cloud_auth/github/persona_mapping" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account_identifier": "test@example.com",
      "claim_matchers": {
        "ref": "refs/heads/main",
        "repository": "test_owner/test_repo",
        "repository_owner": "test_owner",
        "sub": "repo:test_owner/test_repo:(ref:refs/heads/main|pull_request)"
      }
    },
    "type": "github_oidc_auth_config"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cloud_auth/github/persona_mapping" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account_identifier": "test@example.com",
      "claim_matchers": {
        "ref": "refs/heads/main",
        "repository": "test_owner/test_repo",
        "repository_owner": "test_owner",
        "sub": "repo:test_owner/test_repo:(ref:refs/heads/main|pull_request)"
      }
    },
    "type": "github_oidc_auth_config"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cloud_auth/github/persona_mapping" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account_identifier": "test@example.com",
      "claim_matchers": {
        "ref": "refs/heads/main",
        "repository": "test_owner/test_repo",
        "repository_owner": "test_owner",
        "sub": "repo:test_owner/test_repo:(ref:refs/heads/main|pull_request)"
      }
    },
    "type": "github_oidc_auth_config"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cloud_auth/github/persona_mapping" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account_identifier": "test@example.com",
      "claim_matchers": {
        "ref": "refs/heads/main",
        "repository": "test_owner/test_repo",
        "repository_owner": "test_owner",
        "sub": "repo:test_owner/test_repo:(ref:refs/heads/main|pull_request)"
      }
    },
    "type": "github_oidc_auth_config"
  }
}
EOF