Skip to content

update_script

update_script(
    *,
    config_overrides: Optional[GameLiftClientConfig] = None,
    script_id: Optional[ScriptIdOrArn] = None,
    name: Optional[NonZeroAndMaxString] = None,
    version: Optional[NonZeroAndMaxString] = None,
    storage_location: Optional[S3Location] = None,
    zip_file: Optional[ZipBlob] = None,
) -> UpdateScriptOutput

This API works with the following fleet types: EC2

Updates Realtime script metadata and content.

To update script metadata, specify the script ID and provide updated name and/or version values.

To update script content, provide an updated zip file by pointing to either a local file or an Amazon S3 bucket location. You can use either method regardless of how the original script was uploaded. Use the Version parameter to track updates to the script.

If the call is successful, the updated metadata is stored in the script record and a revised script is uploaded to the Amazon GameLift Servers service. Once the script is updated and acquired by a fleet instance, the new version is used for all new game sessions.

Learn more

Amazon GameLift Servers Amazon GameLift Servers Realtime

Related actions

All APIs by task

Parameters:

  • script_id (Optional[ScriptIdOrArn], default: None ) –

    A unique identifier for the Realtime script to update. You can use either the script ID or ARN value.

  • name (Optional[NonZeroAndMaxString], default: None ) –

    A descriptive label that is associated with a script. Script names do not need to be unique.

  • version (Optional[NonZeroAndMaxString], default: None ) –

    Version information that is associated with a build or script. Version strings do not need to be unique.

  • storage_location (Optional[S3Location], default: None ) –

    The location of the Amazon S3 bucket where a zipped file containing your Realtime scripts is stored. The storage location must specify the Amazon S3 bucket name, the zip file name (the "key"), and a role ARN that allows Amazon GameLift Servers to access the Amazon S3 storage location. The S3 bucket must be in the same Region where you want to create a new script. By default, Amazon GameLift Servers uploads the latest version of the zip file; if you have S3 object versioning turned on, you can use the ObjectVersion parameter to specify an earlier version.

  • zip_file (Optional[ZipBlob], default: None ) –

    A data object containing your Realtime scripts and dependencies as a zip file. The zip file can have one or multiple files. Maximum size of a zip file is 5 MB.

    When using the Amazon Web Services CLI tool to create a script, this parameter is set to the zip file name. It must be prepended with the string "fileb://" to indicate that the file data is a binary object. For example: --zip-file fileb://myRealtimeScript.zip.

Raises:

  • InternalServiceException –

    The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.

  • InvalidRequestException –

    One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.

  • NotFoundException –

    The requested resource was not found. The resource was either not created yet or deleted.

  • UnauthorizedException –

    The client failed authentication. Clients should not retry such requests.

  • UnknownServiceError –

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

Source code in docs_src/capo_gamelift/_services/game_lift.py
def update_script(
    self,
    *,
    config_overrides: Optional[GameLiftClientConfig] = None,
    script_id: Optional[
        "capo_gamelift.types.script_id_or_arn.ScriptIdOrArn"
    ] = None,
    name: Optional[
        "capo_gamelift.types.non_zero_and_max_string.NonZeroAndMaxString"
    ] = None,
    version: Optional[
        "capo_gamelift.types.non_zero_and_max_string.NonZeroAndMaxString"
    ] = None,
    storage_location: Optional["capo_gamelift.types.s3_location.S3Location"] = None,
    zip_file: Optional["capo_gamelift.types.zip_blob.ZipBlob"] = None,
) -> "capo_gamelift.types.update_script_output.UpdateScriptOutput":
    """<p> <b>This API works with the following fleet types:</b> EC2</p> <p>Updates Realtime script metadata and content.</p> <p>To update script metadata, specify the script ID and provide updated name and/or version values. </p> <p>To update script content, provide an updated zip file by pointing to either a local file or an Amazon S3 bucket location. You can use either method regardless of how the original script was uploaded. Use the <i>Version</i> parameter to track updates to the script.</p> <p>If the call is successful, the updated metadata is stored in the script record and a revised script is uploaded to the Amazon GameLift Servers service. Once the script is updated and acquired by a fleet instance, the new version is used for all new game sessions. </p> <p> <b>Learn more</b> </p> <p> <a href="https://docs.aws.amazon.com/gamelift/latest/developerguide/realtime-intro.html">Amazon GameLift Servers Amazon GameLift Servers Realtime</a> </p> <p> <b>Related actions</b> </p> <p> <a href="https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets">All APIs by task</a> </p>

    Args:
        script_id: <p>A unique identifier for the Realtime script to update. You can use either the script ID or ARN value.</p>
        name: <p>A descriptive label that is associated with a script. Script names do not need to be unique.</p>
        version: <p>Version information that is associated with a build or script. Version strings do not need to be unique.</p>
        storage_location: <p>The location of the Amazon S3 bucket where a zipped file containing your Realtime scripts is stored. The storage location must specify the Amazon S3 bucket name, the zip file name (the "key"), and a role ARN that allows Amazon GameLift Servers to access the Amazon S3 storage location. The S3 bucket must be in the same Region where you want to create a new script. By default, Amazon GameLift Servers uploads the latest version of the zip file; if you have S3 object versioning turned on, you can use the <code>ObjectVersion</code> parameter to specify an earlier version. </p>
        zip_file: <p>A data object containing your Realtime scripts and dependencies as a zip file. The zip file can have one or multiple files. Maximum size of a zip file is 5 MB.</p> <p>When using the Amazon Web Services CLI tool to create a script, this parameter is set to the zip file name. It must be prepended with the string "fileb://" to indicate that the file data is a binary object. For example: <code>--zip-file fileb://myRealtimeScript.zip</code>.</p>

    Raises:
        capo_gamelift.errors.internal_service_exception.InternalServiceException: <p>The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.</p>
        capo_gamelift.errors.invalid_request_exception.InvalidRequestException: <p>One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.</p>
        capo_gamelift.errors.not_found_exception.NotFoundException: <p>The requested resource was not found. The resource was either not created yet or deleted.</p>
        capo_gamelift.errors.unauthorized_exception.UnauthorizedException: <p>The client failed authentication. Clients should not retry such requests.</p>
        capo_gamelift.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_gamelift.types.update_script_input.UpdateScriptInput]",
    ) -> OperationResponse[
        "capo_gamelift.types.update_script_output.UpdateScriptOutput"
    ]:
        import capo_gamelift._operations.game_lift.update_script

        output, http_response = (
            capo_gamelift._operations.game_lift.update_script.update_script(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateScript")
    )
    input_: capo_gamelift.types.update_script_input.UpdateScriptInput = {}
    if script_id is not None:
        input_["script_id"] = script_id
    if name is not None:
        input_["name"] = name
    if version is not None:
        input_["version"] = version
    if storage_location is not None:
        input_["storage_location"] = storage_location
    if zip_file is not None:
        input_["zip_file"] = zip_file

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output