Optional. Annotations for the service. This data can be consumed by service clients. Restrictions: * * The entire annotations dictionary may contain up to 2000 characters, spread accoss all key-value pairs. Annotations that go beyond this limit are rejected * * Valid annotation keys have two segments: an optional prefix and name, separated by a slash (/). The name segment is required and must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. The prefix is optional. If specified, the prefix must be a DNS subdomain: a series of DNS labels separated by dots (.), not longer than 253 characters in total, followed by a slash (/). Annotations that fails to meet these requirements are rejected Note: This field is equivalent to themetadatafield in the v1beta1 API. They have the same syntax and read/write to the same location in Service Directory.
Output only. The globally unique identifier of the service in the UUID4 format.
getName
Immutable. The resource name for the service in the formatprojects/*/locations/*/namespaces/*/services/*.
Returns
Type
Description
string
setName
Immutable. The resource name for the service in the formatprojects/*/locations/*/namespaces/*/services/*.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getAnnotations
Optional. Annotations for the service. This data can be consumed by service
clients.
Restrictions:
The entire annotations dictionary may contain up to 2000 characters,
spread accoss all key-value pairs. Annotations that go beyond this
limit are rejected
Valid annotation keys have two segments: an optional prefix and name,
separated by a slash (/). The name segment is required and must be 63
characters or less, beginning and ending with an alphanumeric character
([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and
alphanumerics between. The prefix is optional. If specified, the prefix
must be a DNS subdomain: a series of DNS labels separated by dots (.),
not longer than 253 characters in total, followed by a slash (/).
Annotations that fails to meet these requirements are rejected
Note: This field is equivalent to themetadatafield in the v1beta1 API.
They have the same syntax and read/write to the same location in Service
Directory.
Optional. Annotations for the service. This data can be consumed by service
clients.
Restrictions:
The entire annotations dictionary may contain up to 2000 characters,
spread accoss all key-value pairs. Annotations that go beyond this
limit are rejected
Valid annotation keys have two segments: an optional prefix and name,
separated by a slash (/). The name segment is required and must be 63
characters or less, beginning and ending with an alphanumeric character
([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and
alphanumerics between. The prefix is optional. If specified, the prefix
must be a DNS subdomain: a series of DNS labels separated by dots (.),
not longer than 253 characters in total, followed by a slash (/).
Annotations that fails to meet these requirements are rejected
Note: This field is equivalent to themetadatafield in the v1beta1 API.
They have the same syntax and read/write to the same location in Service
Directory.
[[["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 Service Directory V1 Client - Class Service (2.0.6)\n\nVersion latestkeyboard_arrow_down\n\n- [2.0.6 (latest)](/php/docs/reference/cloud-service-directory/latest/V1.Service)\n- [2.0.5](/php/docs/reference/cloud-service-directory/2.0.5/V1.Service)\n- [1.3.6](/php/docs/reference/cloud-service-directory/1.3.6/V1.Service)\n- [1.2.1](/php/docs/reference/cloud-service-directory/1.2.1/V1.Service)\n- [1.1.2](/php/docs/reference/cloud-service-directory/1.1.2/V1.Service)\n- [1.0.5](/php/docs/reference/cloud-service-directory/1.0.5/V1.Service) \nReference documentation and code samples for the Google Cloud Service Directory V1 Client class Service.\n\nAn individual service. A service contains a name and optional metadata.\n\nA service must exist before\n[endpoints](/php/docs/reference/cloud-service-directory/latest/V1.Endpoint) can be\nadded to it.\n\nGenerated from protobuf message `google.cloud.servicedirectory.v1.Service`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ ServiceDirectory \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getName\n\nImmutable. The resource name for the service in the format\n`projects/*/locations/*/namespaces/*/services/*`.\n\n### setName\n\nImmutable. The resource name for the service in the format\n`projects/*/locations/*/namespaces/*/services/*`.\n\n### getAnnotations\n\nOptional. Annotations for the service. This data can be consumed by service\nclients.\n\nRestrictions:\n\n- The entire annotations dictionary may contain up to 2000 characters, spread accoss all key-value pairs. Annotations that go beyond this limit are rejected\n- Valid annotation keys have two segments: an optional prefix and name, separated by a slash (/). The name segment is required and must be 63 characters or less, beginning and ending with an alphanumeric character (\\[a-z0-9A-Z\\]) with dashes (-), underscores (_), dots (.), and alphanumerics between. The prefix is optional. If specified, the prefix must be a DNS subdomain: a series of DNS labels separated by dots (.), not longer than 253 characters in total, followed by a slash (/). Annotations that fails to meet these requirements are rejected Note: This field is equivalent to the `metadata` field in the v1beta1 API. They have the same syntax and read/write to the same location in Service Directory.\n\n### setAnnotations\n\nOptional. Annotations for the service. This data can be consumed by service\nclients.\n\nRestrictions:\n\n- The entire annotations dictionary may contain up to 2000 characters, spread accoss all key-value pairs. Annotations that go beyond this limit are rejected\n- Valid annotation keys have two segments: an optional prefix and name, separated by a slash (/). The name segment is required and must be 63 characters or less, beginning and ending with an alphanumeric character (\\[a-z0-9A-Z\\]) with dashes (-), underscores (_), dots (.), and alphanumerics between. The prefix is optional. If specified, the prefix must be a DNS subdomain: a series of DNS labels separated by dots (.), not longer than 253 characters in total, followed by a slash (/). Annotations that fails to meet these requirements are rejected Note: This field is equivalent to the `metadata` field in the v1beta1 API. They have the same syntax and read/write to the same location in Service Directory.\n\n### getEndpoints\n\nOutput only. Endpoints associated with this service. Returned on\n[LookupService.ResolveService](/php/docs/reference/cloud-service-directory/latest/V1.Client.LookupServiceClient#_Google_Cloud_ServiceDirectory_V1_Client_LookupServiceClient__resolveService__).\n\nControl plane clients should use\n[RegistrationService.ListEndpoints](/php/docs/reference/cloud-service-directory/latest/V1.Client.RegistrationServiceClient#_Google_Cloud_ServiceDirectory_V1_Client_RegistrationServiceClient__listEndpoints__).\n\n### setEndpoints\n\nOutput only. Endpoints associated with this service. Returned on\n[LookupService.ResolveService](/php/docs/reference/cloud-service-directory/latest/V1.Client.LookupServiceClient#_Google_Cloud_ServiceDirectory_V1_Client_LookupServiceClient__resolveService__).\n\nControl plane clients should use\n[RegistrationService.ListEndpoints](/php/docs/reference/cloud-service-directory/latest/V1.Client.RegistrationServiceClient#_Google_Cloud_ServiceDirectory_V1_Client_RegistrationServiceClient__listEndpoints__).\n\n### getUid\n\nOutput only. The globally unique identifier of the service in the UUID4\nformat.\n\n### setUid\n\nOutput only. The globally unique identifier of the service in the UUID4\nformat."]]