Skip to content

create_service_action async

create_service_action(
    name: ServiceActionName,
    definition_type: ServiceActionDefinitionType,
    definition: ServiceActionDefinitionMap,
    idempotency_token: IdempotencyToken,
    *,
    config_overrides: Optional[AsyncServiceCatalogClientConfig] = None,
    description: Optional[ServiceActionDescription] = None,
    accept_language: Optional[AcceptLanguage] = None,
) -> CreateServiceActionOutput

Creates a self-service action.

Parameters:

  • name (ServiceActionName) –

    The self-service action name.

  • definition_type (ServiceActionDefinitionType) –

    The service action definition type. For example, SSM_AUTOMATION.

  • definition (ServiceActionDefinitionMap) –

    The self-service action definition. Can be one of the following:

    Name

    The name of the Amazon Web Services Systems Manager document (SSM document). For example, AWS-RestartEC2Instance.

    If you are using a shared SSM document, you must provide the ARN instead of the name.

    Version

    The Amazon Web Services Systems Manager automation document version. For example, "Version": "1"

    AssumeRole

    The Amazon Resource Name (ARN) of the role that performs the self-service actions on your behalf. For example, "AssumeRole": "arn:aws:iam::12345678910:role/ActionRole".

    To reuse the provisioned product launch role, set to "AssumeRole": "LAUNCH_ROLE".

    Parameters

    The list of parameters in JSON format.

    For example: [{\"Name\":\"InstanceId\",\"Type\":\"TARGET\"}] or [{\"Name\":\"InstanceId\",\"Type\":\"TEXT_VALUE\"}].

  • description (Optional[ServiceActionDescription], default: None ) –

    The self-service action description.

  • accept_language (Optional[AcceptLanguage], default: None ) –

    The language code.

    • jp - Japanese

    • zh - Chinese

  • idempotency_token (IdempotencyToken) –

    A unique identifier that you provide to ensure idempotency. If multiple requests differ only by the idempotency token, the same response is returned for each repeated request.

Raises:

  • InvalidParametersException –

    One or more parameters provided to the operation are not valid.

  • LimitExceededException –

    The current limits of the service would have been exceeded by this operation. Decrease your resource use or increase your service limits and retry the operation.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_service_catalog/_services/async_service_catalog.py
async def create_service_action(
    self,
    name: "capo_service_catalog.types.service_action_name.ServiceActionName",
    definition_type: "capo_service_catalog.types.service_action_definition_type.ServiceActionDefinitionType",
    definition: "capo_service_catalog.types.service_action_definition_map.ServiceActionDefinitionMap",
    idempotency_token: "capo_service_catalog.types.idempotency_token.IdempotencyToken",
    *,
    config_overrides: Optional[AsyncServiceCatalogClientConfig] = None,
    description: Optional[
        "capo_service_catalog.types.service_action_description.ServiceActionDescription"
    ] = None,
    accept_language: Optional[
        "capo_service_catalog.types.accept_language.AcceptLanguage"
    ] = None,
) -> "capo_service_catalog.types.create_service_action_output.CreateServiceActionOutput":
    r"""<p>Creates a self-service action.</p>

    Args:
        name: <p>The self-service action name.</p>
        definition_type: <p>The service action definition type. For example, <code>SSM_AUTOMATION</code>.</p>
        definition: <p>The self-service action definition. Can be one of the following:</p> <dl> <dt>Name</dt> <dd> <p>The name of the Amazon Web Services Systems Manager document (SSM document). For example, <code>AWS-RestartEC2Instance</code>.</p> <p>If you are using a shared SSM document, you must provide the ARN instead of the name.</p> </dd> <dt>Version</dt> <dd> <p>The Amazon Web Services Systems Manager automation document version. For example, <code>"Version": "1"</code> </p> </dd> <dt>AssumeRole</dt> <dd> <p>The Amazon Resource Name (ARN) of the role that performs the self-service actions on your behalf. For example, <code>"AssumeRole": "arn:aws:iam::12345678910:role/ActionRole"</code>.</p> <p>To reuse the provisioned product launch role, set to <code>"AssumeRole": "LAUNCH_ROLE"</code>.</p> </dd> <dt>Parameters</dt> <dd> <p>The list of parameters in JSON format.</p> <p>For example: <code>[{\"Name\":\"InstanceId\",\"Type\":\"TARGET\"}]</code> or <code>[{\"Name\":\"InstanceId\",\"Type\":\"TEXT_VALUE\"}]</code>.</p> </dd> </dl>
        description: <p>The self-service action description.</p>
        accept_language: <p>The language code.</p> <ul> <li> <p> <code>jp</code> - Japanese</p> </li> <li> <p> <code>zh</code> - Chinese</p> </li> </ul>
        idempotency_token: <p>A unique identifier that you provide to ensure idempotency. If multiple requests differ only by the idempotency token, the same response is returned for each repeated request.</p>

    Raises:
        capo_service_catalog.errors.invalid_parameters_exception.InvalidParametersException: <p>One or more parameters provided to the operation are not valid.</p>
        capo_service_catalog.errors.limit_exceeded_exception.LimitExceededException: <p>The current limits of the service would have been exceeded by this operation. Decrease your resource use or increase your service limits and retry the operation.</p>
        capo_service_catalog.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_service_catalog.types.create_service_action_input.CreateServiceActionInput]",
    ) -> AsyncOperationResponse[
        "capo_service_catalog.types.create_service_action_output.CreateServiceActionOutput"
    ]:
        import capo_service_catalog._operations.aws242_service_catalog_service.create_service_action

        (
            output,
            http_response,
        ) = await capo_service_catalog._operations.aws242_service_catalog_service.create_service_action.async_create_service_action(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateServiceAction")
    )
    input_: capo_service_catalog.types.create_service_action_input.CreateServiceActionInput = {
        "name": name,
        "definition_type": definition_type,
        "definition": definition,
        "idempotency_token": idempotency_token,
    }
    if description is not None:
        input_["description"] = description
    if accept_language is not None:
        input_["accept_language"] = accept_language

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output