המשאב הזה מייצג פעולה ממושכת שמוחזרת מקריאה ל-API ברשת.
ייצוג ב-JSON
{"name": string,"metadata": {"@type": string,field1: ...,...},"done": boolean,// Union field result can be only one of the following:"error": {object (Status)},"response": {"@type": string,field1: ...,...}// End of list of possible types for union field result.}
שדות
name
string
השם שהוקצה על ידי השרת, שהוא ייחודי רק באותו שירות שמחזיר אותו במקור. אם משתמשים במיפוי ברירת המחדל של HTTP, השדה name צריך להיות שם משאב שמסתיים ב-operations/{unique_id}.
metadata
object
מטא-נתונים ספציפיים לשירות שמשויכים לפעולה. בדרך כלל הוא מכיל מידע על ההתקדמות ומטא-נתונים נפוצים כמו זמן היצירה. יכול להיות שחלק מהשירותים לא יספק מטא-נתונים כאלה. כל שיטה שמחזירה פעולה ממושכת צריכה לתעד את סוג המטא-נתונים, אם יש כאלה.
אובייקט שמכיל שדות מסוג שרירותי. שדה נוסף "@type" מכיל URI שמזהה את הסוג. דוגמה: { "id": 1234, "@type": "types.example.com/standard/id" }.
done
boolean
אם הערך הוא false, הפעולה עדיין נמשכת. אם הערך הוא true, הפעולה הושלמה ואפשר להשתמש ב-error או ב-response.
שדה האיחוד result. תוצאת הפעולה, שיכולה להיות error או response חוקי. אם done == false, לא מתבצעת הגדרה של error או של response. אם done == true, אפשר להגדיר רק אחד מ-error או מ-response. יכול להיות שחלק מהשירותים לא יספק את התוצאה. הערך של result יכול להיות רק אחת מהאפשרויות הבאות:
התגובה הרגילה והמוצלחת של הפעולה. אם השיטה המקורית לא מחזירה נתונים במקרה של הצלחה, כמו Delete, התגובה היא google.protobuf.Empty. אם השיטה המקורית היא Get/Create/Update רגילה, התגובה צריכה להיות המשאב. בשיטות אחרות, התשובה צריכה להיות מסוג XxxResponse, כאשר Xxx הוא שם השיטה המקורית. לדוגמה, אם שם השיטה המקורית הוא TakeSnapshot(), סוג התגובה המשוער הוא TakeSnapshotResponse.
אובייקט שמכיל שדות מסוג שרירותי. שדה נוסף "@type" מכיל URI שמזהה את הסוג. דוגמה: { "id": 1234, "@type": "types.example.com/standard/id" }.
סטטוס
הסוג Status מגדיר מודל שגיאה לוגי שמתאים לסביבות תכנות שונות, כולל ממשקי API ל-REST וממשקי API ל-RPC. הוא משמש את gRPC. כל הודעה מסוג Status מכילה שלושה נתונים: קוד שגיאה, הודעת שגיאה ופרטי השגיאה.
מידע נוסף על מודל השגיאות הזה ועל אופן השימוש בו זמין במדריך לעיצוב API.
קוד הסטטוס, שצריך להיות ערך enum של google.rpc.Code.
message
string
הודעת שגיאה למפתחים, שצריכה להיות באנגלית. כל הודעת שגיאה שמוצגת למשתמש צריכה להיות מותאמת לשוק המקומי ונשלחת בשדה google.rpc.Status.details, או שמותאמת על ידי הלקוח.
details[]
object
רשימה של הודעות שמכילות את פרטי השגיאה. יש קבוצה משותפת של סוגי הודעות שאפשר להשתמש בהם בממשקי API.
אובייקט שמכיל שדות מסוג שרירותי. שדה נוסף "@type" מכיל URI שמזהה את הסוג. דוגמה: { "id": 1234, "@type": "types.example.com/standard/id" }.
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["התוכן קשה להבנה","hardToUnderstand","thumb-down"],["שגיאות בקוד לדוגמה או במידע","incorrectInformationOrSampleCode","thumb-down"],["חסרים לי פרטים או דוגמאות","missingTheInformationSamplesINeed","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-06-09 (שעון UTC)."],[[["\u003cp\u003eThe \u003ccode\u003eOperation\u003c/code\u003e resource represents a long-running operation resulting from a network API call, and its \u003ccode\u003edone\u003c/code\u003e field indicates whether the operation is still in progress or completed.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eOperation\u003c/code\u003e resource's result is represented by the \u003ccode\u003eresult\u003c/code\u003e field, which can be either an \u003ccode\u003eerror\u003c/code\u003e object of type \u003ccode\u003eStatus\u003c/code\u003e, or a valid \u003ccode\u003eresponse\u003c/code\u003e object containing arbitrary fields and an identifying type URI.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eStatus\u003c/code\u003e type defines an error model with \u003ccode\u003ecode\u003c/code\u003e, \u003ccode\u003emessage\u003c/code\u003e, and \u003ccode\u003edetails\u003c/code\u003e fields, suitable for various programming environments and used by gRPC.\u003c/p\u003e\n"],["\u003cp\u003eSeveral methods are available to manage operations, including \u003ccode\u003ecancel\u003c/code\u003e, \u003ccode\u003edelete\u003c/code\u003e, \u003ccode\u003eget\u003c/code\u003e, and \u003ccode\u003elist\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# REST Resource: projects.locations.operations\n\n- [Resource: Operation](#Operation)\n - [JSON representation](#Operation.SCHEMA_REPRESENTATION)\n- [Status](#Status)\n - [JSON representation](#Status.SCHEMA_REPRESENTATION)\n- [Methods](#METHODS_SUMMARY)\n\nResource: Operation\n-------------------\n\nThis resource represents a long-running operation that is the result of a network API call.\n\nStatus\n------\n\nThe `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors)."]]