This page describes how to manage the lifecycle of a Live Stream API Long-Running Operation (LRO).
Long-Running Operations
are returned when method
calls might take a long time to complete. For example, the Live Stream API
creates an LRO every time you call projects.locations.inputs.create
.
The LRO tracks the status of the processing job.
You can use the projects.locations.operations
methods
that the Live Stream API provides to check the status
of
LROs. You can also list
, cancel
,
or delete
LROs.
LROs are managed at the Google Cloud project and location level. When making a request to the API, include the Google Cloud project and the location in which the LRO is running.
The record of an LRO is kept for approximately 30 days after the LRO finishes, meaning that you cannot view or list an LRO after that point.
Get details about a long-running operation
Suppose you created an input endpoint
.
The name
value in the response shows that the Live Stream API
created an LRO named projects/ PROJECT_NUMBER
/locations/ LOCATION
/operations/ OPERATION_ID
.
To check if the input endpoint has been created, use the projects.locations.operations.get
method. If the response contains "done": false
, repeat the command until the
response contains "done": true
. This operation can take a few minutes to
complete.
You can also retrieve the LRO name by listing long-running operations .
Before using any of the request data, make the following replacements:
-
PROJECT_NUMBER
: your Google Cloud project number; this is located in the Project number field on the IAM Settings page -
LOCATION
: the location where your input endpoint is located; use one of the supported regionsShow locations-
us-central1
-
us-east1
-
us-east4
-
us-west1
-
us-west2
-
northamerica-northeast1
-
southamerica-east1
-
asia-east1
-
asia-east2
-
asia-south1
-
asia-northeast1
-
asia-southeast1
-
australia-southeast1
-
europe-north1
-
europe-west1
-
europe-west2
-
europe-west3
-
europe-west4
-
-
OPERATION_ID
: the identifier for the operation
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/ PROJECT_NUMBER /locations/ LOCATION /operations/ OPERATION_ID ", "metadata": { "@type": "type.googleapis.com/google.cloud.video.livestream.v1.OperationMetadata", "createTime": CREATE_TIME , "endTime": END_TIME , "target": "projects/ PROJECT_NUMBER /locations/ LOCATION /inputs/ INPUT_ID ", "verb": "create", "requestedCancellation": false, "apiVersion": "v1" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.video.livestream.v1.Input", "name": "projects/ PROJECT_NUMBER /locations/ LOCATION /inputs/ INPUT_ID ", "createTime": CREATE_TIME , "updateTime": UPDATE_TIME , "type": "RTMP_PUSH", "uri": INPUT_STREAM_URI , # For example, "rtmp://1.2.3.4/live/b8ebdd94-c8d9-4d88-a16e-b963c43a953b", "tier": "HD" } }
List long-running operations
To list all of the operations in a given location, use the projects.locations.operations.list
method.
Before using any of the request data, make the following replacements:
-
PROJECT_NUMBER
: your Google Cloud project number; this is located in the Project number field on the IAM Settings page -
LOCATION
: the location of the operations; use one of the supported regionsShow locations-
us-central1
-
us-east1
-
us-east4
-
us-west1
-
us-west2
-
northamerica-northeast1
-
southamerica-east1
-
asia-east1
-
asia-east2
-
asia-south1
-
asia-northeast1
-
asia-southeast1
-
australia-southeast1
-
europe-north1
-
europe-west1
-
europe-west2
-
europe-west3
-
europe-west4
-
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "operations": [ { "name": "projects/ PROJECT_NUMBER /locations/ LOCATION /operations/ OPERATION_ID ", "metadata": { "@type": "type.googleapis.com/google.cloud.livestream.v1.OperationMetadata", "createTime": CREATE_TIME , "endTime": END_TIME , "target": "projects/ PROJECT_NUMBER /locations/ LOCATION /inputs/ INPUT_ID , "verb": "create", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }, { "name": "projects/ PROJECT_NUMBER /locations/ LOCATION /operations/ my-other-operation ", "metadata": { "@type": "type.googleapis.com/google.cloud.livestream.v1.OperationMetadata", "createTime": CREATE_TIME , "endTime": END_TIME , "target": "projects/ PROJECT_NUMBER /locations/ LOCATION /inputs/ my-other-input ", "verb": "create", "requestedCancellation": false, "apiVersion": "v1" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.livestream.v1.Input", "name": "projects/ PROJECT_NUMBER /locations/ LOCATION /inputs/ my-other-input ", "createTime": CREATE_TIME , "updateTime": UPDATE_TIME , "type": "RTMP_PUSH", "uri": INPUT_STREAM_URI , "tier": "HD" } } ] }
Cancel a long-running operation
To start asynchronous cancellation on a long-running operation, use the projects.locations.operations.cancel
method. The server makes a best effort to cancel the operation, but success is
not guaranteed.
Before using any of the request data, make the following replacements:
-
PROJECT_NUMBER
: your Google Cloud project number; this is located in the Project number field on the IAM Settings page -
LOCATION
: the location of the operation; use one of the supported regionsShow locations-
us-central1
-
us-east1
-
us-east4
-
us-west1
-
us-west2
-
northamerica-northeast1
-
southamerica-east1
-
asia-east1
-
asia-east2
-
asia-south1
-
asia-northeast1
-
asia-southeast1
-
australia-southeast1
-
europe-north1
-
europe-west1
-
europe-west2
-
europe-west3
-
europe-west4
-
-
OPERATION_ID
: the identifier for the operation
To send your request, expand one of these options:
You should receive an empty JSON object as the response:{}
Delete a long-running operation
To delete a completed long-running operation, use the projects.locations.operations.delete
method. This method indicates that the client is no longer interested in the
operation result. It does not cancel the operation.
Before using any of the request data, make the following replacements:
-
PROJECT_NUMBER
: your Google Cloud project number; this is located in the Project number field on the IAM Settings page -
LOCATION
: the location of the operation; use one of the supported regionsShow locations-
us-central1
-
us-east1
-
us-east4
-
us-west1
-
us-west2
-
northamerica-northeast1
-
southamerica-east1
-
asia-east1
-
asia-east2
-
asia-south1
-
asia-northeast1
-
asia-southeast1
-
australia-southeast1
-
europe-north1
-
europe-west1
-
europe-west2
-
europe-west3
-
europe-west4
-
-
OPERATION_ID
: the identifier for the operation
To send your request, expand one of these options:
You should receive an empty JSON object as the response:{}