Reference documentation and code samples for the Google API Common Protos Client class Peer.
This message defines attributes for a node that handles a network request.
The node can be either a service or an application that sends, forwards,
or receives the request. Service peers should fill inprincipalandlabelsas appropriate.
Generated from protobuf messagegoogle.rpc.context.AttributeContext.Peer
The identity of this peer. Similar toRequest.auth.principal, but relative to the peer instead of the request. For example, the identity associated with a load balancer that forwarded the request.
↳ region_code
string
The CLDR country/region code associated with the above IP address. If the IP address is private, theregion_codeshould reflect the physical location where this peer is running.
The identity of this peer. Similar toRequest.auth.principal, but
relative to the peer instead of the request. For example, the
identity associated with a load balancer that forwarded the request.
Returns
Type
Description
string
setPrincipal
The identity of this peer. Similar toRequest.auth.principal, but
relative to the peer instead of the request. For example, the
identity associated with a load balancer that forwarded the request.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getRegionCode
The CLDR country/region code associated with the above IP address.
If the IP address is private, theregion_codeshould reflect the
physical location where this peer is running.
Returns
Type
Description
string
setRegionCode
The CLDR country/region code associated with the above IP address.
If the IP address is private, theregion_codeshould reflect the
physical location where this peer is running.
[[["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 API Common Protos Client - Class Peer (4.12.3)\n\nVersion latestkeyboard_arrow_down\n\n- [4.12.3 (latest)](/php/docs/reference/common-protos/latest/Rpc.Context.AttributeContext.Peer)\n- [4.12.2](/php/docs/reference/common-protos/4.12.2/Rpc.Context.AttributeContext.Peer)\n- [4.11.0](/php/docs/reference/common-protos/4.11.0/Rpc.Context.AttributeContext.Peer)\n- [4.10.0](/php/docs/reference/common-protos/4.10.0/Rpc.Context.AttributeContext.Peer)\n- [4.9.0](/php/docs/reference/common-protos/4.9.0/Rpc.Context.AttributeContext.Peer)\n- [4.8.3](/php/docs/reference/common-protos/4.8.3/Rpc.Context.AttributeContext.Peer) \nReference documentation and code samples for the Google API Common Protos Client class Peer.\n\nThis message defines attributes for a node that handles a network request.\n\nThe node can be either a service or an application that sends, forwards,\nor receives the request. Service peers should fill in\n`principal` and `labels` as appropriate.\n\nGenerated from protobuf message `google.rpc.context.AttributeContext.Peer`\n\nNamespace\n---------\n\nGoogle \\\\ Rpc \\\\ Context \\\\ AttributeContext\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getIp\n\nThe IP address of the peer.\n\n### setIp\n\nThe IP address of the peer.\n\n### getPort\n\nThe network port of the peer.\n\n### setPort\n\nThe network port of the peer.\n\n### getLabels\n\nThe labels associated with the peer.\n\n### setLabels\n\nThe labels associated with the peer.\n\n### getPrincipal\n\nThe identity of this peer. Similar to `Request.auth.principal`, but\nrelative to the peer instead of the request. For example, the\nidentity associated with a load balancer that forwarded the request.\n\n### setPrincipal\n\nThe identity of this peer. Similar to `Request.auth.principal`, but\nrelative to the peer instead of the request. For example, the\nidentity associated with a load balancer that forwarded the request.\n\n### getRegionCode\n\nThe CLDR country/region code associated with the above IP address.\n\nIf the IP address is private, the `region_code` should reflect the\nphysical location where this peer is running.\n\n### setRegionCode\n\nThe CLDR country/region code associated with the above IP address.\n\nIf the IP address is private, the `region_code` should reflect the\nphysical location where this peer is running."]]