---
title: 모든 GCP STS 사용 가능한 서비스 계정 목록 만들기
description: Datadog 계정에 구성된 모든 GCP STS 지원 서비스 계정을 나열합니다.
breadcrumbs: 문서 > API > 모든 GCP STS 사용 가능한 서비스 계정 목록 만들기
---

> For the complete documentation index, see [llms.txt](https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/llms.txt).

# 모든 GCP STS 사용 가능한 서비스 계정 목록 만들기

## v2 (latest)

| Datadog site      | API endpoint                                                      |
| ----------------- | ----------------------------------------------------------------- |
| app.datadoghq.com | GET https://api.datadoghq.com/api/v2/integration/gcp/accounts     |
| us3.datadoghq.com | GET https://api.us3.datadoghq.com/api/v2/integration/gcp/accounts |
| us5.datadoghq.com | GET https://api.us5.datadoghq.com/api/v2/integration/gcp/accounts |
| app.datadoghq.eu  | GET https://api.datadoghq.eu/api/v2/integration/gcp/accounts      |
| ap1.datadoghq.com | GET https://api.ap1.datadoghq.com/api/v2/integration/gcp/accounts |
| ap2.datadoghq.com | GET https://api.ap2.datadoghq.com/api/v2/integration/gcp/accounts |
| uk1.datadoghq.com | GET https://api.uk1.datadoghq.com/api/v2/integration/gcp/accounts |
| app.ddog-gov.com  | GET https://api.ddog-gov.com/api/v2/integration/gcp/accounts      |
| us2.ddog-gov.com  | GET https://api.us2.ddog-gov.com/api/v2/integration/gcp/accounts  |

### Overview

Datadog 계정에 구성된 모든 GCP STS 지원 서비스 계정을 나열합니다.

This endpoint requires the `gcp_configuration_read` permission.

### Response

{% tabs %}
{% tab label="200" %}
OK

{% tabs %}
{% tab label="Model" %}
Object containing all your STS enabled accounts.

| Parent field               | Field                                     | Type     | Description                                                                                                                                                                                                                                                                                                            |
| -------------------------- | ----------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                            | data                                      | [object] | Array of GCP STS enabled service accounts.                                                                                                                                                                                                                                                                             |
| data                       | attributes                                | object   | Attributes associated with your service account.                                                                                                                                                                                                                                                                       |
| attributes                 | account_tags                              | [string] | Tags to be associated with GCP metrics and service checks from your account.                                                                                                                                                                                                                                           |
| attributes                 | automute                                  | boolean  | Silence monitors for expected GCE instance shutdowns.                                                                                                                                                                                                                                                                  |
| attributes                 | client_email                              | string   | Your service account email address.                                                                                                                                                                                                                                                                                    |
| attributes                 | cloud_run_revision_filters                | [string] | **DEPRECATED**: List of filters to limit the Cloud Run revisions that are pulled into Datadog by using tags. Only Cloud Run revision resources that apply to specified filters are imported into Datadog. **Note:** This field is deprecated. Instead, use `monitored_resource_configs` with `type=cloud_run_revision` |
| attributes                 | host_filters                              | [string] | **DEPRECATED**: List of filters to limit the VM instances that are pulled into Datadog by using tags. Only VM instance resources that apply to specified filters are imported into Datadog. **Note:** This field is deprecated. Instead, use `monitored_resource_configs` with `type=gce_instance`                     |
| attributes                 | is_cspm_enabled                           | boolean  | When enabled, Datadog will activate the Cloud Security Monitoring product for this service account. Note: This requires resource_collection_enabled to be set to true.                                                                                                                                                 |
| attributes                 | is_global_location_enabled                | boolean  | When enabled, Datadog collects metrics where location is explicitly stated as "global" or where location information cannot be deduced from GCP labels. Default: `true`.                                                                                                                                               |
| attributes                 | is_org_folder_resource_collection_enabled | boolean  | When enabled, Datadog scans for organization and folder-level resources under the organization the service account belongs to. Default: `false`.                                                                                                                                                                       |
| attributes                 | is_per_project_quota_enabled              | boolean  | When enabled, Datadog applies the `X-Goog-User-Project` header, attributing Google Cloud billing and quota usage to the project being monitored rather than the default service account project. Default: `false`.                                                                                                     |
| attributes                 | is_resource_change_collection_enabled     | boolean  | When enabled, Datadog scans for all resource change data in your Google Cloud environment. Default: `false`.                                                                                                                                                                                                           |
| attributes                 | is_security_command_center_enabled        | boolean  | When enabled, Datadog will attempt to collect Security Command Center Findings. Note: This requires additional permissions on the service account. Default: `false`.                                                                                                                                                   |
| attributes                 | metric_namespace_configs                  | [object] | Configurations for GCP metric namespaces.                                                                                                                                                                                                                                                                              |
| metric_namespace_configs   | disabled                                  | boolean  | When disabled, Datadog does not collect metrics that are related to this GCP metric namespace. Default: `false`.                                                                                                                                                                                                       |
| metric_namespace_configs   | filters                                   | [string] | When enabled, Datadog applies these additional filters to limit metric collection. A metric is collected only if it does not match all exclusion filters and matches at least one allow filter.                                                                                                                        |
| metric_namespace_configs   | id                                        | string   | The id of the GCP metric namespace.                                                                                                                                                                                                                                                                                    |
| attributes                 | monitored_resource_configs                | [object] | Configurations for GCP monitored resources.                                                                                                                                                                                                                                                                            |
| monitored_resource_configs | filters                                   | [string] | List of filters to limit the monitored resources that are pulled into Datadog by using tags. Only monitored resources that apply to specified filters are imported into Datadog.                                                                                                                                       |
| monitored_resource_configs | type                                      | enum     | The GCP monitored resource type. Only a subset of resource types are supported. Allowed enum values: `cloud_function`, `cloud_run_revision`, `gce_instance`.                                                                                                                                                           |
| attributes                 | region_filter_configs                     | [string] | Configurations for GCP location filtering, such as region, multi-region, or zone. Only monitored resources that match the specified regions are imported into Datadog. By default, Datadog collects from all locations.                                                                                                |
| attributes                 | resource_collection_enabled               | boolean  | When enabled, Datadog scans for all project-level resources in your GCP environment.                                                                                                                                                                                                                                   |
| data                       | id                                        | string   | Your service account's unique ID.                                                                                                                                                                                                                                                                                      |
| data                       | meta                                      | object   | Additional information related to your service account.                                                                                                                                                                                                                                                                |
| meta                       | accessible_projects                       | [string] | The current list of projects accessible from your service account.                                                                                                                                                                                                                                                     |
| data                       | type                                      | enum     | The type of account. Allowed enum values: `gcp_service_account`. Default: `gcp_service_account`.                                                                                                                                                                                                                       |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": [
    {
      "attributes": {
        "account_tags": [],
        "automute": false,
        "client_email": "datadog-service-account@test-project.iam.gserviceaccount.com",
        "cloud_run_revision_filters": [
          "$KEY:$VALUE"
        ],
        "host_filters": [
          "$KEY:$VALUE"
        ],
        "is_cspm_enabled": false,
        "is_global_location_enabled": true,
        "is_org_folder_resource_collection_enabled": false,
        "is_per_project_quota_enabled": true,
        "is_resource_change_collection_enabled": true,
        "is_security_command_center_enabled": true,
        "metric_namespace_configs": [
          {
            "disabled": true,
            "filters": [
              "snapshot.*",
              "!*_by_region"
            ],
            "id": "pubsub"
          }
        ],
        "monitored_resource_configs": [
          {
            "filters": [
              "$KEY:$VALUE"
            ],
            "type": "gce_instance"
          }
        ],
        "region_filter_configs": [
          "nam4",
          "europe-north1"
        ],
        "resource_collection_enabled": false
      },
      "id": "d291291f-12c2-22g4-j290-123456678897",
      "meta": {
        "accessible_projects": []
      },
      "type": "gcp_service_account"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="403" %}
Not Authorized

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="404" %}
Not Found

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, 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 GET "https://api.${DD_SITE}/api/v2/integration/gcp/accounts" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
```
{% /tab %}

{% tab label="Go" %}
```go
// List all GCP STS-enabled service accounts 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())
	ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewGCPIntegrationApi(apiClient)
	resp, r, err := api.ListGCPSTSAccounts(ctx)

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

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

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"
```
{% /tab %}

{% tab label="Java" %}
```java
// List all GCP STS-enabled service accounts returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.GcpIntegrationApi;
import com.datadog.api.client.v2.model.GCPSTSServiceAccountsResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
    GcpIntegrationApi apiInstance = new GcpIntegrationApi(defaultClient);

    try {
      GCPSTSServiceAccountsResponse result = apiInstance.listGCPSTSAccounts();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling GcpIntegrationApi#listGCPSTSAccounts");
      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](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"
```
{% /tab %}

{% tab label="Python" %}
```python
"""
List all GCP STS-enabled service accounts returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.gcp_integration_api import GCPIntegrationApi

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
    api_instance = GCPIntegrationApi(api_client)
    response = api_instance.list_gcpsts_accounts()

    print(response)
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"
```
{% /tab %}

{% tab label="Ruby" %}
```ruby
# List all GCP STS-enabled service accounts returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::GCPIntegrationAPI.new
p api_instance.list_gcpsts_accounts()
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"
```
{% /tab %}

{% tab label="Rust" %}
```rust
// List all GCP STS-enabled service accounts returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_gcp_integration::GCPIntegrationAPI;

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

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
```
{% /tab %}

{% tab label="TypeScript" %}
```typescript
/**
 * List all GCP STS-enabled service accounts returns "OK" response
 */

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

const configuration = client.createConfiguration({
  authMethods: {
    AuthZ: {
      accessToken: process.env.DD_BEARER_TOKEN as string,
    },
  },
});
const apiInstance = new v2.GCPIntegrationApi(configuration);

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

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=typescript) and then save the example to `example.ts` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"
```
{% /tab %}
{% /tabs %}
