sym.sdk.forms

Models for working with Sym access request forms.

Classes

FieldType

Allowed data types for PromptField objects.

FieldOption

An option to display in a drop-down menu.

PromptField

The current state of a prompt_field Terraform block representing an input field for a form used to make a Sym access request.

SlackUserSelection

A representation of a Slack user who has been selected in a Slack user drop-down menu (i.e.

SymPromptForm

The current state of a form used to submit an access request to Sym.

pydantic model sym.sdk.forms.FieldOption

Bases: pydantic.main.BaseModel

An option to display in a drop-down menu. FieldOptions represent value-label pairs to use in drop-down menus. They may be returned by Prefetch Reducers to dynamically generate a list of options for Prompt Fields with prefetch = true.

They are also used in PromptField objects to represent the selected drop-down value as well as the list of selectable options for that field.

Fields
Validators
field label: str [Required]

A short label, no more than 55 characters, to display in the drop-down menu.

This label will be used to filter the options to display when a requester types into an input box.

Constraints
  • maxLength = 55

field value: Any = None

The actual value to pass through when selected.

When cast to a string, this value’s length cannot exceed 55 characters.

Validated by
validator validate_value_length  »  value

Validates that the given value will not exceed Slack-imposed length limits.

class sym.sdk.forms.FieldType(value)

Bases: str, enum.Enum

Allowed data types for PromptField objects.

BOOL = 'bool'

Basic “True” or “False” data.

DURATION = 'duration'

A length of time in seconds.

INT = 'int'

Basic integer data.

INT_LIST = 'int_list'

A list of integers.

SLACK_USER = 'slack_user'

A Slack User ID.

SLACK_USER_LIST = 'slack_user_list'

A list of Slack User IDs.

STRING = 'string'

Basic text data.

STR_LIST = 'str_list'

A list of strings.

pydantic model sym.sdk.forms.PromptField

Bases: pydantic.main.BaseModel

The current state of a prompt_field Terraform block representing an input field for a form used to make a Sym access request.

See the Terraform registry for more information about how these are defined on a Flow.

Fields
field current_allowed_values: List[sym.sdk.forms.FieldOption] = []

The current list of FieldOption objects to be displayed in a drop-down menu.

field label: Optional[str] = None

A display name for this field, to be displayed in the UI.

field name: str [Required]

A unique identifier for this field.

field original_allowed_values: List[sym.sdk.forms.FieldOption] = []

The full list of FieldOption objects either defined in Terraform or returned by this field’s Prefetch Reducer.

field required: bool = True

Whether this field is a required input.

Required inputs are only enforced if visible = True.

field type: sym.sdk.forms.FieldType [Required]

The type of data this field will accept.

field value: Any = None

The current input value for this field.

field visible: bool = True

Whether this field should be displayed in the UI.

pydantic model sym.sdk.forms.SlackUserSelection

Bases: pydantic.main.BaseModel

A representation of a Slack user who has been selected in a Slack user drop-down menu (i.e. a Sym prompt_field with a type of “slack_user” or “slack_user_list”).

Fields
field user_id: str [Required]

The Slack ID of the Slack user who was selected.

field username: Optional[str] = None

The Sym username (i.e. email or bot username) of the user who was selected.

If the selected Slack user is not already a known Sym user in your organization, this attribute will return None.

pydantic model sym.sdk.forms.SymPromptForm

Bases: pydantic.main.BaseModel

The current state of a form used to submit an access request to Sym.

Fields
field additional_header_text: Optional[str] = None

Additional text appended to the header text displayed at the top of the Slack request modal, after the default header text. Supports Slack markdown.

field fields: OrderedDict[str, sym.sdk.forms.PromptField] [Required]

A dictionary of PromptField objects, keyed by field name and in the order they would be displayed in the UI.

NOTE: While the PromptField objects may be modified to change the form’s state, the dictionary itself should not be modified.

field flow_vars: Dict[str, str] = {}

A dictionary of Flow vars and their string values, as defined in the sym_flow Terraform resource’s vars attribute.