Go 1.11은 지원이 종료되었으며 2026년 1월 31일에 지원 중단됩니다. 지원 중단 후에는 조직에서 이전에 조직 정책을 사용하여 레거시 런타임의 배포를 다시 사용 설정한 경우에도 Go 1.11 애플리케이션을 배포할 수 없습니다. 기존 Go 1.11 애플리케이션은 지원 중단 날짜 이후에도 계속 실행되고 트래픽을 수신합니다. 지원되는 최신 Go 버전으로 마이그레이션하는 것이 좋습니다.
Capabilities API를 사용하면 애플리케이션이 특정 API 기능의 서비스 중단 및 예정된 다운타임을 감지할 수 있습니다. 이 API를 사용하면 특정 기능을 사용할 수 없을 때 이를 감지하고 해당 기능을 우회하여 애플리케이션의 다운타임을 줄일 수 있습니다. capability 패키지의 콘텐츠를 보려면 capability 패키지 참조를 확인하세요.
.
예를 들어 Datastore API를 사용하는 경우 Capabilities API를 사용하면 Datastore API를 사용할 수 없을 때 이를 감지하여 사용자에게 오류를 보고할 수 있습니다.
funchandler(whttp.ResponseWriter,r*http.Request){ctx:=appengine.NewContext(r)// Check if the Datastore API is availableif!capability.Enabled(ctx,"datastore_v3","*"){http.Error(w,"This service is currently unavailable.",503)return}// do Datastore lookup ...}
Datastore 읽기 및 쓰기 가능 여부도 별도로 쿼리할 수 있습니다. 다음 샘플은 Datastore 쓰기 가능 여부를 감지하는 방법을 보여주고, 다운타임 중 사용자에게 메시지를 제공합니다.
funccheckDatastoreMode(whttp.ResponseWriter,r*http.Request){ctx:=appengine.NewContext(r)// Check if the Datastore service is in read-only mode.if!capability.Enabled(ctx,"datastore_v3","write"){// Datastore is in read-only mode.}}
Go 1.11에서 Capabilities API 사용
capability.Enabled 함수는 제공된 API와 기능을 사용할 수 있는 경우에 true를 반환합니다. 기능 이름(예: "write")을 전달해야 하며 와일드 카드 "*"로 API의 모든 기능을 쿼리할 수도 있습니다.
[[["이해하기 쉬움","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-09-04(UTC)"],[[["\u003cp\u003eThe Capabilities API allows applications to detect outages and scheduled downtime for specific API capabilities, helping to reduce downtime by identifying when a capability is unavailable and bypassing it.\u003c/p\u003e\n"],["\u003cp\u003eThis API is designed for first-generation runtimes and remains usable when upgrading to corresponding second-generation runtimes, although those upgrading to Go 1.12+ should consult the migration guide.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ecapability.Enabled\u003c/code\u003e function verifies the availability of a given API and capability, and requires a capability name like \u003ccode\u003e"write"\u003c/code\u003e or the wildcard \u003ccode\u003e"*"\u003c/code\u003e for querying all API capabilities.\u003c/p\u003e\n"],["\u003cp\u003eDatastore writes are the only exception to the usual behavior, with the API returning \u003ccode\u003eDISABLED\u003c/code\u003e when Datastore is in read-only mode, whereas other statuses return \u003ccode\u003eENABLED\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eSupported capabilities include the availability of the blobstore, Datastore reads and writes, Mail service, Memcache service, Task Queue service, and URL Fetch service.\u003c/p\u003e\n"]]],[],null,["# Capabilities API for legacy bundled services\n\nWith the Capabilities API, your application can detect outages and scheduled\ndowntime for specific [API capabilities](#Supported_capabilities). You can use\nthis API to reduce downtime in your application by detecting when a capability\nis unavailable and then bypassing it. To view the contents of\nthe `capability` package, see the\n[`capability` package reference](/appengine/docs/legacy/standard/go111/reference/latest/capability).\n.\n| This API is supported for first-generation runtimes and can be used when [upgrading to corresponding second-generation runtimes](/appengine/docs/standard/\n| go\n| /services/access). If you are updating to the App Engine Go 1.12+ runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/go-differences) to learn about your migration options for legacy bundled services.\n| Every status request to this API always returns `ENABLED` except\n| for the \"Datastore writes\" capability, which returns `DISABLED` if\n| Datastore is in read-only mode for your app.\n\nFor example, if you use the Datastore API, you can use the Capabilities API to\ndetect when the Datastore API is unavailable and report an error to the user: \n\n func handler(w http.ResponseWriter, r *http.Request) {\n \tctx := appengine.NewContext(r)\n \t// Check if the Datastore API is available\n \tif !capability.Enabled(ctx, \"datastore_v3\", \"*\") {\n \t\thttp.Error(w, \"This service is currently unavailable.\", 503)\n \t\treturn\n \t}\n \t// do Datastore lookup ...\n }\n\nYou can separately query for the availability of Datastore reads and writes. The\nfollowing sample shows how to detect the availability of Datastore writes and,\nduring downtime, provide a message to users: \n\n func checkDatastoreMode(w http.ResponseWriter, r *http.Request) {\n \tctx := appengine.NewContext(r)\n \t// Check if the Datastore service is in read-only mode.\n \tif !capability.Enabled(ctx, \"datastore_v3\", \"write\") {\n \t\t// Datastore is in read-only mode.\n \t}\n\n }\n\nUsing the Capabilities API in Go 1.11\n-------------------------------------\n\nThe [`capability.Enabled`](/appengine/docs/legacy/standard/go111/reference/latest/capability#google_golang_org_appengine_capability_Enabled)\nfunction returns true if the provided API and capability are available. You must\npass either a capability name (such as `\"write\"`) or the wildcard `\"*\"` to query\nall capabilities of the API.\n\nSupported capabilities\n----------------------\n\nThe API currently supports the following capabilities:"]]