Skip to content

feat: add global policy support to Policy().List() and Policy().GetStatus() #44

Description

@rhuss

Problem

The ListSandboxPolicies and GetSandboxPolicyStatus RPCs accept a global boolean flag that switches them from sandbox-scoped to gateway-global policy mode. The SDK's Policy().List() and Policy().GetStatus() methods don't expose this flag.

Impact

The openshell-dashboard BFF needs to fetch global policy revisions for the Platform Admin "Global Policy" page. Without the global flag, the SDK sends name="" which the gateway rejects with InvalidArgument: name is required.

Currently worked around by returning an empty policy view in the dashboard.

Proposed API

Add a Global option to ListPolicyOption and GetStatusOption:

// List with global flag
revisions, err := client.Policy().List(ctx, "", openshell.WithGlobal(true))

// GetStatus with global flag  
status, err := client.Policy().GetStatus(ctx, "", "", openshell.WithGlobal(true))

The workspace and name parameters would be ignored when global=true, matching the gateway's behavior.

Affected RPCs

RPC Proto field SDK method
ListSandboxPolicies global (bool) Policy().List()
GetSandboxPolicyStatus global (bool) Policy().GetStatus()

Context

Discovered while integrating the SDK into the openshell-dashboard BFF (PR #2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    proto-gapProto API surface not yet covered by SDK

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions