Documentation
¶
Index ¶
- func AddEnvOfServiceParam(cmd *cobra.Command, id *string)
- func AddEnvParam(cmd *cobra.Command, id *string)
- func AddProjectParam(cmd *cobra.Command, id, name *string)
- func AddServiceParam(cmd *cobra.Command, id, name *string)
- func GetProjectByName(client api.Client, ownerID, personalUsername, projectName string) (*model.Project, error)
- func GetServiceByName(client api.Client, ...) (*model.Service, error)
- func PackZip() ([]byte, string, error)
- func PackZipWithoutGitIgnoreFiles() ([]byte, error)
- func ResolveEnvironmentID(client api.Client, projectID string) (string, error)
- func ResolveEnvironmentIDByServiceID(client api.Client, serviceID string) (string, error)
- type CobraRunE
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddEnvOfServiceParam ¶
func AddProjectParam ¶
func AddServiceParam ¶
func GetProjectByName ¶
func GetProjectByName(client api.Client, ownerID, personalUsername, projectName string) (*model.Project, error)
GetProjectByName resolves a project by name within the active workspace.
- Personal workspace (ownerID == ""): uses the cheap `project(owner: $personalUsername, name: $projectName)` query against the caller's account.
- Team workspace (ownerID != ""): there is no `project(ownerID, name)` query, so walk the owner's project list and match by name locally.
Without the team branch a `--name`-based lookup in a team workspace would silently fall through to the caller's personal account — either failing to find the project, or worse, returning a same-named personal project instead of the intended team one. The personal path is unchanged, so existing personal-workspace callers see no behavior change.
func GetServiceByName ¶
func GetServiceByName(client api.Client, ownerID, personalUsername, projectName, projectID, serviceName string) (*model.Service, error)
GetServiceByName resolves a service by name within the active workspace.
- Personal workspace (ownerID == ""): uses the cheap `service(owner, projectName, name)` query.
- Team workspace (ownerID != ""): the personal query keys on the caller's username and would silently look at the personal account. Use the project-scoped `ListAllServices(projectID)` and match by name locally — projectID is unique across owners and team-safe.
In a team workspace the caller must have a project context (projectID), because services have no top-level owner-scoped lookup and a service name is only unique within a project. Personal path is unchanged.
func ResolveEnvironmentID ¶ added in v0.5.8
ResolveEnvironmentID resolves the environment ID from the project ID by listing environments and returning the first one. Every project has exactly one environment since environments are deprecated.
Types ¶
type CobraRunE ¶
func DefaultIDNameByContext ¶
DefaultIDNameByContext returns a Cobra PreRunE that auto-fills `id` and `name` from the resource the supplied closure returns, provided both are empty. Useful for commands like `project get/delete` that should default to "whatever the user has pinned" when invoked with no flags.
The argument is a closure rather than the BasicInfo directly so the resolution happens at PreRunE time (after global flags are parsed), not at Cobra command construction time. This matters for PLA-1590: `--workspace` only takes effect after PersistentPreRunE runs, so a caller passing `f.EffectiveContext().GetProject()` directly would capture the persisted project, not the override-aware empty.