sym.sdk.forms

Models for working with Sym access request forms.

Classes

FieldType

Allowed data types for PromptField objects.

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.

Show JSON schema
{
   "title": "FieldOption",
   "description": "An option to display in a drop-down menu.\nFieldOptions represent value-label pairs to use in drop-down menus. They may be returned by\nPrefetch Reducers to dynamically generate a list of options for Prompt Fields with\n`prefetch = true`.\n\nThey are also used in :class:`~sym.sdk.forms.PromptField` objects to represent the selected\ndrop-down value as well as the list of selectable options for that field.",
   "type": "object",
   "properties": {
      "value": {
         "title": "Value"
      },
      "label": {
         "title": "Label",
         "maxLength": 55,
         "type": "string"
      }
   },
   "required": [
      "label"
   ]
}

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
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

classmethod from_orm(obj: Any) Model
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict().

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().

classmethod parse_file(path: Union[str, pathlib.Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model
classmethod parse_obj(obj: Any) Model
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') DictStrAny
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) unicode
classmethod update_forward_refs(**localns: Any) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

classmethod validate(value: Any) Model
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.

Show JSON schema
{
   "title": "PromptField",
   "description": "The current state of a prompt_field Terraform block representing an input field\nfor a form used to make a Sym access request.\n\nSee `the Terraform registry <https://registry.terraform.io/providers/symopsio/sym/latest/docs/resources/flow#nestedblock--params--prompt_field>`_\nfor more information about how these are defined on a :class:`~sym.sdk.flow.Flow`.",
   "type": "object",
   "properties": {
      "name": {
         "title": "Name",
         "type": "string"
      },
      "type": {
         "$ref": "#/definitions/FieldType"
      },
      "value": {
         "title": "Value"
      },
      "label": {
         "title": "Label",
         "type": "string"
      },
      "required": {
         "title": "Required",
         "default": true,
         "type": "boolean"
      },
      "current_allowed_values": {
         "title": "Current Allowed Values",
         "default": [],
         "type": "array",
         "items": {
            "$ref": "#/definitions/FieldOption"
         }
      },
      "original_allowed_values": {
         "title": "Original Allowed Values",
         "default": [],
         "type": "array",
         "items": {
            "$ref": "#/definitions/FieldOption"
         }
      },
      "visible": {
         "title": "Visible",
         "default": true,
         "type": "boolean"
      }
   },
   "required": [
      "name",
      "type"
   ],
   "definitions": {
      "FieldType": {
         "title": "FieldType",
         "description": "Allowed data types for :class:`~sym.sdk.forms.PromptField` objects.",
         "enum": [
            "string",
            "int",
            "bool",
            "duration",
            "slack_user",
            "slack_user_list",
            "str_list",
            "int_list"
         ],
         "type": "string"
      },
      "FieldOption": {
         "title": "FieldOption",
         "description": "An option to display in a drop-down menu.\nFieldOptions represent value-label pairs to use in drop-down menus. They may be returned by\nPrefetch Reducers to dynamically generate a list of options for Prompt Fields with\n`prefetch = true`.\n\nThey are also used in :class:`~sym.sdk.forms.PromptField` objects to represent the selected\ndrop-down value as well as the list of selectable options for that field.",
         "type": "object",
         "properties": {
            "value": {
               "title": "Value"
            },
            "label": {
               "title": "Label",
               "maxLength": 55,
               "type": "string"
            }
         },
         "required": [
            "label"
         ]
      }
   }
}

Config
  • validate_assignment: bool = True

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.

classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

classmethod from_orm(obj: Any) Model
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict().

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().

classmethod parse_file(path: Union[str, pathlib.Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model
classmethod parse_obj(obj: Any) Model
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') DictStrAny
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) unicode
classmethod update_forward_refs(**localns: Any) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

classmethod validate(value: Any) Model
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”).

Show JSON schema
{
   "title": "SlackUserSelection",
   "description": "A representation of a Slack user who has been selected in a Slack user drop-down menu\n(i.e. a Sym prompt_field with a type of \"slack_user\" or \"slack_user_list\").",
   "type": "object",
   "properties": {
      "user_id": {
         "title": "User Id",
         "type": "string"
      },
      "username": {
         "title": "Username",
         "type": "string"
      }
   },
   "required": [
      "user_id"
   ]
}

Config
  • validate_assignment: bool = True

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.

classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

classmethod from_orm(obj: Any) Model
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict().

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().

classmethod parse_file(path: Union[str, pathlib.Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model
classmethod parse_obj(obj: Any) Model
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') DictStrAny
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) unicode
classmethod update_forward_refs(**localns: Any) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

classmethod validate(value: Any) Model
pydantic model sym.sdk.forms.SymPromptForm

Bases: pydantic.main.BaseModel

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

Show JSON schema
{
   "title": "SymPromptForm",
   "description": "The current state of a form used to submit an access request to Sym.",
   "type": "object",
   "properties": {
      "fields": {
         "title": "Fields",
         "type": "object",
         "additionalProperties": {
            "$ref": "#/definitions/PromptField"
         }
      }
   },
   "required": [
      "fields"
   ],
   "definitions": {
      "FieldType": {
         "title": "FieldType",
         "description": "Allowed data types for :class:`~sym.sdk.forms.PromptField` objects.",
         "enum": [
            "string",
            "int",
            "bool",
            "duration",
            "slack_user",
            "slack_user_list",
            "str_list",
            "int_list"
         ],
         "type": "string"
      },
      "FieldOption": {
         "title": "FieldOption",
         "description": "An option to display in a drop-down menu.\nFieldOptions represent value-label pairs to use in drop-down menus. They may be returned by\nPrefetch Reducers to dynamically generate a list of options for Prompt Fields with\n`prefetch = true`.\n\nThey are also used in :class:`~sym.sdk.forms.PromptField` objects to represent the selected\ndrop-down value as well as the list of selectable options for that field.",
         "type": "object",
         "properties": {
            "value": {
               "title": "Value"
            },
            "label": {
               "title": "Label",
               "maxLength": 55,
               "type": "string"
            }
         },
         "required": [
            "label"
         ]
      },
      "PromptField": {
         "title": "PromptField",
         "description": "The current state of a prompt_field Terraform block representing an input field\nfor a form used to make a Sym access request.\n\nSee `the Terraform registry <https://registry.terraform.io/providers/symopsio/sym/latest/docs/resources/flow#nestedblock--params--prompt_field>`_\nfor more information about how these are defined on a :class:`~sym.sdk.flow.Flow`.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "$ref": "#/definitions/FieldType"
            },
            "value": {
               "title": "Value"
            },
            "label": {
               "title": "Label",
               "type": "string"
            },
            "required": {
               "title": "Required",
               "default": true,
               "type": "boolean"
            },
            "current_allowed_values": {
               "title": "Current Allowed Values",
               "default": [],
               "type": "array",
               "items": {
                  "$ref": "#/definitions/FieldOption"
               }
            },
            "original_allowed_values": {
               "title": "Original Allowed Values",
               "default": [],
               "type": "array",
               "items": {
                  "$ref": "#/definitions/FieldOption"
               }
            },
            "visible": {
               "title": "Visible",
               "default": true,
               "type": "boolean"
            }
         },
         "required": [
            "name",
            "type"
         ]
      }
   }
}

Fields
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.

classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

classmethod from_orm(obj: Any) Model
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict().

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().

classmethod parse_file(path: Union[str, pathlib.Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model
classmethod parse_obj(obj: Any) Model
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') DictStrAny
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) unicode
classmethod update_forward_refs(**localns: Any) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

classmethod validate(value: Any) Model