Skip to content

update_asset_file async

update_asset_file(
    agent_space_id: AgentSpaceIdentifier,
    asset_id: ResourceId,
    path: AssetFilePath,
    *,
    config_overrides: Optional[AsyncDevOpsAgentClientConfig] = None,
    content: Optional[AssetFileBody] = None,
    metadata: Optional[object] = None,
    client_token: Optional[str] = None,
) -> UpdateAssetFileResponse

Updates a file in an asset

Parameters:

  • agent_space_id (AgentSpaceIdentifier) –

    The unique identifier for the agent space containing the asset

  • asset_id (ResourceId) –

    The unique identifier of the asset containing the file

  • path (AssetFilePath) –

    The path of the file within the asset to update

  • content (Optional[AssetFileBody], default: None ) –

    Updated file content. If omitted, the existing content is unchanged.

  • metadata (Optional[object], default: None ) –

    Metadata fields to update. Only the fields present in this document are updated. Omitted fields retain their current values.

  • client_token (Optional[str], default: None ) –

    A unique, case-sensitive identifier used for idempotent asset file update

Raises:

Source code in docs_src/capo_devops_agent/_services/async_dev_ops_agent.py
async def update_asset_file(
    self,
    agent_space_id: "capo_devops_agent.types.agent_space_identifier.AgentSpaceIdentifier",
    asset_id: "capo_devops_agent.types.resource_id.ResourceId",
    path: "capo_devops_agent.types.asset_file_path.AssetFilePath",
    *,
    config_overrides: Optional[AsyncDevOpsAgentClientConfig] = None,
    content: Optional[
        "capo_devops_agent.types.asset_file_body.AssetFileBody"
    ] = None,
    metadata: Optional[object] = None,
    client_token: Optional[str] = None,
) -> "capo_devops_agent.types.update_asset_file_response.UpdateAssetFileResponse":
    """<p>Updates a file in an asset</p>

    Args:
        agent_space_id: <p>The unique identifier for the agent space containing the asset</p>
        asset_id: <p>The unique identifier of the asset containing the file</p>
        path: <p>The path of the file within the asset to update</p>
        content: <p>Updated file content. If omitted, the existing content is unchanged.</p>
        metadata: <p>Metadata fields to update. Only the fields present in this document are updated. Omitted fields retain their current values.</p>
        client_token: <p>A unique, case-sensitive identifier used for idempotent asset file update</p>

    Raises:
        capo_devops_agent.errors.access_denied_exception.AccessDeniedException: <p>Access to the requested resource is denied due to insufficient permissions.</p>
        capo_devops_agent.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource.</p>
        capo_devops_agent.errors.content_size_exceeded_exception.ContentSizeExceededException: <p>This exception is thrown when the content size exceeds the allowed limit.</p>
        capo_devops_agent.errors.internal_server_exception.InternalServerException: <p>This exception is thrown when an unexpected error occurs in the processing of a request.</p>
        capo_devops_agent.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more parameters provided in the request are invalid.</p>
        capo_devops_agent.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource could not be found.</p>
        capo_devops_agent.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would exceed the service quota limit.</p>
        capo_devops_agent.errors.throttling_exception.ThrottlingException: <p>The request was throttled due to too many requests. Please slow down and try again.</p>
        capo_devops_agent.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service.</p>
        capo_devops_agent.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_devops_agent.types.update_asset_file_request.UpdateAssetFileRequest]",
    ) -> AsyncOperationResponse[
        "capo_devops_agent.types.update_asset_file_response.UpdateAssetFileResponse"
    ]:
        import capo_devops_agent._operations.dev_ops_agent.update_asset_file

        (
            output,
            http_response,
        ) = await capo_devops_agent._operations.dev_ops_agent.update_asset_file.async_update_asset_file(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateAssetFile")
    )
    input_: capo_devops_agent.types.update_asset_file_request.UpdateAssetFileRequest = {
        "agent_space_id": agent_space_id,
        "asset_id": asset_id,
        "path": path,
    }
    if content is not None:
        input_["content"] = content
    if metadata is not None:
        input_["metadata"] = metadata
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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