BackendService class final
Represents a Backend Service resource.
A backend service defines how Google Cloud load balancers distribute traffic. The backend service configuration contains a set of values, such as the protocol used to connect to backends, various distribution and session settings, health checks, and timeouts. These settings provide fine-grained control over how your load balancer behaves. Most of the settings have default values that allow for easy configuration if you need to get started quickly.
Backend services in Google Compute Engine can be either regionally or globally scoped.
For more information, seeBackend Services.
Constructors
-
BackendService({int? affinityCookieTtlSec, List<
Backend> backends = const [], BackendServiceCdnPolicy? cdnPolicy, CircuitBreakers? circuitBreakers, String? compressionMode, ConnectionDraining? connectionDraining, BackendServiceConnectionTrackingPolicy? connectionTrackingPolicy, ConsistentHashLoadBalancerSettings? consistentHash, String? creationTimestamp, List<BackendServiceCustomMetric> customMetrics = const [], List<String> customRequestHeaders = const [], List<String> customResponseHeaders = const [], String? description, String? edgeSecurityPolicy, bool? enableCDN, String? externalManagedMigrationState, double? externalManagedMigrationTestingPercentage, BackendServiceFailoverPolicy? failoverPolicy, String? fingerprint, BackendServiceHapolicy? haPolicy, List<String> healthChecks = const [], BackendServiceIap? iap, BigInt? id, String? ipAddressSelectionPolicy, String? kind, String? loadBalancingScheme, List<BackendServiceLocalityLoadBalancingPolicyConfig> localityLbPolicies = const [], String? localityLbPolicy, BackendServiceLogConfig? logConfig, Duration? maxStreamDuration, Map<String, String> metadatas = const {}, String? name, String? network, BackendServiceNetworkPassThroughLbTrafficPolicy? networkPassThroughLbTrafficPolicy, BackendServiceOrchestrationInfo? orchestrationInfo, OutlierDetection? outlierDetection, BackendServiceParams? params, int? port, String? portName, String? protocol, String? region, String? securityPolicy, SecuritySettings? securitySettings, String? selfLink, List<String> serviceBindings = const [], String? serviceLbPolicy, String? sessionAffinity, BackendServiceHttpCookie? strongSessionAffinityCookie, Subsetting? subsetting, int? timeoutSec, BackendServiceTlsSettings? tlsSettings, List<BackendServiceUsedBy> usedBy = const []}) - BackendService.fromJson(Object? j)
-
factory
Properties
- affinityCookieTtlSec → int?
-
Lifetime of cookies in seconds. This setting is applicable to Application
Load Balancers and Traffic Director and requires
GENERATED_COOKIE or HTTP_COOKIE session affinity.
final
-
backends
→ List<
Backend> -
The list of backends that serve this BackendService.
final
- cdnPolicy → BackendServiceCdnPolicy?
-
Cloud CDN configuration for this BackendService. Only available for
specified load balancer types.
final
- circuitBreakers → CircuitBreakers?
-
final
- compressionMode → String?
-
Compress text responses using Brotli or gzip compression, based on
the client's Accept-Encoding header.
Check the CompressionMode enum for the list of possible values.
final
- connectionDraining → ConnectionDraining?
-
connectionDraining cannot be specified with haPolicy.
final
- connectionTrackingPolicy → BackendServiceConnectionTrackingPolicy?
-
Connection Tracking configuration for this BackendService. Connection
tracking policy settings are only available for external passthrough
Network Load Balancers and internal passthrough Network Load Balancers.
final
- consistentHash → ConsistentHashLoadBalancerSettings?
-
Consistent Hash-based load balancing can be used to provide soft session
affinity based on HTTP headers, cookies or other properties. This load
balancing policy is applicable only for HTTP connections. The affinity to a
particular destination host will be lost when one or more hosts are
added/removed from the destination service. This field specifies parameters
that control consistent hashing. This field is only applicable whenlocalityLbPolicy is set to MAGLEV orRING_HASH.
final
- creationTimestamp → String?
-
Output only.
Output OnlyCreation timestamp inRFC3339 text format.final -
customMetrics
→ List<
BackendServiceCustomMetric> -
List of custom metrics that are used for theWEIGHTED_ROUND_ROBIN locality_lb_policy.
final
-
customRequestHeaders
→ List<
String> -
Headers that the load balancer adds to proxied requests. See Creating
custom
headers.
final
-
customResponseHeaders
→ List<
String> -
Headers that the load balancer adds to proxied responses. See Creating
custom
headers.
final
- description → String?
-
An optional description of this resource. Provide this property when you
create the resource.
final
- edgeSecurityPolicy → String?
-
Output OnlyThe resource URL for the edge security policy associated with this backend service.final - enableCDN → bool?
-
If true, enables Cloud CDN for the backend service of a
global external Application Load Balancer.
final
- externalManagedMigrationState → String?
-
Specifies the canary migration state. Possible values are PREPARE,
TEST_BY_PERCENTAGE, and TEST_ALL_TRAFFIC.
final
- externalManagedMigrationTestingPercentage → double?
-
Determines the fraction of requests that should be processed by the Global
external Application Load Balancer.
final
- failoverPolicy → BackendServiceFailoverPolicy?
-
Requires at least one backend instance group to be defined
as a backup (failover) backend.
For load balancers that have configurable failover:
Internal passthrough Network Load
Balancers
and external passthrough Network Load
Balancers.
final
- fingerprint → String?
-
Fingerprint of this resource. A hash of the contents stored in this object.
This field is used in optimistic locking. This field will be ignored when
inserting a BackendService. An up-to-date fingerprint must be provided in
order to update the BackendService, otherwise the request will
fail with error 412 conditionNotMet.
final
- haPolicy → BackendServiceHapolicy?
-
Configures self-managed High Availability (HA) for External and Internal
Protocol Forwarding.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
healthChecks
→ List<
String> -
The list of URLs to the healthChecks, httpHealthChecks (legacy), or
httpsHealthChecks (legacy) resource for health checking this backend
service. Not all backend services support legacy health checks. See
Load balancer guide. Currently, at most one health check can be
specified for each backend service. Backend services with
instance group or zonal NEG backends must have a health check unless
haPolicy is specified. Backend services with internet or serverless NEG
backends must not have a health check.
final
- iap → BackendServiceIap?
-
The configurations for Identity-Aware Proxy on this resource.
Not available for internal passthrough Network Load Balancers and external
passthrough Network Load Balancers.
final
- id → BigInt?
-
Output OnlyThe unique identifier for the resource. This identifier is defined by the server.final - ipAddressSelectionPolicy → String?
-
Specifies a preference for traffic sent from the proxy to the backend (or
from the client to the backend for proxyless gRPC).
The possible values are:
final
- kind → String?
-
Output only.
Output OnlyType of resource. Always compute#backendService for backend services.final - loadBalancingScheme → String?
-
Specifies the load balancer type. A backend service
created for one type of load balancer cannot be used with another.
For more information, refer toChoosing
a load balancer.
Check the LoadBalancingScheme enum for the list of possible values.
final
-
localityLbPolicies
→ List<
BackendServiceLocalityLoadBalancingPolicyConfig> -
A list of locality load-balancing policies to be used in order of
preference. When you use localityLbPolicies, you must set at least one
value for either the localityLbPolicies[].policy or the
localityLbPolicies[].customPolicy field. localityLbPolicies overrides any
value set in the localityLbPolicy field.
final
- localityLbPolicy → String?
-
The load balancing algorithm used within the scope of the locality. The
possible values are:
final
- logConfig → BackendServiceLogConfig?
-
This field denotes the logging options for the load balancer traffic served
by this backend service. If logging is enabled, logs will be exported to
Stackdriver.
final
- maxStreamDuration → Duration?
-
Specifies the default maximum duration (timeout) for streams to this
service. Duration is computed from the beginning of the stream until the
response has been completely processed, including all retries. A stream
that does not complete in this duration is closed.
final
-
metadatas
→ Map<
String, String> -
Deployment metadata associated with the resource to be set by a GKE hub
controller and read by the backend RCTH
final
- name → String?
-
Name of the resource. Provided by the client when the resource is created.
The name must be 1-63 characters long, and comply withRFC1035.
Specifically, the name must be 1-63 characters long and match the regular
expression
[a-z]([-a-z0-9]*[a-z0-9])?which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.final - network → String?
-
The URL of the network to which this backend service belongs.
final
- networkPassThroughLbTrafficPolicy → BackendServiceNetworkPassThroughLbTrafficPolicy?
-
Configures traffic steering properties of internal passthrough Network
Load Balancers.
final
- orchestrationInfo → BackendServiceOrchestrationInfo?
-
Information about the resource or system that manages the backend service.
final
- outlierDetection → OutlierDetection?
-
Settings controlling the ejection of unhealthy backend endpoints from the
load balancing pool of each individual proxy instance that processes the
traffic for the given backend service. If not set, this feature is
considered disabled.
final
- params → BackendServiceParams?
-
Input only.
Input OnlyAdditional params passed with the request, but not persisted as part of resource payload.final - port → int?
-
Deprecated in favor of portName. The TCP port to connect on
the backend. The default value is 80.
For internal passthrough Network Load Balancers and external passthrough
Network Load Balancers, omit port.
final
- portName → String?
-
A named port on a backend instance group representing the port for
communication to the backend VMs in that group. The
named port must be defined on each backend instance
group.
This parameter has no meaning if the backends are NEGs. For internal
passthrough Network Load Balancers and external passthrough Network Load
Balancers, omit port_name.
final
- protocol → String?
-
The protocol this BackendService uses to communicate
with backends.
final
- qualifiedName → String
-
The fully qualified name of this message, i.e.,
google.protobuf.Durationorgoogle.rpc.ErrorInfo.finalinherited - region → String?
-
Output only.
Output OnlyURL of the region where the regional backend service resides. This field is not applicable to global backend services. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- securityPolicy → String?
-
Output OnlyThe resource URL for the security policy associated with this backend service.final - securitySettings → SecuritySettings?
-
This field specifies the security settings that apply to this backend
service. This field is applicable to a global backend service with the
load_balancing_scheme set to INTERNAL_SELF_MANAGED.
final
- selfLink → String?
-
Output OnlyServer-defined URL for the resource.final -
serviceBindings
→ List<
String> -
URLs of networkservices.ServiceBinding resources.
final
- serviceLbPolicy → String?
-
URL to networkservices.ServiceLbPolicy resource.
final
- sessionAffinity → String?
-
Type of session affinity to use. The default is NONE.
final
- strongSessionAffinityCookie → BackendServiceHttpCookie?
-
Describes the HTTP cookie used for stateful session affinity. This field is
applicable and required if the sessionAffinity is set toSTRONG_COOKIE_AFFINITY.
final
- subsetting → Subsetting?
-
subsetting cannot be specified with haPolicy.
final
- timeoutSec → int?
-
The backend service timeout has a different meaning depending on the
type of load balancer. For more information see,
Backend service settings.
The default is 30 seconds.
The full range of timeout values allowed goes from 1
through 2,147,483,647 seconds.
final
- tlsSettings → BackendServiceTlsSettings?
-
Configuration for Backend Authenticated TLS and mTLS. May only be specified
when the backend protocol is SSL, HTTPS or HTTP2.
final
-
usedBy
→ List<
BackendServiceUsedBy> -
Output only.
Output OnlyList of resources referencing given backend service.final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Object -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- fullyQualifiedName → const String