Skip to content

AWS Workspace creation raises ParamValidationError #122

@Chaimaa-Br

Description

@Chaimaa-Br

Hello,

I'm trying to automate AWS Workspace creation using the aws.workspaces_create_workspaces action but the input format seems to be wrong.

The action parameters are :

image

In my Workspaces input parameter, I provide an array as follow :

{ 'DirectoryId': 'xxxxxxx', 'BundleId': 'xxxxxxx', 'UserName': 'xxxxxxx'}

But I receive the following error because it takes every comma seperated K/V and it considers it a value in the Workspaces[n] array :

{
  "stdout": "",
  "stderr": "st2.actions.python.ActionManager: DEBUG    Calling method \"boto3.workspaces.create_workspaces\" with kwargs: {'Workspaces': [\"{ 'DirectoryId': 'xxxxxxxxxx'\", \"'BundleId': 'xxxxxx'\", \"'UserName': 'xxxxxx'}\"]}
Traceback (most recent call last):
  File \"/opt/stackstorm/st2/lib/python3.8/site-packages/python_runner/python_action_wrapper.py\", line 395, in <module>
    obj.run()
  File \"/opt/stackstorm/st2/lib/python3.8/site-packages/python_runner/python_action_wrapper.py\", line 214, in run
    output = action.run(**self._parameters)
  File \"/opt/stackstorm/packs/aws/actions/run.py\", line 36, in run
    return self.do_method(module_path, cls, aws_action, **kwargs)
  File \"/opt/stackstorm/packs/aws/actions/lib/action.py\", line 224, in do_method
    resultset = getattr(obj, action)(**kwargs)
  File \"/opt/stackstorm/virtualenvs/aws/lib/python3.8/site-packages/botocore/client.py\", line 251, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File \"/opt/stackstorm/virtualenvs/aws/lib/python3.8/site-packages/botocore/client.py\", line 512, in _make_api_call
    request_dict = self._convert_to_request_dict(
  File \"/opt/stackstorm/virtualenvs/aws/lib/python3.8/site-packages/botocore/client.py\", line 565, in _convert_to_request_dict
    request_dict = self._serializer.serialize_to_request(
  File \"/opt/stackstorm/virtualenvs/aws/lib/python3.8/site-packages/botocore/validate.py\", line 270, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for parameter Workspaces[0], value: { 'DirectoryId': 'xxxxxxx', type: <class 'str'>, valid types: <class 'dict'>
Invalid type for parameter Workspaces[1], value: 'BundleId': 'xxxxxxxx', type: <class 'str'>, valid types: <class 'dict'>
Invalid type for parameter Workspaces[2], value: 'UserName': 'xxxxxxx'}, type: <class 'str'>, valid types: <class 'dict'>
",
  "exit_code": 1,
  "result": "None"
} 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions