Required. Service hostnames with an optional port for which this route
describes traffic.
Format: <hostname>[:<port>]
Hostname is the fully qualified domain name of a network host. This matches
the RFC 1123 definition of a hostname with 2 notable exceptions:
IPs are not allowed.
A hostname may be prefixed with a wildcard label (*.). The wildcard
label must appear by itself as the first label.
Hostname can be "precise" which is a domain name without the terminating
dot of a network host (e.g. foo.example.com) or "wildcard", which is a
domain name prefixed with a single wildcard label (e.g. *.example.com).
Note that as per RFC1035 and RFC1123, a label must consist of lower case
alphanumeric characters or '-', and must start and end with an alphanumeric
character. No other punctuation is allowed.
The routes associated with a Mesh or Gateway must have unique hostnames. If
you attempt to attach multiple routes with conflicting hostnames, the
configuration will be rejected.
For example, while it is acceptable for routes for the hostnames
*.foo.bar.com and *.bar.com to be associated with the same route, it is
not possible to associate two routes both with *.bar.com or both with
bar.com.
If a port is specified, then gRPC clients must use the channel URI with the
port to match this rule (i.e. "xds:///service:123"), otherwise they must
supply the URI without a port (i.e. "xds:///service").
public RepeatedField<GrpcRoute.Types.RouteRule> Rules { get; }
Required. A list of detailed rules defining how to route traffic.
Within a single GrpcRoute, the GrpcRoute.RouteAction associated with the
first matching GrpcRoute.RouteRule will be executed. At least one rule
must be supplied.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eGrpcRoute\u003c/code\u003e class is used to define how gRPC traffic is routed by Mesh or Gateway resources in the Network Services v1 API.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGrpcRoute\u003c/code\u003e allows you to specify hostnames, and associate them with gateways or meshes to route traffic, utilizing wildcard labels for broad applicability.\u003c/p\u003e\n"],["\u003cp\u003eYou can set up multiple routing rules with \u003ccode\u003eGrpcRoute\u003c/code\u003e, but only the first matching rule will be executed for a given request, with configuration conflicts being rejected.\u003c/p\u003e\n"],["\u003cp\u003eThe resource includes properties for tracking creation and update times, along with optional fields for description and labels to help manage and organize these routing configurations.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGrpcRoute\u003c/code\u003e implements several interfaces including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, and \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and it supports both precise and wildcard hostname definitions for routing.\u003c/p\u003e\n"]]],[],null,["# Network Services v1 API - Class GrpcRoute (1.3.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.3.0 (latest)](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/latest/Google.Cloud.NetworkServices.V1.GrpcRoute)\n- [1.2.0](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/1.2.0/Google.Cloud.NetworkServices.V1.GrpcRoute)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/1.1.0/Google.Cloud.NetworkServices.V1.GrpcRoute)\n- [1.0.0](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/1.0.0/Google.Cloud.NetworkServices.V1.GrpcRoute) \n\n public sealed class GrpcRoute : IMessage\u003cGrpcRoute\u003e, IEquatable\u003cGrpcRoute\u003e, IDeepCloneable\u003cGrpcRoute\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Network Services v1 API class GrpcRoute.\n\nGrpcRoute is the resource defining how gRPC traffic routed by a Mesh\nor Gateway resource is routed. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e GrpcRoute \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[GrpcRoute](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/latest/Google.Cloud.NetworkServices.V1.GrpcRoute), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[GrpcRoute](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/latest/Google.Cloud.NetworkServices.V1.GrpcRoute), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[GrpcRoute](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/latest/Google.Cloud.NetworkServices.V1.GrpcRoute), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.NetworkServices.V1](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/latest/Google.Cloud.NetworkServices.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.NetworkServices.V1.dll\n\nConstructors\n------------\n\n### GrpcRoute()\n\n public GrpcRoute()\n\n### GrpcRoute(GrpcRoute)\n\n public GrpcRoute(GrpcRoute other)\n\nProperties\n----------\n\n### CreateTime\n\n public Timestamp CreateTime { get; set; }\n\nOutput only. The timestamp when the resource was created.\n\n### Description\n\n public string Description { get; set; }\n\nOptional. A free-text description of the resource. Max length 1024\ncharacters.\n\n### Gateways\n\n public RepeatedField\u003cstring\u003e Gateways { get; }\n\nOptional. Gateways defines a list of gateways this GrpcRoute is attached\nto, as one of the routing rules to route the requests served by the\ngateway.\n\nEach gateway reference should match the pattern:\n`projects/*/locations/global/gateways/\u003cgateway_name\u003e`\n\n### GatewaysAsGatewayNames\n\n public ResourceNameList\u003cGatewayName\u003e GatewaysAsGatewayNames { get; }\n\n[GatewayName](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/latest/Google.Cloud.NetworkServices.V1.GatewayName)-typed view over the [Gateways](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/latest/Google.Cloud.NetworkServices.V1.GrpcRoute#Google_Cloud_NetworkServices_V1_GrpcRoute_Gateways) resource name property.\n\n### GrpcRouteName\n\n public GrpcRouteName GrpcRouteName { get; set; }\n\n[GrpcRouteName](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/latest/Google.Cloud.NetworkServices.V1.GrpcRouteName)-typed view over the [Name](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/latest/Google.Cloud.NetworkServices.V1.GrpcRoute#Google_Cloud_NetworkServices_V1_GrpcRoute_Name) resource name property.\n\n### Hostnames\n\n public RepeatedField\u003cstring\u003e Hostnames { get; }\n\nRequired. Service hostnames with an optional port for which this route\ndescribes traffic.\n\nFormat: \\\u003chostname\\\u003e\\[:\\\u003cport\\\u003e\\]\n\nHostname is the fully qualified domain name of a network host. This matches\nthe RFC 1123 definition of a hostname with 2 notable exceptions:\n\n- IPs are not allowed.\n- A hostname may be prefixed with a wildcard label (`*.`). The wildcard label must appear by itself as the first label.\n\nHostname can be \"precise\" which is a domain name without the terminating\ndot of a network host (e.g. `foo.example.com`) or \"wildcard\", which is a\ndomain name prefixed with a single wildcard label (e.g. `*.example.com`).\n\nNote that as per RFC1035 and RFC1123, a label must consist of lower case\nalphanumeric characters or '-', and must start and end with an alphanumeric\ncharacter. No other punctuation is allowed.\n\nThe routes associated with a Mesh or Gateway must have unique hostnames. If\nyou attempt to attach multiple routes with conflicting hostnames, the\nconfiguration will be rejected.\n\nFor example, while it is acceptable for routes for the hostnames\n`*.foo.bar.com` and `*.bar.com` to be associated with the same route, it is\nnot possible to associate two routes both with `*.bar.com` or both with\n`bar.com`.\n\nIf a port is specified, then gRPC clients must use the channel URI with the\nport to match this rule (i.e. \"xds:///service:123\"), otherwise they must\nsupply the URI without a port (i.e. \"xds:///service\").\n\n### Labels\n\n public MapField\u003cstring, string\u003e Labels { get; }\n\nOptional. Set of label tags associated with the GrpcRoute resource.\n\n### Meshes\n\n public RepeatedField\u003cstring\u003e Meshes { get; }\n\nOptional. Meshes defines a list of meshes this GrpcRoute is attached to, as\none of the routing rules to route the requests served by the mesh.\n\nEach mesh reference should match the pattern:\n`projects/*/locations/global/meshes/\u003cmesh_name\u003e`\n\n### MeshesAsMeshNames\n\n public ResourceNameList\u003cMeshName\u003e MeshesAsMeshNames { get; }\n\n[MeshName](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/latest/Google.Cloud.NetworkServices.V1.MeshName)-typed view over the [Meshes](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/latest/Google.Cloud.NetworkServices.V1.GrpcRoute#Google_Cloud_NetworkServices_V1_GrpcRoute_Meshes) resource name property.\n\n### Name\n\n public string Name { get; set; }\n\nIdentifier. Name of the GrpcRoute resource. It matches pattern\n`projects/*/locations/global/grpcRoutes/\u003cgrpc_route_name\u003e`\n\n### Rules\n\n public RepeatedField\u003cGrpcRoute.Types.RouteRule\u003e Rules { get; }\n\nRequired. A list of detailed rules defining how to route traffic.\n\nWithin a single GrpcRoute, the GrpcRoute.RouteAction associated with the\nfirst matching GrpcRoute.RouteRule will be executed. At least one rule\nmust be supplied.\n\n### SelfLink\n\n public string SelfLink { get; set; }\n\nOutput only. Server-defined URL of this resource\n\n### UpdateTime\n\n public Timestamp UpdateTime { get; set; }\n\nOutput only. The timestamp when the resource was updated."]]