From ae32d6d5b38a59515f1cac6cc38655849d248f5d Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 13 Jun 2024 15:06:07 -0700 Subject: [PATCH] chore!: promote CloudOptimization to v1 (#7395) --- .repo-metadata-full.json | 2 +- Optimization/README.md | 5 +- Optimization/owlbot.py | 40 +- Optimization/src/V1/AggregatedMetrics.php | 16 +- Optimization/src/V1/AsyncModelMetadata.php | 8 +- .../src/V1/BatchOptimizeToursRequest.php | 2 +- .../AsyncModelConfig.php | 8 +- .../src/V1/BreakRule/BreakRequest.php | 6 +- .../src/V1/BreakRule/FrequencyConstraint.php | 4 +- Optimization/src/V1/CapacityQuantity.php | 4 +- .../src/V1/CapacityQuantityInterval.php | 6 +- .../src/V1/Client/FleetRoutingClient.php | 31 +- Optimization/src/V1/DistanceLimit.php | 8 +- Optimization/src/V1/FleetRoutingClient.php | 34 - .../src/V1/FleetRoutingGrpcClient.php | 103 --- .../src/V1/Gapic/FleetRoutingGapicClient.php | 690 ------------------ Optimization/src/V1/GcsDestination.php | 2 +- Optimization/src/V1/GcsSource.php | 2 +- .../ConstraintRelaxation/Relaxation.php | 6 +- Optimization/src/V1/InputConfig.php | 2 +- Optimization/src/V1/Location.php | 4 +- Optimization/src/V1/OptimizeToursRequest.php | 30 +- Optimization/src/V1/OptimizeToursResponse.php | 4 +- .../src/V1/OptimizeToursResponse/Metrics.php | 12 +- .../src/V1/OptimizeToursValidationError.php | 8 +- .../FieldReference.php | 4 +- Optimization/src/V1/OutputConfig.php | 2 +- Optimization/src/V1/RouteModifiers.php | 8 +- Optimization/src/V1/Shipment.php | 14 +- Optimization/src/V1/Shipment/Load.php | 2 +- Optimization/src/V1/Shipment/VisitRequest.php | 14 +- Optimization/src/V1/ShipmentModel.php | 8 +- .../ShipmentModel/BreakRule/BreakRequest.php | 6 +- .../BreakRule/FrequencyConstraint.php | 4 +- .../ShipmentModel/DurationDistanceMatrix.php | 2 +- .../src/V1/ShipmentModel/PrecedenceRule.php | 10 +- Optimization/src/V1/ShipmentRoute.php | 16 +- Optimization/src/V1/ShipmentRoute/Delay.php | 4 +- .../src/V1/ShipmentRoute/EncodedPolyline.php | 2 +- Optimization/src/V1/ShipmentRoute/PBBreak.php | 4 +- .../src/V1/ShipmentRoute/Transition.php | 18 +- .../src/V1/ShipmentRoute/TravelStep.php | 8 +- .../src/V1/ShipmentRoute/VehicleLoad.php | 2 +- Optimization/src/V1/ShipmentRoute/Visit.php | 14 +- .../src/V1/ShipmentTypeIncompatibility.php | 2 +- .../src/V1/ShipmentTypeRequirement.php | 2 +- Optimization/src/V1/SkippedShipment.php | 4 +- .../src/V1/SkippedShipment/Reason.php | 6 +- Optimization/src/V1/TimeWindow.php | 12 +- Optimization/src/V1/TransitionAttributes.php | 16 +- Optimization/src/V1/Vehicle.php | 38 +- Optimization/src/V1/Vehicle/DurationLimit.php | 10 +- Optimization/src/V1/Vehicle/LoadLimit.php | 10 +- .../src/V1/Vehicle/LoadLimit/Interval.php | 4 +- Optimization/src/V1/Waypoint.php | 2 +- .../Unit/V1/Client/FleetRoutingClientTest.php | 58 +- .../tests/Unit/V1/FleetRoutingClientTest.php | 249 ------- 57 files changed, 251 insertions(+), 1341 deletions(-) delete mode 100644 Optimization/src/V1/FleetRoutingClient.php delete mode 100644 Optimization/src/V1/FleetRoutingGrpcClient.php delete mode 100644 Optimization/src/V1/Gapic/FleetRoutingGapicClient.php delete mode 100644 Optimization/tests/Unit/V1/FleetRoutingClientTest.php diff --git a/.repo-metadata-full.json b/.repo-metadata-full.json index 9786002498da..c6e977a89bec 100644 --- a/.repo-metadata-full.json +++ b/.repo-metadata-full.json @@ -962,7 +962,7 @@ "Optimization": { "language": "php", "distribution_name": "google/cloud-optimization", - "release_level": "preview", + "release_level": "stable", "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-optimization/latest", "library_type": "GAPIC_AUTO", "api_shortname": "cloudoptimization" diff --git a/Optimization/README.md b/Optimization/README.md index 5c98a8cf43f6..143a597dce5d 100644 --- a/Optimization/README.md +++ b/Optimization/README.md @@ -30,9 +30,8 @@ on authenticating your client. Once authenticated, you'll be ready to start maki ### Version -This component is considered beta. As such, it should be expected to be mostly -stable and we're working towards a release candidate. We will address issues -and requests with a higher priority. +This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in +any minor or patch releases. We will address issues and requests with the highest priority. ### Next Steps diff --git a/Optimization/owlbot.py b/Optimization/owlbot.py index e062ddb1f10d..263fb4ea6aa6 100644 --- a/Optimization/owlbot.py +++ b/Optimization/owlbot.py @@ -1,4 +1,4 @@ -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,13 +30,7 @@ # Added so that we can pass copy_excludes in the owlbot_main() call _tracked_paths.add(src) -php.owlbot_main( - src=src, - dest=dest, - copy_excludes=[ - src / "**/[A-Z]*_*.php" - ] -) +php.owlbot_main(src=src, dest=dest) # remove class_alias code s.replace( @@ -47,32 +41,6 @@ + "\n", '') -### [START] protoc backwards compatibility fixes - -# roll back to private properties. -s.replace( - "src/**/V*/**/*.php", - r"Generated from protobuf field ([^\n]{0,})\n\s{5}\*/\n\s{4}protected \$", - r"""Generated from protobuf field \1 - */ - private $""") - -# Replace "Unwrapped" with "Value" for method names. -s.replace( - "src/**/V*/**/*.php", - r"public function ([s|g]\w{3,})Unwrapped", - r"public function \1Value" -) - -### [END] protoc backwards compatibility fixes - -# fix relative cloud.google.com links -s.replace( - "src/**/V*/**/*.php", - r"(.{0,})\]\((/.{0,})\)", - r"\1](https://cloud.google.com\2)" -) - # format generated clients subprocess.run([ 'npm', @@ -81,8 +49,8 @@ '--package=@prettier/plugin-php@^0.16', '--', 'prettier', - '**/Gapic/*', + '**/Client/*', '--write', '--parser=php', '--single-quote', - '--print-width=80']) + '--print-width=120']) diff --git a/Optimization/src/V1/AggregatedMetrics.php b/Optimization/src/V1/AggregatedMetrics.php index bd9e49ae7605..22976ce6c208 100644 --- a/Optimization/src/V1/AggregatedMetrics.php +++ b/Optimization/src/V1/AggregatedMetrics.php @@ -26,37 +26,37 @@ class AggregatedMetrics extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 performed_shipment_count = 1; */ - private $performed_shipment_count = 0; + protected $performed_shipment_count = 0; /** * Total travel duration for a route or a solution. * * Generated from protobuf field .google.protobuf.Duration travel_duration = 2; */ - private $travel_duration = null; + protected $travel_duration = null; /** * Total wait duration for a route or a solution. * * Generated from protobuf field .google.protobuf.Duration wait_duration = 3; */ - private $wait_duration = null; + protected $wait_duration = null; /** * Total delay duration for a route or a solution. * * Generated from protobuf field .google.protobuf.Duration delay_duration = 4; */ - private $delay_duration = null; + protected $delay_duration = null; /** * Total break duration for a route or a solution. * * Generated from protobuf field .google.protobuf.Duration break_duration = 5; */ - private $break_duration = null; + protected $break_duration = null; /** * Total visit duration for a route or a solution. * * Generated from protobuf field .google.protobuf.Duration visit_duration = 6; */ - private $visit_duration = null; + protected $visit_duration = null; /** * The total duration should be equal to the sum of all durations above. * For routes, it also corresponds to: @@ -66,13 +66,13 @@ class AggregatedMetrics extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration total_duration = 7; */ - private $total_duration = null; + protected $total_duration = null; /** * Total travel distance for a route or a solution. * * Generated from protobuf field double travel_distance_meters = 8; */ - private $travel_distance_meters = 0.0; + protected $travel_distance_meters = 0.0; /** * Maximum load achieved over the entire route (resp. solution), for each of * the quantities on this route (resp. solution), computed as the maximum over diff --git a/Optimization/src/V1/AsyncModelMetadata.php b/Optimization/src/V1/AsyncModelMetadata.php index ea3a6723a51d..a2578dd38100 100644 --- a/Optimization/src/V1/AsyncModelMetadata.php +++ b/Optimization/src/V1/AsyncModelMetadata.php @@ -20,26 +20,26 @@ class AsyncModelMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.AsyncModelMetadata.State state = 1; */ - private $state = 0; + protected $state = 0; /** * A message providing more details about the current state of the operation. * For example, the error message if the operation is failed. * * Generated from protobuf field string state_message = 2; */ - private $state_message = ''; + protected $state_message = ''; /** * The creation time of the operation. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; */ - private $create_time = null; + protected $create_time = null; /** * The last update time of the operation. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; */ - private $update_time = null; + protected $update_time = null; /** * Constructor. diff --git a/Optimization/src/V1/BatchOptimizeToursRequest.php b/Optimization/src/V1/BatchOptimizeToursRequest.php index 8469cd790301..a1c21c85233e 100644 --- a/Optimization/src/V1/BatchOptimizeToursRequest.php +++ b/Optimization/src/V1/BatchOptimizeToursRequest.php @@ -26,7 +26,7 @@ class BatchOptimizeToursRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $parent = ''; + protected $parent = ''; /** * Required. Input/Output information each purchase model, such as file paths * and data formats. diff --git a/Optimization/src/V1/BatchOptimizeToursRequest/AsyncModelConfig.php b/Optimization/src/V1/BatchOptimizeToursRequest/AsyncModelConfig.php index d79231b70eac..37053e55a3d6 100644 --- a/Optimization/src/V1/BatchOptimizeToursRequest/AsyncModelConfig.php +++ b/Optimization/src/V1/BatchOptimizeToursRequest/AsyncModelConfig.php @@ -21,19 +21,19 @@ class AsyncModelConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 1; */ - private $display_name = ''; + protected $display_name = ''; /** * Required. Information about the input model. * * Generated from protobuf field .google.cloud.optimization.v1.InputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $input_config = null; + protected $input_config = null; /** * Required. The desired output location information. * * Generated from protobuf field .google.cloud.optimization.v1.OutputConfig output_config = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $output_config = null; + protected $output_config = null; /** * If this is set, the model will be solved in the checkpoint mode. In this * mode, the input model can have a deadline longer than 30 mins without the @@ -46,7 +46,7 @@ class AsyncModelConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enable_checkpoints = 4; */ - private $enable_checkpoints = false; + protected $enable_checkpoints = false; /** * Constructor. diff --git a/Optimization/src/V1/BreakRule/BreakRequest.php b/Optimization/src/V1/BreakRule/BreakRequest.php index b94ad6687673..5249352d2077 100644 --- a/Optimization/src/V1/BreakRule/BreakRequest.php +++ b/Optimization/src/V1/BreakRule/BreakRequest.php @@ -24,19 +24,19 @@ class BreakRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $earliest_start_time = null; + protected $earliest_start_time = null; /** * Required. Upper bound (inclusive) on the start of the break. * * Generated from protobuf field .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $latest_start_time = null; + protected $latest_start_time = null; /** * Required. Minimum duration of the break. Must be positive. * * Generated from protobuf field .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $min_duration = null; + protected $min_duration = null; /** * Constructor. diff --git a/Optimization/src/V1/BreakRule/FrequencyConstraint.php b/Optimization/src/V1/BreakRule/FrequencyConstraint.php index ed95610a1174..eadcefaeabba 100644 --- a/Optimization/src/V1/BreakRule/FrequencyConstraint.php +++ b/Optimization/src/V1/BreakRule/FrequencyConstraint.php @@ -51,7 +51,7 @@ class FrequencyConstraint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $min_break_duration = null; + protected $min_break_duration = null; /** * Required. Maximum allowed span of any interval of time in the route that * does not include at least partially a break of `duration >= @@ -59,7 +59,7 @@ class FrequencyConstraint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $max_inter_break_duration = null; + protected $max_inter_break_duration = null; /** * Constructor. diff --git a/Optimization/src/V1/CapacityQuantity.php b/Optimization/src/V1/CapacityQuantity.php index 2d55e5710bdc..a9c5183dc909 100644 --- a/Optimization/src/V1/CapacityQuantity.php +++ b/Optimization/src/V1/CapacityQuantity.php @@ -21,11 +21,11 @@ class CapacityQuantity extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field string type = 1; */ - private $type = ''; + protected $type = ''; /** * Generated from protobuf field int64 value = 2; */ - private $value = 0; + protected $value = 0; /** * Constructor. diff --git a/Optimization/src/V1/CapacityQuantityInterval.php b/Optimization/src/V1/CapacityQuantityInterval.php index ed3ed24db849..020743277a3d 100644 --- a/Optimization/src/V1/CapacityQuantityInterval.php +++ b/Optimization/src/V1/CapacityQuantityInterval.php @@ -21,15 +21,15 @@ class CapacityQuantityInterval extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field string type = 1; */ - private $type = ''; + protected $type = ''; /** * Generated from protobuf field optional int64 min_value = 2; */ - private $min_value = null; + protected $min_value = null; /** * Generated from protobuf field optional int64 max_value = 3; */ - private $max_value = null; + protected $max_value = null; /** * Constructor. diff --git a/Optimization/src/V1/Client/FleetRoutingClient.php b/Optimization/src/V1/Client/FleetRoutingClient.php index 853382b19525..8635b879fae2 100644 --- a/Optimization/src/V1/Client/FleetRoutingClient.php +++ b/Optimization/src/V1/Client/FleetRoutingClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Constructor. * diff --git a/Optimization/src/V1/DistanceLimit.php b/Optimization/src/V1/DistanceLimit.php index a79150418ad8..70ad9af40a26 100644 --- a/Optimization/src/V1/DistanceLimit.php +++ b/Optimization/src/V1/DistanceLimit.php @@ -24,7 +24,7 @@ class DistanceLimit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 max_meters = 1; */ - private $max_meters = null; + protected $max_meters = null; /** * A soft limit not enforcing a maximum distance limit, but when violated * results in a cost which adds up to other costs defined in the model, @@ -34,7 +34,7 @@ class DistanceLimit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 soft_max_meters = 2; */ - private $soft_max_meters = null; + protected $soft_max_meters = null; /** * Cost per kilometer incurred, increasing up to `soft_max_meters`, with * formula: @@ -46,7 +46,7 @@ class DistanceLimit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional double cost_per_kilometer_below_soft_max = 4; */ - private $cost_per_kilometer_below_soft_max = null; + protected $cost_per_kilometer_below_soft_max = null; /** * Cost per kilometer incurred if distance is above `soft_max_meters` limit. * The additional cost is 0 if the distance is under the limit, otherwise the @@ -59,7 +59,7 @@ class DistanceLimit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional double cost_per_kilometer_above_soft_max = 3; */ - private $cost_per_kilometer_above_soft_max = null; + protected $cost_per_kilometer_above_soft_max = null; /** * Constructor. diff --git a/Optimization/src/V1/FleetRoutingClient.php b/Optimization/src/V1/FleetRoutingClient.php deleted file mode 100644 index 057a434d2d45..000000000000 --- a/Optimization/src/V1/FleetRoutingClient.php +++ /dev/null @@ -1,34 +0,0 @@ -_simpleRequest('/google.cloud.optimization.v1.FleetRouting/OptimizeTours', - $argument, - ['\Google\Cloud\Optimization\V1\OptimizeToursResponse', 'decode'], - $metadata, $options); - } - - /** - * Optimizes vehicle tours for one or more `OptimizeToursRequest` - * messages as a batch. - * - * This method is a Long Running Operation (LRO). The inputs for optimization - * (`OptimizeToursRequest` messages) and outputs (`OptimizeToursResponse` - * messages) are read/written from/to Cloud Storage in user-specified - * format. Like the `OptimizeTours` method, each `OptimizeToursRequest` - * contains a `ShipmentModel` and returns an `OptimizeToursResponse` - * containing `ShipmentRoute`s, which are a set of routes to be performed by - * vehicles minimizing the overall cost. - * @param \Google\Cloud\Optimization\V1\BatchOptimizeToursRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function BatchOptimizeTours(\Google\Cloud\Optimization\V1\BatchOptimizeToursRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.optimization.v1.FleetRouting/BatchOptimizeTours', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - -} diff --git a/Optimization/src/V1/Gapic/FleetRoutingGapicClient.php b/Optimization/src/V1/Gapic/FleetRoutingGapicClient.php deleted file mode 100644 index 9a867e1a46e0..000000000000 --- a/Optimization/src/V1/Gapic/FleetRoutingGapicClient.php +++ /dev/null @@ -1,690 +0,0 @@ -batchOptimizeTours($parent, $modelConfigs); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $fleetRoutingClient->batchOptimizeTours($parent, $modelConfigs); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $fleetRoutingClient->resumeOperation($operationName, 'batchOptimizeTours'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $fleetRoutingClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Optimization\V1\Client\FleetRoutingClient}. - */ -class FleetRoutingGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.optimization.v1.FleetRouting'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'cloudoptimization.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'cloudoptimization.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => - self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => - __DIR__ . '/../resources/fleet_routing_client_config.json', - 'descriptorsConfigPath' => - __DIR__ . '/../resources/fleet_routing_descriptor_config.php', - 'gcpApiConfigPath' => - __DIR__ . '/../resources/fleet_routing_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => - __DIR__ . - '/../resources/fleet_routing_rest_client_config.php', - ], - ], - ]; - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) - ? $this->descriptors[$methodName]['longRunning'] - : []; - $operation = new OperationResponse( - $operationName, - $this->getOperationsClient(), - $options - ); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'cloudoptimization.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Optimizes vehicle tours for one or more `OptimizeToursRequest` - * messages as a batch. - * - * This method is a Long Running Operation (LRO). The inputs for optimization - * (`OptimizeToursRequest` messages) and outputs (`OptimizeToursResponse` - * messages) are read/written from/to Cloud Storage in user-specified - * format. Like the `OptimizeTours` method, each `OptimizeToursRequest` - * contains a `ShipmentModel` and returns an `OptimizeToursResponse` - * containing `ShipmentRoute`s, which are a set of routes to be performed by - * vehicles minimizing the overall cost. - * - * Sample code: - * ``` - * $fleetRoutingClient = new FleetRoutingClient(); - * try { - * $parent = 'parent'; - * $modelConfigs = []; - * $operationResponse = $fleetRoutingClient->batchOptimizeTours($parent, $modelConfigs); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $fleetRoutingClient->batchOptimizeTours($parent, $modelConfigs); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $fleetRoutingClient->resumeOperation($operationName, 'batchOptimizeTours'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $fleetRoutingClient->close(); - * } - * ``` - * - * @param string $parent Required. Target project and location to make a call. - * - * Format: `projects/{project-id}/locations/{location-id}`. - * - * If no location is specified, a region will be chosen automatically. - * @param AsyncModelConfig[] $modelConfigs Required. Input/Output information each purchase model, such as file paths - * and data formats. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function batchOptimizeTours( - $parent, - $modelConfigs, - array $optionalArgs = [] - ) { - $request = new BatchOptimizeToursRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setModelConfigs($modelConfigs); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startOperationsCall( - 'BatchOptimizeTours', - $optionalArgs, - $request, - $this->getOperationsClient() - )->wait(); - } - - /** - * Sends an `OptimizeToursRequest` containing a `ShipmentModel` and returns an - * `OptimizeToursResponse` containing `ShipmentRoute`s, which are a set of - * routes to be performed by vehicles minimizing the overall cost. - * - * A `ShipmentModel` model consists mainly of `Shipment`s that need to be - * carried out and `Vehicle`s that can be used to transport the `Shipment`s. - * The `ShipmentRoute`s assign `Shipment`s to `Vehicle`s. More specifically, - * they assign a series of `Visit`s to each vehicle, where a `Visit` - * corresponds to a `VisitRequest`, which is a pickup or delivery for a - * `Shipment`. - * - * The goal is to provide an assignment of `ShipmentRoute`s to `Vehicle`s that - * minimizes the total cost where cost has many components defined in the - * `ShipmentModel`. - * - * Sample code: - * ``` - * $fleetRoutingClient = new FleetRoutingClient(); - * try { - * $parent = 'parent'; - * $response = $fleetRoutingClient->optimizeTours($parent); - * } finally { - * $fleetRoutingClient->close(); - * } - * ``` - * - * @param string $parent Required. Target project and location to make a call. - * - * Format: `projects/{project-id}/locations/{location-id}`. - * - * If no location is specified, a region will be chosen automatically. - * @param array $optionalArgs { - * Optional. - * - * @type Duration $timeout - * If this timeout is set, the server returns a response before the timeout - * period has elapsed or the server deadline for synchronous requests is - * reached, whichever is sooner. - * - * For asynchronous requests, the server will generate a solution (if - * possible) before the timeout has elapsed. - * @type ShipmentModel $model - * Shipment model to solve. - * @type int $solvingMode - * By default, the solving mode is `DEFAULT_SOLVE` (0). - * For allowed values, use constants defined on {@see \Google\Cloud\Optimization\V1\OptimizeToursRequest\SolvingMode} - * @type int $searchMode - * Search mode used to solve the request. - * For allowed values, use constants defined on {@see \Google\Cloud\Optimization\V1\OptimizeToursRequest\SearchMode} - * @type ShipmentRoute[] $injectedFirstSolutionRoutes - * Guide the optimization algorithm in finding a first solution that is - * similar to a previous solution. - * - * The model is constrained when the first solution is built. - * Any shipments not performed on a route are implicitly skipped in the first - * solution, but they may be performed in successive solutions. - * - * The solution must satisfy some basic validity assumptions: - * - * * for all routes, `vehicle_index` must be in range and not be duplicated. - * * for all visits, `shipment_index` and `visit_request_index` must be - * in range. - * * a shipment may only be referenced on one route. - * * the pickup of a pickup-delivery shipment must be performed before - * the delivery. - * * no more than one pickup alternative or delivery alternative of - * a shipment may be performed. - * * for all routes, times are increasing (i.e., `vehicle_start_time - * <= visits[0].start_time <= visits[1].start_time ... - * <= vehicle_end_time`). - * * a shipment may only be performed on a vehicle that is allowed. A - * vehicle is allowed if - * [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices] - * is empty or its `vehicle_index` is included in - * [Shipment.allowed_vehicle_indices][google.cloud.optimization.v1.Shipment.allowed_vehicle_indices]. - * - * If the injected solution is not feasible, a validation error is not - * necessarily returned and an error indicating infeasibility may be returned - * instead. - * @type InjectedSolutionConstraint $injectedSolutionConstraint - * Constrain the optimization algorithm to find a final solution that is - * similar to a previous solution. For example, this may be used to freeze - * portions of routes which have already been completed or which are to be - * completed but must not be modified. - * - * If the injected solution is not feasible, a validation error is not - * necessarily returned and an error indicating infeasibility may be returned - * instead. - * @type ShipmentRoute[] $refreshDetailsRoutes - * If non-empty, the given routes will be refreshed, without modifying their - * underlying sequence of visits or travel times: only other details will be - * updated. This does not solve the model. - * - * As of 2020/11, this only populates the polylines of non-empty routes and - * requires that `populate_polylines` is true. - * - * The `route_polyline` fields of the passed-in routes may be inconsistent - * with route `transitions`. - * - * This field must not be used together with `injected_first_solution_routes` - * or `injected_solution_constraint`. - * - * `Shipment.ignore` and `Vehicle.ignore` have no effect on the behavior. - * Polylines are still populated between all visits in all non-empty routes - * regardless of whether the related shipments or vehicles are ignored. - * @type bool $interpretInjectedSolutionsUsingLabels - * If true: - * - * * uses - * [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] - * instead of `vehicle_index` to - * match routes in an injected solution with vehicles in the request; - * reuses the mapping of original - * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] - * to new - * [ShipmentRoute.vehicle_index][google.cloud.optimization.v1.ShipmentRoute.vehicle_index] - * to update - * [ConstraintRelaxation.vehicle_indices][google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.vehicle_indices] - * if non-empty, but the mapping must be unambiguous (i.e., multiple - * `ShipmentRoute`s must not share the same original `vehicle_index`). - * * uses - * [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] - * instead of `shipment_index` - * to match visits in an injected solution with shipments in the request; - * * uses - * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] - * instead of - * [SkippedShipment.index][google.cloud.optimization.v1.SkippedShipment.index] - * to - * match skipped shipments in the injected solution with request - * shipments. - * - * This interpretation applies to the `injected_first_solution_routes`, - * `injected_solution_constraint`, and `refresh_details_routes` fields. - * It can be used when shipment or vehicle indices in the request have - * changed since the solution was created, perhaps because shipments or - * vehicles have been removed from or added to the request. - * - * If true, labels in the following categories must appear at most once in - * their category: - * - * * [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] in the - * request; - * * [Shipment.label][google.cloud.optimization.v1.Shipment.label] in the - * request; - * * [ShipmentRoute.vehicle_label][google.cloud.optimization.v1.ShipmentRoute.vehicle_label] in the injected solution; - * * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] and [ShipmentRoute.Visit.shipment_label][google.cloud.optimization.v1.ShipmentRoute.Visit.shipment_label] in - * the injected solution (except pickup/delivery visit pairs, whose - * `shipment_label` must appear twice). - * - * If a `vehicle_label` in the injected solution does not correspond to a - * request vehicle, the corresponding route is removed from the solution - * along with its visits. If a `shipment_label` in the injected solution does - * not correspond to a request shipment, the corresponding visit is removed - * from the solution. If a - * [SkippedShipment.label][google.cloud.optimization.v1.SkippedShipment.label] - * in the injected solution does not correspond to a request shipment, the - * `SkippedShipment` is removed from the solution. - * - * Removing route visits or entire routes from an injected solution may - * have an effect on the implied constraints, which may lead to change in - * solution, validation errors, or infeasibility. - * - * NOTE: The caller must ensure that each - * [Vehicle.label][google.cloud.optimization.v1.Vehicle.label] (resp. - * [Shipment.label][google.cloud.optimization.v1.Shipment.label]) uniquely - * identifies a vehicle (resp. shipment) entity used across the two relevant - * requests: the past request that produced the `OptimizeToursResponse` used - * in the injected solution and the current request that includes the injected - * solution. The uniqueness checks described above are not enough to guarantee - * this requirement. - * @type bool $considerRoadTraffic - * Consider traffic estimation in calculating `ShipmentRoute` fields - * [Transition.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration], - * [Visit.start_time][google.cloud.optimization.v1.ShipmentRoute.Visit.start_time], - * and `vehicle_end_time`; in setting the - * [ShipmentRoute.has_traffic_infeasibilities][google.cloud.optimization.v1.ShipmentRoute.has_traffic_infeasibilities] - * field, and in calculating the - * [OptimizeToursResponse.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.total_cost] - * field. - * @type bool $populatePolylines - * If true, polylines will be populated in response `ShipmentRoute`s. - * @type bool $populateTransitionPolylines - * If true, polylines will be populated in response - * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. - * Note that in this case, the polylines will also be populated in the - * deprecated `travel_steps`. - * @type bool $allowLargeDeadlineDespiteInterruptionRisk - * If this is set, then the request can have a deadline - * (see https://grpc.io/blog/deadlines) of up to 60 minutes. - * Otherwise, the maximum deadline is only 30 minutes. - * Note that long-lived requests have a significantly larger (but still small) - * risk of interruption. - * @type bool $useGeodesicDistances - * If true, travel distances will be computed using geodesic distances instead - * of Google Maps distances, and travel times will be computed using geodesic - * distances with a speed defined by `geodesic_meters_per_second`. - * @type float $geodesicMetersPerSecond - * When `use_geodesic_distances` is true, this field must be set and defines - * the speed applied to compute travel times. Its value must be at least 1.0 - * meters/seconds. - * @type int $maxValidationErrors - * Truncates the number of validation errors returned. These errors are - * typically attached to an INVALID_ARGUMENT error payload as a BadRequest - * error detail (https://cloud.google.com/apis/design/errors#error_details), - * unless solving_mode=VALIDATE_ONLY: see the - * [OptimizeToursResponse.validation_errors][google.cloud.optimization.v1.OptimizeToursResponse.validation_errors] - * field. - * This defaults to 100 and is capped at 10,000. - * @type string $label - * Label that may be used to identify this request, reported back in the - * [OptimizeToursResponse.request_label][google.cloud.optimization.v1.OptimizeToursResponse.request_label]. - * @type bool $populateTravelStepPolylines - * Deprecated: Use - * [OptimizeToursRequest.populate_transition_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_transition_polylines] - * instead. If true, polylines will be populated in response - * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. - * Note that in this case, the polylines will also be populated in the - * deprecated `travel_steps`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Optimization\V1\OptimizeToursResponse - * - * @throws ApiException if the remote call fails - */ - public function optimizeTours($parent, array $optionalArgs = []) - { - $request = new OptimizeToursRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['timeout'])) { - $request->setTimeout($optionalArgs['timeout']); - } - - if (isset($optionalArgs['model'])) { - $request->setModel($optionalArgs['model']); - } - - if (isset($optionalArgs['solvingMode'])) { - $request->setSolvingMode($optionalArgs['solvingMode']); - } - - if (isset($optionalArgs['searchMode'])) { - $request->setSearchMode($optionalArgs['searchMode']); - } - - if (isset($optionalArgs['injectedFirstSolutionRoutes'])) { - $request->setInjectedFirstSolutionRoutes( - $optionalArgs['injectedFirstSolutionRoutes'] - ); - } - - if (isset($optionalArgs['injectedSolutionConstraint'])) { - $request->setInjectedSolutionConstraint( - $optionalArgs['injectedSolutionConstraint'] - ); - } - - if (isset($optionalArgs['refreshDetailsRoutes'])) { - $request->setRefreshDetailsRoutes( - $optionalArgs['refreshDetailsRoutes'] - ); - } - - if (isset($optionalArgs['interpretInjectedSolutionsUsingLabels'])) { - $request->setInterpretInjectedSolutionsUsingLabels( - $optionalArgs['interpretInjectedSolutionsUsingLabels'] - ); - } - - if (isset($optionalArgs['considerRoadTraffic'])) { - $request->setConsiderRoadTraffic( - $optionalArgs['considerRoadTraffic'] - ); - } - - if (isset($optionalArgs['populatePolylines'])) { - $request->setPopulatePolylines($optionalArgs['populatePolylines']); - } - - if (isset($optionalArgs['populateTransitionPolylines'])) { - $request->setPopulateTransitionPolylines( - $optionalArgs['populateTransitionPolylines'] - ); - } - - if (isset($optionalArgs['allowLargeDeadlineDespiteInterruptionRisk'])) { - $request->setAllowLargeDeadlineDespiteInterruptionRisk( - $optionalArgs['allowLargeDeadlineDespiteInterruptionRisk'] - ); - } - - if (isset($optionalArgs['useGeodesicDistances'])) { - $request->setUseGeodesicDistances( - $optionalArgs['useGeodesicDistances'] - ); - } - - if (isset($optionalArgs['geodesicMetersPerSecond'])) { - $request->setGeodesicMetersPerSecond( - $optionalArgs['geodesicMetersPerSecond'] - ); - } - - if (isset($optionalArgs['maxValidationErrors'])) { - $request->setMaxValidationErrors( - $optionalArgs['maxValidationErrors'] - ); - } - - if (isset($optionalArgs['label'])) { - $request->setLabel($optionalArgs['label']); - } - - if (isset($optionalArgs['populateTravelStepPolylines'])) { - $request->setPopulateTravelStepPolylines( - $optionalArgs['populateTravelStepPolylines'] - ); - } - - $requestParams = new RequestParamsHeaderDescriptor( - $requestParamHeaders - ); - $optionalArgs['headers'] = isset($optionalArgs['headers']) - ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) - : $requestParams->getHeader(); - return $this->startCall( - 'OptimizeTours', - OptimizeToursResponse::class, - $optionalArgs, - $request - )->wait(); - } -} diff --git a/Optimization/src/V1/GcsDestination.php b/Optimization/src/V1/GcsDestination.php index 9c9d993880b2..3ccb29cfd250 100644 --- a/Optimization/src/V1/GcsDestination.php +++ b/Optimization/src/V1/GcsDestination.php @@ -20,7 +20,7 @@ class GcsDestination extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $uri = ''; + protected $uri = ''; /** * Constructor. diff --git a/Optimization/src/V1/GcsSource.php b/Optimization/src/V1/GcsSource.php index 2d630bfe970e..9ddec1cbc0f7 100644 --- a/Optimization/src/V1/GcsSource.php +++ b/Optimization/src/V1/GcsSource.php @@ -20,7 +20,7 @@ class GcsSource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $uri = ''; + protected $uri = ''; /** * Constructor. diff --git a/Optimization/src/V1/InjectedSolutionConstraint/ConstraintRelaxation/Relaxation.php b/Optimization/src/V1/InjectedSolutionConstraint/ConstraintRelaxation/Relaxation.php index 5a4fee031252..c8170db9cbe7 100644 --- a/Optimization/src/V1/InjectedSolutionConstraint/ConstraintRelaxation/Relaxation.php +++ b/Optimization/src/V1/InjectedSolutionConstraint/ConstraintRelaxation/Relaxation.php @@ -50,13 +50,13 @@ class Relaxation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.InjectedSolutionConstraint.ConstraintRelaxation.Relaxation.Level level = 1; */ - private $level = 0; + protected $level = 0; /** * The time at or after which the relaxation `level` may be applied. * * Generated from protobuf field .google.protobuf.Timestamp threshold_time = 2; */ - private $threshold_time = null; + protected $threshold_time = null; /** * The number of visits at or after which the relaxation `level` may be * applied. If `threshold_visit_count` is 0 (or unset), the `level` may be @@ -67,7 +67,7 @@ class Relaxation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 threshold_visit_count = 3; */ - private $threshold_visit_count = 0; + protected $threshold_visit_count = 0; /** * Constructor. diff --git a/Optimization/src/V1/InputConfig.php b/Optimization/src/V1/InputConfig.php index 05cdd837c471..b6c65c213d2a 100644 --- a/Optimization/src/V1/InputConfig.php +++ b/Optimization/src/V1/InputConfig.php @@ -20,7 +20,7 @@ class InputConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.DataFormat data_format = 2; */ - private $data_format = 0; + protected $data_format = 0; protected $source; /** diff --git a/Optimization/src/V1/Location.php b/Optimization/src/V1/Location.php index d75aa1d056f4..cb4cfc3a20de 100644 --- a/Optimization/src/V1/Location.php +++ b/Optimization/src/V1/Location.php @@ -20,7 +20,7 @@ class Location extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.type.LatLng lat_lng = 1; */ - private $lat_lng = null; + protected $lat_lng = null; /** * The compass heading associated with the direction of the flow of traffic. * This value is used to specify the side of the road to use for pickup and @@ -29,7 +29,7 @@ class Location extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 heading = 2; */ - private $heading = null; + protected $heading = null; /** * Constructor. diff --git a/Optimization/src/V1/OptimizeToursRequest.php b/Optimization/src/V1/OptimizeToursRequest.php index 2c85c6ea1a44..97f382a04375 100644 --- a/Optimization/src/V1/OptimizeToursRequest.php +++ b/Optimization/src/V1/OptimizeToursRequest.php @@ -23,7 +23,7 @@ class OptimizeToursRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $parent = ''; + protected $parent = ''; /** * If this timeout is set, the server returns a response before the timeout * period has elapsed or the server deadline for synchronous requests is @@ -33,25 +33,25 @@ class OptimizeToursRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration timeout = 2; */ - private $timeout = null; + protected $timeout = null; /** * Shipment model to solve. * * Generated from protobuf field .google.cloud.optimization.v1.ShipmentModel model = 3; */ - private $model = null; + protected $model = null; /** * By default, the solving mode is `DEFAULT_SOLVE` (0). * * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursRequest.SolvingMode solving_mode = 4; */ - private $solving_mode = 0; + protected $solving_mode = 0; /** * Search mode used to solve the request. * * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursRequest.SearchMode search_mode = 6; */ - private $search_mode = 0; + protected $search_mode = 0; /** * Guide the optimization algorithm in finding a first solution that is * similar to a previous solution. @@ -93,7 +93,7 @@ class OptimizeToursRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.InjectedSolutionConstraint injected_solution_constraint = 8; */ - private $injected_solution_constraint = null; + protected $injected_solution_constraint = null; /** * If non-empty, the given routes will be refreshed, without modifying their * underlying sequence of visits or travel times: only other details will be @@ -173,7 +173,7 @@ class OptimizeToursRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool interpret_injected_solutions_using_labels = 10; */ - private $interpret_injected_solutions_using_labels = false; + protected $interpret_injected_solutions_using_labels = false; /** * Consider traffic estimation in calculating `ShipmentRoute` fields * [Transition.travel_duration][google.cloud.optimization.v1.ShipmentRoute.Transition.travel_duration], @@ -186,13 +186,13 @@ class OptimizeToursRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool consider_road_traffic = 11; */ - private $consider_road_traffic = false; + protected $consider_road_traffic = false; /** * If true, polylines will be populated in response `ShipmentRoute`s. * * Generated from protobuf field bool populate_polylines = 12; */ - private $populate_polylines = false; + protected $populate_polylines = false; /** * If true, polylines will be populated in response * [ShipmentRoute.transitions][google.cloud.optimization.v1.ShipmentRoute.transitions]. @@ -201,7 +201,7 @@ class OptimizeToursRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool populate_transition_polylines = 13; */ - private $populate_transition_polylines = false; + protected $populate_transition_polylines = false; /** * If this is set, then the request can have a deadline * (see https://grpc.io/blog/deadlines) of up to 60 minutes. @@ -211,7 +211,7 @@ class OptimizeToursRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool allow_large_deadline_despite_interruption_risk = 14; */ - private $allow_large_deadline_despite_interruption_risk = false; + protected $allow_large_deadline_despite_interruption_risk = false; /** * If true, travel distances will be computed using geodesic distances instead * of Google Maps distances, and travel times will be computed using geodesic @@ -219,7 +219,7 @@ class OptimizeToursRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool use_geodesic_distances = 15; */ - private $use_geodesic_distances = false; + protected $use_geodesic_distances = false; /** * When `use_geodesic_distances` is true, this field must be set and defines * the speed applied to compute travel times. Its value must be at least 1.0 @@ -227,7 +227,7 @@ class OptimizeToursRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional double geodesic_meters_per_second = 16; */ - private $geodesic_meters_per_second = null; + protected $geodesic_meters_per_second = null; /** * Truncates the number of validation errors returned. These errors are * typically attached to an INVALID_ARGUMENT error payload as a BadRequest @@ -239,14 +239,14 @@ class OptimizeToursRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 max_validation_errors = 5; */ - private $max_validation_errors = null; + protected $max_validation_errors = null; /** * Label that may be used to identify this request, reported back in the * [OptimizeToursResponse.request_label][google.cloud.optimization.v1.OptimizeToursResponse.request_label]. * * Generated from protobuf field string label = 17; */ - private $label = ''; + protected $label = ''; /** * Deprecated: Use * [OptimizeToursRequest.populate_transition_polylines][google.cloud.optimization.v1.OptimizeToursRequest.populate_transition_polylines] diff --git a/Optimization/src/V1/OptimizeToursResponse.php b/Optimization/src/V1/OptimizeToursResponse.php index 13dee71cfc19..14b27b295c28 100644 --- a/Optimization/src/V1/OptimizeToursResponse.php +++ b/Optimization/src/V1/OptimizeToursResponse.php @@ -31,7 +31,7 @@ class OptimizeToursResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string request_label = 3; */ - private $request_label = ''; + protected $request_label = ''; /** * The list of all shipments skipped. * @@ -52,7 +52,7 @@ class OptimizeToursResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursResponse.Metrics metrics = 6; */ - private $metrics = null; + protected $metrics = null; /** * Deprecated: Use * [Metrics.total_cost][google.cloud.optimization.v1.OptimizeToursResponse.Metrics.total_cost] diff --git a/Optimization/src/V1/OptimizeToursResponse/Metrics.php b/Optimization/src/V1/OptimizeToursResponse/Metrics.php index 42d83d3f87d3..156dfcb25d18 100644 --- a/Optimization/src/V1/OptimizeToursResponse/Metrics.php +++ b/Optimization/src/V1/OptimizeToursResponse/Metrics.php @@ -23,13 +23,13 @@ class Metrics extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.AggregatedMetrics aggregated_route_metrics = 1; */ - private $aggregated_route_metrics = null; + protected $aggregated_route_metrics = null; /** * Number of mandatory shipments skipped. * * Generated from protobuf field int32 skipped_mandatory_shipment_count = 2; */ - private $skipped_mandatory_shipment_count = 0; + protected $skipped_mandatory_shipment_count = 0; /** * Number of vehicles used. Note: if a vehicle route is empty and * [Vehicle.used_if_route_is_empty][google.cloud.optimization.v1.Vehicle.used_if_route_is_empty] @@ -37,7 +37,7 @@ class Metrics extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 used_vehicle_count = 3; */ - private $used_vehicle_count = 0; + protected $used_vehicle_count = 0; /** * The earliest start time for a used vehicle, computed as the minimum over * all used vehicles of @@ -45,7 +45,7 @@ class Metrics extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp earliest_vehicle_start_time = 4; */ - private $earliest_vehicle_start_time = null; + protected $earliest_vehicle_start_time = null; /** * The latest end time for a used vehicle, computed as the maximum over all * used vehicles of @@ -53,7 +53,7 @@ class Metrics extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp latest_vehicle_end_time = 5; */ - private $latest_vehicle_end_time = null; + protected $latest_vehicle_end_time = null; /** * Cost of the solution, broken down by cost-related request fields. * The keys are proto paths, relative to the input OptimizeToursRequest, @@ -73,7 +73,7 @@ class Metrics extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double total_cost = 6; */ - private $total_cost = 0.0; + protected $total_cost = 0.0; /** * Constructor. diff --git a/Optimization/src/V1/OptimizeToursValidationError.php b/Optimization/src/V1/OptimizeToursValidationError.php index e12b4554d7fe..bb7ec123e7f8 100644 --- a/Optimization/src/V1/OptimizeToursValidationError.php +++ b/Optimization/src/V1/OptimizeToursValidationError.php @@ -257,13 +257,13 @@ class OptimizeToursValidationError extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 code = 1; */ - private $code = 0; + protected $code = 0; /** * The error display name. * * Generated from protobuf field string display_name = 2; */ - private $display_name = ''; + protected $display_name = ''; /** * An error context may involve 0, 1 (most of the time) or more fields. For * example, referring to vehicle #4 and shipment #2's first pickup can be @@ -287,7 +287,7 @@ class OptimizeToursValidationError extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string error_message = 4; */ - private $error_message = ''; + protected $error_message = ''; /** * May contain the value(s) of the field(s). This is not always available. You * should absolutely not rely on it and use it only for manual model @@ -295,7 +295,7 @@ class OptimizeToursValidationError extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string offending_values = 5; */ - private $offending_values = ''; + protected $offending_values = ''; /** * Constructor. diff --git a/Optimization/src/V1/OptimizeToursValidationError/FieldReference.php b/Optimization/src/V1/OptimizeToursValidationError/FieldReference.php index 52b93165f70c..9efaeeb668d4 100644 --- a/Optimization/src/V1/OptimizeToursValidationError/FieldReference.php +++ b/Optimization/src/V1/OptimizeToursValidationError/FieldReference.php @@ -28,13 +28,13 @@ class FieldReference extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Recursively nested sub-field, if needed. * * Generated from protobuf field .google.cloud.optimization.v1.OptimizeToursValidationError.FieldReference sub_field = 3; */ - private $sub_field = null; + protected $sub_field = null; protected $index_or_key; /** diff --git a/Optimization/src/V1/OutputConfig.php b/Optimization/src/V1/OutputConfig.php index 1f1f07a5106a..b8b6565a9842 100644 --- a/Optimization/src/V1/OutputConfig.php +++ b/Optimization/src/V1/OutputConfig.php @@ -20,7 +20,7 @@ class OutputConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.DataFormat data_format = 2; */ - private $data_format = 0; + protected $data_format = 0; protected $destination; /** diff --git a/Optimization/src/V1/RouteModifiers.php b/Optimization/src/V1/RouteModifiers.php index 4c356775bd52..0a3309db7946 100644 --- a/Optimization/src/V1/RouteModifiers.php +++ b/Optimization/src/V1/RouteModifiers.php @@ -25,7 +25,7 @@ class RouteModifiers extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool avoid_tolls = 2; */ - private $avoid_tolls = false; + protected $avoid_tolls = false; /** * Specifies whether to avoid highways where reasonable. Preference will be * given to routes not containing highways. Applies only to motorized travel @@ -33,7 +33,7 @@ class RouteModifiers extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool avoid_highways = 3; */ - private $avoid_highways = false; + protected $avoid_highways = false; /** * Specifies whether to avoid ferries where reasonable. Preference will be * given to routes not containing travel by ferries. Applies only to motorized @@ -41,7 +41,7 @@ class RouteModifiers extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool avoid_ferries = 4; */ - private $avoid_ferries = false; + protected $avoid_ferries = false; /** * Optional. Specifies whether to avoid navigating indoors where reasonable. * Preference will be given to routes not containing indoor navigation. @@ -49,7 +49,7 @@ class RouteModifiers extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool avoid_indoor = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $avoid_indoor = false; + protected $avoid_indoor = false; /** * Constructor. diff --git a/Optimization/src/V1/Shipment.php b/Optimization/src/V1/Shipment.php index bda31c679302..652069078d66 100644 --- a/Optimization/src/V1/Shipment.php +++ b/Optimization/src/V1/Shipment.php @@ -55,7 +55,7 @@ class Shipment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional double penalty_cost = 4; */ - private $penalty_cost = null; + protected $penalty_cost = null; /** * The set of vehicles that may perform this shipment. If empty, all vehicles * may perform it. Vehicles are given by their index in the `ShipmentModel`'s @@ -105,7 +105,7 @@ class Shipment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional double pickup_to_delivery_relative_detour_limit = 8; */ - private $pickup_to_delivery_relative_detour_limit = null; + protected $pickup_to_delivery_relative_detour_limit = null; /** * Specifies the maximum absolute detour time compared to the shortest path * from pickup to delivery. If specified, it must be nonnegative, and the @@ -124,7 +124,7 @@ class Shipment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration pickup_to_delivery_absolute_detour_limit = 9; */ - private $pickup_to_delivery_absolute_detour_limit = null; + protected $pickup_to_delivery_absolute_detour_limit = null; /** * Specifies the maximum duration from start of pickup to start of delivery of * a shipment. If specified, it must be nonnegative, and the shipment must @@ -135,7 +135,7 @@ class Shipment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration pickup_to_delivery_time_limit = 10; */ - private $pickup_to_delivery_time_limit = null; + protected $pickup_to_delivery_time_limit = null; /** * Non-empty string specifying a "type" for this shipment. * This feature can be used to define incompatibilities or requirements @@ -147,7 +147,7 @@ class Shipment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string shipment_type = 11; */ - private $shipment_type = ''; + protected $shipment_type = ''; /** * Specifies a label for this shipment. This label is reported in the response * in the `shipment_label` of the corresponding @@ -155,7 +155,7 @@ class Shipment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string label = 12; */ - private $label = ''; + protected $label = ''; /** * If true, skip this shipment, but don't apply a `penalty_cost`. * Ignoring a shipment results in a validation error when there are any @@ -167,7 +167,7 @@ class Shipment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool ignore = 13; */ - private $ignore = false; + protected $ignore = false; /** * Deprecated: Use * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] diff --git a/Optimization/src/V1/Shipment/Load.php b/Optimization/src/V1/Shipment/Load.php index 5bbd1032c66f..36b14a8fe738 100644 --- a/Optimization/src/V1/Shipment/Load.php +++ b/Optimization/src/V1/Shipment/Load.php @@ -25,7 +25,7 @@ class Load extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 amount = 2; */ - private $amount = 0; + protected $amount = 0; /** * Constructor. diff --git a/Optimization/src/V1/Shipment/VisitRequest.php b/Optimization/src/V1/Shipment/VisitRequest.php index 3c82d7c20548..0de34e70561f 100644 --- a/Optimization/src/V1/Shipment/VisitRequest.php +++ b/Optimization/src/V1/Shipment/VisitRequest.php @@ -25,7 +25,7 @@ class VisitRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.type.LatLng arrival_location = 1; */ - private $arrival_location = null; + protected $arrival_location = null; /** * The waypoint where the vehicle arrives when performing this * `VisitRequest`. If the shipment model has duration distance matrices, @@ -33,7 +33,7 @@ class VisitRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.Waypoint arrival_waypoint = 2; */ - private $arrival_waypoint = null; + protected $arrival_waypoint = null; /** * The geo-location where the vehicle departs after completing this * `VisitRequest`. Can be omitted if it is the same as `arrival_location`. @@ -42,7 +42,7 @@ class VisitRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.type.LatLng departure_location = 3; */ - private $departure_location = null; + protected $departure_location = null; /** * The waypoint where the vehicle departs after completing this * `VisitRequest`. Can be omitted if it is the same as `arrival_waypoint`. @@ -51,7 +51,7 @@ class VisitRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.Waypoint departure_waypoint = 4; */ - private $departure_waypoint = null; + protected $departure_waypoint = null; /** * Specifies tags attached to the visit request. * Empty or duplicate strings are not allowed. @@ -82,7 +82,7 @@ class VisitRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration duration = 7; */ - private $duration = null; + protected $duration = null; /** * Cost to service this visit request on a vehicle route. This can be used * to pay different costs for each alternative pickup or delivery of a @@ -91,7 +91,7 @@ class VisitRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double cost = 8; */ - private $cost = 0.0; + protected $cost = 0.0; /** * Load demands of this visit request. This is just like * [Shipment.load_demands][google.cloud.optimization.v1.Shipment.load_demands] @@ -120,7 +120,7 @@ class VisitRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string label = 11; */ - private $label = ''; + protected $label = ''; /** * Deprecated: Use * [VisitRequest.load_demands][google.cloud.optimization.v1.Shipment.VisitRequest.load_demands] diff --git a/Optimization/src/V1/ShipmentModel.php b/Optimization/src/V1/ShipmentModel.php index 447be9106ef4..058949f5a9bd 100644 --- a/Optimization/src/V1/ShipmentModel.php +++ b/Optimization/src/V1/ShipmentModel.php @@ -42,7 +42,7 @@ class ShipmentModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 max_active_vehicles = 4; */ - private $max_active_vehicles = null; + protected $max_active_vehicles = null; /** * Global start and end time of the model: no times outside of this range * can be considered valid. @@ -56,14 +56,14 @@ class ShipmentModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp global_start_time = 5; */ - private $global_start_time = null; + protected $global_start_time = null; /** * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) * is used as default. * * Generated from protobuf field .google.protobuf.Timestamp global_end_time = 6; */ - private $global_end_time = null; + protected $global_end_time = null; /** * The "global duration" of the overall plan is the difference between the * earliest effective start time and the latest effective end time of @@ -74,7 +74,7 @@ class ShipmentModel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double global_duration_cost_per_hour = 7; */ - private $global_duration_cost_per_hour = 0.0; + protected $global_duration_cost_per_hour = 0.0; /** * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending diff --git a/Optimization/src/V1/ShipmentModel/BreakRule/BreakRequest.php b/Optimization/src/V1/ShipmentModel/BreakRule/BreakRequest.php index 4d4a719150d3..2c5d2f194083 100644 --- a/Optimization/src/V1/ShipmentModel/BreakRule/BreakRequest.php +++ b/Optimization/src/V1/ShipmentModel/BreakRule/BreakRequest.php @@ -24,19 +24,19 @@ class BreakRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $earliest_start_time = null; + protected $earliest_start_time = null; /** * Required. Upper bound (inclusive) on the start of the break. * * Generated from protobuf field .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $latest_start_time = null; + protected $latest_start_time = null; /** * Required. Minimum duration of the break. Must be positive. * * Generated from protobuf field .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $min_duration = null; + protected $min_duration = null; /** * Constructor. diff --git a/Optimization/src/V1/ShipmentModel/BreakRule/FrequencyConstraint.php b/Optimization/src/V1/ShipmentModel/BreakRule/FrequencyConstraint.php index 363fff0cbba8..bd64391c1e4a 100644 --- a/Optimization/src/V1/ShipmentModel/BreakRule/FrequencyConstraint.php +++ b/Optimization/src/V1/ShipmentModel/BreakRule/FrequencyConstraint.php @@ -51,7 +51,7 @@ class FrequencyConstraint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $min_break_duration = null; + protected $min_break_duration = null; /** * Required. Maximum allowed span of any interval of time in the route * that does not include at least partially a break of `duration >= @@ -59,7 +59,7 @@ class FrequencyConstraint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $max_inter_break_duration = null; + protected $max_inter_break_duration = null; /** * Constructor. diff --git a/Optimization/src/V1/ShipmentModel/DurationDistanceMatrix.php b/Optimization/src/V1/ShipmentModel/DurationDistanceMatrix.php index 66b0bdc8124d..d209bc4e5c2a 100644 --- a/Optimization/src/V1/ShipmentModel/DurationDistanceMatrix.php +++ b/Optimization/src/V1/ShipmentModel/DurationDistanceMatrix.php @@ -35,7 +35,7 @@ class DurationDistanceMatrix extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string vehicle_start_tag = 2; */ - private $vehicle_start_tag = ''; + protected $vehicle_start_tag = ''; /** * Constructor. diff --git a/Optimization/src/V1/ShipmentModel/PrecedenceRule.php b/Optimization/src/V1/ShipmentModel/PrecedenceRule.php index 509b6c74d8b0..3c125da2dbc5 100644 --- a/Optimization/src/V1/ShipmentModel/PrecedenceRule.php +++ b/Optimization/src/V1/ShipmentModel/PrecedenceRule.php @@ -27,31 +27,31 @@ class PrecedenceRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 first_index = 1; */ - private $first_index = null; + protected $first_index = null; /** * Indicates if the "first" event is a delivery. * * Generated from protobuf field bool first_is_delivery = 3; */ - private $first_is_delivery = false; + protected $first_is_delivery = false; /** * Shipment index of the "second" event. This field must be specified. * * Generated from protobuf field optional int32 second_index = 2; */ - private $second_index = null; + protected $second_index = null; /** * Indicates if the "second" event is a delivery. * * Generated from protobuf field bool second_is_delivery = 4; */ - private $second_is_delivery = false; + protected $second_is_delivery = false; /** * The offset between the "first" and "second" event. It can be negative. * * Generated from protobuf field .google.protobuf.Duration offset_duration = 5; */ - private $offset_duration = null; + protected $offset_duration = null; /** * Constructor. diff --git a/Optimization/src/V1/ShipmentRoute.php b/Optimization/src/V1/ShipmentRoute.php index 26b7ebf14f5f..05da325cf562 100644 --- a/Optimization/src/V1/ShipmentRoute.php +++ b/Optimization/src/V1/ShipmentRoute.php @@ -98,26 +98,26 @@ class ShipmentRoute extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 vehicle_index = 1; */ - private $vehicle_index = 0; + protected $vehicle_index = 0; /** * Label of the vehicle performing this route, equal to * `ShipmentModel.vehicles(vehicle_index).label`, if specified. * * Generated from protobuf field string vehicle_label = 2; */ - private $vehicle_label = ''; + protected $vehicle_label = ''; /** * Time at which the vehicle starts its route. * * Generated from protobuf field .google.protobuf.Timestamp vehicle_start_time = 5; */ - private $vehicle_start_time = null; + protected $vehicle_start_time = null; /** * Time at which the vehicle finishes its route. * * Generated from protobuf field .google.protobuf.Timestamp vehicle_end_time = 6; */ - private $vehicle_end_time = null; + protected $vehicle_end_time = null; /** * Ordered sequence of visits representing a route. * visits[i] is the i-th visit in the route. @@ -152,7 +152,7 @@ class ShipmentRoute extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool has_traffic_infeasibilities = 9; */ - private $has_traffic_infeasibilities = false; + protected $has_traffic_infeasibilities = false; /** * The encoded polyline representation of the route. * This field is only populated if @@ -161,7 +161,7 @@ class ShipmentRoute extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 10; */ - private $route_polyline = null; + protected $route_polyline = null; /** * Breaks scheduled for the vehicle performing this route. * The `breaks` sequence represents time intervals, each starting at the @@ -181,7 +181,7 @@ class ShipmentRoute extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.AggregatedMetrics metrics = 12; */ - private $metrics = null; + protected $metrics = null; /** * Cost of the route, broken down by cost-related request fields. * The keys are proto paths, relative to the input OptimizeToursRequest, e.g. @@ -200,7 +200,7 @@ class ShipmentRoute extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double route_total_cost = 18; */ - private $route_total_cost = 0.0; + protected $route_total_cost = 0.0; /** * Deprecated: Use * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] diff --git a/Optimization/src/V1/ShipmentRoute/Delay.php b/Optimization/src/V1/ShipmentRoute/Delay.php index 98c9963c58c5..6e2ef2dcebb7 100644 --- a/Optimization/src/V1/ShipmentRoute/Delay.php +++ b/Optimization/src/V1/ShipmentRoute/Delay.php @@ -24,13 +24,13 @@ class Delay extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; */ - private $start_time = null; + protected $start_time = null; /** * Duration of the delay. * * Generated from protobuf field .google.protobuf.Duration duration = 2; */ - private $duration = null; + protected $duration = null; /** * Constructor. diff --git a/Optimization/src/V1/ShipmentRoute/EncodedPolyline.php b/Optimization/src/V1/ShipmentRoute/EncodedPolyline.php index 441e0efb6cc6..a930a4eacea8 100644 --- a/Optimization/src/V1/ShipmentRoute/EncodedPolyline.php +++ b/Optimization/src/V1/ShipmentRoute/EncodedPolyline.php @@ -23,7 +23,7 @@ class EncodedPolyline extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string points = 1; */ - private $points = ''; + protected $points = ''; /** * Constructor. diff --git a/Optimization/src/V1/ShipmentRoute/PBBreak.php b/Optimization/src/V1/ShipmentRoute/PBBreak.php index 8e137a3a492e..fae28f7abedc 100644 --- a/Optimization/src/V1/ShipmentRoute/PBBreak.php +++ b/Optimization/src/V1/ShipmentRoute/PBBreak.php @@ -20,13 +20,13 @@ class PBBreak extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; */ - private $start_time = null; + protected $start_time = null; /** * Duration of a break. * * Generated from protobuf field .google.protobuf.Duration duration = 2; */ - private $duration = null; + protected $duration = null; /** * Constructor. diff --git a/Optimization/src/V1/ShipmentRoute/Transition.php b/Optimization/src/V1/ShipmentRoute/Transition.php index dde3e27515f6..689a30f8e195 100644 --- a/Optimization/src/V1/ShipmentRoute/Transition.php +++ b/Optimization/src/V1/ShipmentRoute/Transition.php @@ -23,13 +23,13 @@ class Transition extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration travel_duration = 1; */ - private $travel_duration = null; + protected $travel_duration = null; /** * Distance traveled during the transition. * * Generated from protobuf field double travel_distance_meters = 2; */ - private $travel_distance_meters = 0.0; + protected $travel_distance_meters = 0.0; /** * When traffic is requested via * [OptimizeToursRequest.consider_road_traffic] @@ -40,7 +40,7 @@ class Transition extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool traffic_info_unavailable = 3; */ - private $traffic_info_unavailable = false; + protected $traffic_info_unavailable = false; /** * Sum of the delay durations applied to this transition. If any, the delay * starts exactly `delay_duration` seconds before the next event (visit or @@ -49,7 +49,7 @@ class Transition extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration delay_duration = 4; */ - private $delay_duration = null; + protected $delay_duration = null; /** * Sum of the duration of the breaks occurring during this transition, if * any. Details about each break's start time and duration are stored in @@ -57,7 +57,7 @@ class Transition extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration break_duration = 5; */ - private $break_duration = null; + protected $break_duration = null; /** * Time spent waiting during this transition. Wait duration corresponds to * idle time and does not include break time. Also note that this wait time @@ -65,7 +65,7 @@ class Transition extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration wait_duration = 6; */ - private $wait_duration = null; + protected $wait_duration = null; /** * Total duration of the transition, provided for convenience. It is equal * to: @@ -77,13 +77,13 @@ class Transition extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration total_duration = 7; */ - private $total_duration = null; + protected $total_duration = null; /** * Start time of this transition. * * Generated from protobuf field .google.protobuf.Timestamp start_time = 8; */ - private $start_time = null; + protected $start_time = null; /** * The encoded polyline representation of the route followed during the * transition. @@ -93,7 +93,7 @@ class Transition extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 9; */ - private $route_polyline = null; + protected $route_polyline = null; /** * Vehicle loads during this transition, for each type that either appears * in this vehicle's diff --git a/Optimization/src/V1/ShipmentRoute/TravelStep.php b/Optimization/src/V1/ShipmentRoute/TravelStep.php index cd7d0d2ae27d..6977249edcbd 100644 --- a/Optimization/src/V1/ShipmentRoute/TravelStep.php +++ b/Optimization/src/V1/ShipmentRoute/TravelStep.php @@ -32,13 +32,13 @@ class TravelStep extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration duration = 1; */ - private $duration = null; + protected $duration = null; /** * Distance traveled during the step. * * Generated from protobuf field double distance_meters = 2; */ - private $distance_meters = 0.0; + protected $distance_meters = 0.0; /** * When traffic is requested via * [OptimizeToursRequest.consider_road_traffic][google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], @@ -48,7 +48,7 @@ class TravelStep extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool traffic_info_unavailable = 3; */ - private $traffic_info_unavailable = false; + protected $traffic_info_unavailable = false; /** * The encoded polyline representation of the route followed during the * step. @@ -58,7 +58,7 @@ class TravelStep extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.ShipmentRoute.EncodedPolyline route_polyline = 4; */ - private $route_polyline = null; + protected $route_polyline = null; /** * Constructor. diff --git a/Optimization/src/V1/ShipmentRoute/VehicleLoad.php b/Optimization/src/V1/ShipmentRoute/VehicleLoad.php index 29bb1d03e8b7..748144841d92 100644 --- a/Optimization/src/V1/ShipmentRoute/VehicleLoad.php +++ b/Optimization/src/V1/ShipmentRoute/VehicleLoad.php @@ -24,7 +24,7 @@ class VehicleLoad extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 amount = 1; */ - private $amount = 0; + protected $amount = 0; /** * Constructor. diff --git a/Optimization/src/V1/ShipmentRoute/Visit.php b/Optimization/src/V1/ShipmentRoute/Visit.php index 24fb82775ce7..14d098f0cf98 100644 --- a/Optimization/src/V1/ShipmentRoute/Visit.php +++ b/Optimization/src/V1/ShipmentRoute/Visit.php @@ -22,21 +22,21 @@ class Visit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 shipment_index = 1; */ - private $shipment_index = 0; + protected $shipment_index = 0; /** * If true the visit corresponds to a pickup of a `Shipment`. Otherwise, it * corresponds to a delivery. * * Generated from protobuf field bool is_pickup = 2; */ - private $is_pickup = false; + protected $is_pickup = false; /** * Index of `VisitRequest` in either the pickup or delivery field of the * `Shipment` (see `is_pickup`). * * Generated from protobuf field int32 visit_request_index = 3; */ - private $visit_request_index = 0; + protected $visit_request_index = 0; /** * Time at which the visit starts. Note that the vehicle may arrive earlier * than this at the visit location. Times are consistent with the @@ -44,7 +44,7 @@ class Visit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp start_time = 4; */ - private $start_time = null; + protected $start_time = null; /** * Total visit load demand as the sum of the shipment and the visit request * `load_demands`. The values are negative if the visit is a delivery. @@ -74,14 +74,14 @@ class Visit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration detour = 6; */ - private $detour = null; + protected $detour = null; /** * Copy of the corresponding `Shipment.label`, if specified in the * `Shipment`. * * Generated from protobuf field string shipment_label = 7; */ - private $shipment_label = ''; + protected $shipment_label = ''; /** * Copy of the corresponding * [VisitRequest.label][google.cloud.optimization.v1.Shipment.VisitRequest.label], @@ -89,7 +89,7 @@ class Visit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string visit_label = 8; */ - private $visit_label = ''; + protected $visit_label = ''; /** * Deprecated: Use * [Transition.vehicle_loads][google.cloud.optimization.v1.ShipmentRoute.Transition.vehicle_loads] diff --git a/Optimization/src/V1/ShipmentTypeIncompatibility.php b/Optimization/src/V1/ShipmentTypeIncompatibility.php index 92968de59157..b42f828a6d3c 100644 --- a/Optimization/src/V1/ShipmentTypeIncompatibility.php +++ b/Optimization/src/V1/ShipmentTypeIncompatibility.php @@ -29,7 +29,7 @@ class ShipmentTypeIncompatibility extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.ShipmentTypeIncompatibility.IncompatibilityMode incompatibility_mode = 2; */ - private $incompatibility_mode = 0; + protected $incompatibility_mode = 0; /** * Constructor. diff --git a/Optimization/src/V1/ShipmentTypeRequirement.php b/Optimization/src/V1/ShipmentTypeRequirement.php index ebe1ddba7e19..1b6005011b9b 100644 --- a/Optimization/src/V1/ShipmentTypeRequirement.php +++ b/Optimization/src/V1/ShipmentTypeRequirement.php @@ -38,7 +38,7 @@ class ShipmentTypeRequirement extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.ShipmentTypeRequirement.RequirementMode requirement_mode = 3; */ - private $requirement_mode = 0; + protected $requirement_mode = 0; /** * Constructor. diff --git a/Optimization/src/V1/SkippedShipment.php b/Optimization/src/V1/SkippedShipment.php index de3502241baf..90c4eeab9d8a 100644 --- a/Optimization/src/V1/SkippedShipment.php +++ b/Optimization/src/V1/SkippedShipment.php @@ -23,7 +23,7 @@ class SkippedShipment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 index = 1; */ - private $index = 0; + protected $index = 0; /** * Copy of the corresponding * [Shipment.label][google.cloud.optimization.v1.Shipment.label], if specified @@ -31,7 +31,7 @@ class SkippedShipment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string label = 2; */ - private $label = ''; + protected $label = ''; /** * A list of reasons that explain why the shipment was skipped. See comment * above `Reason`. diff --git a/Optimization/src/V1/SkippedShipment/Reason.php b/Optimization/src/V1/SkippedShipment/Reason.php index 15347c3f689b..600f452d411f 100644 --- a/Optimization/src/V1/SkippedShipment/Reason.php +++ b/Optimization/src/V1/SkippedShipment/Reason.php @@ -45,21 +45,21 @@ class Reason extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.SkippedShipment.Reason.Code code = 1; */ - private $code = 0; + protected $code = 0; /** * If the reason is related to a shipment-vehicle incompatibility, this * field provides the index of one relevant vehicle. * * Generated from protobuf field optional int32 example_vehicle_index = 2; */ - private $example_vehicle_index = null; + protected $example_vehicle_index = null; /** * If the reason code is `DEMAND_EXCEEDS_VEHICLE_CAPACITY`, documents one * capacity type that is exceeded. * * Generated from protobuf field string example_exceeded_capacity_type = 3; */ - private $example_exceeded_capacity_type = ''; + protected $example_exceeded_capacity_type = ''; /** * Constructor. diff --git a/Optimization/src/V1/TimeWindow.php b/Optimization/src/V1/TimeWindow.php index cbbee60f3e3c..33c8cc767a0b 100644 --- a/Optimization/src/V1/TimeWindow.php +++ b/Optimization/src/V1/TimeWindow.php @@ -40,26 +40,26 @@ class TimeWindow extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; */ - private $start_time = null; + protected $start_time = null; /** * The hard time window end time. If unspecified it will be set to * `ShipmentModel.global_end_time`. * * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; */ - private $end_time = null; + protected $end_time = null; /** * The soft start time of the time window. * * Generated from protobuf field .google.protobuf.Timestamp soft_start_time = 3; */ - private $soft_start_time = null; + protected $soft_start_time = null; /** * The soft end time of the time window. * * Generated from protobuf field .google.protobuf.Timestamp soft_end_time = 4; */ - private $soft_end_time = null; + protected $soft_end_time = null; /** * A cost per hour added to other costs in the model if the event occurs * before soft_start_time, computed as: @@ -73,7 +73,7 @@ class TimeWindow extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional double cost_per_hour_before_soft_start_time = 5; */ - private $cost_per_hour_before_soft_start_time = null; + protected $cost_per_hour_before_soft_start_time = null; /** * A cost per hour added to other costs in the model if the event occurs after * `soft_end_time`, computed as: @@ -87,7 +87,7 @@ class TimeWindow extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional double cost_per_hour_after_soft_end_time = 6; */ - private $cost_per_hour_after_soft_end_time = null; + protected $cost_per_hour_after_soft_end_time = null; /** * Constructor. diff --git a/Optimization/src/V1/TransitionAttributes.php b/Optimization/src/V1/TransitionAttributes.php index 61ac001df2a4..a5182bd35dfb 100644 --- a/Optimization/src/V1/TransitionAttributes.php +++ b/Optimization/src/V1/TransitionAttributes.php @@ -28,14 +28,14 @@ class TransitionAttributes extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string src_tag = 1; */ - private $src_tag = ''; + protected $src_tag = ''; /** * See `src_tag`. Exactly one of `src_tag` and `excluded_src_tag` must be * non-empty. * * Generated from protobuf field string excluded_src_tag = 2; */ - private $excluded_src_tag = ''; + protected $excluded_src_tag = ''; /** * A destination visit or vehicle end matches iff its * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] @@ -45,14 +45,14 @@ class TransitionAttributes extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string dst_tag = 3; */ - private $dst_tag = ''; + protected $dst_tag = ''; /** * See `dst_tag`. Exactly one of `dst_tag` and `excluded_dst_tag` must be * non-empty. * * Generated from protobuf field string excluded_dst_tag = 4; */ - private $excluded_dst_tag = ''; + protected $excluded_dst_tag = ''; /** * Specifies a cost for performing this transition. This is in the same unit * as all other costs in the model and must not be negative. It is applied on @@ -60,7 +60,7 @@ class TransitionAttributes extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double cost = 5; */ - private $cost = 0.0; + protected $cost = 0.0; /** * Specifies a cost per kilometer applied to the distance traveled while * performing this transition. It adds up to any @@ -69,7 +69,7 @@ class TransitionAttributes extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double cost_per_kilometer = 6; */ - private $cost_per_kilometer = 0.0; + protected $cost_per_kilometer = 0.0; /** * Specifies a limit on the distance traveled while performing this * transition. @@ -77,7 +77,7 @@ class TransitionAttributes extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.DistanceLimit distance_limit = 7; */ - private $distance_limit = null; + protected $distance_limit = null; /** * Specifies a delay incurred when performing this transition. * This delay always occurs *after* finishing the source visit and *before* @@ -85,7 +85,7 @@ class TransitionAttributes extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration delay = 8; */ - private $delay = null; + protected $delay = null; /** * Constructor. diff --git a/Optimization/src/V1/Vehicle.php b/Optimization/src/V1/Vehicle.php index b5dbb09f5210..90af4115a7c0 100644 --- a/Optimization/src/V1/Vehicle.php +++ b/Optimization/src/V1/Vehicle.php @@ -23,14 +23,14 @@ class Vehicle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.TravelMode travel_mode = 1; */ - private $travel_mode = 0; + protected $travel_mode = 0; /** * Optional. A set of conditions to satisfy that affect the way routes are * calculated for the given vehicle. * * Generated from protobuf field .google.cloud.optimization.v1.RouteModifiers route_modifiers = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $route_modifiers = null; + protected $route_modifiers = null; /** * Geographic location where the vehicle starts before picking up any * shipments. If not specified, the vehicle starts at its first pickup. @@ -39,7 +39,7 @@ class Vehicle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.type.LatLng start_location = 3; */ - private $start_location = null; + protected $start_location = null; /** * Waypoint representing a geographic location where the vehicle starts before * picking up any shipments. If neither `start_waypoint` nor `start_location` @@ -49,7 +49,7 @@ class Vehicle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.Waypoint start_waypoint = 4; */ - private $start_waypoint = null; + protected $start_waypoint = null; /** * Geographic location where the vehicle ends after it has completed its last * `VisitRequest`. If not specified the vehicle's `ShipmentRoute` ends @@ -59,7 +59,7 @@ class Vehicle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.type.LatLng end_location = 5; */ - private $end_location = null; + protected $end_location = null; /** * Waypoint representing a geographic location where the vehicle ends after * it has completed its last `VisitRequest`. If neither `end_waypoint` nor @@ -70,7 +70,7 @@ class Vehicle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.Waypoint end_waypoint = 6; */ - private $end_waypoint = null; + protected $end_waypoint = null; /** * Specifies tags attached to the start of the vehicle's route. * Empty or duplicate strings are not allowed. @@ -130,13 +130,13 @@ class Vehicle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional double travel_duration_multiple = 11; */ - private $travel_duration_multiple = null; + protected $travel_duration_multiple = null; /** * Unloading policy enforced on the vehicle. * * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.UnloadingPolicy unloading_policy = 12; */ - private $unloading_policy = 0; + protected $unloading_policy = 0; /** * Capacities of the vehicle (weight, volume, # of pallets for example). * The keys in the map are the identifiers of the type of load, consistent @@ -158,7 +158,7 @@ class Vehicle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double cost_per_hour = 16; */ - private $cost_per_hour = 0.0; + protected $cost_per_hour = 0.0; /** * Cost per traveled hour of the vehicle route. This cost is applied only to * travel time taken by the route (i.e., that reported in @@ -167,7 +167,7 @@ class Vehicle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double cost_per_traveled_hour = 17; */ - private $cost_per_traveled_hour = 0.0; + protected $cost_per_traveled_hour = 0.0; /** * Cost per kilometer of the vehicle route. This cost is applied to the * distance reported in the @@ -177,13 +177,13 @@ class Vehicle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double cost_per_kilometer = 18; */ - private $cost_per_kilometer = 0.0; + protected $cost_per_kilometer = 0.0; /** * Fixed cost applied if this vehicle is used to handle a shipment. * * Generated from protobuf field double fixed_cost = 19; */ - private $fixed_cost = 0.0; + protected $fixed_cost = 0.0; /** * This field only applies to vehicles when their route does not serve any * shipments. It indicates if the vehicle should be considered as used or not @@ -198,7 +198,7 @@ class Vehicle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool used_if_route_is_empty = 20; */ - private $used_if_route_is_empty = false; + protected $used_if_route_is_empty = false; /** * Limit applied to the total duration of the vehicle's route. In a given * `OptimizeToursResponse`, the route duration of a vehicle is the @@ -206,7 +206,7 @@ class Vehicle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.DurationLimit route_duration_limit = 21; */ - private $route_duration_limit = null; + protected $route_duration_limit = null; /** * Limit applied to the travel duration of the vehicle's route. In a given * `OptimizeToursResponse`, the route travel duration is the sum of all its @@ -214,7 +214,7 @@ class Vehicle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.DurationLimit travel_duration_limit = 22; */ - private $travel_duration_limit = null; + protected $travel_duration_limit = null; /** * Limit applied to the total distance of the vehicle's route. In a given * `OptimizeToursResponse`, the route distance is the sum of all its @@ -222,7 +222,7 @@ class Vehicle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.DistanceLimit route_distance_limit = 23; */ - private $route_distance_limit = null; + protected $route_distance_limit = null; /** * Specifies a map from visit_types strings to durations. The duration is time * in addition to @@ -242,7 +242,7 @@ class Vehicle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.optimization.v1.BreakRule break_rule = 25; */ - private $break_rule = null; + protected $break_rule = null; /** * Specifies a label for this vehicle. This label is reported in the response * as the `vehicle_label` of the corresponding @@ -250,7 +250,7 @@ class Vehicle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string label = 27; */ - private $label = ''; + protected $label = ''; /** * If true, `used_if_route_is_empty` must be false, and this vehicle will * remain unused. @@ -266,7 +266,7 @@ class Vehicle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool ignore = 28; */ - private $ignore = false; + protected $ignore = false; /** * Deprecated: No longer used. * Indices in the `break_rule` field in the source diff --git a/Optimization/src/V1/Vehicle/DurationLimit.php b/Optimization/src/V1/Vehicle/DurationLimit.php index 48855471aa7c..39073f5778a3 100644 --- a/Optimization/src/V1/Vehicle/DurationLimit.php +++ b/Optimization/src/V1/Vehicle/DurationLimit.php @@ -23,7 +23,7 @@ class DurationLimit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration max_duration = 1; */ - private $max_duration = null; + protected $max_duration = null; /** * A soft limit not enforcing a maximum duration limit, but when violated * makes the route incur a cost. This cost adds up to other costs defined in @@ -33,7 +33,7 @@ class DurationLimit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration soft_max_duration = 2; */ - private $soft_max_duration = null; + protected $soft_max_duration = null; /** * Cost per hour incurred if the `soft_max_duration` threshold is violated. * The additional cost is 0 if the duration is under the threshold, @@ -45,7 +45,7 @@ class DurationLimit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional double cost_per_hour_after_soft_max = 3; */ - private $cost_per_hour_after_soft_max = null; + protected $cost_per_hour_after_soft_max = null; /** * A soft limit not enforcing a maximum duration limit, but when violated * makes the route incur a cost, quadratic in the duration. This cost adds @@ -58,7 +58,7 @@ class DurationLimit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration quadratic_soft_max_duration = 4; */ - private $quadratic_soft_max_duration = null; + protected $quadratic_soft_max_duration = null; /** * Cost per square hour incurred if the * `quadratic_soft_max_duration` threshold is violated. @@ -72,7 +72,7 @@ class DurationLimit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional double cost_per_square_hour_after_quadratic_soft_max = 5; */ - private $cost_per_square_hour_after_quadratic_soft_max = null; + protected $cost_per_square_hour_after_quadratic_soft_max = null; /** * Constructor. diff --git a/Optimization/src/V1/Vehicle/LoadLimit.php b/Optimization/src/V1/Vehicle/LoadLimit.php index 3b0c60192d79..689c39958ffb 100644 --- a/Optimization/src/V1/Vehicle/LoadLimit.php +++ b/Optimization/src/V1/Vehicle/LoadLimit.php @@ -22,14 +22,14 @@ class LoadLimit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 max_load = 1; */ - private $max_load = null; + protected $max_load = null; /** * A soft limit of the load. See * [cost_per_unit_above_soft_max][google.cloud.optimization.v1.Vehicle.LoadLimit.cost_per_unit_above_soft_max]. * * Generated from protobuf field int64 soft_max_load = 2; */ - private $soft_max_load = 0; + protected $soft_max_load = 0; /** * If the load ever exceeds * [soft_max_load][google.cloud.optimization.v1.Vehicle.LoadLimit.soft_max_load] @@ -42,19 +42,19 @@ class LoadLimit extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double cost_per_unit_above_soft_max = 3; */ - private $cost_per_unit_above_soft_max = 0.0; + protected $cost_per_unit_above_soft_max = 0.0; /** * The acceptable load interval of the vehicle at the start of the route. * * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.LoadLimit.Interval start_load_interval = 4; */ - private $start_load_interval = null; + protected $start_load_interval = null; /** * The acceptable load interval of the vehicle at the end of the route. * * Generated from protobuf field .google.cloud.optimization.v1.Vehicle.LoadLimit.Interval end_load_interval = 5; */ - private $end_load_interval = null; + protected $end_load_interval = null; /** * Constructor. diff --git a/Optimization/src/V1/Vehicle/LoadLimit/Interval.php b/Optimization/src/V1/Vehicle/LoadLimit/Interval.php index 087a0c1b9842..68ade4c77afe 100644 --- a/Optimization/src/V1/Vehicle/LoadLimit/Interval.php +++ b/Optimization/src/V1/Vehicle/LoadLimit/Interval.php @@ -24,7 +24,7 @@ class Interval extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 min = 1; */ - private $min = 0; + protected $min = 0; /** * A maximum acceptable load. Must be ≥ 0. If unspecified, the maximum * load is unrestricted by this message. @@ -35,7 +35,7 @@ class Interval extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 max = 2; */ - private $max = null; + protected $max = null; /** * Constructor. diff --git a/Optimization/src/V1/Waypoint.php b/Optimization/src/V1/Waypoint.php index 40df3e8a163d..3c51fbabc2fe 100644 --- a/Optimization/src/V1/Waypoint.php +++ b/Optimization/src/V1/Waypoint.php @@ -26,7 +26,7 @@ class Waypoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool side_of_road = 3; */ - private $side_of_road = false; + protected $side_of_road = false; protected $location_type; /** diff --git a/Optimization/tests/Unit/V1/Client/FleetRoutingClientTest.php b/Optimization/tests/Unit/V1/Client/FleetRoutingClientTest.php index 1b87ad9a0077..049de54e9641 100644 --- a/Optimization/tests/Unit/V1/Client/FleetRoutingClientTest.php +++ b/Optimization/tests/Unit/V1/Client/FleetRoutingClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return FleetRoutingClient */ @@ -98,9 +100,7 @@ public function batchOptimizeToursTest() // Mock request $parent = 'parent-995424086'; $modelConfigs = []; - $request = (new BatchOptimizeToursRequest()) - ->setParent($parent) - ->setModelConfigs($modelConfigs); + $request = (new BatchOptimizeToursRequest())->setParent($parent)->setModelConfigs($modelConfigs); $response = $gapicClient->batchOptimizeTours($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -158,19 +158,20 @@ public function batchOptimizeToursExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $parent = 'parent-995424086'; $modelConfigs = []; - $request = (new BatchOptimizeToursRequest()) - ->setParent($parent) - ->setModelConfigs($modelConfigs); + $request = (new BatchOptimizeToursRequest())->setParent($parent)->setModelConfigs($modelConfigs); $response = $gapicClient->batchOptimizeTours($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -203,15 +204,14 @@ public function optimizeToursTest() $this->assertTrue($transport->isExhausted()); // Mock response $requestLabel = 'requestLabel1739091268'; - $totalCost = -7.0589032E7; + $totalCost = -7.0589032e7; $expectedResponse = new OptimizeToursResponse(); $expectedResponse->setRequestLabel($requestLabel); $expectedResponse->setTotalCost($totalCost); $transport->addResponse($expectedResponse); // Mock request $parent = 'parent-995424086'; - $request = (new OptimizeToursRequest()) - ->setParent($parent); + $request = (new OptimizeToursRequest())->setParent($parent); $response = $gapicClient->optimizeTours($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -235,17 +235,19 @@ public function optimizeToursExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $parent = 'parent-995424086'; - $request = (new OptimizeToursRequest()) - ->setParent($parent); + $request = (new OptimizeToursRequest())->setParent($parent); try { $gapicClient->optimizeTours($request); // If the $gapicClient method call did not throw, fail the test @@ -291,9 +293,7 @@ public function batchOptimizeToursAsyncTest() // Mock request $parent = 'parent-995424086'; $modelConfigs = []; - $request = (new BatchOptimizeToursRequest()) - ->setParent($parent) - ->setModelConfigs($modelConfigs); + $request = (new BatchOptimizeToursRequest())->setParent($parent)->setModelConfigs($modelConfigs); $response = $gapicClient->batchOptimizeToursAsync($request)->wait(); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); diff --git a/Optimization/tests/Unit/V1/FleetRoutingClientTest.php b/Optimization/tests/Unit/V1/FleetRoutingClientTest.php deleted file mode 100644 index 5afac3e60e43..000000000000 --- a/Optimization/tests/Unit/V1/FleetRoutingClientTest.php +++ /dev/null @@ -1,249 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return FleetRoutingClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new FleetRoutingClient($options); - } - - /** @test */ - public function batchOptimizeToursTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/batchOptimizeToursTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new BatchOptimizeToursResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/batchOptimizeToursTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $parent = 'parent-995424086'; - $modelConfigs = []; - $response = $gapicClient->batchOptimizeTours($parent, $modelConfigs); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.optimization.v1.FleetRouting/BatchOptimizeTours', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($parent, $actualValue); - $actualValue = $actualApiRequestObject->getModelConfigs(); - $this->assertProtobufEquals($modelConfigs, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/batchOptimizeToursTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function batchOptimizeToursExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/batchOptimizeToursTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $parent = 'parent-995424086'; - $modelConfigs = []; - $response = $gapicClient->batchOptimizeTours($parent, $modelConfigs); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/batchOptimizeToursTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function optimizeToursTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $requestLabel = 'requestLabel1739091268'; - $totalCost = -7.0589032E7; - $expectedResponse = new OptimizeToursResponse(); - $expectedResponse->setRequestLabel($requestLabel); - $expectedResponse->setTotalCost($totalCost); - $transport->addResponse($expectedResponse); - // Mock request - $parent = 'parent-995424086'; - $response = $gapicClient->optimizeTours($parent); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.optimization.v1.FleetRouting/OptimizeTours', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($parent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function optimizeToursExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $parent = 'parent-995424086'; - try { - $gapicClient->optimizeTours($parent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -}