A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cloud.google.com/storage/docs/using-long-running-operations below:

Use long-running operations in Cloud Storage

Use long-running operations in Cloud Storage

Stay organized with collections Save and categorize content based on your preferences.

This page describes how to use long-running operations that get initiated from using method calls in Cloud Storage. For detailed information about the semantics of a long-running operation that gets returned from a specific method call, see the feature-specific documentation.

Get required roles

To get the permissions that you need to manage long-running operations in Cloud Storage, ask your administrator to grant you the Storage Admin (roles/storage.admin) role or the Storage Legacy Bucket Owner (roles/storage.legacyBucketOwner) role on the bucket or the project used to perform the underlying operation.

These predefined roles contain the following permissions, which are required to manage long-running operations in Cloud Storage:

Note: The user who initiates a long-running operation can always get the details of the long-running operation, regardless of whether or not they have the storage.bucketOperations.get IAM permission. Users who did not initiate the long-running operation must have the storage.bucketOperations.get in order to get the details of the long-running operation. The storage.bucketOperations.list and storage.bucketOperations.cancel permissions are always required in order to list and cancel long-running operations.

For information about granting roles on buckets, see Set and manage IAM policies on buckets. For information about granting roles on projects, see Manage access.

Get the details of a long-running operation Command line Note: The Google Cloud CLI automatically specifies a default project, which can be controlled using the --project flag.

To get the details or check the status of a long-running operation, use the gcloud storage operations describe command:

gcloud storage operations describe projects/_/buckets/BUCKET_NAME/operations/OPERATION_ID

Replace:

REST APIs JSON API
  1. Have gcloud CLI installed and initialized, which lets you generate an access token for the Authorization header.

  2. Use cURL to call the JSON API with an operations.get request:

    curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    "https://storage.googleapis.com/storage/v1/b/BUCKET_NAME/operations/OPERATION_ID"

    Replace:

If the request is successful, an operations resource is returned:

{
  "kind": "storage#operation",
  "name": "projects/_/buckets/bucket/operations/operation_id",
  "metadata": {
    "@type": OperationMetadataType*,
    metadata OperationMetadata*
  },
  "done": boolean,
  "response": {
    "@type": ResponseResourceType*,
    response ResponseResource*
  }
}
List the long-running operations in a bucket Command line

To list the long-running operations in a bucket, use the gcloud storage operations list command:

gcloud storage operations list gs://BUCKET_NAME

Replace:

REST APIs Cancel a long-running operation Note: Cancelling a long-running operation is asynchronous and done at best-effort. A cancel request on a running long-running operation sets the requested cancellation field, but there's no guarantee that the request will be honored. Command line Note: The Google Cloud CLI automatically specifies a default project, which can be controlled using the --project flag.

To cancel a long-running operation, use the gcloud storage operations cancel command:

gcloud storage operations cancel projects/_/buckets/BUCKET_NAME/operations/OPERATION_ID

Replace:

REST APIs JSON API
  1. Have gcloud CLI installed and initialized, which lets you generate an access token for the Authorization header.

  2. Use cURL to call the JSON API with an operations.post request:

    curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    "https://storage.googleapis.com/storage/v1/b/BUCKET_NAME/operations/OPERATION_ID/cancel"

    Replace:

Long-running operations have metadata associated with them. The following metadata identify properties of a long-running operation:

Error handling

Long-running operations are initiated from asynchronous APIs and require different error handling practices than synchronous APIs. Unlike synchronous APIs, the response to asynchronous API calls can indicate success even if the long-running operation eventually fails. Instead of relying on the status code that gets returned in the response headers, you should parse the long-running operation metadata in the body of the response to determine whether an API call was successful.

For example, if you make a soft delete bulk restore request, it returns a successful HTTP status code (200 OK) even if an error occurs over the course of the operation. To check whether the bulk restore operation was successful, get the status of the long-running operation.

Note that the long-running operation APIs (Get, List, Cancel) are synchronous and return normal errors.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-02 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-02 UTC."],[],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.5