Reference documentation and code samples for the Google Cloud Api Keys V2 Client class ApiTarget.
A restriction for a specific service and optionally one or multiple
specific methods. Both fields are case insensitive.
Generated from protobuf messagegoogle.api.apikeys.v2.ApiTarget
Namespace
Google \ Cloud \ ApiKeys \ V2
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ service
string
The service for this restriction. It should be the canonical service name, for example:translate.googleapis.com. You can usegcloud services listto get a list of services that are enabled in the project.
↳ methods
array
Optional. List of one or more methods that can be called. If empty, all methods for the service are allowed. A wildcard () can be used as the last symbol. Valid examples:google.cloud.translate.v2.TranslateService.GetSupportedLanguageTranslateText`Get`translate.googleapis.com.Get*
getService
The service for this restriction. It should be the canonical
service name, for example:translate.googleapis.com.
You can usegcloud services listto get a list of services that are enabled in the project.
Returns
Type
Description
string
setService
The service for this restriction. It should be the canonical
service name, for example:translate.googleapis.com.
You can usegcloud services listto get a list of services that are enabled in the project.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getMethods
Optional. List of one or more methods that can be called.
If empty, all methods for the service are allowed. A wildcard
() can be used as the last symbol.
Valid examples:google.cloud.translate.v2.TranslateService.GetSupportedLanguageTranslateText`Get`translate.googleapis.com.Get*
Optional. List of one or more methods that can be called.
If empty, all methods for the service are allowed. A wildcard
() can be used as the last symbol.
Valid examples:google.cloud.translate.v2.TranslateService.GetSupportedLanguageTranslateText`Get`translate.googleapis.com.Get*
[[["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-09-04 UTC."],[],[],null,["# Google Cloud Api Keys V2 Client - Class ApiTarget (1.0.5)\n\nVersion latestkeyboard_arrow_down\n\n- [1.0.5 (latest)](/php/docs/reference/cloud-api-keys/latest/V2.ApiTarget)\n- [1.0.4](/php/docs/reference/cloud-api-keys/1.0.4/V2.ApiTarget)\n- [0.4.5](/php/docs/reference/cloud-api-keys/0.4.5/V2.ApiTarget)\n- [0.3.3](/php/docs/reference/cloud-api-keys/0.3.3/V2.ApiTarget)\n- [0.2.2](/php/docs/reference/cloud-api-keys/0.2.2/V2.ApiTarget)\n- [0.1.7](/php/docs/reference/cloud-api-keys/0.1.7/V2.ApiTarget) \nReference documentation and code samples for the Google Cloud Api Keys V2 Client class ApiTarget.\n\nA restriction for a specific service and optionally one or multiple\nspecific methods. Both fields are case insensitive.\n\nGenerated from protobuf message `google.api.apikeys.v2.ApiTarget`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ ApiKeys \\\\ V2\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getService\n\nThe service for this restriction. It should be the canonical\nservice name, for example: `translate.googleapis.com`.\n\nYou can use [`gcloud services list`](/sdk/gcloud/reference/services/list)\nto get a list of services that are enabled in the project.\n\n### setService\n\nThe service for this restriction. It should be the canonical\nservice name, for example: `translate.googleapis.com`.\n\nYou can use [`gcloud services list`](/sdk/gcloud/reference/services/list)\nto get a list of services that are enabled in the project.\n\n### getMethods\n\nOptional. List of one or more methods that can be called.\n\nIf empty, all methods for the service are allowed. A wildcard\n(*) can be used as the last symbol.\nValid examples:\n`google.cloud.translate.v2.TranslateService.GetSupportedLanguage`\n`TranslateText`\n\\`Get* ```translate.googleapis.com.Get*``\n\n### setMethods\n\nOptional. List of one or more methods that can be called.\n\nIf empty, all methods for the service are allowed. A wildcard\n(*) can be used as the last symbol.\nValid examples:\n`google.cloud.translate.v2.TranslateService.GetSupportedLanguage`\n`TranslateText`\n\\`Get* ```translate.googleapis.com.Get*``"]]