Skip to content

Parse service-key credential references in dynamic parameters - #363

Open
stiv03 wants to merge 1 commit into
masterfrom
feature/dynamic-service-key-credentials
Open

stiv03 wants to merge 1 commit into
masterfrom
feature/dynamic-service-key-credentials

Conversation

@stiv03

@stiv03 stiv03 commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Add DynamicParameterUtil support for the
{ds//service-keys..credentials.} reference form: isServiceKeyCredentialReference, getServiceKeyName and getCredentialFieldPath. This is the parsing groundwork for injecting a created service key's credential output into another resource's service-keys[].config at deploy time.

Add DynamicParameterUtil support for the
{ds/<resource>/service-keys.<key>.credentials.<field>} reference form:
isServiceKeyCredentialReference, getServiceKeyName and
getCredentialFieldPath. This is the parsing groundwork for injecting a
created service key's credential output into another resource's
service-keys[].config at deploy time.
@sonarqubecloud

Copy link
Copy Markdown

public static final String REGEX_PATTERN_FOR_DYNAMIC_PARAMETERS = "^\\{ds[A-Za-z0-9_\\-\\.\\/]+\\}$";

private static final String SERVICE_KEY_REFERENCE_PREFIX = "service-keys.";
private static final String CREDENTIALS_SEPARATOR = ".credentials.";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is written, this will only work for a 'credentials' map inside the service key. Should this be a bit more general or do we intentionally want it this way? What would happen if the ztis service changes the internal service key parameter structure.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

credentials is the standard CF contract for service keys, not a ZTIS-specific structure. Every CF service key, regardless of service type, returns its useful data under credentials

Comment on lines +8 to +9
private static final String SERVICE_KEY_REFERENCE_PREFIX = "service-keys.";
private static final String CREDENTIALS_SEPARATOR = ".credentials.";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these dots after or between keywords?

@stiv03 stiv03 Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dots are delimiters in the{ds/<resource>/service-keys.<key>.credentials.<field>} reference syntax, and they're part of that literal text. The two constants are just the fixed delimiter substrings used to split the reference into its parts:

SERVICE_KEY_REFERENCE_PREFIX = "service-keys." - separates the literal service-keys token from the key name, so we can strip it off and get key

CREDENTIALS_SEPARATOR = ".credentials." - fences off the literal credentials token, so we can split off field

for exampel: "{ds/source-service/service-keys.source-key.credentials.clientid}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants