Claude Platform Docs

Добавить рабочее пространство в правило федерации

FederationRuleWorkspace organization().federation().rules().workspaces().add(params, requestOptions = RequestOptions.none())
POST/v1/organizations/federation_rules/{federation_rule_id}/workspaces

Требуется токен доступа OAuth с областью org:admin, полученный с помощью ant auth login --scope org:admin или правила федерации удостоверений рабочих нагрузок; ключи Admin API не принимаются. См. Управление WIF с помощью Admin API.

Включает правило федерации для рабочего пространства.

Операция идемпотентна; повторное включение возвращает существующее включение. Правило и рабочее пространство должны принадлежать вашей организации. Членство целевого сервисного аккаунта правила в этом рабочем пространстве не проверяется при включении: обмен токенов в это рабочее пространство отклоняется, если целевой аккаунт не является участником (он неявно является участником рабочего пространства по умолчанию). Архивированные правила отклоняются с кодом 400. Вызывающие стороны OAuth могут управлять только правилами, у которых oauth_scope равен workspace:developer или workspace:inference; для других областей требуется сеанс Console.

Parameters
WorkspaceAddParams params
Optional<String> federationRuleId⁠Path parameter

ID of the federation rule.

String workspaceId

Tagged ID of the workspace to enable this rule for.

Returns
class FederationRuleWorkspace { type = "federation_rule_workspace"; createdAt; createdByActorId; /* 3 more */ }
JsonValue type = "federation_rule_workspace"
LocalDateTime createdAt

When this workspace was enabled for the rule.

formatdate-time
Optional<String> createdByActorId

Tagged ID (user_... or svac_...) of the actor that enabled this workspace for the rule, if known.

String federationRuleId

Tagged ID of the federation rule.

String workspaceId

Tagged ID of the workspace this rule is enabled for.

Optional<String> workspaceName

Workspace display name. Populated when listing; null in the enable response.

Добавить рабочее пространство в правило федерации
package com.anthropic.example;

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.organization.federation.rules.FederationRuleWorkspace;
import com.anthropic.models.organization.federation.rules.workspaces.WorkspaceAddParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        AnthropicClient client = AnthropicOkHttpClient.fromEnv();

        WorkspaceAddParams params = WorkspaceAddParams.builder()
            .federationRuleId("federation_rule_id")
            .workspaceId("workspace_id")
            .build();
        FederationRuleWorkspace federationRuleWorkspace = client.organization().federation().rules().workspaces().add(params);
    }
}
Returns Examples
Response 200
{
  "created_at": "2024-10-30T23:58:27.427722Z",
  "created_by_actor_id": "created_by_actor_id",
  "federation_rule_id": "federation_rule_id",
  "type": "federation_rule_workspace",
  "workspace_id": "workspace_id",
  "workspace_name": "workspace_name"
}