GetRoleFromSecurityContext
Retrieves the IAM role from the security context of the task execution metadata, falling back to annotations for backward compatibility if no role is found in the security context.
def GetRoleFromSecurityContext(
roleKey: string,
taskExecutionMetadata: core2.TaskExecutionMetadata
) - > string
Retrieves the IAM role from the provided security context or task execution metadata. This function first attempts to get the role from the security context's 'RunAs' field and falls back to annotations for backward compatibility if no role is found.
Parameters
| Name | Type | Description |
|---|---|---|
| roleKey | string | The key used to look up the role within the task execution metadata's annotations if the role is not found in the security context. |
| taskExecutionMetadata | core2.TaskExecutionMetadata | The metadata object containing security context information and annotations from which the role will be extracted. |
Returns
| Type | Description |
|---|---|
string | The IAM role string associated with the security context or annotations. |