def _Run(args, holder, supports_port_specification=False): """Issues the request necessary for adding the health check.""" client = holder.client messages = client.messages health_check_ref = flags.HealthCheckArgument('SSL').ResolveAsResource( args, holder.resources) proxy_header = messages.SSLHealthCheck.ProxyHeaderValueValuesEnum( args.proxy_header) ssl_health_check = messages.SSLHealthCheck(request=args.request, response=args.response, port=args.port, portName=args.port_name, proxyHeader=proxy_header) if supports_port_specification: health_checks_utils.ValidateAndAddPortSpecificationToHealthCheck( args, ssl_health_check) request = messages.ComputeHealthChecksInsertRequest( healthCheck=messages.HealthCheck( name=health_check_ref.Name(), description=args.description, type=messages.HealthCheck.TypeValueValuesEnum.SSL, sslHealthCheck=ssl_health_check, checkIntervalSec=args.check_interval, timeoutSec=args.timeout, healthyThreshold=args.healthy_threshold, unhealthyThreshold=args.unhealthy_threshold), project=health_check_ref.project) return client.MakeRequests([(client.apitools_client.healthChecks, 'Insert', request)])
def _Run(args, holder, include_l7_internal_load_balancing, include_log_config): """Issues the request necessary for adding the health check.""" client = holder.client messages = client.messages # Check that port related flags are set for gRPC health check. args_unset = not (args.port or args.port_name or args.use_serving_port) if args_unset: raise exceptions.ToolException( 'Either --port, --port-name or --use-serving-port must be set for gRPC ' 'health check.' ) health_check_ref = flags.HealthCheckArgument( 'gRPC', include_l7_internal_load_balancing=include_l7_internal_load_balancing ).ResolveAsResource( args, holder.resources, default_scope=compute_scope.ScopeEnum.GLOBAL) grpc_health_check = messages.GRPCHealthCheck( port=args.port, portName=args.port_name, grpcServiceName=args.grpc_service_name) health_checks_utils.ValidateAndAddPortSpecificationToHealthCheck( args, grpc_health_check) if health_checks_utils.IsRegionalHealthCheckRef(health_check_ref): request = messages.ComputeRegionHealthChecksInsertRequest( healthCheck=messages.HealthCheck( name=health_check_ref.Name(), description=args.description, type=messages.HealthCheck.TypeValueValuesEnum.GRPC, grpcHealthCheck=grpc_health_check, checkIntervalSec=args.check_interval, timeoutSec=args.timeout, healthyThreshold=args.healthy_threshold, unhealthyThreshold=args.unhealthy_threshold), project=health_check_ref.project, region=health_check_ref.region) collection = client.apitools_client.regionHealthChecks else: request = messages.ComputeHealthChecksInsertRequest( healthCheck=messages.HealthCheck( name=health_check_ref.Name(), description=args.description, type=messages.HealthCheck.TypeValueValuesEnum.GRPC, grpcHealthCheck=grpc_health_check, checkIntervalSec=args.check_interval, timeoutSec=args.timeout, healthyThreshold=args.healthy_threshold, unhealthyThreshold=args.unhealthy_threshold), project=health_check_ref.project) collection = client.apitools_client.healthChecks if include_log_config: request.healthCheck.logConfig = health_checks_utils.CreateLogConfig( client, args) return client.MakeRequests([(collection, 'Insert', request)])
def _Run(args, holder, include_l7_internal_load_balancing, include_log_config): """Issues the request necessary for adding the health check.""" client = holder.client messages = client.messages health_check_ref = flags.HealthCheckArgument( 'HTTP2', include_l7_internal_load_balancing=include_l7_internal_load_balancing ).ResolveAsResource(args, holder.resources, default_scope=compute_scope.ScopeEnum.GLOBAL) proxy_header = messages.HTTP2HealthCheck.ProxyHeaderValueValuesEnum( args.proxy_header) http2_health_check = messages.HTTP2HealthCheck( host=args.host, port=args.port, portName=args.port_name, requestPath=args.request_path, proxyHeader=proxy_header, response=args.response) health_checks_utils.ValidateAndAddPortSpecificationToHealthCheck( args, http2_health_check) if health_checks_utils.IsRegionalHealthCheckRef(health_check_ref): request = messages.ComputeRegionHealthChecksInsertRequest( healthCheck=messages.HealthCheck( name=health_check_ref.Name(), description=args.description, type=messages.HealthCheck.TypeValueValuesEnum.HTTP2, http2HealthCheck=http2_health_check, checkIntervalSec=args.check_interval, timeoutSec=args.timeout, healthyThreshold=args.healthy_threshold, unhealthyThreshold=args.unhealthy_threshold, ), project=health_check_ref.project, region=health_check_ref.region) collection = client.apitools_client.regionHealthChecks else: request = messages.ComputeHealthChecksInsertRequest( healthCheck=messages.HealthCheck( name=health_check_ref.Name(), description=args.description, type=messages.HealthCheck.TypeValueValuesEnum.HTTP2, http2HealthCheck=http2_health_check, checkIntervalSec=args.check_interval, timeoutSec=args.timeout, healthyThreshold=args.healthy_threshold, unhealthyThreshold=args.unhealthy_threshold), project=health_check_ref.project) collection = client.apitools_client.healthChecks if include_log_config: request.healthCheck.logConfig = health_checks_utils.CreateLogConfig( client, args) return client.MakeRequests([(collection, 'Insert', request)])
def _Run(args, holder, supports_response=False, supports_port_specification=False, regionalized=False): """Issues the request necessary for adding the health check.""" client = holder.client messages = client.messages health_check_ref = flags.HealthCheckArgument( 'HTTP2', include_alpha=regionalized).ResolveAsResource(args, holder.resources) proxy_header = messages.HTTP2HealthCheck.ProxyHeaderValueValuesEnum( args.proxy_header) http2_health_check = messages.HTTP2HealthCheck( host=args.host, port=args.port, portName=args.port_name, requestPath=args.request_path, proxyHeader=proxy_header) if supports_response: http2_health_check.response = args.response if supports_port_specification: health_checks_utils.ValidateAndAddPortSpecificationToHealthCheck( args, http2_health_check) if health_checks_utils.IsRegionalHealthCheckRef(health_check_ref): request = messages.ComputeRegionHealthChecksInsertRequest( healthCheck=messages.HealthCheck( name=health_check_ref.Name(), description=args.description, type=messages.HealthCheck.TypeValueValuesEnum.HTTP2, http2HealthCheck=http2_health_check, checkIntervalSec=args.check_interval, timeoutSec=args.timeout, healthyThreshold=args.healthy_threshold, unhealthyThreshold=args.unhealthy_threshold, ), project=health_check_ref.project, region=health_check_ref.region) collection = client.apitools_client.regionHealthChecks else: request = messages.ComputeHealthChecksInsertRequest( healthCheck=messages.HealthCheck( name=health_check_ref.Name(), description=args.description, type=messages.HealthCheck.TypeValueValuesEnum.HTTP2, http2HealthCheck=http2_health_check, checkIntervalSec=args.check_interval, timeoutSec=args.timeout, healthyThreshold=args.healthy_threshold, unhealthyThreshold=args.unhealthy_threshold), project=health_check_ref.project) collection = client.apitools_client.healthChecks return client.MakeRequests([(collection, 'Insert', request)])
def _Run(args, release_track, include_l7_internal_load_balancing=False): """Issues the request necessary for adding the health check.""" holder = base_classes.ComputeApiHolder(release_track) client = holder.client messages = client.messages health_check_ref = flags.HealthCheckArgument( 'HTTP', include_l7_internal_load_balancing=include_l7_internal_load_balancing ).ResolveAsResource(args, holder.resources) proxy_header = messages.HTTPHealthCheck.ProxyHeaderValueValuesEnum( args.proxy_header) http_health_check = messages.HTTPHealthCheck( host=args.host, port=args.port, portName=args.port_name, requestPath=args.request_path, proxyHeader=proxy_header, response=args.response) health_checks_utils.ValidateAndAddPortSpecificationToHealthCheck( args, http_health_check) if health_checks_utils.IsRegionalHealthCheckRef(health_check_ref): request = messages.ComputeRegionHealthChecksInsertRequest( healthCheck=messages.HealthCheck( name=health_check_ref.Name(), description=args.description, type=messages.HealthCheck.TypeValueValuesEnum.HTTP, httpHealthCheck=http_health_check, checkIntervalSec=args.check_interval, timeoutSec=args.timeout, healthyThreshold=args.healthy_threshold, unhealthyThreshold=args.unhealthy_threshold), project=health_check_ref.project, region=health_check_ref.region) collection = client.apitools_client.regionHealthChecks else: request = messages.ComputeHealthChecksInsertRequest( healthCheck=messages.HealthCheck( name=health_check_ref.Name(), description=args.description, type=messages.HealthCheck.TypeValueValuesEnum.HTTP, httpHealthCheck=http_health_check, checkIntervalSec=args.check_interval, timeoutSec=args.timeout, healthyThreshold=args.healthy_threshold, unhealthyThreshold=args.unhealthy_threshold), project=health_check_ref.project) collection = client.apitools_client.healthChecks return client.MakeRequests([(collection, 'Insert', request)])
def Run(self, args): """Issues the request necessary for adding the health check.""" holder = base_classes.ComputeApiHolder(self.ReleaseTrack()) client = holder.client messages = client.messages health_check_ref = flags.HealthCheckArgument( 'HTTP2').ResolveAsResource(args, holder.resources) proxy_header = messages.HTTP2HealthCheck.ProxyHeaderValueValuesEnum( args.proxy_header) http2_health_check = messages.HTTP2HealthCheck( host=args.host, port=args.port, portName=args.port_name, requestPath=args.request_path, proxyHeader=proxy_header, response=args.response) health_checks_utils.ValidateAndAddPortSpecificationToHealthCheck( args, http2_health_check) request = messages.ComputeHealthChecksInsertRequest( healthCheck=messages.HealthCheck( name=health_check_ref.Name(), description=args.description, type=messages.HealthCheck.TypeValueValuesEnum.HTTP2, http2HealthCheck=http2_health_check, checkIntervalSec=args.check_interval, timeoutSec=args.timeout, healthyThreshold=args.healthy_threshold, unhealthyThreshold=args.unhealthy_threshold, ), project=health_check_ref.project) return client.MakeRequests([(client.apitools_client.healthChecks, 'Insert', request)])